From 01bdb7e580cb94fff273984935f61f27ff5c858f Mon Sep 17 00:00:00 2001 From: aaron <> Date: Fri, 15 Dec 2000 14:15:27 +0000 Subject: [PATCH] .Sh EXAMPLE -> .Sh EXAMPLES. Move this section before SEE ALSO where it belongs. Closes PR/1554 from bk@rt.fm. --- src/lib/libc/stdlib/getopt.3 | 56 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/lib/libc/stdlib/getopt.3 b/src/lib/libc/stdlib/getopt.3 index ef132caf..878290f5 100644 --- a/src/lib/libc/stdlib/getopt.3 +++ b/src/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