Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

OSS Library Calls (w - z) wordexp(3)
NAME
wordexp - Expands tokens from a stream of words
LIBRARY
G-series native OSS processes: /G/system/sysnn/zossesrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zossedll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yossedll |
SYNOPSIS
#include <wordexp.h>
int wordexp(
const char *words,
wordexp_t *pwordexp,
int flags);
PARAMETERS
words Specifies the string containing the tokens to be expanded.
pwordexp Contains a pointer to a wordexp_t structure.
flags Contains a bit flag specifying the configurable aspects of the wordexp( ) func-
tion.
DESCRIPTION
The wordexp() function performs word expansions equivalent to the word expansion that would
be performed by the shell if the contents of the words parameter were arguments on the com-
mand line. The list of expanded words is placed in the structure pointed to by the pwordexp
parameter.
The words parameter cannot contain:
An unquoted newline character
Any of the unquoted shell special characters |, &, ;, <,or>, except in the case of com-
mand substitution
Unquoted parentheses or braces, except in the case of command or variable substitution
If the words parameter contains an unquoted # (number sign) comment character that is the
beginning of a token, the wordexp( ) function might treat the comment character as a regular
character or might interpret it as a comment indicator and ignore the remainder of the expression
in the words parameter.
The wordexp() function allows an application to perform all of the shell’s expansions on a word
or words obtained from a user. For example, if the application prompts for a filename (or a list of
filenames) and then uses the wordexp() function to process the input, the user could respond
with anything that would be valid as input to the shell.
527187-017 Hewlett-Packard Company 869