#include "less.h"
#if MSDOS_COMPILER==WIN32C
#include <windows.h>
#endif
#include "position.h"
#include "option.h"
#include "cmd.h"
extern int erase_char, erase2_char, kill_char;
extern int sigs;
extern int quit_if_one_screen;
extern int squished;
extern int hit_eof;
extern int sc_width;
extern int sc_height;
extern int swindow;
extern int jump_sline;
extern int quitting;
extern int wscroll;
extern int top_scroll;
extern int ignore_eoi;
extern int secure;
extern int hshift;
extern int show_attn;
extern int less_is_more;
extern char *every_first_cmd;
extern char *curr_altfilename;
extern char version[];
extern struct scrpos initial_scrpos;
extern IFILE curr_ifile;
extern void constant *ml_search;
extern void constant *ml_examine;
#if SHELL_ESCAPE || PIPEC
extern void constant *ml_shell;
#endif
#if EDITOR
extern char *editor;
extern char *editproto;
#endif
extern int screen_trashed;
extern int shift_count;
extern int oldbot;
extern int forw_prompt;
extern int file_errors;
extern int unix2003_compat;
extern int add_newline;
extern char * active_dashp_command;
extern int display_next_file_or_exit;
static char ungot[UNGOT_SIZE];
static char *ungotp = NULL;
#if SHELL_ESCAPE
static char *shellcmd = NULL;
#endif
static int mca;
static int search_type;
static LINENUM number;
static long fraction;
static char optchar;
static int optflag;
static int optgetname;
static POSITION bottompos;
static int save_hshift;
#if PIPEC
static char pipec;
#endif
static void multi_search();
static void
cmd_exec()
{
clear_attn();
clear_bot();
flush();
}
static void
start_mca(action, prompt, mlist, cmdflags)
int action;
char *prompt;
void *mlist;
int cmdflags;
{
mca = action;
clear_bot();
clear_cmd();
cmd_putstr(prompt);
set_mlist(mlist, cmdflags);
}
public int
in_mca()
{
return (mca != 0 && mca != A_PREFIX);
}
static void
mca_search()
{
if (search_type & SRCH_FORW)
mca = A_F_SEARCH;
else
mca = A_B_SEARCH;
clear_bot();
clear_cmd();
if (search_type & SRCH_NO_MATCH)
cmd_putstr("Non-match ");
if (search_type & SRCH_FIRST_FILE)
cmd_putstr("First-file ");
if (search_type & SRCH_PAST_EOF)
cmd_putstr("EOF-ignore ");
if (search_type & SRCH_NO_MOVE)
cmd_putstr("Keep-pos ");
if (search_type & SRCH_NO_REGEX)
cmd_putstr("Regex-off ");
if (search_type & SRCH_FORW)
cmd_putstr("/");
else
cmd_putstr("?");
set_mlist(ml_search, 0);
}
static void
mca_opt_toggle()
{
int no_prompt;
int flag;
char *dash;
no_prompt = (optflag & OPT_NO_PROMPT);
flag = (optflag & ~OPT_NO_PROMPT);
dash = (flag == OPT_NO_TOGGLE) ? "_" : "-";
mca = A_OPT_TOGGLE;
clear_bot();
clear_cmd();
cmd_putstr(dash);
if (optgetname)
cmd_putstr(dash);
if (no_prompt)
cmd_putstr("(P)");
switch (flag)
{
case OPT_UNSET:
cmd_putstr("+");
break;
case OPT_SET:
cmd_putstr("!");
break;
}
set_mlist(NULL, 0);
}
static void
exec_mca()
{
register char *cbuf;
cmd_exec();
cbuf = get_cmdbuf();
switch (mca)
{
case A_F_SEARCH:
case A_B_SEARCH:
multi_search(cbuf, (int) number);
break;
case A_FIRSTCMD:
while (*cbuf == '+' || *cbuf == ' ')
cbuf++;
if (every_first_cmd != NULL)
free(every_first_cmd);
if (*cbuf == '\0')
every_first_cmd = NULL;
else
every_first_cmd = save(cbuf);
break;
case A_OPT_TOGGLE:
toggle_option(optchar, cbuf, optflag);
optchar = '\0';
break;
case A_F_BRACKET:
match_brac(cbuf[0], cbuf[1], 1, (int) number);
break;
case A_B_BRACKET:
match_brac(cbuf[1], cbuf[0], 0, (int) number);
break;
#if EXAMINE
case A_EXAMINE:
if (secure)
break;
if (edit_list(cbuf)) {
if (unix2003_compat) {
number = 1;
jump_back(number);
}
}
#if TAGS
cleantags();
#endif
break;
#endif
#if SHELL_ESCAPE
case A_SHELL:
if (*cbuf != '!')
{
if (shellcmd != NULL)
free(shellcmd);
shellcmd = fexpand(cbuf);
}
if (secure)
break;
if (shellcmd == NULL)
lsystem("", "!done");
else
lsystem(shellcmd, "!done");
break;
#endif
#if PIPEC
case A_PIPE:
if (secure)
break;
(void) pipe_mark(pipec, cbuf);
error("|done", NULL_PARG);
break;
#endif
}
}
static int
mca_char(c)
int c;
{
char *p;
int flag;
char buf[3];
PARG parg;
switch (mca)
{
case 0:
return (NO_MCA);
case A_PREFIX:
return (NO_MCA);
case A_DIGIT:
if (!((c >= '0' && c <= '9') || c == '.') &&
editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE|EC_NORIGHTLEFT) == A_INVALID)
{
number = cmd_int(&fraction);
mca = 0;
cmd_accept();
return (NO_MCA);
}
break;
case A_OPT_TOGGLE:
if (optchar == '\0' && len_cmdbuf() == 0)
{
flag = (optflag & ~OPT_NO_PROMPT);
if (flag == OPT_NO_TOGGLE)
{
switch (c)
{
case '_':
optgetname = TRUE;
mca_opt_toggle();
return (MCA_MORE);
}
} else
{
switch (c)
{
case '+':
optflag = (flag == OPT_UNSET) ?
OPT_TOGGLE : OPT_UNSET;
mca_opt_toggle();
return (MCA_MORE);
case '!':
optflag = (flag == OPT_SET) ?
OPT_TOGGLE : OPT_SET;
mca_opt_toggle();
return (MCA_MORE);
case CONTROL('P'):
optflag ^= OPT_NO_PROMPT;
mca_opt_toggle();
return (MCA_MORE);
case '-':
optgetname = TRUE;
mca_opt_toggle();
return (MCA_MORE);
}
}
}
if (optgetname)
{
struct loption *o;
char *oname;
int lc;
if (c == '\n' || c == '\r')
{
if (optchar == '\0')
{
parg.p_string = get_cmdbuf();
error("There is no --%s option", &parg);
return (MCA_DONE);
}
optgetname = FALSE;
cmd_reset();
c = optchar;
} else
{
if (optchar != '\0')
{
if (c == erase_char ||
c == erase2_char ||
c == kill_char)
return (MCA_DONE);
return (MCA_MORE);
}
if (cmd_char(c) == CC_QUIT)
return (MCA_DONE);
p = get_cmdbuf();
lc = ASCII_IS_LOWER(p[0]);
o = findopt_name(&p, &oname, NULL);
if (o != NULL)
{
optchar = o->oletter;
if (!lc && ASCII_IS_LOWER(optchar))
optchar = ASCII_TO_UPPER(optchar);
cmd_reset();
mca_opt_toggle();
for (p = oname; *p != '\0'; p++)
{
c = *p;
if (!lc && ASCII_IS_LOWER(c))
c = ASCII_TO_UPPER(c);
if (cmd_char(c) != CC_OK)
return (MCA_DONE);
}
}
return (MCA_MORE);
}
} else
{
if (c == erase_char || c == erase2_char || c == kill_char)
break;
if (optchar != '\0')
break;
}
optchar = c;
if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE ||
single_char_option(c))
{
toggle_option(c, "", optflag);
return (MCA_DONE);
}
if ((p = opt_prompt(c)) == NULL)
{
buf[0] = '-';
buf[1] = c;
buf[2] = '\0';
p = buf;
}
start_mca(A_OPT_TOGGLE, p, (void*)NULL, 0);
return (MCA_MORE);
case A_F_SEARCH:
case A_B_SEARCH:
if (active_dashp_command) {
add_newline = 1;
}
if (len_cmdbuf() > 0)
break;
flag = 0;
switch (c)
{
case '*':
if (less_is_more)
break;
case CONTROL('E'):
flag = SRCH_PAST_EOF;
break;
case '@':
if (less_is_more)
break;
case CONTROL('F'):
flag = SRCH_FIRST_FILE;
break;
case CONTROL('K'):
flag = SRCH_NO_MOVE;
break;
case CONTROL('R'):
flag = SRCH_NO_REGEX;
break;
case CONTROL('N'):
case '!':
flag = SRCH_NO_MATCH;
break;
}
if (flag != 0)
{
search_type ^= flag;
mca_search();
return (MCA_MORE);
}
break;
}
if (c == '\n' || c == '\r')
{
exec_mca();
return (MCA_DONE);
}
if (cmd_char(c) == CC_QUIT)
return (MCA_DONE);
if ((mca == A_F_BRACKET || mca == A_B_BRACKET) && len_cmdbuf() >= 2)
{
exec_mca();
return (MCA_DONE);
}
return (MCA_MORE);
}
static void
clear_buffers()
{
if (!(ch_getflags() & CH_CANSEEK))
return;
ch_flush();
clr_linenum();
#if HILITE_SEARCH
clr_hilite();
#endif
}
static void
make_display()
{
if (empty_screen())
{
if (initial_scrpos.pos == NULL_POSITION)
jump_loc(ch_zero(), 1);
else
jump_loc(initial_scrpos.pos, initial_scrpos.ln);
} else if (screen_trashed)
{
int save_top_scroll = top_scroll;
int save_ignore_eoi = ignore_eoi;
top_scroll = 1;
ignore_eoi = 0;
if (screen_trashed == 2)
{
reopen_curr_ifile();
jump_forw();
}
repaint();
top_scroll = save_top_scroll;
ignore_eoi = save_ignore_eoi;
}
}
static void
prompt()
{
register char *p;
if (ungotp != NULL && ungotp > ungot)
{
return;
}
make_display();
bottompos = position(BOTTOM_PLUS_ONE);
if ((get_quit_at_eof() == OPT_ONPLUS || quit_if_one_screen) &&
hit_eof && !(ch_getflags() & CH_HELPFILE) &&
next_ifile(curr_ifile) == NULL_IFILE)
{
if (file_errors)
if (unix2003_compat)
quit(QUIT_ERROR);
quit(QUIT_OK);
}
quit_if_one_screen = FALSE;
#if 0
if (get_quit_at_eof() && squished &&
next_ifile(curr_ifile) == NULL_IFILE)
quit(QUIT_OK);
#endif
#if MSDOS_COMPILER==WIN32C
if (!(ch_getflags() & CH_HELPFILE))
SetConsoleTitle(pr_expand("Less?f - %f.", 0));
#endif
if (!forw_prompt)
clear_bot();
clear_cmd();
forw_prompt = 0;
p = pr_string();
if (p == NULL || *p == '\0')
putchr(':');
else
{
at_enter(AT_STANDOUT);
putstr(p);
at_exit();
}
clear_eol();
}
public void
dispversion()
{
PARG parg;
parg.p_string = version;
error("less %s", &parg);
}
public int
getcc()
{
if (ungotp == NULL)
return (getchr());
if (ungotp > ungot)
return (*--ungotp);
ungotp = NULL;
if (len_cmdbuf() == 0 || !empty_screen())
return (getchr());
switch (mca)
{
case A_DIGIT:
return ('g');
case A_F_SEARCH:
case A_B_SEARCH:
return ('\n');
default:
return (getchr());
}
}
public void
ungetcc(c)
int c;
{
if (ungotp == NULL)
ungotp = ungot;
if (ungotp >= ungot + sizeof(ungot))
{
error("ungetcc overflow", NULL_PARG);
quit(QUIT_ERROR);
}
*ungotp++ = c;
}
public void
ungetsc(s)
char *s;
{
register char *p;
for (p = s + strlen(s) - 1; p >= s; p--)
ungetcc(*p);
}
static void
multi_search(pattern, n)
char *pattern;
int n;
{
register int nomore;
IFILE save_ifile;
int changed_file;
changed_file = 0;
save_ifile = save_curr_ifile();
if (search_type & SRCH_FIRST_FILE)
{
if (search_type & SRCH_FORW)
nomore = edit_first();
else
nomore = edit_last();
if (nomore)
{
unsave_ifile(save_ifile);
return;
}
changed_file = 1;
search_type &= ~SRCH_FIRST_FILE;
}
for (;;)
{
n = search(search_type, pattern, n);
search_type &= ~SRCH_NO_MOVE;
if (n == 0)
{
unsave_ifile(save_ifile);
return;
}
if (n < 0)
break;
if ((search_type & SRCH_PAST_EOF) == 0)
break;
if (search_type & SRCH_FORW)
nomore = edit_next(1);
else
nomore = edit_prev(1);
if (nomore)
break;
changed_file = 1;
}
if (n > 0)
error("Pattern not found", NULL_PARG);
if (changed_file)
{
reedit_ifile(save_ifile);
} else
{
unsave_ifile(save_ifile);
}
}
public void
commands()
{
register int c;
register int action;
register char *cbuf;
int newaction;
int save_search_type;
char *extra;
char tbuf[2];
PARG parg;
IFILE old_ifile;
IFILE new_ifile;
char *tagfile;
search_type = SRCH_FORW;
if (unix2003_compat) {
wscroll = (sc_height) / 2;
} else {
wscroll = (sc_height + 1) / 2;
}
newaction = A_NOACTION;
for (;;)
{
mca = 0;
cmd_accept();
number = 0;
optchar = '\0';
if (sigs)
{
psignals();
if (quitting)
quit(QUIT_SAVED_STATUS);
}
check_winch();
cmd_reset();
prompt();
if (sigs)
continue;
if (newaction == A_NOACTION)
c = getcc();
again:
if (sigs)
continue;
if (newaction != A_NOACTION)
{
action = newaction;
newaction = A_NOACTION;
} else
{
if (mca)
switch (mca_char(c))
{
case MCA_MORE:
c = getcc();
goto again;
case MCA_DONE:
continue;
case NO_MCA:
break;
}
if (mca)
{
if (cmd_char(c) == CC_QUIT || len_cmdbuf() == 0)
continue;
cbuf = get_cmdbuf();
} else
{
tbuf[0] = c;
tbuf[1] = '\0';
cbuf = tbuf;
}
extra = NULL;
action = fcmd_decode(cbuf, &extra);
if (extra != NULL)
ungetsc(extra);
}
if (action != A_PREFIX)
cmd_reset();
display_next_file_or_exit = 0;
switch (action)
{
case A_DIGIT:
start_mca(A_DIGIT, ":", (void*)NULL, CF_QUIT_ON_ERASE);
goto again;
case A_F_WINDOW:
if (number > 0)
swindow = (int) number;
case A_F_SCREEN:
display_next_file_or_exit = 1;
if (number <= 0)
number = get_swindow();
cmd_exec();
if (show_attn)
set_attnpos(bottompos);
forward((int) number, 0, 1);
break;
case A_B_WINDOW:
if (number > 0)
swindow = (int) number;
case A_B_SCREEN:
if (number <= 0)
number = get_swindow();
cmd_exec();
backward((int) number, 0, 1);
break;
case A_F_LINE:
display_next_file_or_exit = 1;
if (number <= 0)
number = 1;
cmd_exec();
if (show_attn == OPT_ONPLUS && number > 1)
set_attnpos(bottompos);
forward((int) number, 0, 0);
break;
case A_B_LINE:
if (number <= 0)
number = 1;
cmd_exec();
backward((int) number, 0, 0);
break;
case A_FF_LINE:
if (number <= 0)
number = 1;
cmd_exec();
if (show_attn == OPT_ONPLUS && number > 1)
set_attnpos(bottompos);
forward((int) number, 1, 0);
break;
case A_BF_LINE:
if (number <= 0)
number = 1;
cmd_exec();
backward((int) number, 1, 0);
break;
case A_FF_SCREEN:
if (number <= 0)
number = get_swindow();
cmd_exec();
if (show_attn == OPT_ONPLUS)
set_attnpos(bottompos);
forward((int) number, 1, 0);
break;
case A_F_FOREVER:
if (ch_getflags() & CH_HELPFILE)
break;
cmd_exec();
jump_forw();
ignore_eoi = 1;
hit_eof = 0;
while (!sigs)
{
make_display();
forward(1, 0, 0);
}
ignore_eoi = 0;
if (sigs && !ABORT_SIGS())
newaction = A_F_FOREVER;
break;
case A_F_SCROLL:
display_next_file_or_exit = 1;
if (number > 0)
wscroll = (int) number;
cmd_exec();
if (show_attn == OPT_ONPLUS)
set_attnpos(bottompos);
forward(wscroll, 0, 0);
break;
case A_B_SCROLL:
if (number > 0)
wscroll = (int) number;
cmd_exec();
backward(wscroll, 0, 0);
break;
case A_FREPAINT:
clear_buffers();
case A_REPAINT:
cmd_exec();
repaint();
break;
case A_GOLINE:
if (number <= 0)
number = 1;
cmd_exec();
jump_back(number);
break;
case A_PERCENT:
if (number < 0)
{
number = 0;
fraction = 0;
}
if (number > 100)
{
number = 100;
fraction = 0;
}
cmd_exec();
jump_percent((int) number, fraction);
break;
case A_GOEND:
cmd_exec();
if (number <= 0)
jump_forw();
else
jump_back(number);
break;
case A_GOPOS:
cmd_exec();
if (number < 0)
number = 0;
jump_line_loc((POSITION) number, jump_sline);
break;
case A_STAT:
if (ch_getflags() & CH_HELPFILE)
break;
cmd_exec();
parg.p_string = eq_message();
error("%s", &parg);
break;
case A_VERSION:
cmd_exec();
dispversion();
break;
case A_QUIT:
if (curr_ifile != NULL_IFILE &&
ch_getflags() & CH_HELPFILE)
{
hshift = save_hshift;
if (edit_prev(1) == 0)
break;
}
if (extra != NULL)
quit(*extra);
if (file_errors)
if (unix2003_compat)
quit(QUIT_ERROR);
quit(QUIT_OK);
break;
#define DO_SEARCH() \
if (number <= 0) number = 1; \
mca_search(); \
cmd_exec(); \
multi_search((char *)NULL, (int) number);
case A_F_SEARCH:
search_type = SRCH_FORW;
if (number <= 0)
number = 1;
mca_search();
c = getcc();
goto again;
case A_B_SEARCH:
search_type = SRCH_BACK;
if (number <= 0)
number = 1;
mca_search();
c = getcc();
goto again;
case A_AGAIN_SEARCH:
DO_SEARCH();
break;
case A_T_AGAIN_SEARCH:
search_type |= SRCH_PAST_EOF;
DO_SEARCH();
break;
case A_REVERSE_SEARCH:
save_search_type = search_type;
search_type = SRCH_REVERSE(search_type);
DO_SEARCH();
search_type = save_search_type;
break;
case A_T_REVERSE_SEARCH:
save_search_type = search_type;
search_type = SRCH_REVERSE(search_type);
search_type |= SRCH_PAST_EOF;
DO_SEARCH();
search_type = save_search_type;
break;
case A_UNDO_SEARCH:
undo_search();
break;
case A_HELP:
if (ch_getflags() & CH_HELPFILE)
break;
cmd_exec();
save_hshift = hshift;
hshift = 0;
(void) edit(FAKE_HELPFILE);
break;
case A_EXAMINE:
#if EXAMINE
if (secure)
{
error("Command not available", NULL_PARG);
break;
}
start_mca(A_EXAMINE, "Examine: ", ml_examine, 0);
c = getcc();
goto again;
#else
error("Command not available", NULL_PARG);
break;
#endif
case A_VISUAL:
#if EDITOR
if (secure)
{
error("Command not available", NULL_PARG);
break;
}
if (ch_getflags() & CH_HELPFILE)
break;
if (strcmp(get_filename(curr_ifile), "-") == 0)
{
error("Cannot edit standard input", NULL_PARG);
break;
}
if (curr_altfilename != NULL)
{
error("WARNING: This file was viewed via LESSOPEN",
NULL_PARG);
}
start_mca(A_SHELL, "!", ml_shell, 0);
make_display();
cmd_exec();
lsystem(pr_expand(editproto, 0), (char*)NULL);
break;
#else
error("Command not available", NULL_PARG);
break;
#endif
case A_NEXT_FILE:
#if TAGS
if (ntags())
{
error("No next file", NULL_PARG);
break;
}
#endif
if (number <= 0)
number = 1;
if (edit_next((int) number))
{
if (get_quit_at_eof() && hit_eof &&
!(ch_getflags() & CH_HELPFILE))
quit(QUIT_OK);
parg.p_string = (number > 1) ? "(N-th) " : "";
error("No %snext file", &parg);
}
break;
case A_PREV_FILE:
#if TAGS
if (ntags())
{
error("No previous file", NULL_PARG);
break;
}
#endif
if (number <= 0)
number = 1;
if (edit_prev((int) number))
{
parg.p_string = (number > 1) ? "(N-th) " : "";
error("No %sprevious file", &parg);
}
break;
case A_NEXT_TAG:
#if TAGS
if (number <= 0)
number = 1;
tagfile = nexttag((int) number);
if (tagfile == NULL)
{
error("No next tag", NULL_PARG);
break;
}
if (edit(tagfile) == 0)
{
POSITION pos = tagsearch();
if (pos != NULL_POSITION)
jump_loc(pos, jump_sline);
}
#else
error("Command not available", NULL_PARG);
#endif
break;
case A_PREV_TAG:
#if TAGS
if (number <= 0)
number = 1;
tagfile = prevtag((int) number);
if (tagfile == NULL)
{
error("No previous tag", NULL_PARG);
break;
}
if (edit(tagfile) == 0)
{
POSITION pos = tagsearch();
if (pos != NULL_POSITION)
jump_loc(pos, jump_sline);
}
#else
error("Command not available", NULL_PARG);
#endif
break;
case A_INDEX_FILE:
if (number <= 0)
number = 1;
if (edit_index((int) number))
error("No such file", NULL_PARG);
break;
case A_REMOVE_FILE:
if (ch_getflags() & CH_HELPFILE)
break;
old_ifile = curr_ifile;
new_ifile = getoff_ifile(curr_ifile);
if (new_ifile == NULL_IFILE)
{
bell();
break;
}
if (edit_ifile(new_ifile) != 0)
{
reedit_ifile(old_ifile);
break;
}
del_ifile(old_ifile);
break;
case A_OPT_TOGGLE:
optflag = OPT_TOGGLE;
optgetname = FALSE;
mca_opt_toggle();
c = getcc();
goto again;
case A_DISP_OPTION:
optflag = OPT_NO_TOGGLE;
optgetname = FALSE;
mca_opt_toggle();
c = getcc();
goto again;
case A_FIRSTCMD:
start_mca(A_FIRSTCMD, "+", (void*)NULL, 0);
c = getcc();
goto again;
case A_SHELL:
#if SHELL_ESCAPE
if (secure)
{
error("Command not available", NULL_PARG);
break;
}
start_mca(A_SHELL, "!", ml_shell, 0);
c = getcc();
goto again;
#else
error("Command not available", NULL_PARG);
break;
#endif
case A_SETMARK:
if (ch_getflags() & CH_HELPFILE)
break;
start_mca(A_SETMARK, "mark: ", (void*)NULL, 0);
c = getcc();
if (c == erase_char || c == erase2_char ||
c == kill_char || c == '\n' || c == '\r')
break;
setmark(c);
break;
case A_GOMARK:
start_mca(A_GOMARK, "goto mark: ", (void*)NULL, 0);
c = getcc();
if (c == erase_char || c == erase2_char ||
c == kill_char || c == '\n' || c == '\r')
break;
cmd_exec();
gomark(c);
break;
case A_PIPE:
#if PIPEC
if (secure)
{
error("Command not available", NULL_PARG);
break;
}
start_mca(A_PIPE, "|mark: ", (void*)NULL, 0);
c = getcc();
if (c == erase_char || c == erase2_char || c == kill_char)
break;
if (c == '\n' || c == '\r')
c = '.';
if (badmark(c))
break;
pipec = c;
start_mca(A_PIPE, "!", ml_shell, 0);
c = getcc();
goto again;
#else
error("Command not available", NULL_PARG);
break;
#endif
case A_B_BRACKET:
case A_F_BRACKET:
start_mca(action, "Brackets: ", (void*)NULL, 0);
c = getcc();
goto again;
case A_LSHIFT:
if (number > 0)
shift_count = number;
else
number = (shift_count > 0) ?
shift_count : sc_width / 2;
if (number > hshift)
number = hshift;
hshift -= number;
screen_trashed = 1;
break;
case A_RSHIFT:
if (number > 0)
shift_count = number;
else
number = (shift_count > 0) ?
shift_count : sc_width / 2;
hshift += number;
screen_trashed = 1;
break;
case A_PREFIX:
if (mca != A_PREFIX)
{
cmd_reset();
start_mca(A_PREFIX, " ", (void*)NULL,
CF_QUIT_ON_ERASE);
(void) cmd_char(c);
}
c = getcc();
goto again;
case A_NOACTION:
break;
default:
bell();
break;
}
}
}