]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
dca59f62 LP |
2 | #pragma once |
3 | ||
fd67de01 LP |
4 | #include <stdbool.h> |
5 | ||
dca59f62 | 6 | #define VERB_ANY ((unsigned) -1) |
0c63eb71 LP |
7 | |
8 | typedef enum VerbFlags { | |
c56d1e2c CW |
9 | VERB_DEFAULT = 1 << 0, |
10 | VERB_ONLINE_ONLY = 1 << 1, | |
11 | VERB_MUST_BE_ROOT = 1 << 2, | |
0c63eb71 | 12 | } VerbFlags; |
dca59f62 LP |
13 | |
14 | typedef struct { | |
15 | const char *verb; | |
16 | unsigned min_args, max_args; | |
0c63eb71 | 17 | VerbFlags flags; |
dca59f62 LP |
18 | int (* const dispatch)(int argc, char *argv[], void *userdata); |
19 | } Verb; | |
20 | ||
f38951a6 CW |
21 | bool running_in_chroot_or_offline(void); |
22 | ||
dca59f62 | 23 | int dispatch_verb(int argc, char *argv[], const Verb verbs[], void *userdata); |