safeguard opening of file for debug output:
may be not allowed if caller is not started in admin mode.
This commit is contained in:
parent
57156e16f6
commit
a191697bd6
|
|
@ -619,6 +619,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
||||||
if (ft_ngdebug) {
|
if (ft_ngdebug) {
|
||||||
/*debug: print into file*/
|
/*debug: print into file*/
|
||||||
FILE *fdo = fopen("debug-out2.txt", "w");
|
FILE *fdo = fopen("debug-out2.txt", "w");
|
||||||
|
if (fdo) {
|
||||||
struct card *t = NULL;
|
struct card *t = NULL;
|
||||||
fprintf(fdo, "**************** uncommented deck **************\n\n");
|
fprintf(fdo, "**************** uncommented deck **************\n\n");
|
||||||
/* always print first line */
|
/* always print first line */
|
||||||
|
|
@ -635,6 +636,9 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
||||||
fprintf(fdo, "%6d %6d %s\n", t->linenum_orig, t->linenum, t->line);
|
fprintf(fdo, "%6d %6d %s\n", t->linenum_orig, t->linenum, t->line);
|
||||||
fclose(fdo);
|
fclose(fdo);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
fprintf(stderr, "Warning: Cannot open file debug-out2.txt for saving debug info\n");
|
||||||
|
}
|
||||||
for (dd = deck; dd; dd = dd->nextcard) {
|
for (dd = deck; dd; dd = dd->nextcard) {
|
||||||
/* get csparams and create vectors, being
|
/* get csparams and create vectors, being
|
||||||
available in .control section, in plot 'const' */
|
available in .control section, in plot 'const' */
|
||||||
|
|
@ -761,6 +765,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
||||||
if (ft_ngdebug) {
|
if (ft_ngdebug) {
|
||||||
/*debug: print into file*/
|
/*debug: print into file*/
|
||||||
FILE *fdo = fopen("debug-out3.txt", "w");
|
FILE *fdo = fopen("debug-out3.txt", "w");
|
||||||
|
if (fdo) {
|
||||||
struct card *t = NULL;
|
struct card *t = NULL;
|
||||||
fprintf(fdo, "**************** uncommented deck **************\n\n");
|
fprintf(fdo, "**************** uncommented deck **************\n\n");
|
||||||
/* always print first line */
|
/* always print first line */
|
||||||
|
|
@ -777,6 +782,9 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
||||||
fprintf(fdo, "%6d %6d %s\n", t->linenum_orig, t->linenum, t->line);
|
fprintf(fdo, "%6d %6d %s\n", t->linenum_orig, t->linenum, t->line);
|
||||||
fclose(fdo);
|
fclose(fdo);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
fprintf(stderr, "Warning: Cannot open file debug-out3.txt for saving debug info\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* Now the circuit is defined, so generate the parse trees */
|
/* Now the circuit is defined, so generate the parse trees */
|
||||||
inp_parse_temper_trees(ft_curckt);
|
inp_parse_temper_trees(ft_curckt);
|
||||||
|
|
|
||||||
|
|
@ -620,8 +620,9 @@ inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile, bool *expr_w_t
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ft_ngdebug) {
|
if (ft_ngdebug) {
|
||||||
/*debug: print into file*/
|
|
||||||
FILE *fd = fopen("debug-out.txt", "w");
|
FILE *fd = fopen("debug-out.txt", "w");
|
||||||
|
if (fd) {
|
||||||
|
/*debug: print into file*/
|
||||||
struct card *t;
|
struct card *t;
|
||||||
fprintf(fd, "**************** uncommented deck **************\n\n");
|
fprintf(fd, "**************** uncommented deck **************\n\n");
|
||||||
/* always print first line */
|
/* always print first line */
|
||||||
|
|
@ -641,6 +642,9 @@ inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile, bool *expr_w_t
|
||||||
fprintf(stdout, "max line length %d, max subst. per line %d, number of lines %d\n",
|
fprintf(stdout, "max line length %d, max subst. per line %d, number of lines %d\n",
|
||||||
(int)max_line_length, no_braces, dynmaxline);
|
(int)max_line_length, no_braces, dynmaxline);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
fprintf(stderr, "Warning: Cannot open file debug-out.txt for saving debug info\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cc;
|
return cc;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue