| 163 | return 1; |
| 164 | } |
| 165 | |
| 166 | const char *why = err[0] ? err : "route incomplete"; |
| 167 | if (strcmp(last, why) != 0 || (ticks % 20u) == 0) { |
| 168 | fprintf(stderr, "ds4: waiting for distributed route: %s\n", why); |
| 169 | snprintf(last, sizeof(last), "%s", why); |
| 170 | } |
| 171 | nanosleep(&delay, NULL); |
| 172 | ticks++; |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | static void usage(FILE *fp, const char *topic) { |
| 177 | ds4_help_print(fp, DS4_HELP_DS4, topic); |
| 178 | } |
| 179 | |
| 180 | static int parse_int(const char *s, const char *opt) { |
| 181 | char *end = NULL; |
| 182 | long v = strtol(s, &end, 10); |
| 183 | if (s[0] == '\0' || *end != '\0' || v <= 0 || v > INT32_MAX) { |