mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2025-05-29 15:05:09 +02:00
37 lines
601 B
C
37 lines
601 B
C
#include <stdio.h>
|
|
#include "../stdio_p.h"
|
|
#include "../../stdlib/stdlib_p.h"
|
|
|
|
void __scanf_start(struct __scanf_input *__in)
|
|
{
|
|
|
|
if(__in->fp)
|
|
__in->buffer = fgetc(__in->fp);
|
|
else {
|
|
__in->buffer = *__in->str;
|
|
__in->str += (__in->buffer != 0);
|
|
}
|
|
}
|
|
|
|
int __scanf_fetch(struct __scanf_input *__in)
|
|
{
|
|
if(__in->fp)
|
|
return fgetc(__in->fp);
|
|
|
|
int c = *__in->str;
|
|
if(c == 0)
|
|
return EOF;
|
|
__in->str++;
|
|
return c;
|
|
}
|
|
|
|
void __scanf_end(struct __scanf_input *__in)
|
|
{
|
|
if(__in->buffer == EOF)
|
|
return;
|
|
|
|
if(__in->fp)
|
|
ungetc(__in->buffer, __in->fp);
|
|
else
|
|
__in->str--;
|
|
}
|