X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fquotearg.c;h=339bf34942854b0c59192058f24ec09576087275;hb=fa3486514bd8f15f8eb4c49821d0356b52e5a335;hp=c599acdbbc5ee14e44f82e168a2ff46b19e7593f;hpb=df4e570bc75f0ec8234ded88b130d934a630dedd;p=gnulib.git diff --git a/lib/quotearg.c b/lib/quotearg.c index c599acdbb..339bf3494 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -37,23 +37,6 @@ #define _(msgid) gettext (msgid) #define N_(msgid) msgid -#if !HAVE_MBRTOWC -/* Disable multibyte processing entirely. Since MB_CUR_MAX is 1, the - other macros are defined only for documentation and to satisfy C - syntax. */ -# undef MB_CUR_MAX -# define MB_CUR_MAX 1 -# undef mbstate_t -# define mbstate_t int -# define mbrtowc(pwc, s, n, ps) ((*(pwc) = *(s)) != 0) -# define iswprint(wc) isprint ((unsigned char) (wc)) -# undef HAVE_MBSINIT -#endif - -#if !defined mbsinit && !HAVE_MBSINIT -# define mbsinit(ps) 1 -#endif - #ifndef SIZE_MAX # define SIZE_MAX ((size_t) -1) #endif @@ -373,7 +356,11 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, 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_and_shell_escape; + case '\\': esc = c; + /* No need to escape the escape if we are trying to elide + outer quotes and nothing else is problematic. */ + if (backslash_escapes && elide_outer_quotes && quote_string_len) + goto store_c; c_and_shell_escape: if (quoting_style == shell_always_quoting_style