Loading...
--- Libc/Libc-763.13/stdlib/getsubopt.3
+++ Libc/Libc-262/stdlib/getsubopt.3
@@ -9,6 +9,10 @@
.\" 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.
@@ -26,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)getsubopt.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/stdlib/getsubopt.3,v 1.11 2007/01/09 00:28:10 imp Exp $
+.\" $FreeBSD: src/lib/libc/stdlib/getsubopt.3,v 1.9 2001/09/07 14:46:35 asmodai Exp $
.\"
.Dd June 9, 1993
.Dt GETSUBOPT 3
@@ -37,30 +41,26 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In stdlib.h
+.In unistd.h
.Vt extern char *suboptarg ;
.Ft int
-.Fo getsubopt
-.Fa "char **optionp"
-.Fa "char *const *keylistp"
-.Fa "char **valuep"
-.Fc
+.Fn getsubopt "char **optionp" "char * const *tokens" "char **valuep"
.Sh DESCRIPTION
The
.Fn getsubopt
function
-parses a string containing tokens that are delimited
-by one or more tab, space, or comma
+parses a string containing tokens delimited by one or more tab, space or
+comma
.Pq Ql \&,
characters.
-It is intended for use in parsing groups of option arguments
-that are provided as part of a utility command line.
+It is intended for use in parsing groups of option arguments provided
+as part of a utility command line.
.Pp
The argument
.Fa optionp
is a pointer to a pointer to the string.
The argument
-.Fa keylistp
+.Fa tokens
is a pointer to a
.Dv NULL Ns -terminated
array of pointers to strings.
@@ -69,10 +69,10 @@
.Fn getsubopt
function
returns the zero-based offset of the pointer in the
-.Fa keylistp
-array, referencing a string which matches the first token in the string
- or \-1 if the string contains no tokens or
-.Fa keylistp
+.Fa tokens
+array referencing a string which matches the first token
+in the string, or, \-1 if the string contains no tokens or
+.Fa tokens
does not contain a matching string.
.Pp
If the token is of the form ``name=value'', the location referenced by
@@ -97,7 +97,7 @@
if no ``value'' portion was present.
.Sh EXAMPLES
.Bd -literal -compact
-char *keylistp[] = {
+char *tokens[] = {
#define ONE 0
"one",
#define TWO 1
@@ -118,7 +118,7 @@
case 'b':
options = optarg;
while (*options) {
- switch(getsubopt(&options, keylistp, &value)) {
+ switch(getsubopt(&options, tokens, &value)) {
case ONE:
/* process ``one'' sub option */
break;