1 /* $NetBSD: command.c,v 1.5 2013/09/04 19:44:21 tron Exp $ */
4 * Copyright (C) 1984-2012 Mark Nudelman
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Less License, as specified in the README file.
9 * For more information, see the README file.
14 * User-level command processor.
18 #if MSDOS_COMPILER==WIN32C
25 extern int erase_char
, erase2_char
, kill_char
;
27 extern int quit_if_one_screen
;
32 extern int jump_sline
;
35 extern int top_scroll
;
36 extern int ignore_eoi
;
40 extern POSITION highest_hilite
;
41 extern char *every_first_cmd
;
42 extern char *curr_altfilename
;
43 extern char version
[];
44 extern struct scrpos initial_scrpos
;
45 extern IFILE curr_ifile
;
46 extern void constant
*ml_search
;
47 extern void * constant ml_examine
;
48 #if SHELL_ESCAPE || PIPEC
49 extern void * constant ml_shell
;
53 extern char *editproto
;
55 extern int screen_trashed
; /* The screen has been overwritten */
56 extern int shift_count
;
58 extern int forw_prompt
;
59 extern int be_helpful
;
62 static int helpprompt
;
65 static char *shellcmd
= NULL
; /* For holding last shell command for "!!" */
67 static int mca
; /* The multicharacter command (action) */
68 static int search_type
; /* The previous type of search */
69 static LINENUM number
; /* The number typed by the user */
70 static long fraction
; /* The fractional part of the number */
71 static struct loption
*curropt
;
74 static int optgetname
;
75 static POSITION bottompos
;
76 static int save_hshift
;
82 struct ungot
*ug_next
;
85 static struct ungot
* ungot
= NULL
;
86 static int unget_end
= 0;
88 static void multi_search();
91 * Move the cursor to start of prompt line before executing a command.
92 * This looks nicer if the command takes a long time before
93 * updating the screen.
106 * Set up the display to start a new multi-character command.
109 start_mca(action
, prompt
, mlist
, cmdflags
)
111 constant
char *prompt
;
112 constant
void *mlist
;
119 set_mlist(mlist
, cmdflags
);
125 return (mca
!= 0 && mca
!= A_PREFIX
);
129 * Set up the display to start a new search command.
135 if (search_type
& SRCH_FILTER
)
139 if (search_type
& SRCH_FORW
)
147 if (search_type
& SRCH_NO_MATCH
)
148 cmd_putstr("Non-match ");
149 if (search_type
& SRCH_FIRST_FILE
)
150 cmd_putstr("First-file ");
151 if (search_type
& SRCH_PAST_EOF
)
152 cmd_putstr("EOF-ignore ");
153 if (search_type
& SRCH_NO_MOVE
)
154 cmd_putstr("Keep-pos ");
155 if (search_type
& SRCH_NO_REGEX
)
156 cmd_putstr("Regex-off ");
159 if (search_type
& SRCH_FILTER
)
163 if (search_type
& SRCH_FORW
)
167 set_mlist(ml_search
, 0);
171 * Set up the display to start a new toggle-option command.
180 no_prompt
= (optflag
& OPT_NO_PROMPT
);
181 flag
= (optflag
& ~OPT_NO_PROMPT
);
182 dash
= (flag
== OPT_NO_TOGGLE
) ? "_" : "-";
205 * Execute a multicharacter command.
219 multi_search(cbuf
, (int) number
);
223 search_type
^= SRCH_NO_MATCH
;
224 set_filter_pattern(cbuf
, search_type
);
229 * Skip leading spaces or + signs in the string.
231 while (*cbuf
== '+' || *cbuf
== ' ')
233 if (every_first_cmd
!= NULL
)
234 free(every_first_cmd
);
236 every_first_cmd
= NULL
;
238 every_first_cmd
= save(cbuf
);
241 toggle_option(curropt
, opt_lower
, cbuf
, optflag
);
245 match_brac(cbuf
[0], cbuf
[1], 1, (int) number
);
248 match_brac(cbuf
[1], cbuf
[0], 0, (int) number
);
256 /* If tag structure is loaded then clean it up. */
264 * !! just uses whatever is in shellcmd.
265 * Otherwise, copy cmdbuf to shellcmd,
266 * expanding any special characters ("%" or "#").
270 if (shellcmd
!= NULL
)
272 shellcmd
= fexpand(cbuf
);
277 if (shellcmd
== NULL
)
278 lsystem("", "!done");
280 lsystem(shellcmd
, "!done");
287 (void) pipe_mark(pipec
, cbuf
);
288 error("|done", NULL_PARG
);
295 * Is a character an erase or kill char?
301 return (c
== erase_char
|| c
== erase2_char
|| c
== kill_char
);
305 * Handle the first char of an option (after the initial dash).
308 mca_opt_first_char(c
)
311 int flag
= (optflag
& ~OPT_NO_PROMPT
);
312 if (flag
== OPT_NO_TOGGLE
)
317 /* "__" = long option name. */
328 optflag
= (flag
== OPT_UNSET
) ?
329 OPT_TOGGLE
: OPT_UNSET
;
334 optflag
= (flag
== OPT_SET
) ?
335 OPT_TOGGLE
: OPT_SET
;
339 optflag
^= OPT_NO_PROMPT
;
343 /* "--" = long option name. */
349 /* Char was not handled here. */
354 * Add a char to a long option name.
355 * See if we've got a match for an option name yet.
356 * If so, display the complete name and stop
357 * accepting chars until user hits RETURN.
360 mca_opt_nonfirst_char(c
)
369 * Already have a match for the name.
370 * Don't accept anything but erase/kill.
372 if (is_erase_char(c
))
377 * Add char to cmd buffer and try to match
380 if (cmd_char(c
) == CC_QUIT
)
383 opt_lower
= ASCII_IS_LOWER(p
[0]);
384 curropt
= findopt_name(&p
, &oname
, NULL
);
389 * Remember the option and
390 * display the full option name.
394 for (p
= oname
; *p
!= '\0'; p
++)
397 if (!opt_lower
&& ASCII_IS_LOWER(c
))
398 c
= ASCII_TO_UPPER(c
);
399 if (cmd_char(c
) != CC_OK
)
407 * Handle a char of an option toggle command.
416 * This may be a short option (single char),
417 * or one char of a long option name,
418 * or one char of the option parameter.
420 if (curropt
== NULL
&& len_cmdbuf() == 0)
422 int ret
= mca_opt_first_char(c
);
428 /* We're getting a long option name. */
429 if (c
!= '\n' && c
!= '\r')
430 return (mca_opt_nonfirst_char(c
));
433 parg
.p_string
= get_cmdbuf();
434 error("There is no --%s option", &parg
);
441 if (is_erase_char(c
))
444 /* We're getting the option parameter. */
446 curropt
= findopt(c
);
449 parg
.p_string
= propt(c
);
450 error("There is no %s option", &parg
);
455 * If the option which was entered does not take a
456 * parameter, toggle the option immediately,
457 * so user doesn't have to hit RETURN.
459 if ((optflag
& ~OPT_NO_PROMPT
) != OPT_TOGGLE
||
460 !opt_has_param(curropt
))
462 toggle_option(curropt
, ASCII_IS_LOWER(c
), "", optflag
);
466 * Display a prompt appropriate for the option parameter.
468 start_mca(A_OPT_TOGGLE
, opt_prompt(curropt
), (void*)NULL
, 0);
473 * Handle a char of a search command.
482 * Certain characters as the first char of
483 * the pattern have special meaning:
484 * ! Toggle the NO_MATCH flag
485 * * Toggle the PAST_EOF flag (less extension)
486 * @ Toggle the FIRST_FILE flag (less extension)
488 if (len_cmdbuf() > 0)
496 case CONTROL('E'): /* ignore END of file */
498 flag
= SRCH_PAST_EOF
;
503 case CONTROL('F'): /* FIRST file */
505 flag
= SRCH_FIRST_FILE
;
507 case CONTROL('K'): /* KEEP position */
511 case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */
512 flag
= SRCH_NO_REGEX
;
514 case CONTROL('N'): /* NOT match */
516 flag
= SRCH_NO_MATCH
;
530 * Handle a character of a multi-character command.
542 * We're not in a multicharacter command.
548 * In the prefix of a command.
549 * This not considered a multichar command
550 * (even tho it uses cmdbuf, etc.).
551 * It is handled in the commands() switch.
557 * Entering digits of a number.
558 * Terminated by a non-digit.
560 if (!((c
>= '0' && c
<= '9') || c
== '.') &&
561 editchar(c
, EC_PEEK
|EC_NOHISTORY
|EC_NOCOMPLETE
|EC_NORIGHTLEFT
) == A_INVALID
)
564 * Not part of the number.
565 * End the number and treat this char
566 * as a normal command character.
568 number
= cmd_int(&fraction
);
576 ret
= mca_opt_char(c
);
584 ret
= mca_search_char(c
);
590 /* Other multicharacter command. */
595 * The multichar command is terminated by a newline.
597 if (c
== '\n' || c
== '\r')
600 * Execute the command.
607 * Append the char to the command buffer.
609 if (cmd_char(c
) == CC_QUIT
)
611 * Abort the multi-char command.
615 if ((mca
== A_F_BRACKET
|| mca
== A_B_BRACKET
) && len_cmdbuf() >= 2)
618 * Special case for the bracket-matching commands.
619 * Execute the command after getting exactly two
620 * characters from the user.
627 * Need another character.
633 * Discard any buffered file data.
638 if (!(ch_getflags() & CH_CANSEEK
))
648 * Make sure the screen is displayed.
654 * If nothing is displayed yet, display starting from initial_scrpos.
658 if (initial_scrpos
.pos
== NULL_POSITION
)
660 * {{ Maybe this should be:
661 * jump_loc(ch_zero(), jump_sline);
662 * but this behavior seems rather unexpected
663 * on the first screen. }}
665 jump_loc(ch_zero(), 1);
667 jump_loc(initial_scrpos
.pos
, initial_scrpos
.ln
);
668 } else if (screen_trashed
)
670 int save_top_scroll
= top_scroll
;
671 int save_ignore_eoi
= ignore_eoi
;
674 if (screen_trashed
== 2)
676 /* Special case used by ignore_eoi: re-open the input file
677 * and jump to the end of the file. */
682 top_scroll
= save_top_scroll
;
683 ignore_eoi
= save_ignore_eoi
;
688 * Display the appropriate prompt.
693 register constant
char *p
;
698 * No prompt necessary if commands are from
699 * ungotten chars rather than from the user.
705 * Make sure the screen is displayed.
708 bottompos
= position(BOTTOM_PLUS_ONE
);
711 * If we've hit EOF on the last file and the -E flag is set, quit.
713 if (get_quit_at_eof() == OPT_ONPLUS
&&
714 eof_displayed() && !(ch_getflags() & CH_HELPFILE
) &&
715 next_ifile(curr_ifile
) == NULL_IFILE
)
719 * If the entire file is displayed and the -F flag is set, quit.
721 if (quit_if_one_screen
&&
722 entire_file_displayed() && !(ch_getflags() & CH_HELPFILE
) &&
723 next_ifile(curr_ifile
) == NULL_IFILE
)
726 #if MSDOS_COMPILER==WIN32C
728 * In Win32, display the file name in the window title.
730 if (!(ch_getflags() & CH_HELPFILE
))
731 SetConsoleTitle(pr_expand("Less?f - %f.", 0));
734 * Select the proper prompt and display it.
737 * If the previous action was a forward movement,
738 * don't clear the bottom line of the display;
739 * just print the prompt since the forward movement guarantees
740 * that we're in the right position to display the prompt.
741 * Clearing the line could cause a problem: for example, if the last
742 * line displayed ended at the right screen edge without a newline,
743 * then clearing would clear the last displayed line rather than
751 at_enter(AT_STANDOUT
);
752 putstr("[Press 'h' for instructions.]");
759 if (p
== NULL
|| *p
== '\0')
763 at_enter(AT_STANDOUT
);
772 * Display the less version message.
779 parg
.p_string
= version
;
780 error("less %s", &parg
);
784 * Get command character.
785 * The character normally comes from the keyboard,
786 * but may come from ungotten characters
787 * (characters previously given to ungetcc or ungetsc).
795 * We have just run out of ungotten chars.
798 if (len_cmdbuf() == 0 || !empty_screen())
801 * Command is incomplete, so try to complete it.
807 * We have a number but no command. Treat as #g.
814 * We have "/string" but no newline. Add the \n.
820 * Some other incomplete command. Let user complete it.
829 * Normal case: no ungotten chars, so get one from the user.
835 * Return the next ungotten char.
838 struct ungot
*ug
= ungot
;
839 char c
= ug
->ug_char
;
842 unget_end
= (ungot
== NULL
);
848 * "Unget" a command character.
849 * The next getcc() will return this character.
855 struct ungot
*ug
= (struct ungot
*) ecalloc(1, sizeof(struct ungot
));
864 * Unget a whole string of command characters.
865 * The next sequence of getcc()'s will return this string.
873 for (p
= s
+ strlen(s
) - 1; p
>= s
; p
--)
878 * Search for a pattern, possibly in multiple files.
879 * If SRCH_FIRST_FILE is set, begin searching at the first file.
880 * If SRCH_PAST_EOF is set, continue the search thru multiple files.
883 multi_search(pattern
, n
)
892 save_ifile
= save_curr_ifile();
894 if (search_type
& SRCH_FIRST_FILE
)
897 * Start at the first (or last) file
898 * in the command line list.
900 if (search_type
& SRCH_FORW
)
901 nomore
= edit_first();
903 nomore
= edit_last();
906 unsave_ifile(save_ifile
);
910 search_type
&= ~SRCH_FIRST_FILE
;
915 n
= search(search_type
, pattern
, n
);
917 * The SRCH_NO_MOVE flag doesn't "stick": it gets cleared
918 * after being used once. This allows "n" to work after
919 * using a /@@ search.
921 search_type
&= ~SRCH_NO_MOVE
;
927 unsave_ifile(save_ifile
);
933 * Some kind of error in the search.
934 * Error message has been printed by search().
938 if ((search_type
& SRCH_PAST_EOF
) == 0)
940 * We didn't find a match, but we're
941 * supposed to search only one file.
945 * Move on to the next file.
947 if (search_type
& SRCH_FORW
)
948 nomore
= edit_next(1);
950 nomore
= edit_prev(1);
958 * Print an error message if we haven't already.
961 error("Pattern not found", NULL_PARG
);
966 * Restore the file we were originally viewing.
968 reedit_ifile(save_ifile
);
971 unsave_ifile(save_ifile
);
976 * Forward forever, or until a highlighted line appears.
979 forw_loop(until_hilite
)
984 if (ch_getflags() & CH_HELPFILE
)
989 curr_len
= ch_length();
990 highest_hilite
= until_hilite
? curr_len
: NULL_POSITION
;
994 if (until_hilite
&& highest_hilite
> curr_len
)
1006 * This gets us back in "F mode" after processing
1007 * a non-abort signal (e.g. window-change).
1009 if (sigs
&& !ABORT_SIGS())
1010 return (until_hilite
? A_F_UNTIL_HILITE
: A_F_FOREVER
);
1012 return (A_NOACTION
);
1016 * Main command processor.
1017 * Accept and execute commands until a quit command.
1023 register int action
;
1024 register char *cbuf
;
1026 int save_search_type
;
1033 int until_hilite
= 0;
1035 search_type
= SRCH_FORW
;
1036 wscroll
= (sc_height
+ 1) / 2;
1037 newaction
= A_NOACTION
;
1047 * See if any signals need processing.
1053 quit(QUIT_SAVED_STATUS
);
1057 * See if window size changed, for systems that don't
1058 * generate SIGWINCH.
1063 * Display prompt and accept a character.
1069 if (newaction
== A_NOACTION
)
1076 if (newaction
!= A_NOACTION
)
1079 newaction
= A_NOACTION
;
1083 * If we are in a multicharacter command, call mca_char.
1084 * Otherwise we call fcmd_decode to determine the
1085 * action to be performed.
1088 switch (mca_char(c
))
1092 * Need another character.
1098 * Command has been handled by mca_char.
1099 * Start clean with a prompt.
1104 * Not a multi-char command
1105 * (at least, not anymore).
1111 * Decode the command character and decide what to do.
1116 * We're in a multichar command.
1117 * Add the character to the command buffer
1118 * and display it on the screen.
1119 * If the user backspaces past the start
1120 * of the line, abort the command.
1122 if (cmd_char(c
) == CC_QUIT
|| len_cmdbuf() == 0)
1124 cbuf
= get_cmdbuf();
1128 * Don't use cmd_char if we're starting fresh
1129 * at the beginning of a command, because we
1130 * don't want to echo the command until we know
1131 * it is a multichar command. We also don't
1132 * want erase_char/kill_char to be treated
1133 * as line editing characters.
1140 action
= fcmd_decode(cbuf
, &extra
);
1142 * If an "extra" string was returned,
1143 * process it as a string of command characters.
1149 * Clear the cmdbuf string.
1150 * (But not if we're in the prefix of a command,
1151 * because the partial command string is kept there.)
1153 if (action
!= A_PREFIX
)
1160 * First digit of a number.
1162 start_mca(A_DIGIT
, ":", (void*)NULL
, CF_QUIT_ON_ERASE
);
1167 * Forward one window (and set the window size).
1170 swindow
= (int) number
;
1174 * Forward one screen.
1177 number
= get_swindow();
1180 set_attnpos(bottompos
);
1181 forward((int) number
, 0, 1);
1186 * Backward one window (and set the window size).
1189 swindow
= (int) number
;
1193 * Backward one screen.
1196 number
= get_swindow();
1198 backward((int) number
, 0, 1);
1203 * Forward N (default 1) line.
1208 if (show_attn
== OPT_ONPLUS
&& number
> 1)
1209 set_attnpos(bottompos
);
1210 forward((int) number
, 0, 0);
1215 * Backward N (default 1) line.
1220 backward((int) number
, 0, 0);
1225 * Force forward N (default 1) line.
1230 if (show_attn
== OPT_ONPLUS
&& number
> 1)
1231 set_attnpos(bottompos
);
1232 forward((int) number
, 1, 0);
1237 * Force backward N (default 1) line.
1242 backward((int) number
, 1, 0);
1247 * Force forward one screen.
1250 number
= get_swindow();
1252 if (show_attn
== OPT_ONPLUS
)
1253 set_attnpos(bottompos
);
1254 forward((int) number
, 1, 0);
1259 * Forward forever, ignoring EOF.
1261 newaction
= forw_loop(0);
1264 case A_F_UNTIL_HILITE
:
1265 newaction
= forw_loop(1);
1271 * (default same as last 'd' or 'u' command).
1274 wscroll
= (int) number
;
1276 if (show_attn
== OPT_ONPLUS
)
1277 set_attnpos(bottompos
);
1278 forward(wscroll
, 0, 0);
1284 * (default same as last 'd' or 'u' command).
1287 wscroll
= (int) number
;
1289 backward(wscroll
, 0, 0);
1294 * Flush buffers, then repaint screen.
1295 * Don't flush the buffers on a pipe!
1309 * Go to line N, default beginning of file.
1319 * Go to a specified percentage into the file.
1332 jump_percent((int) number
, fraction
);
1337 * Go to line N, default end of file.
1348 * Go to a specified byte position in the file.
1353 jump_line_loc((POSITION
) number
, jump_sline
);
1358 * Print file name, etc.
1360 if (ch_getflags() & CH_HELPFILE
)
1363 parg
.p_string
= eq_message();
1369 * Print version number, without the "@(#)".
1379 if (curr_ifile
!= NULL_IFILE
&&
1380 ch_getflags() & CH_HELPFILE
)
1383 * Quit while viewing the help file
1384 * just means return to viewing the
1387 hshift
= save_hshift
;
1388 if (edit_prev(1) == 0)
1397 * Define abbreviation for a commonly used sequence below.
1399 #define DO_SEARCH() \
1400 if (number <= 0) number = 1; \
1403 multi_search((char *)NULL, (int) number);
1408 * Search forward for a pattern.
1409 * Get the first char of the pattern.
1411 search_type
= SRCH_FORW
;
1420 * Search backward for a pattern.
1421 * Get the first char of the pattern.
1423 search_type
= SRCH_BACK
;
1432 search_type
= SRCH_FORW
| SRCH_FILTER
;
1437 error("Command not available", NULL_PARG
);
1441 case A_AGAIN_SEARCH
:
1443 * Repeat previous search.
1448 case A_T_AGAIN_SEARCH
:
1450 * Repeat previous search, multiple files.
1452 search_type
|= SRCH_PAST_EOF
;
1456 case A_REVERSE_SEARCH
:
1458 * Repeat previous search, in reverse direction.
1460 save_search_type
= search_type
;
1461 search_type
= SRCH_REVERSE(search_type
);
1463 search_type
= save_search_type
;
1466 case A_T_REVERSE_SEARCH
:
1468 * Repeat previous search,
1469 * multiple files in reverse direction.
1471 save_search_type
= search_type
;
1472 search_type
= SRCH_REVERSE(search_type
);
1473 search_type
|= SRCH_PAST_EOF
;
1475 search_type
= save_search_type
;
1486 if (ch_getflags() & CH_HELPFILE
)
1489 save_hshift
= hshift
;
1491 (void) edit(FAKE_HELPFILE
);
1497 * Edit a new file. Get the filename.
1501 error("Command not available", NULL_PARG
);
1504 start_mca(A_EXAMINE
, "Examine: ", ml_examine
, 0);
1508 error("Command not available", NULL_PARG
);
1514 * Invoke an editor on the input file.
1519 error("Command not available", NULL_PARG
);
1522 if (ch_getflags() & CH_HELPFILE
)
1524 if (strcmp(get_filename(curr_ifile
), "-") == 0)
1526 error("Cannot edit standard input", NULL_PARG
);
1529 if (curr_altfilename
!= NULL
)
1531 error("WARNING: This file was viewed via LESSOPEN",
1534 start_mca(A_SHELL
, "!", ml_shell
, 0);
1536 * Expand the editor prototype string
1537 * and pass it to the system to execute.
1538 * (Make sure the screen is displayed so the
1539 * expansion of "+%lm" works.)
1543 lsystem(pr_expand(editproto
, 0), (char*)NULL
);
1546 error("Command not available", NULL_PARG
);
1552 * Examine next file.
1557 error("No next file", NULL_PARG
);
1563 if (edit_next((int) number
))
1565 if (get_quit_at_eof() && eof_displayed() &&
1566 !(ch_getflags() & CH_HELPFILE
))
1568 parg
.p_string
= (number
> 1) ? "(N-th) " : "";
1569 error("No %snext file", &parg
);
1575 * Examine previous file.
1580 error("No previous file", NULL_PARG
);
1586 if (edit_prev((int) number
))
1588 parg
.p_string
= (number
> 1) ? "(N-th) " : "";
1589 error("No %sprevious file", &parg
);
1597 tagfile
= nexttag((int) number
);
1598 if (tagfile
== NULL
)
1600 error("No next tag", NULL_PARG
);
1603 if (edit(tagfile
) == 0)
1605 POSITION pos
= tagsearch();
1606 if (pos
!= NULL_POSITION
)
1607 jump_loc(pos
, jump_sline
);
1610 error("Command not available", NULL_PARG
);
1618 tagfile
= prevtag((int) number
);
1619 if (tagfile
== NULL
)
1621 error("No previous tag", NULL_PARG
);
1624 if (edit(tagfile
) == 0)
1626 POSITION pos
= tagsearch();
1627 if (pos
!= NULL_POSITION
)
1628 jump_loc(pos
, jump_sline
);
1631 error("Command not available", NULL_PARG
);
1637 * Examine a particular file.
1641 if (edit_index((int) number
))
1642 error("No such file", NULL_PARG
);
1646 if (ch_getflags() & CH_HELPFILE
)
1648 old_ifile
= curr_ifile
;
1649 new_ifile
= getoff_ifile(curr_ifile
);
1650 if (new_ifile
== NULL_IFILE
)
1655 if (edit_ifile(new_ifile
) != 0)
1657 reedit_ifile(old_ifile
);
1660 del_ifile(old_ifile
);
1664 optflag
= OPT_TOGGLE
;
1672 * Report a flag setting.
1674 optflag
= OPT_NO_TOGGLE
;
1682 * Set an initial command for new files.
1684 start_mca(A_FIRSTCMD
, "+", (void*)NULL
, 0);
1695 error("Command not available", NULL_PARG
);
1698 start_mca(A_SHELL
, "!", ml_shell
, 0);
1702 error("Command not available", NULL_PARG
);
1710 if (ch_getflags() & CH_HELPFILE
)
1712 start_mca(A_SETMARK
, "mark: ", (void*)NULL
, 0);
1714 if (c
== erase_char
|| c
== erase2_char
||
1715 c
== kill_char
|| c
== '\n' || c
== '\r')
1724 start_mca(A_GOMARK
, "goto mark: ", (void*)NULL
, 0);
1726 if (c
== erase_char
|| c
== erase2_char
||
1727 c
== kill_char
|| c
== '\n' || c
== '\r')
1737 error("Command not available", NULL_PARG
);
1740 start_mca(A_PIPE
, "|mark: ", (void*)NULL
, 0);
1742 if (c
== erase_char
|| c
== erase2_char
|| c
== kill_char
)
1744 if (c
== '\n' || c
== '\r')
1749 start_mca(A_PIPE
, "!", ml_shell
, 0);
1753 error("Command not available", NULL_PARG
);
1759 start_mca(action
, "Brackets: ", (void*)NULL
, 0);
1765 shift_count
= number
;
1767 number
= (shift_count
> 0) ?
1768 shift_count
: sc_width
/ 2;
1769 if (number
> hshift
)
1777 shift_count
= number
;
1779 number
= (shift_count
> 0) ?
1780 shift_count
: sc_width
/ 2;
1787 * The command is incomplete (more chars are needed).
1788 * Display the current char, so the user knows
1789 * what's going on, and get another character.
1791 if (mca
!= A_PREFIX
)
1794 start_mca(A_PREFIX
, " ", (void*)NULL
,