From 23e9df0181be5c524bfef21778b4a66492f386a7 Mon Sep 17 00:00:00 2001 From: Giles Atkinson <“gatk555@gmail.com”> Date: Mon, 10 Jan 2022 13:47:42 +0000 Subject: [PATCH] Fix for ticket #570: Interactive prompting is always active. Control prompting with variable "interactive" and stop setting it by default. Add code in main.c to set it for an interactve session. --- src/frontend/control.c | 3 ++- src/main.c | 7 +++++++ src/spinit.in | 1 - 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/frontend/control.c b/src/frontend/control.c index 253ff9ca5..4f7f1f460 100644 --- a/src/frontend/control.c +++ b/src/frontend/control.c @@ -227,7 +227,8 @@ docommand(wordlist *wlist) { int nargs = wl_length(wlist->wl_next); if (nargs < command->co_minargs) { - if (command->co_argfn) { + if (command->co_argfn && + cp_getvar("interactive", CP_BOOL, NULL, 0)) { command->co_argfn (wlist->wl_next, command); } else { fprintf(cp_err, "%s: too few args.\n", s); diff --git a/src/main.c b/src/main.c index 821257688..380645bf4 100644 --- a/src/main.c +++ b/src/main.c @@ -1091,6 +1091,13 @@ int main(int argc, char **argv) cp_nocc = FALSE; } + if ((iflag || istty) && !ft_batchmode) { + /* Enable interactive prompting. */ + + bool x_true = TRUE; + cp_vset("interactive", CP_BOOL, &x_true); + } + if (ft_servermode) { /* in server no init file */ readinit = FALSE; } diff --git a/src/spinit.in b/src/spinit.in index e4e7b92a8..5e23eb1ac 100644 --- a/src/spinit.in +++ b/src/spinit.in @@ -12,7 +12,6 @@ set x11lineararcs ** set the number of threads in openmp ** default (if compiled with --enable-openmp) is: 2 *set num_threads=4 -set interactive strcmp __flag $program "ngspice" if $__flag = 0