Previous: glibc match, Up: glibc [Index]
Word expansion is a set of operations acting on a given string and involving the current system environment variable; it is usually performed by Unix shell programs. It works as follows:
#!r6rs (import (rnrs) (prefix (vicare posix) px.) (prefix (vicare glibc) glibc.) (vicare platform constants)) (px.setenv "CIAO" "BLU") (glibc.wordexp/string "$CIAO" 0) ⇒ #("BLU") (px.setenv "CIAO" "BLUETTE") (glibc.wordexp/string "${CIAO##BLU}" 0) ⇒ #("ETTE") (glibc.wordexp/string "/bin/ch*" 0) ⇒ #("/bin/chcon""/bin/chgrp" "/bin/chmod" "/bin/chown" "/bin/chroot")
The following bindings are exported by the (vicare glibc)
library.
Interface to the C function wordexp()
, (libc)wordexp. Perform word expansion on words according to
flags.
words must be a string or bytevector. flags must be a
fixnum resulting from the bitwise combination (fxior
) of the
flags: WRDE_NOCMD
, WRDE_SHOWERR
, WRDE_UNDEF
.
If successful wordexp
returns a vector holding the resulting
bytevectors, wordexp/string
returns a vector holding the
resulting strings; else the return value is a fixnum among:
WRDE_BADCHAR
, WRDE_BADVAL
, WRDE_CMDSUB
,
WRDE_NOSPACE
, WRDE_SYNTAX
.