summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2015-03-04 07:07:01 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-06-08 13:46:41 -0400
commit4201dd1143cccc856dbfbd971582ee39500c0e38 (patch)
tree2c00a2267ac318f0ba41d996ef9112dc131822e9
parent8d10f6e5f4202faac9931ec115f0a572df519f85 (diff)
vtysh: fix function prototypes
This makes a whole bunch of vtysh functions static, fixes prototypes for a few more, and masks user_free() and user_write_config() (both unused.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit a9eb9063071437f5cde3b78adf273b428c49d378)
-rw-r--r--vtysh/vtysh.c33
-rw-r--r--vtysh/vtysh.h2
-rw-r--r--vtysh/vtysh_config.c31
-rw-r--r--vtysh/vtysh_main.c1
-rw-r--r--vtysh/vtysh_user.c18
-rw-r--r--vtysh/vtysh_user.h3
6 files changed, 21 insertions, 67 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index bdfbeb9143..75ce584818 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -34,6 +34,7 @@
#include <stdio.h>
#include <string.h>
+#include "linklist.h"
#include "command.h"
#include "memory.h"
#include "vtysh/vtysh.h"
@@ -69,21 +70,6 @@ struct vtysh_client vtysh_client[] =
{ .fd = -1, .name = "pimd", .flag = VTYSH_PIMD, .path = PIM_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;
-
-
/* Using integrated config from Quagga.conf. Default is no. */
int vtysh_writeconfig_integrated = 0;
@@ -324,14 +310,6 @@ vtysh_client_execute (struct vtysh_client *head_client, const char *line, FILE *
}
void
-vtysh_exit_ripd_only (void)
-{
- if (ripd_client)
- vtysh_client_execute (ripd_client, "exit", stdout);
-}
-
-
-void
vtysh_pager_init (void)
{
char *pager_defined;
@@ -754,7 +732,7 @@ vtysh_config_from_file (struct vty *vty, FILE *fp)
}
/* We don't care about the point of the cursor when '?' is typed. */
-int
+static int
vtysh_rl_describe (void)
{
int ret;
@@ -1006,7 +984,7 @@ static struct cmd_node keychain_key_node =
extern struct cmd_node vty_node;
/* When '^Z' is received from vty, move down to the enable mode. */
-int
+static int
vtysh_end (void)
{
switch (vty->node)
@@ -2680,7 +2658,7 @@ vtysh_update_all_insances(struct vtysh_client * head_client)
}
}
-int
+static int
vtysh_connect_all_instances (struct vtysh_client *head_client)
{
struct vtysh_client *client;
@@ -2713,9 +2691,6 @@ vtysh_connect_all(const char *daemon_name)
matches++;
if (vtysh_connect(&vtysh_client[i]) == 0)
rc++;
- /* We need direct access to ripd in vtysh_exit_ripd_only. */
- if (vtysh_client[i].flag == VTYSH_RIPD)
- ripd_client = &vtysh_client[i];
rc += vtysh_connect_all_instances(&vtysh_client[i]);
}
diff --git a/vtysh/vtysh.h b/vtysh/vtysh.h
index 9bc9f6d1b4..e974cf331c 100644
--- a/vtysh/vtysh.h
+++ b/vtysh/vtysh.h
@@ -55,6 +55,8 @@ void vtysh_config_write (void);
int vtysh_config_from_file (struct vty *, FILE *);
+void config_add_line (struct list *, const char *);
+
int vtysh_mark_file(const char *filename);
int vtysh_read_config (const char *);
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c
index 9497241d7f..fcad333b9f 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -27,21 +27,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "vtysh/vtysh.h"
#include "vtysh/vtysh_user.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;
@@ -63,19 +48,19 @@ struct config
struct list *config_top;
-int
+static int
line_cmp (char *c1, char *c2)
{
return strcmp (c1, c2);
}
-void
+static void
line_del (char *line)
{
XFREE (MTYPE_VTYSH_CONFIG_LINE, line);
}
-struct config *
+static struct config *
config_new (void)
{
struct config *config;
@@ -83,13 +68,13 @@ config_new (void)
return config;
}
-int
+static int
config_cmp (struct config *c1, struct config *c2)
{
return strcmp (c1->name, c2->name);
}
-void
+static void
config_del (struct config* config)
{
list_delete (config->line);
@@ -98,7 +83,7 @@ config_del (struct config* config)
XFREE (MTYPE_VTYSH_CONFIG, config);
}
-struct config *
+static struct config *
config_get (int index, const char *line)
{
struct config *config;
@@ -143,7 +128,7 @@ config_add_line (struct list *config, const char *line)
listnode_add (config, XSTRDUP (MTYPE_VTYSH_CONFIG_LINE, line));
}
-void
+static void
config_add_line_uniq (struct list *config, const char *line)
{
struct listnode *node, *nnode;
@@ -157,7 +142,7 @@ config_add_line_uniq (struct list *config, const char *line)
listnode_add_sort (config, XSTRDUP (MTYPE_VTYSH_CONFIG_LINE, line));
}
-void
+static void
vtysh_config_parse_line (const char *line)
{
char c;
diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c
index 667c88e576..41104eaee6 100644
--- a/vtysh/vtysh_main.c
+++ b/vtysh/vtysh_main.c
@@ -36,6 +36,7 @@
#include "command.h"
#include "memory.h"
#include "privs.h"
+#include "linklist.h"
#include "vtysh/vtysh.h"
#include "vtysh/vtysh_user.h"
diff --git a/vtysh/vtysh_user.c b/vtysh/vtysh_user.c
index e65b7bb118..0d72c378a3 100644
--- a/vtysh/vtysh_user.c
+++ b/vtysh/vtysh_user.c
@@ -47,10 +47,6 @@
#ifdef USE_PAM
static int vtysh_pam(const char *);
#endif
-struct vtysh_user *user_new(void);
-void user_free(struct vtysh_user *);
-struct vtysh_user *user_lookup(const char *);
-struct vtysh_user *user_get(const char *);
int vtysh_auth(void);
void vtysh_user_init(void);
@@ -117,19 +113,13 @@ struct vtysh_user
struct list *userlist;
-struct vtysh_user *
+static struct vtysh_user *
user_new (void)
{
return XCALLOC (0, sizeof (struct vtysh_user));
}
-void
-user_free (struct vtysh_user *user)
-{
- XFREE (0, user);
-}
-
-struct vtysh_user *
+static struct vtysh_user *
user_lookup (const char *name)
{
struct listnode *node, *nnode;
@@ -160,7 +150,7 @@ user_config_write ()
}
}
-struct vtysh_user *
+static struct vtysh_user *
user_get (const char *name)
{
struct vtysh_user *user;
@@ -200,7 +190,7 @@ DEFUN (username_nopassword,
}
int
-vtysh_auth ()
+vtysh_auth (void)
{
struct vtysh_user *user;
struct passwd *passwd;
diff --git a/vtysh/vtysh_user.h b/vtysh/vtysh_user.h
index b0686a9699..16fcdd03a5 100644
--- a/vtysh/vtysh_user.h
+++ b/vtysh/vtysh_user.h
@@ -22,7 +22,8 @@
#ifndef _VTYSH_USER_H
#define _VTYSH_USER_H
-int vtysh_auth ();
+int vtysh_auth (void);
+void vtysh_user_init (void);
void user_config_write(void);
char *vtysh_get_home (void);