| Next | Trivial Utilities | 101 |
printd now runs printlp
(remember printlp is the program that copies the file to /dev/lp)
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}: $!");
}
When the wait returns, printlp has finished printing the file
So printd removes it
until (unlink $head) {
log_error("Couldn't unlink spool file $head: $!!!");
sleep 10;
}
unlink $CONF{curfile};
}
}
| Next | Menu | ![]() |
Copyright © 2012 M. J. Dominus |