File: dviprint

package info (click to toggle)
lyx 1.3.4-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 41,996 kB
  • ctags: 28,239
  • sloc: cpp: 169,428; sh: 11,309; ansic: 6,029; perl: 3,828; python: 1,659; makefile: 1,554; yacc: 356; tcl: 163; sed: 72
file content (57 lines) | stat: -rw-r--r-- 991 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
#
# This script prints a dvi file using dvips regardless of the actual
# configuration of dvips.
#
# Copyright 1996-2000 Michael Meskes <meskes@debian.org>
# Placed under GPL
#
# Updated 1/6/98 to use tempfile.

DVICONF=/usr/lib/texmf/dvips
TMPFILE=`tempfile`

#
# Parse command line and remove -o and -P 
#
while [ $# -gt 0 ];
do
	case $1 in
	-P*)	printer=`echo $1 | cut -b3-`
		if [ -z ${printer} ]; then
			printer=$2
			shift 1
		fi;;
	-o*)	tofile="yes"
		options="${options} $1";;
	*)	options="${options} $1";;
	esac
	shift 1
done

#
# Add corrected -o resp. -P arguments
#
if [ ! "${tofile}" ]; then
	if [ "${printer}" ]; then
		if [ -f ${DVICONF}/config.${printer} ]; then
			options="${options} -P ${printer}"
		else
			options="${options} -o ${TMPFILE}"
			printcmd="lpr -P ${printer}"
		fi
	else
		options="${options} -o ${TMPFILE}"
		printcmd="lpr" 
	fi
fi

#
# Call dvips
#
dvips ${options}
if [ "${printcmd}" ]; then
	${printcmd} ${TMPFILE}
	/bin/rm -f ${TMPFILE}
fi