path: root/include
authorSergey Poznyakoff <>2019-05-13 12:20:24 (GMT)
committer Sergey Poznyakoff <>2019-05-13 12:20:24 (GMT)
commit65f41a742e025487f8ec7f2e7ca2a3af3283fc96 (patch) (side-by-side diff)
treecef728d35f7683f7721659a58fdb2aa1f61387bc /include
parent07930c5ee74b8d2645fc55465833ab84e2f4444a (diff)
wordsplit: optionally disable splitting of unexpandable variable and command refs
* include/wordsplit.h (WRDSO_NOVARSPLIT) (WRDSO_NOCMDSPLIT): New options. * src/wordsplit.c (scan_word): Treat any variable reference, even containing whitespace, as a single word if WRDSO_NOVARSPLIT is set. Ditto for commands and WRDSO_NOCMDSPLIT. * tests/ Add new tests. * tests/wsp.c: Recognize novarsplit and nocmdsplit options. For future use: recognize bskeep_words, bskeep_quote, bskeep.
Diffstat (limited to 'include') (more/less context) (ignore whitespace changes)
1 files changed, 8 insertions, 3 deletions
diff --git a/include/wordsplit.h b/include/wordsplit.h
index 3a7ab25..a175275 100644
--- a/include/wordsplit.h
+++ b/include/wordsplit.h
@@ -203,5 +203,3 @@ struct wordsplit
#define WRDSO_DOTGLOB 0x00000004
-#if 0 /* Unused value */
-#define WRDSO_ARGV 0x00000008
+/* Unused value: 0x00000008 */
/* Keep backslash in unrecognized escape sequences in words */
@@ -222,2 +220,9 @@ struct wordsplit
#define WRDSO_XESC_QUOTE 0x00000400
+/* Unused: 0x00000800 */
+/* Don't split variable references, even if they contain whitespace
+ (e.g. ${VAR:-foo bar}) */
+#define WRDSO_NOVARSPLIT 0x00001000
+/* Don't split commands, even containing whitespace, e.g.
+ $(echo foo bar) */
+#define WRDSO_NOCMDSPLIT 0x00002000

Return to:

Send suggestions and report system problems to the System administrator.