diff options
author | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-02-01 23:15:20 +0800 |
---|---|---|
committer | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-02-01 23:15:20 +0800 |
commit | eb02b264ab76ed138546da08deba14e64ffc22e1 (patch) | |
tree | 3c567c8dd350abcc0f6147f1316b990509f0a90e /innbbsd | |
parent | 09241e5aa2e98ce54e68a65064bcb7b2d24f8cf0 (diff) | |
download | pttbbs-eb02b264ab76ed138546da08deba14e64ffc22e1.tar pttbbs-eb02b264ab76ed138546da08deba14e64ffc22e1.tar.gz pttbbs-eb02b264ab76ed138546da08deba14e64ffc22e1.tar.bz2 pttbbs-eb02b264ab76ed138546da08deba14e64ffc22e1.tar.lz pttbbs-eb02b264ab76ed138546da08deba14e64ffc22e1.tar.xz pttbbs-eb02b264ab76ed138546da08deba14e64ffc22e1.tar.zst pttbbs-eb02b264ab76ed138546da08deba14e64ffc22e1.zip |
Clean up include files.
Fix some compile warnings
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4436 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'innbbsd')
-rw-r--r-- | innbbsd/ctlinnbbsd.c | 2 | ||||
-rw-r--r-- | innbbsd/dbz.c | 2 | ||||
-rw-r--r-- | innbbsd/dbz.h | 1 | ||||
-rw-r--r-- | innbbsd/dbztool.c | 41 | ||||
-rw-r--r-- | innbbsd/externs.h | 24 | ||||
-rw-r--r-- | innbbsd/his.c | 87 | ||||
-rw-r--r-- | innbbsd/his.h | 69 | ||||
-rw-r--r-- | innbbsd/innbbsd.c | 1 | ||||
-rw-r--r-- | innbbsd/inndchannel.c | 1 | ||||
-rw-r--r-- | innbbsd/mkhistory.c | 4 | ||||
-rw-r--r-- | innbbsd/receive_article.c | 1 |
11 files changed, 38 insertions, 195 deletions
diff --git a/innbbsd/ctlinnbbsd.c b/innbbsd/ctlinnbbsd.c index 67181fce..ed80b9f1 100644 --- a/innbbsd/ctlinnbbsd.c +++ b/innbbsd/ctlinnbbsd.c @@ -165,4 +165,6 @@ main(argc, argv) initsocket(); ctlinnbbsd(argc - optind, argv + optind); closesocket(); + + return 0; } diff --git a/innbbsd/dbz.c b/innbbsd/dbz.c index 9b031678..717c291a 100644 --- a/innbbsd/dbz.c +++ b/innbbsd/dbz.c @@ -985,7 +985,7 @@ fetch(key) /* try it */ buffer[keysize] = '\0'; /* terminated for DEBUG */ (void)mapcase(buffer, buffer, keysize); - DEBUG(("fetch: buffer (%s) looking for (%s) size = %d\n", + DEBUG(("fetch: buffer (%s) looking for (%s) size = %ld\n", buffer, key.dptr, keysize)); if (memcmp((POINTER) key.dptr, (POINTER) buffer, cmplen) == 0 && (*sepp == conf.fieldsep || *sepp == '\0')) { diff --git a/innbbsd/dbz.h b/innbbsd/dbz.h index 4883c1e6..bef0512f 100644 --- a/innbbsd/dbz.h +++ b/innbbsd/dbz.h @@ -25,6 +25,7 @@ extern long dbzsize(); extern int dbzincore(); extern int dbzcancel(); extern int dbzdebug(); +extern int dbzwritethrough(); /* * In principle we could handle unlimited-length keys by operating a chunk at diff --git a/innbbsd/dbztool.c b/innbbsd/dbztool.c index c519853a..74291494 100644 --- a/innbbsd/dbztool.c +++ b/innbbsd/dbztool.c @@ -1,24 +1,14 @@ -#include "bbs.h" +#include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/file.h> -#include "his.h" -#include "externs.h" #include <time.h> - -#define DEBUG 1 -#undef DEBUG +#include "his.h" static datum content, inputkey; static char dboutput[1025]; static char dbinput[1025]; -#if 0 -enum { - SUBJECT, FROM, NAME -}; -#endif - char * DBfetch(key) char *key; @@ -69,30 +59,3 @@ storeDB(mid, paths) return DBstore(mid, paths); } } - -int -my_mkdir(idir, mode) - char *idir; - int mode; -{ - char buffer[LEN]; - char *ptr, *dir = buffer; - struct stat st; - strncpy(dir, idir, LEN - 1); - for (; dir != NULL && *dir;) { - ptr = (char *)strchr(dir, '/'); - if (ptr != NULL) { - *ptr = '\0'; - } - if (stat(dir, &st) != 0) { - if (mkdir(dir, mode) != 0) - return -1; - } - chdir(dir); - if (ptr != NULL) - dir = ptr + 1; - else - dir = ptr; - } - return 0; -} diff --git a/innbbsd/externs.h b/innbbsd/externs.h index f17cb70b..de0fd84f 100644 --- a/innbbsd/externs.h +++ b/innbbsd/externs.h @@ -6,10 +6,7 @@ #include <netinet/in.h> #include "bbslib.h" #include "nocem.h" -#include "dbz.h" #include "daemon.h" -#include "his.h" -#include "bbs.h" /* file.c */ char *fileglue (char *, ...); @@ -60,19 +57,6 @@ void sethaltfunction(int (*)(int)); int INNBBSDshutdown(void); void installinnbbsd(void); -/* his.c */ -void HISclose(void); -void HISmaint(void); -void mkhistory(char *); -int myHISsetup(char *); -char *HISfilesfor(datum *, datum *); -int myHISwrite(datum *, char *); -void hisincore(int); -void HISsetup(void); -BOOL HISwrite(datum *, long, char *); -void mkhistory(char *); -time_t gethisinfo(void); - /* daemon.c */ int argify(char *, char ***); void deargify (char ***); @@ -88,13 +72,7 @@ int receive_nocem(void); /* closeonexec.c */ void closeOnExec(int, int); - -/* dbz.c */ -int dbzwritethrough(int); - -/* dbztool.c */ -char *DBfetch(char *); -int storeDB(char *, char *); +void CloseOnExec(int, int); /* inndchannel.c */ int innbbsdstartup(void); diff --git a/innbbsd/his.c b/innbbsd/his.c index 15345575..ae504a8d 100644 --- a/innbbsd/his.c +++ b/innbbsd/his.c @@ -3,11 +3,17 @@ * * History file routines. */ -#include "bbs.h" #include <stdlib.h> +#include <stdio.h> +#include <fcntl.h> +#include <ctype.h> +#include <sys/stat.h> +#include <sys/param.h> +#include <unistd.h> +#include "cmbbs.h" #include "innbbsconf.h" -#include "bbslib.h" #include "his.h" +#include "dbz.h" #include "externs.h" #define STATIC static @@ -252,41 +258,6 @@ HISclose(void) } } - -#ifdef HISset -/* - * * File in the DBZ datum for a Message-ID, making sure not to copy any * - * illegal characters. - */ -STATIC void -HISsetkey(p, keyp) - register char *p; - datum *keyp; -{ - static BUFFER MessageID; - register char *dest; - register int i; - - /* Get space to hold the ID. */ - i = strlen(p); - if (MessageID.Data == NULL) { - MessageID.Data = NEW(char, i + 1); - MessageID.Size = i; - } else if (MessageID.Size < i) { - RENEW(MessageID.Data, char, i + 1); - MessageID.Size = i; - } - for (keyp->dptr = dest = MessageID.Data; *p; p++) - if (*p == HIS_FIELDSEP || *p == '\n') - *dest++ = HIS_BADCHAR; - else - *dest++ = *p; - *dest = '\0'; - - keyp->dsize = dest - MessageID.Data + 1; -} - -#endif /* * * Get the list of files under which a Message-ID is stored. */ @@ -317,7 +288,7 @@ HISfilesfor(key, output) for (p = val.dptr, dest = (char *)&offset, i = sizeof offset; --i >= 0;) *dest++ = *p++; if (lseek(HISreadfd, offset, SEEK_SET) == -1) { - printf("fail here lseek %d\n", offset); + printf("fail here lseek %ld\n", offset); return NULL; } /* Read the text until \n or EOF. */ @@ -349,46 +320,6 @@ HISfilesfor(key, output) /* Translate newsgroup separators to slashes, return the fieldstart. */ } -/* - * * Have we already seen an article? - */ -#ifdef HISh -BOOL -HIShavearticle(MessageID) - char *MessageID; -{ - datum key; - datum val; - - HISsetkey(MessageID, &key); - val = dbzfetch(key); - return val.dptr != NULL; -} -#endif - - -/* - * * Turn a history filename entry from slashes to dots. It's a pity * we - * have to do this. - */ -STATIC void -HISslashify(p) - register char *p; -{ - register char *last; - - for (last = NULL; *p; p++) { - if (*p == '/') { - *p = '.'; - last = p; - } else if (*p == ' ' && last != NULL) - *last = '/'; - } - if (last) - *last = '/'; -} - - void IOError(error) char *error; diff --git a/innbbsd/his.h b/innbbsd/his.h index fab0f76e..73e0fbae 100644 --- a/innbbsd/his.h +++ b/innbbsd/his.h @@ -1,65 +1,15 @@ #ifndef HIS_H #define HIS_H -#include <stdio.h> -#include <fcntl.h> -#include <ctype.h> -#include <sys/stat.h> -#include <sys/param.h> -#ifndef SEEK_SET -#include <unistd.h> -#endif -#include "dbz.h" - -#ifndef XINDEXDIR -#define XINDEXDIR "/homec/xindex" -#endif -#ifndef _PATH_HISTORY -#define _PATH_HISTORY "/u/staff/bbsroot/csie_util/bntpd/history" -#endif - -#ifndef _PATH_COVERVIEW -#define _PATH_COVERVIEW ".coverview" -#endif -#ifndef _PATH_COVERVIEWDIR -#define _PATH_COVERVIEWDIR "/homec/xindex" -#endif +#include <dbz.h> #ifndef XINDEX_DBZINCORE #define XINDEX_DBZINCORE 1 #endif -#ifndef XINDEXNAME -#define XINDEXNAME ".index" -#endif -#ifndef XINDEXDBM -#define XINDEXDBM ".dbm" -#endif -#ifndef XINDEXINFO -#define XINDEXINFO ".info" -#endif #define LEN 1024 -struct t_article { - long artnum; - char subject[LEN]; /* Subject: line from mail header */ - char from[LEN]; /* From: line from mail header (address) */ - char name[LEN]; /* From: line from mail header (full nam e) */ - long date; /* Date: line from header in seconds */ - char xref[LEN]; /* Xref: cross posted article reference line */ - int lines; /* Lines: number of lines in article */ - char *archive; /* Archive-name: line from mail header */ - char *part; /* part no. of archive */ - char *patch; /* patch no. of archive */ -}; - -typedef struct t_article art_t; -#define HIS_BADCHAR '_' #define HIS_FIELDSEP '\t' -#define HIS_NOEXP "-" -#define HIS_SUBFIELDSEP '~' -/* #define HIS_FIELDSEP2 '\034' */ -#define HIS_FIELDSEP2 'I' #ifndef TRUE #define TRUE 1 @@ -74,4 +24,21 @@ typedef unsigned char BOOL; #define ICD_SYNC_COUNT 1 #endif +/* his.c */ +void HISclose(void); +void HISmaint(void); +void mkhistory(char *); +int myHISsetup(char *); +char *HISfilesfor(datum *, datum *); +int myHISwrite(datum *, char *); +void hisincore(int); +void HISsetup(void); +BOOL HISwrite(datum *, long, char *); +void mkhistory(char *); +time_t gethisinfo(void); + +/* dbztool.c */ +char *DBfetch(char *); +int storeDB(char *, char *); + #endif diff --git a/innbbsd/innbbsd.c b/innbbsd/innbbsd.c index e457ff76..22979b1e 100644 --- a/innbbsd/innbbsd.c +++ b/innbbsd/innbbsd.c @@ -7,6 +7,7 @@ #include "inntobbs.h" #include "nntp.h" #include "externs.h" +#include "his.h" #ifdef GETRUSAGE #include <sys/time.h> diff --git a/innbbsd/inndchannel.c b/innbbsd/inndchannel.c index 7122ffe5..8465d4d0 100644 --- a/innbbsd/inndchannel.c +++ b/innbbsd/inndchannel.c @@ -9,6 +9,7 @@ #include <netinet/in.h> #include <arpa/inet.h> #include "bbs.h" +#include "his.h" #define DEBUG #undef DEBUG diff --git a/innbbsd/mkhistory.c b/innbbsd/mkhistory.c index 565949ab..98e0a6ab 100644 --- a/innbbsd/mkhistory.c +++ b/innbbsd/mkhistory.c @@ -1,8 +1,6 @@ -#include "bbs.h" #include <stdlib.h> +#include "his.h" #include "externs.h" -#include "innbbsconf.h" -#include "bbslib.h" int main(argc, argv) diff --git a/innbbsd/receive_article.c b/innbbsd/receive_article.c index f35fd19b..b7d309fc 100644 --- a/innbbsd/receive_article.c +++ b/innbbsd/receive_article.c @@ -37,6 +37,7 @@ #include "bbslib.h" #include "inntobbs.h" #include "antisplam.h" +#include "his.h" extern int Junkhistory; |