Add the following word substitutions when running a shell

command:
  AUTHNAME:     The local authname
  ENDDISC:      The local endpoint discriminator
  LABEL:        The configuration label in use
  PEER_ENDDISC: The peers endpoint discriminator
  USER:         The peers authname
This commit is contained in:
Brian Somers 1998-08-29 23:02:42 +00:00
parent 080a2247c2
commit 131ef891c7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=38629
3 changed files with 109 additions and 35 deletions

View File

@ -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.163 1998/08/29 18:37:02 brian Exp $
* $Id: command.c,v 1.164 1998/08/29 23:02:39 brian Exp $
*
*/
#include <sys/types.h>
@ -127,7 +127,7 @@
#define NEG_DNS 50
const char Version[] = "2.0";
const char VersionDate[] = "$Date: 1998/08/29 18:37:02 $";
const char VersionDate[] = "$Date: 1998/08/29 23:02:39 $";
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);
@ -376,10 +376,22 @@ expand(char **nargv, int argc, char const *const *oargv, struct bundle *bundle)
nargv[0] = strdup(oargv[0]);
for (arg = 1; arg < argc; arg++) {
nargv[arg] = subst(strdup(oargv[arg]), "HISADDR",
nargv[arg] = strdup(oargv[arg]);
nargv[arg] = subst(nargv[arg], "HISADDR",
inet_ntoa(bundle->ncp.ipcp.peer_ip));
nargv[arg] = subst(nargv[arg], "AUTHNAME", bundle->cfg.auth.name);
nargv[arg] = subst(nargv[arg], "INTERFACE", bundle->ifp.Name);
nargv[arg] = subst(nargv[arg], "MYADDR", inet_ntoa(bundle->ncp.ipcp.my_ip));
nargv[arg] = subst(nargv[arg], "USER", bundle->ncp.mp.peer.authname);
nargv[arg] = subst(nargv[arg], "PEER_ENDDISC",
mp_Enddisc(bundle->ncp.mp.peer.enddisc.class,
bundle->ncp.mp.peer.enddisc.address,
bundle->ncp.mp.peer.enddisc.len));
nargv[arg] = subst(nargv[arg], "ENDDISC",
mp_Enddisc(bundle->ncp.mp.cfg.enddisc.class,
bundle->ncp.mp.cfg.enddisc.address,
bundle->ncp.mp.cfg.enddisc.len));
nargv[arg] = subst(nargv[arg], "LABEL", bundle_GetLabel(bundle));
}
nargv[arg] = NULL;
}

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.119 1998/08/25 17:48:43 brian Exp $
.\" $Id: ppp.8,v 1.120 1998/08/25 17:48:55 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -2343,15 +2343,47 @@ which comes with the source distribution.
.It [!]bg Ar command
The given
.Ar command
is executed in the background. Any of the pseudo arguments
.Dv HISADDR ,
.Dv INTERFACE
and
.Dv MYADDR
will be replaced with the appropriate values. If you wish to pause
is executed in the background with the following words replaced:
.Bl -tag -width PEER_ENDDISC
.It Li AUTHNAME
This is replaced with the local
.Ar authname
value. See the
.Dq set authname
command below.
.It Li ENDDISC
This is replaced with the local endpoint discriminator value. See the
.Dq set enddisc
command below.
.It Li HISADDR
This is replaced with the peers IP number.
.It Li INTERFACE
This is replaced with the name of the interface that's in use.
.It Li LABEL
This is replaced with the last label name used. A label may be specified
on the
.Nm
command line, via the
.Dq load
or
.Dq dial
commands and in the
.Pa ppp.secret
file.
.It Li MYADDR
This is replaced with the IP number assigned to the local interface.
.It Li PEER_ENDDISC
This is replaced with the value of the peers endpoint discriminator.
.It Li USER
This is replaced with the username that has been authenticated with PAP or
CHAP. Normally, this variable is assigned only in -direct mode. This value
is available irrespective of whether utmp logging is enabled.
.El
.Pp
If you wish to pause
.Nm
while the command executes, use the
.Dv shell
.Dq shell
command instead.
.It clear modem|ipcp Op current|overall|peak...
Clear the specified throughput values at either the
@ -3351,14 +3383,13 @@ is not specified a shell is invoked according to the
.Dv SHELL
environment variable. Otherwise, the given
.Ar command
is executed. Any of the pseudo arguments
.Dv HISADDR ,
.Dv INTERFACE
and
.Dv MYADDR
will be replaced with the appropriate values. Use of the ! character
requires a following space as with any other commands. You should note
that this command is executed in the foreground -
is executed. Word replacement is done in the same way as for the
.Dq !bg
commanad as described above.
.Pp
Use of the ! character
requires a following space as with any of the other commands. You should
note that this command is executed in the foreground -
.Nm
will not continue running until this process has exited. Use the
.Dv bg

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.119 1998/08/25 17:48:43 brian Exp $
.\" $Id: ppp.8,v 1.120 1998/08/25 17:48:55 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -2343,15 +2343,47 @@ which comes with the source distribution.
.It [!]bg Ar command
The given
.Ar command
is executed in the background. Any of the pseudo arguments
.Dv HISADDR ,
.Dv INTERFACE
and
.Dv MYADDR
will be replaced with the appropriate values. If you wish to pause
is executed in the background with the following words replaced:
.Bl -tag -width PEER_ENDDISC
.It Li AUTHNAME
This is replaced with the local
.Ar authname
value. See the
.Dq set authname
command below.
.It Li ENDDISC
This is replaced with the local endpoint discriminator value. See the
.Dq set enddisc
command below.
.It Li HISADDR
This is replaced with the peers IP number.
.It Li INTERFACE
This is replaced with the name of the interface that's in use.
.It Li LABEL
This is replaced with the last label name used. A label may be specified
on the
.Nm
command line, via the
.Dq load
or
.Dq dial
commands and in the
.Pa ppp.secret
file.
.It Li MYADDR
This is replaced with the IP number assigned to the local interface.
.It Li PEER_ENDDISC
This is replaced with the value of the peers endpoint discriminator.
.It Li USER
This is replaced with the username that has been authenticated with PAP or
CHAP. Normally, this variable is assigned only in -direct mode. This value
is available irrespective of whether utmp logging is enabled.
.El
.Pp
If you wish to pause
.Nm
while the command executes, use the
.Dv shell
.Dq shell
command instead.
.It clear modem|ipcp Op current|overall|peak...
Clear the specified throughput values at either the
@ -3351,14 +3383,13 @@ is not specified a shell is invoked according to the
.Dv SHELL
environment variable. Otherwise, the given
.Ar command
is executed. Any of the pseudo arguments
.Dv HISADDR ,
.Dv INTERFACE
and
.Dv MYADDR
will be replaced with the appropriate values. Use of the ! character
requires a following space as with any other commands. You should note
that this command is executed in the foreground -
is executed. Word replacement is done in the same way as for the
.Dq !bg
commanad as described above.
.Pp
Use of the ! character
requires a following space as with any of the other commands. You should
note that this command is executed in the foreground -
.Nm
will not continue running until this process has exited. Use the
.Dv bg