Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions libstdduck/fileops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,12 @@ extern "C" int _stdduck_peek() {
return stdin_pos == stdin_end ? EOF : *stdin_pos;
}

// TODO: Support ungetc
// TODO: Fully support ungetc
int ungetc(int c, FILE *f) {
return EOF;
if (f==stdin && stdin_pos != stdin_start && stdin_pos[-1] == c) {
stdin_pos--; return c;
} else {
return EOF;
}
}