]>
git.ipfire.org Git - thirdparty/cups.git/blob - ppdc/ppdi.cxx
2 // PPD file import utility for the CUPS PPD Compiler.
4 // Copyright 2007-2011 by Apple Inc.
5 // Copyright 2002-2005 by Easy Software Products.
7 // Licensed under Apache License v2.0. See the file "LICENSE" for more information.
11 // Include necessary headers...
14 #include "ppdc-private.h"
17 #include <sys/types.h>
24 static void usage(void);
28 // 'main()' - Main entry for the PPD import utility.
31 int // O - Exit status
32 main(int argc
, // I - Number of command-line arguments
33 char *argv
[]) // I - Command-line arguments
36 char *opt
; // Current option
37 const char *srcfile
; // Output file
38 ppdcSource
*src
; // PPD source file data
43 // Scan the command-line...
47 for (i
= 1; i
< argc
; i
++)
48 if (argv
[i
][0] == '-')
50 for (opt
= argv
[i
] + 1; *opt
; opt
++)
53 case 'o' : // Output file
64 case 'I' : // Include dir
69 ppdcSource::add_include(argv
[i
]);
79 // Open and load the driver info file...
85 if (access(srcfile
, 0))
86 src
= new ppdcSource();
88 src
= new ppdcSource(srcfile
);
91 // Import the PPD file...
92 src
->import_ppd(argv
[i
]);
95 // If no drivers have been loaded, display the program usage message.
99 // Write the driver info file back to disk...
100 src
->write_file(srcfile
);
102 // Delete the printer driver information...
105 // Return with no errors.
111 // 'usage()' - Show usage and exit.
117 _cupsLangPuts(stdout
, _("Usage: ppdi [options] filename.ppd [ ... "
119 _cupsLangPuts(stdout
, _("Options:"));
120 _cupsLangPuts(stdout
, _(" -I include-dir Add include directory to "
122 _cupsLangPuts(stdout
, _(" -o filename.drv Set driver information "
123 "file (otherwise ppdi.drv)."));