File: xdviprint.sample

package info (click to toggle)
xdvik-ja 22.15-j1.03-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 7,556 kB
  • ctags: 9,278
  • sloc: ansic: 79,619; sh: 7,174; makefile: 657; sed: 271; awk: 35
file content (57 lines) | stat: -rw-r--r-- 1,148 bytes parent folder | download | duplicates (2)
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
## arguments.
PRINTER=$1
PAPERSIZE=$2

## temporary files.
DVITMP=${TMPDIR:-/tmp}/xdviprint.$$.dvi
PSTMP=${TMPDIR:-/tmp}/xdviprint.$$.ps

## save to temporary file.
/bin/cat > $DVITMP

##########
###### DVI -> PS
######
## for dvips
# FILTOPTTBL=${XDVIFILTOPTTBL:-/usr/local/share/texmf/xdvi/xdvipaper.dvips}
# DVIPSCMD="dvips -f -t"
####
## for dvi2ps
# FILTOPTTBL=${XDVIFILTOPTTBL:-/usr/local/share/texmf/xdvi/xdvipaper.dvi2ps-j}
# DVIPSCMD="dvi2ps -o"
####
## for jdvi2kps
# FILTOPTTBL=${XDVIFILTOPTTBL:-/usr/local/share/texmf/xdvi/xdvipaper.jdvi2kps}
# DVIPSCMD="jdvi2kps -pa"
##########

## apply filter to paper size name
PAPER=`awk '\
  $1 == "'"$PAPERSIZE"'" {\
    name = $1; sub("#.*", ""); sub("^[ \t]*[^ \t]+[ \t]*", "");\
    if ($0 != "") {name = $0;} if (name != "") {print name; exit}};\
  $1 ~ /^=/ {\
    sub("#.*", ""); sub("=", ""); print; exit}' $FILTOPTTBL`

## exec DVI->PS
$DVIPSCMD $PAPER $DVITMP > $PSTMP

## remove DVI
/bin/rm -f $DVITMP

##########
###### print out
######
## for BSD
lpr -P$PRINTER $PSTMP
####
## for SYSV
# lp -c -d $PRINTER $PSTMP
##########

## remove PS
/bin/rm -f $PSTMP

## exit
exit 0