]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/testppd.c
5318c4d240ee5766e282b4b746653f0ef705423c
[thirdparty/cups.git] / cups / testppd.c
1 /*
2 * "$Id: testppd.c 7633 2008-06-10 23:07:29Z mike $"
3 *
4 * PPD test program for the Common UNIX Printing System (CUPS).
5 *
6 * Copyright 2007-2008 by Apple Inc.
7 * Copyright 1997-2006 by Easy Software Products.
8 *
9 * These coded instructions, statements, and computer programs are the
10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * which should have been included with this file. If this file is
13 * file is missing or damaged, see the license at "http://www.cups.org/".
14 *
15 * This file is subject to the Apple OS-Developed Software exception.
16 *
17 * Contents:
18 *
19 * main() - Main entry.
20 */
21
22 /*
23 * Include necessary headers...
24 */
25
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <cups/string.h>
29 #include <sys/stat.h>
30 #include <errno.h>
31 #include "cups.h"
32 #ifdef WIN32
33 # include <io.h>
34 #else
35 # include <unistd.h>
36 # include <fcntl.h>
37 #endif /* WIN32 */
38
39
40 /*
41 * Test data...
42 */
43
44 static const char *default_code =
45 "[{\n"
46 "%%BeginFeature: *InstalledDuplexer False\n"
47 "%%EndFeature\n"
48 "} stopped cleartomark\n"
49 "[{\n"
50 "%%BeginFeature: *PageRegion Letter\n"
51 "PageRegion=Letter\n"
52 "%%EndFeature\n"
53 "} stopped cleartomark\n"
54 "[{\n"
55 "%%BeginFeature: *InputSlot Tray\n"
56 "InputSlot=Tray\n"
57 "%%EndFeature\n"
58 "} stopped cleartomark\n"
59 "[{\n"
60 "%%BeginFeature: *IntOption None\n"
61 "%%EndFeature\n"
62 "} stopped cleartomark\n"
63 "[{\n"
64 "%%BeginFeature: *StringOption None\n"
65 "%%EndFeature\n"
66 "} stopped cleartomark\n";
67
68 static const char *custom_code =
69 "[{\n"
70 "%%BeginFeature: *InstalledDuplexer False\n"
71 "%%EndFeature\n"
72 "} stopped cleartomark\n"
73 "[{\n"
74 "%%BeginFeature: *InputSlot Tray\n"
75 "InputSlot=Tray\n"
76 "%%EndFeature\n"
77 "} stopped cleartomark\n"
78 "[{\n"
79 "%%BeginFeature: *IntOption None\n"
80 "%%EndFeature\n"
81 "} stopped cleartomark\n"
82 "[{\n"
83 "%%BeginFeature: *CustomStringOption True\n"
84 "(value\\0502\\051)\n"
85 "(value 1)\n"
86 "StringOption=Custom\n"
87 "%%EndFeature\n"
88 "} stopped cleartomark\n"
89 "[{\n"
90 "%%BeginFeature: *CustomPageSize True\n"
91 "400\n"
92 "500\n"
93 "0\n"
94 "0\n"
95 "0\n"
96 "PageSize=Custom\n"
97 "%%EndFeature\n"
98 "} stopped cleartomark\n";
99
100
101 /*
102 * 'main()' - Main entry.
103 */
104
105 int /* O - Exit status */
106 main(int argc, /* I - Number of command-line arguments */
107 char *argv[]) /* I - Command-line arguments */
108 {
109 int i; /* Looping var */
110 ppd_file_t *ppd; /* PPD file loaded from disk */
111 int status; /* Status of tests (0 = success, 1 = fail) */
112 int conflicts; /* Number of conflicts */
113 char *s; /* String */
114 char buffer[8192]; /* String buffer */
115 const char *text; /* Localized text */
116 int num_options; /* Number of options */
117 cups_option_t *options; /* Options */
118 ppd_size_t minsize, /* Minimum size */
119 maxsize; /* Maximum size */
120
121
122 status = 0;
123
124 if (argc == 1)
125 {
126 /*
127 * Setup directories for locale stuff...
128 */
129
130 if (access("locale", 0))
131 {
132 mkdir("locale", 0777);
133 mkdir("locale/fr", 0777);
134 symlink("../../../locale/cups_fr.po", "locale/fr/cups_fr.po");
135 mkdir("locale/zh_TW", 0777);
136 symlink("../../../locale/cups_zh_TW.po", "locale/zh_TW/cups_zh_TW.po");
137 }
138
139 putenv("LOCALEDIR=locale");
140
141 /*
142 * Do tests with test.ppd...
143 */
144
145 fputs("ppdOpenFile(test.ppd): ", stdout);
146
147 if ((ppd = ppdOpenFile("test.ppd")) != NULL)
148 puts("PASS");
149 else
150 {
151 ppd_status_t err; /* Last error in file */
152 int line; /* Line number in file */
153
154
155 status ++;
156 err = ppdLastError(&line);
157
158 printf("FAIL (%s on line %d)\n", ppdErrorString(err), line);
159 }
160
161 fputs("ppdMarkDefaults: ", stdout);
162 ppdMarkDefaults(ppd);
163
164 if ((conflicts = ppdConflicts(ppd)) == 0)
165 puts("PASS");
166 else
167 {
168 status ++;
169 printf("FAIL (%d conflicts)\n", conflicts);
170 }
171
172 fputs("ppdEmitString (defaults): ", stdout);
173 if ((s = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL &&
174 !strcmp(s, default_code))
175 puts("PASS");
176 else
177 {
178 status ++;
179 printf("FAIL (%d bytes instead of %d)\n", s ? (int)strlen(s) : 0,
180 (int)strlen(default_code));
181
182 if (s)
183 puts(s);
184 }
185
186 if (s)
187 free(s);
188
189 fputs("ppdEmitString (custom size and string): ", stdout);
190 ppdMarkOption(ppd, "PageSize", "Custom.400x500");
191 ppdMarkOption(ppd, "StringOption", "{String1=\"value 1\" String2=value(2)}");
192
193 if ((s = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL &&
194 !strcmp(s, custom_code))
195 puts("PASS");
196 else
197 {
198 status ++;
199 printf("FAIL (%d bytes instead of %d)\n", s ? (int)strlen(s) : 0,
200 (int)strlen(custom_code));
201
202 if (s)
203 puts(s);
204 }
205
206 if (s)
207 free(s);
208
209 /*
210 * Test constraints...
211 */
212
213 fputs("ppdConflicts(): ", stdout);
214 ppdMarkOption(ppd, "PageSize", "Letter");
215 ppdMarkOption(ppd, "InputSlot", "Envelope");
216
217 if ((conflicts = ppdConflicts(ppd)) == 2)
218 puts("PASS (2)");
219 else
220 {
221 printf("FAIL (%d)\n", conflicts);
222 status ++;
223 }
224
225 fputs("cupsResolveConflicts(InputSlot=Envelope): ", stdout);
226 num_options = 0;
227 options = NULL;
228 if (cupsResolveConflicts(ppd, "InputSlot", "Envelope", &num_options,
229 &options))
230 {
231 puts("FAIL (Resolved but shouldn't be able to!)");
232 status ++;
233 }
234 else
235 puts("PASS (Unable to resolve)");
236 cupsFreeOptions(num_options, options);
237
238 fputs("cupsResolveConflicts(No option/choice): ", stdout);
239 num_options = 0;
240 options = NULL;
241 if (cupsResolveConflicts(ppd, NULL, NULL, &num_options, &options) &&
242 num_options == 1 && !strcasecmp(options[0].name, "InputSlot") &&
243 !strcasecmp(options[0].value, "Manual"))
244 puts("PASS (Resolved)");
245 else if (num_options > 0)
246 {
247 printf("FAIL (%d options:", num_options);
248 for (i = 0; i < num_options; i ++)
249 printf(" %s=%s", options[i].name, options[i].value);
250 puts(")");
251 status ++;
252 }
253 else
254 {
255 puts("FAIL (Unable to resolve)");
256 status ++;
257 }
258 cupsFreeOptions(num_options, options);
259
260 fputs("ppdInstallableConflict(): ", stdout);
261 if (ppdInstallableConflict(ppd, "Duplex", "DuplexNoTumble") &&
262 !ppdInstallableConflict(ppd, "Duplex", "None"))
263 puts("PASS");
264 else if (!ppdInstallableConflict(ppd, "Duplex", "DuplexNoTumble"))
265 {
266 puts("FAIL (Duplex=DuplexNoTumble did not conflict)");
267 status ++;
268 }
269 else
270 {
271 puts("FAIL (Duplex=None conflicted)");
272 status ++;
273 }
274
275 /*
276 * ppdPageSizeLimits
277 */
278
279 fputs("ppdPageSizeLimits: ", stdout);
280 if (ppdPageSizeLimits(ppd, &minsize, &maxsize))
281 {
282 if (minsize.width != 36 || minsize.length != 36 ||
283 maxsize.width != 1080 || maxsize.length != 86400)
284 {
285 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
286 "expected min=36x36, max=1080x86400)\n", minsize.width,
287 minsize.length, maxsize.width, maxsize.length);
288 status ++;
289 }
290 else
291 puts("PASS");
292 }
293 else
294 {
295 puts("FAIL (returned 0)");
296 status ++;
297 }
298
299 /*
300 * Test localization...
301 */
302
303 fputs("ppdLocalizeIPPReason(text): ", stdout);
304 if (ppdLocalizeIPPReason(ppd, "foo", NULL, buffer, sizeof(buffer)) &&
305 !strcmp(buffer, "Foo Reason"))
306 puts("PASS");
307 else
308 {
309 status ++;
310 printf("FAIL (\"%s\" instead of \"Foo Reason\")\n", buffer);
311 }
312
313 fputs("ppdLocalizeIPPReason(http): ", stdout);
314 if (ppdLocalizeIPPReason(ppd, "foo", "http", buffer, sizeof(buffer)) &&
315 !strcmp(buffer, "http://foo/bar.html"))
316 puts("PASS");
317 else
318 {
319 status ++;
320 printf("FAIL (\"%s\" instead of \"http://foo/bar.html\")\n", buffer);
321 }
322
323 fputs("ppdLocalizeIPPReason(help): ", stdout);
324 if (ppdLocalizeIPPReason(ppd, "foo", "help", buffer, sizeof(buffer)) &&
325 !strcmp(buffer, "help:anchor='foo'%20bookID=Vendor%20Help"))
326 puts("PASS");
327 else
328 {
329 status ++;
330 printf("FAIL (\"%s\" instead of \"help:anchor='foo'%%20bookID=Vendor%%20Help\")\n", buffer);
331 }
332
333 fputs("ppdLocalizeIPPReason(file): ", stdout);
334 if (ppdLocalizeIPPReason(ppd, "foo", "file", buffer, sizeof(buffer)) &&
335 !strcmp(buffer, "/help/foo/bar.html"))
336 puts("PASS");
337 else
338 {
339 status ++;
340 printf("FAIL (\"%s\" instead of \"/help/foo/bar.html\")\n", buffer);
341 }
342
343 putenv("LANG=fr");
344
345 fputs("ppdLocalizeIPPReason(fr text): ", stdout);
346 if (ppdLocalizeIPPReason(ppd, "foo", NULL, buffer, sizeof(buffer)) &&
347 !strcmp(buffer, "La Long Foo Reason"))
348 puts("PASS");
349 else
350 {
351 status ++;
352 printf("FAIL (\"%s\" instead of \"La Long Foo Reason\")\n", buffer);
353 }
354
355 putenv("LANG=zh_TW");
356
357 fputs("ppdLocalizeIPPReason(zh_TW text): ", stdout);
358 if (ppdLocalizeIPPReason(ppd, "foo", NULL, buffer, sizeof(buffer)) &&
359 !strcmp(buffer, "Number 1 Foo Reason"))
360 puts("PASS");
361 else
362 {
363 status ++;
364 printf("FAIL (\"%s\" instead of \"Number 1 Foo Reason\")\n", buffer);
365 }
366
367 /*
368 * cupsMarkerName localization...
369 */
370
371 putenv("LANG=en");
372
373 fputs("ppdLocalizeMarkerName(bogus): ", stdout);
374
375 if ((text = ppdLocalizeMarkerName(ppd, "bogus")) != NULL)
376 {
377 status ++;
378 printf("FAIL (\"%s\" instead of NULL)\n", text);
379 }
380 else
381 puts("PASS");
382
383 fputs("ppdLocalizeMarkerName(cyan): ", stdout);
384
385 if ((text = ppdLocalizeMarkerName(ppd, "cyan")) != NULL &&
386 !strcmp(text, "Cyan Toner"))
387 puts("PASS");
388 else
389 {
390 status ++;
391 printf("FAIL (\"%s\" instead of \"Cyan Toner\")\n",
392 text ? text : "(null)");
393 }
394
395 putenv("LANG=fr");
396
397 fputs("ppdLocalizeMarkerName(fr cyan): ", stdout);
398 if ((text = ppdLocalizeMarkerName(ppd, "cyan")) != NULL &&
399 !strcmp(text, "La Toner Cyan"))
400 puts("PASS");
401 else
402 {
403 status ++;
404 printf("FAIL (\"%s\" instead of \"La Toner Cyan\")\n",
405 text ? text : "(null)");
406 }
407
408 putenv("LANG=zh_TW");
409
410 fputs("ppdLocalizeMarkerName(zh_TW cyan): ", stdout);
411 if ((text = ppdLocalizeMarkerName(ppd, "cyan")) != NULL &&
412 !strcmp(text, "Number 1 Cyan Toner"))
413 puts("PASS");
414 else
415 {
416 status ++;
417 printf("FAIL (\"%s\" instead of \"Number 1 Cyan Toner\")\n",
418 text ? text : "(null)");
419 }
420
421 ppdClose(ppd);
422
423 /*
424 * Test new constraints...
425 */
426
427 fputs("ppdOpenFile(test2.ppd): ", stdout);
428
429 if ((ppd = ppdOpenFile("test2.ppd")) != NULL)
430 puts("PASS");
431 else
432 {
433 ppd_status_t err; /* Last error in file */
434 int line; /* Line number in file */
435
436
437 status ++;
438 err = ppdLastError(&line);
439
440 printf("FAIL (%s on line %d)\n", ppdErrorString(err), line);
441 }
442
443 fputs("ppdMarkDefaults: ", stdout);
444 ppdMarkDefaults(ppd);
445
446 if ((conflicts = ppdConflicts(ppd)) == 0)
447 puts("PASS");
448 else
449 {
450 status ++;
451 printf("FAIL (%d conflicts)\n", conflicts);
452 }
453
454 fputs("ppdConflicts(): ", stdout);
455 ppdMarkOption(ppd, "PageSize", "Env10");
456 ppdMarkOption(ppd, "InputSlot", "Envelope");
457 ppdMarkOption(ppd, "Quality", "Photo");
458
459 if ((conflicts = ppdConflicts(ppd)) == 2)
460 puts("PASS (2)");
461 else
462 {
463 printf("FAIL (%d)\n", conflicts);
464 status ++;
465 }
466
467 fputs("cupsResolveConflicts(Quality=Photo): ", stdout);
468 num_options = 0;
469 options = NULL;
470 if (cupsResolveConflicts(ppd, "Quality", "Photo", &num_options,
471 &options))
472 {
473 printf("FAIL (%d options:", num_options);
474 for (i = 0; i < num_options; i ++)
475 printf(" %s=%s", options[i].name, options[i].value);
476 puts(")");
477 status ++;
478 }
479 else
480 puts("PASS (Unable to resolve)");
481 cupsFreeOptions(num_options, options);
482
483 fputs("cupsResolveConflicts(No option/choice): ", stdout);
484 num_options = 0;
485 options = NULL;
486 if (cupsResolveConflicts(ppd, NULL, NULL, &num_options, &options) &&
487 num_options == 1 && !strcasecmp(options->name, "Quality") &&
488 !strcasecmp(options->value, "Normal"))
489 puts("PASS");
490 else if (num_options > 0)
491 {
492 printf("FAIL (%d options:", num_options);
493 for (i = 0; i < num_options; i ++)
494 printf(" %s=%s", options[i].name, options[i].value);
495 puts(")");
496 status ++;
497 }
498 else
499 {
500 puts("FAIL (Unable to resolve!)");
501 status ++;
502 }
503 cupsFreeOptions(num_options, options);
504
505 fputs("cupsResolveConflicts(loop test): ", stdout);
506 ppdMarkOption(ppd, "PageSize", "A4");
507 ppdMarkOption(ppd, "Quality", "Photo");
508 num_options = 0;
509 options = NULL;
510 if (!cupsResolveConflicts(ppd, NULL, NULL, &num_options, &options))
511 puts("PASS");
512 else if (num_options > 0)
513 {
514 printf("FAIL (%d options:", num_options);
515 for (i = 0; i < num_options; i ++)
516 printf(" %s=%s", options[i].name, options[i].value);
517 puts(")");
518 }
519 else
520 puts("FAIL (No conflicts!)");
521
522 fputs("ppdInstallableConflict(): ", stdout);
523 if (ppdInstallableConflict(ppd, "Duplex", "DuplexNoTumble") &&
524 !ppdInstallableConflict(ppd, "Duplex", "None"))
525 puts("PASS");
526 else if (!ppdInstallableConflict(ppd, "Duplex", "DuplexNoTumble"))
527 {
528 puts("FAIL (Duplex=DuplexNoTumble did not conflict)");
529 status ++;
530 }
531 else
532 {
533 puts("FAIL (Duplex=None conflicted)");
534 status ++;
535 }
536
537 /*
538 * ppdPageSizeLimits
539 */
540
541 ppdMarkDefaults(ppd);
542
543 fputs("ppdPageSizeLimits(default): ", stdout);
544 if (ppdPageSizeLimits(ppd, &minsize, &maxsize))
545 {
546 if (minsize.width != 36 || minsize.length != 36 ||
547 maxsize.width != 1080 || maxsize.length != 86400)
548 {
549 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
550 "expected min=36x36, max=1080x86400)\n", minsize.width,
551 minsize.length, maxsize.width, maxsize.length);
552 status ++;
553 }
554 else
555 puts("PASS");
556 }
557 else
558 {
559 puts("FAIL (returned 0)");
560 status ++;
561 }
562
563 ppdMarkOption(ppd, "InputSlot", "Manual");
564
565 fputs("ppdPageSizeLimits(InputSlot=Manual): ", stdout);
566 if (ppdPageSizeLimits(ppd, &minsize, &maxsize))
567 {
568 if (minsize.width != 100 || minsize.length != 100 ||
569 maxsize.width != 1000 || maxsize.length != 1000)
570 {
571 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
572 "expected min=100x100, max=1000x1000)\n", minsize.width,
573 minsize.length, maxsize.width, maxsize.length);
574 status ++;
575 }
576 else
577 puts("PASS");
578 }
579 else
580 {
581 puts("FAIL (returned 0)");
582 status ++;
583 }
584
585 ppdMarkOption(ppd, "Quality", "Photo");
586
587 fputs("ppdPageSizeLimits(Quality=Photo): ", stdout);
588 if (ppdPageSizeLimits(ppd, &minsize, &maxsize))
589 {
590 if (minsize.width != 200 || minsize.length != 200 ||
591 maxsize.width != 1000 || maxsize.length != 1000)
592 {
593 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
594 "expected min=200x200, max=1000x1000)\n", minsize.width,
595 minsize.length, maxsize.width, maxsize.length);
596 status ++;
597 }
598 else
599 puts("PASS");
600 }
601 else
602 {
603 puts("FAIL (returned 0)");
604 status ++;
605 }
606
607 ppdMarkOption(ppd, "InputSlot", "Tray");
608
609 fputs("ppdPageSizeLimits(Quality=Photo): ", stdout);
610 if (ppdPageSizeLimits(ppd, &minsize, &maxsize))
611 {
612 if (minsize.width != 300 || minsize.length != 300 ||
613 maxsize.width != 1080 || maxsize.length != 86400)
614 {
615 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
616 "expected min=300x300, max=1080x86400)\n", minsize.width,
617 minsize.length, maxsize.width, maxsize.length);
618 status ++;
619 }
620 else
621 puts("PASS");
622 }
623 else
624 {
625 puts("FAIL (returned 0)");
626 status ++;
627 }
628 }
629 else
630 {
631 const char *filename; /* PPD filename */
632
633
634 if (!strncmp(argv[1], "-d", 2))
635 {
636 filename = cupsGetPPD(argv[1] + 2);
637 if (!filename)
638 {
639 printf("%s: %s\n", argv[1], cupsLastErrorString());
640 return (1);
641 }
642 }
643 else
644 filename = argv[1];
645
646 if ((ppd = ppdOpenFile(filename)) == NULL)
647 {
648 ppd_status_t err; /* Last error in file */
649 int line; /* Line number in file */
650
651
652 status ++;
653 err = ppdLastError(&line);
654
655 printf("%s: %s on line %d\n", argv[1], ppdErrorString(err), line);
656 }
657 else
658 {
659 int j, k; /* Looping vars */
660 ppd_attr_t *attr; /* Current attribute */
661 ppd_group_t *group; /* Option group */
662 ppd_option_t *option; /* Option */
663 ppd_coption_t *coption; /* Custom option */
664 ppd_cparam_t *cparam; /* Custom parameter */
665 ppd_const_t *c; /* UIConstraints */
666 char lang[255]; /* LANG environment variable */
667
668
669 if (argc > 2)
670 {
671 snprintf(lang, sizeof(lang), "LANG=%s", argv[2]);
672 putenv(lang);
673 }
674
675 ppdLocalize(ppd);
676
677 for (i = ppd->num_groups, group = ppd->groups;
678 i > 0;
679 i --, group ++)
680 {
681 printf("%s (%s):\n", group->name, group->text);
682
683 for (j = group->num_options, option = group->options;
684 j > 0;
685 j --, option ++)
686 {
687 printf(" %s (%s):\n", option->keyword, option->text);
688
689 for (k = 0; k < option->num_choices; k ++)
690 printf(" - %s (%s)\n", option->choices[k].choice,
691 option->choices[k].text);
692
693 if ((coption = ppdFindCustomOption(ppd, option->keyword)) != NULL)
694 {
695 for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
696 cparam;
697 cparam = (ppd_cparam_t *)cupsArrayNext(coption->params))
698 {
699 switch (cparam->type)
700 {
701 case PPD_CUSTOM_CURVE :
702 printf(" %s(%s): PPD_CUSTOM_CURVE (%g to %g)\n",
703 cparam->name, cparam->text,
704 cparam->minimum.custom_curve,
705 cparam->maximum.custom_curve);
706 break;
707
708 case PPD_CUSTOM_INT :
709 printf(" %s(%s): PPD_CUSTOM_INT (%d to %d)\n",
710 cparam->name, cparam->text,
711 cparam->minimum.custom_int,
712 cparam->maximum.custom_int);
713 break;
714
715 case PPD_CUSTOM_INVCURVE :
716 printf(" %s(%s): PPD_CUSTOM_INVCURVE (%g to %g)\n",
717 cparam->name, cparam->text,
718 cparam->minimum.custom_invcurve,
719 cparam->maximum.custom_invcurve);
720 break;
721
722 case PPD_CUSTOM_PASSCODE :
723 printf(" %s(%s): PPD_CUSTOM_PASSCODE (%d to %d)\n",
724 cparam->name, cparam->text,
725 cparam->minimum.custom_passcode,
726 cparam->maximum.custom_passcode);
727 break;
728
729 case PPD_CUSTOM_PASSWORD :
730 printf(" %s(%s): PPD_CUSTOM_PASSWORD (%d to %d)\n",
731 cparam->name, cparam->text,
732 cparam->minimum.custom_password,
733 cparam->maximum.custom_password);
734 break;
735
736 case PPD_CUSTOM_POINTS :
737 printf(" %s(%s): PPD_CUSTOM_POINTS (%g to %g)\n",
738 cparam->name, cparam->text,
739 cparam->minimum.custom_points,
740 cparam->maximum.custom_points);
741 break;
742
743 case PPD_CUSTOM_REAL :
744 printf(" %s(%s): PPD_CUSTOM_REAL (%g to %g)\n",
745 cparam->name, cparam->text,
746 cparam->minimum.custom_real,
747 cparam->maximum.custom_real);
748 break;
749
750 case PPD_CUSTOM_STRING :
751 printf(" %s(%s): PPD_CUSTOM_STRING (%d to %d)\n",
752 cparam->name, cparam->text,
753 cparam->minimum.custom_string,
754 cparam->maximum.custom_string);
755 break;
756 }
757 }
758 }
759 }
760 }
761
762 puts("Constraints:");
763
764 for (i = ppd->num_consts, c = ppd->consts; i > 0; i --, c ++)
765 printf(" *UIConstraints: *%s %s *%s %s\n", c->option1, c->choice1,
766 c->option2, c->choice2);
767
768 puts("Attributes:");
769
770 for (attr = (ppd_attr_t *)cupsArrayFirst(ppd->sorted_attrs);
771 attr;
772 attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs))
773 printf(" *%s %s/%s: \"%s\"\n", attr->name, attr->spec,
774 attr->text, attr->value ? attr->value : "");
775 }
776
777 if (!strncmp(argv[1], "-d", 2))
778 unlink(filename);
779 }
780
781 #ifdef __APPLE__
782 if (getenv("MallocStackLogging") && getenv("MallocStackLoggingNoCompact"))
783 {
784 char command[1024]; /* malloc_history command */
785
786 snprintf(command, sizeof(command), "malloc_history %d -all_by_size",
787 getpid());
788 fflush(stdout);
789 system(command);
790 }
791 #endif /* __APPLE__ */
792
793 ppdClose(ppd);
794
795 return (status);
796 }
797
798
799 /*
800 * End of "$Id: testppd.c 7633 2008-06-10 23:07:29Z mike $".
801 */