summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/config.h4
-rw-r--r--include/proto.h3
-rw-r--r--include/pttstruct.h14
-rw-r--r--mbbsd/chat.c10
-rw-r--r--mbbsd/edit.c26
-rw-r--r--mbbsd/io.c18
-rw-r--r--sample/pttbbs.conf6
-rw-r--r--sample/pttbbs_minimal.conf14
8 files changed, 37 insertions, 58 deletions
diff --git a/include/config.h b/include/config.h
index b6254a08..194e5dc9 100644
--- a/include/config.h
+++ b/include/config.h
@@ -46,11 +46,11 @@
#endif
#ifndef MAX_POST_MONEY /* 發表文章稿費的上限 */
-#define MAX_POST_MONEY 100
+#define MAX_POST_MONEY (100)
#endif
#ifndef MAX_CHICKEN_MONEY /* 養雞場獲利上限 */
-#define MAX_CHICKEN_MONEY 100
+#define MAX_CHICKEN_MONEY (100)
#endif
#ifndef MAX_GUEST_LIFE /* 最長未認證使用者保留時間(秒) */
diff --git a/include/proto.h b/include/proto.h
index 87efad8c..46784a17 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -719,8 +719,7 @@ int u_editsig(void);
int u_cloak(void);
int u_register(void);
int u_list(void);
-#if defined(DBCSAWARE_GETDATA) || defined(DBCSAWARE_EDIT)
-# define DBCSAWARE
+#ifdef DBCSAWARE
int u_detectDBCSAwareEvilClient();
int getDBCSstatus(unsigned char *s, int pos);
#define ISDBCSAWARE() (cuser.uflag & DBCSAWARE_FLAG)
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 6794d38b..22cc64a1 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -246,18 +246,6 @@ typedef struct fileheader_t {
int money;
int anon_uid;
/* different order to match alignment */
-#ifdef _BIG_ENDIAN
- struct {
- unsigned char pad[1]; /* money & 0xff000000 */
- unsigned char regtime; /* money & 0xff0000 */
- unsigned char logins; /* money & 0xff00 */
- unsigned char posts; /* money & 0xff */
- } vote_limits;
- struct {
- unsigned int flag:1;
- unsigned int ref:31;
- } refer;
-#else
struct {
unsigned char posts; /* money & 0xff */
unsigned char logins; /* money & 0xff00 */
@@ -265,10 +253,10 @@ typedef struct fileheader_t {
unsigned char pad[1]; /* money & 0xffff0000 */
} vote_limits;
struct {
+ /* is this ordering correct? */
unsigned int ref:31;
unsigned int flag:1;
} refer;
-#endif
} multi; /* rocker: if bit32 on ==> reference */
/* XXX dirty, split into flag and money if money of each file is less than 16bit? */
unsigned char filemode; /* must be last field @ boards.c */
diff --git a/mbbsd/chat.c b/mbbsd/chat.c
index bd0a381e..761965bb 100644
--- a/mbbsd/chat.c
+++ b/mbbsd/chat.c
@@ -1,7 +1,7 @@
/* $Id$ */
#include "bbs.h"
-#ifndef DBCSAWARE_GETDATA
+#ifndef DBCSAWARE
#define dbcs_off (1)
#endif
@@ -414,7 +414,7 @@ t_chat(void)
if (currchar)
{
--currchar;
-#ifdef DBCSAWARE_GETDATA
+#ifdef DBCSAWARE
if(currchar > 0 &&
ISDBCSAWARE() &&
getDBCSstatus(inbuf, currchar) == DBCS_TRAILING)
@@ -426,7 +426,7 @@ t_chat(void)
if (inbuf[currchar])
{
++currchar;
-#ifdef DBCSAWARE_GETDATA
+#ifdef DBCSAWARE
if(inbuf[currchar] &&
ISDBCSAWARE() &&
getDBCSstatus(inbuf, currchar) == DBCS_TRAILING)
@@ -481,7 +481,7 @@ t_chat(void)
move(b_lines - 1, chatid_len);
} else if (ch == Ctrl('H') || ch == '\177') {
if (currchar) {
-#ifdef DBCSAWARE_GETDATA
+#ifdef DBCSAWARE
int dbcs_off = 1;
if (ISDBCSAWARE() &&
getDBCSstatus(inbuf, currchar-1) == DBCS_TRAILING)
@@ -505,7 +505,7 @@ t_chat(void)
break;
} else if (ch == Ctrl('D')) {
if ((size_t)currchar < strlen(inbuf)) {
-#ifdef DBCSAWARE_GETDATA
+#ifdef DBCSAWARE
int dbcs_off = 1;
if (ISDBCSAWARE() && inbuf[currchar+1] &&
getDBCSstatus(inbuf, currchar+1) == DBCS_TRAILING)
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index 42b104a6..4b79abd7 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -212,7 +212,7 @@ static const char *table_mode[6] = {
"╪"
};
-#ifdef DBCSAWARE_EDIT
+#ifdef DBCSAWARE
static char mbcs_mode =1;
#define IS_BIG5_HI(x) (0x81 <= (x) && (x) <= 0xfe)
@@ -1917,7 +1917,7 @@ edit_outs_n(const char *text, int n)
register unsigned char inAnsi = 0;
register unsigned char ch;
-#ifdef DBCSAWARE_EDIT
+#ifdef DBCSAWARE
/* 0 = N/A, 1 = leading byte printed, 2 = ansi in middle */
register unsigned char isDBCS = 0;
#endif
@@ -1943,7 +1943,7 @@ edit_outs_n(const char *text, int n)
else if(ch == ESC_CHR)
{
inAnsi = 1;
-#ifdef DBCSAWARE_EDIT
+#ifdef DBCSAWARE
if(isDBCS == 1)
{
isDBCS = 2;
@@ -1955,7 +1955,7 @@ edit_outs_n(const char *text, int n)
}
else
{
-#ifdef DBCSAWARE_EDIT
+#ifdef DBCSAWARE
if(isDBCS == 1)
isDBCS = 0;
else if (isDBCS == 2)
@@ -2083,7 +2083,7 @@ display_textline_internal(textline_t *p, int i, int min, int max)
(*output)(p->data + max);
} else
-#ifdef DBCSAWARE_EDIT
+#ifdef DBCSAWARE
if(mbcs_mode && curr_buf->edit_margin > 0)
{
if(curr_buf->edit_margin >= p->len)
@@ -2681,7 +2681,7 @@ vedit(char *fpath, int saveheader, int *islocal)
strncpy(mytitle, save_title, STRLEN-2);
mytitle[STRLEN-1] = 0;
-#ifdef DBCSAWARE_EDIT
+#ifdef DBCSAWARE
mbcs_mode = (cuser.uflag & DBCSAWARE_FLAG) ? 1 : 0;
#endif
@@ -2760,7 +2760,7 @@ vedit(char *fpath, int saveheader, int *islocal)
count = 0;
tin = interval;
}
-#ifndef DBCSAWARE_EDIT
+#ifndef DBCSAWARE
/* this is almost useless! */
if (curr_buf->raw_mode) {
switch (ch) {
@@ -2933,7 +2933,7 @@ vedit(char *fpath, int saveheader, int *islocal)
curr_buf->oldcurrline = curr_buf->currline;
break;
case 'R':
-#ifdef DBCSAWARE_EDIT
+#ifdef DBCSAWARE
case 'r':
mbcs_mode =! mbcs_mode;
#endif
@@ -3056,7 +3056,7 @@ vedit(char *fpath, int saveheader, int *islocal)
curr_buf->currpnt--;
if (curr_buf->ansimode)
curr_buf->currpnt = ansi2n(curr_buf->currpnt, curr_buf->currline);
-#ifdef DBCSAWARE_EDIT
+#ifdef DBCSAWARE
if(mbcs_mode)
curr_buf->currpnt = fix_cursor(curr_buf->currline->data, curr_buf->currpnt, FC_LEFT);
#endif
@@ -3074,7 +3074,7 @@ vedit(char *fpath, int saveheader, int *islocal)
curr_buf->currpnt++;
if (curr_buf->ansimode)
curr_buf->currpnt = ansi2n(curr_buf->currpnt, curr_buf->currline);
-#ifdef DBCSAWARE_EDIT
+#ifdef DBCSAWARE
if(mbcs_mode)
curr_buf->currpnt = fix_cursor(curr_buf->currline->data, curr_buf->currpnt, FC_RIGHT);
#endif
@@ -3193,7 +3193,7 @@ vedit(char *fpath, int saveheader, int *islocal)
}
break;
}
-#ifndef DBCSAWARE_EDIT
+#ifndef DBCSAWARE
curr_buf->currpnt--;
delete_char();
#else
@@ -3226,7 +3226,7 @@ vedit(char *fpath, int saveheader, int *islocal)
}
curr_buf->redraw_everything = YEA;
} else {
-#ifndef DBCSAWARE_EDIT
+#ifndef DBCSAWARE
delete_char();
#else
{
@@ -3293,7 +3293,7 @@ vedit(char *fpath, int saveheader, int *islocal)
window_scroll_down();
else if (cursor_at_bottom_line())
window_scroll_up();
-#ifdef DBCSAWARE_EDIT
+#ifdef DBCSAWARE
if(mbcs_mode)
curr_buf->currpnt = fix_cursor(curr_buf->currline->data, curr_buf->currpnt, FC_LEFT);
#endif
diff --git a/mbbsd/io.c b/mbbsd/io.c
index 89f03a0b..bf7eb91e 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -721,7 +721,7 @@ strip_nonebig5(unsigned char *str, int maxlen)
str[len]='\0';
}
-#ifdef DBCSAWARE_GETDATA
+#ifdef DBCSAWARE
int getDBCSstatus(unsigned char *s, int pos)
{
@@ -759,7 +759,7 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
static char lastcmd[MAXLASTCMD][80];
unsigned char occupy_msg = 0;
-#ifdef DBCSAWARE_GETDATA
+#ifdef DBCSAWARE
unsigned int dbcsincomplete = 0;
#endif
@@ -867,7 +867,7 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
if (currchar > 0)
{
--currchar;
-#ifdef DBCSAWARE_GETDATA
+#ifdef DBCSAWARE
if(currchar > 0 &&
ISDBCSAWARE() &&
getDBCSstatus(buf, currchar) == DBCS_TRAILING)
@@ -879,7 +879,7 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
if (buf[currchar])
{
++currchar;
-#ifdef DBCSAWARE_GETDATA
+#ifdef DBCSAWARE
if(buf[currchar] &&
ISDBCSAWARE() &&
getDBCSstatus(buf, currchar) == DBCS_TRAILING)
@@ -890,7 +890,7 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
case '\177':
case Ctrl('H'):
if (currchar) {
-#ifdef DBCSAWARE_GETDATA
+#ifdef DBCSAWARE
int dbcs_off = 1;
if (ISDBCSAWARE() &&
getDBCSstatus(buf, currchar-1) == DBCS_TRAILING)
@@ -905,7 +905,7 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
{
move(y, x + clen);
outc(' ');
-#ifdef DBCSAWARE_GETDATA
+#ifdef DBCSAWARE
while(--dbcs_off > 0) outc(' ');
#endif
move(y, x);
@@ -929,7 +929,7 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
case Ctrl('D'):
case KEY_DEL:
if (buf[currchar]) {
-#ifdef DBCSAWARE_GETDATA
+#ifdef DBCSAWARE
int dbcs_off = 1;
if (ISDBCSAWARE() && buf[currchar+1] &&
getDBCSstatus(buf, currchar+1) == DBCS_TRAILING)
@@ -942,7 +942,7 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
{
move(y, x + clen);
outc(' ');
-#ifdef DBCSAWARE_GETDATA
+#ifdef DBCSAWARE
while(--dbcs_off > 0) outc(' ');
#endif
move(y, x);
@@ -960,7 +960,7 @@ oldgetdata(int line, int col, const char *prompt, char *buf, int len, int echo)
break;
default:
if (isprint2(ch) && clen < len && x + clen < scr_cols) {
-#ifdef DBCSAWARE_GETDATA
+#ifdef DBCSAWARE
if(ISDBCSAWARE())
{
/* to prevent single byte input */
diff --git a/sample/pttbbs.conf b/sample/pttbbs.conf
index bfd002ff..e8f806f8 100644
--- a/sample/pttbbs.conf
+++ b/sample/pttbbs.conf
@@ -133,10 +133,8 @@
/* 若定義, 在使用者註冊之前, 會先顯示出該檔案, 經使用者確認後才能註冊 */
//#define HAVE_USERAGREEMENT "etc/UserAgreement"
-/* DBCS Aware: 讓游標不會跑到 DBCS trailing bytes 上
- * 但注意這會吃不少 CPU */
-//#define DBCSAWARE_GETDATA
-//#define DBCSAWARE_EDIT
+/* DBCS Aware: 讓游標不會跑到 DBCS trailing bytes 上 */
+//#define DBCSAWARE
/* 因為 DBCS 要先偵測,所以可以利用指定下面的時間來判斷使用者有否偵測過
* 請換成你真正上線的時間 (time_t) */
//#define DBCSAWARE_UPGRADE_STARTTIME (0)
diff --git a/sample/pttbbs_minimal.conf b/sample/pttbbs_minimal.conf
index 6f865a80..1536dfd0 100644
--- a/sample/pttbbs_minimal.conf
+++ b/sample/pttbbs_minimal.conf
@@ -3,21 +3,15 @@
#define BBSENAME "PTT" /* 英文站名 */
#define MYHOSTNAME "ptt.csie.ntu.edu.tw" /* 網路位址 */
#define MYIP "140.112.30.142" /* IP位址 */
-#define REGCODE_MAGIC "pttbbs" /* 註冊亂數種子 */
-#define RELAY_SERVER_IP "140.112.30.143" /* 寄站外信的 server */
+#define REGCODE_MAGIC "changeMe" /* 註冊亂數種子 */
/* 下面是較常改的設定,不改也行 */
/* Performance Settings */
-#define MAX_USERS (150000)
-#define MAX_ACTIVE (4096)
-#define MAX_CPULOAD (50)
-#define MAX_FROM (512)
+#define MAX_USERS (15000) /* 最高註冊人數 */
+#define MAX_ACTIVE (512) /* 最多同時上站人數 */
/* Misc Settings */
-#define MEM_CHECK (0)
-#define TITLE_COLOR "\33[0;1;37;44m"
-#define MAX_POST_MONEY (1000)
-#define MAX_CHICKEN_MONEY (10000)
+#define MEM_CHECK (0) /* 設為 0 代表非測試中 */
/* vim:ft=c
*/