Open System Services Library Calls Reference Manual (G06.28+, H06.05+)
OSS Library Calls (w - z) wordexp(3)
— 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 speci
fied 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 flag 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 specififes 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.
WRDE_CMDSUB
Command substitution was requested when the WRDE_NOCMD flag is set in
the flags parameter.
WRDE_EOPEN
The popen( ) function returned an error. Check the errno value returned by that
function call.
527187-007 Hewlett-Packard Company 8−55