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

Function show_ppd

cups/testlang.c:158–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156 */
157
158static int /* O - Number of errors */
159show_ppd(const char *filename) /* I - Filename */
160{
161 ppd_file_t *ppd; /* PPD file */
162 ppd_option_t *option; /* PageSize option */
163 ppd_choice_t *choice; /* PageSize/Letter choice */
164 char buffer[1024]; /* String buffer */
165
166
167 if ((ppd = ppdOpenFile(filename)) == NULL)
168 {
169 printf("Unable to open PPD file \"%s\".\n", filename);
170 return (1);
171 }
172
173 ppdLocalize(ppd);
174
175 if ((option = ppdFindOption(ppd, "PageSize")) == NULL)
176 {
177 puts("No PageSize option.");
178 return (1);
179 }
180 else
181 {
182 printf("PageSize: %s\n", option->text);
183
184 if ((choice = ppdFindChoice(option, "Letter")) == NULL)
185 {
186 puts("No Letter PageSize choice.");
187 return (1);
188 }
189 else
190 {
191 printf("Letter: %s\n", choice->text);
192 }
193 }
194
195 printf("media-empty: %s\n", ppdLocalizeIPPReason(ppd, "media-empty", NULL, buffer, sizeof(buffer)));
196
197 ppdClose(ppd);
198
199 return (0);
200}
201
202
203/*

Callers 1

mainFunction · 0.85

Calls 6

ppdOpenFileFunction · 0.85
ppdLocalizeFunction · 0.85
ppdFindOptionFunction · 0.85
ppdFindChoiceFunction · 0.85
ppdLocalizeIPPReasonFunction · 0.85
ppdCloseFunction · 0.85

Tested by

no test coverage detected