diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-09-08 11:33:23 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-09-08 11:33:23 +0800 |
commit | ca5ee5b2867227c04827eb952685f8212715d1c7 (patch) | |
tree | 7368ccbd42c18f5ddb373fbf747aa90f4510a23a | |
parent | 8a3a6d8827cf9ba4073dbdff48e0cdfeb7d012c3 (diff) | |
download | pttbbs-ca5ee5b2867227c04827eb952685f8212715d1c7.tar pttbbs-ca5ee5b2867227c04827eb952685f8212715d1c7.tar.gz pttbbs-ca5ee5b2867227c04827eb952685f8212715d1c7.tar.bz2 pttbbs-ca5ee5b2867227c04827eb952685f8212715d1c7.tar.lz pttbbs-ca5ee5b2867227c04827eb952685f8212715d1c7.tar.xz pttbbs-ca5ee5b2867227c04827eb952685f8212715d1c7.tar.zst pttbbs-ca5ee5b2867227c04827eb952685f8212715d1c7.zip |
* merge trunk
* merge current
* allow view old 'goodpost' just like old numlogin
git-svn-id: http://opensvn.csie.org/pttbbs/branches/pttbbs.pwcu@4820 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/proto.h | 4 | ||||
-rw-r--r-- | mbbsd/user.c | 3 | ||||
-rw-r--r-- | util/mandex.c | 37 |
3 files changed, 33 insertions, 11 deletions
diff --git a/include/proto.h b/include/proto.h index a70298b3..ea232c78 100644 --- a/include/proto.h +++ b/include/proto.h @@ -53,11 +53,7 @@ void BlogMain(int); #endif /* assess */ -int inc_goodpost(const char *, int num); int inc_badpost(const char *, int num); -int inc_goodsale(const char *, int num); -int inc_badsale(const char *, int num); -//void set_assess(int uid, unsigned char num, int type); /* bbs */ void delete_allpost(const char *userid); diff --git a/mbbsd/user.c b/mbbsd/user.c index 1656869c..b6bc04b0 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -208,7 +208,8 @@ user_display(const userec_t * u, int adminmode) // conditional fields #ifdef ASSESS - prints("\t\t劣文數目: %d\n", u->badpost); + prints("\t\t劣文數目: %u (舊優文結算: %u)\n", + (unsigned int)u->badpost, (unsigned int)u->goodpost); #endif // ASSESS #ifdef CHESSCOUNTRY diff --git a/util/mandex.c b/util/mandex.c index eb8de895..14399476 100644 --- a/util/mandex.c +++ b/util/mandex.c @@ -108,6 +108,7 @@ man_index(const char * brdname) stat(buf, &st); curr_brdinfo.k = st.st_size; printf("(%s)[%dK] d: %d f: %d\n", buf, curr_brdinfo.k, curr_brdinfo.ndir, curr_brdinfo.nfile); + fflush(stdout); // in case the output is redirected... setdirpath(fpath, buf, fn_index); rename(buf, fpath); @@ -198,7 +199,7 @@ output_chart(const boardinfo_t * board, const int nbrds) } fclose(fp); } -static boardinfo_t board[MAX_BOARD]; +static boardinfo_t board[MAX_BOARD+1]; static const char dirs[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', @@ -257,10 +258,22 @@ int main(int argc, char* argv[]) /* process all boards */ if (checkrebuild && (fd = open("man/.rank.cache", O_RDONLY)) >= 0) { + int dirty = 0; read(fd, board, sizeof(board)); close(fd); qsort(board, MAX_BOARD, sizeof(boardinfo_t), sortbyname); - for (nb = 0; board[nb].bname[0] != 0; ++nb); + for (nb = 0; board[nb].bname[0] != 0; ++nb) { + /* delete non-exist boards */ + if (getbnum(board[nb].bname) == 0) { + memset(&(board[nb]), 0, sizeof(boardinfo_t)); + dirty = 1; + } + } + /* sort again if dirty */ + if (dirty) { + qsort(board, MAX_BOARD, sizeof(boardinfo_t), sortbyname); + for (nb = 0; board[nb].bname[0] != 0; ++nb); + } nSorted = nb; } else { memset(board, 0, sizeof(board)); @@ -285,6 +298,7 @@ int main(int argc, char* argv[]) sprintf(fpath, "man/boards/%c/%s/.rebuild", dirs[i], fname); if (access(fpath, 0) < 0) { printf("skip no modify board %s\n", fname); + fflush(stdout); // in case the output is redirected... continue; } unlink(fpath); @@ -292,11 +306,22 @@ int main(int argc, char* argv[]) man_index(fname); - if (curr_brdinfo.k) { - if (!(biptr = bsearch(fname, board, nSorted, sizeof(boardinfo_t), sortbyname))) - biptr = &board[nb++]; - memcpy(biptr, &curr_brdinfo, sizeof(boardinfo_t)); + if (!curr_brdinfo.k) + continue; + + // determine if this board was not seen in partial update queue + biptr = bsearch(fname, board, nSorted, sizeof(boardinfo_t), sortbyname); + if (!biptr) + { + // give up if exceeded max entry + if (nb >= MAX_BOARD) + continue; + biptr = &board[nb++]; } + + // update record + assert(biptr); + memcpy(biptr, &curr_brdinfo, sizeof(boardinfo_t)); } closedir(dirp); } |