* Versatec printer daemon
#define SETSTATE (('v'<<8)|1)
#define VRAST "/usr/local/lib/vrast"
int prtmode
[] = {0100, 0, 0};
char dfname
[27] = "/usr/vpd/";
signal (SIGHUP
, SIG_IGN
);
signal (SIGINT
, SIG_IGN
);
signal (SIGQUIT
, SIG_IGN
);
signal (SIGTERM
, SIG_IGN
);
* Close all files, open root as 0, 1, 2
* to assure standard environment
if (chdir ("/usr/vpd") < 0)
if (stat ("lock", &stb
) >= 0)
if ((df
=creat ("lock", 0)) < 0)
if (open ("/dev/vp0", 1) == 3)
int f
= open ("/dev/tty", 1);
write (f
, "Versatec is offline\n", 20);
* find the first queueable directory entry
n
= read (dp
, &dbuf
, sizeof dbuf
);
* if there was a job printed
* pull it out of the toner bath
strcpy (&dfname
[9], dbuf
.d_name
);
if (trysend (dfname
) == 0) /* everything was ok */
for (*banbuf
= plot
= 0; getline ();)
strcpy (banbuf
, line
+ 1);
strcpy (fonts
[line
[0]-'1'], line
+ 1);
ioctl (3, SETSTATE
, prtmode
);
write (3, "\nJOB ABORTED***\n", 16);
ioctl (3, SETSTATE
, prtmode
);
write (3, "\nJOB ABORTED***\n", 16);
strcpy (linep
, line
+ 1);
* Unlink files and send mail.
static char ifonts
[4][50] =
strcpy(fonts
[i
], ifonts
[i
]);
execl ("/bin/mail", "mail", &line
[1], 0);
printf ("Your versatec job is done\n");
while ((c
= getc (dfb
)) != '\n')
} while ((linel
& 07) != 0);
signal (SIGALRM
, onalrm
);
ioctl (3, SETSTATE
, prtmode
);
execl ("/usr/lib/vpf", "vpf", "-b", banbuf
, line
+1, 0);
execl ("/usr/lib/vpf", "vpf", line
, 0);
rm
= creat (".railmag", 0666);
write (rm
, "/usr/lib/vfont/", strlen ("/usr/lib/vfont/"));
write (rm
, fonts
[i
], strlen (fonts
[i
]));
execl ("/usr/lib/vcat", "vcat", "-3", "-b", banbuf
, line
+1, 0);
execl ("/usr/lib/vcat", "vcat", "-3", line
+1, 0);
execl (VRAST
, "vrast", "-v", "-b", banbuf
, line
+1, linep
, 0);
execl (VRAST
, "vrast", "-v", line
+1, linep
, 0);
signal (SIGALRM
, onalrm
);
if (stat (dfname
, &stb
) < 0)
ioctl (3, SETSTATE
, prtmode
);
write (3, "\n\n\n\n\n\n\n\n", 8);