forked from Mirror/frr
vtysh: vtysh-warnings.patch
Remove compile warnings for the vtysh directory Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by:
This commit is contained in:
parent
91283e7641
commit
c0e8c16f84
|
@ -3972,7 +3972,7 @@ DEFUN (no_banner_motd,
|
||||||
|
|
||||||
/* Set config filename. Called from vty.c */
|
/* Set config filename. Called from vty.c */
|
||||||
void
|
void
|
||||||
host_config_set (char *filename)
|
host_config_set (const char *filename)
|
||||||
{
|
{
|
||||||
if (host.config)
|
if (host.config)
|
||||||
XFREE (MTYPE_HOST, host.config);
|
XFREE (MTYPE_HOST, host.config);
|
||||||
|
|
|
@ -546,7 +546,7 @@ extern struct cmd_element config_quit_cmd;
|
||||||
extern struct cmd_element config_help_cmd;
|
extern struct cmd_element config_help_cmd;
|
||||||
extern struct cmd_element config_list_cmd;
|
extern struct cmd_element config_list_cmd;
|
||||||
extern char *host_config_file (void);
|
extern char *host_config_file (void);
|
||||||
extern void host_config_set (char *);
|
extern void host_config_set (const char *);
|
||||||
|
|
||||||
extern void print_version (const char *);
|
extern void print_version (const char *);
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,9 @@ char *vtysh_pager_name = NULL;
|
||||||
struct vtysh_client
|
struct vtysh_client
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
char *name;
|
const char *name;
|
||||||
int flag;
|
int flag;
|
||||||
char *path;
|
const char *path;
|
||||||
struct vtysh_client *next;
|
struct vtysh_client *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,6 +68,16 @@ struct vtysh_client vtysh_client[] =
|
||||||
{ .fd = -1, .name = "babeld", .flag = VTYSH_BABELD, .path = BABEL_VTYSH_PATH, .next = NULL},
|
{ .fd = -1, .name = "babeld", .flag = VTYSH_BABELD, .path = BABEL_VTYSH_PATH, .next = NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compiler is warning about prototypes not being declared.
|
||||||
|
* The DEFUNSH and DEFUN macro's are messing with the
|
||||||
|
* compiler I believe. This is just to make it happy.
|
||||||
|
*/
|
||||||
|
int vtysh_end(void);
|
||||||
|
int vtysh_rl_describe(void);
|
||||||
|
void vtysh_exit_ripd_only(void);
|
||||||
|
int vtysh_connect_all_instances(struct vtysh_client *);
|
||||||
|
|
||||||
|
|
||||||
/* We need direct access to ripd to implement vtysh_exit_ripd_only. */
|
/* We need direct access to ripd to implement vtysh_exit_ripd_only. */
|
||||||
static struct vtysh_client *ripd_client = NULL;
|
static struct vtysh_client *ripd_client = NULL;
|
||||||
|
@ -192,7 +202,7 @@ vtysh_client_config_one (struct vtysh_client *vclient, char *line)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
vtysh_client_config (struct vtysh_client *head_client, char *line)
|
vtysh_client_config (struct vtysh_client *head_client, char *line)
|
||||||
{
|
{
|
||||||
struct vtysh_client *client;
|
struct vtysh_client *client;
|
||||||
|
@ -200,17 +210,17 @@ vtysh_client_config (struct vtysh_client *head_client, char *line)
|
||||||
|
|
||||||
rc = vtysh_client_config_one(head_client, line);
|
rc = vtysh_client_config_one(head_client, line);
|
||||||
if (rc != CMD_SUCCESS)
|
if (rc != CMD_SUCCESS)
|
||||||
return rc;
|
return;
|
||||||
|
|
||||||
client = head_client->next;
|
client = head_client->next;
|
||||||
while (client)
|
while (client)
|
||||||
{
|
{
|
||||||
rc = vtysh_client_config_one(client, line);
|
rc = vtysh_client_config_one(client, line);
|
||||||
if (rc != CMD_SUCCESS)
|
if (rc != CMD_SUCCESS)
|
||||||
return rc;
|
return;
|
||||||
client = client->next;
|
client = client->next;
|
||||||
}
|
}
|
||||||
return CMD_SUCCESS;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -501,7 +511,7 @@ vtysh_execute (const char *line)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vtysh_mark_file (char *filename)
|
vtysh_mark_file (const char *filename)
|
||||||
{
|
{
|
||||||
struct vty *vty;
|
struct vty *vty;
|
||||||
FILE *confp = NULL;
|
FILE *confp = NULL;
|
||||||
|
@ -1926,7 +1936,6 @@ DEFUN (vtysh_write_terminal,
|
||||||
"Write to terminal\n")
|
"Write to terminal\n")
|
||||||
{
|
{
|
||||||
u_int i;
|
u_int i;
|
||||||
int ret;
|
|
||||||
char line[] = "write terminal\n";
|
char line[] = "write terminal\n";
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
|
|
||||||
|
@ -1948,7 +1957,7 @@ DEFUN (vtysh_write_terminal,
|
||||||
vty_out (vty, "!%s", VTY_NEWLINE);
|
vty_out (vty, "!%s", VTY_NEWLINE);
|
||||||
|
|
||||||
for (i = 0; i < array_size(vtysh_client); i++)
|
for (i = 0; i < array_size(vtysh_client); i++)
|
||||||
ret = vtysh_client_config (&vtysh_client[i], line);
|
vtysh_client_config (&vtysh_client[i], line);
|
||||||
|
|
||||||
/* Integrate vtysh specific configuration. */
|
/* Integrate vtysh specific configuration. */
|
||||||
vtysh_config_write ();
|
vtysh_config_write ();
|
||||||
|
@ -1996,7 +2005,6 @@ static int
|
||||||
write_config_integrated(void)
|
write_config_integrated(void)
|
||||||
{
|
{
|
||||||
u_int i;
|
u_int i;
|
||||||
int ret;
|
|
||||||
char line[] = "write terminal\n";
|
char line[] = "write terminal\n";
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *integrate_sav = NULL;
|
char *integrate_sav = NULL;
|
||||||
|
@ -2022,7 +2030,7 @@ write_config_integrated(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < array_size(vtysh_client); i++)
|
for (i = 0; i < array_size(vtysh_client); i++)
|
||||||
ret = vtysh_client_config (&vtysh_client[i], line);
|
vtysh_client_config (&vtysh_client[i], line);
|
||||||
|
|
||||||
vtysh_config_dump (fp);
|
vtysh_config_dump (fp);
|
||||||
|
|
||||||
|
@ -2157,11 +2165,10 @@ DEFUN (vtysh_show_daemons,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute command in child process. */
|
/* Execute command in child process. */
|
||||||
static int
|
static void
|
||||||
execute_command (const char *command, int argc, const char *arg1,
|
execute_command (const char *command, int argc, const char *arg1,
|
||||||
const char *arg2)
|
const char *arg2)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
@ -2180,13 +2187,13 @@ execute_command (const char *command, int argc, const char *arg1,
|
||||||
switch (argc)
|
switch (argc)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
ret = execlp (command, command, (const char *)NULL);
|
execlp (command, command, (const char *)NULL);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ret = execlp (command, command, arg1, (const char *)NULL);
|
execlp (command, command, arg1, (const char *)NULL);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ret = execlp (command, command, arg1, arg2, (const char *)NULL);
|
execlp (command, command, arg1, arg2, (const char *)NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2198,10 +2205,9 @@ execute_command (const char *command, int argc, const char *arg1,
|
||||||
{
|
{
|
||||||
/* This is parent. */
|
/* This is parent. */
|
||||||
execute_flag = 1;
|
execute_flag = 1;
|
||||||
ret = wait4 (pid, &status, 0, NULL);
|
wait4 (pid, &status, 0, NULL);
|
||||||
execute_flag = 0;
|
execute_flag = 0;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (vtysh_ping,
|
DEFUN (vtysh_ping,
|
||||||
|
@ -2443,7 +2449,7 @@ static void
|
||||||
vtysh_update_all_insances(struct vtysh_client * head_client)
|
vtysh_update_all_insances(struct vtysh_client * head_client)
|
||||||
{
|
{
|
||||||
struct vtysh_client *client;
|
struct vtysh_client *client;
|
||||||
char *path;
|
char *ptr;
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *file;
|
struct dirent *file;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
@ -2466,11 +2472,11 @@ vtysh_update_all_insances(struct vtysh_client * head_client)
|
||||||
}
|
}
|
||||||
client = (struct vtysh_client *) malloc(sizeof(struct vtysh_client));
|
client = (struct vtysh_client *) malloc(sizeof(struct vtysh_client));
|
||||||
client->fd = -1;
|
client->fd = -1;
|
||||||
client->name = (char *) malloc(10);
|
client->name = "ospfd";
|
||||||
strcpy(client->name, "ospfd");
|
|
||||||
client->flag = VTYSH_OSPFD;
|
client->flag = VTYSH_OSPFD;
|
||||||
client->path = (char *) malloc(100);
|
ptr = (char *) malloc(100);
|
||||||
sprintf(client->path, "/var/run/quagga/%s", file->d_name);
|
sprintf(ptr, "/var/run/quagga/%s", file->d_name);
|
||||||
|
client->path = (const char *)ptr;
|
||||||
client->next = NULL;
|
client->next = NULL;
|
||||||
vtysh_client_sorted_insert(head_client, client);
|
vtysh_client_sorted_insert(head_client, client);
|
||||||
n++;
|
n++;
|
||||||
|
|
|
@ -52,9 +52,9 @@ void vtysh_config_write (void);
|
||||||
|
|
||||||
int vtysh_config_from_file (struct vty *, FILE *);
|
int vtysh_config_from_file (struct vty *, FILE *);
|
||||||
|
|
||||||
int vtysh_mark_file(char *filename);
|
int vtysh_mark_file(const char *filename);
|
||||||
|
|
||||||
int vtysh_read_config (char *);
|
int vtysh_read_config (const char *);
|
||||||
|
|
||||||
void vtysh_config_parse (char *);
|
void vtysh_config_parse (char *);
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,21 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
|
||||||
#include "vtysh/vtysh.h"
|
#include "vtysh/vtysh.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compiler is warning about prototypes not being declared.
|
||||||
|
* The DEFUNSH and DEFUN macro's are messing with the
|
||||||
|
* compiler I believe. This is just to make it happy.
|
||||||
|
*/
|
||||||
|
int line_cmp(char *, char*);
|
||||||
|
void line_del(char *);
|
||||||
|
struct config *config_new(void);
|
||||||
|
int config_cmp(struct config *, struct config *);
|
||||||
|
void config_del(struct config *);
|
||||||
|
struct config *config_get(int, const char *);
|
||||||
|
void config_add_line(struct list *, const char *);
|
||||||
|
void config_add_line_uniq(struct list *, const char *);
|
||||||
|
void vtysh_config_parse_line(const char *);
|
||||||
|
|
||||||
vector configvec;
|
vector configvec;
|
||||||
|
|
||||||
extern int vtysh_writeconfig_integrated;
|
extern int vtysh_writeconfig_integrated;
|
||||||
|
@ -390,7 +405,7 @@ vtysh_read_file (FILE *confp)
|
||||||
|
|
||||||
/* Read up configuration file from config_default_dir. */
|
/* Read up configuration file from config_default_dir. */
|
||||||
int
|
int
|
||||||
vtysh_read_config (char *config_default_dir)
|
vtysh_read_config (const char *config_default_dir)
|
||||||
{
|
{
|
||||||
FILE *confp = NULL;
|
FILE *confp = NULL;
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ struct thread_master *master;
|
||||||
FILE *logfile;
|
FILE *logfile;
|
||||||
|
|
||||||
/* SIGTSTP handler. This function care user's ^Z input. */
|
/* SIGTSTP handler. This function care user's ^Z input. */
|
||||||
void
|
static void
|
||||||
sigtstp (int sig)
|
sigtstp (int sig)
|
||||||
{
|
{
|
||||||
/* Execute "end" command. */
|
/* Execute "end" command. */
|
||||||
|
@ -84,7 +84,7 @@ sigtstp (int sig)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SIGINT handler. This function care user's ^Z input. */
|
/* SIGINT handler. This function care user's ^Z input. */
|
||||||
void
|
static void
|
||||||
sigint (int sig)
|
sigint (int sig)
|
||||||
{
|
{
|
||||||
/* Check this process is not child process. */
|
/* Check this process is not child process. */
|
||||||
|
@ -98,7 +98,7 @@ sigint (int sig)
|
||||||
|
|
||||||
/* Signale wrapper for vtysh. We don't use sigevent because
|
/* Signale wrapper for vtysh. We don't use sigevent because
|
||||||
* vtysh doesn't use threads. TODO */
|
* vtysh doesn't use threads. TODO */
|
||||||
RETSIGTYPE *
|
static RETSIGTYPE *
|
||||||
vtysh_signal_set (int signo, void (*func)(int))
|
vtysh_signal_set (int signo, void (*func)(int))
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -121,8 +121,8 @@ vtysh_signal_set (int signo, void (*func)(int))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialization of signal handles. */
|
/* Initialization of signal handles. */
|
||||||
void
|
static void
|
||||||
vtysh_signal_init ()
|
vtysh_signal_init (void)
|
||||||
{
|
{
|
||||||
vtysh_signal_set (SIGINT, sigint);
|
vtysh_signal_set (SIGINT, sigint);
|
||||||
vtysh_signal_set (SIGTSTP, sigtstp);
|
vtysh_signal_set (SIGTSTP, sigtstp);
|
||||||
|
@ -172,8 +172,8 @@ struct option longopts[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Read a string, and return a pointer to it. Returns NULL on EOF. */
|
/* Read a string, and return a pointer to it. Returns NULL on EOF. */
|
||||||
char *
|
static char *
|
||||||
vtysh_rl_gets ()
|
vtysh_rl_gets (void)
|
||||||
{
|
{
|
||||||
HIST_ENTRY *last;
|
HIST_ENTRY *last;
|
||||||
/* If the buffer has already been allocated, return the memory
|
/* If the buffer has already been allocated, return the memory
|
||||||
|
@ -206,7 +206,7 @@ static void log_it(const char *line)
|
||||||
{
|
{
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
struct tm *tmp = localtime(&t);
|
struct tm *tmp = localtime(&t);
|
||||||
char *user = getenv("USER") ? : "boot";
|
const char *user = getenv("USER") ? : "boot";
|
||||||
char tod[64];
|
char tod[64];
|
||||||
|
|
||||||
strftime(tod, sizeof tod, "%Y%m%d-%H:%M.%S", tmp);
|
strftime(tod, sizeof tod, "%Y%m%d-%H:%M.%S", tmp);
|
||||||
|
|
|
@ -38,6 +38,20 @@
|
||||||
#include "linklist.h"
|
#include "linklist.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compiler is warning about prototypes not being declared.
|
||||||
|
* The DEFUNSH and DEFUN macro's are messing with the
|
||||||
|
* compiler I believe. This is just to make it happy.
|
||||||
|
*/
|
||||||
|
int vtysh_pam(const char *);
|
||||||
|
struct vtysh_user *user_new(void);
|
||||||
|
void user_free(struct vtysh_user *);
|
||||||
|
struct vtysh_user *user_lookup(const char *);
|
||||||
|
void user_config_write(void);
|
||||||
|
struct vtysh_user *user_get(const char *);
|
||||||
|
int vtysh_auth(void);
|
||||||
|
void vtysh_user_init(void);
|
||||||
|
|
||||||
#ifdef USE_PAM
|
#ifdef USE_PAM
|
||||||
static struct pam_conv conv =
|
static struct pam_conv conv =
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue