summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-02-01 23:15:20 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-02-01 23:15:20 +0800
commitf4101aa2b3288cbfdb1284ac4c705cc2a4a8fbc2 (patch)
tree04377a9799d1649945ad1fadbc84710881a6ae55
parent98fa2f9a29047700a16737ae187ad05c5a9f75e7 (diff)
downloadpttbbs-f4101aa2b3288cbfdb1284ac4c705cc2a4a8fbc2.tar
pttbbs-f4101aa2b3288cbfdb1284ac4c705cc2a4a8fbc2.tar.gz
pttbbs-f4101aa2b3288cbfdb1284ac4c705cc2a4a8fbc2.tar.bz2
pttbbs-f4101aa2b3288cbfdb1284ac4c705cc2a4a8fbc2.tar.lz
pttbbs-f4101aa2b3288cbfdb1284ac4c705cc2a4a8fbc2.tar.xz
pttbbs-f4101aa2b3288cbfdb1284ac4c705cc2a4a8fbc2.tar.zst
pttbbs-f4101aa2b3288cbfdb1284ac4c705cc2a4a8fbc2.zip
Clean up include files.
Fix some compile warnings git-svn-id: http://opensvn.csie.org/pttbbs/trunk@4436 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/innbbsd/ctlinnbbsd.c2
-rw-r--r--pttbbs/innbbsd/dbz.c2
-rw-r--r--pttbbs/innbbsd/dbz.h1
-rw-r--r--pttbbs/innbbsd/dbztool.c41
-rw-r--r--pttbbs/innbbsd/externs.h24
-rw-r--r--pttbbs/innbbsd/his.c87
-rw-r--r--pttbbs/innbbsd/his.h69
-rw-r--r--pttbbs/innbbsd/innbbsd.c1
-rw-r--r--pttbbs/innbbsd/inndchannel.c1
-rw-r--r--pttbbs/innbbsd/mkhistory.c4
-rw-r--r--pttbbs/innbbsd/receive_article.c1
11 files changed, 38 insertions, 195 deletions
diff --git a/pttbbs/innbbsd/ctlinnbbsd.c b/pttbbs/innbbsd/ctlinnbbsd.c
index 67181fce..ed80b9f1 100644
--- a/pttbbs/innbbsd/ctlinnbbsd.c
+++ b/pttbbs/innbbsd/ctlinnbbsd.c
@@ -165,4 +165,6 @@ main(argc, argv)
initsocket();
ctlinnbbsd(argc - optind, argv + optind);
closesocket();
+
+ return 0;
}
diff --git a/pttbbs/innbbsd/dbz.c b/pttbbs/innbbsd/dbz.c
index 9b031678..717c291a 100644
--- a/pttbbs/innbbsd/dbz.c
+++ b/pttbbs/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/pttbbs/innbbsd/dbz.h b/pttbbs/innbbsd/dbz.h
index 4883c1e6..bef0512f 100644
--- a/pttbbs/innbbsd/dbz.h
+++ b/pttbbs/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/pttbbs/innbbsd/dbztool.c b/pttbbs/innbbsd/dbztool.c
index c519853a..74291494 100644
--- a/pttbbs/innbbsd/dbztool.c
+++ b/pttbbs/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/pttbbs/innbbsd/externs.h b/pttbbs/innbbsd/externs.h
index f17cb70b..de0fd84f 100644
--- a/pttbbs/innbbsd/externs.h
+++ b/pttbbs/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/pttbbs/innbbsd/his.c b/pttbbs/innbbsd/his.c
index 15345575..ae504a8d 100644
--- a/pttbbs/innbbsd/his.c
+++ b/pttbbs/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/pttbbs/innbbsd/his.h b/pttbbs/innbbsd/his.h
index fab0f76e..73e0fbae 100644
--- a/pttbbs/innbbsd/his.h
+++ b/pttbbs/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/pttbbs/innbbsd/innbbsd.c b/pttbbs/innbbsd/innbbsd.c
index e457ff76..22979b1e 100644
--- a/pttbbs/innbbsd/innbbsd.c
+++ b/pttbbs/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/pttbbs/innbbsd/inndchannel.c b/pttbbs/innbbsd/inndchannel.c
index 7122ffe5..8465d4d0 100644
--- a/pttbbs/innbbsd/inndchannel.c
+++ b/pttbbs/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/pttbbs/innbbsd/mkhistory.c b/pttbbs/innbbsd/mkhistory.c
index 565949ab..98e0a6ab 100644
--- a/pttbbs/innbbsd/mkhistory.c
+++ b/pttbbs/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/pttbbs/innbbsd/receive_article.c b/pttbbs/innbbsd/receive_article.c
index f35fd19b..b7d309fc 100644
--- a/pttbbs/innbbsd/receive_article.c
+++ b/pttbbs/innbbsd/receive_article.c
@@ -37,6 +37,7 @@
#include "bbslib.h"
#include "inntobbs.h"
#include "antisplam.h"
+#include "his.h"
extern int Junkhistory;