diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-04-15 20:05:52 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-04-15 20:05:52 +0800 |
commit | 1a77a39f25006a3f73b36365220c3168c59f9fd2 (patch) | |
tree | 9c4fc1c9715dfeaad11cb8bcc159b6cf23e9c417 /mbbsd/more.c | |
parent | 5894f7afe1f35469e766a3c3fd6f6b0ee806a31a (diff) | |
download | pttbbs-1a77a39f25006a3f73b36365220c3168c59f9fd2.tar pttbbs-1a77a39f25006a3f73b36365220c3168c59f9fd2.tar.gz pttbbs-1a77a39f25006a3f73b36365220c3168c59f9fd2.tar.bz2 pttbbs-1a77a39f25006a3f73b36365220c3168c59f9fd2.tar.lz pttbbs-1a77a39f25006a3f73b36365220c3168c59f9fd2.tar.xz pttbbs-1a77a39f25006a3f73b36365220c3168c59f9fd2.tar.zst pttbbs-1a77a39f25006a3f73b36365220c3168c59f9fd2.zip |
MDCACHE
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@103 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/more.c')
-rw-r--r-- | mbbsd/more.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/mbbsd/more.c b/mbbsd/more.c index f7755874..a65c1ee5 100644 --- a/mbbsd/more.c +++ b/mbbsd/more.c @@ -1,4 +1,4 @@ -/* $Id: more.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */ +/* $Id: more.c,v 1.2 2002/04/15 12:05:52 in2 Exp $ */ #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -193,7 +193,7 @@ static int readln(FILE *fp, char *buf) { extern userec_t cuser; static int more_web(char *fpath, int promptend); - +extern int *GLOBE; int more(char *fpath, int promptend) { extern char* strcasestr(); static char *head[4] = {"作者", "標題", "時間" ,"轉信"}; @@ -232,8 +232,23 @@ int more(char *fpath, int promptend) { search_char0 = *search_str; *search_str = 0; - +#ifdef MDCACHE + if( strncmp(fpath, "boards/", 7) == 0 || strncmp(fpath, "etc/", 4) == 0 ){ + /* we only cache boards/ and etc/ */ + char *cpath = cachepath(fpath); + ++GLOBE[0]; + if( (fd = open(cpath, O_RDONLY)) < 0 ){ + if( (fd = updatemdcache(cpath, fpath)) < 0 ) + return -1; + } + else + ++GLOBE[1]; + } + else + fd = open (fpath, O_RDONLY, 0600); +#else fd = open (fpath, O_RDONLY, 0600); +#endif if (fd < 0) return -1; if(fstat(fd, &st) || ((fsize = st.st_size) <= 0) || S_ISDIR (st.st_mode)) |