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