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.
This commit is contained in:
Giles Atkinson 2022-01-10 13:47:42 +00:00 committed by Holger Vogt
parent c4e94cd59b
commit 23e9df0181
3 changed files with 9 additions and 2 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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