#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.65 2000-06-03 16:40:36 itojun Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.69 2000-07-11 00:49:03 assar Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
#include <pcap.h>
#include <stdio.h>
-#if __STDC__
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include <stdlib.h>
#include <string.h>
#ifdef TIME_WITH_SYS_TIME
break;
case -3: /* Default + Date*/
s = (tvp->tv_sec + thiszone) % 86400;
- time(&Time);
- tm = localtime(&Time);
+ Time = (tvp->tv_sec + thiszone) - s;
+ tm = gmtime (&Time);
(void)printf("%02d/%02d/%04d %02d:%02d:%02d.%06u ",
tm->tm_mon+1, tm->tm_mday,
tm->tm_year+1900,
/* VARARGS */
-__dead void
-#if __STDC__
+void
error(const char *fmt, ...)
-#else
-error(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
{
va_list ap;
(void)fprintf(stderr, "%s: ", program_name);
-#if __STDC__
va_start(ap, fmt);
-#else
- va_start(ap);
-#endif
(void)vfprintf(stderr, fmt, ap);
va_end(ap);
if (*fmt) {
/* VARARGS */
void
-#if __STDC__
warning(const char *fmt, ...)
-#else
-warning(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
{
va_list ap;
(void)fprintf(stderr, "%s: WARNING: ", program_name);
-#if __STDC__
va_start(ap, fmt);
-#else
- va_start(ap);
-#endif
(void)vfprintf(stderr, fmt, ap);
va_end(ap);
if (*fmt) {
ch = (unsigned char)(c & 0xff);
if (c < 0x80 && isprint(c))
- printf("\\%03o", c & 0xff);
- else
printf("%c", c & 0xff);
+ else
+ printf("\\%03o", c & 0xff);
}