fix -N option for output netlist filename

This commit is contained in:
Stefan Frederik 2021-02-09 17:19:37 +01:00
parent b7686bfe5c
commit 238c9f592d
8 changed files with 8 additions and 5 deletions

View File

@ -116,6 +116,7 @@ xcb_visualtype_t *visual_xcb;
/* these variables are mirrored in tcl code */
int fullscreen=0;
char *netlist_dir=NULL; /* user set netlist directory via cmd-option or menu or xschemrc */
char initial_netlist_name[PATH_MAX]={0};
int top_subckt = 0;
int spiceprefix = 1;
int unzoom_nodrift=1;

View File

@ -106,7 +106,7 @@ void check_opt(char *opt, char *optval, int type)
} else if( (type == SHORT && *opt == 'N') || (type == LONG && !strcmp("netlist_filename", opt)) ) {
dbg(1, "process_options(): set netlist name to %s\n", optval);
if(optval) my_strncpy(xctx->netlist_name, optval, S(xctx->netlist_name));
if(optval) my_strncpy(initial_netlist_name, optval, S(initial_netlist_name));
} else if( (type == SHORT && *opt == 's') || (type == LONG && !strcmp("spice", opt)) ) {
dbg(1, "process_options(): set netlist type to spice\n");

View File

@ -66,7 +66,7 @@ void global_spice_netlist(int global) /* netlister driver */
fd=fopen(netl_filename, "w");
if(xctx->netlist_name[0]) {
my_snprintf(cellname, S(cellname), "%s", get_cell(xctx->netlist_name, 0));
my_snprintf(cellname, S(cellname), "%s", get_cell_w_ext(xctx->netlist_name, 0));
} else {
my_snprintf(cellname, S(cellname), "%s.spice", skip_dir(xctx->sch[xctx->currsch]));
}

View File

@ -51,7 +51,7 @@ void global_tedax_netlist(int global) /* netlister driver */
fd=fopen(netl_filename, "w");
if(xctx->netlist_name[0]) {
my_snprintf(cellname, S(cellname), "%s", get_cell(xctx->netlist_name, 0));
my_snprintf(cellname, S(cellname), "%s", get_cell_w_ext(xctx->netlist_name, 0));
} else {
my_snprintf(cellname, S(cellname), "%s.tdx", skip_dir(xctx->sch[xctx->currsch]));
}

View File

@ -55,7 +55,7 @@ void global_verilog_netlist(int global) /* netlister driver */
fd=fopen(netl_filename, "w");
if(xctx->netlist_name[0]) {
my_snprintf(cellname, S(cellname), "%s", get_cell(xctx->netlist_name, 0));
my_snprintf(cellname, S(cellname), "%s", get_cell_w_ext(xctx->netlist_name, 0));
} else {
my_snprintf(cellname, S(cellname), "%s.v", skip_dir(xctx->sch[xctx->currsch]));
}

View File

@ -56,7 +56,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
if(xctx->netlist_name[0]) {
my_snprintf(cellname, S(cellname), "%s", get_cell(xctx->netlist_name, 0));
my_snprintf(cellname, S(cellname), "%s", get_cell_w_ext(xctx->netlist_name, 0));
} else {
my_snprintf(cellname, S(cellname), "%s.vhdl", skip_dir(xctx->sch[xctx->currsch]));
}

View File

@ -1567,6 +1567,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
if(!set_netlist_dir(0, NULL)) {
fprintf(errfp, "problems creating netlist directory %s\n", netlist_dir ? netlist_dir : "<NULL>");
}
if(initial_netlist_name[0]) my_strncpy(xctx->netlist_name, initial_netlist_name, S(initial_netlist_name));
enable_layers();

View File

@ -754,6 +754,7 @@ extern int currentsch;
extern char *xschem_version_string;
extern int split_files;
extern char *netlist_dir;
extern char initial_netlist_name[PATH_MAX];
extern char bus_char[];
extern int max_undo;
extern int draw_dots;