]>
git.ipfire.org Git - thirdparty/cups.git/blob - ppdc/ppdi.cxx
4 // PPD file import utility for the CUPS PPD Compiler.
6 // Copyright 2007-2008 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>
29 #include <cups/i18n.h>
36 static void usage(void);
40 // 'main()' - Main entry for the PPD import utility.
43 int // O - Exit status
44 main(int argc
, // I - Number of command-line arguments
45 char *argv
[]) // I - Command-line arguments
48 char *opt
; // Current option
49 const char *srcfile
; // Output file
50 ppdcSource
*src
; // PPD source file data
55 // Scan the command-line...
59 for (i
= 1; i
< argc
; i
++)
60 if (argv
[i
][0] == '-')
62 for (opt
= argv
[i
] + 1; *opt
; opt
++)
65 case 'o' : // Output file
76 case 'I' : // Include dir
81 ppdcSource::add_include(argv
[i
]);
91 // Open and load the driver info file...
97 if (access(srcfile
, 0))
98 src
= new ppdcSource();
100 src
= new ppdcSource(srcfile
);
103 // Import the PPD file...
104 src
->import_ppd(argv
[i
]);
107 // If no drivers have been loaded, display the program usage message.
111 // Write the driver info file back to disk...
112 src
->write_file(srcfile
);
114 // Delete the printer driver information...
117 // Return with no errors.
123 // 'usage()' - Show usage and exit.
129 _cupsLangPuts(stdout
,
130 _("Usage: ppdi [options] filename.ppd [ ... filenameN.ppd ]\n"
133 " -o filename.drv\n"));