Error message when specifying unused mapping

This commit is contained in:
Iwan Timmer 2015-07-15 11:56:48 +02:00
parent f99ba40cc9
commit d71d238a19

View File

@ -178,6 +178,8 @@ int main(int argc, char* argv[]) {
int option_index = 0;
bool sops = true;
bool localaudio = false;
bool inputAdded = false;
bool mapped = true;
int c;
while ((c = getopt_long_only(argc, argv, "-abc:d:efg:h:i:j:k:lm:n", long_options, &option_index)) != -1) {
switch (c) {
@ -212,6 +214,8 @@ int main(int argc, char* argv[]) {
break;
case 'j':
input_create(optarg, mapping);
inputAdded = true;
mapped = true;
break;
case 'k':
mapping = get_path(optarg);
@ -219,6 +223,7 @@ int main(int argc, char* argv[]) {
fprintf(stderr, "Unable to open custom mapping file: %s\n", optarg);
exit(-1);
}
mapped = false;
break;
case 'l':
sops = false;
@ -241,6 +246,11 @@ int main(int argc, char* argv[]) {
}
}
if (inputAdded && !mapped) {
fprintf(stderr, "Mapping option should be followed by the input to be mapped.\n");
exit(-1);
}
if (action == NULL || strcmp("help", action) == 0)
help();
else if (strcmp("map", action) == 0) {