summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1998-06-15 19:06:25 +0000
committerbrian <brian@FreeBSD.org>1998-06-15 19:06:25 +0000
commit13defc3317e75eb1c300da13d71fcfca0afa9fea (patch)
treeb381951b12d7887e75222845d5020654bac355ca /usr.sbin
parent3f8652a3018ca60b9dd6e6cabb477c7abf044e98 (diff)
downloadFreeBSD-src-13defc3317e75eb1c300da13d71fcfca0afa9fea.zip
FreeBSD-src-13defc3317e75eb1c300da13d71fcfca0afa9fea.tar.gz
Fix a rather nasty use of `static'. This caused a SEGV
when running ``link * load label'' as we ended up recursing back into command_Interpret after nuking our command arg list.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/alias_cmd.c3
-rw-r--r--usr.sbin/ppp/bundle.c4
-rw-r--r--usr.sbin/ppp/ccp.c4
-rw-r--r--usr.sbin/ppp/command.c22
-rw-r--r--usr.sbin/ppp/command.h4
-rw-r--r--usr.sbin/ppp/filter.c4
-rw-r--r--usr.sbin/ppp/hdlc.c4
-rw-r--r--usr.sbin/ppp/ipcp.c4
-rw-r--r--usr.sbin/ppp/lcp.c4
-rw-r--r--usr.sbin/ppp/log.c4
-rw-r--r--usr.sbin/ppp/mbuf.c3
-rw-r--r--usr.sbin/ppp/modem.c4
-rw-r--r--usr.sbin/ppp/mp.c4
-rw-r--r--usr.sbin/ppp/nat_cmd.c3
-rw-r--r--usr.sbin/ppp/route.c4
-rw-r--r--usr.sbin/ppp/slcompress.c4
-rw-r--r--usr.sbin/ppp/systems.c10
17 files changed, 45 insertions, 44 deletions
diff --git a/usr.sbin/ppp/alias_cmd.c b/usr.sbin/ppp/alias_cmd.c
index c4265fd..eb9d15f 100644
--- a/usr.sbin/ppp/alias_cmd.c
+++ b/usr.sbin/ppp/alias_cmd.c
@@ -2,7 +2,7 @@
* The code in this file was written by Eivind Eklund <perhaps@yes.no>,
* who places it in the public domain without restriction.
*
- * $Id: alias_cmd.c,v 1.12.2.8 1998/05/01 19:23:43 brian Exp $
+ * $Id: alias_cmd.c,v 1.13 1998/05/21 21:43:42 brian Exp $
*/
#include <sys/types.h>
@@ -15,6 +15,7 @@
#include <string.h>
#include <termios.h>
+#include "defs.h"
#include "command.h"
#include "log.h"
#include "loadalias.h"
diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c
index 86ad0f9..56d609f 100644
--- a/usr.sbin/ppp/bundle.c
+++ b/usr.sbin/ppp/bundle.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: bundle.c,v 1.15 1998/06/12 17:45:03 brian Exp $
+ * $Id: bundle.c,v 1.16 1998/06/15 19:05:10 brian Exp $
*/
#include <sys/param.h>
@@ -51,11 +51,11 @@
#include <termios.h>
#include <unistd.h>
+#include "defs.h"
#include "command.h"
#include "mbuf.h"
#include "log.h"
#include "id.h"
-#include "defs.h"
#include "timer.h"
#include "fsm.h"
#include "iplist.h"
diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c
index 3a52abc..086160e 100644
--- a/usr.sbin/ppp/ccp.c
+++ b/usr.sbin/ppp/ccp.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ccp.c,v 1.32 1998/05/21 21:44:21 brian Exp $
+ * $Id: ccp.c,v 1.33 1998/05/23 13:38:00 brian Exp $
*
* TODO:
* o Support other compression protocols
@@ -32,10 +32,10 @@
#include <stdlib.h>
#include <termios.h>
+#include "defs.h"
#include "command.h"
#include "mbuf.h"
#include "log.h"
-#include "defs.h"
#include "timer.h"
#include "fsm.h"
#include "lcpproto.h"
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index 6e8726b..7d292ba 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.142 1998/06/15 19:05:12 brian Exp $
+ * $Id: command.c,v 1.143 1998/06/15 19:05:40 brian Exp $
*
*/
#include <sys/types.h>
@@ -44,10 +44,10 @@
#include <termios.h>
#include <unistd.h>
+#include "defs.h"
#include "command.h"
#include "mbuf.h"
#include "log.h"
-#include "defs.h"
#include "timer.h"
#include "fsm.h"
#include "lcp.h"
@@ -124,7 +124,7 @@
#define NEG_DNS 50
const char Version[] = "2.0-beta";
-const char VersionDate[] = "$Date: 1998/06/15 19:05:12 $";
+const char VersionDate[] = "$Date: 1998/06/15 19:05:40 $";
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);
@@ -709,20 +709,18 @@ FindExec(struct bundle *bundle, struct cmdtab const *cmds, int argc, int argn,
return val;
}
-void
-command_Interpret(char *buff, int nb, int *argc, char ***argv)
+int
+command_Interpret(char *buff, int nb, char *argv[MAXARGS])
{
- static char *vector[MAXARGS];
char *cp;
if (nb > 0) {
cp = buff + strcspn(buff, "\r\n");
if (cp)
*cp = '\0';
- *argc = MakeArgs(buff, vector, VECSIZE(vector));
- *argv = vector;
- } else
- *argc = 0;
+ return MakeArgs(buff, argv, MAXARGS);
+ }
+ return 0;
}
static int
@@ -784,9 +782,9 @@ command_Decode(struct bundle *bundle, char *buff, int nb, struct prompt *prompt,
const char *label)
{
int argc;
- char **argv;
+ char *argv[MAXARGS];
- command_Interpret(buff, nb, &argc, &argv);
+ argc = command_Interpret(buff, nb, argv);
command_Run(bundle, argc, (char const *const *)argv, prompt, label, NULL);
}
diff --git a/usr.sbin/ppp/command.h b/usr.sbin/ppp/command.h
index b3cf622..f01901d 100644
--- a/usr.sbin/ppp/command.h
+++ b/usr.sbin/ppp/command.h
@@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: command.h,v 1.13 1998/05/21 21:44:48 brian Exp $
+ * $Id: command.h,v 1.14 1998/06/15 19:05:42 brian Exp $
*
* TODO:
*/
@@ -54,7 +54,7 @@ struct cmdtab {
extern const char Version[];
extern const char VersionDate[];
-extern void command_Interpret(char *, int, int *, char ***);
+extern int command_Interpret(char *, int, char *vector[MAXARGS]);
extern void command_Run(struct bundle *, int, char const *const *,
struct prompt *, const char *, struct datalink *);
extern void command_Decode(struct bundle *, char *, int, struct prompt *,
diff --git a/usr.sbin/ppp/filter.c b/usr.sbin/ppp/filter.c
index 1330480..b65eace 100644
--- a/usr.sbin/ppp/filter.c
+++ b/usr.sbin/ppp/filter.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: filter.c,v 1.22.2.19 1998/05/01 19:24:28 brian Exp $
+ * $Id: filter.c,v 1.23 1998/05/21 21:45:13 brian Exp $
*
* TODO: Shoud send ICMP error message when we discard packets.
*/
@@ -35,10 +35,10 @@
#include <strings.h>
#include <termios.h>
+#include "defs.h"
#include "command.h"
#include "mbuf.h"
#include "log.h"
-#include "defs.h"
#include "iplist.h"
#include "timer.h"
#include "throughput.h"
diff --git a/usr.sbin/ppp/hdlc.c b/usr.sbin/ppp/hdlc.c
index a6f1c25..efdbfc6 100644
--- a/usr.sbin/ppp/hdlc.c
+++ b/usr.sbin/ppp/hdlc.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: hdlc.c,v 1.28.2.37 1998/05/21 01:26:07 brian Exp $
+ * $Id: hdlc.c,v 1.31 1998/05/21 21:45:28 brian Exp $
*
* TODO:
*/
@@ -31,10 +31,10 @@
#include <string.h>
#include <termios.h>
+#include "defs.h"
#include "command.h"
#include "mbuf.h"
#include "log.h"
-#include "defs.h"
#include "timer.h"
#include "fsm.h"
#include "lqr.h"
diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c
index 4af816e..03e6dc0 100644
--- a/usr.sbin/ppp/ipcp.c
+++ b/usr.sbin/ppp/ipcp.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ipcp.c,v 1.54 1998/06/12 17:45:10 brian Exp $
+ * $Id: ipcp.c,v 1.55 1998/06/15 19:05:44 brian Exp $
*
* TODO:
* o More RFC1772 backwoard compatibility
@@ -41,10 +41,10 @@
#include <termios.h>
#include <unistd.h>
+#include "defs.h"
#include "command.h"
#include "mbuf.h"
#include "log.h"
-#include "defs.h"
#include "timer.h"
#include "fsm.h"
#include "lcpproto.h"
diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c
index 6e28dfc..ddddfb9 100644
--- a/usr.sbin/ppp/lcp.c
+++ b/usr.sbin/ppp/lcp.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: lcp.c,v 1.57 1998/05/21 21:46:00 brian Exp $
+ * $Id: lcp.c,v 1.58 1998/05/29 18:32:40 brian Exp $
*
* TODO:
* o Limit data field length by MRU
@@ -35,10 +35,10 @@
#include <termios.h>
#include <unistd.h>
+#include "defs.h"
#include "command.h"
#include "mbuf.h"
#include "log.h"
-#include "defs.h"
#include "timer.h"
#include "fsm.h"
#include "iplist.h"
diff --git a/usr.sbin/ppp/log.c b/usr.sbin/ppp/log.c
index c530dae..01de47a 100644
--- a/usr.sbin/ppp/log.c
+++ b/usr.sbin/ppp/log.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: log.c,v 1.28 1998/05/23 22:24:40 brian Exp $
+ * $Id: log.c,v 1.29 1998/05/28 23:17:42 brian Exp $
*/
#include <sys/types.h>
@@ -34,12 +34,12 @@
#include <syslog.h>
#include <termios.h>
+#include "defs.h"
#include "command.h"
#include "mbuf.h"
#include "log.h"
#include "descriptor.h"
#include "prompt.h"
-#include "defs.h"
static const char *LogNames[] = {
"Async",
diff --git a/usr.sbin/ppp/mbuf.c b/usr.sbin/ppp/mbuf.c
index fc30aeb..8142014 100644
--- a/usr.sbin/ppp/mbuf.c
+++ b/usr.sbin/ppp/mbuf.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: mbuf.c,v 1.13.2.11 1998/05/01 19:25:19 brian Exp $
+ * $Id: mbuf.c,v 1.14 1998/05/21 21:46:46 brian Exp $
*
*/
#include <sys/types.h>
@@ -28,6 +28,7 @@
#include <sysexits.h>
#include <termios.h>
+#include "defs.h"
#include "command.h"
#include "mbuf.h"
#include "log.h"
diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c
index c80a334..69122fe 100644
--- a/usr.sbin/ppp/modem.c
+++ b/usr.sbin/ppp/modem.c
@@ -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.88 1998/05/29 18:33:09 brian Exp $
+ * $Id: modem.c,v 1.89 1998/06/15 19:05:25 brian Exp $
*
* TODO:
*/
@@ -47,10 +47,10 @@
#include <libutil.h>
#endif
+#include "defs.h"
#include "command.h"
#include "mbuf.h"
#include "log.h"
-#include "defs.h"
#include "id.h"
#include "timer.h"
#include "fsm.h"
diff --git a/usr.sbin/ppp/mp.c b/usr.sbin/ppp/mp.c
index 65ccfc0..d68d61e 100644
--- a/usr.sbin/ppp/mp.c
+++ b/usr.sbin/ppp/mp.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: mp.c,v 1.5 1998/05/23 22:24:46 brian Exp $
+ * $Id: mp.c,v 1.6 1998/05/25 02:22:38 brian Exp $
*/
#include <sys/types.h>
@@ -44,10 +44,10 @@
#include <termios.h>
#include <unistd.h>
+#include "defs.h"
#include "command.h"
#include "mbuf.h"
#include "log.h"
-#include "defs.h"
#include "timer.h"
#include "fsm.h"
#include "iplist.h"
diff --git a/usr.sbin/ppp/nat_cmd.c b/usr.sbin/ppp/nat_cmd.c
index c4265fd..eb9d15f 100644
--- a/usr.sbin/ppp/nat_cmd.c
+++ b/usr.sbin/ppp/nat_cmd.c
@@ -2,7 +2,7 @@
* The code in this file was written by Eivind Eklund <perhaps@yes.no>,
* who places it in the public domain without restriction.
*
- * $Id: alias_cmd.c,v 1.12.2.8 1998/05/01 19:23:43 brian Exp $
+ * $Id: alias_cmd.c,v 1.13 1998/05/21 21:43:42 brian Exp $
*/
#include <sys/types.h>
@@ -15,6 +15,7 @@
#include <string.h>
#include <termios.h>
+#include "defs.h"
#include "command.h"
#include "log.h"
#include "loadalias.h"
diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c
index da033f7..d4ac9ed 100644
--- a/usr.sbin/ppp/route.c
+++ b/usr.sbin/ppp/route.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: route.c,v 1.45 1998/05/21 21:48:10 brian Exp $
+ * $Id: route.c,v 1.46 1998/06/10 00:16:07 brian Exp $
*
*/
@@ -40,10 +40,10 @@
#include <sys/sysctl.h>
#include <termios.h>
+#include "defs.h"
#include "command.h"
#include "mbuf.h"
#include "log.h"
-#include "defs.h"
#include "iplist.h"
#include "timer.h"
#include "throughput.h"
diff --git a/usr.sbin/ppp/slcompress.c b/usr.sbin/ppp/slcompress.c
index bd6ca4e..503f470 100644
--- a/usr.sbin/ppp/slcompress.c
+++ b/usr.sbin/ppp/slcompress.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: slcompress.c,v 1.16 1998/05/21 21:48:27 brian Exp $
+ * $Id: slcompress.c,v 1.17 1998/06/14 00:56:11 brian Exp $
*
* Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
* - Initial distribution.
@@ -34,10 +34,10 @@
#include <string.h>
#include <termios.h>
+#include "defs.h"
#include "command.h"
#include "mbuf.h"
#include "log.h"
-#include "defs.h"
#include "slcompress.h"
#include "descriptor.h"
#include "prompt.h"
diff --git a/usr.sbin/ppp/systems.c b/usr.sbin/ppp/systems.c
index 734cf62..e5583f6 100644
--- a/usr.sbin/ppp/systems.c
+++ b/usr.sbin/ppp/systems.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: systems.c,v 1.36 1998/05/21 21:48:33 brian Exp $
+ * $Id: systems.c,v 1.37 1998/06/15 19:05:47 brian Exp $
*
* TODO:
*/
@@ -30,10 +30,10 @@
#include <string.h>
#include <unistd.h>
+#include "defs.h"
#include "command.h"
#include "log.h"
#include "id.h"
-#include "defs.h"
#include "systems.h"
#define issep(ch) ((ch) == ' ' || (ch) == '\t')
@@ -252,7 +252,7 @@ ReadSystem(struct bundle *bundle, const char *name, const char *file,
char filename[MAXPATHLEN];
int linenum;
int argc;
- char **argv;
+ char *argv[MAXARGS];
int allowcmd;
int indent;
char arg[LINE_LEN];
@@ -319,8 +319,8 @@ ReadSystem(struct bundle *bundle, const char *name, const char *file,
break;
len = strlen(cp);
- command_Interpret(cp, len, &argc, &argv);
- allowcmd = argc > 0 && !strcasecmp(*argv, "allow");
+ argc = command_Interpret(cp, len, argv);
+ allowcmd = argc > 0 && !strcasecmp(argv[0], "allow");
if ((!doexec && allowcmd) || (doexec && !allowcmd))
command_Run(bundle, argc, (char const *const *)argv, prompt,
name, cx);
OpenPOWER on IntegriCloud