From 9e81baf8352b3d525c9a1459f28dae6b540988e3 Mon Sep 17 00:00:00 2001
From: in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>
Date: Tue, 4 Jun 2002 13:08:35 +0000
Subject: global variable move to var.c

git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@280 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
---
 mbbsd/Makefile    |   7 +-
 mbbsd/admin.c     |  44 +-----
 mbbsd/announce.c  |  55 +------
 mbbsd/args.c      |   7 +-
 mbbsd/bbcall.c    |  15 +-
 mbbsd/bbs.c       |  82 +---------
 mbbsd/board.c     |  46 +-----
 mbbsd/cache.c     |  61 +------
 mbbsd/cal.c       |  30 +---
 mbbsd/calendar.c  |  15 +-
 mbbsd/card.c      |  16 +-
 mbbsd/chat.c      |  47 +-----
 mbbsd/chc_draw.c  |  17 +-
 mbbsd/chc_net.c   |  11 +-
 mbbsd/chc_play.c  |  26 +--
 mbbsd/chc_rule.c  |  13 +-
 mbbsd/chicken.c   |  26 +--
 mbbsd/dark.c      |  16 +-
 mbbsd/dice.c      |  15 +-
 mbbsd/edit.c      |  49 +-----
 mbbsd/friend.c    |  38 +----
 mbbsd/gamble.c    |  19 +--
 mbbsd/gomo.c      |  28 +---
 mbbsd/gomo1.c     |  23 +--
 mbbsd/guess.c     |  17 +-
 mbbsd/indict.c    |  18 +--
 mbbsd/io.c        |  54 +------
 mbbsd/kaede.c     |  16 +-
 mbbsd/lovepaper.c |  18 +--
 mbbsd/mail.c      |  61 +------
 mbbsd/mbbsd.c     |  82 +---------
 mbbsd/menu.c      |  62 ++------
 mbbsd/more.c      |  33 +---
 mbbsd/name.c      |  24 +--
 mbbsd/osdep.c     |   8 +-
 mbbsd/othello.c   |  16 +-
 mbbsd/page.c      |  15 +-
 mbbsd/passwd.c    |  21 +--
 mbbsd/read.c      |  63 +-------
 mbbsd/record.c    |  19 +--
 mbbsd/register.c  |  27 +---
 mbbsd/screen.c    |  35 +----
 mbbsd/stuff.c     |  28 +---
 mbbsd/syspost.c   |  15 +-
 mbbsd/talk.c      |  63 +-------
 mbbsd/term.c      |  39 +----
 mbbsd/toolkit.c   |   7 +-
 mbbsd/topsong.c   |  11 +-
 mbbsd/user.c      |  38 +----
 mbbsd/var.c       | 463 +++++++++++++++++++++++++++++++++++++++++++++---------
 mbbsd/vice.c      |  17 +-
 mbbsd/vote.c      |  32 +---
 mbbsd/voteboard.c |  24 +--
 mbbsd/xyz.c       |  36 +----
 54 files changed, 529 insertions(+), 1539 deletions(-)

(limited to 'mbbsd')

diff --git a/mbbsd/Makefile b/mbbsd/Makefile
index 017f3d42..47ae7819 100644
--- a/mbbsd/Makefile
+++ b/mbbsd/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.7 2002/05/08 22:30:58 in2 Exp $
+# $Id: Makefile,v 1.8 2002/06/04 13:08:33 in2 Exp $
 
 BBSHOME?=$(HOME)
 OSTYPE=FreeBSD
@@ -46,7 +46,7 @@ OBJS=	admin.o announce.o args.o bbcall.o bbs.o board.o cache.o cal.o card.o\
 	calendar.o
 
 .SUFFIXES: .c .o
-.c.o:
+.c.o:	../include/var.h
 	$(CC) $(ADDFLAGS) $(CFLAGS) -c $*.c
 
 all: $(PROG)
@@ -54,6 +54,9 @@ all: $(PROG)
 $(PROG): $(OBJS)
 	$(CC) $(ADDFLAGS) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS)
 
+../include/var.h:	var.c
+	perl ../util/parsevar.pl < var.c > ../include/var.h
+
 test: $(PROG)
 	killall -9 testmbbsd || true
 	cp mbbsd testmbbsd
