]>
git.ipfire.org Git - thirdparty/cups.git/blob - cups/testppd.c
2 * "$Id: testppd.c,v 1.13 1999/07/12 16:09:41 mike Exp $"
4 * PPD test program for the Common UNIX Printing System (CUPS).
6 * Copyright 1997-1999 by Easy Software Products, all rights reserved.
8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE.txt" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636-3111 USA
20 * Voice: (301) 373-9603
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
24 * PostScript is a trademark of Adobe Systems, Inc.
28 * main() - Main entry for test program.
32 * Include necessary headers...
40 * 'main()' - Main entry for test program.
43 int /* O - Exit status */
44 main(int argc
, /* I - Number of command-line arguments */
45 char *argv
[]) /* I - Command-line arguments */
47 int i
, j
, k
, m
, n
; /* Looping vars */
48 const char *filename
; /* File to load */
49 ppd_file_t
*ppd
; /* PPD file record */
50 ppd_size_t
*size
; /* Size record */
51 ppd_group_t
*group
; /* UI group */
52 ppd_option_t
*option
; /* Standard UI option */
53 ppd_choice_t
*choice
; /* Standard UI option choice */
54 static char *uis
[] = { "BOOLEAN", "PICKONE", "PICKMANY" };
55 static char *sections
[] = { "ANY", "DOCUMENT", "EXIT",
56 "JCL", "PAGE", "PROLOG" };
60 * Display PPD files for each file listed on the command-line...
65 fputs("Usage: ppdtest filename1.ppd [... filenameN.ppd]\n", stderr
);
69 for (i
= 1; i
< argc
; i
++)
71 if (strstr(argv
[i
], ".ppd"))
74 filename
= cupsGetPPD(argv
[i
]);
76 if ((ppd
= ppdOpenFile(filename
)) == NULL
)
78 fprintf(stderr
, "Unable to open \'%s\' as a PPD file!\n", filename
);
82 printf("FILE: %s\n", filename
);
83 printf(" language_level = %d\n", ppd
->language_level
);
84 printf(" color_device = %s\n", ppd
->color_device
? "TRUE" : "FALSE");
85 printf(" variable_sizes = %s\n", ppd
->variable_sizes
? "TRUE" : "FALSE");
86 printf(" landscape = %d\n", ppd
->landscape
);
88 switch (ppd
->colorspace
)
91 puts(" colorspace = PPD_CS_CMYK");
94 puts(" colorspace = PPD_CS_CMY");
97 puts(" colorspace = PPD_CS_GRAY");
100 puts(" colorspace = PPD_CS_RGB");
103 puts(" colorspace = <unknown>");
107 printf(" num_emulations = %d\n", ppd
->num_emulations
);
108 for (j
= 0; j
< ppd
->num_emulations
; j
++)
109 printf(" emulations[%d] = %s\n", j
, ppd
->emulations
[j
].name
);
111 printf(" lang_encoding = %s\n", ppd
->lang_encoding
);
112 printf(" lang_version = %s\n", ppd
->lang_version
);
113 printf(" modelname = %s\n", ppd
->modelname
);
114 printf(" ttrasterizer = %s\n",
115 ppd
->ttrasterizer
== NULL
? "None" : ppd
->ttrasterizer
);
116 printf(" manufacturer = %s\n", ppd
->manufacturer
);
117 printf(" product = %s\n", ppd
->product
);
118 printf(" nickname = %s\n", ppd
->nickname
);
119 printf(" shortnickname = %s\n", ppd
->shortnickname
);
120 printf(" patches = %d bytes\n",
121 ppd
->patches
== NULL
? 0 : strlen(ppd
->patches
));
123 printf(" num_groups = %d\n", ppd
->num_groups
);
124 for (j
= 0, group
= ppd
->groups
; j
< ppd
->num_groups
; j
++, group
++)
126 printf(" group[%d] = %s\n", j
, group
->text
);
128 for (k
= 0, option
= group
->options
; k
< group
->num_options
; k
++, option
++)
130 printf(" options[%d] = %s (%s) %s %s %.0f\n", k
,
131 option
->keyword
, option
->text
, uis
[option
->ui
],
132 sections
[option
->section
], option
->order
);
134 if (strcmp(option
->keyword
, "PageSize") == 0 ||
135 strcmp(option
->keyword
, "PageRegion") == 0)
137 for (m
= option
->num_choices
, choice
= option
->choices
;
141 size
= ppdPageSize(ppd
, choice
->choice
);
144 printf(" %s (%s) = ERROR", choice
->choice
, choice
->text
);
146 printf(" %s (%s) = %.2fx%.2fin (%.1f,%.1f,%.1f,%.1f)", choice
->choice
,
147 choice
->text
, size
->width
/ 72.0, size
->length
/ 72.0,
148 size
->left
/ 72.0, size
->bottom
/ 72.0,
149 size
->right
/ 72.0, size
->top
/ 72.0);
151 if (strcmp(option
->defchoice
, choice
->choice
) == 0)
159 for (m
= option
->num_choices
, choice
= option
->choices
;
163 printf(" %s (%s)", choice
->choice
, choice
->text
);
165 if (strcmp(option
->defchoice
, choice
->choice
) == 0)
182 * End of "$Id: testppd.c,v 1.13 1999/07/12 16:09:41 mike Exp $".