summaryrefslogtreecommitdiffstats
path: root/vtysh
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2015-05-20 03:29:15 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2015-05-20 03:29:15 +0200
commitc0e8c16f844e27675f30ceae50e599d4953e0ae3 (patch)
tree722366fc213778a76e9f4df4d0c7b22c4986227e /vtysh
parentisisd: isisd-warnings.patch (diff)
downloadfrr-c0e8c16f844e27675f30ceae50e599d4953e0ae3.tar.xz
frr-c0e8c16f844e27675f30ceae50e599d4953e0ae3.zip
vtysh: vtysh-warnings.patch
Remove compile warnings for the vtysh directory Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by:
Diffstat (limited to 'vtysh')
-rw-r--r--vtysh/vtysh.c52
-rw-r--r--vtysh/vtysh.h4
-rw-r--r--vtysh/vtysh_config.c17
-rw-r--r--vtysh/vtysh_main.c16
-rw-r--r--vtysh/vtysh_user.c14
5 files changed, 69 insertions, 34 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index a3a39d8e2..e7d5036d5 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -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++;
diff --git a/vtysh/vtysh.h b/vtysh/vtysh.h
index c6430e10b..b7ad299e1 100644
--- a/vtysh/vtysh.h
+++ b/vtysh/vtysh.h
@@ -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 *);
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c
index f9cb6a79b..e16b88548 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -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;
diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c
index c706f154a..5d3a61e14 100644
--- a/vtysh/vtysh_main.c
+++ b/vtysh/vtysh_main.c
@@ -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);
diff --git a/vtysh/vtysh_user.c b/vtysh/vtysh_user.c
index 58676c10c..e2432dec2 100644
--- a/vtysh/vtysh_user.c
+++ b/vtysh/vtysh_user.c
@@ -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 =
{