X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fquotearg.c;h=6e7ac8afed7b780ff65c5182fc80060e073113d8;hb=9b1445bd01af11c9c2b508e2c642fa415fb9c829;hp=9eb05161cf6a5c62297a8bbf075af5bdc395c877;hpb=c4b7f3f8557b27a729a0065bba401dc629357345;p=gnulib.git diff --git a/lib/quotearg.c b/lib/quotearg.c index 9eb05161c..6e7ac8afe 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -26,12 +26,6 @@ #include #include -#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) -# define ISASCII(c) 1 -#else -# define ISASCII(c) isascii (c) -#endif -#define ISPRINT(c) (ISASCII (c) && isprint (c)) #if ENABLE_NLS # include @@ -50,6 +44,12 @@ # define UCHAR_MAX ((unsigned char) -1) #endif +#if HAVE_C_BACKSLASH_A +# define ALERT_CHAR '\a' +#else +# define ALERT_CHAR '\7' +#endif + #if HAVE_STDLIB_H # include #endif @@ -58,6 +58,10 @@ # include #endif +#if HAVE_WCTYPE_H +# include +#endif + #if HAVE_MBRTOWC && HAVE_WCHAR_H # include #else @@ -69,6 +73,17 @@ #define INT_BITS (sizeof (int) * CHAR_BIT) +#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) +/* Undefine to protect against the definition in wctype.h of solaris2.6. */ +# undef ISASCII +# define ISASCII(c) 1 +#else +# define ISASCII(c) isascii (c) +#endif +/* Undefine to protect against the definition in wctype.h of solaris2.6. */ +#undef ISPRINT +#define ISPRINT(c) (ISASCII (c) && isprint (c)) + struct quoting_options { /* Basic quoting style. */ @@ -257,25 +272,24 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, } break; -#if HAVE_C_BACKSLASH_A - case '\a': esc = 'a'; goto c_escape; -#endif + case ALERT_CHAR: esc = 'a'; goto c_escape; case '\b': esc = 'b'; goto c_escape; case '\f': esc = 'f'; goto c_escape; - case '\n': esc = 'n'; goto c_escape; - case '\r': esc = 'r'; goto c_escape; - case '\t': esc = 't'; goto c_escape; + case '\n': esc = 'n'; goto c_and_shell_escape; + case '\r': esc = 'r'; goto c_and_shell_escape; + case '\t': esc = 't'; goto c_and_shell_escape; case '\v': esc = 'v'; goto c_escape; - case '\\': esc = c; goto c_escape; + case '\\': esc = c; goto c_and_shell_escape; + c_and_shell_escape: + if (quoting_style == shell_quoting_style) + goto use_shell_always_quoting_style; c_escape: if (backslash_escapes) { c = esc; goto store_escape; } - if (quoting_style == shell_quoting_style) - goto use_shell_always_quoting_style; break; case '#': case '~':