diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-02-08 18:42:39 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-02-08 18:42:39 -0500 |
commit | 7ef8a7379f7f7d09e71ccae2a0b688c3cd80423f (patch) | |
tree | 092ab0aed1769117fd7b28b8592f6f96b0e0d5af /src/stdio/ungetc.c | |
parent | 6acf19370e8adff79cd83b257d3f04aeaf2a59dd (diff) |
merge sources into single tree
Diffstat (limited to 'src/stdio/ungetc.c')
-rw-r--r-- | src/stdio/ungetc.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/stdio/ungetc.c b/src/stdio/ungetc.c new file mode 100644 index 00000000..1c32ac1f --- /dev/null +++ b/src/stdio/ungetc.c @@ -0,0 +1,37 @@ +#include <stdio.h> +#include "nonstd/io.h" + +/** push a character back into an input stream **/ +int ungetc(int c, FILE *stream) +{ + (void)c; (void)stream; + /* TODO */ + /* + RETURN_SUCCESS(ARGUMENT(c)); + RETURN_FAILURE(CONSTANT(EOF)); + */ + return EOF; +} + +/*** +pushes the characer ARGUMENT(c) (converted to an +type(unsigned char)) into the input stream ARGUMENT(stream). Future function calls +that read input will return the pushed character. Calls to seeking functions +(e.g. FUNCTION(fseek), FUNCTION(fsetpos), or FUNCTION(rewind)) will discard pushed characters. +The file associated with ARGUMENT(stream) is unchanged. + +At least one character can be pushed back. Multiple calls to THIS() without +intervening read operations may fail. + +If macro(EOF) is specified for ARGUMENT(c), THIS() fails and the input stream +is unchagned. + +A successfull call clears the end-of-file indicator for ARGUMENT(stream). The file +position indicator is decremented. + +Calling THIS() on a binary stream when the file position indicator is zero +is obsolete in ISO/IEC 9899:1999. +***/ +/* +STDC(1) +*/ |