|
NAMEwordexp —
perform shell-style word expansions
LIBRARYStandard C Library (libc, -lc)SYNOPSIS#include <wordexp.h>
int
void
DESCRIPTIONThewordexp () function performs shell-style word
expansion on words and places the list of words into the
we_wordv member of we, and the
number of words into we_wordc.
The flags argument is the bitwise inclusive OR of any of the following constants:
The wordexp_t structure is defined in
typedef struct { size_t we_wordc; /* count of words matched */ char **we_wordv; /* pointer to list of words */ size_t we_offs; /* slots to reserve in we_wordv */ } wordexp_t; The IMPLEMENTATION NOTESThewordexp () function is implemented using the
undocumented freebsd_wordexp shell built-in command.
RETURN VALUESThewordexp () function returns zero if successful,
otherwise it returns one of the following error codes:
The ENVIRONMENT
EXAMPLESInvoke the editor on all .c files in the current directory and /etc/motd (error checking omitted):wordexp_t we; wordexp("${EDITOR:-vi} *.c /etc/motd", &we, 0); execvp(we.we_wordv[0], we.we_wordv); DIAGNOSTICSDiagnostic messages from the shell are written to the standard error output ifWRDE_SHOWERR is set in flags.
SEE ALSOsh(1), fnmatch(3), glob(3), popen(3), system(3)STANDARDSThewordexp () and wordfree ()
functions conform to IEEE Std 1003.1-2001
(“POSIX.1”).
BUGSThe currentwordexp () implementation does not recognize
multibyte characters other than UTF-8, since the shell (which it invokes to
perform expansions) does not.
SECURITY CONSIDERATIONSPathname generation may create output that is exponentially larger than the input size.Although this implementation detects command substitution reliably
for
Visit the GSP FreeBSD Man Page Interface. |