add a note about nsswitch.conf entry required for sudo-ldap
[debian/sudo] / snprintf.c
index 4b7b2b52f3ae5c8d2af122b8c95462b17d92a98d..7ad4774691284d726aaa3d6a6e54c4873a531d36 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999-2005 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 1999-2005, 2008 Todd C. Miller <Todd.Miller@courtesan.com>
  * Copyright (c) 1990, 1993
  *     The Regents of the University of California.  All rights reserved.
  *
@@ -52,6 +52,9 @@
 #  include <stdlib.h>
 # endif
 #endif /* STDC_HEADERS */
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
 #ifdef HAVE_STRING_H
 # if defined(HAVE_MEMORY_H) && !defined(STDC_HEADERS)
 #  include <memory.h>
 
 #include <compat.h>
 
-#ifndef lint
-__unused static const char rcsid[] = "$Sudo: snprintf.c,v 1.14.4.2 2007/06/12 01:28:42 millert Exp $";
-#endif /* lint */
-
 static int xxxprintf    __P((char **, size_t, int, const char *, va_list));
 
 /*
@@ -91,18 +90,18 @@ static int xxxprintf         __P((char **, size_t, int, const char *, va_list));
 # define LONG_MAX      (ULONG_MAX / 2)
 #endif
 #ifdef HAVE_LONG_LONG
-# ifndef UQUAD_MAX
-#  ifdef ULONG_LONG_MAX
-#   define UQUAD_MAX   ULONG_LONG_MAX
+# ifndef ULLONG_MAX
+#  ifdef UQUAD_MAX
+#   define ULLONG_MAX  UQUAD_MAX
 #  else
-#   define UQUAD_MAX   ((unsigned long long)-1)
+#   define ULLONG_MAX  ((unsigned long long)-1)
 #  endif
 # endif
-# ifndef QUAD_MAX
-#  ifdef LONG_LONG_MAX
-#   define QUAD_MAX    LONG_LONG_MAX
+# ifndef LLONG_MAX
+#  ifdef QUAD_MAX
+#   define LLONG_MAX   QUAD_MAX
 #  else
-#   define QUAD_MAX    (UQUAD_MAX / 2)
+#   define LLONG_MAX   (ULLONG_MAX / 2)
 #  endif
 # endif
 #endif /* HAVE_LONG_LONG */
@@ -129,9 +128,9 @@ static int xxxprintf         __P((char **, size_t, int, const char *, va_list));
 #define BUF            68
 
 #ifndef HAVE_MEMCHR
-VOID *
+void *
 memchr(s, c, n)
-       const VOID *s;
+       const void *s;
        unsigned char c;
        size_t n;
 {
@@ -140,7 +139,7 @@ memchr(s, c, n)
 
                do {
                        if (*p++ == c)
-                               return ((VOID *)(p - 1));
+                               return ((void *)(p - 1));
                } while (--n != 0);
        }
        return (NULL);
@@ -237,7 +236,7 @@ __uqtoa(val, endp, base, octzero, xdigs)
                        *--cp = to_char(val % 10);
                        return (cp);
                }
-               if (val > QUAD_MAX) {
+               if (val > LLONG_MAX) {
                        *--cp = to_char(val % 10);
                        sval = val / 10;
                } else
@@ -537,7 +536,7 @@ reswitch:   switch (ch) {
                         * defined manner.''
                         *      -- ANSI X3J11
                         */
-                       ulval = (unsigned long)va_arg(ap, VOID *);
+                       ulval = (unsigned long)va_arg(ap, void *);
                        base = 16;
                        xdigs = "0123456789abcdef";
                        flags = (flags & ~QUADINT) | HEXPREFIX;