Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
OSS Library Calls (g - h) getsubopt(3)
NAME
getsubopt - Parses suboption arguments from a string
LIBRARY
G-series native OSS processes: /G/system/sysnn/zosshsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zosshdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yosshdll |
SYNOPSIS
#include <stdlib.h>
int getsubopt(
char **optionp,
char * const *tokens,
char **valuep);
PARAMETERS
optionp Is the address of a pointer to the option argument string.
tokens Is a vector of possible tokens. It is organized as a series of pointers to strings ter-
minated by a null pointer.
valuep Is the address of a pointer to the value string.
DESCRIPTION
The getsubopt( ) function takes a flag argument that was originally parsed by the getopt( ) func-
tion and parses its suboption arguments. Suboption arguments are comma-separated and may
consist of either of a single token, or a token-value pair separated by an equal sign. Neither a
token or its value can include either a comma or an equal sign.
The getsubopt( ) function examines the option argument string using the pointer located at the
address given by the optionp parameter. If the option argument string contains only a single
suboption argument, getsubopt( ) sets * optionp to point to null at the end of the string. Other-
wise, it replaces the comma separator in the option argument string with a null pointer and sets *
optionp to point to the start of the next suboption argument. If the suboption argument is a
token-value pair, getsubopt( ) sets * valuep to point to the first character of the value. Otherwise,
it sets * valuep to a null pointer.
NOTES
The getsubopt( ) function can be called by native processes only.
When the getsubopt( ) function fails to match a suboption argument with any token in the tokens
vector, the calling program must determine if this is an error or if the unrecognized option should
be passed to another program.
RETURN VALUES
The getsubopt( ) function returns the index of the matched token string, or -1 if no token strings
were matched.
ERRORS
None. This function does not set errno.
RELATED INFORMATION
Functions: getopt(3).
527187-017 Hewlett-Packard Company 3−151