Deleted Added
full compact
command.c (58044) command.c (58045)
1/*
2 * PPP User command processing module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
1/*
2 * PPP User command processing module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 * $FreeBSD: head/usr.sbin/ppp/command.c 58044 2000-03-14 01:47:27Z brian $
20 * $FreeBSD: head/usr.sbin/ppp/command.c 58045 2000-03-14 01:47:31Z brian $
21 *
22 */
23#include <sys/param.h>
24#include <netinet/in_systm.h>
25#include <netinet/in.h>
26#include <netinet/ip.h>
27#include <arpa/inet.h>
28#include <sys/socket.h>

--- 901 unchanged lines hidden (view full) ---

930 else if (val)
931 log_Printf(LogWARN, "%s: Failed %d\n",
932 mkPrefix(argn+1, argv, prefix, sizeof prefix), val);
933
934 return val;
935}
936
937int
21 *
22 */
23#include <sys/param.h>
24#include <netinet/in_systm.h>
25#include <netinet/in.h>
26#include <netinet/ip.h>
27#include <arpa/inet.h>
28#include <sys/socket.h>

--- 901 unchanged lines hidden (view full) ---

930 else if (val)
931 log_Printf(LogWARN, "%s: Failed %d\n",
932 mkPrefix(argn+1, argv, prefix, sizeof prefix), val);
933
934 return val;
935}
936
937int
938command_Expand_Interpret(char *buff, int nb, char *argv[MAXARGS], int offset)
939{
940 char buff2[LINE_LEN-offset];
941
942 InterpretArg(buff, buff2);
943 strncpy(buff, buff2, LINE_LEN - offset - 1);
944 buff[LINE_LEN - offset - 1] = '\0';
945
946 return command_Interpret(buff, nb, argv);
947}
948
949int
938command_Interpret(char *buff, int nb, char *argv[MAXARGS])
939{
940 char *cp;
941
942 if (nb > 0) {
943 cp = buff + strcspn(buff, "\r\n");
944 if (cp)
945 *cp = '\0';

--- 62 unchanged lines hidden (view full) ---

1008
1009int
1010command_Decode(struct bundle *bundle, char *buff, int nb, struct prompt *prompt,
1011 const char *label)
1012{
1013 int argc;
1014 char *argv[MAXARGS];
1015
950command_Interpret(char *buff, int nb, char *argv[MAXARGS])
951{
952 char *cp;
953
954 if (nb > 0) {
955 cp = buff + strcspn(buff, "\r\n");
956 if (cp)
957 *cp = '\0';

--- 62 unchanged lines hidden (view full) ---

1020
1021int
1022command_Decode(struct bundle *bundle, char *buff, int nb, struct prompt *prompt,
1023 const char *label)
1024{
1025 int argc;
1026 char *argv[MAXARGS];
1027
1016 if ((argc = command_Interpret(buff, nb, argv)) < 0)
1028 if ((argc = command_Expand_Interpret(buff, nb, argv, 0)) < 0)
1017 return 0;
1018
1019 command_Run(bundle, argc, (char const *const *)argv, prompt, label, NULL);
1020 return 1;
1021}
1022
1023static int
1024ShowCommand(struct cmdargs const *arg)

--- 1677 unchanged lines hidden ---
1029 return 0;
1030
1031 command_Run(bundle, argc, (char const *const *)argv, prompt, label, NULL);
1032 return 1;
1033}
1034
1035static int
1036ShowCommand(struct cmdargs const *arg)

--- 1677 unchanged lines hidden ---