Commit 552f6581 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

parseOptionsLong: init all flag.

parent 13d6a27b
......@@ -1029,23 +1029,12 @@ str_to_int(const char *intstring)
void
evaluateColorOptions(const std::string &optarg)
{
if ("all" == optarg)
{
mpmoColorSet(All);
}
else if ("auto" == optarg)
{
mpmoColorSet(Auto);
}
else if ("no" == optarg)
{
mpmoColorSet(No);
}
else
{
mpmoColorSet(All);
cdoAbort("Color option <%s> unknown. Known options: auto, all, no", Yellow(optarg.c_str()));
}
// clang-format off
if ("all" == optarg) mpmoColorSet(All);
else if ("auto" == optarg) mpmoColorSet(Auto);
else if ("no" == optarg) mpmoColorSet(No);
else cdoAbort("Color option <%s> unknown. Known options: auto, all, no", Yellow(optarg.c_str()));
// clang-format on
}
int
......@@ -1064,33 +1053,33 @@ evaluateExpectOptions(const std::string &optarg)
}
static int
parse_options_long(int argc, char *argv[])
parseOptionsLong(int argc, char *argv[])
{
// These variables must be initialized with each while loop run!
int lasync_worker;
int lnetcdf_hdr_pad;
int luse_fftw;
int leccodes;
int lcellsearchmethod;
int lpointsearchmethod;
int lcolor;
int lconfig;
int ldebLevel;
int leccodes;
int lenableexcept;
int lgridsearchradius;
int lremap_genweights;
int lprecision;
int lnetcdf_hdr_pad;
int lpedantic;
int lpercentile;
int lprintoperatorsno = 0;
int lprintoperators = 0;
int lpedantic = 0;
int lenableexcept;
int ltimestat_date;
int luse_time_bounds;
int lpointsearchmethod;
int lprecision;
int lprintoperators;
int lprintoperatorsno;
int lremap_genweights;
int lscmode;
int lseed;
int lsortname;
int lsortparam;
int ldebLevel;
int lseed = 0;
int lscmode;
int lconfig;
int ltimestat_date;
int luse_fftw;
int luse_time_bounds;
int verbose;
int lcolor;
char *token;
// clang-format off
const struct cdo_option opt_long[] =
......@@ -1147,24 +1136,28 @@ parse_options_long(int argc, char *argv[])
// IMPORTANT: BY EVERY OPTION that takes arguments you MUST set its trigger variable to ZERO;
// otherwise the parameters of other options get wrongly assigned.
lasync_worker = 0;
leccodes = 0;
lprecision = 0;
lpercentile = 0;
lnetcdf_hdr_pad = 0;
luse_fftw = 0;
lcellsearchmethod = 0;
lcolor = 0;
lconfig = 0;
lpointsearchmethod = 0;
ldebLevel = 0;
leccodes = 0;
lenableexcept = 0;
lgridsearchradius = 0;
lnetcdf_hdr_pad = 0;
lpedantic = 0;
lpercentile = 0;
lpointsearchmethod = 0;
lprecision = 0;
lprintoperators = 0;
lprintoperatorsno = 0;
lremap_genweights = 0;
lenableexcept = 0;
ltimestat_date = 0;
luse_time_bounds = 0;
lscmode = 0;
lseed = 0;
lsortname = 0;
lsortparam = 0;
ldebLevel = 0;
lscmode = 0;
lcolor = 0;
ltimestat_date = 0;
luse_fftw = 0;
luse_time_bounds = 0;
int c = cdo_getopt_long(argc, argv, "f:b:e:P:g:i:k:l:m:n:t:D:z:aC:cdhLMOpQRrsSTuVvWXZ", opt_long, nullptr);
if (c == -1) break;
......@@ -1307,16 +1300,15 @@ parse_options_long(int argc, char *argv[])
break;
case 'D':
Debug = 1;
token = std::strtok((char *) CDO_optarg, ",");
while (token != NULL)
{
int res = std::atoi(token);
if (res != 0)
{
DebugLevel = DebugLevel | (int) std::pow(2, res) / 2;
}
token = std::strtok(NULL, ",");
}
{
char *token = std::strtok((char *) CDO_optarg, ",");
while (token != NULL)
{
int res = std::atoi(token);
if (res != 0) DebugLevel = DebugLevel | (int) std::pow(2, res) / 2;
token = std::strtok(NULL, ",");
}
}
break;
case 'f': setDefaultFileType(CDO_optarg); break;
case 'g': cdo_set_grids(CDO_optarg); break;
......@@ -1796,7 +1788,7 @@ main(int argc, char *argv[])
get_env_vars();
init_modules();
status = parse_options_long(argc, argv);
status = parseOptionsLong(argc, argv);
if (status != 0) return 1;
cdo_set_options();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment