From 8d57beeab10d2afd72e2e3bc6b1ad4695b791955 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 23 Jan 1997 04:24:20 +0000 Subject: update from main archive 970121 Thu Jan 23 04:06:42 1997 Ulrich Drepper * Make-dist (.PHONY: dist): Remove duplicate declaration. (README): Depend on version.h not version.c. * Makefile (README): Depend on version.h not version.c. * Makeconfig (inst_libdir, inst_slibdir, inst_includedir, inst_datadir, inst_zonedir, inst_localedir, inst_i18ndir, inst_bindir, inst_sbindir, inst_infodir, inst_sysconfdir): New variables. Same as variable withough inst_ but prepended with $(install_root). (localtime-time): Use $(inst_sysconfdir) not $(sysconfdir). * Makefile (install-others): Use $(inst_includedir). (gnu/stabs.h, gnu/lib-names.h): Use $(inst_includedir). * Makerules (tons of install rules): Use inst_% variables. * elf/Makefile: Likewise. * hurd/Makefile: Likewise. * intl/Makefile: Likewise. * manual/Makefile: Likewise. * po/Makefile: Likewise. * sunrpc/Makefile: Likewise. * sysdeps/mach/hurd/Makefile: Likewise. * sysdeps/standalone/i386/force_cpu386/Makefile: Likewise. * time/Makefile: Likewise. * config.make.in: Revert patch from Sat Jan 18 22:15:26 1997, leave install_root in place. * gnu-versions.h (_GNU_GETOPT_INTERFACE_VERSION): Define to 2. * posix/getopt.c (GETOPT_INTERFACE_VERSION): Define to 2. * posix/getopt1.c (GETOPT_INTERFACE_VERSION): Define to 2. * elf/Makefile [yes==$(has-ldconfig)]: Correct dependencies of ldconfig. (CFLAGS-dl-load.c): New variable, avoid gcc warning. * sysdeps/mach/hurd/configure.in: Add _LIBC_REENTRENT to DEFINES. * sysdeps/mach/hurd/getdents.c: Update copyright. De-ANSI-declfy. * sysdeps/stub/getdents.c: Likewise. Correct return value. * sysdeps/unix/getdents.c: Likewise. * sysdeps/unix/sysv/getdents.c: Likewise. * sysdeps/unix/readdir.c: Update copyright. * sysdeps/unix/bsd/sony/newsos4/Makefile: Correct ifeq arguments. * sysdeps/unix/bsd/sun/sunos4/Makefile: Likewise. * sysdeps/unix/sysv/Makefile: Likewise. * sysdeps/unix/sysv/linux/Makefile: Likewise. * sysdeps/unix/sysv/linux/alpha/Makefile: Likewise. * sysdeps/unix/sysv/linux/i386/Makefile: Likewise. * sysdeps/unix/sysv/linux/Dist: Don't distribute kernel_termios.h, but sys/kernel_termios.h. * sysdeps/unix/sysv/linux/alpha/Dist: Likewise. * sysdeps/unix/sysv/linux/Makefile [$(subdir)==termios] (sysdep_headers): Add sys/kernel_termios.h. * sysdeps/unix/sysv/linux/kernel_termios.h: Moved to... * sysdeps/unix/sysv/linux/sys/kernel_termios.h: ...here. * sysdeps/unix/sysv/linux/sys/tcgetattr.c: Use __kernel_termios and __KERNEL_NCCS instead of kernel_termios and KERNEL_NCCS resp. * sysdeps/unix/sysv/linux/alpha/ioctls.h: New file. * sysdeps/unix/sysv/linux/getdents.c: Correct problems with alignment. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove getdents. Reported by Eirik Fuller . * time/Banner: Removed. Wrong and unnecessary information. It's now in... * time/README: New file. * time/Makefile (distribute): Remove Banner, add README. Wed Jan 22 13:19:56 1997 Richard Henderson * sysdeps/unix/sysv/linux/alpha/ioperm.c (platforms): Add Sable. (init_iosys): Recognize /etc/alpha_systype as a four-tuple for the purpose of supporting brand new systems. (*): The type of iosys variables should be iosys_t. 1997-01-22 Paul Eggert * strftime.c (_strftime_copytm): New function, to work around Solaris 2.5 tzset bug. Wed Jan 22 23:05:14 1997 Ulrich Drepper * sysdeps/mach/hurd/vdprintf.c: Complete de-ANSI-declfication. * sysdeps/posix/pipestream.c (writedecl): Fix typo. Reported by Marcus G. Daniels . Wed Jan 22 13:58:56 1997 Andreas Jaeger * elf/Makefile (CFLAGS-dl-load.c): New Variable to keep gcc silent since name_copy is initialized. Wed Jan 22 16:58:12 1997 Ulrich Drepper * stdio-common/Makefile (tests): Remove scanf11. * stdio-common/scanf11.c: Removed. * stdio-common/vfscanf.c Revert patch of Thu Jan 16 23:39:25 1997. Although the Corrigendum 1 describes the result as implemented the even more recent Amendement 1 seconds the position of ISO C:1990 where the %n directive has no effect on the assignment count. * stdio-common/bug10.c: Likewise. * stdio-common/scanf1.c: Likewise. * stdio-common/scanf3.c: Likewise. * stdio-common/scanf10.c: Likewise. * stdio-common/tstdiomisc.c: Likewise. * new-malloc/obstack.h: Don't define malloc using bcopy if malloc is not available. This leads to problems since bcopy does not return a value. Instead define _obstack_memcpy based on memcpy or bcopy. This name isn't used outside obstack.h and so no problems from using the memcpy function in a file including obstack.h can result. Reported by Martin Trapp . Tue Jan 21 18:35:55 1997 Andreas Schwab * misc/regexp.h (compile): Fix typos. Tue Jan 21 01:01:59 1997 Andreas Schwab * sysdeps/unix/sysv/linux/sys/procfs.h (struct elf_prpsinfo): Fix type of pr_{pid,ppid,pgrp,sid} fields. * sysdeps/unix/sysv/linux/alpha/sys/procfs.h (struct elf_prpsinfo): Likewise. --- stdio-common/Makefile | 3 +-- stdio-common/bug10.c | 2 +- stdio-common/scanf1.c | 2 +- stdio-common/scanf10.c | 2 +- stdio-common/scanf3.c | 4 ++-- stdio-common/tstdiomisc.c | 2 +- stdio-common/vfscanf.c | 28 ++++++++++++++++++++++++++++ 7 files changed, 35 insertions(+), 8 deletions(-) (limited to 'stdio-common') diff --git a/stdio-common/Makefile b/stdio-common/Makefile index e7c1cb8..814374b 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -43,8 +43,7 @@ tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \ xbug errnobug \ bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 \ tfformat tiformat tstdiomisc \ - scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 \ - scanf11 + scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 include ../Rules diff --git a/stdio-common/bug10.c b/stdio-common/bug10.c index 5e8ae25..3e15526 100644 --- a/stdio-common/bug10.c +++ b/stdio-common/bug10.c @@ -14,7 +14,7 @@ main (int arc, char *argv) printf("Result of sscanf = %d\n", res); printf("Scanned format %%u = %u\n", val); printf("Possibly scanned format %%n = %d\n", n); - result |= res != 2 || val != 111 || n != 3; + result |= res != 1 || val != 111 || n != 3; result |= sscanf ("", " %n", &n) == EOF; diff --git a/stdio-common/scanf1.c b/stdio-common/scanf1.c index 58c78c2..be6d63e 100644 --- a/stdio-common/scanf1.c +++ b/stdio-common/scanf1.c @@ -9,7 +9,7 @@ main (int argc, char *argv[]) n = i = r = -1; r = sscanf ("1234:567", "%d%n", &i, &n); printf ("%d %d %d\n", r, n, i); - if (r != 2 || i != 1234 || n != 4) + if (r != 1 || i != 1234 || n != 4) abort (); return 0; } diff --git a/stdio-common/scanf10.c b/stdio-common/scanf10.c index 27a5e66..f896137 100644 --- a/stdio-common/scanf10.c +++ b/stdio-common/scanf10.c @@ -11,5 +11,5 @@ main (int argc, char *argv[]) printf ("retc=%d a=%d b=%d\n", retc, a, b); - return retc == 2 && a == 6 && b == 12 ? 0 : 1; + return retc == -1 && a == 6 && b == 12 ? 0 : 1; } diff --git a/stdio-common/scanf3.c b/stdio-common/scanf3.c index 5bfa80b..33495cc 100644 --- a/stdio-common/scanf3.c +++ b/stdio-common/scanf3.c @@ -13,7 +13,7 @@ main(int arc, char *argv[]) printf("Result of sscanf = %d\n", res); printf("Scanned format %%u = %u\n", val); printf("Possibly scanned format %%n = %d\n", n); - if (n != 3 || val != 111 || res != 2) + if (n != 3 || val != 111 || res != 1) abort (); val = n = -1; @@ -21,7 +21,7 @@ main(int arc, char *argv[]) printf("Result of sscanf = %d\n", res); printf("Scanned format %%u = %u\n", val); printf("Possibly scanned format %%n = %d\n", n); - if (n != 3 || val != 111 || res != 2) + if (n != 3 || val != 111 || res != 1) abort (); return 0; diff --git a/stdio-common/tstdiomisc.c b/stdio-common/tstdiomisc.c index dbce623..8dac4f2 100644 --- a/stdio-common/tstdiomisc.c +++ b/stdio-common/tstdiomisc.c @@ -27,7 +27,7 @@ t2 (void) SCAN ("12345", "%ld", N, 1, 12345); SCAN ("12345", "%llllld", N, 0, -1); SCAN ("12345", "%LLLLLd", N, 0, -1); - SCAN ("test ", "%*s%n", n, 1, 4); + SCAN ("test ", "%*s%n", n, 0, 4); SCAN ("test ", "%2*s%n", n, 0, -1); SCAN ("12 ", "%l2d", n, 0, -1); SCAN ("12 ", "%2ld", N, 1, 12); diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index ef0dbee..f201c46 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -462,7 +462,35 @@ __vfscanf (FILE *s, const char *format, va_list argptr) *ARG (short int *) = read_in; else *ARG (int *) = read_in; + +#ifdef NO_BUG_IN_ISO_C_CORRIGENDUM_1 + /* We have a severe problem here. The ISO C standard + contradicts itself in explaining the effect of the %n + format in `scanf'. While in ISO C:1990 and the ISO C + Amendement 1:1995 the result is described as + + Execution of a %n directive does not effect the + assignment count returned at the completion of + execution of the f(w)scanf function. + + in ISO C Corrigendum 1:1994 the following was added: + + Subclause 7.9.6.2 + Add the following fourth example: + In: + #include + int d1, d2, n1, n2, i; + i = sscanf("123", "%d%n%n%d", &d1, &n1, &n2, &d2); + the value 123 is assigned to d1 and the value3 to n1. + Because %n can never get an input failure the value + of 3 is also assigned to n2. The value of d2 is not + affected. The value 3 is assigned to i. + + We go for now with the historically correct code fro ISO C, + i.e., we don't count the %n assignments. When it ever + should proof to be wrong just remove the #ifdef above. */ ++done; +#endif } break; -- cgit v1.1