]> git.saurik.com Git - apple/libc.git/blame_incremental - stdlib/FreeBSD/getsubopt.3.patch
Libc-763.11.tar.gz
[apple/libc.git] / stdlib / FreeBSD / getsubopt.3.patch
... / ...
CommitLineData
1--- getsubopt.3.bsdnew 2009-11-13 14:11:48.000000000 -0800
2+++ getsubopt.3 2009-11-13 14:11:48.000000000 -0800
3@@ -40,23 +40,27 @@
4 .In stdlib.h
5 .Vt extern char *suboptarg ;
6 .Ft int
7-.Fn getsubopt "char **optionp" "char * const *tokens" "char **valuep"
8+.Fo getsubopt
9+.Fa "char **optionp"
10+.Fa "char *const *keylistp"
11+.Fa "char **valuep"
12+.Fc
13 .Sh DESCRIPTION
14 The
15 .Fn getsubopt
16 function
17-parses a string containing tokens delimited by one or more tab, space or
18-comma
19+parses a string containing tokens that are delimited
20+by one or more tab, space, or comma
21 .Pq Ql \&,
22 characters.
23-It is intended for use in parsing groups of option arguments provided
24-as part of a utility command line.
25+It is intended for use in parsing groups of option arguments
26+that are provided as part of a utility command line.
27 .Pp
28 The argument
29 .Fa optionp
30 is a pointer to a pointer to the string.
31 The argument
32-.Fa tokens
33+.Fa keylistp
34 is a pointer to a
35 .Dv NULL Ns -terminated
36 array of pointers to strings.
37@@ -65,10 +69,10 @@ The
38 .Fn getsubopt
39 function
40 returns the zero-based offset of the pointer in the
41-.Fa tokens
42-array referencing a string which matches the first token
43-in the string, or, \-1 if the string contains no tokens or
44-.Fa tokens
45+.Fa keylistp
46+array, referencing a string which matches the first token in the string
47+ or \-1 if the string contains no tokens or
48+.Fa keylistp
49 does not contain a matching string.
50 .Pp
51 If the token is of the form ``name=value'', the location referenced by
52@@ -93,7 +97,7 @@ will be set to point to the ``value'' po
53 if no ``value'' portion was present.
54 .Sh EXAMPLES
55 .Bd -literal -compact
56-char *tokens[] = {
57+char *keylistp[] = {
58 #define ONE 0
59 "one",
60 #define TWO 1
61@@ -114,7 +118,7 @@ while ((ch = getopt(argc, argv, "ab:"))
62 case 'b':
63 options = optarg;
64 while (*options) {
65- switch(getsubopt(&options, tokens, &value)) {
66+ switch(getsubopt(&options, keylistp, &value)) {
67 case ONE:
68 /* process ``one'' sub option */
69 break;