MCPcopy Create free account
hub / github.com/OpenPrinting/cups / copy_setup

Function copy_setup

filter/pstops.c:1732–1799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1730 */
1731
1732static ssize_t /* O - Length of next line */
1733copy_setup(cups_file_t *fp, /* I - File to read from */
1734 pstops_doc_t *doc, /* I - Document info */
1735 ppd_file_t *ppd, /* I - PPD file */
1736 char *line, /* I - Line buffer */
1737 ssize_t linelen, /* I - Length of initial line */
1738 size_t linesize) /* I - Size of line buffer */
1739{
1740 int num_options; /* Number of options */
1741 cups_option_t *options; /* Options */
1742
1743
1744 while (strncmp(line, "%%BeginSetup", 12))
1745 {
1746 if (!strncmp(line, "%%Page:", 7))
1747 break;
1748
1749 doc_write(doc, line, (size_t)linelen);
1750
1751 if ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) == 0)
1752 break;
1753 }
1754
1755 doc_puts(doc, "%%BeginSetup\n");
1756
1757 do_setup(doc, ppd);
1758
1759 num_options = 0;
1760 options = NULL;
1761
1762 if (!strncmp(line, "%%BeginSetup", 12))
1763 {
1764 while (strncmp(line, "%%EndSetup", 10))
1765 {
1766 if (!strncmp(line, "%%Page:", 7))
1767 break;
1768 else if (!strncmp(line, "%%IncludeFeature:", 17))
1769 {
1770 /*
1771 * %%IncludeFeature: *MainKeyword OptionKeyword
1772 */
1773
1774 if (doc->number_up == 1 && !doc->fit_to_page)
1775 num_options = include_feature(ppd, line, num_options, &options);
1776 }
1777 else if (strncmp(line, "%%BeginSetup", 12))
1778 doc_write(doc, line, (size_t)linelen);
1779
1780 if ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) == 0)
1781 break;
1782 }
1783
1784 if (!strncmp(line, "%%EndSetup", 10))
1785 linelen = (ssize_t)cupsFileGetLine(fp, line, linesize);
1786 else
1787 fputs("DEBUG: The %%EndSetup comment is missing.\n", stderr);
1788 }
1789

Callers 1

copy_dscFunction · 0.85

Calls 7

doc_writeFunction · 0.85
cupsFileGetLineFunction · 0.85
doc_putsFunction · 0.85
do_setupFunction · 0.85
include_featureFunction · 0.85
write_optionsFunction · 0.85
cupsFreeOptionsFunction · 0.85

Tested by

no test coverage detected