diff options
-rw-r--r-- | lib/libc/stdio/fgets.3 | 5 | ||||
-rw-r--r-- | lib/libc/stdio/fopen.3 | 12 | ||||
-rw-r--r-- | lib/libc/stdio/fputs.3 | 4 | ||||
-rw-r--r-- | lib/libc/stdio/fseek.3 | 6 | ||||
-rw-r--r-- | lib/libc/stdio/funopen.3 | 11 | ||||
-rw-r--r-- | lib/libc/stdio/getc.3 | 12 | ||||
-rw-r--r-- | lib/libc/stdio/mktemp.3 | 11 | ||||
-rw-r--r-- | lib/libc/stdio/printf.3 | 17 | ||||
-rw-r--r-- | lib/libc/stdio/putc.3 | 4 | ||||
-rw-r--r-- | lib/libc/stdio/scanf.3 | 20 | ||||
-rw-r--r-- | lib/libc/stdio/setbuf.3 | 5 | ||||
-rw-r--r-- | lib/libc/stdio/stdio.3 | 32 | ||||
-rw-r--r-- | lib/libc/stdio/tmpnam.3 | 6 |
13 files changed, 81 insertions, 64 deletions
diff --git a/lib/libc/stdio/fgets.3 b/lib/libc/stdio/fgets.3 index f532a4b0927..3ba2aacbbab 100644 --- a/lib/libc/stdio/fgets.3 +++ b/lib/libc/stdio/fgets.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fgets.3,v 1.20 2005/02/25 03:12:44 cloder Exp $ +.\" $OpenBSD: fgets.3,v 1.21 2005/07/26 03:30:25 jaredy Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -85,8 +85,9 @@ they return .Dv NULL . The .Fn fgets -and functions +and .Fn gets +functions do not distinguish between end-of-file and error, and callers must use .Xr feof 3 and diff --git a/lib/libc/stdio/fopen.3 b/lib/libc/stdio/fopen.3 index 7d260aaded1..48e04f47aad 100644 --- a/lib/libc/stdio/fopen.3 +++ b/lib/libc/stdio/fopen.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fopen.3,v 1.17 2005/07/26 03:06:09 jaredy Exp $ +.\" $OpenBSD: fopen.3,v 1.18 2005/07/26 03:30:25 jaredy Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -159,11 +159,11 @@ or .Sh RETURN VALUES Upon successful completion, .Fn fopen , -.Fn fdopen +.Fn fdopen , and .Fn freopen return a -.Tn FILE +.Vt FILE pointer. Otherwise, .Dv NULL @@ -213,7 +213,7 @@ function may also fail and set .Va errno for any of the errors specified for the routines .Xr open 2 , -.Xr fclose 3 +.Xr fclose 3 , and .Xr fflush 3 . .Sh SEE ALSO @@ -240,7 +240,9 @@ with error checking should .Fa fildes in case of failure, and .Xr fclose 3 -the resulting FILE * in case of success. +the resulting +.Vt FILE * +in case of success. .Bd -literal FILE *file; int fd; diff --git a/lib/libc/stdio/fputs.3 b/lib/libc/stdio/fputs.3 index bdf6b07d346..ac9df3efae8 100644 --- a/lib/libc/stdio/fputs.3 +++ b/lib/libc/stdio/fputs.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fputs.3,v 1.6 2003/06/02 20:18:37 millert Exp $ +.\" $OpenBSD: fputs.3,v 1.7 2005/07/26 03:30:25 jaredy Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -69,7 +69,7 @@ function returns 0 on success and .Dv EOF on error; .Fn puts -returns a nonnegative integer on success and +returns a non-negative integer on success and .Dv EOF on error. .Sh ERRORS diff --git a/lib/libc/stdio/fseek.3 b/lib/libc/stdio/fseek.3 index 5fb54836380..fb591802fa0 100644 --- a/lib/libc/stdio/fseek.3 +++ b/lib/libc/stdio/fseek.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fseek.3,v 1.9 2003/06/02 20:18:37 millert Exp $ +.\" $OpenBSD: fseek.3,v 1.10 2005/07/26 03:30:25 jaredy Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -158,7 +158,7 @@ Otherwise, .Fn fseek and .Fn fseeko -return \-1 and the others return a nonzero value and the global variable +return \-1 and the others return a non-zero value and the global variable .Va errno is set to indicate the error. .Sh ERRORS @@ -179,7 +179,7 @@ or .Dv SEEK_CUR . .El .Pp -The function +The functions .Fn fgetpos , .Fn fseek , .Fn fseeko , diff --git a/lib/libc/stdio/funopen.3 b/lib/libc/stdio/funopen.3 index a3a71865119..3e60ed61536 100644 --- a/lib/libc/stdio/funopen.3 +++ b/lib/libc/stdio/funopen.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: funopen.3,v 1.12 2005/07/26 03:25:01 jaredy Exp $ +.\" $OpenBSD: funopen.3,v 1.13 2005/07/26 03:30:25 jaredy Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -40,11 +40,14 @@ .Sh SYNOPSIS .Fd #include <stdio.h> .Ft FILE * -.Fn funopen "const void *cookie" "int (*readfn)(void *, char *, int)" "int (*writefn)(void *, const char *, int)" "fpos_t (*seekfn)(void *, fpos_t, int)" "int (*closefn)(void *)" +.Fn funopen "const void *cookie" "int (*readfn)(void *, char *, int)" \ + "int (*writefn)(void *, const char *, int)" \ + "fpos_t (*seekfn)(void *, fpos_t, int)" \ + "int (*closefn)(void *)" .Ft FILE * -.Fn fropen "const void *cookie" "int (*readfn)(void *, char *, int)" +.Fn fropen "const void *cookie" "int (*readfn)(void *, char *, int)" .Ft FILE * -.Fn fwopen "const void *cookie" "int (*writefn)(void *, const char *, int)" +.Fn fwopen "const void *cookie" "int (*writefn)(void *, const char *, int)" .Sh DESCRIPTION The .Fn funopen diff --git a/lib/libc/stdio/getc.3 b/lib/libc/stdio/getc.3 index 82c11a1249f..c26d11fd03a 100644 --- a/lib/libc/stdio/getc.3 +++ b/lib/libc/stdio/getc.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: getc.3,v 1.10 2003/06/02 20:18:37 millert Exp $ +.\" $OpenBSD: getc.3,v 1.11 2005/07/26 03:30:25 jaredy Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -69,7 +69,8 @@ The .Fn getchar function is equivalent to .Fn getc -with the argument stdin. +with the argument +.Em stdin . .Pp The .Fn getw @@ -119,8 +120,9 @@ and .Xr ferror 3 must be used to check for failure after calling .Fn getw . -The size and byte order of an -.Em int -varies from one machine to another, and +.Pp +Since the size and byte order of an +.Vt int +may vary from one machine to another, .Fn getw is not recommended for portable applications. diff --git a/lib/libc/stdio/mktemp.3 b/lib/libc/stdio/mktemp.3 index 867c251ef05..655fd0c8f72 100644 --- a/lib/libc/stdio/mktemp.3 +++ b/lib/libc/stdio/mktemp.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mktemp.3,v 1.36 2005/07/26 03:17:31 jaredy Exp $ +.\" $OpenBSD: mktemp.3,v 1.37 2005/07/26 03:30:25 jaredy Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -59,14 +59,12 @@ appended to it, for example .Pa /tmp/temp.XXXXXX . The trailing -.So Li X -.Sc Ns s +.So Li X Sc Ns s are replaced with the current process number and/or a unique letter combination. The number of unique file names that can be returned depends on the number of -.So Li X -.Sc Ns s +.So Li X Sc Ns s provided; six .So Li X .Sc Ns s @@ -111,7 +109,8 @@ except it permits a suffix to exist in the template. The template should be of the form .Pa /tmp/tmpXXXXXXXXXXsuffix . .Fn mkstemps -is told the length of the suffix string, i.e., strlen("suffix"); +is told the length of the suffix string, i.e., +.Li strlen("suffix") . .Pp The .Fn mkdtemp diff --git a/lib/libc/stdio/printf.3 b/lib/libc/stdio/printf.3 index f138476201c..0678581bff4 100644 --- a/lib/libc/stdio/printf.3 +++ b/lib/libc/stdio/printf.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: printf.3,v 1.48 2005/07/26 03:23:14 jaredy Exp $ +.\" $OpenBSD: printf.3,v 1.49 2005/07/26 03:30:25 jaredy Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -653,7 +653,7 @@ to five decimal places: fprintf(stdout, "pi = %.5f\en", 4 * atan(1.0)); .Ed .Pp -To allocate a 128 byte string and print into it: +To allocate a 128-byte string and print into it: .Bd -literal -offset indent #include <stdarg.h> #include <stdio.h> @@ -749,9 +749,9 @@ interface is not portable. It is important never to pass a string with user-supplied data as a format without using .Ql %s . -An attacker can put format specifiers in the string to mangle your stack, +An attacker can put format specifiers in the string to mangle the stack, leading to a possible security hole. -This holds true even if you have built the string +This holds true even if the string has been built .Dq by hand using a function like .Fn snprintf , @@ -764,8 +764,11 @@ Be sure to use the proper secure idiom: snprintf(buffer, sizeof(buffer), "%s", string); .Ed .Pp -There is no way for printf to know the size of each argument passed. -If you use positional arguments you must ensure that all parameters, up to the +There is no way for +.Fn printf +to know the size of each argument passed. +If positional arguments are used, care must be taken to ensure that all +parameters, up to the last positionally specified parameter, are used in the format string. This allows for the format string to be parsed for this information. -Failure to do this will mean your code is non-portable and liable to fail. +Failure to do this will mean the code is non-portable and liable to fail. diff --git a/lib/libc/stdio/putc.3 b/lib/libc/stdio/putc.3 index e4c879b17bb..0d1102c1322 100644 --- a/lib/libc/stdio/putc.3 +++ b/lib/libc/stdio/putc.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: putc.3,v 1.7 2003/06/02 20:18:37 millert Exp $ +.\" $OpenBSD: putc.3,v 1.8 2005/07/26 03:30:25 jaredy Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -119,6 +119,6 @@ function appeared in .Sh BUGS Since the size and byte order of an .Li int -varies from one machine to another, +may vary from one machine to another, .Fn putw is not recommended for portable applications. diff --git a/lib/libc/stdio/scanf.3 b/lib/libc/stdio/scanf.3 index d533d7a7b0f..8e1e85942b6 100644 --- a/lib/libc/stdio/scanf.3 +++ b/lib/libc/stdio/scanf.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: scanf.3,v 1.13 2005/07/26 03:27:04 jaredy Exp $ +.\" $OpenBSD: scanf.3,v 1.14 2005/07/26 03:30:25 jaredy Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -119,7 +119,7 @@ Scanning also stops when an input conversion cannot be made (see below). .Sh CONVERSIONS Following the .Cm % -character introducing a conversion there may be a number of +character, introducing a conversion, there may be a number of .Em flag characters, as follows: .Bl -tag -width indent @@ -282,14 +282,15 @@ plus a terminating .Tn NUL character. The usual skip of leading whitespace is suppressed. +.Pp The string is to be made up of characters in (or not in) a particular set; the set is defined by the characters between the open bracket -.Cm [ +.Cm \&[ character and a close bracket -.Cm ] +.Cm \&] character. The set excludes those characters if the first character after the open bracket is a circumflex @@ -305,12 +306,15 @@ when placed between two other characters, it adds all intervening characters to the set. To include a hyphen, make it the last character before the final close bracket. +.Pp For instance, .Ql [^]0-9-] -means the set `everything except close bracket, zero through nine, -and hyphen'. -The string ends with the appearance of a character not in the -(or, with a circumflex, in) set +means the set +.Do +everything except close bracket, zero through nine, and hyphen +.Dc . +The string ends with the appearance of a character not in +(or, with a circumflex, in) the set or when the field width runs out. .It Cm p Matches a pointer value (as printed by diff --git a/lib/libc/stdio/setbuf.3 b/lib/libc/stdio/setbuf.3 index f0cb8dce1e6..0fb79ad3787 100644 --- a/lib/libc/stdio/setbuf.3 +++ b/lib/libc/stdio/setbuf.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: setbuf.3,v 1.10 2003/06/02 20:18:37 millert Exp $ +.\" $OpenBSD: setbuf.3,v 1.11 2005/07/26 03:30:25 jaredy Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -88,7 +88,8 @@ function may be used to alter the buffering behavior of a stream. The .Fa mode parameter must be one of the following three macros: -.Bl -tag -width _IOFBF -offset indent +.Pp +.Bl -tag -width _IOFBF -offset indent -compact .It Dv _IONBF unbuffered .It Dv _IOLBF diff --git a/lib/libc/stdio/stdio.3 b/lib/libc/stdio/stdio.3 index 1bc1b265068..e69b5da2ac8 100644 --- a/lib/libc/stdio/stdio.3 +++ b/lib/libc/stdio/stdio.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: stdio.3,v 1.17 2004/06/20 21:09:30 jfb Exp $ +.\" $OpenBSD: stdio.3,v 1.18 2005/07/26 03:30:25 jaredy Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -63,7 +63,7 @@ associated with the stream is positioned at the start of the file (byte zero), unless the file is opened with append mode. If append mode is used, the position indicator will be placed at the end-of-file. -The position indicator is maintained by subsequent reads, writes +The position indicator is maintained by subsequent reads, writes, and positioning requests. All input occurs as if the characters were read by successive calls to the @@ -93,7 +93,9 @@ Other methods of program termination may not close files properly and hence buffered output may be lost. In particular, .Xr _exit 2 -does not flush stdio files. +does not flush +.Nm +files. Neither does an exit due to a signal. Buffers are flushed by .Xr abort 3 @@ -165,7 +167,7 @@ The .Tn SYNOPSIS sections of the following manual pages indicate which include files are to be used, what the compiler declaration for the function -looks like and which external variables are of interest. +looks like, and which external variables are of interest. .Pp The following are defined as macros; these names may not be re-used @@ -181,7 +183,7 @@ without first removing their current definitions with .Dv NULL , .Dv SEEK_END , .Dv SEEK_SET , -.Dv SEE_CUR , +.Dv SEEK_CUR , .Dv TMP_MAX , .Dv clearerr , .Dv feof , @@ -197,15 +199,15 @@ without first removing their current definitions with .Dv stdin , .Dv stdout . Function versions of the macro functions -.Xr feof , -.Xr ferror , -.Xr clearerr , -.Xr fileno , -.Xr getc , -.Xr getchar , -.Xr putc , +.Xr feof 3 , +.Xr ferror 3 , +.Xr clearerr 3 , +.Xr fileno 3 , +.Xr getc 3 , +.Xr getchar 3 , +.Xr putc 3 , and -.Xr putchar +.Xr putchar 3 exist and will be used if the macro definitions are explicitly removed. .Sh LIST OF FUNCTIONS @@ -289,6 +291,6 @@ library conforms to .Sh BUGS The standard buffered functions do not interact well with certain other library and system functions, especially -.Xr vfork +.Xr vfork 2 and -.Xr abort . +.Xr abort 3 . diff --git a/lib/libc/stdio/tmpnam.3 b/lib/libc/stdio/tmpnam.3 index b70d5b2ee14..eca2cc1815a 100644 --- a/lib/libc/stdio/tmpnam.3 +++ b/lib/libc/stdio/tmpnam.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmpnam.3,v 1.13 2003/06/02 20:18:37 millert Exp $ +.\" $OpenBSD: tmpnam.3,v 1.14 2005/07/26 03:30:25 jaredy Exp $ .\" .\" Copyright (c) 1988, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -60,8 +60,8 @@ reference to it is closed. Since .Xr mkstemp 3 creates the file with mode -.Dv S_IRUSR | S_IWUSR , -after the unlink +.Dv S_IRUSR \*(Ba S_IWUSR , +after the unlink, .Xr fchown 2 and .Xr umask 2 |