Parser of command line optarg ignores long version of arguments
Parsing command line arguments ignores long version of arguments, e.g
./src/siril -d /astronomy/data/m81.m82.fits -s /astronomy/data/m81.m82.fits/mono_preprocessing_cosmetic.ssf
works as expected, however long version arguments:
./src/siril --directory /astronomy/data/m81.m82.fits --script /astronomy/data/m81.m82.fits/mono_preprocessing_cosmetic.ssf
does not work.
Inspecting e.g. the code snippet:
case 'd':
cwd_forced = optarg;
forcecwd = TRUE;
break;
reveals that optarg = 'irectory' rather than next char* argument.
How about switching to getopt_long, that is, e.g.
struct option long_opts[] = {
{"directory", required_argument, 0, 'd'},
{"script", required_argument, 0, 's'},
{0, 0, 0, 0}
};
int c;
while ((c = getopt_long(argc, argv, "d:s:",
long_opts, NULL)) != -1) {
switch (c) {
case 'd': {
/* Parse here the directory path argument. */
break;
}
case 's': {
/* Parse here the script path argument. */
break;
}