summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-04 03:28:57 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-04 03:28:57 +0800
commitd7fe5b258c13cabd339cc4bda3aea25df93f31ea (patch)
treed501f262c5c70548cf7189558ab3da016fa56a1a /mbbsd
parent6eadc41a587bb1f362470e42d6b615e1567a6343 (diff)
downloadpttbbs-d7fe5b258c13cabd339cc4bda3aea25df93f31ea.tar
pttbbs-d7fe5b258c13cabd339cc4bda3aea25df93f31ea.tar.gz
pttbbs-d7fe5b258c13cabd339cc4bda3aea25df93f31ea.tar.bz2
pttbbs-d7fe5b258c13cabd339cc4bda3aea25df93f31ea.tar.lz
pttbbs-d7fe5b258c13cabd339cc4bda3aea25df93f31ea.tar.xz
pttbbs-d7fe5b258c13cabd339cc4bda3aea25df93f31ea.tar.zst
pttbbs-d7fe5b258c13cabd339cc4bda3aea25df93f31ea.zip
add 'where am I' in announce system (thanks to sangl@ptt[PttSuggestion])
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4492 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/announce.c54
1 files changed, 48 insertions, 6 deletions
diff --git a/mbbsd/announce.c b/mbbsd/announce.c
index 0176d553..97762e13 100644
--- a/mbbsd/announce.c
+++ b/mbbsd/announce.c
@@ -325,6 +325,7 @@ a_showhelp(int level)
"[^B][PgUp] 上頁選單\n"
"[^F][PgDn][Spc] 下頁選單\n"
"[##] 移到該選項\n"
+ "[^W] 我在哪裡\n"
"[F][U] 將文章寄回 Internet 郵箱/"
"將文章 uuencode 後寄回郵箱\n");
if (level >= MANAGER) {
@@ -1015,13 +1016,15 @@ isvisible_man(const menu_t * me)
}
return 1;
}
+
int
-a_menu(const char *maintitle, const char *path,
+a_menu_rec(const char *maintitle, const char *path,
int lastlevel, int lastbid,
- char *trans_buffer)
+ char *trans_buffer,
+ menu_t *root, menu_t *parent)
{
static char Fexit; // 用來跳出 recursion
- menu_t me;
+ menu_t me = {0};
char fname[PATHLEN];
int ch, returnvalue = FULLUPDATE;
@@ -1035,7 +1038,13 @@ a_menu(const char *maintitle, const char *path,
if(trans_buffer)
trans_buffer[0] = '\0';
- memset(&me, 0, sizeof(me));
+ if (parent)
+ {
+ parent->next = &me;
+ } else {
+ root = &me;
+ }
+
Fexit = 0;
me.header_size = p_lines;
me.header = (fileheader_t *) calloc(me.header_size, FHSZ);
@@ -1148,6 +1157,28 @@ a_menu(const char *maintitle, const char *path,
me.page = 9999;
break;
+ case Ctrl('W'):
+ // XXX look up current location (utilize path and .DIR lookup)
+ move(1, 0); clrtobot(); outs("我在哪?\n");
+ {
+ menu_t *p;
+ int lvl = 0, num = 0;
+
+ for (p = root; p != NULL && lvl < t_lines - 3; p = p->next, lvl++)
+ {
+ prints("%*s", lvl, "");
+ if (num)
+ prints("%d. ", num);
+ prints("%s\n", p->mtitle);
+
+ // print in next round..
+ num = p->now +1;
+ }
+ }
+ vmsg(NULL);
+ me.page = 9999;
+ break;
+
case 'e':
case 'E':
snprintf(fname, sizeof(fname),
@@ -1275,8 +1306,9 @@ a_menu(const char *maintitle, const char *path,
break;
}
} else if (dashd(fname)) {
- a_menu(me.header[me.now - me.page].title, fname,
- me.level, me.bid, trans_buffer);
+ a_menu_rec(me.header[me.now - me.page].title, fname,
+ me.level, me.bid, trans_buffer, root, &me);
+ me.next = NULL;
/* Ptt 強力跳出recursive */
if (Fexit) {
free(me.header);
@@ -1408,6 +1440,16 @@ a_menu(const char *maintitle, const char *path,
}
int
+a_menu(const char *maintitle, const char *path,
+ int lastlevel, int lastbid,
+ char *trans_buffer)
+{
+ return a_menu_rec(maintitle, path,
+ lastlevel, lastbid, trans_buffer,
+ NULL, NULL);
+}
+
+int
Announce(void)
{
setutmpmode(ANNOUNCE);