From 0775e9d20c61f23d895fc92a499a69e031a211c0 Mon Sep 17 00:00:00 2001 From: ptt Date: Tue, 13 Apr 2004 13:37:53 +0000 Subject: simplify the code git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1750 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/bbs.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 07bc4159..dd631f1a 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -2324,14 +2324,10 @@ board_etc() static int push_bottom(int ent, fileheader_t * fhdr, char *direct) { - int num, i; + int num; char buf[256]; if ((currmode & MODE_DIGEST) || !(currmode & MODE_BOARD)) return DONOTHING; - if(strstr(direct, ".bottom")) - strcpy(buf, direct); - else - sprintf(buf, "%s.bottom", direct); num = getbottomtotal(currbid); if(getans(fhdr->filemode & FILE_BOTTOM ? "取消置底公告?(y/N)": @@ -2339,6 +2335,7 @@ push_bottom(int ent, fileheader_t * fhdr, char *direct) fhdr->filemode ^= FILE_BOTTOM; if(fhdr->filemode & FILE_BOTTOM) { + sprintf(buf, "%s.bottom", direct); if(num >= 5) { vmsg("不得超過 5 篇重要公告 請精簡!"); @@ -2348,14 +2345,7 @@ push_bottom(int ent, fileheader_t * fhdr, char *direct) } else { - fileheader_t headers[5]; - if(num>5) num=5; - num = get_records(buf, &headers, sizeof(fileheader_t), 1, num); - for(i=0; ifilename, headers[i].filename)) - delete_record(buf, sizeof(fileheader_t), i+1); - } + num = delete_record(direct, sizeof(fileheader_t), ent); } setbottomtotal(currbid); touchdircache(currbid); -- cgit v1.2.3