]> git.ipfire.org Git - thirdparty/cups.git/blame - backend/ipp.c
Mirror 1.1.x changes.
[thirdparty/cups.git] / backend / ipp.c
CommitLineData
c8f9565c 1/*
6bb5a528 2 * "$Id: ipp.c,v 1.38.2.32 2004/06/29 02:45:24 mike Exp $"
c8f9565c 3 *
4 * IPP backend for the Common UNIX Printing System (CUPS).
5 *
1d9595ab 6 * Copyright 1997-2003 by Easy Software Products, all rights reserved.
c8f9565c 7 *
8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
13 * at:
14 *
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
8784b6a6 17 * 44141 Airport View Drive, Suite 204
c8f9565c 18 * Hollywood, Maryland 20636-3111 USA
19 *
20 * Voice: (301) 373-9603
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
23 *
dab1a4d8 24 * This file is subject to the Apple OS-Developed Software exception.
25 *
c8f9565c 26 * Contents:
27 *
d1c2727f 28 * main() - Send a file to the printer or server.
6bb5a528 29 * check_printer_state() - Check the printer state...
d1c2727f 30 * password_cb() - Disable the password prompt for
31 * cupsDoFileRequest().
32 * report_printer_state() - Report the printer state.
8f4595eb 33 * run_pictwps_filter() - Convert PICT files to PostScript when printing
34 * remotely.
35 * sigterm_handler() - Handle 'terminate' signals that stop the backend.
c8f9565c 36 */
37
38/*
39 * Include necessary headers.
40 */
41
42#include <stdio.h>
43#include <stdlib.h>
44#include <errno.h>
45#include <sys/types.h>
46#include <sys/stat.h>
2d417cb3 47#include <cups/http-private.h>
c8f9565c 48#include <cups/cups.h>
49#include <cups/language.h>
50#include <cups/string.h>
4ff40357 51#include <signal.h>
1c85e5c0 52#include <sys/wait.h>
c8f9565c 53
54
8f4595eb 55/*
56 * Globals...
57 */
58
6bb5a528 59static char *password = NULL; /* Password for device URI */
b8f3410f 60#ifdef __APPLE__
61static char pstmpname[1024] = ""; /* Temporary PostScript file name */
62#endif /* __APPLE__ */
6bb5a528 63static char tmpfilename[1024] = ""; /* Temporary spool file name */
8f4595eb 64
65
b5cb0608 66/*
67 * Local functions...
68 */
69
6bb5a528 70void check_printer_state(http_t *http, cups_lang_t *language,
71 const char *charset, const char *uri, /* I - Printer URI */
72 const char *resource, const char *user,
73 int version);
b5cb0608 74const char *password_cb(const char *);
d1c2727f 75int report_printer_state(ipp_t *ipp);
b5cb0608 76
a684a3b0 77#ifdef __APPLE__
b8f3410f 78int run_pictwps_filter(char **argv, const char *filename);
a684a3b0 79#endif /* __APPLE__ */
8f4595eb 80static void sigterm_handler(int sig);
a684a3b0 81
b5cb0608 82
c8f9565c 83/*
84 * 'main()' - Send a file to the printer or server.
85 *
86 * Usage:
87 *
88 * printer-uri job-id user title copies options [file]
89 */
90
91int /* O - Exit status */
92main(int argc, /* I - Number of command-line arguments (6 or 7) */
93 char *argv[]) /* I - Command-line arguments */
94{
25512894 95 int i; /* Looping var */
c8f9565c 96 int num_options; /* Number of printer options */
3079988e 97 cups_option_t *options; /* Printer options */
c8f9565c 98 char method[255], /* Method in URI */
99 hostname[1024], /* Hostname */
100 username[255], /* Username info */
897922a9 101 resource[1024], /* Resource info (printer name) */
102 *optptr, /* Pointer to URI options */
103 name[255], /* Name of option */
104 value[255], /* Value of option */
105 *ptr; /* Pointer into name or value */
d8e1f369 106 char *filename; /* File to print */
c8f9565c 107 int port; /* Port number (not used) */
b5cb0608 108 char uri[HTTP_MAX_URI];/* Updated URI without user/pass */
97fcaf92 109 ipp_status_t ipp_status; /* Status of IPP request */
c8f9565c 110 http_t *http; /* HTTP connection */
111 ipp_t *request, /* IPP request */
2922de55 112 *response, /* IPP response */
113 *supported; /* get-printer-attributes response */
897922a9 114 int waitjob, /* Wait for job complete? */
115 waitprinter; /* Wait for printer ready? */
b5cb0608 116 ipp_attribute_t *job_id_attr; /* job-id attribute */
117 int job_id; /* job-id value */
8f4595eb 118 ipp_attribute_t *job_sheets; /* job-media-sheets-completed attribute */
b5cb0608 119 ipp_attribute_t *job_state; /* job-state attribute */
97fcaf92 120 ipp_attribute_t *copies_sup; /* copies-supported attribute */
25512894 121 ipp_attribute_t *charset_sup; /* charset-supported attribute */
36aa99bb 122 ipp_attribute_t *format_sup; /* document-format-supported attribute */
997cf8b0 123 ipp_attribute_t *printer_state;
124 /* printer-state attribute */
125 ipp_attribute_t *printer_accepting;
126 /* printer-is-accepting-jobs attribute */
25512894 127 const char *charset; /* Character set to use */
c8f9565c 128 cups_lang_t *language; /* Default language */
97fcaf92 129 int copies; /* Number of copies remaining */
0a3944d6 130 const char *content_type; /* CONTENT_TYPE environment variable */
4ff40357 131#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
132 struct sigaction action; /* Actions for POSIX signals */
133#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
5a2c7855 134 int version; /* IPP version */
d1c2727f 135 int reasons; /* Number of printer-state-reasons shown */
8f4595eb 136 static const char * const pattrs[] =
137 { /* Printer attributes we want */
138 "copies-supported",
139 "charset-supported",
140 "document-format-supported",
141 "printer-is-accepting-jobs",
142 "printer-state",
143 "printer-state-reasons",
144 };
145 static const char * const jattrs[] =
146 { /* Job attributes we want */
147 "job-media-sheets-completed",
148 "job-state"
149 };
c8f9565c 150
4b23f3b3 151
152 /*
153 * Make sure status messages are not buffered...
154 */
155
2922de55 156 setbuf(stderr, NULL);
c8f9565c 157
98904cd6 158 /*
8f4595eb 159 * Ignore SIGPIPE and catch SIGTERM signals...
98904cd6 160 */
161
162#ifdef HAVE_SIGSET
163 sigset(SIGPIPE, SIG_IGN);
8f4595eb 164 sigset(SIGTERM, sigterm_handler);
98904cd6 165#elif defined(HAVE_SIGACTION)
166 memset(&action, 0, sizeof(action));
167 action.sa_handler = SIG_IGN;
168 sigaction(SIGPIPE, &action, NULL);
8f4595eb 169
170 sigemptyset(&action.sa_mask);
171 sigaddset(&action.sa_mask, SIGTERM);
172 action.sa_handler = sigterm_handler;
173 sigaction(SIGTERM, &action, NULL);
98904cd6 174#else
175 signal(SIGPIPE, SIG_IGN);
8f4595eb 176 signal(SIGTERM, sigterm_handler);
98904cd6 177#endif /* HAVE_SIGSET */
178
4b23f3b3 179 /*
180 * Check command-line...
181 */
182
68edc300 183 if (argc == 1)
184 {
183914a3 185 char *s;
186
d4c438d4 187 if ((s = strrchr(argv[0], '/')) != NULL)
188 s ++;
189 else
190 s = argv[0];
191
7c587866 192 printf("network %s \"Unknown\" \"Internet Printing Protocol (%s)\"\n", s, s);
68edc300 193 return (0);
194 }
195 else if (argc < 6 || argc > 7)
c8f9565c 196 {
197 fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
198 argv[0]);
199 return (1);
200 }
201
a684a3b0 202 /*
203 * Get the content type...
204 */
205
206 if (argc > 6)
207 content_type = getenv("CONTENT_TYPE");
208 else
209 content_type = "application/vnd.cups-raw";
210
211 if (content_type == NULL)
212 content_type = "application/octet-stream";
213
7abb7137 214 /*
215 * Extract the hostname and printer name from the URI...
216 */
217
218 if (strchr(argv[0], ':') != NULL)
219 httpSeparate(argv[0], method, username, hostname, &port, resource);
220 else if (getenv("DEVICE_URI") != NULL)
221 httpSeparate(getenv("DEVICE_URI"), method, username, hostname, &port,
222 resource);
223 else
224 {
225 fputs("ERROR: Missing device URI on command-line and no DEVICE_URI environment variable!\n",
226 stderr);
227 return (1);
228 }
229
230 if (!strcmp(method, "https"))
231 cupsSetEncryption(HTTP_ENCRYPT_ALWAYS);
232
c8f9565c 233 /*
234 * If we have 7 arguments, print the file named on the command-line.
97fcaf92 235 * Otherwise, copy stdin to a temporary file and print the temporary
236 * file.
c8f9565c 237 */
238
239 if (argc == 6)
97fcaf92 240 {
241 /*
242 * Copy stdin to a temporary file...
243 */
244
1b5bf964 245 int fd; /* Temporary file */
97fcaf92 246 char buffer[8192]; /* Buffer for copying */
247 int bytes; /* Number of bytes read */
248
249
8f4595eb 250 if ((fd = cupsTempFd(tmpfilename, sizeof(tmpfilename))) < 0)
97fcaf92 251 {
252 perror("ERROR: unable to create temporary file");
253 return (1);
254 }
255
256 while ((bytes = fread(buffer, 1, sizeof(buffer), stdin)) > 0)
1b5bf964 257 if (write(fd, buffer, bytes) < bytes)
97fcaf92 258 {
259 perror("ERROR: unable to write to temporary file");
1b5bf964 260 close(fd);
8f4595eb 261 unlink(tmpfilename);
97fcaf92 262 return (1);
263 }
264
1b5bf964 265 close(fd);
8f4595eb 266 filename = tmpfilename;
97fcaf92 267 }
268 else
8f4595eb 269 filename = argv[6];
97fcaf92 270
897922a9 271 /*
272 * See if there are any options...
273 */
274
275 waitjob = 1;
276 waitprinter = 1;
277
278 if ((optptr = strchr(resource, '?')) != NULL)
279 {
280 /*
281 * Yup, terminate the device name string and move to the first
282 * character of the optptr...
283 */
284
285 *optptr++ = '\0';
286
287 /*
288 * Then parse the optptr...
289 */
290
291 while (*optptr)
292 {
293 /*
294 * Get the name...
295 */
296
297 for (ptr = name; *optptr && *optptr != '=';)
298 if (ptr < (name + sizeof(name) - 1))
299 *ptr++ = *optptr++;
300 *ptr = '\0';
301
302 if (*optptr == '=')
303 {
304 /*
305 * Get the value...
306 */
307
308 optptr ++;
309
310 for (ptr = value; *optptr && *optptr != '+';)
311 if (ptr < (value + sizeof(value) - 1))
312 *ptr++ = *optptr++;
313 *ptr = '\0';
314
315 if (*optptr == '+')
316 optptr ++;
317 }
318 else
319 value[0] = '\0';
320
321 /*
322 * Process the option...
323 */
324
325 if (!strcasecmp(name, "waitjob"))
326 {
327 /*
328 * Wait for job completion?
329 */
330
331 waitjob = !strcasecmp(value, "on") ||
332 !strcasecmp(value, "yes") ||
333 !strcasecmp(value, "true");
334 }
335 else if (!strcasecmp(name, "waitprinter"))
336 {
337 /*
338 * Wait for printer idle?
339 */
340
341 waitprinter = !strcasecmp(value, "on") ||
342 !strcasecmp(value, "yes") ||
343 !strcasecmp(value, "true");
344 }
345 else if (!strcasecmp(name, "encryption"))
346 {
347 /*
348 * Enable/disable encryption?
349 */
350
351 if (!strcasecmp(value, "always"))
352 cupsSetEncryption(HTTP_ENCRYPT_ALWAYS);
353 else if (!strcasecmp(value, "required"))
354 cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
355 else if (!strcasecmp(value, "never"))
356 cupsSetEncryption(HTTP_ENCRYPT_NEVER);
357 else if (!strcasecmp(value, "ifrequested"))
358 cupsSetEncryption(HTTP_ENCRYPT_IF_REQUESTED);
359 else
360 {
361 fprintf(stderr, "ERROR: Unknown encryption option value \"%s\"!\n",
362 value);
363 }
364 }
365 else
366 {
367 /*
368 * Unknown option...
369 */
370
371 fprintf(stderr, "ERROR: Unknown option \"%s\" with value \"%s\"!\n",
372 name, value);
373 }
374 }
375 }
376
c8f9565c 377 /*
b5cb0608 378 * Set the authentication info, if any...
c8f9565c 379 */
380
b5cb0608 381 cupsSetPasswordCB(password_cb);
382
383 if (username[0])
384 {
385 if ((password = strchr(username, ':')) != NULL)
386 *password++ = '\0';
387
388 cupsSetUser(username);
389 }
c8f9565c 390
391 /*
392 * Try connecting to the remote server...
393 */
394
97fcaf92 395 do
c8f9565c 396 {
a4e23897 397 fprintf(stderr, "INFO: Connecting to %s on port %d...\n", hostname, port);
c8f9565c 398
7914a6a1 399 if ((http = httpConnectEncrypt(hostname, port, cupsEncryption())) == NULL)
d21a7597 400 {
997cf8b0 401 if (getenv("CLASS") != NULL)
402 {
403 /*
404 * If the CLASS environment variable is set, the job was submitted
405 * to a class and not to a specific queue. In this case, we want
406 * to abort immediately so that the job can be requeued on the next
407 * available printer in the class.
408 */
409
897922a9 410 fprintf(stderr, "INFO: Unable to connect to %s, queuing on next printer in class...\n",
997cf8b0 411 hostname);
412
a684a3b0 413 if (argc == 6 || strcmp(filename, argv[6]))
997cf8b0 414 unlink(filename);
415
416 /*
417 * Sleep 5 seconds to keep the job from requeuing too rapidly...
418 */
419
420 sleep(5);
421
422 return (1);
423 }
424
4c2096b8 425 if (errno == ECONNREFUSED || errno == EHOSTDOWN ||
426 errno == EHOSTUNREACH)
97fcaf92 427 {
428 fprintf(stderr, "INFO: Network host \'%s\' is busy; will retry in 30 seconds...",
429 hostname);
430 sleep(30);
431 }
7e3ba0af 432 else if (h_errno)
433 {
434 fprintf(stderr, "INFO: Unable to lookup host \'%s\' - %s\n",
435 hostname, hstrerror(h_errno));
436 sleep(30);
437 }
97fcaf92 438 else
439 {
440 perror("ERROR: Unable to connect to IPP host");
2cc18dd2 441 sleep(30);
97fcaf92 442 }
d21a7597 443 }
c8f9565c 444 }
97fcaf92 445 while (http == NULL);
c8f9565c 446
a4e23897 447 fprintf(stderr, "INFO: Connected to %s...\n", hostname);
448
c8f9565c 449 /*
450 * Build a URI for the printer and fill the standard IPP attributes for
8ce7c000 451 * an IPP_PRINT_FILE request. We can't use the URI in argv[0] because it
452 * might contain username:password information...
c8f9565c 453 */
454
3f9cb6c6 455 snprintf(uri, sizeof(uri), "%s://%s:%d%s", method, hostname, port, resource);
c8f9565c 456
457 /*
97fcaf92 458 * First validate the destination and see if the device supports multiple
459 * copies. We have to do this because some IPP servers (e.g. HP JetDirect)
460 * don't support the copies attribute...
c8f9565c 461 */
462
25512894 463 language = cupsLangDefault();
464 charset_sup = NULL;
465 copies_sup = NULL;
2922de55 466 format_sup = NULL;
25512894 467 version = 1;
2922de55 468 supported = NULL;
c8f9565c 469
97fcaf92 470 do
c8f9565c 471 {
472 /*
97fcaf92 473 * Build the IPP request...
c8f9565c 474 */
475
97fcaf92 476 request = ippNew();
0a3ac972 477 request->request.op.version[1] = version;
478 request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
479 request->request.op.request_id = 1;
c8f9565c 480
97fcaf92 481 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
67436e05 482 "attributes-charset", NULL, "utf-8");
97fcaf92 483
484 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
485 "attributes-natural-language", NULL,
67436e05 486 language != NULL ? language->language : "en");
c8f9565c 487
97fcaf92 488 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
489 NULL, uri);
c8f9565c 490
8f4595eb 491 ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
492 "requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]),
493 NULL, pattrs);
494
97fcaf92 495 /*
496 * Do the request...
497 */
c8f9565c 498
a4e23897 499 fputs("DEBUG: Getting supported attributes...\n", stderr);
500
b5cb0608 501 if ((supported = cupsDoRequest(http, request, resource)) == NULL)
502 ipp_status = cupsLastError();
503 else
0a3ac972 504 ipp_status = supported->request.status.status_code;
b5cb0608 505
506 if (ipp_status > IPP_OK_CONFLICT)
c8f9565c 507 {
b5cb0608 508 if (ipp_status == IPP_PRINTER_BUSY ||
509 ipp_status == IPP_SERVICE_UNAVAILABLE)
c8f9565c 510 {
b5cb0608 511 fputs("INFO: Printer busy; will retry in 10 seconds...\n", stderr);
d1c2727f 512 report_printer_state(supported);
97fcaf92 513 sleep(10);
97fcaf92 514 }
b5cb0608 515 else if ((ipp_status == IPP_BAD_REQUEST ||
516 ipp_status == IPP_VERSION_NOT_SUPPORTED) && version == 1)
c8f9565c 517 {
b5cb0608 518 /*
519 * Switch to IPP/1.0...
520 */
97fcaf92 521
b5cb0608 522 fputs("INFO: Printer does not support IPP/1.1, trying IPP/1.0...\n", stderr);
523 version = 0;
a4e23897 524 httpReconnect(http);
c8f9565c 525 }
67474245 526 else if (ipp_status == IPP_NOT_FOUND)
527 {
528 fputs("ERROR: Destination printer does not exist!\n", stderr);
529
530 if (supported)
531 ippDelete(supported);
532
533 return (1);
534 }
97fcaf92 535 else
67474245 536 {
d1c2727f 537 fprintf(stderr, "ERROR: Unable to get printer status (%s)!\n",
b5cb0608 538 ippErrorString(ipp_status));
67474245 539 sleep(10);
540 }
d1c2727f 541
542 if (supported)
543 ippDelete(supported);
544
545 continue;
97fcaf92 546 }
b5cb0608 547 else if ((copies_sup = ippFindAttribute(supported, "copies-supported",
548 IPP_TAG_RANGE)) != NULL)
97fcaf92 549 {
b5cb0608 550 /*
551 * Has the "copies-supported" attribute - does it have an upper
552 * bound > 1?
553 */
97fcaf92 554
b5cb0608 555 if (copies_sup->values[0].range.upper <= 1)
556 copies_sup = NULL; /* No */
557 }
97fcaf92 558
b5cb0608 559 charset_sup = ippFindAttribute(supported, "charset-supported",
560 IPP_TAG_CHARSET);
561 format_sup = ippFindAttribute(supported, "document-format-supported",
562 IPP_TAG_MIMETYPE);
563
564 if (format_sup)
565 {
566 fprintf(stderr, "DEBUG: document-format-supported (%d values)\n",
567 format_sup->num_values);
568 for (i = 0; i < format_sup->num_values; i ++)
569 fprintf(stderr, "DEBUG: [%d] = \"%s\"\n", i,
570 format_sup->values[i].string.text);
c8f9565c 571 }
d1c2727f 572
573 report_printer_state(supported);
c8f9565c 574 }
97fcaf92 575 while (ipp_status > IPP_OK_CONFLICT);
c8f9565c 576
997cf8b0 577 /*
578 * See if the printer is accepting jobs and is not stopped; if either
579 * condition is true and we are printing to a class, requeue the job...
580 */
581
582 if (getenv("CLASS") != NULL)
583 {
584 printer_state = ippFindAttribute(supported, "printer-state",
585 IPP_TAG_ENUM);
586 printer_accepting = ippFindAttribute(supported, "printer-is-accepting-jobs",
587 IPP_TAG_BOOLEAN);
588
589 if (printer_state == NULL ||
897922a9 590 (printer_state->values[0].integer > IPP_PRINTER_PROCESSING && waitprinter) ||
997cf8b0 591 printer_accepting == NULL ||
592 !printer_accepting->values[0].boolean)
593 {
594 /*
595 * If the CLASS environment variable is set, the job was submitted
596 * to a class and not to a specific queue. In this case, we want
597 * to abort immediately so that the job can be requeued on the next
598 * available printer in the class.
599 */
600
601 fprintf(stderr, "INFO: Unable to queue job on %s, queuing on next printer in class...\n",
602 hostname);
603
604 ippDelete(supported);
605 httpClose(http);
606
a684a3b0 607 if (argc == 6 || strcmp(filename, argv[6]))
997cf8b0 608 unlink(filename);
609
610 /*
611 * Sleep 5 seconds to keep the job from requeuing too rapidly...
612 */
613
614 sleep(5);
615
616 return (1);
617 }
618 }
619
c8f9565c 620 /*
97fcaf92 621 * See if the printer supports multiple copies...
c8f9565c 622 */
623
d1c2727f 624 if (copies_sup || argc < 7)
97fcaf92 625 copies = 1;
0c5b0932 626 else
97fcaf92 627 copies = atoi(argv[4]);
0c5b0932 628
25512894 629 /*
630 * Figure out the character set to use...
631 */
632
633 charset = language ? cupsLangEncoding(language) : "us-ascii";
634
635 if (charset_sup)
636 {
637 /*
638 * See if IPP server supports the requested character set...
639 */
640
641 for (i = 0; i < charset_sup->num_values; i ++)
642 if (strcasecmp(charset, charset_sup->values[i].string.text) == 0)
643 break;
644
645 /*
646 * If not, choose us-ascii or utf-8...
647 */
648
649 if (i >= charset_sup->num_values)
650 {
651 /*
652 * See if us-ascii is supported...
653 */
654
655 for (i = 0; i < charset_sup->num_values; i ++)
656 if (strcasecmp("us-ascii", charset_sup->values[i].string.text) == 0)
657 break;
658
659 if (i < charset_sup->num_values)
660 charset = "us-ascii";
661 else
662 charset = "utf-8";
663 }
664 }
665
c8f9565c 666 /*
97fcaf92 667 * Then issue the print-job request...
c8f9565c 668 */
669
d1c2727f 670 reasons = 0;
671
97fcaf92 672 while (copies > 0)
c8f9565c 673 {
674 /*
97fcaf92 675 * Build the IPP request...
c8f9565c 676 */
677
97fcaf92 678 request = ippNew();
0a3ac972 679 request->request.op.version[1] = version;
680 request->request.op.operation_id = IPP_PRINT_JOB;
681 request->request.op.request_id = 1;
c8f9565c 682
97fcaf92 683 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
25512894 684 "attributes-charset", NULL, charset);
8ce7c000 685
97fcaf92 686 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
687 "attributes-natural-language", NULL,
67436e05 688 language != NULL ? language->language : "en");
c8f9565c 689
97fcaf92 690 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
691 NULL, uri);
c8f9565c 692
97fcaf92 693 fprintf(stderr, "DEBUG: printer-uri = \"%s\"\n", uri);
694
753453e4 695 if (argv[2][0])
897922a9 696 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
697 "requesting-user-name", NULL, argv[2]);
97fcaf92 698
699 fprintf(stderr, "DEBUG: requesting-user-name = \"%s\"\n", argv[2]);
700
753453e4 701 if (argv[3][0])
702 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
703 argv[3]);
c8f9565c 704
97fcaf92 705 fprintf(stderr, "DEBUG: job-name = \"%s\"\n", argv[3]);
8ce7c000 706
c8f9565c 707 /*
97fcaf92 708 * Handle options on the command-line...
c8f9565c 709 */
710
97fcaf92 711 options = NULL;
712 num_options = cupsParseOptions(argv[5], 0, &options);
713
e7186d00 714#ifdef __APPLE__
715 if (content_type != NULL && strcasecmp(content_type, "application/pictwps") == 0)
716 {
717 if (format_sup != NULL)
718 {
719 for (i = 0; i < format_sup->num_values; i ++)
720 if (strcasecmp(content_type, format_sup->values[i].string.text) == 0)
721 break;
722 }
723
724 if (format_sup == NULL || i >= format_sup->num_values)
725 {
726 /*
727 * Remote doesn't support "application/pictwps" (i.e. it's not MacOS X)
728 * so convert the document to PostScript...
729 */
730
b8f3410f 731 if (run_pictwps_filter(argv, filename))
e7186d00 732 return (1);
733
b8f3410f 734 filename = pstmpname;
735
e7186d00 736 /*
737 * Change the MIME type to application/postscript...
738 */
739
740 content_type = "application/postscript";
741 }
742 }
743#endif /* __APPLE__ */
744
753453e4 745 if (content_type != NULL && format_sup != NULL)
36aa99bb 746 {
747 for (i = 0; i < format_sup->num_values; i ++)
748 if (strcasecmp(content_type, format_sup->values[i].string.text) == 0)
749 break;
750
751 if (i < format_sup->num_values)
752 num_options = cupsAddOption("document-format", content_type,
753 num_options, &options);
754 }
97fcaf92 755
753453e4 756 if (copies_sup)
757 {
758 /*
759 * Only send options if the destination printer supports the copies
760 * attribute. This is a hack for the HP JetDirect implementation of
761 * IPP, which does not accept extension attributes and incorrectly
762 * reports a client-error-bad-request error instead of the
763 * successful-ok-unsupported-attributes status. In short, at least
764 * some HP implementations of IPP are non-compliant.
765 */
766
767 cupsEncodeOptions(request, num_options, options);
768 ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_INTEGER, "copies",
769 atoi(argv[4]));
770 }
771
183914a3 772 cupsFreeOptions(num_options, options);
c8f9565c 773
a4e23897 774 /*
775 * If copies aren't supported, then we are likely dealing with an HP
776 * JetDirect. The HP IPP implementation seems to close the connection
777 * after every request (that is, it does *not* implement HTTP Keep-
778 * Alive, which is REQUIRED by HTTP/1.1...
779 */
780
781 if (!copies_sup)
782 httpReconnect(http);
783
cb555bcf 784 /*
b5cb0608 785 * Do the request...
cb555bcf 786 */
787
b5cb0608 788 if ((response = cupsDoFileRequest(http, request, resource, filename)) == NULL)
789 ipp_status = cupsLastError();
790 else
0a3ac972 791 ipp_status = response->request.status.status_code;
b5cb0608 792
793 if (ipp_status > IPP_OK_CONFLICT)
794 {
753453e4 795 job_id = 0;
796
b5cb0608 797 if (ipp_status == IPP_SERVICE_UNAVAILABLE ||
798 ipp_status == IPP_PRINTER_BUSY)
799 {
800 fputs("INFO: Printer is busy; retrying print job...\n", stderr);
801 sleep(10);
802 }
803 else
804 fprintf(stderr, "ERROR: Print file was not accepted (%s)!\n",
805 ippErrorString(ipp_status));
806 }
807 else if ((job_id_attr = ippFindAttribute(response, "job-id",
808 IPP_TAG_INTEGER)) == NULL)
97fcaf92 809 {
b5cb0608 810 fputs("INFO: Print file accepted - job ID unknown.\n", stderr);
811 job_id = 0;
812 }
813 else
814 {
815 job_id = job_id_attr->values[0].integer;
816 fprintf(stderr, "INFO: Print file accepted - job ID %d.\n", job_id);
97fcaf92 817 }
cb555bcf 818
b5cb0608 819 if (response)
820 ippDelete(response);
821
753453e4 822 if (ipp_status <= IPP_OK_CONFLICT && argc > 6)
b5cb0608 823 {
824 fprintf(stderr, "PAGE: 1 %d\n", copies_sup ? atoi(argv[4]) : 1);
825 copies --;
826 }
827 else if (ipp_status != IPP_SERVICE_UNAVAILABLE &&
828 ipp_status != IPP_PRINTER_BUSY)
829 break;
8ce7c000 830
c8f9565c 831 /*
b5cb0608 832 * Wait for the job to complete...
c8f9565c 833 */
834
897922a9 835 if (!job_id || !waitjob)
b5cb0608 836 continue;
837
838 fputs("INFO: Waiting for job to complete...\n", stderr);
839
97fcaf92 840 for (;;)
c8f9565c 841 {
97fcaf92 842 /*
b5cb0608 843 * Build an IPP_GET_JOB_ATTRIBUTES request...
97fcaf92 844 */
845
b5cb0608 846 request = ippNew();
0a3ac972 847 request->request.op.version[1] = version;
848 request->request.op.operation_id = IPP_GET_JOB_ATTRIBUTES;
849 request->request.op.request_id = 1;
97fcaf92 850
b5cb0608 851 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
852 "attributes-charset", NULL, charset);
3f9cb6c6 853
b5cb0608 854 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
855 "attributes-natural-language", NULL,
856 language != NULL ? language->language : "en");
97fcaf92 857
b5cb0608 858 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
859 NULL, uri);
3f9cb6c6 860
b5cb0608 861 ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id",
862 job_id);
c8f9565c 863
ee8b7dd3 864 if (argv[2][0])
897922a9 865 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
866 "requesting-user-name", NULL, argv[2]);
ee8b7dd3 867
8f4595eb 868 ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
869 "requested-attributes", sizeof(jattrs) / sizeof(jattrs[0]),
870 NULL, jattrs);
97fcaf92 871
872 /*
b5cb0608 873 * Do the request...
97fcaf92 874 */
875
a4e23897 876 if (!copies_sup)
877 httpReconnect(http);
878
b5cb0608 879 if ((response = cupsDoRequest(http, request, resource)) == NULL)
880 ipp_status = cupsLastError();
881 else
0a3ac972 882 ipp_status = response->request.status.status_code;
97fcaf92 883
b5cb0608 884 if (ipp_status == IPP_NOT_FOUND)
97fcaf92 885 {
b5cb0608 886 /*
d1c2727f 887 * Job has gone away and/or the server has no job history...
b5cb0608 888 */
97fcaf92 889
b5cb0608 890 ippDelete(response);
d1c2727f 891
892 ipp_status = IPP_OK;
b5cb0608 893 break;
97fcaf92 894 }
895
b5cb0608 896 if (ipp_status > IPP_OK_CONFLICT)
6a536282 897 {
b5cb0608 898 if (ipp_status != IPP_SERVICE_UNAVAILABLE &&
899 ipp_status != IPP_PRINTER_BUSY)
97fcaf92 900 {
b5cb0608 901 if (response)
902 ippDelete(response);
903
904 fprintf(stderr, "ERROR: Unable to get job %d attributes (%s)!\n",
905 job_id, ippErrorString(ipp_status));
906 break;
97fcaf92 907 }
6a536282 908 }
8f4595eb 909
910 if (response != NULL)
97fcaf92 911 {
8f4595eb 912 if ((job_sheets = ippFindAttribute(response, "job-media-sheets-completed",
913 IPP_TAG_INTEGER)) != NULL)
914 fprintf(stderr, "PAGE: total %d\n", job_sheets->values[0].integer);
97fcaf92 915
8f4595eb 916 if ((job_state = ippFindAttribute(response, "job-state",
917 IPP_TAG_ENUM)) != NULL)
97fcaf92 918 {
8f4595eb 919 /*
920 * Stop polling if the job is finished or pending-held...
921 */
922
923 if (job_state->values[0].integer > IPP_JOB_PROCESSING ||
924 job_state->values[0].integer == IPP_JOB_HELD)
925 {
926 ippDelete(response);
927 break;
928 }
97fcaf92 929 }
97fcaf92 930 }
931
d1c2727f 932 if (response)
933 ippDelete(response);
934
b5cb0608 935 /*
6bb5a528 936 * Check the printer state and report it if necessary...
b5cb0608 937 */
c8f9565c 938
6bb5a528 939/* if (!copies_sup)
940 httpReconnect(http);*/
d1c2727f 941
6bb5a528 942 check_printer_state(http, language, charset, uri, resource, argv[2],
943 version);
d1c2727f 944
945 /*
946 * Wait 10 seconds before polling again...
947 */
97fcaf92 948
b5cb0608 949 sleep(10);
97fcaf92 950 }
c8f9565c 951 }
952
6bb5a528 953 /*
954 * Check the printer state and report it if necessary...
955 */
956
957/* if (!copies_sup)
958 httpReconnect(http);*/
959
960 check_printer_state(http, language, charset, uri, resource, argv[2], version);
961
c8f9565c 962 /*
963 * Free memory...
964 */
965
966 httpClose(http);
c8f9565c 967
2922de55 968 if (supported)
969 ippDelete(supported);
970
c8f9565c 971 /*
b8f3410f 972 * Remove the temporary file(s) if necessary...
c8f9565c 973 */
974
d8e1f369 975 if (tmpfilename[0])
8f4595eb 976 unlink(tmpfilename);
c8f9565c 977
b8f3410f 978#ifdef __APPLE__
979 if (pstmpname[0])
980 unlink(pstmpname);
981#endif /* __APPLE__ */
982
c8f9565c 983 /*
984 * Return the queue status...
985 */
986
b5cb0608 987 return (ipp_status > IPP_OK_CONFLICT);
988}
989
990
6bb5a528 991/*
992 * 'check_printer_state()' - Check the printer state...
993 */
994
995void
996check_printer_state(http_t *http, /* I - HTTP connection */
997 cups_lang_t *language,
998 /* I - Language */
999 const char *charset,
1000 /* I - Charset */
1001 const char *uri, /* I - Printer URI */
1002 const char *resource,
1003 /* I - Resource path */
1004 const char *user, /* I - Username, if any */
1005 int version)/* I - IPP version */
1006{
1007 ipp_t *request, /* IPP request */
1008 *response; /* IPP response */
1009
1010
1011 /*
1012 * Check on the printer state...
1013 */
1014
1015 request = ippNew();
1016 request->request.op.version[1] = version;
1017 request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
1018 request->request.op.request_id = 1;
1019
1020 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
1021 "attributes-charset", NULL, charset);
1022
1023 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
1024 "attributes-natural-language", NULL,
1025 language != NULL ? language->language : "en");
1026
1027 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
1028 NULL, uri);
1029
1030 if (user && user[0])
1031 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
1032 "requesting-user-name", NULL, user);
1033
1034 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
1035 "requested-attributes", NULL, "printer-state-reasons");
1036
1037 /*
1038 * Do the request...
1039 */
1040
1041 if ((response = cupsDoRequest(http, request, resource)) != NULL)
1042 {
1043 report_printer_state(response);
1044 ippDelete(response);
1045 }
1046}
1047
1048
b5cb0608 1049/*
1050 * 'password_cb()' - Disable the password prompt for cupsDoFileRequest().
1051 */
1052
1053const char * /* O - Password */
1054password_cb(const char *prompt) /* I - Prompt (not used) */
1055{
1056 (void)prompt;
1057
1058 return (password);
c8f9565c 1059}
1060
1061
1062/*
d1c2727f 1063 * 'report_printer_state()' - Report the printer state.
1064 */
1065
d8076497 1066int /* O - Number of reasons shown */
d1c2727f 1067report_printer_state(ipp_t *ipp) /* I - IPP response */
1068{
1069 int i; /* Looping var */
d8076497 1070 int count; /* Count of reasons shown... */
d1c2727f 1071 ipp_attribute_t *reasons; /* printer-state-reasons */
8f4595eb 1072 const char *reason; /* Current reason */
d1c2727f 1073 const char *message; /* Message to show */
d8076497 1074 char unknown[1024]; /* Unknown message string */
8f4595eb 1075 const char *prefix; /* Prefix for STATE: line */
1076 char state[1024]; /* State string */
d1c2727f 1077
1078
1079 if ((reasons = ippFindAttribute(ipp, "printer-state-reasons",
1080 IPP_TAG_KEYWORD)) == NULL)
1081 return (0);
1082
8f4595eb 1083 state[0] = '\0';
1084 prefix = "STATE: ";
1085
d8076497 1086 for (i = 0, count = 0; i < reasons->num_values; i ++)
d1c2727f 1087 {
8f4595eb 1088 reason = reasons->values[i].string.text;
1089
1090 strlcat(state, prefix, sizeof(state));
1091 strlcat(state, reason, sizeof(state));
1092
1093 prefix = ",";
d1c2727f 1094 message = NULL;
1095
8f4595eb 1096 if (strncmp(reason, "media-needed", 12) == 0)
d1c2727f 1097 message = "Media tray needs to be filled.";
8f4595eb 1098 else if (strncmp(reason, "media-jam", 9) == 0)
d1c2727f 1099 message = "Media jam!";
8f4595eb 1100 else if (strncmp(reason, "moving-to-paused", 16) == 0 ||
1101 strncmp(reason, "paused", 6) == 0 ||
1102 strncmp(reason, "shutdown", 8) == 0)
d1c2727f 1103 message = "Printer off-line.";
8f4595eb 1104 else if (strncmp(reason, "toner-low", 9) == 0)
d1c2727f 1105 message = "Toner low.";
8f4595eb 1106 else if (strncmp(reason, "toner-empty", 11) == 0)
d1c2727f 1107 message = "Out of toner!";
8f4595eb 1108 else if (strncmp(reason, "cover-open", 10) == 0)
d1c2727f 1109 message = "Cover open.";
8f4595eb 1110 else if (strncmp(reason, "interlock-open", 14) == 0)
d1c2727f 1111 message = "Interlock open.";
8f4595eb 1112 else if (strncmp(reason, "door-open", 9) == 0)
d1c2727f 1113 message = "Door open.";
8f4595eb 1114 else if (strncmp(reason, "input-tray-missing", 18) == 0)
d1c2727f 1115 message = "Media tray missing!";
8f4595eb 1116 else if (strncmp(reason, "media-low", 9) == 0)
d1c2727f 1117 message = "Media tray almost empty.";
8f4595eb 1118 else if (strncmp(reason, "media-empty", 11) == 0)
d1c2727f 1119 message = "Media tray empty!";
8f4595eb 1120 else if (strncmp(reason, "output-tray-missing", 19) == 0)
d1c2727f 1121 message = "Output tray missing!";
8f4595eb 1122 else if (strncmp(reason, "output-area-almost-full", 23) == 0)
d1c2727f 1123 message = "Output bin almost full.";
8f4595eb 1124 else if (strncmp(reason, "output-area-full", 16) == 0)
d1c2727f 1125 message = "Output bin full!";
8f4595eb 1126 else if (strncmp(reason, "marker-supply-low", 17) == 0)
d1c2727f 1127 message = "Ink/toner almost empty.";
8f4595eb 1128 else if (strncmp(reason, "marker-supply-empty", 19) == 0)
d1c2727f 1129 message = "Ink/toner empty!";
8f4595eb 1130 else if (strncmp(reason, "marker-waste-almost-full", 24) == 0)
d1c2727f 1131 message = "Ink/toner waste bin almost full.";
8f4595eb 1132 else if (strncmp(reason, "marker-waste-full", 17) == 0)
d1c2727f 1133 message = "Ink/toner waste bin full!";
8f4595eb 1134 else if (strncmp(reason, "fuser-over-temp", 15) == 0)
d1c2727f 1135 message = "Fuser temperature high!";
8f4595eb 1136 else if (strncmp(reason, "fuser-under-temp", 16) == 0)
d1c2727f 1137 message = "Fuser temperature low!";
8f4595eb 1138 else if (strncmp(reason, "opc-near-eol", 12) == 0)
d1c2727f 1139 message = "OPC almost at end-of-life.";
8f4595eb 1140 else if (strncmp(reason, "opc-life-over", 13) == 0)
d1c2727f 1141 message = "OPC at end-of-life!";
8f4595eb 1142 else if (strncmp(reason, "developer-low", 13) == 0)
d1c2727f 1143 message = "Developer almost empty.";
8f4595eb 1144 else if (strncmp(reason, "developer-empty", 15) == 0)
d1c2727f 1145 message = "Developer empty!";
8f4595eb 1146 else if (strstr(reason, "error") != NULL)
d8076497 1147 {
1148 message = unknown;
1149
1150 snprintf(unknown, sizeof(unknown), "Unknown printer error (%s)!",
8f4595eb 1151 reason);
d8076497 1152 }
d1c2727f 1153
1154 if (message)
1155 {
d8076497 1156 count ++;
d1c2727f 1157 if (strstr(reasons->values[i].string.text, "error"))
1158 fprintf(stderr, "ERROR: %s\n", message);
1159 else if (strstr(reasons->values[i].string.text, "warning"))
1160 fprintf(stderr, "WARNING: %s\n", message);
1161 else
1162 fprintf(stderr, "INFO: %s\n", message);
1163 }
1164 }
1165
8f4595eb 1166 fprintf(stderr, "%s\n", state);
1167
d8076497 1168 return (count);
d1c2727f 1169}
1170
1171
a684a3b0 1172#ifdef __APPLE__
1173/*
1174 * 'run_pictwps_filter()' - Convert PICT files to PostScript when printing
1175 * remotely.
1176 *
1177 * This step is required because the PICT format is not documented and
1178 * subject to change, so developing a filter for other OS's is infeasible.
1179 * Also, fonts required by the PICT file need to be embedded on the
1180 * client side (which has the fonts), so we run the filter to get a
1181 * PostScript file for printing...
1182 */
1183
1184int /* O - Exit status of filter */
b8f3410f 1185run_pictwps_filter(char **argv, /* I - Command-line arguments */
1186 const char *filename) /* I - Filename */
a684a3b0 1187{
1188 struct stat fileinfo; /* Print file information */
1189 const char *ppdfile; /* PPD file for destination printer */
1190 int pid; /* Child process ID */
1191 int fd; /* Temporary file descriptor */
1192 int status; /* Exit status of filter */
1193 const char *printer; /* PRINTER env var */
1194 static char ppdenv[1024]; /* PPD environment variable */
1195
1196
1197 /*
1198 * First get the PPD file for the printer...
1199 */
1200
1201 printer = getenv("PRINTER");
1202 if (!printer)
1203 {
1204 fputs("ERROR: PRINTER environment variable not defined!\n", stderr);
1205 return (-1);
1206 }
1207
1208 if ((ppdfile = cupsGetPPD(printer)) == NULL)
1209 {
1210 fprintf(stderr, "ERROR: Unable to get PPD file for printer \"%s\" - %s.\n",
1211 printer, ippErrorString(cupsLastError()));
1c85e5c0 1212 /*return (-1);*/
1213 }
1214 else
1215 {
1216 snprintf(ppdenv, sizeof(ppdenv), "PPD=%s", ppdfile);
1217 putenv(ppdenv);
a684a3b0 1218 }
a684a3b0 1219
1220 /*
1221 * Then create a temporary file for printing...
1222 */
1223
b8f3410f 1224 if ((fd = cupsTempFd(pstmpname, sizeof(pstmpname))) < 0)
a684a3b0 1225 {
1226 fprintf(stderr, "ERROR: Unable to create temporary file - %s.\n",
1c85e5c0 1227 strerror(errno));
1228 if (ppdfile)
1229 unlink(ppdfile);
a684a3b0 1230 return (-1);
1231 }
1232
1233 /*
1234 * Get the owner of the spool file - it is owned by the user we want to run
1235 * as...
1236 */
1237
b8f3410f 1238 if (argv[6])
1239 stat(argv[6], &fileinfo);
1240 else
1241 {
1242 /*
1243 * Use the OSX defaults, as an up-stream filter created the PICT
1244 * file...
1245 */
1246
1247 fileinfo.st_uid = 1;
1248 fileinfo.st_gid = 80;
1249 }
a684a3b0 1250
1c85e5c0 1251 if (ppdfile)
1252 chown(ppdfile, fileinfo.st_uid, fileinfo.st_gid);
1253
1254 fchown(fd, fileinfo.st_uid, fileinfo.st_gid);
1255
a684a3b0 1256 /*
1257 * Finally, run the filter to convert the file...
1258 */
1259
1260 if ((pid = fork()) == 0)
1261 {
1262 /*
1263 * Child process for pictwpstops... Redirect output of pictwpstops to a
1264 * file...
1265 */
1266
1267 close(1);
1268 dup(fd);
1269 close(fd);
1270
1271 if (!getuid())
1272 {
1273 /*
1274 * Change to an unpriviledged user...
1275 */
1276
1277 setgid(fileinfo.st_gid);
1278 setuid(fileinfo.st_uid);
1279 }
1280
1281 execlp("pictwpstops", printer, argv[1], argv[2], argv[3], argv[4], argv[5],
b8f3410f 1282 filename, NULL);
a684a3b0 1283 perror("ERROR: Unable to exec pictwpstops");
1284 return (errno);
1285 }
1c85e5c0 1286
1287 close(fd);
1288
1289 if (pid < 0)
a684a3b0 1290 {
1291 /*
1292 * Error!
1293 */
1294
1295 perror("ERROR: Unable to fork pictwpstops");
a684a3b0 1296 unlink(filename);
1c85e5c0 1297 if (ppdfile)
1298 unlink(ppdfile);
a684a3b0 1299 return (-1);
1300 }
1301
1302 /*
1303 * Now wait for the filter to complete...
1304 */
1305
1306 if (wait(&status) < 0)
1307 {
1308 perror("ERROR: Unable to wait for pictwpstops");
1309 close(fd);
1310 unlink(filename);
1c85e5c0 1311 if (ppdfile)
1312 unlink(ppdfile);
a684a3b0 1313 return (-1);
1314 }
1315
1c85e5c0 1316 if (ppdfile)
1317 unlink(ppdfile);
1318
a684a3b0 1319 close(fd);
1320
1321 if (status)
1322 {
1323 if (status >= 256)
1324 fprintf(stderr, "ERROR: pictwpstops exited with status %d!\n",
1325 status / 256);
1326 else
1327 fprintf(stderr, "ERROR: pictwpstops exited on signal %d!\n",
1328 status);
1329
1330 unlink(filename);
1331 return (status);
1332 }
1333
1334 /*
1335 * Return with no errors..
1336 */
1337
1338 return (0);
1339}
1340#endif /* __APPLE__ */
1341
d1c2727f 1342
1343/*
8f4595eb 1344 * 'sigterm_handler()' - Handle 'terminate' signals that stop the backend.
1345 */
1346
1347static void
1348sigterm_handler(int sig) /* I - Signal */
1349{
1350 (void)sig; /* remove compiler warnings... */
1351
1352 /*
b8f3410f 1353 * Remove the temporary file(s) if necessary...
8f4595eb 1354 */
1355
1356 if (tmpfilename[0])
1357 unlink(tmpfilename);
1358
b8f3410f 1359#ifdef __APPLE__
1360 if (pstmpname[0])
1361 unlink(pstmpname);
1362#endif /* __APPLE__ */
1363
8f4595eb 1364 exit(1);
1365}
1366
1367
1368/*
6bb5a528 1369 * End of "$Id: ipp.c,v 1.38.2.32 2004/06/29 02:45:24 mike Exp $".
c8f9565c 1370 */