1*12531Sralph /* startdaemon.c 4.3 83/05/18 */ 212114Sralph /* 312114Sralph * Tell the printer daemon that there are new files in the spool directory. 412114Sralph */ 512114Sralph 612114Sralph #include "lp.h" 712114Sralph 812114Sralph startdaemon() 912114Sralph { 1012114Sralph register int rem, i, err = 0; 1112114Sralph char buf[BUFSIZ]; 1212114Sralph 13*12531Sralph rem = getport(host); 1412114Sralph if (rem < 0) 1512114Sralph return(0); 1612114Sralph (void) sprintf(buf, "\1%s\n", printer); 1712114Sralph i = strlen(buf); 1812114Sralph if (write(rem, buf, i) != i) { 1912114Sralph (void) close(rem); 2012114Sralph return(0); 2112114Sralph } 2212114Sralph while ((i = read(rem, buf, sizeof(buf))) > 0) { 2312114Sralph (void) fwrite(buf, 1, i, stdout); 2412114Sralph err++; 2512114Sralph } 2612114Sralph (void) close(rem); 2712114Sralph return(i == 0 && err == 0); 2812114Sralph } 29