From 2e90463cfcfde52331085defe5f76f16b15c1da7 Mon Sep 17 00:00:00 2001 From: "mulder.patrick@gmail.com" Date: Sun, 23 Aug 2020 12:14:56 +0200 Subject: [PATCH] Save to default file --- lib/io_xopen.cc | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/io_xopen.cc b/lib/io_xopen.cc index af4f4df..1636b18 100644 --- a/lib/io_xopen.cc +++ b/lib/io_xopen.cc @@ -48,32 +48,33 @@ void xclose(FILE **fn) FILE *xopen(CS& cmd, const char *ext, const char *how) { char fname[BIGBUFLEN]; - + cmd.skipbl(); if (cmd.is_end()) {untested(); - cmd = getcmd("file name? ",fname, BIGBUFLEN); - } - /* copy the name */ + // cmd = getcmd("file name? ", fname, BIGBUFLEN); + strncpy(fname, "snapshot.ckt\0", 100); + } else { + /* copy the name */ cmd.skipbl(); /* and while we're at it ... */ - { /* find out if we want to add the */ + /* find out if we want to add the */ bool defalt = true; /* default extension */ size_t i; for (i = 0; i < BIGBUFLEN; ) { char c = cmd.ctoc(); if (!c || isspace(c)) { - break; + break; } if (c == '$') {untested(); - sprintf(&(fname[i]), "%ld", static_cast(time(0))); - i = strlen(fname); + sprintf(&(fname[i]), "%ld", static_cast(time(0))); + i = strlen(fname); }else{ /* we want to add the extension */ - fname[i++] = c; /* if it doesn't already have one, */ - if (c == '.') { /* as determined by a '.' */ - defalt = false; /* not before the directory */ - }else if (strchr(ENDDIR,c)) { /* separator-terminator character */ - itested(); - defalt = true; /* '\' or '/' for msdos, */ - } + fname[i++] = c; /* if it doesn't already have one, */ + if (c == '.') { /* as determined by a '.' */ + defalt = false; /* not before the directory */ + }else if (strchr(ENDDIR,c)) { /* separator-terminator character */ + itested(); + defalt = true; /* '\' or '/' for msdos, */ + } } /* ']' or '/' for vms, */ } /* '/' for unix (in ENDDIR) */ cmd.skip(-1); @@ -84,8 +85,9 @@ FILE *xopen(CS& cmd, const char *ext, const char *how) fname[i] = '\0'; } } - + trim(fname); + printf("Save session to %s \n", fname); if (strlen(fname)==0) { return NULL; } -- 2.16.4