Codebase list foomatic-db-engine / upstream/3.0.2-20050705
Imported Upstream version 3.0.2-20050705 Didier Raboud 13 years ago
6 changed file(s) with 46 addition(s) and 31 deletion(s). Raw diff Collapse all Expand all
00 /COPYING/3.1/Tue Jan 28 23:01:10 2003//Tfoomatic-3_0-branch
1 /ChangeLog/3.99.2.24/Thu Feb 24 00:17:50 2005//Tfoomatic-3_0-branch
1 /ChangeLog/3.99.2.26/Mon May 30 00:44:48 2005//Tfoomatic-3_0-branch
22 /Foomatic-Devel-Ideas.txt/3.2/Tue Apr 22 23:19:52 2003//Tfoomatic-3_0-branch
33 /Makefile.in/3.16.2.3/Fri Jan 28 16:17:13 2005//Tfoomatic-3_0-branch
4 /README/3.26.2.5/Tue Sep 14 21:08:37 2004//Tfoomatic-3_0-branch
4 /README/3.26.2.6/Wed May 11 17:58:56 2005//Tfoomatic-3_0-branch
55 /README.build-foomatic-filters-ppds/3.3.2.1/Sun Mar 28 23:04:51 2004//Tfoomatic-3_0-branch
66 /TODO/3.1/Fri Nov 29 01:31:37 2002//Tfoomatic-3_0-branch
77 /USAGE/3.14.2.4/Tue Sep 14 21:08:37 2004//Tfoomatic-3_0-branch
1616 /foomatic-compiledb.1.in/3.1/Thu Nov 28 02:42:26 2002//Tfoomatic-3_0-branch
1717 /foomatic-compiledb.in/3.6.2.1/Tue Nov 30 14:29:43 2004//Tfoomatic-3_0-branch
1818 /foomatic-configure.1.in/3.1/Thu Nov 28 02:42:26 2002//Tfoomatic-3_0-branch
19 /foomatic-configure.in/3.18.2.3/Thu Feb 24 00:17:50 2005//Tfoomatic-3_0-branch
19 /foomatic-configure.in/3.18.2.4/Mon May 30 00:44:48 2005//Tfoomatic-3_0-branch
2020 /foomatic-filters-ppds-README/3.1/Sun Feb 23 07:14:18 2003//Tfoomatic-3_0-branch
2121 /foomatic-filters-ppds-install/3.1/Sun Feb 23 07:14:18 2003//Tfoomatic-3_0-branch
2222 /foomatic-fix-xml.in/3.0/Fri Oct 11 01:16:34 2002//Tfoomatic-3_0-branch
0 2004-02-23 Till Kamppeter <till.kamppeter@gmx.net>
0 2005-05-29 Till Kamppeter <till.kamppeter@gmx.net>
1
2 * foomatic-configure.in, lib/Foomatic/DB.pm: Added support for
3 PPD file names with spaces (Mandriva bug #16172).
4
5 2005-05-11 Till Kamppeter <till.kamppeter@gmx.net>
6
7 * README: Corrected character list in "<arg_allowedchars>" in the
8 example string option XML file. Improved instructions for
9 "<arg_allowedchars>".
10
11 2005-02-23 Till Kamppeter <till.kamppeter@gmx.net>
112
213 * foomatic-configure.in: Fixed bug of old non-Foomatic PPD not
314 overtaken when applying "foomatic-configure" to a queue without
718 options "0" or "1" was written into the PPD file and not
819 "False" or "True".
920
10 2004-01-28 Till Kamppeter <till.kamppeter@gmx.net>
21 2005-01-28 Till Kamppeter <till.kamppeter@gmx.net>
1122
1223 * makeDefaults.in, foomatic-cleanupdrivers.in: Allow use of an
1324 alternative Foomatic database location specifying it with the
1930 * foomatic-cleanupdrivers.in: Use default database location from
2031 Defaults.pm.
2132
22 2004-01-22 Till Kamppeter <till.kamppeter@gmx.net>
33 2005-01-22 Till Kamppeter <till.kamppeter@gmx.net>
2334
2435 * lib/Foomatic/DB.pm: Fixed Tim Waugh's fix. It made an
2536 "@@IEEE1284@@" appear in the PPD file when for a printer
20672067 "/^[...]*$/" expression in the Perl scripts, so ranges with "-", a
20682068 list of forbidden characters with a leading "^", or special characters
20692069 as "\w", "\d", "\x07", ... are allowed. To allow a backslash, one has
2070 to escape it by using two backslashes ("\\").
2070 to escape it by using two backslashes ("\\"). To allow a "-" it must
2071 be in the end of the list to not make it defining a range and for a
2072 "^" must be placed at any other place than the beginning of the string
2073 if it should be explicitly allowed.
20712074
20722075 "<arg_allowedregexp>" allows also to restrict the structure of the
20732076 string, as it defines an arbitrary Perl regular expression (see "man
21192122 <arg_proto>-G%s </arg_proto>
21202123 </arg_execution>
21212124 <arg_maxlength>127</arg_maxlength>
2122 <arg_allowedchars>A-Za-z0-9\._-/</arg_allowedchars>
2125 <arg_allowedchars>A-Za-z0-9\._/-</arg_allowedchars>
21232126 <arg_allowedregexp>(?&lt;!\/)$</arg_allowedregexp>
21242127 <constraints>
21252128 <constraint sense="true">
312312 }
313313 } elsif ($config->{'ppdfile'}) {
314314 if (! -r $config->{'ppdfile'}) {
315 die "The PPD file $config->{'ppdfile'} does not exist or is " .
315 die "The PPD file \'$config->{'ppdfile'}\' does not exist or is " .
316316 "readable.\n";
317317 }
318318 # Load the data from the PPD file
385385 my ($config, $ppdfile, $rawqueue, $newfoomaticdata) = @_;
386386
387387 # Save old $ppdfile, if any
388 system("cp -f $ppdfile $ppdfile.old")
388 system("cp -f \'$ppdfile\' \'$ppdfile.old\'")
389389 if (-f $ppdfile);
390390 if ($rawqueue) {
391391 # Raw queue with $postpipe, use a "PPD" only containing the
394394 (($config->{'spooler'} eq 'lprng') ||
395395 ($config->{'spooler'} eq 'lpd'))) ||
396396 ($config->{'spooler'} eq 'direct')) {
397 open PPDFILE, "> $ppdfile" or die "Cannot write $ppdfile!\n";
397 open PPDFILE, "> $ppdfile" or die "Cannot write \'$ppdfile\'!\n";
398398 print PPDFILE "*PPD-Adobe: \"4.3\"\n*%\n";
399399 print PPDFILE "*% This is a raw (driverless/unfiltered) " .
400400 "queue, this PPD file only carries\n" .
404404 chmod 0644, $ppdfile;
405405 } else {
406406 if (-f $ppdfile) {
407 unlink "$ppdfile" or die "Cannot delete $ppdfile!\n";
407 unlink "$ppdfile" or die "Cannot delete \'$ppdfile\'!\n";
408408 }
409409 }
410410 } else {
412412 # Copy in the PPD file specified on the command line
413413 if ($config->{'ppdfile'} !~ /\.gz$/i) {
414414 # Uncompressed PPD file
415 system("cp -f $config->{'ppdfile'} $ppdfile") and
416 die "Cannot copy $config->{'ppdfile'} to $ppdfile!\n";
415 system("cp -f \'$config->{'ppdfile'}\' \'$ppdfile\'") and
416 die "Cannot copy \'$config->{'ppdfile'}\' to \'$ppdfile\'!\n";
417417 } else {
418418 # Compressed PPD file
419 system("$sysdeps->{'gzip'} -dc $config->{'ppdfile'} > " .
420 "$ppdfile") and
421 die "Cannot copy $config->{'ppdfile'} to $ppdfile!\n";
419 system("$sysdeps->{'gzip'} -dc " .
420 "\'$config->{'ppdfile'}\' > " .
421 "\'$ppdfile\'") and
422 die "Cannot copy \'$config->{'ppdfile'}\' to \'$ppdfile\'!\n";
422423 }
423424 # Set default option settings and $postpipe
424425 $db->ppdsetdefaults($ppdfile);
425426 } elsif ($newfoomaticdata) {
426427 # Generate the PPD file from the Foomatic database
427 open PPDFILE, "> $ppdfile" or die "Cannot write $ppdfile!\n";
428 open PPDFILE, "> $ppdfile" or die "Cannot write \'$ppdfile\'!\n";
428429 print PPDFILE $db->getppd($config->{'shortgui'});
429430 close PPDFILE;
430431 } else {
11571158
11581159 # PPD file argument for the printer
11591160 if (!$rawqueue) {
1160 $lpadminline .= " -P \"$ppdfile\"";
1161 $lpadminline .= " -P \'$ppdfile\'";
11611162 }
11621163
11631164 # All URIs ("-c" option) have the same syntax as URIs in CUPS
14581459 system("$sysdeps->{'foomatic-rip'} --genrawpdq $driverfile") and
14591460 die "Cannot create $driverfile!\n";
14601461 } else {
1461 system("$sysdeps->{'foomatic-rip'} --ppd $ppdfile --genpdq " .
1462 system("$sysdeps->{'foomatic-rip'} --ppd \'$ppdfile\' --genpdq " .
14621463 "$driverfile") and
14631464 die "Cannot create $driverfile!\n";
14641465 }
41454146 # From PPD file
41464147 my $dat = ppdtoperl($config->{'ppdfile'});
41474148 if (!defined($dat)) {
4148 die ("Unable to open PPD file $config->{'ppdfile'}\n");
4149 die ("Unable to open PPD file \'$config->{'ppdfile'}\'\n");
41494150 }
41504151 $db->{'dat'} = $dat;
41514152 } else {
0 /DB.pm/3.56.2.12/Thu Feb 24 00:17:50 2005//Tfoomatic-3_0-branch
0 /DB.pm/3.56.2.13/Mon May 30 00:44:49 2005//Tfoomatic-3_0-branch
11 /PPD.pm/3.0/Fri Oct 11 01:16:34 2002//Tfoomatic-3_0-branch
22 /UIElem.pm/3.0/Fri Oct 11 01:16:34 2002//Tfoomatic-3_0-branch
33 D
1414 use POSIX; # for rounding integers
1515 use strict;
1616
17 my $ver = '$Revision: 3.56.2.12 $ ';
17 my $ver = '$Revision: 3.56.2.13 $ ';
1818
1919 # constructor for Foomatic::DB
2020 sub new {
550550 my $dat = ppdtoperl($ppdfile);
551551
552552 if (!defined($dat)) {
553 die ("Unable to open PPD file $ppdfile\n");
553 die ("Unable to open PPD file \'$ppdfile\'\n");
554554 }
555555
556556 $this->{'dat'} = $dat;
569569
570570 # Load the PPD file and send it to the parser
571571 open PPD, ($ppdfile !~ /\.gz$/i ? "< $ppdfile" :
572 "$sysdeps->{'gzip'} -cd $ppdfile |") or return undef;
572 "$sysdeps->{'gzip'} -cd \'$ppdfile\' |") or return undef;
573573 my @ppd = <PPD>;
574574 close PPD;
575575 return ppdfromvartoperl(\@ppd);
12361236
12371237 # Open the PPD file
12381238 open PPD, ($ppdfile !~ /\.gz$/i ? "< $ppdfile" :
1239 "$sysdeps->{'gzip'} -cd $ppdfile |") or
1240 die ("Unable to open PPD file $ppdfile\n");
1239 "$sysdeps->{'gzip'} -cd \'$ppdfile\' |") or
1240 die ("Unable to open PPD file \'$ppdfile\'\n");
12411241
12421242 # We don't read the "COMDATA" lines of old Foomatic 2.0.x PPD files
12431243 # here, because the defaults in the main PPD structure have priority.
13071307
13081308 # Load the complete PPD file into memory but remove the postpipe
13091309 open PPD, ($ppdfile !~ /\.gz$/i ? "< $ppdfile" :
1310 "$sysdeps->{'gzip'} -cd $ppdfile |") or
1311 die ("Unable to open PPD file $ppdfile\n");
1310 "$sysdeps->{'gzip'} -cd \'$ppdfile\' |") or
1311 die ("Unable to open PPD file \'$ppdfile\'\n");
13121312 while (my $line = <PPD>) {
13131313 if ($line =~ m!^\*FoomaticRIPPostPipe:\s*\"(.*)$!) {
13141314 # "*FoomaticRIPPostPipe: <code>"
14581458
14591459 # Write back the modified PPD file
14601460 open PPD, ($ppdfile !~ /\.gz$/i ? "> $ppdfile" :
1461 "| $sysdeps->{'gzip'} > $ppdfile") or
1462 die ("Unable to open PPD file $ppdfile for writing\n");
1461 "| $sysdeps->{'gzip'} > \'$ppdfile\'") or
1462 die ("Unable to open PPD file \'$ppdfile\' for writing\n");
14631463 print PPD $ppd;
14641464 close PPD;
14651465