diff options
author | jkh <jkh@FreeBSD.org> | 1996-12-22 17:29:33 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1996-12-22 17:29:33 +0000 |
commit | 52623b565c8fc4ba063611c16810780149f5a572 (patch) | |
tree | 72cd3867b0a34f1c1c5b4b27757dd905d1a8e4e0 /usr.sbin/ppp/modem.c | |
parent | 6ca14a89c608ae04e77c840dbd24a9587eb1e5c7 (diff) | |
download | FreeBSD-src-52623b565c8fc4ba063611c16810780149f5a572.zip FreeBSD-src-52623b565c8fc4ba063611c16810780149f5a572.tar.gz |
For /usr/sbin/ppp, you must choose between running ppp in the background or
connecting to a host immediately in the foreground.
I would like to be able to run ppp from a script so that my script can be
sure that it is connected to the 'net before it continues running:
# Dial up the internet.
ppp -background myprovider || exit 1
do-some-net-command
# Hang up the modem.
kill -HUP `cat /var/run/ppp.tun0.pid`
Another problem is that the current ppp calls its process id file
`/var/run/PPP.server', which may conflict if you have more than one IP
tunnel interface available.
Closes PR#1469
Submitted by: Gord Matzigkeit <gord@enci.ucalgary.ca>
Diffstat (limited to 'usr.sbin/ppp/modem.c')
-rw-r--r-- | usr.sbin/ppp/modem.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index b0e0f71..a4fdcae 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.24 1996/05/11 20:48:36 phk Exp $ + * $Id: modem.c,v 1.25 1996/12/22 17:09:14 jkh Exp $ * * TODO: */ @@ -724,6 +724,7 @@ int DialModem() { char ScriptBuffer[200]; + int excode = 0; strcpy(ScriptBuffer, VarDialScript); if (DoChat(ScriptBuffer) > 0) { @@ -735,16 +736,25 @@ DialModem() fprintf(stderr, "login OK!\n"); return(1); } else { - if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER) + if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER) { fprintf(stderr, "login failed.\n"); + excode = EX_NOLOGIN; + } } ModemTimeout(); /* Dummy call to check modem status */ } else { - if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER) + if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER) { fprintf(stderr, "dial failed.\n"); + excode = EX_NODIAL; + } } HangupModem(0); + if (mode & MODE_BACKGROUND) { + extern void Cleanup(); + CloseModem(); + Cleanup(excode); + } return(0); } |