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.
This commit is contained in:
parent
30291ffb15
commit
c9e11a112d
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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 *,
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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",
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user