#include <isc/mem.h>
#include <isc/netmgr.h>
+#define DEFAULT_PATH "/tmp"
+
typedef struct ctx {
int log_level;
+ // Path
+ const char* path;
+
// Zones
const char** zones;
unsigned int num_zones;
enum {
OPT_DEBUG = 1,
+ OPT_PATH = 2,
};
static struct argp_option options[] = {
{ "debug", OPT_DEBUG, NULL, 0, "Run in debug mode", 0 },
+ { "path", OPT_PATH, "PATH", 1, "Path where to store the zones", 0 },
{ NULL },
};
ctx->log_level = LOG_DEBUG;
break;
+ case OPT_PATH:
+ ctx->path = arg;
+ break;
+
case ARGP_KEY_ARG:
zones = reallocarray(ctx->zones, ctx->num_zones + 1, sizeof(*ctx->zones));
if (!zones) {
int r;
// Create the context
- ctx_t ctx = {};
+ ctx_t ctx = {
+ .path = DEFAULT_PATH,
+ };
// Setup the command line parser
struct argp parser = {