From 42320e822348f2f85ac193804097059b380127c3 Mon Sep 17 00:00:00 2001 From: thorpej Date: Fri, 24 May 2002 22:17:20 +0000 Subject: [PATCH] * Move the prototype of __svfscanf from to libc/stdio/local.h. * Add prototype for vfscanf to . * Remove #define of vfscanf to __svfscanf from . * Include local.h in libc files which need __svfscanf. * Add vfscanf weak alias to __svfscanf. Fixes standards/16997. NOTE: libc minor not bumped -- ride on the bump to 12.84 made by itojun today. --- include/stdio.h | 15 ++++----------- lib/libc/stdio/fscanf.c | 6 ++++-- lib/libc/stdio/local.h | 5 ++++- lib/libc/stdio/scanf.c | 6 ++++-- lib/libc/stdio/vfscanf.c | 13 +++++++++++-- lib/libc/stdio/vscanf.c | 6 ++++-- 6 files changed, 31 insertions(+), 20 deletions(-) diff --git a/include/stdio.h b/include/stdio.h index ee51e89f7147..758d7ed1c08e 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -1,4 +1,4 @@ -/* $NetBSD: stdio.h,v 1.44 2002/05/24 21:07:44 thorpej Exp $ */ +/* $NetBSD: stdio.h,v 1.45 2002/05/24 22:17:20 thorpej Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -371,6 +371,9 @@ int vasprintf __P((char ** __restrict, const char * __restrict, __attribute__((__format__(__printf__, 2, 0))); int vscanf __P((const char * __restrict, _BSD_VA_LIST_)) __attribute__((__format__(__scanf__, 1, 0))); +int vfscanf __P((FILE * __restrict, const char * __restrict, + _BSD_VA_LIST_)) + __attribute__((__format__(__scanf__, 2, 0))); int vsscanf __P((const char * __restrict, const char * __restrict, _BSD_VA_LIST_)) __attribute__((__format__(__scanf__, 2, 0))); @@ -378,13 +381,6 @@ __const char *fmtcheck __P((const char *, const char *)) __attribute__((__format_arg__(2))); __END_DECLS -/* - * This is a #define because the function is used internally and - * (unlike vfscanf) the name __svfscanf is guaranteed not to collide - * with a user function when _ANSI_SOURCE or _POSIX_SOURCE is defined. - */ -#define vfscanf(fp, fmt, va) __svfscanf((fp), (fmt), (va)) - /* * Stdio function-access interface. */ @@ -404,9 +400,6 @@ __END_DECLS */ __BEGIN_DECLS int __srget __P((FILE *)); -int __svfscanf __P((FILE * __restrict, const char * __restrict, - _BSD_VA_LIST_)) - __attribute__((__format__(__scanf__, 2, 0))); int __swbuf __P((int, FILE *)); __END_DECLS diff --git a/lib/libc/stdio/fscanf.c b/lib/libc/stdio/fscanf.c index 33ef68ef2384..9a24cbd34238 100644 --- a/lib/libc/stdio/fscanf.c +++ b/lib/libc/stdio/fscanf.c @@ -1,4 +1,4 @@ -/* $NetBSD: fscanf.c,v 1.8 1999/09/20 04:39:28 lukem Exp $ */ +/* $NetBSD: fscanf.c,v 1.9 2002/05/24 22:17:20 thorpej Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)fscanf.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: fscanf.c,v 1.8 1999/09/20 04:39:28 lukem Exp $"); +__RCSID("$NetBSD: fscanf.c,v 1.9 2002/05/24 22:17:20 thorpej Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -54,6 +54,8 @@ __RCSID("$NetBSD: fscanf.c,v 1.8 1999/09/20 04:39:28 lukem Exp $"); #include #endif +#include "local.h" + int #if __STDC__ fscanf(FILE *fp, char const *fmt, ...) { diff --git a/lib/libc/stdio/local.h b/lib/libc/stdio/local.h index 312d301ce507..04e13eff9f50 100644 --- a/lib/libc/stdio/local.h +++ b/lib/libc/stdio/local.h @@ -1,4 +1,4 @@ -/* $NetBSD: local.h,v 1.10 2001/12/07 11:47:43 yamt Exp $ */ +/* $NetBSD: local.h,v 1.11 2002/05/24 22:17:20 thorpej Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -62,6 +62,9 @@ extern int _fwalk __P((int (*)(FILE *))); extern char *_mktemp __P((char *)); extern int __swsetup __P((FILE *)); extern int __sflags __P((const char *, int *)); +extern int __svfscanf __P((FILE * __restrict, const char * __restrict, + _BSD_VA_LIST_)) + __attribute__((__format__(__scanf__, 2, 0))); extern int __sdidinit; diff --git a/lib/libc/stdio/scanf.c b/lib/libc/stdio/scanf.c index 37be2b6c32a2..dd88c6c53824 100644 --- a/lib/libc/stdio/scanf.c +++ b/lib/libc/stdio/scanf.c @@ -1,4 +1,4 @@ -/* $NetBSD: scanf.c,v 1.8 1999/09/20 04:39:32 lukem Exp $ */ +/* $NetBSD: scanf.c,v 1.9 2002/05/24 22:17:20 thorpej Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)scanf.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: scanf.c,v 1.8 1999/09/20 04:39:32 lukem Exp $"); +__RCSID("$NetBSD: scanf.c,v 1.9 2002/05/24 22:17:20 thorpej Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -54,6 +54,8 @@ __RCSID("$NetBSD: scanf.c,v 1.8 1999/09/20 04:39:32 lukem Exp $"); #include #endif +#include "local.h" + int #if __STDC__ scanf(char const *fmt, ...) diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c index 13df2ef5f246..631f5b20fa82 100644 --- a/lib/libc/stdio/vfscanf.c +++ b/lib/libc/stdio/vfscanf.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfscanf.c,v 1.30 2001/12/07 11:47:45 yamt Exp $ */ +/* $NetBSD: vfscanf.c,v 1.31 2002/05/24 22:17:20 thorpej Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: vfscanf.c,v 1.30 2001/12/07 11:47:45 yamt Exp $"); +__RCSID("$NetBSD: vfscanf.c,v 1.31 2002/05/24 22:17:20 thorpej Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -67,6 +67,15 @@ __RCSID("$NetBSD: vfscanf.c,v 1.30 2001/12/07 11:47:45 yamt Exp $"); #include "floatio.h" #endif +/* + * Provide an external name for vfscanf. Note, we don't use the normal + * namespace.h method; stdio routines explicitly use the internal name + * __svfscanf. + */ +#ifdef __weak_alias +__weak_alias(vfscanf,__svfscanf) +#endif + #define BUF 513 /* Maximum length of numeric string. */ /* diff --git a/lib/libc/stdio/vscanf.c b/lib/libc/stdio/vscanf.c index e76c6d63795d..4e85ab479eb4 100644 --- a/lib/libc/stdio/vscanf.c +++ b/lib/libc/stdio/vscanf.c @@ -1,4 +1,4 @@ -/* $NetBSD: vscanf.c,v 1.9 1999/09/20 04:39:34 lukem Exp $ */ +/* $NetBSD: vscanf.c,v 1.10 2002/05/24 22:17:21 thorpej Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)vscanf.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: vscanf.c,v 1.9 1999/09/20 04:39:34 lukem Exp $"); +__RCSID("$NetBSD: vscanf.c,v 1.10 2002/05/24 22:17:21 thorpej Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -49,6 +49,8 @@ __RCSID("$NetBSD: vscanf.c,v 1.9 1999/09/20 04:39:34 lukem Exp $"); #include #include +#include "local.h" + int vscanf(fmt, ap) const char *fmt;