Skip to content
Snippets Groups Projects
Commit 99211441 authored by Andreas Gattringer's avatar Andreas Gattringer
Browse files

fixed command line parsing

parent 6fa634cf
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,7 @@
#include "cats_global.h"
#include <string.h>
#include <assert.h>
#include "command_line_options.h"
#include "command_line_info.h"
......@@ -91,17 +92,17 @@ struct program_options check_cats_main_arguments(int argc, char **argv)
int opt;
int error = 0;
int option_index = 0;
// FIXME unify error messages, start with Error:
while ((opt = getopt_long(argc, argv, "qs:r:l:v:ho:",
longopts, &optind)) != -1) {
longopts, &option_index)) != -1) {
bool success;
bool conversion_success;
float value;
bool bool_value;
switch (opt) {
case 'o':
case 'o':
options.output_directory = strdup(optarg);
break;
case 'r':
......@@ -288,9 +289,9 @@ struct program_options check_cats_main_arguments(int argc, char **argv)
exit_cats(EXIT_FAILURE);
}
for (int index = optind; index < argc; index++) {
options.configuration_file = argv[index];
break;
assert(optind < argc);
if (options.configuration_file == NULL && options.need_conf == true) {
options.configuration_file = strdup(argv[optind]);
}
if (options.configuration_file == NULL && options.need_conf == true) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment