X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fquotearg.c;h=902192e701edc8bd0d5c92ccb7d3acceada6e184;hb=603d2944945d084c2b46af808808bcc2f2e73abe;hp=722fa734db0de6bd39cfdf7e83ca7b263f8d074f;hpb=cbdd6c8a97d2c2b324e902df553448e1bdb6b392;p=gnulib.git diff --git a/lib/quotearg.c b/lib/quotearg.c index 722fa734d..902192e70 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,21 +58,39 @@ # include #endif -#if HAVE_WCTYPE_H -# include -#endif - #if HAVE_MBRTOWC && HAVE_WCHAR_H # include +# if !HAVE_MBSTATE_T_OBJECT +# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0) +# endif #else -# define iswprint(wc) 1 -# define mbrtowc(pwc, s, n, ps) 1 +# define mbrtowc(pwc, s, n, ps) ((*(pwc) = *(s)) != 0) # define mbsinit(ps) 1 -# define mbstate_t int +# define iswprint(wc) ISPRINT ((unsigned char) (wc)) +#endif + +#ifndef iswprint +# if HAVE_WCTYPE_H +# include +# endif +# if !defined iswprint && !HAVE_ISWPRINT +# define iswprint(wc) 1 +# endif #endif #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. */ @@ -261,9 +279,7 @@ 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_and_shell_escape;