[cups.general] Re: Print to external programm

Johannes Meixner jsmeix at suse.de
Mon Apr 24 02:33:34 PDT 2006


Hello,

On Apr 23 12:56 Kurt Pfeifle wrote (shortened):
> do you have access to a SUSE-10.0 box?

Since openSUSE anybody has access to Suse Linux:

http://en.opensuse.org/Released_Version

Select "Installation Repository" and follow the path and e.g.
for Suse Linux 10.0 on x86 (for i586 CPUs) you may be lead
(depending on your country) to a mirror like:

http://ftp.gwdg.de/pub/opensuse/distribution/SL-10.0-OSS/inst-source/suse/i586/


And here my usual simple example backend with everything harcoded
but hopefully a nice simple example how easy a backend can be made:
--------------------------------------------------------------------
#! /bin/bash
# see the "CUPS Software Programmers Manual":
# "Writing Filters" and "Writing Backends"
# and see the man page "man backend".

# debug info in /var/log/cups/error_log
set -x

# output "Device Discovery" information on stdout
if test "$#" = "0"
then
  echo 'direct lp0:/dev/lp0 "Unknown" "lp0 Printer"'
  exit 0
fi

# have the input at fd0 (stdin) in any case
if test -n "$6"
then
  exec <"$6"
fi

# infinite retries to access the device
until cat /dev/null >/dev/lp0
do
  echo 'INFO: cannot access /dev/lp0 - retry in 30 seconds' 1>&2
  sleep 30
done
echo 'INFO: sending the data to /dev/lp0' 1>&2

# forward the data from stdin to the device
if cat - >/dev/lp0
then
  echo 'INFO:' 1>&2
  exit 0
else
  echo 'ERROR: failed to send the data to /dev/lp0' 1>&2
  exit 1
fi
--------------------------------------------------------------------


Kind Regards
Johannes Meixner
-- 
SUSE LINUX Products GmbH, Maxfeldstrasse 5      Mail: jsmeix at suse.de
90409 Nuernberg, Germany                    WWW: http://www.suse.de/





More information about the cups mailing list