date and time created 83/05/27 11:12:45 by sam
[unix-history] / usr / src / usr.sbin / lpr / common_source / startdaemon.c
/* startdaemon.c 4.3 83/05/18 */
/*
* Tell the printer daemon that there are new files in the spool directory.
*/
#include "lp.h"
startdaemon()
{
register int rem, i, err = 0;
char buf[BUFSIZ];
rem = getport(host);
if (rem < 0)
return(0);
(void) sprintf(buf, "\1%s\n", printer);
i = strlen(buf);
if (write(rem, buf, i) != i) {
(void) close(rem);
return(0);
}
while ((i = read(rem, buf, sizeof(buf))) > 0) {
(void) fwrite(buf, 1, i, stdout);
err++;
}
(void) close(rem);
return(i == 0 && err == 0);
}