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