diff options
author | Ulrich Drepper <drepper@redhat.com> | 2002-02-26 05:23:31 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2002-02-26 05:23:31 +0000 |
commit | b39d571990557cc5ab855794ff0d4d7876f4596b (patch) | |
tree | f5f6918e0520a86a5576cc393c39fabb1cb4e0eb /stdio-common/tst-ungetc.c | |
parent | 77fe0b9cd86ccba7349921082d886cbca613404c (diff) | |
download | glibc-b39d571990557cc5ab855794ff0d4d7876f4596b.zip glibc-b39d571990557cc5ab855794ff0d4d7876f4596b.tar.gz glibc-b39d571990557cc5ab855794ff0d4d7876f4596b.tar.bz2 |
Update.
2002-02-25 Jakub Jelinek <jakub@redhat.com>
* libio/iofopen.c (__fopen_maybe_mmap): Set the initial
position to fp->_offset if it is set.
* stdio-common/Makefile (tests): Add tst-fdopen.
* stdio-common/tst-fdopen.c: New test.
2002-02-25 Jakub Jelinek <jakub@redhat.com>
* libio/fileops.c (_IO_file_xsgetn_mmap): Handle reading from backup.
* stdio-common/tst-ungetc.c (main): Add another test.
Diffstat (limited to 'stdio-common/tst-ungetc.c')
-rw-r--r-- | stdio-common/tst-ungetc.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/stdio-common/tst-ungetc.c b/stdio-common/tst-ungetc.c index 08819b7..2cadf1c 100644 --- a/stdio-common/tst-ungetc.c +++ b/stdio-common/tst-ungetc.c @@ -18,6 +18,7 @@ main (int argc, char *argv[]) FILE *fp = NULL; int retval = 0; int c; + char buffer[64]; name = tmpnam (NULL); fp = fopen (name, "w"); @@ -40,6 +41,17 @@ main (int argc, char *argv[]) assert (feof (fp) == 0); assert (getc (fp) == c); assert (getc (fp) == EOF); + fclose (fp); + fp = NULL; + + fp = fopen (name, "r"); + assert (fp != NULL); + assert (getc (fp) == 'b'); + assert (getc (fp) == 'l'); + assert (ungetc ('b', fp) == 'b'); + assert (fread (buffer, 1, 64, fp) == 2); + assert (buffer[0] == 'b'); + assert (buffer[1] == 'a'); the_end: if (fp != NULL) |