diff options
author | brian <brian@FreeBSD.org> | 1997-06-23 23:10:13 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-06-23 23:10:13 +0000 |
commit | a3c9607200fa5d73b5ca5d98520f8b3ed827bcad (patch) | |
tree | a1d537c05bf29eed0619e803fdc4bb0b59c7c648 /usr.sbin/ppp/modem.c | |
parent | d1c718d9c36fb450a5075b50919dc171fadc6089 (diff) | |
download | FreeBSD-src-a3c9607200fa5d73b5ca5d98520f8b3ed827bcad.zip FreeBSD-src-a3c9607200fa5d73b5ca5d98520f8b3ed827bcad.tar.gz |
o Fix uptime for direct connections.
o Style police
o Make hangup abort the current connection, not
necessarily exiting (-auto/-ddial).
o Trap HUP and INT during DoChat and abort the
connection attempt. This means you can now
type "dial" and change your mind with ^C, or
HUP the process to stop it dialing.
Slapped into doing it by: Chuck Robey <chuckr@glue.umd.edu>
Diffstat (limited to 'usr.sbin/ppp/modem.c')
-rw-r--r-- | usr.sbin/ppp/modem.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index b34545e..4625483 100644 --- a/usr.sbin/ppp/modem.c +++ b/usr.sbin/ppp/modem.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: modem.c,v 1.42 1997/06/09 03:27:30 brian Exp $ + * $Id: modem.c,v 1.43 1997/06/11 03:57:50 brian Exp $ * * TODO: */ @@ -207,7 +207,9 @@ void DownConnection() { LogPrintf(LogPHASE, "Disconnected!\n"); - LogPrintf(LogPHASE, "Connect time: %d secs\n", time(NULL) - uptime); + if (uptime) + LogPrintf(LogPHASE, "Connect time: %d secs\n", time(NULL) - uptime); + uptime = 0; if (!TermMode) { CloseModem(); LcpDown(); @@ -711,19 +713,23 @@ DialModem() strncpy(ScriptBuffer, VarDialScript,sizeof(ScriptBuffer)-1); ScriptBuffer[sizeof(ScriptBuffer)-1] = '\0'; - if (DoChat(ScriptBuffer) > 0) { + if ((excode = DoChat(ScriptBuffer)) > 0) { if (VarTerm) fprintf(VarTerm, "dial OK!\n"); strncpy(ScriptBuffer, VarLoginScript,sizeof(ScriptBuffer)-1); - if (DoChat(ScriptBuffer) > 0) { + if ((excode = DoChat(ScriptBuffer)) > 0) { if (VarTerm) fprintf(VarTerm, "login OK!\n"); return EX_DONE; + } else if (excode == -1) + excode = EX_SIG; + else { + LogPrintf(LogWARN, "DialModem: login failed.\n"); + excode = EX_NOLOGIN; } - LogPrintf(LogWARN, "DialModem: login failed.\n"); ModemTimeout(); /* Dummy call to check modem status */ - excode = EX_NOLOGIN; - } + } else if (excode == -1) + excode = EX_SIG; else { LogPrintf(LogWARN, "DialModem: dial failed.\n"); excode = EX_NODIAL; |