From 1177c8babf74c7335c5f3bf09c45961bebeed6c6 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 12 Mar 1996 09:50:46 +0000 Subject: Tue Mar 12 04:42:01 1996 Roland McGrath * sysdeps/sparc/jmp_buf.h: Rewritten; use array of ints, not struct. * sysdeps/sparc/setjmp.S: Rewritten; store %fp value as well. * sysdeps/sparc/__longjmp.S: Rewritten; unwind frames one by one with `restore' until the target frame is hit. Sun Mar 10 20:29:40 1996 Andreas Schwab * sysdeps/unix/sysv/linux/sigsuspend.c: New file. * sysdeps/unix/sysv/linux/syscalls.list: Remove sigsuspend, add s_sigsuspend. Thu Mar 7 21:30:58 1996 Andreas Schwab * Makerules (+make-deps, sed-remove-objpfx): Quote periods on the left side of sed substitutions. Sun Mar 10 16:58:10 1996 Ulrich Drepper * stdio-common/printf_fp.c (hack_digit): __mpn_normal_size is not available anymore. Do it ourselves. * sysdeps/unix/sysv/linux/i386/fpu_control.h (_FPU_SETCW): Correct GCC `asm' syntax. * stdio-common/Makefile (tests): Add tst-ungetc. * stdio-common/tst-ungetc.c: New test from drepper. * stdio-common/tstscanf.c (main): New %[ test case from drepper. * sysdeps/libm-ieee754/s_scalbn.c (scalbn): Rename to __scalbn; somehow this was missed, though the weak alias is already there. --- stdio-common/tst-ungetc.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 stdio-common/tst-ungetc.c (limited to 'stdio-common/tst-ungetc.c') diff --git a/stdio-common/tst-ungetc.c b/stdio-common/tst-ungetc.c new file mode 100644 index 0000000..67c45d4 --- /dev/null +++ b/stdio-common/tst-ungetc.c @@ -0,0 +1,42 @@ +/* Test for ungetc bugs. */ + +#include + +#define assert(x) \ + if (!(x)) \ + { \ + fputs ("test failed: " #x "\n", stderr); \ + retval = 1; \ + goto the_end; \ + } + +int +main (int argc, char *argv[]) +{ + char *name; + FILE *fp = NULL; + int retval = 0; + int c; + + name = tmpnam (NULL); + fp = fopen (name, "w"); + assert (fp != NULL) + fputs ("bl", fp); + fclose (fp); + fp = NULL; + + fp = fopen (name, "r"); + assert (fp != NULL) + assert (getc (fp) != EOF); + assert ((c = getc (fp)) != EOF); + assert (getc (fp) == EOF); + assert (ungetc (c, fp) == c); + assert (feof (fp) == 0); + +the_end: + if (fp != NULL) + fclose (fp); + unlink (name); + + return retval; +} -- cgit v1.1