From 2cb84d580dab3aefdba2960c7023d92077b12cb1 Mon Sep 17 00:00:00 2001 From: Kris Kennaway Date: Thu, 8 Jun 2000 07:18:03 +0000 Subject: MFC: Typo, update example code --- lib/libc/stdlib/getopt.3 | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'lib/libc/stdlib') diff --git a/lib/libc/stdlib/getopt.3 b/lib/libc/stdlib/getopt.3 index 2240ba71a966..ec504fec91ba 100644 --- a/lib/libc/stdlib/getopt.3 +++ b/lib/libc/stdlib/getopt.3 @@ -128,7 +128,7 @@ when the argument list is exhausted, or .Ql ? if a non-recognized option is encountered. -The interpretation of options in the argument list may be canceled +The interpretation of options in the argument list may be cancelled by the option .Ql -- (double dash) which causes @@ -174,8 +174,6 @@ This is an extension to the specification. .Sh EXAMPLE .Bd -literal -compact -extern char *optarg; -extern int optind; int bflag, ch, fd; bflag = 0; @@ -185,11 +183,8 @@ while ((ch = getopt(argc, argv, "bf:")) != -1) 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); - } + if ((fd = open(optarg, O_RDONLY, 0)) < 0) + err(1, "%s", optarg); break; case '?': default: -- cgit v1.3