struct vtysh_client
{
int fd;
- char *name;
+ const char *name;
int flag;
- char *path;
+ const char *path;
struct vtysh_client *next;
};
{ .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;
return ret;
}
-static int
+static void
vtysh_client_config (struct vtysh_client *head_client, char *line)
{
struct vtysh_client *client;
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
}
int
-vtysh_mark_file (char *filename)
+vtysh_mark_file (const char *filename)
{
struct vty *vty;
FILE *confp = NULL;
"Write to terminal\n")
{
u_int i;
- int ret;
char line[] = "write terminal\n";
FILE *fp = NULL;
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 ();
write_config_integrated(void)
{
u_int i;
- int ret;
char line[] = "write terminal\n";
FILE *fp;
char *integrate_sav = NULL;
}
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);
}
/* 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;
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;
}
{
/* 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,
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;
}
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++;
#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;
/* 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;
FILE *logfile;
/* SIGTSTP handler. This function care user's ^Z input. */
-void
+static void
sigtstp (int sig)
{
/* Execute "end" command. */
}
/* SIGINT handler. This function care user's ^Z input. */
-void
+static void
sigint (int sig)
{
/* Check this process is not child process. */
/* 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;
}
/* Initialization of signal handles. */
-void
-vtysh_signal_init ()
+static void
+vtysh_signal_init (void)
{
vtysh_signal_set (SIGINT, sigint);
vtysh_signal_set (SIGTSTP, sigtstp);
};
/* 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
{
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);