From 7b49f01537bef297dea74e3e1129a90594d955fb Mon Sep 17 00:00:00 2001 From: ptt Date: Thu, 8 Apr 2004 05:37:44 +0000 Subject: push bottom complete git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1731 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/bbs.c | 5 ++--- mbbsd/cache.c | 9 ++++----- mbbsd/read.c | 6 ++++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index b0d3b140..92376ed7 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -2329,9 +2329,9 @@ push_bottom(int ent, fileheader_t * fhdr, char *direct) strcpy(buf, direct); else sprintf(buf, "%s.bottom", direct); - num = get_num_records(buf, sizeof(fileheader_t)); + num = getbottomtotal(currbid); if(getans(fhdr->filemode & FILE_BOTTOM ? - "¨ú®ø¸m©³¤½½§i?(y/N)": + "¨ú®ø¸m©³¤½§i?(y/N)": "¥[¤J¸m©³¤½§i?(y/N)")!='y') return READ_REDRAW; fhdr->filemode ^= FILE_BOTTOM; if(fhdr->filemode & FILE_BOTTOM) @@ -2357,7 +2357,6 @@ push_bottom(int ent, fileheader_t * fhdr, char *direct) } setbottomtotal(currbid); touchdircache(currbid); - load_fileheader_bottom_cache(currbid, direct); return DIRCHANGED; } diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 67864fa8..698da5c7 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -518,7 +518,7 @@ touchdircache(int bid) #if DIRCACHESIZE void -load_fileheader_bottom_cache(int bid, char *direct) +load_fileheader_bottom_cache(int bid, char *bottompath) { int num = getbtotal(bid), n_bottom = getbottomtotal(bid); int n = num - DIRCACHESIZE + n_bottom + 1; @@ -530,9 +530,7 @@ load_fileheader_bottom_cache(int bid, char *direct) } if(n_bottom) { - char path[256]; - sprintf(path, "%s.bottom", direct); - get_records(path, &SHM->dircache[bid - 1][dirsize], + get_records(bottompath, &SHM->dircache[bid - 1][dirsize], sizeof(fileheader_t), 1, n_bottom); } } @@ -731,8 +729,9 @@ setbottomtotal(int bid) { boardheader_t *bh = getbcache(bid); char genbuf[256]; - setbfile(genbuf, bh->brdname, ".BOTTOM"); + setbfile(genbuf, bh->brdname, ".DIR.bottom"); SHM->n_bottom[bid-1]=get_num_records(genbuf, sizeof(fileheader_t)); + load_fileheader_bottom_cache(currbid, genbuf); } void setbtotal(int bid) diff --git a/mbbsd/read.c b/mbbsd/read.c index ede71f6a..e96a9449 100644 --- a/mbbsd/read.c +++ b/mbbsd/read.c @@ -821,7 +821,6 @@ i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey if( (last_line = getbtotal(currbid)) == 0 ){ setbtotal(currbid); setbottomtotal(currbid); - load_fileheader_bottom_cache(currbid, currdirect); last_line = get_num_records(currdirect, FHSZ); } sprintf(directbottom, "%s.bottom", direct); @@ -873,7 +872,10 @@ i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey case PARTUPDATE: if (last_line < locmem->top_ln + p_lines) { if (bidcache > 0 && !(currmode & (MODE_SELECT | MODE_DIGEST))) - num = getbtotal(currbid)+getbottomtotal(currbid); + { + bottom_line = getbtotal(currbid); + num = bottom_line+getbottomtotal(currbid); + } else num = get_num_records(currdirect, FHSZ); -- cgit v1.2.3