Warning: this is a htmlized version!
The original is across this link.
#######
#
# E-scripts on printing.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/a/e/print.e>
#           or at <http://angg.twu.net/e/print.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/a/.emacs[.html]>,
#                 <http://angg.twu.net/a/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######



# (find-node "(a2ps)Top")
# (find-node "(a2ps)Some Encodings")
# (find-fline "/usr/share/a2ps/encoding/")
# (find-node "(a2ps)Sheets Options")

# (find-lynxfile "src/LYCharSets.c")
# (find-lynxfile "src/chrtrans/dmcs_uni.tbl")
# (find-lynxfile "src/LYCharSets.c")
# (find-lynxfile "test/iso8859-1.html")
# (find-lynxfile "test/ISO_LATIN1_test.html")
# (find-lynxfile "test/sgml.html")

agrep atilde \
src/LYCharSets.c	\
src/chrtrans/dmcs_uni.tbl	\
src/LYCharSets.c	\
test/iso8859-1.html	\
test/ISO_LATIN1_test.html	\
test/sgml.html

export A=(src/LYCharSets.c
src/chrtrans/dmcs_uni.tbl
src/LYCharSets.c
test/iso8859-1.html
test/ISO_LATIN1_test.html
test/sgml.html)

agrep 198 $A


a2ps -o ~/o.ps -X ibmpc ~/AGENDA/telefones
a2ps -o ~/o.ps -X ibmpc \
  --columns=2 --rows=1 --major=columns --portrait --medium=A4dj \
  ~/AGENDA/telefones

cd
rm o.p[0-9][0-9]
gs -sDEVICE=djet500 -r300 -sOutputFile=o.p%02d -dNOPAUSE -dBATCH o.ps
rm o.zip; zip o.zip o.p0?
laf o.zip




#######
#
# Expect papers
#
#######

cd /snarf/http/expect.nist.gov/doc/
A=(tcl-debug.ps seminal.ps scripts.ps bgpasswd.ps kibitz.ps regress.ps
   sysadm.ps expectk.ps seven-years.ps)
for i in $A; do gv $i &; done

gv /snarf/http/www.cica.indiana.edu/cica/faq/tcl/p1.ps &

function pspack {
  S=0.55; H0=-16; H1=257; V0=434; V2=50
  S=0.47; H0=-16; H1=257; V0=434; V2=50
# pstops -d 4:0@$S($H0,$V0)+1@$S($H1,$V0)+2@$S($H0,$V2)+3@$S($H1,$V2)
#   psresize -Pletter -pA4
  cat
}

rm -Rv ~/ps
mkdir ~/ps
cd ~/ps
A=(tcl-debug.ps seminal.ps scripts.ps bgpasswd.ps kibitz.ps regress.ps
   sysadm.ps expectk.ps seven-years.ps)
for i in $A; do pspack < /snarf/http/expect.nist.gov/doc/$i >$i; done
gv bgpasswd.ps

cd /snarf/http/www.cica.indiana.edu/cica/faq/tcl/
# S=0.5; H0=24; H1=297; V0=434; V2=50
S=0.55; H0=-16; H1=257; V0=434; V2=50
cat book.p1.ps |
  pstops -d 4:0@$S($H0,$V0)+1@$S($H1,$V0)+2@$S($H0,$V2)+3@$S($H1,$V2) > p1.ps
cat book.p2.ps |
  pstops -d 4:0@$S($H0,$V0)+1@$S($H1,$V0)+2@$S($H0,$V2)+3@$S($H1,$V2) > p2.ps
cat book.p3.ps |
  pstops -d 4:0@$S($H0,$V0)+1@$S($H1,$V0)+2@$S($H0,$V2)+3@$S($H1,$V2) > p3.ps
cat book.p4.ps |
  pstops -d 4:0@$S($H0,$V0)+1@$S($H1,$V0)+2@$S($H0,$V2)+3@$S($H1,$V2) > p4.ps

cd /snarf/http/www.cica.indiana.edu/cica/faq/tcl/
gv -media a4 -scale -2 p1.ps
gv -media a4 -scale -2 p2.ps
gv -media a4 -scale -2 p3.ps
gv -media a4 -scale -2 p4.ps

cd /snarf/http/www.cica.indiana.edu/cica/faq/tcl/
tar -cvzf ~/tb.tgz p?.ps
zip ~/tb.zip p?.ps





#####
#
# printer irq
#
#####

# (eeman "perlfunc" "  ioctl")
# (eeman "perlfaq8" "include files to do ioctl")
# (find-k2file "include/linux/lp.h" "LPSETIRQ")

perl -e '
  open LP, "/dev/lp1" or die "Cant open lp1\n";
  $a = ioctl LP, 0x605, 7;
  print "$a\n";
'

# (find-zshnode "Variables Index")
# (find-zshnode "Parameters Set By The Shell" "`!'")

cat > /dev/lp1 &
cat /proc/interrupts
kill -9 $!




#####
#
# Impressora da sala dos anões da PUC
#
#####

# (find-vldifile "libpaperg.list")
# (find-vldifile "ppd-gs.list")
# (find-fline "/usr/share/ppd/en/")

# (find-knuthfile "tex/texbook.tex" "{units of measure, table}")
# pt point (baselines in this manual are 12 pt apart)
# pc pica             1 pc = 12 pt
# in inch             1 in = 72.27 pt
# bp big point       72 bp = 1 in
# cm centimeter    2.54 cm = 1 in
# mm millimeter      10 mm = 1 cm
# dd didot point   1157 dd = 1238 pt
# cc cicero           1 cc = 12 dd
# sp scaled point 65536 sp = 1 pt

