diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-06-21 21:58:22 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-06-21 21:58:22 +0300 |
commit | f507a4f071e7a77a040c535d00fa5a57d0cb6e1d (patch) | |
tree | 1cd213efb8a3fee22a036f1fd8bab511a8f55015 /include/smap | |
parent | 8bdc093422a9cb83dac7212ad1cd96a319d558ec (diff) | |
download | smap-f507a4f071e7a77a040c535d00fa5a57d0cb6e1d.tar.gz smap-f507a4f071e7a77a040c535d00fa5a57d0cb6e1d.tar.bz2 |
Implement WRDSF_NOSPLIT flag in wordsplit.
* include/smap/wordsplit.h (WRDSF_NOSPLIT): New flag.
* lib/wordsplit.c (wordsplit_len): If WRDSF_NOSPLIT is set,
treat entire input as if it were in double quotes.
Diffstat (limited to 'include/smap')
-rw-r--r-- | include/smap/wordsplit.h | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/include/smap/wordsplit.h b/include/smap/wordsplit.h index a836d83..822a324 100644 --- a/include/smap/wordsplit.h +++ b/include/smap/wordsplit.h @@ -42,53 +42,55 @@ struct wordsplit /* Append the words found to the array resulting from a previous call. */ -#define WRDSF_APPEND 0x00001 +#define WRDSF_APPEND 0x000001 /* Insert we_offs initial NULLs in the array ws_wordv. (These are not counted in the returned ws_wordc.) */ -#define WRDSF_DOOFFS 0x00002 +#define WRDSF_DOOFFS 0x000002 /* Don't do command substitution. Reserved for future use. */ -#define WRDSF_NOCMD 0x00004 +#define WRDSF_NOCMD 0x000004 /* The parameter p resulted from a previous call to wordsplit(), and wordsplit_free() was not called. Reuse the allocated storage. */ -#define WRDSF_REUSE 0x00008 +#define WRDSF_REUSE 0x000008 /* Print errors */ -#define WRDSF_SHOWERR 0x00010 +#define WRDSF_SHOWERR 0x000010 /* Consider it an error if an undefined shell variable is expanded. */ -#define WRDSF_UNDEF 0x00020 +#define WRDSF_UNDEF 0x000020 /* Don't do variable expansion. Reserved for future use. */ -#define WRDSF_NOVAR 0x00040 +#define WRDSF_NOVAR 0x000040 /* Abort on ENOMEM error */ -#define WRDSF_ENOMEMABRT 0x00080 +#define WRDSF_ENOMEMABRT 0x000080 /* Treat whitespace as delimiters */ -#define WRDSF_WS 0x00100 +#define WRDSF_WS 0x000100 /* Handle quotes and escape directives */ -#define WRDSF_QUOTE 0x00200 +#define WRDSF_QUOTE 0x000200 /* Replace each input sequence of repeated delimiters with a single delimiter */ -#define WRDSF_SQUEEZE_DELIMS 0x00400 +#define WRDSF_SQUEEZE_DELIMS 0x000400 /* Return delimiters */ -#define WRDSF_RETURN_DELIMS 0x00800 +#define WRDSF_RETURN_DELIMS 0x000800 /* Treat sed expressions as words */ -#define WRDSF_SED_EXPR 0x01000 +#define WRDSF_SED_EXPR 0x001000 /* ws_delim field is initialized */ -#define WRDSF_DELIM 0x02000 +#define WRDSF_DELIM 0x002000 /* ws_comment field is initialized */ -#define WRDSF_COMMENT 0x04000 +#define WRDSF_COMMENT 0x004000 /* ws_alloc_die field is initialized */ -#define WRDSF_ALLOC_DIE 0x08000 +#define WRDSF_ALLOC_DIE 0x008000 /* ws_error field is initialized */ -#define WRDSF_ERROR 0x10000 +#define WRDSF_ERROR 0x010000 /* ws_env field is initialized */ -#define WRDSF_ENV 0x20000 +#define WRDSF_ENV 0x020000 /* ws_getvar field is initialized */ -#define WRDSF_GETVAR 0x40000 +#define WRDSF_GETVAR 0x040000 /* enable debugging */ -#define WRDSF_DEBUG 0x80000 +#define WRDSF_DEBUG 0x080000 +/* Don't split input into words. Useful for side effects. */ +#define WRDSF_NOSPLIT 0x100000 -#define WRDSF_DEFFLAGS \ +#define WRDSF_DEFFLAGS \ (WRDSF_NOVAR | WRDSF_NOCMD | \ WRDSF_WS | WRDSF_QUOTE | WRDSF_SQUEEZE_DELIMS) |