mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 00:02:28 +00:00
Further improve scanf
This commit is contained in:
parent
6ef2a471e4
commit
7e08a97cea
3 changed files with 76 additions and 37 deletions
|
@ -26,7 +26,9 @@
|
|||
int ungetc_unlocked(int c, FILE *f) {
|
||||
if (c == -1) return -1;
|
||||
if (f->beg) {
|
||||
f->buf[--f->beg] = c;
|
||||
if (c != f->buf[--f->beg]) {
|
||||
f->buf[f->beg] = c;
|
||||
}
|
||||
} else if (f->end < f->size) {
|
||||
memmove(f->buf + 1, f->buf, f->end++);
|
||||
f->buf[0] = c;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue