| 435 | } |
| 436 | |
| 437 | static void parse_output_words(struct output_struct *words, short *levels, const char *str, uchar priority) |
| 438 | { |
| 439 | const char *s; |
| 440 | int j, len, lev; |
| 441 | |
| 442 | for ( ; str; str = s) { |
| 443 | if ((s = strchr(str, ',')) != NULL) |
| 444 | len = s++ - str; |
| 445 | else |
| 446 | len = strlen(str); |
| 447 | if (!len) |
| 448 | continue; |
| 449 | if (!isDigit(str)) { |
| 450 | while (len && isDigit(str+len-1)) |
| 451 | len--; |
| 452 | } |
| 453 | lev = isDigit(str+len) ? atoi(str+len) : 1; |
| 454 | if (lev > MAX_OUT_LEVEL) |
| 455 | lev = MAX_OUT_LEVEL; |
| 456 | if (len == 4 && strncasecmp(str, "help", 4) == 0) { |
| 457 | output_item_help(words); |
| 458 | exit_cleanup(0); |
| 459 | } |
| 460 | if (len == 4 && strncasecmp(str, "none", 4) == 0) |
| 461 | len = lev = 0; |
| 462 | else if (len == 3 && strncasecmp(str, "all", 3) == 0) |
| 463 | len = 0; |
| 464 | for (j = 0; words[j].name; j++) { |
| 465 | if (!len |
| 466 | || (len == words[j].namelen && strncasecmp(str, words[j].name, len) == 0)) { |
| 467 | if (priority >= words[j].priority) { |
| 468 | words[j].priority = priority; |
| 469 | levels[j] = lev; |
| 470 | } |
| 471 | if (len) |
| 472 | break; |
| 473 | } |
| 474 | } |
| 475 | if (len && !words[j].name && !am_server) { |
| 476 | rprintf(FERROR, "Unknown %s item: \"%.*s\"\n", |
| 477 | words[j].help, len, str); |
| 478 | exit_cleanup(RERR_SYNTAX); |
| 479 | } |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | /* Tell the user what all the info or debug flags mean. */ |
| 484 | static void output_item_help(struct output_struct *words) |
no test coverage detected