#include <stdarg.h>
#include <stdio.h>
#include <ctype.h>
+#include <string.h>
#ifndef AFS_NT40_ENV
#include <netinet/in.h>
#include <netdb.h>
#if defined(AFS_AIX32_ENV) || defined(AFS_SUN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SGI65_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
int len = 0, dig, i;
while (val) {
- dig = val % base;
+ dig = (int) (val % base);
val = (val - dig) / base;
if (dig < 10)
dig = dig + '0';
int
afs_vsnprintf(char *p, size_t avail, const char *fmt, va_list ap)
{
- unsigned int width, precision, haveprec, len;
+ unsigned int width, precision, haveprec;
+ size_t len;
int ljust, plsign, spsign, altform, zfill;
int hflag, lflag, count, *countp, j;
char *x, *y, xbuf[MAXPREC + 21], fbuf[20];
* if spsign specified, IPaddr fields are space-filled to 3 digits
*/
UVAL = va_arg(ap, unsigned long);
- ia.s_addr = UVAL;
+ ia.s_addr = (unsigned long)UVAL;
if (haveprec && !precision)
he = 0;
else
*y = toupper(*y);
}
} else {
- UVAL = ntohl(UVAL);
+ UVAL = ntohl((unsigned long)UVAL);
if (zfill) {
x = "%03u.%03u.%03u.%03u";
} else if (spsign) {
{
int result;
result = afs_vsnprintf(p, avail, fmt, ap);
-#ifdef AFS_AIX51_ENV
+#if defined(AFS_AIX51_ENV) || defined(AFS_NT40_ENV)
return result;
#endif
}
#endif /* AFS_OSF20_ENV || AFS_AIX32_ENV */
+#ifndef HAVE_VSYSLOG
+void
+vsyslog(int priority, const char *format, va_list args)
+{
+ char buf[1024];
+ vsnprintf(buf, sizeof(buf), format, args);
+ syslog(priority, "%s", buf);
+}
+#endif
+
#ifndef AFS_NT40_ENV
#if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || (defined(AFS_SUN55_ENV) && !defined(AFS_SUN56_ENV)) || !defined(HAVE_SNPRINTF)