Added some ymodem receive code

This commit is contained in:
Michiel Broek 2004-11-23 20:56:05 +00:00
parent ba54b2037f
commit e3a13e9126
2 changed files with 17 additions and 29 deletions

View File

@ -49,32 +49,10 @@
#include "ymrecv.h"
/*
Design remarks.
This entry must accept up and downloads at the same time in case a users
wants to download but uses a bidirectional protocol and has something to
upload.
First design fase: support the now used external protocols and link it to
the rest of the bbs.
Second design fase: add build-in zmodem and ymodem-1k.
To think of:
- Drop bidirectional support, is this still in use. No bimodem specs and
Hydra seems not implemented in any terminal emulator.
- Add sliding kermit? Can still be used externally.
- Add special internet protocol and make a module for minicom. No, this
would mean only a few users will use it.
*/
int sentbytes;
int rcvdbytes;
extern int zmodem_requested;
int ForceProtocol()
@ -439,8 +417,18 @@ int upload(up_list **upload_list)
sleep(2);
if (uProtInternal) {
if (strncasecmp(sProtName, "zmodem", 6) == 0) {
if ((strncasecmp(sProtName, "zmodem", 6) == 0) || (strncasecmp(sProtName, "ymodem", 6) == 0)) {
if (strncasecmp(sProtName, "zmodem", 6) == 0) {
zmodem_requested = TRUE;
protocol = ZM_ZMODEM;
} else {
zmodem_requested = FALSE;
}
if (strncasecmp(sProtName, "ymodem", 6) == 0)
protocol = ZM_YMODEM;
rc = zmrcvfiles();
Syslog('b', "Begin dir processing");
if ((dirp = opendir(".")) == NULL) {
WriteError("$Upload: can't open ./upl");

View File

@ -81,7 +81,7 @@ int zmrcvfiles(void)
{
int rc;
Syslog('+', "Zmodem: start Zmodem receive");
Syslog('+', "%s: start receive", protname());
zsendline_init();
if (secbuf == NULL)
@ -90,7 +90,7 @@ int zmrcvfiles(void)
protocol = ZM_ZMODEM;
if ((rc = tryz()) < 0) {
Syslog('+', "Zmodem: could not initiate receive, rc=%d",rc);
Syslog('+', "%s: could not initiate receive, rc=%d", protname(), rc);
} else {
if (rc == 0) {
if (wcrxpn(secbuf) == TERROR) {
@ -129,7 +129,7 @@ int zmrcvfiles(void)
fubar:
if (fout) {
if (closeit(0)) {
WriteError("Zmodem: Error closing file");
WriteError("%s: Error closing file", protname);
}
}
@ -143,7 +143,7 @@ fubar:
*/
purgeline(100);
Syslog('z', "Zmodem: receive rc=%d",rc);
Syslog('z', "%s: receive rc=%d", protname(), rc);
return abs(rc);
}
@ -153,7 +153,7 @@ fubar:
* Initialize for Zmodem receive attempt, try to activate Zmodem sender
* Handles ZSINIT frame
* Return ZFILE if Zmodem filename received, -1 on error,
* ZCOMPL if transaction finished, else 0
* ZCOMPL if transaction finished, else 0: can be ymodem.
*/
int tryz(void)
{