* Line-printer daemon for Versatek
char dfname
[26] = "/usr/lpd/";
signal(SIGQUIT
, SIG_IGN
);
* Close all files, open root as 0, 1, 2
* to assure standard environment
if ((df
=creat("/usr/lpd/lock", 0)) < 0)
df
= open("/usr/lpd", 0);
if (read(df
, &dbuf
, sizeof dbuf
) < sizeof dbuf
) {
} while (dbuf
.ino
==0 || dbuf
.name
[0]!='d' || dbuf
.name
[1]!='f');
while (p1
< &dbuf
.name
[14])
if (trysend(dfname
) == 0)
if (fopen(file
, dfb
) < 0)
while (getline()) switch (line
[0]) {
* Unlink files and send mail.
while (getline()) switch (line
[0]) {
execl("/bin/mail", "mail", &line
[1], 0);
printf("Your printer job is done\n");
while ((c
= getc(dfb
)) != '\n') {
} while ((linel
& 07) != 0);
execl("/usr/bin/vpr", "vpr", "-b", banbuf
, line
+1, 0);
execl("/usr/bin/vpr", "vpr", line
, 0);