File lpdfilter-0.46.dif of Package lpdfilter

--- Imakefile
+++ Imakefile	2006-06-02 15:58:26.000000000 +0200
@@ -21,7 +21,7 @@ GLOBAL		=	$(LIBDIR)/global
 MAN		=	/usr/share/man
 
 CC		=	gcc
-CFLAGS		=	-O2 -Wall -pipe -funroll-loops
+CFLAGS		=	$(RPM_OPT_FLAGS) -Wall -pipe -funroll-loops
 LFLAGS		=	-s
 INSTALL		=	install
 LN		=	ln
--- bin/if
+++ bin/if	2007-07-27 14:14:31.876957000 +0200
@@ -129,8 +129,16 @@ set +a
 # PLP is here a BSDlpr.
 #
 case "$control" in
-    *control.*) daemon="LPRng"  ;;
-    *)		daemon="BSDlpr" ;;
+    *control.*)
+	daemon="LPRng"
+	;;
+    *)
+	if test -n "$PRINTCAP_ENTRY" ; then
+	    daemon="LPRng"
+	else
+	    daemon="BSDlpr"
+	fi
+	;;
 esac
 
 #
@@ -216,8 +224,12 @@ unset line opt arg
 #
 # Read printcap entry and get all options
 #
-entry="$(readpc "$queue" "$printcap" 2> /dev/null)"
-test $? -eq 0 || fatal_error "Error: can not print"
+if test -n "$PRINTCAP_ENTRY" ; then
+    entry="$(echo "$PRINTCAP_ENTRY" | sed  ":join /^${queue}.*\$/{N; s/\n[[:blank:]]:/:/; b join}")"
+else
+    entry="$(readpc "$queue" "$printcap" 2> /dev/null)"
+    test $? -eq 0 || fatal_error "Error: can not print"
+fi
 n=0
 IFS=":"
 for e in $entry ; do
--- filter/pdf2ps
+++ filter/pdf2ps	2008-01-08 14:29:27.747906390 +0100
@@ -41,9 +41,30 @@ fi
 # run the command on stdin
 #
 if type -p acroread &> /dev/null ; then
-    exec -a acroread acroread -toPostScript
+    medium="-size ${size:=a4}"
+    case "${size:=a4}" in
+	tabloid|11x17)		medium="-size tabloid" ;;
+	a4dj)			medium="-size a4"      ;;
+	letterdj)		medium="-size letter"  ;;
+	letter|legal|ledger)	medium="-size $size"   ;;
+	a[345)			medium="-size $size"   ;;
+	b[45])			medium="-size $size"   ;;
+    esac
+
+    #
+    # The current acroread crashes on reading from stdin
+    #
+    #   exec -a acroread acroread -toPostScript -level2 -shrink -expand -saveVM ${medium}
+
+    trap 'test -n "$tmp" -a -e "$tmp" && rm -f "$tmp"
+	  test -n "$out" -a -e "$out" && rm -f "$out"' EXIT
+    tmp="$(mktemp ${TMPDIR:-/tmp}/lpdfilter-${0##*/}-XXXXXXXXXX)" || exit 2
+    out="$(mktemp ${TMPDIR:-/tmp}/lpdfilter-${0##*/}-XXXXXXXXXX)" || exit 2
+    cat > $tmp
+    acroread -toPostScript -level2 -shrink -expand -saveVM ${medium} -pairs $tmp $out
+    cat $out
 else
-    tmp="$(mktemp ${TMPDIR:-/tmp}/lpdfilter-${0##*/}.XXXXXX)" || exit 2
+    tmp="$(mktemp ${TMPDIR:-/tmp}/lpdfilter-${0##*/}.XXXXXXXXXX)" || exit 2
     cat > $tmp
     $pdftops -dPSLevel1 $tmp -
 fi
--- global/setup.lib
+++ global/setup.lib	2007-09-04 17:27:13.620460000 +0200
@@ -567,6 +567,14 @@ function upp ()
 #   -> /usr/share/ghostscript/<version>/doc/Devices.htm
 }
 
+catalog=catalog.devices
+for x in /usr/share/doc/packages/ghostscript*/catalog.devices ; do
+    if test -s $x ; then
+        catalog=$x
+    fi
+done
+unset x
+
 # Ask for ghostscript driver
 function ghostscript ()
 {
@@ -575,7 +583,7 @@ function ghostscript ()
     local message="
 Please typein the name of the device driver given to ghostscript.
 This driver should work with your printer. A list is found in the
-file /usr/share/doc/packages/ghostscript/catalog.devices.
+file ${catalog}.
 For some types of main drivers (e.g. hpijs, hpdj, uniprint, omni)
 you have to add a prefix like hpdj which leads e.g. to hpdj_500.
 Some printers need a post processor filter to convert ghostscript
@@ -713,10 +721,10 @@ To read catalog.devices type nothing.
 # Read catalog.devices
 function catalog ()
 {
-    if test -s /usr/share/doc/packages/ghostscript/catalog.devices ; then
+    if test -s ${catalog} ; then
 	run_dialog --yesno "\\nDo you want read catalog.devices of ghostscript?\\n" \
 	7 $((COLS-10)) || return
-	run_dialog --textbox /usr/share/doc/packages/ghostscript/catalog.devices \
+	run_dialog --textbox ${catalog} \
 	$((ROWS-2)) $((COLS-10))
     else
 	run_dialog --msgbox "\\nIt seems that there is no ghostscript installed (no catalog.devices).\\n" \
openSUSE Build Service is sponsored by