summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-09-12 11:31:16 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-09-12 11:31:16 +0800
commit535e458a1b28ecdf69dddcace060807e462980fd (patch)
tree6321dcb267e99a267c85cc113695e27b76cb1f70
parentfa932118b9ab9bffa96c1e73ab4aa982f60292cb (diff)
downloadpttbbs-535e458a1b28ecdf69dddcace060807e462980fd.tar
pttbbs-535e458a1b28ecdf69dddcace060807e462980fd.tar.gz
pttbbs-535e458a1b28ecdf69dddcace060807e462980fd.tar.bz2
pttbbs-535e458a1b28ecdf69dddcace060807e462980fd.tar.lz
pttbbs-535e458a1b28ecdf69dddcace060807e462980fd.tar.xz
pttbbs-535e458a1b28ecdf69dddcace060807e462980fd.tar.zst
pttbbs-535e458a1b28ecdf69dddcace060807e462980fd.zip
Solaris compatible
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2193 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/bbs.h4
-rw-r--r--include/osdep.h13
-rw-r--r--innbbsd/Makefile7
-rw-r--r--innbbsd/bbsnnrp.c2
-rw-r--r--innbbsd/connectsock.c2
-rw-r--r--innbbsd/innbbsconf.h12
-rw-r--r--innbbsd/port.c2
-rw-r--r--mbbsd/osdep.c30
-rw-r--r--mbbsd/register.c3
-rw-r--r--mbbsd/user.c3
-rw-r--r--util/Makefile4
-rw-r--r--util/reaper.c4
-rw-r--r--util/tunepasswd.c10
13 files changed, 64 insertions, 32 deletions
diff --git a/include/bbs.h b/include/bbs.h
index 5b4dca21..3a2f0cb9 100644
--- a/include/bbs.h
+++ b/include/bbs.h
@@ -1,7 +1,10 @@
/* $id$ */
+
#ifndef INCLUDE_BBS_H
#define INCLUDE_BBS_H
+#include "osdep.h"
+
#include <stdio.h>
#include <string.h>
#include <assert.h>
@@ -34,7 +37,6 @@
#include <sys/sem.h>
#include <sys/msg.h>
-#include "osdep.h"
/* our header */
#include "config.h"
diff --git a/include/osdep.h b/include/osdep.h
index a7c719d1..8e790595 100644
--- a/include/osdep.h
+++ b/include/osdep.h
@@ -9,13 +9,17 @@
#else
#include <machine/limits.h>
#endif
+
#include <machine/param.h>
+ #define _XOPEN_SOURCE
+ #define _ISOC99_SOURCE
+
#elif defined(__linux__)
- #include <sys/param.h>
+ #define _GNU_SOURCE
+
#include <sys/ioctl.h>
- #include <limits.h>
#include <sys/file.h> /* for flock() */
#include <strings.h> /* for strcasecmp() */
@@ -32,10 +36,13 @@
#include <limits.h>
#include <strings.h> /* for strcasecmp() */
+ #define _ISOC99_SOURCE
+
#define NEED_FLOCK
#define NEED_UNSETENV
#define NEED_SCANDIR
#define NEED_STRCASESTR
+ #define NEED_TIMEGM
#if __OS_MAJOR_VERSION__ == 5 && __OS_MINOR_VERSION__ < 8
#define NEED_STRLCPY
@@ -49,7 +56,7 @@
#else
- #warning "Unknown OSTYPE"
+ #error "Unknown OSTYPE"
#endif
diff --git a/innbbsd/Makefile b/innbbsd/Makefile
index 9399d32d..585bce6f 100644
--- a/innbbsd/Makefile
+++ b/innbbsd/Makefile
@@ -57,13 +57,14 @@ SRCS = inndchannel.c innbbsd.c connectsock.c rfc931.c \
port.c str_decode.c
MOBJS = makedbz.o bbslib.o file.o dbz.o closeonexec.o
-HOBJS = mkhistory.o bbslib.o file.o his.o dbz.o port.o closeonexec.o
+HOBJS = mkhistory.o bbslib.o file.o his.o dbz.o port.o closeonexec.o \
+ $(BBS_REC_EXTRA_$(OSTYPE))
DBZOBJS = dbzserver.o dbzinnbbsd.o pmain.o connectsock.o bbslib.o his.o \
daemon.o file.o dbz.o dbztool.o rfc931.o port.o closeonexec.o \
morelog.o
NNRPOBJS = bbsnnrp.o pmain.o bbslib.o connectsock.o file.o
LINKOBJS = bbslink.o pmain.o inntobbs.o echobbslib.o connectsock.o file.o port.o\
- str_decode.o
+ str_decode.o $(BBS_REC_EXTRA_$(OSTYPE))
LINKOBJS2 = bbslink2.o pmain.o inntobbs.o echobbslib.o connectsock.o file.o port.o
CTLOBJS = ctlinnbbsd.o pmain.o bbslib.o connectsock.o file.o
INNBBSD = innbbsd mkhistory bbsnnrp ctlinnbbsd $(BBSLINK)
@@ -97,7 +98,7 @@ irix:
Solaris: solaris
solaris:
- @$(MAKE) EXTRAFLAGS="-DMMAP -DSOLARIS -DSYSV -I/usr/local/include/ -I../include/" LDFLAGS="-L/usr/local/lib -liconv -lsocket -lnsl -lkstat ../mbbsd/osdep.o" YACC="bison -y" target
+ @$(MAKE) EXTRAFLAGS="-DMMAP -DSolaris -DSYSV -I/usr/local/include/ -I../include/" LDFLAGS="-L/usr/local/lib -liconv -lsocket -lnsl -lkstat" YACC="bison -y" target
FreeBSD:
@$(MAKE) CC=cc EXTRAFLAGS="-DBSD44 -DMMAP -DGETRUSAGE" LDFLAGS="-lcrypt -liconv" target
diff --git a/innbbsd/bbsnnrp.c b/innbbsd/bbsnnrp.c
index 544e3336..6aeeeb86 100644
--- a/innbbsd/bbsnnrp.c
+++ b/innbbsd/bbsnnrp.c
@@ -11,6 +11,7 @@
*/
#include "innbbsconf.h"
+#include "osdep.h"
#include <sys/mman.h>
#ifndef AIX
#include <sys/fcntl.h>
@@ -18,7 +19,6 @@
#include "bbslib.h"
#include "daemon.h"
#include "nntp.h"
-#include "osdep.h"
#ifndef MAX_ARTS
#define MAX_ARTS 100
diff --git a/innbbsd/connectsock.c b/innbbsd/connectsock.c
index f61ff160..45796d0c 100644
--- a/innbbsd/connectsock.c
+++ b/innbbsd/connectsock.c
@@ -1,8 +1,8 @@
+#include "osdep.h"
#include "innbbsconf.h"
#include "daemon.h"
#include <signal.h>
#include <setjmp.h>
-#include "osdep.h"
static jmp_buf timebuf;
diff --git a/innbbsd/innbbsconf.h b/innbbsd/innbbsconf.h
index 4e068443..dcdc5f21 100644
--- a/innbbsd/innbbsconf.h
+++ b/innbbsd/innbbsconf.h
@@ -134,14 +134,14 @@
#if !defined(__svr4__) || defined(sun)
#define WITH_TM_GMTOFF
#endif
-#if (defined(__svr4__) && defined(sun)) || defined(SOLARIS)
-#ifndef SOLARIS
-#define SOLARIS
+#if (defined(__svr4__) && defined(sun)) || defined(Solaris)
+#ifndef Solaris
+#define Solaris
#endif
#define NO_getdtablesize
-#define NO_bcopy
-#define NO_bzero
-#define NO_flock
+//#define NO_bcopy
+//#define NO_bzero
+//#define NO_flock
#define WITH_lockf
#endif
diff --git a/innbbsd/port.c b/innbbsd/port.c
index 8962ea14..fab82771 100644
--- a/innbbsd/port.c
+++ b/innbbsd/port.c
@@ -13,6 +13,7 @@ getdtablesize()
}
#endif
+#if 0
#if defined(SYSV) && !defined(WITH_RECORD_O)
#include <fcntl.h>
flock(fd, op)
@@ -31,3 +32,4 @@ flock(fd, op)
return lockf(fd, op, 0L);
}
#endif
+#endif
diff --git a/mbbsd/osdep.c b/mbbsd/osdep.c
index 1bca7208..598cc5fd 100644
--- a/mbbsd/osdep.c
+++ b/mbbsd/osdep.c
@@ -76,6 +76,36 @@ strlcat(dst, src, siz)
#endif
+#ifdef NEED_TIMEGM
+
+#include <time.h>
+#include <stdlib.h>
+
+time_t timegm (struct tm *tm)
+{
+ time_t ret;
+ char *tz;
+
+ tz = getenv("TZ");
+ putenv("TZ=");
+ tzset();
+ ret = mktime(tm);
+
+ if (tz){
+ char *buff = malloc( strlen(tz) + 10);
+ sprintf( buff, "TZ=%s", tz);
+ putenv(buff);
+ free(buff);
+ }
+ else
+ unsetenv("TZ");
+ tzset();
+
+ return ret;
+}
+
+#endif
+
#ifdef NEED_STRLCPY
/* ------------------------------------------------------------------------ */
diff --git a/mbbsd/register.c b/mbbsd/register.c
index a578f16a..e33a5098 100644
--- a/mbbsd/register.c
+++ b/mbbsd/register.c
@@ -1,7 +1,4 @@
/* $Id$ */
-#define _XOPEN_SOURCE
-#define _ISOC99_SOURCE
-
#include "bbs.h"
char *
diff --git a/mbbsd/user.c b/mbbsd/user.c
index eb93217e..819595a8 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -1,7 +1,4 @@
/* $Id$ */
-#define _XOPEN_SOURCE
-#define _ISOC99_SOURCE
-
#include "bbs.h"
static char * const sex[8] = {
diff --git a/util/Makefile b/util/Makefile
index 54e26131..e4e88871 100644
--- a/util/Makefile
+++ b/util/Makefile
@@ -24,13 +24,13 @@ CPROG_WITH_UTIL= \
reaper buildAnnounce inndBM shmctl \
outmail chkhbf checkmoney merge_dir \
transman angel gamblegive checkdir \
- chesscountry
+ chesscountry tunepasswd buildir
# 下面這些程式, 會直接被 compile
CPROG_WITHOUT_UTIL= \
shmsweep uhash_loader showboard \
countalldice webgrep bbsrf initbbs \
- userlist tunepasswd buildir merge_passwd \
+ userlist merge_passwd \
merge_board xchatd bbsmail
# 下面這些程式會被 install
diff --git a/util/reaper.c b/util/reaper.c
index 2fc587e0..7904566d 100644
--- a/util/reaper.c
+++ b/util/reaper.c
@@ -49,7 +49,11 @@ int check(int n, userec_t *u) {
int main(int argc, char **argv)
{
now = time(NULL);
+#ifdef Solaris
+ openlog("reaper", LOG_PID, SYSLOG_FACILITY);
+#else
openlog("reaper", LOG_PID | LOG_PERROR, SYSLOG_FACILITY);
+#endif
chdir(BBSHOME);
attach_SHM();
diff --git a/util/tunepasswd.c b/util/tunepasswd.c
index 1d575dcc..b617fb77 100644
--- a/util/tunepasswd.c
+++ b/util/tunepasswd.c
@@ -1,13 +1,5 @@
/* $Id$ */
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
+#include "bbs.h"
int tune(int num) {
int i, j, fin, fout;