summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-04-28 22:29:26 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-04-28 22:29:26 +0800
commit57456cdf52f2dd420aed9a5653a0beef51d3bdaa (patch)
treec52eb4bb47dd776b6541a9aaf6e93c736bfebc0a
parent1cfd2ba12337bbad41d8e1c1bb5b828d7ef9bc95 (diff)
downloadpttbbs-57456cdf52f2dd420aed9a5653a0beef51d3bdaa.tar
pttbbs-57456cdf52f2dd420aed9a5653a0beef51d3bdaa.tar.gz
pttbbs-57456cdf52f2dd420aed9a5653a0beef51d3bdaa.tar.bz2
pttbbs-57456cdf52f2dd420aed9a5653a0beef51d3bdaa.tar.lz
pttbbs-57456cdf52f2dd420aed9a5653a0beef51d3bdaa.tar.xz
pttbbs-57456cdf52f2dd420aed9a5653a0beef51d3bdaa.tar.zst
pttbbs-57456cdf52f2dd420aed9a5653a0beef51d3bdaa.zip
DEBUG
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@129 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/Makefile26
-rw-r--r--mbbsd/mbbsd.c14
2 files changed, 30 insertions, 10 deletions
diff --git a/mbbsd/Makefile b/mbbsd/Makefile
index 4169ccb6..531488a4 100644
--- a/mbbsd/Makefile
+++ b/mbbsd/Makefile
@@ -1,22 +1,34 @@
-# $Id: Makefile,v 1.5 2002/04/10 10:51:24 in2 Exp $
+# $Id: Makefile,v 1.6 2002/04/28 14:29:26 in2 Exp $
BBSHOME?=$(HOME)
OSTYPE=FreeBSD
# FreeBSD
-CFLAGS_FreeBSD= -pipe -Wall -g -O -DHAVE_SETPROCTITLE -DBBSHOME='"$(BBSHOME)"' -DFreeBSD -I../include
-LDFLAGS_FreeBSD=-pipe -Wall -g -O
+CFLAGS_FreeBSD= -pipe -Wall -DHAVE_SETPROCTITLE -DBBSHOME='"$(BBSHOME)"' -DFreeBSD -I../include
+LDFLAGS_FreeBSD=-pipe -Wall
LIBS_FreeBSD= -lutil -lkvm
# Linux
-CFLAGS_linux= -pipe -Wall -g -O -DHAVE_DES_CRYPT -DBBSHOME='"$(BBSHOME)"' -DLinux -I../include -s
-LDFLAGS_linux= -pipe -Wall -g -O
+CFLAGS_linux= -pipe -Wall -DHAVE_DES_CRYPT -DBBSHOME='"$(BBSHOME)"' -DLinux -I../include -s
+LDFLAGS_linux= -pipe -Wall
LIBS_linux= -lcrypt
CFLAGS= $(CFLAGS_$(OSTYPE))
LDFLAGS=$(LDFLAGS_$(OSTYPE))
LIBS= $(LIBS_$(OSTYPE))
+.if defined(DEBUG)
+CFLAGS+= -g -DDEBUG
+LDFLAGS+= -g -DDEBUG
+.else
+CFLAGS+= -O
+LDFLAGS+= -O
+.endif
+
+.if defined(NO_FORK)
+CFLAGS+= -DNO_FORK
+.endif
+
CC= gcc
PROG= mbbsd
OBJS= admin.o announce.o args.o bbcall.o bbs.o board.o cache.o cal.o card.o\
@@ -30,12 +42,12 @@ OBJS= admin.o announce.o args.o bbcall.o bbs.o board.o cache.o cal.o card.o\
.SUFFIXES: .c .o
.c.o:
- $(CC) $(CFLAGS) -c $*.c
+ $(CC) $(ADDFLAGS) $(CFLAGS) -c $*.c
all: $(PROG)
$(PROG): $(OBJS)
- $(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS)
+ $(CC) $(ADDFLAGS) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS)
test: $(PROG)
killall -9 testmbbsd || true
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 49915683..e7a2f84d 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1,4 +1,4 @@
-/* $Id: mbbsd.c,v 1.22 2002/04/27 15:50:17 in2 Exp $ */
+/* $Id: mbbsd.c,v 1.23 2002/04/28 14:29:26 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -88,10 +88,12 @@ start_daemon ()
struct tm *dummy_time = localtime (&dummy);
strftime (buf, 80, "%d/%b/%Y:%H:%M:%S", dummy_time);
-
+
+#ifndef NO_FORK
if ((n = fork ())){
exit (0);
}
+#endif
/* rocker.011018: it's a good idea to close all unexcept fd!! */
n = getdtablesize ();
@@ -103,9 +105,11 @@ start_daemon ()
/* rocker.011018: after new session,
we should insure the process is clean daemon */
+#ifndef NO_FORK
if ((n = fork ())){
exit (0);
}
+#endif
}
static void
@@ -1363,11 +1367,15 @@ daemon_login (int argc, char *argv[], char *envp[])
close(csock);
continue;
}
-
+
+#ifdef NO_FORK
+ break;
+#else
if(fork()==0)
break;
else
close(csock);
+#endif
}
/* here is only child running */