Imported Upstream version 3.0.2-20060530
Didier Raboud
13 years ago
0 | 0 | /COPYING/3.1/Tue Jan 28 23:01:10 2003//Tfoomatic-3_0-branch |
1 | /ChangeLog/3.99.2.40/Tue Feb 28 11:01:43 2006//Tfoomatic-3_0-branch | |
1 | /ChangeLog/3.99.2.48/Tue May 23 22:46:40 2006//Tfoomatic-3_0-branch | |
2 | 2 | /Foomatic-Devel-Ideas.txt/3.2/Tue Apr 22 23:19:52 2003//Tfoomatic-3_0-branch |
3 | /Makefile.in/3.16.2.3/Fri Jan 28 16:17:13 2005//Tfoomatic-3_0-branch | |
4 | /README/3.26.2.7/Tue Jul 12 23:38:02 2005//Tfoomatic-3_0-branch | |
3 | /Makefile.in/3.16.2.4/Wed Apr 19 23:48:43 2006//Tfoomatic-3_0-branch | |
4 | /README/3.26.2.8/Wed Apr 19 23:48:43 2006//Tfoomatic-3_0-branch | |
5 | 5 | /README.build-foomatic-filters-ppds/3.3.2.1/Sun Mar 28 23:04:51 2004//Tfoomatic-3_0-branch |
6 | 6 | /TODO/3.1/Fri Nov 29 01:31:37 2002//Tfoomatic-3_0-branch |
7 | /USAGE/3.14.2.4/Tue Sep 14 21:08:37 2004//Tfoomatic-3_0-branch | |
7 | /USAGE/3.14.2.5/Wed Apr 19 23:48:43 2006//Tfoomatic-3_0-branch | |
8 | 8 | /acinclude.m4/3.0/Fri Oct 11 01:16:34 2002//Tfoomatic-3_0-branch |
9 | /configure.ac/1.1.2.1/Fri Jan 6 17:37:50 2006//Tfoomatic-3_0-branch | |
9 | /configure.ac/1.1.2.3/Mon May 22 13:56:26 2006//Tfoomatic-3_0-branch | |
10 | 10 | /extract_pjl/3.1/Wed Nov 19 03:23:50 2003//Tfoomatic-3_0-branch |
11 | 11 | /foomatic-addpjloptions.8.in/3.2/Wed Nov 19 03:23:50 2003//Tfoomatic-3_0-branch |
12 | 12 | /foomatic-addpjloptions.in/3.1/Wed Nov 19 03:23:50 2003//Tfoomatic-3_0-branch |
16 | 16 | /foomatic-compiledb.1.in/3.1/Thu Nov 28 02:42:26 2002//Tfoomatic-3_0-branch |
17 | 17 | /foomatic-compiledb.in/3.6.2.2/Sun Oct 23 01:03:45 2005//Tfoomatic-3_0-branch |
18 | 18 | /foomatic-configure.1.in/3.1/Thu Nov 28 02:42:26 2002//Tfoomatic-3_0-branch |
19 | /foomatic-configure.in/3.18.2.9/Tue Feb 28 11:01:43 2006//Tfoomatic-3_0-branch | |
19 | /foomatic-configure.in/3.18.2.11/Sat Apr 22 18:40:43 2006//Tfoomatic-3_0-branch | |
20 | 20 | /foomatic-filters-ppds-README/3.1/Sun Feb 23 07:14:18 2003//Tfoomatic-3_0-branch |
21 | 21 | /foomatic-filters-ppds-install/3.1/Sun Feb 23 07:14:18 2003//Tfoomatic-3_0-branch |
22 | 22 | /foomatic-fix-xml.in/3.0/Fri Oct 11 01:16:34 2002//Tfoomatic-3_0-branch |
30 | 30 | /foomatic-ppd-options.1.in/3.1/Wed Nov 19 03:23:50 2003//Tfoomatic-3_0-branch |
31 | 31 | /foomatic-ppd-options.in/3.2/Wed Nov 19 03:41:29 2003//Tfoomatic-3_0-branch |
32 | 32 | /foomatic-ppdfile.1.in/3.2/Wed Nov 19 03:23:50 2003//Tfoomatic-3_0-branch |
33 | /foomatic-ppdfile.in/3.4.2.4/Sun Oct 23 00:43:39 2005//Tfoomatic-3_0-branch | |
33 | /foomatic-ppdfile.in/3.4.2.7/Mon May 22 11:49:27 2006//Tfoomatic-3_0-branch | |
34 | 34 | /foomatic-preferred-driver.8.in/3.0/Fri Oct 11 01:16:34 2002//Tfoomatic-3_0-branch |
35 | 35 | /foomatic-preferred-driver.in/3.3.2.1/Sun Mar 28 23:04:51 2004//Tfoomatic-3_0-branch |
36 | 36 | /foomatic-printermap-to-gimp-print-xml.in/1.1.2.2/Sun Mar 28 23:04:51 2004//Tfoomatic-3_0-branch |
41 | 41 | /gsQuit/3.1/Wed Nov 19 03:23:50 2003//Tfoomatic-3_0-branch |
42 | 42 | /gsTest/3.1/Wed Nov 19 03:23:50 2003//Tfoomatic-3_0-branch |
43 | 43 | /install-sh/3.0/Fri Oct 11 01:16:34 2002//Tfoomatic-3_0-branch |
44 | /makeDefaults.in/3.3.2.1/Fri Jan 28 12:39:36 2005//Tfoomatic-3_0-branch | |
44 | /makeDefaults.in/3.3.2.2/Wed Apr 19 23:48:43 2006//Tfoomatic-3_0-branch | |
45 | 45 | /makeMan.in/3.1/Thu Jun 26 13:28:24 2003//Tfoomatic-3_0-branch |
46 | 46 | /make_configure/3.0/Fri Oct 11 01:16:34 2002//Tfoomatic-3_0-branch |
47 | 47 | /mkinstalldirs/3.1/Wed Nov 19 03:23:50 2003//Tfoomatic-3_0-branch |
0 | 2006-05-23 Till Kamppeter <till.kamppeter@gmx.net> | |
1 | ||
2 | * lib/Foomatic/DB.pm: Eliminated a warning. | |
3 | ||
4 | 2006-05-22 Till Kamppeter <till.kamppeter@gmx.net> | |
5 | ||
6 | * configure.ac: Do never use CUPS commands "enable-cups", | |
7 | "disable-cups", "accept-cups", "reject-cups", even if | |
8 | executable files with these names are available. CUPS has only | |
9 | one executable for these tasks and recognizes by the | |
10 | executable/link name what to do. So it only accepts execution | |
11 | with one of the names "enable", "disable", "accept", "reject". | |
12 | ||
13 | * lib/Foomatic/DB.pm: When generating PPD files from Foomatic | |
14 | XML data and the option XML files contain "<arg_order>" tags | |
15 | with different values, the options get ordered by the | |
16 | "<arg_order>" values (within their group). This way manually | |
17 | defining the presentation order of the options gets possible. | |
18 | Fixed also a buglet in the setting of the default of numerical | |
19 | options. | |
20 | ||
21 | * foomatic-ppdfile.in: Removed "use strict;" due to an | |
22 | incompatibility with the "getopts()" Perl function. | |
23 | ||
24 | 2006-05-20 Till Kamppeter <till.kamppeter@gmx.net> | |
25 | ||
26 | * lib/Foomatic/DB.pm: Improved group name parsing in the PPD | |
27 | files, now the group names of the Gutenprint CUPS raster | |
28 | PPDs are read out correctly. Do not sort the options any more | |
29 | when reading PPD files. | |
30 | ||
31 | 2006-05-19 Till Kamppeter <till.kamppeter@gmx.net> | |
32 | ||
33 | * foomatic-ppdfile.in: Let PPD file generation with cups-driverd | |
34 | also work if the driver name contains dashes (as in Gutenprint), | |
35 | added "use strict;", let debug output and error messages have | |
36 | prefixes to be correctly categorized in the CUPS error_log. | |
37 | ||
38 | 2006-04-22 Till Kamppeter <till.kamppeter@gmx.net> | |
39 | ||
40 | * foomatic-configure.in: Added support for reading additional items | |
41 | from the /etc/cups/printers.conf file: Print quotas, individual, | |
42 | printer sharing, error and operation policies. | |
43 | ||
44 | 2006-04-21 Till Kamppeter <till.kamppeter@gmx.net> | |
45 | ||
46 | * lib/Foomatic/DB.pm: Eliminated some warnings | |
47 | ||
48 | * foomatic-configure.in: Added new URIs to URI overview in | |
49 | header comments, let beh wrapper backend also not be | |
50 | applied to HPLIP fax queues (URI: "hpfax:/..."). | |
51 | ||
52 | 2006-04-19 Till Kamppeter <till.kamppeter@gmx.net> | |
53 | ||
54 | * foomatic-ppdfile.in, lib/Foomatic/DB.pm, configure.ac, | |
55 | Makefile.in, makeDefaults.in, USAGE, README: Added support for | |
56 | on-the-fly PPD file generation by the CUPS 1.2 cups-driverd. | |
57 | ||
58 | * USAGE: Update HPOJ -> HPLIP. | |
59 | ||
0 | 60 | 2006-02-28 Till Kamppeter <till.kamppeter@gmx.net> |
1 | 61 | |
2 | 62 | * foomatic-configure.in: Treat a missing /etc/cups/printers.conf |
0 | 0 | |
1 | 1 | # Makefile to install foomatic-db-engine |
2 | # $Revision: 3.16.2.3 $ | |
2 | # $Revision: 3.16.2.4 $ | |
3 | 3 | |
4 | 4 | # PREFIX defaults to /usr/local for manually installed progs, so that they |
5 | 5 | # are not messed up on a system upgrade. |
85 | 85 | CUPS_PPDS=@CUPS_PPDS@ |
86 | 86 | CUPS_FILTERS=@CUPS_FILTERS@ |
87 | 87 | CUPS_BACKENDS=@CUPS_BACKENDS@ |
88 | LIB_CUPS=@LIB_CUPS@ | |
89 | CUPS_DRIVER=@LIB_CUPS@/driver | |
88 | 90 | CUPS_PCONF=@CUPS_PCONF@ |
89 | 91 | CUPS_LPR=@CUPS_LPR@ |
90 | 92 | CUPS_LPQ=@CUPS_LPQ@ |
199 | 201 | # Link to allow foomatic-ppdfile be called under the old name |
200 | 202 | # foomatic-datafile |
201 | 203 | ln -sf foomatic-ppdfile $(DESTDIR)$(BINDIR)/foomatic-datafile |
204 | # Link foomatic-ppdfile to the CUPS 1.2 PPD generator directory, | |
205 | # so that the cups-driverd automatically generates Foomatic PPDs | |
206 | # on demand (/usr/lib/cups/driver). | |
207 | if [ -d $(LIB_CUPS) ]; then \ | |
208 | ${SRC}/mkinstalldirs $(DESTDIR)$(CUPS_DRIVER); \ | |
209 | ln -sf $(BINDIR)/foomatic-ppdfile $(DESTDIR)$(CUPS_DRIVER)/foomatic; \ | |
210 | fi | |
202 | 211 | |
203 | 212 | install-man: check-config |
204 | 213 | ${SRC}/mkinstalldirs $(DESTDIR)$(MANDIR) |
387 | 387 | Foomatic database and not the one from the IEEE-1284 auto-detection |
388 | 388 | ID string for the "*Manufacturer: ..." tag of the PPD files, as in |
389 | 389 | the IDs the manufacturer names often do not comply with the Adobe |
390 | specs (as "Hewlett-Packard", "HP" has to be used. | |
390 | specs (as "Hewlett-Packard", "HP" has to be used). | |
391 | ||
392 | Implemented after 3.0.2: | |
393 | ||
394 | - Support for on-the-fly PPD generation by CUPS 1.2. Now all Foomatic PPDs | |
395 | appear in the model lists of the CUPS web interface without needing to | |
396 | pre-compile the PPDs. The PPDs get actually generated if one selects | |
397 | them for the new print queue to be set up. | |
391 | 398 | |
392 | 399 | Planned/Roadmap for future releases: |
393 | 400 |
222 | 222 | A default spooler can be set by putting its name into an |
223 | 223 | /etc/foomatic/defaultspooler file or into ~/.defaultspooler |
224 | 224 | |
225 | If you have a multi-function device from HP, install HPOJ from | |
226 | ||
227 | http://hpoj.sourceforge.net/ | |
228 | ||
229 | before starting to set up printer queues with Foomatic. This is needed | |
230 | for printing on USB devices and for scanning and photo memory card | |
231 | access on all devices. If you use CUPS 1.1.12 or newer together with | |
232 | the old HPOJ 0.8, you need also the latest "ptal" backend script from | |
233 | ||
234 | http://www.hornclan.com/~mark/cups/ | |
235 | ||
236 | License information and installation instructions for this script you | |
237 | find in the beginning of the script itself. See also the end of the | |
238 | "Adding a queue" section in this file to see how to use this script. | |
239 | ||
240 | The "ptal" backend script is already included in HPOJ 0.9. | |
225 | If you have a printer or multi-function device from HP, install HPLIP from | |
226 | ||
227 | http://hpinkjet.sourceforge.net/ | |
228 | ||
229 | before starting to set up printer queues with Foomatic. This gives you | |
230 | the possibility to access all extra functions of your HP device, | |
231 | independent whether it is connected via parallel port, USB, or | |
232 | ethernet. This gives you, depending on the device, functionality, as | |
233 | ink/toner level check, nozzle check and cleaning, color adjustment, | |
234 | head alignement, scanning, memory card access, and even sending faxes. | |
241 | 235 | |
242 | 236 | Printing through the MTink daemon from the MTink package |
243 | 237 | (http://xwtools.automatix.de/) is also supported. When CUPS is the |
245 | 239 | will be used. Using the MTink daemon it is possible to check the ink |
246 | 240 | levels while printing. The MTink daemon supports only Epson inkjets |
247 | 241 | from the Epson Stylus Color 740 on to the current models. |
242 | ||
243 | ||
244 | Easy printer setup with CUPS 1.2 | |
245 | -------------------------------- | |
246 | ||
247 | If you have CUPS 1.2 or newer, you do not need the command line to | |
248 | set up printers with Foomatic. Simply fire up the web interface entering | |
249 | ||
250 | http://localhost:631/ | |
251 | ||
252 | and click the "Administration" tab. Then click the "Add this printer" at | |
253 | the entry of an auto-detected printer (parallel, USB, ethernet) or click | |
254 | "Add printer" at the top. Follow the instructions on the following pages. | |
255 | ||
256 | If the printers of the Foomatic database do not appear, check whether the | |
257 | link to foomatic-ppdfile is in /usr/lib/cups/driver: | |
258 | ||
259 | lrwxrwxrwx 1 root root 25 Apr 19 18:13 foomatic -> /usr/bin/foomatic-ppdfile | |
260 | ||
261 | If not, create it manually. | |
262 | ||
263 | If you want the web interface only list entries for the recommended | |
264 | driver for each printer, create a file /etc/cups/foomatic.conf | |
265 | containing the line | |
266 | ||
267 | OnlyRecommended Yes | |
268 | ||
269 | Note: CUPS paths may be different on your system. | |
270 | ||
248 | 271 | |
249 | 272 | |
250 | 273 | Adding a queue |
305 | 328 | /dev/usb/lp1, ..., so we are |
306 | 329 | compatible to older versions of |
307 | 330 | Foomatic. |
331 | hp:/<device name> : HP printer used with the low-level | |
332 | driver HPLIP (see | |
333 | http://hpinkjet.sourceforge.net/). The | |
334 | device name is name assigned to the | |
335 | device by the HPLIP system, Run | |
336 | "lpinfo -v" to see valid URIs (works | |
337 | only with CUPS). | |
308 | 338 | ptal:/<device name> : HP multi-function device used with |
309 | 339 | the low-level driver HPOJ (see |
310 | 340 | http://hpoj.sourceforge.net/). The |
311 | 341 | device name is name assigned to the |
312 | 342 | device by the ptal-mlcd daemon, for |
313 | example "mlc:usb:PSC_950". | |
343 | example "mlc:usb:PSC_950" (Obsolete, | |
344 | but still working). | |
314 | 345 | mtink:/<device name> : Epson Stylus Color, Photo, Pro, |
315 | 346 | or Scan inkjet printer used through |
316 | 347 | the mtink daemon. <device name> |
456 | 487 | |
457 | 488 | foomatic-configure -s lpd -n remoteraw -c socket://192.168.1.234:9100/ |
458 | 489 | |
459 | If you want to print on a multi-function device from HP you should use | |
460 | the low-level driver HPOJ (http://hpoj.sourceforge.net/) so that you | |
461 | are also able to scan or to access memory cards. For many USB devices | |
462 | you need HPOJ even when you only want to print. To set up a queue, set | |
463 | up HPOJ first and then look for the HPOJ device for your printer. You | |
464 | get a list of all configured (with "ptal-init setup") devices with "ls | |
465 | /etc/ptal" (users of HPOJ 0.8 find the device name in /etc/ptal-start.conf | |
466 | in the line starting with "ptal-printd"). | |
467 | ||
468 | The device name is for example "mlc:usb:PSC_950" for an HP PSC 950 | |
469 | connected via USB. To set up a queue for this printer under CUPS you | |
470 | have to enter: | |
471 | ||
472 | foomatic-configure -s cups -n PSC950 -c ptal:/mlc:usb:PSC_950 | |
473 | -p HP-PSC_950 -d hpijs -o PageSize=A4 | |
474 | ||
475 | If you use CUPS 1.1.12 and newer, you need the most recent "ptal" | |
476 | backend script, which is either part of HPOJ (0.9 or newer) or | |
477 | separately downloadable from | |
478 | ||
479 | http://www.hornclan.com/~mark/cups/ | |
480 | ||
481 | (use the "File"/"Save as ..." function of your browser to get it onto | |
482 | your hard disk). Foolow the instructions in the beginning of the file | |
483 | to install it. | |
484 | ||
485 | After installing HPOJ and/or "ptal" and configuring your printer with | |
486 | "ptal-init setup" restart the CUPS daemon and ONLY NOW set up your | |
487 | printer queue, foomatic-configure will then auto-detect the "ptal" | |
488 | script and make use of it. | |
489 | 490 | |
490 | 491 | |
491 | 492 | Modifying a queue |
3976 | 3976 | ;; |
3977 | 3977 | *) |
3978 | 3978 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR |
3979 | as_dummy="SBB" | |
3980 | for as_dir in $as_dummy | |
3979 | for as_dir in $SBB | |
3981 | 3980 | do |
3982 | 3981 | IFS=$as_save_IFS |
3983 | 3982 | test -z "$as_dir" && as_dir=. |
4315 | 4314 | done |
4316 | 4315 | test -n "$CUPS_BACKENDS" || CUPS_BACKENDS="/usr/lib/cups/backend" |
4317 | 4316 | |
4317 | for ac_dir in cups | |
4318 | do | |
4319 | # Extract the first word of "$ac_dir", so it can be a program name with args. | |
4320 | set dummy $ac_dir; ac_word=$2 | |
4321 | echo "$as_me:$LINENO: checking for $ac_word/" >&5 | |
4322 | echo $ECHO_N "checking for $ac_word/... $ECHO_C" >&6 | |
4323 | if test "${ac_cv_path_LIB_CUPS+set}" = set; then | |
4324 | echo $ECHO_N "(cached) $ECHO_C" >&6 | |
4325 | else | |
4326 | case "$LIB_CUPS" in | |
4327 | /*) | |
4328 | ac_cv_path_LIB_CUPS="$LIB_CUPS" # Let the user override the test with a path. | |
4329 | ;; | |
4330 | ?:/*) | |
4331 | ac_cv_path_LIB_CUPS="$LIB_CUPS" # Let the user override the test with a dos path. | |
4332 | ;; | |
4333 | *) | |
4334 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" | |
4335 | ac_dummy="$LIBSEARCHPATH" | |
4336 | for ac_dir in $ac_dummy; do | |
4337 | test -z "$ac_dir" && ac_dir=. | |
4338 | if test -d $ac_dir/$ac_word; then | |
4339 | ac_cv_path_LIB_CUPS="$ac_dir/$ac_word" | |
4340 | break | |
4341 | fi | |
4342 | done | |
4343 | IFS="$ac_save_ifs" | |
4344 | ;; | |
4345 | esac | |
4346 | fi | |
4347 | LIB_CUPS="$ac_cv_path_LIB_CUPS" | |
4348 | if test -n "$LIB_CUPS"; then | |
4349 | echo "$as_me:$LINENO: result: $LIB_CUPS" >&5 | |
4350 | echo "${ECHO_T}$LIB_CUPS" >&6 | |
4351 | else | |
4352 | echo "$as_me:$LINENO: result: no" >&5 | |
4353 | echo "${ECHO_T}no" >&6 | |
4354 | fi | |
4355 | ||
4356 | test -n "$LIB_CUPS" && break | |
4357 | done | |
4358 | test -n "$LIB_CUPS" || LIB_CUPS="/usr/lib/cups" | |
4359 | ||
4318 | 4360 | for ac_prog in cups/printers.conf |
4319 | 4361 | do |
4320 | 4362 | # Extract the first word of "$ac_prog", so it can be a program name with args. |
4510 | 4552 | ;; |
4511 | 4553 | *) |
4512 | 4554 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR |
4513 | as_dummy="SBB" | |
4514 | for as_dir in $as_dummy | |
4555 | for as_dir in $SBB | |
4515 | 4556 | do |
4516 | 4557 | IFS=$as_save_IFS |
4517 | 4558 | test -z "$as_dir" && as_dir=. |
4631 | 4672 | done |
4632 | 4673 | test -n "$CUPS_CANCEL" || CUPS_CANCEL="/usr/bin/cancel" |
4633 | 4674 | |
4634 | for ac_prog in enable-cups enable | |
4675 | for ac_prog in enable | |
4635 | 4676 | do |
4636 | 4677 | # Extract the first word of "$ac_prog", so it can be a program name with args. |
4637 | 4678 | set dummy $ac_prog; ac_word=$2 |
4676 | 4717 | done |
4677 | 4718 | test -n "$CUPS_ENABLE" || CUPS_ENABLE="/usr/bin/enable" |
4678 | 4719 | |
4679 | for ac_prog in disable-cups disable | |
4720 | for ac_prog in disable | |
4680 | 4721 | do |
4681 | 4722 | # Extract the first word of "$ac_prog", so it can be a program name with args. |
4682 | 4723 | set dummy $ac_prog; ac_word=$2 |
4721 | 4762 | done |
4722 | 4763 | test -n "$CUPS_DISABLE" || CUPS_DISABLE="/usr/bin/disable" |
4723 | 4764 | |
4724 | for ac_prog in accept-cups accept | |
4765 | for ac_prog in accept | |
4725 | 4766 | do |
4726 | 4767 | # Extract the first word of "$ac_prog", so it can be a program name with args. |
4727 | 4768 | set dummy $ac_prog; ac_word=$2 |
4736 | 4777 | ;; |
4737 | 4778 | *) |
4738 | 4779 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR |
4739 | as_dummy="SBB" | |
4740 | for as_dir in $as_dummy | |
4780 | for as_dir in $SBB | |
4741 | 4781 | do |
4742 | 4782 | IFS=$as_save_IFS |
4743 | 4783 | test -z "$as_dir" && as_dir=. |
4767 | 4807 | done |
4768 | 4808 | test -n "$CUPS_ACCEPT" || CUPS_ACCEPT="/usr/sbin/accept" |
4769 | 4809 | |
4770 | for ac_prog in reject-cups reject | |
4810 | for ac_prog in reject | |
4771 | 4811 | do |
4772 | 4812 | # Extract the first word of "$ac_prog", so it can be a program name with args. |
4773 | 4813 | set dummy $ac_prog; ac_word=$2 |
4782 | 4822 | ;; |
4783 | 4823 | *) |
4784 | 4824 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR |
4785 | as_dummy="SBB" | |
4786 | for as_dir in $as_dummy | |
4825 | for as_dir in $SBB | |
4787 | 4826 | do |
4788 | 4827 | IFS=$as_save_IFS |
4789 | 4828 | test -z "$as_dir" && as_dir=. |
4828 | 4867 | ;; |
4829 | 4868 | *) |
4830 | 4869 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR |
4831 | as_dummy="SBB" | |
4832 | for as_dir in $as_dummy | |
4870 | for as_dir in $SBB | |
4833 | 4871 | do |
4834 | 4872 | IFS=$as_save_IFS |
4835 | 4873 | test -z "$as_dir" && as_dir=. |
6575 | 6613 | s,@CUPS_PPDS@,$CUPS_PPDS,;t t |
6576 | 6614 | s,@CUPS_FILTERS@,$CUPS_FILTERS,;t t |
6577 | 6615 | s,@CUPS_BACKENDS@,$CUPS_BACKENDS,;t t |
6616 | s,@LIB_CUPS@,$LIB_CUPS,;t t | |
6578 | 6617 | s,@CUPS_PCONF@,$CUPS_PCONF,;t t |
6579 | 6618 | s,@CUPS_LPR@,$CUPS_LPR,;t t |
6580 | 6619 | s,@CUPS_LPQ@,$CUPS_LPQ,;t t |
223 | 223 | AC_PATH_PROGS(LPD_LPR,lpr-lpd lpr-lprng lpr-lpr lpr,/usr/bin/lpr,$BINSEARCHPATH) |
224 | 224 | AC_PATH_PROGS(LPD_LPQ,lpq-lpd lpq-lprng lpq-lpr lpq,/usr/bin/lpq,$BINSEARCHPATH) |
225 | 225 | AC_PATH_PROGS(LPD_LPRM,lprm-lpd lprm-lprng lprm-lpr lprm,/usr/bin/lprm,$BINSEARCHPATH) |
226 | AC_PATH_PROGS(LPD_LPC,lpc-lpd lpc-lprng lpc-lpr lpc,/usr/sbin/lpc,SBB) | |
226 | AC_PATH_PROGS(LPD_LPC,lpc-lpd lpc-lprng lpc-lpr lpc,/usr/sbin/lpc,$SBB) | |
227 | 227 | AC_PATH_PROGS(LPRNG_CHECKPC,checkpc,/usr/sbin/checkpc,$SBINSEARCHPATH) |
228 | 228 | |
229 | 229 | dnl Paths and other settings for CUPS |
233 | 233 | AC_PATH_DIRS(CUPS_PPDS,cups/model,/usr/share/cups/model,$DATASEARCHPATH) |
234 | 234 | AC_PATH_DIRS(CUPS_FILTERS,cups/filter,/usr/lib/cups/filter,$DATASEARCHPATH) |
235 | 235 | AC_PATH_DIRS(CUPS_BACKENDS,cups/backend,/usr/lib/cups/backend,$DATASEARCHPATH) |
236 | AC_PATH_DIRS(LIB_CUPS,cups,/usr/lib/cups,$LIBSEARCHPATH) | |
236 | 237 | AC_PATH_PROGS(CUPS_PCONF,cups/printers.conf,$CUPS_ETC/printers.conf,$SYSCONFSEARCHPATH) |
237 | 238 | AC_PATH_PROGS(CUPS_LPR,lpr-cups lpr,/usr/bin/lpr,$BINSEARCHPATH) |
238 | 239 | AC_PATH_PROGS(CUPS_LPQ,lpq-cups lpq,/usr/bin/lpq,$BINSEARCHPATH) |
239 | 240 | AC_PATH_PROGS(CUPS_LPRM,lprm-cups lprm,/usr/bin/lprm,$BINSEARCHPATH) |
240 | AC_PATH_PROGS(CUPS_LPC,lpc-cups lpc,/usr/sbin/lpc,SBB) | |
241 | AC_PATH_PROGS(CUPS_LPC,lpc-cups lpc,/usr/sbin/lpc,$SBB) | |
241 | 242 | AC_PATH_PROGS(CUPS_LP,lp-cups lp,/usr/bin/lp,$BINSEARCHPATH) |
242 | 243 | AC_PATH_PROGS(CUPS_CANCEL,cancel-cups cancel,/usr/bin/cancel,$BSB) |
243 | AC_PATH_PROGS(CUPS_ENABLE,enable-cups enable,/usr/bin/enable,$BSB) | |
244 | AC_PATH_PROGS(CUPS_DISABLE,disable-cups disable,/usr/bin/disable,$BSB) | |
245 | AC_PATH_PROGS(CUPS_ACCEPT,accept-cups accept,/usr/sbin/accept,SBB) | |
246 | AC_PATH_PROGS(CUPS_REJECT,reject-cups reject,/usr/sbin/reject,SBB) | |
247 | AC_PATH_PROGS(CUPS_LPMOVE,lpmove,/usr/sbin/lpmove,SBB) | |
244 | AC_PATH_PROGS(CUPS_ENABLE,enable,/usr/bin/enable,$BSB) | |
245 | AC_PATH_PROGS(CUPS_DISABLE,disable,/usr/bin/disable,$BSB) | |
246 | AC_PATH_PROGS(CUPS_ACCEPT,accept,/usr/sbin/accept,$SBB) | |
247 | AC_PATH_PROGS(CUPS_REJECT,reject,/usr/sbin/reject,$SBB) | |
248 | AC_PATH_PROGS(CUPS_LPMOVE,lpmove,/usr/sbin/lpmove,$SBB) | |
248 | 249 | AC_PATH_PROGS(CUPS_LPOPTIONS,lpoptions,/usr/bin/lpoptions,$BINSEARCHPATH) |
249 | 250 | AC_PATH_PROGS(CUPS_LPINFO,lpinfo,/usr/sbin/lpinfo,$SBINSEARCHPATH) |
250 | 251 |
29 | 29 | # parallel:/path/device # Local parallel printer |
30 | 30 | # serial:/path/device # Local serial printer |
31 | 31 | # file:/path/file # includes usb, lp, named pipes, other |
32 | # ptal:/provider:bus:name # HPOJ MLC protocol (hpoj.sourceforge.net) | |
32 | # hp:/bus/model?serial=xxx # HPLIP print queue (hpinkjet.sf.net) | |
33 | # hpfax:/bus/model?serial=xxx # HPLIP fax queue (hpinkjet.sf.net) | |
34 | # ptal:/provider:bus:name # HPOJ MLC protocol (hpoj.sf.net,obsolete) | |
33 | 35 | # mtink:/path/device # Epson inkjet through mtink daemon |
34 | 36 | # # (for ink level monitoring when printing, |
35 | 37 | # # http://xwtools.automatix.de/) |
36 | 38 | # lpd://host/queue # LPD protocol |
39 | # lpd://host # LPD protocol (default queue, CUPS only) | |
37 | 40 | # socket://host:port # TCP aka appsocket |
41 | # socket://host # TCP aka appsocket (port 9100) | |
38 | 42 | # ncp://user:pass@host/queue # Netware (LPD, LPRng, direct) |
39 | 43 | # smb://user:pass@wgrp/host/queue # Windows (CUPS, PPR, LPD, LPRng, direct) |
40 | 44 | # stdout # Standard output (direct) |
1277 | 1281 | # using the HPLIP ("hp") backend, as otherwise the "hp-toolbox" |
1278 | 1282 | # will not list the printer any more. HPLIP does infinite retries |
1279 | 1283 | # in 30-sec intervals anyway. |
1280 | if (($cupsuri) && ($cupsuri !~ m!^hp:/!) && | |
1284 | if (($cupsuri) && ($cupsuri !~ m!^hp(fax|):/!) && | |
1281 | 1285 | (($config->{'dd'} != 0) || ($config->{'att'} != 1))) { |
1282 | 1286 | $cupsuri = sprintf("beh:/%d/%d/%d/%s", |
1283 | 1287 | $config->{'dd'}, $config->{'att'}, |
2746 | 2750 | ($c->{'spooler'} eq "cups" ? |
2747 | 2751 | (_tag('dontdisable',$c->{'dd'}), |
2748 | 2752 | _tag('attempts',$c->{'att'}), |
2749 | _tag('delay',$c->{'delay'})) : ()), | |
2750 | ||
2753 | _tag('delay',$c->{'delay'}), | |
2754 | (defined($c->{'quotaperiod'}) ? | |
2755 | _tag('quotaperiod',$c->{'quotaperiod'}) : ()), | |
2756 | (defined($c->{'pagelimit'}) ? | |
2757 | _tag('pagelimit',$c->{'pagelimit'}) : ()), | |
2758 | (defined($c->{'klimit'}) ? | |
2759 | _tag('klimit',$c->{'klimit'}) : ()), | |
2760 | (defined($c->{'laststatechange'}) ? | |
2761 | _tag('laststatechange',$c->{'laststatechange'}) : ()), | |
2762 | (defined($c->{'shared'}) ? | |
2763 | _tag('shared',$c->{'shared'}) : ()), | |
2764 | (defined($c->{'operationpolicy'}) ? | |
2765 | _tag('operationpolicy',$c->{'operationpolicy'}) : ()), | |
2766 | (defined($c->{'errorpolicy'}) ? | |
2767 | _tag('errorpolicy',$c->{'errorpolicy'}) : ())) : ()), | |
2751 | 2768 | "</queue>\n"; |
2752 | 2769 | |
2753 | 2770 | return; |
3730 | 3747 | $uri = "mtink:/$1"; |
3731 | 3748 | } |
3732 | 3749 | $c->{'connect'} = $uri; |
3750 | # CUPS-specific extra info | |
3751 | $c->{'quotaperiod'} = $p->{'QuotaPeriod'} | |
3752 | if defined($p->{'QuotaPeriod'}); | |
3753 | $c->{'pagelimit'} = $p->{'PageLimit'} | |
3754 | if defined($p->{'PageLimit'}); | |
3755 | $c->{'klimit'} = $p->{'KLimit'} | |
3756 | if defined($p->{'KLimit'}); | |
3757 | # CUPS 1.2-specific settings | |
3758 | $c->{'laststatechange'} = $p->{'StateTime'} | |
3759 | if defined($p->{'StateTime'}); | |
3760 | $c->{'shared'} = $p->{'Shared'} | |
3761 | if defined($p->{'Shared'}); | |
3762 | $c->{'operationpolicy'} = $p->{'OpPolicy'} | |
3763 | if defined($p->{'OpPolicy'}); | |
3764 | $c->{'errorpolicy'} = $p->{'ErrorPolicy'} | |
3765 | if defined($p->{'ErrorPolicy'}); | |
3733 | 3766 | $dat->{'queuedata'} = $c; |
3734 | 3767 | } |
3735 | 3768 | if (!defined($dat->{'queuedata'})) {$dat = undef}; |
0 | 0 | #!@PERL@ |
1 | 1 | # -*- perl -*- |
2 | ||
3 | # Foomatic PPD file generator for manual PPD generation (via "-p", | |
4 | # "-d", "-A", and "-P" command line options) or for automatic | |
5 | # on-the-fly PPD generation by CUPS 1.2 or newer (via "cat" and "list" | |
6 | # command line options). | |
7 | ||
2 | 8 | use Foomatic::Defaults; |
3 | 9 | use Foomatic::DB; |
4 | 10 | use Getopt::Std; |
5 | 11 | use Data::Dumper; |
6 | ||
7 | help if !@ARGV ; | |
8 | getopts("AP:d:p:hwt:") || help(); | |
12 | #use strict; | |
13 | ||
14 | my $debug = 0; | |
15 | ||
16 | # Use program name as the first part of the PPD URI for CUPS (should be | |
17 | # "foomatic"). | |
18 | $0 =~ m!/([^/]+)\s*$!; | |
19 | my $progname = ($1 || $0); | |
20 | ||
21 | # Default settings for listing PPDs by cups-driverd | |
22 | ||
23 | # List only the PPD file with the reconmmended driver for each printer | |
24 | # and do not show "(recommended)" in the CUPS web interface. This mode | |
25 | # makes CUPS setup with the web interface very easy for beginners. | |
26 | # This can be set by "OnlyRecommended Yes" or "OnlyRecommended No" in | |
27 | # /etc/cups/foomatic.conf | |
28 | my $onlyrecommended = 0; | |
29 | ||
30 | help() if !@ARGV; | |
31 | #my ($opt_h, $opt_d, $opt_p, $opt_A, $opt_P, $opt_w); | |
32 | getopts("AP:d:p:hwt:"); | |
9 | 33 | help() if $opt_h; |
10 | my $driver = $opt_d; | |
34 | my $drv = $opt_d; | |
11 | 35 | my $poid = $opt_p; |
12 | 36 | my $showall = $opt_A; |
13 | 37 | my $showmatch = $opt_P; |
14 | my $debug = 0; | |
15 | ||
16 | my $db = Foomatic::DB->new(); | |
17 | $db->get_overview(); | |
18 | my $printer; | |
19 | my @drivers = $db->get_driverlist(); | |
20 | if( $showall or $showmatch ){ | |
21 | for $printer (@{$db->{'overview'}}) { | |
38 | help() if ($#ARGV > 1) && !($poid); | |
39 | ||
40 | if ($ARGV[0] =~ /^list$/i) { | |
41 | # List all available PPD files (format for cups-driverd) | |
42 | cupslistppds(); | |
43 | } elsif ($ARGV[0] =~ /^cat$/i) { | |
44 | # Generate and return the selected PPD file (cups-driverd command line) | |
45 | generateppd($ARGV[1]); | |
46 | } elsif ($showall or $showmatch) { | |
47 | # List all PPD files or files matching regexp (manual operation) | |
48 | foomaticlistppds($showmatch); | |
49 | } elsif ($poid) { | |
50 | # Generate and return the selected PPD file (manual operation) | |
51 | generateppd($poid, $drv); | |
52 | } else { | |
53 | help(); | |
54 | } | |
55 | ||
56 | exit(0); | |
57 | ||
58 | sub cupslistppds { | |
59 | my $db = Foomatic::DB->new(); | |
60 | $db->get_overview(); | |
61 | ||
62 | # Read configuration in /etc/cups/foomatic.conf | |
63 | my $conffilename; | |
64 | if (my $cupsserverroot = $ENV{CUPS_SERVERROOT}) { | |
65 | $conffilename = "$cupsserverroot/foomatic.conf"; | |
66 | } else { | |
67 | $conffilename = "/etc/cups/foomatic.conf"; | |
68 | } | |
69 | if (-r $conffilename and | |
70 | open CONF, "< $conffilename") { | |
71 | while (my $line = <CONF>) { | |
72 | chomp $line; | |
73 | if ($line =~ | |
74 | /^\s*OnlyRecommended\s+(Yes|On|True|1)\s*$/i) { | |
75 | $onlyrecommended = 1; | |
76 | } elsif ($line =~ | |
77 | /^\s*OnlyRecommended\s+(No|Off|False|0)\s*$/i) { | |
78 | $onlyrecommended = 0; | |
79 | } | |
80 | } | |
81 | close CONF; | |
82 | } | |
83 | ||
84 | for my $printer (@{$db->{'overview'}}) { | |
85 | my $poid = $printer->{'id'}; | |
86 | my $make = $printer->{'make'}; | |
87 | my $model = $printer->{'model'}; | |
88 | my $recdriver = $printer->{'driver'}; | |
89 | my @drivers = @{$printer->{'drivers'}}; | |
90 | my $id = $printer->{'ieee'}; | |
91 | ||
92 | # No drivers => No PPDs | |
93 | next if $#drivers < 0; | |
94 | ||
95 | # Put the reconmmended driver to the beginning of list, as CUPS | |
96 | # probably will take the first PPD which matches the printer model | |
97 | my @sorteddrivers; | |
98 | if (Foomatic::DB::member($recdriver, @drivers)) { | |
99 | # Valid entry for the recommended driver | |
100 | push(@sorteddrivers, $recdriver); | |
101 | if (!$onlyrecommended) { | |
102 | foreach my $driver (@drivers) { | |
103 | push(@sorteddrivers, $driver) if $driver ne $recdriver; | |
104 | } | |
105 | } | |
106 | } else { | |
107 | # Invalid entry for the recommended driver | |
108 | next if $onlyrecommended; | |
109 | undef $recdriver; | |
110 | @sorteddrivers = @drivers; | |
111 | } | |
112 | ||
113 | # Go through all the drivers and list the PPD entries | |
114 | foreach my $driver (@sorteddrivers) { | |
115 | # Get PPD header data from the PPD file generator | |
116 | my ($ieee1284,$pnpmake,$pnpmodel,$filename,$longname, | |
117 | $drivername,$nickname,$modelname) = | |
118 | Foomatic::DB::getppdheaderdata($printer, $driver, | |
119 | ($onlyrecommended ? '' : | |
120 | $printer->{'driver'})); | |
121 | print "\"$progname:$longname\" en \"$make\" \"$nickname\" \"$ieee1284\"\n"; | |
122 | } | |
123 | } | |
124 | } | |
125 | ||
126 | sub foomaticlistppds { | |
127 | ||
128 | my ($match) = @_; | |
129 | ||
130 | my $db = Foomatic::DB->new(); | |
131 | $db->get_overview(); | |
132 | my @drivers = $db->get_driverlist(); | |
133 | ||
134 | for my $printer (@{$db->{'overview'}}) { | |
22 | 135 | my $pr = $printer->{'make'}; |
23 | 136 | my $model = $printer->{'model'}; |
24 | 137 | my $name = "$pr $model"; |
31 | 144 | $dlist .= "$d "; |
32 | 145 | } |
33 | 146 | } |
34 | if( not defined($showmatch) or "$name" =~ m{$showmatch}o ){ | |
147 | if (not $match or "$name" =~ m{$match}o) { | |
35 | 148 | print "$name Id='$printer->{'id'}' Driver='$driver'"; |
36 | 149 | if ($dcount > 1){ |
37 | 150 | print " CompatibleDrivers='$dlist'"; |
39 | 152 | print "\n"; |
40 | 153 | } |
41 | 154 | } |
42 | exit 0; | |
43 | } | |
44 | ||
45 | help() if( not defined( $poid ) ); | |
46 | ||
47 | # If the user supplies an old numerical printer ID, translate it to | |
48 | # a new clear-text ID | |
49 | $poid = Foomatic::DB::translate_printer_id($poid); | |
50 | ||
51 | my $lcname = lc( $poid ); | |
52 | my $pentry; | |
53 | for $printer (@{$db->{'overview'}}) { | |
54 | my $name = lc( $printer->{'id'} ); | |
55 | print "compare '$lcname' to '$name'\n" if $debug; | |
56 | if( $name eq $lcname ){ | |
57 | $pentry = $printer; | |
58 | last; | |
59 | } | |
60 | } | |
61 | ||
62 | print "found " . Dumper($pentry) if $debug; | |
63 | die "printer '$poid' not found!\n" if( not defined $pentry ); | |
64 | ||
65 | if (not defined($driver) ) { | |
66 | $driver = $pentry->{'driver'}; | |
67 | if( not defined( $driver ) ){ | |
68 | die "printer '$poid' does not have default driver!\n"; | |
69 | } | |
70 | } | |
71 | ||
72 | my $found = 0; | |
73 | for my $d (@{$pentry->{'drivers'}}) { | |
74 | last if ($found = ($driver eq $d)); | |
75 | } | |
76 | if( not $found ){ | |
77 | warn "WARNING: printer '$poid' and driver '$driver' are not compatible\n"; | |
78 | } | |
79 | $found = 0; | |
80 | for my $d (@drivers) { | |
81 | last if ($found = ($driver eq $d)); | |
82 | } | |
83 | if( not $found ){ | |
84 | die "ERROR: driver '$driver' not in database!\n"; | |
85 | } | |
86 | ||
87 | # Get all the data about this driver/printer pair | |
88 | my $possible = $db->getdat($driver, $poid); | |
89 | # Stop if the printer is not supported by the given driver | |
90 | die "That printer and driver combination is not possible.\n" | |
91 | if (!$possible); | |
92 | # Stop if the driver entry has an empty command line prototype or if there | |
93 | # is no custom PPD file | |
94 | die "There is neither a custom PPD file nor the driver database entry contains sufficient data to build a PPD file.\n" | |
95 | if (!$db->{'dat'}{'cmd'}) && (!$db->{'dat'}{'ppdfile'}); | |
96 | ||
97 | my @data; | |
98 | ||
99 | @data = $db->getppd($opt_w); | |
100 | die "ERROR: no PPD file for printer '$poid' and driver '$driver'!\n" | |
101 | if not @data; | |
102 | ||
103 | print @data; | |
104 | ||
105 | exit 0; | |
155 | } | |
156 | ||
157 | sub generateppd { | |
158 | ||
159 | my ($ppduri, $driver) = @_; | |
160 | my $poid; | |
161 | ||
162 | my $db = Foomatic::DB->new(); | |
163 | $db->get_overview(); | |
164 | my $printer; | |
165 | my @drivers = $db->get_driverlist(); | |
166 | ||
167 | if ($ppduri =~ /^$progname:(.*)\.ppd$/) { | |
168 | # cups-driverd operation | |
169 | # We try to split between printer name and driver name at all | |
170 | # dashes in the PPD file name, as some drivers (ex. Gutenprint) | |
171 | # have dashes in their names. | |
172 | my $ppdname = $1; | |
173 | my @poidcomponents = split(/-/, $ppdname); | |
174 | my @drivercomponents = (); | |
175 | while ($#poidcomponents > 1) { | |
176 | unshift(@drivercomponents, pop(@poidcomponents)); | |
177 | $driver = join('-', @drivercomponents); | |
178 | next if !Foomatic::DB::member($driver, @drivers); | |
179 | $poid = join('-', @poidcomponents); | |
180 | last; | |
181 | } | |
182 | die "ERROR: Could not determine driver name for $ppdname.ppd!\n" | |
183 | if( !$poid ); | |
184 | } else { | |
185 | # manual operation | |
186 | $poid = $ppduri; | |
187 | } | |
188 | ||
189 | # If the user supplies an old numerical printer ID, translate it to | |
190 | # a new clear-text ID | |
191 | $poid = Foomatic::DB::translate_printer_id($poid); | |
192 | ||
193 | my $lcname = lc( $poid ); | |
194 | my $pentry; | |
195 | for $printer (@{$db->{'overview'}}) { | |
196 | my $name = lc( $printer->{'id'} ); | |
197 | print STDERR "DEBUG2: $progname: compare '$lcname' to '$name'\n" if $debug; | |
198 | if( $name eq $lcname ){ | |
199 | $pentry = $printer; | |
200 | last; | |
201 | } | |
202 | } | |
203 | ||
204 | die "ERROR: Printer '$poid' not found!\n" if( not defined $pentry ); | |
205 | print STDERR "DEBUG: $progname: Found $pentry->{id}\nDEBUG2: $progname: " . | |
206 | join ("\nDEBUG2: $progname: ", split(/\n/, Dumper($pentry))) . | |
207 | "\n" if $debug; | |
208 | ||
209 | if (!$driver || ($driver =~ /(default|recommended)/i)) { | |
210 | $driver = $pentry->{'driver'}; | |
211 | if( not defined( $driver ) ){ | |
212 | die "ERROR: $progname: Printer '$poid' does not have default driver!\n"; | |
213 | } | |
214 | } | |
215 | ||
216 | my $found = 0; | |
217 | for my $d (@{$pentry->{'drivers'}}) { | |
218 | last if ($found = ($driver eq $d)); | |
219 | } | |
220 | if ( not $found ) { | |
221 | warn "ERROR: $progname: Printer '$poid' and driver '$driver' are not compatible\n"; | |
222 | } | |
223 | $found = 0; | |
224 | for my $d (@drivers) { | |
225 | last if ($found = ($driver eq $d)); | |
226 | } | |
227 | if ( not $found ) { | |
228 | die "ERROR: $progname: Driver '$driver' not in database!\n"; | |
229 | } | |
230 | ||
231 | # Get all the data about this driver/printer pair | |
232 | my $possible = $db->getdat($driver, $poid); | |
233 | # Stop if the printer is not supported by the given driver | |
234 | die "ERROR: $progname: That printer and driver combination is not possible.\n" | |
235 | if (!$possible); | |
236 | # Stop if the driver entry has an empty command line prototype or if there | |
237 | # is no custom PPD file | |
238 | die "ERROR: $progname: There is neither a custom PPD file nor the driver database entry contains sufficient data to build a PPD file.\n" | |
239 | if (!$db->{'dat'}{'cmd'}) && (!$db->{'dat'}{'ppdfile'}); | |
240 | ||
241 | my @data; | |
242 | ||
243 | @data = $db->getppd($opt_w); | |
244 | die "ERROR: $progname: No PPD file for printer '$poid' and driver '$driver'!\n" | |
245 | if not @data; | |
246 | ||
247 | print @data; | |
248 | ||
249 | } | |
106 | 250 | |
107 | 251 | sub help { |
108 | 252 | print <<HELP; |
109 | $0 [-h][-A][-w][-P regexp] | |
110 | $0 [-h][-A][-d <driver>] [-p <printerid>] | |
111 | -d <driver> : Driver name | |
112 | -p <printerid> : Printer ID | |
253 | ||
254 | $progname -A | |
255 | $progname -P <regexpr> | |
256 | $progname -p <printerid> [-d <driver>] [-w] | |
257 | $progname list | |
258 | $progname cat <CUPS PPD URI> [-w] | |
259 | $progname -h | |
260 | ||
113 | 261 | -A : show all Printer ID's and compatible drivers |
114 | 262 | -P <regexpr> : show all Printer ID's whose names and model |
115 | 263 | matched by the RE. For example: |
116 | 264 | -P HP will match all names with HP in them |
265 | -p <printerid> : Printer ID | |
266 | -d <driver> : Driver name | |
267 | If the driver is not specified then the default driver | |
268 | for the <printerid> is used. | |
269 | list : List all possible PPDs in the format needed by the | |
270 | cups-driverd | |
271 | cat <CUPS PPD URI> : Generate PPD file appropriate to the <CUPS PPD URI>. | |
272 | Available CUPS PPD URIs are listed by | |
273 | "$progname list". | |
117 | 274 | -w : Generate PPD which is compatible with the CUPS PostScript |
118 | 275 | driver for Windows (GUI strings are limited to 39 |
119 | 276 | characters). |
120 | 277 | -h : show help information |
121 | 278 | |
122 | If the driver is not specified then the default driver for the | |
123 | printerid is used. | |
124 | 279 | |
125 | 280 | HELP |
126 | 281 | exit 1; |
0 | /DB.pm/3.56.2.21/Tue Jan 17 15:37:27 2006//Tfoomatic-3_0-branch | |
0 | /DB.pm/3.56.2.26/Tue May 23 22:46:40 2006//Tfoomatic-3_0-branch | |
1 | 1 | /PPD.pm/3.0/Fri Oct 11 01:16:34 2002//Tfoomatic-3_0-branch |
2 | 2 | /UIElem.pm/3.0/Fri Oct 11 01:16:34 2002//Tfoomatic-3_0-branch |
3 | 3 | D |
14 | 14 | use POSIX; # for rounding integers |
15 | 15 | use strict; |
16 | 16 | |
17 | my $ver = '$Revision: 3.56.2.21 $ '; | |
17 | my $ver = '$Revision: 3.56.2.26 $ '; | |
18 | 18 | |
19 | 19 | # constructor for Foomatic::DB |
20 | 20 | sub new { |
403 | 403 | if ($firstgroup[$i]) {return 1}; |
404 | 404 | if ($secondgroup[$i]) {return -1}; |
405 | 405 | |
406 | # Check whether they argument names are in the @standardopts list | |
406 | # Sort by order parameter if the order parameters are different | |
407 | if (defined($firstarg->{'order'}) && defined($secondarg->{'order'}) && | |
408 | $firstarg->{'order'} != $secondarg->{'order'}) { | |
409 | return $firstarg->{'order'} cmp $secondarg->{'order'}; | |
410 | } | |
411 | ||
412 | # Check whether the argument names are in the @standardopts list | |
407 | 413 | for ($i = 0; $i <= $#standardopts; $i++) { |
408 | 414 | my $firstinlist = ($first =~ /^$standardopts[$i]/); |
409 | 415 | my $secondinlist = ($second =~ /^$standardopts[$i]/); |
759 | 765 | $dat->{'args_byname'}{'PageSize'}{'vals_byname'}{$setting}{'driverval'} = $code; |
760 | 766 | $dat->{'args_byname'}{'PageRegion'}{'vals_byname'}{$setting}{'driverval'} = $code; |
761 | 767 | } |
762 | } elsif (m!^\*Open(Sub|)Group:\s*([^\s/]+)(/(.*)|)$!) { | |
768 | } elsif (m!^\*Open(Sub|)Group:\s*([^/]+)(/(.*)|)$!) { | |
763 | 769 | # "*Open[Sub]Group: <group>[/<translation>] |
764 | 770 | my $group = $2; |
771 | chomp($group) if $group; | |
765 | 772 | my $grouptrans = $4; |
773 | chomp($grouptrans) if $grouptrans; | |
766 | 774 | if (!$grouptrans) { |
767 | 775 | $grouptrans = longname($group); |
768 | 776 | } |
771 | 779 | } |
772 | 780 | $currentgroup .= $group; |
773 | 781 | push(@currentgrouptrans, $grouptrans); |
774 | } elsif (m!^\*Close(Sub|)Group:\s*([^\s/]+)$!) { | |
782 | } elsif (m!^\*Close(Sub|)Group:\s*([^/]+)$!) { | |
775 | 783 | # "*Close[Sub]Group: <group>" |
776 | 784 | my $group = $2; |
785 | chomp($group) if $group; | |
777 | 786 | $currentgroup =~ s!$group$!!; |
778 | 787 | $currentgroup =~ s!/$!!; |
779 | 788 | pop(@currentgrouptrans); |
1030 | 1039 | $dat->{'args_byname'}{$currentargument}{'vals_byname'}{$setting}{'comment'} = $translation; |
1031 | 1040 | # Make sure that this argument has a default setting, even |
1032 | 1041 | # if none is defined in this PPD file |
1033 | if ($dat->{'args_byname'}{$currentargument}{'default'} eq "") { | |
1042 | if (!defined($dat->{'args_byname'}{$currentargument}{'default'}) || | |
1043 | ($dat->{'args_byname'}{$currentargument}{'default'} eq "")) { | |
1034 | 1044 | $dat->{'args_byname'}{$currentargument}{'default'} = $setting; |
1035 | 1045 | } |
1036 | 1046 | } |
1187 | 1197 | if (!$isfoomatic) { |
1188 | 1198 | $dat->{'make'} = undef; |
1189 | 1199 | $dat->{'model'} = undef; |
1190 | sortoptions($dat, 1); | |
1200 | #sortoptions($dat, 1); | |
1191 | 1201 | } |
1192 | 1202 | |
1193 | 1203 | return $dat; |
1957 | 1967 | if ($arg->{'default'} < $arg->{'min'}) { |
1958 | 1968 | $arg->{'default'} = $arg->{'min'}; |
1959 | 1969 | $arg->{'cdefault'} = $arg->{'default'}; |
1960 | } elsif ($arg->{'cdefault'} > $arg->{'max'}) { | |
1970 | } elsif ($arg->{'default'} > $arg->{'max'}) { | |
1961 | 1971 | $arg->{'default'} = $arg->{'max'}; |
1962 | 1972 | $arg->{'cdefault'} = $arg->{'default'}; |
1963 | 1973 | } elsif (defined($arg->{'vals_byname'}{$arg->{'default'}})) { |
2024 | 2034 | } else { |
2025 | 2035 | return $str; |
2026 | 2036 | } |
2037 | } | |
2038 | ||
2039 | sub ppd1284DeviceID { | |
2040 | ||
2041 | # Clean up IEEE-1284 device ID to only contain the fields relevant | |
2042 | # to printer model auto-detection (MFG, MDL, DES, CMD, SKU), this | |
2043 | # the line length limit of PPDs does not get exceeded on very long | |
2044 | # ID strings. | |
2045 | ||
2046 | my ($id) = @_; | |
2047 | my $ppdid = ""; | |
2048 | ||
2049 | foreach my $field ("(MFG|MANUFACTURER)", "(MDL|MODEL)", "(CMD|COMMAND SET)", "(DES|DESCRIPTION)", "SKU") { | |
2050 | if ($id =~ m/(\b$field:[^:;]+;)/is) { | |
2051 | $ppdid .= $1; | |
2052 | } | |
2053 | } | |
2054 | ||
2055 | return $ppdid; | |
2056 | } | |
2057 | ||
2058 | sub getppdheaderdata { | |
2059 | ||
2060 | my ($dat, $driver, $recdriver) = @_; | |
2061 | ||
2062 | # Complete IEEE 1284 ID string? | |
2063 | my $ieee1284; | |
2064 | $ieee1284 = $dat->{'general_ieee'} or $ieee1284 = $dat->{'pnp_ieee'} or | |
2065 | $ieee1284 = $dat->{'par_ieee'} or $ieee1284 = $dat->{'usb_ieee'} or | |
2066 | $ieee1284 = $dat->{'snmp_ieee'} or $ieee1284 = ""; | |
2067 | # Extract data fields from the ID string | |
2068 | my $ieeemake; | |
2069 | my $ieeemodel; | |
2070 | my $ieeecmd; | |
2071 | my $ieeedes; | |
2072 | if ($ieee1284) { | |
2073 | $ieee1284 =~ /(MFG|MANUFACTURER):([^:;]+);/; | |
2074 | $ieeemake = $2; | |
2075 | $ieee1284 =~ /(MDL|MODEL):([^:;]+);/; | |
2076 | $ieeemodel = $2; | |
2077 | $ieee1284 =~ /(CMD|COMMANDS\s+SET):([^:;]+);/; | |
2078 | $ieeecmd = $2; | |
2079 | $ieee1284 =~ /(DES|DESCRIPTION):([^:;]+);/; | |
2080 | $ieeedes = $2; | |
2081 | } | |
2082 | # Auto-detection data listed field by field in the printer XML file? | |
2083 | my $pnpmake; | |
2084 | $pnpmake = $ieeemake or $pnpmake = $dat->{'general_mfg'} or | |
2085 | $pnpmake = $dat->{'pnp_mfg'} or $pnpmake = $dat->{'par_mfg'} or | |
2086 | $pnpmake = $dat->{'usb_mfg'} or $pnpmake = ""; | |
2087 | my $pnpmodel; | |
2088 | $pnpmodel = $ieeemodel or $pnpmodel = $dat->{'general_mdl'} or | |
2089 | $pnpmodel = $dat->{'pnp_mdl'} or $pnpmodel = $dat->{'par_mdl'} or | |
2090 | $pnpmodel = $dat->{'usb_mdl'} or $pnpmodel = ""; | |
2091 | my $pnpcmd; | |
2092 | $pnpcmd = $ieeecmd or $pnpcmd = $dat->{'general_cmd'} or | |
2093 | $pnpcmd = $dat->{'pnp_cmd'} or $pnpcmd = $dat->{'par_cmd'} or | |
2094 | $pnpcmd = $dat->{'usb_cmd'} or $pnpcmd = ""; | |
2095 | my $pnpdescription; | |
2096 | $pnpdescription = $ieeedes or | |
2097 | $pnpdescription = $dat->{'general_des'} or | |
2098 | $pnpdescription = $dat->{'pnp_des'} or | |
2099 | $pnpdescription = $dat->{'par_des'} or | |
2100 | $pnpdescription = $dat->{'usb_des'} or | |
2101 | $pnpdescription = ""; | |
2102 | if ((!$ieee1284) && ((($pnpmake) && ($pnpmodel)) || ($pnpdescription))){ | |
2103 | $ieee1284 .= "MFG:$pnpmake;" if $pnpmake; | |
2104 | $ieee1284 .= "MDL:$pnpmodel;" if $pnpmodel; | |
2105 | $ieee1284 .= "CMD:$pnpcmd;" if $pnpcmd; | |
2106 | $ieee1284 .= "DES:$pnpdescription;" if $pnpdescription; | |
2107 | } | |
2108 | ||
2109 | # Remove everything from the device ID which is not relevant to | |
2110 | # auto-detection of the printer model. | |
2111 | $ieee1284 = ppd1284DeviceID($ieee1284) if $ieee1284; | |
2112 | ||
2113 | my $make = $dat->{'make'}; | |
2114 | my $model = $dat->{'model'}; | |
2115 | ||
2116 | $pnpmake = $make if !$pnpmake; | |
2117 | $pnpmodel = $model if !$pnpmodel; | |
2118 | ||
2119 | # File name for the PPD file | |
2120 | my $filename = join('-',($dat->{'make'}, | |
2121 | $dat->{'model'}, | |
2122 | $driver));; | |
2123 | $filename =~ s![ /\(\)]!_!g; | |
2124 | $filename =~ s![\+]!plus!g; | |
2125 | $filename =~ s!__+!_!g; | |
2126 | $filename =~ s!_$!!; | |
2127 | $filename =~ s!^_!!; | |
2128 | $filename =~ s!_-!-!; | |
2129 | $filename =~ s!-_!-!; | |
2130 | my $longname = "$filename.ppd"; | |
2131 | ||
2132 | # Driver name | |
2133 | my $drivername = $driver; | |
2134 | ||
2135 | # Do we use the recommended driver? | |
2136 | my $driverrecommended = ""; | |
2137 | if ($driver eq $recdriver) { | |
2138 | $driverrecommended = " (recommended)"; | |
2139 | } | |
2140 | ||
2141 | # evil special case. | |
2142 | $drivername = "stp-4.0" if $drivername eq 'stp'; | |
2143 | ||
2144 | # Nickname for the PPPD file | |
2145 | my $nickname = | |
2146 | "$make $model Foomatic/$drivername$driverrecommended"; | |
2147 | my $modelname = "$make $model"; | |
2148 | # Remove forbidden characters (Adobe PPD spec 4.3 section 5.3) | |
2149 | $modelname =~ s/[^A-Za-z0-9 \.\/\-\+]//gs; | |
2150 | ||
2151 | return ($ieee1284,$pnpmake,$pnpmodel,$filename,$longname, | |
2152 | $drivername,$nickname,$modelname); | |
2027 | 2153 | } |
2028 | 2154 | |
2029 | 2155 | # |
3350 | 3476 | $pcfilename = 'FOOMATIC' if !defined($pcfilename); |
3351 | 3477 | my $model = $dat->{'model'}; |
3352 | 3478 | my $make = $dat->{'make'}; |
3353 | my $ieee1284; | |
3354 | $ieee1284 = $dat->{'general_ieee'} or $ieee1284 = $dat->{'pnp_ieee'} or | |
3355 | $ieee1284 = $dat->{'par_ieee'} or $ieee1284 = $dat->{'usb_ieee'} or | |
3356 | $ieee1284 = $dat->{'snmp_ieee'} or $ieee1284 = ""; | |
3357 | my $ieeemodel; | |
3358 | my $ieeemake; | |
3479 | my ($ieee1284,$pnpmake,$pnpmodel,$filename,$longname, | |
3480 | $drivername,$nickname,$modelname) = | |
3481 | getppdheaderdata($dat, $dat->{'driver'}, $dat->{'recdriver'}); | |
3359 | 3482 | if ($ieee1284) { |
3360 | $ieee1284 =~ /(MDL|MODEL):([^:;]+);/; | |
3361 | $ieeemodel = $2; | |
3362 | $ieee1284 =~ /(MFG|MANUFACTURER):([^:;]+);/; | |
3363 | $ieeemake = $2; | |
3364 | } | |
3365 | my $pnpmodel; | |
3366 | $pnpmodel = $dat->{'general_mdl'} or $dat->{'pnp_mdl'} or | |
3367 | $pnpmodel = $dat->{'par_mdl'} or $pnpmodel = $dat->{'usb_mdl'} or | |
3368 | $pnpmodel = $ieeemodel or $pnpmodel = $model; | |
3369 | my $pnpmake; | |
3370 | $pnpmake = $dat->{'general_mfg'} or $dat->{'pnp_mfg'} or | |
3371 | $pnpmake = $dat->{'par_mfg'} or $pnpmake = $dat->{'usb_mfg'} or | |
3372 | $pnpmake = $ieeemake or $pnpmake = $make; | |
3373 | if ($ieee1284) { | |
3374 | $ieee1284 =~ s/;(.)/;\n $1/gs; | |
3375 | $ieee1284 = "*1284DeviceID: \"\n " . $ieee1284 . "\n\"\n*End"; | |
3376 | } | |
3377 | my $filename = join('-',($dat->{'make'}, | |
3378 | $dat->{'model'}, | |
3379 | $dat->{'driver'}));; | |
3380 | $filename =~ s![ /\(\)]!_!g; | |
3381 | $filename =~ s![\+]!plus!g; | |
3382 | $filename =~ s!__+!_!g; | |
3383 | $filename =~ s!_$!!; | |
3384 | $filename =~ s!_-!-!; | |
3385 | $filename =~ s!^_!!; | |
3386 | my $longname = "$filename.ppd"; | |
3387 | ||
3388 | my $drivername = $dat->{'driver'}; | |
3389 | ||
3390 | # Do we use the recommended driver? | |
3391 | my $driverrecommended = ""; | |
3392 | if ($dat->{'driver'} eq $dat->{'recdriver'}) { | |
3393 | $driverrecommended = " (recommended)"; | |
3394 | } | |
3395 | ||
3396 | # evil special case. | |
3397 | $drivername = "stp-4.0" if $drivername eq 'stp'; | |
3398 | ||
3399 | # Do not use "," or "+" in the *ShortNickName to make the Windows | |
3400 | # PostScript drivers happy | |
3401 | my $nickname = | |
3402 | "$make $model Foomatic/$drivername$driverrecommended"; | |
3403 | my $modelname = "$make $model"; | |
3404 | # Remove forbidden characters (Adobe PPD spec 4.3 section 5.3) | |
3405 | $modelname =~ s/[^A-Za-z0-9 \.\/\-\+]//gs; | |
3483 | #$ieee1284 =~ s/;(.)/;\n $1/gs; | |
3484 | #$ieee1284 = "*1284DeviceID: \"\n " . $ieee1284 . "\n\"\n*End"; | |
3485 | #$ieee1284 =~ s/;(.)/;\n $1/gs; | |
3486 | $ieee1284 = "*1284DeviceID: \"" . $ieee1284 . "\""; | |
3487 | } | |
3406 | 3488 | # Do not use "," or "+" in the *ShortNickName to make the Windows |
3407 | 3489 | # PostScript drivers happy |
3408 | 3490 | my $shortnickname = "$make $model $drivername"; |
53 | 53 | 'cups-ppds' => '$ENV{CUPS_PPDS}', |
54 | 54 | 'cups-filters' => '$ENV{CUPS_FILTERS}', |
55 | 55 | 'cups-backends' => '$ENV{CUPS_BACKENDS}', |
56 | 'cups-driver' => '$ENV{LIB_CUPS}/driver', | |
56 | 57 | 'cups-pconf' => '$ENV{CUPS_PCONF}', |
57 | 58 | 'cups-lpr' => '$ENV{CUPS_LPR}', |
58 | 59 | 'cups-lpq' => '$ENV{CUPS_LPQ}', |
135 | 136 | 'cups-ppds' => '$ENV{CUPS_PPDS}', |
136 | 137 | 'cups-filters' => '$ENV{CUPS_FILTERS}', |
137 | 138 | 'cups-backends' => '$ENV{CUPS_BACKENDS}', |
139 | 'cups-driver' => '$ENV{LIB_CUPS}/driver', | |
138 | 140 | 'cups-pconf' => '$ENV{CUPS_PCONF}', |
139 | 141 | 'cups-lpr' => '$ENV{CUPS_LPR}', |
140 | 142 | 'cups-lpq' => '$ENV{CUPS_LPQ}', |