Skip to content

Commit

Permalink
Ring bell on each char of invalid long option name.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwsw committed Dec 1, 2018
1 parent 5048f6d commit 93c26ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS.VER
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

* Shell-escape filenames in history so they can be used again.

* Ring bell if user enters invalid long option name.

* Use PCRE_UTF8 flag for pcre regular expressions when in UTF-8 mode.

* Windows: use wide-char string to set console title.
Expand Down
8 changes: 7 additions & 1 deletion command.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ mca_opt_nonfirst_char(c)
{
char *p;
char *oname;
int err;

if (curropt != NULL)
{
Expand All @@ -387,7 +388,8 @@ mca_opt_nonfirst_char(c)
return (MCA_DONE);
p = get_cmdbuf();
opt_lower = ASCII_IS_LOWER(p[0]);
curropt = findopt_name(&p, &oname, NULL);
err = 0;
curropt = findopt_name(&p, &oname, &err);
if (curropt != NULL)
{
/*
Expand All @@ -405,6 +407,10 @@ mca_opt_nonfirst_char(c)
if (cmd_char(c) != CC_OK)
return (MCA_DONE);
}
} else
{
if (err != OPT_AMBIG && !is_erase_char(c))
bell();
}
return (MCA_MORE);
}
Expand Down

0 comments on commit 93c26ca

Please sign in to comment.