Skip to content

Commit

Permalink
Make "clear" external command runnable without "!" and alias-able
Browse files Browse the repository at this point in the history
Make the "clear" external command runnable without an exclamation point
("!") for convenient.  Additionally, make it acceptable as a command
string for alias exceptionally in external commands.

Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
  • Loading branch information
k-hagio committed Oct 10, 2023
1 parent 578fc08 commit 5e758aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmdline.c
Expand Up @@ -1833,6 +1833,10 @@ allocate_alias(int origin)
if (get_command_table_entry(args[2]))
found = TRUE;

/* Accept the "clear" external command exceptionally. */
if (STREQ(args[2], "clear"))
found = TRUE;

if (!found) {
if (!strlen(args[2])) {
if (alias_exists(args[1])) {
Expand Down
3 changes: 2 additions & 1 deletion main.c
Expand Up @@ -1043,7 +1043,8 @@ is_external_command(void)
STREQ(cmd, "more") ||
STREQ(cmd, "less") ||
STREQ(cmd, "echo") ||
STREQ(cmd, "ls")) {
STREQ(cmd, "ls") ||
STREQ(cmd, "clear")) {
sprintf(command, "%s", cmd);
for (i = 1; i < argcnt; i++) {
strcat(command, " ");
Expand Down

0 comments on commit 5e758aa

Please sign in to comment.