From 96bebafac5c2ec0b288e9d61eab9c6af8a1d365c Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 7 May 2023 15:48:06 +0200 Subject: [PATCH] Enable history substitution of interactive commands only when variable 'histsubst' is set. This feature is in conflict with ! (logic inversion) in .control language logic expressions. --- src/frontend/init.c | 5 +++++ src/frontend/parser/cshpar.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/frontend/init.c b/src/frontend/init.c index 6c3a77513..a19d2f4db 100644 --- a/src/frontend/init.c +++ b/src/frontend/init.c @@ -20,6 +20,7 @@ cp_init(void) cp_chars[128] cp_maxhistlength (set to 10000 in com_history.c) cp_curin, cp_curout, cp_curerr (defined in streams.c) + cp_no_histsubst */ { cp_vset("history", CP_NUM, &cp_maxhistlength); @@ -28,6 +29,10 @@ cp_init(void) cp_curout = stdout; cp_curerr = stderr; + /* Enable history substitution */ + if (cp_getvar("histsubst", CP_BOOL, NULL, 0)) + cp_no_histsubst = FALSE; + /* io redirection in streams.c: cp_in set to cp_curin etc. */ cp_ioreset(); diff --git a/src/frontend/parser/cshpar.c b/src/frontend/parser/cshpar.c index 35a31c9e9..b4cfa7fc8 100644 --- a/src/frontend/parser/cshpar.c +++ b/src/frontend/parser/cshpar.c @@ -37,8 +37,8 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #include #endif - -bool cp_no_histsubst = FALSE; /* perform history substitution by default */ +/* perform history substitution only when variable 'histsubst' is set */ +bool cp_no_histsubst = TRUE; /* Things go as follows: * (1) Read the line and do some initial quoting (by setting the 8th bit),