Skip to content
Snippets Groups Projects
Commit 5287cdc0 authored by rswindell's avatar rswindell
Browse files

Added control over how filenames are written to the DSZLOG: via the sexyz.ini

file, [DSZLOG] section, the "Path" key controls whether the full path is
logged, "Short" controls whether the Micros~1 shortened path/filename is logged
(on Windows only), and "Quotes" controls whether the filename is logged in
double-quotes (for EleBBS long filename compatibility).
The "Quotes" feature can also be enabled with the "-quotes" command-line
option.
Updated copyright dates.
parent 5ae8f6ea
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* * * *
* Copyright 2005 Rob Swindell - http://www.synchro.net/copyright.html * * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
* * * *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License * * modify it under the terms of the GNU General Public License *
...@@ -86,6 +86,9 @@ long zmode=0L; /* Zmodem mode */ ...@@ -86,6 +86,9 @@ long zmode=0L; /* Zmodem mode */
uchar block[1024]; /* Block buffer */ uchar block[1024]; /* Block buffer */
ulong block_num; /* Block number */ ulong block_num; /* Block number */
char* dszlog; char* dszlog;
BOOL dszlog_path=TRUE; /* Log complete path to filename */
BOOL dszlog_short=FALSE; /* Log Micros~1 short filename */
BOOL dszlog_quotes=FALSE; /* Quote filenames in DSZLOG */
int log_level=LOG_INFO; int log_level=LOG_INFO;
xmodem_t xm; xmodem_t xm;
...@@ -215,6 +218,30 @@ BOOL WINAPI ControlHandler(DWORD CtrlType) ...@@ -215,6 +218,30 @@ BOOL WINAPI ControlHandler(DWORD CtrlType)
} }
#endif #endif
char* dszlog_filename(char* str)
{
char* p=str;
static char path[MAX_PATH+1];
#ifdef _WIN32
char sfpath[MAX_PATH+1];
if(dszlog_short) {
SAFECOPY(sfpath,str);
GetShortPathName(str,sfpath,sizeof(sfpath));
p=sfpath;
}
#endif
if(!dszlog_path)
p=getfname(p);
if(!dszlog_quotes)
return(p);
SAFEPRINTF(path,"\"%s\"",p);
return(path);
}
static char *chr(uchar ch) static char *chr(uchar ch)
{ {
static char str[25]; static char str[25];
...@@ -862,7 +889,7 @@ static int send_files(char** fname, uint fnames) ...@@ -862,7 +889,7 @@ static int send_files(char** fname, uint fnames)
,mode&ZMODEM ? zm.errors : xm.errors ,mode&ZMODEM ? zm.errors : xm.errors
,flows ,flows
,mode&ZMODEM ? zm.block_size : xm.block_size ,mode&ZMODEM ? zm.block_size : xm.block_size
,path); ,dszlog_filename(path));
fflush(logfp); fflush(logfp);
} }
total_bytes += sent_bytes; total_bytes += sent_bytes;
...@@ -1186,7 +1213,7 @@ static int receive_files(char** fname_list, int fnames) ...@@ -1186,7 +1213,7 @@ static int receive_files(char** fname_list, int fnames)
,errors ,errors
,flows ,flows
,mode&ZMODEM ? zm.block_size : xm.block_size ,mode&ZMODEM ? zm.block_size : xm.block_size
,str ,dszlog_filename(str)
,serial_num); ,serial_num);
fflush(logfp); fflush(logfp);
} }
...@@ -1290,9 +1317,10 @@ int main(int argc, char **argv) ...@@ -1290,9 +1317,10 @@ int main(int argc, char **argv)
sscanf("$Revision$", "%*s %s", revision); sscanf("$Revision$", "%*s %s", revision);
fprintf(statfp,"\nSynchronet External X/Y/Zmodem v%s-%s" fprintf(statfp,"\nSynchronet External X/Y/Zmodem v%s-%s"
" Copyright 2005 Rob Swindell\n\n" " Copyright %s Rob Swindell\n\n"
,revision ,revision
,PLATFORM_DESC ,PLATFORM_DESC
,__DATE__+7
); );
xmodem_init(&xm,NULL,&mode,lputs,xmodem_progress,send_byte,recv_byte,is_connected); xmodem_init(&xm,NULL,&mode,lputs,xmodem_progress,send_byte,recv_byte,is_connected);
...@@ -1354,6 +1382,10 @@ int main(int argc, char **argv) ...@@ -1354,6 +1382,10 @@ int main(int argc, char **argv)
zm.escape_8th_bit =iniReadBool(fp,"Zmodem","Escape8thBit",FALSE); zm.escape_8th_bit =iniReadBool(fp,"Zmodem","Escape8thBit",FALSE);
zm.escape_ctrl_chars =iniReadBool(fp,"Zmodem","EscapeCtrlChars",FALSE); zm.escape_ctrl_chars =iniReadBool(fp,"Zmodem","EscapeCtrlChars",FALSE);
dszlog_path =iniReadBool(fp,"DSZLOG","Path",TRUE);
dszlog_short =iniReadBool(fp,"DSZLOG","Short",FALSE);
dszlog_quotes =iniReadBool(fp,"DSZLOG","Quotes",FALSE);
if(fp!=NULL) if(fp!=NULL)
fclose(fp); fclose(fp);
...@@ -1458,6 +1490,10 @@ int main(int argc, char **argv) ...@@ -1458,6 +1490,10 @@ int main(int argc, char **argv)
log_level=LOG_DEBUG; log_level=LOG_DEBUG;
continue; continue;
} }
if(stricmp(arg,"quotes")==0) {
dszlog_quotes=TRUE;
continue;
}
switch(toupper(*arg)) { switch(toupper(*arg)) {
case 'K': /* sz/rz compatible */ case 'K': /* sz/rz compatible */
xm.block_size=1024; xm.block_size=1024;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment