Include <wctype.h> after <wchar.h>,
[gnulib.git] / lib / quotearg.c
index 3cdbfbd..7fa5278 100644 (file)
 # 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 <stdlib.h>
 #endif
 # include <string.h>
 #endif
 
-#if HAVE_WCTYPE_H
-# include <wctype.h>
-#endif
-
 #if HAVE_MBRTOWC && HAVE_WCHAR_H
 # include <wchar.h>
+# if !HAVE_MBSTATE_T_OBJECT
+#  define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
+#  define mbstate_t int
+# endif
 #else
-# define iswprint(wc) 1
 # define mbrtowc(pwc, s, n, ps) 1
 # define mbsinit(ps) 1
 # define mbstate_t int
 #endif
 
+#if HAVE_WCTYPE_H
+# include <wctype.h>
+#endif
+#if !defined iswprint && !HAVE_ISWPRINT
+# define iswprint(wc) 1
+#endif
+
 #define INT_BITS (sizeof (int) * CHAR_BIT)
 
 #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
@@ -266,9 +278,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;