2017-11-18 17:09:20 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2014-12-19 01:48:05 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#define VERB_ANY ((unsigned) -1)
|
2017-12-11 23:10:11 +01:00
|
|
|
|
|
|
|
typedef enum VerbFlags {
|
2017-12-14 21:23:02 +01:00
|
|
|
VERB_DEFAULT = 1 << 0,
|
|
|
|
VERB_ONLINE_ONLY = 1 << 1,
|
|
|
|
VERB_MUST_BE_ROOT = 1 << 2,
|
2017-12-11 23:10:11 +01:00
|
|
|
} VerbFlags;
|
2014-12-19 01:48:05 +01:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const char *verb;
|
|
|
|
unsigned min_args, max_args;
|
2017-12-11 23:10:11 +01:00
|
|
|
VerbFlags flags;
|
2014-12-19 01:48:05 +01:00
|
|
|
int (* const dispatch)(int argc, char *argv[], void *userdata);
|
|
|
|
} Verb;
|
|
|
|
|
2017-12-13 22:04:41 +01:00
|
|
|
bool running_in_chroot_or_offline(void);
|
|
|
|
|
2014-12-19 01:48:05 +01:00
|
|
|
int dispatch_verb(int argc, char *argv[], const Verb verbs[], void *userdata);
|