1 /* startdaemon.c 4.1 83/04/29 */ 2 /* 3 * Tell the printer daemon that there are new files in the spool directory. 4 */ 5 6 #include "lp.h" 7 8 startdaemon() 9 { 10 register int rem, i, err = 0; 11 char buf[BUFSIZ]; 12 13 rem = getport(); 14 if (rem < 0) 15 return(0); 16 (void) sprintf(buf, "\1%s\n", printer); 17 i = strlen(buf); 18 if (write(rem, buf, i) != i) { 19 (void) close(rem); 20 return(0); 21 } 22 while ((i = read(rem, buf, sizeof(buf))) > 0) { 23 (void) fwrite(buf, 1, i, stdout); 24 err++; 25 } 26 (void) close(rem); 27 return(i == 0 && err == 0); 28 } 29