diff --git a/src/actions.c b/src/actions.c index e031114b..6e26cede 100644 --- a/src/actions.c +++ b/src/actions.c @@ -362,7 +362,7 @@ void ask_new_file(void) if(!has_x) return; if(xctx->modified) { - if(save(1)) return; /* user cancels save, so do nothing. */ + if(save(1) == -1 ) return; /* user cancels save, so do nothing. */ } tcleval("load_file_dialog {Load Schematic} .sch.sym INITIALLOADDIR"); my_snprintf(fullname, S(fullname),"%s", tclresult()); diff --git a/src/scheduler.c b/src/scheduler.c index adc3e267..9a02f18f 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -414,7 +414,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg cmd_found = 1; cancel=save(1); - if(!cancel){ + if(cancel != -1){ /* -1 means user cancel save request */ char name[PATH_MAX]; struct stat buf; int i; @@ -426,7 +426,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(argc>=3 && !strcmp(argv[2],"SYMBOL")) { xctx->netlist_type = CAD_SYMBOL_ATTRS; set_tcl_netlist_type(); - for(i=0;;i++) { + for(i=0;;i++) { /* find a non-existent untitled[-n].sym */ if(i == 0) my_snprintf(name, S(name), "%s.sym", "untitled"); else my_snprintf(name, S(name), "%s-%d.sym", "untitled", i); if(stat(name, &buf)) break; @@ -1424,7 +1424,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg { cmd_found = 1; if(argc==3) { - if(!has_x || !xctx->modified || !save(1) ) { /* save(1)==1 --> user cancel */ + if(!has_x || !xctx->modified || save(1) != -1 ) { /* save(1)==-1 --> user cancel */ dbg(1, "scheduler(): load: filename=%s\n", argv[2]); clear_all_hilights(); xctx->currsch = 0;