URI:
       thardcopy.rc - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       thardcopy.rc (1699B)
       ---
            1 #!/bin/rc
            2 # Generate paper output from the data that a PostScript program normally
            3 # sends back to a host computer using file output operators.
            4 #
            5 
            6 POSTLIB=/sys/lib/postscript/prologues
            7 PROLOGUE=$POSTLIB/hardcopy.ps
            8 
            9 OPTIONS=
           10 MODE=portrait
           11 
           12 NONCONFORMING='%!PS'
           13 ENDPROLOG='%%EndProlog'
           14 BEGINSETUP='%%BeginSetup'
           15 ENDSETUP='%%EndSetup'
           16 TRAILER='%%Trailer'
           17 
           18 SETUP=HardcopySetup
           19 DONE='(%stdout)(w) file -1 write'
           20 
           21 while (! ~ $#* 0 && ~ $1 -*) {
           22         switch ($1) {
           23         case -c;  shift; OPTIONS=$OPTIONS' /#copies '$1' store'
           24         case -c*; OPTIONS=$OPTIONS' /#copies `{echo $1 | sed s/-c//}' store'
           25 
           26         case -f;  shift; OPTIONS=$OPTIONS' /font '/$1' def'
           27         case -f*; OPTIONS=$OPTIONS' /font '/`{echo $1 | sed s/-f//}' def'
           28 
           29         case -p;  shift; MODE=$1
           30         case -p*; MODE=`{echo $1 | sed s/-p//}
           31 
           32         case -m;  shift; OPTIONS=$OPTIONS' /magnification '$1' def'
           33         case -m*; OPTIONS=$OPTIONS' /magnification '`{echo $1 | sed s/-m//}' def'
           34 
           35         case -s;  shift; OPTIONS=$OPTIONS' /pointsize '$1' def'
           36         case -s*; OPTIONS=$OPTIONS' /pointsize '`{echo $1 | sed s/-s//}' def'
           37 
           38         case -x;  shift; OPTIONS=$OPTIONS' /xoffset '$1' def'
           39         case -x*; OPTIONS=$OPTIONS' /xoffset '`{echo $1 | sed s/-x//}' def'
           40 
           41         case -y;  shift; OPTIONS=$OPTIONS' /yoffset '$1' def'
           42         case -y*; OPTIONS=$OPTIONS' /yoffset '`{echo $1 | sed s/-y//}' def'
           43 
           44         case -L;  shift; PROLOGUE=$1
           45         case -L*; PROLOGUE=`{echo $1 | sed s/-L//}
           46 
           47         case --;
           48 
           49         case -*;  echo '$0: illegal option $1' >&2; exit 1
           50         }
           51         shift
           52 }
           53 
           54 switch ($MODE) {
           55         case l*; OPTIONS=$OPTIONS' /landscape true def'
           56         case *;  OPTIONS=$OPTIONS' /landscape false def'
           57 }
           58 
           59 echo $NONCONFORMING
           60 cat $PROLOGUE
           61 echo $ENDPROLOG
           62 echo $BEGINSETUP
           63 echo $OPTIONS
           64 echo $SETUP
           65 echo $ENDSETUP
           66 
           67 cat $*
           68 
           69 echo $TRAILER
           70 echo $DONE