diff options
author | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-04-05 11:59:57 +0800 |
---|---|---|
committer | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-04-05 11:59:57 +0800 |
commit | eb80beb9396a32ba29e0f239a4a5ce095dbe4a12 (patch) | |
tree | 919e7b37141281db6cdd7175e10170fd577047ef /mbbsd/brc.c | |
parent | 33a2861676cb7b10025bffb62192dded48a49ee7 (diff) | |
download | pttbbs-eb80beb9396a32ba29e0f239a4a5ce095dbe4a12.tar pttbbs-eb80beb9396a32ba29e0f239a4a5ce095dbe4a12.tar.gz pttbbs-eb80beb9396a32ba29e0f239a4a5ce095dbe4a12.tar.bz2 pttbbs-eb80beb9396a32ba29e0f239a4a5ce095dbe4a12.tar.lz pttbbs-eb80beb9396a32ba29e0f239a4a5ce095dbe4a12.tar.xz pttbbs-eb80beb9396a32ba29e0f239a4a5ce095dbe4a12.tar.zst pttbbs-eb80beb9396a32ba29e0f239a4a5ce095dbe4a12.zip |
Ignoring duplicated board record in old file.
git-svn-id: http://opensvn.csie.org/pttbbs/branches/scw.brc2@1693 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/brc.c')
-rw-r--r-- | mbbsd/brc.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/mbbsd/brc.c b/mbbsd/brc.c index 3219d238..71a59ff7 100644 --- a/mbbsd/brc.c +++ b/mbbsd/brc.c @@ -222,18 +222,33 @@ read_old_brc(int fd) char brdname[BRC_STRLEN + 1]; char *ptr; brcnbrd_t num; + brcbid_t bid; + brcbid_t read_brd[512]; + int nRead = 0, i; ptr = brc_buf; brc_size = 0; while (read(fd, brdname, BRC_STRLEN + 1) == BRC_STRLEN + 1) { num = brdname[BRC_STRLEN]; brdname[BRC_STRLEN] = 0; - *(brcbid_t*)ptr = getbnum(brdname); + bid = getbnum(brdname); + + for (i = 0; i < nRead; ++i) + if (read_brd[i] == bid) + break; + if (i != nRead){ + lseek(fd, num * sizeof(int), SEEK_CUR); + continue; + } + read_brd[nRead >= 512 ? nRead = 0 : nRead++] = bid; + + *(brcbid_t*)ptr = bid; ptr += sizeof(brcbid_t); *(brcnbrd_t*)ptr = num; ptr += sizeof(brcnbrd_t); if (read(fd, ptr, sizeof(int) * num) != sizeof(int) * num) break; + brc_size += sizeof(brcbid_t) + sizeof(brcnbrd_t) + sizeof(time_t) * num; ptr += sizeof(time_t) * num; |