4.4BSD snapshot (revision 8.1)
[unix-history] / usr / src / lib / libc / stdio / scanf.3
index 9ba3a64..de480ef 100644 (file)
@@ -2,10 +2,12 @@
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to Berkeley by
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to Berkeley by
-.\" Chris Torek.
+.\" Chris Torek and the American National Standards Committee X3,
+.\" on Information Processing Systems.
+.\"
 .\" %sccs.include.redist.man%
 .\"
 .\" %sccs.include.redist.man%
 .\"
-.\"     @(#)scanf.3    6.7 (Berkeley) %G%
+.\"     @(#)scanf.3    6.14 (Berkeley) %G%
 .\"
 .Dd 
 .Dt SCANF 3
 .\"
 .Dd 
 .Dt SCANF 3
@@ -26,7 +28,7 @@
 .Fn fscanf "FILE *stream" "const char *format" ...
 .Ft int
 .Fn sscanf "const char *str" "const char *format" ...
 .Fn fscanf "FILE *stream" "const char *format" ...
 .Ft int
 .Fn sscanf "const char *str" "const char *format" ...
-.Fd #include <varargs.h>
+.Fd #include <stdarg.h>
 .Ft int
 .Fn vscanf "const char *format" "va_list ap"
 .Ft int
 .Ft int
 .Fn vscanf "const char *format" "va_list ap"
 .Ft int
@@ -65,16 +67,19 @@ is analogous to
 and reads input from the stream pointer
 .Fa stream
 using a variable argument list of pointers (see
 and reads input from the stream pointer
 .Fa stream
 using a variable argument list of pointers (see
-.Xr varargs 3 ) .
+.Xr stdarg 3 ) .
+The
 .Fn vscanf
 .Fn vscanf
-scans a variable argument list from the standard input and
+function scans a variable argument list from the standard input and
+the
 .Fn vsscanf
 .Fn vsscanf
-scans it from a string;
+function scans it from a string;
 these are analogous to
 these are analogous to
+the
 .Fn vprintf
 and
 .Fn vsprintf
 .Fn vprintf
 and
 .Fn vsprintf
-respectively.
+functions respectively.
 Each successive
 .Em pointer
 argument must correspond properly with
 Each successive
 .Em pointer
 argument must correspond properly with
@@ -160,7 +165,7 @@ The following conversions are available:
 .Bl -tag -width XXXX
 .It Cm %
 Matches a literal `%'.
 .Bl -tag -width XXXX
 .It Cm %
 Matches a literal `%'.
-That is, `%%' in the format string
+That is, `%\&%' in the format string
 matches a single input `%' character.
 No conversion is done, and assignment does not occur.
 .It Cm d
 matches a single input `%' character.
 No conversion is done, and assignment does not occur.
 .It Cm d
@@ -362,13 +367,24 @@ the number of conversions which were successfully completed is returned.
 .Sh SEE ALSO
 .Xr strtol 3 ,
 .Xr strtoul 3 ,
 .Sh SEE ALSO
 .Xr strtol 3 ,
 .Xr strtoul 3 ,
+.Xr strtod 3 ,
 .Xr getc 3 ,
 .Xr printf 3
 .Xr getc 3 ,
 .Xr printf 3
+.Sh STANDARDS
+The functions
+.Fn fscanf ,
+.Fn scanf ,
+and
+.Fn sscanf
+conform to
+.St -ansiC .
 .Sh HISTORY
 .Sh HISTORY
-A
-.Nm
-function appeared in
-.At v7 .
+The functions
+.Fn vscanf ,
+.Fn vsscanf
+and
+.Fn vfscanf
+are new to this release.
 .Sh BUGS
 The current situation with
 .Cm %F
 .Sh BUGS
 The current situation with
 .Cm %F
@@ -378,8 +394,11 @@ conversions is unfortunate.
 .Pp
 All of the backwards compatibility formats will be removed in the future.
 .Pp
 .Pp
 All of the backwards compatibility formats will be removed in the future.
 .Pp
-There is no
-.Em vscanf
-or
-.Em vsscanf .
-.\" Had to draw the line somewhere!
+Numerical strings are truncated to 512 characters; for example,
+.Cm %f
+and
+.Cm %d
+are implicitly
+.Cm %512f
+and
+.Cm %512d .