6a00dc5ed2
Submitted by: Yuko Sasaki <yuko@veltec.co.jp>
150 lines
4.2 KiB
Groff
150 lines
4.2 KiB
Groff
.\" Copyright (c) 1990, 1991, 1993
|
||
.\" The Regents of the University of California. All rights reserved.
|
||
.\"
|
||
.\" Redistribution and use in source and binary forms, with or without
|
||
.\" modification, are permitted provided that the following conditions
|
||
.\" are met:
|
||
.\" 1. Redistributions of source code must retain the above copyright
|
||
.\" notice, this list of conditions and the following disclaimer.
|
||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||
.\" notice, this list of conditions and the following disclaimer in the
|
||
.\" documentation and/or other materials provided with the distribution.
|
||
.\" 3. All advertising materials mentioning features or use of this software
|
||
.\" must display the following acknowledgement:
|
||
.\" This product includes software developed by the University of
|
||
.\" California, Berkeley and its contributors.
|
||
.\" 4. Neither the name of the University nor the names of its contributors
|
||
.\" may be used to endorse or promote products derived from this software
|
||
.\" without specific prior written permission.
|
||
.\"
|
||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||
.\" SUCH DAMAGE.
|
||
.\"
|
||
.\" @(#)getsubopt.3 8.1 (Berkeley) 6/9/93
|
||
.\" %FreeBSD: src/lib/libc/stdlib/getsubopt.3,v 1.5.2.4 2001/12/14 18:33:58 ru Exp %
|
||
.\" $FreeBSD$
|
||
.\"
|
||
.Dd June 9, 1993
|
||
.Dt GETSUBOPT 3
|
||
.Os
|
||
.Sh ̾<EFBFBD><EFBFBD>
|
||
.Nm getsubopt
|
||
.Nd <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>饵<EFBFBD>֥<EFBFBD><EFBFBD>ץ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
.Sh <EFBFBD>饤<EFBFBD>֥<EFBFBD><EFBFBD><EFBFBD>
|
||
.Lb libc
|
||
.Sh <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
.In unistd.h
|
||
.Vt extern char *suboptarg ;
|
||
.Ft int
|
||
.Fn getsubopt "char **optionp" "char * const *tokens" "char **valuep"
|
||
.Sh <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
.Fn getsubopt
|
||
<EFBFBD>ؿ<EFBFBD><EFBFBD>ϡ<EFBFBD>
|
||
1 <20>Ĥޤ<C4A4><DEA4><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD>Υ<EFBFBD><CEA5>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>ڡ<EFBFBD><DAA1><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4>ϥ<EFBFBD><CFA5><EFBFBD><EFBFBD><EFBFBD>
|
||
.Pq Ql \&,
|
||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>饯<EFBFBD><EFBFBD><EFBFBD>ˤ<EFBFBD><EFBFBD>äƶ<EFBFBD><EFBFB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EFBFBD>ϡ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ``value'' <20><><EFBFBD><EFBFBD>ʬ<EFBFBD><EFBFBD><F2BCA8A4>褦<EFBFBD><E8A4A6><EFBFBD><EFBFBD><EFBFBD>ꤵ<EFBFBD><EAA4B5><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD>
|
||
<EFBFBD>ޤ<EFBFBD><EFBFBD>ϡ<EFBFBD>``value'' <20><>ʬ<EFBFBD><CAAC><EFBFBD>ʤ<EFBFBD><CAA4>ä<EFBFBD><C3A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
.Dv NULL
|
||
<EFBFBD>Ȥʤ<EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD>
|
||
.Sh <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
.Bd -literal -compact
|
||
char *tokens[] = {
|
||
#define ONE 0
|
||
"one",
|
||
#define TWO 1
|
||
"two",
|
||
NULL
|
||
};
|
||
|
||
\&...
|
||
|
||
extern char *optarg, *suboptarg;
|
||
char *option, *value;
|
||
|
||
while ((ch = getopt(argc, argv, "ab:")) != -1) {
|
||
switch(ch) {
|
||
case 'a':
|
||
/* ``a'' <20><><EFBFBD>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||
break;
|
||
case 'b':
|
||
option = optarg;
|
||
while (*option) {
|
||
switch(getsubopt(&option, tokens, &value)) {
|
||
case ONE:
|
||
/* ``one'' <20><><EFBFBD>֥<EFBFBD><D6A5>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||
break;
|
||
case TWO:
|
||
/* ``two'' <20><><EFBFBD>֥<EFBFBD><D6A5>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||
if (!value)
|
||
error("no value for two");
|
||
i = atoi(value);
|
||
break;
|
||
case \-1:
|
||
if (suboptarg)
|
||
error("illegal sub option %s",
|
||
suboptarg);
|
||
else
|
||
error("missing sub option");
|
||
break;
|
||
}
|
||
break;
|
||
}
|
||
|
||
.Ed
|
||
.Sh <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
.Xr getopt 3 ,
|
||
.Xr strsep 3
|
||
.Sh <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
.Fn getsubopt
|
||
<EFBFBD>ؿ<EFBFBD><EFBFBD><EFBFBD>
|
||
.Bx 4.4
|
||
<EFBFBD>ǤϤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>о줷<EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|