]>
Commit | Line | Data |
---|---|---|
34e8f829 A |
1 | --- scanf.3.orig 2008-07-30 01:54:48.000000000 -0700 |
2 | +++ scanf.3 2008-07-30 02:06:07.000000000 -0700 | |
224c7076 A |
3 | @@ -40,35 +40,55 @@ |
4 | .Dt SCANF 3 | |
5 | .Os | |
6 | .Sh NAME | |
7 | -.Nm scanf , | |
8 | .Nm fscanf , | |
9 | +.Nm scanf , | |
10 | .Nm sscanf , | |
11 | +.Nm vfscanf , | |
12 | .Nm vscanf , | |
13 | -.Nm vsscanf , | |
14 | -.Nm vfscanf | |
15 | +.Nm vsscanf | |
16 | .Nd input format conversion | |
17 | .Sh LIBRARY | |
18 | .Lb libc | |
19 | .Sh SYNOPSIS | |
20 | .In stdio.h | |
21 | .Ft int | |
22 | -.Fn scanf "const char * restrict format" ... | |
23 | +.Fo fscanf | |
24 | +.Fa "FILE *restrict stream" | |
25 | +.Fa "const char *restrict format" ... | |
26 | +.Fc | |
27 | .Ft int | |
28 | -.Fn fscanf "FILE * restrict stream" "const char * restrict format" ... | |
29 | +.Fo scanf | |
30 | +.Fa "const char *restrict format" ... | |
31 | +.Fc | |
32 | .Ft int | |
33 | -.Fn sscanf "const char * restrict str" "const char * restrict format" ... | |
34 | +.Fo sscanf | |
35 | +.Fa "const char *restrict s" | |
36 | +.Fa "const char *restrict format" ... | |
37 | +.Fc | |
38 | .In stdarg.h | |
39 | +.In stdio.h | |
40 | .Ft int | |
41 | -.Fn vscanf "const char * restrict format" "va_list ap" | |
42 | +.Fo vfscanf | |
43 | +.Fa "FILE *restrict stream" | |
44 | +.Fa "const char *restrict format" | |
45 | +.Fa "va_list arg" | |
46 | +.Fc | |
47 | .Ft int | |
48 | -.Fn vsscanf "const char * restrict str" "const char * restrict format" "va_list ap" | |
49 | +.Fo vscanf | |
50 | +.Fa "const char *restrict format" | |
51 | +.Fa "va_list arg" | |
52 | +.Fc | |
53 | .Ft int | |
54 | -.Fn vfscanf "FILE * restrict stream" "const char * restrict format" "va_list ap" | |
55 | +.Fo vsscanf | |
56 | +.Fa "const char *restrict s" | |
57 | +.Fa "const char *restrict format" | |
58 | +.Fa "va_list arg" | |
59 | +.Fc | |
60 | .Sh DESCRIPTION | |
61 | The | |
62 | .Fn scanf | |
63 | family of functions scans input according to a | |
64 | -.Fa format | |
65 | +.Fa format , | |
66 | as described below. | |
67 | This format may contain | |
68 | .Em conversion specifiers ; | |
69 | @@ -87,7 +107,8 @@ | |
70 | and | |
71 | .Fn sscanf | |
72 | reads its input from the character string pointed to by | |
73 | -.Fa str . | |
74 | +.Fa s . | |
75 | +.Pp | |
3d9156a7 | 76 | The |
224c7076 A |
77 | .Fn vfscanf |
78 | function | |
79 | @@ -108,7 +129,8 @@ | |
80 | .Fn vprintf | |
81 | and | |
82 | .Fn vsprintf | |
83 | -functions respectively. | |
84 | +functions, respectively. | |
85 | +.Pp | |
86 | Each successive | |
87 | .Em pointer | |
88 | argument must correspond properly with | |
89 | @@ -132,10 +154,16 @@ | |
3d9156a7 A |
90 | when an input character does not match such a format character. |
91 | Scanning also stops | |
92 | when an input conversion cannot be made (see below). | |
93 | +.Pp | |
94 | +Extended locale versions of these functions are documented in | |
95 | +.Xr scanf_l 3 . | |
96 | +See | |
97 | +.Xr xlocale 3 | |
98 | +for more information. | |
99 | .Sh CONVERSIONS | |
100 | Following the | |
101 | .Cm % | |
102 | -character introducing a conversion | |
224c7076 | 103 | +character introducing a conversion, |
3d9156a7 A |
104 | there may be a number of |
105 | .Em flag | |
106 | characters, as follows: | |
34e8f829 A |
107 | @@ -415,7 +443,8 @@ |
108 | in | |
109 | .Xr printf 3 ) ; | |
110 | the next pointer must be a pointer to | |
111 | -.Vt void . | |
112 | +.Vt "void *" | |
113 | +(or other pointer type). | |
114 | .It Cm n | |
115 | Nothing is expected; | |
116 | instead, the number of characters consumed thus far from the input | |
117 | @@ -440,13 +469,10 @@ | |
224c7076 A |
118 | causes an immediate return of |
119 | .Dv EOF . | |
120 | .Sh RETURN VALUES | |
121 | -These | |
122 | -functions | |
123 | -return | |
124 | -the number of input items assigned, which can be fewer than provided | |
125 | -for, or even zero, in the event of a matching failure. | |
126 | -Zero | |
127 | -indicates that, while there was input available, | |
128 | +These functions return the number of input items assigned. | |
129 | +This can be fewer than provided for, or even zero, | |
130 | +in the event of a matching failure. | |
131 | +Zero indicates that, although there was input available, | |
132 | no conversions were assigned; | |
133 | typically this is due to an invalid input character, | |
134 | such as an alphabetic character for a | |
34e8f829 | 135 | @@ -463,6 +489,7 @@ |
224c7076 A |
136 | .Xr getc 3 , |
137 | .Xr mbrtowc 3 , | |
138 | .Xr printf 3 , | |
139 | +.Xr scanf_l 3 , | |
3d9156a7 A |
140 | .Xr strtod 3 , |
141 | .Xr strtol 3 , | |
142 | .Xr strtoul 3 , | |
34e8f829 | 143 | @@ -473,7 +500,7 @@ |
224c7076 A |
144 | .Fn scanf , |
145 | .Fn sscanf , | |
146 | .Fn vfscanf , | |
147 | -.Fn vscanf | |
148 | +.Fn vscanf , | |
3d9156a7 | 149 | and |
224c7076 A |
150 | .Fn vsscanf |
151 | conform to |