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; int option_index = 0;
bool sops = true; bool sops = true;
bool localaudio = false; bool localaudio = false;
bool inputAdded = false;
bool mapped = true;
int c; int c;
while ((c = getopt_long_only(argc, argv, "-abc:d:efg:h:i:j:k:lm:n", long_options, &option_index)) != -1) { while ((c = getopt_long_only(argc, argv, "-abc:d:efg:h:i:j:k:lm:n", long_options, &option_index)) != -1) {
switch (c) { switch (c) {
@ -212,6 +214,8 @@ int main(int argc, char* argv[]) {
break; break;
case 'j': case 'j':
input_create(optarg, mapping); input_create(optarg, mapping);
inputAdded = true;
mapped = true;
break; break;
case 'k': case 'k':
mapping = get_path(optarg); 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); fprintf(stderr, "Unable to open custom mapping file: %s\n", optarg);
exit(-1); exit(-1);
} }
mapped = false;
break; break;
case 'l': case 'l':
sops = false; 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) if (action == NULL || strcmp("help", action) == 0)
help(); help();
else if (strcmp("map", action) == 0) { else if (strcmp("map", action) == 0) {