diff options
author | Andrés <andmarti@gmail.com> | 2021-05-25 23:13:03 -0300 |
---|---|---|
committer | Andrés <andmarti@gmail.com> | 2021-05-25 23:13:03 -0300 |
commit | d609b7570d9c12cdd005ce2053ce8abce31c89d4 (patch) | |
tree | 13dbdef7ab4056cd96a5126e076d2ea1255e614f | |
parent | ccece1f38d0906163a848d96b6a4411a18252db4 (diff) |
Fix when not using scimrc
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | src/file.c | 29 | ||||
-rwxr-xr-x | src/gdb.gdb | 3 |
3 files changed, 23 insertions, 11 deletions
@@ -15,7 +15,7 @@ added new colors types SHEET, CURRENT_SHEET and FILENM loading xlsx with multiple sheet saving xlsx with multiple sheets add :renamesheet command -reference cells from different sheets in formulas: ={Sheet2}!A2 +reference cells from different sheets in formulas: ={"Sheet2"}!A2 removed --sheet and --filename_with_mode configuration variables ** fix in calc_mobile_cols() created movetosheet command in gram.y, to be used when saving and loading files @@ -745,7 +745,9 @@ void write_cells(FILE * f, struct roman * doc, struct sheet * sh, int r0, int c0 * \param[in] fname file name * \param[in] eraseflg * - * \return SC_READFILE_SUCCESS if we loaded the file, SC_READFILE_ERROR if we failed, + * \return + * SC_READFILE_SUCCESS if we could load the file, + * SC_READFILE_ERROR if we failed, * SC_READFILE_DOESNTEXIST if the file doesn't exist. */ sc_readfile_result readfile(char * fname, int eraseflg) { @@ -815,7 +817,8 @@ sc_readfile_result readfile(char * fname, int eraseflg) { sc_error("XLSX import support not compiled in"); #else open_xlsx(fname, "UTF-8"); - if (roman->name == NULL) roman->name = malloc(sizeof(char)*PATHLEN); + if (roman->name != NULL) free(roman->name); + roman->name = malloc(sizeof(char)*PATHLEN); strcpy(roman->name, fname); roman->modflg = 0; #endif @@ -828,7 +831,8 @@ sc_readfile_result readfile(char * fname, int eraseflg) { sc_error("ODS import support not compiled in"); #else open_ods(fname, "UTF-8"); - if (roman->name == NULL) roman->name = malloc(sizeof(char)*PATHLEN); + if (roman->name != NULL) free(roman->name); + roman->name = malloc(sizeof(char)*PATHLEN); strcpy(roman->name, fname); roman->modflg = 0; #endif @@ -842,7 +846,8 @@ sc_readfile_result readfile(char * fname, int eraseflg) { #else open_xls(fname, "UTF-8"); roman->modflg = 0; - if (roman->name == NULL) roman->name = malloc(sizeof(char)*PATHLEN); + if (roman->name != NULL) free(roman->name); + roman->name = malloc(sizeof(char)*PATHLEN); strcpy(roman->name, fname); #endif roman->loading = 0; @@ -854,7 +859,8 @@ sc_readfile_result readfile(char * fname, int eraseflg) { ! strcasecmp( & fname[len-4], ".txt") )){ import_csv(fname, get_delim(&fname[len-3])); // csv tsv tab txt delim import - if (roman->name == NULL) roman->name = malloc(sizeof(char)*PATHLEN); + if (roman->name != NULL) free(roman->name); + roman->name = malloc(sizeof(char)*PATHLEN); strcpy(roman->name, fname); roman->modflg = 0; roman->loading = 0; @@ -865,7 +871,8 @@ sc_readfile_result readfile(char * fname, int eraseflg) { ! strcasecmp( & fname[len-4], ".mkd"))){ import_markdown(fname); - if (roman->name == NULL) roman->name = malloc(sizeof(char)*PATHLEN); + if (roman->name != NULL) free(roman->name); + roman->name = malloc(sizeof(char)*PATHLEN); strcpy(roman->name, fname); roman->modflg = 0; roman->loading = 0; @@ -886,10 +893,13 @@ sc_readfile_result readfile(char * fname, int eraseflg) { f = fopen(save, "r"); if (f == NULL) { roman->loading = 0; - if (roman->name == NULL) roman->name = malloc(sizeof(char)*PATHLEN); - strcpy(roman->name, save); + if (strstr(save, "scimrc") == NULL) { + if (roman->name != NULL) free(roman->name); + roman->name = malloc(sizeof(char)*PATHLEN); + strcpy(roman->name, save); + } return SC_READFILE_DOESNTEXIST; - } /* */ + } if (eraseflg) erasedb(roman->cur_sh, 0); //TODO handle file @@ -905,6 +915,7 @@ sc_readfile_result readfile(char * fname, int eraseflg) { cellassign = 0; } if (strstr(save, "scimrc") == NULL) { + if (roman->name != NULL) free(roman->name); roman->name = malloc(sizeof(char)*PATHLEN); strcpy(roman->name, save); } diff --git a/src/gdb.gdb b/src/gdb.gdb index 1c8e0a4..912a7f8 100755 --- a/src/gdb.gdb +++ b/src/gdb.gdb @@ -1,2 +1,3 @@ target remote localhost:12345 -b graph.c:141 +b file.c:907 +b file.c:753 |