Debian Codegraph @

src/cups/cups-genppd.c

raw symbols SCIP
1 /*
2 * PPD file generation program for the CUPS drivers.
3 *
4 * Copyright 1993-2008 by Mike Sweet and Robert Krawitz.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 *
19 * Contents:
20 *
21 * main() - Process files on the command-line...
22 * cat_ppd() - Copy the named PPD to stdout.
23 * generate_ppd() - Generate a PPD file.
24 * getlangs() - Get a list of available translations.
25 * help() - Show detailed help.
26 * is_special_option() - Determine if an option should be grouped.
27 * list_ppds() - List the available drivers.
28 * print_group_close() - Close a UI group.
29 * print_group_open() - Open a new UI group.
30 * printlangs() - Print list of available translations.
31 * printmodels() - Print a list of available models.
32 * usage() - Show program usage.
33 * write_ppd() - Write a PPD file.
34 */
35
36 #include "genppd.h"cxx . . $ `<file>/src/cups/genppd.h`/
37
38 static int generate_ppdcxx . . $ generate_ppd(3959531cd2005af8).(const char *prefix, int verbose,
39 const stp_printer_tcxx . . $ stp_printer_t# *p, const char *language,
40 ppd_type_tcxx . . $ ppd_type_t# ppd_type, int use_compression);
41 static int generate_model_ppdscxx . . $ generate_model_ppds(61c2773c3ee3e875).(const char *prefix, int verbose,
42 const stp_printer_tcxx . . $ stp_printer_t# *printer,
43 const char *language, int which_ppds,
44 int use_compression);
45 static void helpcxx . . $ help(49f6e7a06ebc5aa8).(void);
46 static void printlangscxx . . $ printlangs(3ed91490e421178f).(char** langs);
47 static void printmodelscxx . . $ printmodels(d4f767463ce0a6b3).(int verbose);
48 static void usagecxx . . $ usage(49f6e7a06ebc5aa8).(void);
49 static gpFilecxx . . $ gpFile# gpopencxx . . $ gpopen(edad3f60917c9399).(const char *path, const char *mode, int use_compression);
50 static int gpclosecxx . . $ gpclose(7452ccc0852184f6).(gpFilecxx . . $ gpFile# f, int use_compression);
51
52 /*
53 * 'main()' - Process files on the command-line...
54 */
55
56 int /* O - Exit status */
57 maincxx . . $ main(afcd3168fc1188a4).(int argc, /* I - Number of command-line arguments */
58 char *argv[]) /* I - Command-line arguments */
59 {
60 int i; /* Looping var */
61 const char *prefix; /* Directory prefix for output */
62 const char *language = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; /* Language */
63 const stp_printer_tcxx . . $ stp_printer_t# *printer; /* Pointer to printer driver */
64 int verbose = 0; /* Verbose messages */
65 char **langs = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; /* Available translations */
66 char **models = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; /* Models to output, all if NULL */
67 int opt_printlangs = 0; /* Print available translations */
68 int opt_printmodels = 0;/* Print available models */
69 int which_ppds = 2; /* Simplified PPD's = 1, full = 2,
70 no color opts = 4 */
71 unsigned parallel = 1; /* Generate PPD files in parallel */
72 unsigned rotor = 0; /* Rotor for generating PPD files in parallel */
73 unsigned test_rotor = 0; /* Testing (serialized) rotor */
74 unsigned test_rotor_circumference = 1; /* Testing (serialized) rotor size */
75 pid_tcxx . . $ pid_t# *subprocesses = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
76 int parent = 1;
77 #ifdef HAVE_LIBZcxx . . $ `config.h:91:9`!
78 int use_compression = 1;
79 #else
80 int use_compression = 0;
81 #endif
82 int skip_duplicate_ppds = 0;
83
84
85 /*
86 * Parse command-line args...
87 */
88
89 prefix = CUPS_MODELDIRcxx . . $ `config.h:8:9`!;
90
91 for (;;)
92 {
93 if ((i = getoptcxx . . $ getopt(2483c31ff9bab884).(argc, argv, "23hvqc:p:l:LMVd:saNCbZzSr:R:")) == -1)
94 break;
95
96 switch (i)
97 {
98 case '2':
99 cups_ppd_ps_levelcxx . . $ cups_ppd_ps_level. = 2;
100 break;
101 case '3':
102 cups_ppd_ps_levelcxx . . $ cups_ppd_ps_level. = 3;
103 break;
104 case 'h':
105 helpcxx . . $ help(49f6e7a06ebc5aa8).();
106 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:93:9`!);
107 break;
108 case 'v':
109 verbose = 1;
110 break;
111 case 'q':
112 verbose = 0;
113 break;
114 case 'c':
115 fputscxx . . $ fputs(874fa6a5e59ab9bd).("ERROR: -c option no longer supported!\n", stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!);
116 break;
117 case 'p':
118 prefix = optargcxx . . $ optarg.;
119 # ifdef DEBUG
120 fprintf(stderr, "DEBUG: prefix: %s\n", prefix);
121 # endif
122 break;
123 case 'l':
124 language = optargcxx . . $ optarg.;
125 break;
126 case 'L':
127 opt_printlangs = 1;
128 break;
129 case 'M':
130 opt_printmodels = 1;
131 break;
132 case 'd':
133 cups_modeldircxx . . $ cups_modeldir. = optargcxx . . $ optarg.;
134 break;
135 case 's':
136 which_ppds = 1;
137 break;
138 case 'a':
139 which_ppds = 3;
140 break;
141 case 'C':
142 which_ppds |= 4;
143 break;
144 case 'N':
145 localize_numberscxx . . $ localize_numbers. = !localize_numberscxx . . $ localize_numbers.;
146 break;
147 case 'V':
148 printfcxx . . $ printf(581fddd72a8db8fc).("cups-genppd version %s, "
149 "Copyright 1993-2008 by Michael R Sweet and Robert Krawitz.\n\n",
150 VERSIONcxx . . $ `config.h:204:9`!);
151 printfcxx . . $ printf(581fddd72a8db8fc).("Default CUPS PPD PostScript Level: %d\n", cups_ppd_ps_levelcxx . . $ cups_ppd_ps_level.);
152 printfcxx . . $ printf(581fddd72a8db8fc).("Default PPD location (prefix): %s\n", CUPS_MODELDIRcxx . . $ `config.h:8:9`!);
153 printfcxx . . $ printf(581fddd72a8db8fc).("Default base locale directory: %s\n\n", PACKAGE_LOCALE_DIRcxx . . $ `<built-in>:415:9`!);
154 putscxx . . $ puts(5c4306d8553b3696).("This program is free software; you can redistribute it and/or\n"
155 "modify it under the terms of the GNU General Public License,\n"
156 "version 2, as published by the Free Software Foundation.\n"
157 "\n"
158 "This program is distributed in the hope that it will be useful,\n"
159 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
160 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
161 "GNU General Public License for more details.\n");
162 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:93:9`!);
163 break;
164 case 'b':
165 use_base_versioncxx . . $ use_base_version. = 1;
166 break;
167 case 'z':
168 #ifdef HAVE_LIBZcxx . . $ `config.h:91:9`!
169 use_compression = 1;
170 #endif
171 break;
172 case 'Z':
173 #ifdef HAVE_LIBZcxx . . $ `config.h:91:9`!
174 use_compression = 0;
175 #endif
176 break;
177 case 'S':
178 skip_duplicate_ppds = 1;
179 break;
180 case 'r':
181 test_rotor = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.);
182 break;
183 case 'R':
184 test_rotor_circumference = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.);
185 break;
186 default:
187 usagecxx . . $ usage(49f6e7a06ebc5aa8).();
188 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!);
189 break;
190 }
191 }
192 if (test_rotor_circumference < 1 || test_rotor >= test_rotor_circumference)
193 {
194 test_rotor = 0;
195 test_rotor_circumference = 1;
196 }
197 #ifdef HAVE_LIBZcxx . . $ `config.h:91:9`!
198 if (use_compression)
199 gpextcxx . . $ gpext. = ".gz";
200 else
201 #endif
202 gpextcxx . . $ gpext. = "";
203 if (optindcxx . . $ optind. < argc) {
204 int n, numargs;
205 numargs = argc-optindcxx . . $ optind.;
206 models = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).((numargs+1) * sizeof(char*));
207 for (n=0; n<numargs; n++)
208 {
209 models[n] = argv[optindcxx . . $ optind.+n];
210 }
211 models[numargs] = (char*)NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
212 }
213
214 /*
215 * Initialise libgutenprint
216 */
217
218 stp_initcxx . . $ stp_init(b126dc7c1de90089).();
219
220 langs = getlangscxx . . $ getlangs(de5739791ae7584).();
221
222 /*
223 * Print lists
224 */
225
226 if (opt_printlangs)
227 {
228 printlangscxx . . $ printlangs(3ed91490e421178f).(langs);
229 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:93:9`!);
230 }
231
232 if (opt_printmodels)
233 {
234 printmodelscxx . . $ printmodels(d4f767463ce0a6b3).(verbose);
235 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:93:9`!);
236 }
237
238 /*
239 * Write PPD files...
240 */
241
242 if (getenvcxx . . $ getenv(a8b8e32347182212).("STP_PARALLEL"))
243 {
244 parallel = atoicxx . . $ atoi(5c4306d8553b3696).(getenvcxx . . $ getenv(a8b8e32347182212).("STP_PARALLEL"));
245 if (parallel < 1 || parallel > 256)
246 parallel = 1;
247 }
248 if (parallel > 1)
249 {
250 subprocesses = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(pid_tcxx . . $ pid_t#) * parallel);
251 for (rotor = 0; rotor < parallel; rotor++)
252 {
253 pid_tcxx . . $ pid_t# pid = forkcxx . . $ fork(b126dc7c1de90089).();
254 if (pid == 0) /* Child */
255 {
256 parent = 0;
257 break;
258 }
259 else if (pid > 0)
260 subprocesses[rotor] = pid;
261 else
262 {
263 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Cannot fork: %s\n", strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
264 return 1;
265 }
266 }
267 }
268 if (models)
269 {
270 int n;
271 for (n=0; models[n]; n++)
272 {
273 printer = stp_get_printer_by_drivercxx . . $ stp_get_printer_by_driver(5594043bc706389b).(models[n]);
274 if (!printer)
275 printer = stp_get_printer_by_long_namecxx . . $ stp_get_printer_by_long_name(5594043bc706389b).(models[n]);
276
277 if (n % parallel == rotor && printer)
278 {
279 if (printer)
280 {
281 if (generate_model_ppdscxx . . $ generate_model_ppds(61c2773c3ee3e875).(prefix, verbose, printer, language,
282 which_ppds, use_compression))
283 return 1;
284 }
285 else
286 {
287 printfcxx . . $ printf(581fddd72a8db8fc).("Driver not found: %s\n", models[n]);
288 return (1);
289 }
290 }
291 }
292 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(models);
293 }
294 else
295 {
296 int test_rotor_current = -1;
297 stp_string_list_tcxx . . $ stp_string_list_t# *seen_models = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
298 if (skip_duplicate_ppds)
299 seen_models = stp_string_list_createcxx . . $ stp_string_list_create(f262b3b5e10fad14).();
300
301 for (i = 0; i < stp_printer_model_countcxx . . $ stp_printer_model_count(b126dc7c1de90089).(); i++)
302 {
303 printer = stp_get_printer_by_indexcxx . . $ stp_get_printer_by_index(2036101347f379c).(i);
304 test_rotor_current++;
305 if (skip_duplicate_ppds)
306 {
307 char model_family[128];
308 (void) snprintfcxx . . $ snprintf(ea502d73e74c754c).(model_family, 127, "%d_%s",
309 stp_printer_get_modelcxx . . $ stp_printer_get_model(7a5f2d0743711567).(printer),
310 stp_printer_get_familycxx . . $ stp_printer_get_family(b5d6ef9de7e317aa).(printer));
311 if (stp_string_list_is_presentcxx . . $ stp_string_list_is_present(bf726c32497cc2b).(seen_models, model_family))
312 continue;
313 else
314 stp_string_list_add_string_unsafecxx . . $ stp_string_list_add_string_unsafe(61ec312b340c2952).(seen_models, model_family,
315 model_family);
316 }
317 if (test_rotor_current % test_rotor_circumference != test_rotor)
318 continue;
319 if (i % parallel == rotor && printer)
320 {
321 if (! verbose && (i % 100) == 0)
322 fputccxx . . $ fputc(b1cd03d6c470d1bd).('.',stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!);
323 if (generate_model_ppdscxx . . $ generate_model_ppds(61c2773c3ee3e875).(prefix, verbose, printer, language,
324 which_ppds, use_compression))
325 return 1;
326 }
327 }
328 if (seen_models)
329 stp_string_list_destroycxx . . $ stp_string_list_destroy(73d8582195bcdbb3).(seen_models);
330 }
331 if (subprocesses)
332 {
333 pid_tcxx . . $ pid_t# pid;
334 do
335 {
336 int status;
337 pid = waitpidcxx . . $ waitpid(1df93256b606fe1f).(-1, &status, 0);
338 if (pid > 0 && (!WIFEXITEDcxx . . $ `<external>/10696550936717951914/stdlib.h:47:10`!(status) || WEXITSTATUScxx . . $ `<external>/10696550936717951914/stdlib.h:44:10`!(status) != 0))
339 {
340 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "failed!\n");
341 return 1;
342 }
343 } while (pid > 0);
344 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(subprocesses);
345 }
346 if (parent && !verbose)
347 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, " done.\n");
348
349 return (0);
350 }
351
352 static int
353 generate_model_ppdscxx . . $ generate_model_ppds(61c2773c3ee3e875).(const char *prefix, int verbose,
354 const stp_printer_tcxx . . $ stp_printer_t# *printer, const char *language,
355 int which_ppds, int use_compression)
356 {
357 if ((which_ppds & 1) &&
358 generate_ppdcxx . . $ generate_ppd(3959531cd2005af8).(prefix, verbose, printer, language, PPD_SIMPLIFIEDcxx . . $ PPD_SIMPLIFIED.,
359 use_compression))
360 return (1);
361 if ((which_ppds & 2) &&
362 generate_ppdcxx . . $ generate_ppd(3959531cd2005af8).(prefix, verbose, printer, language, PPD_STANDARDcxx . . $ PPD_STANDARD.,
363 use_compression))
364 return (1);
365 if ((which_ppds & 4) &&
366 generate_ppdcxx . . $ generate_ppd(3959531cd2005af8).(prefix, verbose, printer, language, PPD_NO_COLOR_OPTScxx . . $ PPD_NO_COLOR_OPTS.,
367 use_compression))
368 return (1);
369 return 0;
370 }
371
372 /*
373 * 'generate_ppd()' - Generate a PPD file.
374 */
375
376 static int /* O - Exit status */
377 generate_ppdcxx . . $ generate_ppd(3959531cd2005af8).(
378 const char *prefix, /* I - PPD directory prefix */
379 int verbose, /* I - Verbosity level */
380 const stp_printer_tcxx . . $ stp_printer_t# *p, /* I - Driver */
381 const char *language, /* I - Primary language */
382 ppd_type_tcxx . . $ ppd_type_t# ppd_type, /* I - full, simplified, no color */
383 int use_compression) /* I - compress output */
384 {
385 int status; /* Exit status */
386 gpFilecxx . . $ gpFile# fp; /* File to write to */
387 char filename[1024], /* Filename */
388 ppd_location[1024]; /* Installed location */
389 struct statcxx . . $ stat# dir; /* Prefix dir status */
390 const char *ppd_infix;
391
392 /*
393 * Skip the PostScript drivers...
394 */
395
396 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(stp_printer_get_familycxx . . $ stp_printer_get_family(b5d6ef9de7e317aa).(p), "ps") ||
397 !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(stp_printer_get_familycxx . . $ stp_printer_get_family(b5d6ef9de7e317aa).(p), "raw"))
398 return (0);
399
400 /*
401 * Make sure the destination directory exists...
402 */
403
404 if (statcxx . . $ stat(a9cd1e23e96f423c).(prefix, &dir) && !S_ISDIRcxx . . $ `<external>/531885356569766532/stat.h:125:9`!(dir.st_mode))
405 {
406 if (mkdircxx . . $ mkdir(1df18506ef0a631b).(prefix, 0777))
407 {
408 printfcxx . . $ printf(581fddd72a8db8fc).("cups-genppd: Cannot create directory %s: %s\n",
409 prefix, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
410 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!);
411 }
412 }
413
414 /*
415 * The files will be named stp-<driver>.<major>.<minor>.ppd, for
416 * example:
417 *
418 * stp-escp2-ex.5.0.ppd
419 *
420 * or
421 *
422 * stp-escp2-ex.5.0.ppd.gz
423 */
424
425 switch (ppd_type)
426 {
427 case PPD_SIMPLIFIEDcxx . . $ PPD_SIMPLIFIED.:
428 ppd_infix = ".sim";
429 break;
430 case PPD_NO_COLOR_OPTScxx . . $ PPD_NO_COLOR_OPTS.:
431 ppd_infix = ".nc";
432 break;
433 default:
434 ppd_infix = "";
435 }
436
437 snprintfcxx . . $ snprintf(ea502d73e74c754c).(filename, sizeof(filename) - 1, "%s/stp-%s.%s%s%s%s",
438 prefix, stp_printer_get_drivercxx . . $ stp_printer_get_driver(b5d6ef9de7e317aa).(p), GUTENPRINT_RELEASE_VERSIONcxx . . $ `config.h:30:9`!,
439 ppd_infix, ppdextcxx . . $ ppdext., gpextcxx . . $ gpext.);
440
441 /*
442 * Open the PPD file...
443 */
444
445 if ((fp = gpopencxx . . $ gpopen(edad3f60917c9399).(filename, "wb", use_compression)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
446 {
447 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "cups-genppd: Unable to create file \"%s\" - %s.\n",
448 filename, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
449 return (2);
450 }
451
452 if (verbose)
453 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Writing %s...\n", filename);
454
455 snprintfcxx . . $ snprintf(ea502d73e74c754c).(ppd_location, sizeof(ppd_location), "%s%s%s/%s",
456 cups_modeldircxx . . $ cups_modeldir.,
457 cups_modeldircxx . . $ cups_modeldir.[strlencxx . . $ strlen(751346f8406fd082).(cups_modeldircxx . . $ cups_modeldir.) - 1] == '/' ? "" : "/",
458 language ? language : "C",
459 basenamecxx . . $ `<external>/6296865783241590524/libgen.h:35:9`!(filename));
460
461 snprintfcxx . . $ snprintf(ea502d73e74c754c).(filename, sizeof(filename) - 1, "stp-%s.%s%s%s",
462 stp_printer_get_drivercxx . . $ stp_printer_get_driver(b5d6ef9de7e317aa).(p), GUTENPRINT_RELEASE_VERSIONcxx . . $ `config.h:30:9`!,
463 ppd_infix, ppdextcxx . . $ ppdext.);
464
465 status = write_ppdcxx . . $ write_ppd(b5c2acede45c40d2).(fp, p, language, ppd_location, ppd_type,
466 basenamecxx . . $ `<external>/6296865783241590524/libgen.h:35:9`!(filename), use_compression);
467
468 gpclosecxx . . $ gpclose(7452ccc0852184f6).(fp, use_compression);
469
470 return (status);
471 }
472
473
474 /*
475 * 'help()' - Show detailed help.
476 */
477
478 void
479 helpcxx . . $ help(49f6e7a06ebc5aa8).(void)
480 {
481 putscxx . . $ puts(5c4306d8553b3696).("Generate Gutenprint PPD files for use with CUPS\n\n");
482 usagecxx . . $ usage(49f6e7a06ebc5aa8).();
483 putscxx . . $ puts(5c4306d8553b3696).("\nExamples: LANG=de_DE cups-genppd -p ppd -c /usr/share/locale\n"
484 " cups-genppd -L -c /usr/share/locale\n"
485 " cups-genppd -M -v\n\n"
486 "Commands:\n"
487 " -h Show this help message.\n"
488 " -L List available translations (message catalogs).\n"
489 " -M List available printer models.\n"
490 " -V Show version information and defaults.\n"
491 " The default is to output PPDs.\n");
492 putscxx . . $ puts(5c4306d8553b3696).("Options:\n"
493 " -N Localize numbers.\n"
494 " -l locale Output PPDs translated with messages for locale.\n"
495 " -p prefix Output PPDs in directory prefix.\n"
496 " -d prefix Embed directory prefix in PPD file.\n"
497 " -s Generate simplified PPD files.\n"
498 " -a Generate all (simplified and full) PPD files.\n"
499 " -q Quiet mode.\n"
500 " -v Verbose mode.\n");
501 putscxx . . $ puts(5c4306d8553b3696).(
502 #ifdef HAVE_LIBZcxx . . $ `config.h:91:9`!
503 " -z Compress PPD files.\n"
504 " -Z Don't compress PPD files.\n"
505 #endif
506 " -S Skip PPD files with duplicate model identifiers.\n"
507 " -R size Generate every size'th PPD file.\n"
508 " -r divisor Generate the PPD files (N % size == divisor).\n"
509 "\n"
510 "models:\n"
511 " A list of printer models, either the driver or quoted full name.\n");
512 }
513
514 /*
515 * 'usage()' - Show program usage.
516 */
517
518 void
519 usagecxx . . $ usage(49f6e7a06ebc5aa8).(void)
520 {
521 putscxx . . $ puts(5c4306d8553b3696).("Usage: cups-genppd "
522 "[-l locale] [-p prefix] [-s | -a] [-q] [-v] models...\n"
523 " cups-genppd -L\n"
524 " cups-genppd -M [-v]\n"
525 " cups-genppd -h\n"
526 " cups-genppd -V\n");
527 }
528
529 /*
530 * 'printlangs()' - Print list of available translations.
531 */
532
533 void
534 printlangscxx . . $ printlangs(3ed91490e421178f).(char **langs) /* I - Languages */
535 {
536 if (langs)
537 {
538 int n = 0;
539 while (langs && langs[n])
540 {
541 putscxx . . $ puts(5c4306d8553b3696).(langs[n]);
542 n++;
543 }
544 }
545 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:93:9`!);
546 }
547
548
549 /*
550 * 'printmodels()' - Print a list of available models.
551 */
552
553 void
554 printmodelscxx . . $ printmodels(d4f767463ce0a6b3).(int verbose) /* I - Verbosity level */
555 {
556 const stp_printer_tcxx . . $ stp_printer_t# *p;
557 int i;
558
559 for (i = 0; i < stp_printer_model_countcxx . . $ stp_printer_model_count(b126dc7c1de90089).(); i++)
560 {
561 p = stp_get_printer_by_indexcxx . . $ stp_get_printer_by_index(2036101347f379c).(i);
562 if (p &&
563 strcmpcxx . . $ strcmp(5ae29d726ae57f88).(stp_printer_get_familycxx . . $ stp_printer_get_family(b5d6ef9de7e317aa).(p), "ps") != 0 &&
564 strcmpcxx . . $ strcmp(5ae29d726ae57f88).(stp_printer_get_familycxx . . $ stp_printer_get_family(b5d6ef9de7e317aa).(p), "raw") != 0)
565 {
566 if(verbose)
567 printfcxx . . $ printf(581fddd72a8db8fc).("%-20s%s\n", stp_printer_get_drivercxx . . $ stp_printer_get_driver(b5d6ef9de7e317aa).(p),
568 stp_printer_get_long_namecxx . . $ stp_printer_get_long_name(b5d6ef9de7e317aa).(p));
569 else
570 printfcxx . . $ printf(581fddd72a8db8fc).("%s\n", stp_printer_get_drivercxx . . $ stp_printer_get_driver(b5d6ef9de7e317aa).(p));
571 }
572 }
573 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:93:9`!);
574 }
575
576 static gpFilecxx . . $ gpFile#
577 gpopencxx . . $ gpopen(edad3f60917c9399).(const char *path, const char *mode, int use_compression)
578 {
579 #ifdef HAVE_LIBZcxx . . $ `config.h:91:9`!
580 gpFilecxx . . $ gpFile# f = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(gpfilecxx . . $ gpfile#));
581 if (use_compression)
582 {
583 f->gzfcxx . . $ $anonymous_type_b1f2d71ee109eb2b_1#gzf. = gzopencxx . . $ gzopen(e549dd1a5168a7e3).(path, mode);
584 if (!f->gzfcxx . . $ $anonymous_type_b1f2d71ee109eb2b_1#gzf.)
585 {
586 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(f);
587 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
588 }
589 return f;
590 }
591 else
592 #endif
593 {
594 FILEcxx . . $ FILE# *fl = fopencxx . . $ fopen(82ec0787cd37e0a3).(path, mode);
595 #ifdef HAVE_LIBZcxx . . $ `config.h:91:9`!
596 if (fl)
597 {
598 f->fcxx . . $ $anonymous_type_b1f2d71ee109eb2b_1#f. = fl;
599 return f;
600 }
601 else
602 {
603 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(f);
604 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
605 }
606 #else
607 return fl;
608 #endif
609 }
610 }
611
612 static int
613 gpclosecxx . . $ gpclose(7452ccc0852184f6).(gpFilecxx . . $ gpFile# f, int use_compression)
614 {
615 int status;
616 #ifdef HAVE_LIBZcxx . . $ `config.h:91:9`!
617 if (use_compression)
618 status = gzclosecxx . . $ gzclose(4d4947b8d23ad0c4).(f->gzfcxx . . $ $anonymous_type_b1f2d71ee109eb2b_1#gzf.);
619 else
620 status = fclosecxx . . $ fclose(89bc1efcdac0ca22).(f->fcxx . . $ $anonymous_type_b1f2d71ee109eb2b_1#f.);
621 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(f);
622 #else
623 status = fclose(f);
624 #endif
625 return status;
626 }