1 /* Parse comma separate list into words.
2 Copyright (C) 2004 Free Software Foundation, Inc.
3 Contributed by Simon Josefsson <jas@extundo.com>, 2004.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 /* Assuming *OPTIONP is a comma separated list of elements of the form
21 "token" or "token=value", getsubopt parses the first of these elements.
22 If the first element refers to a "token" that is member of the given
23 NULL-terminated array of tokens:
24 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
25 the first option and the comma, sets *VALUEP to the value of the
26 element (or NULL if it doesn't contain an "=" sign),
27 - It returns the index of the "token" in the given array of tokens.
28 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
29 For more details see the POSIX:2001 specification.
30 http://www.opengroup.org/onlinepubs/009695399/functions/getsubopt.html */
34 /* Get getsubopt declaration. */
39 extern int getsubopt (char **optionp, char *const *tokens, char **valuep);