summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-05-31 17:08:43 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-05-31 17:08:43 +0800
commit8c28203de4580efafd474e9015acc692e7810ddf (patch)
tree38a80781af523ee4f6f0e2a7cd9008964cd1c422
parent6f7163ba4a2e022b620447c7defa81ae90fbdda0 (diff)
downloadpttbbs-8c28203de4580efafd474e9015acc692e7810ddf.tar
pttbbs-8c28203de4580efafd474e9015acc692e7810ddf.tar.gz
pttbbs-8c28203de4580efafd474e9015acc692e7810ddf.tar.bz2
pttbbs-8c28203de4580efafd474e9015acc692e7810ddf.tar.lz
pttbbs-8c28203de4580efafd474e9015acc692e7810ddf.tar.xz
pttbbs-8c28203de4580efafd474e9015acc692e7810ddf.tar.zst
pttbbs-8c28203de4580efafd474e9015acc692e7810ddf.zip
reindent for ptt and fix '='
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2040 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/read.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/mbbsd/read.c b/mbbsd/read.c
index be6e681d..f4c2a4b2 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -264,35 +264,40 @@ thread(keeploc_t * locmem, int stypen)
{
fileheader_t fh;
int pos = locmem->crs_ln, jump = 200, new_ln;
- int fd = -1, step = stypen & RS_FORWARD ? 1 : -1;
+ int fd = -1, step = stypen & RS_FORWARD ? 1 : -1, amatch = -1;
char *key =
(stypen & RS_AUTHOR ? headers[pos - locmem->top_ln].owner :
(subject( stypen & RS_CURRENT ?
currtitle :
headers[pos - locmem->top_ln].title )));
- for(new_ln = pos + step ;
- new_ln > 0 && new_ln <= last_line && --jump>0;
- new_ln += step) {
+ for( new_ln = pos + step ;
+ new_ln > 0 && new_ln <= last_line && --jump > 0;
+ new_ln += step ) {
get_record_keep(currdirect, &fh, sizeof(fileheader_t), new_ln, &fd);
- if(stypen & RS_TITLE){
- if(stypen & RS_FIRST) {
- if(!strcmp(fh.title, key)) break;
+ if( stypen & RS_TITLE ){
+ if( stypen & RS_FIRST ){
+ if( !strcmp(fh.title, key) )
+ break;
+ else if( !strcmp(&fh.title[4], key) )
+ amatch = new_ln;
}
- else
- if(!strcmp(subject(fh.title), key)) break;
+ else if( !strcmp(subject(fh.title), key) )
+ break;
}
- else if(stypen & RS_NEWPOST){
- if(strncmp(fh.title,"Re:",3)) break;
+ else if( stypen & RS_NEWPOST ){
+ if( strncmp(fh.title, "Re:", 3) )
+ break;
}
else{ // RS_AUTHOR
- if(!strcmp(subject(fh.owner), key)) break;
+ if( !strcmp(subject(fh.owner), key) )
+ break;
}
}
if( fd != -1 )
close(fd);
- if( jump <=0 || new_ln<=0 || new_ln > last_line )
- new_ln = pos; //didn't find
+ if( jump <= 0 || new_ln <= 0 || new_ln > last_line )
+ new_ln = (amatch == -1 ? pos : amatch); //didn't find
else{
strncpy(currtitle, fh.title, TTLEN);
strncpy(currtitle, fh.title, TTLEN);