scanf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too.

Both POSIX and glibc use 'restrict' in scanf(), fscanf(), sscanf(), vscanf(), vfscanf(), vsscanf().
Let's use it here too.

.../glibc$ grep_glibc_prototype scanf
libio/stdio.h:397:
extern int scanf (const char *__restrict __format, ...) __wur;
.../glibc$ grep_glibc_prototype fscanf
libio/stdio.h:391:
extern int fscanf (FILE *__restrict __stream,
		   const char *__restrict __format, ...) __wur;
.../glibc$ grep_glibc_prototype sscanf
libio/stdio.h:399:
extern int sscanf (const char *__restrict __s,
		   const char *__restrict __format, ...) __THROW;
.../glibc$ grep_glibc_prototype vscanf
libio/stdio.h:443:
extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
     __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
.../glibc$ grep_glibc_prototype vfscanf
libio/stdio.h:435:
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
		    __gnuc_va_list __arg)
     __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
.../glibc$ grep_glibc_prototype vsscanf
libio/stdio.h:447:
extern int vsscanf (const char *__restrict __s,
		    const char *__restrict __format, __gnuc_va_list __arg)
     __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
.../glibc$

Also reorder v* functions to match the order of non-v functions.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Alejandro Colomar 2021-03-11 23:33:14 +01:00 committed by Michael Kerrisk
parent 0b3f94cb89
commit 4745230707
1 changed files with 10 additions and 6 deletions

View File

@ -56,15 +56,19 @@ scanf, fscanf, sscanf, vscanf, vsscanf, vfscanf \- input format conversion
.nf
.B #include <stdio.h>
.PP
.BI "int scanf(const char *" format ", ...);"
.BI "int fscanf(FILE *" stream ", const char *" format ", ...);"
.BI "int sscanf(const char *" str ", const char *" format ", ...);"
.BI "int scanf(const char *restrict " format ", ...);"
.BI "int fscanf(FILE *restrict " stream ,
.BI " const char *restrict " format ", ...);"
.BI "int sscanf(const char *restrict " str ,
.BI " const char *restrict " format ", ...);"
.PP
.B #include <stdarg.h>
.PP
.BI "int vscanf(const char *" format ", va_list " ap );
.BI "int vsscanf(const char *" str ", const char *" format ", va_list " ap );
.BI "int vfscanf(FILE *" stream ", const char *" format ", va_list " ap );
.BI "int vscanf(const char *restrict " format ", va_list " ap );
.BI "int vfscanf(FILE *restrict " stream ,
.BI " const char *restrict " format ", va_list " ap );
.BI "int vsscanf(const char *restrict " str ,
.BI " const char *restrict " format ", va_list " ap );
.fi
.PP
.RS -4