]>
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 // These coded instructions, statements, and computer programs are the
8 // property of Apple Inc. and are protected by Federal copyright
9 // law. Distribution and use rights are outlined in the file "LICENSE.txt"
10 // which should have been included with this file. If this file is
11 // file is missing or damaged, see the license at "http://www.cups.org/".
15 // Include necessary headers...
18 #include "ppdc-private.h"
21 #include <sys/types.h>
28 static void usage(void);
32 // 'main()' - Main entry for the PPD import utility.
35 int // O - Exit status
36 main(int argc
, // I - Number of command-line arguments
37 char *argv
[]) // I - Command-line arguments
40 char *opt
; // Current option
41 const char *srcfile
; // Output file
42 ppdcSource
*src
; // PPD source file data
47 // Scan the command-line...
51 for (i
= 1; i
< argc
; i
++)
52 if (argv
[i
][0] == '-')
54 for (opt
= argv
[i
] + 1; *opt
; opt
++)
57 case 'o' : // Output file
68 case 'I' : // Include dir
73 ppdcSource::add_include(argv
[i
]);
83 // Open and load the driver info file...
89 if (access(srcfile
, 0))
90 src
= new ppdcSource();
92 src
= new ppdcSource(srcfile
);
95 // Import the PPD file...
96 src
->import_ppd(argv
[i
]);
99 // If no drivers have been loaded, display the program usage message.
103 // Write the driver info file back to disk...
104 src
->write_file(srcfile
);
106 // Delete the printer driver information...
109 // Return with no errors.
115 // 'usage()' - Show usage and exit.
121 _cupsLangPuts(stdout
, _("Usage: ppdi [options] filename.ppd [ ... "
123 _cupsLangPuts(stdout
, _("Options:"));
124 _cupsLangPuts(stdout
, _(" -I include-dir Add include directory to "
126 _cupsLangPuts(stdout
, _(" -o filename.drv Set driver information "
127 "file (otherwise ppdi.drv)."));