diff options
Diffstat (limited to 'src/wordsplit.h')
-rw-r--r-- | src/wordsplit.h | 36 |
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); |