mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
parent
c3ed8d6c7f
commit
d769df3482
17 changed files with 102 additions and 155 deletions
|
@ -18,8 +18,12 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/stdio/stdio.h"
|
||||
|
||||
/**
|
||||
* Pushes 𝑐 back to stream.
|
||||
*/
|
||||
int ungetc(int c, FILE *f) {
|
||||
f->beg = (f->beg - 1) & (f->size - 1);
|
||||
f->buf[f->beg] = c;
|
||||
uint32_t i;
|
||||
if (c == -1) return c;
|
||||
if (f->beg) f->buf[--f->beg] = c;
|
||||
return c;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue