]>
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...
25 #include "ppdc-private.h"
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
54 // Scan the command-line...
58 for (i
= 1; i
< argc
; i
++)
59 if (argv
[i
][0] == '-')
61 for (opt
= argv
[i
] + 1; *opt
; opt
++)
64 case 'o' : // Output file
75 case 'I' : // Include dir
80 ppdcSource::add_include(argv
[i
]);
90 // Open and load the driver info file...
96 if (access(srcfile
, 0))
97 src
= new ppdcSource();
99 src
= new ppdcSource(srcfile
);
102 // Import the PPD file...
103 src
->import_ppd(argv
[i
]);
106 // If no drivers have been loaded, display the program usage message.
110 // Write the driver info file back to disk...
111 src
->write_file(srcfile
);
113 // Delete the printer driver information...
116 // Return with no errors.
122 // 'usage()' - Show usage and exit.
128 _cupsLangPuts(stdout
,
129 _("Usage: ppdi [options] filename.ppd [ ... filenameN.ppd ]\n"
132 " -o filename.drv\n"));