mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-05 17:52:30 +02:00
commit bash-20160923 snapshot
This commit is contained in:
@@ -49,6 +49,8 @@
|
||||
#include "rlprivate.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
#define MAX_MACRO_LEVEL 16
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Hacking Keyboard Macros */
|
||||
@@ -83,12 +85,21 @@ struct saved_macro {
|
||||
/* The list of saved macros. */
|
||||
static struct saved_macro *macro_list = (struct saved_macro *)NULL;
|
||||
|
||||
static int macro_level = 0;
|
||||
|
||||
/* Set up to read subsequent input from STRING.
|
||||
STRING is free ()'ed when we are done with it. */
|
||||
void
|
||||
_rl_with_macro_input (string)
|
||||
char *string;
|
||||
{
|
||||
if (macro_level > MAX_MACRO_LEVEL)
|
||||
{
|
||||
_rl_errmsg ("maximum macro execution nesting level exceeded");
|
||||
_rl_abort_internal ();
|
||||
return;
|
||||
}
|
||||
|
||||
_rl_push_executing_macro ();
|
||||
rl_executing_macro = string;
|
||||
executing_macro_index = 0;
|
||||
@@ -146,6 +157,8 @@ _rl_push_executing_macro ()
|
||||
saver->string = rl_executing_macro;
|
||||
|
||||
macro_list = saver;
|
||||
|
||||
macro_level++;
|
||||
}
|
||||
|
||||
/* Discard the current macro, replacing it with the one
|
||||
@@ -168,6 +181,8 @@ _rl_pop_executing_macro ()
|
||||
xfree (macro);
|
||||
}
|
||||
|
||||
macro_level--;
|
||||
|
||||
if (rl_executing_macro == 0)
|
||||
RL_UNSETSTATE(RL_STATE_MACROINPUT);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user