diff options
Diffstat (limited to 'src/lib/libc/stdlib/getsubopt.3')
-rw-r--r-- | src/lib/libc/stdlib/getsubopt.3 | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/libc/stdlib/getsubopt.3 b/src/lib/libc/stdlib/getsubopt.3 index 0ea48864c3..a5f98e5d96 100644 --- a/src/lib/libc/stdlib/getsubopt.3 +++ b/src/lib/libc/stdlib/getsubopt.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: getsubopt.3,v 1.3 1999/06/29 18:36:20 aaron Exp $ | 1 | .\" $OpenBSD: getsubopt.3,v 1.4 2000/04/20 13:50:02 aaron Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1990, 1991, 1993 | 3 | .\" Copyright (c) 1990, 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | 4 | .\" The Regents of the University of California. All rights reserved. |
@@ -41,15 +41,14 @@ | |||
41 | .Nd get sub options from an argument | 41 | .Nd get sub options from an argument |
42 | .Sh SYNOPSIS | 42 | .Sh SYNOPSIS |
43 | .Fd #include <stdlib.h> | 43 | .Fd #include <stdlib.h> |
44 | .Vt extern char *suboptarg | 44 | .Vt extern char *suboptarg; |
45 | .Ft int | 45 | .Ft int |
46 | .Fn getsubopt "char **optionp" "char * const *tokens" "char **valuep" | 46 | .Fn getsubopt "char **optionp" "char * const *tokens" "char **valuep" |
47 | .Sh DESCRIPTION | 47 | .Sh DESCRIPTION |
48 | The | 48 | The |
49 | .Fn getsubopt | 49 | .Fn getsubopt |
50 | function | 50 | function parses a string containing tokens delimited by one or more |
51 | parses a string containing tokens delimited by one or more tab, space or | 51 | tab, space or comma |
52 | comma | ||
53 | .Pq Ql \&, | 52 | .Pq Ql \&, |
54 | characters. | 53 | characters. |
55 | It is intended for use in parsing groups of option arguments provided | 54 | It is intended for use in parsing groups of option arguments provided |
@@ -60,22 +59,24 @@ The argument | |||
60 | is a pointer to a pointer to the string. | 59 | is a pointer to a pointer to the string. |
61 | The argument | 60 | The argument |
62 | .Fa tokens | 61 | .Fa tokens |
63 | is a pointer to a null-terminated | 62 | is a pointer to a null-terminated array of pointers to strings. |
64 | array of pointers to strings. | ||
65 | .Pp | 63 | .Pp |
66 | The | 64 | The |
67 | .Fn getsubopt | 65 | .Fn getsubopt |
68 | function | 66 | function returns the zero-based offset of the pointer in the |
69 | returns the zero-based offset of the pointer in the | ||
70 | .Fa tokens | 67 | .Fa tokens |
71 | array referencing a string which matches the first token | 68 | array referencing a string which matches the first token |
72 | in the string, or, \-1 if the string contains no tokens or | 69 | in the string, or, \-1 if the string contains no tokens or |
73 | .Fa tokens | 70 | .Fa tokens |
74 | does not contain a matching string. | 71 | does not contain a matching string. |
75 | .Pp | 72 | .Pp |
76 | If the token is of the form ``name=value'', the location referenced by | 73 | If the token is of the form |
74 | .Ar name Ns No = Ns Ar value , | ||
75 | the location referenced by | ||
77 | .Fa valuep | 76 | .Fa valuep |
78 | will be set to point to the start of the ``value'' portion of the token. | 77 | will be set to point to the start of the |
78 | .Dq value | ||
79 | portion of the token. | ||
79 | .Pp | 80 | .Pp |
80 | On return from | 81 | On return from |
81 | .Fn getsubopt , | 82 | .Fn getsubopt , |
@@ -86,13 +87,12 @@ The external variable | |||
86 | .Fa suboptarg | 87 | .Fa suboptarg |
87 | will be set to point to the start of the current token, or | 88 | will be set to point to the start of the current token, or |
88 | .Dv NULL | 89 | .Dv NULL |
89 | if no | 90 | if no tokens were present. |
90 | tokens were present. | ||
91 | The argument | 91 | The argument |
92 | .Fa valuep | 92 | .Fa valuep |
93 | will be set to point to the ``value'' portion of the token, or | 93 | will be set to point to the value portion of the token, or |
94 | .Dv NULL | 94 | .Dv NULL |
95 | if no ``value'' portion was present. | 95 | if no value portion was present. |
96 | .Sh EXAMPLE | 96 | .Sh EXAMPLE |
97 | .Bd -literal -compact | 97 | .Bd -literal -compact |
98 | char *tokens[] = { | 98 | char *tokens[] = { |