]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
snprintf-string-includes-20030619
authorNathan Neulinger <nneul@umr.edu>
Fri, 20 Jun 2003 01:35:19 +0000 (01:35 +0000)
committerDerrick Brashear <shadow@dementia.org>
Fri, 20 Jun 2003 01:35:19 +0000 (01:35 +0000)
and some warnings killed. anyhow it should be happier now

src/util/snprintf.c

index 1ef261376a36a0c010b899daf3f6d4ca6f0f24f1..09e25f968a3b6289e687eb1d436fd44215569111 100644 (file)
@@ -14,6 +14,13 @@ RCSID("$Header$");
 #if defined(AFS_AIX32_ENV) || defined(AFS_SUN_ENV) || defined(AFS_XBSD_ENV)
 #include <sys/socket.h>
 #endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
 
 #define MAXPREC 100
 
@@ -332,15 +339,16 @@ int afs_vsnprintf(char *p, size_t avail, const char *fmt, va_list ap)
           x = he->h_name;
           len = strlen(x);
           if (haveprec && precision < len) len = precision;
-          if (altform)
-            for (y = x; *y; y++) if (isupper(*y)) *y = tolower(*y);
-          else if (plsign)
+          if (altform) {
+            for (y = x; *y; y++) if (isupper(*y)) *y = tolower(*y); }
+          else if (plsign) {
             for (y = x; *y; y++) if (islower(*y)) *y = toupper(*y);
+         }
         } else {
           UVAL = ntohl(UVAL);
-          if      (zfill)  x = "%03u.%03u.%03u.%03u";
-          else if (spsign) x = "%3u.%3u.%3u.%3u";
-          else             x = "%u.%u.%u.%u";
+          if      (zfill)  { x = "%03u.%03u.%03u.%03u"; }
+          else if (spsign) { x = "%3u.%3u.%3u.%3u"; }
+          else       {      x = "%u.%u.%u.%u"; }
           sprintf(xbuf, x,
                   (UVAL & 0xff000000) >> 24, (UVAL & 0x00ff0000) >> 16,
                   (UVAL & 0x0000ff00) >> 8,  (UVAL & 0x000000ff));