shared/verbs: turn verb argument specification into nulstr
Like the command-level CommandDescription.argspec, a verb's argspec is now a nulstr, so that a verb may declare multiple alternative usage lines. The verbs help table renders one synopsis line per nulstr entry in the synopsis cell. All verb argument specifications must gain an explicit NUL suffix. This is a lot of churn, but I think this needs to be done. For now, there'll be only one user of the new functionality (i.e. a verb with more than one argspec), but I think we'll eventually want to use this in other places too.
This commit is contained in:
@@ -82,7 +82,7 @@ static const char *integrity_algorithm_select(const void *key_file_buf) {
|
||||
return dm_integrity_algorithm_to_string(a);
|
||||
}
|
||||
|
||||
VERB(verb_attach, "attach", "VOLUME DEVICE [HMAC_KEY_FILE|-] [OPTIONS]", 3, 5, 0,
|
||||
VERB(verb_attach, "attach", "VOLUME DEVICE [HMAC_KEY_FILE|-] [OPTIONS]\0", 3, 5, 0,
|
||||
"Attach an integrity protected block device");
|
||||
static int verb_attach(int argc, char *argv[], uintptr_t _data, void *userdata) {
|
||||
_cleanup_(crypt_freep) struct crypt_device *cd = NULL;
|
||||
@@ -151,7 +151,7 @@ static int verb_attach(int argc, char *argv[], uintptr_t _data, void *userdata)
|
||||
return 0;
|
||||
}
|
||||
|
||||
VERB(verb_detach, "detach", "VOLUME", 2, 2, 0,
|
||||
VERB(verb_detach, "detach", "VOLUME\0", 2, 2, 0,
|
||||
"Detach an integrity protected block device");
|
||||
static int verb_detach(int argc, char *argv[], uintptr_t _data, void *userdata) {
|
||||
_cleanup_(crypt_freep) struct crypt_device *cd = NULL;
|
||||
|
||||
Reference in New Issue
Block a user