recvjob.c (27757) | recvjob.c (29780) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 19 unchanged lines hidden (view full) --- 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 */ 34 35#ifndef lint | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 19 unchanged lines hidden (view full) --- 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 */ 34 35#ifndef lint |
36static char copyright[] = | 36static const char copyright[] = |
37"@(#) Copyright (c) 1983, 1993\n\ 38 The Regents of the University of California. All rights reserved.\n"; 39#endif /* not lint */ 40 41#ifndef lint | 37"@(#) Copyright (c) 1983, 1993\n\ 38 The Regents of the University of California. All rights reserved.\n"; 39#endif /* not lint */ 40 41#ifndef lint |
42#if 0 |
|
42static char sccsid[] = "@(#)recvjob.c 8.2 (Berkeley) 4/27/95"; | 43static char sccsid[] = "@(#)recvjob.c 8.2 (Berkeley) 4/27/95"; |
44#endif 45static const char rcsid[] = 46 "$Id$"; |
|
43#endif /* not lint */ 44 45/* 46 * Receive printer jobs from the network, queue them and 47 * start the printer daemon. 48 */ 49#include <sys/param.h> 50#include <sys/mount.h> --- 90 unchanged lines hidden (view full) --- 141 for (;;) { 142 /* 143 * Read a command to tell us what to do 144 */ 145 cp = line; 146 do { 147 if ((size = read(1, cp, 1)) != 1) { 148 if (size < 0) | 47#endif /* not lint */ 48 49/* 50 * Receive printer jobs from the network, queue them and 51 * start the printer daemon. 52 */ 53#include <sys/param.h> 54#include <sys/mount.h> --- 90 unchanged lines hidden (view full) --- 145 for (;;) { 146 /* 147 * Read a command to tell us what to do 148 */ 149 cp = line; 150 do { 151 if ((size = read(1, cp, 1)) != 1) { 152 if (size < 0) |
149 frecverr("%s: Lost connection", | 153 frecverr("%s: lost connection", |
150 printer); 151 return(nfiles); 152 } 153 } while (*cp++ != '\n' && (cp - line + 1) < sizeof(line)); 154 if (cp - line + 1 >= sizeof(line)) 155 frecverr("readjob overflow"); 156 *--cp = '\0'; 157 cp = line; --- 80 unchanged lines hidden (view full) --- 238 for (i = 0; i < size; i += BUFSIZ) { 239 amt = BUFSIZ; 240 cp = buf; 241 if (i + amt > size) 242 amt = size - i; 243 do { 244 j = read(1, cp, amt); 245 if (j <= 0) | 154 printer); 155 return(nfiles); 156 } 157 } while (*cp++ != '\n' && (cp - line + 1) < sizeof(line)); 158 if (cp - line + 1 >= sizeof(line)) 159 frecverr("readjob overflow"); 160 *--cp = '\0'; 161 cp = line; --- 80 unchanged lines hidden (view full) --- 242 for (i = 0; i < size; i += BUFSIZ) { 243 amt = BUFSIZ; 244 cp = buf; 245 if (i + amt > size) 246 amt = size - i; 247 do { 248 j = read(1, cp, amt); 249 if (j <= 0) |
246 frecverr("Lost connection"); | 250 frecverr("lost connection"); |
247 amt -= j; 248 cp += j; 249 } while (amt > 0); 250 amt = BUFSIZ; 251 if (i + amt > size) 252 amt = size - i; 253 if (write(fd, buf, amt) != amt) { 254 err++; --- 12 unchanged lines hidden (view full) --- 267} 268 269static int 270noresponse() 271{ 272 char resp; 273 274 if (read(1, &resp, 1) != 1) | 251 amt -= j; 252 cp += j; 253 } while (amt > 0); 254 amt = BUFSIZ; 255 if (i + amt > size) 256 amt = size - i; 257 if (write(fd, buf, amt) != amt) { 258 err++; --- 12 unchanged lines hidden (view full) --- 271} 272 273static int 274noresponse() 275{ 276 char resp; 277 278 if (read(1, &resp, 1) != 1) |
275 frecverr("Lost connection"); | 279 frecverr("lost connection"); |
276 if (resp == '\0') 277 return(0); 278 return(1); 279} 280 281/* 282 * Check to see if there is enough space on the disk for size bytes. 283 * 1 == OK, 0 == Not OK. --- 83 unchanged lines hidden --- | 280 if (resp == '\0') 281 return(0); 282 return(1); 283} 284 285/* 286 * Check to see if there is enough space on the disk for size bytes. 287 * 1 == OK, 0 == Not OK. --- 83 unchanged lines hidden --- |