From 738be8220e48ccccb35d016d750e1721efaf64ca Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Fri, 20 Jun 2003 01:35:19 +0000 Subject: [PATCH] snprintf-string-includes-20030619 and some warnings killed. anyhow it should be happier now --- src/util/snprintf.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/util/snprintf.c b/src/util/snprintf.c index 1ef261376..09e25f968 100644 --- a/src/util/snprintf.c +++ b/src/util/snprintf.c @@ -14,6 +14,13 @@ RCSID("$Header$"); #if defined(AFS_AIX32_ENV) || defined(AFS_SUN_ENV) || defined(AFS_XBSD_ENV) #include #endif +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#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)); -- 2.39.5