version 1.5, 2001/05/03 20:43:12 |
version 1.6, 2001/05/23 22:20:36 |
|
|
} SRCHCOM; |
} SRCHCOM; |
|
|
static int isearch __P((int)); |
static int isearch __P((int)); |
static VOID is_cpush __P((int)); |
static void is_cpush __P((int)); |
static VOID is_lpush __P((void)); |
static void is_lpush __P((void)); |
static VOID is_pop __P((void)); |
static void is_pop __P((void)); |
static int is_peek __P((void)); |
static int is_peek __P((void)); |
static VOID is_undo __P((int *, int *)); |
static void is_undo __P((int *, int *)); |
static int is_find __P((int)); |
static int is_find __P((int)); |
static VOID is_prompt __P((int, int, int)); |
static void is_prompt __P((int, int, int)); |
static VOID is_dspl __P((char *, int)); |
static void is_dspl __P((char *, int)); |
static int eq __P((int, int)); |
static int eq __P((int, int)); |
|
|
static SRCHCOM cmds[NSRCH]; |
static SRCHCOM cmds[NSRCH]; |
|
|
for (cip = 0; cip < NSRCH; cip++) |
for (cip = 0; cip < NSRCH; cip++) |
cmds[cip].s_code = SRCH_NOPR; |
cmds[cip].s_code = SRCH_NOPR; |
|
|
(VOID)strcpy(opat, pat); |
(void)strcpy(opat, pat); |
cip = 0; |
cip = 0; |
pptr = -1; |
pptr = -1; |
clp = curwp->w_dotp; |
clp = curwp->w_dotp; |
|
|
curwp->w_doto = cbo; |
curwp->w_doto = cbo; |
curwp->w_flag |= WFMOVE; |
curwp->w_flag |= WFMOVE; |
srch_lastdir = dir; |
srch_lastdir = dir; |
(VOID)ctrlg(FFRAND, 0); |
(void)ctrlg(FFRAND, 0); |
(VOID)strcpy(pat, opat); |
(void)strcpy(pat, opat); |
return ABORT; |
return ABORT; |
case CCHR(']'): |
case CCHR(']'): |
case CCHR('S'): |
case CCHR('S'): |
|
|
break; |
break; |
is_lpush(); |
is_lpush(); |
pptr = strlen(pat); |
pptr = strlen(pat); |
(VOID)forwchar(FFRAND, 1); |
(void)forwchar(FFRAND, 1); |
if (is_find(SRCH_FORW) != FALSE) |
if (is_find(SRCH_FORW) != FALSE) |
is_cpush(SRCH_MARK); |
is_cpush(SRCH_MARK); |
else { |
else { |
(VOID)backchar(FFRAND, 1); |
(void)backchar(FFRAND, 1); |
ttbeep(); |
ttbeep(); |
success = FALSE; |
success = FALSE; |
} |
} |
|
|
break; |
break; |
is_lpush(); |
is_lpush(); |
pptr = strlen(pat); |
pptr = strlen(pat); |
(VOID)backchar(FFRAND, 1); |
(void)backchar(FFRAND, 1); |
if (is_find(SRCH_BACK) != FALSE) |
if (is_find(SRCH_BACK) != FALSE) |
is_cpush(SRCH_MARK); |
is_cpush(SRCH_MARK); |
else { |
else { |
(VOID)forwchar(FFRAND, 1); |
(void)forwchar(FFRAND, 1); |
ttbeep(); |
ttbeep(); |
success = FALSE; |
success = FALSE; |
} |
} |
|
|
/* NOTREACHED */ |
/* NOTREACHED */ |
} |
} |
|
|
static VOID |
static void |
is_cpush(cmd) |
is_cpush(cmd) |
int cmd; |
int cmd; |
{ |
{ |
|
|
cmds[cip].s_code = cmd; |
cmds[cip].s_code = cmd; |
} |
} |
|
|
static VOID |
static void |
is_lpush() |
is_lpush() |
{ |
{ |
int ctp; |
int ctp; |
|
|
cmds[ctp].s_dotp = curwp->w_dotp; |
cmds[ctp].s_dotp = curwp->w_dotp; |
} |
} |
|
|
static VOID |
static void |
is_pop() |
is_pop() |
{ |
{ |
if (cmds[cip].s_code != SRCH_NOPR) { |
if (cmds[cip].s_code != SRCH_NOPR) { |
|
|
} |
} |
|
|
/* this used to always return TRUE (the return value was checked) */ |
/* this used to always return TRUE (the return value was checked) */ |
static VOID |
static void |
is_undo(pptr, dir) |
is_undo(pptr, dir) |
int *pptr, *dir; |
int *pptr, *dir; |
{ |
{ |
|
|
plen = strlen(pat); |
plen = strlen(pat); |
if (plen != 0) { |
if (plen != 0) { |
if (dir == SRCH_FORW) { |
if (dir == SRCH_FORW) { |
(VOID)backchar(FFARG | FFRAND, plen); |
(void)backchar(FFARG | FFRAND, plen); |
if (forwsrch() == FALSE) { |
if (forwsrch() == FALSE) { |
curwp->w_doto = odoto; |
curwp->w_doto = odoto; |
curwp->w_dotp = odotp; |
curwp->w_dotp = odotp; |
|
|
return TRUE; |
return TRUE; |
} |
} |
if (dir == SRCH_BACK) { |
if (dir == SRCH_BACK) { |
(VOID)forwchar(FFARG | FFRAND, plen); |
(void)forwchar(FFARG | FFRAND, plen); |
if (backsrch() == FALSE) { |
if (backsrch() == FALSE) { |
curwp->w_doto = odoto; |
curwp->w_doto = odoto; |
curwp->w_dotp = odotp; |
curwp->w_dotp = odotp; |
|
|
* on if it liked the "dir". However, none of the callers looked at the |
* on if it liked the "dir". However, none of the callers looked at the |
* status, so I just made the checking vanish. |
* status, so I just made the checking vanish. |
*/ |
*/ |
static VOID |
static void |
is_prompt(dir, flag, success) |
is_prompt(dir, flag, success) |
int dir, flag, success; |
int dir, flag, success; |
{ |
{ |
|
|
* Prompt writing routine for the incremental search. The "prompt" is just |
* Prompt writing routine for the incremental search. The "prompt" is just |
* a string. The "flag" determines whether pat should be printed. |
* a string. The "flag" determines whether pat should be printed. |
*/ |
*/ |
static VOID |
static void |
is_dspl(prompt, flag) |
is_dspl(prompt, flag) |
char *prompt; |
char *prompt; |
int flag; |
int flag; |
|
|
goto stopsearch; |
goto stopsearch; |
/* ^G or ESC */ |
/* ^G or ESC */ |
case CCHR('G'): |
case CCHR('G'): |
(VOID)ctrlg(FFRAND, 0); |
(void)ctrlg(FFRAND, 0); |
case CCHR('['): |
case CCHR('['): |
goto stopsearch; |
goto stopsearch; |
case '!': |
case '!': |
|
|
|
|
/* specified */ |
/* specified */ |
if (s == TRUE) |
if (s == TRUE) |
(VOID) strcpy(pat, tpat); |
(void) strcpy(pat, tpat); |
/* CR, but old one */ |
/* CR, but old one */ |
else if (s == FALSE && pat[0] != 0) |
else if (s == FALSE && pat[0] != 0) |
s = TRUE; |
s = TRUE; |