diff options
-rw-r--r-- | pttbbs/include/common.h | 1 | ||||
-rw-r--r-- | pttbbs/include/proto.h | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/mbbsd.c | 25 | ||||
-rw-r--r-- | pttbbs/mbbsd/menu.c | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/user.c | 42 | ||||
-rw-r--r-- | pttbbs/mbbsd/var.c | 3 | ||||
-rw-r--r-- | pttbbs/mbbsd/xyz.c | 131 | ||||
-rw-r--r-- | pttbbs/util/shmctl.c | 3 |
8 files changed, 42 insertions, 167 deletions
diff --git a/pttbbs/include/common.h b/pttbbs/include/common.h index 6e3c8540..e2bb2112 100644 --- a/pttbbs/include/common.h +++ b/pttbbs/include/common.h @@ -28,7 +28,6 @@ #define FN_DIR ".DIR" #define FN_BOARD ".BRD" /* board list */ #define FN_USEBOARD "usboard" /* ¬ÝªO²Îp */ -#define FN_NOTE_ANS "note.ans" #define FN_TOPSONG "etc/topsong" #define FN_OVERRIDES "overrides" #define FN_TICKET "ticket" diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h index b8d38728..77895399 100644 --- a/pttbbs/include/proto.h +++ b/pttbbs/include/proto.h @@ -675,7 +675,6 @@ void do_voteboardreply(const fileheader_t *fhdr); /* xyz */ int m_sysop(void); int x_boardman(void); -int x_note(void); int x_login(void); int x_week(void); int x_issue(void); @@ -687,7 +686,6 @@ int x_history(void); int x_weather(void); int x_stock(void); int x_mrtmap(void); -int note(void); int Goodbye(void); /* BBS-LUA */ diff --git a/pttbbs/mbbsd/mbbsd.c b/pttbbs/mbbsd/mbbsd.c index 0aa6c3fa..10eac019 100644 --- a/pttbbs/mbbsd/mbbsd.c +++ b/pttbbs/mbbsd/mbbsd.c @@ -1328,16 +1328,25 @@ user_login(void) if ((cuser.loginview >> i) & 1) { const char *fn = loginview_file[(int)i][0]; + // fn == '\0': ignore; NULL: break; if (!fn) break; - if (*fn == '@') // special - { - // since only one special now, let's write directly... - if (strcmp(fn, "@calendar") == 0) - calendar(); - } else { - // use NA+pause or YEA? - more(fn, YEA); + + switch (*fn) { + case '\0': + // simply ignore it. + break; + + case '@': + // since only one special now, let's write directly... + if (strcmp(fn, "@calendar") == 0) + calendar(); + break; + + default: + // use NA+pause or YEA? + more(fn, YEA); + break; } } } diff --git a/pttbbs/mbbsd/menu.c b/pttbbs/mbbsd/menu.c index 183cf7ed..1d102cf9 100644 --- a/pttbbs/mbbsd/menu.c +++ b/pttbbs/mbbsd/menu.c @@ -788,7 +788,6 @@ static const commands_t xyzlist[] = { {x_program, 0, "PProgram ¥»µ{¦¡¤§ª©¥»»Pª©Åv«Å§i"}, #endif {x_history, 0, "HHistory ¡m§Ú̪º¦¨ªø¡n"}, - {x_note, 0, "NNote ¡m»Ä²¢W»¶¬y¨¥ªO¡n"}, {x_login,0, "SSystem ¡m¨t²Î«n¤½§i¡n"}, #ifdef HAVE_SYSUPDATES {x_sys_updates,0,"LLUpdates ¡m¥»¯¸¨t²Îµ{¦¡§ó·s¬ö¿ý¡n"}, @@ -852,7 +851,6 @@ static int chessroom(); /* Ptt Play menu */ static const commands_t playlist[] = { - {note, PERM_LOGINOK, "NNote ¡i ¨è¨è¬y¨¥ªO ¡j"}, {p_money,PERM_LOGINOK, "PPay ¡i" ANSI_COLOR(1;31) " " BBSMNAME2 "¶q³c©± " ANSI_RESET "¡j"}, {chicken_main,PERM_LOGINOK, diff --git a/pttbbs/mbbsd/user.c b/pttbbs/mbbsd/user.c index ea0fed33..c1324921 100644 --- a/pttbbs/mbbsd/user.c +++ b/pttbbs/mbbsd/user.c @@ -60,26 +60,28 @@ u_loginview(void) int i, in; unsigned int pbits = cuser.loginview; - clear(); - move(4, 0); - for (i = 0; i < NUMVIEWFILE && loginview_file[i][0]; i++) - prints(" %c. %-20s %-15s \n", 'A' + i, - loginview_file[i][1], ((pbits >> i) & 1 ? "£¾" : "¢æ")); - in = i; - - clrtobot(); - while ((i = vmsgf("½Ð«ö [A-%c] ¤Á´«³]©w¡A«ö [Return] µ²§ô¡G", - 'A'+in-1))!='\r') - { - i = i - 'a'; - if (i >= in || i < 0) - bell(); - else { - pbits ^= (1 << i); - move(i + 4, 28); - outs((pbits >> i) & 1 ? "£¾" : "¢æ"); - } - } + do { + vs_hdr("³]©w¶i¯¸µe±"); + move(4, 0); + for (i = 0; i < NUMVIEWFILE && loginview_file[i][0]; i++) { + // ignore those without file name + if (!*loginview_file[i][0]) + continue; + prints(" %c. %-20s %-15s \n", 'A' + i, + loginview_file[i][1], ((pbits >> i) & 1 ? "£¾" : "¢æ")); + } + in = i; // max i + i = vmsgf("½Ð«ö [A-%c] ¤Á´«³]©w¡A«ö [Return] µ²§ô¡G", 'A'+in-1); + if (i == '\r') + break; + // process i + i = tolower(i) - 'a'; + if (i >= in || i < 0 || !*loginview_file[i][0]) { + bell(); + continue; + } + pbits ^= (1 << i); + } while (1); if (pbits != cuser.loginview) { pwcuSetLoginView(pbits); diff --git a/pttbbs/mbbsd/var.c b/pttbbs/mbbsd/var.c index 39197a46..9e1fd8be 100644 --- a/pttbbs/mbbsd/var.c +++ b/pttbbs/mbbsd/var.c @@ -118,7 +118,6 @@ unsigned int currstat; char * const fn_passwd = FN_PASSWD; char * const fn_board = FN_BOARD; -char * const fn_note_ans = FN_NOTE_ANS; const char * const fn_plans = "plans"; const char * const fn_writelog = "writelog"; const char * const fn_talklog = "talklog"; @@ -134,7 +133,7 @@ const char * const fn_boardhelp = FN_BOARDHELP; /* are descript in userec.loginview */ char * const loginview_file[NUMVIEWFILE][2] = { - {FN_NOTE_ANS, "»Ä²¢W»¶¬y¨¥ªO"}, + {"", "(«O¯d)"}, {FN_TOPSONG, "ÂIºq±Æ¦æº]"}, {"etc/topusr", "¤Q¤j±Æ¦æº]"}, {"etc/topusr100", "¦Ê¤j±Æ¦æº]"}, diff --git a/pttbbs/mbbsd/xyz.c b/pttbbs/mbbsd/xyz.c index 4523536a..96fd55d7 100644 --- a/pttbbs/mbbsd/xyz.c +++ b/pttbbs/mbbsd/xyz.c @@ -32,13 +32,6 @@ x_boards(void) #endif int -x_note(void) -{ - more(fn_note_ans, YEA); - return 0; -} - -int x_issue(void) { more("etc/day", YEA); @@ -73,121 +66,6 @@ x_login(void) return 0; } -int -note(void) -{ - char *fn_note_tmp = "note.tmp"; - char *fn_note_dat = "note.dat"; - int total = 0, i, collect, len; - struct stat st; - char buf[256], buf2[80]; - int fd, fx; - FILE *fp, *foo; - - typedef struct notedata_t { - time4_t date; - char userid[IDLEN + 1]; - char nickname[19]; - char buf[3][80]; - } notedata_t; - notedata_t myitem; - - if (cuser.money < 5) { - vmsg(ANSI_COLOR(1;41) " «u§r! n§ë¤¤¸¤~¯à¯d¨¥...¨S¿úC.." ANSI_RESET); - return 0; - } - setutmpmode(EDNOTE); - do { - myitem.buf[0][0] = myitem.buf[1][0] = myitem.buf[2][0] = '\0'; - move(12, 0); - clrtobot(); - outs("\n§ë¤¤¸... ¹Í... ½Ð¯d¨¥ (¦Ü¦h¤T¦æ)¡A«ö[Enter]µ²§ô"); - for (i = 0; (i < 3) && getdata(16 + i, 0, "¡G", myitem.buf[i], - sizeof(myitem.buf[i]) - 5, DOECHO) - && *myitem.buf[i]; i++); - getdata(b_lines - 1, 0, "(S)Àx¦s (E)«·s¨Ó¹L (Q)¨ú®ø¡H[S] ", - buf, 3, LCECHO); - - if (buf[0] == 'q' || (i == 0 && *buf != 'e')) - return 0; - } while (buf[0] == 'e'); - demoney(-5); - strcpy(myitem.userid, cuser.userid); - strlcpy(myitem.nickname, cuser.nickname, sizeof(myitem.nickname)); - myitem.date = now; - - /* begin load file */ - if ((foo = fopen(".note", "a")) == NULL) - return 0; - - unlink(fn_note_ans); // remove first to prevent mmap(pmore) crash - if ((fp = fopen(fn_note_ans, "w")) == NULL) { - fclose(fp); - return 0; - } - - if ((fx = open(fn_note_tmp, O_WRONLY | O_CREAT, 0644)) <= 0) { - fclose(foo); - fclose(fp); - return 0; - } - - if ((fd = open(fn_note_dat, O_RDONLY)) == -1) - total = 1; - else if (fstat(fd, &st) != -1) { - total = st.st_size / sizeof(notedata_t) + 1; - if (total > MAX_NOTE) - total = MAX_NOTE; - } - fputs(ANSI_COLOR(1;31;44) "¡ó¢s¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢t" - ANSI_COLOR(37) "»Ä²¢W»¶ªO" ANSI_COLOR(31) "¢u¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢s¡ó" - ANSI_RESET "\n", fp); - collect = 1; - - while (total) { - snprintf(buf, sizeof(buf), ANSI_COLOR(1;31) "ùÝ¢t" ANSI_COLOR(32) " %s " ANSI_COLOR(37) "(%s)", - myitem.userid, myitem.nickname); - len = strlen(buf); - - for (i = len; i < 71; i++) - strcat(buf, " "); - snprintf(buf2, sizeof(buf2), " " ANSI_COLOR(1;36) "%.16s" ANSI_COLOR(31) " ¢uùß" ANSI_RESET "\n", - Cdate(&(myitem.date))); - strcat(buf, buf2); - fputs(buf, fp); - if (collect) - fputs(buf, foo); - for (i = 0; i < 3 && *myitem.buf[i]; i++) { - fprintf(fp, ANSI_COLOR(1;31) "¢x" ANSI_RESET "%-74.74s" ANSI_COLOR(1;31) "¢x" ANSI_RESET "\n", - myitem.buf[i]); - if (collect) - fprintf(foo, ANSI_COLOR(1;31) "¢x" ANSI_RESET "%-74.74s" ANSI_COLOR(1;31) "¢x" ANSI_RESET "\n", - myitem.buf[i]); - } - fputs(ANSI_COLOR(1;31) "ùã¢s¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w" - "¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢sùå" ANSI_RESET "\n", fp); - - if (collect) { - fputs(ANSI_COLOR(1;31) "ùã¢s¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w" - "¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢sùå" ANSI_RESET "\n", foo); - fclose(foo); - collect = 0; - } - write(fx, &myitem, sizeof(myitem)); - - if (--total) - read(fd, (char *)&myitem, sizeof(myitem)); - } - fputs(ANSI_COLOR(1;31;44) "¡ó¢r¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w" - "¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢r¡ó" ANSI_RESET "\n", fp); - fclose(fp); - close(fd); - close(fx); - Rename(fn_note_tmp, fn_note_dat); - more(fn_note_ans, YEA); - return 0; -} - static void mail_sysop(void) { @@ -264,15 +142,6 @@ Goodbye(void) return 0; adbanner_goodbye(); - if (cuser.userlevel) { - getdata(b_lines - 1, 0, - "(G)ÀH·¦Ó³u (M)¦«¹Ú¯¸ªø (N)»Ä²¢W»¶¬y¨¥ªO¡H[G] ", - genbuf, 3, LCECHO); - if (genbuf[0] == 'm') - mail_sysop(); - else if (genbuf[0] == 'n') - note(); - } show_80x24_screen("etc/Logout"); { int diff = (now - login_start_time) / 60; diff --git a/pttbbs/util/shmctl.c b/pttbbs/util/shmctl.c index ebf6e83e..258c1bda 100644 --- a/pttbbs/util/shmctl.c +++ b/pttbbs/util/shmctl.c @@ -374,7 +374,8 @@ cmputmpuid(const void * i, const void * j) return SHM->uinfo[*(int*)i].uid - SHM->uinfo[*(int*)j].uid; } -inline void utmpsort(int sortall) +static inline +void utmpsort(int sortall) { userinfo_t *uentp; int count, i, ns; |