summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/getsubopt.3
diff options
context:
space:
mode:
authorjaredy <jaredy@openbsd.org>2005-10-11 01:23:41 +0000
committerjaredy <jaredy@openbsd.org>2005-10-11 01:23:41 +0000
commit2fe637cb0bbda731e0b8fe03052750949216dfbf (patch)
treebb45cab4e901be328633f90a50c89a02358a856e /lib/libc/stdlib/getsubopt.3
parentA while back, undo records were moved from the BUFFER struct to MGWIN. (diff)
downloadwireguard-openbsd-2fe637cb0bbda731e0b8fe03052750949216dfbf.tar.xz
wireguard-openbsd-2fe637cb0bbda731e0b8fe03052750949216dfbf.zip
tidy up examples
- use err() for error handling - add lint hints - spacing nits and missing braces ok otto
Diffstat (limited to 'lib/libc/stdlib/getsubopt.3')
-rw-r--r--lib/libc/stdlib/getsubopt.312
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/libc/stdlib/getsubopt.3 b/lib/libc/stdlib/getsubopt.3
index d0308e2d509..6a7c28ff4df 100644
--- a/lib/libc/stdlib/getsubopt.3
+++ b/lib/libc/stdlib/getsubopt.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: getsubopt.3,v 1.10 2005/07/26 04:20:23 jaredy Exp $
+.\" $OpenBSD: getsubopt.3,v 1.11 2005/10/11 01:23:41 jaredy Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -104,15 +104,15 @@ char *tokens[] = {
extern char *optarg, *suboptarg;
char *options, *value;
-while ((ch = getopt(argc, argv, "ab:")) != \-1) {
- switch(ch) {
+while ((ch = getopt(argc, argv, "ab:")) != -1) {
+ switch (ch) {
case 'a':
/* process ``a'' option */
break;
case 'b':
options = optarg;
while (*options) {
- switch(getsubopt(&options, tokens, &value)) {
+ switch (getsubopt(&options, tokens, &value)) {
case ONE:
/* process ``one'' sub option */
break;
@@ -122,16 +122,18 @@ while ((ch = getopt(argc, argv, "ab:")) != \-1) {
error("no value for two");
i = atoi(value);
break;
- case \-1:
+ case -1:
if (suboptarg)
error("illegal sub option %s",
suboptarg);
else
error("missing sub option");
break;
+ }
}
break;
}
+}
.Ed
.Sh SEE ALSO
.Xr getopt 3 ,