diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2005-05-11 18:39:20 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2005-05-11 18:39:20 +0000 |
commit | 8d8d7a1eeeb3509c69bb27b3d97c04a887175599 (patch) | |
tree | 3a82f7647a16b601fe6f2e67afec249e4087456d | |
parent | 63cdea24dc015481c84d87a03b0a235ba64d1cdb (diff) |
let vfscanf be a real function. Use a weak_alias on systems where this
is feasible.
Okay millert@
There's a major libc bump coming that is going to cover this as well...
-rw-r--r-- | include/stdio.h | 13 | ||||
-rw-r--r-- | lib/libc/stdio/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libc/stdio/__svfscanf.c | 26 | ||||
-rw-r--r-- | lib/libc/stdio/scanf.c | 4 | ||||
-rw-r--r-- | lib/libc/stdio/sscanf.c | 4 | ||||
-rw-r--r-- | lib/libc/stdio/vfscanf.c | 8 | ||||
-rw-r--r-- | lib/libc/stdio/vscanf.c | 4 | ||||
-rw-r--r-- | lib/libc/stdio/vsscanf.c | 4 |
8 files changed, 46 insertions, 21 deletions
diff --git a/include/stdio.h b/include/stdio.h index 197d972dac0..8329e00d298 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stdio.h,v 1.31 2005/04/30 09:25:17 espie Exp $ */ +/* $OpenBSD: stdio.h,v 1.32 2005/05/11 18:39:19 espie Exp $ */ /* $NetBSD: stdio.h,v 1.18 1996/04/25 18:29:21 jtc Exp $ */ /*- @@ -327,16 +327,12 @@ int vscanf(const char *, _BSD_VA_LIST_) int vsscanf(const char *, const char *, _BSD_VA_LIST_) __attribute__((__format__ (scanf, 2, 0))) __attribute__((__nonnull__ (2))); +int vfscanf(FILE *, const char *, _BSD_VA_LIST_) + __attribute__((__format__ (scanf, 2, 0))) + __attribute__((__nonnull__ (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 __svfscanf - -/* * Stdio function-access interface. */ __BEGIN_DECLS @@ -355,7 +351,6 @@ __END_DECLS */ __BEGIN_DECLS int __srget(FILE *); -int __svfscanf(FILE *, const char *, _BSD_VA_LIST_); int __swbuf(int, FILE *); __END_DECLS diff --git a/lib/libc/stdio/Makefile.inc b/lib/libc/stdio/Makefile.inc index 44f673a3973..1c2639bd036 100644 --- a/lib/libc/stdio/Makefile.inc +++ b/lib/libc/stdio/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.11 2000/03/28 22:42:03 deraadt Exp $ +# $OpenBSD: Makefile.inc,v 1.12 2005/05/11 18:39:19 espie Exp $ # stdio sources .PATH: ${LIBCSRCDIR}/stdio @@ -14,7 +14,7 @@ SRCS+= asprintf.c clrerr.c fclose.c fdopen.c feof.c ferror.c fflush.c fgetc.c \ scanf.c setbuf.c setbuffer.c setvbuf.c snprintf.c sprintf.c sscanf.c \ stdio.c tempnam.c tmpfile.c tmpnam.c ungetc.c vasprintf.c vfprintf.c \ vfscanf.c vprintf.c vscanf.c vsnprintf.c vsprintf.c vsscanf.c \ - wbuf.c wsetup.c flockfile.c + wbuf.c wsetup.c flockfile.c __svfscanf.c MAN+= fclose.3 ferror.3 fflush.3 fgetln.3 fgets.3 fopen.3 fputs.3 \ fread.3 fseek.3 funopen.3 getc.3 mktemp.3 perror.3 printf.3 putc.3 \ diff --git a/lib/libc/stdio/__svfscanf.c b/lib/libc/stdio/__svfscanf.c new file mode 100644 index 00000000000..3040fba4c72 --- /dev/null +++ b/lib/libc/stdio/__svfscanf.c @@ -0,0 +1,26 @@ +/* $OpenBSD: __svfscanf.c,v 1.1 2005/05/11 18:39:19 espie Exp $ */ + +/* + * Copyright (c) 2005 Marc Espie <espie@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/cdefs.h> + +#ifdef __indr_reference +__indr_reference(vfscanf, __svfscanf); +#else +# define VFSCANF __svfscanf +# include "vfscanf.c" +#endif diff --git a/lib/libc/stdio/scanf.c b/lib/libc/stdio/scanf.c index 05393c172c1..061ad3489ad 100644 --- a/lib/libc/stdio/scanf.c +++ b/lib/libc/stdio/scanf.c @@ -31,7 +31,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: scanf.c,v 1.7 2005/03/31 18:36:29 pat Exp $"; +static char rcsid[] = "$OpenBSD: scanf.c,v 1.8 2005/05/11 18:39:19 espie Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> @@ -44,7 +44,7 @@ scanf(const char *fmt, ...) va_list ap; va_start(ap, fmt); - ret = __svfscanf(stdin, fmt, ap); + ret = vfscanf(stdin, fmt, ap); va_end(ap); return (ret); } diff --git a/lib/libc/stdio/sscanf.c b/lib/libc/stdio/sscanf.c index 0104e941e03..e8fea3ee68c 100644 --- a/lib/libc/stdio/sscanf.c +++ b/lib/libc/stdio/sscanf.c @@ -31,7 +31,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: sscanf.c,v 1.9 2005/04/30 09:25:17 espie Exp $"; +static char rcsid[] = "$OpenBSD: sscanf.c,v 1.10 2005/05/11 18:39:19 espie Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> @@ -63,7 +63,7 @@ sscanf(const char *str, const char *fmt, ...) _UB(&f)._base = NULL; f._lb._base = NULL; va_start(ap, fmt); - ret = __svfscanf(&f, fmt, ap); + ret = vfscanf(&f, fmt, ap); va_end(ap); return (ret); } diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c index 27e8b575bca..2c0fc98ad6c 100644 --- a/lib/libc/stdio/vfscanf.c +++ b/lib/libc/stdio/vfscanf.c @@ -31,7 +31,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: vfscanf.c,v 1.11 2005/03/31 18:36:29 pat Exp $"; +static char rcsid[] = "$OpenBSD: vfscanf.c,v 1.12 2005/05/11 18:39:19 espie Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> @@ -85,11 +85,15 @@ static char rcsid[] = "$OpenBSD: vfscanf.c,v 1.11 2005/03/31 18:36:29 pat Exp $" static u_char *__sccl(char *, u_char *); +#if !defined(VFSCANF) +#define VFSCANF vfscanf +#endif + /* * vfscanf */ int -__svfscanf(FILE *fp, const char *fmt0, _BSD_VA_LIST_ ap) +VFSCANF(FILE *fp, const char *fmt0, _BSD_VA_LIST_ ap) { u_char *fmt = (u_char *)fmt0; int c; /* character from format, or conversion */ diff --git a/lib/libc/stdio/vscanf.c b/lib/libc/stdio/vscanf.c index 5c8b5379cbe..898acc339d0 100644 --- a/lib/libc/stdio/vscanf.c +++ b/lib/libc/stdio/vscanf.c @@ -31,7 +31,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: vscanf.c,v 1.5 2004/09/28 18:12:44 otto Exp $"; +static char rcsid[] = "$OpenBSD: vscanf.c,v 1.6 2005/05/11 18:39:19 espie Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> @@ -40,5 +40,5 @@ int vscanf(const char *fmt, _BSD_VA_LIST_ ap) { - return (__svfscanf(stdin, fmt, ap)); + return (vfscanf(stdin, fmt, ap)); } diff --git a/lib/libc/stdio/vsscanf.c b/lib/libc/stdio/vsscanf.c index 34b54cb7dea..a1585c622a0 100644 --- a/lib/libc/stdio/vsscanf.c +++ b/lib/libc/stdio/vsscanf.c @@ -31,7 +31,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: vsscanf.c,v 1.7 2005/04/30 09:25:17 espie Exp $"; +static char rcsid[] = "$OpenBSD: vsscanf.c,v 1.8 2005/05/11 18:39:19 espie Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> @@ -59,5 +59,5 @@ vsscanf(const char *str, const char *fmt, _BSD_VA_LIST_ ap) f._read = eofread; _UB(&f)._base = NULL; f._lb._base = NULL; - return (__svfscanf(&f, fmt, ap)); + return (vfscanf(&f, fmt, ap)); } |