]>
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-2009 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...
28 #include <cups/string.h>
45 static const char *default_code
=
47 "%%BeginFeature: *InstalledDuplexer False\n"
49 "} stopped cleartomark\n"
51 "%%BeginFeature: *PageRegion Letter\n"
54 "} stopped cleartomark\n"
56 "%%BeginFeature: *InputSlot Tray\n"
59 "} stopped cleartomark\n"
61 "%%BeginFeature: *IntOption None\n"
63 "} stopped cleartomark\n"
65 "%%BeginFeature: *StringOption None\n"
67 "} stopped cleartomark\n";
69 static const char *custom_code
=
71 "%%BeginFeature: *InstalledDuplexer False\n"
73 "} stopped cleartomark\n"
75 "%%BeginFeature: *InputSlot Tray\n"
78 "} stopped cleartomark\n"
80 "%%BeginFeature: *IntOption None\n"
82 "} stopped cleartomark\n"
84 "%%BeginFeature: *CustomStringOption True\n"
85 "(value\\0502\\051)\n"
87 "StringOption=Custom\n"
89 "} stopped cleartomark\n"
91 "%%BeginFeature: *CustomPageSize True\n"
99 "} stopped cleartomark\n";
103 * 'main()' - Main entry.
106 int /* O - Exit status */
107 main(int argc
, /* I - Number of command-line arguments */
108 char *argv
[]) /* I - Command-line arguments */
110 int i
; /* Looping var */
111 ppd_file_t
*ppd
; /* PPD file loaded from disk */
112 int status
; /* Status of tests (0 = success, 1 = fail) */
113 int conflicts
; /* Number of conflicts */
114 char *s
; /* String */
115 char buffer
[8192]; /* String buffer */
116 const char *text
, /* Localized text */
117 *val
; /* Option value */
118 int num_options
; /* Number of options */
119 cups_option_t
*options
; /* Options */
120 ppd_size_t minsize
, /* Minimum size */
121 maxsize
, /* Maximum size */
122 *size
; /* Current size */
123 ppd_attr_t
*attr
; /* Current attribute */
124 _cups_pwg_media_t
*pwgmedia
; /* PWG media size */
132 * Setup directories for locale stuff...
135 if (access("locale", 0))
137 mkdir("locale", 0777);
138 mkdir("locale/fr", 0777);
139 symlink("../../../locale/cups_fr.po", "locale/fr/cups_fr.po");
140 mkdir("locale/zh_TW", 0777);
141 symlink("../../../locale/cups_zh_TW.po", "locale/zh_TW/cups_zh_TW.po");
144 putenv("LOCALEDIR=locale");
147 * Do tests with test.ppd...
150 fputs("ppdOpenFile(test.ppd): ", stdout
);
152 if ((ppd
= ppdOpenFile("test.ppd")) != NULL
)
156 ppd_status_t err
; /* Last error in file */
157 int line
; /* Line number in file */
161 err
= ppdLastError(&line
);
163 printf("FAIL (%s on line %d)\n", ppdErrorString(err
), line
);
166 fputs("ppdFindAttr(wildcard): ", stdout
);
167 if ((attr
= ppdFindAttr(ppd
, "cupsTest", NULL
)) == NULL
)
170 puts("FAIL (not found)");
172 else if (strcmp(attr
->name
, "cupsTest") || strcmp(attr
->spec
, "Foo"))
175 printf("FAIL (got \"%s %s\")\n", attr
->name
, attr
->spec
);
180 fputs("ppdFindNextAttr(wildcard): ", stdout
);
181 if ((attr
= ppdFindNextAttr(ppd
, "cupsTest", NULL
)) == NULL
)
184 puts("FAIL (not found)");
186 else if (strcmp(attr
->name
, "cupsTest") || strcmp(attr
->spec
, "Bar"))
189 printf("FAIL (got \"%s %s\")\n", attr
->name
, attr
->spec
);
194 fputs("ppdFindAttr(Foo): ", stdout
);
195 if ((attr
= ppdFindAttr(ppd
, "cupsTest", "Foo")) == NULL
)
198 puts("FAIL (not found)");
200 else if (strcmp(attr
->name
, "cupsTest") || strcmp(attr
->spec
, "Foo"))
203 printf("FAIL (got \"%s %s\")\n", attr
->name
, attr
->spec
);
208 fputs("ppdFindNextAttr(Foo): ", stdout
);
209 if ((attr
= ppdFindNextAttr(ppd
, "cupsTest", "Foo")) != NULL
)
212 printf("FAIL (got \"%s %s\")\n", attr
->name
, attr
->spec
);
217 fputs("ppdMarkDefaults: ", stdout
);
218 ppdMarkDefaults(ppd
);
220 if ((conflicts
= ppdConflicts(ppd
)) == 0)
225 printf("FAIL (%d conflicts)\n", conflicts
);
228 fputs("ppdEmitString (defaults): ", stdout
);
229 if ((s
= ppdEmitString(ppd
, PPD_ORDER_ANY
, 0.0)) != NULL
&&
230 !strcmp(s
, default_code
))
235 printf("FAIL (%d bytes instead of %d)\n", s
? (int)strlen(s
) : 0,
236 (int)strlen(default_code
));
245 fputs("ppdEmitString (custom size and string): ", stdout
);
246 ppdMarkOption(ppd
, "PageSize", "Custom.400x500");
247 ppdMarkOption(ppd
, "StringOption", "{String1=\"value 1\" String2=value(2)}");
249 if ((s
= ppdEmitString(ppd
, PPD_ORDER_ANY
, 0.0)) != NULL
&&
250 !strcmp(s
, custom_code
))
255 printf("FAIL (%d bytes instead of %d)\n", s
? (int)strlen(s
) : 0,
256 (int)strlen(custom_code
));
266 * Test constraints...
269 fputs("cupsGetConflicts(InputSlot=Envelope): ", stdout
);
270 ppdMarkOption(ppd
, "PageSize", "Letter");
272 num_options
= cupsGetConflicts(ppd
, "InputSlot", "Envelope", &options
);
273 if (num_options
!= 2 ||
274 (val
= cupsGetOption("PageRegion", num_options
, options
)) == NULL
||
275 strcasecmp(val
, "Letter") ||
276 (val
= cupsGetOption("PageSize", num_options
, options
)) == NULL
||
277 strcasecmp(val
, "Letter"))
279 printf("FAIL (%d options:", num_options
);
280 for (i
= 0; i
< num_options
; i
++)
281 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
288 fputs("ppdConflicts(): ", stdout
);
289 ppdMarkOption(ppd
, "InputSlot", "Envelope");
291 if ((conflicts
= ppdConflicts(ppd
)) == 2)
295 printf("FAIL (%d)\n", conflicts
);
299 fputs("cupsResolveConflicts(InputSlot=Envelope): ", stdout
);
302 if (!cupsResolveConflicts(ppd
, "InputSlot", "Envelope", &num_options
,
305 puts("FAIL (Unable to resolve)");
308 else if (num_options
!= 2 ||
309 !cupsGetOption("PageSize", num_options
, options
))
311 printf("FAIL (%d options:", num_options
);
312 for (i
= 0; i
< num_options
; i
++)
313 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
318 puts("PASS (Resolved by changing PageSize)");
320 cupsFreeOptions(num_options
, options
);
322 fputs("cupsResolveConflicts(No option/choice): ", stdout
);
325 if (cupsResolveConflicts(ppd
, NULL
, NULL
, &num_options
, &options
) &&
326 num_options
== 1 && !strcasecmp(options
[0].name
, "InputSlot") &&
327 !strcasecmp(options
[0].value
, "Tray"))
328 puts("PASS (Resolved by changing InputSlot)");
329 else if (num_options
> 0)
331 printf("FAIL (%d options:", num_options
);
332 for (i
= 0; i
< num_options
; i
++)
333 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
339 puts("FAIL (Unable to resolve)");
342 cupsFreeOptions(num_options
, options
);
344 fputs("ppdInstallableConflict(): ", stdout
);
345 if (ppdInstallableConflict(ppd
, "Duplex", "DuplexNoTumble") &&
346 !ppdInstallableConflict(ppd
, "Duplex", "None"))
348 else if (!ppdInstallableConflict(ppd
, "Duplex", "DuplexNoTumble"))
350 puts("FAIL (Duplex=DuplexNoTumble did not conflict)");
355 puts("FAIL (Duplex=None conflicted)");
363 fputs("ppdPageSizeLimits: ", stdout
);
364 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
366 if (minsize
.width
!= 36 || minsize
.length
!= 36 ||
367 maxsize
.width
!= 1080 || maxsize
.length
!= 86400)
369 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
370 "expected min=36x36, max=1080x86400)\n", minsize
.width
,
371 minsize
.length
, maxsize
.width
, maxsize
.length
);
379 puts("FAIL (returned 0)");
384 * cupsMarkOptions with PWG and IPP size names.
387 fputs("cupsMarkOptions(media=iso-a4): ", stdout
);
388 num_options
= cupsAddOption("media", "iso-a4", 0, &options
);
389 cupsMarkOptions(ppd
, num_options
, options
);
390 cupsFreeOptions(num_options
, options
);
392 size
= ppdPageSize(ppd
, NULL
);
393 if (!size
|| strcmp(size
->name
, "A4"))
395 printf("FAIL (%s)\n", size
? size
->name
: "unknown");
401 fputs("cupsMarkOptions(media=na_letter_8.5x11in): ", stdout
);
402 num_options
= cupsAddOption("media", "na_letter_8.5x11in", 0, &options
);
403 cupsMarkOptions(ppd
, num_options
, options
);
404 cupsFreeOptions(num_options
, options
);
406 size
= ppdPageSize(ppd
, NULL
);
407 if (!size
|| strcmp(size
->name
, "Letter"))
409 printf("FAIL (%s)\n", size
? size
->name
: "unknown");
415 fputs("_cupsPWGMediaBySize(842, 1191): ", stdout
);
416 if ((pwgmedia
= _cupsPWGMediaBySize(842, 1191)) == NULL
)
418 puts("FAIL (not found)");
421 else if (strcmp(pwgmedia
->pwg
, "iso_a3_297x420mm"))
423 printf("FAIL (%s)\n", pwgmedia
->pwg
);
430 * Test localization...
433 fputs("ppdLocalizeIPPReason(text): ", stdout
);
434 if (ppdLocalizeIPPReason(ppd
, "foo", NULL
, buffer
, sizeof(buffer
)) &&
435 !strcmp(buffer
, "Foo Reason"))
440 printf("FAIL (\"%s\" instead of \"Foo Reason\")\n", buffer
);
443 fputs("ppdLocalizeIPPReason(http): ", stdout
);
444 if (ppdLocalizeIPPReason(ppd
, "foo", "http", buffer
, sizeof(buffer
)) &&
445 !strcmp(buffer
, "http://foo/bar.html"))
450 printf("FAIL (\"%s\" instead of \"http://foo/bar.html\")\n", buffer
);
453 fputs("ppdLocalizeIPPReason(help): ", stdout
);
454 if (ppdLocalizeIPPReason(ppd
, "foo", "help", buffer
, sizeof(buffer
)) &&
455 !strcmp(buffer
, "help:anchor='foo'%20bookID=Vendor%20Help"))
460 printf("FAIL (\"%s\" instead of \"help:anchor='foo'%%20bookID=Vendor%%20Help\")\n", buffer
);
463 fputs("ppdLocalizeIPPReason(file): ", stdout
);
464 if (ppdLocalizeIPPReason(ppd
, "foo", "file", buffer
, sizeof(buffer
)) &&
465 !strcmp(buffer
, "/help/foo/bar.html"))
470 printf("FAIL (\"%s\" instead of \"/help/foo/bar.html\")\n", buffer
);
475 putenv("LC_CTYPE=fr");
476 putenv("LC_MESSAGES=fr");
478 fputs("ppdLocalizeIPPReason(fr text): ", stdout
);
479 if (ppdLocalizeIPPReason(ppd
, "foo", NULL
, buffer
, sizeof(buffer
)) &&
480 !strcmp(buffer
, "La Long Foo Reason"))
485 printf("FAIL (\"%s\" instead of \"La Long Foo Reason\")\n", buffer
);
488 putenv("LANG=zh_TW");
489 putenv("LC_ALL=zh_TW");
490 putenv("LC_CTYPE=zh_TW");
491 putenv("LC_MESSAGES=zh_TW");
493 fputs("ppdLocalizeIPPReason(zh_TW text): ", stdout
);
494 if (ppdLocalizeIPPReason(ppd
, "foo", NULL
, buffer
, sizeof(buffer
)) &&
495 !strcmp(buffer
, "Number 1 Foo Reason"))
500 printf("FAIL (\"%s\" instead of \"Number 1 Foo Reason\")\n", buffer
);
504 * cupsMarkerName localization...
509 putenv("LC_CTYPE=en");
510 putenv("LC_MESSAGES=en");
512 fputs("ppdLocalizeMarkerName(bogus): ", stdout
);
514 if ((text
= ppdLocalizeMarkerName(ppd
, "bogus")) != NULL
)
517 printf("FAIL (\"%s\" instead of NULL)\n", text
);
522 fputs("ppdLocalizeMarkerName(cyan): ", stdout
);
524 if ((text
= ppdLocalizeMarkerName(ppd
, "cyan")) != NULL
&&
525 !strcmp(text
, "Cyan Toner"))
530 printf("FAIL (\"%s\" instead of \"Cyan Toner\")\n",
531 text
? text
: "(null)");
536 putenv("LC_CTYPE=fr");
537 putenv("LC_MESSAGES=fr");
539 fputs("ppdLocalizeMarkerName(fr cyan): ", stdout
);
540 if ((text
= ppdLocalizeMarkerName(ppd
, "cyan")) != NULL
&&
541 !strcmp(text
, "La Toner Cyan"))
546 printf("FAIL (\"%s\" instead of \"La Toner Cyan\")\n",
547 text
? text
: "(null)");
550 putenv("LANG=zh_TW");
551 putenv("LC_ALL=zh_TW");
552 putenv("LC_CTYPE=zh_TW");
553 putenv("LC_MESSAGES=zh_TW");
555 fputs("ppdLocalizeMarkerName(zh_TW cyan): ", stdout
);
556 if ((text
= ppdLocalizeMarkerName(ppd
, "cyan")) != NULL
&&
557 !strcmp(text
, "Number 1 Cyan Toner"))
562 printf("FAIL (\"%s\" instead of \"Number 1 Cyan Toner\")\n",
563 text
? text
: "(null)");
569 * Test new constraints...
572 fputs("ppdOpenFile(test2.ppd): ", stdout
);
574 if ((ppd
= ppdOpenFile("test2.ppd")) != NULL
)
578 ppd_status_t err
; /* Last error in file */
579 int line
; /* Line number in file */
583 err
= ppdLastError(&line
);
585 printf("FAIL (%s on line %d)\n", ppdErrorString(err
), line
);
588 fputs("ppdMarkDefaults: ", stdout
);
589 ppdMarkDefaults(ppd
);
591 if ((conflicts
= ppdConflicts(ppd
)) == 0)
596 printf("FAIL (%d conflicts)\n", conflicts
);
599 fputs("ppdConflicts(): ", stdout
);
600 ppdMarkOption(ppd
, "PageSize", "Env10");
601 ppdMarkOption(ppd
, "InputSlot", "Envelope");
602 ppdMarkOption(ppd
, "Quality", "Photo");
604 if ((conflicts
= ppdConflicts(ppd
)) == 2)
608 printf("FAIL (%d)\n", conflicts
);
612 fputs("cupsResolveConflicts(Quality=Photo): ", stdout
);
615 if (cupsResolveConflicts(ppd
, "Quality", "Photo", &num_options
,
618 printf("FAIL (%d options:", num_options
);
619 for (i
= 0; i
< num_options
; i
++)
620 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
625 puts("PASS (Unable to resolve)");
626 cupsFreeOptions(num_options
, options
);
628 fputs("cupsResolveConflicts(No option/choice): ", stdout
);
631 if (cupsResolveConflicts(ppd
, NULL
, NULL
, &num_options
, &options
) &&
632 num_options
== 1 && !strcasecmp(options
->name
, "Quality") &&
633 !strcasecmp(options
->value
, "Normal"))
635 else if (num_options
> 0)
637 printf("FAIL (%d options:", num_options
);
638 for (i
= 0; i
< num_options
; i
++)
639 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
645 puts("FAIL (Unable to resolve!)");
648 cupsFreeOptions(num_options
, options
);
650 fputs("cupsResolveConflicts(loop test): ", stdout
);
651 ppdMarkOption(ppd
, "PageSize", "A4");
652 ppdMarkOption(ppd
, "Quality", "Photo");
655 if (!cupsResolveConflicts(ppd
, NULL
, NULL
, &num_options
, &options
))
657 else if (num_options
> 0)
659 printf("FAIL (%d options:", num_options
);
660 for (i
= 0; i
< num_options
; i
++)
661 printf(" %s=%s", options
[i
].name
, options
[i
].value
);
665 puts("FAIL (No conflicts!)");
667 fputs("ppdInstallableConflict(): ", stdout
);
668 if (ppdInstallableConflict(ppd
, "Duplex", "DuplexNoTumble") &&
669 !ppdInstallableConflict(ppd
, "Duplex", "None"))
671 else if (!ppdInstallableConflict(ppd
, "Duplex", "DuplexNoTumble"))
673 puts("FAIL (Duplex=DuplexNoTumble did not conflict)");
678 puts("FAIL (Duplex=None conflicted)");
686 ppdMarkDefaults(ppd
);
688 fputs("ppdPageSizeLimits(default): ", stdout
);
689 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
691 if (minsize
.width
!= 36 || minsize
.length
!= 36 ||
692 maxsize
.width
!= 1080 || maxsize
.length
!= 86400)
694 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
695 "expected min=36x36, max=1080x86400)\n", minsize
.width
,
696 minsize
.length
, maxsize
.width
, maxsize
.length
);
704 puts("FAIL (returned 0)");
708 ppdMarkOption(ppd
, "InputSlot", "Manual");
710 fputs("ppdPageSizeLimits(InputSlot=Manual): ", stdout
);
711 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
713 if (minsize
.width
!= 100 || minsize
.length
!= 100 ||
714 maxsize
.width
!= 1000 || maxsize
.length
!= 1000)
716 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
717 "expected min=100x100, max=1000x1000)\n", minsize
.width
,
718 minsize
.length
, maxsize
.width
, maxsize
.length
);
726 puts("FAIL (returned 0)");
730 ppdMarkOption(ppd
, "Quality", "Photo");
732 fputs("ppdPageSizeLimits(Quality=Photo): ", stdout
);
733 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
735 if (minsize
.width
!= 200 || minsize
.length
!= 200 ||
736 maxsize
.width
!= 1000 || maxsize
.length
!= 1000)
738 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
739 "expected min=200x200, max=1000x1000)\n", minsize
.width
,
740 minsize
.length
, maxsize
.width
, maxsize
.length
);
748 puts("FAIL (returned 0)");
752 ppdMarkOption(ppd
, "InputSlot", "Tray");
754 fputs("ppdPageSizeLimits(Quality=Photo): ", stdout
);
755 if (ppdPageSizeLimits(ppd
, &minsize
, &maxsize
))
757 if (minsize
.width
!= 300 || minsize
.length
!= 300 ||
758 maxsize
.width
!= 1080 || maxsize
.length
!= 86400)
760 printf("FAIL (got min=%.0fx%.0f, max=%.0fx%.0f, "
761 "expected min=300x300, max=1080x86400)\n", minsize
.width
,
762 minsize
.length
, maxsize
.width
, maxsize
.length
);
770 puts("FAIL (returned 0)");
776 const char *filename
; /* PPD filename */
777 struct stat fileinfo
; /* File information */
780 if (!strncmp(argv
[1], "-d", 2))
782 filename
= cupsGetPPD(argv
[1] + 2);
785 printf("%s: %s\n", argv
[1], cupsLastErrorString());
792 if (lstat(filename
, &fileinfo
))
794 printf("%s: %s\n", filename
, strerror(errno
));
798 if (S_ISLNK(fileinfo
.st_mode
))
800 char realfile
[1024]; /* Real file path */
801 ssize_t realsize
; /* Size of real file path */
804 if ((realsize
= readlink(filename
, realfile
, sizeof(realfile
) - 1)) < 0)
805 strcpy(realfile
, "Unknown");
807 realfile
[realsize
] = '\0';
809 if (stat(realfile
, &fileinfo
))
810 printf("%s: symlink to \"%s\", %s\n", filename
, realfile
,
813 printf("%s: symlink to \"%s\", %ld bytes\n", filename
, realfile
,
814 (long)fileinfo
.st_size
);
817 printf("%s: regular file, %ld bytes\n", filename
, (long)fileinfo
.st_size
);
819 if ((ppd
= ppdOpenFile(filename
)) == NULL
)
821 ppd_status_t err
; /* Last error in file */
822 int line
; /* Line number in file */
826 err
= ppdLastError(&line
);
828 printf("%s: %s on line %d\n", argv
[1], ppdErrorString(err
), line
);
832 int j
, k
; /* Looping vars */
833 ppd_group_t
*group
; /* Option group */
834 ppd_option_t
*option
; /* Option */
835 ppd_coption_t
*coption
; /* Custom option */
836 ppd_cparam_t
*cparam
; /* Custom parameter */
837 ppd_const_t
*c
; /* UIConstraints */
838 char lang
[255], /* LANG environment variable */
839 lc_all
[255], /* LC_ALL environment variable */
840 lc_ctype
[255], /* LC_CTYPE environment variable */
841 lc_messages
[255];/* LC_MESSAGES environment variable */
846 snprintf(lang
, sizeof(lang
), "LANG=%s", argv
[2]);
848 snprintf(lc_all
, sizeof(lc_all
), "LC_ALL=%s", argv
[2]);
850 snprintf(lc_ctype
, sizeof(lc_ctype
), "LC_CTYPE=%s", argv
[2]);
852 snprintf(lc_messages
, sizeof(lc_messages
), "LC_MESSAGES=%s", argv
[2]);
860 text
= ppdLocalizeIPPReason(ppd
, argv
[3], NULL
, buffer
, sizeof(buffer
));
861 printf("ppdLocalizeIPPReason(%s)=%s\n", argv
[3],
862 text
? text
: "(null)");
863 return (text
== NULL
);
866 for (i
= ppd
->num_groups
, group
= ppd
->groups
;
870 printf("%s (%s):\n", group
->name
, group
->text
);
872 for (j
= group
->num_options
, option
= group
->options
;
876 printf(" %s (%s):\n", option
->keyword
, option
->text
);
878 for (k
= 0; k
< option
->num_choices
; k
++)
879 printf(" - %s (%s)\n", option
->choices
[k
].choice
,
880 option
->choices
[k
].text
);
882 if ((coption
= ppdFindCustomOption(ppd
, option
->keyword
)) != NULL
)
884 for (cparam
= (ppd_cparam_t
*)cupsArrayFirst(coption
->params
);
886 cparam
= (ppd_cparam_t
*)cupsArrayNext(coption
->params
))
888 switch (cparam
->type
)
890 case PPD_CUSTOM_CURVE
:
891 printf(" %s(%s): PPD_CUSTOM_CURVE (%g to %g)\n",
892 cparam
->name
, cparam
->text
,
893 cparam
->minimum
.custom_curve
,
894 cparam
->maximum
.custom_curve
);
897 case PPD_CUSTOM_INT
:
898 printf(" %s(%s): PPD_CUSTOM_INT (%d to %d)\n",
899 cparam
->name
, cparam
->text
,
900 cparam
->minimum
.custom_int
,
901 cparam
->maximum
.custom_int
);
904 case PPD_CUSTOM_INVCURVE
:
905 printf(" %s(%s): PPD_CUSTOM_INVCURVE (%g to %g)\n",
906 cparam
->name
, cparam
->text
,
907 cparam
->minimum
.custom_invcurve
,
908 cparam
->maximum
.custom_invcurve
);
911 case PPD_CUSTOM_PASSCODE
:
912 printf(" %s(%s): PPD_CUSTOM_PASSCODE (%d to %d)\n",
913 cparam
->name
, cparam
->text
,
914 cparam
->minimum
.custom_passcode
,
915 cparam
->maximum
.custom_passcode
);
918 case PPD_CUSTOM_PASSWORD
:
919 printf(" %s(%s): PPD_CUSTOM_PASSWORD (%d to %d)\n",
920 cparam
->name
, cparam
->text
,
921 cparam
->minimum
.custom_password
,
922 cparam
->maximum
.custom_password
);
925 case PPD_CUSTOM_POINTS
:
926 printf(" %s(%s): PPD_CUSTOM_POINTS (%g to %g)\n",
927 cparam
->name
, cparam
->text
,
928 cparam
->minimum
.custom_points
,
929 cparam
->maximum
.custom_points
);
932 case PPD_CUSTOM_REAL
:
933 printf(" %s(%s): PPD_CUSTOM_REAL (%g to %g)\n",
934 cparam
->name
, cparam
->text
,
935 cparam
->minimum
.custom_real
,
936 cparam
->maximum
.custom_real
);
939 case PPD_CUSTOM_STRING
:
940 printf(" %s(%s): PPD_CUSTOM_STRING (%d to %d)\n",
941 cparam
->name
, cparam
->text
,
942 cparam
->minimum
.custom_string
,
943 cparam
->maximum
.custom_string
);
951 puts("Constraints:");
953 for (i
= ppd
->num_consts
, c
= ppd
->consts
; i
> 0; i
--, c
++)
954 printf(" *UIConstraints: *%s %s *%s %s\n", c
->option1
, c
->choice1
,
955 c
->option2
, c
->choice2
);
959 for (attr
= (ppd_attr_t
*)cupsArrayFirst(ppd
->sorted_attrs
);
961 attr
= (ppd_attr_t
*)cupsArrayNext(ppd
->sorted_attrs
))
962 printf(" *%s %s/%s: \"%s\"\n", attr
->name
, attr
->spec
,
963 attr
->text
, attr
->value
? attr
->value
: "");
966 if (!strncmp(argv
[1], "-d", 2))
971 if (getenv("MallocStackLogging") && getenv("MallocStackLoggingNoCompact"))
973 char command
[1024]; /* malloc_history command */
975 snprintf(command
, sizeof(command
), "malloc_history %d -all_by_size",
980 #endif /* __APPLE__ */
989 * End of "$Id: testppd.c 7897 2008-09-02 19:33:19Z mike $".