summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog111
-rw-r--r--Makefile.in1
-rw-r--r--README40
-rw-r--r--USAGE11
-rw-r--r--VERSION2
-rw-r--r--VERSION.full2
-rw-r--r--config.h.in9
-rwxr-xr-xconfigure310
-rw-r--r--configure.ac35
-rw-r--r--fileconverter.c22
-rw-r--r--fileconverter.h22
-rw-r--r--foomaticrip.c83
-rw-r--r--foomaticrip.h22
-rw-r--r--options.c31
-rw-r--r--options.h22
-rw-r--r--pdf.c150
-rw-r--r--pdf.h22
-rw-r--r--postscript.c24
-rw-r--r--postscript.h22
-rw-r--r--process.c22
-rw-r--r--process.h22
-rw-r--r--renderer.c52
-rw-r--r--renderer.h22
-rw-r--r--spooler.c24
-rw-r--r--spooler.h22
-rw-r--r--util.c49
-rw-r--r--util.h23
27 files changed, 757 insertions, 420 deletions
diff --git a/ChangeLog b/ChangeLog
index 368dddd..ed9eac8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,114 @@
+2010-02-15 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * Tagged branch for release 4.0.4.
+
+ * VERSION, README, USAGE, configure.ac: Updated for release 4.0.4.
+
+ * README, USAGE: Reflected that libgs is not needed any more.
+
+2010-02-12 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * pdf.c, configure.ac: Removed dependency on libgs by calling
+ Ghostscript via the command line. This makes packaging for Linux
+ distributions easier and also building on Mac OS X and Solaris
+ gets simplified (Bugs #303, #382, #384).
+
+2010-02-05 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * options.c, spooler.c: Made suppression of CUPS accounting PostScript
+ code into a PostScript data stream actually working:
+ PPD keyword is "*FoomaticRIPCommandLinePDF", value must be "true",
+ and check of the ps_accounting variable must be done after parsing
+ the PPD file (Ubuntu bug #513690).
+
+2010-02-03 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * postscript.c: Added NULL pointer check to avoid segfault when
+ custom margins option is added to the PPD file via the
+ alignmargins script (Bug #413, Debian bug #539676).
+
+2010-02-02 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * foomaticrip.c: If incoming PDF needs to get converted to
+ PostScript remove /usr/lib/cups/filter from $PATH, so that
+ "pdftops" of Poppler or XPDF gets called and not "pdftops" of
+ CUPS. The latter has another command line and does undesired page
+ management operations (Ubuntu bug #463059).
+
+2010-01-19 Lars Uebernickel <larsuebernickel@gmx.de>
+
+ * *.[ch], README: Added license headers to all source files and
+ clarified in the README that the license is GPLv2 or later.
+
+2010-01-16 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * options.c: Fixed the previous revision to have bug #399 also
+ fixed for float options.
+
+2010-01-15 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * options.c: When building the driver command line do not use the
+ empty code fields of automatically generated choices of
+ numerical options of Foomatic-based PPDs (bug #399).
+
+2009-08-19 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * Tagged branch for release 4.0.3.
+
+ * VERSION, README, USAGE, configure.ac: Updated for release 4.0.3.
+
+ * foomaticrip.c: If PDF input has to be converted to PostScript
+ due to a PPD which does not support PDF (like the PPDs of the
+ Foomatic "Postscript" driver), we try at first to use "pdftops"
+ (Poppler) and only if this fails we use Ghostscript. This is
+ because Ghostscript blows up PDFs to huge PostScript
+ files (which many PostScript printers failed on), whereas
+ Poppler's output stays compact. As "pdftops" does not support
+ reading from stdin, we create a temporary file with the input
+ before starting to convert. Note that "pdftops" will get only
+ used if it has the "-origpagesizes" option (Poppler 0.11.x or
+ newer), as otherwise documents with pages of different sizes do
+ not get converted correctly (bug #365).
+
+ * pdf.c, util.c, util.h: Moved temp_dir() function from pdf.c to util.c
+ as it is now also needed by foomaticrip.c.
+
+ * foomaticrip.c: Fixed LPRng support (bug #337): PPD file names
+ were not read correctly from /etc/printcap (PRINTCAP_ENTRY
+ environment variable), starting 8 characters after the beginning
+ of the path and not stopping at a colon. Also the last command
+ line argument of the foomatic-rip call was always considered the
+ name of the PPD file, even if the PPD file name was already
+ determined by the PRINTCAP_ENTRY environment variable or the
+ "--ppd" command line argument.
+
+2009-07-01 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * foomaticrip.c: Do not use JCL which is preceeded to the input
+ data. We can generate it on our own and even merge it with the JCL
+ coming from the driver.
+
+ * renderer.c: Make sure that "@PJL SET ..." commands from the PPD
+ file do not get nmerged into the driver's PJL header too early,
+ expecially not before "@PJL JOB ..." lines, as then the commands
+ get ignored. This happened especially with the "InputSlot"
+ option for the "cdnj500" driver.
+
+2009-06-24 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * Tagged branch for release 4.0.2.
+
+ * VERSION, README, USAGE, configure.ac: Updated for release 4.0.2.
+
+2009-05-31 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * configure.ac: Add support for cups-config (bug #349).
+
+2009-05-27 Till Kamppeter <till.kamppeter@gmail.com>
+
+ * renderer.c: Fixed no-return-in-nonvoid-function compiler warning
+ caused by the write_binary_data() function (bug #348).
+
2009-04-23 Till Kamppeter <till.kamppeter@gmail.com>
* Re-tagged branch for release 4.0.1.
diff --git a/Makefile.in b/Makefile.in
index fed1b92..1b8239c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -100,6 +100,7 @@ CPPFLAGS = @CPPFLAGS@
# Paths for CUPS
CUPS = @CUPS@
CUPS_BACKENDS = @CUPS_BACKENDS@
+CUPS_CONFIG = @CUPS_CONFIG@
CUPS_FILTERS = @CUPS_FILTERS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
diff --git a/README b/README
index a25bdf0..75a01a6 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
-Foomatic 4.0.1
+Foomatic 4.0.4
==============
@@ -10,9 +10,6 @@ Filter scripts used by the printer spoolers to convert the incoming
PostScript data into the printer's native format using a
printer/driver specific, but spooler-independent PPD file.
-Till Kamppeter <till.kamppeter@gmail.com>
-Lars Uebernickel <larsuebernickel@gmx.de>
-
http://www.openprinting.org/
This README contains mainly info for developers. See the file USAGE if
@@ -22,8 +19,18 @@ you want to know how to use Foomatic.
Copying
-------
-This package and also the other Foomatic packages are under the
-GPL. See http://www.gnu.org/.
+This package is free software and can be redistributed and/or modified
+under the terms of the GNU General Public License; either version 2 of
+the License, or (at your option) any later version.
+
+
+Authors
+-------
+
+Till Kamppeter <till.kamppeter@gmail.com>
+Lars Uebernickel <larsuebernickel@gmx.de>
+Grant Taylor <gtaylor@picante.com>
+Helge Blischke <h.blischke@srz.de>
Bugs
@@ -95,14 +102,14 @@ printer/driver capabilities info. Manufacturer-supplied PPDs (in most
cases of of PostScript printers) can be used, too.
foomatic-rip is now written in C, in contrary to Perl in Foomatic
-3.x. This allows foomatic-rip to link directly with libraries. Besides
-the standard libraries, foomatic-rip currently only uses the
-Ghostscript library libgs. The functionality of the former
-foomatic-gswrapper is now integrated into foomatic-rip, so the
-foomatic-gswrapper is not needed any more.
+3.x. This allows foomatic-rip to link directly with
+libraries. foomatic-rip currently uses only the standard
+libraries. The functionality of the former foomatic-gswrapper is now
+integrated into foomatic-rip, so the foomatic-gswrapper is not needed
+any more.
beh is still written in Perl and does not need anything else than a
-Perl interpreter.It is only for use with CUPS.
+Perl interpreter. It is only for use with CUPS.
The test/ subdirectory contains a test suite, originally developed for
the distribution compliance tests of the LSB. It also serves as a
@@ -122,14 +129,7 @@ contains the documentation.
Dependencies
------------
-To build this package you need a C compiler, its standard libraries,
-and the Ghostscript library (libgs, /usr/lib/libgs.so*). For the
-latter Ghostscript must be built in shared library mode ("make
-so"). If your libgs is provided by your operating system distribution,
-make sure that its C headers (package libgs.dev(el) or
-ghostscript.dev(el)) are installed.
-
-To run foomatic-rip you need to have the Ghostscript library installed.
+To build this package you need a C compiler, and its standard libraries.
To run beh a Perl interpreter (5.6.0 and newer) is needed.
diff --git a/USAGE b/USAGE
index 7c30d36..0bb13e0 100644
--- a/USAGE
+++ b/USAGE
@@ -1,5 +1,5 @@
-Foomatic 4.0.1
+Foomatic 4.0.4
==============
foomatic-filters
@@ -78,14 +78,7 @@ foomatic-filters needs the Ghostscript library for foomatic-rip and
the Perl interpreter for beh (Backend Error Handler) and the test
suite.
-To build foomatic-rip you need a C compiler, its standard libraries,
-and the Ghostscript library (libgs, /usr/lib/libgs.so*). For the
-latter Ghostscript must be built in shared library mode ("make
-so"). If your libgs is provided by your operating system distribution,
-make sure that its C headers (package libgs.dev(el) or
-ghostscript.dev(el)) are installed.
-
-To run foomatic-rip you need to have the Ghostscript library installed.
+To build foomatic-rip you need a C compiler and its standard libraries.
To run beh (Backend Error Handler) or the test suite a Perl interpreter
(5.6.0 and newer) is needed.
diff --git a/VERSION b/VERSION
index 1454f6e..c5106e6 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.0.1
+4.0.4
diff --git a/VERSION.full b/VERSION.full
index 20f1017..664aeb2 100644
--- a/VERSION.full
+++ b/VERSION.full
@@ -1 +1 @@
-4.0.1.208
+4.0.4.217
diff --git a/config.h.in b/config.h.in
index 1c429d7..80e8480 100644
--- a/config.h.in
+++ b/config.h.in
@@ -18,18 +18,9 @@
/* Define to 1 if you have the `gethostname' function. */
#undef HAVE_GETHOSTNAME
-/* Define to 1 if you have the <ghostscript/iapi.h> header file. */
-#undef HAVE_GHOSTSCRIPT_IAPI_H
-
-/* Define to 1 if you have the <ghostscript/ierrors.h> header file. */
-#undef HAVE_GHOSTSCRIPT_IERRORS_H
-
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
-/* Define to 1 if you have the `gs' library (-lgs). */
-#undef HAVE_LIBGS
-
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
diff --git a/configure b/configure
index 57215ee..79297fb 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.1".
+# Generated by GNU Autoconf 2.61 for foomatic-rip "4.0.4".
#
# 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.1"'
-PACKAGE_STRING='foomatic-rip "4.0.1"'
+PACKAGE_VERSION='"4.0.4"'
+PACKAGE_STRING='foomatic-rip "4.0.4"'
PACKAGE_BUGREPORT=''
ac_unique_file="options.c"
@@ -701,6 +701,7 @@ LIBOBJS
POW_LIB
PERL
PRINTCAP
+CUPS_CONFIG
CUPS
CUPS_FILTERS
CUPS_BACKENDS
@@ -1230,7 +1231,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.1" to adapt to many kinds of systems.
+\`configure' configures foomatic-rip "4.0.4" to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1296,7 +1297,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of foomatic-rip "4.0.1":";;
+ short | recursive ) echo "Configuration of foomatic-rip "4.0.4":";;
esac
cat <<\_ACEOF
@@ -1392,7 +1393,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-foomatic-rip configure "4.0.1"
+foomatic-rip configure "4.0.4"
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1406,7 +1407,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.1", which was
+It was created by foomatic-rip $as_me "4.0.4", which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2076,7 +2077,7 @@ fi
# Define the identity of the package.
PACKAGE='foomatic-rip'
- VERSION='"4.0.1"'
+ VERSION='"4.0.4"'
# Some tools Automake needs.
@@ -6904,8 +6905,60 @@ echo "${ECHO_T}no" >&6; }
fi
-# Check for /usr/lib/cups
-# Extract the first word of "cups", so it can be a program name with args.
+# Extract the first word of "cups-config", so it can be a program name with args.
+set dummy cups-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_CUPS_CONFIG+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $CUPS_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_CUPS_CONFIG="$CUPS_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_CUPS_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+CUPS_CONFIG=$ac_cv_path_CUPS_CONFIG
+if test -n "$CUPS_CONFIG"; then
+ { echo "$as_me:$LINENO: result: $CUPS_CONFIG" >&5
+echo "${ECHO_T}$CUPS_CONFIG" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+if test -n "$CUPS_CONFIG" && test -z "$CUPS_SERVERBIN"; then
+ CUPS_SERVERBIN=`cups-config --serverbin 2>/dev/null`
+fi
+if test -n "$CUPS_SERVERBIN"; then
+ CUPS=$CUPS_SERVERBIN
+ CUPS_FILTERS="$CUPS_SERVERBIN/filter"
+ CUPS_BACKENDS="$CUPS_SERVERBIN/backend"
+
+
+
+else
+ # Check for /usr/lib/cups
+ # Extract the first word of "cups", so it can be a program name with args.
set dummy cups; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word/" >&5
echo $ECHO_N "checking for $ac_word/... $ECHO_C" >&6; }
@@ -6921,7 +6974,7 @@ else
;;
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$LIBSEARCHPATH"
+ ac_dummy="$SERVERBIB$LIBSEARCHPATH"
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -d $ac_dir/$ac_word; then
@@ -6944,8 +6997,8 @@ echo "${ECHO_T}no" >&6; }
fi
-# Check for /usr/lib/cups/filter
-# Extract the first word of "cups/filter", so it can be a program name with args.
+ # Check for /usr/lib/cups/filter
+ # Extract the first word of "cups/filter", so it can be a program name with args.
set dummy cups/filter; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word/" >&5
echo $ECHO_N "checking for $ac_word/... $ECHO_C" >&6; }
@@ -6961,7 +7014,7 @@ else
;;
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$LIBSEARCHPATH"
+ ac_dummy="$FILTERS$LIBSEARCHPATH"
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -d $ac_dir/$ac_word; then
@@ -6984,8 +7037,8 @@ echo "${ECHO_T}no" >&6; }
fi
-# Check for /usr/lib/cups/backend
-# Extract the first word of "cups/backend", so it can be a program name with args.
+ # Check for /usr/lib/cups/backend
+ # Extract the first word of "cups/backend", so it can be a program name with args.
set dummy cups/backend; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word/" >&5
echo $ECHO_N "checking for $ac_word/... $ECHO_C" >&6; }
@@ -7001,7 +7054,7 @@ else
;;
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$LIBSEARCHPATH"
+ ac_dummy="$BACKENDS$LIBSEARCHPATH"
for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -d $ac_dir/$ac_word; then
@@ -7023,6 +7076,7 @@ else
echo "${ECHO_T}no" >&6; }
fi
+fi
# Check for /usr/lib/ppr
# Extract the first word of "ppr", so it can be a program name with args.
@@ -7144,219 +7198,6 @@ echo "${ECHO_T}no" >&6; }
fi
-
-
-for ac_header in ghostscript/ierrors.h ghostscript/iapi.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
- # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
- ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-{ echo "$as_me:$LINENO: checking for gsapi_new_instance in -lgs" >&5
-echo $ECHO_N "checking for gsapi_new_instance in -lgs... $ECHO_C" >&6; }
-if test "${ac_cv_lib_gs_gsapi_new_instance+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgs $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gsapi_new_instance ();
-int
-main ()
-{
-return gsapi_new_instance ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
- ac_cv_lib_gs_gsapi_new_instance=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_gs_gsapi_new_instance=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_gs_gsapi_new_instance" >&5
-echo "${ECHO_T}$ac_cv_lib_gs_gsapi_new_instance" >&6; }
-if test $ac_cv_lib_gs_gsapi_new_instance = yes; then
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBGS 1
-_ACEOF
-
- LIBS="-lgs $LIBS"
-
-fi
-
-
# Check whether --enable-file-converter-check was given.
if test "${enable_file_converter_check+set}" = set; then
enableval=$enable_file_converter_check; if eval "test x${enableval} = xno"; then
@@ -7992,7 +7833,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.1", which was
+This file was extended by foomatic-rip $as_me "4.0.4", which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -8045,7 +7886,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-foomatic-rip config.status "4.0.1"
+foomatic-rip config.status "4.0.4"
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
@@ -8313,6 +8154,7 @@ LIBOBJS!$LIBOBJS$ac_delim
POW_LIB!$POW_LIB$ac_delim
PERL!$PERL$ac_delim
PRINTCAP!$PRINTCAP$ac_delim
+CUPS_CONFIG!$CUPS_CONFIG$ac_delim
CUPS!$CUPS$ac_delim
CUPS_FILTERS!$CUPS_FILTERS$ac_delim
CUPS_BACKENDS!$CUPS_BACKENDS$ac_delim
@@ -8321,7 +8163,6 @@ PPR_INTERFACES!$PPR_INTERFACES$ac_delim
PPR_LIB!$PPR_LIB$ac_delim
A2PS!$A2PS$ac_delim
ENSCRIPT!$ENSCRIPT$ac_delim
-MPAGE!$MPAGE$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -8363,6 +8204,7 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
+MPAGE!$MPAGE$ac_delim
TEXTTOPS!$TEXTTOPS$ac_delim
FILECONVERTER!$FILECONVERTER$ac_delim
ECHO!$ECHO$ac_delim
@@ -8370,7 +8212,7 @@ EXECPATH!$EXECPATH$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 5; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 6; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/configure.ac b/configure.ac
index 390902d..7617852 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.1")
+AC_INIT(foomatic-rip, "4.0.4")
AM_INIT_AUTOMAKE([no-define])
AC_CONFIG_SRCDIR([options.c])
@@ -66,14 +66,30 @@ fi
# Check for /etc/printcap
AC_PATH_DIR(PRINTCAP,printcap,/etc/printcap,$ETCSEARCHPATH)
-# Check for /usr/lib/cups
-AC_PATH_DIR(CUPS,cups,/usr/lib/cups,$LIBSEARCHPATH)
+dnl Check for cups-config
+AC_PATH_PROG(CUPS_CONFIG,cups-config)
-# Check for /usr/lib/cups/filter
-AC_PATH_DIR(CUPS_FILTERS,cups/filter,/usr/lib/cups/filter,$LIBSEARCHPATH)
-
-# Check for /usr/lib/cups/backend
-AC_PATH_DIR(CUPS_BACKENDS,cups/backend,/usr/lib/cups/backend,$LIBSEARCHPATH)
+dnl Use cups-config to find CUPS directories
+if test -n "$CUPS_CONFIG" && test -z "$CUPS_SERVERBIN"; then
+ CUPS_SERVERBIN=`cups-config --serverbin 2>/dev/null`
+fi
+if test -n "$CUPS_SERVERBIN"; then
+ CUPS=$CUPS_SERVERBIN
+ CUPS_FILTERS="$CUPS_SERVERBIN/filter"
+ CUPS_BACKENDS="$CUPS_SERVERBIN/backend"
+ AC_SUBST(CUPS)
+ AC_SUBST(CUPS_FILTERS)
+ AC_SUBST(CUPS_BACKENDS)
+else
+ # Check for /usr/lib/cups
+ AC_PATH_DIR(CUPS,cups,/usr/lib/cups,$SERVERBIB$LIBSEARCHPATH)
+
+ # Check for /usr/lib/cups/filter
+ AC_PATH_DIR(CUPS_FILTERS,cups/filter,/usr/lib/cups/filter,$FILTERS$LIBSEARCHPATH)
+
+ # Check for /usr/lib/cups/backend
+ AC_PATH_DIR(CUPS_BACKENDS,cups/backend,/usr/lib/cups/backend,$BACKENDS$LIBSEARCHPATH)
+fi
# Check for /usr/lib/ppr
AC_PATH_DIR(PPR,ppr,/usr/lib/ppr,$LIBSEARCHPATH)
@@ -84,9 +100,6 @@ AC_PATH_DIR(PPR_INTERFACES,ppr/interfaces,/usr/lib/ppr/interfaces,$LIBSEARCHPATH
# Check for /usr/lib/ppr/lib
AC_PATH_DIR(PPR_LIB,ppr/lib,/usr/lib/ppr/lib,$LIBSEARCHPATH)
-AC_CHECK_HEADERS([ghostscript/ierrors.h ghostscript/iapi.h])
-AC_CHECK_LIB(gs, gsapi_new_instance)
-
AC_ARG_ENABLE(file-converter-check, [ --enable-file-converter-check check whether a file converter is installed [default=yes]],
[if eval "test x${enableval} = xno"; then
NOCONVERTERCHECK=1
diff --git a/fileconverter.c b/fileconverter.c
index f5e4da4..6751dbf 100644
--- a/fileconverter.c
+++ b/fileconverter.c
@@ -1,3 +1,25 @@
+/* fileconverter.c
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#include <stdlib.h>
#include <stdio.h>
diff --git a/fileconverter.h b/fileconverter.h
index 1b96a10..ecd0544 100644
--- a/fileconverter.h
+++ b/fileconverter.h
@@ -1,3 +1,25 @@
+/* fileconverter.h
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef fileconverter_h
#define fileconverter_h
diff --git a/foomaticrip.c b/foomaticrip.c
index 8c5b352..b548b1e 100644
--- a/foomaticrip.c
+++ b/foomaticrip.c
@@ -1,3 +1,25 @@
+/* foomaticrip.c
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#include "foomaticrip.h"
#include "util.h"
@@ -965,10 +987,13 @@ int print_file(const char *filename, int convert)
n = fread(buf, 1, sizeof(buf) - 1, file);
buf[n] = '\0';
type = guess_file_type(buf, n, &startpos);
- if (startpos > 0) {
+ /* We do not use any JCL preceeded to the inputr data, as it is simply
+ the PJL commands from the PPD file, and these commands we can also
+ generate, end we even merge them with PJl from the driver */
+ /*if (startpos > 0) {
jobhasjcl = 1;
write_output(buf, startpos);
- }
+ }*/
if (file != stdin)
rewind(file);
@@ -983,26 +1008,48 @@ int print_file(const char *filename, int convert)
char pdf2ps_cmd[PATH_MAX];
FILE *out, *in;
int renderer_pid;
+ char tmpfilename[PATH_MAX] = "";
_log("Driver does not understand PDF input, "
"converting to PostScript\n");
pdfconvertedtops = 1;
+
+ /* If reading from stdin, write everything into a temporary file */
+ if (file == stdin)
+ {
+ int fd;
+ FILE *tmpfile;
+
+ snprintf(tmpfilename, PATH_MAX, "%s/foomatic-XXXXXX", temp_dir());
+ fd = mkstemp(tmpfilename);
+ if (fd < 0) {
+ _log("Could not create temporary file: %s\n", strerror(errno));
+ return EXIT_PRNERR_NORETRY_BAD_SETTINGS;
+ }
+ tmpfile = fdopen(fd, "r+");
+ copy_file(tmpfile, stdin, buf, n);
+ fclose(tmpfile);
+
+ filename = tmpfilename;
+ }
+
+ /* If the spooler is CUPS we remove the /usr/lib/cups/filter
+ (CUPS filter directory, can be different, but ends with
+ "/cups/filter") which CUPS adds to the beginning of $PATH,
+ so that Poppler's/XPDF's pdftops filter is called and not
+ the one of CUPS, as the one of CUPS has a different command
+ line and does undesired page management operations */
snprintf(pdf2ps_cmd, PATH_MAX,
- "gs -q -sstdout=%%stderr -sDEVICE=pswrite -sOutputFile=- "
- "-dBATCH -dNOPAUSE -dPARANOIDSAFER %s",
- file == stdin ? "-" : filename);
+ "%spdftops -level2 -origpagesizes %s - 2>/dev/null || "
+ "gs -q -sstdout=%%stderr -sDEVICE=pswrite -sOutputFile=- "
+ "-dBATCH -dNOPAUSE -dPARANOIDSAFER %s 2>/dev/null",
+ (spooler == SPOOLER_CUPS ?
+ "PATH=${PATH#*/cups/filter:} " : ""),
+ filename, filename);
renderer_pid = start_system_process("pdf-to-ps", pdf2ps_cmd, &in, &out);
- if (file == stdin)
- {
- fwrite(buf, 1, n, in);
- while ((n = fread(buf, 1, sizeof(buf), file)))
- fwrite(buf, 1, n, in);
- fclose(in);
- }
-
if (dup2(fileno(out), fileno(stdin)) < 0)
rip_die(EXIT_PRNERR_NORETRY_BAD_SETTINGS,
"Couldn't dup stdout of pdf-to-ps\n");
@@ -1192,12 +1239,13 @@ int main(int argc, char** argv)
spooler = SPOOLER_LPRNG;
if ((str = strstr(getenv("PRINTCAP_ENTRY"), "ppd=")))
str += 4;
- else if ((str = strstr(getenv("PRINTCAP_ENTRY"), "ppdfile=")));
- str += 8;
+ else if ((str = strstr(getenv("PRINTCAP_ENTRY"), "ppdfile=")))
+ str += 8;
if (str) {
while (isspace(*str)) str++;
p = job->ppdfile;
- while (*str != '\0' && !isspace(*str) && *str != '\n') {
+ while (*str != '\0' && !isspace(*str) && *str != '\n' &&
+ *str != ':') {
if (isprint(*str) && strchr(shellescapes, *str) == NULL)
*p++ = *str;
str++;
@@ -1306,8 +1354,9 @@ int main(int argc, char** argv)
init_cups(arglist, filelist, job);
break;
- case SPOOLER_LPD:
case SPOOLER_LPRNG:
+ if (job->ppdfile[0] != '\0') break;
+ case SPOOLER_LPD:
case SPOOLER_GNULPR:
/* Get PPD file name as the last command line argument */
if (arglist->last)
diff --git a/foomaticrip.h b/foomaticrip.h
index f91570d..a13a465 100644
--- a/foomaticrip.h
+++ b/foomaticrip.h
@@ -1,3 +1,25 @@
+/* foomaticrip.h
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef foomatic_h
#define foomatic_h
diff --git a/options.c b/options.c
index 49c07c4..777ba50 100644
--- a/options.c
+++ b/options.c
@@ -1,3 +1,25 @@
+/* options.c
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#include "foomaticrip.h"
#include "options.h"
@@ -863,7 +885,8 @@ int option_get_command(dstr_t *cmd, option_t *opt, int optionset, int section)
/* If the value is set to a predefined choice */
choice = option_find_choice(opt, valstr);
- if (choice) {
+ if (choice && (*choice->command ||
+ ((opt->type != TYPE_INT) && (opt->type != TYPE_FLOAT)))) {
dstrcpy(cmd, choice->command);
return 1;
}
@@ -1511,9 +1534,9 @@ void read_ppd_file(const char *filename)
else if (strcmp(key, "FoomaticRIPCommandLinePDF") == 0) {
unhtmlify(cmd_pdf, 1024, value->data);
}
- else if (strcmp(key, "FoomaticNoPageAccounting") == 0) {
+ else if (strcmp(key, "FoomaticRIPNoPageAccounting") == 0) {
/* Boolean value */
- if (strcasecmp(value->data, "true") != 0) {
+ if (strcasecmp(value->data, "true") == 0) {
/* Driver is not compatible with page accounting according to the
Foomatic database, so turn it off for this driver */
ps_accounting = 0;
@@ -1899,7 +1922,7 @@ void append_setup_section(dstr_t *str, int optset, int comments)
}
/* PostScript code to generate accounting messages for CUPS */
- if (spooler == SPOOLER_CUPS) {
+ if (spooler == SPOOLER_CUPS && ps_accounting == 1) {
_log("Inserting PostScript code for CUPS' page accounting\n");
dstrcat(str, accounting_prolog);
}
diff --git a/options.h b/options.h
index 6e66d04..cb059ae 100644
--- a/options.h
+++ b/options.h
@@ -1,3 +1,25 @@
+/* options.h
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef options_h
#define options_h
diff --git a/pdf.c b/pdf.c
index 53a02b0..968c885 100644
--- a/pdf.c
+++ b/pdf.c
@@ -1,3 +1,25 @@
+/* pdf.c
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#include "foomaticrip.h"
#include "util.h"
@@ -11,104 +33,36 @@
#include <unistd.h>
#include <errno.h>
-#include <ghostscript/iapi.h>
-#include <ghostscript/ierrors.h>
-
#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
-const char *pagecountcode =
- "/pdffile (%s) (r) file def\n"
- "pdfdict begin\n"
- "pdffile pdfopen begin\n"
- "(PageCount: ) print\n"
- "pdfpagecount == flush\n" /* 'flush' makes sure that gs_stdout is called
- before gsapi_run_string returns */
- "currentdict pdfclose\n"
- "end end\n";
-
-char gsout [256];
-
static int wait_for_renderer();
-static const char * temp_dir()
-{
- static const char *tmpdir = NULL;
-
- if (!tmpdir)
- {
- const char *dirs[] = { getenv("TMPDIR"), P_tmpdir, "/tmp", NULL };
- const char **dir;
-
- for (dir = dirs; *dir; dir++)
- if (access(*dir, W_OK) == 0) {
- tmpdir = *dir;
- break;
- }
- if (tmpdir)
- {
- _log("Storing temporary files in %s\n", tmpdir);
- setenv("TMPDIR", tmpdir, 1); /* for child processes */
- }
- else
- rip_die(EXIT_PRNERR_NORETRY_BAD_SETTINGS,
- "Cannot find a writable temp dir.");
- }
-
- return tmpdir;
-}
-
-int gs_stdout(void *instance, const char *str, int len)
-{
- int last;
- if (isempty(gsout)) {
- last = len < 256 ? len : 255;
- strncpy(gsout, str, last +1);
- gsout[last] = '\0';
- }
- return len; /* ignore everything after the first few chars */
-}
-
-int gs_stderr(void *instance, const char *str, int len)
-{
- char *buf = malloc(len +1);
- strncpy(buf, str, len);
- buf[len] = '\0';
- _log("Ghostscript: %s", buf);
- free(buf);
- return len;
-}
-
static int pdf_count_pages(const char *filename)
{
- void *minst;
- int gsargc = 3;
- char *gsargv[] = { "", "-dNODISPLAY", "-q" };
+ char gscommand[4095];
+ char output[31] = "";
int pagecount;
- int exit_code;
- char code[2048];
- if (gsapi_new_instance(&minst, NULL) < 0) {
- _log("Could not create ghostscript instance\n");
- return -1;
- }
- gsapi_set_stdio(minst, NULL, gs_stdout, gs_stderr);
- if (gsapi_init_with_args(minst, gsargc, gsargv) < 0) {
- _log("Could not init ghostscript\n");
- gsapi_exit(minst);
- gsapi_delete_instance(minst);
- return -1;
- }
+ snprintf(gscommand, 4095, "%s -dNODISPLAY -q -c "
+ "'/pdffile (%s) (r) file def pdfdict begin pdffile pdfopen begin "
+ "(PageCount: ) print pdfpagecount == flush currentdict pdfclose "
+ "end end quit'",
+ gspath, filename);
- snprintf(code, 2048, pagecountcode, filename);
- if (gsapi_run_string(minst, code, 0, &exit_code) == 0) {
- if (sscanf(gsout, "PageCount: %d", &pagecount) < 1)
- pagecount = -1;
+ FILE *pd = popen(gscommand, "r");
+ if (!pd) {
+ _log("Failed to execute ghostscript to determine number of input pages!\n");
+ return 0;
}
- gsapi_exit(minst);
- gsapi_delete_instance(minst);
+ fread(output, 1, 31, pd);
+ pclose(pd);
+
+ if (sscanf(output, "PageCount: %d", &pagecount) < 1)
+ pagecount = -1;
+
return pagecount;
}
@@ -156,11 +110,8 @@ static int pdf_extract_pages(char filename[PATH_MAX],
int first,
int last)
{
- void *minst;
+ char gscommand[4095];
char filename_arg[PATH_MAX], first_arg[50], last_arg[50];
- const char *gs_args[] = { "", "-q", "-dNOPAUSE", "-dBATCH",
- "-dPARANOIDSAFER", "-sDEVICE=pdfwrite", filename_arg, first_arg,
- last_arg, pdffilename };
_log("Extracting pages %d through %d\n", first, last);
@@ -169,12 +120,6 @@ static int pdf_extract_pages(char filename[PATH_MAX],
if (!filename[0])
return 0;
- if (gsapi_new_instance(&minst, NULL) < 0)
- {
- _log("Could not create ghostscript instance\n");
- return 0;
- }
-
snprintf(filename_arg, PATH_MAX, "-sOutputFile=%s", filename);
snprintf(first_arg, 50, "-dFirstPage=%d", first);
if (last > 0)
@@ -182,18 +127,17 @@ static int pdf_extract_pages(char filename[PATH_MAX],
else
first_arg[0] = '\0';
- gsapi_set_stdio(minst, NULL, NULL, gs_stderr);
+ snprintf(gscommand, 4095, "%s -q -dNOPAUSE -dBATCH -dPARANOIDSAFER"
+ "-sDEVICE=pdfwrite %s %s %s %s",
+ gspath, filename_arg, first_arg, last_arg, pdffilename);
- if (gsapi_init_with_args(minst, ARRAY_LEN(gs_args), (char **)gs_args) < 0)
- {
- _log("Could not run ghostscript to extract the pages\n");
- gsapi_exit(minst);
- gsapi_delete_instance(minst);
+ FILE *pd = popen(gscommand, "r");
+ if (!pd) {
+ _log("Could not run ghostscript to extract the pages!\n");
return 0;
}
+ pclose(pd);
- gsapi_exit(minst);
- gsapi_delete_instance(minst);
return 1;
}
diff --git a/pdf.h b/pdf.h
index da98eb9..f2f9b1c 100644
--- a/pdf.h
+++ b/pdf.h
@@ -1,3 +1,25 @@
+/* pdf.h
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef pdf_h
#define pdf_h
diff --git a/postscript.c b/postscript.c
index 84e6327..7aa0233 100644
--- a/postscript.c
+++ b/postscript.c
@@ -1,3 +1,25 @@
+/* postscript.c
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#include "foomaticrip.h"
#include "util.h"
@@ -728,7 +750,7 @@ void _print_ps(stream_t *stream)
if (spooler == SPOOLER_CUPS &&
linetype == LT_BEGIN_FEATURE &&
!option_get_value(o, optionset("notfirst")) &&
- strcmp(option_get_value(o, optset), value) != 0 &&
+ strcmp(option_get_value(o, optset) ?: "", value) != 0 &&
(inheader || option_get_section(o) == SECTION_PAGESETUP)) {
/* We have the first occurence of an option
diff --git a/postscript.h b/postscript.h
index b851dd3..cb6c525 100644
--- a/postscript.h
+++ b/postscript.h
@@ -1,3 +1,25 @@
+/* postscript.h
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef postscript_h
#define postscript_h
diff --git a/process.c b/process.c
index 9808cda..f5763bd 100644
--- a/process.c
+++ b/process.c
@@ -1,3 +1,25 @@
+/* process.c
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#include "foomaticrip.h"
#include "process.h"
diff --git a/process.h b/process.h
index bc201b5..b95dcb4 100644
--- a/process.h
+++ b/process.h
@@ -1,3 +1,25 @@
+/* process.h
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef process_h
#define process_h
diff --git a/renderer.c b/renderer.c
index 48a56aa..4a46e9c 100644
--- a/renderer.c
+++ b/renderer.c
@@ -1,3 +1,25 @@
+/* renderer.c
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#define _GNU_SOURCE
@@ -139,7 +161,7 @@ char * read_line(FILE *stream, size_t *readbytes)
return line;
}
-write_binary_data(FILE *stream, const char *data, size_t bytes)
+void write_binary_data(FILE *stream, const char *data, size_t bytes)
{
int i;
for (i=0; i < bytes; i++)
@@ -248,7 +270,7 @@ static int write_merged_jcl_options(FILE *stream,
{
char *p = strstr(original_opts[0], jclstr);
char header[128];
- char **optsp;
+ char **optsp1 = NULL, **optsp2 = NULL;
/* No JCL options in original_opts, just prepend opts */
if (argv_count(original_opts) == 1)
@@ -284,18 +306,30 @@ static int write_merged_jcl_options(FILE *stream,
header[p - original_opts[0]] = '\0';
fprintf(stream, "%s", header);
- for (optsp = opts; *optsp; optsp++)
- if (!jcl_options_find_keyword(original_opts, *optsp, jclstr))
- fprintf(stream, "%s\n", *optsp);
-
- for (optsp = original_opts; *(optsp + 1); optsp++) {
- if (optsp != original_opts) p = *optsp;
+ /* Insert the JCL commands from the PPD file right before the first
+ "@PJL SET ..." line from the, if there are no "@PJL SET ..." lines,
+ directly before "@PJL ENTER LANGUAGE ...", otherwise after the JCL
+ commands from the driver */
+ for (optsp1 = original_opts; *(optsp1 + 1); optsp1++) {
+ if (optsp2 == NULL &&
+ ((strstr(*optsp1, "ENTER LANGUAGE") != NULL) ||
+ (strncasecmp(*optsp1, "@PJL SET ", 9) == 0))) {
+ for (optsp2 = opts; *optsp2; optsp2++)
+ if (!jcl_options_find_keyword(original_opts, *optsp2, jclstr))
+ fprintf(stream, "%s\n", *optsp2);
+ }
+ if (optsp1 != original_opts) p = *optsp1;
if (jcl_options_find_keyword(opts, p, jclstr))
fprintf(stream, "%s\n", jcl_options_find_keyword(opts, p, jclstr));
else
fprintf(stream, "%s\n", p);
}
- write_binary_data(stream, *optsp, readbinarybytes);
+ if (optsp2 == NULL)
+ for (optsp2 = opts; *optsp2; optsp2++)
+ if (!jcl_options_find_keyword(original_opts, *optsp2, jclstr))
+ fprintf(stream, "%s\n", *optsp2);
+
+ write_binary_data(stream, *optsp1, readbinarybytes);
return 1;
}
diff --git a/renderer.h b/renderer.h
index 963208d..298f67b 100644
--- a/renderer.h
+++ b/renderer.h
@@ -1,3 +1,25 @@
+/* renderer.h
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef renderer_h
#define renderer_h
diff --git a/spooler.c b/spooler.c
index 8255d51..ed48be1 100644
--- a/spooler.c
+++ b/spooler.c
@@ -1,3 +1,25 @@
+/* spooler.c
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#include "spooler.h"
#include "foomaticrip.h"
@@ -267,7 +289,7 @@ void init_cups(list_t *arglist, dstr_t *filelist, jobparams_t *job)
}
}
- accounting_prolog = ps_accounting ? accounting_prolog_code : NULL;
+ accounting_prolog = accounting_prolog_code;
/* On which queue are we printing?
CUPS gives the PPD file the same name as the printer queue,
diff --git a/spooler.h b/spooler.h
index 8b915c8..d90d71a 100644
--- a/spooler.h
+++ b/spooler.h
@@ -1,3 +1,25 @@
+/* spooler.h
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef SPOOLER_H
#define SPOOLER_H
diff --git a/util.c b/util.c
index 57adb46..cb9b043 100644
--- a/util.c
+++ b/util.c
@@ -1,3 +1,25 @@
+/* util.c
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#include "util.h"
#include "foomaticrip.h"
@@ -11,6 +33,33 @@
const char* shellescapes = "|<>&!$\'\"#*?()[]{}";
+const char * temp_dir()
+{
+ static const char *tmpdir = NULL;
+
+ if (!tmpdir)
+ {
+ const char *dirs[] = { getenv("TMPDIR"), P_tmpdir, "/tmp", NULL };
+ const char **dir;
+
+ for (dir = dirs; *dir; dir++)
+ if (access(*dir, W_OK) == 0) {
+ tmpdir = *dir;
+ break;
+ }
+ if (tmpdir)
+ {
+ _log("Storing temporary files in %s\n", tmpdir);
+ setenv("TMPDIR", tmpdir, 1); /* for child processes */
+ }
+ else
+ rip_die(EXIT_PRNERR_NORETRY_BAD_SETTINGS,
+ "Cannot find a writable temp dir.");
+ }
+
+ return tmpdir;
+}
+
int prefixcmp(const char *str, const char *prefix)
{
return strncmp(str, prefix, strlen(prefix));
diff --git a/util.h b/util.h
index 90e2596..c21290b 100644
--- a/util.h
+++ b/util.h
@@ -1,3 +1,25 @@
+/* util.h
+ *
+ * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com>
+ * Copyright (C) 2008 Lars Uebernickel <larsuebernickel@gmx.de>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef util_h
#define util_h
@@ -13,6 +35,7 @@
extern const char* shellescapes;
int isempty(const char *string);
+const char * temp_dir();
int prefixcmp(const char *str, const char *prefix);
int prefixcasecmp(const char *str, const char *prefix);