Allow a "hangup" capability.
You can now "ATZ" your modem when it's closed. Submitted by: peter@citylink.dinoex.sub.org (Peter Much)
This commit is contained in:
parent
18f72dfed8
commit
c09be724d6
@ -18,7 +18,7 @@
|
||||
* Columbus, OH 43221
|
||||
* (614)451-1883
|
||||
*
|
||||
* $Id: chat.c,v 1.27 1997/06/23 23:10:05 brian Exp $
|
||||
* $Id: chat.c,v 1.28 1997/07/01 21:31:21 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Support more UUCP compatible control sequences.
|
||||
@ -569,6 +569,9 @@ DoChat(char *script)
|
||||
char **argv;
|
||||
int argc, n, state;
|
||||
|
||||
if (!script || !*script)
|
||||
return MATCH;
|
||||
|
||||
/* While we're chatting, we want an INT to fail us */
|
||||
if (setjmp(ChatEnv)) {
|
||||
signal(SIGINT, oint);
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: command.c,v 1.65 1997/06/30 03:03:29 brian Exp $
|
||||
* $Id: command.c,v 1.66 1997/07/12 19:22:34 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
@ -1149,6 +1149,7 @@ char **argv;
|
||||
#define VAR_DEVICE 4
|
||||
#define VAR_ACCMAP 5
|
||||
#define VAR_PHONE 6
|
||||
#define VAR_HANGUP 7
|
||||
|
||||
static int
|
||||
SetVariable(list, argc, argv, param)
|
||||
@ -1199,6 +1200,10 @@ int param;
|
||||
strcpy(VarPhoneCopy, VarPhoneList);
|
||||
VarNextPhone = VarPhoneCopy;
|
||||
break;
|
||||
case VAR_HANGUP:
|
||||
strncpy(VarHangupScript, arg, sizeof(VarHangupScript)-1);
|
||||
VarHangupScript[sizeof(VarHangupScript)-1] = '\0';
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1259,6 +1264,8 @@ struct cmdtab const SetCommands[] = {
|
||||
"Set dialing script", "set dial chat-script", (void *)VAR_DIAL},
|
||||
{ "escape", NULL, SetEscape, LOCAL_AUTH,
|
||||
"Set escape characters", "set escape hex-digit ..."},
|
||||
{ "hangup", NULL, SetVariable, LOCAL_AUTH,
|
||||
"Set hangup script", "set hangup chat-script", (void *)VAR_HANGUP},
|
||||
{ "ifaddr", NULL, SetInterfaceAddr, LOCAL_AUTH,
|
||||
"Set destination address", "set ifaddr [src-addr [dst-addr [netmask [trg-addr]]]]"},
|
||||
{ "ifilter", NULL, SetIfilter, LOCAL_AUTH,
|
||||
|
@ -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.43 1997/06/11 03:57:50 brian Exp $
|
||||
* $Id: modem.c,v 1.44 1997/06/23 23:10:13 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -206,10 +206,14 @@ static time_t uptime;
|
||||
void
|
||||
DownConnection()
|
||||
{
|
||||
char ScriptBuffer[200];
|
||||
|
||||
LogPrintf(LogPHASE, "Disconnected!\n");
|
||||
if (uptime)
|
||||
LogPrintf(LogPHASE, "Connect time: %d secs\n", time(NULL) - uptime);
|
||||
uptime = 0;
|
||||
strcpy(ScriptBuffer, VarHangupScript); /* arrays are the same size */
|
||||
DoChat(ScriptBuffer);
|
||||
if (!TermMode) {
|
||||
CloseModem();
|
||||
LcpDown();
|
||||
@ -572,13 +576,19 @@ int flag;
|
||||
*/
|
||||
if (modem >= 0)
|
||||
{
|
||||
tcflush(modem, TCIOFLUSH);
|
||||
UnrawModem(modem);
|
||||
close(modem);
|
||||
char ScriptBuffer[200];
|
||||
|
||||
strcpy(ScriptBuffer, VarHangupScript); /* arrays are the same size */
|
||||
DoChat(ScriptBuffer);
|
||||
tcflush(modem, TCIOFLUSH);
|
||||
UnrawModem(modem);
|
||||
close(modem);
|
||||
}
|
||||
modem = -1; /* Mark as modem has closed */
|
||||
(void) uu_unlock(VarBaseDevice);
|
||||
} else if (modem >= 0) {
|
||||
char ScriptBuffer[200];
|
||||
|
||||
mbits |= TIOCM_DTR;
|
||||
#ifndef notyet
|
||||
ioctl(modem, TIOCMSET, &mbits);
|
||||
@ -587,6 +597,8 @@ int flag;
|
||||
cfsetspeed(&ts, IntToSpeed(VarSpeed));
|
||||
tcsetattr(modem, TCSADRAIN, &ts);
|
||||
#endif
|
||||
strcpy(ScriptBuffer, VarHangupScript); /* arrays are the same size */
|
||||
DoChat(ScriptBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $Id: ppp.8,v 1.43 1997/06/30 03:03:35 brian Exp $
|
||||
.\" $Id: ppp.8,v 1.44 1997/07/01 21:31:28 brian Exp $
|
||||
.Dd 20 September 1995
|
||||
.Os FreeBSD
|
||||
.Dt PPP 8
|
||||
@ -1559,6 +1559,11 @@ below) and the string \\\\P will be replaced with the password (see
|
||||
.Dq set key
|
||||
above).
|
||||
|
||||
.It set hangup chat-script
|
||||
This specifies the chat script that will be used to reset the modem
|
||||
before it is closed. It should not normally be necessary, but can
|
||||
be used for devices that fail to reset themselves properly on close.
|
||||
|
||||
.It set escape value...
|
||||
This option is similar to the
|
||||
.Dq set accmap
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $Id: ppp.8,v 1.43 1997/06/30 03:03:35 brian Exp $
|
||||
.\" $Id: ppp.8,v 1.44 1997/07/01 21:31:28 brian Exp $
|
||||
.Dd 20 September 1995
|
||||
.Os FreeBSD
|
||||
.Dt PPP 8
|
||||
@ -1559,6 +1559,11 @@ below) and the string \\\\P will be replaced with the password (see
|
||||
.Dq set key
|
||||
above).
|
||||
|
||||
.It set hangup chat-script
|
||||
This specifies the chat script that will be used to reset the modem
|
||||
before it is closed. It should not normally be necessary, but can
|
||||
be used for devices that fail to reset themselves properly on close.
|
||||
|
||||
.It set escape value...
|
||||
This option is similar to the
|
||||
.Dq set accmap
|
||||
|
@ -15,7 +15,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: vars.h,v 1.18 1997/06/09 03:27:42 brian Exp $
|
||||
* $Id: vars.h,v 1.19 1997/06/11 03:57:51 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -85,6 +85,7 @@ struct pppvars {
|
||||
char phone_copy[200]; /* copy for strsep() */
|
||||
char *next_phone; /* Next phone from the list */
|
||||
char shostname[MAXHOSTNAMELEN];/* Local short Host Name */
|
||||
char hangup_script[200]; /* Hangup script before modem is closed */
|
||||
struct aliasHandlers handler; /* Alias function pointers */
|
||||
};
|
||||
|
||||
@ -99,6 +100,7 @@ struct pppvars {
|
||||
#define VarOpenMode pppVars.open_mode
|
||||
#define VarLocalAuth pppVars.lauth
|
||||
#define VarDialScript pppVars.dial_script
|
||||
#define VarHangupScript pppVars.hangup_script
|
||||
#define VarLoginScript pppVars.login_script
|
||||
#define VarIdleTimeout pppVars.idle_timeout
|
||||
#define VarLqrTimeout pppVars.lqr_timeout
|
||||
|
Loading…
Reference in New Issue
Block a user