return out;
}
-struct wgdevice *config_read_cmd(char *argv[], int argc)
+struct wgdevice *config_read_cmd(const char *argv[], int argc)
{
struct wgdevice *device = calloc(1, sizeof(*device));
struct wgpeer *peer = NULL;
bool is_peer_section, is_device_section;
};
-struct wgdevice *config_read_cmd(char *argv[], int argc);
+struct wgdevice *config_read_cmd(const char *argv[], int argc);
bool config_read_init(struct config_ctx *ctx, bool append);
bool config_read_line(struct config_ctx *ctx, const char *line);
struct wgdevice *config_read_finish(struct config_ctx *ctx);
}
#endif
-int genkey_main(int argc, char *argv[])
+int genkey_main(int argc, const char *argv[])
{
uint8_t key[WG_KEY_LEN];
char base64[WG_KEY_LEN_BASE64];
#include "subcommands.h"
#include "ctype.h"
-int pubkey_main(int argc, char *argv[])
+int pubkey_main(int argc, const char *argv[])
{
uint8_t key[WG_KEY_LEN] __attribute__((aligned(sizeof(uintptr_t))));
char base64[WG_KEY_LEN_BASE64];
#include "ipc.h"
#include "subcommands.h"
-int set_main(int argc, char *argv[])
+int set_main(int argc, const char *argv[])
{
struct wgdevice *device = NULL;
int ret = 1;
return true;
}
-int setconf_main(int argc, char *argv[])
+int setconf_main(int argc, const char *argv[])
{
struct wgdevice *device = NULL;
struct config_ctx ctx;
return base64;
}
-static char *maybe_key(const uint8_t maybe_key[static WG_KEY_LEN], bool have_it)
+static const char *maybe_key(const uint8_t maybe_key[static WG_KEY_LEN], bool have_it)
{
if (!have_it)
return "(none)";
return key(maybe_key);
}
-static char *masked_key(const uint8_t masked_key[static WG_KEY_LEN])
+static const char *masked_key(const uint8_t masked_key[static WG_KEY_LEN])
{
const char *var = getenv("WG_HIDE_KEYS");
return true;
}
-int show_main(int argc, char *argv[])
+int show_main(int argc, const char *argv[])
{
int ret = 0;
#include "ipc.h"
#include "subcommands.h"
-int showconf_main(int argc, char *argv[])
+int showconf_main(int argc, const char *argv[])
{
char base64[WG_KEY_LEN_BASE64];
char ip[INET6_ADDRSTRLEN];
#define SUBCOMMANDS_H
extern const char *PROG_NAME;
-int show_main(int argc, char *argv[]);
-int showconf_main(int argc, char *argv[]);
-int set_main(int argc, char *argv[]);
-int setconf_main(int argc, char *argv[]);
-int genkey_main(int argc, char *argv[]);
-int pubkey_main(int argc, char *argv[]);
+int show_main(int argc, const char *argv[]);
+int showconf_main(int argc, const char *argv[]);
+int set_main(int argc, const char *argv[]);
+int setconf_main(int argc, const char *argv[]);
+int genkey_main(int argc, const char *argv[]);
+int pubkey_main(int argc, const char *argv[]);
#endif
static const struct {
const char *subcommand;
- int (*function)(int, char**);
+ int (*function)(int, const char**);
const char *description;
} subcommands[] = {
{ "show", show_main, "Shows the current configuration and device information" },
fprintf(file, "You may pass `--help' to any of these subcommands to view usage.\n");
}
-int main(int argc, char *argv[])
+int main(int argc, const char *argv[])
{
PROG_NAME = argv[0];
}
if (argc == 1) {
- static char *new_argv[] = { "show", NULL };
+ static const char *new_argv[] = { "show", NULL };
return show_main(1, new_argv);
}