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

Added support for --option syntax.

Added support for -S option to disable Zmodem streaming (slow zmodem).
Added some additional debug output to zmodem_recv_file_frame().
parent 8bc32068
Branches
Tags
No related merge requests found
......@@ -1157,6 +1157,7 @@ static const char* usage=
#endif
"\n"
"opts = -o to overwrite files when receiving\n"
" -s disable Zmodem streaming (Slow Zmodem)\n"
" -! to pause after abnormal exit (error)\n"
" -telnet to enable Telnet mode\n"
" -rlogin to enable RLogin (pass-through) mode\n"
......@@ -1181,6 +1182,7 @@ int main(int argc, char **argv)
char fname[MAX_PATH+1];
char ini_fname[MAX_PATH+1];
char* p;
char* arg;
int i;
int retval;
uint fnames=0;
......@@ -1332,20 +1334,25 @@ int main(int argc, char **argv)
exit(1);
}
if(argv[i][0]=='-') {
if(stricmp(argv[i]+1,"telnet")==0) {
arg=argv[i];
if(*arg=='-') {
while(*arg=='-')
arg++;
if(stricmp(arg,"telnet")==0) {
telnet=TRUE;
continue;
}
if(stricmp(argv[i]+1,"rlogin")==0) {
if(stricmp(arg,"rlogin")==0) {
telnet=FALSE;
continue;
}
switch(toupper(argv[i][1])) {
switch(toupper(*arg)) {
case 'K': /* sz/rz compatible */
xm.block_size=1024;
break;
case 'S': /* disable Zmodem streaming */
zm.no_streaming=TRUE;
break;
case 'G': /* Ymodem-G */
mode|=GMODE;
break;
......
......@@ -357,7 +357,7 @@ zmodem_tx_header(zmodem_t* zm, unsigned char * p)
}
}
else {
zmodem_tx_hex_header(zm, p);
zmodem_tx_hex_header(zm, p); /* <--- is this a bug? (rrs) */
}
}
......@@ -1197,10 +1197,10 @@ void zmodem_send_zrinit(zmodem_t* zm)
zrinit_header[ZF0] = ZF0_CANBRK | ZF0_CANFDX | ZF0_CANOVIO | ZF0_CANFC32;
#if 0
zrinit_header[ZP0] = sizeof(zm->rx_data_subpacket) >> 8;
zrinit_header[ZP1] = sizeof(zm->rx_data_subpacket) & 0xff;
#endif
if(zm->no_streaming) {
zrinit_header[ZP0] = sizeof(zm->rx_data_subpacket) >> 8;
zrinit_header[ZP1] = sizeof(zm->rx_data_subpacket) & 0xff;
}
zmodem_tx_hex_header(zm, zrinit_header);
}
......@@ -1769,9 +1769,6 @@ int zmodem_recv_file_frame(zmodem_t* zm, FILE* fp, ulong offset, ulong fsize, ti
unsigned n;
int type;
/*
* create a ZRPOS frame and send it to the other side
*/
zmodem_send_pos_header(zm, ZRPOS, ftell(fp), /* Hex? */ TRUE);
/*
......@@ -1785,11 +1782,17 @@ int zmodem_recv_file_frame(zmodem_t* zm, FILE* fp, ulong offset, ulong fsize, ti
if (type == TIMEOUT) {
return TIMEOUT;
}
} while (type != ZDATA && !zm->cancelled);
if(zm->cancelled)
return(ZCAN);
} while (type != ZDATA);
pos = zm->rxd_header[ZP0] | (zm->rxd_header[ZP1] << 8) |
(zm->rxd_header[ZP2] << 16) | (zm->rxd_header[ZP3] << 24);
} while (pos != ftell(fp) && !zm->cancelled);
if(pos==ftell(fp))
break;
lprintf(zm,LOG_WARNING,"Wrong ZDATA block (%lu vs %lu)", pos, ftell(fp));
} while(!zm->cancelled);
do {
type = zmodem_rx_data(zm,zm->rx_data_subpacket,sizeof(zm->rx_data_subpacket),&n);
......@@ -1803,7 +1806,10 @@ int zmodem_recv_file_frame(zmodem_t* zm, FILE* fp, ulong offset, ulong fsize, ti
if(zm->progress!=NULL)
zm->progress(zm->cbdata,offset,ftell(fp),fsize,start);
} while (type == FRAMEOK && !zm->cancelled);
if(zm->cancelled)
return(ZCAN);
} while (type == FRAMEOK);
return type;
}
......
......@@ -248,6 +248,7 @@ typedef struct {
/* Status */
BOOL cancelled;
BOOL file_skipped;
BOOL no_streaming;
/* Configuration */
long* mode;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment