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