diff --git a/mbbsd/admin.c b/mbbsd/admin.c
index ba690f8a..9d795f90 100644
--- a/mbbsd/admin.c
+++ b/mbbsd/admin.c
@@ -1,25 +1,6 @@
-/* $Id: admin.c,v 1.19 2002/06/02 06:44:28 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "perm.h"
-#include "modes.h"
-#include "proto.h"
+/* $Id: admin.c,v 1.20 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
-extern struct bcache_t *brdshm;
-extern char *msg_uid;
-extern userec_t xuser;
-extern char *err_uid;
-extern boardheader_t *bcache;
-extern time_t now;
 /* �ϥΪ̺޲z */
 int m_user() {
     userec_t muser;
@@ -43,8 +24,6 @@ int m_user() {
     return 0;
 }
 
-extern int b_lines;
-
 static int search_key_user(char *passwdfile, int mode) {
     userec_t user;
     int ch;
@@ -168,8 +147,6 @@ static void bperm_msg(boardheader_t *board) {
 	   board->brdattr & BRD_POSTMASK ? "�o��" : "�\\Ū");
 }
 
-extern char* str_permboard[];
-
 unsigned int setperms(unsigned int pbits, char *pstring[]) {
     register int i;
     char choice[4];
@@ -208,11 +185,6 @@ void setup_man(boardheader_t * board) {
     mkdir(genbuf, 0755);
 }
 
-extern char *fn_board;
-extern char *err_bid;
-extern userec_t cuser;
-extern char *msg_sure_ny;
-extern char* str_permid[];
 
 int m_mod_board(char *bname) {
     boardheader_t bh, newbh;
@@ -391,8 +363,6 @@ int m_mod_board(char *bname) {
     return 0;
 }
 
-extern char *msg_bid;
-
 /* �]�w�ݪ� */
 int m_board() {
     char bname[32];
@@ -515,9 +485,6 @@ int x_file() {
     return FULLUPDATE;
 }
 
-extern int numboards;
-extern int class_bid;
-
 int m_newbrd(int recover) {
     boardheader_t newboard;
     char ans[4];
@@ -977,9 +944,6 @@ int scan_register_form(char *regfile, int automode, int neednum) {
     return (0);
 }
 
-extern char* fn_register;
-extern int t_lines;
-
 int m_register() {
     FILE *fn;
     int x, y, wid, len;
@@ -1088,7 +1052,6 @@ int give_money() {
     
     stand_title("�o����...");
     if(to_all) {
-	extern struct uhash_t *uhash;
 	int i, unum;
 	for(unum = uhash->number, i=0; i<unum; i++) {
 	    if(bad_user_id(uhash->userid[i]))
@@ -1096,7 +1059,8 @@ int give_money() {
 	    id = uhash->userid[i];
 	    give_id_money(id, money, fp2, tt, now);
 	}
-	give_money_post("�����ϥΪ�", atoi(money) );
+	// something wrong @_@
+	//give_money_post("�����ϥΪ�", atoi(money) );
     } else {
 	if(!(fp = fopen("etc/givemoney.txt", "r+"))) {
 	    fclose(fp2);
diff --git a/mbbsd/announce.c b/mbbsd/announce.c
index a31dc6c2..3afdbac2 100644
--- a/mbbsd/announce.c
+++ b/mbbsd/announce.c
@@ -1,31 +1,6 @@
-/* $Id: announce.c,v 1.9 2002/05/25 11:18:11 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <syslog.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "perm.h"
-#include "common.h"
-#include "modes.h"
-#include "proto.h"
-
-extern struct bcache_t *brdshm;
-extern int b_lines;
-extern int p_lines;
-extern int TagNum;
-extern int currbid;
-extern time_t now;
+/* $Id: announce.c,v 1.10 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
+
 static void g_showmenu(gmenu_t *pm) {
     static char *mytype = "�s    ��     ��������";
     char *title, ch;
@@ -108,8 +83,6 @@ static char *nextfield(char *data, char *field) {
     return data;
 }
 
-extern char *str_author1;
-
 static FILE* my_open(char* path) {
     FILE* ans = 0;
     char buf[80];
@@ -145,8 +118,6 @@ static void isig(int sig) {
 }
 
 #define PROXY_HOME      "proxy/"
-extern userec_t cuser;
-extern userinfo_t *currutmp;
 
 static void go_proxy(char* fpath, item_t *node, int update) {
     char *ptr, *str, *server;
@@ -326,10 +297,6 @@ static void g_showhelp() {
 #define PATHLEN     256
 
 static char paste_fname[200];
-extern time_t paste_time;
-extern char paste_path[];
-extern char paste_title[];
-extern int paste_level;
 
 static void load_paste() {
     struct stat st;
@@ -521,8 +488,6 @@ static int AnnounceSelect() {
     return FULLUPDATE;
 }
 
-extern char vetitle[];
-
 void gem(char* maintitle, item_t* path, int update) {
     gmenu_t me;
     int ch;
@@ -715,10 +680,6 @@ void gem(char* maintitle, item_t* path, int update) {
 	free(me.item[ch]);
 }
 
-extern char *msg_fwd_ok;
-extern char *msg_fwd_err1;
-extern char *msg_fwd_err2;
-
 static void a_forward(char *path, fileheader_t *pitem, int mode) {
     fileheader_t fhdr;
     
@@ -758,7 +719,6 @@ static void a_additem(menu_t *pm, fileheader_t *myheader) {
 #define ADDGROUP        1
 #define ADDGOPHER       2
 #define ADDLINK         3
-extern char currboard[];
 
 static void a_newitem(menu_t *pm, int mode) {
     static char *mesg[4] = {
@@ -999,9 +959,6 @@ static void a_appenditem(menu_t *pm, int isask) {
 }
 
 static int a_pastetagpost(menu_t *pm, int mode) {
-    extern int TagNum;
-    extern void EnumTagFhdr();
-    extern void UnTagger(int locus);
     fileheader_t fhdr;
     int ans = 0, ent=0, tagnum;
     char title[TTLEN + 1]=  "��  ";
@@ -1248,12 +1205,6 @@ static void atitle() {
 }
 #endif
 
-extern char currtitle[TTLEN + 1];
-
-char trans_buffer[256];
-extern char quote_file[];
-extern unsigned int currstat;
-
 static int isvisible_man(menu_t  *me)
 {
   fileheader_t *fhdr = &me->header[me->now-me->page];
diff --git a/mbbsd/args.c b/mbbsd/args.c
index 4d1d6ceb..9f937723 100644
--- a/mbbsd/args.c
+++ b/mbbsd/args.c
@@ -1,4 +1,5 @@
-/* $Id: args.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: args.c,v 1.2 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 #ifdef HAVE_SETPROCTITLE
 
 void initsetproctitle(int argc, char **argv, char **envp) {
@@ -6,10 +7,6 @@ void initsetproctitle(int argc, char **argv, char **envp) {
 
 #else
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
 
 char **Argv = NULL;          /* pointer to argument vector */
 char *LastArgv = NULL;       /* end of argv */
diff --git a/mbbsd/bbcall.c b/mbbsd/bbcall.c
index 8fdc56d2..7e511686 100644
--- a/mbbsd/bbcall.c
+++ b/mbbsd/bbcall.c
@@ -1,16 +1,5 @@
-/* $Id: bbcall.c,v 1.2 2002/04/28 19:35:28 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "proto.h"
+/* $Id: bbcall.c,v 1.3 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 #define SERVER_0941     "www.chips.com.tw"
 #define SERVER_0943     "www.pager.com.tw"
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 9c5d864b..4b401280 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1,27 +1,5 @@
-/* $Id: bbs.c,v 1.47 2002/06/02 01:55:21 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "perm.h"
-#include "modes.h"
-#include "common.h"
-#include "proto.h"
-
-extern struct bcache_t *brdshm;
-extern userinfo_t *currutmp;
-extern userec_t cuser;
-extern void touchdircache(int bid);
-extern int TagNum;
-extern time_t now;
-extern char fromhost[];
-
+/* $Id: bbs.c,v 1.48 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 static void mail_by_link(char* owner, char* title, char* path) {
     char genbuf[200];
@@ -38,7 +16,6 @@ static void mail_by_link(char* owner, char* title, char* path) {
     append_record(genbuf, &mymail, sizeof(mymail));      
 }
 
-extern int usernum;
 
 void anticrosspost() {
     char buf[200];
@@ -119,10 +96,6 @@ void make_blist() {
 }
 */
 
-extern int currbid;
-extern char currBM[];
-extern int currmode;
-extern char currboard[];
 static time_t board_note_time;
 static char *brd_title;
 
@@ -152,12 +125,6 @@ static void readtitle() {
 	 "                                   \033[m");
 }
 
-extern int brc_num;
-extern int brc_list[];
-extern char currtitle[TTLEN + 1];
-
-extern int Tagger();
-
 static void readdoent(int num, fileheader_t *ent)
 {
     int     type,uid;
@@ -211,27 +178,18 @@ static void readdoent(int num, fileheader_t *ent)
                title);
 }
 
-extern char currfile[];
-
 int cmpfilename(fileheader_t *fhdr) {
     return (!strcmp(fhdr->filename, currfile));
 }
 
-extern unsigned char currfmode;
-
 int cmpfmode(fileheader_t *fhdr) {
     return (fhdr->filemode & currfmode);
 }
 
-extern char currowner[];
-
 int cmpfowner(fileheader_t *fhdr) {
     return !strcasecmp(fhdr->owner, currowner);
 }
 
-extern char *err_bid;
-extern userinfo_t *currutmp;
-
 int whereami(int ent, fileheader_t *fhdr, char *direct) {
     boardheader_t *bh, *p[32], *root;
     int i,j;
@@ -329,9 +287,6 @@ void outgo_post(fileheader_t *fh, char *board) {
     }
 }
 
-extern char *str_author1;
-extern char *str_author2;
-
 static void cancelpost(fileheader_t *fh, int by_BM) {
     FILE *fin, *fout;
     char *ptr, *brd;
@@ -372,9 +327,6 @@ static void cancelpost(fileheader_t *fh, int by_BM) {
     }
 }
 
-extern char *str_reply;
-extern char save_title[];
-
 /* ----------------------------------------------------- */
 /* �o���B�^���B�s��B����峹                            */
 /* ----------------------------------------------------- */
@@ -411,19 +363,10 @@ static void do_unanonymous_post(char* fpath) {
     }
 }
 
-extern char quote_file[];
-extern char quote_user[];
-extern int curredit;
-extern unsigned int currbrdattr;
-extern char currdirect[];
-extern char *err_uid;
-
 #ifdef NO_WATER_POST
 static time_t last_post_time = 0;
 static time_t water_counts = 0;
 #endif
-int local_article;
-char real_name[IDLEN + 1];
 
 static int do_general() {
     fileheader_t postfile;
@@ -628,9 +571,6 @@ int do_post() {
     return 0;
 }
 
-extern int b_lines;
-extern int curredit;
-
 static void do_generalboardreply(fileheader_t *fhdr){            
     char genbuf[200];
     getdata(b_lines - 1, 0,
@@ -768,7 +708,6 @@ static int edit_post(int ent, fileheader_t *fhdr, char *direct) {
     return FULLUPDATE;
 }
 
-extern crosspost_t postrecord;
 #define UPDATE_USEREC   (currmode |= MODE_DIRTY)
 
 static int cross_post(int ent, fileheader_t *fhdr, char *direct) {
@@ -1140,8 +1079,6 @@ int edit_title(int ent, fileheader_t *fhdr, char *direct) {
     return DONOTHING;
 }
 
-extern unsigned int currstat;
-
 static int solve_post(int ent, fileheader_t * fhdr, char *direct){
     if (HAS_PERM(PERM_SYSOP)) {
 	fhdr->filemode ^= FILE_SOLVED;
@@ -1166,7 +1103,6 @@ static int recommend_cancel(int ent, fileheader_t *fhdr, char *direct) {
 }
 static int recommend(int ent, fileheader_t *fhdr, char *direct) {
     struct tm *ptime=localtime(&now); 
-    extern userec_t xuser;
     char buf[200],path[200], yn[5];
     boardheader_t *bp;
     bp = getbcache(currbid);
@@ -1224,8 +1160,6 @@ static int mark_post(int ent, fileheader_t *fhdr, char *direct) {
     return PART_REDRAW;
 }
 
-extern char *msg_sure_ny;
-
 int del_range(int ent, fileheader_t *fhdr, char *direct) {
     char num1[8], num2[8];
     int inum1, inum2;
@@ -1298,9 +1232,6 @@ int del_range(int ent, fileheader_t *fhdr, char *direct) {
     return DONOTHING;
 }
 
-extern char *msg_del_ny;
-extern char *msg_del_ok;
-
 static int del_post(int ent, fileheader_t *fhdr, char *direct) {
     char genbuf[100];
     int not_owned;
@@ -1521,10 +1452,6 @@ static int sequential_read(int ent, fileheader_t *fhdr, char *direct) {
     return FULLUPDATE;
 }
 
-extern char *fn_notes;
-extern char *msg_cancel;
-extern char *fn_board;
-
 /* ----------------------------------------------------- */
 /* �ݪO�Ƨѿ��B��K�B��ذ�                              */
 /* ----------------------------------------------------- */
@@ -1686,8 +1613,6 @@ int board_etc() {
     return NEWDIRECT;
 }
 
-extern char *fn_mandex;
-
 static int good_post(int ent, fileheader_t *fhdr, char *direct) {
     char genbuf[200];
     char genbuf2[200];
@@ -1796,7 +1721,6 @@ static int b_help() {
 /* ----------------------------------------------------- */
 char board_hidden_status;
 #ifdef  BMCHS
-extern char *fn_board;
 static int change_hidden(int ent, fileheader_t *fhdr, char *direct)
 {
     boardheader_t bh;
@@ -1896,8 +1820,6 @@ struct onekey_t read_comms[] = {
     {'\0', NULL}
 };
 
-time_t board_visit_time;
-
 int Read() {
     int mode0 = currutmp->mode;
     int stat0 = currstat, tmpbid=currutmp->brc_id;
diff --git a/mbbsd/board.c b/mbbsd/board.c
index c0fed91c..af997121 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -1,26 +1,10 @@
-/* $Id: board.c,v 1.28 2002/06/02 01:55:21 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "perm.h"
-#include "modes.h"
-#include "common.h"
-#include "proto.h"
-
+/* $Id: board.c,v 1.29 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 #define BRC_STRLEN 15             /* Length of board name */
 #define BRC_MAXSIZE     24576
 #define BRC_ITEMSIZE    (BRC_STRLEN + 1 + BRC_MAXNUM * sizeof( int ))
 #define BRC_MAXNUM      80
 
-extern userinfo_t *currutmp;
-extern time_t now;
 static char *brc_getrecord(char *ptr, char *name, int *pnum, int *list) {
     int num;
     char *tmp;
@@ -55,13 +39,9 @@ static char *brc_putrecord(char *ptr, char *name, int num, int *list) {
     return ptr;
 }
 
-extern userec_t cuser;
-extern char currboard[];        /* name of currently selected board */
 static int brc_changed = 0;
 static char brc_buf[BRC_MAXSIZE];
-int brc_num;
 static char brc_name[BRC_STRLEN];
-int brc_list[BRC_MAXNUM];
 static char *fn_boardrc = ".boardrc";
 static int brc_size;
 
@@ -117,10 +97,6 @@ static void read_brc_buf() {
     }
 }
 
-extern int currbid;
-extern unsigned int currbrdattr;
-extern boardheader_t *bcache;
-
 int brc_initial(char *boardname) {
     char *ptr;
     if(strcmp(currboard, boardname) == 0) {
@@ -227,8 +203,6 @@ typedef struct {
     unsigned int myattr;
 } boardstat_t;
 
-extern time_t login_start_time;
-extern int numboards;
 static int *zapbuf=NULL,*favbuf;
 static boardstat_t *nbrd=NULL;
 
@@ -294,8 +268,6 @@ void save_brdbuf() {
     }
 }
 
-extern char *fn_visable;
-
 int Ben_Perm(boardheader_t *bptr) {
     register int level,brdattr;
     register char *ptr;
@@ -328,10 +300,6 @@ int Ben_Perm(boardheader_t *bptr) {
     return 1;
 }
 
-extern char currauthor[];
-extern int b_lines;
-extern char currowner[];
-
 #if 0
 static int have_author(char* brdname) {
     char dirname[100];
@@ -380,10 +348,7 @@ static int check_newpost(boardstat_t *ptr) { /* Ptt 
     return 1;
 }
 
-extern int currmode;
-extern struct bcache_t *brdshm;
 static int brdnum;
-int  class_bid = 0;
 static int yank_flag = 1;
 static void load_uidofgid(const int gid, const int type){
    boardheader_t *bptr,*currbptr;
@@ -546,9 +511,6 @@ static void brdlist_foot() {
 	   yank_flag==0 ? "�̷R" : yank_flag==1 ? "����" : "����");
 }
 
-extern unsigned int currstat;
-extern char *BBSName;
-
 static void show_brdlist(int head, int clsflag, int newflag) {
     int myrow = 2;
     if(class_bid == 1) {
@@ -680,9 +642,6 @@ static void set_menu_BM(char *BM) {
     }
 }
 
-extern int p_lines;             /* a Page of Screen line numbers: tlines-4 */
-extern int t_lines;
-extern char *fn_notes;
 static char *privateboard =
 "\n\n\n\n         �藍�_ ���O�ثe�u��ݪO�n�Ͷi�J  �Х��V�O�D�ӽФJ�ҳ\\�i";
 static void dozap(int num){
@@ -736,7 +695,6 @@ static void choose_board(int newflag) {
 #if HAVE_SEARCH_ALL
     char genbuf[200];
 #endif
-    extern time_t board_visit_time;
     
     setutmpmode(newflag ? READNEW : READBRD);
     brdnum = 0;
diff --git a/mbbsd/cache.c b/mbbsd/cache.c
index 5d7bef6a..ab87c3a0 100644
--- a/mbbsd/cache.c
+++ b/mbbsd/cache.c
@@ -1,30 +1,5 @@
-/* $Id: cache.c,v 1.30 2002/06/01 03:51:36 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <ctype.h>
-#include <errno.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/sem.h>
-
-#ifdef __FreeBSD__
-#include <machine/param.h>
-#endif
-
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "perm.h"
-#include "modes.h"
-#include "proto.h"
+/* $Id: cache.c,v 1.31 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 #ifndef __FreeBSD__
 union semun {
@@ -34,7 +9,6 @@ union semun {
     struct seminfo *__buf;      /* buffer for IPC_INFO */
 };
 #endif
-extern time_t now;
 int fcache_semid;
 
 /* the reason for "safe_sleep" is that we may call sleep during
@@ -154,7 +128,6 @@ void sem_lock(int op,int semid) {
    the bbs exits if it can't attach to the shared memory or 
    the hash is not loaded yet.
 */
-uhash_t *uhash;
 
 /* attach_uhash should be called before using uhash */
 void attach_uhash() {
@@ -209,7 +182,6 @@ int deumoney(int uid, int money) {
        return setumoney(uid,uhash->money[uid-1]+money);
 }
 int demoney(int money) {
-  extern int usernum;
   return deumoney(usernum,money);
 } 
 int moneyof(int uid){   /* ptt ��i�����B�z�IJv */
@@ -232,7 +204,6 @@ int searchuser(char *userid) {
 }
 
 #if !defined(_BBS_UTIL_C_)
-extern userec_t xuser;
 
 int getuser(char *userid) {
     int uid;
@@ -310,20 +281,13 @@ char *u_namearray(char buf[][IDLEN + 1], int *pnum, char *tag) {
 /*-------------------------------------------------------*/
 /* .UTMP cache                                           */
 /*-------------------------------------------------------*/
-struct utmpfile_t *utmpshm=NULL;
-
 void resolve_utmp() {
     if(utmpshm == NULL) {
 	utmpshm = attach_shm(UTMPSHM_KEY, sizeof(*utmpshm));
     }
 }
 
-userinfo_t *currutmp = NULL;
-
 #if !defined(_BBS_UTIL_C_)
-extern unsigned int currstat;
-extern userec_t cuser;
-
 void setutmpmode(int mode) {
     if(currstat != mode)
 	currutmp->mode = currstat = mode;
@@ -426,7 +390,6 @@ void sort_utmp()
 }
 // Ptt:�o��[�Jhash�[�� ��Ū�utmp
 void getnewutmpent(userinfo_t *up) {
-    extern int errno;
     register int i, p ;
     register userinfo_t *uentp;
     for(i = 0, p=StringHash(up->userid)%USHM_SIZE; i < USHM_SIZE; i++, p++) {
@@ -460,8 +423,6 @@ userinfo_t *search_ulist(int uid) {
 }
 
 #if !defined(_BBS_UTIL_C_)           
-extern int usernum;
-
 userinfo_t *search_ulist_pid(int pid) {
     register int i=0, j, start = 0, end = utmpshm->number - 1;
     register userinfo_t **ulist;
@@ -567,11 +528,6 @@ void purge_utmp(userinfo_t *uentp) {
 /*-------------------------------------------------------*/
 /* .BOARDS cache                                         */
 /*-------------------------------------------------------*/
-extern char *fn_board;
-extern int currbid;
-bcache_t *brdshm;
-boardheader_t *bcache;
-
 void touchdircache(int bid)
 {
     int *i= (int *)&brdshm->dircache[bid - 1][0].filename[0];
@@ -665,8 +621,6 @@ static void reload_bcache() {
 #endif
 }
 
-int numboards = -1;
-
 void resolve_boards() {
     if(brdshm == NULL) {
 	brdshm = attach_shm(BRDSHM_KEY, sizeof(*brdshm));
@@ -806,9 +760,6 @@ int getbnum(char *bname) {
 }
 
 #if !defined(_BBS_UTIL_C_)
-extern char *fn_water;
-extern char *str_sysop;
-
 int haspostperm(char *bname) {
     register int i;
     char buf[200];
@@ -920,13 +871,12 @@ static void reload_pttcache()
     }
 }
 
-int     *GLOBE;
 void resolve_garbage() {
     int count=0;
     
     if(ptt == NULL) {
 	ptt = attach_shm(PTTSHM_KEY, sizeof(*ptt));
-	GLOBE = ptt->GLOBE;
+	GLOBALVAR = ptt->GLOBALVAR;
 	if(ptt->touchtime == 0)
 	    ptt->touchtime = 1;
     }
@@ -950,8 +900,6 @@ void resolve_garbage() {
 /* PTT's cache                                           */
 /*-------------------------------------------------------*/
 /* cachefor from host �P�̦h�W�u�H�� */
-struct fromcache_t *fcache;
-
 static void reload_fcache() {
     if(fcache->busystate)
 	safe_sleep(1);
@@ -1002,9 +950,6 @@ void resolve_fcache() {
 	reload_fcache();
 }
 
-extern time_t login_start_time;
-extern char *fn_visable;
-
 void hbflreload(int bid)
 {
     int     hbfl[MAX_FRIEND + 1], i, num, uid;
diff --git a/mbbsd/cal.c b/mbbsd/cal.c
index 5d80bc47..3b41d279 100644
--- a/mbbsd/cal.c
+++ b/mbbsd/cal.c
@@ -1,26 +1,10 @@
-/* $Id: cal.c,v 1.12 2002/05/25 11:18:11 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "modes.h"
-#include "perm.h"
-#include "proto.h"
-
-extern struct utmpfile_t *utmpshm;
-extern int usernum;
-extern time_t now;
+/* $Id: cal.c,v 1.13 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 /* ���� Multi play */
 static int count_multiplay(int unmode) {
     register int i, j;
     register userinfo_t *uentp;
-    extern struct utmpfile_t *utmpshm;
 
     for(i = j = 0; i < USHM_SIZE; i++) {
 	uentp = &(utmpshm->uinfo[i]);
@@ -31,9 +15,6 @@ static int count_multiplay(int unmode) {
     return j;
 }
 
-extern userinfo_t *currutmp;
-extern char *ModeTypeTable[];
-
 int lockutmpmode(int unmode, int state) {
     int errorno = 0;
     
@@ -66,9 +47,6 @@ int unlockutmpmode() {
     return 0;
 }
 
-extern userec_t cuser;
-extern userec_t xuser;
-
 /* �ϥο������ */
 #define VICE_NEW   "vice.new"
 
@@ -96,8 +74,6 @@ int vice(int money, char* item) {
 #define lockbreak(unmode, state) if(lockutmpmode(unmode, state)) break
 #define SONGBOOK  "etc/SONGBOOK"
 #define OSONGPATH "etc/SONGO"
-extern char trans_buffer[];
-extern char save_title[];
 
 static int osong(char *defaultid) {
     char destid[IDLEN + 1],buf[200],genbuf[200],filename[256],say[51];
@@ -269,8 +245,6 @@ static int inmailbox(int m) {
 }
 
 
-extern int b_lines;
-
 #if !HAVE_FREECLOAK
 /* ������ */
 int p_cloak() {
diff --git a/mbbsd/calendar.c b/mbbsd/calendar.c
index 371a8f79..f807c8a9 100644
--- a/mbbsd/calendar.c
+++ b/mbbsd/calendar.c
@@ -1,15 +1,6 @@
-/* $Id: calendar.c,v 1.2 2002/05/13 03:20:04 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "proto.h"
-#include "modes.h"
+/* $Id: calendar.c,v 1.3 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
-extern time_t now;
 typedef struct event_t {
     int year, month, day, days;
     int color;
@@ -100,8 +91,6 @@ static void FreeEvent(event_t *e) {
     }
 }
 
-extern userec_t cuser;
-
 static event_t *ReadEvent(int today) {
     FILE *fp;
     char buf[256];
diff --git a/mbbsd/card.c b/mbbsd/card.c
index 66aeded8..e5ac18e7 100644
--- a/mbbsd/card.c
+++ b/mbbsd/card.c
@@ -1,13 +1,5 @@
-/* $Id: card.c,v 1.2 2002/04/28 19:35:28 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "modes.h"
-#include "proto.h"
-extern int usernum;
+/* $Id: card.c,v 1.3 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 static int card_remain(int cards[]) {
     int i, temp = 0;
@@ -322,8 +314,6 @@ int card_99() {
 #define JACK      (10)        /*�³ǧJ��Ticket*/
 #define NINE99    (99)        /*99    ��Ticket*/
 
-extern userec_t cuser;
-
 static int game_log(int type, int money) {
     FILE *fp;
 
@@ -394,8 +384,6 @@ static int card_alls_upper(int all[]) {
     return count;
 }
 
-extern int b_lines;
-
 static int card_jack(int *db) {
     int i, j;
     int cpu[5], c[5], me[5], m[5];
diff --git a/mbbsd/chat.c b/mbbsd/chat.c
index 284403a8..17e004b0 100644
--- a/mbbsd/chat.c
+++ b/mbbsd/chat.c
@@ -1,27 +1,8 @@
-/* $Id: chat.c,v 1.4 2002/05/25 11:18:11 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <ctype.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "perm.h"
-#include "common.h"
-#include "modes.h"
-#include "proto.h"
-
-extern userinfo_t *currutmp;
-static int chatline;
-static int stop_line;    /* next line of bottom of message window area */
-static FILE *flog;
-extern time_t now;
+/* $Id: chat.c,v 1.5 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
+static int chatline, stop_line;
+static FILE *flog;
 static void printchatline(char *str) {
     move(chatline, 0);
     if(*str == '>' && !PERM_HIDE(currutmp))
@@ -40,8 +21,6 @@ static void printchatline(char *str) {
 	fprintf(flog, "%s\n", str);
 }
 
-extern int b_lines;             /* Screen bottom line number: t_lines-1 */
-
 static void chat_clear() {
     for(chatline = 2; chatline < stop_line; chatline++) {
 	move(chatline, 0);
@@ -125,8 +104,6 @@ static int chat_recv(int fd, char *chatid) {
     return 0;
 }
 
-extern userec_t cuser;
-
 static int printuserent(userinfo_t *uentp) {
     static char uline[80];
     static int cnt;
@@ -208,11 +185,6 @@ static void chat_pager() {
     printchatline(genbuf);
 }
 
-extern char *str_space;
-extern userec_t xuser;
-extern char *fn_plans;
-extern char *err_uid;
-
 static void chat_query(char *arg) {
     char *uid;
     int tuid;
@@ -245,8 +217,6 @@ static void chat_query(char *arg) {
 	printchatline(err_uid);
 }
 
-extern char *msg_shortulist;
-
 static void chat_users() {
     printchatline("");
     printchatline("�i " BBSNAME "���C�ȦC�� �j");
@@ -294,8 +264,6 @@ static int chat_cmd(char *buf, int fd) {
     return 0;
 }
 
-extern char trans_buffer[256];         /* �@��ǻ��ܼ� add by Ptt */
-
 #if 0
 static char *select_address() {
     int c;
@@ -330,9 +298,6 @@ static char *select_address() {
 }
 #endif
 
-extern int usernum;
-extern int t_lines;
-extern char *msg_seperator;
 #define MAXLASTCMD 6
 static int chatid_len = 10;
 
@@ -563,7 +528,6 @@ int t_chat() {
 	    continue;
 	}
 	if(ch == Ctrl('I')) {
-	    extern screenline_t *big_picture;
 	    screenline_t *screen0 = calloc(t_lines, sizeof(screenline_t));
 
 	    memcpy(screen0, big_picture, t_lines * sizeof(screenline_t));
@@ -615,7 +579,4 @@ int t_chat() {
 /* -------------------------------------------------- */
 #if 0
 
-extern char page_requestor[];
-extern userinfo_t *currutmp;
-
 #endif
diff --git a/mbbsd/chc_draw.c b/mbbsd/chc_draw.c
index b3bd216f..bb9a15a9 100644
--- a/mbbsd/chc_draw.c
+++ b/mbbsd/chc_draw.c
@@ -1,10 +1,5 @@
-/* $Id: chc_draw.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
-#include <stdio.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "proto.h"
+/* $Id: chc_draw.c,v 1.2 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 #define SIDE_ROW          10
 #define TURN_ROW          11
@@ -14,12 +9,6 @@
 #define MYWIN_ROW         17
 #define HISWIN_ROW        18
 
-extern char chc_warnmsg[64], *chc_mateid;
-extern rc_t chc_from, chc_to, chc_select;
-extern int chc_selected, chc_my, chc_turn, chc_firststep;
-extern int chc_lefttime;
-extern int chc_hiswin, chc_hislose, chc_histie;
-
 static char *turn_str[2] = {"�ª�", "����"};
 
 static char *num_str[10] = {
@@ -104,8 +93,6 @@ static void showstep(board_t board) {
     prints("\033[m");
 }
 
-extern userec_t cuser;
-
 void chc_drawline(board_t board, int line) {
     int i, j;
     
diff --git a/mbbsd/chc_net.c b/mbbsd/chc_net.c
index d094d5f2..b9f63d8f 100644
--- a/mbbsd/chc_net.c
+++ b/mbbsd/chc_net.c
@@ -1,12 +1,5 @@
-/* $Id: chc_net.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
-#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include "config.h"
-#include "pttstruct.h"
-
-extern rc_t chc_from, chc_to;
-
+/* $Id: chc_net.c,v 1.2 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 typedef struct drc_t {
     rc_t from, to;
 } drc_t;
diff --git a/mbbsd/chc_play.c b/mbbsd/chc_play.c
index 8f3e432c..cffe3959 100644
--- a/mbbsd/chc_play.c
+++ b/mbbsd/chc_play.c
@@ -1,26 +1,8 @@
-/* $Id: chc_play.c,v 1.2 2002/05/13 03:20:04 ptt Exp $ */
-#include <stdio.h>
-#include <time.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <string.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "modes.h"
-#include "proto.h"
-
-extern userinfo_t *currutmp;
-extern int usernum;
-extern time_t now;
+/* $Id: chc_play.c,v 1.3 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 typedef int (*play_func_t)(int, board_t, board_t);
 
 static int chc_ipass = 0, chc_hepass = 0;
-int chc_lefttime;
-int chc_my, chc_turn, chc_selected, chc_firststep;
-char chc_warnmsg[64], *chc_mateid;
-rc_t chc_from, chc_to, chc_select, chc_cursor;
-int chc_hiswin, chc_hislose, chc_histie;
 
 #define CHC_TIMEOUT           300
 #define SIDE_ROW          10
@@ -191,8 +173,6 @@ static int myplay(int s, board_t board, board_t tmpbrd) {
     return endgame;
 }
 
-extern userec_t cuser;
-
 static void mainloop(int s, board_t board) {
     int endgame;
     board_t tmpbrd;
@@ -229,8 +209,6 @@ static void mainloop(int s, board_t board) {
     oflush();
 }
 
-extern userec_t xuser;
-
 static void chc_init(int s, board_t board) {
     userinfo_t *my = currutmp;
 
diff --git a/mbbsd/chc_rule.c b/mbbsd/chc_rule.c
index 35d8fe6a..e5a92c32 100644
--- a/mbbsd/chc_rule.c
+++ b/mbbsd/chc_rule.c
@@ -1,14 +1,5 @@
-/* $Id: chc_rule.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
-#include <stdio.h>
-#include <sys/types.h>
-#include <string.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "proto.h"
-
-extern rc_t chc_from, chc_to;
-extern int chc_my;
+/* $Id: chc_rule.c,v 1.2 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 #define CENTER(a, b)      (((a) + (b)) >> 1)
 
diff --git a/mbbsd/chicken.c b/mbbsd/chicken.c
index c3bc1fa0..9c30deec 100644
--- a/mbbsd/chicken.c
+++ b/mbbsd/chicken.c
@@ -1,16 +1,5 @@
-/* $Id: chicken.c,v 1.3 2002/05/13 03:20:04 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "modes.h"
-#include "proto.h"
+/* $Id: chicken.c,v 1.4 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 #define NUM_KINDS   13                   /* ���h�ֺذʪ� */
 
@@ -56,8 +45,6 @@ enum {
     TEMPERAMENT, TIREDSTRONG, SICK, HP_MAX, MM_MAX
 };
 
-extern userec_t cuser;
-extern time_t now;
 static chicken_t *mychicken = &cuser.mychicken;
 static int age;
 
@@ -92,9 +79,6 @@ static const int time_change[NUM_KINDS][14] =
     { 1,  1, 147,    2,  10,   10,   85,  20,  4,  25,  25,   5,  145,  95}
 };
 
-extern userec_t xuser;
-extern int usernum;
-
 int reload_chicken() {
     passwd_query(usernum, &xuser);
     memcpy(mychicken, &xuser.mychicken, sizeof(chicken_t));
@@ -208,7 +192,6 @@ static void show_chicken_stat(chicken_t *thechicken) {
 }
 
 #define CHICKEN_PIC "etc/chickens"
-extern char *BBSName;
 
 void show_chicken_data(chicken_t *thechicken, chicken_t *pkchicken) {
     char buf[1024];
@@ -360,8 +343,6 @@ static void ch_hit() {
     pressanykey();
 }
 
-extern int b_lines;             /* Screen bottom line number: t_lines-1 */
-
 void ch_buyitem(int money, char *picture, int *item) {
     int num = 0;
     char buf[5];
@@ -843,9 +824,6 @@ int chicken_main() {
     return 0;
 }
 
-extern userinfo_t *currutmp;
-extern struct utmpfile_t *utmpshm;
-
 int chickenpk(int fd) {
     char mateid[IDLEN + 1], data[200], buf[200];
     int ch = 0;
diff --git a/mbbsd/dark.c b/mbbsd/dark.c
index ee691577..9cf99aab 100644
--- a/mbbsd/dark.c
+++ b/mbbsd/dark.c
@@ -1,19 +1,8 @@
-/* $Id: dark.c,v 1.3 2002/05/13 03:20:04 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "proto.h"
+/* $Id: dark.c,v 1.4 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 #define RED   1
 #define BLACK 0
-extern time_t now;
 typedef short int sint;
 
 typedef struct item {
@@ -26,7 +15,6 @@ typedef struct cur{
 
 static item brd[4][8];                 
 static cur  curr;                            /*   6 �� bytes */
-extern userinfo_t *currutmp; 
 
 static char *rname[]={"�L","��","�X","��","��","�K","��"};
 static char *bname[]={"��","�]","��","��","�H","�h","�N"};
diff --git a/mbbsd/dice.c b/mbbsd/dice.c
index e4aa8869..32ef7f5b 100644
--- a/mbbsd/dice.c
+++ b/mbbsd/dice.c
@@ -1,13 +1,5 @@
-/* $Id: dice.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "modes.h"
-#include "proto.h"
+/* $Id: dice.c,v 1.3 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 #define DICE_TXT   BBSHOME "/etc/dice.txt"
 #define DICE_DATA  BBSHOME "/etc/dice.data"
@@ -20,7 +12,6 @@
 #define B_TIMES  5
 #define B_THIRD  3
 
-extern int usernum;
 static int flag[100], value[100];
 
 typedef struct dicedata_t {
@@ -173,8 +164,6 @@ static int check_index(int index) {
     return 0;
 }
 
-extern userec_t cuser;
-
 static int del(int total, dicedata_t *table) {
     int index, money;
     char data[10];
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index f6a14766..b9dc41ba 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1,21 +1,5 @@
-/* $Id: edit.c,v 1.10 2002/05/14 17:13:45 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <time.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "config.h"
-#include "common.h"
-#include "modes.h"
-#include "perm.h"
-#include "proto.h"
-
-#define WRAPMARGIN (511)
-
+/* $Id: edit.c,v 1.11 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 typedef struct textline_t {
     struct textline_t *prev;
     struct textline_t *next;
@@ -23,29 +7,6 @@ typedef struct textline_t {
     char data[WRAPMARGIN + 1];
 } textline_t;
 
-extern int current_font_type;
-extern char *str_author1;
-extern char *str_author2;
-extern int t_lines, t_columns;  /* Screen size / width */
-extern int b_lines;             /* Screen bottom line number: t_lines-1 */
-extern char quote_file[80];
-extern char quote_user[80];
-extern int curredit;
-extern unsigned int currbrdattr;
-extern char currboard[];        /* name of currently selected board */
-extern char *str_reply;
-extern char *str_post1;
-extern char *str_post2;
-extern char *BBSName;
-extern char fromhost[];
-extern unsigned int currstat;
-extern crosspost_t postrecord;
-extern userinfo_t *currutmp;
-extern int KEY_ESC_arg;
-extern char reset_color[];
-extern char trans_buffer[256];
-extern time_t now;
-
 #define KEEP_EDITING    -2
 #define BACKUP_LIMIT    100
 #define SCR_WIDTH       80 
@@ -61,8 +22,6 @@ static textline_t *blockline = NULL;
 static textline_t *top_of_win = NULL;
 static textline_t *deleted_lines = NULL;
 
-extern int local_article;
-extern char real_name[IDLEN + 1];
 static char line[WRAPMARGIN  + 2];
 static int ifuseanony=0;
 static int currpnt, currln, totaln;
@@ -82,8 +41,6 @@ static int insert_c = ' ';
 
 static char fp_bak[] = "bak";
 
-char save_title[STRLEN];
-
 /* �O����޲z�P�s��B�z */
 static void indigestion(i) {
     fprintf(stderr, "�Y������ %d\n", i);
@@ -733,8 +690,6 @@ static void read_file(char *fpath) {
     load_file(fp);
 }
 
-extern userec_t cuser;
-
 void write_header(FILE *fp) {
 
     if(curredit & EDIT_MAIL || curredit & EDIT_LIST) {
diff --git a/mbbsd/friend.c b/mbbsd/friend.c
index bac0674e..d772ad8c 100644
--- a/mbbsd/friend.c
+++ b/mbbsd/friend.c
@@ -1,26 +1,5 @@
-/* $Id: friend.c,v 1.5 2002/04/28 19:35:29 in2 Exp $ */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "perm.h"
-#include "proto.h"
-#include "modes.h"
-
-extern userec_t cuser;
-extern int currmode;
-extern char currboard[];	/* name of currently selected board */
-extern char *fn_overrides;
-extern userinfo_t *currutmp;
-extern char *fn_reject;
-extern int usernum;
-extern char *str_space;
-extern char *msg_uid;
+/* $Id: friend.c,v 1.6 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 /* ------------------------------------- */
 /* �S�O�W��                              */
@@ -43,17 +22,6 @@ static unsigned int friend_max[8] = {
 };
 /* ���M�n�͸��a�H�W�泣�O * 2 ���O�@���̦hload��shm�u�঳128 */
 
-/* Ptt �U�دS�O�W�檺�ɦW */
-char *friend_file[8] = {
-    FN_OVERRIDES,
-    FN_REJECT,
-    "alohaed",
-    "postlist",
-    "",
-    FN_CANVOTE,
-    FN_WATER,
-    FN_VISABLE
-};
 
 /* Ptt �U�دS�O�W�檺�ɭz */
 static char *friend_desc[8] = {
@@ -324,8 +292,6 @@ void friend_load() {
     login_friend_online();
 }
 
-extern userec_t cuser;
-
 static void friend_water(char *message, int type) { /* �s����y added by Ptt */
     char fpath[80], line[80], userid[IDLEN + 1];
     FILE *fp;
diff --git a/mbbsd/gamble.c b/mbbsd/gamble.c
index 64f04848..541dd451 100644
--- a/mbbsd/gamble.c
+++ b/mbbsd/gamble.c
@@ -1,22 +1,7 @@
-/* $Id: gamble.c,v 1.3 2002/05/13 03:20:04 ptt Exp $ */
-#include <stdio.h>
-#include <time.h>
-#include <string.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "modes.h"
-#include "proto.h"
-extern int usernum;
+/* $Id: gamble.c,v 1.4 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 #ifndef _BBS_UTIL_C_
-extern userec_t cuser;
-extern int b_lines;
-extern time_t now;
-
 #define MAX_ITEM	8	//�̤j �䶵(item) �Ӽ�
 #define MAX_ITEM_LEN	30	//�̤j �C�@�䶵�W�r����
 #define MAX_SUBJECT_LEN 650	//8*81 = 648 �̤j �D�D���� 
diff --git a/mbbsd/gomo.c b/mbbsd/gomo.c
index a8174d7f..6969df7a 100644
--- a/mbbsd/gomo.c
+++ b/mbbsd/gomo.c
@@ -1,28 +1,9 @@
-/* $Id: gomo.c,v 1.4 2002/05/25 11:18:11 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <string.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "gomo.h"
-#include "common.h"
-#include "modes.h"
-#include "proto.h"
+/* $Id: gomo.c,v 1.5 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
-extern int usernum;
-extern userinfo_t *currutmp;
-extern time_t now;
-
-char ku[BRDSIZ][BRDSIZ];
 static char *chess[] = { "��", "��" };
 static int tick, lastcount, mylasttick, hislasttick;
 
-unsigned char  *pat, *adv;
-
 typedef struct {
     char x;
     char y;
@@ -55,8 +36,6 @@ static void HO_undo(Horder_t *mv) {
     prints("%.2s", str + loc);
 }
 
-extern userec_t cuser;
-
 static void HO_log(char *user) {
     int i;
     FILE *log;
@@ -64,7 +43,6 @@ static void HO_log(char *user) {
     char buf1[80];
     char title[80];
     Horder_t *ptr = pool;
-    extern screenline_t *big_picture;
     fileheader_t mymail;
 
     sprintf(buf, "home/%c/%s/F.%d", cuser.userid[0], cuser.userid,
@@ -165,8 +143,6 @@ static int gomo_key(int fd, int ch, Horder_t *mv) {
     return 0;
 }
 
-extern userec_t xuser;
-
 static int reload_gomo() {
     passwd_query(usernum, &xuser);
     cuser.five_win = xuser.five_win;
diff --git a/mbbsd/gomo1.c b/mbbsd/gomo1.c
index 953bad2d..c741f538 100644
--- a/mbbsd/gomo1.c
+++ b/mbbsd/gomo1.c
@@ -1,24 +1,9 @@
-/* $Id: gomo1.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "proto.h"
+/* $Id: gomo1.c,v 1.2 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 #define QCAST   int (*)(const void *, const void *)
 
-#define BBLANK (0)  /* �ť� */
-#define BBLACK (1)  /* �¤l, ���� */
-#define BWHITE (2)  /* �դl, ��� */
-#ifndef BRDSIZ
-#define BRDSIZ (15) /* �ѽL����j�p */
-#endif
-
-extern char ku[BRDSIZ][BRDSIZ];
-
 /* pattern and advance map */
-extern unsigned char *pat, *adv;
 
 static int intrevcmp(const void *a, const void *b) {
     return (*(int *)b - *(int *)a);
@@ -62,7 +47,7 @@ int chkwin(int style, int limit) {
 
 /* x,y: 0..BRDSIZ-1 ; color: CBLACK,CWHITE ; limit:1,0 ; dx,dy: 0,1 */
 static int dirchk(int x, int y, int color, int limit, int dx, int dy) {
-    int le, ri, loc, style;
+    int le, ri, loc, style = 0;
 
     le = gomo_getindex(x, y, color, -dx, -dy);
     ri = gomo_getindex(x, y, color, dx,  dy);
@@ -78,7 +63,7 @@ static int dirchk(int x, int y, int color, int limit, int dx, int dy) {
     style >>= 4;
     
     if((style == 3) || (style == 2)) {
-	int i, n, tmp, nx, ny;
+	int i, n = 0, tmp, nx, ny;
 	
 	n = adv[loc >> 1];
 	
diff --git a/mbbsd/guess.c b/mbbsd/guess.c
index c24b8361..2a7e6fdb 100644
--- a/mbbsd/guess.c
+++ b/mbbsd/guess.c
@@ -1,16 +1,5 @@
-/* $Id: guess.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <string.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "modes.h"
-#include "proto.h"
-
-extern char *BBSName;
-extern int usernum;
+/* $Id: guess.c,v 1.3 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 #define LOGPASS BBSHOME "/etc/winguess.log"
 
 static void show_table(char TABLE[], char ifcomputer) {
@@ -31,8 +20,6 @@ static void show_table(char TABLE[], char ifcomputer) {
     prints("\033[33m=================\033[m");
 }
 
-extern userec_t cuser;
-
 static unsigned long int get_money(void) {
     int money, i;
     char data[20];
diff --git a/mbbsd/indict.c b/mbbsd/indict.c
index 51e20590..8861b320 100644
--- a/mbbsd/indict.c
+++ b/mbbsd/indict.c
@@ -1,20 +1,10 @@
-/* $Id: indict.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "perm.h"
-#include "common.h"
-#include "modes.h"
-#include "proto.h"
+/* $Id: indict.c,v 1.3 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 #define REFER "etc/dicts"
 
-extern userec_t cuser;
-char dict[41],database[41];
-
-static void addword(char word[]) {
+static void addword(char word[])
+{
     char buf[150],temp[150],a[3];
     FILE *fp = fopen(database,"r+");
 
diff --git a/mbbsd/io.c b/mbbsd/io.c
index f553db74..12459063 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -1,21 +1,5 @@
-/* $Id: io.c,v 1.16 2002/05/15 08:55:30 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <time.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <signal.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "perm.h"
-#include "modes.h"
-#include "common.h"
-#include "proto.h"
+/* $Id: io.c,v 1.17 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 #if defined(linux)
 #define OBUFSIZE  2048
@@ -25,23 +9,10 @@
 #define IBUFSIZE  256
 #endif
 
-extern int current_font_type;
-extern char *fn_proverb;
-extern userinfo_t *currutmp;
-extern unsigned int currstat;
-extern pid_t currpid;
-extern int errno;
-extern screenline_t *big_picture;
-extern int t_lines, t_columns;  /* Screen size / width */
-extern water_t water[6], *swater[5], *water_which;
-extern char water_usies;
-
 static char outbuf[OBUFSIZE], inbuf[IBUFSIZE];
 static int obufsize = 0, ibufsize = 0;
 static int icurrchar = 0;
 
-time_t now;
-
 /* ----------------------------------------------------- */
 /* output routines                                       */
 /* ----------------------------------------------------- */
@@ -101,22 +72,6 @@ int num_in_buf() {
     return icurrchar - ibufsize;
 }
 
-int watermode = -1, wmofo = -1; 
-/*
-  WATERMODE(WATER_ORIG) | WATERMODE(WATER_NEW):
-  Ptt ���y�^�U�Ϊ��Ѽ�
-      watermode = -1  �S�b�^���y
-                = 0   �b�^�W�@�����y  (Ctrl-R)
-	        > 0   �b�^�e n �����y (Ctrl-R Ctrl-R)
-
-  WATERMODE(WATER_OFO)  by in2
-        wmofo     = -1  �S�b�^���y
-	          = 0   ���b�^���y
-		  = 1   �^���y���S������y
-        wmofo     >=0 �ɦ�����y�N�u���, ���|��water[]��,
-	              �ݦ^�����y���ɭԤ@���g�J.
-*/
-
 /*
 	dogetch() is not reentrant-safe. SIGUSR[12] might happen at any time,
 	and dogetch() might be called again, and then ibufsize/icurrchar/inbuf
@@ -181,7 +136,7 @@ static int dogetch() {
       }
     return inbuf[icurrchar++];
 }
-extern userec_t cuser;
+
 static int water_which_flag=0;
 int igetch() {
     register int ch;
@@ -343,7 +298,6 @@ int oldgetdata(int line, int col, char *prompt, char *buf, int len, int echo) {
     register int ch, i;
     int clen;
     int x = col, y = line;
-    extern unsigned char scr_cols;
 #define MAXLASTCMD 12
     static char lastcmd[MAXLASTCMD][80];
 
@@ -563,8 +517,6 @@ rget(int x,char *prompt)
 }
 
 
-int KEY_ESC_arg;
-
 int igetkey() {
     int mode;
     int ch, last;
diff --git a/mbbsd/kaede.c b/mbbsd/kaede.c
index d3f9355b..d9c33589 100644
--- a/mbbsd/kaede.c
+++ b/mbbsd/kaede.c
@@ -1,17 +1,5 @@
-/* $Id: kaede.c,v 1.2 2002/05/13 03:20:04 ptt Exp $ */
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "proto.h"
-
-extern struct utmpfile_t *utmpshm;
-extern userec_t cuser;
-extern time_t now;
+/* $Id: kaede.c,v 1.3 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 char *Ptt_prints(char *str, int mode) {
     char *po , strbuf[256];
diff --git a/mbbsd/lovepaper.c b/mbbsd/lovepaper.c
index f4b8b56c..4c96f461 100644
--- a/mbbsd/lovepaper.c
+++ b/mbbsd/lovepaper.c
@@ -1,21 +1,7 @@
-/* $Id: lovepaper.c,v 1.4 2002/05/25 11:18:11 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "modes.h"
-#include "common.h"
-#include "proto.h"
-
+/* $Id: lovepaper.c,v 1.5 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 #define DATA "etc/lovepaper.dat"
 
-extern userec_t cuser;
-extern time_t now;
-
 int x_love() {
     char buf1[200], save_title[TTLEN + 1];
     char receiver[61], path[STRLEN] = "home/";
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index 9f7da59a..14325216 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -1,50 +1,5 @@
-/* $Id: mail.c,v 1.10 2002/05/25 17:49:48 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "perm.h"
-#include "modes.h"
-#include "proto.h"
-
-extern struct bcache_t *brdshm;
-extern int TagNum;
-extern int b_lines;               /* Screen bottom line number: t_lines-1 */
-extern char save_title[];         /* used by editor when inserting */
-extern int curredit;
-extern char *err_uid;
-extern char *msg_cancel;
-extern char *msg_uid;
-extern char *fn_overrides;
-extern char quote_file[80];
-extern char quote_user[80];
-extern char *fn_notes;
-extern char *msg_mailer;
-extern char *msg_sure_ny;
-extern char *BBSName;
-extern char currtitle[TTLEN + 1];
-extern unsigned char currfmode;               /* current file mode */
-extern char *msg_del_ny;
-extern char currfile[FNLEN];
-extern int currmode;
-extern char currboard[];        /* name of currently selected board */
-extern char *str_space;
-extern char *str_author1;
-extern char *str_author2;
-extern userinfo_t *currutmp;
-extern unsigned int currstat;
-extern pid_t currpid;
-extern int usernum;
-extern char *str_mail_address;
-extern userec_t cuser;
-extern time_t now;
+/* $Id: mail.c,v 1.11 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 char currmaildir[32];
 static char msg_cc[] = "\033[32m[�s�զW��]\033[m\n";
 static char listfile[] = "list.0";
@@ -238,8 +193,6 @@ static void do_hold_mail(char *fpath, char *receiver, char *holder) {
     do_append(title, &mymail, sizeof(mymail));
 }
 
-extern userec_t xuser;
-
 void hold_mail(char *fpath, char *receiver) {
     char buf[4];
     
@@ -361,8 +314,6 @@ int m_send() {
 }
 
 /* �s�ձH�H�B�^�H : multi_send, multi_reply */
-extern struct word_t *toplev;
-
 static void multi_list(int *reciper) {
     char uid[16];
     char genbuf[200];
@@ -441,7 +392,7 @@ static void multi_list(int *reciper) {
 
 static void multi_send(char *title) {
     FILE *fp;
-    struct word_t *p;
+    struct word_t *p = NULL;
     fileheader_t mymail;
     char fpath[TTLEN], *ptr;
     int reciper, listing;
@@ -580,7 +531,6 @@ int mail_all() {
     fileheader_t mymail;
     char fpath[TTLEN];
     char genbuf[200];
-    extern struct uhash_t *uhash;
     int i, unum;
     char *userid;
     
@@ -851,11 +801,6 @@ static void maildoent(int num, fileheader_t *ent) {
 	       ent->date, ent->owner, color, mark, title);
 }
 
-#ifdef POSTBUG
-extern int bug_possible;
-#endif
-
-
 static int m_idle(int ent, fileheader_t *fhdr, char *direct) {
     t_idle();
     return FULLUPDATE;
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index e964c2c0..036976f6 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1,63 +1,21 @@
-/* $Id: mbbsd.c,v 1.31 2002/05/24 18:24:22 ptt Exp $ */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <syslog.h>
-#include <errno.h>
-#include <netdb.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <arpa/telnet.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "perm.h"
-#include "modes.h"
-#include "proto.h"
-#ifdef FreeBSD
-  #include <machine/limits.h>
-#else
-  #include <limits.h>
-#endif
+/* $Id: mbbsd.c,v 1.32 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
 
 #define SOCKET_QLEN 4
 #define TH_LOW 100
 #define TH_HIGH 120
 
-extern int t_lines, t_columns;	/* Screen size / width */
-extern int b_lines;		/* Screen bottom line number: t_lines-1 */
-extern userinfo_t *currutmp;
-extern time_t now;
 static void do_aloha (char *hello);
 
 #if 0
 static jmp_buf byebye;
 #endif
 
-int talkrequest = NA;
-
 static char remoteusername[40] = "?";
 
-extern struct fromcache_t *fcache;
-extern struct utmpfile_t *utmpshm;
-extern int fcache_semid;
-
 static unsigned char enter_uflag;
 static int use_shell_login_mode = 0;
 
-char fromhost[STRLEN] = "\0";
-
 static struct sockaddr_in xsin;
 
 /* set signal handler, which won't be reset once signal comes */
@@ -152,8 +110,6 @@ chkload (char *buf)
     return 0;
 }
 
-extern userec_t cuser;
-
 void
 log_user (char *msg)
 {
@@ -164,7 +120,6 @@ log_user (char *msg)
     log_file (filename, msg);
 }
 
-extern time_t login_start_time;
 
 void
 log_usies (char *mode, char *mesg)
@@ -195,9 +150,6 @@ setflags (int mask, int value)
 	cuser.uflag &= ~mask;
 }
 
-extern int usernum;
-extern int currmode;
-
 void
 u_exit (char *mode)
 {
@@ -278,8 +230,6 @@ mysrand ()
     srand (time (NULL) + currutmp->pid);  /* �ɶ��� pid �� rand �� seed */
 }
 
-extern userec_t xuser;
-
 int
 dosearchuser (char *userid)
 {
@@ -312,7 +262,6 @@ talk_request(int sig)
 	unsigned char mode0 = currutmp->mode;
 	char c0 = currutmp->chatid[0];
 	screenline_t *screen0 = calloc (t_lines, sizeof (screenline_t));
-	extern screenline_t *big_picture;
 	
 	currutmp->mode = 0;
 	currutmp->chatid[0] = 1;
@@ -326,9 +275,6 @@ talk_request(int sig)
     }
 }
 
-extern char *fn_writelog;
-FILE *fp_writelog = NULL;
-
 void
 show_call_in(int save, int which)
 {
@@ -354,10 +300,6 @@ show_call_in(int save, int which)
     }
 }
 
-extern  unsigned int currstat;
-water_t water[6], *swater[6], *water_which=&water[0];
-char    water_usies=0;
-extern  int watermode, wmofo;
 static int add_history_water(water_t *w, msgque_t *msg)
 {
     // mode: 1: all data(including userid, pid);
@@ -568,16 +510,12 @@ logattempt (char *uid, char type)
     }
 }
 
-extern char *str_new;
-extern char *err_uid;
-
 static void
 login_query ()
 {
     char uid[IDLEN + 1], passbuf[PASSLEN];
     int attempts;
     char genbuf[200];
-    extern struct utmpfile_t *utmpshm;
     resolve_utmp ();
     resolve_garbage ();
     attach_uhash ();
@@ -772,17 +710,12 @@ check_BM ()
 {
     int i;
     boardheader_t *bhdr;
-    extern boardheader_t *bcache;
-    extern int numboards;
     
     cuser.userlevel &= ~PERM_BM;
     for (i = 0, bhdr = bcache; i < numboards && !is_BM (bhdr->BM); i++, bhdr++)
 	;
 }
 
-extern pid_t currpid;
-extern crosspost_t postrecord;
-
 static void
 setup_utmp (int mode)
 {
@@ -836,10 +769,6 @@ setup_utmp (int mode)
 #endif
 }
 
-extern char margs[];
-extern char *str_sysop;
-extern char *loginview_file[NUMVIEWFILE][2];
-
 static void
 user_login ()
 {
@@ -1005,13 +934,9 @@ do_term_init ()
     initscr ();
 }
 
-extern char *fn_register;
-extern int showansi;
-
 static void
 start_client ()
 {
-    extern struct commands_t cmdlist[];
 #ifdef CPULIMIT
     struct rlimit rml;
     rml.rlim_cur = CPULIMIT * 60;
@@ -1248,9 +1173,6 @@ bind_port (int port)
 static void shell_login (int argc, char *argv[], char *envp[]);
 static void daemon_login (int argc, char *argv[], char *envp[]);
 static int check_ban_and_load (int fd);
-#ifdef SUPPORT_GB
-extern int current_font_type;
-#endif
 
 int
 main (int argc, char *argv[], char *envp[])
diff --git a/mbbsd/menu.c b/mbbsd/menu.c
index 5108606e..cbdb0871 100644
--- a/mbbsd/menu.c
+++ b/mbbsd/menu.c
@@ -1,27 +1,6 @@
-/* $Id: menu.c,v 1.8 2002/05/13 03:20:04 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <sys/types.h>
-#include <string.h>
-#include <unistd.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "perm.h"
-#include "modes.h"
-#include "proto.h"
-extern int usernum;
-extern int talkrequest;
-extern char *fn_register;
-extern char currboard[];        /* name of currently selected board */
-extern int currmode;
-extern unsigned int currstat;
-extern char reset_color[];
-extern userinfo_t *currutmp;
-extern char *BBSName;
-extern int b_lines;             /* Screen bottom line number: t_lines-1 */
-extern time_t now;
+/* $Id: menu.c,v 1.9 2002/06/04 13:08:33 in2 Exp $ */
+#include "bbs.h"
+
 /* help & menu processring */
 static int refscreen = NA;
 extern char *boardprefix;
@@ -554,52 +533,45 @@ static int forsearch() {
 
 /* main menu */
 
-static int admin() {
+int admin()
+{
     domenu(ADMIN, "�t��@", 'X', adminlist);
     return 0;
 }
 
-static int Mail() {
+int Mail()
+{
     domenu(MAIL, "�q�l�l��", 'R', maillist);
     return 0;
 }
 
-static int Talk() {
+int Talk()
+{
     domenu(TMENU, "��ѻ���", 'U', talklist);
     return 0;
 }
 
-static int User() {
+int User()
+{
     domenu(UMENU, "�ӤH�]�w", 'A', userlist);
     return 0;
 }
 
-static int Xyz() {
+int Xyz()
+{
     domenu(XMENU, "�u��{��", 'M', xyzlist);
     return 0;
 }
 
-static int Play_Play() {
+int Play_Play()
+{
     domenu(PMENU, "�����C�ֳ�", 'A', playlist);
     return 0;
 }
 
-static int Name_Menu() {
+int Name_Menu()
+{
     domenu(NMENU, "�զ⮣��", 'O', namelist);
     return 0;
 }
 
-commands_t cmdlist[] = {
-    {admin,PERM_SYSOP|PERM_VIEWSYSOP, "00Admin       �i �t��@�� �j"},
-    {Announce, 0,                     "AAnnounce     �i ��ؤ��G�� �j"},
-    {Boards, 0,                       "FFavorite     �i �� �� �̷R �j"},
-    {root_board, 0,                   "CClass        �i ���հQ�װ� �j"},
-    {Mail, PERM_BASIC,                "MMail         �i �p�H�H��� �j"},
-    {Talk, 0,                         "TTalk         �i �𶢲�Ѱ� �j"},
-    {User, 0,                         "UUser         �i �ӤH�]�w�� �j"},
-    {Xyz, 0,                          "XXyz          �i �t�Τu��� �j"},
-    {Play_Play,0,                     "PPlay         �i �C�ֳ�/�j�Ǭd�]�j"},
-    {Name_Menu,PERM_LOGINOK,          "NNamelist     �i �s�S�O�W�� �j"},
-    {Goodbye, 0,                      "GGoodbye       ���}�A�A���K�K"},
-    {NULL, 0, NULL}
-};
diff --git a/mbbsd/more.c b/mbbsd/more.c
index 87d71fe9..1d6b173a 100644
--- a/mbbsd/more.c
+++ b/mbbsd/more.c
@@ -1,30 +1,5 @@
-/* $Id: more.c,v 1.13 2002/05/13 03:20:04 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "modes.h"
-#include "perm.h"
-#include "proto.h"
-
-extern int showansi;
-extern int t_lines, t_columns;  /* Screen size / width */
-extern int b_lines;             /* Screen bottom line number: t_lines-1 */
-extern char *str_author1;
-extern char *str_author2;
-extern char *str_post1;
-extern char *str_post2;
-extern char *msg_seperator;
-extern char reset_color[];
-extern time_t now;
+/* $Id: more.c,v 1.14 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 #define MORE_BUFSIZE	4096
 #define MORE_WINSIZE	4096
 #define STR_ANSICODE    "[0123456789;,"
@@ -190,12 +165,8 @@ static int readln(FILE *fp, char *buf) {
 }
 */
 
-extern userec_t cuser;
-
 static int more_web(char *fpath, int promptend);
-extern int *GLOBE;
 int more(char *fpath, int promptend) {
-    extern char* strcasestr();
     static char *head[4] = {"�@��", "���D", "�ɶ�" ,"��H"};
     char *ptr, *word = NULL, buf[ANSILINELEN + 1], *ch1;
     struct stat st;
diff --git a/mbbsd/name.c b/mbbsd/name.c
index 192ead3d..b78b54d1 100644
--- a/mbbsd/name.c
+++ b/mbbsd/name.c
@@ -1,24 +1,6 @@
-/* $Id: name.c,v 1.6 2002/05/24 16:45:39 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <signal.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "proto.h"
-#include "perm.h"
-
-extern struct bcache_t *brdshm;
-extern struct utmpfile_t *utmpshm;
-extern userec_t cuser;
-extern char *str_space;
-extern int p_lines;             /* a Page of Screen line numbers: tlines-4 */
-extern int b_lines;             /* Screen bottom line number: t_lines-1 */
-
-word_t *toplev = NULL;
+/* $Id: name.c,v 1.7 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
+
 static word_t *current = NULL;
 static char *msg_more = "\033[7m-- More --\033[m";
 
diff --git a/mbbsd/osdep.c b/mbbsd/osdep.c
index 5f99da22..315cdb51 100644
--- a/mbbsd/osdep.c
+++ b/mbbsd/osdep.c
@@ -1,9 +1,5 @@
-/* $Id: osdep.c,v 1.2 2002/05/15 09:14:24 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
+/* $Id: osdep.c,v 1.3 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 #if __FreeBSD__  
 
diff --git a/mbbsd/othello.c b/mbbsd/othello.c
index 888a483e..4a146f77 100644
--- a/mbbsd/othello.c
+++ b/mbbsd/othello.c
@@ -1,15 +1,5 @@
-/* $Id: othello.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <string.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "modes.h"
-#include "proto.h"
-
-extern char *BBSName;
+/* $Id: othello.c,v 1.3 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 #define LOGFILE "etc/othello.log"
 #define SECRET "etc/othello.secret"
@@ -81,8 +71,6 @@ static void print_chess(int x, int y, char chess) {
     refresh();
 }
 
-extern userec_t cuser;
-
 static void printboard() {
     int i;
     
diff --git a/mbbsd/page.c b/mbbsd/page.c
index 05b2f744..b39f7d7e 100644
--- a/mbbsd/page.c
+++ b/mbbsd/page.c
@@ -1,14 +1,5 @@
-/* $Id: page.c,v 1.4 2002/05/25 11:18:11 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "modes.h"
-#include "common.h"
-#include "proto.h"
+/* $Id: page.c,v 1.5 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 #define hpressanykey(a) {move(22, 0); prints(a); pressanykey();}      
 static void filt_railway(char* fpath) {
@@ -31,8 +22,6 @@ static void filt_railway(char* fpath) {
     unlink(tmppath);
 }
 
-extern userec_t cuser;
-
 int main_railway() {
     fileheader_t mhdr;
     char genbuf[200];
diff --git a/mbbsd/passwd.c b/mbbsd/passwd.c
index 28a31119..cfc7361a 100644
--- a/mbbsd/passwd.c
+++ b/mbbsd/passwd.c
@@ -1,21 +1,5 @@
-/* $Id: passwd.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "modes.h"
-#include "proto.h"
-
-extern char *fn_passwd;
+/* $Id: passwd.c,v 1.2 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 static userec_t *passwd_image = NULL;
 static int passwd_image_size;
@@ -85,7 +69,6 @@ int passwd_mmap() {
     return 0;
 }
 
-extern int usernum;
 int passwd_update_money(int num) {
     int money;
     if(num < 1 || num > MAX_USERS)
diff --git a/mbbsd/read.c b/mbbsd/read.c
index 5866422e..7e598f53 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -1,72 +1,17 @@
-/* $Id: read.c,v 1.3 2002/04/29 07:05:45 in2 Exp $ */
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "modes.h"
-#include "common.h"
-#include "perm.h"
-#include "proto.h"
+/* $Id: read.c,v 1.4 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 #define MAXPATHLEN 256
 
-extern int p_lines;             /* a Page of Screen line numbers: tlines-4 */
-extern int b_lines;             /* Screen bottom line number: t_lines-1 */
-extern char currowner[IDLEN + 2];
-extern char currtitle[TTLEN + 1];
-extern char currauthor[IDLEN + 2];
-extern char *str_reply;
-extern char *msg_fwd_ok;
-extern char *msg_fwd_err1;
-extern char *msg_fwd_err2;
-extern int currmode;
-extern unsigned int currstat;
-extern char currboard[];        /* name of currently selected board */
-extern int KEY_ESC_arg;
-extern int curredit;
-extern char *msg_mailer;
-extern int currbid;
-extern bcache_t *brdshm;  
-
-char currdirect[64];
 static fileheader_t *headers = NULL;
 static int last_line;
 static int hit_thread;
 
-/* rocker.011018: add new tag */
-
-extern int rget();
-extern char getans();
-extern void touchdircache();
-extern int get_fileheader_cache();
-
-/* rocker.011018: �s��tag�覡 */
-
-#define MAXTAGS	256
-
 #include <sys/mman.h>
 
-typedef struct
-{ 
-  time_t chrono;
-  int recno;
-}      TagItem;
-
-
 /* ----------------------------------------------------- */
 /* Tag List ����                                         */
 /* ----------------------------------------------------- */
-
-  
-int TagNum;                     /* tag's number */
-TagItem TagList[MAXTAGS];       /* ascending list */
-
 void
 UnTagger (int locus)
 {
@@ -507,8 +452,6 @@ static void mail_forward(fileheader_t *fhdr, char *direct, int mode) {
 }
 #endif
 
-extern userec_t cuser;
-
 static int select_read(keeploc_t *locmem, int sr_mode) {
     register char *tag,*query,*temp;
     fileheader_t fh;
@@ -606,8 +549,6 @@ static int select_read(keeploc_t *locmem, int sr_mode) {
     return st.st_size;
 }
 
-extern userec_t xuser;
-
 static int i_read_key(onekey_t *rcmdlist, keeploc_t *locmem, int ch, int bid) {
     int i, mode = DONOTHING;
     
diff --git a/mbbsd/record.c b/mbbsd/record.c
index 2f82b372..a29988b7 100644
--- a/mbbsd/record.c
+++ b/mbbsd/record.c
@@ -1,23 +1,9 @@
-/* $Id: record.c,v 1.4 2002/05/13 03:20:04 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "modes.h"
-#include "proto.h"
+/* $Id: record.c,v 1.5 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 #undef  HAVE_MMAP
 #define BUFSIZE 512
 
-extern char *str_reply;
-extern time_t now;
 static void PttLock(int fd, int size, int mode) {
     static struct flock lock_it;
     int ret;
@@ -209,7 +195,6 @@ int delete_range(char *fpath, int id1, int id2) {
     char fullpath[STRLEN], *t;
     int fdr, fdw, fd;
     int count;
-    extern int Tagger();
     
     nolfilename(&my, fpath);
     
diff --git a/mbbsd/register.c b/mbbsd/register.c
index 36b30f46..a3fa13ef 100644
--- a/mbbsd/register.c
+++ b/mbbsd/register.c
@@ -1,27 +1,7 @@
-/* $Id: register.c,v 1.4 2002/05/13 03:20:04 ptt Exp $ */
+/* $Id: register.c,v 1.5 2002/06/04 13:08:34 in2 Exp $ */
 #define _XOPEN_SOURCE
 
-#include <stdio.h>
-#include <strings.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "perm.h"
-#include "common.h"
-#include "proto.h"
-
-extern char *str_new;
-extern char *msg_uid;
-extern int t_lines, t_columns;  /* Screen size / width */
-extern char *str_mail_address;
-extern time_t now;
+#include "bbs.h"
 /* password encryption */
 static char pwbuf[14];
 
@@ -141,7 +121,6 @@ int check_and_expire_account(int uid,userec_t *urec)
     return val;
 }
 
-extern char *fn_passwd;
 
 int getnewuserid() {
     char genbuf[50];
@@ -199,7 +178,6 @@ int getnewuserid() {
 }
 
 void new_register() {
-    extern userec_t xuser;
     userec_t newuser;
     char passbuf[STRLEN];
     int allocid, try, id;
@@ -284,7 +262,6 @@ void new_register() {
     }
 }
 
-extern userec_t cuser;
 
 void check_register() {
     char *ptr = NULL;
diff --git a/mbbsd/screen.c b/mbbsd/screen.c
index 2c70917f..5bd9dbdb 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -1,30 +1,6 @@
-/* $Id: screen.c,v 1.2 2002/04/27 15:50:17 in2 Exp $ */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "proto.h"
-
-extern int t_lines, t_columns;  /* Screen size / width */
-extern int b_lines;             /* Screen bottom line number: t_lines-1 */
-extern int p_lines;             /* a Page of Screen line numbers: tlines-4 */
-extern int showansi;
-
-extern char *clearbuf;
-extern char *cleolbuf;
-extern char *scrollrev;
-extern char *strtstandout;
-extern char *endstandout;
-extern int clearbuflen;
-extern int cleolbuflen;
-extern int scrollrevlen;
-extern int strtstandoutlen;
-extern int endstandoutlen;
-extern int automargins;
+/* $Id: screen.c,v 1.3 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
+
 #ifdef SUPPORT_GB    
 static int current_font_type=TYPE_BIG5;
 static int gbinited=0;
@@ -36,15 +12,12 @@ static int gbinited=0;
 #define o_standup()   output(strtstandout,strtstandoutlen)
 #define o_standdown() output(endstandout,endstandoutlen)
 
-unsigned char scr_lns, scr_cols;
 static unsigned char cur_ln = 0, cur_col = 0;
 static unsigned char docls, downfrom = 0;
 static unsigned char standing = NA;
 static char roll = 0;
 static int scrollcnt, tc_col, tc_line;
 
-screenline_t *big_picture = NULL;
-
 #define MODIFIED (1)            /* if line has been modifed, screen output */
 #define STANDOUT (2)            /* if this line has a standout region */
 
@@ -157,8 +130,6 @@ void redoscr() {
 void refresh() {
     register screenline_t *bp = big_picture;
     register int i, j, len;
-    extern int automargins;
-    extern int scrollrevlen;
     if(num_in_buf())
 	return;
 
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c
index cede4a9d..2fa278e9 100644
--- a/mbbsd/stuff.c
+++ b/mbbsd/stuff.c
@@ -1,26 +1,5 @@
-/* $Id: stuff.c,v 1.2 2002/03/09 17:27:57 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "modes.h"
-#include "common.h"
-#include "perm.h"
-#include "proto.h"
-
-extern int currmode;
-extern char *fn_mandex;
-extern char *str_reply;
-extern char *str_space;
-extern int b_lines;             /* Screen bottom line number: t_lines-1 */
-extern userec_t cuser;
+/* $Id: stuff.c,v 1.3 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 /* ----------------------------------------------------- */
 /* set file path for boards/user home                    */
@@ -316,8 +295,6 @@ char *Cdatedate(time_t *clock){
 static void capture_screen() {
     char fname[200];
     FILE* fp;
-    extern screenline_t *big_picture;
-    extern unsigned char scr_lns;
     int i;
 
     getdata(b_lines - 2, 0, "��o�ӵe�����J��Ȧs�ɡH[y/N] ",
@@ -397,7 +374,6 @@ void bell() {
 int search_num(int ch, int max) {
     int clen = 1;
     int x, y;
-    extern unsigned char scr_cols;
     char genbuf[10];
     
     outmsg("\033[7m ���ܲĴX���G\033[m");
diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c
index f1a2e70e..bbd07381 100644
--- a/mbbsd/syspost.c
+++ b/mbbsd/syspost.c
@@ -1,17 +1,6 @@
-/* $Id: syspost.c,v 1.9 2002/06/02 01:55:21 in2 Exp $ */
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "perm.h"
-#include "common.h"
-#include "proto.h"
+/* $Id: syspost.c,v 1.10 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
-extern char *str_permid[];
-extern userec_t cuser;
-extern time_t now;
 void post_change_perm(int oldperm, int newperm, char *sysopid, char *userid) {
     FILE *fp;
     fileheader_t fhdr;
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 2324204c..3cb14c57 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1,52 +1,8 @@
-/* $Id: talk.c,v 1.59 2002/06/02 08:36:56 in2 Exp $ */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <syslog.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <netdb.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "perm.h"
-#include "modes.h"
-#include "proto.h"
+/* $Id: talk.c,v 1.60 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 #define QCAST   int (*)(const void *, const void *)
 
-extern userinfo_t *currutmp;
-extern char *ModeTypeTable[MAX_MODES];
-extern char *fn_overrides;
-extern int usernum;
-extern char *msg_sure_ny;
-extern char *msg_cancel;
-extern unsigned int currstat;
-extern char *fn_writelog;
-extern FILE *fp_writelog;
-extern pid_t currpid;
-extern int b_lines;		/* Screen bottom line number: t_lines-1 */
-extern int t_lines, t_columns;	/* Screen size / width */
-extern char *fn_talklog;
-extern char currauthor[IDLEN + 2];
-extern char *msg_usr_left;
-extern char *msg_uid;
-extern char *BBSName;
-extern int p_lines;		/* a Page of Screen line numbers: tlines-4 */
-extern char fromhost[];
-extern char *err_uid;
-extern int talkrequest;
-extern char *msg_shortulist;
-extern char *msg_nobody;
-extern boardheader_t *bcache;
-extern userec_t cuser;
-extern userec_t xuser;
-extern time_t now;
 static char *IdleTypeTable[] = {
     "���b��b��", "���H�ӹq", "�V����", "�����P��", "�������A", "�ڦb���"
 };
@@ -70,12 +26,8 @@ typedef struct pickup_t {
     int friend, uoffset;
 } pickup_t;
 
-extern int bind( /* int,struct sockaddr *, int */ );
-extern char *getuserid();
-extern struct utmpfile_t *utmpshm;
-extern int watermode, wmofo;
-extern water_t water[6], *swater[5], *water_which;
-extern char *friend_file[8], water_usies;
+//extern int bind( /* int,struct sockaddr *, int */ );
+//extern char *getuserid();
 
 /* �O�� friend �� user number */
 //#define PICKUP_WAYS     7		//�����k�h�u��
@@ -854,7 +806,6 @@ static void do_talk_nextline(talkwin_t * twin)
 
 static void do_talk_char(talkwin_t * twin, int ch)
 {
-    extern screenline_t *big_picture;
     screenline_t *line;
     int i;
     char ch0, buf[81];
@@ -1094,8 +1045,6 @@ static void do_talk(int fd)
 
     if (flog){
 	char ans[4];
-	extern screenline_t *big_picture;
-	extern unsigned char scr_lns;
 	int i;
 
 	fprintf(flog, "\n\033[33;44m���O�e�� [%s] ...     \033[m\n",
@@ -1635,10 +1584,6 @@ static void pickup(pickup_t *currpickup, int pickup_way, int *page,
 	currpickup[got].ui = 0;
 }
 
-#ifdef WHERE
-extern struct fromcache_t *fcache;
-#endif
-
 char    *Mind[] = {
     "   ",
     "^-^", "^_^", "Q_Q", "@_@", "/_\\", "=_=", "-_-", "-.-", ">_<",
diff --git a/mbbsd/term.c b/mbbsd/term.c
index db3e66d1..4cab3e2c 100644
--- a/mbbsd/term.c
+++ b/mbbsd/term.c
@@ -1,16 +1,5 @@
-/* $Id: term.c,v 1.2 2002/04/15 20:00:22 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <termios.h>
-#include <string.h>
-#include <syslog.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "proto.h"
+/* $Id: term.c,v 1.3 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 int tgetent(const char *bp, char *name);
 char *tgetstr(const char *id, char **area);
@@ -45,28 +34,6 @@ void init_tty() {
 
 #define TERMCOMSIZE (40)
 
-char *clearbuf = "\33[H\33[J";
-int clearbuflen = 6;
-
-char *cleolbuf = "\33[K";
-int cleolbuflen = 3;
-
-char *scrollrev = "\33M";
-int scrollrevlen = 2;
-
-char *strtstandout = "\33[7m";
-int strtstandoutlen = 4;
-
-char *endstandout = "\33[m";
-int endstandoutlen = 3;
-
-int t_lines = 24;
-int b_lines = 23;
-int p_lines = 20;
-int t_columns = 80;
-
-int automargins = 1;
-
 #if 0
 static char *outp;
 static int *outlp;
@@ -80,8 +47,6 @@ static int outcf(int ch) {
 }
 #endif
 
-extern screenline_t *big_picture;
-
 static void term_resize(int sig) {
     struct winsize newsize;
     screenline_t *new_picture;
diff --git a/mbbsd/toolkit.c b/mbbsd/toolkit.c
index 81a0d6f0..2955f040 100644
--- a/mbbsd/toolkit.c
+++ b/mbbsd/toolkit.c
@@ -1,8 +1,5 @@
-/* $Id: toolkit.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
-#include <ctype.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
+/* $Id: toolkit.c,v 1.2 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 unsigned StringHash(unsigned char *s) {
     unsigned int v=0;
diff --git a/mbbsd/topsong.c b/mbbsd/topsong.c
index d3a65447..169feb8d 100644
--- a/mbbsd/topsong.c
+++ b/mbbsd/topsong.c
@@ -1,12 +1,5 @@
-/* $Id: topsong.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "proto.h"
+/* $Id: topsong.c,v 1.2 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 #define MAX_SONGS 300
 #define QCAST     int (*)(const void *, const void *)
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 89ebef5f..54a3a515 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -1,37 +1,5 @@
-/* $Id: user.c,v 1.20 2002/06/02 06:44:44 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "perm.h"
-#include "modes.h"
-#include "proto.h"
-
-extern int numboards;
-extern boardheader_t *bcache;
-extern char *loginview_file[NUMVIEWFILE][2];
-extern int b_lines;             /* Screen bottom line number: t_lines-1 */
-extern time_t login_start_time;
-extern char *msg_uid;
-extern int usernum;
-extern char *msg_sure_ny;
-extern userinfo_t *currutmp;
-extern int showansi;
-extern char reset_color[];
-extern char *fn_proverb;
-extern char *fn_plans;
-extern char *msg_del_ok;
-extern char *fn_register;
-extern char *msg_nobody;
-extern userec_t cuser;
-extern userec_t xuser;
-extern time_t now;
+/* $Id: user.c,v 1.21 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 static char *sex[8] = {
     MSG_BIG_BOY, MSG_BIG_GIRL, MSG_LITTLE_BOY, MSG_LITTLE_GIRL,
@@ -220,7 +188,6 @@ static void violate_law(userec_t *u, int unum){
     pressanykey();
 }
 
-extern char* str_permid[];
 
 void uinfo_query(userec_t *u, int real, int unum) {
     userec_t x;
@@ -1062,7 +1029,6 @@ int u_register(void)
 }
 
 /* �C�X�Ҧ����U�ϥΪ� */
-extern struct uhash_t *uhash;
 static int usercounter, totalusers, showrealname;
 static ushort u_list_special;
 
diff --git a/mbbsd/var.c b/mbbsd/var.c
index e7fbb118..43dab291 100644
--- a/mbbsd/var.c
+++ b/mbbsd/var.c
@@ -1,9 +1,6 @@
-/* $Id: var.c,v 1.5 2002/05/25 06:28:21 ptt Exp $ */
-#include <stdio.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
+/* $Id: var.c,v 1.6 2002/06/04 13:08:34 in2 Exp $ */
+#define INCLUDE_VAR_H
+#include "bbs.h"
 
 char *str_permid[] = {
     "���v�O",                   /* PERM_BASIC */
@@ -46,7 +43,7 @@ char *str_permboard[] = {
     "����H",                     /* BRD_NOTRAN */
     "�s�ժ�",                     /* BRD_GROUP */
     "���ê�",                     /* BRD_HIDE */
-    "����(���ݳ]�w)",        /* BRD_POSTMASK */
+    "����(���ݳ]�w)",             /* BRD_POSTMASK */
     "�ΦW��",                     /* BRD_ANONYMOUS */
     "�w�]�ΦW��",                 /* BRD_DEFAULTANONYMOUS */
     "�H�k��i���ݪ�",             /* BRD_BAD */
@@ -75,53 +72,53 @@ char *str_permboard[] = {
     "�S�Q��", 
 };
 
-int usernum;
-pid_t currpid;                  /* current process ID */
-unsigned int currstat;
-int currmode = 0;
-int curredit = 0;
-int showansi = 1;
-time_t login_start_time;
-userec_t cuser;                   /* current user structure */
-userec_t xuser;                   /* lookup user structure */
-char quote_file[80] = "\0";
-char quote_user[80] = "\0";
-time_t paste_time;
-char paste_title[STRLEN];
-char paste_path[256];
-int paste_level;
-char currtitle[TTLEN + 1] = "\0";
-char vetitle[TTLEN + 1] = "\0";
-char currowner[IDLEN + 2] = "\0";
-char currauthor[IDLEN + 2] = "\0";
-char currfile[FNLEN];           /* current file name @ bbs.c mail.c */
-unsigned char currfmode;               /* current file mode */
-char currboard[IDLEN + 2];
-int currbid;
-unsigned int currbrdattr;
-char currBM[IDLEN * 3 + 10];
-char reset_color[4] = "\033[m";
-char margs[64] = "\0";           /*  main argv list*/
-crosspost_t postrecord;           /* anti cross post */
+int     usernum;
+int     currmode = 0;
+int     curredit = 0;
+int     showansi = 1;
+int     paste_level;
+int     currbid;
+char    quote_file[80] = "\0";
+char    quote_user[80] = "\0";
+char    paste_title[STRLEN];
+char    paste_path[256];
+char    currtitle[TTLEN + 1] = "\0";
+char    vetitle[TTLEN + 1] = "\0";
+char    currowner[IDLEN + 2] = "\0";
+char    currauthor[IDLEN + 2] = "\0";
+char    currfile[FNLEN];           /* current file name @ bbs.c mail.c */
+char    currboard[IDLEN + 2];
+char    currBM[IDLEN * 3 + 10];
+char    reset_color[4] = "\033[m";
+char    margs[64] = "\0";           /*  main argv list*/
+pid_t   currpid;                  /* current process ID */
+time_t  login_start_time;
+time_t  paste_time;
+userec_t        cuser;                   /* current user structure */
+userec_t        xuser;                   /* lookup user structure */
+crosspost_t     postrecord;           /* anti cross post */
+unsigned int    currbrdattr;
+unsigned int    currstat;
+unsigned char   currfmode;               /* current file mode */
 
 /* global string variables */
 /* filename */
 
-char *fn_passwd = FN_PASSWD;
-char *fn_board = FN_BOARD;
-char *fn_note_ans = FN_NOTE_ANS;
-char *fn_register = "register.new";
-char *fn_plans = "plans";
-char *fn_writelog = "writelog";
-char *fn_talklog = "talklog";
+char *fn_passwd    = FN_PASSWD;
+char *fn_board     = FN_BOARD;
+char *fn_note_ans  = FN_NOTE_ANS;
+char *fn_register  = "register.new";
+char *fn_plans     = "plans";
+char *fn_writelog  = "writelog";
+char *fn_talklog   = "talklog";
 char *fn_overrides = FN_OVERRIDES;
-char *fn_reject = FN_REJECT;
-char *fn_canvote = FN_CANVOTE;
-char *fn_notes = "notes";
-char *fn_water = FN_WATER;
-char *fn_visable = FN_VISABLE;
-char *fn_mandex = "/.Names";
-char *fn_proverb = "proverb";
+char *fn_reject    = FN_REJECT;
+char *fn_canvote   = FN_CANVOTE;
+char *fn_notes     = "notes";
+char *fn_water     = FN_WATER;
+char *fn_visable   = FN_VISABLE;
+char *fn_mandex    = "/.Names";
+char *fn_proverb   = "proverb";
 
 /* are descript in userec.loginview */
 
@@ -143,42 +140,42 @@ char *loginview_file[NUMVIEWFILE][2] = {
 };
 
 /* message */
-char *msg_seperator = MSG_SEPERATOR;
-char *msg_mailer = MSG_MAILER;
+char *msg_seperator  = MSG_SEPERATOR;
+char *msg_mailer     = MSG_MAILER;
 char *msg_shortulist = MSG_SHORTULIST;
 
-char *msg_cancel = MSG_CANCEL;
-char *msg_usr_left = MSG_USR_LEFT;
-char *msg_nobody = MSG_NOBODY;
+char *msg_cancel     = MSG_CANCEL;
+char *msg_usr_left   = MSG_USR_LEFT;
+char *msg_nobody     = MSG_NOBODY;
 
-char *msg_sure_ny = MSG_SURE_NY;
-char *msg_sure_yn = MSG_SURE_YN;
+char *msg_sure_ny    = MSG_SURE_NY;
+char *msg_sure_yn    = MSG_SURE_YN;
 
-char *msg_bid = MSG_BID;
-char *msg_uid = MSG_UID;
+char *msg_bid        = MSG_BID;
+char *msg_uid        = MSG_UID;
 
-char *msg_del_ok = MSG_DEL_OK;
-char *msg_del_ny = MSG_DEL_NY;
+char *msg_del_ok     = MSG_DEL_OK;
+char *msg_del_ny     = MSG_DEL_NY;
 
-char *msg_fwd_ok = MSG_FWD_OK;
-char *msg_fwd_err1 = MSG_FWD_ERR1;
-char *msg_fwd_err2 = MSG_FWD_ERR2;
+char *msg_fwd_ok     = MSG_FWD_OK;
+char *msg_fwd_err1   = MSG_FWD_ERR1;
+char *msg_fwd_err2   = MSG_FWD_ERR2;
 
 char *err_board_update = ERR_BOARD_UPDATE;
-char *err_bid = ERR_BID;
-char *err_uid = ERR_UID;
-char *err_filename = ERR_FILENAME;
+char *err_bid        = ERR_BID;
+char *err_uid        = ERR_UID;
+char *err_filename   = ERR_FILENAME;
 
 char *str_mail_address = "." BBSUSER "@" MYHOSTNAME;
-char *str_new = "new";
-char *str_reply = "Re: ";
-char *str_space = " \t\n\r";
-char *str_sysop = "SYSOP";
-char *str_author1 = STR_AUTHOR1;
-char *str_author2 = STR_AUTHOR2;
-char *str_post1 = STR_POST1;
-char *str_post2 = STR_POST2;
-char *BBSName = BBSNAME;
+char *str_new        = "new";
+char *str_reply      = "Re: ";
+char *str_space      = " \t\n\r";
+char *str_sysop      = "SYSOP";
+char *str_author1    = STR_AUTHOR1;
+char *str_author2    = STR_AUTHOR2;
+char *str_post1      = STR_POST1;
+char *str_post2      = STR_POST2;
+char *BBSName        = BBSNAME;
 
 /* #define MAX_MODES 78 */
 /* MAX_MODES is defined in common.h */
@@ -262,6 +259,320 @@ char *ModeTypeTable[MAX_MODES] = {
     "�U�H��",                      /* CHC */
     "�U�t�X",			   /* DARK */
     "NBA�j�q��"                    /* TMPJACK */
-    "��tt�d�]�t��",                 /* JCEE */
+    "��tt�d�]�t��",                /* JCEE */
     "���s�峹"                    /* REEDIT */
 };
+
+/* indict.c */
+char    dict[41], database[41];
+
+/* term.c */
+int     b_lines = 23;
+int     t_lines = 24;
+int     p_lines = 20;
+int     t_columns = 80;
+char    *strtstandout = "\33[7m";
+int     strtstandoutlen = 4;
+char    *endstandout = "\33[m";
+int     endstandoutlen = 3;
+char    *clearbuf = "\33[H\33[J";
+int     clearbuflen = 6;
+char    *cleolbuf = "\33[K";
+int     cleolbuflen = 3;
+char    *scrollrev = "\33M";
+int     scrollrevlen = 2;
+int     automargins = 1;
+
+/* io.c */
+time_t  now;
+int     KEY_ESC_arg;
+int     watermode = -1;
+int     wmofo = -1; 
+/*
+  WATERMODE(WATER_ORIG) | WATERMODE(WATER_NEW):
+  Ptt ���y�^�U�Ϊ��Ѽ�
+      watermode = -1  �S�b�^���y
+                = 0   �b�^�W�@�����y  (Ctrl-R)
+	        > 0   �b�^�e n �����y (Ctrl-R Ctrl-R)
+
+  WATERMODE(WATER_OFO)  by in2
+        wmofo     = -1  �S�b�^���y
+	          = 0   ���b�^���y
+		  = 1   �^���y���S������y
+        wmofo     >=0 �ɦ�����y�N�u���, ���|��water[]��,
+	              �ݦ^�����y���ɭԤ@���g�J.
+*/
+
+
+/* cache.c */
+int     numboards = -1;
+int     *GLOBALVAR;
+uhash_t *uhash;
+bcache_t        *brdshm;
+userinfo_t      *currutmp;
+boardheader_t   *bcache;
+struct  utmpfile_t      *utmpshm;
+struct  fromcache_t     *fcache;
+
+/* board.c */
+int     class_bid = 0;
+int     brc_num;
+int     brc_list[BRC_MAXNUM];
+
+/* read.c */
+int     TagNum;                 /* tag's number */
+TagItem TagList[MAXTAGS];       /* ascending list */
+char    currdirect[64];
+
+/* edit.c */
+char    save_title[STRLEN];
+
+/* bbs.c */
+time_t  board_visit_time;
+char    real_name[IDLEN + 1];
+int     local_article;
+
+/* mbbsd.c */
+int     talkrequest = NA;
+char    fromhost[STRLEN] = "\0";
+char    water_usies = 0;
+FILE    *fp_writelog = NULL;
+water_t water[6], *swater[6], *water_which = &water[0];
+
+/* announce.c */
+char    trans_buffer[256];
+
+/* chc_play.c */
+rc_t    chc_from, chc_to, chc_select, chc_cursor;
+int     chc_lefttime;
+int     chc_my, chc_turn, chc_selected, chc_firststep;
+char    chc_warnmsg[64], *chc_mateid;
+int     chc_hiswin, chc_hislose, chc_histie;
+
+/* screen.c */
+screenline_t    *big_picture = NULL;
+unsigned char   scr_lns, scr_cols;
+
+/* gomo.c */
+char    ku[BRDSIZ][BRDSIZ];
+unsigned char   *pat, *adv;
+unsigned char   *pat_gomoku /* [1954] */ =
+/*    0 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*   16 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x55\xcc\x00\x00\x00\x00"
+/*   32 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x33\x00\x44\x00\x33\x00\x00\x00"
+/*   48 */ "\x00\x22\x00\x55\x00\x22\x00\x00\x00\x44\x33\x66\x55\xcc\x33\x66"
+/*   64 */ "\x55\xcc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00"
+/*   80 */ "\x55\x00\x55\x00\x05\x00\x55\x02\x46\x00\xaa\x00\x00\x55\x00\x55"
+/*   96 */ "\x00\x05\x00\x55\x00\x05\x00\x55\x00\x00\x44\xcc\x44\xcc\x05\xbb"
+/*  112 */ "\x44\xcc\x05\xbb\x44\xcc\x05\xbb\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  128 */ "\x00\x00\x33\x00\x00\x00\x44\x00\x00\x00\x00\x00\x33\x00\x44\x00"
+/*  144 */ "\x33\x22\x66\x00\x55\x55\xcc\x00\x33\x00\x00\x00\x00\x22\x00\x55"
+/*  160 */ "\x00\x22\x00\x55\x00\x02\x00\x05\x00\x22\x00\x00\x33\x44\x33\x66"
+/*  176 */ "\x55\xcc\x33\x66\x55\xcc\x33\x46\x05\xbb\x33\x66\x55\xcc\x00\x00"
+/*  192 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x44\x00\x00\x00"
+/*  208 */ "\x33\x00\x00\x22\x55\x22\x55\x02\x05\x22\x55\x02\x46\x22\xaa\x55"
+/*  224 */ "\xcc\x22\x55\x02\x46\x22\xaa\x00\x22\x55\x22\x55\x02\x05\x22\x55"
+/*  240 */ "\x02\x05\x22\x55\x02\x05\x22\x55\x02\x05\x22\x55\x02\x44\x66\xcc"
+/*  256 */ "\x66\xcc\x46\xbb\x66\xcc\x46\xbb\x66\xcc\x46\xbb\x66\xcc\x46\xbb"
+/*  272 */ "\x66\xcc\x46\xbb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x33\x00"
+/*  288 */ "\x00\x00\x44\x00\x00\x00\x33\x00\x22\x22\x66\x00\x00\x00\x00\x00"
+/*  304 */ "\x03\x00\x44\x00\x33\x22\x66\x00\x55\x55\xcc\x00\x33\x22\x66\x00"
+/*  320 */ "\x55\x55\xcc\x00\x03\x00\x00\x00\x00\x02\x00\x55\x00\x02\x00\x55"
+/*  336 */ "\x00\x02\x00\x05\x00\x02\x00\x55\x00\x02\x02\x46\x00\x02\x00\x55"
+/*  352 */ "\x55\x05\x55\x46\xaa\xcc\x55\x46\xaa\xcc\x55\x06\x5a\xbb\x55\x46"
+/*  368 */ "\xaa\xcc\x55\x06\x5a\xbb\x55\x46\xaa\xcc\x00\x00\x00\x00\x00\x00"
+/*  384 */ "\x00\x00\x00\x00\x03\x00\x00\x00\x44\x00\x00\x00\x33\x00\x22\x22"
+/*  400 */ "\x66\x00\x00\x00\x55\x00\x55\x55\x05\x55\x05\x55\x05\x55\x05\x55"
+/*  416 */ "\x46\x55\x5a\xaa\xcc\x55\x05\x55\x46\x55\x5a\xaa\xcc\x55\x05\x55"
+/*  432 */ "\x06\x55\x0a\x55\x55\x05\x55\x05\x55\x05\x55\x05\x55\x05\x55\x05"
+/*  448 */ "\x55\x05\x55\x05\x55\x05\x55\x05\x55\x46\x55\x05\x55\x5a\x55\x5a"
+/*  464 */ "\xaa\xcc\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb"
+/*  480 */ "\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb"
+/*  496 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x33\x00\x00\x00\x44\x00"
+/*  512 */ "\x00\x00\x33\x00\x22\x22\x66\x00\x00\x00\x55\x00\x55\x55\xcc\x00"
+/*  528 */ "\x00\x00\x00\x00\x33\x00\x44\x00\x33\x22\x66\x00\x55\x55\xcc\x00"
+/*  544 */ "\x33\x22\x66\x00\x55\x55\xcc\x00\x33\x02\x46\x00\x05\x05\xbb\x00"
+/*  560 */ "\x33\x00\x00\x00\x00\x22\x00\x55\x00\x22\x00\x55\x00\x02\x00\x05"
+/*  576 */ "\x00\x22\x00\x55\x00\x02\x02\x46\x00\x22\x00\xaa\x00\x55\x55\xcc"
+/*  592 */ "\x00\x22\x00\x00\x33\x44\x33\x66\x55\xcc\x33\x66\x55\xcc\x33\x46"
+/*  608 */ "\x05\xbb\x33\x66\x55\xcc\x33\x46\x05\xbb\x33\x66\x55\xcc\x33\x46"
+/*  624 */ "\x05\xbb\x33\x66\x55\xcc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  640 */ "\x03\x00\x00\x00\x44\x00\x00\x00\x33\x00\x22\x22\x66\x00\x00\x00"
+/*  656 */ "\x55\x00\x55\x55\xcc\x00\x00\x00\x33\x00\x00\x22\x55\x22\x55\x02"
+/*  672 */ "\x05\x22\x55\x02\x46\x22\xaa\x55\xcc\x22\x55\x02\x46\x22\xaa\x55"
+/*  688 */ "\xcc\x22\x55\x02\x06\x22\x5a\x05\xbb\x22\x55\x02\x46\x22\xaa\x00"
+/*  704 */ "\x22\x55\x22\x55\x02\x05\x22\x55\x02\x05\x22\x55\x02\x05\x22\x55"
+/*  720 */ "\x02\x05\x22\x55\x02\x46\x22\x55\x02\x5a\x22\xaa\x55\xcc\x22\x55"
+/*  736 */ "\x02\x05\x22\x55\x02\x44\x66\xcc\x66\xcc\x46\xbb\x66\xcc\x46\xbb"
+/*  752 */ "\x66\xcc\x46\xbb\x66\xcc\x46\xbb\x66\xcc\x46\xbb\x66\xcc\x46\xbb"
+/*  768 */ "\x66\xcc\x46\xbb\x66\xcc\x46\xbb\x66\xcc\x46\xbb\x00\x00\x00\x00"
+/*  784 */ "\x00\x00\x00\x00\x00\x00\x33\x00\x00\x00\x44\x00\x00\x00\x33\x00"
+/*  800 */ "\x22\x22\x66\x00\x00\x00\x55\x00\x55\x55\xcc\x00\x00\x00\x33\x00"
+/*  816 */ "\x22\x22\x66\x00\x00\x00\x00\x00\x03\x00\x44\x00\x33\x22\x66\x00"
+/*  832 */ "\x55\x55\xcc\x00\x33\x22\x66\x00\x55\x55\xcc\x00\x03\x02\x46\x00"
+/*  848 */ "\x05\x05\xbb\x00\x33\x22\x66\x00\x55\x55\xcc\x00\x03\x00\x00\x00"
+/*  864 */ "\x00\x02\x00\x55\x00\x02\x00\x55\x00\x02\x00\x05\x00\x02\x00\x55"
+/*  880 */ "\x00\x02\x02\x46\x00\x02\x00\xaa\x00\x55\x55\xcc\x00\x02\x00\x55"
+/*  896 */ "\x00\x02\x02\x46\x00\x02\x00\x55\x55\x05\x55\x46\xaa\xcc\x55\x46"
+/*  912 */ "\xaa\xcc\x55\x06\x5a\xbb\x55\x46\xaa\xcc\x55\x06\x5a\xbb\x55\x46"
+/*  928 */ "\xaa\xcc\x55\x06\x5a\xbb\x55\x46\xaa\xcc\x55\x06\x5a\xbb\x55\x46"
+/*  944 */ "\xaa\xcc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00"
+/*  960 */ "\x44\x00\x00\x00\x33\x00\x22\x22\x66\x00\x00\x00\x55\x00\x55\x55"
+/*  976 */ "\xcc\x00\x00\x00\x33\x00\x22\x22\x66\x00\x00\x00\x55\x00\x55\x55"
+/*  992 */ "\x05\x55\x05\x55\x05\x55\x05\x55\x46\x55\x5a\xaa\xcc\x55\x05\x55"
+/* 1008 */ "\x46\x55\x5a\xaa\xcc\x55\x05\x55\x06\x55\x0a\x5a\xbb\x55\x05\x55"
+/* 1024 */ "\x46\x55\x5a\xaa\xcc\x55\x05\x55\x06\x55\x0a\x55\x55\x05\x55\x05"
+/* 1040 */ "\x55\x05\x55\x05\x55\x05\x55\x05\x55\x05\x55\x05\x55\x05\x55\x05"
+/* 1056 */ "\x55\x46\x55\x05\x55\x5a\x55\x5a\xaa\xcc\x55\x05\x55\x05\x55\x05"
+/* 1072 */ "\x55\x46\x55\x05\x55\x5a\x55\x5a\xaa\xcc\xcc\xbb\xcc\xbb\xcc\xbb"
+/* 1088 */ "\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb"
+/* 1104 */ "\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb"
+/* 1120 */ "\xcc\xbb\xcc\xbb\xcc\xbb\xcc\xbb\x00\x00\x00\x00\x00\x00\x00\x00"
+/* 1136 */ "\x00\x00\x33\x00\x00\x00\x44\x00\x00\x00\x33\x00\x22\x22\x66\x00"
+/* 1152 */ "\x00\x00\x55\x00\x55\x55\xcc\x00\x00\x00\x33\x00\x22\x22\x66\x00"
+/* 1168 */ "\x00\x00\x55\x00\x55\x55\xcc\x00\x00\x00\x00\x00\x33\x00\x44\x00"
+/* 1184 */ "\x33\x22\x66\x00\x55\x55\xcc\x00\x33\x22\x66\x00\x55\x55\xcc\x00"
+/* 1200 */ "\x33\x02\x46\x00\x05\x05\xbb\x00\x33\x22\x66\x00\x55\x55\xcc\x00"
+/* 1216 */ "\x33\x02\x46\x00\x05\x05\xbb\x00\x33\x00\x00\x00\x00\x22\x00\x55"
+/* 1232 */ "\x00\x22\x00\x55\x00\x02\x00\x05\x00\x22\x00\x55\x00\x02\x02\x46"
+/* 1248 */ "\x00\x22\x00\xaa\x00\x55\x55\xcc\x00\x22\x00\x55\x00\x02\x02\x46"
+/* 1264 */ "\x00\x22\x00\xaa\x00\x55\x55\xcc\x00\x22\x00\x00\x03\x44\x33\x66"
+/* 1280 */ "\x55\xcc\x33\x66\x55\xcc\x03\x46\x05\xbb\x33\x66\x55\xcc\x03\x46"
+/* 1296 */ "\x05\xbb\x33\x66\x55\xcc\x03\x46\x05\xbb\x33\x66\x55\xcc\x03\x46"
+/* 1312 */ "\x05\xbb\x33\x66\x55\xcc\x03\x46\x05\xbb\x33\x66\x55\xcc\x00\x00"
+/* 1328 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x44\x00\x00\x00"
+/* 1344 */ "\x33\x00\x22\x22\x66\x00\x00\x00\x55\x00\x55\x55\xcc\x00\x00\x00"
+/* 1360 */ "\x33\x00\x22\x22\x66\x00\x00\x00\x55\x00\x55\x55\xcc\x00\x00\x00"
+/* 1376 */ "\x03\x00\x00\x02\x55\x02\x55\x02\x05\x02\x55\x02\x46\x02\xaa\x55"
+/* 1392 */ "\xcc\x02\x55\x02\x46\x02\xaa\x55\xcc\x02\x55\x02\x06\x02\x5a\x05"
+/* 1408 */ "\xbb\x02\x55\x02\x46\x02\xaa\x55\xcc\x02\x55\x02\x06\x02\x5a\x05"
+/* 1424 */ "\xbb\x02\x55\x02\x46\x02\xaa\x00\x02\x55\x02\x55\x02\x05\x02\x55"
+/* 1440 */ "\x02\x05\x02\x55\x02\x05\x02\x55\x02\x05\x02\x55\x02\x46\x02\x55"
+/* 1456 */ "\x02\x5a\x02\xaa\x55\xcc\x02\x55\x02\x05\x02\x55\x02\x46\x02\x55"
+/* 1472 */ "\x02\x5a\x02\xaa\x55\xcc\x02\x55\x02\x05\x02\x55\x02\x05\x46\xcc"
+/* 1488 */ "\x46\xcc\x06\xbb\x46\xcc\x06\xbb\x46\xcc\x06\xbb\x46\xcc\x06\xbb"
+/* 1504 */ "\x46\xcc\x06\xbb\x46\xcc\x06\xbb\x46\xcc\x06\xbb\x46\xcc\x06\xbb"
+/* 1520 */ "\x46\xcc\x06\xbb\x46\xcc\x06\xbb\x46\xcc\x06\xbb\x46\xcc\x06\xbb"
+/* 1536 */ "\x46\xcc\x06\xbb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x33\x00"
+/* 1552 */ "\x00\x00\x44\x00\x00\x00\x33\x00\x22\x22\x66\x00\x00\x00\x55\x00"
+/* 1568 */ "\x55\x55\xcc\x00\x00\x00\x33\x00\x22\x22\x66\x00\x00\x00\x55\x00"
+/* 1584 */ "\x55\x55\xcc\x00\x00\x00\x33\x00\x02\x02\x46\x00\x00\x00\x00\x00"
+/* 1600 */ "\x03\x00\x44\x00\x33\x22\x66\x00\x55\x55\xcc\x00\x33\x22\x66\x00"
+/* 1616 */ "\x55\x55\xcc\x00\x03\x02\x46\x00\x05\x05\xbb\x00\x33\x22\x66\x00"
+/* 1632 */ "\x55\x55\xcc\x00\x03\x02\x46\x00\x05\x05\xbb\x00\x33\x22\x66\x00"
+/* 1648 */ "\x55\x55\xcc\x00\x03\x00\x00\x00\x00\x02\x00\x55\x00\x02\x00\x55"
+/* 1664 */ "\x00\x02\x00\x05\x00\x02\x00\x55\x00\x02\x02\x46\x00\x02\x00\xaa"
+/* 1680 */ "\x00\x55\x55\xcc\x00\x02\x00\x55\x00\x02\x02\x46\x00\x02\x00\xaa"
+/* 1696 */ "\x00\x55\x55\xcc\x00\x02\x00\x55\x00\x02\x02\x06\x00\x02\x00\x05"
+/* 1712 */ "\x05\x05\x05\x46\x5a\xcc\x05\x46\x5a\xcc\x05\x06\x0a\xbb\x05\x46"
+/* 1728 */ "\x5a\xcc\x05\x06\x0a\xbb\x05\x46\x5a\xcc\x05\x06\x0a\xbb\x05\x46"
+/* 1744 */ "\x5a\xcc\x05\x06\x0a\xbb\x05\x46\x5a\xcc\x05\x06\x0a\xbb\x05\x46"
+/* 1760 */ "\x5a\xcc\x05\x06\x0a\xbb\x05\x46\x5a\xcc\x00\x00\x00\x00\x00\x00"
+/* 1776 */ "\x00\x00\x00\x00\x03\x00\x00\x00\x44\x00\x00\x00\x33\x00\x22\x22"
+/* 1792 */ "\x66\x00\x00\x00\x55\x00\x55\x55\xcc\x00\x00\x00\x33\x00\x22\x22"
+/* 1808 */ "\x66\x00\x00\x00\x55\x00\x55\x55\xcc\x00\x00\x00\x03\x00\x02\x02"
+/* 1824 */ "\x46\x00\x00\x00\x05\x00\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05"
+/* 1840 */ "\x46\x05\x5a\x5a\xcc\x05\x05\x05\x46\x05\x5a\x5a\xcc\x05\x05\x05"
+/* 1856 */ "\x06\x05\x0a\x0a\xbb\x05\x05\x05\x46\x05\x5a\x5a\xcc\x05\x05\x05"
+/* 1872 */ "\x06\x05\x0a\x0a\xbb\x05\x05\x05\x46\x05\x5a\x5a\xcc\x05\x05\x05"
+/* 1888 */ "\x06\x05\x0a\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05"
+/* 1904 */ "\x05\x05\x05\x05\x05\x05\x05\x05\x05\x46\x05\x05\x05\x5a\x05\x5a"
+/* 1920 */ "\x5a\xcc\x05\x05\x05\x05\x05\x05\x05\x46\x05\x05\x05\x5a\x05\x5a"
+/* 1936 */ "\x5a\xcc\x05\x05\x05\x05\x05\x05\x05\x06\x05\x05\x05\x0a\x05\x0a"
+/* 1952 */ "\x0a";
+
+unsigned char   *adv_gomoku /* [978] */ =
+/*    0 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*   16 */ "\x00\x00\x00\x00\xa0\x00\xa0\x00\x04\x00\x04\x00\x00\xd0\x00\xd0"
+/*   32 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*   48 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*   64 */ "\x00\x70\x00\x00\x00\x00\xa0\x00\xa1\x00\x00\x00\xa0\x00\x04\x00"
+/*   80 */ "\x04\x00\x00\x00\x04\x00\xd0\xd0\x00\xd0\x00\xd0\x00\xd0\x00\x00"
+/*   96 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x70\x08\x08\x00\x08\x00\x08\x00"
+/*  112 */ "\x08\x00\x08\x00\x40\x40\x00\x40\x00\x40\x00\x40\x00\x40\x00\x00"
+/*  128 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x70"
+/*  144 */ "\x00\x00\x00\x70\x21\x00\x00\x00\x00\x00\xa1\x00\x00\x00\xa1\x00"
+/*  160 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  176 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  192 */ "\x00\x00\x00\x00\x00\x00\x70\x21\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  208 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  224 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  240 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x70\x00\x00"
+/*  256 */ "\x00\x70\x21\x00\x00\x00\x00\x00\x00\x00\xa0\x00\xa1\x00\x00\x00"
+/*  272 */ "\xa1\x00\x00\x00\xa0\x00\x00\x00\xa0\x00\x04\x00\x04\x00\x00\x00"
+/*  288 */ "\x04\x00\x00\x00\x04\x00\x00\x00\x04\x00\xd0\xd0\x00\xd0\x00\xd0"
+/*  304 */ "\x00\xd0\x00\xd0\x00\xd0\x00\xd0\x00\xd0\x00\x00\x00\x00\x00\x00"
+/*  320 */ "\x00\x00\x00\x00\x70\x21\x00\x00\x00\x00\x00\x00\x70\x08\x08\x00"
+/*  336 */ "\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00"
+/*  352 */ "\x40\x40\x00\x40\x00\x40\x00\x40\x00\x40\x00\x40\x00\x40\x00\x40"
+/*  368 */ "\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  384 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x70\x00\x00\x00\x70"
+/*  400 */ "\x21\x00\x00\x00\x00\x00\x00\x70\x21\x00\x00\x00\x00\x00\xa1\x00"
+/*  416 */ "\x00\x00\xa1\x00\x00\x00\x00\x00\x00\x00\xa1\x00\x00\x00\x00\x00"
+/*  432 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  448 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  464 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  480 */ "\x00\x00\x70\x21\x00\x00\x00\x00\x00\x00\x70\x21\x00\x00\x00\x00"
+/*  496 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  512 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  528 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  544 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  560 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x70\x00\x00\x00\x70\x21\x00"
+/*  576 */ "\x00\x00\x00\x00\x00\x70\x21\x00\x00\x00\x00\x00\x00\x00\xa0\x00"
+/*  592 */ "\xa1\x00\x00\x00\xa1\x00\x00\x00\xa0\x00\x00\x00\xa1\x00\x00\x00"
+/*  608 */ "\xa0\x00\x00\x00\xa0\x00\x04\x00\x04\x00\x00\x00\x04\x00\x00\x00"
+/*  624 */ "\x04\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\xd0"
+/*  640 */ "\x00\xd0\x00\x00\x00\xd0\x00\x00\x00\xd0\x00\x00\x00\xd0\x00\x00"
+/*  656 */ "\x00\xd0\x00\x00\x00\xd0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  672 */ "\x70\x21\x00\x00\x00\x00\x00\x00\x70\x21\x00\x00\x00\x00\x00\x00"
+/*  688 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  704 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  720 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  736 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  752 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  768 */ "\x00\x00\x00\x00\x00\x00\x00\x70\x00\x00\x00\x70\x21\x00\x00\x00"
+/*  784 */ "\x00\x00\x00\x70\x21\x00\x00\x00\x00\x00\x00\x70\x00\x00\x00\x00"
+/*  800 */ "\x00\x00\xa1\x00\x00\x00\xa1\x00\x00\x00\x00\x00\x00\x00\xa1\x00"
+/*  816 */ "\x00\x00\x00\x00\x00\x00\xa1\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  832 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  848 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  864 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  880 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x70\x21"
+/*  896 */ "\x00\x00\x00\x00\x00\x00\x70\x21\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  912 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  928 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  944 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  960 */ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+/*  976 */ "\x00";
+
+/* name.c */
+word_t   *toplev;
+
+/* menu.c */
+commands_t      cmdlist[] = {
+    {admin,PERM_SYSOP|PERM_VIEWSYSOP, "00Admin       �i �t��@�� �j"},
+    {Announce, 0,                     "AAnnounce     �i ��ؤ��G�� �j"},
+    {Boards, 0,                       "FFavorite     �i �� �� �̷R �j"},
+    {root_board, 0,                   "CClass        �i ���հQ�װ� �j"},
+    {Mail, PERM_BASIC,                "MMail         �i �p�H�H��� �j"},
+    {Talk, 0,                         "TTalk         �i �𶢲�Ѱ� �j"},
+    {User, 0,                         "UUser         �i �ӤH�]�w�� �j"},
+    {Xyz, 0,                          "XXyz          �i �t�Τu��� �j"},
+    {Play_Play,0,                     "PPlay         �i �C�ֳ�/�j�Ǭd�]�j"},
+    {Name_Menu,PERM_LOGINOK,          "NNamelist     �i �s�S�O�W�� �j"},
+    {Goodbye, 0,                      "GGoodbye       ���}�A�A���K�K"},
+    {NULL, 0, NULL}
+};
+
+/* friend.c */
+/* Ptt �U�دS�O�W�檺�ɦW */
+char    *friend_file[8] = {
+    FN_OVERRIDES,
+    FN_REJECT,
+    "alohaed",
+    "postlist",
+    "",
+    FN_CANVOTE,
+    FN_WATER,
+    FN_VISABLE
+};
diff --git a/mbbsd/vice.c b/mbbsd/vice.c
index a27e5b21..8b8abe0f 100644
--- a/mbbsd/vice.c
+++ b/mbbsd/vice.c
@@ -1,15 +1,5 @@
-/* $Id: vice.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "modes.h"
-#include "proto.h"
-extern int usernum;
+/* $Id: vice.c,v 1.3 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 #define VICE_PLAY   BBSHOME "/etc/vice/vice.play"
 #define VICE_DATA   "vice.new"
@@ -24,8 +14,6 @@ extern int usernum;
 #define MAX_LOST_PICTURE 3
 #define MAX_END_PICTURE  5
 
-
-
 static int vice_load(char tbingo[6][15]) {
     FILE *fb = fopen(VICE_BINGO, "r");
     char buf[16], *ptr;
@@ -81,7 +69,6 @@ static int ran_showmfile(char *filename, int maxnum) {
     return more(buf, YEA);
 }
 
-extern userec_t cuser;
 
 int vice_main() {
     FILE *fd;
diff --git a/mbbsd/vote.c b/mbbsd/vote.c
index f25a6a2b..914ac24a 100644
--- a/mbbsd/vote.c
+++ b/mbbsd/vote.c
@@ -1,33 +1,7 @@
-/* $Id: vote.c,v 1.8 2002/05/25 09:33:22 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <time.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <sys/file.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "modes.h"
-#include "common.h"
-#include "perm.h"
-#include "proto.h"
+/* $Id: vote.c,v 1.9 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 static int total;
-extern int numboards;
-extern boardheader_t *bcache;     /* Thor: for speed up */
-extern char *err_board_update;
-extern char *fn_board;
-extern char *msg_seperator;
-extern int t_lines, t_columns;  /* Screen size / width */
-extern int b_lines;             /* Screen bottom line number: t_lines-1 */
-extern int currmode;
-extern int usernum;
-extern char currboard[];        /* name of currently selected board */
-extern userec_t cuser;
 
 static char STR_bv_control[] = "control";  /* �벼��� �ﶵ */
 static char STR_bv_desc[] = "desc";        /* �벼�ت� */
@@ -122,7 +96,7 @@ static int b_nonzeroNum(char *buf) {
     }
     return i;
 }
-extern time_t now;
+
 static void vote_report(char *bname, char *fname, char *fpath) {
     register char *ip;
     time_t dtime;
diff --git a/mbbsd/voteboard.c b/mbbsd/voteboard.c
index f8be3d27..2f71fef2 100644
--- a/mbbsd/voteboard.c
+++ b/mbbsd/voteboard.c
@@ -1,28 +1,8 @@
-/* $Id: voteboard.c,v 1.6 2002/05/25 11:18:11 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "modes.h"
-#include "common.h"
-#include "perm.h"
-#include "proto.h"
+/* $Id: voteboard.c,v 1.7 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
 
 #define VOTEBOARD "NewBoard"
 
-extern char currboard[];
-extern int currbid;
-extern boardheader_t *bcache;
-extern int currmode;
-extern userec_t cuser;
-extern time_t now;
-
 void do_voteboardreply(fileheader_t *fhdr){
     char genbuf[1024];
     char reason[50];
diff --git a/mbbsd/xyz.c b/mbbsd/xyz.c
index 3754582e..59a265b3 100644
--- a/mbbsd/xyz.c
+++ b/mbbsd/xyz.c
@@ -1,31 +1,9 @@
-/* $Id: xyz.c,v 1.7 2002/05/25 11:18:11 ptt Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <signal.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "common.h"
-#include "modes.h"
-#include "proto.h"
-
-extern char *fn_note_ans;
-extern int b_lines;             /* Screen bottom line number: t_lines-1 */
-extern char *BBSName;
-extern char fromhost[];
-extern userinfo_t *currutmp;
-extern userec_t cuser;
-extern time_t now;
+/* $Id: xyz.c,v 1.8 2002/06/04 13:08:34 in2 Exp $ */
+#include "bbs.h"
+
 /* �U�زέp�ά�����T�C�� */
 /* Ptt90�~�פj���p�۬d�]�t��  */
 int x_90() {
-    extern char dict[21], database[41];
     strcpy(dict, "(90)����Ҹ�/�m�W/�Ǯ�/��t/����");
     strcpy(database, "etc/90");
     use_dict();
@@ -34,7 +12,6 @@ int x_90() {
 
 /* Ptt89�~�פj���p�۬d�]�t��  */
 int x_89() {
-    extern char dict[21], database[41];
     strcpy(dict, "(89)����Ҹ�/�m�W/�Ǯ�/��t/����");
     strcpy(database, "etc/89");
     use_dict();
@@ -42,8 +19,6 @@ int x_89() {
 }
 /* Ptt88�~�פj���p�۬d�]�t��  */
 int x_88() {
-    extern char dict[21], database[41];
-
     strcpy(dict, "(88)����Ҹ�/�m�W/�Ǯ�/��t/����");
     strcpy(database, "etc/88");
     use_dict();
@@ -51,8 +26,6 @@ int x_88() {
 }    
 /* Ptt87�~�פj���p�۬d�]�t��  */
 int x_87() {
-    extern char dict[21], database[41];
-
     strcpy(dict, "(87)����Ҹ�/�m�W/�Ǯ�/��t");
     strcpy(database, "etc/87");
     use_dict();
@@ -61,8 +34,6 @@ int x_87() {
 
 /* Ptt86�~�פj���p�۬d�]�t��  */
 int x_86() {
-    extern char dict[21], database[41];
-
     strcpy(dict, "(86)����Ҹ�/�m�W/�Ǯ�/��t");
     strcpy(database, "etc/86");
     use_dict();
@@ -319,7 +290,6 @@ int m_sysop() {
 }
 
 int Goodbye() {
-    extern void movie();
     char genbuf[100];
 
     getdata(b_lines - 1, 0, "�z�T�w�n���}�i " BBSNAME " �j��(Y/N)�H[N] ",
-- 
cgit v1.2.3