From 448e079102f385b9205e29859b9850c80c2770aa Mon Sep 17 00:00:00 2001 From: in2 Date: Mon, 5 May 2003 05:30:02 +0000 Subject: replace varvars.h by stdarg.h (because gcc 3.3 no longer support varvars.h) git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk@821 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/innbbsd/Makefile | 7 ++++--- pttbbs/innbbsd/bbslib.c | 30 +++++++++++++++--------------- pttbbs/innbbsd/bbslib.h | 2 +- pttbbs/innbbsd/bbslink.c | 11 ++++------- pttbbs/innbbsd/bbslink2.c | 1 - pttbbs/innbbsd/echobbslib.c | 30 +++++++++++++++--------------- pttbbs/innbbsd/file.c | 34 ++++++++++++++++------------------ pttbbs/innbbsd/inntobbs.c | 4 +--- 8 files changed, 56 insertions(+), 63 deletions(-) diff --git a/pttbbs/innbbsd/Makefile b/pttbbs/innbbsd/Makefile index 38e9a2db..8fd415ad 100644 --- a/pttbbs/innbbsd/Makefile +++ b/pttbbs/innbbsd/Makefile @@ -5,13 +5,14 @@ # create : 95/03/29 # # update : 95/12/15 # # ------------------------------------------------------- # +# stdarg.h patch for pttbbs by in2 03/05/05 # #################################################### # this is a bbs <--> news gateway ##################################################### -VERSION=0.50beta-4 -LASTVERSION=0.50beta-3 -ADMINUSER= root@your.domain.name +VERSION=0.51 +LASTVERSION=0.50beta-4 +ADMINUSER?= root@your.domain.name BBSHOME?=$(HOME) BBS_SRC = .. TARGET = $(INNBBSD) $(BBSNNRP) $(BBSLINK) diff --git a/pttbbs/innbbsd/bbslib.c b/pttbbs/innbbsd/bbslib.c index 0dc808c3..c0177e87 100644 --- a/pttbbs/innbbsd/bbslib.c +++ b/pttbbs/innbbsd/bbslib.c @@ -1,9 +1,9 @@ #if defined( LINUX ) # include "innbbsconf.h" # include "bbslib.h" -# include +# include #else -# include +# include # include "innbbsconf.h" # include "bbslib.h" #endif @@ -76,17 +76,15 @@ setverboseoff() } } -verboselog(va_alist) -va_dcl +verboselog(char *fmt, ...) { va_list ap; - register char* fmt; char datebuf[40]; time_t now; if (verboseFlag == 0) return; - va_start(ap); + va_start(ap, fmt); time(&now); strftime(datebuf, sizeof(datebuf), "%b %d %X ", localtime(&now)); @@ -97,8 +95,10 @@ va_dcl else bbslogfp = fdopen(1, "a"); } - if (bbslogfp == NULL) { va_end(ap); return; } - fmt = va_arg(ap, char *) ; + if (bbslogfp == NULL) { + va_end(ap); + return; + } fprintf(bbslogfp,"%s[%d] ",datebuf, getpid()); vfprintf(bbslogfp, fmt, ap); fflush(bbslogfp); @@ -106,18 +106,16 @@ va_dcl } #ifdef PalmBBS -xbbslog(va_alist) +xbbslog(char *fmt, ...) #else -bbslog(va_alist) +bbslog(char *fmt, ...) #endif -va_dcl { va_list ap; - register char* fmt; char datebuf[40]; time_t now; - va_start(ap); + va_start(ap, fmt); time(&now); strftime(datebuf, sizeof(datebuf), "%b %d %X ", localtime(&now)); @@ -125,8 +123,10 @@ va_dcl if (bbslogfp == NULL) { bbslogfp = fopen(LOGFILE, "a"); } - if (bbslogfp == NULL) { va_end(ap); return; } - fmt = va_arg(ap, char *) ; + if (bbslogfp == NULL) { + va_end(ap); + return; + } fprintf(bbslogfp,"%s[%d] ",datebuf,getpid()); vfprintf(bbslogfp, fmt, ap); fflush(bbslogfp); diff --git a/pttbbs/innbbsd/bbslib.h b/pttbbs/innbbsd/bbslib.h index 190672b7..a03a1d67 100644 --- a/pttbbs/innbbsd/bbslib.h +++ b/pttbbs/innbbsd/bbslib.h @@ -51,7 +51,7 @@ int initial_bbs ARG((char* )); char *restrdup ARG((char *, char *)); nodelist_t *search_nodelist ARG((char *, char *)); newsfeeds_t *search_group ARG((char *)); -int bbslog ARG(()); +int bbslog(char *fmt, ...); void *mymalloc ARG((int)); void *myrealloc ARG((void *, int)); diff --git a/pttbbs/innbbsd/bbslink.c b/pttbbs/innbbsd/bbslink.c index 300f3f7d..1c0b1565 100644 --- a/pttbbs/innbbsd/bbslink.c +++ b/pttbbs/innbbsd/bbslink.c @@ -1,9 +1,9 @@ #if defined( LINUX ) # include "innbbsconf.h" # include "bbslib.h" -# include +# include #else -# include +# include # include "innbbsconf.h" # include "bbslib.h" #endif @@ -248,15 +248,12 @@ bbslink_get_lock(file) int -tcpcommand(va_alist) -va_dcl +tcpcommand(char *fmt, ...) { va_list ap; - register char *fmt; char *ptr; - va_start(ap); - fmt = va_arg(ap, char *); + va_start(ap, fmt); vfprintf(NNTPwfp, fmt, ap); fprintf(NNTPwfp, "\r\n"); fflush(NNTPwfp); diff --git a/pttbbs/innbbsd/bbslink2.c b/pttbbs/innbbsd/bbslink2.c index 70d39766..7a6834b3 100644 --- a/pttbbs/innbbsd/bbslink2.c +++ b/pttbbs/innbbsd/bbslink2.c @@ -223,7 +223,6 @@ va_dcl char *ptr; va_start(ap); - fmt = va_arg(ap, char *); vfprintf(NNTPwfp, fmt, ap); fprintf(NNTPwfp, "\r\n"); fflush(NNTPwfp); diff --git a/pttbbs/innbbsd/echobbslib.c b/pttbbs/innbbsd/echobbslib.c index 84d77de6..2511b50a 100644 --- a/pttbbs/innbbsd/echobbslib.c +++ b/pttbbs/innbbsd/echobbslib.c @@ -1,9 +1,9 @@ #if defined( LINUX ) # include "innbbsconf.h" # include "bbslib.h" -# include +# include #else -# include +# include # include "innbbsconf.h" # include "bbslib.h" #endif @@ -76,17 +76,15 @@ setverboseoff() } } -verboselog(va_alist) -va_dcl +verboselog(char *fmt, ...) { va_list ap; - register char* fmt; char datebuf[40]; time_t now; if (verboseFlag == 0) return; - va_start(ap); + va_start(ap, fmt); time(&now); strftime(datebuf, sizeof(datebuf), "%b %d %X ", localtime(&now)); @@ -97,8 +95,10 @@ va_dcl else bbslogfp = fdopen(1, "a"); } - if (bbslogfp == NULL) { va_end(ap); return; } - fmt = va_arg(ap, char *) ; + if (bbslogfp == NULL) { + va_end(ap); + return; + } fprintf(bbslogfp,"%s[%d] ",datebuf, getpid()); vfprintf(bbslogfp, fmt, ap); fflush(bbslogfp); @@ -106,18 +106,16 @@ va_dcl } #ifdef PalmBBS -xbbslog(va_alist) +xbbslog(char *fmt, ...) #else -bbslog(va_alist) +bbslog(char *fmt, ...) #endif -va_dcl { va_list ap; - register char* fmt; char datebuf[40]; time_t now; - va_start(ap); + va_start(ap, fmt); time(&now); strftime(datebuf, sizeof(datebuf), "%b %d %X ", localtime(&now)); @@ -125,8 +123,10 @@ va_dcl if (bbslogfp == NULL) { bbslogfp = fopen(LOGFILE, "a"); } - if (bbslogfp == NULL) { va_end(ap); return; } - fmt = va_arg(ap, char *) ; + if (bbslogfp == NULL) { + va_end(ap); + return; + } fprintf(bbslogfp,"%s[%d] ",datebuf,getpid()); vfprintf(bbslogfp, fmt, ap); fflush(bbslogfp); diff --git a/pttbbs/innbbsd/file.c b/pttbbs/innbbsd/file.c index d4df15b2..7016f940 100644 --- a/pttbbs/innbbsd/file.c +++ b/pttbbs/innbbsd/file.c @@ -1,7 +1,7 @@ #include #include #include -#include +#include #define MAXARGS 100 /* isfile is called by @@ -25,20 +25,14 @@ FILE *fp; fileglue("%s/%s",home,".newsrc"); */ -char *fileglue(va_alist) -va_dcl +char *fileglue(char *fmt, ...) { - va_list ap; - register char* fmt; - static char *newstring; - static char gluebuffer[8192]; - - va_start(ap); - fmt = va_arg(ap, char *) ; - vsprintf(gluebuffer, fmt, ap); - newstring = gluebuffer; - va_end(ap); - return newstring; + va_list ap; + static char gluebuffer[8192]; + va_start(ap, fmt); + vsprintf(gluebuffer, fmt, ap); + va_end(ap); + return gluebuffer; } long @@ -71,8 +65,8 @@ char* filename; return 1; } +#ifdef TEST int isfilev(va_alist) -va_dcl { va_list ap; struct stat st; @@ -88,6 +82,7 @@ va_dcl va_end(ap); return isfile(FILEBUF); } +#endif int isdir(filename) @@ -100,8 +95,8 @@ char* filename; return 1; } +#ifdef TEST int isdirv(va_alist) -va_dcl { va_list ap; struct stat st; @@ -116,6 +111,7 @@ va_dcl va_end(ap); return isdir(FILEBUF); } +#endif unsigned long mtime(filename) char* filename; @@ -125,8 +121,8 @@ char* filename; return st.st_mtime; } +#ifdef TEST unsigned long mtimev(va_alist) -va_dcl { va_list ap; struct stat st; @@ -141,6 +137,7 @@ va_dcl va_end(ap); return mtime(FILEBUF); } +#endif unsigned long atime(filename) char *filename; @@ -150,8 +147,8 @@ char *filename; return st.st_atime; } +#ifdef TEST unsigned long atimev(va_alist) -va_dcl { va_list ap; struct stat st; @@ -166,6 +163,7 @@ va_dcl va_end(ap); return atime(FILEBUF); } +#endif /*#undef TEST*/ #ifdef TEST diff --git a/pttbbs/innbbsd/inntobbs.c b/pttbbs/innbbsd/inntobbs.c index b57d8bb1..653ea488 100644 --- a/pttbbs/innbbsd/inntobbs.c +++ b/pttbbs/innbbsd/inntobbs.c @@ -18,9 +18,7 @@ ORGANIZATION_H, LASTHEADER, }; */ -char *strchr ARG((char*,int)); -char *strrchr ARG((char*,int)); -char *strstr ARG((char*,char*)); +#include header_t headertable[] = { "Subject" ,SUBJECT_H, -- cgit v1.2.3