Commit 7c825b7c authored by Tristan Gingold's avatar Tristan Gingold

wr2rf.c: add a timeout option for wr-wait

parent 8b54cd82
......@@ -1132,12 +1132,30 @@ wrc_read_print_status (struct libwr2rf_dev *dev)
static void
wrc_wait (struct libwr2rf_dev *dev, int argc, char **argv)
{
while (1) {
unsigned count;
count = ~0;
if (argc > 1) {
if (strcmp(argv[1], "help") == 0) {
printf ("usage: %s [timeout]\n", argv[0]);
return;
}
else if (isdigit (argv[1][0]))
count = atoi(argv[1]);
else {
fprintf (stderr, "unknown option %s\n", argv[1]);
return;
}
}
for (; count; count--) {
wrc_read_print_status (dev);
if (libwr2rf_wrc_time_valid(dev) == 0)
break;
return;
sleep(1);
}
printf("wr-wait: timeout\n");
}
static void
......
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