From 440a2643ed42f8be05450e0b00021d933f64e0b3 Mon Sep 17 00:00:00 2001 From: piaip Date: Sun, 11 Sep 2005 03:51:16 +0000 Subject: moving forward! git-svn-id: http://opensvn.csie.org/pttbbs/branches/piaip.automake@3154 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- README.1st | 41 +++++++++ configure.in | 1 + include/bbs.h | 2 +- include/bbsconf.h | 268 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/defconf.h | 268 ------------------------------------------------------ mbbsd/Makefile.am | 14 +-- mbbsd/chess.c | 4 - mbbsd/mbbsd.c | 5 - mbbsd/talk.c | 12 --- pttbbs.mk | 12 +-- util/Makefile.am | 123 +++++++++++-------------- util/bbsrf.c | 2 +- 12 files changed, 376 insertions(+), 376 deletions(-) create mode 100644 README.1st create mode 100644 include/bbsconf.h delete mode 100644 include/defconf.h diff --git a/README.1st b/README.1st new file mode 100644 index 00000000..ba15b7b6 --- /dev/null +++ b/README.1st @@ -0,0 +1,41 @@ +------------------------------------------ + +PTTBBS - 1.9 Branch + +Release Engineer: piaip + +------------------------------------------ + +1.9 branch is a whole new generation. +In this release we want to migrate old +MAKE system from pmake(BSD flavor) to +GNU Autoconf/Automake. And after this +it is believed that we will be able to +release faster and more stable. + +To apply this branch, please install: +Autoconf 2.59 +Automake 1.9 + +And run these commands in top level +directory: + +aclocal +autoheader +autoconf +automake -a + +Then you will be able to use +./configure +make + +------------------------------------------ +Warning: 1.9 Automake branch is STILL +WORK IN PROGRESS. That is, it's not stable +and may not be run/build/install. + +Any help is welcome to make it faster +released! + + piaip@csie.ntu.edu.tw, + Sun Sep 11 11:50:56 CST 2005 diff --git a/configure.in b/configure.in index a1721948..2321e3ed 100644 --- a/configure.in +++ b/configure.in @@ -10,6 +10,7 @@ AC_PREFIX_DEFAULT(/home/bbs) # Checks for programs. AC_PROG_CC +AC_PROG_RANLIB # Checks for libraries. diff --git a/include/bbs.h b/include/bbs.h index 4931ef99..321ee425 100644 --- a/include/bbs.h +++ b/include/bbs.h @@ -38,7 +38,7 @@ #include /* our header */ -#include "config.h" +#include "bbsconf.h" #ifdef TIMET64 typedef uint32_t time4_t; #else diff --git a/include/bbsconf.h b/include/bbsconf.h new file mode 100644 index 00000000..194e5dc9 --- /dev/null +++ b/include/bbsconf.h @@ -0,0 +1,268 @@ +/* $Id$ */ +#ifndef INCLUDE_CONFIG_H +#define INCLUDE_CONFIG_H + +#include +#include "../pttbbs.conf" + +#define BBSPROG BBSHOME "/bin/mbbsd" /* 主程式 */ +#define BAN_FILE "BAN" /* 關站通告檔 */ +#define LOAD_FILE "/proc/loadavg" /* for Linux */ + +#ifndef BBSUSER +#define BBSUSER "bbs" +#endif + +#ifndef BBSUID +#define BBSUID (9999) +#endif + +#ifndef BBSGID +#define BBSGID (99) +#endif + +#ifndef RELAY_SERVER_IP /* 寄站外信的 mail server */ +#define RELAY_SERVER_IP "127.0.0.1" +#endif + +#ifndef MAX_USERS /* 最高註冊人數 */ +#define MAX_USERS (150000) +#endif + +#ifndef MAX_ACTIVE +#define MAX_ACTIVE (1024) /* 最多同時上站人數 */ +#endif + +#ifndef MAX_CPULOAD +#define MAX_CPULOAD (70) /* CPU 最高load */ +#endif + +#ifndef MAX_LANG +#define MAX_LANG (1) /* 最多使用語言 */ +#endif + +#ifndef MAX_STRING +#define MAX_STRING (8000) /* 系統最多使用字串 */ +#endif + +#ifndef MAX_POST_MONEY /* 發表文章稿費的上限 */ +#define MAX_POST_MONEY (100) +#endif + +#ifndef MAX_CHICKEN_MONEY /* 養雞場獲利上限 */ +#define MAX_CHICKEN_MONEY (100) +#endif + +#ifndef MAX_GUEST_LIFE /* 最長未認證使用者保留時間(秒) */ +#define MAX_GUEST_LIFE (3 * 24 * 60 * 60) +#endif + +#ifndef MAX_EDIT_LINE +#define MAX_EDIT_LINE 2048 /* 文章最長編輯長度 */ +#endif + +#ifndef MAX_LIFE /* 最長使用者保留時間(秒) */ +#define MAX_LIFE (120 * 24 * 60 * 60) +#endif + +#ifndef MAX_FROM +#define MAX_FROM (300) /* 最多故鄉數 */ +#endif + +#ifndef THREAD_SEARCH_RANGE +#define THREAD_SEARCH_RANGE (500) +#endif + +#ifndef HAVE_JCEE /* 大學聯考查榜系統 */ +#define HAVE_JCEE 0 +#endif + +#ifndef MEM_CHECK +#define MEM_CHECK 0x98761234 +#endif + +#ifndef FOREIGN_REG_DAY /* 外籍使用者試用日期上限 */ +#define FOREIGN_REG_DAY 30 +#endif + +#ifndef HAVE_FREECLOAK +#define HAVE_FREECLOAK 0 +#endif + +#ifndef FORCE_PROCESS_REGISTER_FORM +#define FORCE_PROCESS_REGISTER_FORM 0 +#endif + +#ifndef TITLE_COLOR +#define TITLE_COLOR ANSI_COLOR(0;1;37;46) +#endif + +#ifndef SYSLOG_FACILITY +#define SYSLOG_FACILITY LOG_LOCAL0 +#endif + +#ifndef TAR_PATH +#define TAR_PATH "tar" +#endif + +#ifndef MUTT_PATH +#define MUTT_PATH "mutt" +#endif + +#ifndef HBFLexpire +#define HBFLexpire (432000) /* 5 days */ +#endif + +#ifndef MAXPATHLEN +#define MAXPATHLEN (256) +#endif + +#ifndef PATHLEN +#define PATHLEN (256) +#endif + +#ifndef MAX_BOARD +#define MAX_BOARD (8192) /* 最大開板個數 */ +#endif + +#ifndef MAX_EXKEEPMAIL +#define MAX_EXKEEPMAIL (1000) /* 最多信箱加大多少封 */ +#endif + +#ifndef OVERLOADBLOCKFDS +#define OVERLOADBLOCKFDS (0) /* 超載後會保留這麼多個 fd */ +#endif + +#ifndef HOTBOARDCACHE +#define HOTBOARDCACHE (0) /* 熱門看板快取 */ +#endif + +#ifndef INNTIMEZONE +#define INNTIMEZONE "+0800 (CST)" +#endif + +#ifndef ADD_EXMAILBOX +#define ADD_EXMAILBOX 0 /* 贈送信箱 */ +#endif + +#ifndef HASH_BITS +#define HASH_BITS 16 /* userid->uid hashing bits */ +#endif + +/* more.c 中文章頁數上限(lines/22), +4 for safe */ +#define MAX_PAGES (MAX_EDIT_LINE / 22 + 4) + +/* 以下還未整理 */ +#define MAX_FRIEND (256) /* 載入 cache 之最多朋友數目 */ +#define MAX_REJECT (32) /* 載入 cache 之最多壞人數目 */ +#define MAX_MSGS (10) /* 水球(熱訊)忍耐上限 */ +#define MAX_MOVIE (999) /* 最多動態看板數 */ +#define MAX_MOVIE_SECTION (10) /* 最多動態看板類別 */ +#define MAX_ITEMS (1000) /* 一個目錄最多有幾項 */ +#define MAX_HISTORY (12) /* 動態看板保持 12 筆歷史記錄 */ +#define MAX_CROSSNUM (9) /* 最多crosspost次數 */ +#define MAX_QUERYLINES (16) /* 顯示 Query/Plan 訊息最大行數 */ +#define MAX_LOGIN_INFO (128) /* 最多上線通知人數 */ +#define MAX_POST_INFO (32) /* 最多新文章通知人數 */ +#define MAX_NAMELIST (128) /* 最多其他特別名單人數 */ +#define MAX_KEEPMAIL (200) /* 最多保留幾封 MAIL? */ +#define MAX_NOTE (20) /* 最多保留幾篇留言? */ +#define MAX_SIGLINES (6) /* 簽名檔引入最大行數 */ +#define MAX_CROSSNUM (9) /* 最多crosspost次數 */ +#define MAX_REVIEW (7) /* 最多水球回顧 */ +#define NUMVIEWFILE (14) /* 進站畫面最多數 */ +#define MAX_SWAPUSED (0.7) /* SWAP最高使用率 */ +#define LOGINATTEMPTS (3) /* 最大進站失誤次數 */ +#define WHERE /* 是否有故鄉功能 */ +#undef LOG_BOARD /* 看板是否log */ + + +#define LOGINASNEW /* 採用上站申請帳號制度 */ +#define NO_WATER_POST /* 防止BlahBlah式灌水 */ +#define USE_BSMTP /* 使用opus的BSMTP 寄收信? */ +#define HAVE_ANONYMOUS /* 提供 Anonymous 板 */ +#undef POSTNOTIFY /* 新文章通知功能 */ +#define INTERNET_EMAIL /* 支援 InterNet Email 功能(含 Forward) */ +#define HAVE_ORIGIN /* 顯示 author 來自何處 */ +#undef HAVE_MAILCLEAN /* 清理所有使用者個人信箱 */ +#undef HAVE_SUICIDE /* 提供使用者自殺功能 */ +#undef HAVE_REPORT /* 系統追蹤報告 */ +#undef HAVE_INFO /* 顯示程式版本說明 */ +#undef HAVE_LICENSE /* 顯示 GNU 版權畫面 */ +#define FAST_LOGIN /* Login 不檢查遠端使用者 */ +#define HAVE_CAL /* 提供計算機 */ +#undef HAVE_REPORT /* 系統追蹤報告 */ +#undef NEWUSER_LIMIT /* 新手上路的三天限制 */ +#undef HAVE_X_BOARDS + +#define USE_LYNX /* 使用外部lynx dump ? */ +#undef USE_PROXY +#ifdef USE_PROXY +#define PROXYSERVER "140.112.28.165" +#define PROXYPORT 3128 +#endif +#define LOCAL_PROXY /* 是否開啟local 的proxy */ +#ifdef LOCAL_PROXY +#define HPROXYDAY 1 /* local的proxy refresh天數 */ +#endif + +#define SHOWMIND /* 看見心情 */ +#define SHOWUID /* 看見使用者 UID */ +#define SHOWBOARD /* 看見使用者看板 */ +#define SHOWPID /* 看見使用者 PID */ + +#define DOTIMEOUT +#ifdef DOTIMEOUT +#define IDLE_TIMEOUT (43200) /* 一般情況之 timeout (12hr) */ +#define MONITOR_TIMEOUT (20*60) /* monitor 時之 timeout */ +#define SHOW_IDLE_TIME /* 顯示閒置時間 */ +#endif + +#define SEM_ENTER -1 /* enter semaphore */ +#define SEM_LEAVE 1 /* leave semaphore */ +#define SEM_RESET 0 /* reset semaphore */ + +#define MAGIC_KEY 1234 /* 身分認證信函編碼 */ + +#define SHM_KEY 1228 +#if 0 +#define BRDSHM_KEY 1208 +#define UHASH_KEY 1218 /* userid->uid hash */ +#define UTMPSHM_KEY 2221 +#define PTTSHM_KEY 1220 /* 動態看板 , 節日 */ +#define FROMSHM_KEY 1223 /* whereis, 最多使用者 */ +#endif + +#define BRDSEM_KEY 2005 /* semaphore key */ +#define PTTSEM_KEY 2000 /* semaphore key */ +#define FROMSEM_KEY 2003 /* semaphore key */ +#define PASSWDSEM_KEY 2010 + +#define NEW_CHATPORT 3838 +#define CHATPORT 5722 + +#define MAX_ROOM 16 /* 最多有幾間包廂? */ + +#define EXIT_LOGOUT 0 +#define EXIT_LOSTCONN -1 +#define EXIT_CLIERROR -2 +#define EXIT_TIMEDOUT -3 +#define EXIT_KICK -4 + +#define CHAT_LOGIN_OK "OK" +#define CHAT_LOGIN_EXISTS "EX" +#define CHAT_LOGIN_INVALID "IN" +#define CHAT_LOGIN_BOGUS "BG" +#define BADCIDCHARS " *" /* Chat Room 中禁用於 nick 的字元 */ + +#define ALLPOST "ALLPOST" +#define ALLHIDPOST "ALLHIDPOST" + +#define MAXTAGS 256 +#define BRC_STRLEN 15 /* Length of board name */ +#define BRC_MAXSIZE 24576 +#define BRC_MAXNUM 80 + +#define WRAPMARGIN (511) + +#endif diff --git a/include/defconf.h b/include/defconf.h deleted file mode 100644 index 194e5dc9..00000000 --- a/include/defconf.h +++ /dev/null @@ -1,268 +0,0 @@ -/* $Id$ */ -#ifndef INCLUDE_CONFIG_H -#define INCLUDE_CONFIG_H - -#include -#include "../pttbbs.conf" - -#define BBSPROG BBSHOME "/bin/mbbsd" /* 主程式 */ -#define BAN_FILE "BAN" /* 關站通告檔 */ -#define LOAD_FILE "/proc/loadavg" /* for Linux */ - -#ifndef BBSUSER -#define BBSUSER "bbs" -#endif - -#ifndef BBSUID -#define BBSUID (9999) -#endif - -#ifndef BBSGID -#define BBSGID (99) -#endif - -#ifndef RELAY_SERVER_IP /* 寄站外信的 mail server */ -#define RELAY_SERVER_IP "127.0.0.1" -#endif - -#ifndef MAX_USERS /* 最高註冊人數 */ -#define MAX_USERS (150000) -#endif - -#ifndef MAX_ACTIVE -#define MAX_ACTIVE (1024) /* 最多同時上站人數 */ -#endif - -#ifndef MAX_CPULOAD -#define MAX_CPULOAD (70) /* CPU 最高load */ -#endif - -#ifndef MAX_LANG -#define MAX_LANG (1) /* 最多使用語言 */ -#endif - -#ifndef MAX_STRING -#define MAX_STRING (8000) /* 系統最多使用字串 */ -#endif - -#ifndef MAX_POST_MONEY /* 發表文章稿費的上限 */ -#define MAX_POST_MONEY (100) -#endif - -#ifndef MAX_CHICKEN_MONEY /* 養雞場獲利上限 */ -#define MAX_CHICKEN_MONEY (100) -#endif - -#ifndef MAX_GUEST_LIFE /* 最長未認證使用者保留時間(秒) */ -#define MAX_GUEST_LIFE (3 * 24 * 60 * 60) -#endif - -#ifndef MAX_EDIT_LINE -#define MAX_EDIT_LINE 2048 /* 文章最長編輯長度 */ -#endif - -#ifndef MAX_LIFE /* 最長使用者保留時間(秒) */ -#define MAX_LIFE (120 * 24 * 60 * 60) -#endif - -#ifndef MAX_FROM -#define MAX_FROM (300) /* 最多故鄉數 */ -#endif - -#ifndef THREAD_SEARCH_RANGE -#define THREAD_SEARCH_RANGE (500) -#endif - -#ifndef HAVE_JCEE /* 大學聯考查榜系統 */ -#define HAVE_JCEE 0 -#endif - -#ifndef MEM_CHECK -#define MEM_CHECK 0x98761234 -#endif - -#ifndef FOREIGN_REG_DAY /* 外籍使用者試用日期上限 */ -#define FOREIGN_REG_DAY 30 -#endif - -#ifndef HAVE_FREECLOAK -#define HAVE_FREECLOAK 0 -#endif - -#ifndef FORCE_PROCESS_REGISTER_FORM -#define FORCE_PROCESS_REGISTER_FORM 0 -#endif - -#ifndef TITLE_COLOR -#define TITLE_COLOR ANSI_COLOR(0;1;37;46) -#endif - -#ifndef SYSLOG_FACILITY -#define SYSLOG_FACILITY LOG_LOCAL0 -#endif - -#ifndef TAR_PATH -#define TAR_PATH "tar" -#endif - -#ifndef MUTT_PATH -#define MUTT_PATH "mutt" -#endif - -#ifndef HBFLexpire -#define HBFLexpire (432000) /* 5 days */ -#endif - -#ifndef MAXPATHLEN -#define MAXPATHLEN (256) -#endif - -#ifndef PATHLEN -#define PATHLEN (256) -#endif - -#ifndef MAX_BOARD -#define MAX_BOARD (8192) /* 最大開板個數 */ -#endif - -#ifndef MAX_EXKEEPMAIL -#define MAX_EXKEEPMAIL (1000) /* 最多信箱加大多少封 */ -#endif - -#ifndef OVERLOADBLOCKFDS -#define OVERLOADBLOCKFDS (0) /* 超載後會保留這麼多個 fd */ -#endif - -#ifndef HOTBOARDCACHE -#define HOTBOARDCACHE (0) /* 熱門看板快取 */ -#endif - -#ifndef INNTIMEZONE -#define INNTIMEZONE "+0800 (CST)" -#endif - -#ifndef ADD_EXMAILBOX -#define ADD_EXMAILBOX 0 /* 贈送信箱 */ -#endif - -#ifndef HASH_BITS -#define HASH_BITS 16 /* userid->uid hashing bits */ -#endif - -/* more.c 中文章頁數上限(lines/22), +4 for safe */ -#define MAX_PAGES (MAX_EDIT_LINE / 22 + 4) - -/* 以下還未整理 */ -#define MAX_FRIEND (256) /* 載入 cache 之最多朋友數目 */ -#define MAX_REJECT (32) /* 載入 cache 之最多壞人數目 */ -#define MAX_MSGS (10) /* 水球(熱訊)忍耐上限 */ -#define MAX_MOVIE (999) /* 最多動態看板數 */ -#define MAX_MOVIE_SECTION (10) /* 最多動態看板類別 */ -#define MAX_ITEMS (1000) /* 一個目錄最多有幾項 */ -#define MAX_HISTORY (12) /* 動態看板保持 12 筆歷史記錄 */ -#define MAX_CROSSNUM (9) /* 最多crosspost次數 */ -#define MAX_QUERYLINES (16) /* 顯示 Query/Plan 訊息最大行數 */ -#define MAX_LOGIN_INFO (128) /* 最多上線通知人數 */ -#define MAX_POST_INFO (32) /* 最多新文章通知人數 */ -#define MAX_NAMELIST (128) /* 最多其他特別名單人數 */ -#define MAX_KEEPMAIL (200) /* 最多保留幾封 MAIL? */ -#define MAX_NOTE (20) /* 最多保留幾篇留言? */ -#define MAX_SIGLINES (6) /* 簽名檔引入最大行數 */ -#define MAX_CROSSNUM (9) /* 最多crosspost次數 */ -#define MAX_REVIEW (7) /* 最多水球回顧 */ -#define NUMVIEWFILE (14) /* 進站畫面最多數 */ -#define MAX_SWAPUSED (0.7) /* SWAP最高使用率 */ -#define LOGINATTEMPTS (3) /* 最大進站失誤次數 */ -#define WHERE /* 是否有故鄉功能 */ -#undef LOG_BOARD /* 看板是否log */ - - -#define LOGINASNEW /* 採用上站申請帳號制度 */ -#define NO_WATER_POST /* 防止BlahBlah式灌水 */ -#define USE_BSMTP /* 使用opus的BSMTP 寄收信? */ -#define HAVE_ANONYMOUS /* 提供 Anonymous 板 */ -#undef POSTNOTIFY /* 新文章通知功能 */ -#define INTERNET_EMAIL /* 支援 InterNet Email 功能(含 Forward) */ -#define HAVE_ORIGIN /* 顯示 author 來自何處 */ -#undef HAVE_MAILCLEAN /* 清理所有使用者個人信箱 */ -#undef HAVE_SUICIDE /* 提供使用者自殺功能 */ -#undef HAVE_REPORT /* 系統追蹤報告 */ -#undef HAVE_INFO /* 顯示程式版本說明 */ -#undef HAVE_LICENSE /* 顯示 GNU 版權畫面 */ -#define FAST_LOGIN /* Login 不檢查遠端使用者 */ -#define HAVE_CAL /* 提供計算機 */ -#undef HAVE_REPORT /* 系統追蹤報告 */ -#undef NEWUSER_LIMIT /* 新手上路的三天限制 */ -#undef HAVE_X_BOARDS - -#define USE_LYNX /* 使用外部lynx dump ? */ -#undef USE_PROXY -#ifdef USE_PROXY -#define PROXYSERVER "140.112.28.165" -#define PROXYPORT 3128 -#endif -#define LOCAL_PROXY /* 是否開啟local 的proxy */ -#ifdef LOCAL_PROXY -#define HPROXYDAY 1 /* local的proxy refresh天數 */ -#endif - -#define SHOWMIND /* 看見心情 */ -#define SHOWUID /* 看見使用者 UID */ -#define SHOWBOARD /* 看見使用者看板 */ -#define SHOWPID /* 看見使用者 PID */ - -#define DOTIMEOUT -#ifdef DOTIMEOUT -#define IDLE_TIMEOUT (43200) /* 一般情況之 timeout (12hr) */ -#define MONITOR_TIMEOUT (20*60) /* monitor 時之 timeout */ -#define SHOW_IDLE_TIME /* 顯示閒置時間 */ -#endif - -#define SEM_ENTER -1 /* enter semaphore */ -#define SEM_LEAVE 1 /* leave semaphore */ -#define SEM_RESET 0 /* reset semaphore */ - -#define MAGIC_KEY 1234 /* 身分認證信函編碼 */ - -#define SHM_KEY 1228 -#if 0 -#define BRDSHM_KEY 1208 -#define UHASH_KEY 1218 /* userid->uid hash */ -#define UTMPSHM_KEY 2221 -#define PTTSHM_KEY 1220 /* 動態看板 , 節日 */ -#define FROMSHM_KEY 1223 /* whereis, 最多使用者 */ -#endif - -#define BRDSEM_KEY 2005 /* semaphore key */ -#define PTTSEM_KEY 2000 /* semaphore key */ -#define FROMSEM_KEY 2003 /* semaphore key */ -#define PASSWDSEM_KEY 2010 - -#define NEW_CHATPORT 3838 -#define CHATPORT 5722 - -#define MAX_ROOM 16 /* 最多有幾間包廂? */ - -#define EXIT_LOGOUT 0 -#define EXIT_LOSTCONN -1 -#define EXIT_CLIERROR -2 -#define EXIT_TIMEDOUT -3 -#define EXIT_KICK -4 - -#define CHAT_LOGIN_OK "OK" -#define CHAT_LOGIN_EXISTS "EX" -#define CHAT_LOGIN_INVALID "IN" -#define CHAT_LOGIN_BOGUS "BG" -#define BADCIDCHARS " *" /* Chat Room 中禁用於 nick 的字元 */ - -#define ALLPOST "ALLPOST" -#define ALLHIDPOST "ALLHIDPOST" - -#define MAXTAGS 256 -#define BRC_STRLEN 15 /* Length of board name */ -#define BRC_MAXSIZE 24576 -#define BRC_MAXNUM 80 - -#define WRAPMARGIN (511) - -#endif diff --git a/mbbsd/Makefile.am b/mbbsd/Makefile.am index 8d19b6ff..6ab24ad3 100644 --- a/mbbsd/Makefile.am +++ b/mbbsd/Makefile.am @@ -4,7 +4,8 @@ ######################################################################## # $Id$ -bin_PROGRAMS=mbbsd +PROG=mbbsd +bin_PROGRAMS=$(PROG) mbbsd_SOURCES= \ ../include/var.h \ @@ -19,6 +20,12 @@ mbbsd_SOURCES= \ ../include/var.h: var.c perl ../util/parsevar.pl < var.c > ../include/var.h +test: $(PROG) + killall -9 test$(PROG) || true + cp $(PROG) test$(PROG) + ./test$(PROG) 9000 + rm -f test$(PROG) + ## reduce .bss align overhead #.if !defined(DEBUG) #LDFLAGS+=-Wl,--sort-common @@ -28,11 +35,6 @@ mbbsd_SOURCES= \ # sh ../util/newvers.sh # $(DIETCC) $(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) $(EXT_LIBS) vers.c -#test: $(PROG) -# killall -9 testmbbsd || true -# cp mbbsd testmbbsd -# ./testmbbsd 9000 -# rm -f testmbbsd # #install: $(PROG) # install -d $(BBSHOME)/bin/ diff --git a/mbbsd/chess.c b/mbbsd/chess.c index b50ade04..ed6d6472 100644 --- a/mbbsd/chess.c +++ b/mbbsd/chess.c @@ -1120,11 +1120,7 @@ ChessWatchGame(void (*play)(int, ChessGameMode), int game, const char* title) vmsg("無法建立連線"); return -1; } -#if defined(Solaris) && __OS_MAJOR_VERSION__ == 5 && __OS_MINOR_VERSION__ < 7 - msgsock = accept(sock, (struct sockaddr *) 0, 0); -#else msgsock = accept(sock, (struct sockaddr *) 0, (socklen_t *) 0); -#endif close(sock); if (msgsock < 0) return -1; diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 83bdc709..595ba1a9 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1535,13 +1535,8 @@ daemon_login(int argc, char *argv[], char *envp[]) /* main loop */ while( 1 ){ len_of_sock_addr = sizeof(xsin); -#if defined(Solaris) && __OS_MAJOR_VERSION__ == 5 && __OS_MINOR_VERSION__ < 7 - if( (csock = accept(msock, (struct sockaddr *)&xsin, - &len_of_sock_addr)) < 0 ){ -#else if( (csock = accept(msock, (struct sockaddr *)&xsin, (socklen_t *)&len_of_sock_addr)) < 0 ){ -#endif if (errno != EINTR) sleep(1); continue; diff --git a/mbbsd/talk.c b/mbbsd/talk.c index 12d526bf..8d36d472 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -1390,11 +1390,7 @@ int make_connection_to_somebody(userinfo_t *uin, int timeout){ return -1; } length = sizeof(server); -#if defined(Solaris) && __OS_MAJOR_VERSION__ == 5 && __OS_MINOR_VERSION__ < 7 - if (getsockname(sock, (struct sockaddr *) & server, & length) < 0) { -#else if (getsockname(sock, (struct sockaddr *) & server, (socklen_t *) & length) < 0) { -#endif close(sock); perror("sock name err"); unlockutmpmode(); @@ -1492,11 +1488,7 @@ my_talk(userinfo_t * uin, int fri_stat, char defact) if (sock < 0) vmsg("無法建立連線"); else { -#if defined(Solaris) && __OS_MAJOR_VERSION__ == 5 && __OS_MINOR_VERSION__ < 7 - msgsock = accept(sock, (struct sockaddr *) 0, 0); -#else msgsock = accept(sock, (struct sockaddr *) 0, (socklen_t *) 0); -#endif close(sock); if (msgsock == -1) { perror("accept"); @@ -1599,11 +1591,7 @@ my_talk(userinfo_t * uin, int fri_stat, char defact) sock = make_connection_to_somebody(uin, 5); -#if defined(Solaris) && __OS_MAJOR_VERSION__ == 5 && __OS_MINOR_VERSION__ < 7 - msgsock = accept(sock, (struct sockaddr *) 0, 0); -#else msgsock = accept(sock, (struct sockaddr *) 0, (socklen_t *) 0); -#endif if (msgsock == -1) { perror("accept"); unlockutmpmode(); diff --git a/pttbbs.mk b/pttbbs.mk index 7f88be49..851530ca 100644 --- a/pttbbs.mk +++ b/pttbbs.mk @@ -4,8 +4,6 @@ BBSHOME?= $(HOME) BBSHOME?= /home/bbs OS!= uname -OS_MAJOR_VER!= uname -r|cut -d . -f 1 -OS_MINOR_VER!= uname -r|cut -d . -f 2 OSTYPE?= $(OS) CC= gcc @@ -22,19 +20,11 @@ CFLAGS_FreeBSD= -I/usr/local/include LDFLAGS_FreeBSD= LIBS_FreeBSD= -lkvm -liconv -# Linux特有的環境 -CFLAGS_Linux= -LDFLAGS_Linux= -LIBS_Linux= - # SunOS特有的環境 CFLAGS_Solaris= -DSolaris -I/usr/local/include LDFLAGS_Solaris= -L/usr/local/lib -L/usr/lib LIBS_Solaris= -lnsl -lsocket -liconv -lkstat -OS_FLAGS= -D__OS_MAJOR_VERSION__="$(OS_MAJOR_VER)" \ - -D__OS_MINOR_VERSION__="$(OS_MINOR_VER)" - # CFLAGS, LDFLAGS, LIBS 加入 OS 相關參數 PTT_CFLAGS+= $(CFLAGS_$(OSTYPE)) $(OS_FLAGS) PTT_LDFLAGS+= $(LDFLAGS_$(OSTYPE)) @@ -62,7 +52,9 @@ CFLAGS= $(PTT_CFLAGS) -O1 -tpp6 -mcpu=pentiumpro -march=pentiumiii \ -ip -ipo LDFLAGS+= -O1 -tpp6 -mcpu=pentiumpro -march=pentiumiii -ip -ipo \ $(PTT_LDFLAGS) $(PTT_LIBS) + .elif defined(GDB) + CFLAGS= -g -O0 $(PTT_CFLAGS) LDFLAGS= -O0 $(PTT_LDFLAGS) $(PTT_LIBS) .else diff --git a/util/Makefile.am b/util/Makefile.am index f1cdf95d..9a09eb71 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -4,8 +4,11 @@ ######################################################################## # $Id$ +AUTOMAKE_OPTIONS=foreign + CFLAGS=-DPTTBBS_UTIL BBSBASE=../include/var.h +CFLAGS+=-Wall -pipe -DBBSHOME='"/home/bbs"' -I ../include # Compile and build with BBS utility library. CPROG_WITH_UTIL= \ @@ -17,13 +20,19 @@ CPROG_WITH_UTIL= \ reaper buildAnnounce inndBM mailangel \ outmail chkhbf checkmoney merge_dir \ transman angel gamblegive checkdir \ - chesscountry tunepasswd buildir xchatd + chesscountry tunepasswd buildir xchatd \ + cleanpasswd \ + shmctl # Compile directly. CPROG_WITHOUT_UTIL= \ countalldice bbsrf bbsmail initbbs \ gamble_fix merge_board merge_passwd showboard \ - userlist uhash_loader + userlist uhash_loader + +# migration, not used in general case. +CPROG_NO_BUILD=r2014convert passwdconverter + # No need to be compiled. SCRIPT_PROG = \ @@ -33,82 +42,58 @@ SCRIPT_PROG = \ dailybackup.pl tarqueue.pl waterball.pl filtermail.pl \ getbackup.pl udnnews.pl rebuildaloha.pl -bin_PRORAMS=$(SCRIPT_PROG) $(CPROG_WITHOUT_UTIL) $(CPROG_WITH_UTIL) \ - shmctl - -UTIL_LIB= \ - util_cache.c util_record.c util_passwd.c util_var.c \ - util_stuff.c util_osdep.c util_args.c util_file.c \ - util_crypt.c - -MBBSD_OBJS= \ - cache record passwd var \ - stuff osdep args file \ - crypt - -../include/var.h: ../mbbsd/var.c - cd ../mbbsd; $(MAKE) ../include/var.h +MBBSD_PATH=../mbbsd -.for fn in ${CPROG_WITH_UTIL} -${fn}: ${BBSBASE} ${fn}.c ${UTIL_OBJS} - $(CCACHE) ${CC} ${CFLAGS} ${LDFLAGS} -o ${fn} ${UTIL_OBJS} ${fn}.c -.endfor +MBBSD_LIB= \ + $(MBBSD_PATH)/cache.c $(MBBSD_PATH)/record.c \ + $(MBBSD_PATH)/passwd.c $(MBBSD_PATH)/var.c \ + $(MBBSD_PATH)/stuff.c $(MBBSD_PATH)/osdep.c \ + $(MBBSD_PATH)/args.c $(MBBSD_PATH)/file.c \ + $(MBBSD_PATH)/crypt.c -.for fn in ${MBBSD_OBJS} -util_${fn}.o: ${BBSBASE} ../mbbsd/${fn}.c - $(CCACHE) ${CC} ${CFLAGS} -D_BBS_UTIL_C_ -c -o $@ ../mbbsd/${fn}.c -.endfor +bin_PROGRAMS=$(CPROG_WITH_UTIL) $(CPROG_WITHOUT_UTIL) -shmctl: ${BBSBASE} shmctl.c ${UTIL_OBJS} - $(CCACHE) ${CC} ${CFLAGS} ${LDFLAGS} -o shmctl ${UTIL_OBJS} shmctl.c +noinst_LIBRARIES=libmbbsd.a +libmbbsd_a_SOURCES=$(MBBSD_LIB) $(BBSBASE) +libmbbsd_a_CFLAGS=-D_BBS_UTIL_C_ -bbsmail: ${BBSBASE} bbsmail.c ../innbbsd/str_decode.c $(UTIL_OBJS) - $(CCACHE) $(CC) $(CFLAGS) $(LDFLAGS) -o bbsmail -DUSE_ICONV \ - bbsmail.c ../innbbsd/str_decode.c $(UTIL_OBJS) +LDADD=libmbbsd.a -install: $(PROGS) - install -d $(BBSHOME)/bin/ - install -c -m 755 $(PROGS) $(BBSHOME)/bin/ - chmod 4755 $(BBSHOME)/bin/post -.if defined(WITHFILTERMAIL) - $(MAKE) installfiltermail -.endif +$(BBSBASE): ../mbbsd/var.c + cd ../mbbsd; $(MAKE) ../include/var.h -clean: - rm -f *.o $(CPROGS) $(CPROG_WITH_UTIL) $(CPROG_WITHOUT_UTIL) +#bbsmail: ${BBSBASE} bbsmail.c ../innbbsd/str_decode.c $(UTIL_OBJS) +# $(CCACHE) $(CC) $(CFLAGS) $(LDFLAGS) -o bbsmail -DUSE_ICONV \ +# bbsmail.c ../innbbsd/str_decode.c $(UTIL_OBJS) +#install: $(PROGS) +# install -d $(BBSHOME)/bin/ +# install -c -m 755 $(PROGS) $(BBSHOME)/bin/ +# chmod 4755 $(BBSHOME)/bin/post +#.if defined(WITHFILTERMAIL) +# $(MAKE) installfiltermail +#.endif -installfiltermail: - mv $(BBSHOME)/bin/bbsmail $(BBSHOME)/bin/realbbsmail - ln -s $(BBSHOME)/bin/filtermail.pl $(BBSHOME)/bin/bbsmail +#installfiltermail: +# mv $(BBSHOME)/bin/bbsmail $(BBSHOME)/bin/realbbsmail +# ln -s $(BBSHOME)/bin/filtermail.pl $(BBSHOME)/bin/bbsmail -# for diskstat(FreeBSD 4.x only) . -# diskstat should be compiled with bbs and installed with root -diskstat: diskstat.c - $(CCACHE) $(CC) $(CFLAGS) -o diskstat diskstat.c -ldevstat -lkvm +## for diskstat(FreeBSD 4.x only) . +## diskstat should be compiled with bbs and installed with root +#diskstat: diskstat.c +# $(CCACHE) $(CC) $(CFLAGS) -o diskstat diskstat.c -ldevstat -lkvm -installdiskstat: diskstat - cp -f diskstat /usr/local/bin/ - chgrp kmem /usr/local/bin/diskstat - chmod 2755 /usr/local/bin/diskstat +#installdiskstat: diskstat +# cp -f diskstat /usr/local/bin/ +# chgrp kmem /usr/local/bin/diskstat +# chmod 2755 /usr/local/bin/diskstat # for bbsctl. bbsctl should be compiled with bbs and installed with root -bbsctl: bbsctl.c - $(CCACHE) $(CC) $(CFLAGS) -o $@ $@.c - -installbbsctl: bbsctl - rm -f /home/bbs/bin/bbsctl - cp /home/bbs/pttbbs/util/bbsctl /home/bbs/bin/bbsctl - chown root /home/bbs/bin/bbsctl - chmod 4755 /home/bbs/bin/bbsctl - -cleanpasswd: cleanpasswd.c ${UTIL_OBJS} - $(CCACHE) ${CC} ${CFLAGS} ${LDFLAGS} -o cleanpasswd ${UTIL_OBJS} cleanpasswd.c - -r2014transfer: r2014convert - $(CCACHE) ${CC} ${CFLAGS} ${LDFLAGS} -o r2014convert r2014convert.c - ./r2014convert - rm r2014convert - -passwdconverter: passwdconverter.c - $(CCACHE) $(CC) $(CFLAGS) $(LDFLAGS) $(UTIL_OBJS) -o passwdconverter passwdconverter.c +#bbsctl: bbsctl.c +# $(CCACHE) $(CC) $(CFLAGS) -o $@ $@.c + +#installbbsctl: bbsctl +# rm -f /home/bbs/bin/bbsctl +# cp /home/bbs/pttbbs/util/bbsctl /home/bbs/bin/bbsctl +# chown root /home/bbs/bin/bbsctl +# chmod 4755 /home/bbs/bin/bbsctl diff --git a/util/bbsrf.c b/util/bbsrf.c index 27ed9e3a..7ecd0824 100644 --- a/util/bbsrf.c +++ b/util/bbsrf.c @@ -11,7 +11,7 @@ #include #include #include -#include "config.h" +#include "bbsconf.h" #ifdef Solaris #include -- cgit v1.2.3