#!/usr/bin/perl
$i=0;
$ARGC = @ARGV;

if($ARGC == 0){
  &STDIN;
}elsif($ARGC >= 1){
  &FILE;
}

sub STDIN(){
  print "%!\n<< /Duplex true /Tumble true >> setpagedevice\n";
  while(<>){
    print;
  }
}

sub FILE(){
    while($ARGV[$i]){
      $filename = $ARGV[$i++];
      open(FILE, "$filename");
      print "%!\n<< /Duplex true /Tumble true >> setpagedevice\n";
      while (<FILE>){
	print;
      }
      close(FILE);
    }
}
