From 6f7d89b1ac44cf9ec1023b333785873ea8a48e27 Mon Sep 17 00:00:00 2001 From: Renaud Fivet Date: Wed, 21 Jul 2021 08:16:11 +0800 Subject: [PATCH] Fix regression: checking abort when prompting for command name. --- bind.c | 8 ++++++-- exec.c | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/bind.c b/bind.c index 460bbfa..e1ba41a 100644 --- a/bind.c +++ b/bind.c @@ -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 ; diff --git a/exec.c b/exec.c index 3681c67..b8f86ad 100644 --- a/exec.c +++ b/exec.c @@ -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 ;