Code cleanup

This commit is contained in:
Michiel Broek 2004-11-28 19:34:06 +00:00
parent 723b8bd999
commit 85166dd9cb
4 changed files with 12 additions and 56 deletions

View File

@ -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;
@ -137,14 +137,14 @@ int tty_write(char *buf, int size)
if (result != size) {
if (hanged_up || (errno == EPIPE) || (errno == ECONNRESET)) {
tty_status = STAT_HANGUP;
WriteError("tty_write: hanged_up flag");
WriteError("tty_put: hanged_up flag");
} else {
tty_status=STAT_ERROR;
Syslog('!', "tty_write: error flag");
Syslog('!', "tty_put: error flag");
}
}
if (tty_status)
Syslog('t', "tty_write: error %s", ttystat[tty_status]);
Syslog('t', "tty_put: error %s", ttystat[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)
{
if (!left) {
@ -217,14 +207,7 @@ int tty_putc(int c)
{
char buf = c;
return tty_write(&buf,1);
}
int tty_put(char *buf, int size)
{
return tty_write(buf,size);
return tty_put(&buf, 1);
}

View File

@ -4,7 +4,6 @@
#define TTYIO_H
#define TCHECK() tty_check()
#define FLUSHOUT() tty_flushout()
#define FLUSHIN() tty_flushin()
#define PUTCHAR(x) tty_putc(x)
#define PUT(x,y) tty_put(x,y)
@ -27,8 +26,6 @@
#define HANGUP (-STAT_HANGUP)
#define EMPTY (-STAT_EMPTY)
#define GET_COMPLETE(x) (x & 1)
#define PUT_COMPLETE(x) (x & 2)
#ifndef NUL
#define NUL 0x00
@ -77,13 +74,13 @@
#define TSYNC 0xae
#define YOOHOO 0xf1
extern int tty_status;
extern int tty_check(void);
extern int tty_getc(int);
extern int tty_putc(int);
extern int tty_put(char*,int);
extern void tty_flushout(void);
extern void tty_flushin(void);
int tty_status;
int tty_check(void);
int tty_getc(int);
int tty_putc(int);
int tty_put(char*, int);
void tty_flushin(void);
#endif

View File

@ -128,20 +128,17 @@ et_tu:
eof_seen = FALSE;
Syslog('x', "Send %s", printablec(NAKchar));
sendline(NAKchar);
// ioctl(1, TCFLSH, 0);
purgeline(0); /* Do read next time ... */
while ((c = wcgetsec(&Blklen, rpn, 10)) != 0) {
if (c == WCEOT) {
Syslog('x', "Pathname fetch returned EOT");
sendline(ACK);
// ioctl(1, TCFLSH, 0);
purgeline(0); /* Do read next time ... */
goto et_tu;
}
return TERROR;
}
sendline(ACK);
// ioctl(1, TCFLSH, 0);
return OK;
}
@ -162,7 +159,6 @@ int wcrx(void)
for (;;) {
sendline(sendchar); /* send it now, we're ready! */
// ioctl(1, TCFLSH, 0);
purgeline(0); /* Do read next time ... */
/*
@ -191,7 +187,6 @@ int wcrx(void)
if (closeit(1))
return ERROR;
sendline(ACK);
// ioctl(1, TCFLSH, 0);
purgeline(0); /* Do read next time ... */
return OK;
}
@ -279,14 +274,12 @@ humbug:
if (Firstsec) {
sendline(NAKchar);
// ioctl(1, TCFLSH, 0);
Syslog('x', "%s: send %s", protname(), printablec(NAKchar));
purgeline(0); /* Do read next time ... */
} else {
maxtime = 5;
sendline(NAK);
Syslog('x', "%s: send NAK", protname());
// ioctl(1, TCFLSH, 0);
purgeline(0); /* Do read next time ... */
}
}

View File

@ -224,7 +224,6 @@ static int wctxpn(char *fname)
if ((input_f != stdin) && *fname)
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);
// sprintf(p, "%lu %lo 0 0 0 0", (long) f.st_size, f.st_mtime);
Totalleft -= f.st_size;
if (--Filesleft <= 0)
@ -256,11 +255,6 @@ static int getnak(void)
for (;;) {
tries++;
switch (firstch = GETCHAR(10)) {
// case ZPAD:
// if (getzrxinit())
// return ERROR;
// Ascii = 0; /* Receiver does the conversion */
// return FALSE;
case TIMEOUT:
Syslog('x', "getnak: timeout try %d", tries);
/* 50 seconds are enough (was 30, 26-11-2004 MB) */
@ -268,17 +262,6 @@ static int getnak(void)
Syslog('x', "Timeout on pathname");
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;
case WANTG:
Syslog('x', "getnak: got WANTG");