# As unidades do PostScript são big points (cf. blue book, p. 18).

# (find-fline "/usr/lib/ghostscript/5.10/gs_statd.ps" "/a4 {")
# a4 = 595bp x 842bp 
# letter = 612bp x 792bp

# (defun bp2in (nbp) (/ nbp 72.0))
# (defun bp2cm (nbp) (* 2.54 (/ nbp 72.0)))
# (mapcar 'bp2in '(595 842))
# (mapcar 'bp2in '(612 792))

# 1bp =~ 0.35mm.
# a4 =~ 21cm x 29.704cm.
# letter =~ 21.59cm x 27.94cm

# a4 =~ 8.264in x 11.695in
# letter =~ 8.5in x 11.0in

# (bp2cm (- 842 792)) -> 1.764 (cm)
# (- 29.5 8.2) -> 21.3 (mm)

# Nos Tcl papers o topo do "T" nas páginas pares (de trás) está a
# 29.5mm do topo da página, e nas páginas ímpares (da frente) a 8.2mm.

8.2mm 29.5mm


# (find-fline "/usr/bin/paperconf")
# (find-fline "/usr/sbin/paperconfig")


# (find-vldifile "psutils.list")
# (find-fline "/usr/bin/fixfmps")

man pstops
man epsffit
man psnup
man psresize
man psmerge
man fixscribeps
man getafm
man fixfmps
man fixmacps
man fixpsditps
man fixpspps
man fixtpps
man fixwfwps
man fixwpps
man fixwwps
man extractres
man showchar
man psbook
man psselect
man fixdlsrps
man includeres



dvips -o /tmp/o.ps $S/http/www.sato.kuis.kyoto-u.ac.jp/~takeuti/art/param.dvi
cat /tmp/o.ps |
  pstops 2:0(0,0),1(0,-1in) > /tmp/o2.ps

function moveps () {
  echo '
  puts $argv
  foreach {xl xr yl yr} {0 0 0 0} {}
  foreach {tag val} "in 1 cm [expr 1/2.54] raise {y 1} lower {y -1}
    moveright {x 1} moveleft {x -1}" {
      set T($tag) $val
  }
  proc add {xory sign sides n unit} {
    global T
    set d [expr $sign*$n*$T($unit)]
    if {$sides!="right"} {upvar #0 ${xory}l v; set v [expr $v+$d]}
    if {$sides!="left"}  {upvar #0 ${xory}r v; set v [expr $v+$d]}
  }
  set r {^(raise|lower|move(right|left))_?(left|right)?_?([0-9.-]+)(cm|in)$}
  foreach command $argv {
    if [regexp $r $command {} com {} side n unit] {
      # puts "$ok:$com:$side:$n:$unit"
      eval add $T($com) [list $side] $n $unit
    } else {
      puts "Bad command: $command"
      # exit 1
    }
  }
  puts "2:0(${xl}in,${yl}in),1(${xr}in,${yr}in)"' | \
  tclsh -f - $*
}


function moveps () {
  pstops $(~/TCL/pstopsargs $*)
}

dvips -o /tmp/o.ps $S/http/www.sato.kuis.kyoto-u.ac.jp/~takeuti/art/param.dvi
moveps raise_left_1in moveright_right_1in < /tmp/o.ps > /tmp/o2.ps
laf /tmp

gv /tmp/o.ps &
gv /tmp/o2.ps &




#####
#
# psutils at boto
#
#####

pdsc /debian/dists/slink/main/source/text/psutils_1.17-6.dsc
cd /usr/src/
tar -cvzf /tmp/p.tgz psutils-1.17/
cd /tmp/
laf
ftpboto 'put p.tgz' 'lcd ~' 'put .zshrc' 'mkdir TCL' 'put TCL/pstopsargs' 'chmod 755 TCL/pstopsargs' 'quit'

# On boto:
cd
rm -Rv ~/psutils-1.17/
tar -xvzf ~/p.tgz
cd ~/psutils-1.17/
make pstops |& tee omp
make pstops.1 |& tee omm
cp -v pstops pstops.1 ~/bin/



# (find-fline "/debian/dists/slink/main/source/text/")
# (find-fline "/debian/dists/slink/main/source/text/psutils_1.17-6.diff.gz")



moveps raise_left_1in moveright_right_1in


cat /tmp/o.ps |
  pstops 2:0(0,0),1(0,-1in) > /tmp/o2.ps
moveps raise_left_5.08cm moveright_-0.4in

# (find-fline "~/TCL/pstopsargs")





| tclsh -f - raise_left_5.08cm moveright_-0.4in


 raise_left_2.5cm moveright_-0.4in



  forach {odd_dn even_dn} $argv {}
  proc cm2in {nbp} {expr 
  puts 2:0(0,[expr -

function lower_safo () {
  RAISE_ODD=

cd /snarf/http/www.cica.indiana.edu/cica/faq/tcl/
# S=0.5; H0=24; H1=297; V0=434; V2=50
S=0.55; H0=-16; H1=257; V0=434; V2=50
cat book.p1.ps |
  pstops -d 4:0@$S($H0,$V0)+1@$S($H1,$V0)+2@$S($H0,$V2)+3@$S($H1,$V2) > p1.ps




man paperconf
man papersize
man paperconfig

man systempapersizefile
man defaultpapersizefile
man paperinfo
man paperwithsize
man paperfirst
man papernext
man paperprev
man paperlast
man paperinit
man paperdone
man systempapername
man defaultpapername

# (find-fline "/usr/share/a2ps/ppd/")