]>
git.ipfire.org Git - thirdparty/cups.git/blob - ppdc/ppdi.cxx
4 // PPD file import utility for the CUPS PPD Compiler.
6 // Copyright 2007 by Apple Inc.
7 // Copyright 2002-2005 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/".
17 // main() - Main entry for the PPD import utility.
18 // usage() - Show usage and exit.
22 // Include necessary headers...
28 #include <sys/types.h>
35 static void usage(void);
39 // 'main()' - Main entry for the PPD import utility.
42 int // O - Exit status
43 main(int argc
, // I - Number of command-line arguments
44 char *argv
[]) // I - Command-line arguments
47 char *opt
; // Current option
48 const char *srcfile
; // Output file
49 ppdcSource
*src
; // PPD source file data
52 // Scan the command-line...
56 for (i
= 1; i
< argc
; i
++)
57 if (argv
[i
][0] == '-')
59 for (opt
= argv
[i
] + 1; *opt
; opt
++)
62 case 'o' : // Output file
73 case 'I' : // Include dir
78 ppdcSource::add_include(argv
[i
]);
88 // Open and load the driver info file...
94 if (access(srcfile
, 0))
95 src
= new ppdcSource();
97 src
= new ppdcSource(srcfile
);
100 // Import the PPD file...
101 src
->import_ppd(argv
[i
]);
104 // If no drivers have been loaded, display the program usage message.
108 // Write the driver info file back to disk...
109 src
->write_file(srcfile
);
111 // Delete the printer driver information...
114 // Return with no errors.
120 // 'usage()' - Show usage and exit.
126 puts("Usage: ppdi [options] filename.ppd [ ... filenameN.ppd ]");
128 puts(" -I include-dir");
129 puts(" -o filename.drv");