From 5c7cf493a3e30fcae8e008276f8bb36356c4cbf4 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 17 Jan 2020 23:36:47 +0100 Subject: [PATCH] enable returning inp_spsource() with an error code --- src/frontend/inp.c | 8 +++++--- src/include/ngspice/fteext.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/frontend/inp.c b/src/frontend/inp.c index bb5009bd9..772ecd97b 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -434,7 +434,7 @@ eval_seed_opt(struct card *deck) * filter out the following cards: .save, .width, .four, .print, and * .plot, to perform after the run is over. * Then, we run dodeck, which parses up the deck. */ -void +int inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) /* arguments: * *fp = pointer to the input file @@ -532,7 +532,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) if (!deck) { if (!intfile && fp) fclose(fp); - return; + return 1; } /* files starting with *ng_script are user supplied command files */ @@ -738,7 +738,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) line_free(realdeck, TRUE); line_free(deck->actualLine, TRUE); tfree(tt); - return; + return 1; } /* Now handle translation of spice2c6 POLYs. */ @@ -977,6 +977,8 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) cp_curerr = lasterr; tfree(tt); + + return 0; } diff --git a/src/include/ngspice/fteext.h b/src/include/ngspice/fteext.h index 2c12fbd31..1af75542e 100644 --- a/src/include/ngspice/fteext.h +++ b/src/include/ngspice/fteext.h @@ -211,7 +211,7 @@ extern bool gr_circular; void inp_dodeck(struct card *deck, char *tt, wordlist *end, bool reuse, struct card *options, char *filename); extern void inp_source(const char *file); -void inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile); +int inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile); extern void inp_casefix(char *string); extern void inp_list(FILE *file, struct card *deck, struct card *extras, int type); extern struct card *inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile, bool *expr_w_temper);