]>
git.ipfire.org Git - thirdparty/cups.git/blob - cups/testppd.c
a77490e4254f6c94038cfa6d07275896e7e4a31c
2 * "$Id: testppd.c 7897 2008-09-02 19:33:19Z mike $"
4 * PPD test program for 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-private.h"
41 static const char *default_code
=
43 "%%BeginFeature: *InstalledDuplexer False\n"
45 "} stopped cleartomark\n"
47 "%%BeginFeature: *PageRegion Letter\n"
50 "} stopped cleartomark\n"
52 "%%BeginFeature: *InputSlot Tray\n"
55 "} stopped cleartomark\n"
57 "%%BeginFeature: *MediaType Plain\n"
60 "} stopped cleartomark\n"
62 "%%BeginFeature: *IntOption None\n"
64 "} stopped cleartomark\n"
66 "%%BeginFeature: *StringOption None\n"
68 "} stopped cleartomark\n";
70 static const char *custom_code
=
72 "%%BeginFeature: *InstalledDuplexer False\n"
74 "} stopped cleartomark\n"
76 "%%BeginFeature: *InputSlot Tray\n"
79 "} stopped cleartomark\n"
81 "%%BeginFeature: *MediaType Plain\n"
84 "} stopped cleartomark\n"
86 "%%BeginFeature: *IntOption None\n"
88 "} stopped cleartomark\n"
90 "%%BeginFeature: *CustomStringOption True\n"
91 "(value\\0502\\051)\n"
93 "StringOption=Custom\n"
95 "} stopped cleartomark\n"
97 "%%BeginFeature: *CustomPageSize True\n"
105 "} stopped cleartomark\n";
107 static const char *default2_code
=
109 "%%BeginFeature: *InstalledDuplexer False\n"
111 "} stopped cleartomark\n"
113 "%%BeginFeature: *InputSlot Tray\n"
116 "} stopped cleartomark\n"
118 "%%BeginFeature: *Quality Normal\n"
121 "} stopped cleartomark\n"
123 "%%BeginFeature: *IntOption None\n"
125 "} stopped cleartomark\n"
127 "%%BeginFeature: *StringOption None\n"
129 "} stopped cleartomark\n";
133 * 'main()' - Main entry.
136 int /* O - Exit status */
137 main(int argc
, /* I - Number of command-line arguments */
138 char *argv
[]) /* I - Command-line arguments */
140 int i
; /* Looping var */
141 ppd_file_t
*ppd
; /* PPD file loaded from disk */
142 int status
; /* Status of tests (0 = success, 1 = fail) */
143 int conflicts
; /* Number of conflicts */
144 char *s
; /* String */
145 char buffer
[8192]; /* String buffer */
146 const char *text
, /* Localized text */
147 *val
; /* Option value */
148 int num_options
; /* Number of options */
149 cups_option_t
*options
; /* Options */
150 ppd_size_t minsize
, /* Minimum size */
151 maxsize
, /* Maximum size */
152 *size
; /* Current size */
153 ppd_attr_t
*attr
; /* Current attribute */
161 * Setup directories for locale stuff...
164 if (access("locale", 0))
166 mkdir("locale", 0777);
167 mkdir("locale/fr", 0777);
168 symlink("../../../locale/cups_fr.po", "locale/fr/cups_fr.po");
169 mkdir("locale/zh_TW", 0777);
170 symlink("../../../locale/cups_zh_TW.po", "locale/zh_TW/cups_zh_TW.po");
173 putenv("LOCALEDIR=locale");
174 putenv("SOFTWARE=CUPS");
177 * Do tests with test.ppd...
180 fputs("ppdOpenFile(test.ppd): ", stdout
);
182 if ((ppd
= ppdOpenFile("test.ppd")) != NULL
)
186 ppd_status_t err
; /* Last error in file */
187 int line
; /* Line number in file */
191 err
= ppdLastError(&line
);
193 printf("FAIL (%s on line %d)\n", ppdErrorString(err
), line
);
196 fputs("ppdFindAttr(wildcard): ", stdout
);
197 if ((attr
= ppdFindAttr(ppd
, "cupsTest", NULL
)) == NULL
)
200 puts("FAIL (not found)");
202 else if (strcmp(attr
->name
, "cupsTest") || strcmp(attr
->spec
, "Foo"))
205 printf("FAIL (got \"%s %s\")\n", attr
->name
, attr
->spec
);
210 fputs("ppdFindNextAttr(wildcard): ", stdout
);
211 if ((attr
= ppdFindNextAttr(ppd
, "cupsTest", NULL
)) == NULL
)
214 puts("FAIL (not found)");
216 else if (strcmp(attr
->name
, "cupsTest") || strcmp(attr
->spec
, "Bar"))
219 printf("FAIL (got \"%s %s\")\n", attr
->name
, attr
->spec
);
224 fputs("ppdFindAttr(Foo): ", stdout
);
225 if ((attr
= ppdFindAttr(ppd
, "cupsTest", "Foo")) == NULL
)
228 puts("FAIL (not found)");
230 else if (strcmp(attr
->name
, "cupsTest") || strcmp(attr
->spec
, "Foo"))
233 printf("FAIL (got \"%s %s\")\n", attr
->name
, attr
->spec
);
238 fputs("ppdFindNextAttr(Foo): ", stdout
);
239 if ((attr
= ppdFindNextAttr(ppd
, "cupsTest", "Foo")) != NULL
)
242 printf("FAIL (got \"%s %s\")\n", attr
->name
, attr
->spec
);
247 fputs("ppdMarkDefaults: ", stdout
);
248 ppdMarkDefaults(ppd
);
250 if ((conflicts
= ppdConflicts(ppd
)) == 0)
255 printf("FAIL (%d conflicts)\n", conflicts
);
258 fputs("ppdEmitString (defaults): ", stdout
);
259 if ((s
= ppdEmitString(ppd
, PPD_ORDER_ANY
, 0.0)) != NULL
&&
260 !strcmp(s
, default_code
))
265 printf("FAIL (%d bytes instead of %d)\n", s
? (int)strlen(s
) : 0,
266 (int)strlen(default_code
));
275 fputs("ppdEmitString (custom size and string): ", stdout
);
276 ppdMarkOption(ppd
, "PageSize", "Custom.400x500");
277 ppdMarkOption(ppd
, "StringOption", "{String1=\"value 1\" String2=value(2)}");
279 if ((s
= ppdEmitString(ppd
, PPD_ORDER_ANY
, 0.0)) != NULL
&&
280 !strcmp(s
, custom_code
))
285 printf("FAIL (%d bytes instead of %d)\n", s
? (int)strlen(s
) : 0,
286 (int)strlen(custom_code
));
296 * Test constraints...
299 fputs("cupsGetConflicts(InputSlot=Envelope): ", stdout
);
300 ppdMarkOption(ppd
, "PageSize", "Letter");
302 num_options
= cupsGetConflicts(ppd
, "InputSlot", "Envelope", &options
);
303 if (num_options
!= 2 ||
304 (val
= cupsGetOption("PageRegion", num_options
, options
)) == NULL
||
305 strcasecmp(val
, "Letter") ||
306 (val
= cupsGetOption("PageSize", num_options
, options
)) == NULL
||
307 strcasecmp(val
, "Letter"))
309 printf("FAIL (%d options:", num_options
);
310 for (i
= 0; i
< num_options
; i
++)
311 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
318 fputs("ppdConflicts(): ", stdout
);
319 ppdMarkOption(ppd
, "InputSlot", "Envelope");
321 if ((conflicts
= ppdConflicts(ppd
)) == 2)
325 printf("FAIL (%d)\n", conflicts
);
329 fputs("cupsResolveConflicts(InputSlot=Envelope): ", stdout
);
332 if (!cupsResolveConflicts(ppd
, "InputSlot", "Envelope", &num_options
,
335 puts("FAIL (Unable to resolve)");
338 else if (num_options
!= 2 ||
339 !cupsGetOption("PageSize", num_options
, options
))
341 printf("FAIL (%d options:", num_options
);
342 for (i
= 0; i
< num_options
; i
++)
343 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
348 puts("PASS (Resolved by changing PageSize)");
350 cupsFreeOptions(num_options
, options
);
352 fputs("cupsResolveConflicts(No option/choice): ", stdout
);
355 if (cupsResolveConflicts(ppd
, NULL
, NULL
, &num_options
, &options
) &&
356 num_options
== 1 && !strcasecmp(options
[0].name
, "InputSlot") &&
357 !strcasecmp(options
[0].value
, "Tray"))
358 puts("PASS (Resolved by changing InputSlot)");
359 else if (num_options
> 0)
361 printf("FAIL (%d options:", num_options
);
362 for (i
= 0; i
< num_options
; i
++)
363 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
369 puts("FAIL (Unable to resolve)");
372 cupsFreeOptions(num_options
, options
);
374 fputs("ppdInstallableConflict(): ", stdout
);
375 if (ppdInstallableConflict(ppd
, "Duplex", "DuplexNoTumble") &&
376 !ppdInstallableConflict(ppd
, "Duplex", "None"))
378 else if (!ppdInstallableConflict(ppd
, "Duplex", "DuplexNoTumble"))
380 puts("FAIL (Duplex=DuplexNoTumble did not conflict)");
385 puts("FAIL (Duplex=None conflicted)");
393 fputs("ppdPageSizeLimits: ", stdout
);
394 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
396 if (minsize
.width
!= 36 || minsize
.length
!= 36 ||
397 maxsize
.width
!= 1080 || maxsize
.length
!= 86400)
399 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
400 "expected min=36x36, max=1080x86400)\n", minsize
.width
,
401 minsize
.length
, maxsize
.width
, maxsize
.length
);
409 puts("FAIL (returned 0)");
414 * cupsMarkOptions with PWG and IPP size names.
417 fputs("cupsMarkOptions(media=iso-a4): ", stdout
);
418 num_options
= cupsAddOption("media", "iso-a4", 0, &options
);
419 cupsMarkOptions(ppd
, num_options
, options
);
420 cupsFreeOptions(num_options
, options
);
422 size
= ppdPageSize(ppd
, NULL
);
423 if (!size
|| strcmp(size
->name
, "A4"))
425 printf("FAIL (%s)\n", size
? size
->name
: "unknown");
431 fputs("cupsMarkOptions(media=na_letter_8.5x11in): ", stdout
);
432 num_options
= cupsAddOption("media", "na_letter_8.5x11in", 0, &options
);
433 cupsMarkOptions(ppd
, num_options
, options
);
434 cupsFreeOptions(num_options
, options
);
436 size
= ppdPageSize(ppd
, NULL
);
437 if (!size
|| strcmp(size
->name
, "Letter"))
439 printf("FAIL (%s)\n", size
? size
->name
: "unknown");
446 * Test localization...
449 fputs("ppdLocalizeIPPReason(text): ", stdout
);
450 if (ppdLocalizeIPPReason(ppd
, "foo", NULL
, buffer
, sizeof(buffer
)) &&
451 !strcmp(buffer
, "Foo Reason"))
456 printf("FAIL (\"%s\" instead of \"Foo Reason\")\n", buffer
);
459 fputs("ppdLocalizeIPPReason(http): ", stdout
);
460 if (ppdLocalizeIPPReason(ppd
, "foo", "http", buffer
, sizeof(buffer
)) &&
461 !strcmp(buffer
, "http://foo/bar.html"))
466 printf("FAIL (\"%s\" instead of \"http://foo/bar.html\")\n", buffer
);
469 fputs("ppdLocalizeIPPReason(help): ", stdout
);
470 if (ppdLocalizeIPPReason(ppd
, "foo", "help", buffer
, sizeof(buffer
)) &&
471 !strcmp(buffer
, "help:anchor='foo'%20bookID=Vendor%20Help"))
476 printf("FAIL (\"%s\" instead of \"help:anchor='foo'%%20bookID=Vendor%%20Help\")\n", buffer
);
479 fputs("ppdLocalizeIPPReason(file): ", stdout
);
480 if (ppdLocalizeIPPReason(ppd
, "foo", "file", buffer
, sizeof(buffer
)) &&
481 !strcmp(buffer
, "/help/foo/bar.html"))
486 printf("FAIL (\"%s\" instead of \"/help/foo/bar.html\")\n", buffer
);
491 putenv("LC_CTYPE=fr");
492 putenv("LC_MESSAGES=fr");
494 fputs("ppdLocalizeIPPReason(fr text): ", stdout
);
495 if (ppdLocalizeIPPReason(ppd
, "foo", NULL
, buffer
, sizeof(buffer
)) &&
496 !strcmp(buffer
, "La Long Foo Reason"))
501 printf("FAIL (\"%s\" instead of \"La Long Foo Reason\")\n", buffer
);
504 putenv("LANG=zh_TW");
505 putenv("LC_ALL=zh_TW");
506 putenv("LC_CTYPE=zh_TW");
507 putenv("LC_MESSAGES=zh_TW");
509 fputs("ppdLocalizeIPPReason(zh_TW text): ", stdout
);
510 if (ppdLocalizeIPPReason(ppd
, "foo", NULL
, buffer
, sizeof(buffer
)) &&
511 !strcmp(buffer
, "Number 1 Foo Reason"))
516 printf("FAIL (\"%s\" instead of \"Number 1 Foo Reason\")\n", buffer
);
520 * cupsMarkerName localization...
525 putenv("LC_CTYPE=en");
526 putenv("LC_MESSAGES=en");
528 fputs("ppdLocalizeMarkerName(bogus): ", stdout
);
530 if ((text
= ppdLocalizeMarkerName(ppd
, "bogus")) != NULL
)
533 printf("FAIL (\"%s\" instead of NULL)\n", text
);
538 fputs("ppdLocalizeMarkerName(cyan): ", stdout
);
540 if ((text
= ppdLocalizeMarkerName(ppd
, "cyan")) != NULL
&&
541 !strcmp(text
, "Cyan Toner"))
546 printf("FAIL (\"%s\" instead of \"Cyan Toner\")\n",
547 text
? text
: "(null)");
552 putenv("LC_CTYPE=fr");
553 putenv("LC_MESSAGES=fr");
555 fputs("ppdLocalizeMarkerName(fr cyan): ", stdout
);
556 if ((text
= ppdLocalizeMarkerName(ppd
, "cyan")) != NULL
&&
557 !strcmp(text
, "La Toner Cyan"))
562 printf("FAIL (\"%s\" instead of \"La Toner Cyan\")\n",
563 text
? text
: "(null)");
566 putenv("LANG=zh_TW");
567 putenv("LC_ALL=zh_TW");
568 putenv("LC_CTYPE=zh_TW");
569 putenv("LC_MESSAGES=zh_TW");
571 fputs("ppdLocalizeMarkerName(zh_TW cyan): ", stdout
);
572 if ((text
= ppdLocalizeMarkerName(ppd
, "cyan")) != NULL
&&
573 !strcmp(text
, "Number 1 Cyan Toner"))
578 printf("FAIL (\"%s\" instead of \"Number 1 Cyan Toner\")\n",
579 text
? text
: "(null)");
585 * Test new constraints...
588 fputs("ppdOpenFile(test2.ppd): ", stdout
);
590 if ((ppd
= ppdOpenFile("test2.ppd")) != NULL
)
594 ppd_status_t err
; /* Last error in file */
595 int line
; /* Line number in file */
599 err
= ppdLastError(&line
);
601 printf("FAIL (%s on line %d)\n", ppdErrorString(err
), line
);
604 fputs("ppdMarkDefaults: ", stdout
);
605 ppdMarkDefaults(ppd
);
607 if ((conflicts
= ppdConflicts(ppd
)) == 0)
612 printf("FAIL (%d conflicts)\n", conflicts
);
615 fputs("ppdEmitString (defaults): ", stdout
);
616 if ((s
= ppdEmitString(ppd
, PPD_ORDER_ANY
, 0.0)) != NULL
&&
617 !strcmp(s
, default2_code
))
622 printf("FAIL (%d bytes instead of %d)\n", s
? (int)strlen(s
) : 0,
623 (int)strlen(default2_code
));
632 fputs("ppdConflicts(): ", stdout
);
633 ppdMarkOption(ppd
, "PageSize", "Env10");
634 ppdMarkOption(ppd
, "InputSlot", "Envelope");
635 ppdMarkOption(ppd
, "Quality", "Photo");
637 if ((conflicts
= ppdConflicts(ppd
)) == 1)
641 printf("FAIL (%d)\n", conflicts
);
645 fputs("cupsResolveConflicts(Quality=Photo): ", stdout
);
648 if (cupsResolveConflicts(ppd
, "Quality", "Photo", &num_options
,
651 printf("FAIL (%d options:", num_options
);
652 for (i
= 0; i
< num_options
; i
++)
653 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
658 puts("PASS (Unable to resolve)");
659 cupsFreeOptions(num_options
, options
);
661 fputs("cupsResolveConflicts(No option/choice): ", stdout
);
664 if (cupsResolveConflicts(ppd
, NULL
, NULL
, &num_options
, &options
) &&
665 num_options
== 1 && !strcasecmp(options
->name
, "Quality") &&
666 !strcasecmp(options
->value
, "Normal"))
668 else if (num_options
> 0)
670 printf("FAIL (%d options:", num_options
);
671 for (i
= 0; i
< num_options
; i
++)
672 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
678 puts("FAIL (Unable to resolve!)");
681 cupsFreeOptions(num_options
, options
);
683 fputs("cupsResolveConflicts(loop test): ", stdout
);
684 ppdMarkOption(ppd
, "PageSize", "A4");
685 ppdMarkOption(ppd
, "InputSlot", "Tray");
686 ppdMarkOption(ppd
, "Quality", "Photo");
689 if (!cupsResolveConflicts(ppd
, NULL
, NULL
, &num_options
, &options
))
691 else if (num_options
> 0)
693 printf("FAIL (%d options:", num_options
);
694 for (i
= 0; i
< num_options
; i
++)
695 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
699 puts("FAIL (No conflicts!)");
701 fputs("ppdInstallableConflict(): ", stdout
);
702 if (ppdInstallableConflict(ppd
, "Duplex", "DuplexNoTumble") &&
703 !ppdInstallableConflict(ppd
, "Duplex", "None"))
705 else if (!ppdInstallableConflict(ppd
, "Duplex", "DuplexNoTumble"))
707 puts("FAIL (Duplex=DuplexNoTumble did not conflict)");
712 puts("FAIL (Duplex=None conflicted)");
720 ppdMarkDefaults(ppd
);
722 fputs("ppdPageSizeLimits(default): ", stdout
);
723 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
725 if (minsize
.width
!= 36 || minsize
.length
!= 36 ||
726 maxsize
.width
!= 1080 || maxsize
.length
!= 86400)
728 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
729 "expected min=36x36, max=1080x86400)\n", minsize
.width
,
730 minsize
.length
, maxsize
.width
, maxsize
.length
);
738 puts("FAIL (returned 0)");
742 ppdMarkOption(ppd
, "InputSlot", "Manual");
744 fputs("ppdPageSizeLimits(InputSlot=Manual): ", stdout
);
745 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
747 if (minsize
.width
!= 100 || minsize
.length
!= 100 ||
748 maxsize
.width
!= 1000 || maxsize
.length
!= 1000)
750 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
751 "expected min=100x100, max=1000x1000)\n", minsize
.width
,
752 minsize
.length
, maxsize
.width
, maxsize
.length
);
760 puts("FAIL (returned 0)");
764 ppdMarkOption(ppd
, "Quality", "Photo");
766 fputs("ppdPageSizeLimits(Quality=Photo): ", stdout
);
767 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
769 if (minsize
.width
!= 200 || minsize
.length
!= 200 ||
770 maxsize
.width
!= 1000 || maxsize
.length
!= 1000)
772 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
773 "expected min=200x200, max=1000x1000)\n", minsize
.width
,
774 minsize
.length
, maxsize
.width
, maxsize
.length
);
782 puts("FAIL (returned 0)");
786 ppdMarkOption(ppd
, "InputSlot", "Tray");
788 fputs("ppdPageSizeLimits(Quality=Photo): ", stdout
);
789 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
791 if (minsize
.width
!= 300 || minsize
.length
!= 300 ||
792 maxsize
.width
!= 1080 || maxsize
.length
!= 86400)
794 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
795 "expected min=300x300, max=1080x86400)\n", minsize
.width
,
796 minsize
.length
, maxsize
.width
, maxsize
.length
);
804 puts("FAIL (returned 0)");
810 const char *filename
; /* PPD filename */
811 struct stat fileinfo
; /* File information */
814 if (!strncmp(argv
[1], "-d", 2))
816 filename
= cupsGetPPD(argv
[1] + 2);
819 printf("%s: %s\n", argv
[1], cupsLastErrorString());
826 if (lstat(filename
, &fileinfo
))
828 printf("%s: %s\n", filename
, strerror(errno
));
832 if (S_ISLNK(fileinfo
.st_mode
))
834 char realfile
[1024]; /* Real file path */
835 ssize_t realsize
; /* Size of real file path */
838 if ((realsize
= readlink(filename
, realfile
, sizeof(realfile
) - 1)) < 0)
839 strcpy(realfile
, "Unknown");
841 realfile
[realsize
] = '\0';
843 if (stat(realfile
, &fileinfo
))
844 printf("%s: symlink to \"%s\", %s\n", filename
, realfile
,
847 printf("%s: symlink to \"%s\", %ld bytes\n", filename
, realfile
,
848 (long)fileinfo
.st_size
);
851 printf("%s: regular file, %ld bytes\n", filename
, (long)fileinfo
.st_size
);
853 if ((ppd
= ppdOpenFile(filename
)) == NULL
)
855 ppd_status_t err
; /* Last error in file */
856 int line
; /* Line number in file */
860 err
= ppdLastError(&line
);
862 printf("%s: %s on line %d\n", argv
[1], ppdErrorString(err
), line
);
866 int j
, k
; /* Looping vars */
867 ppd_group_t
*group
; /* Option group */
868 ppd_option_t
*option
; /* Option */
869 ppd_coption_t
*coption
; /* Custom option */
870 ppd_cparam_t
*cparam
; /* Custom parameter */
871 ppd_const_t
*c
; /* UIConstraints */
872 char lang
[255], /* LANG environment variable */
873 lc_all
[255], /* LC_ALL environment variable */
874 lc_ctype
[255], /* LC_CTYPE environment variable */
875 lc_messages
[255];/* LC_MESSAGES environment variable */
880 snprintf(lang
, sizeof(lang
), "LANG=%s", argv
[2]);
882 snprintf(lc_all
, sizeof(lc_all
), "LC_ALL=%s", argv
[2]);
884 snprintf(lc_ctype
, sizeof(lc_ctype
), "LC_CTYPE=%s", argv
[2]);
886 snprintf(lc_messages
, sizeof(lc_messages
), "LC_MESSAGES=%s", argv
[2]);
891 ppdMarkDefaults(ppd
);
895 text
= ppdLocalizeIPPReason(ppd
, argv
[3], NULL
, buffer
, sizeof(buffer
));
896 printf("ppdLocalizeIPPReason(%s)=%s\n", argv
[3],
897 text
? text
: "(null)");
898 return (text
== NULL
);
901 for (i
= ppd
->num_groups
, group
= ppd
->groups
;
905 printf("%s (%s):\n", group
->name
, group
->text
);
907 for (j
= group
->num_options
, option
= group
->options
;
911 printf(" %s (%s):\n", option
->keyword
, option
->text
);
913 for (k
= 0; k
< option
->num_choices
; k
++)
914 printf(" - %s%s (%s)\n",
915 option
->choices
[k
].marked
? "*" : "",
916 option
->choices
[k
].choice
, option
->choices
[k
].text
);
918 if ((coption
= ppdFindCustomOption(ppd
, option
->keyword
)) != NULL
)
920 for (cparam
= (ppd_cparam_t
*)cupsArrayFirst(coption
->params
);
922 cparam
= (ppd_cparam_t
*)cupsArrayNext(coption
->params
))
924 switch (cparam
->type
)
926 case PPD_CUSTOM_CURVE
:
927 printf(" %s(%s): PPD_CUSTOM_CURVE (%g to %g)\n",
928 cparam
->name
, cparam
->text
,
929 cparam
->minimum
.custom_curve
,
930 cparam
->maximum
.custom_curve
);
933 case PPD_CUSTOM_INT
:
934 printf(" %s(%s): PPD_CUSTOM_INT (%d to %d)\n",
935 cparam
->name
, cparam
->text
,
936 cparam
->minimum
.custom_int
,
937 cparam
->maximum
.custom_int
);
940 case PPD_CUSTOM_INVCURVE
:
941 printf(" %s(%s): PPD_CUSTOM_INVCURVE (%g to %g)\n",
942 cparam
->name
, cparam
->text
,
943 cparam
->minimum
.custom_invcurve
,
944 cparam
->maximum
.custom_invcurve
);
947 case PPD_CUSTOM_PASSCODE
:
948 printf(" %s(%s): PPD_CUSTOM_PASSCODE (%d to %d)\n",
949 cparam
->name
, cparam
->text
,
950 cparam
->minimum
.custom_passcode
,
951 cparam
->maximum
.custom_passcode
);
954 case PPD_CUSTOM_PASSWORD
:
955 printf(" %s(%s): PPD_CUSTOM_PASSWORD (%d to %d)\n",
956 cparam
->name
, cparam
->text
,
957 cparam
->minimum
.custom_password
,
958 cparam
->maximum
.custom_password
);
961 case PPD_CUSTOM_POINTS
:
962 printf(" %s(%s): PPD_CUSTOM_POINTS (%g to %g)\n",
963 cparam
->name
, cparam
->text
,
964 cparam
->minimum
.custom_points
,
965 cparam
->maximum
.custom_points
);
968 case PPD_CUSTOM_REAL
:
969 printf(" %s(%s): PPD_CUSTOM_REAL (%g to %g)\n",
970 cparam
->name
, cparam
->text
,
971 cparam
->minimum
.custom_real
,
972 cparam
->maximum
.custom_real
);
975 case PPD_CUSTOM_STRING
:
976 printf(" %s(%s): PPD_CUSTOM_STRING (%d to %d)\n",
977 cparam
->name
, cparam
->text
,
978 cparam
->minimum
.custom_string
,
979 cparam
->maximum
.custom_string
);
987 puts("\nConstraints:");
989 for (i
= ppd
->num_consts
, c
= ppd
->consts
; i
> 0; i
--, c
++)
990 printf(" *UIConstraints: *%s %s *%s %s\n", c
->option1
, c
->choice1
,
991 c
->option2
, c
->choice2
);
992 if (ppd
->num_consts
== 0)
993 puts(" NO CONSTRAINTS");
997 for (i
= 0; i
< ppd
->num_filters
; i
++)
998 printf(" %s\n", ppd
->filters
[i
]);
1000 if (ppd
->num_filters
== 0)
1001 puts(" NO FILTERS");
1003 puts("\nAttributes:");
1005 for (attr
= (ppd_attr_t
*)cupsArrayFirst(ppd
->sorted_attrs
);
1007 attr
= (ppd_attr_t
*)cupsArrayNext(ppd
->sorted_attrs
))
1008 printf(" *%s %s/%s: \"%s\"\n", attr
->name
, attr
->spec
,
1009 attr
->text
, attr
->value
? attr
->value
: "");
1012 if (!strncmp(argv
[1], "-d", 2))
1017 if (getenv("MallocStackLogging") && getenv("MallocStackLoggingNoCompact"))
1019 char command
[1024]; /* malloc_history command */
1021 snprintf(command
, sizeof(command
), "malloc_history %d -all_by_size",
1026 #endif /* __APPLE__ */
1035 * End of "$Id: testppd.c 7897 2008-09-02 19:33:19Z mike $".