HP-UX Reference (11i v3 07/02) - 3 Library Functions N-Z (vol 7)

w
wordexp(3C) wordexp(3C)
Zero or more null pointers, as specified by
WRDE_DOOFFS and pwordexp->we_offs .
Pointers to the words that were in the
pwordexp->we_wordv list 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
pwordexp->we_wordc
is the total number of words from all of the calls.
The application can change any of the fields after a call to
wordexp(), but if it does, it must
reset them to the original value before a subsequent call, using the same pwordexp value, to
wordfree() or wordexp() with the WRDE_APPEND or WRDE_REUSE
flag.
If words contains an unquoted newline,
|,
&, ;, <, >, parentheses, or curly brackets in an inappropriate
context,
wordexp() fails, and the number of expanded words is zero.
Unless WRDE_SHOWERR is set in flags,
wordexp() redirects stderr to /dev/null for any utilities exe-
cuted as a result of command substitution while expanding words.If
WRDE_SHOWERR is set, wor-
dexp()
writes messages to stderr if syntax errors are detected while expanding words.
If
WRDE_DOOFFS is set, pwordexp->we_offs
has the same value for each wordexp() call and the
wordfree() call using a given wordexp().
RETURN VALUE
Upon successful completion, wordexp() returns zero; otherwise, it returns a nonzero value defined in
<wordexp.h> to indicate the error:
WRDE_BADCHAR One of the unquoted characters |, &, ;, <, >, parentheses, or braces appears in
words in an inappropriate context.
WRDE_BADVAL Reference to undefined shell variable when WRDE_UNDEF is set in flags.
WRDE_CMDSUB Command substitution requested when WRDE_NOCMD was set in flags.
WRDE_NOSPACE Attempt to allocate memory failed.
WRDE_SYNTAX Shell syntax error such as unbalanced parentheses or unterminated string.
WRDE_INTERNAL Internal error.
If wordexp() returns the error value WRDE_NOSPACE , pwordexp->we_wordc and
pwordexp->we_wordv are updated to reflect any words that were successfully expanded. In other
cases, they are not modified.
AUTHOR
wordexp() and wordfree() were developed by OSF and HP.
SEE ALSO
sh-posix(1), fnmatch(3C), glob(3C), regexp(5), thread_safety(5).
STANDARDS CONFORMANCE
wordexp(): XPG4, POSIX.2
wordfree() : XPG4, POSIX.2
HP-UX 11i Version 3: February 2007 2 Hewlett-Packard Company 663