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:
Donald Sharp 2015-05-19 18:29:15 -07:00
parent 91283e7641
commit c0e8c16f84
7 changed files with 71 additions and 36 deletions

View file

@ -3972,7 +3972,7 @@ DEFUN (no_banner_motd,
/* Set config filename. Called from vty.c */
void
host_config_set (char *filename)
host_config_set (const char *filename)
{
if (host.config)
XFREE (MTYPE_HOST, host.config);

View file

@ -546,7 +546,7 @@ extern struct cmd_element config_quit_cmd;
extern struct cmd_element config_help_cmd;
extern struct cmd_element config_list_cmd;
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 *);

View file

@ -50,9 +50,9 @@ char *vtysh_pager_name = NULL;
struct vtysh_client
{
int fd;
char *name;
const char *name;
int flag;
char *path;
const char *path;
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},
};
/*
* 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. */
static struct vtysh_client *ripd_client = NULL;
@ -192,7 +202,7 @@ vtysh_client_config_one (struct vtysh_client *vclient, char *line)
return ret;
}
static int
static void
vtysh_client_config (struct vtysh_client *head_client, char *line)
{
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);
if (rc != CMD_SUCCESS)
return rc;
return;
client = head_client->next;
while (client)
{
rc = vtysh_client_config_one(client, line);
if (rc != CMD_SUCCESS)
return rc;
return;
client = client->next;
}
return CMD_SUCCESS;
return;
}
static int
@ -501,7 +511,7 @@ vtysh_execute (const char *line)
}
int
vtysh_mark_file (char *filename)
vtysh_mark_file (const char *filename)
{
struct vty *vty;
FILE *confp = NULL;
@ -1926,7 +1936,6 @@ DEFUN (vtysh_write_terminal,
"Write to terminal\n")
{
u_int i;
int ret;
char line[] = "write terminal\n";
FILE *fp = NULL;
@ -1948,7 +1957,7 @@ DEFUN (vtysh_write_terminal,
vty_out (vty, "!%s", VTY_NEWLINE);
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. */
vtysh_config_write ();
@ -1996,7 +2005,6 @@ static int
write_config_integrated(void)
{
u_int i;
int ret;
char line[] = "write terminal\n";
FILE *fp;
char *integrate_sav = NULL;
@ -2022,7 +2030,7 @@ write_config_integrated(void)
}
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);
@ -2157,11 +2165,10 @@ DEFUN (vtysh_show_daemons,
}
/* Execute command in child process. */
static int
static void
execute_command (const char *command, int argc, const char *arg1,
const char *arg2)
{
int ret;
pid_t pid;
int status;
@ -2180,13 +2187,13 @@ execute_command (const char *command, int argc, const char *arg1,
switch (argc)
{
case 0:
ret = execlp (command, command, (const char *)NULL);
execlp (command, command, (const char *)NULL);
break;
case 1:
ret = execlp (command, command, arg1, (const char *)NULL);
execlp (command, command, arg1, (const char *)NULL);
break;
case 2:
ret = execlp (command, command, arg1, arg2, (const char *)NULL);
execlp (command, command, arg1, arg2, (const char *)NULL);
break;
}
@ -2198,10 +2205,9 @@ execute_command (const char *command, int argc, const char *arg1,
{
/* This is parent. */
execute_flag = 1;
ret = wait4 (pid, &status, 0, NULL);
wait4 (pid, &status, 0, NULL);
execute_flag = 0;
}
return 0;
}
DEFUN (vtysh_ping,
@ -2443,7 +2449,7 @@ static void
vtysh_update_all_insances(struct vtysh_client * head_client)
{
struct vtysh_client *client;
char *path;
char *ptr;
DIR *dir;
struct dirent *file;
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->fd = -1;
client->name = (char *) malloc(10);
strcpy(client->name, "ospfd");
client->name = "ospfd";
client->flag = VTYSH_OSPFD;
client->path = (char *) malloc(100);
sprintf(client->path, "/var/run/quagga/%s", file->d_name);
ptr = (char *) malloc(100);
sprintf(ptr, "/var/run/quagga/%s", file->d_name);
client->path = (const char *)ptr;
client->next = NULL;
vtysh_client_sorted_insert(head_client, client);
n++;

View file

@ -52,9 +52,9 @@ void vtysh_config_write (void);
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 *);

View file

@ -26,6 +26,21 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#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;
extern int vtysh_writeconfig_integrated;
@ -390,7 +405,7 @@ vtysh_read_file (FILE *confp)
/* Read up configuration file from config_default_dir. */
int
vtysh_read_config (char *config_default_dir)
vtysh_read_config (const char *config_default_dir)
{
FILE *confp = NULL;

View file

@ -63,7 +63,7 @@ struct thread_master *master;
FILE *logfile;
/* SIGTSTP handler. This function care user's ^Z input. */
void
static void
sigtstp (int sig)
{
/* Execute "end" command. */
@ -84,7 +84,7 @@ sigtstp (int sig)
}
/* SIGINT handler. This function care user's ^Z input. */
void
static void
sigint (int sig)
{
/* Check this process is not child process. */
@ -98,7 +98,7 @@ sigint (int sig)
/* Signale wrapper for vtysh. We don't use sigevent because
* vtysh doesn't use threads. TODO */
RETSIGTYPE *
static RETSIGTYPE *
vtysh_signal_set (int signo, void (*func)(int))
{
int ret;
@ -121,8 +121,8 @@ vtysh_signal_set (int signo, void (*func)(int))
}
/* Initialization of signal handles. */
void
vtysh_signal_init ()
static void
vtysh_signal_init (void)
{
vtysh_signal_set (SIGINT, sigint);
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. */
char *
vtysh_rl_gets ()
static char *
vtysh_rl_gets (void)
{
HIST_ENTRY *last;
/* 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);
struct tm *tmp = localtime(&t);
char *user = getenv("USER") ? : "boot";
const char *user = getenv("USER") ? : "boot";
char tod[64];
strftime(tod, sizeof tod, "%Y%m%d-%H:%M.%S", tmp);

View file

@ -38,6 +38,20 @@
#include "linklist.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
static struct pam_conv conv =
{