Advanced Programming in the UNIX® Environment
ptg10805159 Section 21.5 Source Code 807 The command used to submit a print job is shown next. The C source file isprint.c. 1/* ...
ptg10805159 808 Communicating with a Network Printer Chapter 21 34 if (err || (optind != argc - 1)) 35 err_quit("usage: print [- ...
ptg10805159 Section 21.5 Source Code 809 53 } else { 54 submit_file(fd, sfd, argv[optind], sbuf.st_size, text); 55 exit(0); 56 } ...
ptg10805159 810 Communicating with a Network Printer Chapter 21 81 req.size=htonl(nbytes); 82 if (text) 83 req.flags=htonl(PR_TE ...
ptg10805159 Section 21.5 Source Code 811 107 /* 108 * Now send the file. 109 */ 110 while ((nr = read(fd, buf, IOBUFSZ)) != 0) { ...
ptg10805159 812 Communicating with a Network Printer Chapter 21 1/* 2*Print server daemon. 3*/ 4#include "apue.h" 5#include < ...
ptg10805159 Section 21.5 Source Code 813 38 /* 39 * Needed for logging. 40 */ 41 int log_to_stderr = 0; 42 /* 43 * Printer-relat ...
ptg10805159 814 Communicating with a Network Printer Chapter 21 60 int32_t nextjob; 61 pthread_mutex_t joblock = PTHREAD_MUTEX_I ...
ptg10805159 Section 21.5 Source Code 815 98 if (argc != 1) 99 err_quit("usage: printd"); 100 daemonize("printd"); 101 sigemptyse ...
ptg10805159 816 Communicating with a Network Printer Chapter 21 122 FD_ZERO(&rendezvous); 123 maxfd=-1; 124 for (aip = ailis ...
ptg10805159 Section 21.5 Source Code 817 143 err=pthread_create(&tid, NULL, printer_thread, NULL); 144 if (err == 0) 145 err ...
ptg10805159 818 Communicating with a Network Printer Chapter 21 168 /* 169 * Initialize the job ID file. Use a record lock to pr ...
ptg10805159 Section 21.5 Source Code 819 193 /* 194 * Initialize printer information from configuration file. 195 * 196 * LOCKIN ...
ptg10805159 820 Communicating with a Network Printer Chapter 21 225 /* 226 * Get the next job number. 227 * 228 * LOCKING: acqui ...
ptg10805159 Section 21.5 Source Code 821 254 jp->jobid=jobid; 255 jp->next=NULL; 256 pthread_mutex_lock(&joblock); 257 ...
ptg10805159 822 Communicating with a Network Printer Chapter 21 284 /* 285 * Remove a job from the list of pending jobs. 286 * 2 ...
ptg10805159 Section 21.5 Source Code 823 318 while ((entp = readdir(dirp)) != NULL) { 319 /* 320 * Skip "." and ".." 321 */ 322 ...
ptg10805159 824 Communicating with a Network Printer Chapter 21 352 /* 353 * Accept a print job from a client. 354 * 355 * LOCKI ...
ptg10805159 Section 21.5 Source Code 825 385 req.size=ntohl(req.size); 386 req.flags=ntohl(req.flags); 387 /* 388 * Create the d ...
ptg10805159 826 Communicating with a Network Printer Chapter 21 414 nw=write(fd, buf, nr); 415 if (nw != nr) { 416 res.jobid=0; ...
«
38
39
40
41
42
43
44
45
46
47
»
Free download pdf