From 4c2c59e33a17407453b34493ccd0e3fd7a6f4da6 Mon Sep 17 00:00:00 2001 From: ptt Date: Sat, 29 Jun 2002 13:50:46 +0000 Subject: try toplazyBM git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@375 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- util/toplazyBM.c | 6 +++--- util/util_cache.c | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'util') diff --git a/util/toplazyBM.c b/util/toplazyBM.c index a2a34b94..b55d6a26 100644 --- a/util/toplazyBM.c +++ b/util/toplazyBM.c @@ -1,4 +1,4 @@ -/* $Id: toplazyBM.c,v 1.5 2002/06/19 13:38:01 lwms Exp $ */ +/* $Id: toplazyBM.c,v 1.6 2002/06/29 13:50:46 ptt Exp $ */ #include "bbs.h" @@ -22,7 +22,7 @@ typedef struct BMarray{ char *bmname; int flag; } BMArray; -BMArray bms[3]; +BMArray bms[5]; int bmlostdays_cmp(const void *va, const void *vb) @@ -118,7 +118,7 @@ int main(int argc, char *argv[]) j++; } index++; - } while((p=strtok(NULL,"/ "))!=NULL); + } while((p=strtok(NULL,"/ "))!=NULL && index<5); if(flag == 1){ //boardheader_t *fhp = 0; diff --git a/util/util_cache.c b/util/util_cache.c index 4a53cd2c..4cf0ff1f 100644 --- a/util/util_cache.c +++ b/util/util_cache.c @@ -1,4 +1,4 @@ -/* $Id: util_cache.c,v 1.4 2002/06/09 12:51:07 in2 Exp $ */ +/* $Id: util_cache.c,v 1.5 2002/06/29 13:50:46 ptt Exp $ */ #include #include #include @@ -339,14 +339,17 @@ void touch_boards() { void reset_board(int bid) { int fd; + boardheader_t bh; if(--bid<0)return; if(SHM->Bbusystate==0) { SHM->Bbusystate = 1; if((fd = open(fn_board, O_RDONLY)) > 0) { lseek(fd, (off_t)(bid * sizeof(boardheader_t)), SEEK_SET); - read(fd, &bcache[bid], sizeof(boardheader_t)); + read(fd, &bh , sizeof(boardheader_t)); close(fd); + if(bh.brdname[0] && !strcmp(bh.brdname,bcache[bid].brdname)) + memcpy(&bcache[bid],&bh, sizeof(boardheader_t)); } SHM->Bbusystate = 0; } -- cgit v1.2.3