aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ppp/command.c
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>1997-11-13 14:43:20 +0000
committerBrian Somers <brian@FreeBSD.org>1997-11-13 14:43:20 +0000
commitd9181b051285b6e652b845ea3b1b477d5746d744 (patch)
tree12563683fb7df6a3ca93f1424f0cbd91a7d9d120 /usr.sbin/ppp/command.c
parent04da22ce2db9bce2a769dde02f195a4b14e4273c (diff)
downloadsrc-d9181b051285b6e652b845ea3b1b477d5746d744.tar.gz
src-d9181b051285b6e652b845ea3b1b477d5746d744.zip
Notes
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 025fda01de61..5156962ac753 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