Next Trivial Utilities 101

printd: Printing

         if ($pid = fork()) {               # parent
           wait;
           handle_printlp_result($? >> 8) if $? != 0;
         } elsif (defined $pid) {    # child
           open STDIN, "< &=FILE" or exit 8;
           close FILE;
           close STDOUT;
           print STDERR "exec-ing $CONF{printlp}, $CONF{printer}\n" 
               if $CONF{debug_printd};
           exec $CONF{printlp}, $CONF{printer};
           exit 9;
         } else {                    # fork error
           log_error("Couldn't fork for $CONF{printlp}: $!");
         }
         until (unlink $head) {
           log_error("Couldn't unlink spool file $head: $!!!");
           sleep 10;
         }
         unlink $CONF{curfile};
       }
     }


Next Menu Copyright © 2012 M. J. Dominus