summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/command.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-11-13 14:43:20 +0000
committerbrian <brian@FreeBSD.org>1997-11-13 14:43:20 +0000
commit1b096d24d96081ff46460353a825801f161ba97a (patch)
treebf625cfae5f3ec15d8d579813e0dd6f06a0157a5 /usr.sbin/ppp/command.c
parentf38c8654e56487fbac49838d797ac4687ff69200 (diff)
downloadFreeBSD-src-1b096d24d96081ff46460353a825801f161ba97a.zip
FreeBSD-src-1b096d24d96081ff46460353a825801f161ba97a.tar.gz
Fix command logging (broken with the "allow" command).
Diffstat (limited to 'usr.sbin/ppp/command.c')
-rw-r--r--usr.sbin/ppp/command.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index 025fda0..5156962 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.100 1997/11/12 16:34:50 brian Exp $
+ * $Id: command.c,v 1.101 1997/11/12 18:47:28 brian Exp $
*
*/
#include <sys/param.h>
@@ -707,23 +707,39 @@ InterpretCommand(char *buff, int nb, int *argc, char ***argv)
}
void
-RunCommand(int argc, char **argv, int prompt)
+RunCommand(int argc, char **argv, const char *label)
{
- if (argc > 0)
+ if (argc > 0) {
+ if (LogIsKept(LogCOMMAND)) {
+ static char buf[LINE_LEN];
+ int f, n;
+
+ *buf = '\0';
+ if (label) {
+ strcpy(buf, label);
+ strcat(buf, ": ");
+ }
+ n = strlen(buf);
+ for (f = 0; f < argc; f++) {
+ if (n < sizeof(buf)-1 && f)
+ buf[n++] = ' ';
+ strncpy(buf+n, argv[f], sizeof(buf)-n-1);
+ n += strlen(buf+n);
+ }
+ LogPrintf(LogCOMMAND, "%s\n", buf);
+ }
FindExec(Commands, argc, argv);
-
- if (prompt)
- Prompt();
+ }
}
void
-DecodeCommand(char *buff, int nb, int prompt)
+DecodeCommand(char *buff, int nb, const char *label)
{
int argc;
char **argv;
InterpretCommand(buff, nb, &argc, &argv);
- RunCommand(argc, argv, prompt);
+ RunCommand(argc, argv, label);
}
static int
OpenPOWER on IntegriCloud