diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-07-17 11:27:29 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-07-17 11:27:29 +0800 |
commit | 91d90470f1c9eb465a5ea7799263af90212fcfce (patch) | |
tree | d552da494965c42d9708ecd97d1fd91ea270e83f /mbbsd | |
parent | 0c09591e5426ec3fce7d1f6a609bf9664da0cc9f (diff) | |
download | pttbbs-91d90470f1c9eb465a5ea7799263af90212fcfce.tar pttbbs-91d90470f1c9eb465a5ea7799263af90212fcfce.tar.gz pttbbs-91d90470f1c9eb465a5ea7799263af90212fcfce.tar.bz2 pttbbs-91d90470f1c9eb465a5ea7799263af90212fcfce.tar.lz pttbbs-91d90470f1c9eb465a5ea7799263af90212fcfce.tar.xz pttbbs-91d90470f1c9eb465a5ea7799263af90212fcfce.tar.zst pttbbs-91d90470f1c9eb465a5ea7799263af90212fcfce.zip |
random signature
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@1056 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/edit.c | 19 | ||||
-rw-r--r-- | mbbsd/user.c | 16 |
2 files changed, 19 insertions, 16 deletions
diff --git a/mbbsd/edit.c b/mbbsd/edit.c index c3e2fdc5..81fc73da 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -1,4 +1,4 @@ -/* $Id: edit.c,v 1.36 2003/06/28 08:47:45 kcwu Exp $ */ +/* $Id: edit.c,v 1.37 2003/07/17 03:27:29 victor Exp $ */ /* edit.c, 用來提供 bbs上的文字編輯器, 即 ve. * 現在這一個是惡搞過的版本, 比較不穩定, 用比較多的 cpu, 但是可以省下許多 * 的記憶體 (以 Ptt為例, 在九千人上站的時候, 約可省下 50MB 的記憶體) @@ -895,11 +895,11 @@ void addsignature(FILE * fp, int ifuseanony) { FILE *fs; - int i; + int i, num; char buf[WRAPMARGIN + 1]; char fpath[STRLEN]; - static char msg[] = "請選擇簽名檔 (1-9, 0=不加)[0]: "; + static char msg[] = "請選擇簽名檔 (1-9, 0=不加 X=隨機)[X]: "; char ch; if (!strcmp(cuser.userid, STR_GUEST)) { @@ -908,13 +908,16 @@ addsignature(FILE * fp, int ifuseanony) return; } if (!ifuseanony) { - i = showsignature(fpath); - msg[27] = ch = '0' | (cuser.uflag & SIG_FLAG); + num = showsignature(fpath, &i); + msg[34] = ch = isdigit(cuser.signature) ? cuser.signature : 'X'; getdata(0, 0, msg, buf, 4, DOECHO); - if (ch != buf[0] && buf[0] >= '0' && buf[0] <= '9') { - ch = buf[0]; - cuser.uflag = (cuser.uflag & ~SIG_FLAG) | (ch & SIG_FLAG); + if (buf[0] == 0 || buf[0] == 'x' || isdigit(buf[0])) { + if (isdigit(buf[0])) + ch = buf[0]; + else + ch = '1' + rand() % num; + cuser.signature = buf[0]; } if (ch != '0') { fpath[i] = ch; diff --git a/mbbsd/user.c b/mbbsd/user.c index c706b741..4e12167d 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -1,4 +1,4 @@ -/* $Id: user.c,v 1.69 2003/07/17 00:57:21 in2 Exp $ */ +/* $Id: user.c,v 1.70 2003/07/17 03:27:29 victor Exp $ */ #include "bbs.h" static char *sex[8] = { @@ -712,29 +712,29 @@ showplans(char *uid) } int -showsignature(char *fname) +showsignature(char *fname, int *j) { FILE *fp; char buf[256]; - int i, j; + int i, num = 0; char ch; clear(); move(2, 0); setuserfile(fname, "sig.0"); - j = strlen(fname) - 1; + *j = strlen(fname) - 1; for (ch = '1'; ch <= '9'; ch++) { - fname[j] = ch; + fname[*j] = ch; if ((fp = fopen(fname, "r"))) { prints("\033[36m【 簽名檔.%c 】\033[m\n", ch); for (i = 0; i < MAX_SIGLINES && fgets(buf, sizeof(buf), fp); i++) outs(buf); - + num++; fclose(fp); } } - return j; + return num; } int @@ -745,7 +745,7 @@ u_editsig() int j; char genbuf[200]; - j = showsignature(genbuf); + showsignature(genbuf, &j); getdata(0, 0, "簽名檔 (E)編輯 (D)刪除 (Q)取消?[Q] ", ans, sizeof(ans), LCECHO); |