1
0
Fork 0

Args for key path and addressbook path was capitalised and theirs long variants.

This commit is contained in:
Alexander Andreev 2024-03-31 02:13:27 +04:00
parent 9d7383ec73
commit 4a03096436
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34
1 changed files with 15 additions and 2 deletions

View File

@ -267,9 +267,22 @@ int parse_argv(int argc, const char **argv, struct options *opts) {
for (int i = 1; i < argc; ++i) {
if (argv[i][0] == '-') {
if (argv[i][1] == '-') {
if (strncmp(&argv[i][2], "keys", 4) == 0) {
opts->key_path = argv[i+1];
++i;
} else if (strncmp(&argv[i][2], "addressbook", 11) == 0) {
opts->addressbook_path = argv[i+1];
++i;
} else {
return -1;
}
continue;
}
switch (argv[i][1]) {
case 'k': opts->key_path = argv[i+1]; ++i; continue;
case 'a': opts->addressbook_path = argv[i+1]; ++i; continue;
case 'K': opts->key_path = argv[i+1]; ++i; continue;
case 'A': opts->addressbook_path = argv[i+1]; ++i; continue;
case 'v': return -2;
case 'h': return -3;
default: return -1;