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

OSS Library Calls (w - z) wordexp(3)
The first such call does not set the WRDE_ APPEND flag. All subsequent calls set it.
For a single invocation of the wordexp() function, all calls either set the
WRDE_DOOFFS flag or do not set it.
After the second and each subsequent call, the pwordexp parameter points to a list con-
taining the following:
Zero or more null characters, as specified by the WRDE_DOOFFS ag and the
we_offs field of the wordexp_t structure.
Pointers to the words that were in the structure pointed to by pwordexp before
the call, in the same order as before.
Pointers to the new words generated by the latest call, in the specified order.
The count returned in the structure pointed to by pwordexp is the total number of words
from all of the calls.
The application should not modify the pwordexp parameter between the calls.
The WRDE_NOCMD ag is provided for applications that, for security or other reasons, want
to prevent a user from executing shell commands. Disallowing unquoted shell special characters
also prevents unwanted side effects such as executing a command or writing to a file.
Unless WRDE_SHOWERR is set in the flags parameter, the wordexp( ) function redirects the
standard error file to /dev/null for any utilities executed as a result of command substitution
while expanding the words parameter. If WRDE_SHOWERR is set, the wordexp( ) function
can write messages to the standard error file if syntax errors are detected during expansion of the
words parameter.
RETURN VALUES
If no errors are encountered while expanding the words parameter, the wordexp() function
returns the value 0 (zero). If an error occurs, it returns a nonzero value indicating the error.
NOTES
If you use this function on a word that specifies the local / (slash) root directory, the expansion
includes the /G and /E directories. Actions appropriate for local OSS files under / often are not
appropriate for local Guardian files or for any files on other HP NonStop server nodes.
The UTILSGE environment variable that governs shell utility behavior can be used to test or
recommend whether use should include Guardian files or files on remote HP NonStop server
nodes. Note that UTILSGE settings are only advisory for functions; changing the variable value
does not affect function behavior. Refer to the environ(5) reference page either online or in the
Open System Services System Calls Reference Manual for more information about UTILSGE.
ERRORS
If any of the following conditions occurs, the wordexp( ) function returns the corresponding
nonzero constant, which is defined in the wordexp.h header file.
WRDE_BADCHAR
One of the unquoted characters |, &, ;, <, >, parenthesis, or braces appears in the
words parameter in an inappropriate context.
WRDE_BADVAL
A reference was made to an undefined shell variable when the WRDE_UNDEF
flag is set in the flags parameter.
527187-017 Hewlett-Packard Company 871