From fa5b233767ca9d4e012839c28eb13628d2ebba63 Mon Sep 17 00:00:00 2001 From: piaip Date: Sat, 10 Sep 2005 06:24:56 +0000 Subject: Automake is a hard work, still not working now. git-svn-id: http://opensvn.csie.org/pttbbs/branches/piaip.automake@3152 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- Makefile | 14 --- Makefile.am | 10 ++ Makefile.old | 14 +++ README | 12 ++- cacheserver/Makefile | 14 --- cacheserver/Makefile.old | 14 +++ configure.in | 58 ++++++++++ docs/proto/Makefile | 18 ---- docs/proto/Makefile.old | 18 ++++ include/config.h | 268 ----------------------------------------------- include/defconf.h | 268 +++++++++++++++++++++++++++++++++++++++++++++++ innbbsd/Makefile | 71 ------------- innbbsd/Makefile.old | 71 +++++++++++++ innbbsd/innbbsd.c | 8 +- mbbsd/Makefile | 63 ----------- mbbsd/Makefile.am | 41 ++++++++ mbbsd/Makefile.old | 63 +++++++++++ sample/Makefile | 11 -- sample/Makefile.old | 11 ++ sample/innd/Makefile | 9 -- sample/innd/Makefile.old | 9 ++ util/Makefile | 118 --------------------- util/Makefile.am | 114 ++++++++++++++++++++ util/Makefile.old | 118 +++++++++++++++++++++ 24 files changed, 821 insertions(+), 594 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100644 Makefile.old delete mode 100644 cacheserver/Makefile create mode 100644 cacheserver/Makefile.old create mode 100644 configure.in delete mode 100644 docs/proto/Makefile create mode 100644 docs/proto/Makefile.old delete mode 100644 include/config.h create mode 100644 include/defconf.h delete mode 100644 innbbsd/Makefile create mode 100644 innbbsd/Makefile.old delete mode 100644 mbbsd/Makefile create mode 100644 mbbsd/Makefile.am create mode 100644 mbbsd/Makefile.old delete mode 100644 sample/Makefile create mode 100644 sample/Makefile.old delete mode 100644 sample/innd/Makefile create mode 100644 sample/innd/Makefile.old delete mode 100644 util/Makefile create mode 100644 util/Makefile.am create mode 100644 util/Makefile.old diff --git a/Makefile b/Makefile deleted file mode 100644 index f0938dff..00000000 --- a/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -SUBDIR= mbbsd util innbbsd - -all install clean: -.if !exists(/usr/local/lib/libhz.so) && !exists(/usr/lib/libhz.so) - @echo "sorry, libhz not found." - @echo "above FreeBSD, please install /usr/ports/chinese/autoconvert" - @echo "above Debian/Linux, please install package libhz0" - @exit 1 -.endif - @for i in $(SUBDIR); do\ - cd $$i;\ - $(MAKE) $@;\ - cd ..;\ - done diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..0017125f --- /dev/null +++ b/Makefile.am @@ -0,0 +1,10 @@ +######################################################################## +# PTT BBS Automake +# Create: piaip, Sat Sep 10 10:36:56 CST 2005 +######################################################################## +# $Id$ + +# We are not using standard GNU package +AUTOMAKE_OPTIONS=foreign + +SUBDIRS=mbbsd util diff --git a/Makefile.old b/Makefile.old new file mode 100644 index 00000000..f0938dff --- /dev/null +++ b/Makefile.old @@ -0,0 +1,14 @@ +SUBDIR= mbbsd util innbbsd + +all install clean: +.if !exists(/usr/local/lib/libhz.so) && !exists(/usr/lib/libhz.so) + @echo "sorry, libhz not found." + @echo "above FreeBSD, please install /usr/ports/chinese/autoconvert" + @echo "above Debian/Linux, please install package libhz0" + @exit 1 +.endif + @for i in $(SUBDIR); do\ + cd $$i;\ + $(MAKE) $@;\ + cd ..;\ + done diff --git a/README b/README index 84d36246..93d6d575 100644 --- a/README +++ b/README @@ -21,12 +21,14 @@ $Id$ proto/ mbbsd/ 裡面各個檔案的說明,詳見該目錄的 README z6ibbs.[12].txt in2 隨筆 - sample/ 範例 + sample/ 範例設定及資源檔 crontab 提供 bbs執行時須透過 crontab 定時跑的設定 - blog/ PttBLOG include/ include 檔 - innbbsd/ 轉信 mbbsd/ bbs 主程式 - mbbsd.icc/ 提供使用 icc來編譯所須要的 Makefile - pttpi/ Ptt Programming Interface + + util/ 工具程式 + innbbsd/ 轉信 + + blog/ PttBLOG 模組 + staticweb/ 靜態網頁瀏覽模組 diff --git a/cacheserver/Makefile b/cacheserver/Makefile deleted file mode 100644 index 42b077b4..00000000 --- a/cacheserver/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $Id$ -.include "../pttbbs.mk" - -PROGRAMS= utmpserver utmpsync - -all: ${PROGRAMS} - -.for fn in ${PROGRAMS} -${fn}: ${fn}.c - ${CC} ${CFLAGS} ${LDFLAGS} -DPTTBBS_UTIL -o ${fn} ${fn}.c ../util/util_*.o -.endfor - -clean: - rm -f *~ ${PROGRAMS} diff --git a/cacheserver/Makefile.old b/cacheserver/Makefile.old new file mode 100644 index 00000000..42b077b4 --- /dev/null +++ b/cacheserver/Makefile.old @@ -0,0 +1,14 @@ +# $Id$ +.include "../pttbbs.mk" + +PROGRAMS= utmpserver utmpsync + +all: ${PROGRAMS} + +.for fn in ${PROGRAMS} +${fn}: ${fn}.c + ${CC} ${CFLAGS} ${LDFLAGS} -DPTTBBS_UTIL -o ${fn} ${fn}.c ../util/util_*.o +.endfor + +clean: + rm -f *~ ${PROGRAMS} diff --git a/configure.in b/configure.in new file mode 100644 index 00000000..a1721948 --- /dev/null +++ b/configure.in @@ -0,0 +1,58 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.59) +AC_INIT(PTTBBS, 1.9, piaip@csie.ntu.edu.tw) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR(mbbsd/bbs.c) +AC_CONFIG_HEADER(config.h) +AC_PREFIX_DEFAULT(/home/bbs) + +# Checks for programs. +AC_PROG_CC + +# Checks for libraries. + +# Checks for header files. +AC_FUNC_ALLOCA +AC_HEADER_DIRENT +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h memory.h netdb.h netinet/in.h sgtty.h stddef.h stdlib.h string.h strings.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termios.h unistd.h utime.h utmp.h utmpx.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_TYPE_UID_T +AC_C_INLINE +AC_TYPE_OFF_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_HEADER_TIME +AC_STRUCT_TM + +# Checks for library functions. +AC_FUNC_CLOSEDIR_VOID +AC_FUNC_ERROR_AT_LINE +AC_FUNC_FORK +AC_FUNC_GETGROUPS +# AC_FUNC_GETLOADAVG +AC_PROG_GCC_TRADITIONAL +AC_FUNC_LSTAT +AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK +AC_FUNC_MALLOC +AC_FUNC_MEMCMP +AC_FUNC_MKTIME +AC_FUNC_MMAP +AC_FUNC_REALLOC +AC_FUNC_SELECT_ARGTYPES +AC_FUNC_SETPGRP +AC_FUNC_SETVBUF_REVERSED +AC_TYPE_SIGNAL +AC_FUNC_STAT +AC_FUNC_STRFTIME +AC_FUNC_UTIME_NULL +AC_FUNC_VPRINTF +AC_CHECK_FUNCS([alarm bzero dup2 floor ftruncate getcwd gethostbyaddr gethostbyname gethostname getpagesize gettimeofday inet_ntoa localtime_r memchr memmove memset mkdir munmap pow putenv rmdir select setenv socket strcasecmp strchr strdup strerror strncasecmp strrchr strspn strstr tzset utime]) +AC_CONFIG_FILES([Makefile mbbsd/Makefile util/Makefile]) +AC_OUTPUT diff --git a/docs/proto/Makefile b/docs/proto/Makefile deleted file mode 100644 index 63086b38..00000000 --- a/docs/proto/Makefile +++ /dev/null @@ -1,18 +0,0 @@ - -#.SUFFIXES: .c .txt - -# XXX 瘝瘥頛憟賜雿瘜? -# 湔亦 .c.txt 憟賢餌桀桅瘝 xxx.c @_@ - -NAME!= cd ../../mbbsd/ && ls *.c | sed -e "s/\.c//" -SRC!= cd ../../mbbsd/ && ls *.c | sed -e "s/\.c/.txt/" - -all: $(SRC) - -.for fn in $(NAME) -$(fn).txt: ../../mbbsd/$(fn).c - ./cdoc ../../mbbsd/$(fn).c > $(fn).txt -.endfor - -clean: - rm -f *.txt diff --git a/docs/proto/Makefile.old b/docs/proto/Makefile.old new file mode 100644 index 00000000..63086b38 --- /dev/null +++ b/docs/proto/Makefile.old @@ -0,0 +1,18 @@ + +#.SUFFIXES: .c .txt + +# XXX 瘝瘥頛憟賜雿瘜? +# 湔亦 .c.txt 憟賢餌桀桅瘝 xxx.c @_@ + +NAME!= cd ../../mbbsd/ && ls *.c | sed -e "s/\.c//" +SRC!= cd ../../mbbsd/ && ls *.c | sed -e "s/\.c/.txt/" + +all: $(SRC) + +.for fn in $(NAME) +$(fn).txt: ../../mbbsd/$(fn).c + ./cdoc ../../mbbsd/$(fn).c > $(fn).txt +.endfor + +clean: + rm -f *.txt diff --git a/include/config.h b/include/config.h deleted file mode 100644 index 194e5dc9..00000000 --- a/include/config.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/include/defconf.h b/include/defconf.h new file mode 100644 index 00000000..194e5dc9 --- /dev/null +++ b/include/defconf.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/innbbsd/Makefile b/innbbsd/Makefile deleted file mode 100644 index 0e6c75cc..00000000 --- a/innbbsd/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -# $Id$ -.include "../pttbbs.mk" - -VERSION= 0.50-pttpatch -ADMINUSER?= root@your.domain.name - -# FreeBSD為了 innbbsd額外需加的參數 -inn_CFLAGS_FreeBSD= -DBSD44 -DMMAP -DGETRUSAGE -inn_LDFLAGS_FreeBSD= -L/usr/local/lib -lcrypt -liconv - -# Linux為了 innbbsd額外需加的參數 -inn_CFLAGS_Linux= -DLINUX -DGETRUSAGE -inn_LDFLAGS_Linux= - -# Solaris為了innbbsd額外需加的參數 -inn_CFLAGS_Solaris= -DMMAP -DSolaris -DSYSV -I/usr/local/include/ -inn_LDFLAGS_Solaris= -L/usr/local/lib -liconv -lsocket -lnsl -lkstat - -CFLAGS+= -DVERSION=\"${VERSION}\" \ - -DADMINUSER=\"${ADMINUSER}\" \ - -DMapleBBS -DDBZDEBUG -I. \ - ${inn_CFLAGS_${OSTYPE}} -DHMM_USE_ANTI_SPAM - -LDFLAGS+= ${inn_LDFLAGS_${OSTYPE}} - -PROGS= bbslink bbsnnrp ctlinnbbsd \ - innbbsd mkhistory - -all: ${PROGS} - -# bbs util -UTIL_DIR= ../util -UTIL_OBJS= \ - util_cache.o util_record.o util_passwd.o util_var.o \ - util_stuff.o util_osdep.o util_args.o util_file.o - -.for fn in ${UTIL_OBJS} -LINK_UTIL_OBJS+= ${UTIL_DIR}/${fn} - -${UTIL_DIR}/${fn}: # FIXME: dependency - cd ${UTIL_DIR}; make ${fn} -.endfor - - -echobbslib.o: echobbslib.c - ${CC} ${CFLAGS} -DWITH_ECHOMAIL -c echobbslib.c - -innbbsd: inndchannel.o innbbsd.o connectsock.o rfc931.o daemon.o \ - file.o pmain.o his.o dbz.o closeonexec.o dbztool.o \ - inntobbs.o receive_article.o echobbslib.o str_decode.o nocem.o - ${CCACHE} ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS} - -bbslink: bbslink.o pmain.o inntobbs.o echobbslib.o connectsock.o \ - file.o port.o str_decode.o - ${CCACHE} ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS} - -bbsnnrp: bbsnnrp.o pmain.o bbslib.o connectsock.o file.o - ${CCACHE} ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS} - -ctlinnbbsd: ctlinnbbsd.o pmain.o bbslib.o connectsock.o file.o - ${CCACHE} ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS} - -mkhistory: mkhistory.o bbslib.o file.o his.o dbz.o port.o closeonexec.o - ${CCACHE} ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS} - -install: ${PROGS} - install -d ${BBSHOME}/innd/ - install -c -m 755 ${PROGS} ${BBSHOME}/innd/ - -clean: - rm -f *.o ${PROGS} core *.core diff --git a/innbbsd/Makefile.old b/innbbsd/Makefile.old new file mode 100644 index 00000000..0e6c75cc --- /dev/null +++ b/innbbsd/Makefile.old @@ -0,0 +1,71 @@ +# $Id$ +.include "../pttbbs.mk" + +VERSION= 0.50-pttpatch +ADMINUSER?= root@your.domain.name + +# FreeBSD為了 innbbsd額外需加的參數 +inn_CFLAGS_FreeBSD= -DBSD44 -DMMAP -DGETRUSAGE +inn_LDFLAGS_FreeBSD= -L/usr/local/lib -lcrypt -liconv + +# Linux為了 innbbsd額外需加的參數 +inn_CFLAGS_Linux= -DLINUX -DGETRUSAGE +inn_LDFLAGS_Linux= + +# Solaris為了innbbsd額外需加的參數 +inn_CFLAGS_Solaris= -DMMAP -DSolaris -DSYSV -I/usr/local/include/ +inn_LDFLAGS_Solaris= -L/usr/local/lib -liconv -lsocket -lnsl -lkstat + +CFLAGS+= -DVERSION=\"${VERSION}\" \ + -DADMINUSER=\"${ADMINUSER}\" \ + -DMapleBBS -DDBZDEBUG -I. \ + ${inn_CFLAGS_${OSTYPE}} -DHMM_USE_ANTI_SPAM + +LDFLAGS+= ${inn_LDFLAGS_${OSTYPE}} + +PROGS= bbslink bbsnnrp ctlinnbbsd \ + innbbsd mkhistory + +all: ${PROGS} + +# bbs util +UTIL_DIR= ../util +UTIL_OBJS= \ + util_cache.o util_record.o util_passwd.o util_var.o \ + util_stuff.o util_osdep.o util_args.o util_file.o + +.for fn in ${UTIL_OBJS} +LINK_UTIL_OBJS+= ${UTIL_DIR}/${fn} + +${UTIL_DIR}/${fn}: # FIXME: dependency + cd ${UTIL_DIR}; make ${fn} +.endfor + + +echobbslib.o: echobbslib.c + ${CC} ${CFLAGS} -DWITH_ECHOMAIL -c echobbslib.c + +innbbsd: inndchannel.o innbbsd.o connectsock.o rfc931.o daemon.o \ + file.o pmain.o his.o dbz.o closeonexec.o dbztool.o \ + inntobbs.o receive_article.o echobbslib.o str_decode.o nocem.o + ${CCACHE} ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS} + +bbslink: bbslink.o pmain.o inntobbs.o echobbslib.o connectsock.o \ + file.o port.o str_decode.o + ${CCACHE} ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS} + +bbsnnrp: bbsnnrp.o pmain.o bbslib.o connectsock.o file.o + ${CCACHE} ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS} + +ctlinnbbsd: ctlinnbbsd.o pmain.o bbslib.o connectsock.o file.o + ${CCACHE} ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS} + +mkhistory: mkhistory.o bbslib.o file.o his.o dbz.o port.o closeonexec.o + ${CCACHE} ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS} + +install: ${PROGS} + install -d ${BBSHOME}/innd/ + install -c -m 755 ${PROGS} ${BBSHOME}/innd/ + +clean: + rm -f *.o ${PROGS} core *.core diff --git a/innbbsd/innbbsd.c b/innbbsd/innbbsd.c index f71ab30c..bdbd2a59 100644 --- a/innbbsd/innbbsd.c +++ b/innbbsd/innbbsd.c @@ -266,7 +266,6 @@ static int CMDmode(client) ClientType *client; { - /* char cwdpath[MAXPATHLEN+1]; */ argv_t *argv = &client->Argv; extern ClientType INNBBSD_STAT; daemoncmd_t *p = argv->dc; @@ -312,8 +311,11 @@ CMDmode(client) fprintf(argv->out, "NONE NEWSFEEDS %d\r\n", NONENEWSFEEDS); fprintf(argv->out, "Max connections %d\r\n", Maxclient); #ifdef DEBUGCWD - getwd(cwdpath); - fprintf(argv->out, "Working directory %s\r\n", cwdpath); + { + char cwdpath[MAXPATHLEN+1]; + getcwd(cwdpath, sizeof(cwdpath)); + fprintf(argv->out, "Working directory %s\r\n", cwdpath); + } #endif if (Channel) for (i = 0, j = 0; i < Maxclient; ++i) { diff --git a/mbbsd/Makefile b/mbbsd/Makefile deleted file mode 100644 index a635cb48..00000000 --- a/mbbsd/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# $Id$ - -.include "../pttbbs.mk" - -.if defined(WITH_BLOG) -CFLAGS+= -DBLOG -LDFLAGS+= -L/usr/local/lib/mysql -lmysqlclient -.endif - - -PROG= mbbsd -OBJS= admin.o announce.o args.o assess.o bbs.o board.o cache.o cal.o card.o\ - chat.o chc.o chc_tab.o chicken.o convert.o crypt.o dark.o edit.o fav.o friend.o gamble.o\ - gomo.o guess.o indict.o io.o kaede.o lovepaper.o mail.o mbbsd.o menu.o\ - more.o name.o osdep.o othello.o read.o record.o register.o\ - screen.o stuff.o talk.o term.o topsong.o user.o brc.o vice.o vote.o\ - xyz.o voteboard.o syspost.o var.o passwd.o calendar.o go.o file.o \ - pmore.o chess.o - -.if defined(DIET) -OBJS+= random.o time.o -DIETCC= diet -Os -.endif -#CFLAGS+=-g -#CFLAGS+=-std=c99 - -# reduce .bss align overhead -.if !defined(DEBUG) -LDFLAGS+=-Wl,--sort-common -.endif - -.if defined(MERGEBBS) -CFLAGS+= -DMERGEBBS -OBJS+= merge.o -.endif - -.SUFFIXES: .c .o -.c.o: ../include/var.h - $(CCACHE) $(DIETCC) $(CC) $(CFLAGS) -c $*.c - -all: $(PROG) - -$(PROG): $(OBJS) - sh ../util/newvers.sh - $(DIETCC) $(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) $(EXT_LIBS) vers.c - -../include/var.h: var.c - perl ../util/parsevar.pl < var.c > ../include/var.h - -test: $(PROG) - killall -9 testmbbsd || true - cp mbbsd testmbbsd - ./testmbbsd 9000 - rm -f testmbbsd - -install: $(PROG) - install -d $(BBSHOME)/bin/ - install -c -m 755 $(PROG) $(BBSHOME)/bin/ - mv -f $(BBSHOME)/bin/mbbsd $(BBSHOME)/bin/mbbsd.`date '+%m%d%H%M'` - ln -sv $(BBSHOME)/bin/mbbsd.`date '+%m%d%H%M'` $(BBSHOME)/bin/mbbsd - -clean: - rm -f $(OBJS) $(PROG) diff --git a/mbbsd/Makefile.am b/mbbsd/Makefile.am new file mode 100644 index 00000000..8d19b6ff --- /dev/null +++ b/mbbsd/Makefile.am @@ -0,0 +1,41 @@ +######################################################################## +# PTT BBS Automake +# Create: piaip, Sat Sep 10 10:36:56 CST 2005 +######################################################################## +# $Id$ + +bin_PROGRAMS=mbbsd + +mbbsd_SOURCES= \ + ../include/var.h \ + admin.c announce.c args.c assess.c bbs.c board.c brc.c cache.c \ + cal.c calendar.c card.c chat.c chc.c chc_tab.c chess.c chicken.c \ + convert.c crypt.c dark.c edit.c fav.c file.c friend.c gamble.c \ + go.c gomo.c guess.c indict.c io.c kaede.c lovepaper.c mail.c \ + mbbsd.c menu.c more.c name.c osdep.c othello.c passwd.c pmore.c \ + read.c record.c register.c screen.c stuff.c syspost.c talk.c \ + term.c topsong.c user.c var.c vice.c vote.c voteboard.c xyz.c + +../include/var.h: var.c + perl ../util/parsevar.pl < var.c > ../include/var.h + +## reduce .bss align overhead +#.if !defined(DEBUG) +#LDFLAGS+=-Wl,--sort-common +#.endif + +#$(PROG): $(OBJS) +# 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/ +# install -c -m 755 $(PROG) $(BBSHOME)/bin/ +# mv -f $(BBSHOME)/bin/mbbsd $(BBSHOME)/bin/mbbsd.`date '+%m%d%H%M'` +# ln -sv $(BBSHOME)/bin/mbbsd.`date '+%m%d%H%M'` $(BBSHOME)/bin/mbbsd diff --git a/mbbsd/Makefile.old b/mbbsd/Makefile.old new file mode 100644 index 00000000..a635cb48 --- /dev/null +++ b/mbbsd/Makefile.old @@ -0,0 +1,63 @@ +# $Id$ + +.include "../pttbbs.mk" + +.if defined(WITH_BLOG) +CFLAGS+= -DBLOG +LDFLAGS+= -L/usr/local/lib/mysql -lmysqlclient +.endif + + +PROG= mbbsd +OBJS= admin.o announce.o args.o assess.o bbs.o board.o cache.o cal.o card.o\ + chat.o chc.o chc_tab.o chicken.o convert.o crypt.o dark.o edit.o fav.o friend.o gamble.o\ + gomo.o guess.o indict.o io.o kaede.o lovepaper.o mail.o mbbsd.o menu.o\ + more.o name.o osdep.o othello.o read.o record.o register.o\ + screen.o stuff.o talk.o term.o topsong.o user.o brc.o vice.o vote.o\ + xyz.o voteboard.o syspost.o var.o passwd.o calendar.o go.o file.o \ + pmore.o chess.o + +.if defined(DIET) +OBJS+= random.o time.o +DIETCC= diet -Os +.endif +#CFLAGS+=-g +#CFLAGS+=-std=c99 + +# reduce .bss align overhead +.if !defined(DEBUG) +LDFLAGS+=-Wl,--sort-common +.endif + +.if defined(MERGEBBS) +CFLAGS+= -DMERGEBBS +OBJS+= merge.o +.endif + +.SUFFIXES: .c .o +.c.o: ../include/var.h + $(CCACHE) $(DIETCC) $(CC) $(CFLAGS) -c $*.c + +all: $(PROG) + +$(PROG): $(OBJS) + sh ../util/newvers.sh + $(DIETCC) $(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) $(EXT_LIBS) vers.c + +../include/var.h: var.c + perl ../util/parsevar.pl < var.c > ../include/var.h + +test: $(PROG) + killall -9 testmbbsd || true + cp mbbsd testmbbsd + ./testmbbsd 9000 + rm -f testmbbsd + +install: $(PROG) + install -d $(BBSHOME)/bin/ + install -c -m 755 $(PROG) $(BBSHOME)/bin/ + mv -f $(BBSHOME)/bin/mbbsd $(BBSHOME)/bin/mbbsd.`date '+%m%d%H%M'` + ln -sv $(BBSHOME)/bin/mbbsd.`date '+%m%d%H%M'` $(BBSHOME)/bin/mbbsd + +clean: + rm -f $(OBJS) $(PROG) diff --git a/sample/Makefile b/sample/Makefile deleted file mode 100644 index 832eba59..00000000 --- a/sample/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -SUBDIR=etc innd -BBSHOME?=$(HOME) - -all: - -install: - @for i in $(SUBDIR); do\ - cd $$i;\ - $(MAKE) BBSHOME=$(BBSHOME) $@;\ - cd ..;\ - done diff --git a/sample/Makefile.old b/sample/Makefile.old new file mode 100644 index 00000000..832eba59 --- /dev/null +++ b/sample/Makefile.old @@ -0,0 +1,11 @@ +SUBDIR=etc innd +BBSHOME?=$(HOME) + +all: + +install: + @for i in $(SUBDIR); do\ + cd $$i;\ + $(MAKE) BBSHOME=$(BBSHOME) $@;\ + cd ..;\ + done diff --git a/sample/innd/Makefile b/sample/innd/Makefile deleted file mode 100644 index 28f297c2..00000000 --- a/sample/innd/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -BBSHOME?=$(HOME) -TARGET=$(BBSHOME)/innd/ -FILES=bbsname.bbs newsfeeds.bbs nodelist.bbs ntu.active ncmperm.bbs - -all: - -install: - install -d $(TARGET) - install -c -m 644 $(FILES) $(TARGET) diff --git a/sample/innd/Makefile.old b/sample/innd/Makefile.old new file mode 100644 index 00000000..28f297c2 --- /dev/null +++ b/sample/innd/Makefile.old @@ -0,0 +1,9 @@ +BBSHOME?=$(HOME) +TARGET=$(BBSHOME)/innd/ +FILES=bbsname.bbs newsfeeds.bbs nodelist.bbs ntu.active ncmperm.bbs + +all: + +install: + install -d $(TARGET) + install -c -m 644 $(FILES) $(TARGET) diff --git a/util/Makefile b/util/Makefile deleted file mode 100644 index cc94fdd5..00000000 --- a/util/Makefile +++ /dev/null @@ -1,118 +0,0 @@ -# $Id$ - -.include "../pttbbs.mk" - -CFLAGS+= -DPTTBBS_UTIL - -BBSBASE= ../include/var.h - -UTIL_OBJS= \ - util_cache.o util_record.o util_passwd.o util_var.o \ - util_stuff.o util_osdep.o util_args.o util_file.o \ - util_crypt.o - -MBBSD_OBJS= \ - cache record passwd var \ - stuff osdep args file \ - crypt - -# 下面這些程式, 會被 compile 並且和 $(UTIL_OBJS) 聯結 -CPROG_WITH_UTIL= \ - boardlist BM_money post poststat \ - jungo account birth deluserfile \ - expire mandex rmuid horoscope \ - openvice parse_news openticket topusr \ - yearsold toplazyBM toplazyBBM writemoney \ - reaper buildAnnounce inndBM mailangel \ - outmail chkhbf checkmoney merge_dir \ - transman angel gamblegive checkdir \ - chesscountry tunepasswd buildir xchatd - -# 下面這些程式, 會直接被 compile -CPROG_WITHOUT_UTIL= \ - uhash_loader showboard \ - countalldice bbsrf initbbs \ - userlist merge_passwd \ - merge_board bbsmail gamble_fix - -# 下面這些程式會被 install -PROGS= ${CPROG_WITH_UTIL} ${CPROG_WITHOUT_UTIL} \ - shmctl \ - BM_money.sh backpasswd.sh mailog.sh opendice.sh \ - openticket.sh stock.sh topsong.sh weather.sh \ - stock.perl weather.perl toplazyBM.sh toplazyBBM.sh \ - dailybackup.pl tarqueue.pl waterball.pl filtermail.pl \ - getbackup.pl udnnews.pl rebuildaloha.pl - -all: ${CPROG_WITH_UTIL} ${CPROG_WITHOUT_UTIL} ${PROGS} - -../include/var.h: ../mbbsd/var.c - cd ../mbbsd; $(MAKE) ../include/var.h - -.for fn in ${CPROG_WITH_UTIL} -${fn}: ${BBSBASE} ${fn}.c ${UTIL_OBJS} - $(CCACHE) ${CC} ${CFLAGS} ${LDFLAGS} -o ${fn} ${UTIL_OBJS} ${fn}.c -.endfor - -.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 - -shmctl: ${BBSBASE} shmctl.c ${UTIL_OBJS} - $(CCACHE) ${CC} ${CFLAGS} ${LDFLAGS} -o shmctl ${UTIL_OBJS} shmctl.c -#shmctl: ${BBSBASE} shmctl.c ${UTIL_OBJS} -# $(CCACHE) gcc -g -DBBSHOME='"/home/bbs"' -I../include -D__OS_MAJOR_VERSION__="2" -D__OS_MINOR_VERSION__="6" -DPTTBBS_UTIL -O1 -o shmctl ${UTIL_OBJS} shmctl.c -#shmctl: ${BBSBASE} shmctl.cc ${UTIL_OBJS} -# $(CCACHE) g++ -g -DBBSHOME='"/home/bbs"' -I../include -D__OS_MAJOR_VERSION__="2" -D__OS_MINOR_VERSION__="6" -DPTTBBS_UTIL -O1 -o shmctl ${UTIL_OBJS} shmctl.cc - -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 - -clean: - rm -f *.o $(CPROGS) $(CPROG_WITH_UTIL) $(CPROG_WITHOUT_UTIL) - - -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 - -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 diff --git a/util/Makefile.am b/util/Makefile.am new file mode 100644 index 00000000..f1cdf95d --- /dev/null +++ b/util/Makefile.am @@ -0,0 +1,114 @@ +######################################################################## +# PTT BBS Automake +# Create: piaip, Sat Sep 10 10:36:56 CST 2005 +######################################################################## +# $Id$ + +CFLAGS=-DPTTBBS_UTIL +BBSBASE=../include/var.h + +# Compile and build with BBS utility library. +CPROG_WITH_UTIL= \ + boardlist BM_money post poststat \ + jungo account birth deluserfile \ + expire mandex rmuid horoscope \ + openvice parse_news openticket topusr \ + yearsold toplazyBM toplazyBBM writemoney \ + reaper buildAnnounce inndBM mailangel \ + outmail chkhbf checkmoney merge_dir \ + transman angel gamblegive checkdir \ + chesscountry tunepasswd buildir xchatd + +# Compile directly. +CPROG_WITHOUT_UTIL= \ + countalldice bbsrf bbsmail initbbs \ + gamble_fix merge_board merge_passwd showboard \ + userlist uhash_loader + +# No need to be compiled. +SCRIPT_PROG = \ + BM_money.sh backpasswd.sh mailog.sh opendice.sh \ + openticket.sh stock.sh topsong.sh weather.sh \ + stock.perl weather.perl toplazyBM.sh toplazyBBM.sh \ + 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 + +.for fn in ${CPROG_WITH_UTIL} +${fn}: ${BBSBASE} ${fn}.c ${UTIL_OBJS} + $(CCACHE) ${CC} ${CFLAGS} ${LDFLAGS} -o ${fn} ${UTIL_OBJS} ${fn}.c +.endfor + +.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 + +shmctl: ${BBSBASE} shmctl.c ${UTIL_OBJS} + $(CCACHE) ${CC} ${CFLAGS} ${LDFLAGS} -o shmctl ${UTIL_OBJS} shmctl.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) + +install: $(PROGS) + install -d $(BBSHOME)/bin/ + install -c -m 755 $(PROGS) $(BBSHOME)/bin/ + chmod 4755 $(BBSHOME)/bin/post +.if defined(WITHFILTERMAIL) + $(MAKE) installfiltermail +.endif + +clean: + rm -f *.o $(CPROGS) $(CPROG_WITH_UTIL) $(CPROG_WITHOUT_UTIL) + + +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 + +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 diff --git a/util/Makefile.old b/util/Makefile.old new file mode 100644 index 00000000..cc94fdd5 --- /dev/null +++ b/util/Makefile.old @@ -0,0 +1,118 @@ +# $Id$ + +.include "../pttbbs.mk" + +CFLAGS+= -DPTTBBS_UTIL + +BBSBASE= ../include/var.h + +UTIL_OBJS= \ + util_cache.o util_record.o util_passwd.o util_var.o \ + util_stuff.o util_osdep.o util_args.o util_file.o \ + util_crypt.o + +MBBSD_OBJS= \ + cache record passwd var \ + stuff osdep args file \ + crypt + +# 下面這些程式, 會被 compile 並且和 $(UTIL_OBJS) 聯結 +CPROG_WITH_UTIL= \ + boardlist BM_money post poststat \ + jungo account birth deluserfile \ + expire mandex rmuid horoscope \ + openvice parse_news openticket topusr \ + yearsold toplazyBM toplazyBBM writemoney \ + reaper buildAnnounce inndBM mailangel \ + outmail chkhbf checkmoney merge_dir \ + transman angel gamblegive checkdir \ + chesscountry tunepasswd buildir xchatd + +# 下面這些程式, 會直接被 compile +CPROG_WITHOUT_UTIL= \ + uhash_loader showboard \ + countalldice bbsrf initbbs \ + userlist merge_passwd \ + merge_board bbsmail gamble_fix + +# 下面這些程式會被 install +PROGS= ${CPROG_WITH_UTIL} ${CPROG_WITHOUT_UTIL} \ + shmctl \ + BM_money.sh backpasswd.sh mailog.sh opendice.sh \ + openticket.sh stock.sh topsong.sh weather.sh \ + stock.perl weather.perl toplazyBM.sh toplazyBBM.sh \ + dailybackup.pl tarqueue.pl waterball.pl filtermail.pl \ + getbackup.pl udnnews.pl rebuildaloha.pl + +all: ${CPROG_WITH_UTIL} ${CPROG_WITHOUT_UTIL} ${PROGS} + +../include/var.h: ../mbbsd/var.c + cd ../mbbsd; $(MAKE) ../include/var.h + +.for fn in ${CPROG_WITH_UTIL} +${fn}: ${BBSBASE} ${fn}.c ${UTIL_OBJS} + $(CCACHE) ${CC} ${CFLAGS} ${LDFLAGS} -o ${fn} ${UTIL_OBJS} ${fn}.c +.endfor + +.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 + +shmctl: ${BBSBASE} shmctl.c ${UTIL_OBJS} + $(CCACHE) ${CC} ${CFLAGS} ${LDFLAGS} -o shmctl ${UTIL_OBJS} shmctl.c +#shmctl: ${BBSBASE} shmctl.c ${UTIL_OBJS} +# $(CCACHE) gcc -g -DBBSHOME='"/home/bbs"' -I../include -D__OS_MAJOR_VERSION__="2" -D__OS_MINOR_VERSION__="6" -DPTTBBS_UTIL -O1 -o shmctl ${UTIL_OBJS} shmctl.c +#shmctl: ${BBSBASE} shmctl.cc ${UTIL_OBJS} +# $(CCACHE) g++ -g -DBBSHOME='"/home/bbs"' -I../include -D__OS_MAJOR_VERSION__="2" -D__OS_MINOR_VERSION__="6" -DPTTBBS_UTIL -O1 -o shmctl ${UTIL_OBJS} shmctl.cc + +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 + +clean: + rm -f *.o $(CPROGS) $(CPROG_WITH_UTIL) $(CPROG_WITHOUT_UTIL) + + +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 + +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 -- cgit v1.2.3