diff options
author | Eduardo Chappa <chappa@washington.edu> | 2021-04-04 20:59:17 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2021-04-04 20:59:17 -0600 |
commit | e189040a9d6b6e366bd71fd2121f736c18f3039f (patch) | |
tree | b4fe091856854936f4164413bde1c75d598a173e | |
parent | 5a6ddae7324ec3e753aba48e9244ee138eaf8da4 (diff) | |
download | alpine-e189040a9d6b6e366bd71fd2121f736c18f3039f.tar.xz |
* PC-Alpine: Debug files used to be created with extension .txt1, .txt2, etc.
Rename those files so that they have extension .txt.
-rw-r--r-- | alpine/osdep/debuging.c | 41 | ||||
-rw-r--r-- | include/config.wnt.h | 5 | ||||
-rw-r--r-- | pith/pine.hlp | 2 |
3 files changed, 42 insertions, 6 deletions
diff --git a/alpine/osdep/debuging.c b/alpine/osdep/debuging.c index f7f83fff..a8bee9bd 100644 --- a/alpine/osdep/debuging.c +++ b/alpine/osdep/debuging.c @@ -72,25 +72,56 @@ init_debug(void) { char nbuf[5]; char newfname[MAXPATH+1], filename[MAXPATH+1], *dfile = NULL; + char basename[MAXPATH+1]; + struct stat sbuf; int i, fd; if(!((debug || ps_global->debug_imap || ps_global->debug_tcp || ps_global->debug_http) && ps_global->write_debug_file)) return; + build_path(basename, ps_global->home_dir, DEBUGFILE, sizeof(basename)); +#ifdef DEBUGFILEEXT + if (ps_global->debug_nfiles > 0) { + strncpy(filename, basename, sizeof(filename) - 1); + filename[sizeof(filename) - 1] = '\0'; + strncat(filename, DEBUGFILEEXT, sizeof(filename) - 1 - strlen(filename)); + snprintf(nbuf, sizeof(nbuf), "%d", ps_global->debug_nfiles); + strncat(filename, nbuf, sizeof(filename) - 1 - strlen(filename)); + our_unlink(filename); + } +#endif /* DEBUGFILEEXT */ + for(i = ps_global->debug_nfiles - 1; i > 0; i--){ - build_path(filename, ps_global->home_dir, DEBUGFILE, sizeof(filename)); - strncpy(newfname, filename, sizeof(newfname)-1); - newfname[sizeof(newfname)-1] = '\0'; + strncpy(filename, basename, sizeof(filename)-1); + filename[sizeof(filename)-1] = '\0'; snprintf(nbuf, sizeof(nbuf), "%d", i); - strncat(filename, nbuf, sizeof(filename)-1-strlen(filename)); + strncat(filename, nbuf, sizeof(filename)-1-strlen(filename)); +#ifdef DEBUGFILEEXT + strncat(filename, DEBUGFILEEXT, sizeof(filename)-1-strlen(filename)); + if (our_stat(filename, &sbuf) < 0){ + strncpy(filename, basename, sizeof(filename)-1); + filename[sizeof(filename)-1] = '\0'; + strncat(filename, DEBUGFILEEXT, sizeof(filename)-1-strlen(filename)); + strncat(filename, nbuf, sizeof(filename)-1-strlen(filename)); + } +#endif /* DEBUGFILEEXT */ + strncpy(newfname, basename, sizeof(newfname)-1); + newfname[sizeof(newfname)-1] = '\0'; snprintf(nbuf, sizeof(nbuf), "%d", i+1); strncat(newfname, nbuf, sizeof(newfname)-1-strlen(newfname)); +#ifdef DEBUGFILEEXT + strncat(newfname, DEBUGFILEEXT, sizeof(newfname)-1-strlen(newfname)); +#endif /* DEBUGFILEEXT */ (void)rename_file(filename, newfname); } - build_path(filename, ps_global->home_dir, DEBUGFILE, sizeof(filename)-1); + strncpy(filename, basename, sizeof(filename) - 1); + filename[sizeof(filename) - 1] = '\0'; strncat(filename, "1", sizeof(filename)-1-strlen(filename)); filename[sizeof(filename)-1] = '\0'; +#ifdef DEBUGFILEEXT + strncat(filename, DEBUGFILEEXT, sizeof(filename) - 1 - strlen(filename)); +#endif /* DEBUGFILEEXT */ debugfile = NULL; dfile = filename; diff --git a/include/config.wnt.h b/include/config.wnt.h index 77b9ae8f..5795e389 100644 --- a/include/config.wnt.h +++ b/include/config.wnt.h @@ -24,7 +24,10 @@ #define DEBUG /* Default configuration value */ -#define DEBUGFILE "pinedebg.txt" +#define DEBUGFILE "pinedebg" + +/* Default extension for debug files */ +#define DEBUGFILEEXT ".txt" /* Display debug messages in journal */ #define DEBUGJOURNAL diff --git a/pith/pine.hlp b/pith/pine.hlp index cb5b8466..41e7719b 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -205,6 +205,8 @@ New features include: to save them in the Windows Credentials, so they will be saved as several broken pieces, which means that old versions od Alpine will NOT be able to use saved passwords, once this version of Alpine is used. +<LI> PC-Alpine: Debug files used to be created with extension .txt1, .txt2, etc. + Rename those files so that they have extension .txt. </UL> <P> |