summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/getsubopt.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/stdlib/getsubopt.3')
-rw-r--r--src/lib/libc/stdlib/getsubopt.330
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
48The 48The
49.Fn getsubopt 49.Fn getsubopt
50function 50function parses a string containing tokens delimited by one or more
51parses a string containing tokens delimited by one or more tab, space or 51tab, space or comma
52comma
53.Pq Ql \&, 52.Pq Ql \&,
54characters. 53characters.
55It is intended for use in parsing groups of option arguments provided 54It is intended for use in parsing groups of option arguments provided
@@ -60,22 +59,24 @@ The argument
60is a pointer to a pointer to the string. 59is a pointer to a pointer to the string.
61The argument 60The argument
62.Fa tokens 61.Fa tokens
63is a pointer to a null-terminated 62is a pointer to a null-terminated array of pointers to strings.
64array of pointers to strings.
65.Pp 63.Pp
66The 64The
67.Fn getsubopt 65.Fn getsubopt
68function 66function returns the zero-based offset of the pointer in the
69returns the zero-based offset of the pointer in the
70.Fa tokens 67.Fa tokens
71array referencing a string which matches the first token 68array referencing a string which matches the first token
72in the string, or, \-1 if the string contains no tokens or 69in the string, or, \-1 if the string contains no tokens or
73.Fa tokens 70.Fa tokens
74does not contain a matching string. 71does not contain a matching string.
75.Pp 72.Pp
76If the token is of the form ``name=value'', the location referenced by 73If the token is of the form
74.Ar name Ns No = Ns Ar value ,
75the location referenced by
77.Fa valuep 76.Fa valuep
78will be set to point to the start of the ``value'' portion of the token. 77will be set to point to the start of the
78.Dq value
79portion of the token.
79.Pp 80.Pp
80On return from 81On return from
81.Fn getsubopt , 82.Fn getsubopt ,
@@ -86,13 +87,12 @@ The external variable
86.Fa suboptarg 87.Fa suboptarg
87will be set to point to the start of the current token, or 88will be set to point to the start of the current token, or
88.Dv NULL 89.Dv NULL
89if no 90if no tokens were present.
90tokens were present.
91The argument 91The argument
92.Fa valuep 92.Fa valuep
93will be set to point to the ``value'' portion of the token, or 93will be set to point to the value portion of the token, or
94.Dv NULL 94.Dv NULL
95if no ``value'' portion was present. 95if no value portion was present.
96.Sh EXAMPLE 96.Sh EXAMPLE
97.Bd -literal -compact 97.Bd -literal -compact
98char *tokens[] = { 98char *tokens[] = {