1 /* Parse comma separate list into words.
2 Copyright (C) 2004-2005 Free Software Foundation, Inc.
3 Contributed by Simon Josefsson <jas@extundo.com>, 2004.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 This program 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
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 /* Assuming *OPTIONP is a comma separated list of elements of the form
20 "token" or "token=value", getsubopt parses the first of these elements.
21 If the first element refers to a "token" that is member of the given
22 NULL-terminated array of tokens:
23 - It replaces the comma with a NUL byte, updates *OPTIONP to point past
24 the first option and the comma, sets *VALUEP to the value of the
25 element (or NULL if it doesn't contain an "=" sign),
26 - It returns the index of the "token" in the given array of tokens.
27 Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
28 For more details see the POSIX:2001 specification.
29 http://www.opengroup.org/susv3xsh/getsubopt.html */
33 /* Get getsubopt declaration. */
38 extern int getsubopt (char **optionp, char *const *tokens, char **valuep);