Printing through UUCP

Stephen J. Friedl friedl at mtndew.Tustin.CA.US
Mon Dec 24 06:24:06 AEST 1990


Greg Woods posts the source to an lp interface script to let one printer
server multiple machines, but a bug caught my eye.  This appears in all the
lp interfaces I've seen, so this is by no means picking on Greg.

	PRINTER=`basename $0`
	TITLE=$3
	COPIES=$4
	OPTIONS=$5
	shift; shift; shift; shift; shift

	files="$*"

	for F in $files
	do
		FILES="$FILES !$F"
	done

The problem with this is that filenames with spaces in them can't get
printed because the assignment of "$*" to "$files" causes the notion of
the separate args to be lost.  The right way to do this is:

	PRINTER=`basename $0`
	TITLE=$3
	COPIES=$4
	OPTIONS=$5
	shift 5;

	for F in "$@"			# <-- this expands things right
	do
		FILES="$FILES !$F"
	done

Now you can print a file with spaces in them.

     Steve

-- 
Stephen J. Friedl, KA8CMY  /  3B2-kind-of-guy  /  Tustin, CA / 3B2-kind-of-guy
+1 714 544 6561  / friedl at mtndew.Tustin.CA.US  / {uunet,attmail}!mtndew!friedl

Why not add Hollerith fields to printf()?



More information about the Alt.sources.d mailing list