Improved protocol selection

This commit is contained in:
Michiel Broek 2004-11-28 16:15:35 +00:00
parent 70792652c8
commit cfdad80d1d
3 changed files with 7 additions and 5 deletions

View File

@ -45,6 +45,7 @@ v0.71.0 27-Oct-2004
After upload, files are now stored correctly in the filebase. After upload, files are now stored correctly in the filebase.
In change protocol, changed the colors. In change protocol, changed the colors.
With user chat, the timeout timer wasn't refreshed. With user chat, the timeout timer wasn't refreshed.
Improved test for users protocol available.
mbnewusr: mbnewusr:
Rewrote terminal i/o. Rewrote terminal i/o.

View File

@ -849,6 +849,7 @@ void Chg_Protocol()
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
ReadExitinfo(); ReadExitinfo();
Set_Protocol(exitinfo.sProtocol);
Syslog('+', "Old protocol %s", sProtName); Syslog('+', "Old protocol %s", sProtName);
while(TRUE) { while(TRUE) {
@ -944,11 +945,12 @@ void Set_Protocol(char *Protocol)
int precno = 0; int precno = 0;
char *temp; char *temp;
memset(&sProtName, 0, sizeof(sProtName));
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/etc/protocol.data", getenv("MBSE_ROOT")); sprintf(temp, "%s/etc/protocol.data", getenv("MBSE_ROOT"));
if(( pProtConfig = fopen(temp, "rb")) == NULL) { if (( pProtConfig = fopen(temp, "rb")) == NULL) {
WriteError("$Can't open %s", temp); WriteError("$Can't open %s", temp);
Enter(1); Enter(1);
/* Protocol: Can't open protocol file. */ /* Protocol: Can't open protocol file. */
@ -962,8 +964,7 @@ void Set_Protocol(char *Protocol)
fread(&PROThdr, sizeof(PROThdr), 1, pProtConfig); fread(&PROThdr, sizeof(PROThdr), 1, pProtConfig);
while (fread(&PROT, PROThdr.recsize, 1, pProtConfig) == 1) { while (fread(&PROT, PROThdr.recsize, 1, pProtConfig) == 1) {
if ((strcmp(PROT.ProtName, Protocol)) == 0) { if (((strcmp(PROT.ProtName, Protocol)) == 0) && PROT.Available) {
tlf(sProtName);
strcpy(sProtName, PROT.ProtName); strcpy(sProtName, PROT.ProtName);
strcpy(sProtUp, PROT.ProtUp); strcpy(sProtUp, PROT.ProtUp);
strcpy(sProtDn, PROT.ProtDn); strcpy(sProtDn, PROT.ProtDn);

View File

@ -434,11 +434,11 @@ int upload(up_list **upload_list)
if (strncasecmp(sProtName, "xmodem", 6) == 0) if (strncasecmp(sProtName, "xmodem", 6) == 0)
protocol = ZM_XMODEM; protocol = ZM_XMODEM;
if ((strstr(sProtName, "1K") || strstr(sProtName, "1k")) && (protocol != ZM_ZMODEM)) { if (strstr(sProtName, "-1K") && (protocol != ZM_ZMODEM)) {
Syslog('x', "%s: want 1K blocks", protname()); Syslog('x', "%s: want 1K blocks", protname());
want1k = TRUE; want1k = TRUE;
} }
if ((strstr(sProtName, "G")) && (protocol == ZM_YMODEM)) { if ((strstr(sProtName, "-G")) && (protocol == ZM_YMODEM)) {
Syslog('x', "%s: want Ymodem-G", protname()); Syslog('x', "%s: want Ymodem-G", protname());
wantg = TRUE; wantg = TRUE;
} }