]>
git.ipfire.org Git - thirdparty/cups.git/blob - cups/testppd.c
2 * "$Id: testppd.c 7897 2008-09-02 19:33:19Z mike $"
4 * PPD test program for the Common UNIX Printing System (CUPS).
6 * Copyright 2007-2010 by Apple Inc.
7 * Copyright 1997-2006 by Easy Software Products.
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/".
15 * This file is subject to the Apple OS-Developed Software exception.
19 * main() - Main entry.
23 * Include necessary headers...
26 #include <cups/cups.h>
27 #include <cups/string.h>
44 static const char *default_code
=
46 "%%BeginFeature: *InstalledDuplexer False\n"
48 "} stopped cleartomark\n"
50 "%%BeginFeature: *PageRegion Letter\n"
53 "} stopped cleartomark\n"
55 "%%BeginFeature: *InputSlot Tray\n"
58 "} stopped cleartomark\n"
60 "%%BeginFeature: *MediaType Plain\n"
63 "} stopped cleartomark\n"
65 "%%BeginFeature: *IntOption None\n"
67 "} stopped cleartomark\n"
69 "%%BeginFeature: *StringOption None\n"
71 "} stopped cleartomark\n";
73 static const char *custom_code
=
75 "%%BeginFeature: *InstalledDuplexer False\n"
77 "} stopped cleartomark\n"
79 "%%BeginFeature: *InputSlot Tray\n"
82 "} stopped cleartomark\n"
84 "%%BeginFeature: *MediaType Plain\n"
87 "} stopped cleartomark\n"
89 "%%BeginFeature: *IntOption None\n"
91 "} stopped cleartomark\n"
93 "%%BeginFeature: *CustomStringOption True\n"
94 "(value\\0502\\051)\n"
96 "StringOption=Custom\n"
98 "} stopped cleartomark\n"
100 "%%BeginFeature: *CustomPageSize True\n"
108 "} stopped cleartomark\n";
110 static const char *default2_code
=
112 "%%BeginFeature: *InstalledDuplexer False\n"
114 "} stopped cleartomark\n"
116 "%%BeginFeature: *InputSlot Tray\n"
119 "} stopped cleartomark\n"
121 "%%BeginFeature: *Quality Normal\n"
124 "} stopped cleartomark\n"
126 "%%BeginFeature: *IntOption None\n"
128 "} stopped cleartomark\n"
130 "%%BeginFeature: *StringOption None\n"
132 "} stopped cleartomark\n";
136 * 'main()' - Main entry.
139 int /* O - Exit status */
140 main(int argc
, /* I - Number of command-line arguments */
141 char *argv
[]) /* I - Command-line arguments */
143 int i
; /* Looping var */
144 ppd_file_t
*ppd
; /* PPD file loaded from disk */
145 int status
; /* Status of tests (0 = success, 1 = fail) */
146 int conflicts
; /* Number of conflicts */
147 char *s
; /* String */
148 char buffer
[8192]; /* String buffer */
149 const char *text
, /* Localized text */
150 *val
; /* Option value */
151 int num_options
; /* Number of options */
152 cups_option_t
*options
; /* Options */
153 ppd_size_t minsize
, /* Minimum size */
154 maxsize
, /* Maximum size */
155 *size
; /* Current size */
156 ppd_attr_t
*attr
; /* Current attribute */
164 * Setup directories for locale stuff...
167 if (access("locale", 0))
169 mkdir("locale", 0777);
170 mkdir("locale/fr", 0777);
171 symlink("../../../locale/cups_fr.po", "locale/fr/cups_fr.po");
172 mkdir("locale/zh_TW", 0777);
173 symlink("../../../locale/cups_zh_TW.po", "locale/zh_TW/cups_zh_TW.po");
176 putenv("LOCALEDIR=locale");
177 putenv("SOFTWARE=CUPS");
180 * Do tests with test.ppd...
183 fputs("ppdOpenFile(test.ppd): ", stdout
);
185 if ((ppd
= ppdOpenFile("test.ppd")) != NULL
)
189 ppd_status_t err
; /* Last error in file */
190 int line
; /* Line number in file */
194 err
= ppdLastError(&line
);
196 printf("FAIL (%s on line %d)\n", ppdErrorString(err
), line
);
199 fputs("ppdFindAttr(wildcard): ", stdout
);
200 if ((attr
= ppdFindAttr(ppd
, "cupsTest", NULL
)) == NULL
)
203 puts("FAIL (not found)");
205 else if (strcmp(attr
->name
, "cupsTest") || strcmp(attr
->spec
, "Foo"))
208 printf("FAIL (got \"%s %s\")\n", attr
->name
, attr
->spec
);
213 fputs("ppdFindNextAttr(wildcard): ", stdout
);
214 if ((attr
= ppdFindNextAttr(ppd
, "cupsTest", NULL
)) == NULL
)
217 puts("FAIL (not found)");
219 else if (strcmp(attr
->name
, "cupsTest") || strcmp(attr
->spec
, "Bar"))
222 printf("FAIL (got \"%s %s\")\n", attr
->name
, attr
->spec
);
227 fputs("ppdFindAttr(Foo): ", stdout
);
228 if ((attr
= ppdFindAttr(ppd
, "cupsTest", "Foo")) == NULL
)
231 puts("FAIL (not found)");
233 else if (strcmp(attr
->name
, "cupsTest") || strcmp(attr
->spec
, "Foo"))
236 printf("FAIL (got \"%s %s\")\n", attr
->name
, attr
->spec
);
241 fputs("ppdFindNextAttr(Foo): ", stdout
);
242 if ((attr
= ppdFindNextAttr(ppd
, "cupsTest", "Foo")) != NULL
)
245 printf("FAIL (got \"%s %s\")\n", attr
->name
, attr
->spec
);
250 fputs("ppdMarkDefaults: ", stdout
);
251 ppdMarkDefaults(ppd
);
253 if ((conflicts
= ppdConflicts(ppd
)) == 0)
258 printf("FAIL (%d conflicts)\n", conflicts
);
261 fputs("ppdEmitString (defaults): ", stdout
);
262 if ((s
= ppdEmitString(ppd
, PPD_ORDER_ANY
, 0.0)) != NULL
&&
263 !strcmp(s
, default_code
))
268 printf("FAIL (%d bytes instead of %d)\n", s
? (int)strlen(s
) : 0,
269 (int)strlen(default_code
));
278 fputs("ppdEmitString (custom size and string): ", stdout
);
279 ppdMarkOption(ppd
, "PageSize", "Custom.400x500");
280 ppdMarkOption(ppd
, "StringOption", "{String1=\"value 1\" String2=value(2)}");
282 if ((s
= ppdEmitString(ppd
, PPD_ORDER_ANY
, 0.0)) != NULL
&&
283 !strcmp(s
, custom_code
))
288 printf("FAIL (%d bytes instead of %d)\n", s
? (int)strlen(s
) : 0,
289 (int)strlen(custom_code
));
299 * Test constraints...
302 fputs("cupsGetConflicts(InputSlot=Envelope): ", stdout
);
303 ppdMarkOption(ppd
, "PageSize", "Letter");
305 num_options
= cupsGetConflicts(ppd
, "InputSlot", "Envelope", &options
);
306 if (num_options
!= 2 ||
307 (val
= cupsGetOption("PageRegion", num_options
, options
)) == NULL
||
308 strcasecmp(val
, "Letter") ||
309 (val
= cupsGetOption("PageSize", num_options
, options
)) == NULL
||
310 strcasecmp(val
, "Letter"))
312 printf("FAIL (%d options:", num_options
);
313 for (i
= 0; i
< num_options
; i
++)
314 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
321 fputs("ppdConflicts(): ", stdout
);
322 ppdMarkOption(ppd
, "InputSlot", "Envelope");
324 if ((conflicts
= ppdConflicts(ppd
)) == 2)
328 printf("FAIL (%d)\n", conflicts
);
332 fputs("cupsResolveConflicts(InputSlot=Envelope): ", stdout
);
335 if (!cupsResolveConflicts(ppd
, "InputSlot", "Envelope", &num_options
,
338 puts("FAIL (Unable to resolve)");
341 else if (num_options
!= 2 ||
342 !cupsGetOption("PageSize", num_options
, options
))
344 printf("FAIL (%d options:", num_options
);
345 for (i
= 0; i
< num_options
; i
++)
346 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
351 puts("PASS (Resolved by changing PageSize)");
353 cupsFreeOptions(num_options
, options
);
355 fputs("cupsResolveConflicts(No option/choice): ", stdout
);
358 if (cupsResolveConflicts(ppd
, NULL
, NULL
, &num_options
, &options
) &&
359 num_options
== 1 && !strcasecmp(options
[0].name
, "InputSlot") &&
360 !strcasecmp(options
[0].value
, "Tray"))
361 puts("PASS (Resolved by changing InputSlot)");
362 else if (num_options
> 0)
364 printf("FAIL (%d options:", num_options
);
365 for (i
= 0; i
< num_options
; i
++)
366 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
372 puts("FAIL (Unable to resolve)");
375 cupsFreeOptions(num_options
, options
);
377 fputs("ppdInstallableConflict(): ", stdout
);
378 if (ppdInstallableConflict(ppd
, "Duplex", "DuplexNoTumble") &&
379 !ppdInstallableConflict(ppd
, "Duplex", "None"))
381 else if (!ppdInstallableConflict(ppd
, "Duplex", "DuplexNoTumble"))
383 puts("FAIL (Duplex=DuplexNoTumble did not conflict)");
388 puts("FAIL (Duplex=None conflicted)");
396 fputs("ppdPageSizeLimits: ", stdout
);
397 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
399 if (minsize
.width
!= 36 || minsize
.length
!= 36 ||
400 maxsize
.width
!= 1080 || maxsize
.length
!= 86400)
402 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
403 "expected min=36x36, max=1080x86400)\n", minsize
.width
,
404 minsize
.length
, maxsize
.width
, maxsize
.length
);
412 puts("FAIL (returned 0)");
417 * cupsMarkOptions with PWG and IPP size names.
420 fputs("cupsMarkOptions(media=iso-a4): ", stdout
);
421 num_options
= cupsAddOption("media", "iso-a4", 0, &options
);
422 cupsMarkOptions(ppd
, num_options
, options
);
423 cupsFreeOptions(num_options
, options
);
425 size
= ppdPageSize(ppd
, NULL
);
426 if (!size
|| strcmp(size
->name
, "A4"))
428 printf("FAIL (%s)\n", size
? size
->name
: "unknown");
434 fputs("cupsMarkOptions(media=na_letter_8.5x11in): ", stdout
);
435 num_options
= cupsAddOption("media", "na_letter_8.5x11in", 0, &options
);
436 cupsMarkOptions(ppd
, num_options
, options
);
437 cupsFreeOptions(num_options
, options
);
439 size
= ppdPageSize(ppd
, NULL
);
440 if (!size
|| strcmp(size
->name
, "Letter"))
442 printf("FAIL (%s)\n", size
? size
->name
: "unknown");
449 * Test localization...
452 fputs("ppdLocalizeIPPReason(text): ", stdout
);
453 if (ppdLocalizeIPPReason(ppd
, "foo", NULL
, buffer
, sizeof(buffer
)) &&
454 !strcmp(buffer
, "Foo Reason"))
459 printf("FAIL (\"%s\" instead of \"Foo Reason\")\n", buffer
);
462 fputs("ppdLocalizeIPPReason(http): ", stdout
);
463 if (ppdLocalizeIPPReason(ppd
, "foo", "http", buffer
, sizeof(buffer
)) &&
464 !strcmp(buffer
, "http://foo/bar.html"))
469 printf("FAIL (\"%s\" instead of \"http://foo/bar.html\")\n", buffer
);
472 fputs("ppdLocalizeIPPReason(help): ", stdout
);
473 if (ppdLocalizeIPPReason(ppd
, "foo", "help", buffer
, sizeof(buffer
)) &&
474 !strcmp(buffer
, "help:anchor='foo'%20bookID=Vendor%20Help"))
479 printf("FAIL (\"%s\" instead of \"help:anchor='foo'%%20bookID=Vendor%%20Help\")\n", buffer
);
482 fputs("ppdLocalizeIPPReason(file): ", stdout
);
483 if (ppdLocalizeIPPReason(ppd
, "foo", "file", buffer
, sizeof(buffer
)) &&
484 !strcmp(buffer
, "/help/foo/bar.html"))
489 printf("FAIL (\"%s\" instead of \"/help/foo/bar.html\")\n", buffer
);
494 putenv("LC_CTYPE=fr");
495 putenv("LC_MESSAGES=fr");
497 fputs("ppdLocalizeIPPReason(fr text): ", stdout
);
498 if (ppdLocalizeIPPReason(ppd
, "foo", NULL
, buffer
, sizeof(buffer
)) &&
499 !strcmp(buffer
, "La Long Foo Reason"))
504 printf("FAIL (\"%s\" instead of \"La Long Foo Reason\")\n", buffer
);
507 putenv("LANG=zh_TW");
508 putenv("LC_ALL=zh_TW");
509 putenv("LC_CTYPE=zh_TW");
510 putenv("LC_MESSAGES=zh_TW");
512 fputs("ppdLocalizeIPPReason(zh_TW text): ", stdout
);
513 if (ppdLocalizeIPPReason(ppd
, "foo", NULL
, buffer
, sizeof(buffer
)) &&
514 !strcmp(buffer
, "Number 1 Foo Reason"))
519 printf("FAIL (\"%s\" instead of \"Number 1 Foo Reason\")\n", buffer
);
523 * cupsMarkerName localization...
528 putenv("LC_CTYPE=en");
529 putenv("LC_MESSAGES=en");
531 fputs("ppdLocalizeMarkerName(bogus): ", stdout
);
533 if ((text
= ppdLocalizeMarkerName(ppd
, "bogus")) != NULL
)
536 printf("FAIL (\"%s\" instead of NULL)\n", text
);
541 fputs("ppdLocalizeMarkerName(cyan): ", stdout
);
543 if ((text
= ppdLocalizeMarkerName(ppd
, "cyan")) != NULL
&&
544 !strcmp(text
, "Cyan Toner"))
549 printf("FAIL (\"%s\" instead of \"Cyan Toner\")\n",
550 text
? text
: "(null)");
555 putenv("LC_CTYPE=fr");
556 putenv("LC_MESSAGES=fr");
558 fputs("ppdLocalizeMarkerName(fr cyan): ", stdout
);
559 if ((text
= ppdLocalizeMarkerName(ppd
, "cyan")) != NULL
&&
560 !strcmp(text
, "La Toner Cyan"))
565 printf("FAIL (\"%s\" instead of \"La Toner Cyan\")\n",
566 text
? text
: "(null)");
569 putenv("LANG=zh_TW");
570 putenv("LC_ALL=zh_TW");
571 putenv("LC_CTYPE=zh_TW");
572 putenv("LC_MESSAGES=zh_TW");
574 fputs("ppdLocalizeMarkerName(zh_TW cyan): ", stdout
);
575 if ((text
= ppdLocalizeMarkerName(ppd
, "cyan")) != NULL
&&
576 !strcmp(text
, "Number 1 Cyan Toner"))
581 printf("FAIL (\"%s\" instead of \"Number 1 Cyan Toner\")\n",
582 text
? text
: "(null)");
588 * Test new constraints...
591 fputs("ppdOpenFile(test2.ppd): ", stdout
);
593 if ((ppd
= ppdOpenFile("test2.ppd")) != NULL
)
597 ppd_status_t err
; /* Last error in file */
598 int line
; /* Line number in file */
602 err
= ppdLastError(&line
);
604 printf("FAIL (%s on line %d)\n", ppdErrorString(err
), line
);
607 fputs("ppdMarkDefaults: ", stdout
);
608 ppdMarkDefaults(ppd
);
610 if ((conflicts
= ppdConflicts(ppd
)) == 0)
615 printf("FAIL (%d conflicts)\n", conflicts
);
618 fputs("ppdEmitString (defaults): ", stdout
);
619 if ((s
= ppdEmitString(ppd
, PPD_ORDER_ANY
, 0.0)) != NULL
&&
620 !strcmp(s
, default2_code
))
625 printf("FAIL (%d bytes instead of %d)\n", s
? (int)strlen(s
) : 0,
626 (int)strlen(default2_code
));
635 fputs("ppdConflicts(): ", stdout
);
636 ppdMarkOption(ppd
, "PageSize", "Env10");
637 ppdMarkOption(ppd
, "InputSlot", "Envelope");
638 ppdMarkOption(ppd
, "Quality", "Photo");
640 if ((conflicts
= ppdConflicts(ppd
)) == 1)
644 printf("FAIL (%d)\n", conflicts
);
648 fputs("cupsResolveConflicts(Quality=Photo): ", stdout
);
651 if (cupsResolveConflicts(ppd
, "Quality", "Photo", &num_options
,
654 printf("FAIL (%d options:", num_options
);
655 for (i
= 0; i
< num_options
; i
++)
656 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
661 puts("PASS (Unable to resolve)");
662 cupsFreeOptions(num_options
, options
);
664 fputs("cupsResolveConflicts(No option/choice): ", stdout
);
667 if (cupsResolveConflicts(ppd
, NULL
, NULL
, &num_options
, &options
) &&
668 num_options
== 1 && !strcasecmp(options
->name
, "Quality") &&
669 !strcasecmp(options
->value
, "Normal"))
671 else if (num_options
> 0)
673 printf("FAIL (%d options:", num_options
);
674 for (i
= 0; i
< num_options
; i
++)
675 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
681 puts("FAIL (Unable to resolve!)");
684 cupsFreeOptions(num_options
, options
);
686 fputs("cupsResolveConflicts(loop test): ", stdout
);
687 ppdMarkOption(ppd
, "PageSize", "A4");
688 ppdMarkOption(ppd
, "InputSlot", "Tray");
689 ppdMarkOption(ppd
, "Quality", "Photo");
692 if (!cupsResolveConflicts(ppd
, NULL
, NULL
, &num_options
, &options
))
694 else if (num_options
> 0)
696 printf("FAIL (%d options:", num_options
);
697 for (i
= 0; i
< num_options
; i
++)
698 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
702 puts("FAIL (No conflicts!)");
704 fputs("ppdInstallableConflict(): ", stdout
);
705 if (ppdInstallableConflict(ppd
, "Duplex", "DuplexNoTumble") &&
706 !ppdInstallableConflict(ppd
, "Duplex", "None"))
708 else if (!ppdInstallableConflict(ppd
, "Duplex", "DuplexNoTumble"))
710 puts("FAIL (Duplex=DuplexNoTumble did not conflict)");
715 puts("FAIL (Duplex=None conflicted)");
723 ppdMarkDefaults(ppd
);
725 fputs("ppdPageSizeLimits(default): ", stdout
);
726 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
728 if (minsize
.width
!= 36 || minsize
.length
!= 36 ||
729 maxsize
.width
!= 1080 || maxsize
.length
!= 86400)
731 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
732 "expected min=36x36, max=1080x86400)\n", minsize
.width
,
733 minsize
.length
, maxsize
.width
, maxsize
.length
);
741 puts("FAIL (returned 0)");
745 ppdMarkOption(ppd
, "InputSlot", "Manual");
747 fputs("ppdPageSizeLimits(InputSlot=Manual): ", stdout
);
748 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
750 if (minsize
.width
!= 100 || minsize
.length
!= 100 ||
751 maxsize
.width
!= 1000 || maxsize
.length
!= 1000)
753 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
754 "expected min=100x100, max=1000x1000)\n", minsize
.width
,
755 minsize
.length
, maxsize
.width
, maxsize
.length
);
763 puts("FAIL (returned 0)");
767 ppdMarkOption(ppd
, "Quality", "Photo");
769 fputs("ppdPageSizeLimits(Quality=Photo): ", stdout
);
770 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
772 if (minsize
.width
!= 200 || minsize
.length
!= 200 ||
773 maxsize
.width
!= 1000 || maxsize
.length
!= 1000)
775 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
776 "expected min=200x200, max=1000x1000)\n", minsize
.width
,
777 minsize
.length
, maxsize
.width
, maxsize
.length
);
785 puts("FAIL (returned 0)");
789 ppdMarkOption(ppd
, "InputSlot", "Tray");
791 fputs("ppdPageSizeLimits(Quality=Photo): ", stdout
);
792 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
794 if (minsize
.width
!= 300 || minsize
.length
!= 300 ||
795 maxsize
.width
!= 1080 || maxsize
.length
!= 86400)
797 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
798 "expected min=300x300, max=1080x86400)\n", minsize
.width
,
799 minsize
.length
, maxsize
.width
, maxsize
.length
);
807 puts("FAIL (returned 0)");
813 const char *filename
; /* PPD filename */
814 struct stat fileinfo
; /* File information */
817 if (!strncmp(argv
[1], "-d", 2))
819 filename
= cupsGetPPD(argv
[1] + 2);
822 printf("%s: %s\n", argv
[1], cupsLastErrorString());
829 if (lstat(filename
, &fileinfo
))
831 printf("%s: %s\n", filename
, strerror(errno
));
835 if (S_ISLNK(fileinfo
.st_mode
))
837 char realfile
[1024]; /* Real file path */
838 ssize_t realsize
; /* Size of real file path */
841 if ((realsize
= readlink(filename
, realfile
, sizeof(realfile
) - 1)) < 0)
842 strcpy(realfile
, "Unknown");
844 realfile
[realsize
] = '\0';
846 if (stat(realfile
, &fileinfo
))
847 printf("%s: symlink to \"%s\", %s\n", filename
, realfile
,
850 printf("%s: symlink to \"%s\", %ld bytes\n", filename
, realfile
,
851 (long)fileinfo
.st_size
);
854 printf("%s: regular file, %ld bytes\n", filename
, (long)fileinfo
.st_size
);
856 if ((ppd
= ppdOpenFile(filename
)) == NULL
)
858 ppd_status_t err
; /* Last error in file */
859 int line
; /* Line number in file */
863 err
= ppdLastError(&line
);
865 printf("%s: %s on line %d\n", argv
[1], ppdErrorString(err
), line
);
869 int j
, k
; /* Looping vars */
870 ppd_group_t
*group
; /* Option group */
871 ppd_option_t
*option
; /* Option */
872 ppd_coption_t
*coption
; /* Custom option */
873 ppd_cparam_t
*cparam
; /* Custom parameter */
874 ppd_const_t
*c
; /* UIConstraints */
875 char lang
[255], /* LANG environment variable */
876 lc_all
[255], /* LC_ALL environment variable */
877 lc_ctype
[255], /* LC_CTYPE environment variable */
878 lc_messages
[255];/* LC_MESSAGES environment variable */
883 snprintf(lang
, sizeof(lang
), "LANG=%s", argv
[2]);
885 snprintf(lc_all
, sizeof(lc_all
), "LC_ALL=%s", argv
[2]);
887 snprintf(lc_ctype
, sizeof(lc_ctype
), "LC_CTYPE=%s", argv
[2]);
889 snprintf(lc_messages
, sizeof(lc_messages
), "LC_MESSAGES=%s", argv
[2]);
894 ppdMarkDefaults(ppd
);
898 text
= ppdLocalizeIPPReason(ppd
, argv
[3], NULL
, buffer
, sizeof(buffer
));
899 printf("ppdLocalizeIPPReason(%s)=%s\n", argv
[3],
900 text
? text
: "(null)");
901 return (text
== NULL
);
904 for (i
= ppd
->num_groups
, group
= ppd
->groups
;
908 printf("%s (%s):\n", group
->name
, group
->text
);
910 for (j
= group
->num_options
, option
= group
->options
;
914 printf(" %s (%s):\n", option
->keyword
, option
->text
);
916 for (k
= 0; k
< option
->num_choices
; k
++)
917 printf(" - %s%s (%s)\n",
918 option
->choices
[k
].marked
? "*" : "",
919 option
->choices
[k
].choice
, option
->choices
[k
].text
);
921 if ((coption
= ppdFindCustomOption(ppd
, option
->keyword
)) != NULL
)
923 for (cparam
= (ppd_cparam_t
*)cupsArrayFirst(coption
->params
);
925 cparam
= (ppd_cparam_t
*)cupsArrayNext(coption
->params
))
927 switch (cparam
->type
)
929 case PPD_CUSTOM_CURVE
:
930 printf(" %s(%s): PPD_CUSTOM_CURVE (%g to %g)\n",
931 cparam
->name
, cparam
->text
,
932 cparam
->minimum
.custom_curve
,
933 cparam
->maximum
.custom_curve
);
936 case PPD_CUSTOM_INT
:
937 printf(" %s(%s): PPD_CUSTOM_INT (%d to %d)\n",
938 cparam
->name
, cparam
->text
,
939 cparam
->minimum
.custom_int
,
940 cparam
->maximum
.custom_int
);
943 case PPD_CUSTOM_INVCURVE
:
944 printf(" %s(%s): PPD_CUSTOM_INVCURVE (%g to %g)\n",
945 cparam
->name
, cparam
->text
,
946 cparam
->minimum
.custom_invcurve
,
947 cparam
->maximum
.custom_invcurve
);
950 case PPD_CUSTOM_PASSCODE
:
951 printf(" %s(%s): PPD_CUSTOM_PASSCODE (%d to %d)\n",
952 cparam
->name
, cparam
->text
,
953 cparam
->minimum
.custom_passcode
,
954 cparam
->maximum
.custom_passcode
);
957 case PPD_CUSTOM_PASSWORD
:
958 printf(" %s(%s): PPD_CUSTOM_PASSWORD (%d to %d)\n",
959 cparam
->name
, cparam
->text
,
960 cparam
->minimum
.custom_password
,
961 cparam
->maximum
.custom_password
);
964 case PPD_CUSTOM_POINTS
:
965 printf(" %s(%s): PPD_CUSTOM_POINTS (%g to %g)\n",
966 cparam
->name
, cparam
->text
,
967 cparam
->minimum
.custom_points
,
968 cparam
->maximum
.custom_points
);
971 case PPD_CUSTOM_REAL
:
972 printf(" %s(%s): PPD_CUSTOM_REAL (%g to %g)\n",
973 cparam
->name
, cparam
->text
,
974 cparam
->minimum
.custom_real
,
975 cparam
->maximum
.custom_real
);
978 case PPD_CUSTOM_STRING
:
979 printf(" %s(%s): PPD_CUSTOM_STRING (%d to %d)\n",
980 cparam
->name
, cparam
->text
,
981 cparam
->minimum
.custom_string
,
982 cparam
->maximum
.custom_string
);
990 puts("\nConstraints:");
992 for (i
= ppd
->num_consts
, c
= ppd
->consts
; i
> 0; i
--, c
++)
993 printf(" *UIConstraints: *%s %s *%s %s\n", c
->option1
, c
->choice1
,
994 c
->option2
, c
->choice2
);
995 if (ppd
->num_consts
== 0)
996 puts(" NO CONSTRAINTS");
1000 for (i
= 0; i
< ppd
->num_filters
; i
++)
1001 printf(" %s\n", ppd
->filters
[i
]);
1003 if (ppd
->num_filters
== 0)
1004 puts(" NO FILTERS");
1006 puts("\nAttributes:");
1008 for (attr
= (ppd_attr_t
*)cupsArrayFirst(ppd
->sorted_attrs
);
1010 attr
= (ppd_attr_t
*)cupsArrayNext(ppd
->sorted_attrs
))
1011 printf(" *%s %s/%s: \"%s\"\n", attr
->name
, attr
->spec
,
1012 attr
->text
, attr
->value
? attr
->value
: "");
1015 if (!strncmp(argv
[1], "-d", 2))
1020 if (getenv("MallocStackLogging") && getenv("MallocStackLoggingNoCompact"))
1022 char command
[1024]; /* malloc_history command */
1024 snprintf(command
, sizeof(command
), "malloc_history %d -all_by_size",
1029 #endif /* __APPLE__ */
1038 * End of "$Id: testppd.c 7897 2008-09-02 19:33:19Z mike $".