From 66a4b2226e3a8e481b87aaf401a0faaf51d9b59d Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Wed, 26 Apr 2023 09:46:22 +0200 Subject: [PATCH] .libsave: don't save the command itself, improve messaging --- src/frontend/inpcom.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index c8369dea3..1f4994c7b 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -6925,7 +6925,7 @@ static void inp_poly_err(struct card *card) #endif /* Print the parsed library to lib_out?.lib, with ? a growing number - if multiple libs are saved in a single run. */ + if multiple libs are saved in a single run. Don't save the .libsave line.*/ static char* libprint(struct card* t, const char *dir_name) { struct card* tmp; @@ -6935,10 +6935,13 @@ static char* libprint(struct card* t, const char *dir_name) FILE* fd = fopen(outfile, "w"); if (fd) { for (tmp = t; tmp; tmp = tmp->nextcard) - if (*(tmp->line) != '*') + if (*(tmp->line) != '*' && !ciprefix(".libsave", tmp->line)) fprintf(fd, "%s\n", tmp->line); fclose(fd); } + else { + fprintf(stderr, "Warning: Can't open file %s \n command .libsave ignored!\n", outfile); + } return outfile; }