summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDidier Raboud <didier@raboud.com>2010-05-23 00:08:58 +0200
committerDidier Raboud <didier@raboud.com>2010-05-23 00:08:58 +0200
commita5bb801067f8acde0c828e03bca2a7762638e0c3 (patch)
tree3cfaf44a8004e59be870e37bcfd55cbec9cf781e
parentcf99864b7647e8827d00d7210859d8d6278d1e69 (diff)
parent7b7bb0240eda341c29d786e97f6ad7c52d10cac7 (diff)
Merge branch 'upstream'
-rw-r--r--ChangeLog35
-rw-r--r--README2
-rw-r--r--USAGE2
-rw-r--r--VERSION2
-rw-r--r--VERSION.full2
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--foomatic-rip.1.in79
-rw-r--r--foomaticrip.c85
-rw-r--r--options.c22
-rw-r--r--postscript.c3
11 files changed, 184 insertions, 70 deletions
diff --git a/ChangeLog b/ChangeLog
index 7dfe2f6..368dddd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2009-04-23 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * Re-tagged branch for release 4.0.1.
+
+ * VERSION, README, USAGE, configure.ac: Updated.
+
+2009-04-19 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * Tagged branch for release 4.0.1.
+
+ * foomatic-rip.1.in: Added documentation for the configuration file
+ (/etc/foomatic/filter.conf, bug #312), minor text fixes.
+
+ * postscript.c: Fixed segfault when the PPD contains only a
+ default value but not an option for it (like
+ "*DefaultResolution: 600dpi" and the client inserts this as an
+ option setting into the PostScript input data stream (Windows
+ clients do so). Bug #324.
+
+2009-03-30 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * options.c: Custom page sizes were not accepted if one of the three
+ parameters "WidthOffset", "HeightOffset", or "Orientation" of the
+ "PageSize" option in the PPD file did not allow 0 as value.
+ Made error messages for the parameters of custom options more
+ readable.
+
+ * foomaticrip.c, options.c: If there are printing system options
+ (like "media" of CUPS) and PPD options (like "PageSize") on the
+ command line and they do the same thing (like choosing the paper
+ size) let the setting of the PPD option always have priority,
+ as this is expected for a CUPS filter (see CUPS STR #3148). This
+ is done by treating the printing system options before the PPD
+ options. This fixes Ubuntu bug #338999.
+
2009-03-08 Till Kamppeter <till.kamppeter@gmail.com>
* renderer.c: Fixed segmentation fault in JCL option handling (bugs
diff --git a/README b/README
index ba897c9..a25bdf0 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
-Foomatic 4.0.0
+Foomatic 4.0.1
==============
diff --git a/USAGE b/USAGE
index cb809ce..7c30d36 100644
--- a/USAGE
+++ b/USAGE
@@ -1,5 +1,5 @@
-Foomatic 4.0.0
+Foomatic 4.0.1
==============
foomatic-filters
diff --git a/VERSION b/VERSION
index fcdb2e1..1454f6e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.0.0
+4.0.1
diff --git a/VERSION.full b/VERSION.full
index 0e15d60..20f1017 100644
--- a/VERSION.full
+++ b/VERSION.full
@@ -1 +1 @@
-4.0.0.203
+4.0.1.208
diff --git a/configure b/configure
index 8b9969e..57215ee 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for foomatic-rip "4.0.0".
+# Generated by GNU Autoconf 2.61 for foomatic-rip "4.0.1".
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -572,8 +572,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='foomatic-rip'
PACKAGE_TARNAME='foomatic-rip'
-PACKAGE_VERSION='"4.0.0"'
-PACKAGE_STRING='foomatic-rip "4.0.0"'
+PACKAGE_VERSION='"4.0.1"'
+PACKAGE_STRING='foomatic-rip "4.0.1"'
PACKAGE_BUGREPORT=''
ac_unique_file="options.c"
@@ -1230,7 +1230,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures foomatic-rip "4.0.0" to adapt to many kinds of systems.
+\`configure' configures foomatic-rip "4.0.1" to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1296,7 +1296,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of foomatic-rip "4.0.0":";;
+ short | recursive ) echo "Configuration of foomatic-rip "4.0.1":";;
esac
cat <<\_ACEOF
@@ -1392,7 +1392,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-foomatic-rip configure "4.0.0"
+foomatic-rip configure "4.0.1"
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1406,7 +1406,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by foomatic-rip $as_me "4.0.0", which was
+It was created by foomatic-rip $as_me "4.0.1", which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2076,7 +2076,7 @@ fi
# Define the identity of the package.
PACKAGE='foomatic-rip'
- VERSION='"4.0.0"'
+ VERSION='"4.0.1"'
# Some tools Automake needs.
@@ -7992,7 +7992,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by foomatic-rip $as_me "4.0.0", which was
+This file was extended by foomatic-rip $as_me "4.0.1", which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -8045,7 +8045,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-foomatic-rip config.status "4.0.0"
+foomatic-rip config.status "4.0.1"
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/configure.ac b/configure.ac
index a1eeffc..390902d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT(foomatic-rip, "4.0.0")
+AC_INIT(foomatic-rip, "4.0.1")
AM_INIT_AUTOMAKE([no-define])
AC_CONFIG_SRCDIR([options.c])
diff --git a/foomatic-rip.1.in b/foomatic-rip.1.in
index 95891bc..d1db022 100644
--- a/foomatic-rip.1.in
+++ b/foomatic-rip.1.in
@@ -7,7 +7,7 @@ foomatic-rip \- Universal print filter/RIP wrapper
.SH SYNOPSIS
.SS \fRGeneral Options:
-.BI \fBfoomatic-rip\fR\ \fB[-v]\ [-q]\ [-d]\fP \fI\ <filter\ specific\ options>
+.BI \fBfoomatic-rip\fR\ \fB[-v]\ [-q]\fP \fI\ <spooler-specific\ options>
.SS \fRSpooler-less printing/CPS (older versions) filter:
.BI \fBfoomatic-rip\fR\ \fB[\fB-P\fR \ \fI<printer>\fR \
@@ -50,7 +50,7 @@ foomatic-rip is a universal print filter which works with every known free
software printer spooler. It has the following features:
.Topic
-It translates PostScript (and also other file formats) from standard
+It translates PostScript and PDF (and also other file formats) from standard
input to the printer's native language (usually put to standard
output).
@@ -63,7 +63,7 @@ translation is done is described in a \fBPPD file\fR.
.Topic
Printer capabilities, how to handle user options, and how to build the
renderer command line is always described by \fBPPD files\fR, these
-PPD files can come from \fBFoomatic\fR or can be the ones supplied by
+PPD files usually come from \fBFoomatic\fR or can be the ones supplied by
the manufacturers of PostScript printers. The PPD files are the same
for all spoolers.
@@ -75,7 +75,7 @@ called by the command line options and environment variables which
were supplied by the spooler.
.Topic
-Non-PostScript files are translated to PostScript before they are
+Non-PostScript/PDF files are translated to PostScript before they are
passed to the renderer. This is usually done by \fBa2ps(1)\fR,
\fBenscript(1)\fR, or \fBmpage(1)\fR. foomatic-rip auto-detects which
program is installed, but manual configuration is also possible.
@@ -106,13 +106,6 @@ This opens a security loophole and should not be used in production.
\fRquiet mode - minimal information output
.TP 10
-.B \-d
-\fRidentical to the 'opts' option, but option information is
-left in text format. This is useful for running foomatic-rip
-from the command line to determine what the printer option are.
-The PPD file will need to be specified using the --ppd option.
-
-.TP 10
.BI \-P \ <printer>
\fI<printer>\fR is the configured printer which should be used for this job.
@@ -137,8 +130,8 @@ specified \fI<printer>\fR.
The file(s) to be printed.
.P
-\fBfoomatic-rip\fR will print from standard input unless a file to
-print is specified on the command line.
+\fBfoomatic-rip\fR will print from standard input unless at least one file to
+be printed is specified on the command line.
If your printer PPD file is stored as \fI@sysconfdir@/direct/<printer>.ppd\fR
or \fI~/.foomatic/direct/<printer>.ppd\fR you can use it by simply specifying "-P \fI<printer>\fR".
@@ -199,10 +192,62 @@ See the documentation on the OpenPrinting Web site:
http://www.openprinting.org/
\fR
+.SH "CONFIGURATION FILE"
+
+The file \fB@sysconfdir@/foomatic/filter.conf\fR is read whenever
+foomatic-rip is executed. It allows to configure the behavior of
+foomatic-rip as follows (lines beginning with \fB#\fR are comments and
+therefore get ignored):
+
+.TP 10
+.BI textfilter: \ <command>
+\fRSelects the filter for input files which are not PostScript or PDF.
+\fI<command>\fR is one of \fBa2ps\fR, \fBenscript\fR, or \fBmpage\fR.
+foomatic-rip auitomatically selects the needed command line options.
+
+.TP 10
+.B debug: 0|1
+\fRTurns on (\fB1\fR) or off (\fB0\fR) the debug mode. This is equivalent to
+supplying the \fB--debug\fR command line option. Default setting is \fB0\fR.
+
+.TP 10
+.B ps_accounting: 0|1
+\fRTurns on (\fB1\fR) or off (\fB0\fR) inserting PostScript code for page
+accounting into PostScript jobs. The inserted PostScript code makes
+Ghostscript generating accounting output on stderr and CUPS can this way
+log each page which got printed. The code will only be inserted if CUPS
+is the spooler. Default setting is \fB1\fR.
+
+.TP 10
+.BI echo: \ [<path>/]<executable>
+\fRSets the path to an \fBecho(1)\fR executable which supports \fB-n\fR.
+
+.TP 10
+.BI gspath: \ [<path>/]<executable>
+\fRSets the path to the Ghostscript (\fBgs(1)\fR) executable. To be used if
+Ghostscript is at a non-standard location or if an alternative Ghostscript
+should be used.
+
+.TP 10
+.BI execpath: \ <path>[:<path>]...
+\fRSets the \fB$PATH\fR variable to be used by foomatic-rip.
+
+.TP 10
+.BI cupsfilterpath: \ <path>[:<path>]...
+\fRSets the directories (colon-separated) in which foomatic-rip searches for
+CUPS filters.
+
+.TP 10
+.BI preferred_shell: \ [<path>/]<executable>
+\fRSets the preferred shell to use when executing FoomaticRIPCommandLine and
+friends. Several PPD files use shell constructs that require a more
+modern shell like \fBbash\fR, \fBzsh\fR, or \fBksh\fR.
+
+
.SH FILES
.PD 0
.TP 0
-@sysconfdir@/cups/<printer>.ppd
+@sysconfdir@/cups/ppd/<printer>.ppd
.TP 0
@sysconfdir@/lpd/<printer>.ppd
.TP 0
@@ -213,6 +258,12 @@ http://www.openprinting.org/
@sysconfdir@/direct/<printer>.ppd
The PPD files of the currently defined printers
+
+.TP 8
+@sysconfdir@/foomatic/filter.conf
+
+Configuration file for foomatic-rip
+
.PD 0
.\".SH SEE ALSO
diff --git a/foomaticrip.c b/foomaticrip.c
index 2db5cb8..8c5b352 100644
--- a/foomaticrip.c
+++ b/foomaticrip.c
@@ -285,15 +285,19 @@ char * extract_next_option(char *str, char **pagerange, char **key, char **value
/* processes job->optstr */
void process_cmdline_options()
{
- char *p, *nextopt, *pagerange, *key, *value;
+ char *p, *cmdlineopts, *nextopt, *pagerange, *key, *value;
option_t *opt, *opt2;
int optset;
char tmp [256];
- for (nextopt = extract_next_option(job->optstr->data, &pagerange, &key, &value);
+ _log("Printing system options:\n");
+ cmdlineopts = strdup(job->optstr->data);
+ for (nextopt = extract_next_option(cmdlineopts, &pagerange, &key, &value);
key;
nextopt = extract_next_option(nextopt, &pagerange, &key, &value))
{
+ /* Consider only options which are not in the PPD file here */
+ if ((opt = find_option(key)) != NULL) continue;
if (value)
_log("Pondering option '%s=%s'\n", key, value);
else
@@ -316,13 +320,6 @@ void process_cmdline_options()
if (pagerange) {
snprintf(tmp, 256, "pages:%s", pagerange);
optset = optionset(tmp);
-
- opt = find_option(key);
- if (opt && (option_get_section(opt) != SECTION_ANYSETUP &&
- option_get_section(opt) != SECTION_PAGESETUP)) {
- _log("This option (%s) is not a \"PageSetup\" or \"AnySetup\" option, so it cannot be restricted to a page range.\n", key);
- continue;
- }
}
else
optset = optionset("userval");
@@ -401,38 +398,66 @@ void process_cmdline_options()
for Collate and StapleLocation? These may be here...
*/
}
- else {
- /* Various non-standard printer-specific options */
- if ((opt = find_option(key))) {
- if (!option_set_value(opt, optset, value)) {
- _log(" invalid choice \"%s\", using \"%s\" instead\n",
- value, option_get_value(opt, optset));
- }
- }
- else if (spooler == SPOOLER_PPR_INT) {
- /* Unknown option, pass it to PPR's backend interface */
- if (!backendoptions)
- backendoptions = create_dstr();
- dstrcatf(backendoptions, "%s=%s ", key, value);
- }
- else
- _log("Unknown option %s=%s.\n", key, value);
- }
+ else if (spooler == SPOOLER_PPR_INT) {
+ /* Unknown option, pass it to PPR's backend interface */
+ if (!backendoptions)
+ backendoptions = create_dstr();
+ dstrcatf(backendoptions, "%s=%s ", key, value);
+ }
+ else
+ _log("Unknown option %s=%s.\n", key, value);
}
/* Custom paper size */
else if ((opt = find_option("PageSize")) && option_set_value(opt, optset, key)) {
/* do nothing, if the value could be set, it has been set */
}
+ else
+ _log("Unknown boolean option \"%s\".\n", key);
+ }
+ free(cmdlineopts);
+
+ _log("Options from the PPD file:\n");
+ cmdlineopts = strdup(job->optstr->data);
+ for (nextopt = extract_next_option(cmdlineopts, &pagerange, &key, &value);
+ key;
+ nextopt = extract_next_option(nextopt, &pagerange, &key, &value))
+ {
+ /* Consider only PPD file options here */
+ if ((opt = find_option(key)) == NULL) continue;
+ if (value)
+ _log("Pondering option '%s=%s'\n", key, value);
+ else
+ _log("Pondering option '%s'\n", key);
+
+ if (pagerange) {
+ snprintf(tmp, 256, "pages:%s", pagerange);
+ optset = optionset(tmp);
+
+ if (opt && (option_get_section(opt) != SECTION_ANYSETUP &&
+ option_get_section(opt) != SECTION_PAGESETUP)) {
+ _log("This option (%s) is not a \"PageSetup\" or \"AnySetup\" option, so it cannot be restricted to a page range.\n", key);
+ continue;
+ }
+ }
+ else
+ optset = optionset("userval");
+
+ if (value) {
+ /* Various non-standard printer-specific options */
+ if (!option_set_value(opt, optset, value)) {
+ _log(" invalid choice \"%s\", using \"%s\" instead\n",
+ value, option_get_value(opt, optset));
+ }
+ }
/* Standard bool args:
landscape; what to do here?
duplex; we should just handle this one OK now? */
- else if (!prefixcasecmp(key, "no") && (opt = find_option(&key[2])))
+ else if (!prefixcasecmp(key, "no"))
option_set_value(opt, optset, "0");
- else if ((opt = find_option(key)))
- option_set_value(opt, optset, "1");
else
- _log("Unknown boolean option \"%s\".\n", key);
+ option_set_value(opt, optset, "1");
}
+ free(cmdlineopts);
}
/* checks whether a pdq driver declaration file should be build
diff --git a/options.c b/options.c
index e39bf1e..49c07c4 100644
--- a/options.c
+++ b/options.c
@@ -253,7 +253,9 @@ option_t * find_option(const char *name)
return find_option("PageSize");
for (opt = optionlist; opt; opt = opt->next) {
- if (!strcasecmp(opt->name, name))
+ if ((!strcasecmp(opt->name, name)) ||
+ ((!strcasecmp(opt->name, &name[2])) &&
+ (!prefixcasecmp(name, "no"))))
return opt;
}
return NULL;
@@ -427,12 +429,12 @@ char * get_valid_param_string(option_t *opt, param_t *param, const char *str)
imin = !isempty(param->min) ? atoi(param->min) : -999999;
imax = !isempty(param->max) ? atoi(param->max) : 1000000;
if (i < imin) {
- _log("Value \"%s\" for option \"%s.%s\" is smaller than the minimum value \"%d\"\n",
+ _log("Value \"%s\" for option \"%s\", parameter \"%s\" is smaller than the minimum value \"%d\"\n",
str, opt->name, param->name, imin);
return NULL;
}
else if (i > imax) {
- _log("Value \"%s\" for option \"%s.%s\" is larger than the maximum value \"%d\"\n",
+ _log("Value \"%s\" for option \"%s\", parameter \"%s\" is larger than the maximum value \"%d\"\n",
str, opt->name, param->name, imax);
return NULL;
}
@@ -448,12 +450,12 @@ char * get_valid_param_string(option_t *opt, param_t *param, const char *str)
fmin = !isempty(param->min) ? atof(param->min) : -999999.0;
fmax = !isempty(param->max) ? atof(param->max) : 1000000.0;
if (f < fmin) {
- _log("Value \"%s\" for option \"%s.%s\" is smaller than the minimum value \"%d\"\n",
+ _log("Value \"%s\" for option \"%s\", parameter \"%s\" is smaller than the minimum value \"%d\"\n",
str, opt->name, param->name, fmin);
return NULL;
}
else if (f > fmax) {
- _log("Value \"%s\" for option \"%s.%s\" is larger than the maximum value \"%d\"\n",
+ _log("Value \"%s\" for option \"%s\", parameter \"%s\" is larger than the maximum value \"%d\"\n",
str, opt->name, param->name, fmax);
return NULL;
}
@@ -466,24 +468,24 @@ char * get_valid_param_string(option_t *opt, param_t *param, const char *str)
case TYPE_PASSCODE:
if (param->allowedchars &&
regexec(param->allowedchars, str, 0, NULL, 0) != 0) {
- _log("Custom string \"%s\" for \"%s.%s\" contains illegal characters.\n",
+ _log("Custom string \"%s\" for \"%s\", parameter \"%s\" contains illegal characters.\n",
str, opt->name, param->name);
return NULL;
}
if (param->allowedregexp &&
regexec(param->allowedregexp, str, 0, NULL, 0) != 0) {
- _log("Custom string \"%s\" for \"%s.%s\" does not match the allowed regexp.\n",
+ _log("Custom string \"%s\" for \"%s\", parameter \"%s\" does not match the allowed regexp.\n",
str, opt->name, param->name);
return NULL;
}
len = strlen(str);
if (!isempty(param->min) && len < atoi(param->min)) {
- _log("Custom value \"%s\" is too short for \"%s.%s\".\n",
+ _log("Custom value \"%s\" is too short for option \"%s\", parameter \"%s\".\n",
str, opt->name, param->name);
return NULL;
}
if (!isempty(param->max) && len > atoi(param->max)) {
- _log("Custom value \"%s\" is too long for \"%s.%s\".\n",
+ _log("Custom value \"%s\" is too long for option \"%s\", parameter \"%s\".\n",
str, opt->name, param->name);
return NULL;
}
@@ -548,7 +550,7 @@ static char ** paramvalues_from_string(option_t *opt, const char *str)
else if (!strcasecmp(param->name, "height"))
paramvalues[i] = get_valid_param_string_int(opt, param, (int)height);
else
- paramvalues[i] = get_valid_param_string(opt, param, "0");
+ paramvalues[i] = !isempty(param->min) ? param->min : "-999999";
if (!paramvalues[i]) {
free_paramvalues(opt, paramvalues);
return NULL;
diff --git a/postscript.c b/postscript.c
index b82ba9a..84e6327 100644
--- a/postscript.c
+++ b/postscript.c
@@ -722,7 +722,8 @@ void _print_ps(stream_t *stream)
attribute-to-filter option passing in CUPS is kind of
funky, especially wrt boolean options. */
_log("Found: %s", line->data);
- if ((o = find_option(optionname))) {
+ if ((o = find_option(optionname)) &&
+ (o->type != TYPE_NONE)) {
_log(" Option: %s=%s%s\n", optionname, fromcomposite ? "From" : "", value);
if (spooler == SPOOLER_CUPS &&
linetype == LT_BEGIN_FEATURE &&