swanctl: Add global --debug, --options and --uri arguments

Similarly to the previous commit for pki, this allows setting these
options before the command, and by pre-parsing them we can see log
messages during the initialization.
This commit is contained in:
Tobias Brunner
2026-02-06 11:25:13 +01:00
parent 0d41001e74
commit e2786cbcb8
3 changed files with 193 additions and 91 deletions
+9 -3
View File
@@ -1,4 +1,5 @@
/*
* Copyright (C) 2016-2026 Tobias Brunner
* Copyright (C) 2009 Martin Willi
*
* Copyright (C) secunet Security Networks AG
@@ -26,9 +27,9 @@
#include <library.h>
/**
* Maximum number of commands (+1).
* Maximum number of commands (+3).
*/
#define MAX_COMMANDS 26
#define MAX_COMMANDS 29
/**
* Maximum number of options in a command (+3)
@@ -96,10 +97,15 @@ int command_getopt(char **arg);
*/
void command_register(command_t command);
/**
* Initialize command parsing/dispatching.
*/
int command_init(int argc, char *argv[]);
/**
* Dispatch commands.
*/
int command_dispatch(int argc, char *argv[]);
int command_dispatch();
/**
* Show usage information of active command.