]> git.puffer.fish Git - mirror/frr.git/commitdiff
vtysh: fix function prototypes
authorDavid Lamparter <equinox@opensourcerouting.org>
Wed, 4 Mar 2015 06:07:01 +0000 (07:07 +0100)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 8 Jun 2016 17:46:41 +0000 (13:46 -0400)
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)

vtysh/vtysh.c
vtysh/vtysh.h
vtysh/vtysh_config.c
vtysh/vtysh_main.c
vtysh/vtysh_user.c
vtysh/vtysh_user.h

index bdfbeb9143a0dc6d2518f5f23b212009ec90261f..75ce5848189a8a84963616b4ef2de55705d99cd9 100644 (file)
@@ -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;
 
@@ -323,14 +309,6 @@ vtysh_client_execute (struct vtysh_client *head_client, const char *line, FILE *
   return CMD_SUCCESS;
 }
 
-void
-vtysh_exit_ripd_only (void)
-{
-  if (ripd_client)
-    vtysh_client_execute (ripd_client, "exit", stdout);
-}
-
-
 void
 vtysh_pager_init (void)
 {
@@ -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]);
        }
index 9bc9f6d1b47e31f323307c0920565f87df52a4f7..e974cf331c2db5f6c9f8a3c2df218b9c3c12a6de 100644 (file)
@@ -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 *);
index 9497241d7f7139d1f2cd86141c646662a671c487..fcad333b9f67f9bdf286a16afb8f5b1e6402f08a 100644 (file)
@@ -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;
index 667c88e576ea2076e47f8696e7d1b21082d92eef..41104eaee6da13f1041b7616a840b7f77f724eb4 100644 (file)
@@ -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"
index e65b7bb1189dee83384306309c6e66a7906feff4..0d72c378a31862fbb3732b36892091d733c6db10 100644 (file)
 #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;
index b0686a969902c82907c2ef9d6ffbdb3b092bb85a..16fcdd03a5889c920d5b05ca4972f4e341d645df 100644 (file)
@@ -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);