summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmc <>2010-09-19 22:22:13 +0000
committerjmc <>2010-09-19 22:22:13 +0000
commitac86f18c856eba658f53b60087d6df6b476c20d5 (patch)
tree0fc5c0532d262e64f2447cab318c26bc12d20f6f
parent793667c14e1b799fe0747dfc6cebd10d1b1c4fe9 (diff)
downloadopenbsd-ac86f18c856eba658f53b60087d6df6b476c20d5.tar.gz
openbsd-ac86f18c856eba658f53b60087d6df6b476c20d5.tar.bz2
openbsd-ac86f18c856eba658f53b60087d6df6b476c20d5.zip
more wacky macro fixing;
-rw-r--r--src/lib/libc/stdlib/getopt_long.374
1 files changed, 37 insertions, 37 deletions
diff --git a/src/lib/libc/stdlib/getopt_long.3 b/src/lib/libc/stdlib/getopt_long.3
index 2bab963734..53737d8f25 100644
--- a/src/lib/libc/stdlib/getopt_long.3
+++ b/src/lib/libc/stdlib/getopt_long.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: getopt_long.3,v 1.15 2007/07/03 12:06:07 jmc Exp $ 1.\" $OpenBSD: getopt_long.3,v 1.16 2010/09/19 22:22:13 jmc Exp $
2.\" $NetBSD: getopt_long.3,v 1.11 2002/10/02 10:54:19 wiz Exp $ 2.\" $NetBSD: getopt_long.3,v 1.11 2002/10/02 10:54:19 wiz Exp $
3.\" 3.\"
4.\" Copyright (c) 1988, 1991, 1993 4.\" Copyright (c) 1988, 1991, 1993
@@ -30,7 +30,7 @@
30.\" 30.\"
31.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95 31.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95
32.\" 32.\"
33.Dd $Mdocdate: July 3 2007 $ 33.Dd $Mdocdate: September 19 2010 $
34.Dt GETOPT_LONG 3 34.Dt GETOPT_LONG 3
35.Os 35.Os
36.Sh NAME 36.Sh NAME
@@ -204,41 +204,6 @@ if there was a missing option argument,
204.Sq \&? 204.Sq \&?
205if the user specified an unknown or ambiguous option, and 205if the user specified an unknown or ambiguous option, and
206\-1 when the argument list has been exhausted. 206\-1 when the argument list has been exhausted.
207.Sh EXAMPLES
208.Bd -literal
209int bflag, ch, fd;
210int daggerset;
211
212/* options descriptor */
213static struct option longopts[] = {
214 { "buffy", no_argument, NULL, 'b' },
215 { "fluoride", required_argument, NULL, 'f' },
216 { "daggerset", no_argument, &daggerset, 1 },
217 { NULL, 0, NULL, 0 }
218};
219
220bflag = 0;
221while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1)
222 switch (ch) {
223 case 'b':
224 bflag = 1;
225 break;
226 case 'f':
227 if ((fd = open(optarg, O_RDONLY, 0)) == -1)
228 err(1, "unable to open %s", optarg);
229 break;
230 case 0:
231 if (daggerset)
232 fprintf(stderr, "Buffy will use her dagger to "
233 "apply fluoride to dracula's teeth\en");
234 break;
235 default:
236 usage();
237 /* NOTREACHED */
238 }
239argc -= optind;
240argv += optind;
241.Ed
242.Sh IMPLEMENTATION DIFFERENCES 207.Sh IMPLEMENTATION DIFFERENCES
243This section describes differences to the GNU implementation 208This section describes differences to the GNU implementation
244found in glibc-2.1.3: 209found in glibc-2.1.3:
@@ -444,6 +409,41 @@ in the
444.Ar optstring 409.Ar optstring
445is ignored. 410is ignored.
446.El 411.El
412.Sh EXAMPLES
413.Bd -literal
414int bflag, ch, fd;
415int daggerset;
416
417/* options descriptor */
418static struct option longopts[] = {
419 { "buffy", no_argument, NULL, 'b' },
420 { "fluoride", required_argument, NULL, 'f' },
421 { "daggerset", no_argument, &daggerset, 1 },
422 { NULL, 0, NULL, 0 }
423};
424
425bflag = 0;
426while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1)
427 switch (ch) {
428 case 'b':
429 bflag = 1;
430 break;
431 case 'f':
432 if ((fd = open(optarg, O_RDONLY, 0)) == -1)
433 err(1, "unable to open %s", optarg);
434 break;
435 case 0:
436 if (daggerset)
437 fprintf(stderr, "Buffy will use her dagger to "
438 "apply fluoride to dracula's teeth\en");
439 break;
440 default:
441 usage();
442 /* NOTREACHED */
443 }
444argc -= optind;
445argv += optind;
446.Ed
447.Sh SEE ALSO 447.Sh SEE ALSO
448.Xr getopt 3 448.Xr getopt 3
449.Sh HISTORY 449.Sh HISTORY