diff options
author | 2000-12-15 14:15:27 +0000 | |
---|---|---|
committer | 2000-12-15 14:15:27 +0000 | |
commit | 2a0c3c0d4113f8a83aba77b59a61ec95ff88dad4 (patch) | |
tree | f99694604ddf5cca518fd95fedd1b0dd849d6828 /lib/libc/stdlib | |
parent | return resource exhaustion message on memory allocation error. poll on (diff) | |
download | wireguard-openbsd-2a0c3c0d4113f8a83aba77b59a61ec95ff88dad4.tar.xz wireguard-openbsd-2a0c3c0d4113f8a83aba77b59a61ec95ff88dad4.zip |
.Sh EXAMPLE -> .Sh EXAMPLES. Move this section before SEE ALSO where it
belongs. Closes PR/1554 from bk@rt.fm.
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r-- | lib/libc/stdlib/getopt.3 | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/lib/libc/stdlib/getopt.3 b/lib/libc/stdlib/getopt.3 index ef132cafc59..878290f5425 100644 --- a/lib/libc/stdlib/getopt.3 +++ b/lib/libc/stdlib/getopt.3 @@ -29,7 +29,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $OpenBSD: getopt.3,v 1.13 2000/04/20 13:50:02 aaron Exp $ +.\" $OpenBSD: getopt.3,v 1.14 2000/12/15 14:15:27 aaron Exp $ .\" .Dd April 19, 1994 .Dt GETOPT 3 @@ -126,6 +126,33 @@ When all options have been processed (i.e., up to the first non-option argument), .Fn getopt returns \-1. +.Sh EXAMPLES +.Bd -literal -compact +extern char *optarg; +extern int optind; +int bflag, ch, fd; + +bflag = 0; +while ((ch = getopt(argc, argv, "bf:")) != -1) { + switch (ch) { + case 'b': + bflag = 1; + break; + case 'f': + if ((fd = open(optarg, O_RDONLY, 0)) < 0) { + (void)fprintf(stderr, + "myname: %s: %s\en", optarg, strerror(errno)); + exit(1); + } + break; + case '?': + default: + usage(); + } +} +argc -= optind; +argv += optind; +.Ed .Sh SEE ALSO .Xr getopt 1 , .Xr getsubopt 3 @@ -162,33 +189,6 @@ function multiple times. This is an extension to the .St -p1003.2 specification. -.Sh EXAMPLE -.Bd -literal -compact -extern char *optarg; -extern int optind; -int bflag, ch, fd; - -bflag = 0; -while ((ch = getopt(argc, argv, "bf:")) != -1) { - switch (ch) { - case 'b': - bflag = 1; - break; - case 'f': - if ((fd = open(optarg, O_RDONLY, 0)) < 0) { - (void)fprintf(stderr, - "myname: %s: %s\en", optarg, strerror(errno)); - exit(1); - } - break; - case '?': - default: - usage(); - } -} -argc -= optind; -argv += optind; -.Ed .Sh HISTORY The .Fn getopt |