wordexp(3) Library Functions Manual wordexp(3) wordexp, wordfree - posix (libc -lc) #include int wordexp(const char *restrict s, wordexp_t *restrict p, int flags); void wordfree(wordexp_t *p); glibc ( feature_test_macros(7)): wordexp() wordfree(): _XOPEN_SOURCE wordexp() s p. wordexp_t we_wordc we_wordv we_offs. we_wordc size_t s. we_wordv char ** . we_offs size_t ( flags ) we_wordv NULL. wordfree() . we_wordv . ( sh(1)) s . | & ; < > ( ) { } . s # # . : ( ~user ) ( $FOO FOO) ( $(command) `command` ) . ($@ $* $# $? $- $$ $! $0) . $IFS. . we_wordv NULL. (flags) flag OR : WRDE_APPEND . WRDE_DOOFFS we_offs NULL we_wordv. ( we_wordc .) WRDE_NOCMD . WRDE_REUSE p wordexp() wordfree(). . WRDE_SHOWERR stderr /dev/null. stderr . WRDE_UNDEF . wordexp() 0. wordexp() : WRDE_BADCHAR |, &, ;, <, >, (, ), {, }. WRDE_BADVAL WRDE_UNDEF . WRDE_CMDSUB WRDE_NOCMD . WRDE_NOSPACE . WRDE_SYNTAX . attributes(7). +----------------------+------------------------------------+----------+ | | | | +----------------------+------------------------------------+----------+ |wordexp() | | MT-Unsafe | | | | race:utent | | | | const:env | | | | env | | | | sig:ALRM | | | | timer | | | | locale | +----------------------+------------------------------------+----------+ |wordfree() | | MT-Safe | +----------------------+------------------------------------+----------+ utent race:utent setutent(3) getutent(3) endutent(3) . wordexp() race:utent . POSIX.1-2008. POSIX.1-2001. glibc 2.1. "ls [a-c]*.c". #include #include #include int main(void) { wordexp_t p; char **w; wordexp("[a-c]*.c", &p, 0); w = p.we_wordv; for (size_t i = 0; i < p.we_wordc; i++) printf("%s\n", w[i]); wordfree(&p); exit(EXIT_SUCCESS); } fnmatch(3), glob(3) 3 . . : . 6.18 8 2026 wordexp(3)