Open System Services Library Calls Reference Manual (G06.28+, H06.05+)

wordexp(3) OSS Library Calls Reference Manual
2. Parameter expansion, command substitution, and arithmetic expansion are performed
next, from beginning to end.
3. Field splitting is then performed on elds generated by Step 2, unless the IFS (Input Field
Separators) is full.
4. Pathname expansion is performed, unless the set -f command is in effect.
5. Quotation-mark removal is always performed last.
The wordexp_t structure is allocated by the caller, but memory to contain the expanded tokens is
allocated by the wordexp() function and added to the structure as needed.
The ags Parameter
The value of the ags parameter is the bitwise inclusive OR of the following constants, which are
dened in the wordexp.h header le:
WRDE_APPEND
Appends words generated by this call to those generated by a previous call to the
wordexp() function.
WRDE_DOOFFS
Makes use of the we_offs eld of the wordexp_t structure. If the
WRDE_DOOFFS ag is set, the we_offs eld is used to specify the number of
null pointers to add to the beginning of the list of pointers pointed to by the
we_wordv eld. If the WRDE_DOOFFS ag is not set in the rst call to the
wordexp() function with a pwordexp parameter, it should not be set in subse-
quent calls to the wordexp() function with a pwordexp parameter.
WRDE_NOCMD
Fails if command substitution is requested.
WRDE_REUSE
Can reuse previously allocated memory, because the pwordexp parameter was
passed to a previous successful call to the wordexp() function. Therefore, the
memory previously allocated might be reused.
WRDE_SHOWERR
Does not redirect the standard error le to /dev/null.
WRDE_UNDEF
Reports an error on an attempt to expand an undened shell variable.
The WRDE_ APPEND ag can be used to append a new set of words to those generated by a
previous call to the wordexp() function. The following rules apply when two or more calls to the
wordexp() function are made with the same value of the pwordexp parameter and without inter-
vening calls to the wordfree() function:
The rst such call does not set the WRDE_ APPEND ag. All subsequent calls set it.
For a single invocation of the wordexp() function, all calls either set the
WRDE_DOOFFS ag 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 specied by the WRDE_DOOFFS ag and the
we_offs eld of the wordexp_t structure.
854 Hewlett-Packard Company 527187-007