作者kevinblue.bbs@nightless.twbbs.org (凱文藍) 看板: itoc
標題Re: [修正] 解決亂數簽名檔會讀到空檔的問題
時間城區夜未眠 (2008/04/07 Mon 10:33:09)
這是我們站的,不過是很爛很爛的做法 :Q
loading 大的站請不要這樣惡搞 :p
btw, 9 個簽名檔
> src/maple/edit.c #ve_quota()
if (!(cuser.ufo & UFO_NOSIGN)) /*
itoc.000320: 不使用簽名檔 */
#endif
{
int topsign=1;
show_sign:
if (cuser.ufo & UFO_SHOWSIGN) /* itoc.000319: 顯示簽名檔的內容 */
show_sign('0'+topsign);
msg[50] = op = cuser.signature + '0';
if (fd = vget(b_lines, 0, msg, buf, 3, DOECHO))
{
if (fd == 'n') /* LHD.031107: 按 n 循環換頁 */
{
topsign = (topsign + 3) % 9;
goto show_sign;
}
if (op != fd && ((fd >= '0' && fd <= '9') || fd == 'r'))
{
cuser.signature = fd - '0';
op = fd;
}
}
if (op == 'r')
{
sprintf(buf, "%s.%c", FN_SIGN, '1');
usr_fpath(fpath, cuser.userid, buf);
/*itoc.020123: 各個簽名檔檔案分開 */
if (open(fpath, O_RDONLY) < 0)
goto no_sign;
/* kevinblue: 如果第一個簽名檔是空白表示使用者沒設定簽名檔 */
get_sign:
srand(time(NULL));
op = (rand() % 9) + '1';
sprintf(buf, "%s.%c", FN_SIGN, op);
usr_fpath(fpath, cuser.userid, buf);
/* itoc.020123: 各個簽名檔檔案分開 */
if (open(fpath, O_RDONLY) < 0)
goto get_sign;
else
goto print_sign;
}
if (op != '0')
{
sprintf(buf, "%s.%c", FN_SIGN, op);
usr_fpath(fpath, cuser.userid, buf);
/* itoc.020123: 各個簽名檔檔案分開 */
print_sign:
if ((fd = open(fpath, O_RDONLY)) >= 0)
{
op = 0;
mgets(-1);
while ((str = mgets(fd)) && (op < MAXSIGLINES))
{
if (!op)
this = ve_line(this, "--");
this = ve_line(this, str);
op++;
}
close(fd);
}
}
}
no_sign:
this->next = next;
if (next)
next->prev = this;
--
If we knew what we were doing, it wouldn't be called research, would it?
--Albert Einstein
--
�i◣�i█ ██ █�i ██ █ ██ ██ ██ * ● . ' ▃▃
██ █�f ██ █ █ █▆ █▆ █▆ ' * . :: : :: : :
█◥ █ ██ █�i █ █▆ █▆ ▆█ ▆█ 城區夜未眠 : :: :: : ::
Origin:東吳資科城區夜未眠(nightless.twbbs.org)▊▋▎ [FROM:140.109.23.36]
m※ 編輯: kevinblue 來自: 140.109.23.36 (04/07 10:33)