From 5c2feefbb3efe2c5313babaf2f09f89294c7a6a9 Mon Sep 17 00:00:00 2001 From: mhsin Date: Tue, 20 Sep 2005 19:13:52 +0000 Subject: Revert r3196(as a workaround). Really(hope so :p) solve bug in r3192. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3197 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/edit.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/edit.c b/mbbsd/edit.c index ca8c6882..cade65f7 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -1524,23 +1524,27 @@ browse_sigs: if (!buf[0]) buf[0] = ch; - ch = buf[0]; + if (isdigit((int)buf[0])) + ch = buf[0]; + else + ch = '1' + random() % (si.max+1); cuser.signature = buf[0]; - while (ch != '0' && si.total > 0) { - if(!isdigit((int)buf[0])) - ch = '1' + random() % (si.max+1); + if (ch != '0') { fpath[i] = ch; - if ((fs = fopen(fpath, "r"))) { - fputs("\n--\n", fp); - for (i = 0; i < MAX_SIGLINES && - fgets(buf, sizeof(buf), fs); i++) - fputs(buf, fp); - fclose(fs); - ch = '0'; - } else if (isdigit((int)buf[0])) { - ch = '0'; - } + do + { + if ((fs = fopen(fpath, "r"))) { + fputs("\n--\n", fp); + for (i = 0; i < MAX_SIGLINES && + fgets(buf, sizeof(buf), fs); i++) + fputs(buf, fp); + fclose(fs); + fpath[i] = ch; + } + else + fpath[i] = '1' + (fpath[i] - '1' + 1) % (si.max+1); + } while (!isdigit((int)buf[0]) && si.max > 0 && ch != fpath[i]); } } } -- cgit v1.2.3