Removed some ttyio heavy debug from mbcico
This commit is contained in:
parent
b3b4b5dcb5
commit
821e1dc5b6
@ -20,6 +20,10 @@ v0.37.3 09-Apr-2003.
|
||||
Added menu function display file.
|
||||
Display ascii textfiles now uses the More Y/n/= prompt.
|
||||
|
||||
mbcico:
|
||||
Removed some heavy debug code from ttyio functions to increase
|
||||
throughput.
|
||||
|
||||
lang:
|
||||
New language prompt number 17.
|
||||
Erased language prompts 18..36.
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Fidonet mailer
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2003
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -76,11 +76,10 @@ int tty_resettimer(int tno)
|
||||
{
|
||||
if (tno >= NUMTIMERS) {
|
||||
errno = EINVAL;
|
||||
WriteError("$ttyio: invalid timer No for resettimer()");
|
||||
WriteError("ttyio: invalid timer No for resettimer(%d)", tno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Syslog('T', "ttyio: resettimer(%d)", tno);
|
||||
timer[tno] = (time_t) 0;
|
||||
return 0;
|
||||
}
|
||||
@ -91,7 +90,6 @@ void tty_resettimers(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
Syslog('T', "ttyio: resettimers");
|
||||
for (i = 0; i < NUMTIMERS; i++)
|
||||
timer[i] = (time_t)0;
|
||||
}
|
||||
@ -102,11 +100,10 @@ int tty_settimer(int tno, int interval)
|
||||
{
|
||||
if (tno >= NUMTIMERS) {
|
||||
errno = EINVAL;
|
||||
WriteError("$ttyio: invalid timer No for settimer()");
|
||||
WriteError("ttyio: invalid timer No for settimer(%d)", tno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Syslog('T', "ttyio: settimer(%d,%d)",tno,interval);
|
||||
timer[tno]=time((time_t*)NULL)+interval;
|
||||
return 0;
|
||||
}
|
||||
@ -119,7 +116,7 @@ int tty_expired(int tno)
|
||||
|
||||
if (tno >= NUMTIMERS) {
|
||||
errno = EINVAL;
|
||||
WriteError("$ttyio: invalid timer No for expired(%d)", tno);
|
||||
WriteError("ttyio: invalid timer No for expired(%d)", tno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -130,7 +127,6 @@ int tty_expired(int tno)
|
||||
return 0;
|
||||
|
||||
now = time(NULL);
|
||||
Syslog('T', "ttyio: expired(%d) now=%lu,timer=%lu,return %s", tno,now,timer[tno],(now >= timer[tno])?"yes":"no");
|
||||
return (now >= timer[tno]);
|
||||
}
|
||||
|
||||
@ -140,7 +136,7 @@ int tty_running(int tno)
|
||||
{
|
||||
if (tno > NUMTIMERS) {
|
||||
errno = EINVAL;
|
||||
WriteError("$ttyio: invalid timer for tty_running(%d)", tno);
|
||||
WriteError("ttyio: invalid timer for tty_running(%d)", tno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -166,7 +162,6 @@ static int tty_read(char *buf, int size, int tot)
|
||||
fd_set readfds, writefds, exceptfds;
|
||||
struct timeval seltimer;
|
||||
|
||||
Syslog('T', "tty_read: (%08lx,%d,%d)",buf,size,tot);
|
||||
if (size == 0)
|
||||
return 0;
|
||||
tty_status = 0;
|
||||
@ -178,8 +173,7 @@ static int tty_read(char *buf, int size, int tot)
|
||||
if (timer[i]) {
|
||||
if (now >= timer[i]) {
|
||||
tty_status=STAT_TIMEOUT;
|
||||
Syslog('-', "tty_read: timer %d already expired, return",i);
|
||||
// Syslog('t', "tty_read: timer %d already expired, return",i);
|
||||
Syslog('!', "tty_read: timer %d already expired, return", i);
|
||||
return -tty_status;
|
||||
} else {
|
||||
if (timeout > (timer[i]-now))
|
||||
@ -190,8 +184,6 @@ static int tty_read(char *buf, int size, int tot)
|
||||
if ((tot != -1) && (timeout > tot))
|
||||
timeout=tot;
|
||||
|
||||
Syslog('T', "tty_read: timeout = %d", timeout);
|
||||
|
||||
FD_ZERO(&readfds);
|
||||
FD_ZERO(&writefds);
|
||||
FD_ZERO(&exceptfds);
|
||||
@ -205,7 +197,7 @@ static int tty_read(char *buf, int size, int tot)
|
||||
if (rc < 0) {
|
||||
if (hanged_up) {
|
||||
tty_status=STAT_HANGUP;
|
||||
WriteError("$tty_read: hanged_up flag");
|
||||
WriteError("tty_read: hanged_up flag");
|
||||
} else {
|
||||
WriteError("$tty_read: select for read failed");
|
||||
tty_status = STAT_ERROR;
|
||||
@ -214,13 +206,12 @@ static int tty_read(char *buf, int size, int tot)
|
||||
tty_status = STAT_TIMEOUT;
|
||||
} else { /* rc > 0 */
|
||||
if (FD_ISSET(0,&exceptfds)) {
|
||||
Syslog('+', "$tty_read: exeption error");
|
||||
Syslog('!', "$tty_read: exeption error");
|
||||
tty_status = STAT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (tty_status) {
|
||||
Syslog('T', "tty_read: return after select: %s",ttystat[tty_status]);
|
||||
return -tty_status;
|
||||
}
|
||||
|
||||
@ -235,14 +226,14 @@ static int tty_read(char *buf, int size, int tot)
|
||||
Syslog('t', "tty_read: return %d",rc);
|
||||
if (hanged_up || (errno == EPIPE) || (errno == ECONNRESET)) {
|
||||
tty_status = STAT_HANGUP;
|
||||
WriteError("$tty_read: hanged_up flag");
|
||||
WriteError("tty_read: hanged_up flag");
|
||||
} else {
|
||||
tty_status = STAT_ERROR;
|
||||
Syslog('-', "tty_read: error flag");
|
||||
Syslog('!', "tty_read: error flag");
|
||||
}
|
||||
rc=-tty_status;
|
||||
} else
|
||||
Syslog('T', "tty_read: %s %d characters", printable(buf, rc), rc);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -252,18 +243,16 @@ int tty_write(char *buf, int size)
|
||||
{
|
||||
int result;
|
||||
|
||||
Syslog('T', "tty_write(%08lx,%d)",buf,size);
|
||||
|
||||
tty_status=0;
|
||||
result = write(1,buf,size);
|
||||
|
||||
if (result != size) {
|
||||
if (hanged_up || (errno == EPIPE) || (errno == ECONNRESET)) {
|
||||
tty_status = STAT_HANGUP;
|
||||
WriteError("$tty_write: hanged_up flag");
|
||||
WriteError("tty_write: hanged_up flag");
|
||||
} else {
|
||||
tty_status=STAT_ERROR;
|
||||
Syslog('-', "tty_write: error flag");
|
||||
Syslog('!', "tty_write: error flag");
|
||||
}
|
||||
}
|
||||
if (tty_status)
|
||||
@ -276,7 +265,7 @@ int tty_write(char *buf, int size)
|
||||
|
||||
/* public r/w functions */
|
||||
|
||||
/**
|
||||
/*
|
||||
* Check if there is data available on stdin.
|
||||
*/
|
||||
int tty_check(void)
|
||||
|
Reference in New Issue
Block a user