version 1.12, 2014/04/14 20:10:33 |
version 1.13, 2014/04/25 13:38:21 |
|
|
/* |
/* |
* Copyright (C) 1984-2011 Mark Nudelman |
* Copyright (C) 1984-2012 Mark Nudelman |
* |
* |
* You may distribute under the terms of either the GNU General Public |
* You may distribute under the terms of either the GNU General Public |
* License or the Less License, as specified in the README file. |
* License or the Less License, as specified in the README file. |
* |
* |
* For more information about less, or for information on how to |
* For more information, see the README file. |
* contact the author, see the README file. |
|
*/ |
*/ |
|
|
|
|
|
|
extern int secure; |
extern int secure; |
extern int hshift; |
extern int hshift; |
extern int show_attn; |
extern int show_attn; |
|
extern POSITION highest_hilite; |
extern char *every_first_cmd; |
extern char *every_first_cmd; |
extern char *curr_altfilename; |
extern char *curr_altfilename; |
extern char version[]; |
extern char version[]; |
|
|
static void |
static void |
start_mca(action, prompt, mlist, cmdflags) |
start_mca(action, prompt, mlist, cmdflags) |
int action; |
int action; |
char *prompt; |
constant char *prompt; |
void *mlist; |
constant void *mlist; |
int cmdflags; |
int cmdflags; |
{ |
{ |
mca = action; |
mca = action; |
|
|
static void |
static void |
prompt() |
prompt() |
{ |
{ |
register char *p; |
register constant char *p; |
|
|
if (ungot != NULL) |
if (ungot != NULL) |
{ |
{ |
|
|
} |
} |
|
|
/* |
/* |
|
* Forward forever, or until a highlighted line appears. |
|
*/ |
|
static int |
|
forw_loop(until_hilite) |
|
int until_hilite; |
|
{ |
|
POSITION curr_len; |
|
|
|
if (ch_getflags() & CH_HELPFILE) |
|
return (A_NOACTION); |
|
|
|
cmd_exec(); |
|
jump_forw(); |
|
curr_len = ch_length(); |
|
highest_hilite = until_hilite ? curr_len : NULL_POSITION; |
|
ignore_eoi = 1; |
|
while (!sigs) |
|
{ |
|
if (until_hilite && highest_hilite > curr_len) |
|
{ |
|
bell(); |
|
break; |
|
} |
|
make_display(); |
|
forward(1, 0, 0); |
|
} |
|
ignore_eoi = 0; |
|
ch_set_eof(); |
|
|
|
/* |
|
* This gets us back in "F mode" after processing |
|
* a non-abort signal (e.g. window-change). |
|
*/ |
|
if (sigs && !ABORT_SIGS()) |
|
return (until_hilite ? A_F_UNTIL_HILITE : A_F_FOREVER); |
|
|
|
return (A_NOACTION); |
|
} |
|
|
|
/* |
* Main command processor. |
* Main command processor. |
* Accept and execute commands until a quit command. |
* Accept and execute commands until a quit command. |
*/ |
*/ |
|
|
IFILE old_ifile; |
IFILE old_ifile; |
IFILE new_ifile; |
IFILE new_ifile; |
char *tagfile; |
char *tagfile; |
|
int until_hilite = 0; |
|
|
search_type = SRCH_FORW; |
search_type = SRCH_FORW; |
wscroll = (sc_height + 1) / 2; |
wscroll = (sc_height + 1) / 2; |
|
|
/* |
/* |
* Forward forever, ignoring EOF. |
* Forward forever, ignoring EOF. |
*/ |
*/ |
if (ch_getflags() & CH_HELPFILE) |
newaction = forw_loop(0); |
break; |
|
cmd_exec(); |
|
jump_forw(); |
|
ignore_eoi = 1; |
|
while (!sigs) |
|
{ |
|
make_display(); |
|
forward(1, 0, 0); |
|
} |
|
ignore_eoi = 0; |
|
/* |
|
* This gets us back in "F mode" after processing |
|
* a non-abort signal (e.g. window-change). |
|
*/ |
|
if (sigs && !ABORT_SIGS()) |
|
newaction = A_F_FOREVER; |
|
if (less_is_more) |
if (less_is_more) |
quit_at_eof = OPT_ON; |
quit_at_eof = OPT_ON; |
break; |
break; |
|
|
|
case A_F_UNTIL_HILITE: |
|
newaction = forw_loop(1); |
|
break; |
|
|
case A_F_SCROLL: |
case A_F_SCROLL: |
/* |
/* |
* Forward N lines |
* Forward N lines |
|
|
break; |
break; |
|
|
case A_HELP: |
case A_HELP: |
#if !SMALL |
|
/* |
/* |
* Help. |
* Help. |
*/ |
*/ |
|
#if !SMALL |
if (ch_getflags() & CH_HELPFILE) |
if (ch_getflags() & CH_HELPFILE) |
break; |
break; |
if (ungot != NULL || unget_end) { |
if (ungot != NULL || unget_end) { |