diff --git a/cdba.c b/cdba.c index b4418c5..9c7cf73 100644 --- a/cdba.c +++ b/cdba.c @@ -467,6 +467,7 @@ static void usage(void) int main(int argc, char **argv) { + bool power_cycle_on_timeout = true; bool timeout_on_inactivity = true; struct termios *orig_tios; struct work *next; @@ -487,11 +488,14 @@ int main(int argc, char **argv) int opt; int ret; - while ((opt = getopt(argc, argv, "b:c:h:t:T:")) != -1) { + while ((opt = getopt(argc, argv, "b:c:C:h:t:T:")) != -1) { switch (opt) { case 'b': board = optarg; break; + case 'C': + power_cycle_on_timeout = false; + /* FALLTHROUGH */ case 'c': power_cycles = atoi(optarg); break; @@ -537,6 +541,9 @@ int main(int argc, char **argv) if (!power_cycles) break; + if (reached_timeout && !power_cycle_on_timeout) + break; + printf("power cycle (%d left)\n", power_cycles); fflush(stdout);