Code cleanup
This commit is contained in:
parent
723b8bd999
commit
85166dd9cb
@ -127,7 +127,7 @@ static int tty_read(char *buf, int size, int tot)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int tty_write(char *buf, int size)
|
int tty_put(char *buf, int size)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
@ -137,14 +137,14 @@ int tty_write(char *buf, int size)
|
|||||||
if (result != size) {
|
if (result != size) {
|
||||||
if (hanged_up || (errno == EPIPE) || (errno == ECONNRESET)) {
|
if (hanged_up || (errno == EPIPE) || (errno == ECONNRESET)) {
|
||||||
tty_status = STAT_HANGUP;
|
tty_status = STAT_HANGUP;
|
||||||
WriteError("tty_write: hanged_up flag");
|
WriteError("tty_put: hanged_up flag");
|
||||||
} else {
|
} else {
|
||||||
tty_status=STAT_ERROR;
|
tty_status=STAT_ERROR;
|
||||||
Syslog('!', "tty_write: error flag");
|
Syslog('!', "tty_put: error flag");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tty_status)
|
if (tty_status)
|
||||||
Syslog('t', "tty_write: error %s", ttystat[tty_status]);
|
Syslog('t', "tty_put: error %s", ttystat[tty_status]);
|
||||||
|
|
||||||
return -tty_status;
|
return -tty_status;
|
||||||
}
|
}
|
||||||
@ -185,16 +185,6 @@ void tty_flushin(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Discard all available characters in output buffer.
|
|
||||||
*/
|
|
||||||
void tty_flushout(void)
|
|
||||||
{
|
|
||||||
tcflush(1, TCOFLUSH);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int tty_getc(int tot)
|
int tty_getc(int tot)
|
||||||
{
|
{
|
||||||
if (!left) {
|
if (!left) {
|
||||||
@ -217,14 +207,7 @@ int tty_putc(int c)
|
|||||||
{
|
{
|
||||||
char buf = c;
|
char buf = c;
|
||||||
|
|
||||||
return tty_write(&buf,1);
|
return tty_put(&buf, 1);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int tty_put(char *buf, int size)
|
|
||||||
{
|
|
||||||
return tty_write(buf,size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#define TTYIO_H
|
#define TTYIO_H
|
||||||
|
|
||||||
#define TCHECK() tty_check()
|
#define TCHECK() tty_check()
|
||||||
#define FLUSHOUT() tty_flushout()
|
|
||||||
#define FLUSHIN() tty_flushin()
|
#define FLUSHIN() tty_flushin()
|
||||||
#define PUTCHAR(x) tty_putc(x)
|
#define PUTCHAR(x) tty_putc(x)
|
||||||
#define PUT(x,y) tty_put(x,y)
|
#define PUT(x,y) tty_put(x,y)
|
||||||
@ -27,8 +26,6 @@
|
|||||||
#define HANGUP (-STAT_HANGUP)
|
#define HANGUP (-STAT_HANGUP)
|
||||||
#define EMPTY (-STAT_EMPTY)
|
#define EMPTY (-STAT_EMPTY)
|
||||||
|
|
||||||
#define GET_COMPLETE(x) (x & 1)
|
|
||||||
#define PUT_COMPLETE(x) (x & 2)
|
|
||||||
|
|
||||||
#ifndef NUL
|
#ifndef NUL
|
||||||
#define NUL 0x00
|
#define NUL 0x00
|
||||||
@ -77,13 +74,13 @@
|
|||||||
#define TSYNC 0xae
|
#define TSYNC 0xae
|
||||||
#define YOOHOO 0xf1
|
#define YOOHOO 0xf1
|
||||||
|
|
||||||
extern int tty_status;
|
|
||||||
|
|
||||||
extern int tty_check(void);
|
int tty_status;
|
||||||
extern int tty_getc(int);
|
int tty_check(void);
|
||||||
extern int tty_putc(int);
|
int tty_getc(int);
|
||||||
extern int tty_put(char*,int);
|
int tty_putc(int);
|
||||||
extern void tty_flushout(void);
|
int tty_put(char*, int);
|
||||||
extern void tty_flushin(void);
|
void tty_flushin(void);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -128,20 +128,17 @@ et_tu:
|
|||||||
eof_seen = FALSE;
|
eof_seen = FALSE;
|
||||||
Syslog('x', "Send %s", printablec(NAKchar));
|
Syslog('x', "Send %s", printablec(NAKchar));
|
||||||
sendline(NAKchar);
|
sendline(NAKchar);
|
||||||
// ioctl(1, TCFLSH, 0);
|
|
||||||
purgeline(0); /* Do read next time ... */
|
purgeline(0); /* Do read next time ... */
|
||||||
while ((c = wcgetsec(&Blklen, rpn, 10)) != 0) {
|
while ((c = wcgetsec(&Blklen, rpn, 10)) != 0) {
|
||||||
if (c == WCEOT) {
|
if (c == WCEOT) {
|
||||||
Syslog('x', "Pathname fetch returned EOT");
|
Syslog('x', "Pathname fetch returned EOT");
|
||||||
sendline(ACK);
|
sendline(ACK);
|
||||||
// ioctl(1, TCFLSH, 0);
|
|
||||||
purgeline(0); /* Do read next time ... */
|
purgeline(0); /* Do read next time ... */
|
||||||
goto et_tu;
|
goto et_tu;
|
||||||
}
|
}
|
||||||
return TERROR;
|
return TERROR;
|
||||||
}
|
}
|
||||||
sendline(ACK);
|
sendline(ACK);
|
||||||
// ioctl(1, TCFLSH, 0);
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +159,6 @@ int wcrx(void)
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
sendline(sendchar); /* send it now, we're ready! */
|
sendline(sendchar); /* send it now, we're ready! */
|
||||||
// ioctl(1, TCFLSH, 0);
|
|
||||||
purgeline(0); /* Do read next time ... */
|
purgeline(0); /* Do read next time ... */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -191,7 +187,6 @@ int wcrx(void)
|
|||||||
if (closeit(1))
|
if (closeit(1))
|
||||||
return ERROR;
|
return ERROR;
|
||||||
sendline(ACK);
|
sendline(ACK);
|
||||||
// ioctl(1, TCFLSH, 0);
|
|
||||||
purgeline(0); /* Do read next time ... */
|
purgeline(0); /* Do read next time ... */
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -279,14 +274,12 @@ humbug:
|
|||||||
|
|
||||||
if (Firstsec) {
|
if (Firstsec) {
|
||||||
sendline(NAKchar);
|
sendline(NAKchar);
|
||||||
// ioctl(1, TCFLSH, 0);
|
|
||||||
Syslog('x', "%s: send %s", protname(), printablec(NAKchar));
|
Syslog('x', "%s: send %s", protname(), printablec(NAKchar));
|
||||||
purgeline(0); /* Do read next time ... */
|
purgeline(0); /* Do read next time ... */
|
||||||
} else {
|
} else {
|
||||||
maxtime = 5;
|
maxtime = 5;
|
||||||
sendline(NAK);
|
sendline(NAK);
|
||||||
Syslog('x', "%s: send NAK", protname());
|
Syslog('x', "%s: send NAK", protname());
|
||||||
// ioctl(1, TCFLSH, 0);
|
|
||||||
purgeline(0); /* Do read next time ... */
|
purgeline(0); /* Do read next time ... */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,6 @@ static int wctxpn(char *fname)
|
|||||||
if ((input_f != stdin) && *fname)
|
if ((input_f != stdin) && *fname)
|
||||||
sprintf(p, "%lu %lo %o 0 %d %ld", (long) f.st_size, f.st_mtime,
|
sprintf(p, "%lu %lo %o 0 %d %ld", (long) f.st_size, f.st_mtime,
|
||||||
(unsigned int)((no_unixmode) ? 0 : f.st_mode), Filesleft, Totalleft);
|
(unsigned int)((no_unixmode) ? 0 : f.st_mode), Filesleft, Totalleft);
|
||||||
// sprintf(p, "%lu %lo 0 0 0 0", (long) f.st_size, f.st_mtime);
|
|
||||||
|
|
||||||
Totalleft -= f.st_size;
|
Totalleft -= f.st_size;
|
||||||
if (--Filesleft <= 0)
|
if (--Filesleft <= 0)
|
||||||
@ -256,11 +255,6 @@ static int getnak(void)
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
tries++;
|
tries++;
|
||||||
switch (firstch = GETCHAR(10)) {
|
switch (firstch = GETCHAR(10)) {
|
||||||
// case ZPAD:
|
|
||||||
// if (getzrxinit())
|
|
||||||
// return ERROR;
|
|
||||||
// Ascii = 0; /* Receiver does the conversion */
|
|
||||||
// return FALSE;
|
|
||||||
case TIMEOUT:
|
case TIMEOUT:
|
||||||
Syslog('x', "getnak: timeout try %d", tries);
|
Syslog('x', "getnak: timeout try %d", tries);
|
||||||
/* 50 seconds are enough (was 30, 26-11-2004 MB) */
|
/* 50 seconds are enough (was 30, 26-11-2004 MB) */
|
||||||
@ -268,17 +262,6 @@ static int getnak(void)
|
|||||||
Syslog('x', "Timeout on pathname");
|
Syslog('x', "Timeout on pathname");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/* don't send a second ZRQINIT _directly_ after the
|
|
||||||
* first one. Never send more then 4 ZRQINIT, because
|
|
||||||
* omen rz stops if it saw 5 of them */
|
|
||||||
// if ((zrqinits_sent>1 || tries>1) && zrqinits_sent<4) {
|
|
||||||
/* if we already sent a ZRQINIT we are using zmodem
|
|
||||||
* protocol and may send further ZRQINITs
|
|
||||||
*/
|
|
||||||
// stohdr(0L);
|
|
||||||
// zshhdr(ZRQINIT, Txhdr);
|
|
||||||
// zrqinits_sent++;
|
|
||||||
// }
|
|
||||||
continue;
|
continue;
|
||||||
case WANTG:
|
case WANTG:
|
||||||
Syslog('x', "getnak: got WANTG");
|
Syslog('x', "getnak: got WANTG");
|
||||||
|
Reference in New Issue
Block a user