brace filenames (to protect spaces) in Tcl_VarEval() calls from C as per Joanne findings.
This commit is contained in:
parent
629917cfcd
commit
954979e200
|
|
@ -55,12 +55,12 @@ void print_image()
|
|||
if(!has_x) return ;
|
||||
if(!lastdir[0]) my_strncpy(lastdir, pwd_dir, S(lastdir));
|
||||
if(!xctx->plotfile[0]) {
|
||||
Tcl_VarEval(interp, "tk_getSaveFile -title {Select destination file} -initialfile ",
|
||||
get_cell(xctx->sch[xctx->currsch], 0) , ".png -initialdir ", lastdir, NULL);
|
||||
Tcl_VarEval(interp, "tk_getSaveFile -title {Select destination file} -initialfile {",
|
||||
get_cell(xctx->sch[xctx->currsch], 0) , ".png} -initialdir {", lastdir, "}", NULL);
|
||||
r = tclresult();
|
||||
if(r[0]) {
|
||||
my_strncpy(xctx->plotfile, r, S(xctx->plotfile));
|
||||
Tcl_VarEval(interp, "file dirname ", xctx->plotfile, NULL);
|
||||
Tcl_VarEval(interp, "file dirname {", xctx->plotfile, "}", NULL);
|
||||
my_strncpy(lastdir, tclresult(), S(lastdir));
|
||||
}
|
||||
else return;
|
||||
|
|
|
|||
|
|
@ -887,12 +887,12 @@ int ps_draw(int what)
|
|||
if(what & 1) { /* prolog */
|
||||
if(!lastdir[0]) my_strncpy(lastdir, pwd_dir, S(lastdir));
|
||||
if(!xctx->plotfile[0]) {
|
||||
Tcl_VarEval(interp, "tk_getSaveFile -title {Select destination file} -initialfile ",
|
||||
get_cell(xctx->sch[xctx->currsch], 0) , ".pdf -initialdir ", lastdir, NULL);
|
||||
Tcl_VarEval(interp, "tk_getSaveFile -title {Select destination file} -initialfile {",
|
||||
get_cell(xctx->sch[xctx->currsch], 0) , ".pdf} -initialdir {", lastdir, "}", NULL);
|
||||
r = tclresult();
|
||||
if(r[0]) {
|
||||
my_strncpy(xctx->plotfile, r, S(xctx->plotfile));
|
||||
Tcl_VarEval(interp, "file dirname ", xctx->plotfile, NULL);
|
||||
Tcl_VarEval(interp, "file dirname {", xctx->plotfile, "}", NULL);
|
||||
my_strncpy(lastdir, tclresult(), S(lastdir));
|
||||
}
|
||||
else return 0;
|
||||
|
|
|
|||
|
|
@ -1102,7 +1102,7 @@ void load_schematic(int load_symbols, const char *filename, int reset_undo) /* 2
|
|||
dbg(2, "load_schematic(): loaded file:wire=%d inst=%d\n",xctx->wires , xctx->instances);
|
||||
if(load_symbols) link_symbols_to_instances(-1);
|
||||
if(reset_undo) {
|
||||
Tcl_VarEval(interp, "is_xschem_file ", xctx->sch[xctx->currsch], NULL);
|
||||
Tcl_VarEval(interp, "is_xschem_file {", xctx->sch[xctx->currsch], "}", NULL);
|
||||
if(!strcmp(tclresult(), "SYMBOL")) {
|
||||
xctx->save_netlist_type = xctx->netlist_type;
|
||||
xctx->netlist_type = CAD_SYMBOL_ATTRS;
|
||||
|
|
|
|||
|
|
@ -1768,7 +1768,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
return TCL_ERROR;
|
||||
}
|
||||
if(argc >= 4) {
|
||||
Tcl_VarEval(interp, "file normalize \"", argv[3], "\"", NULL);
|
||||
Tcl_VarEval(interp, "file normalize {", argv[3], "}", NULL);
|
||||
my_strncpy(xctx->plotfile, Tcl_GetStringResult(interp), S(xctx->plotfile));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -564,12 +564,12 @@ void svg_draw(void)
|
|||
|
||||
if(!lastdir[0]) my_strncpy(lastdir, pwd_dir, S(lastdir));
|
||||
if(!xctx->plotfile[0]) {
|
||||
Tcl_VarEval(interp, "tk_getSaveFile -title {Select destination file} -initialfile ",
|
||||
get_cell(xctx->sch[xctx->currsch], 0) , ".svg -initialdir ", lastdir, NULL);
|
||||
Tcl_VarEval(interp, "tk_getSaveFile -title {Select destination file} -initialfile {",
|
||||
get_cell(xctx->sch[xctx->currsch], 0) , ".svg} -initialdir {", lastdir, "}", NULL);
|
||||
r = tclresult();
|
||||
if(r[0]) {
|
||||
my_strncpy(xctx->plotfile, r, S(xctx->plotfile));
|
||||
Tcl_VarEval(interp, "file dirname ", xctx->plotfile, NULL);
|
||||
Tcl_VarEval(interp, "file dirname {", xctx->plotfile, "}", NULL);
|
||||
my_strncpy(lastdir, tclresult(), S(lastdir));
|
||||
}
|
||||
else return;
|
||||
|
|
|
|||
|
|
@ -1910,7 +1910,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
|
|||
|
||||
/* source tcl file given on command line with --script */
|
||||
if(tcl_script[0]) {
|
||||
Tcl_VarEval(interp, "update; source ", tcl_script, NULL);
|
||||
Tcl_VarEval(interp, "update; source {", tcl_script, "}", NULL);
|
||||
}
|
||||
|
||||
if(quit) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue