Added some ymodem receive code
This commit is contained in:
parent
ba54b2037f
commit
e3a13e9126
@ -49,32 +49,10 @@
|
|||||||
#include "ymrecv.h"
|
#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 sentbytes;
|
||||||
int rcvdbytes;
|
int rcvdbytes;
|
||||||
|
|
||||||
|
extern int zmodem_requested;
|
||||||
|
|
||||||
|
|
||||||
int ForceProtocol()
|
int ForceProtocol()
|
||||||
@ -439,8 +417,18 @@ int upload(up_list **upload_list)
|
|||||||
sleep(2);
|
sleep(2);
|
||||||
|
|
||||||
if (uProtInternal) {
|
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();
|
rc = zmrcvfiles();
|
||||||
|
|
||||||
Syslog('b', "Begin dir processing");
|
Syslog('b', "Begin dir processing");
|
||||||
if ((dirp = opendir(".")) == NULL) {
|
if ((dirp = opendir(".")) == NULL) {
|
||||||
WriteError("$Upload: can't open ./upl");
|
WriteError("$Upload: can't open ./upl");
|
||||||
|
@ -81,7 +81,7 @@ int zmrcvfiles(void)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
Syslog('+', "Zmodem: start Zmodem receive");
|
Syslog('+', "%s: start receive", protname());
|
||||||
|
|
||||||
zsendline_init();
|
zsendline_init();
|
||||||
if (secbuf == NULL)
|
if (secbuf == NULL)
|
||||||
@ -90,7 +90,7 @@ int zmrcvfiles(void)
|
|||||||
protocol = ZM_ZMODEM;
|
protocol = ZM_ZMODEM;
|
||||||
|
|
||||||
if ((rc = tryz()) < 0) {
|
if ((rc = tryz()) < 0) {
|
||||||
Syslog('+', "Zmodem: could not initiate receive, rc=%d",rc);
|
Syslog('+', "%s: could not initiate receive, rc=%d", protname(), rc);
|
||||||
} else {
|
} else {
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
if (wcrxpn(secbuf) == TERROR) {
|
if (wcrxpn(secbuf) == TERROR) {
|
||||||
@ -129,7 +129,7 @@ int zmrcvfiles(void)
|
|||||||
fubar:
|
fubar:
|
||||||
if (fout) {
|
if (fout) {
|
||||||
if (closeit(0)) {
|
if (closeit(0)) {
|
||||||
WriteError("Zmodem: Error closing file");
|
WriteError("%s: Error closing file", protname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ fubar:
|
|||||||
*/
|
*/
|
||||||
purgeline(100);
|
purgeline(100);
|
||||||
|
|
||||||
Syslog('z', "Zmodem: receive rc=%d",rc);
|
Syslog('z', "%s: receive rc=%d", protname(), rc);
|
||||||
return abs(rc);
|
return abs(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ fubar:
|
|||||||
* Initialize for Zmodem receive attempt, try to activate Zmodem sender
|
* Initialize for Zmodem receive attempt, try to activate Zmodem sender
|
||||||
* Handles ZSINIT frame
|
* Handles ZSINIT frame
|
||||||
* Return ZFILE if Zmodem filename received, -1 on error,
|
* 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)
|
int tryz(void)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user