From 440a2643ed42f8be05450e0b00021d933f64e0b3 Mon Sep 17 00:00:00 2001
From: piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>
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 <sys/msg.h>
 
 /* 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 <syslog.h>
+#include "../pttbbs.conf"
+
+#define BBSPROG         BBSHOME "/bin/mbbsd"         /* �D�{�� */
+#define BAN_FILE        "BAN"                        /* �����q�i�� */
+#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                     /* �H���~�H�� mail server */
+#define RELAY_SERVER_IP    "127.0.0.1"
+#endif
+
+#ifndef MAX_USERS                           /* �̰����U�H�� */
+#define MAX_USERS          (150000)
+#endif
+
+#ifndef MAX_ACTIVE
+#define MAX_ACTIVE        (1024)         /* �̦h�P�ɤW���H�� */
+#endif
+
+#ifndef MAX_CPULOAD
+#define MAX_CPULOAD       (70)           /* CPU �̰�load */
+#endif
+
+#ifndef MAX_LANG
+#define MAX_LANG          (1)			 /* �̦h�ϥλy�� */
+#endif
+
+#ifndef MAX_STRING
+#define MAX_STRING        (8000)         /* �t�γ̦h�ϥΦr�� */
+#endif
+
+#ifndef MAX_POST_MONEY                      /* �o���峹�Z�O���W�� */
+#define MAX_POST_MONEY     (100)
+#endif
+
+#ifndef MAX_CHICKEN_MONEY                   /* �i������Q�W�� */
+#define MAX_CHICKEN_MONEY  (100)
+#endif
+
+#ifndef MAX_GUEST_LIFE                      /* �̪����{�ҨϥΪ̫O�d�ɶ�(��) */
+#define MAX_GUEST_LIFE     (3 * 24 * 60 * 60)
+#endif
+
+#ifndef MAX_EDIT_LINE
+#define MAX_EDIT_LINE 2048                  /* �峹�̪��s����� */
+#endif 
+
+#ifndef MAX_LIFE                            /* �̪��ϥΪ̫O�d�ɶ�(��) */
+#define MAX_LIFE           (120 * 24 * 60 * 60)
+#endif
+
+#ifndef MAX_FROM
+#define MAX_FROM           (300)            /* �̦h�G�m�� */
+#endif
+
+#ifndef THREAD_SEARCH_RANGE
+#define THREAD_SEARCH_RANGE (500)
+#endif
+
+#ifndef HAVE_JCEE                           /* �j���p�Ҭd�]�t�� */
+#define HAVE_JCEE 0
+#endif
+
+#ifndef MEM_CHECK
+#define MEM_CHECK 0x98761234
+#endif
+
+#ifndef FOREIGN_REG_DAY                     /* �~�y�ϥΪ̸եΤ���W�� */
+#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)         /* �̤j�}�O�Ӽ� */
+#endif
+
+#ifndef MAX_EXKEEPMAIL
+#define MAX_EXKEEPMAIL    (1000)         /* �̦h�H�c�[�j�h�֫� */
+#endif
+
+#ifndef OVERLOADBLOCKFDS
+#define OVERLOADBLOCKFDS  (0)            /* �W����|�O�d�o��h�� fd */
+#endif
+
+#ifndef HOTBOARDCACHE
+#define HOTBOARDCACHE     (0)            /* �����ݪO�֨� */
+#endif
+
+#ifndef INNTIMEZONE
+#define INNTIMEZONE       "+0800 (CST)"
+#endif
+
+#ifndef ADD_EXMAILBOX
+#define ADD_EXMAILBOX     0              /* �ذe�H�c */
+#endif
+
+#ifndef HASH_BITS
+#define HASH_BITS         16             /* userid->uid hashing bits */
+#endif
+
+/* more.c ���峹���ƤW��(lines/22), +4 for safe */
+#define MAX_PAGES         (MAX_EDIT_LINE / 22 + 4)
+
+/* �H�U�٥���z */
+#define MAX_FRIEND        (256)          /* ���J cache ���̦h�B�ͼƥ� */
+#define MAX_REJECT        (32)           /* ���J cache ���̦h�a�H�ƥ� */
+#define MAX_MSGS          (10)           /* ���y(���T)�ԭ@�W�� */
+#define MAX_MOVIE         (999)          /* �̦h�ʺA�ݪO�� */
+#define MAX_MOVIE_SECTION (10)		 /* �̦h�ʺA�ݪO���O */
+#define MAX_ITEMS         (1000)         /* �@�ӥؿ��̦h���X�� */
+#define MAX_HISTORY       (12)           /* �ʺA�ݪO�O�� 12 �����v�O�� */
+#define MAX_CROSSNUM      (9) 	         /* �̦hcrosspost���� */
+#define MAX_QUERYLINES    (16)           /* ��� Query/Plan �T���̤j��� */
+#define MAX_LOGIN_INFO    (128)          /* �̦h�W�u�q���H�� */
+#define MAX_POST_INFO     (32)           /* �̦h�s�峹�q���H�� */
+#define MAX_NAMELIST      (128)          /* �̦h��L�S�O�W��H�� */
+#define MAX_KEEPMAIL      (200)          /* �̦h�O�d�X�� MAIL�H */
+#define MAX_NOTE          (20)           /* �̦h�O�d�X�g�d���H */
+#define MAX_SIGLINES      (6)            /* ñ�W�ɤޤJ�̤j��� */
+#define MAX_CROSSNUM      (9) 	         /* �̦hcrosspost���� */
+#define MAX_REVIEW        (7)		 /* �̦h���y�^�U */
+#define NUMVIEWFILE       (14)           /* �i���e���̦h�� */
+#define MAX_SWAPUSED      (0.7)          /* SWAP�̰��ϥβv */
+#define LOGINATTEMPTS     (3)            /* �̤j�i�����~���� */
+#define WHERE                            /* �O�_���G�m�\�� */
+#undef  LOG_BOARD  			 /* �ݪO�O�_log */
+
+
+#define LOGINASNEW              /* �ĥΤW���ӽбb����� */
+#define NO_WATER_POST           /* ����BlahBlah����� */
+#define USE_BSMTP               /* �ϥ�opus��BSMTP �H���H? */
+#define HAVE_ANONYMOUS          /* ���� Anonymous �O */
+#undef  POSTNOTIFY              /* �s�峹�q���\�� */
+#define INTERNET_EMAIL          /* �䴩 InterNet Email �\��(�t Forward) */
+#define HAVE_ORIGIN             /* ��� author �Ӧۦ�B */
+#undef  HAVE_MAILCLEAN          /* �M�z�Ҧ��ϥΪ̭ӤH�H�c */
+#undef  HAVE_SUICIDE            /* ���ѨϥΪ̦۱��\�� */
+#undef  HAVE_REPORT             /* �t�ΰl�ܳ��i */
+#undef  HAVE_INFO               /* ��ܵ{���������� */
+#undef  HAVE_LICENSE            /* ��� GNU ���v�e�� */
+#define FAST_LOGIN		/* Login ���ˬd���ݨϥΪ� */
+#define HAVE_CAL                /* ���ѭp��� */
+#undef  HAVE_REPORT             /* �t�ΰl�ܳ��i */
+#undef  NEWUSER_LIMIT           /* �s��W�����T�ѭ��� */
+#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             /* �O�_�}��local ��proxy */
+#ifdef  LOCAL_PROXY
+#define HPROXYDAY   1           /* local��proxy refresh�Ѽ� */
+#endif
+
+#define SHOWMIND                /* �ݨ��߱� */
+#define SHOWUID                 /* �ݨ��ϥΪ� UID */
+#define SHOWBOARD               /* �ݨ��ϥΪ̬ݪO */
+#define SHOWPID                 /* �ݨ��ϥΪ� PID */
+
+#define DOTIMEOUT
+#ifdef  DOTIMEOUT
+#define IDLE_TIMEOUT    (43200) /* �@�뱡�p�� timeout (12hr) */
+#define MONITOR_TIMEOUT (20*60) /* monitor �ɤ� timeout */
+#define SHOW_IDLE_TIME          /* ��ܶ��m�ɶ� */
+#endif
+
+#define SEM_ENTER      -1      /* enter semaphore */
+#define SEM_LEAVE      1       /* leave semaphore */
+#define SEM_RESET      0       /* reset semaphore */
+
+#define MAGIC_KEY       1234    /* �����{�ҫH��s�X */
+
+#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    /* �ʺA�ݪO , �`�� */
+#define FROMSHM_KEY     1223    /* whereis, �̦h�ϥΪ� */
+#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              /* �̦h���X���]�[�H */
+
+#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 ���T�� nick ���r�� */
+
+#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 <syslog.h>
-#include "../pttbbs.conf"
-
-#define BBSPROG         BBSHOME "/bin/mbbsd"         /* �D�{�� */
-#define BAN_FILE        "BAN"                        /* �����q�i�� */
-#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                     /* �H���~�H�� mail server */
-#define RELAY_SERVER_IP    "127.0.0.1"
-#endif
-
-#ifndef MAX_USERS                           /* �̰����U�H�� */
-#define MAX_USERS          (150000)
-#endif
-
-#ifndef MAX_ACTIVE
-#define MAX_ACTIVE        (1024)         /* �̦h�P�ɤW���H�� */
-#endif
-
-#ifndef MAX_CPULOAD
-#define MAX_CPULOAD       (70)           /* CPU �̰�load */
-#endif
-
-#ifndef MAX_LANG
-#define MAX_LANG          (1)			 /* �̦h�ϥλy�� */
-#endif
-
-#ifndef MAX_STRING
-#define MAX_STRING        (8000)         /* �t�γ̦h�ϥΦr�� */
-#endif
-
-#ifndef MAX_POST_MONEY                      /* �o���峹�Z�O���W�� */
-#define MAX_POST_MONEY     (100)
-#endif
-
-#ifndef MAX_CHICKEN_MONEY                   /* �i������Q�W�� */
-#define MAX_CHICKEN_MONEY  (100)
-#endif
-
-#ifndef MAX_GUEST_LIFE                      /* �̪����{�ҨϥΪ̫O�d�ɶ�(��) */
-#define MAX_GUEST_LIFE     (3 * 24 * 60 * 60)
-#endif
-
-#ifndef MAX_EDIT_LINE
-#define MAX_EDIT_LINE 2048                  /* �峹�̪��s����� */
-#endif 
-
-#ifndef MAX_LIFE                            /* �̪��ϥΪ̫O�d�ɶ�(��) */
-#define MAX_LIFE           (120 * 24 * 60 * 60)
-#endif
-
-#ifndef MAX_FROM
-#define MAX_FROM           (300)            /* �̦h�G�m�� */
-#endif
-
-#ifndef THREAD_SEARCH_RANGE
-#define THREAD_SEARCH_RANGE (500)
-#endif
-
-#ifndef HAVE_JCEE                           /* �j���p�Ҭd�]�t�� */
-#define HAVE_JCEE 0
-#endif
-
-#ifndef MEM_CHECK
-#define MEM_CHECK 0x98761234
-#endif
-
-#ifndef FOREIGN_REG_DAY                     /* �~�y�ϥΪ̸եΤ���W�� */
-#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)         /* �̤j�}�O�Ӽ� */
-#endif
-
-#ifndef MAX_EXKEEPMAIL
-#define MAX_EXKEEPMAIL    (1000)         /* �̦h�H�c�[�j�h�֫� */
-#endif
-
-#ifndef OVERLOADBLOCKFDS
-#define OVERLOADBLOCKFDS  (0)            /* �W����|�O�d�o��h�� fd */
-#endif
-
-#ifndef HOTBOARDCACHE
-#define HOTBOARDCACHE     (0)            /* �����ݪO�֨� */
-#endif
-
-#ifndef INNTIMEZONE
-#define INNTIMEZONE       "+0800 (CST)"
-#endif
-
-#ifndef ADD_EXMAILBOX
-#define ADD_EXMAILBOX     0              /* �ذe�H�c */
-#endif
-
-#ifndef HASH_BITS
-#define HASH_BITS         16             /* userid->uid hashing bits */
-#endif
-
-/* more.c ���峹���ƤW��(lines/22), +4 for safe */
-#define MAX_PAGES         (MAX_EDIT_LINE / 22 + 4)
-
-/* �H�U�٥���z */
-#define MAX_FRIEND        (256)          /* ���J cache ���̦h�B�ͼƥ� */
-#define MAX_REJECT        (32)           /* ���J cache ���̦h�a�H�ƥ� */
-#define MAX_MSGS          (10)           /* ���y(���T)�ԭ@�W�� */
-#define MAX_MOVIE         (999)          /* �̦h�ʺA�ݪO�� */
-#define MAX_MOVIE_SECTION (10)		 /* �̦h�ʺA�ݪO���O */
-#define MAX_ITEMS         (1000)         /* �@�ӥؿ��̦h���X�� */
-#define MAX_HISTORY       (12)           /* �ʺA�ݪO�O�� 12 �����v�O�� */
-#define MAX_CROSSNUM      (9) 	         /* �̦hcrosspost���� */
-#define MAX_QUERYLINES    (16)           /* ��� Query/Plan �T���̤j��� */
-#define MAX_LOGIN_INFO    (128)          /* �̦h�W�u�q���H�� */
-#define MAX_POST_INFO     (32)           /* �̦h�s�峹�q���H�� */
-#define MAX_NAMELIST      (128)          /* �̦h��L�S�O�W��H�� */
-#define MAX_KEEPMAIL      (200)          /* �̦h�O�d�X�� MAIL�H */
-#define MAX_NOTE          (20)           /* �̦h�O�d�X�g�d���H */
-#define MAX_SIGLINES      (6)            /* ñ�W�ɤޤJ�̤j��� */
-#define MAX_CROSSNUM      (9) 	         /* �̦hcrosspost���� */
-#define MAX_REVIEW        (7)		 /* �̦h���y�^�U */
-#define NUMVIEWFILE       (14)           /* �i���e���̦h�� */
-#define MAX_SWAPUSED      (0.7)          /* SWAP�̰��ϥβv */
-#define LOGINATTEMPTS     (3)            /* �̤j�i�����~���� */
-#define WHERE                            /* �O�_���G�m�\�� */
-#undef  LOG_BOARD  			 /* �ݪO�O�_log */
-
-
-#define LOGINASNEW              /* �ĥΤW���ӽбb����� */
-#define NO_WATER_POST           /* ����BlahBlah����� */
-#define USE_BSMTP               /* �ϥ�opus��BSMTP �H���H? */
-#define HAVE_ANONYMOUS          /* ���� Anonymous �O */
-#undef  POSTNOTIFY              /* �s�峹�q���\�� */
-#define INTERNET_EMAIL          /* �䴩 InterNet Email �\��(�t Forward) */
-#define HAVE_ORIGIN             /* ��� author �Ӧۦ�B */
-#undef  HAVE_MAILCLEAN          /* �M�z�Ҧ��ϥΪ̭ӤH�H�c */
-#undef  HAVE_SUICIDE            /* ���ѨϥΪ̦۱��\�� */
-#undef  HAVE_REPORT             /* �t�ΰl�ܳ��i */
-#undef  HAVE_INFO               /* ��ܵ{���������� */
-#undef  HAVE_LICENSE            /* ��� GNU ���v�e�� */
-#define FAST_LOGIN		/* Login ���ˬd���ݨϥΪ� */
-#define HAVE_CAL                /* ���ѭp��� */
-#undef  HAVE_REPORT             /* �t�ΰl�ܳ��i */
-#undef  NEWUSER_LIMIT           /* �s��W�����T�ѭ��� */
-#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             /* �O�_�}��local ��proxy */
-#ifdef  LOCAL_PROXY
-#define HPROXYDAY   1           /* local��proxy refresh�Ѽ� */
-#endif
-
-#define SHOWMIND                /* �ݨ��߱� */
-#define SHOWUID                 /* �ݨ��ϥΪ� UID */
-#define SHOWBOARD               /* �ݨ��ϥΪ̬ݪO */
-#define SHOWPID                 /* �ݨ��ϥΪ� PID */
-
-#define DOTIMEOUT
-#ifdef  DOTIMEOUT
-#define IDLE_TIMEOUT    (43200) /* �@�뱡�p�� timeout (12hr) */
-#define MONITOR_TIMEOUT (20*60) /* monitor �ɤ� timeout */
-#define SHOW_IDLE_TIME          /* ��ܶ��m�ɶ� */
-#endif
-
-#define SEM_ENTER      -1      /* enter semaphore */
-#define SEM_LEAVE      1       /* leave semaphore */
-#define SEM_RESET      0       /* reset semaphore */
-
-#define MAGIC_KEY       1234    /* �����{�ҫH��s�X */
-
-#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    /* �ʺA�ݪO , �`�� */
-#define FROMSHM_KEY     1223    /* whereis, �̦h�ϥΪ� */
-#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              /* �̦h���X���]�[�H */
-
-#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 ���T�� nick ���r�� */
-
-#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("�L�k�إ߳s�u");
 	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("�L�k�إ߳s�u");
 	    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�S��������
-CFLAGS_Linux=	
-LDFLAGS_Linux=	
-LIBS_Linux=	
-
 # SunOS�S��������
 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 �[�J 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 <fcntl.h>
 #include <sys/types.h>
 #include <sys/uio.h>
-#include "config.h"
+#include "bbsconf.h"
 
 #ifdef Solaris
     #include <utmpx.h>
-- 
cgit v1.2.3