| 517 | */ |
| 518 | |
| 519 | static int /* O - 1 on success, 0 on failure */ |
| 520 | load_words(const char *filename, /* I - File to load */ |
| 521 | cups_array_t *array) /* I - Array to add to */ |
| 522 | { |
| 523 | FILE *fp; /* Test file */ |
| 524 | char word[256]; /* Word from file */ |
| 525 | |
| 526 | |
| 527 | if ((fp = fopen(filename, "r")) == NULL) |
| 528 | { |
| 529 | perror(filename); |
| 530 | return (0); |
| 531 | } |
| 532 | |
| 533 | while (fscanf(fp, "%255s", word) == 1) |
| 534 | { |
| 535 | if (!cupsArrayFind(array, word)) |
| 536 | cupsArrayAdd(array, strdup(word)); |
| 537 | } |
| 538 | |
| 539 | fclose(fp); |
| 540 | |
| 541 | return (1); |
| 542 | } |
no test coverage detected