@@ -35,11 +35,13 @@ static void show_usage(int argc, char** argv) {
3535 std::cout
3636 << " Use: " << QASP_PROGRAM_NAME << " [OPTIONS] SOURCES...\n "
3737 << " Process qasp SOURCES and blabla...\n\n "
38- << " -q, --quiet hide log information\n "
39- << " --help show this help\n "
40- << " --version print version info and exit\n " ;
38+ << " -j N, --parallel=N allow N jobs at once.\n "
39+ << " -n N, --iterations=N iterate solving N times (infinite: N <- 0).\n "
40+ << " -q, --quiet hide log information.\n "
41+ << " --help print this message and exit.\n "
42+ << " --version print version info and exit.\n " ;
4143
42- exit (1 );
44+ exit (EXIT_FAILURE );
4345
4446}
4547
@@ -63,7 +65,7 @@ static void show_version(int argc, char** argv) {
6365 << __TIMESTAMP__ << " )\n " ;
6466
6567
66- exit (1 );
68+ exit (EXIT_FAILURE );
6769
6870}
6971
@@ -83,7 +85,7 @@ int main(int argc, char** argv) {
8385 qasp::Options options;
8486
8587 int c, idx;
86- while ((c = getopt_long (argc, argv, " qj:hv" , long_options, &idx)) != -1 ) {
88+ while ((c = getopt_long (argc, argv, " qj:n: hv" , long_options, &idx)) != -1 ) {
8789
8890 switch (c) {
8991 case ' q' :
@@ -92,6 +94,9 @@ int main(int argc, char** argv) {
9294 case ' j' :
9395 options.cpus = atoi (optarg);
9496 break ;
97+ case ' n' :
98+ options.iterations = atoll (optarg);
99+ break ;
95100 case ' v' :
96101 show_version (argc, argv);
97102 break ;
@@ -111,6 +116,11 @@ int main(int argc, char** argv) {
111116 abort ();
112117 }
113118
119+ if (unlikely (options.iterations <= 0 )) {
120+ options.iterations = std::numeric_limits<decltype (options.iterations )>().max ();
121+ }
122+
123+
114124
115125 std::vector<std::string> sources;
116126
@@ -153,6 +163,6 @@ int main(int argc, char** argv) {
153163
154164 }
155165
156- return 0 ;
166+ return EXIT_SUCCESS ;
157167
158168}
0 commit comments