Browse Source

.Sh EXAMPLE -> .Sh EXAMPLES. Move this section before SEE ALSO where it

belongs. Closes PR/1554 from bk@rt.fm.
OPENBSD_2_9
aaron 23 years ago
parent
commit
01bdb7e580
1 changed files with 28 additions and 28 deletions
  1. +28
    -28
      src/lib/libc/stdlib/getopt.3

+ 28
- 28
src/lib/libc/stdlib/getopt.3 View File

@ -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


Loading…
Cancel
Save