| 554 | */ |
| 555 | |
| 556 | static ssize_t /* O - Length of next line */ |
| 557 | copy_comments(cups_file_t *fp, /* I - File to read from */ |
| 558 | pstops_doc_t *doc, /* I - Document info */ |
| 559 | ppd_file_t *ppd, /* I - PPD file */ |
| 560 | char *line, /* I - Line buffer */ |
| 561 | ssize_t linelen, /* I - Length of initial line */ |
| 562 | size_t linesize) /* I - Size of line buffer */ |
| 563 | { |
| 564 | int saw_bounding_box, /* Saw %%BoundingBox: comment? */ |
| 565 | saw_for, /* Saw %%For: comment? */ |
| 566 | saw_pages, /* Saw %%Pages: comment? */ |
| 567 | saw_title; /* Saw %%Title: comment? */ |
| 568 | |
| 569 | |
| 570 | /* |
| 571 | * Loop until we see %%EndComments or a non-comment line... |
| 572 | */ |
| 573 | |
| 574 | saw_bounding_box = 0; |
| 575 | saw_for = 0; |
| 576 | saw_pages = 0; |
| 577 | saw_title = 0; |
| 578 | |
| 579 | while (line[0] == '%') |
| 580 | { |
| 581 | /* |
| 582 | * Strip trailing whitespace... |
| 583 | */ |
| 584 | |
| 585 | while (linelen > 0) |
| 586 | { |
| 587 | linelen --; |
| 588 | |
| 589 | if (!isspace(line[linelen] & 255)) |
| 590 | break; |
| 591 | else |
| 592 | line[linelen] = '\0'; |
| 593 | } |
| 594 | |
| 595 | /* |
| 596 | * Log the header... |
| 597 | */ |
| 598 | |
| 599 | fprintf(stderr, "DEBUG: %s\n", line); |
| 600 | |
| 601 | /* |
| 602 | * Pull the headers out... |
| 603 | */ |
| 604 | |
| 605 | if (!strncmp(line, "%%Pages:", 8)) |
| 606 | { |
| 607 | int pages; /* Number of pages */ |
| 608 | |
| 609 | if (saw_pages) |
| 610 | fputs("DEBUG: A duplicate %%Pages: comment was seen.\n", stderr); |
| 611 | |
| 612 | saw_pages = 1; |
| 613 |
no test coverage detected