Commit | Line | Data |
---|---|---|
e923dc6a | 1 | /* startdaemon.c 4.3 83/05/18 */ |
c6e2cb21 RC |
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 | ||
e923dc6a | 13 | rem = getport(host); |
c6e2cb21 RC |
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 | } |