diff options
author | Eric Blake <ebb9@byu.net> | 2008-02-13 21:46:03 -0700 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2008-02-16 07:41:38 -0700 |
commit | df4e570bc75f0ec8234ded88b130d934a630dedd (patch) | |
tree | 21fea3e0abeaeaf7a08f9b2e32226cfb93b247f7 /lib/quotearg.h | |
parent | e301b04f6a43e37e77b15431c373d82c7f1cfc8c (diff) | |
download | gnulib-df4e570bc75f0ec8234ded88b130d934a630dedd.tar.gz |
Avoid trigraph quoting in default output.
* lib/quotearg.h (enum quoting_flags): Add QA_SPLIT_TRIGRAPHS.
* lib/quotearg.c (quotearg_buffer_restyled): Don't quote trigraphs
unless explicitly requested.
* tests/test-quotearg.c (flag_results, main): Add additional tests.
Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'lib/quotearg.h')
-rw-r--r-- | lib/quotearg.h | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/lib/quotearg.h b/lib/quotearg.h index 9f8177110f..078d9b6b53 100644 --- a/lib/quotearg.h +++ b/lib/quotearg.h @@ -75,14 +75,15 @@ enum quoting_style /* Quote names as for a C language string (ls --quoting-style=c). Behaves like c_maybe_quoting_style if QA_ELIDE_OUTER_QUOTES is - in effect. + in effect. Split into consecutive strings if + QA_SPLIT_TRIGRAPHS. quotearg_buffer: - "\"simple\"", "\"\\0 \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a:b\"" + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" quotearg: - "\"simple\"", "\"\\0 \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a:b\"" + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" quotearg_colon: - "\"simple\"", "\"\\0 \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a\\:b\"" + "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a\\:b\"" */ c_quoting_style, @@ -90,17 +91,16 @@ enum quoting_style characters if no quoted characters are encountered. quotearg_buffer: - "simple", "\"\\0 \\t\\n'\\\"\\033?\"\"?/\\\\\"", "a:b" + "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "a:b" quotearg: - "simple", "\"\\0 \\t\\n'\\\"\\033?\"\"?/\\\\\"", "a:b" + "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "a:b" quotearg_colon: - "simple", "\"\\0 \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a:b\"" + "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\"" */ c_maybe_quoting_style, /* Like c_quoting_style except always omit the surrounding - double-quote characters and don't worry about trigraphs (ls - --quoting-style=escape). + double-quote characters (ls --quoting-style=escape). quotearg_buffer: "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a:b" @@ -136,8 +136,7 @@ enum quoting_style locale_quoting_style, /* Like c_quoting_style except use quotation marks appropriate for - the locale and don't worry about trigraphs (ls - --quoting-style=clocale). + the locale (ls --quoting-style=clocale). LC_MESSAGES=C quotearg_buffer: @@ -171,7 +170,13 @@ enum quoting_flags /* Omit the surrounding quote characters if no escaped characters are encountered. */ - QA_ELIDE_OUTER_QUOTES = 0x02 + QA_ELIDE_OUTER_QUOTES = 0x02, + + /* In the c_quoting_style and c_maybe_quoting_style, split ANSI + trigraph sequences into concatenated strings (for example, + "?""?/" rather than "??/", which could be confused with + "\\"). */ + QA_SPLIT_TRIGRAPHS = 0x04 }; /* For now, --quoting-style=literal is the default, but this may change. */ |