tech-misc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[PATCH] POSIX01: put v*scanf() functions under _ISOC99_SOURCE domain



ISO C99 requires the presence of the vscanf(), vfscanf(), and vsscanf()
functions. NetBSD until now hiddes their under its own macros. We'll put their
under ISO C99 domain as well.
---
 include/stdio.h |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/include/stdio.h b/include/stdio.h
index 257213e..9c7dc79 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -360,6 +360,23 @@ __END_DECLS
 #endif /* _XOPEN_SOURCE >= 500 || _LARGEFILE_SOURCE || _NETBSD_SOURCE */
 
 /*
+ * Functions defined in at least ISO C99. Still put under _NETBSD_SOURCE due to
+ * backward compatible.
+ */
+#if defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+int     vscanf(const char * __restrict, _BSD_VA_LIST_)
+           __attribute__((__format__(__scanf__, 1, 0)));
+int     vfscanf(FILE * __restrict, const char * __restrict,
+           _BSD_VA_LIST_)
+           __attribute__((__format__(__scanf__, 2, 0)));
+int     vsscanf(const char * __restrict, const char * __restrict,
+           _BSD_VA_LIST_)
+           __attribute__((__format__(__scanf__, 2, 0)));
+__END_DECLS
+#endif /* _ISOC99_SOURCE || _NETBSD_SOURCE */
+
+/*
  * Routines that are purely local.
  */
 #if defined(_NETBSD_SOURCE)
@@ -381,14 +398,6 @@ int         setlinebuf(FILE *);
 int     vasprintf(char ** __restrict, const char * __restrict,
            _BSD_VA_LIST_)
            __attribute__((__format__(__printf__, 2, 0)));
-int     vscanf(const char * __restrict, _BSD_VA_LIST_)
-           __attribute__((__format__(__scanf__, 1, 0)));
-int     vfscanf(FILE * __restrict, const char * __restrict,
-           _BSD_VA_LIST_)
-           __attribute__((__format__(__scanf__, 2, 0)));
-int     vsscanf(const char * __restrict, const char * __restrict,
-           _BSD_VA_LIST_)
-           __attribute__((__format__(__scanf__, 2, 0)));
 const char *fmtcheck(const char *, const char *)
            __attribute__((__format_arg__(2)));
 __END_DECLS
-- 
1.5.2.5



Home | Main Index | Thread Index | Old Index