Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add scanf_l and wscanf_l families.
details: https://anonhg.NetBSD.org/src/rev/f1a3282dcb9c
branches: trunk
changeset: 786206:f1a3282dcb9c
user: joerg <joerg%NetBSD.org@localhost>
date: Fri Apr 19 23:32:16 2013 +0000
description:
Add scanf_l and wscanf_l families.
diffstat:
include/stdio.h | 17 +++++++-
include/wchar.h | 12 ++++-
lib/libc/include/namespace.h | 12 ++++-
lib/libc/stdio/fscanf.c | 20 ++++++++-
lib/libc/stdio/fwscanf.c | 22 ++++++++-
lib/libc/stdio/local.h | 10 ++-
lib/libc/stdio/scanf.c | 22 ++++++++-
lib/libc/stdio/sscanf.c | 42 ++++++++---------
lib/libc/stdio/swscanf.c | 22 ++++++++-
lib/libc/stdio/vfscanf.c | 98 ++++++++++++++++++++++++-------------------
lib/libc/stdio/vfwscanf.c | 96 +++++++++++++++++++++++++-----------------
lib/libc/stdio/vscanf.c | 17 ++++++-
lib/libc/stdio/vsscanf.c | 20 +++++++-
lib/libc/stdio/vswscanf.c | 29 +++++++++---
lib/libc/stdio/vwscanf.c | 15 +++++-
lib/libc/stdio/wscanf.c | 21 ++++++++-
16 files changed, 338 insertions(+), 137 deletions(-)
diffs (truncated from 1332 to 300 lines):
diff -r 64edaf47e220 -r f1a3282dcb9c include/stdio.h
--- a/include/stdio.h Fri Apr 19 23:28:47 2013 +0000
+++ b/include/stdio.h Fri Apr 19 23:32:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: stdio.h,v 1.84 2013/04/19 15:22:24 joerg Exp $ */
+/* $NetBSD: stdio.h,v 1.85 2013/04/19 23:32:16 joerg Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -559,6 +559,21 @@
int vsprintf_l(char * __restrict, locale_t, const char * __restrict,
__va_list) __printflike(3, 0);
#endif
+
+int fscanf_l(FILE * __restrict, locale_t, const char * __restrict, ...)
+ __scanflike(3, 4);
+int scanf_l(locale_t, const char * __restrict, ...)
+ __scanflike(2, 3);
+int sscanf_l(const char * __restrict, locale_t,
+ const char * __restrict, ...) __scanflike(3, 4);
+int vscanf_l(locale_t, const char * __restrict, __va_list)
+ __scanflike(2, 0);
+int vscanf_l(locale_t, const char * __restrict, __va_list)
+ __scanflike(2, 0);
+int vfscanf_l(FILE * __restrict, locale_t, const char * __restrict,
+ __va_list) __scanflike(3, 0);
+int vsscanf_l(const char * __restrict, locale_t, const char * __restrict,
+ __va_list) __scanflike(3, 0);
#endif
#if _FORTIFY_SOURCE > 0
diff -r 64edaf47e220 -r f1a3282dcb9c include/wchar.h
--- a/include/wchar.h Fri Apr 19 23:28:47 2013 +0000
+++ b/include/wchar.h Fri Apr 19 23:32:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wchar.h,v 1.35 2013/04/19 15:22:24 joerg Exp $ */
+/* $NetBSD: wchar.h,v 1.36 2013/04/19 23:32:16 joerg Exp $ */
/*-
* Copyright (c)1999 Citrus Project,
@@ -257,6 +257,16 @@
const wchar_t * __restrict, __va_list);
int vwprintf_l(locale_t, const wchar_t * __restrict, __va_list);
int wprintf_l(locale_t, const wchar_t * __restrict, ...);
+
+int fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...);
+int swscanf_l(const wchar_t * __restrict, locale_t, const wchar_t *
+ __restrict, ...);
+int wscanf_l(locale_t, const wchar_t * __restrict, ...);
+int vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict,
+ __va_list);
+int vswscanf_l(const wchar_t * __restrict, locale_t, const wchar_t * __restrict,
+ __va_list);
+int vwscanf_l(locale_t, const wchar_t * __restrict, __va_list);
#endif /* _NETBSD_SOURCE */
#endif /* !_WCHAR_H_ */
diff -r 64edaf47e220 -r f1a3282dcb9c lib/libc/include/namespace.h
--- a/lib/libc/include/namespace.h Fri Apr 19 23:28:47 2013 +0000
+++ b/lib/libc/include/namespace.h Fri Apr 19 23:32:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: namespace.h,v 1.163 2013/04/19 23:28:47 joerg Exp $ */
+/* $NetBSD: namespace.h,v 1.164 2013/04/19 23:32:16 joerg Exp $ */
/*-
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -290,6 +290,7 @@
#define freenetconfigent _freenetconfigent
#define freeaddrinfo _freeaddrinfo
#define freeifaddrs _freeifaddrs
+#define fscanf_l _fscanf_l
#define fstatvfs _fstatvfs
#define ftok _ftok
#define ftruncate _ftruncate
@@ -299,6 +300,7 @@
#define fts_read _fts_read
#define fts_set _fts_set
#define fwprintf_l _fwprintf_l
+#define fwscanf_l _fwscanf_l
#define gai_strerror _gai_strerror
#define get_myaddress _get_myaddress
#define getaddrinfo _getaddrinfo
@@ -550,6 +552,7 @@
#define rpcb_uaddr2taddr _rpcb_uaddr2taddr
#define rpcb_unset _rpcb_unset
#define scandir _scandir
+#define scanf_l _scanf_l
#define seed48 _seed48
#define seekdir _seekdir
#define select _select
@@ -604,6 +607,7 @@
#define sradixsort _sradixsort
#define srand48 _srand48
#define srandom _srandom
+#define sscanf_l _sscanf_l
#define statvfs(a, b) _statvfs(a, b)
#define strcasecmp _strcasecmp
#define strcoll_l _strcoll_l
@@ -654,6 +658,7 @@
#define svcudp_enablecache _svcudp_enablecache
#define sysarch _sys_sysarch
#define swprintf_l _swprintf_l
+#define swscanf_l _swscanf_l
#define sysctl _sysctl
#define sysctlbyname _sysctlbyname
#define sysctlgetmibinfo _sysctlgetmibinfo
@@ -708,11 +713,15 @@
#define vfprintf_l _vfprintf_l
#define vfwprintf_l _vfwprintf_l
#define vprintf_l _vprintf_l
+#define vscanf_l _vscanf_l
+#define vsscanf_l _vsscanf_l
+#define vswscanf_l _vswscanf_l
#define vsnprintf_l _vsnprintf_l
#define vsnprintf_ss _vsnprintf_ss
#define vsprintf_l _vsprintf_l
#define vswprintf_l _vswprintf_l
#define vwprintf_l _vwprintf_l
+#define vwscanf_l _vwscanf_l
#define vsyslog _vsyslog
#define vsyslog_r _vsyslog_r
#define vsyslog_ss _vsyslog_ss
@@ -737,6 +746,7 @@
#define wcwidth _wcwidth
#define wcwidth_l _wcwidth_l
#define wprintf_l _wprintf_l
+#define wscanf_l _wscanf_l
#define xdr_accepted_reply _xdr_accepted_reply
#define xdr_array _xdr_array
#define xdr_authunix_parms _xdr_authunix_parms
diff -r 64edaf47e220 -r f1a3282dcb9c lib/libc/stdio/fscanf.c
--- a/lib/libc/stdio/fscanf.c Fri Apr 19 23:28:47 2013 +0000
+++ b/lib/libc/stdio/fscanf.c Fri Apr 19 23:32:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fscanf.c,v 1.13 2012/03/15 18:22:30 christos Exp $ */
+/* $NetBSD: fscanf.c,v 1.14 2013/04/19 23:32:17 joerg Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,10 +37,12 @@
#if 0
static char sccsid[] = "@(#)fscanf.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: fscanf.c,v 1.13 2012/03/15 18:22:30 christos Exp $");
+__RCSID("$NetBSD: fscanf.c,v 1.14 2013/04/19 23:32:17 joerg Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
+#include "namespace.h"
+
#include <assert.h>
#include <errno.h>
#include <stdarg.h>
@@ -49,6 +51,8 @@
#include "reentrant.h"
#include "local.h"
+__weak_alias(fscanf_l, _fscanf_l)
+
int
fscanf(FILE *fp, char const *fmt, ...)
{
@@ -60,3 +64,15 @@
va_end(ap);
return ret;
}
+
+int
+fscanf_l(FILE *fp, locale_t loc, char const *fmt, ...)
+{
+ int ret;
+ va_list ap;
+
+ va_start(ap, fmt);
+ ret = __svfscanf_l(fp, loc, fmt, ap);
+ va_end(ap);
+ return ret;
+}
diff -r 64edaf47e220 -r f1a3282dcb9c lib/libc/stdio/fwscanf.c
--- a/lib/libc/stdio/fwscanf.c Fri Apr 19 23:28:47 2013 +0000
+++ b/lib/libc/stdio/fwscanf.c Fri Apr 19 23:32:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fwscanf.c,v 1.2 2012/03/15 18:22:30 christos Exp $ */
+/* $NetBSD: fwscanf.c,v 1.3 2013/04/19 23:32:17 joerg Exp $ */
/*-
* Copyright (c) 2002 Tim J. Robbins
@@ -31,14 +31,18 @@
#if 0
__FBSDID("$FreeBSD: src/lib/libc/stdio/fwscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $");
#else
-__RCSID("$NetBSD: fwscanf.c,v 1.2 2012/03/15 18:22:30 christos Exp $");
+__RCSID("$NetBSD: fwscanf.c,v 1.3 2013/04/19 23:32:17 joerg Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
+#include "namespace.h"
+
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
+__weak_alias(fwscanf_l, _fwscanf_l)
+
int
fwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, ...)
{
@@ -51,3 +55,17 @@
return r;
}
+
+int
+fwscanf_l(FILE * __restrict fp, locale_t loc, const wchar_t * __restrict fmt,
+ ...)
+{
+ va_list ap;
+ int r;
+
+ va_start(ap, fmt);
+ r = vfwscanf_l(fp, loc, fmt, ap);
+ va_end(ap);
+
+ return r;
+}
diff -r 64edaf47e220 -r f1a3282dcb9c lib/libc/stdio/local.h
--- a/lib/libc/stdio/local.h Fri Apr 19 23:28:47 2013 +0000
+++ b/lib/libc/stdio/local.h Fri Apr 19 23:32:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: local.h,v 1.35 2013/04/19 15:22:25 joerg Exp $ */
+/* $NetBSD: local.h,v 1.36 2013/04/19 23:32:17 joerg Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -65,8 +65,10 @@
extern int __sflags(const char *, int *);
extern int __svfscanf(FILE * __restrict, const char * __restrict,
va_list) __scanflike(2, 0);
-extern int __svfscanf_unlocked(FILE * __restrict, const char * __restrict,
- va_list) __scanflike(2, 0);
+extern int __svfscanf_l(FILE * __restrict, locale_t,
+ const char * __restrict, va_list) __scanflike(3, 0);
+extern int __svfscanf_unlocked_l(FILE * __restrict, locale_t,
+ const char * __restrict, va_list) __scanflike(3, 0);
extern int __vfprintf_unlocked_l(FILE * __restrict, locale_t,
const char * __restrict, va_list) __printflike(3, 0);
@@ -82,7 +84,7 @@
FILE *__restrict);
extern char *__fgetstr(FILE * __restrict, size_t * __restrict, int);
extern int __vfwprintf_unlocked_l(FILE *, locale_t, const wchar_t *, va_list);
-extern int __vfwscanf_unlocked(FILE * __restrict,
+extern int __vfwscanf_unlocked_l(FILE * __restrict, locale_t,
const wchar_t * __restrict, va_list);
/*
diff -r 64edaf47e220 -r f1a3282dcb9c lib/libc/stdio/scanf.c
--- a/lib/libc/stdio/scanf.c Fri Apr 19 23:28:47 2013 +0000
+++ b/lib/libc/stdio/scanf.c Fri Apr 19 23:32:16 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scanf.c,v 1.13 2012/03/15 18:22:30 christos Exp $ */
+/* $NetBSD: scanf.c,v 1.14 2013/04/19 23:32:17 joerg Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,10 +37,12 @@
#if 0
static char sccsid[] = "@(#)scanf.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: scanf.c,v 1.13 2012/03/15 18:22:30 christos Exp $");
+__RCSID("$NetBSD: scanf.c,v 1.14 2013/04/19 23:32:17 joerg Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
+#include "namespace.h"
+
#include <assert.h>
#include <errno.h>
#include <stdarg.h>
@@ -49,6 +51,8 @@
#include "reentrant.h"
#include "local.h"
+__weak_alias(scanf_l, _scanf_l)
+
int
scanf(char const *fmt, ...)
{
@@ -62,3 +66,17 @@
va_end(ap);
return ret;
}
+
+int
+scanf_l(locale_t loc, char const *fmt, ...)
+{
+ int ret;
+ va_list ap;
+
+ _DIAGASSERT(fmt != NULL);
Home |
Main Index |
Thread Index |
Old Index