Browse Source

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>
David Lamparter 7 years ago
parent
commit
a9eb906307
5 changed files with 29 additions and 24 deletions
  1. 3 3
      vtysh/vtysh.c
  2. 9 9
      vtysh/vtysh_config.c
  3. 4 4
      vtysh/vtysh_main.c
  4. 11 7
      vtysh/vtysh_user.c
  5. 2 1
      vtysh/vtysh_user.h

+ 3 - 3
vtysh/vtysh.c

@@ -251,7 +251,7 @@ vtysh_client_execute (struct vtysh_client *vclient, const char *line, FILE *fp)
     }
 }
 
-void
+static void
 vtysh_exit_ripd_only (void)
 {
   if (ripd_client)
@@ -547,7 +547,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;
@@ -821,7 +821,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)

+ 9 - 9
vtysh/vtysh_config.c

@@ -47,19 +47,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 ()
 {
   struct config *config;
@@ -67,13 +67,13 @@ config_new ()
   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);
@@ -82,7 +82,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;
@@ -121,13 +121,13 @@ config_get (int index, const char *line)
   return config;
 }
 
-void
+static void
 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;
@@ -141,7 +141,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;

+ 4 - 4
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. */
@@ -121,7 +121,7 @@ vtysh_signal_set (int signo, void (*func)(int))
 }
 
 /* Initialization of signal handles. */
-void
+static void
 vtysh_signal_init ()
 {
   vtysh_signal_set (SIGINT, sigint);
@@ -168,7 +168,7 @@ struct option longopts[] =
 };
 
 /* Read a string, and return a pointer to it.  Returns NULL on EOF. */
-char *
+static char *
 vtysh_rl_gets ()
 {
   HIST_ENTRY *last;

+ 11 - 7
vtysh/vtysh_user.c

@@ -99,19 +99,21 @@ struct vtysh_user
 
 struct list *userlist;
 
-struct vtysh_user *
+static struct vtysh_user *
 user_new ()
 {
   return XCALLOC (0, sizeof (struct vtysh_user));
 }
 
-void
+#if 0
+static void
 user_free (struct vtysh_user *user)
 {
   XFREE (0, user);
 }
+#endif
 
-struct vtysh_user *
+static struct vtysh_user *
 user_lookup (const char *name)
 {
   struct listnode *node, *nnode;
@@ -125,7 +127,8 @@ user_lookup (const char *name)
   return NULL;
 }
 
-void
+#if 0
+static void
 user_config_write ()
 {
   struct listnode *node, *nnode;
@@ -137,8 +140,9 @@ user_config_write ()
 	printf (" username %s nopassword\n", user->name);
     }
 }
+#endif
 
-struct vtysh_user *
+static struct vtysh_user *
 user_get (const char *name)
 {
   struct vtysh_user *user;
@@ -167,7 +171,7 @@ DEFUN (username_nopassword,
 }
 
 int
-vtysh_auth ()
+vtysh_auth (void)
 {
   struct vtysh_user *user;
   struct passwd *passwd;
@@ -188,7 +192,7 @@ vtysh_auth ()
 }
 
 void
-vtysh_user_init ()
+vtysh_user_init (void)
 {
   userlist = list_new ();
   install_element (CONFIG_NODE, &username_nopassword_cmd);

+ 2 - 1
vtysh/vtysh_user.h

@@ -22,6 +22,7 @@
 #ifndef _VTYSH_USER_H
 #define _VTYSH_USER_H
 
-int vtysh_auth ();
+int vtysh_auth (void);
+void vtysh_user_init (void);
 
 #endif /* _VTYSH_USER_H */