diff -Nur webalizer-1.30-04/Makefile.in webalizer-1.30-04-zlib/Makefile.in --- webalizer-1.30-04/Makefile.in Tue Jun 29 14:12:40 1999 +++ webalizer-1.30-04-zlib/Makefile.in Sun Sep 5 11:18:13 1999 @@ -33,15 +33,19 @@ # where are the GD header files? GDLIB = @GDLIB@ +# zlib support +#ZLIB_DEFS = -DZLIB # -I/usr/local/include +#ZLIB_LIBS = -lz # -L/usr/local/lib + # Shouldn't have to touch below here! all: webalizer webalizer: webalizer.o webalizer.h graphs.o graphs.h ctry.h webalizer_lang.h - $(CC) ${LDFLAGS} -o webalizer webalizer.o graphs.o ${LIBS} + $(CC) ${LDFLAGS} -o webalizer webalizer.o graphs.o ${LIBS} ${ZLIB_LIBS} webalizer.o: webalizer.c webalizer.h webalizer_lang.h ctry.h - $(CC) ${CFLAGS} ${DEFS} -c webalizer.c + $(CC) ${CFLAGS} ${DEFS} ${ZLIB_DEFS} -c webalizer.c graphs.o: graphs.c graphs.h webalizer_lang.h $(CC) ${CFLAGS} ${DEFS} -I${GDLIB} -c graphs.c diff -Nur webalizer-1.30-04/webalizer.c webalizer-1.30-04-zlib/webalizer.c --- webalizer-1.30-04/webalizer.c Mon Jul 12 02:36:10 1999 +++ webalizer-1.30-04-zlib/webalizer.c Sun Sep 5 08:19:29 1999 @@ -64,6 +64,18 @@ #define CLK_TCK _SC_CLK_TCK #endif +/* zlib */ +#ifdef ZLIB +#include +#define FOPEN(f,m) gzopen(f, m) +#define FCLOSE(f) gzclose(f) +#define FGETS(b,s,f) gzgets(f,b,s) +#else +#define FOPEN(f,m) fopen(f, m) +#define FCLOSE(f) fclose(f) +#define FGETS(b,s,f) fgets(b,s,f) +#endif + /*********************************************/ /* GLOBAL VARIABLES */ /*********************************************/ @@ -344,7 +356,7 @@ /* open log file */ if (log_fname) { - log_fp = fopen(log_fname,"r"); + log_fp = FOPEN(log_fname,"r"); if (!log_fp) { /* Error: Can't open log file ... */ @@ -440,7 +452,7 @@ /* MAIN PROCESS LOOP - read through log file */ /*********************************************/ - while ((fgets(buffer, BUFSIZE, log_fname?log_fp:stdin)) != NULL) + while ((FGETS(buffer, BUFSIZE, log_fname?log_fp:stdin)) != NULL) { total_rec++; if (strlen(buffer) == (BUFSIZE-1)) @@ -455,7 +467,7 @@ total_bad++; /* bump bad record counter */ /* get the rest of the record */ - while ( (fgets(buffer,BUFSIZE,log_fname?log_fp:stdin)) != NULL) + while ( (FGETS(buffer,BUFSIZE,log_fname?log_fp:stdin)) != NULL) { if (strlen(buffer) < BUFSIZE-1) { @@ -1101,7 +1113,7 @@ /*********************************************/ /* only close log if really a file */ - if (log_fname) fclose(log_fp); /* close log file */ + if (log_fname) FCLOSE(log_fp); /* close log file */ if (good_rec) /* were any good records? */ {