diff options
-rw-r--r-- | pttbbs/innbbsd/bbslib.c | 7 | ||||
-rw-r--r-- | pttbbs/innbbsd/bbslib.h | 2 | ||||
-rw-r--r-- | pttbbs/innbbsd/bbsnnrp.c | 3 | ||||
-rw-r--r-- | pttbbs/innbbsd/connectsock.c | 11 | ||||
-rw-r--r-- | pttbbs/innbbsd/ctlinnbbsd.c | 1 | ||||
-rw-r--r-- | pttbbs/innbbsd/dbz.h | 4 | ||||
-rw-r--r-- | pttbbs/innbbsd/dbztool.c | 5 | ||||
-rw-r--r-- | pttbbs/innbbsd/echobbslib.c | 4 | ||||
-rw-r--r-- | pttbbs/innbbsd/externs.h | 72 | ||||
-rw-r--r-- | pttbbs/innbbsd/his.c | 11 | ||||
-rw-r--r-- | pttbbs/innbbsd/innbbsd.c | 5 | ||||
-rw-r--r-- | pttbbs/innbbsd/inndchannel.c | 23 | ||||
-rw-r--r-- | pttbbs/innbbsd/inntobbs.c | 6 | ||||
-rw-r--r-- | pttbbs/innbbsd/mkhistory.c | 1 | ||||
-rw-r--r-- | pttbbs/innbbsd/nocem.c | 6 | ||||
-rw-r--r-- | pttbbs/innbbsd/nocem.h | 4 | ||||
-rw-r--r-- | pttbbs/innbbsd/pmain.c | 1 | ||||
-rw-r--r-- | pttbbs/innbbsd/receive_article.c | 13 | ||||
-rw-r--r-- | pttbbs/innbbsd/rfc931.c | 2 | ||||
-rw-r--r-- | pttbbs/innbbsd/str_decode.c | 7 |
20 files changed, 150 insertions, 38 deletions
diff --git a/pttbbs/innbbsd/bbslib.c b/pttbbs/innbbsd/bbslib.c index f16d77ba..326c7d87 100644 --- a/pttbbs/innbbsd/bbslib.c +++ b/pttbbs/innbbsd/bbslib.c @@ -9,6 +9,7 @@ #include "bbslib.h" #endif #include "config.h" +#include "externs.h" char INNBBSCONF[MAXPATHLEN]; char INNDHOME[MAXPATHLEN]; @@ -62,19 +63,19 @@ verboseoff() } void -setverboseon() +setverboseon(void) { verboseFlag = 1; } int -isverboselog() +isverboselog(void) { return verboseFlag; } void -setverboseoff() +setverboseoff(void) { verboseoff(); if (bbslogfp != NULL) { diff --git a/pttbbs/innbbsd/bbslib.h b/pttbbs/innbbsd/bbslib.h index 20f7cfb9..2aebcb96 100644 --- a/pttbbs/innbbsd/bbslib.h +++ b/pttbbs/innbbsd/bbslib.h @@ -1,6 +1,6 @@ #ifndef BBSLIB_H #define BBSLIB_H - +#include <stdio.h> /* for FILE */ typedef struct nodelist_t { char *node; char *exclusion; diff --git a/pttbbs/innbbsd/bbsnnrp.c b/pttbbs/innbbsd/bbsnnrp.c index e011c595..bee96899 100644 --- a/pttbbs/innbbsd/bbsnnrp.c +++ b/pttbbs/innbbsd/bbsnnrp.c @@ -20,6 +20,7 @@ #include "bbslib.h" #include "daemon.h" #include "nntp.h" +#include "externs.h" #ifndef MAX_ARTS #define MAX_ARTS 100 @@ -74,6 +75,8 @@ char LockFile[1024]; #define INNBBSconnectOK NNTP_POSTOK_VAL nnrp_t BBSNNRP; +int writerc(nnrp_t *); +int INNBBSihave(nnrp_t *, ULONG, char *); void doterm(s) diff --git a/pttbbs/innbbsd/connectsock.c b/pttbbs/innbbsd/connectsock.c index 4b9382b5..5e526715 100644 --- a/pttbbs/innbbsd/connectsock.c +++ b/pttbbs/innbbsd/connectsock.c @@ -4,7 +4,10 @@ #include "daemon.h" #include <signal.h> #include <setjmp.h> - +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include "externs.h" static jmp_buf timebuf; static void @@ -34,7 +37,7 @@ dokill(s) static int INETDstart = 0; void -startfrominetd(flag) +startfrominetd(int flag) { INETDstart = flag; } @@ -54,11 +57,11 @@ standalonesetup(fd) } static char *UNIX_SERVER_PATH; -static int (*halt) (); +static int (*halt) (int); void sethaltfunction(haltfunc) - int (*haltfunc) (); + int (*haltfunc) (int); { halt = haltfunc; } diff --git a/pttbbs/innbbsd/ctlinnbbsd.c b/pttbbs/innbbsd/ctlinnbbsd.c index 45830dc4..95e7d315 100644 --- a/pttbbs/innbbsd/ctlinnbbsd.c +++ b/pttbbs/innbbsd/ctlinnbbsd.c @@ -1,6 +1,7 @@ #include <stdlib.h> #include "innbbsconf.h" #include "bbslib.h" +#include "externs.h" extern char *optarg; extern int opterr, optind; diff --git a/pttbbs/innbbsd/dbz.h b/pttbbs/innbbsd/dbz.h index 94414012..4883c1e6 100644 --- a/pttbbs/innbbsd/dbz.h +++ b/pttbbs/innbbsd/dbz.h @@ -1,4 +1,6 @@ /* for dbm and dbz */ +#ifndef _DBZ_H +#define _DBZ_H typedef struct { char *dptr; int dsize; @@ -30,3 +32,5 @@ extern int dbzdebug(); * them simplifies the code and doesn't hurt anything. */ #define DBZMAXKEY 255 + +#endif /* _DBZ_H */ diff --git a/pttbbs/innbbsd/dbztool.c b/pttbbs/innbbsd/dbztool.c index 34fc4046..c2d77476 100644 --- a/pttbbs/innbbsd/dbztool.c +++ b/pttbbs/innbbsd/dbztool.c @@ -2,6 +2,8 @@ #include <unistd.h> #include <sys/file.h> #include "his.h" +#include "externs.h" +#include <time.h> #define DEBUG 1 #undef DEBUG @@ -10,9 +12,12 @@ static datum content, inputkey; static char dboutput[1025]; static char dbinput[1025]; +#if 0 enum { SUBJECT, FROM, NAME }; +#endif + char * DBfetch(key) char *key; diff --git a/pttbbs/innbbsd/echobbslib.c b/pttbbs/innbbsd/echobbslib.c index 7efc00d4..0d34a443 100644 --- a/pttbbs/innbbsd/echobbslib.c +++ b/pttbbs/innbbsd/echobbslib.c @@ -10,6 +10,8 @@ #endif #include "config.h" +#include "externs.h" + char INNBBSCONF[MAXPATHLEN]; char INNDHOME[MAXPATHLEN]; char HISTORY[MAXPATHLEN]; @@ -239,7 +241,7 @@ initial_bbs(outgoing) } } #ifdef WITH_ECHOMAIL - bbsnameptr = (char *)fileglue("%s/bbsname.bbs", INNDHOME); + bbsnameptr = fileglue("%s/bbsname.bbs", INNDHOME); if ((FN = fopen(bbsnameptr, "r")) == NULL) { fprintf(stderr, "can't open file %s\n", bbsnameptr); return 0; diff --git a/pttbbs/innbbsd/externs.h b/pttbbs/innbbsd/externs.h index 84a59e8c..67edb8d1 100644 --- a/pttbbs/innbbsd/externs.h +++ b/pttbbs/innbbsd/externs.h @@ -9,8 +9,80 @@ #endif #endif +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include "bbslib.h" +#include "nocem.h" +#include "dbz.h" +#include "daemon.h" +#include "his.h" +#include "bbs.h" + char *fileglue ARG((char *,...)); char *ascii_date ARG(()); char **split ARG((char *, char *)); +char *my_rfc931_name(int, struct sockaddr_in *); +int isreturn(unsigned char); +nodelist_t *search_nodelist_bynode(char *node); +int isfile(char *); +void str_decode_M3(unsigned char *str); +int headervalue(char *); +int open_listen(char *, char *, int (*) ARG((int))); +int open_unix_listen(char *, char *, int (*) ARG((int))); +int unixclient(char *, char *); +int pmain(char *port); +void docompletehalt(int); +int p_unix_main(char *); +int INNBBSDshutdown(void); +void HISclose(void); +void HISmaint(void); +newsfeeds_t *search_board(char *board); +long filesize(char *); +int inetclient(char *, char *, char *); +int iszerofile(char *); +void init_echomailfp(void); +void init_bbsfeedsfp(void); +int isdir(char *); +int readnffile(char *); +int readnlfile(char *, char *); +int tryaccept(int); +void verboselog(char *fmt,...); +int argify(char *, char ***); +void deargify ARG((char ***)); +void mkhistory(char *); +int cancel_article_front(char *); +ncmperm_t *search_issuer(char *); +int myHISsetup(char *); +void closeOnExec(int, int); +int dbzwritethrough(int); +char *HISfilesfor(datum *, datum *); +int myHISwrite(datum *, char *); +void CloseOnExec(int, int); +void verboseon(char *); +daemoncmd_t *searchcmd(char *); +void hisincore(int); +void startfrominetd(int); +void HISsetup(void); +void installinnbbsd(void); +void sethaltfunction(int (*) (int)); +int innbbsdstartup(void); +int isverboselog(void); +time_t gethisinfo(void); +void setverboseoff(void); +void setverboseon(void); +char *DBfetch(char *); +int storeDB(char *, char *); +int readlines(ClientType *); +int receive_control(void); +int receive_nocem(void); +void clearfdset(int); +void channeldestroy(ClientType *); +BOOL HISwrite(datum *, long, char *); +void mkhistory(char *); +void testandmkdir(char *); +void feedfplog(newsfeeds_t *, char *, int); +char **BNGsplit(char *); +void bbsfeedslog(char *, int); #endif diff --git a/pttbbs/innbbsd/his.c b/pttbbs/innbbsd/his.c index 12a761c6..773fb78c 100644 --- a/pttbbs/innbbsd/his.c +++ b/pttbbs/innbbsd/his.c @@ -7,6 +7,7 @@ #include "innbbsconf.h" #include "bbslib.h" #include "his.h" +#include "externs.h" #define STATIC static /* STATIC char HIShistpath[] = _PATH_HISTORY; */ @@ -88,7 +89,7 @@ mkhistory(srchist) } time_t -gethisinfo() +gethisinfo(void) { FILE *hismaint; time_t lasthist; @@ -110,7 +111,7 @@ gethisinfo() } void -HISmaint() +HISmaint(void) { FILE *hismaint; time_t lasthist, now; @@ -174,7 +175,7 @@ HISmaint() * * Set up the history files. */ void -HISsetup() +HISsetup(void) { myHISsetup(HISTORY); } @@ -231,7 +232,7 @@ HISsync() * * Close the history files. */ void -HISclose() +HISclose(void) { if (HISwritefp != NULL) { /* @@ -441,8 +442,8 @@ myHISwrite(key, remain) BOOL HISwrite(key, date, paths) datum *key; - char *paths; long date; + char *paths; { long offset; datum val; diff --git a/pttbbs/innbbsd/innbbsd.c b/pttbbs/innbbsd/innbbsd.c index 88209bf6..f71ab30c 100644 --- a/pttbbs/innbbsd/innbbsd.c +++ b/pttbbs/innbbsd/innbbsd.c @@ -5,6 +5,7 @@ #include "bbslib.h" #include "inntobbs.h" #include "nntp.h" +#include "externs.h" #ifdef GETRUSAGE #include <sys/time.h> @@ -73,7 +74,7 @@ static daemoncmd_t cmds[] = }; void -installinnbbsd() +installinnbbsd(void) { installdaemon(cmds, 100, NULL); } @@ -237,7 +238,7 @@ INNBBSDhalt() } int -INNBBSDshutdown() +INNBBSDshutdown(void) { return shutdownflag; } diff --git a/pttbbs/innbbsd/inndchannel.c b/pttbbs/innbbsd/inndchannel.c index 8a920ce4..fe5b74ef 100644 --- a/pttbbs/innbbsd/inndchannel.c +++ b/pttbbs/innbbsd/inndchannel.c @@ -3,6 +3,11 @@ #include "daemon.h" #include "bbslib.h" #include "config.h" +#include "externs.h" +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include "bbs.h" #define DEBUG #undef DEBUG @@ -43,6 +48,8 @@ char *REMOTEUSERNAME, *REMOTEHOSTNAME; static fd_set rfd, wfd, efd, orfd, owfd, oefd; +int channelreader(ClientType *); + void clearfdset(fd) int fd; @@ -120,8 +127,8 @@ inndchannel(port, path) bbsinnd = pmain(port); if (bbsinnd < 0) { perror("pmain, existing"); - docompletehalt(); - return (-1); + docompletehalt(0); + return; } FD_ZERO(&rfd); FD_ZERO(&wfd); @@ -135,7 +142,7 @@ inndchannel(port, path) * running, try to remove %s\n",path); */ close(bbsinnd); - return (-1); + return; } else { FD_SET(localbbsinnd, &rfd); localdaemonready = 1; @@ -169,7 +176,7 @@ inndchannel(port, path) if (INNBBSDshutdown()) { HISclose(); bbslog(" Shutdown Complete \n"); - docompletehalt(); + docompletehalt(0); exit(0); } time(&now); @@ -268,7 +275,7 @@ inndchannel(port, path) FD_SET(ns, &rfd); /* FD_SET(ns,&wfd); */ length = sizeof(there); if (getpeername(ns, (struct sockaddr *) & there, &length) >= 0) { - name = (char *)my_rfc931_name(ns, &there); + name = (char *)my_rfc931_name(ns, (struct sockaddr_in *)&there); strncpy(client[i].username, name, 20); hp = (struct hostent *) gethostbyaddr((char *)&there.sin_addr, sizeof(struct in_addr), there.sin_family); if (hp) @@ -513,11 +520,11 @@ standaloneinit(port) FILE *pf; char pidfile[24]; ndescriptors = getdtablesize(); - /* #ifndef NOFORK */ +#ifndef NOFORK if (!inetdstart) if (fork()) exit(0); - /* #endif */ +#endif sprintf(pidfile, "/tmp/innbbsd-%s.pid", port); /* @@ -572,7 +579,7 @@ main() static time_t INNBBSDstartup; int -innbbsdstartup() +innbbsdstartup(void) { return INNBBSDstartup; } diff --git a/pttbbs/innbbsd/inntobbs.c b/pttbbs/innbbsd/inntobbs.c index f40d4cf5..b9982f0d 100644 --- a/pttbbs/innbbsd/inntobbs.c +++ b/pttbbs/innbbsd/inntobbs.c @@ -1,7 +1,9 @@ #include <stdio.h> +#include <stdlib.h> #include "daemon.h" #include "bbslib.h" #include <time.h> +#include "externs.h" #define INNTOBBS #include "inntobbs.h" @@ -148,7 +150,7 @@ static FILE *bbsfeedsfp = NULL; static int bbsfeedson = -1; void -init_bbsfeedsfp() +init_bbsfeedsfp(void) { if (bbsfeedsfp != NULL) { fclose(bbsfeedsfp); @@ -192,7 +194,7 @@ static FILE *echomailfp = NULL; static int echomaillogon = -1; void -init_echomailfp() +init_echomailfp(void) { if (echomailfp != NULL) { fclose(echomailfp); diff --git a/pttbbs/innbbsd/mkhistory.c b/pttbbs/innbbsd/mkhistory.c index cc986b03..c1278adb 100644 --- a/pttbbs/innbbsd/mkhistory.c +++ b/pttbbs/innbbsd/mkhistory.c @@ -1,4 +1,5 @@ #include <stdlib.h> +#include "externs.h" #include "innbbsconf.h" #include "bbslib.h" diff --git a/pttbbs/innbbsd/nocem.c b/pttbbs/innbbsd/nocem.c index cea4e088..595ecb1d 100644 --- a/pttbbs/innbbsd/nocem.c +++ b/pttbbs/innbbsd/nocem.c @@ -4,6 +4,7 @@ */ #include <stdlib.h> +#include "externs.h" #include "nocem.h" #define PGP5 #undef PGP2 @@ -27,6 +28,9 @@ FILE *NNTPwfp = NULL; char NNTPbuffer[1024]; int num_spammid = 0; char errmsg[1024] = "nothing"; +int NCMCOUNT = 0; +ncmperm_t *NCMPERM=NULL, **NCMPERM_BYTYPE=NULL; +static char *NCMPERM_BUF; /* ------------------------------------------------------------------ */ /* NCM initial and maintain */ @@ -590,7 +594,7 @@ initial_nocem() } int -receive_nocem() +receive_nocem(void) { int rel; diff --git a/pttbbs/innbbsd/nocem.h b/pttbbs/innbbsd/nocem.h index 40f3271d..de5b2d4d 100644 --- a/pttbbs/innbbsd/nocem.h +++ b/pttbbs/innbbsd/nocem.h @@ -19,10 +19,6 @@ typedef struct ncmperm_t int perm; } ncmperm_t; -ncmperm_t *NCMPERM=NULL, **NCMPERM_BYTYPE=NULL; -static char *NCMPERM_BUF; -int NCMCOUNT = 0; - #define TEXT 0 #define NCMHDR 1 #define NCMBDY 2 diff --git a/pttbbs/innbbsd/pmain.c b/pttbbs/innbbsd/pmain.c index 2f7e8c91..1b039c48 100644 --- a/pttbbs/innbbsd/pmain.c +++ b/pttbbs/innbbsd/pmain.c @@ -1,5 +1,6 @@ #include "innbbsconf.h" #include "daemon.h" +#include "externs.h" /* char *AccessFile=ACCESSFILE; */ #define INNBBSDPORT1 "1904" diff --git a/pttbbs/innbbsd/receive_article.c b/pttbbs/innbbsd/receive_article.c index 6e2e754e..b9672edd 100644 --- a/pttbbs/innbbsd/receive_article.c +++ b/pttbbs/innbbsd/receive_article.c @@ -24,7 +24,10 @@ * cacnel_article_front(mid) --> cancel_article() --> bbspost_write_cancel(); */ - +#include "externs.h" +#include <stdlib.h> +#define _XOPEN_SOURCE /* glibc2 needs this */ +#include <time.h> #ifndef PowerBBS #include "innbbsconf.h" #include "daemon.h" @@ -489,7 +492,7 @@ receive_article() } int -receive_control() +receive_control(void) { char *boardhome, *fname; char firstpath[MAXPATHLEN], *firstpathbase; @@ -866,9 +869,8 @@ nolfilename(n, fpath) sprintf(n->lockfn, "%s.lock", fpath); } - - -static int +#if 0 +int delete_record(const char *fpath, int size, int id) { nol my; @@ -941,6 +943,7 @@ delete_record(const char *fpath, int size, int id) close(fd); return 0; } +#endif int cancel_article(homepath, board, file) diff --git a/pttbbs/innbbsd/rfc931.c b/pttbbs/innbbsd/rfc931.c index 187f7929..33ee49fd 100644 --- a/pttbbs/innbbsd/rfc931.c +++ b/pttbbs/innbbsd/rfc931.c @@ -17,6 +17,8 @@ static char sccsid[] = "@(#) rfc931.c 1.4 93/03/07 22:47:52"; #endif #include <stdio.h> +#include <stdlib.h> +#include <unistd.h> #include <syslog.h> #include <sys/types.h> #include <sys/socket.h> diff --git a/pttbbs/innbbsd/str_decode.c b/pttbbs/innbbsd/str_decode.c index 4da40bcf..72a1f225 100644 --- a/pttbbs/innbbsd/str_decode.c +++ b/pttbbs/innbbsd/str_decode.c @@ -24,6 +24,7 @@ #include <stdio.h> #include <errno.h> #include <string.h> +#include <ctype.h> /* isspace() */ #define USE_ICONV 1 /* @@ -75,17 +76,19 @@ base64_code(int x) /* judge & decode QP / BASE64 */ /* ----------------------------------------------------- */ -static inline int +inline int isreturn(unsigned char c) { return c == '\r' || c == '\n'; } -static inline int +#if 0 /* in glibc */ +inline int isspace(unsigned char c) { return c == ' ' || c == '\t' || isreturn(c); } +#endif /* static inline */ int |