Fix regression: checking abort when prompting for command name.

This commit is contained in:
Renaud 2021-07-21 08:16:11 +08:00
parent c093b7064b
commit 6f7d89b1ac
2 changed files with 11 additions and 4 deletions

8
bind.c
View File

@ -106,7 +106,7 @@ int deskey( int f, int n) {
*
* int f, n; command arguments [IGNORED]
*/
int bindtokey(int f, int n) {
int bindtokey( int f, int n) {
key_tab *ktp ; /* pointer into the command table */
char outseq[ 80] ; /* output buffer for keystroke sequence */
@ -114,7 +114,11 @@ int bindtokey(int f, int n) {
mlwrite(": bind-to-key ");
/* get the function name to bind it to */
fnp_t kfunc = getname()->n_func ;
const name_bind *nbp = getname() ;
if( nbp == NULL) /* abort */
return FALSE ;
fnp_t kfunc = nbp->n_func ;
if( kfunc == NULL) {
mlwrite( "(No such function)") ;
return FALSE ;

7
exec.c
View File

@ -87,10 +87,13 @@ static int macarg( char *tok, int toksz) ;
*/
int namedcmd( int f, int n) {
/* prompt the user to type a named command */
mlwrite(": ");
mlwrite(": execute-named-cmd ");
/* and now get the function name to execute */
const name_bind *nbp = getname() ;
if( nbp == NULL) /* abort */
return FALSE ;
fnp_t kfunc = nbp->n_func ;
if (kfunc == NULL) {
mlwrite("(No such function)");
@ -118,7 +121,7 @@ int execcmd( int f, int n) {
char *cmdstr ; /* string holding command to execute */
/* get the line wanted */
status = newmlarg( &cmdstr, ": ", 0) ;
status = newmlarg( &cmdstr, ": execute-command-line ", 0) ;
if( status != TRUE)
return status ;