[mu TECH] lpr tweak / bug(?)

From: Alfie Costa (agcosta@gis.net)
Date: Thu Apr 06 2000 - 07:04:58 CEST


Tweak 6:

In /usr/bin/lpr

It says:
    
    shift; shift

...which might as well be:

    shift 2

...also some business with 'exec' I may not properly understand, or else
it is a bug:

    *:*) exec /usr/lpr/rem/$prog -P$pr "$@" ;;

    *)
            echo -n "Send file to $pr ..."
                exec /usr/lpr/loc/$prog "$@"
            echo "done." ;;
 
I think the 2nd 'exec' will prevent 'echo "done."' from ever running.
Are the 'exec' statements there to save memory?

In the attached file I've cut out both 'exec's, which may be a too excessive
fix?


#!/bin/ash

# lpr wrapper for lpr-local and lpr-remote
# by M.Andreoli (C) 1999

if [ -r /setup/cnf/printer.cnf ] ; then
        . /setup/cnf/printer.cnf
else
        PRINTER=ascii
fi

export PRINTER

# Syntax

case "$1" in
  -P)
    pr=$2;
    shift 2
    ;;
  -P*)
    pr=`echo -n "$1" | sed -e 's/^-P//'`
    shift
    ;;
esac

pr=${pr:-$PRINTER}
prog=`basename $0`

case $1 in
-h)
cat <<END
lpr, lpq, lprm -- muLinux offline printing

Usage :
        lpr [-h] [-f output] [-Phost:printer] [files]
        lpq [-P host:printer] -l
        lprm [-P host:printer] [-all | jobs]

Notes:
        This lpr support only ASCII and HP-PCL printers
        and work for fews file-type: TIFF-g3 (fax) and ascii but,
        using -P option, you can redirect your input to remote
        UNIX printer (BSD-like).

END
exit 0
        ;;
esac

# switch local<->remote

case "$pr" in
*:*) /usr/lpr/rem/$prog -P$pr "$@"
        ;;
*)
        echo -n "Send file to $pr ..."
        /usr/lpr/loc/$prog "$@"
        echo "done."
        ;;
esac


---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: mulinux-help@sunsite.auc.dk



This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:13 CET