summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-24 10:54:10 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-24 10:54:10 +0800
commit6d2bbbc9932595ea1a0ef4732864d077c01ff010 (patch)
tree9636c10104002a09eeb82601ae5adfa6460acf49
parentb35685ff078b08f1b87bbe12ab3422e8abaf19c0 (diff)
downloadpttbbs-6d2bbbc9932595ea1a0ef4732864d077c01ff010.tar
pttbbs-6d2bbbc9932595ea1a0ef4732864d077c01ff010.tar.gz
pttbbs-6d2bbbc9932595ea1a0ef4732864d077c01ff010.tar.bz2
pttbbs-6d2bbbc9932595ea1a0ef4732864d077c01ff010.tar.lz
pttbbs-6d2bbbc9932595ea1a0ef4732864d077c01ff010.tar.xz
pttbbs-6d2bbbc9932595ea1a0ef4732864d077c01ff010.tar.zst
pttbbs-6d2bbbc9932595ea1a0ef4732864d077c01ff010.zip
fix forever loop in read.c
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1841 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/read.c63
1 files changed, 29 insertions, 34 deletions
diff --git a/mbbsd/read.c b/mbbsd/read.c
index b2db9715..133c85b5 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -809,7 +809,7 @@ void
i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey_t * rcmdlist, int bidcache)
{
keeploc_t *locmem = NULL;
- int recbase = 0, mode, lastmode;
+ int recbase = 0, mode, lastmode, last_ln;
int num = 0, entries = 0, n_bottom=0;
int i;
char currdirect0[64], default_ch = 0;
@@ -903,46 +903,41 @@ i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey
bottom_line);
if(mode == READ_SKIP)
mode = lastmode;
- switch(mode) // 以下這幾種 mode 要再處理游標
- {
- case READ_PREV:
- default_ch = 'r';
- lastmode = mode;
+ // 以下這幾種 mode 要再處理游標
+ if(mode == READ_PREV || mode == READ_NEXT || mode == RELATE_PREV ||
+ mode == RELATE_FIRST || mode == 'A' || mode == 'a' )
+ {
+ lastmode = mode;
+ last_ln = locmem->crs_ln;
+
+ switch(mode)
+ {
+ case READ_PREV:
mode = cursor_pos(locmem, locmem->crs_ln - 1, 10);
- break;
- case READ_NEXT:
- default_ch = 'r';
- lastmode = mode;
+ break;
+ case READ_NEXT:
mode = cursor_pos(locmem, locmem->crs_ln + 1, 10);
- break;
- case RELATE_PREV:
- default_ch = 'r';
- lastmode = mode;
+ break;
+ case RELATE_PREV:
mode = thread(locmem, RELATE_PREV, &locmem->crs_ln);
- break;
- case RELATE_NEXT:
- default_ch = 'r';
- lastmode = mode;
+ break;
+ case RELATE_NEXT:
mode = thread(locmem, RELATE_NEXT, &locmem->crs_ln);
- break;
- case RELATE_FIRST:
- default_ch = 'r';
- lastmode = mode;
+ break;
+ case RELATE_FIRST:
mode = thread(locmem, RELATE_FIRST, &locmem->crs_ln);
- break;
- case 'A':
- default_ch = 'r';
- lastmode = mode;
+ break;
+ case 'A':
mode = thread(locmem, 'A', &locmem->crs_ln);
- break;
- case 'a':
- default_ch = 'r';
- lastmode = mode;
+ break;
+ case 'a':
mode = thread(locmem, 'a', &locmem->crs_ln);
- break;
- default:
- default_ch=0;
- }
+ break;
+ }
+ if(locmem->crs_ln != last_ln) default_ch = 'r';
+ }
+ else
+ default_ch=0;
} while (mode != DOQUIT);
#undef FHSZ