From 2b23dbce042044ec20c571600164b14b7d6d6543 Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 27 Oct 1998 22:53:19 +0000 Subject: Add ``PROCESSID'' as a constant expanded when running commands. --- usr.sbin/ppp/command.c | 7 +++++-- usr.sbin/ppp/ppp.8 | 4 +++- usr.sbin/ppp/ppp.8.m4 | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index 2e432ff..a45ab3c 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -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.171 1998/10/26 19:07:39 brian Exp $ + * $Id: command.c,v 1.172 1998/10/26 19:07:42 brian Exp $ * */ #include @@ -134,7 +134,7 @@ #define NEG_DNS 50 const char Version[] = "2.0"; -const char VersionDate[] = "$Date: 1998/10/26 19:07:39 $"; +const char VersionDate[] = "$Date: 1998/10/26 19:07:42 $"; static int ShowCommand(struct cmdargs const *); static int TerminalCommand(struct cmdargs const *); @@ -384,8 +384,10 @@ static void expand(char **nargv, int argc, char const *const *oargv, struct bundle *bundle) { int arg; + char pid[12]; nargv[0] = strdup(oargv[0]); + snprintf(pid, sizeof pid, "%d", getpid()); for (arg = 1; arg < argc; arg++) { nargv[arg] = strdup(oargv[arg]); nargv[arg] = subst(nargv[arg], "HISADDR", @@ -402,6 +404,7 @@ expand(char **nargv, int argc, char const *const *oargv, struct bundle *bundle) 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], "PROCESSID", pid); nargv[arg] = subst(nargv[arg], "LABEL", bundle_GetLabel(bundle)); } nargv[arg] = NULL; diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8 index 22aa170..ddd3cf0 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.129 1998/10/26 19:07:39 brian Exp $ +.\" $Id: ppp.8,v 1.130 1998/10/27 22:53:18 brian Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -2381,6 +2381,8 @@ file. 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 PROCESSID +This is replaced with the current process id. .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 diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4 index 22aa170..ddd3cf0 100644 --- a/usr.sbin/ppp/ppp.8.m4 +++ b/usr.sbin/ppp/ppp.8.m4 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.129 1998/10/26 19:07:39 brian Exp $ +.\" $Id: ppp.8,v 1.130 1998/10/27 22:53:18 brian Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -2381,6 +2381,8 @@ file. 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 PROCESSID +This is replaced with the current process id. .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 -- cgit v1.1