1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-13 21:15:08 -05:00

Remove C99isms

This commit is contained in:
Dan Fandrich 2007-02-17 01:25:32 +00:00
parent 69f2f5cb6f
commit 213017e9cf

View File

@ -27,8 +27,6 @@
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <signal.h> #include <signal.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
@ -54,6 +52,7 @@
#include "curlx.h" /* from the private lib dir */ #include "curlx.h" /* from the private lib dir */
#include "getpart.h" #include "getpart.h"
#include "util.h" #include "util.h"
#include "timeval.h"
#if defined(ENABLE_IPV6) && defined(__MINGW32__) #if defined(ENABLE_IPV6) && defined(__MINGW32__)
const struct in6_addr in6addr_any = {{ IN6ADDR_ANY_INIT }}; const struct in6_addr in6addr_any = {{ IN6ADDR_ANY_INIT }};
@ -68,18 +67,20 @@ void logmsg(const char *msg, ...)
char buffer[512]; /* possible overflow if you pass in a huge string */ char buffer[512]; /* possible overflow if you pass in a huge string */
FILE *logfp; FILE *logfp;
int error; int error;
struct timeval tv;
time_t sec;
struct tm *now;
char timebuf[20];
if (!serverlogfile) { if (!serverlogfile) {
fprintf(stderr, "Error: serverlogfile not set\n"); fprintf(stderr, "Error: serverlogfile not set\n");
return; return;
} }
struct timeval tv = curlx_tvnow(); tv = curlx_tvnow();
time_t sec = tv.tv_sec; sec = tv.tv_sec;
struct tm *now = now = localtime(&sec); /* not multithread safe but we don't care */
localtime(&sec); /* not multithread safe but we don't care */
char timebuf[20];
snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld", snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld",
now->tm_hour, now->tm_min, now->tm_sec, tv.tv_usec); now->tm_hour, now->tm_min, now->tm_sec, tv.tv_usec);