summaryrefslogtreecommitdiffstats
path: root/mbbsd/record.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-14 19:50:05 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-14 19:50:05 +0800
commita298d6c46128c1b594e39578024933a696de741f (patch)
treee07278a6e7ddeefa6f308cf83b0085c45e3e42f5 /mbbsd/record.c
parentd9e73c38f6bdb4e85ba58ccb2382f15eb9186335 (diff)
downloadpttbbs-a298d6c46128c1b594e39578024933a696de741f.tar
pttbbs-a298d6c46128c1b594e39578024933a696de741f.tar.gz
pttbbs-a298d6c46128c1b594e39578024933a696de741f.tar.bz2
pttbbs-a298d6c46128c1b594e39578024933a696de741f.tar.lz
pttbbs-a298d6c46128c1b594e39578024933a696de741f.tar.xz
pttbbs-a298d6c46128c1b594e39578024933a696de741f.tar.zst
pttbbs-a298d6c46128c1b594e39578024933a696de741f.zip
- bbs: add title for AID display
- xyz: prevent mmap crash for note_ans - pfterm/screen: add getyx_ansi - fav: add ASKBOARD to new account default favs - record: add setaidfile() git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3834 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/record.c')
-rw-r--r--mbbsd/record.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/mbbsd/record.c b/mbbsd/record.c
index 37d15870..17811fb8 100644
--- a/mbbsd/record.c
+++ b/mbbsd/record.c
@@ -626,3 +626,39 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char *
return 0;
}
+
+void
+setaidfile(char *buf, const char *bn, aidu_t aidu)
+{
+ // try to load by AID
+ int bid = 0;
+ int n = 0, fd = 0;
+ char bfpath[PATHLEN] = "";
+ boardheader_t *bh = NULL;
+ fileheader_t fh;
+
+ buf[0] = 0;
+ bid = getbnum(bn);
+
+ if (bid <= 0) return;
+ assert(0<=bid-1 && bid-1<MAX_BOARD);
+ bh = getbcache(bid);
+ if (!HasBoardPerm(bh)) return;
+
+ setbfile(bfpath, bh->brdname, FN_DIR);
+ n = search_aidu(bfpath, aidu);
+
+ if (n < 0) return;
+ fd = open(bfpath, O_RDONLY);
+ if (fd < 0) return;
+
+ lseek(fd, n*sizeof(fileheader_t), SEEK_SET);
+ memset(&fh, 0, sizeof(fh));
+ if (read(fd, &fh, sizeof(fh)) > 0)
+ {
+ setbfile(buf, bh->brdname, fh.filename);
+ if (!dashf(buf))
+ buf[0] = 0;
+ }
+ close(fd);
+}