From f7d387005f66b5f6856271da78f5f8790cb0ae16 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sun, 13 Dec 2015 10:18:34 +0100 Subject: [PATCH] numparam/spicenum.c, bug #300, exit gracefully upon numparam error (SHARED_MODULE) Thanks to Sergii Baitala, who reported this in #300 Shared ngspice: ngspice hangs on getchar http://sourceforge.net/p/ngspice/bugs/300/ --- src/frontend/numparam/spicenum.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/frontend/numparam/spicenum.c b/src/frontend/numparam/spicenum.c index 273c56d6e..39cd6f52b 100644 --- a/src/frontend/numparam/spicenum.c +++ b/src/frontend/numparam/spicenum.c @@ -28,6 +28,9 @@ Todo: #include "ngspice/fteext.h" +#ifdef SHARED_MODULE +extern void shared_exit(int status); +#endif extern bool ft_batchmode; @@ -494,6 +497,12 @@ nupa_done(void) simulation has finished. */ if (nerrors) { + +#ifdef SHARED_MODULE + fprintf(cp_err, "Numparam expansion errors: Problem with input file.\n"); + shared_exit(EXIT_BAD); +#endif + printf(" Copies=%d Evals=%d Placeholders=%ld Symbols=%d Errors=%d\n", linecountS, evalcountS, placeholder, dictsize, nerrors); /* debug: ask if spice run really wanted */