diff --git a/src/sbbs3/sexyz.c b/src/sbbs3/sexyz.c index b5113c7390c3873fbfcd7ef0492660f4a2db1de2..e6433f187d1f6c26b62d4c2d25c69b69ff0b16d7 100644 --- a/src/sbbs3/sexyz.c +++ b/src/sbbs3/sexyz.c @@ -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; diff --git a/src/sbbs3/zmodem.c b/src/sbbs3/zmodem.c index 144932284113f670f43b34cd33a2f54246bed5b8..5bbaf70e6d92c400ed229e2b8594e6b393493d3f 100644 --- a/src/sbbs3/zmodem.c +++ b/src/sbbs3/zmodem.c @@ -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; } diff --git a/src/sbbs3/zmodem.h b/src/sbbs3/zmodem.h index 7c76e767f8f21679f2f5ca6d369aa8d3d58c2399..3e248936b6f4057fae9007c9b381f59beb11d7a1 100644 --- a/src/sbbs3/zmodem.h +++ b/src/sbbs3/zmodem.h @@ -248,6 +248,7 @@ typedef struct { /* Status */ BOOL cancelled; BOOL file_skipped; + BOOL no_streaming; /* Configuration */ long* mode;