aboutsummaryrefslogtreecommitdiff
path: root/src/wordsplit.h
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2014-10-30 16:58:00 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2015-12-17 15:26:28 +0200
commit59d4374b24e9f9f077f2e2e973fa75f3c3d505e0 (patch)
tree0ac1fef3e04c45554b1f893fbc28a8fc2ba019ac /src/wordsplit.h
parent56a02e741cd8d8b9dce27a79ae9bbcaf1713c4f7 (diff)
downloadgrecs-59d4374b24e9f9f077f2e2e973fa75f3c3d505e0.tar.gz
grecs-59d4374b24e9f9f077f2e2e973fa75f3c3d505e0.tar.bz2
Finish wordsplit docs, improve tests
Diffstat (limited to 'src/wordsplit.h')
-rw-r--r--src/wordsplit.h36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/wordsplit.h b/src/wordsplit.h
index 3c1d533..5f36b1e 100644
--- a/src/wordsplit.h
+++ b/src/wordsplit.h
@@ -43,7 +43,7 @@ struct wordsplit
Additional options. */
const char *ws_delim; /* [Input] (WRDSF_DELIM) Word delimiters. */
const char *ws_comment; /* [Input] (WRDSF_COMMENT) Comment characters. */
- const char *ws_escape; /* [Input] (WRDSF_ESCAPE) Characters to be escaped
+ const char *ws_escape[2]; /* [Input] (WRDSF_ESCAPE) Characters to be escaped
with backslash. */
void (*ws_alloc_die) (wordsplit_t *wsp);
/* [Input] (WRDSF_ALLOC_DIE) Function called when
@@ -184,13 +184,35 @@ struct wordsplit
WRDSF_QUOTE | WRDSF_SQUEEZE_DELIMS | WRDSF_CESCAPES)
/* Remove the word that produces empty string after path expansion */
-#define WRDSO_NULLGLOB 0x01
+#define WRDSO_NULLGLOB 0x00000001
/* Print error message if path expansion produces empty string */
-#define WRDSO_FAILGLOB 0x02
+#define WRDSO_FAILGLOB 0x00000002
/* Allow a leading period to be matched by metacharacters. */
-#define WRDSO_DOTGLOB 0x04
+#define WRDSO_DOTGLOB 0x00000004
/* ws_command needs argv parameter */
-#define WRDSO_ARGV 0x08
+#define WRDSO_ARGV 0x00000008
+/* Keep backslash in unrecognized escape sequences in words */
+#define WRDSO_BSKEEP_WORD 0x00000010
+/* Handle octal escapes in words */
+#define WRDSO_OESC_WORD 0x00000020
+/* Handle hex escapes in words */
+#define WRDSO_XESC_WORD 0x00000040
+
+/* Keep backslash in unrecognized escape sequences in quoted strings */
+#define WRDSO_BSKEEP_QUOTE 0x00000100
+/* Handle octal escapes in quoted strings */
+#define WRDSO_OESC_QUOTE 0x00000200
+/* Handle hex escapes in quoted strings */
+#define WRDSO_XESC_QUOTE 0x00000400
+
+#define WRDSO_BSKEEP WRDSO_BSKEEP_WORD
+#define WRDSO_OESC WRDSO_OESC_WORD
+#define WRDSO_XESC WRDSO_XESC_WORD
+
+/* Set escape option F in WS for words (Q==0) or quoted strings (Q==1) */
+#define WRDSO_ESC_SET(ws,q,f) ((ws)->ws_options |= ((f) << 4*(q)))
+/* Test WS for escape option F for words (Q==0) or quoted strings (Q==1) */
+#define WRDSO_ESC_TEST(ws,q,f) ((ws)->ws_options & ((f) << 4*(q)))
#define WRDSE_OK 0
#define WRDSE_EOF WRDSE_OK
@@ -215,10 +237,6 @@ int wordsplit_c_unquote_char (int c);
int wordsplit_c_quote_char (int c);
size_t wordsplit_c_quoted_length (const char *str, int quote_hex,
int *quote);
-void wordsplit_general_unquote_copy (char *dst, const char *src, size_t n,
- const char *escapable);
-void wordsplit_sh_unquote_copy (char *dst, const char *src, size_t n);
-void wordsplit_c_unquote_copy (char *dst, const char *src, size_t n);
void wordsplit_c_quote_copy (char *dst, const char *src, int quote_hex);
void wordsplit_perror (wordsplit_t *ws);

Return to:

Send suggestions and report system problems to the System administrator.