]> git.pld-linux.org Git - packages/cups.git/blob - cups-svn5706.patch
- sync to latest CUPS svn (quite a lot of bugfixes)
[packages/cups.git] / cups-svn5706.patch
1 diff -durN release-1.2.1/backend/backend-private.h cups-1.2.x/backend/backend-private.h
2 --- release-1.2.1/backend/backend-private.h     1970-01-01 01:00:00.000000000 +0100
3 +++ cups-1.2.x/backend/backend-private.h        2006-06-26 12:42:40.000000000 +0100
4 @@ -0,0 +1,73 @@
5 +/*
6 + * "$Id$"
7 + *
8 + *   Backend support definitions for the Common UNIX Printing System (CUPS).
9 + *
10 + *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
11 + *
12 + *   These coded instructions, statements, and computer programs are the
13 + *   property of Easy Software Products and are protected by Federal
14 + *   copyright law.  Distribution and use rights are outlined in the file
15 + *   "LICENSE" which should have been included with this file.  If this
16 + *   file is missing or damaged please contact Easy Software Products
17 + *   at:
18 + *
19 + *       Attn: CUPS Licensing Information
20 + *       Easy Software Products
21 + *       44141 Airport View Drive, Suite 204
22 + *       Hollywood, Maryland 20636 USA
23 + *
24 + *       Voice: (301) 373-9600
25 + *       EMail: cups-info@cups.org
26 + *         WWW: http://www.cups.org
27 + *
28 + *   This file is subject to the Apple OS-Developed Software exception.
29 + */
30 +
31 +#ifndef _CUPS_BACKEND_PRIVATE_H_
32 +#  define _CUPS_BACKEND_PRIVATE_H_
33 +
34 +
35 +/*
36 + * Include necessary headers.
37 + */
38 +
39 +#  include <cups/backend.h>
40 +#  include <cups/cups.h>
41 +#  include <cups/debug.h>
42 +#  include <stdlib.h>
43 +#  include <errno.h>
44 +#  include <cups/string.h>
45 +#  include <signal.h>
46 +
47 +
48 +/*
49 + * C++ magic...
50 + */
51 +
52 +#  ifdef _cplusplus
53 +extern "C" {
54 +#  endif /* _cplusplus */
55 +
56 +
57 +/*
58 + * Prototypes...
59 + */
60 +
61 +extern int     backendGetDeviceID(int fd, char *device_id, int device_id_size,
62 +                                  char *make_model, int make_model_size,
63 +                                  const char *scheme, char *uri, int uri_size);
64 +extern int     backendGetMakeModel(const char *device_id, char *make_model,
65 +                                   int make_model_size);
66 +extern ssize_t backendRunLoop(int print_fd, int device_fd, int use_bc);
67 +
68 +
69 +#  ifdef _cplusplus
70 +}
71 +#  endif /* _cplusplus */
72 +#endif /* !_CUPS_BACKEND_PRIVATE_H_ */
73 +
74 +
75 +/*
76 + * End of "$Id$".
77 + */
78 diff -durN release-1.2.1/backend/Dependencies cups-1.2.x/backend/Dependencies
79 --- release-1.2.1/backend/Dependencies  2006-07-04 17:32:11.000000000 +0100
80 +++ cups-1.2.x/backend/Dependencies     2006-06-26 12:42:40.000000000 +0100
81 @@ -9,26 +9,31 @@
82  lpd.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h
83  lpd.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
84  lpd.o: ../cups/string.h
85 -parallel.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
86 -parallel.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
87 -parallel.o: ../cups/language.h ../cups/string.h ../config.h ieee1284.c
88 -parallel.o: ../cups/debug.h
89 +pap.o: ../cups/http.h ../cups/md5.h
90 +parallel.o: backend-private.h ../cups/backend.h ../cups/cups.h ../cups/ipp.h
91 +parallel.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/array.h
92 +parallel.o: ../cups/file.h ../cups/language.h ../cups/debug.h
93 +parallel.o: ../cups/string.h ../config.h
94  scsi.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
95  scsi.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
96  scsi.o: ../cups/language.h ../cups/string.h ../config.h
97 -serial.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
98 -serial.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
99 -serial.o: ../cups/language.h ../cups/string.h ../config.h
100 -snmp.o: ../cups/backend.h ../cups/http-private.h ../config.h ../cups/http.h
101 -snmp.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h
102 -snmp.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
103 -snmp.o: ../cups/string.h ../cups/array.h ../cups/file.h ieee1284.c
104 -snmp.o: ../cups/debug.h
105 -socket.o: ../cups/backend.h ../cups/http-private.h ../config.h ../cups/http.h
106 -socket.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h
107 -socket.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
108 -socket.o: ../cups/string.h
109 -test1284.o: ../cups/string.h ../config.h ieee1284.c ../cups/debug.h
110 +serial.o: backend-private.h ../cups/backend.h ../cups/cups.h ../cups/ipp.h
111 +serial.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/array.h
112 +serial.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/string.h
113 +serial.o: ../config.h
114 +snmp.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/md5.h
115 +snmp.o: ../cups/ipp-private.h ../cups/ipp.h backend-private.h
116 +snmp.o: ../cups/backend.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
117 +snmp.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/string.h
118 +snmp.o: ../cups/array.h ../cups/file.h
119 +socket.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/md5.h
120 +socket.o: ../cups/ipp-private.h ../cups/ipp.h backend-private.h
121 +socket.o: ../cups/backend.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
122 +socket.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/string.h
123 +test1284.o: ../cups/string.h ../config.h ieee1284.c backend-private.h
124 +test1284.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
125 +test1284.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
126 +test1284.o: ../cups/language.h ../cups/debug.h
127  usb.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
128  usb.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
129  usb.o: ../cups/language.h ../cups/string.h ../config.h
130 diff -durN release-1.2.1/backend/easysw-firewire-design.txt cups-1.2.x/backend/easysw-firewire-design.txt
131 --- release-1.2.1/backend/easysw-firewire-design.txt    2006-07-04 17:32:11.000000000 +0100
132 +++ cups-1.2.x/backend/easysw-firewire-design.txt       1970-01-01 01:00:00.000000000 +0100
133 @@ -1,71 +0,0 @@
134 -Preliminary Design for CUPS Firewire Printer Backend - 03/19/2002
135 ------------------------------------------------------------------
136 -
137 -OVERVIEW
138 -
139 -    Easy Software Products will develop an IEEE-1394, a.k.a.
140 -    Firewire, printing interface for its Common UNIX Printing
141 -    System ("CUPS") for initial use under the Linux operating
142 -    system.  A follow-on implementation for MacOS X is
143 -    anticipated as well.
144 -
145 -    The operating system interfaces for IEEE-1394 ports vary
146 -    widely; the CUPS printing interface will abstract the OS
147 -    layer to a simpler interface geared towards discovering,
148 -    opening, reading from, writing to, and closing IEEE-1394
149 -    printers.
150 -
151 -    The initial development of the CUPS backend will be targeted
152 -    at the EPSON Stylus Pro 10000 large format printer, which
153 -    requires the bandwidth provided by Firewire in order to
154 -    print at full speed.  This printer supports printing via
155 -    Serial Bus Protocol 2 (SBP-2) using the SCSI and PWG command
156 -    sets. The CUPS backend will implement the PWG command set on
157 -    LUN 0 only.
158 -
159 -
160 -OS ABSTRACTION LAYER
161 -
162 -    The OS abstraction layer will be a thin client library that
163 -    implements the following functions:
164 -
165 -        ieee1394_list
166 -       ieee1394_open
167 -       ieee1394_close
168 -       ieee1394_read
169 -       ieee1394_write
170 -       ieee1394_error
171 -
172 -    The "ieee1394_list" function will list all of the available
173 -    printer devices on the bus.  The device information will
174 -    consist of the device URI (ieee1394:/something) used to
175 -    access the device and the make and model information, if
176 -    available, for the device ("EPSON Stylus Printer").
177 -
178 -    The "ieee1394_open" and "ieee1394_close" functions will open
179 -    and close a connection to the printer, respectively.
180 -
181 -    The "ieee1394_read" and "ieee1394_write" functions will read
182 -    and write data to and from the printer, respectively.  The
183 -    read function will be non-blocking, returning data only if
184 -    there is data coming back from the printer.
185 -
186 -    The "ieee1394_error" function will return a string
187 -    describing the last error or NULL if no error occurred.
188 -
189 -    The library will be responsible for creating any background
190 -    threads that are needed to monitor the connection to the
191 -    printer.
192 -
193 -
194 -CUPS BACKEND
195 -
196 -    The CUPS backend will use the OS abstraction layer to list
197 -    and access the Firewire printers.  The "main" function will
198 -    read and write printer data, while the "list_devices"
199 -    function will be called as necessary to identify the
200 -    available devices.
201 -
202 -    The CUPS 1.1 backend will record any status information in
203 -    the error log file, while the 1.2 backend will supply it to
204 -    the printer driver process.
205 diff -durN release-1.2.1/backend/easysw-firewire-linux.txt cups-1.2.x/backend/easysw-firewire-linux.txt
206 --- release-1.2.1/backend/easysw-firewire-linux.txt     2006-07-04 17:32:11.000000000 +0100
207 +++ cups-1.2.x/backend/easysw-firewire-linux.txt        1970-01-01 01:00:00.000000000 +0100
208 @@ -1,35 +0,0 @@
209 -Easy Software Products
210 -44141 Airport View Drive
211 -Suite 204
212 -Hollywood, Maryland 20636
213 -+1.301.373.9600
214 -March 8, 2002
215 -
216 -
217 -Subject: EPSON Firewire Printer Driver for Linux
218 -
219 -Currently, no Firewire printer support exists for Linux.  Since
220 -the latest EPSON printer products depend on the Firewire
221 -interface to print at full speed, a solution is needed to
222 -support customers using Linux as their server platform.
223 -
224 -The Linux Firewire subsystem provides a user-mode driver
225 -interface that allows driver programs to access Firewire
226 -devices.  Easy Software Products will utilize this interface to
227 -develop a "backend" program for the Common UNIX Printing System
228 -that will allow users to print to EPSON printers using the
229 -Firewire interface.
230 -
231 -After examining the Linux interface, we estimate that it will
232 -require approximately 30 hours of development time to write,
233 -test, and document the Firewire backend, for a total cost of
234 -$3,000. The new backend will become a standard part of the CUPS
235 -software distribution and will be included with at least the
236 -following Linux distributions:
237 -
238 -    - Caldera Linux
239 -    - Mandrake Linux
240 -    - Red Hat Linux
241 -    - SuSE Linux
242 -
243 -ESP will provide EPSON with binaries for Red Hat Linux 7.2.
244 diff -durN release-1.2.1/backend/ieee1284.c cups-1.2.x/backend/ieee1284.c
245 --- release-1.2.1/backend/ieee1284.c    2006-07-04 17:32:11.000000000 +0100
246 +++ cups-1.2.x/backend/ieee1284.c       2006-06-26 12:42:40.000000000 +0100
247 @@ -1,5 +1,5 @@
248  /*
249 - * "$Id$"
250 + * "$Id$"
251   *
252   *   IEEE-1284 support functions for the Common UNIX Printing System (CUPS).
253   *
254 @@ -25,51 +25,41 @@
255   *
256   * Contents:
257   *
258 - *   get_device_id()  - Get the IEEE-1284 device ID string and corresponding
259 - *                      URI.
260 - *   get_make_model() - Get the make and model string from the device ID.
261 + *   backendGetDeviceID()  - Get the IEEE-1284 device ID string and
262 + *                           corresponding URI.
263 + *   backendGetMakeModel() - Get the make and model string from the device ID.
264   */
265  
266  /*
267   * Include necessary headers.
268   */
269  
270 -#include <cups/debug.h>
271 -
272 +#include "backend-private.h"
273  
274 -/*
275 - * Prototypes...
276 - */
277 +#ifdef __linux
278 +#  include <sys/ioctl.h>
279 +#  include <linux/lp.h>
280 +#  define IOCNR_GET_DEVICE_ID          1
281 +#  define LPIOC_GET_DEVICE_ID(len)     _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
282 +#endif /* __linux */
283  
284 -static int     get_make_model(const char *device_id, char *make_model,
285 -                              int make_model_size);
286 +#ifdef __sun
287 +#  ifdef __sparc
288 +#    include <sys/ecppio.h>
289 +#  else
290 +#    include <sys/ioccom.h>
291 +#    include <sys/ecppsys.h>
292 +#  endif /* __sparc */
293 +#endif /* __sun */
294  
295  
296  /*
297 - * 'get_device_id()' - Get the IEEE-1284 device ID string and
298 - *                     corresponding URI.
299 + * 'backendGetDeviceID()' - Get the IEEE-1284 device ID string and
300 + *                          corresponding URI.
301   */
302  
303 -#ifndef SNMP_BACKEND
304 -#  ifdef __linux
305 -#    include <sys/ioctl.h>
306 -#    include <linux/lp.h>
307 -#    define IOCNR_GET_DEVICE_ID                1
308 -#    define LPIOC_GET_DEVICE_ID(len)   _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
309 -#  endif /* __linux */
310 -
311 -#  ifdef __sun
312 -#    ifdef __sparc
313 -#      include <sys/ecppio.h>
314 -#    else
315 -#      include <sys/ioccom.h>
316 -#      include <sys/ecppsys.h>
317 -#    endif /* __sparc */
318 -#  endif /* __sun */
319 -
320 -
321  int                                    /* O - 0 on success, -1 on failure */
322 -get_device_id(
323 +backendGetDeviceID(
324      int        fd,                     /* I - File descriptor */
325      char       *device_id,             /* O - 1284 device ID */
326      int        device_id_size,         /* I - Size of buffer */
327 @@ -93,7 +83,7 @@
328  #endif /* __sun && ECPPIOC_GETDEVID */
329  
330  
331 -  DEBUG_printf(("get_device_id(fd=%d, device_id=%p, device_id_size=%d, "
332 +  DEBUG_printf(("backendGetDeviceID(fd=%d, device_id=%p, device_id_size=%d, "
333                  "make_model=%p, make_model_size=%d, scheme=\"%s\", "
334                 "uri=%p, uri_size=%d)\n", fd, device_id, device_id_size,
335                 make_model, make_model_size, scheme ? scheme : "(null)",
336 @@ -107,7 +97,7 @@
337        !device_id || device_id_size < 32 ||
338        !make_model || make_model_size < 32)
339    {
340 -    DEBUG_puts("get_device_id: Bad args!");
341 +    DEBUG_puts("backendGetDeviceID: Bad args!");
342      return (-1);
343    }
344  
345 @@ -155,7 +145,7 @@
346    }
347  #  ifdef DEBUG
348    else
349 -    printf("get_device_id: ioctl failed - %s\n", strerror(errno));
350 +    printf("backendGetDeviceID: ioctl failed - %s\n", strerror(errno));
351  #  endif /* DEBUG */
352  #endif /* __linux */
353  
354 @@ -178,11 +168,11 @@
355    }
356  #  ifdef DEBUG
357    else
358 -    printf("get_device_id: ioctl failed - %s\n", strerror(errno));
359 +    printf("backendGetDeviceID: ioctl failed - %s\n", strerror(errno));
360  #  endif /* DEBUG */
361  #endif /* __sun && ECPPIOC_GETDEVID */
362  
363 -  DEBUG_printf(("get_device_id: device_id=\"%s\"\n", device_id));
364 +  DEBUG_printf(("backendGetDeviceID: device_id=\"%s\"\n", device_id));
365  
366    if (!*device_id)
367      return (-1);
368 @@ -191,7 +181,7 @@
369    * Get the make and model...
370    */
371  
372 -  get_make_model(device_id, make_model, make_model_size);
373 +  backendGetMakeModel(device_id, make_model, make_model_size);
374  
375   /*
376    * Then generate a device URI...
377 @@ -303,15 +293,14 @@
378  
379    return (0);
380  }
381 -#endif /* !SNMP_BACKEND */
382  
383  
384  /*
385 - * 'get_make_model()' - Get the make and model string from the device ID.
386 + * 'backendGetMakeModel()' - Get the make and model string from the device ID.
387   */
388  
389  int                                    /* O - 0 on success, -1 on failure */
390 -get_make_model(
391 +backendGetMakeModel(
392      const char *device_id,             /* O - 1284 device ID */
393      char       *make_model,            /* O - Make/model */
394      int        make_model_size)                /* I - Size of buffer */
395 @@ -322,7 +311,7 @@
396         *mdl;                           /* Model string */
397  
398  
399 -  DEBUG_printf(("get_make_model(device_id=\"%s\", "
400 +  DEBUG_printf(("backendGetMakeModel(device_id=\"%s\", "
401                  "make_model=%p, make_model_size=%d)\n", device_id,
402                 make_model, make_model_size));
403  
404 @@ -332,7 +321,7 @@
405  
406    if (!device_id || !*device_id || !make_model || make_model_size < 32)
407    {
408 -    DEBUG_puts("get_make_model: Bad args!");
409 +    DEBUG_puts("backendGetMakeModel: Bad args!");
410      return (-1);
411    }
412  
413 @@ -506,5 +495,5 @@
414  
415  
416  /*
417 - * End of "$Id$".
418 + * End of "$Id$".
419   */
420 diff -durN release-1.2.1/backend/ieee1394.c cups-1.2.x/backend/ieee1394.c
421 --- release-1.2.1/backend/ieee1394.c    2006-07-04 17:32:11.000000000 +0100
422 +++ cups-1.2.x/backend/ieee1394.c       1970-01-01 01:00:00.000000000 +0100
423 @@ -1,267 +0,0 @@
424 -/*
425 - * "$Id$"
426 - *
427 - *   IEEE-1394 backend for the Common UNIX Printing System (CUPS).
428 - *
429 - *   Copyright 2002 by Easy Software Products, all rights reserved.
430 - *
431 - *   Redistribution and use in source and binary forms, with or
432 - *   without modification, are permitted provided that the
433 - *   following conditions are met:
434 - *
435 - *     1. Redistributions of source code must retain the above
436 - *       copyright notice, this list of conditions and the
437 - *       following disclaimer.
438 - *
439 - *     2. Redistributions in binary form must reproduce the
440 - *       above copyright notice, this list of conditions and
441 - *       the following disclaimer in the documentation and/or
442 - *       other materials provided with the distribution.
443 - *
444 - *     3. All advertising materials mentioning features or use
445 - *       of this software must display the following
446 - *       acknowledgement:
447 - *
448 - *         This product includes software developed by Easy
449 - *         Software Products.
450 - *
451 - *     4. The name of Easy Software Products may not be used to
452 - *       endorse or promote products derived from this software
453 - *       without specific prior written permission.
454 - *
455 - *   THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
456 - *   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
457 - *   BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
458 - *   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
459 - *   DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
460 - *   BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
461 - *   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
462 - *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
463 - *   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
464 - *   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
465 - *   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
466 - *   OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
467 - *   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
468 - *   DAMAGE.
469 - *
470 - * Contents:
471 - *
472 - *   main()         - Send a file to the printer.
473 - *   list_devices() - List all known printer devices...
474 - */
475 -
476 -/*
477 - * Include necessary headers.
478 - */
479 -
480 -#include "ieee1394.h"
481 -
482 -
483 -/*
484 - * Local functions...
485 - */
486 -
487 -void   list_devices(void);
488 -
489 -
490 -/*
491 - * 'main()' - Send a file to the printer.
492 - *
493 - * Usage:
494 - *
495 - *    printer-uri job-id user title copies options [file]
496 - */
497 -
498 -int                    /* O - Exit status */
499 -main(int  argc,                /* I - Number of command-line arguments (6 or 7) */
500 -     char *argv[])     /* I - Command-line arguments */
501 -{
502 -  ieee1394_dev_t dev;          /* Printer device */
503 -  int          fp;             /* Print file */
504 -  int          copies;         /* Number of copies to print */
505 -  int          rbytes;         /* Number of bytes read from device */
506 -  size_t       nbytes,         /* Number of bytes read from file */
507 -               tbytes;         /* Total number of bytes written */
508 -  char         buffer[8192];   /* Input/output buffer */
509 -#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
510 -  struct sigaction action;     /* Actions for POSIX signals */
511 -#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
512 -
513 -
514 - /*
515 -  * Make sure status messages are not buffered...
516 -  */
517 -
518 -  setbuf(stderr, NULL);
519 -
520 - /*
521 -  * Check command-line...
522 -  */
523 -
524 -  if (argc == 1)
525 -  {
526 -    list_devices();
527 -
528 -    return (0);
529 -  }
530 -  else if (argc < 6 || argc > 7)
531 -  {
532 -    fprintf(stderr, "Usage: %s job-id user title copies options [file]\n",
533 -            argv[0]);
534 -    return (1);
535 -  }
536 -
537 - /*
538 -  * If we have 7 arguments, print the file named on the command-line.
539 -  * Otherwise, send stdin instead...
540 -  */
541 -
542 -  if (argc == 6)
543 -  {
544 -    fp     = 0;
545 -    copies = 1;
546 -  }
547 -  else
548 -  {
549 -   /*
550 -    * Try to open the print file...
551 -    */
552 -
553 -    if ((fp = open(argv[6], O_RDONLY)) < 0)
554 -    {
555 -      perror("ERROR: unable to open print file");
556 -      return (1);
557 -    }
558 -
559 -    copies = atoi(argv[4]);
560 -  }
561 -
562 - /*
563 -  * Try to open the printer device...
564 -  */
565 -
566 -  fputs("STATE: +connecting-to-device\n", stderr);
567 -
568 -  do
569 -  {
570 -    if ((dev = ieee1394_open(argv[0])) == NULL)
571 -    {
572 -      fputs("INFO: Firewire printer busy; will retry in 30 seconds...\n", stderr);
573 -      sleep(30);
574 -    }
575 -  }
576 -  while (dev == NULL);
577 -
578 -  fputs("STATE: -connecting-to-device\n", stderr);
579 -
580 - /*
581 -  * Now that we are "connected" to the port, ignore SIGTERM so that we
582 -  * can finish out any page data the driver sends (e.g. to eject the
583 -  * current page...  Only ignore SIGTERM if we are printing data from
584 -  * stdin (otherwise you can't cancel raw jobs...)
585 -  */
586 -
587 -  if (argc < 7)
588 -  {
589 -#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
590 -    sigset(SIGTERM, SIG_IGN);
591 -#elif defined(HAVE_SIGACTION)
592 -    memset(&action, 0, sizeof(action));
593 -
594 -    sigemptyset(&action.sa_mask);
595 -    action.sa_handler = SIG_IGN;
596 -    sigaction(SIGTERM, &action, NULL);
597 -#else
598 -    signal(SIGTERM, SIG_IGN);
599 -#endif /* HAVE_SIGSET */
600 -  }
601 -
602 - /*
603 -  * Finally, send the print file...
604 -  */
605 -
606 -  while (copies > 0)
607 -  {
608 -    copies --;
609 -
610 -    if (fp != 0)
611 -    {
612 -      fputs("PAGE: 1 1\n", stderr);
613 -      lseek(fp, 0, SEEK_SET);
614 -    }
615 -
616 -    tbytes = 0;
617 -    while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
618 -    {
619 -     /*
620 -      * Write the print data to the printer...
621 -      */
622 -
623 -      tbytes += nbytes;
624 -
625 -      if (ieee1394_write(dev, buffer, nbytes) < 0)
626 -      {
627 -       perror("ERROR: Unable to send print file to printer");
628 -       break;
629 -      }
630 -
631 -      if ((rbytes = ieee1394_read(dev, buffer, sizeof(buffer))) > 0)
632 -        fprintf(stderr, "INFO: Read %d bytes from printer...\n", rbytes);
633 -
634 -      if (argc > 6)
635 -       fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
636 -               (unsigned long)tbytes);
637 -    }
638 -  }
639 -
640 - /*
641 -  * Close the printer device and input file and return...
642 -  */
643 -
644 -  ieee1394_close(dev);
645 -
646 -  if (fp != 0)
647 -    close(fp);
648 -
649 -  fputs("INFO: Ready to print.\n", stderr);
650 -
651 -  return (0);
652 -}
653 -
654 -
655 -/*
656 - * 'list_devices()' - List all known devices...
657 - */
658 -
659 -void
660 -list_devices(void)
661 -{
662 -  int                  i,              /* Looping var */
663 -                       num_info;       /* Number of devices */
664 -  ieee1394_info_t      *info;          /* Devices... */
665 -
666 -
667 - /*
668 -  * Get the available devices...
669 -  */
670 -
671 -  info = ieee1394_list(&num_info);
672 -
673 - /*
674 -  * List them as needed...
675 -  */
676 -
677 -  if (num_info > 0)
678 -  {
679 -    for (i = 0; i < num_info; i ++)
680 -      printf("direct %s \"%s\" \"%s\"\n", info[i].uri,
681 -             info[i].make_model, info[i].description);
682 -
683 -    free(info);
684 -  }
685 -}
686 -
687 -
688 -/*
689 - * End of "$Id$".
690 - */
691 diff -durN release-1.2.1/backend/ieee1394.h cups-1.2.x/backend/ieee1394.h
692 --- release-1.2.1/backend/ieee1394.h    2006-07-04 17:32:11.000000000 +0100
693 +++ cups-1.2.x/backend/ieee1394.h       1970-01-01 01:00:00.000000000 +0100
694 @@ -1,103 +0,0 @@
695 -/*
696 - * "$Id$"
697 - *
698 - *   IEEE-1394 header for the Common UNIX Printing System (CUPS).
699 - *
700 - *   Copyright 2002 by Easy Software Products, all rights reserved.
701 - *
702 - *   Redistribution and use in source and binary forms, with or
703 - *   without modification, are permitted provided that the
704 - *   following conditions are met:
705 - *
706 - *     1. Redistributions of source code must retain the above
707 - *       copyright notice, this list of conditions and the
708 - *       following disclaimer.
709 - *
710 - *     2. Redistributions in binary form must reproduce the
711 - *       above copyright notice, this list of conditions and
712 - *       the following disclaimer in the documentation and/or
713 - *       other materials provided with the distribution.
714 - *
715 - *     3. All advertising materials mentioning features or use
716 - *       of this software must display the following
717 - *       acknowledgement:
718 - *
719 - *         This product includes software developed by Easy
720 - *         Software Products.
721 - *
722 - *     4. The name of Easy Software Products may not be used to
723 - *       endorse or promote products derived from this software
724 - *       without specific prior written permission.
725 - *
726 - *   THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
727 - *   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
728 - *   BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
729 - *   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
730 - *   DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
731 - *   BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
732 - *   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
733 - *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
734 - *   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
735 - *   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
736 - *   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
737 - *   OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
738 - *   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
739 - *   DAMAGE.
740 - */
741 -
742 -/*
743 - * Include necessary headers.
744 - */
745 -
746 -#include <cups/cups.h>
747 -#include <stdio.h>
748 -#include <stdlib.h>
749 -#include <stdarg.h>
750 -#include <cups/string.h>
751 -#include <errno.h>
752 -#include <sys/types.h>
753 -#include <sys/stat.h>
754 -#include <signal.h>
755 -
756 -#ifdef WIN32
757 -#  include <io.h>
758 -#else
759 -#  include <unistd.h>
760 -#  include <fcntl.h>
761 -#endif /* WIN32 */
762 -
763 -
764 -/*
765 - * Device information structure...
766 - */
767 -
768 -typedef struct
769 -{
770 -  char uri[HTTP_MAX_URI],      /* Device URI */
771 -       description[128],       /* Description of port */
772 -       make_model[128];        /* Make and model */
773 -} ieee1394_info_t;
774 -
775 -
776 -/*
777 - * Private device connection information...
778 - */
779 -
780 -typedef void   *ieee1394_dev_t;
781 -
782 -
783 -/*
784 - * Prototypes for standard IEEE-1394 interface...
785 - */
786 -
787 -extern ieee1394_info_t *ieee1394_list(int *num_devices);
788 -extern ieee1394_dev_t  ieee1394_open(const char *uri);
789 -extern int             ieee1394_close(ieee1394_dev_t dev);
790 -extern int             ieee1394_read(ieee1394_dev_t dev, char *buffer, int len);
791 -extern int             ieee1394_write(ieee1394_dev_t dev, char *buffer, int len);
792 -extern const char      *ieee1394_error(void);
793 -
794 -
795 -/*
796 - * End of "$Id$".
797 - */
798 diff -durN release-1.2.1/backend/ieee1394-linux.c cups-1.2.x/backend/ieee1394-linux.c
799 --- release-1.2.1/backend/ieee1394-linux.c      2006-07-04 17:32:11.000000000 +0100
800 +++ cups-1.2.x/backend/ieee1394-linux.c 1970-01-01 01:00:00.000000000 +0100
801 @@ -1,877 +0,0 @@
802 -/*
803 - * "$Id$"
804 - *
805 - *   Linux IEEE-1394 glue for the Common UNIX Printing System (CUPS).
806 - *
807 - *   Copyright 2002 by Easy Software Products, all rights reserved.
808 - *
809 - *   Redistribution and use in source and binary forms, with or
810 - *   without modification, are permitted provided that the
811 - *   following conditions are met:
812 - *
813 - *     1. Redistributions of source code must retain the above
814 - *       copyright notice, this list of conditions and the
815 - *       following disclaimer.
816 - *
817 - *     2. Redistributions in binary form must reproduce the
818 - *       above copyright notice, this list of conditions and
819 - *       the following disclaimer in the documentation and/or
820 - *       other materials provided with the distribution.
821 - *
822 - *     3. All advertising materials mentioning features or use
823 - *       of this software must display the following
824 - *       acknowledgement:
825 - *
826 - *         This product includes software developed by Easy
827 - *         Software Products.
828 - *
829 - *     4. The name of Easy Software Products may not be used to
830 - *       endorse or promote products derived from this software
831 - *       without specific prior written permission.
832 - *
833 - *   THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS
834 - *   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
835 - *   BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
836 - *   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
837 - *   DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
838 - *   BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
839 - *   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
840 - *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
841 - *   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
842 - *   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
843 - *   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
844 - *   OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
845 - *   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
846 - *   DAMAGE.
847 - *
848 - * Contents:
849 - *
850 - *   get_device_id()  - Get the IEEE-1284 device ID for a node...
851 - *   get_unit_type()  - Get the unit type for a node...
852 - *   show_data()      - Show a data node...
853 - *   show_dir()       - Show a directory list...
854 - *   ieee1394_list()  - List the available printer devices.
855 - *   ieee1394_open()  - Open a printer device.
856 - *   ieee1394_close() - Close a printer device.
857 - *   ieee1394_read()  - Read from a printer device.
858 - *   ieee1394_write() - Write data to a printer device.
859 - *   ieee1394_error() - Return the last error.
860 - */
861 -
862 -/*
863 - * Include necessary headers.
864 - */
865 -
866 -#include "ieee1394.h"
867 -#include <cups/debug.h>
868 -#include <libraw1394/raw1394.h>
869 -#include <libraw1394/csr.h>
870 -
871 -
872 -/*
873 - * Limits...
874 - */
875 -
876 -#define MAX_NODES      100
877 -
878 -
879 -/*
880 - * Structures...
881 - */
882 -
883 -typedef struct
884 -{
885 -  char                 uri[HTTP_MAX_URI],/* URI for this node... */
886 -                       description[128],/* Description of port */
887 -                       make_model[128];/* Make and model */
888 -  int                  port,           /* Port where this node is found */
889 -                       node;           /* Node number */
890 -  unsigned long long   addr;           /* Management address */
891 -} linux1394_node_t;
892 -
893 -typedef struct
894 -{
895 -  raw1394handle_t      handle;         /* Handle for printer device */
896 -  int                  node;           /* Node number for printer device */
897 -  unsigned long long   addr;           /* Management address */
898 -} linux1394_dev_t;
899 -
900 -
901 -/*
902 - * ORB messages for communication with the device...
903 - */
904 -
905 -typedef struct         /**** Login ORB Message */
906 -{
907 -  unsigned char                passwd_addr[8]; /* Password address */
908 -  unsigned char                resp_addr[8];   /* Login response address */
909 -  unsigned char                notify_excl;    /* Notify and exclusive bits */
910 -  unsigned char                recon_func;     /* Reconnect time and function */
911 -  unsigned char                lun[2];         /* Logical unit number */
912 -  unsigned char                passwd_len[2];  /* Length of password */
913 -  unsigned char                resp_len[2];    /* Length of login response */
914 -  unsigned char                fifo_addr[8];   /* Local status FIFO address */
915 -} login_orb_t;
916 -
917 -typedef struct         /**** Login Response Message ****/
918 -{
919 -  unsigned char                length[2];      /* Length of response */
920 -  unsigned char                login_id[2];    /* Login ID */
921 -  unsigned char                cmd_addr[8];    /* Command block agent address */
922 -  unsigned char                reserved[2];    /* Reserved (0) */
923 -  unsigned char                recon_hold[2];  /* Number of seconds to hold login */
924 -} login_resp_t;
925 -
926 -
927 -/*
928 - * Local globals...
929 - */
930 -
931 -static char            error_string[1024] = "";
932 -static int             num_nodes;
933 -static linux1394_node_t        nodes[MAX_NODES];
934 -
935 -
936 -/*
937 - * 'get_device_id()' - Get the IEEE-1284 device ID for a node...
938 - */
939 -
940 -static char *                          /* O - Device ID */
941 -get_device_id(raw1394handle_t    handle,/* I - Handle for device */
942 -              int                node, /* I - Node number */
943 -             unsigned long long offset,/* I - Offset to directory */
944 -             char               *id,   /* O - ID string */
945 -             int                idlen) /* I - Size of ID string */
946 -{
947 -  unsigned char                data[1024],     /* Data from ROM */
948 -                       *dataptr;       /* Pointer into data */
949 -  int                  length;         /* Length of directory */
950 -  int                  datalen;        /* Length of data */
951 -  unsigned long long   dataoff;        /* Offset of data */
952 -
953 -
954 -  DEBUG_printf(("get_device_id(handle = %p, node = %d, offset = %llx, id = %p, idlen = %d)\n",
955 -                handle, node, offset, id, idlen));
956 -
957 -  *id = '\0';
958 -
959 - /*
960 -  * Read the directory length from the first quadlet...
961 -  */
962 -
963 -  if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
964 -    return (NULL);
965 -
966 -  offset += 4;
967 -
968 - /*
969 -  * The length is in the upper 16 bits...
970 -  */
971 -
972 -  length = (data[0] << 8) | data[1];
973 -
974 -  DEBUG_printf(("    length = %d\n", length));
975 -
976 - /*
977 -  * Then read the directory, looking for unit directory or device tags...
978 -  */
979 -
980 -  while (length > 0)
981 -  {
982 -    if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
983 -      return (NULL);
984 -
985 -    DEBUG_printf(("    data = %02X %02X %02X %02X\n", data[0], data[1],
986 -                  data[2], data[3]));
987 -
988 -    if (data[0] == 0xd1)
989 -    {
990 -     /*
991 -      * Found the unit directory...
992 -      */
993 -
994 -      offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
995 -
996 -      return (get_device_id(handle, node, offset, id, idlen));
997 -    }
998 -    else if (data[0] == 0x81)
999 -    {
1000 -     /*
1001 -      * Found potential IEEE-1284 device ID...
1002 -      */
1003 -
1004 -      dataoff = offset + (((((data[1] << 8) | data[2]) << 8) | data[3]) << 2);
1005 -
1006 -      if (raw1394_read(handle, 0xffc0 | node, dataoff, 4, (quadlet_t *)data) < 0)
1007 -       return (NULL);
1008 -
1009 -      dataoff += 4;
1010 -
1011 -     /*
1012 -      * Read the leaf value...
1013 -      */
1014 -
1015 -      datalen = (data[0] << 8) | data[1];
1016 -
1017 -      if (datalen > (sizeof(data) / 4))
1018 -        datalen = sizeof(data) / 4;
1019 -
1020 -      for (dataptr = data; datalen > 0; datalen --, dataptr += 4, dataoff += 4)
1021 -       if (raw1394_read(handle, 0xffc0 | node, dataoff, 4,
1022 -                        (quadlet_t *)dataptr) < 0)
1023 -         return (NULL);
1024 -
1025 -      if (data[0] == 0 && memcmp(data + 8, "MFG:", 4) == 0)
1026 -      {
1027 -       /*
1028 -        * Found the device ID...
1029 -       */
1030 -
1031 -        datalen = dataptr - data - 8;
1032 -       if (datalen >= idlen)
1033 -         datalen --;
1034 -
1035 -       memcpy(id, data + 8, datalen);
1036 -       id[datalen] = '\0';
1037 -
1038 -        return (id);
1039 -      }
1040 -    }
1041 -
1042 -    offset += 4;
1043 -    length --;
1044 -  }
1045 -
1046 -  return (NULL);
1047 -}
1048 -
1049 -
1050 -/*
1051 - * 'get_man_addr()' - Get the management address for a node...
1052 - */
1053 -
1054 -static int                             /* O - Unit type */
1055 -get_man_addr(raw1394handle_t    handle,        /* I - Handle for device */
1056 -             int                node,  /* I - Node number */
1057 -            unsigned long long offset) /* I - Offset to directory */
1058 -{
1059 -  unsigned char        data[4];                /* Data from ROM */
1060 -  int          length;                 /* Length of directory */
1061 -
1062 -
1063 -  DEBUG_printf(("get_man_addr(handle = %p, node = %d, offset = %llx)\n",
1064 -                handle, node, offset));
1065 -
1066 - /*
1067 -  * Read the directory length from the first quadlet...
1068 -  */
1069 -
1070 -  if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
1071 -    return (-1);
1072 -
1073 -  offset += 4;
1074 -
1075 - /*
1076 -  * The length is in the upper 16 bits...
1077 -  */
1078 -
1079 -  length = (data[0] << 8) | data[1];
1080 -
1081 -  DEBUG_printf(("    length = %d\n", length));
1082 -
1083 - /*
1084 -  * Then read the directory, looking for unit directory or type tags...
1085 -  */
1086 -
1087 -  while (length > 0)
1088 -  {
1089 -    if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
1090 -      return (-1);
1091 -
1092 -    DEBUG_printf(("    data = %02X %02X %02X %02X\n", data[0], data[1],
1093 -                  data[2], data[3]));
1094 -
1095 -    if (data[0] == 0xd1)
1096 -    {
1097 -     /*
1098 -      * Found the unit directory...
1099 -      */
1100 -
1101 -      offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
1102 -
1103 -      return (get_man_addr(handle, node, offset));
1104 -    }
1105 -    else if (data[0] == 0x54)
1106 -    {
1107 -     /*
1108 -      * Found the management address...
1109 -      */
1110 -
1111 -      return (((((data[1] << 8) | data[2]) << 8) | data[3]) << 2);
1112 -    }
1113 -
1114 -    offset += 4;
1115 -    length --;
1116 -  }
1117 -
1118 -  return (-1);
1119 -}
1120 -
1121 -
1122 -/*
1123 - * 'get_unit_type()' - Get the unit type for a node...
1124 - */
1125 -
1126 -static int                             /* O - Unit type */
1127 -get_unit_type(raw1394handle_t    handle,/* I - Handle for device */
1128 -              int                node, /* I - Node number */
1129 -             unsigned long long offset)/* I - Offset to directory */
1130 -{
1131 -  unsigned char        data[4];                /* Data from ROM */
1132 -  int          length;                 /* Length of directory */
1133 -
1134 -
1135 -  DEBUG_printf(("get_unit_type(handle = %p, node = %d, offset = %llx)\n",
1136 -                handle, node, offset));
1137 -
1138 - /*
1139 -  * Read the directory length from the first quadlet...
1140 -  */
1141 -
1142 -  if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
1143 -    return (-1);
1144 -
1145 -  offset += 4;
1146 -
1147 - /*
1148 -  * The length is in the upper 16 bits...
1149 -  */
1150 -
1151 -  length = (data[0] << 8) | data[1];
1152 -
1153 -  DEBUG_printf(("    length = %d\n", length));
1154 -
1155 - /*
1156 -  * Then read the directory, looking for unit directory or type tags...
1157 -  */
1158 -
1159 -  while (length > 0)
1160 -  {
1161 -    if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
1162 -      return (-1);
1163 -
1164 -    DEBUG_printf(("    data = %02X %02X %02X %02X\n", data[0], data[1],
1165 -                  data[2], data[3]));
1166 -
1167 -    if (data[0] == 0xd1)
1168 -    {
1169 -     /*
1170 -      * Found the unit directory...
1171 -      */
1172 -
1173 -      offset += ((((data[1] << 8) | data[2]) << 8) | data[3]) << 2;
1174 -
1175 -      return (get_unit_type(handle, node, offset));
1176 -    }
1177 -    else if (data[0] == 0x14)
1178 -    {
1179 -     /*
1180 -      * Found the unit type...
1181 -      */
1182 -
1183 -      return (data[1] & 0x1f);
1184 -    }
1185 -
1186 -    offset += 4;
1187 -    length --;
1188 -  }
1189 -
1190 -  return (-1);
1191 -}
1192 -
1193 -
1194 -#ifdef DEBUG
1195 -/*
1196 - * 'show_data()' - Show a data node...
1197 - */
1198 -
1199 -static void
1200 -show_data(raw1394handle_t    handle,   /* I - Handle for device */
1201 -          int                node,     /* I - Node number */
1202 -         unsigned long long offset,    /* I - Offset to directory */
1203 -         int                indent)    /* Amount to indent */
1204 -{
1205 -  int          i;                      /* Looping var */
1206 -  unsigned char        data[4];                /* Data from ROM */
1207 -  int          length;                 /* Length of data */
1208 -
1209 -
1210 - /*
1211 -  * Read the data length from the first quadlet...
1212 -  */
1213 -
1214 -  if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
1215 -    return;
1216 -
1217 -  offset += 4;
1218 -
1219 - /*
1220 -  * The length is in the upper 16 bits...
1221 -  */
1222 -
1223 -  length = (data[0] << 8) | data[1];
1224 -
1225 - /*
1226 -  * Then read the data...
1227 -  */
1228 -
1229 -  for (i = 0; i < indent; i ++)
1230 -    putchar(' ');
1231 -
1232 -  printf("LEAF (%d quadlets)\n", length);
1233 -
1234 -  while (length > 0)
1235 -  {
1236 -    if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
1237 -      return;
1238 -
1239 -    for (i = 0; i < indent; i ++)
1240 -      putchar(' ');
1241 -
1242 -    printf("%02X %02X %02X %02X    '%c%c%c%c'\n",
1243 -           data[0], data[1], data[2], data[3],
1244 -           (data[0] < ' ' || data[0] >= 0x7f) ? '.' : data[0],
1245 -           (data[1] < ' ' || data[1] >= 0x7f) ? '.' : data[1],
1246 -           (data[2] < ' ' || data[2] >= 0x7f) ? '.' : data[2],
1247 -           (data[3] < ' ' || data[3] >= 0x7f) ? '.' : data[3]);
1248 -
1249 -    offset += 4;
1250 -    length --;
1251 -  }
1252 -}
1253 -
1254 -
1255 -/*
1256 - * 'show_dir()' - Show a directory list...
1257 - */
1258 -
1259 -static void
1260 -show_dir(raw1394handle_t    handle,    /* I - Handle for device */
1261 -         int                node,      /* I - Node number */
1262 -        unsigned long long offset,     /* I - Offset to directory */
1263 -        int                indent)     /* Amount to indent */
1264 -{
1265 -  int                  i;              /* Looping var */
1266 -  unsigned char                data[4];        /* Data from ROM */
1267 -  int                  length;         /* Length of directory */
1268 -  int                  value;          /* Value in directory */
1269 -
1270 -
1271 - /*
1272 -  * Read the directory length from the first quadlet...
1273 -  */
1274 -
1275 -  if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
1276 -    return;
1277 -
1278 -  offset += 4;
1279 -
1280 - /*
1281 -  * The length is in the upper 16 bits...
1282 -  */
1283 -
1284 -  length = (data[0] << 8) | data[1];
1285 -
1286 - /*
1287 -  * Then read the directory...
1288 -  */
1289 -
1290 -  while (length > 0)
1291 -  {
1292 -    if (raw1394_read(handle, 0xffc0 | node, offset, 4, (quadlet_t *)data) < 0)
1293 -      return;
1294 -
1295 -    for (i = 0; i < indent; i ++)
1296 -      putchar(' ');
1297 -
1298 -    printf("%02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]);
1299 -
1300 -    value = (((data[1] << 8) | data[2]) << 8) | data[3];
1301 -
1302 -    switch (data[0] & 0xc0)
1303 -    {
1304 -      case 0x00 :
1305 -         for (i = -4; i < indent; i ++)
1306 -           putchar(' ');
1307 -
1308 -          printf("IMMEDIATE %d\n", value);
1309 -         break;
1310 -
1311 -      case 0x40 :
1312 -         for (i = -4; i < indent; i ++)
1313 -           putchar(' ');
1314 -
1315 -          printf("CSR OFFSET +%06X\n", value);
1316 -         break;
1317 -
1318 -      case 0x80 :
1319 -          show_data(handle, node, offset + value * 4, indent + 4);
1320 -         break;
1321 -
1322 -      case 0xc0 :
1323 -          show_dir(handle, node, offset + value * 4, indent + 4);
1324 -         break;
1325 -    }
1326 -
1327 -    offset += 4;
1328 -    length --;
1329 -  }
1330 -}
1331 -#endif /* DEBUG */
1332 -
1333 -
1334 -/*
1335 - * 'ieee1394_list()' - List the available printer devices.
1336 - */
1337 -
1338 -ieee1394_info_t        *                       /* O - Printer information */
1339 -ieee1394_list(int *num_devices)                /* O - Number of printers */
1340 -{
1341 -  int                  i, j;           /* Looping vars */
1342 -  raw1394handle_t      handle;         /* 1394 handle */
1343 -  int                  num_ports;      /* Number of ports */
1344 -  struct raw1394_portinfo ports[100];  /* Port data... */
1345 -  unsigned char                guid[8];        /* Global unique ID */
1346 -  int                  vendor;         /* Vendor portion of GUID */
1347 -  int                  unit_type;      /* Unit type */
1348 -  int                  addr;           /* Management address offset */
1349 -  char                 id[1024],       /* Device ID string */
1350 -                       *idptr,         /* Pointer into ID string */
1351 -                       *idsep;         /* Pointer to separator */
1352 -  ieee1394_info_t      *devices;       /* Device list */
1353 -
1354 -
1355 - /*
1356 -  * Connect to the user-mode driver interface...
1357 -  */
1358 -
1359 -  handle    = raw1394_new_handle();
1360 -  num_ports = raw1394_get_port_info(handle, ports,
1361 -                                    sizeof(ports) / sizeof(ports[0]));
1362 -
1363 -  DEBUG_printf(("num_ports = %d\n", num_ports));
1364 -
1365 - /*
1366 -  * Loop through the ports to discover what nodes are available.
1367 -  */
1368 -
1369 -  num_nodes = 0;
1370 -
1371 -  for (i = 0; i < num_ports; i ++)
1372 -  {
1373 -    DEBUG_printf(("ports[%d] = { nodes = %d, name = \"%s\" }\n", i,
1374 -                  ports[i].nodes, ports[i].name));
1375 -
1376 -    raw1394_set_port(handle, i);
1377 -
1378 -    for (j = 0; j < ports[i].nodes; j ++)
1379 -    {
1380 -      if (raw1394_read(handle, 0xffc0 | j,
1381 -                       CSR_REGISTER_BASE + CSR_CONFIG_ROM + 12, 4,
1382 -                      (quadlet_t *)guid) < 0)
1383 -      {
1384 -        DEBUG_printf(("    Node #%d: Unable to contact (%s)!\n", j,
1385 -                     strerror(errno)));
1386 -        continue;
1387 -      }
1388 -      else
1389 -      {
1390 -        raw1394_read(handle, 0xffc0 | j,
1391 -                     CSR_REGISTER_BASE + CSR_CONFIG_ROM + 16, 4,
1392 -                    (quadlet_t *)(guid + 4));
1393 -
1394 -        DEBUG_printf(("    Node #%d: GUID = %02X%02X%02X%02X%02X%02X%02X%02X\n",
1395 -                     j, guid[0], guid[1], guid[2], guid[3], guid[4],
1396 -                     guid[5], guid[6], guid[7]));
1397 -
1398 -        vendor    = (((guid[0] << 8) | guid[1]) << 8) | guid[2];
1399 -        unit_type = get_unit_type(handle, j,
1400 -                                 CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20);
1401 -
1402 -        DEBUG_printf(("vendor = %x, unit_type = %d\n", vendor, unit_type));
1403 -
1404 -        if (unit_type == 2 && num_nodes < MAX_NODES)
1405 -       {
1406 -        /*
1407 -         * Found a printer device; add it to the nodes list...
1408 -         */
1409 -
1410 -#ifdef DEBUG
1411 -          show_dir(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20, 0);
1412 -#endif /* DEBUG */
1413 -
1414 -          memset(nodes + num_nodes, 0, sizeof(linux1394_node_t));
1415 -
1416 -          sprintf(nodes[num_nodes].uri, "ieee1394://%02X%02X%02X%02X%02X%02X%02X%02X",
1417 -                 guid[0], guid[1], guid[2], guid[3], guid[4],
1418 -                 guid[5], guid[6], guid[7]);
1419 -
1420 -          nodes[num_nodes].port = i;
1421 -         nodes[num_nodes].node = j;
1422 -
1423 -          addr = get_man_addr(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20);
1424 -
1425 -          if (addr < 0)
1426 -           continue;
1427 -
1428 -          nodes[num_nodes].addr = CSR_REGISTER_BASE + addr;
1429 -
1430 -          DEBUG_printf(("Node address = %llx\n", nodes[num_nodes].addr));
1431 -
1432 -          get_device_id(handle, j, CSR_REGISTER_BASE + CSR_CONFIG_ROM + 20,
1433 -                       id, sizeof(id));
1434 -
1435 -          if (id[0])
1436 -         {
1437 -          /*
1438 -           * Grab the manufacturer and model name from the device ID
1439 -           * string...
1440 -           */
1441 -
1442 -            idptr = id + 4;
1443 -            idsep = strchr(id, ';');
1444 -           if (idsep)
1445 -             *idsep++ = '\0';
1446 -           else
1447 -             idsep = idptr;
1448 -
1449 -           snprintf(nodes[num_nodes].description,
1450 -                    sizeof(nodes[num_nodes].description),
1451 -                    "%s Firewire Printer", idptr);
1452 -
1453 -            if ((idptr = strstr(idsep, "DES:")) == NULL)
1454 -             idptr = strstr(idsep, "MDL:");
1455 -
1456 -            if (idptr == NULL)
1457 -              strcpy(nodes[num_nodes].make_model, "Unknown");
1458 -           else
1459 -           {
1460 -            /*
1461 -             * Grab the DES or MDL code...
1462 -             */
1463 -
1464 -             idptr += 4;
1465 -             idsep = strchr(idptr, ';');
1466 -             if (idsep)
1467 -               *idsep = '\0';
1468 -
1469 -              if (strncmp(id + 4, idptr, strlen(id + 4)) == 0)
1470 -             {
1471 -              /*
1472 -               * Use the description directly...
1473 -               */
1474 -
1475 -               strlcpy(nodes[num_nodes].make_model, idptr,
1476 -                       sizeof(nodes[num_nodes].make_model));
1477 -              }
1478 -             else
1479 -             {
1480 -              /*
1481 -               * Add the manufacturer to the front of the name...
1482 -               */
1483 -
1484 -               snprintf(nodes[num_nodes].make_model,
1485 -                        sizeof(nodes[num_nodes].make_model),
1486 -                        "%s %s", id + 4, idptr);
1487 -              }
1488 -            }
1489 -         }
1490 -         else
1491 -         {
1492 -          /*
1493 -           * Flag it as an unknown printer...
1494 -           */
1495 -
1496 -           sprintf(nodes[num_nodes].description,
1497 -                   "Unknown%06X Firewire Printer", vendor);
1498 -            strcpy(nodes[num_nodes].make_model, "Unknown");
1499 -         }
1500 -
1501 -         num_nodes ++;
1502 -       }
1503 -      }
1504 -    }
1505 -  }
1506 -
1507 - /*
1508 -  * Done querying the Firewire bus...
1509 -  */
1510 -
1511 -  raw1394_destroy_handle(handle);
1512 -
1513 - /*
1514 -  * Build an array of device info structures as needed...
1515 -  */
1516 -
1517 -  if (num_devices == NULL)
1518 -    return (NULL);
1519 -
1520 -  *num_devices = num_nodes;
1521 -
1522 -  if (num_nodes)
1523 -  {
1524 -    if ((devices = calloc(sizeof(ieee1394_info_t), num_nodes)) != NULL)
1525 -    {
1526 -      for (i = 0; i < num_nodes; i ++)
1527 -      {
1528 -        strcpy(devices[i].uri, nodes[i].uri);
1529 -       strcpy(devices[i].description, nodes[i].description);
1530 -       strcpy(devices[i].make_model, nodes[i].make_model);
1531 -      }
1532 -    }
1533 -
1534 -    return (devices);
1535 -  }
1536 -  else
1537 -    return (NULL);
1538 -}
1539 -
1540 -
1541 -/*
1542 - * 'ieee1394_open()' - Open a printer device.
1543 - */
1544 -
1545 -ieee1394_dev_t                         /* O - Printer device or NULL */
1546 -ieee1394_open(const char *uri)         /* I - Device URI */
1547 -{
1548 -  int                  i;              /* Looping var */
1549 -  linux1394_dev_t      *ldev;          /* Linux device */
1550 -
1551 -
1552 - /*
1553 -  * Return early if we can't see any printers...
1554 -  */
1555 -
1556 -  if (num_nodes == 0)
1557 -    ieee1394_list(NULL);
1558 -
1559 -  if (num_nodes == 0)
1560 -  {
1561 -    strcpy(error_string, "No IEEE-1394 printers found!");
1562 -    return (NULL);
1563 -  }
1564 -
1565 - /*
1566 -  * Look for the URI...
1567 -  */
1568 -
1569 -  for (i = 0; i < num_nodes; i ++)
1570 -    if (strcmp(nodes[i].uri, uri) == 0)
1571 -      break;
1572 -
1573 -  if (i >= num_nodes)
1574 -  {
1575 -    snprintf(error_string, sizeof(error_string), "Device %s not found!", uri);
1576 -    return (NULL);
1577 -  }
1578 -
1579 - /*
1580 -  * Now create a new device structure...
1581 -  */
1582 -
1583 -  if ((ldev = calloc(sizeof(linux1394_dev_t), 1)) == NULL)
1584 -  {
1585 -    strcpy(error_string, "Out of memory!");
1586 -    return (NULL);
1587 -  }
1588 -
1589 -  ldev->handle = raw1394_new_handle();
1590 -  ldev->node   = nodes[i].node;
1591 -  ldev->addr   = nodes[i].addr;
1592 -
1593 -  raw1394_set_port(ldev->handle, nodes[i].port);
1594 -
1595 -  error_string[0] = '\0';
1596 -
1597 -  return ((ieee1394_dev_t)ldev);
1598 -}
1599 -
1600 -
1601 -/*
1602 - * 'ieee1394_close()' - Close a printer device.
1603 - */
1604 -
1605 -int                                    /* O - 0 on success, -1 on failure */
1606 -ieee1394_close(ieee1394_dev_t dev)     /* I - Printer device */
1607 -{
1608 -  linux1394_dev_t      *ldev;          /* Linux device */
1609 -
1610 -
1611 -  ldev = (linux1394_dev_t *)dev;
1612 -
1613 -  raw1394_destroy_handle(ldev->handle);
1614 -
1615 -  free(ldev);
1616 -
1617 -  return (0);
1618 -}
1619 -
1620 -
1621 -/*
1622 - * 'ieee1394_read()' - Read from a printer device.
1623 - */
1624 -
1625 -int                                    /* O - Number of bytes read or -1 */
1626 -ieee1394_read(ieee1394_dev_t dev,      /* I - Printer device */
1627 -              char           *buffer,  /* I - Read buffer */
1628 -             int            len)       /* I - Max bytes to read */
1629 -{
1630 -  linux1394_dev_t      *ldev;          /* Linux device */
1631 -
1632 -
1633 -  ldev = (linux1394_dev_t *)dev;
1634 -
1635 -
1636 -  return (0);
1637 -}
1638 -
1639 -
1640 -/*
1641 - * 'ieee1394_write()' - Write data to a printer device.
1642 - */
1643 -
1644 -int                                    /* O - Number of bytes written or -1 */
1645 -ieee1394_write(ieee1394_dev_t dev,     /* I - Printer device */
1646 -               char           *buffer, /* I - Buffer to write */
1647 -              int            len)      /* I - Number of bytes to write */
1648 -{
1649 -  linux1394_dev_t      *ldev;          /* Linux device */
1650 -
1651 -
1652 -  ldev = (linux1394_dev_t *)dev;
1653 -
1654 -
1655 -/*  if (raw1394_write(handle, 0xffc0 | j, 0, ,
1656 -                      (quadlet_t *)guid) < 0)*/
1657 -
1658 -  return (len);
1659 -}
1660 -
1661 -
1662 -/*
1663 - * 'ieee1394_error()' - Return the last error.
1664 - */
1665 -
1666 -const char *                           /* O - Error string or NULL */
1667 -ieee1394_error(void)
1668 -{
1669 -  if (error_string[0])
1670 -    return (error_string);
1671 -  else
1672 -    return (NULL);
1673 -}
1674 -
1675 -
1676 -/*
1677 - * End of "$Id$".
1678 - */
1679 diff -durN release-1.2.1/backend/ipp.c cups-1.2.x/backend/ipp.c
1680 --- release-1.2.1/backend/ipp.c 2006-07-04 17:32:11.000000000 +0100
1681 +++ cups-1.2.x/backend/ipp.c    2006-06-26 12:42:40.000000000 +0100
1682 @@ -1,5 +1,5 @@
1683  /*
1684 - * "$Id$"
1685 + * "$Id$"
1686   *
1687   *   IPP backend for the Common UNIX Printing System (CUPS).
1688   *
1689 @@ -211,7 +211,8 @@
1690    */
1691  
1692    if ((content_type = getenv("FINAL_CONTENT_TYPE")) == NULL)
1693 -    content_type = "application/octet-stream";
1694 +    if ((content_type = getenv("CONTENT_TYPE")) == NULL)
1695 +      content_type = "application/octet-stream";
1696  
1697   /*
1698    * Extract the hostname and printer name from the URI...
1699 @@ -1619,5 +1620,5 @@
1700  
1701  
1702  /*
1703 - * End of "$Id$".
1704 + * End of "$Id$".
1705   */
1706 diff -durN release-1.2.1/backend/Makefile cups-1.2.x/backend/Makefile
1707 --- release-1.2.1/backend/Makefile      2006-07-04 17:32:11.000000000 +0100
1708 +++ cups-1.2.x/backend/Makefile 2006-06-26 12:42:40.000000000 +0100
1709 @@ -1,5 +1,5 @@
1710  #
1711 -# "$Id$"
1712 +# "$Id$"
1713  #
1714  #   Backend makefile for the Common UNIX Printing System (CUPS).
1715  #
1716 @@ -28,7 +28,8 @@
1717  
1718  RBACKENDS =    ipp lpd
1719  UBACKENDS =    $(PAP) parallel scsi serial snmp socket usb
1720 -TARGETS        =       betest test1284 $(RBACKENDS) $(UBACKENDS)
1721 +TARGETS        =       betest test1284 libbackend.a $(RBACKENDS) $(UBACKENDS)
1722 +LIBOBJS        =       ieee1284.o runloop.o
1723  OBJS   =       betest.o ipp.o lpd.o pap.o parallel.o scsi.o \
1724                 serial.o snmp.o socket.o test1284.o usb.o
1725  
1726 @@ -105,6 +106,17 @@
1727  
1728  
1729  #
1730 +# libbackend.a
1731 +#
1732 +
1733 +libbackend.a:  $(LIBOBJS)
1734 +       echo Archiving $@...
1735 +       $(RM) $@
1736 +       $(AR) $(ARFLAGS) $@ $(LIBOBJS)
1737 +       $(RANLIB) $@
1738 +
1739 +
1740 +#
1741  # ieee1394
1742  #
1743  
1744 @@ -149,9 +161,9 @@
1745  # parallel
1746  #
1747  
1748 -parallel:      parallel.o ../cups/$(LIBCUPS)
1749 +parallel:      parallel.o ../cups/$(LIBCUPS) libbackend.a
1750         echo Linking $@...
1751 -       $(CC) $(LDFLAGS) -o parallel parallel.o $(LIBS)
1752 +       $(CC) $(LDFLAGS) -o parallel parallel.o libbackend.a $(LIBS)
1753  
1754  
1755  #
1756 @@ -169,37 +181,37 @@
1757  # serial
1758  #
1759  
1760 -serial:        serial.o ../cups/$(LIBCUPS)
1761 +serial:        serial.o ../cups/$(LIBCUPS) libbackend.a
1762         echo Linking $@...
1763 -       $(CC) $(LDFLAGS) -o serial serial.o $(BACKLIBS) $(LIBS)
1764 +       $(CC) $(LDFLAGS) -o serial serial.o libbackend.a $(BACKLIBS) $(LIBS)
1765  
1766  
1767  #
1768  # snmp
1769  #
1770  
1771 -snmp:  snmp.o ../cups/$(LIBCUPS)
1772 +snmp:  snmp.o ../cups/$(LIBCUPS) libbackend.a
1773         echo Linking $@...
1774 -       $(CC) $(LDFLAGS) -o snmp snmp.o $(LIBS)
1775 +       $(CC) $(LDFLAGS) -o snmp snmp.o libbackend.a $(LIBS)
1776  
1777  
1778  #
1779  # socket
1780  #
1781  
1782 -socket:        socket.o ../cups/$(LIBCUPS)
1783 +socket:        socket.o ../cups/$(LIBCUPS) libbackend.a
1784         echo Linking $@...
1785 -       $(CC) $(LDFLAGS) -o socket socket.o $(LIBS)
1786 +       $(CC) $(LDFLAGS) -o socket socket.o libbackend.a $(LIBS)
1787  
1788  
1789  #
1790  # usb
1791  #
1792  
1793 -usb:   usb.o ../cups/$(LIBCUPS)
1794 +usb:   usb.o ../cups/$(LIBCUPS) libbackend.a
1795         echo Linking $@...
1796 -       $(CC) $(LDFLAGS) -o usb usb.o $(BACKLIBS) $(LIBS)
1797 -usb.o: usb.c usb-darwin.c usb-unix.c ieee1284.c
1798 +       $(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(BACKLIBS) $(LIBS)
1799 +usb.o: usb.c usb-darwin.c usb-unix.c
1800  
1801  
1802  #
1803 @@ -210,5 +222,5 @@
1804  
1805  
1806  #
1807 -# End of "$Id$".
1808 +# End of "$Id$".
1809  #
1810 diff -durN release-1.2.1/backend/parallel.c cups-1.2.x/backend/parallel.c
1811 --- release-1.2.1/backend/parallel.c    2006-07-04 17:32:11.000000000 +0100
1812 +++ cups-1.2.x/backend/parallel.c       2006-06-26 12:42:40.000000000 +0100
1813 @@ -1,5 +1,5 @@
1814  /*
1815 - * "$Id$"
1816 + * "$Id$"
1817   *
1818   *   Parallel port backend for the Common UNIX Printing System (CUPS).
1819   *
1820 @@ -33,14 +33,7 @@
1821   * Include necessary headers.
1822   */
1823  
1824 -#include <cups/backend.h>
1825 -#include <cups/cups.h>
1826 -#include <stdio.h>
1827 -#include <stdlib.h>
1828 -#include <errno.h>
1829 -#include <cups/string.h>
1830 -#include <signal.h>
1831 -#include "ieee1284.c"
1832 +#include "backend-private.h"
1833  
1834  #ifdef __hpux
1835  #  include <sys/time.h>
1836 @@ -94,25 +87,18 @@
1837                 resource[1024],         /* Resource info (device and options) */
1838                 *options;               /* Pointer to options */
1839    int          port;                   /* Port number (not used) */
1840 -  int          fp;                     /* Print file */
1841 +  int          print_fd,               /* Print file */
1842 +               device_fd;              /* Parallel device */
1843    int          copies;                 /* Number of copies to print */
1844 -  int          fd;                     /* Parallel device */
1845 -  int          rbytes;                 /* Number of bytes read */
1846 -  int          wbytes;                 /* Number of bytes written */
1847 -  size_t       nbytes,                 /* Number of bytes read */
1848 -               tbytes;                 /* Total number of bytes written */
1849 -  char         buffer[8192],           /* Output buffer */
1850 -               *bufptr;                /* Pointer into buffer */
1851 +  size_t       tbytes;                 /* Total number of bytes written */
1852    struct termios opts;                 /* Parallel port options */
1853 -  fd_set       input,                  /* Input set for select() */
1854 -               output;                 /* Output set for select() */
1855 +#if defined(__linux) && defined(LP_POUTPA)
1856 +  unsigned int status;                 /* Port status (off-line, out-of-paper, etc.) */
1857    int          paperout;               /* Paper out? */
1858 +#endif /* __linux && LP_POUTPA */
1859  #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
1860    struct sigaction action;             /* Actions for POSIX signals */
1861  #endif /* HAVE_SIGACTION && !HAVE_SIGSET */
1862 -#ifdef __linux
1863 -  unsigned int status;                 /* Port status (off-line, out-of-paper, etc.) */
1864 -#endif /* __linux */
1865  
1866  
1867   /*
1868 @@ -157,8 +143,8 @@
1869  
1870    if (argc == 6)
1871    {
1872 -    fp     = 0;
1873 -    copies = 1;
1874 +    print_fd = 0;
1875 +    copies   = 1;
1876    }
1877    else
1878    {
1879 @@ -166,7 +152,7 @@
1880      * Try to open the print file...
1881      */
1882  
1883 -    if ((fp = open(argv[6], O_RDONLY)) < 0)
1884 +    if ((print_fd = open(argv[6], O_RDONLY)) < 0)
1885      {
1886        perror("ERROR: unable to open print file");
1887        return (CUPS_BACKEND_FAILED);
1888 @@ -206,7 +192,7 @@
1889  
1890    do
1891    {
1892 -    if ((fd = open(resource, O_WRONLY | O_EXCL)) == -1)
1893 +    if ((device_fd = open(resource, O_WRONLY | O_EXCL)) == -1)
1894      {
1895        if (getenv("CLASS") != NULL)
1896        {
1897 @@ -217,8 +203,8 @@
1898         * available printer in the class.
1899         */
1900  
1901 -        fputs("INFO: Unable to open parallel port, queuing on next printer in class...\n",
1902 -             stderr);
1903 +        fputs("INFO: Unable to open parallel port, queuing on next printer "
1904 +             "in class...\n", stderr);
1905  
1906         /*
1907          * Sleep 5 seconds to keep the job from requeuing too rapidly...
1908 @@ -231,23 +217,26 @@
1909  
1910        if (errno == EBUSY)
1911        {
1912 -        fputs("INFO: Parallel port busy; will retry in 30 seconds...\n", stderr);
1913 +        fputs("INFO: Parallel port busy; will retry in 30 seconds...\n",
1914 +             stderr);
1915         sleep(30);
1916        }
1917        else if (errno == ENXIO || errno == EIO || errno == ENOENT)
1918        {
1919 -        fputs("INFO: Printer not connected; will retry in 30 seconds...\n", stderr);
1920 +        fputs("INFO: Printer not connected; will retry in 30 seconds...\n",
1921 +             stderr);
1922         sleep(30);
1923        }
1924        else
1925        {
1926 -       fprintf(stderr, "ERROR: Unable to open parallel port device file \"%s\": %s\n",
1927 +       fprintf(stderr,
1928 +               "ERROR: Unable to open parallel port device file \"%s\": %s\n",
1929                 resource, strerror(errno));
1930         return (CUPS_BACKEND_FAILED);
1931        }
1932      }
1933    }
1934 -  while (fd < 0);
1935 +  while (device_fd < 0);
1936  
1937    fputs("STATE: -connecting-to-device\n", stderr);
1938  
1939 @@ -255,25 +244,21 @@
1940    * Set any options provided...
1941    */
1942  
1943 -  tcgetattr(fd, &opts);
1944 +  tcgetattr(device_fd, &opts);
1945  
1946    opts.c_lflag &= ~(ICANON | ECHO | ISIG);     /* Raw mode */
1947  
1948    /**** No options supported yet ****/
1949  
1950 -  tcsetattr(fd, TCSANOW, &opts);
1951 -
1952 - /*
1953 -  * Check printer status...
1954 -  */
1955 -
1956 -  paperout = 0;
1957 +  tcsetattr(device_fd, TCSANOW, &opts);
1958  
1959  #if defined(__linux) && defined(LP_POUTPA)
1960   /*
1961    * Show the printer status before we send the file...
1962    */
1963  
1964 +  paperout = 0;
1965 +
1966    while (!ioctl(fd, LPGETSTATUS, &status))
1967    {
1968      fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n", status);
1969 @@ -298,146 +283,38 @@
1970  #endif /* __linux && LP_POUTPA */
1971  
1972   /*
1973 -  * Now that we are "connected" to the port, ignore SIGTERM so that we
1974 -  * can finish out any page data the driver sends (e.g. to eject the
1975 -  * current page...  Only ignore SIGTERM if we are printing data from
1976 -  * stdin (otherwise you can't cancel raw jobs...)
1977 -  */
1978 -
1979 -  if (argc < 7)
1980 -  {
1981 -#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
1982 -    sigset(SIGTERM, SIG_IGN);
1983 -#elif defined(HAVE_SIGACTION)
1984 -    memset(&action, 0, sizeof(action));
1985 -
1986 -    sigemptyset(&action.sa_mask);
1987 -    action.sa_handler = SIG_IGN;
1988 -    sigaction(SIGTERM, &action, NULL);
1989 -#else
1990 -    signal(SIGTERM, SIG_IGN);
1991 -#endif /* HAVE_SIGSET */
1992 -  }
1993 -
1994 - /*
1995    * Finally, send the print file...
1996    */
1997  
1998 -  wbytes = 0;
1999 +  tbytes = 0;
2000  
2001 -  while (copies > 0)
2002 +  while (copies > 0 && tbytes >= 0)
2003    {
2004      copies --;
2005  
2006 -    if (fp != 0)
2007 +    if (print_fd != 0)
2008      {
2009        fputs("PAGE: 1 1\n", stderr);
2010 -      lseek(fp, 0, SEEK_SET);
2011 +      lseek(print_fd, 0, SEEK_SET);
2012      }
2013  
2014 -    tbytes = 0;
2015 -    while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
2016 -    {
2017 -     /*
2018 -      * Write the print data to the printer...
2019 -      */
2020 -
2021 -      tbytes += nbytes;
2022 -      bufptr = buffer;
2023 -
2024 -      while (nbytes > 0)
2025 -      {
2026 -       /*
2027 -        * See if we are ready to read or write...
2028 -       */
2029 -
2030 -        do
2031 -       {
2032 -          FD_ZERO(&input);
2033 -         FD_SET(fd, &input);
2034 -         FD_ZERO(&output);
2035 -         FD_SET(fd, &output);
2036 -        }
2037 -       while (select(fd + 1, &input, &output, NULL, NULL) < 0);
2038 -
2039 -        if (FD_ISSET(fd, &input))
2040 -       {
2041 -        /*
2042 -         * Read backchannel data...
2043 -         */
2044 -
2045 -         if ((rbytes = read(fd, resource, sizeof(resource))) > 0)
2046 -         {
2047 -           fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
2048 -                   rbytes);
2049 -            cupsBackChannelWrite(resource, rbytes, 1.0);
2050 -          }
2051 -       }
2052 -
2053 -        if (FD_ISSET(fd, &output))
2054 -       {
2055 -        /*
2056 -         * Write print data...
2057 -         */
2058 -
2059 -         if ((wbytes = write(fd, bufptr, nbytes)) < 0)
2060 -           if (errno == ENOTTY)
2061 -             wbytes = write(fd, bufptr, nbytes);
2062 -
2063 -         if (wbytes < 0)
2064 -         {
2065 -          /*
2066 -           * Check for retryable errors...
2067 -           */
2068 -
2069 -            if (errno == ENOSPC)
2070 -           {
2071 -             paperout = 1;
2072 -             fputs("ERROR: Out of paper!\n", stderr);
2073 -             fputs("STATUS: +media-tray-empty-error\n", stderr);
2074 -           }
2075 -           else if (errno != EAGAIN && errno != EINTR)
2076 -           {
2077 -             perror("ERROR: Unable to send print file to printer");
2078 -             break;
2079 -           }
2080 -         }
2081 -         else
2082 -         {
2083 -          /*
2084 -           * Update count and pointer...
2085 -           */
2086 -
2087 -            if (paperout)
2088 -           {
2089 -             fputs("STATUS: -media-tray-empty-error\n", stderr);
2090 -             paperout = 0;
2091 -           }
2092 -
2093 -           nbytes -= wbytes;
2094 -           bufptr += wbytes;
2095 -         }
2096 -       }
2097 -      }
2098 -
2099 -      if (wbytes < 0)
2100 -        break;
2101 +    tbytes = backendRunLoop(print_fd, device_fd, 1);
2102  
2103 -      if (argc > 6)
2104 -       fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
2105 -               (unsigned long)tbytes);
2106 -    }
2107 +    if (print_fd != 0 && tbytes >= 0)
2108 +      fprintf(stderr, "INFO: Sent print file, " CUPS_LLFMT " bytes...\n",
2109 +             CUPS_LLCAST tbytes);
2110    }
2111  
2112   /*
2113    * Close the socket connection and input file and return...
2114    */
2115  
2116 -  close(fd);
2117 -  if (fp != 0)
2118 -    close(fp);
2119 +  close(device_fd);
2120  
2121 -  return (wbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
2122 +  if (print_fd != 0)
2123 +    close(print_fd);
2124 +
2125 +  return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
2126  }
2127  
2128  
2129 @@ -485,9 +362,9 @@
2130        * Now grab the IEEE 1284 device ID string...
2131        */
2132  
2133 -      if (!get_device_id(fd, device_id, sizeof(device_id),
2134 -                         make_model, sizeof(make_model),
2135 -                        NULL, NULL, 0))
2136 +      if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
2137 +                              make_model, sizeof(make_model),
2138 +                             NULL, NULL, 0))
2139         printf("direct parallel:%s \"%s\" \"%s LPT #%d\" \"%s\"\n", device,
2140                make_model, make_model, i + 1, device_id);
2141        else
2142 @@ -735,5 +612,5 @@
2143  
2144  
2145  /*
2146 - * End of "$Id$".
2147 + * End of "$Id$".
2148   */
2149 diff -durN release-1.2.1/backend/runloop.c cups-1.2.x/backend/runloop.c
2150 --- release-1.2.1/backend/runloop.c     1970-01-01 01:00:00.000000000 +0100
2151 +++ cups-1.2.x/backend/runloop.c        2006-06-26 12:42:40.000000000 +0100
2152 @@ -0,0 +1,218 @@
2153 +/*
2154 + * "$Id$"
2155 + *
2156 + *   Common run loop API for the Common UNIX Printing System (CUPS).
2157 + *
2158 + *   Copyright 2006 by Easy Software Products, all rights reserved.
2159 + *
2160 + *   These coded instructions, statements, and computer programs are the
2161 + *   property of Easy Software Products and are protected by Federal
2162 + *   copyright law.  Distribution and use rights are outlined in the file
2163 + *   "LICENSE" which should have been included with this file.  If this
2164 + *   file is missing or damaged please contact Easy Software Products
2165 + *   at:
2166 + *
2167 + *       Attn: CUPS Licensing Information
2168 + *       Easy Software Products
2169 + *       44141 Airport View Drive, Suite 204
2170 + *       Hollywood, Maryland 20636 USA
2171 + *
2172 + *       Voice: (301) 373-9600
2173 + *       EMail: cups-info@cups.org
2174 + *         WWW: http://www.cups.org
2175 + *
2176 + *   This file is subject to the Apple OS-Developed Software exception.
2177 + *
2178 + * Contents:
2179 + *
2180 + *   backendRunLoop() - Read and write print and back-channel data.
2181 + */
2182 +
2183 +/*
2184 + * Include necessary headers.
2185 + */
2186 +
2187 +#include "backend-private.h"
2188 +#include <sys/select.h>
2189 +
2190 +
2191 +/*
2192 + * 'backendRunLoop()' - Read and write print and back-channel data.
2193 + */
2194 +
2195 +ssize_t                                        /* O - Total bytes on success, -1 on error */
2196 +backendRunLoop(int print_fd,           /* I - Print file descriptor */
2197 +               int device_fd,          /* I - Device file descriptor */
2198 +              int use_bc)              /* I - Use back-channel? */
2199 +{
2200 +  int          nfds;                   /* Maximum file descriptor value + 1 */
2201 +  fd_set       input,                  /* Input set for reading */
2202 +               output;                 /* Output set for writing */
2203 +  ssize_t      print_bytes,            /* Print bytes read */
2204 +               bc_bytes,               /* Backchannel bytes read */
2205 +               total_bytes,            /* Total bytes written */
2206 +               bytes;                  /* Bytes written */
2207 +  int          paperout;               /* "Paper out" status */
2208 +  char         print_buffer[8192],     /* Print data buffer */
2209 +               *print_ptr,             /* Pointer into print data buffer */
2210 +               bc_buffer[1024];        /* Back-channel data buffer */
2211 +#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
2212 +  struct sigaction action;             /* Actions for POSIX signals */
2213 +#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
2214 +
2215 +
2216 + /*
2217 +  * If we are printing data from a print driver on stdin, ignore SIGTERM
2218 +  * so that the driver can finish out any page data, e.g. to eject the
2219 +  * current page.  We only do this for stdin printing as otherwise there
2220 +  * is no way to cancel a raw print job...
2221 +  */
2222 +
2223 +  if (!print_fd)
2224 +  {
2225 +#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
2226 +    sigset(SIGTERM, SIG_IGN);
2227 +#elif defined(HAVE_SIGACTION)
2228 +    memset(&action, 0, sizeof(action));
2229 +
2230 +    sigemptyset(&action.sa_mask);
2231 +    action.sa_handler = SIG_IGN;
2232 +    sigaction(SIGTERM, &action, NULL);
2233 +#else
2234 +    signal(SIGTERM, SIG_IGN);
2235 +#endif /* HAVE_SIGSET */
2236 +  }
2237 +
2238 + /*
2239 +  * Figure out the maximum file descriptor value to use with select()...
2240 +  */
2241 +
2242 +  nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
2243 +
2244 + /*
2245 +  * Now loop until we are out of data from print_fd...
2246 +  */
2247 +
2248 +  for (print_bytes = 0, print_ptr = print_buffer, paperout = 0, total_bytes = 0;;)
2249 +  {
2250 +   /*
2251 +    * Use select() to determine whether we have data to copy around...
2252 +    */
2253 +
2254 +    FD_ZERO(&input);
2255 +    if (!print_bytes)
2256 +      FD_SET(print_fd, &input);
2257 +    if (use_bc)
2258 +      FD_SET(device_fd, &input);
2259 +
2260 +    FD_ZERO(&output);
2261 +    if (print_bytes)
2262 +      FD_SET(device_fd, &output);
2263 +
2264 +    if (select(nfds, &input, &output, NULL, NULL) < 0)
2265 +      continue;                                /* Ignore errors here */
2266 +
2267 +   /*
2268 +    * Check if we have back-channel data ready...
2269 +    */
2270 +
2271 +    if (FD_ISSET(device_fd, &input))
2272 +    {
2273 +      if ((bc_bytes = read(device_fd, bc_buffer, sizeof(bc_buffer))) > 0)
2274 +      {
2275 +       fprintf(stderr,
2276 +               "DEBUG: Received " CUPS_LLFMT " bytes of back-channel data!\n",
2277 +               CUPS_LLCAST bc_bytes);
2278 +        cupsBackChannelWrite(bc_buffer, bc_bytes, 1.0);
2279 +      }
2280 +    }
2281 +
2282 +   /*
2283 +    * Check if we have print data ready...
2284 +    */
2285 +
2286 +    if (FD_ISSET(print_fd, &input))
2287 +    {
2288 +      if ((print_bytes = read(print_fd, print_buffer,
2289 +                              sizeof(print_buffer))) < 0)
2290 +      {
2291 +       /*
2292 +        * Read error - bail if we don't see EAGAIN or EINTR...
2293 +       */
2294 +
2295 +       if (errno != EAGAIN || errno != EINTR)
2296 +       {
2297 +         perror("ERROR: Unable to read print data");
2298 +         return (-1);
2299 +       }
2300 +
2301 +        print_bytes = 0;
2302 +      }
2303 +      else if (print_bytes == 0)
2304 +      {
2305 +       /*
2306 +        * End of file, break out of the loop...
2307 +       */
2308 +
2309 +        break;
2310 +      }
2311 +
2312 +      print_ptr = print_buffer;
2313 +    }
2314 +
2315 +   /*
2316 +    * Check if the device is ready to receive data and we have data to
2317 +    * send...
2318 +    */
2319 +
2320 +    if (print_bytes && FD_ISSET(device_fd, &output))
2321 +    {
2322 +      if ((bytes = write(device_fd, print_ptr, print_bytes)) < 0)
2323 +      {
2324 +       /*
2325 +        * Write error - bail if we don't see an error we can retry...
2326 +       */
2327 +
2328 +        if (errno == ENOSPC)
2329 +       {
2330 +         if (!paperout)
2331 +         {
2332 +           fputs("ERROR: Out of paper!\n", stderr);
2333 +           fputs("STATUS: +media-tray-empty-error\n", stderr);
2334 +           paperout = 1;
2335 +         }
2336 +        }
2337 +       else if (errno != EAGAIN && errno != EINTR && errno != ENOTTY)
2338 +       {
2339 +         perror("ERROR: Unable to write print data");
2340 +         return (-1);
2341 +       }
2342 +      }
2343 +      else
2344 +      {
2345 +        if (paperout)
2346 +       {
2347 +         fputs("STATUS: -media-tray-empty-error\n", stderr);
2348 +         paperout = 0;
2349 +       }
2350 +
2351 +        fprintf(stderr, "DEBUG: Wrote %d bytes...\n", (int)bytes);
2352 +
2353 +        print_bytes -= bytes;
2354 +       print_ptr   += bytes;
2355 +       total_bytes += bytes;
2356 +      }
2357 +    }
2358 +  }
2359 +
2360 + /*
2361 +  * Return with success...
2362 +  */
2363 +
2364 +  return (total_bytes);
2365 +}
2366 +
2367 +
2368 +/*
2369 + * End of "$Id$".
2370 + */
2371 diff -durN release-1.2.1/backend/serial.c cups-1.2.x/backend/serial.c
2372 --- release-1.2.1/backend/serial.c      2006-07-04 17:32:11.000000000 +0100
2373 +++ cups-1.2.x/backend/serial.c 2006-06-26 12:42:40.000000000 +0100
2374 @@ -1,5 +1,5 @@
2375  /*
2376 - * "$Id$"
2377 + * "$Id$"
2378   *
2379   *   Serial port backend for the Common UNIX Printing System (CUPS).
2380   *
2381 @@ -33,13 +33,7 @@
2382   * Include necessary headers.
2383   */
2384  
2385 -#include <cups/backend.h>
2386 -#include <cups/cups.h>
2387 -#include <stdio.h>
2388 -#include <stdlib.h>
2389 -#include <errno.h>
2390 -#include <cups/string.h>
2391 -#include <signal.h>
2392 +#include "backend-private.h"
2393  
2394  #ifdef __hpux
2395  #  include <sys/modem.h>
2396 @@ -121,21 +115,23 @@
2397                 value[255],             /* Value of option */
2398                 *ptr;                   /* Pointer into name or value */
2399    int          port;                   /* Port number (not used) */
2400 -  int          fp;                     /* Print file */
2401    int          copies;                 /* Number of copies to print */
2402 -  int          fd;                     /* Parallel device */
2403 -  int          rbytes;                 /* Number of bytes read */
2404 -  int          wbytes;                 /* Number of bytes written */
2405 -  size_t       nbytes,                 /* Number of bytes read */
2406 -               tbytes;                 /* Total number of bytes written */
2407 +  int          print_fd,               /* Print file */
2408 +               device_fd;              /* Serial device */
2409 +  int          nfds;                   /* Maximum file descriptor value + 1 */
2410 +  fd_set       input,                  /* Input set for reading */
2411 +               output;                 /* Output set for writing */
2412 +  ssize_t      print_bytes,            /* Print bytes read */
2413 +               bc_bytes,               /* Backchannel bytes read */
2414 +               total_bytes,            /* Total bytes written */
2415 +               bytes;                  /* Bytes written */
2416    int          dtrdsr;                 /* Do dtr/dsr flow control? */
2417 -  int          bufsize;                /* Size of output buffer for writes */
2418 -  char         buffer[8192],           /* Output buffer */
2419 -               *bufptr;                /* Pointer into buffer */
2420 +  int          print_size;             /* Size of output buffer for writes */
2421 +  char         print_buffer[8192],     /* Print data buffer */
2422 +               *print_ptr,             /* Pointer into print data buffer */
2423 +               bc_buffer[1024];        /* Back-channel data buffer */
2424    struct termios opts;                 /* Serial port options */
2425    struct termios origopts;             /* Original port options */
2426 -  fd_set       input,                  /* Input set for select() */
2427 -               output;                 /* Output set for select() */
2428  #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
2429    struct sigaction action;             /* Actions for POSIX signals */
2430  #endif /* HAVE_SIGACTION && !HAVE_SIGSET */
2431 @@ -183,8 +179,8 @@
2432  
2433    if (argc == 6)
2434    {
2435 -    fp     = 0;
2436 -    copies = 1;
2437 +    print_fd = 0;
2438 +    copies   = 1;
2439    }
2440    else
2441    {
2442 @@ -192,7 +188,7 @@
2443      * Try to open the print file...
2444      */
2445  
2446 -    if ((fp = open(argv[6], O_RDONLY)) < 0)
2447 +    if ((print_fd = open(argv[6], O_RDONLY)) < 0)
2448      {
2449        perror("ERROR: unable to open print file");
2450        return (CUPS_BACKEND_FAILED);
2451 @@ -232,7 +228,8 @@
2452  
2453    do
2454    {
2455 -    if ((fd = open(resource, O_WRONLY | O_NOCTTY | O_EXCL | O_NDELAY)) == -1)
2456 +    if ((device_fd = open(resource, O_RDWR | O_NOCTTY | O_EXCL |
2457 +                                    O_NDELAY)) == -1)
2458      {
2459        if (getenv("CLASS") != NULL)
2460        {
2461 @@ -268,7 +265,7 @@
2462        }
2463      }
2464    }
2465 -  while (fd < 0);
2466 +  while (device_fd < 0);
2467  
2468    fputs("STATE: -connecting-to-device\n", stderr);
2469  
2470 @@ -276,16 +273,18 @@
2471    * Set any options provided...
2472    */
2473  
2474 -  tcgetattr(fd, &origopts);
2475 -  tcgetattr(fd, &opts);
2476 +  tcgetattr(device_fd, &origopts);
2477 +  tcgetattr(device_fd, &opts);
2478  
2479 -  opts.c_lflag &= ~(ICANON | ECHO | ISIG);     /* Raw mode */
2480 -  opts.c_oflag &= ~OPOST;                      /* Don't post-process */
2481 +  opts.c_lflag &= ~(ICANON | ECHO | ISIG);
2482 +                                       /* Raw mode */
2483 +  opts.c_oflag &= ~OPOST;              /* Don't post-process */
2484  
2485 -  bufsize = 96;                /* 9600 baud / 10 bits/char / 10Hz */
2486 -  dtrdsr  = 0;         /* No dtr/dsr flow control */
2487 +  print_size = 96;                     /* 9600 baud / 10 bits/char / 10Hz */
2488 +  dtrdsr     = 0;                      /* No dtr/dsr flow control */
2489  
2490 -  if (options != NULL)
2491 +  if (options)
2492 +  {
2493      while (*options)
2494      {
2495       /*
2496 @@ -326,7 +325,7 @@
2497          * Set the baud rate...
2498         */
2499  
2500 -        bufsize = atoi(value) / 100;
2501 +        print_size = atoi(value) / 100;
2502  
2503  #if B19200 == 19200
2504          cfsetispeed(&opts, atoi(value));
2505 @@ -488,9 +487,10 @@
2506         }
2507        }
2508      }
2509 +  }
2510  
2511 -  tcsetattr(fd, TCSANOW, &opts);
2512 -  fcntl(fd, F_SETFL, 0);
2513 +  tcsetattr(device_fd, TCSANOW, &opts);
2514 +  fcntl(device_fd, F_SETFL, 0);
2515  
2516   /*
2517    * Now that we are "connected" to the port, ignore SIGTERM so that we
2518 @@ -499,7 +499,7 @@
2519    * stdin (otherwise you can't cancel raw jobs...)
2520    */
2521  
2522 -  if (argc < 7)
2523 +  if (print_fd != 0)
2524    {
2525  #ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
2526      sigset(SIGTERM, SIG_IGN);
2527 @@ -515,133 +515,181 @@
2528    }
2529  
2530   /*
2531 -  * Finally, send the print file...
2532 +  * Figure out the maximum file descriptor value to use with select()...
2533    */
2534  
2535 -  if (bufsize > sizeof(buffer))
2536 -    bufsize = sizeof(buffer);
2537 +  nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
2538  
2539 -  wbytes = 0;
2540 + /*
2541 +  * Finally, send the print file.  Ordinarily we would just use the
2542 +  * backendRunLoop() function, however since we need to use smaller
2543 +  * writes and may need to do DSR/DTR flow control, we duplicate much
2544 +  * of the code here instead...
2545 +  */
2546 +
2547 +  if (print_size > sizeof(print_buffer))
2548 +    print_size = sizeof(print_buffer);
2549 +
2550 +  total_bytes = 0;
2551  
2552    while (copies > 0)
2553    {
2554      copies --;
2555  
2556 -    if (fp != 0)
2557 +    if (print_fd != 0)
2558      {
2559        fputs("PAGE: 1 1\n", stderr);
2560 -      lseek(fp, 0, SEEK_SET);
2561 +      lseek(print_fd, 0, SEEK_SET);
2562      }
2563  
2564 -    if (dtrdsr)
2565 +   /*
2566 +    * Now loop until we are out of data from print_fd...
2567 +    */
2568 +
2569 +    for (print_bytes = 0, print_ptr = print_buffer;;)
2570      {
2571       /*
2572 -      * Check the port and sleep until DSR is set...
2573 +      * Use select() to determine whether we have data to copy around...
2574        */
2575  
2576 -      int status;
2577 +      FD_ZERO(&input);
2578 +      if (!print_bytes)
2579 +       FD_SET(print_fd, &input);
2580 +      FD_SET(device_fd, &input);
2581  
2582 +      FD_ZERO(&output);
2583 +      if (print_bytes)
2584 +       FD_SET(device_fd, &output);
2585  
2586 -      if (!ioctl(fd, TIOCMGET, &status))
2587 -        if (!(status & TIOCM_DSR))
2588 +      if (select(nfds, &input, &output, NULL, NULL) < 0)
2589 +       continue;                       /* Ignore errors here */
2590 +
2591 +     /*
2592 +      * Check if we have back-channel data ready...
2593 +      */
2594 +
2595 +      if (FD_ISSET(device_fd, &input))
2596 +      {
2597 +       if ((bc_bytes = read(device_fd, bc_buffer, sizeof(bc_buffer))) > 0)
2598 +       {
2599 +         fprintf(stderr,
2600 +                 "DEBUG: Received " CUPS_LLFMT " bytes of back-channel data!\n",
2601 +                 CUPS_LLCAST bc_bytes);
2602 +          cupsBackChannelWrite(bc_buffer, bc_bytes, 1.0);
2603 +       }
2604 +      }
2605 +
2606 +     /*
2607 +      * Check if we have print data ready...
2608 +      */
2609 +
2610 +      if (FD_ISSET(print_fd, &input))
2611 +      {
2612 +       if ((print_bytes = read(print_fd, print_buffer, print_size)) < 0)
2613         {
2614          /*
2615 -         * Wait for DSR to go high...
2616 +          * Read error - bail if we don't see EAGAIN or EINTR...
2617           */
2618  
2619 -         fputs("DEBUG: DSR is low; waiting for device...\n", stderr);
2620 -
2621 -          do
2622 +         if (errno != EAGAIN || errno != EINTR)
2623           {
2624 -           sleep(1);
2625 -           if (ioctl(fd, TIOCMGET, &status))
2626 -             break;
2627 -         }
2628 -         while (!(status & TIOCM_DSR));
2629 -
2630 -         fputs("DEBUG: DSR is high; writing to device...\n", stderr);
2631 -        }
2632 -    }
2633 +           perror("ERROR: Unable to read print data");
2634  
2635 -    tbytes = 0;
2636 -    while ((nbytes = read(fp, buffer, bufsize)) > 0)
2637 -    {
2638 -     /*
2639 -      * Write the print data to the printer...
2640 -      */
2641 +            tcsetattr(device_fd, TCSADRAIN, &origopts);
2642  
2643 -      tbytes += nbytes;
2644 -      bufptr = buffer;
2645 +           close(device_fd);
2646  
2647 -      while (nbytes > 0)
2648 -      {
2649 -       /*
2650 -        * See if we are ready to read or write...
2651 -       */
2652 +           if (print_fd != 0)
2653 +             close(print_fd);
2654  
2655 -        do
2656 -       {
2657 -          FD_ZERO(&input);
2658 -         FD_SET(fd, &input);
2659 -         FD_ZERO(&output);
2660 -         FD_SET(fd, &output);
2661 -        }
2662 -       while (select(fd + 1, &input, &output, NULL, NULL) < 0);
2663 +           return (CUPS_BACKEND_FAILED);
2664 +         }
2665  
2666 -        if (FD_ISSET(fd, &input))
2667 +          print_bytes = 0;
2668 +       }
2669 +       else if (print_bytes == 0)
2670         {
2671          /*
2672 -         * Read backchannel data...
2673 +          * End of file, break out of the loop...
2674           */
2675  
2676 -         if ((rbytes = read(fd, resource, sizeof(resource))) > 0)
2677 -         {
2678 -           fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
2679 -                   rbytes);
2680 -            cupsBackChannelWrite(resource, rbytes, 1.0);
2681 -          }
2682 +          break;
2683         }
2684  
2685 -        if (FD_ISSET(fd, &output))
2686 +       print_ptr = print_buffer;
2687 +      }
2688 +
2689 +     /*
2690 +      * Check if the device is ready to receive data and we have data to
2691 +      * send...
2692 +      */
2693 +
2694 +      if (print_bytes && FD_ISSET(device_fd, &output))
2695 +      {
2696 +       if (dtrdsr)
2697         {
2698          /*
2699 -         * Write print data...
2700 +         * Check the port and sleep until DSR is set...
2701           */
2702  
2703 -         if ((wbytes = write(fd, bufptr, nbytes)) < 0)
2704 -           if (errno == ENOTTY)
2705 -             wbytes = write(fd, bufptr, nbytes);
2706 +         int status;
2707  
2708 -         if (wbytes < 0)
2709 -         {
2710 -          /*
2711 -           * Check for retryable errors...
2712 -           */
2713  
2714 -           if (errno != EAGAIN && errno != EINTR)
2715 +         if (!ioctl(device_fd, TIOCMGET, &status))
2716 +            if (!(status & TIOCM_DSR))
2717             {
2718 -             perror("ERROR: Unable to send print file to printer");
2719 -             break;
2720 -           }
2721 -         }
2722 -         else
2723 +            /*
2724 +             * Wait for DSR to go high...
2725 +             */
2726 +
2727 +             fputs("DEBUG: DSR is low; waiting for device...\n", stderr);
2728 +
2729 +              do
2730 +             {
2731 +              /*
2732 +               * Poll every 100ms...
2733 +               */
2734 +
2735 +               usleep(100000);
2736 +
2737 +               if (ioctl(device_fd, TIOCMGET, &status))
2738 +                 break;
2739 +             }
2740 +             while (!(status & TIOCM_DSR));
2741 +
2742 +             fputs("DEBUG: DSR is high; writing to device...\n", stderr);
2743 +            }
2744 +       }
2745 +
2746 +       if ((bytes = write(device_fd, print_ptr, print_bytes)) < 0)
2747 +       {
2748 +        /*
2749 +          * Write error - bail if we don't see an error we can retry...
2750 +         */
2751 +
2752 +         if (errno != EAGAIN && errno != EINTR && errno != ENOTTY)
2753           {
2754 -          /*
2755 -           * Update count and pointer...
2756 -           */
2757 +           perror("ERROR: Unable to write print data");
2758  
2759 -           nbytes -= wbytes;
2760 -           bufptr += wbytes;
2761 +            tcsetattr(device_fd, TCSADRAIN, &origopts);
2762 +
2763 +           close(device_fd);
2764 +
2765 +           if (print_fd != 0)
2766 +             close(print_fd);
2767 +
2768 +           return (CUPS_BACKEND_FAILED);
2769           }
2770         }
2771 -      }
2772 -
2773 -      if (wbytes < 0)
2774 -        break;
2775 +       else
2776 +       {
2777 +          fprintf(stderr, "DEBUG: Wrote %d bytes...\n", (int)bytes);
2778  
2779 -      if (argc > 6)
2780 -       fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
2781 -               (unsigned long)tbytes);
2782 +          print_bytes -= bytes;
2783 +         print_ptr   += bytes;
2784 +         total_bytes += bytes;
2785 +       }
2786 +      }
2787      }
2788    }
2789  
2790 @@ -649,13 +697,14 @@
2791    * Close the serial port and input file and return...
2792    */
2793  
2794 -  tcsetattr(fd, TCSADRAIN, &origopts);
2795 +  tcsetattr(device_fd, TCSADRAIN, &origopts);
2796  
2797 -  close(fd);
2798 -  if (fp != 0)
2799 -    close(fp);
2800 +  close(device_fd);
2801  
2802 -  return (wbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
2803 +  if (print_fd != 0)
2804 +    close(print_fd);
2805 +
2806 +  return (total_bytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
2807  }
2808  
2809  
2810 @@ -1169,5 +1218,5 @@
2811  
2812  
2813  /*
2814 - * End of "$Id$".
2815 + * End of "$Id$".
2816   */
2817 diff -durN release-1.2.1/backend/snmp.c cups-1.2.x/backend/snmp.c
2818 --- release-1.2.1/backend/snmp.c        2006-07-04 17:32:11.000000000 +0100
2819 +++ cups-1.2.x/backend/snmp.c   2006-06-28 09:59:03.000000000 +0100
2820 @@ -1,5 +1,5 @@
2821  /*
2822 - * "$Id$"
2823 + * "$Id$"
2824   *
2825   *   SNMP discovery backend for the Common UNIX Printing System (CUPS).
2826   *
2827 @@ -77,17 +77,10 @@
2828   * Include necessary headers.
2829   */
2830  
2831 -#include <cups/backend.h>
2832  #include <cups/http-private.h>
2833 -#include <cups/cups.h>
2834 -#include <cups/string.h>
2835 +#include "backend-private.h"
2836  #include <cups/array.h>
2837  #include <cups/file.h>
2838 -#include <errno.h>
2839 -#include <signal.h>
2840 -
2841 -#define SNMP_BACKEND
2842 -#include "ieee1284.c"
2843  
2844  
2845  /*
2846 @@ -391,7 +384,7 @@
2847  
2848    debug_printf("DEBUG: add_cache(addr=%p, addrname=\"%s\", uri=\"%s\", "
2849                    "id=\"%s\", make_and_model=\"%s\")\n",
2850 -               addr, addrname, uri, id ? id :  "(null)",
2851 +               addr, addrname, uri ? uri : "(null)", id ? id :  "(null)",
2852                make_and_model ? make_and_model : "(null)");
2853  
2854    temp = calloc(1, sizeof(snmp_cache_t));
2855 @@ -1648,6 +1641,14 @@
2856           info = NULL;
2857  
2858         /*
2859 +        * Don't use the printer-make-and-model if it contains a generic
2860 +       * string like "Ricoh IPP Printer"...
2861 +       */
2862 +
2863 +       if (model && strstr(model->values[0].string.text, "IPP Printer"))
2864 +         model = NULL;
2865 +
2866 +       /*
2867          * If we don't have a printer-make-and-model string from the printer
2868         * but do have the 1284 device ID string, generate a make-and-model
2869         * string from the device ID info...
2870 @@ -1656,7 +1657,9 @@
2871         if (model)
2872            strlcpy(temp, model->values[0].string.text, sizeof(temp));
2873         else if (info)
2874 -         get_make_model(info->values[0].string.text, temp, sizeof(temp));
2875 +         backendGetMakeModel(info->values[0].string.text, temp, sizeof(temp));
2876 +        else
2877 +         temp[0] = '\0';
2878  
2879          fix_make_model(make_model, temp, sizeof(make_model));
2880  
2881 @@ -1928,8 +1931,8 @@
2882        * Description is the IEEE-1284 device ID...
2883        */
2884  
2885 -      get_make_model(packet.object_value.string, make_model,
2886 -                     sizeof(make_model));
2887 +      backendGetMakeModel(packet.object_value.string, make_model,
2888 +                         sizeof(make_model));
2889      }
2890      else
2891      {
2892 @@ -2212,5 +2215,5 @@
2893  
2894  
2895  /*
2896 - * End of "$Id$".
2897 + * End of "$Id$".
2898   */
2899 diff -durN release-1.2.1/backend/socket.c cups-1.2.x/backend/socket.c
2900 --- release-1.2.1/backend/socket.c      2006-07-04 17:32:11.000000000 +0100
2901 +++ cups-1.2.x/backend/socket.c 2006-06-26 12:42:40.000000000 +0100
2902 @@ -1,5 +1,5 @@
2903  /*
2904 - * "$Id$"
2905 + * "$Id$"
2906   *
2907   *   AppSocket backend for the Common UNIX Printing System (CUPS).
2908   *
2909 @@ -32,17 +32,11 @@
2910   * Include necessary headers.
2911   */
2912  
2913 -#include <cups/backend.h>
2914  #include <cups/http-private.h>
2915 -#include <cups/cups.h>
2916 -#include <stdio.h>
2917 -#include <stdlib.h>
2918 +#include "backend-private.h"
2919  #include <stdarg.h>
2920 -#include <cups/string.h>
2921 -#include <errno.h>
2922  #include <sys/types.h>
2923  #include <sys/stat.h>
2924 -#include <signal.h>
2925  
2926  #ifdef WIN32
2927  #  include <winsock.h>
2928 @@ -76,24 +70,19 @@
2929                 name[255],              /* Name of option */
2930                 value[255],             /* Value of option */
2931                 *ptr;                   /* Pointer into name or value */
2932 -  int          fp;                     /* Print file */
2933 +  int          print_fd;               /* Print file */
2934    int          copies;                 /* Number of copies to print */
2935    int          waiteof;                /* Wait for end-of-file? */
2936    int          port;                   /* Port number */
2937    char         portname[255];          /* Port name */
2938    int          delay;                  /* Delay for retries... */
2939 -  int          fd;                     /* AppSocket */
2940 +  int          device_fd;              /* AppSocket */
2941    int          error;                  /* Error code (if any) */
2942    http_addrlist_t *addrlist;           /* Address list */
2943 -  int          rbytes;                 /* Number of bytes read */
2944 -  int          wbytes;                 /* Number of bytes written */
2945 -  int          nbytes;                 /* Number of bytes read */
2946 -  size_t       tbytes;                 /* Total number of bytes written */
2947 -  char         buffer[8192],           /* Output buffer */
2948 -               *bufptr;                /* Pointer into buffer */
2949 +  ssize_t      tbytes;                 /* Total number of bytes written */
2950    struct timeval timeout;              /* Timeout for select() */
2951 -  fd_set       input,                  /* Input set for select() */
2952 -               output;                 /* Output set for select() */
2953 +  fd_set       input;                  /* Input set for select() */
2954 +  ssize_t      bc_bytes;               /* Number of back-channel bytes read */
2955  #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
2956    struct sigaction action;             /* Actions for POSIX signals */
2957  #endif /* HAVE_SIGACTION && !HAVE_SIGSET */
2958 @@ -142,8 +131,8 @@
2959  
2960    if (argc == 6)
2961    {
2962 -    fp     = 0;
2963 -    copies = 1;
2964 +    print_fd = 0;
2965 +    copies   = 1;
2966    }
2967    else
2968    {
2969 @@ -151,7 +140,7 @@
2970      * Try to open the print file...
2971      */
2972  
2973 -    if ((fp = open(argv[6], O_RDONLY)) < 0)
2974 +    if ((print_fd = open(argv[6], O_RDONLY)) < 0)
2975      {
2976        perror("ERROR: unable to open print file");
2977        return (CUPS_BACKEND_FAILED);
2978 @@ -252,228 +241,134 @@
2979    fprintf(stderr, "INFO: Attempting to connect to host %s on port %d\n",
2980            hostname, port);
2981  
2982 -  wbytes = 0;
2983 +  fputs("STATE: +connecting-to-device\n", stderr);
2984  
2985 -  while (copies > 0)
2986 +  for (delay = 5;;)
2987    {
2988 -    fputs("STATE: +connecting-to-device\n", stderr);
2989 -
2990 -    for (delay = 5;;)
2991 +    if (!httpAddrConnect(addrlist, &device_fd))
2992      {
2993 -      if (!httpAddrConnect(addrlist, &fd))
2994 -      {
2995 -       error = errno;
2996 -       fd    = -1;
2997 +      error     = errno;
2998 +      device_fd = -1;
2999  
3000 -       if (getenv("CLASS") != NULL)
3001 -       {
3002 -        /*
3003 -          * If the CLASS environment variable is set, the job was submitted
3004 -         * to a class and not to a specific queue.  In this case, we want
3005 -         * to abort immediately so that the job can be requeued on the next
3006 -         * available printer in the class.
3007 -         */
3008 +      if (getenv("CLASS") != NULL)
3009 +      {
3010 +       /*
3011 +        * If the CLASS environment variable is set, the job was submitted
3012 +       * to a class and not to a specific queue.  In this case, we want
3013 +       * to abort immediately so that the job can be requeued on the next
3014 +       * available printer in the class.
3015 +       */
3016  
3017 -          fprintf(stderr, "INFO: Unable to connect to \"%s\", queuing on next printer in class...\n",
3018 -                 hostname);
3019 +        fprintf(stderr, "INFO: Unable to connect to \"%s\", queuing on next printer in class...\n",
3020 +               hostname);
3021  
3022 -        /*
3023 -          * Sleep 5 seconds to keep the job from requeuing too rapidly...
3024 -         */
3025 +       /*
3026 +        * Sleep 5 seconds to keep the job from requeuing too rapidly...
3027 +       */
3028  
3029 -         sleep(5);
3030 +       sleep(5);
3031  
3032 -          return (CUPS_BACKEND_FAILED);
3033 -       }
3034 +        return (CUPS_BACKEND_FAILED);
3035 +      }
3036  
3037 -       if (error == ECONNREFUSED || error == EHOSTDOWN ||
3038 -            error == EHOSTUNREACH)
3039 -       {
3040 -         fprintf(stderr, "INFO: Network host \'%s\' is busy; will retry in %d seconds...\n",
3041 -                  hostname, delay);
3042 -         sleep(delay);
3043 +      if (error == ECONNREFUSED || error == EHOSTDOWN ||
3044 +          error == EHOSTUNREACH)
3045 +      {
3046 +       fprintf(stderr,
3047 +               "INFO: Network host \'%s\' is busy; will retry in %d seconds...\n",
3048 +                hostname, delay);
3049 +       sleep(delay);
3050  
3051 -         if (delay < 30)
3052 -           delay += 5;
3053 -       }
3054 -       else
3055 -       {
3056 -         perror("ERROR: Unable to connect to printer (retrying in 30 seconds)");
3057 -         sleep(30);
3058 -       }
3059 +       if (delay < 30)
3060 +         delay += 5;
3061        }
3062        else
3063 -       break;
3064 +      {
3065 +       perror("ERROR: Unable to connect to printer (retrying in 30 seconds)");
3066 +       sleep(30);
3067 +      }
3068      }
3069 +    else
3070 +      break;
3071 +  }
3072  
3073 -    fputs("STATE: -connecting-to-device\n", stderr);
3074 -
3075 -   /*
3076 -    * Now that we are "connected" to the port, ignore SIGTERM so that we
3077 -    * can finish out any page data the driver sends (e.g. to eject the
3078 -    * current page...  Only ignore SIGTERM if we are printing data from
3079 -    * stdin (otherwise you can't cancel raw jobs...)
3080 -    */
3081 -
3082 -    if (argc < 7)
3083 -    {
3084 -#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
3085 -      sigset(SIGTERM, SIG_IGN);
3086 -#elif defined(HAVE_SIGACTION)
3087 -      memset(&action, 0, sizeof(action));
3088 +  fputs("STATE: -connecting-to-device\n", stderr);
3089  
3090 -      sigemptyset(&action.sa_mask);
3091 -      action.sa_handler = SIG_IGN;
3092 -      sigaction(SIGTERM, &action, NULL);
3093 -#else
3094 -      signal(SIGTERM, SIG_IGN);
3095 -#endif /* HAVE_SIGSET */
3096 -    }
3097 + /*
3098 +  * Print everything...
3099 +  */
3100  
3101 -   /*
3102 -    * Finally, send the print file...
3103 -    */
3104 +  tbytes = 0;
3105  
3106 +  while (copies > 0 && tbytes >= 0)
3107 +  {
3108      copies --;
3109  
3110 -    if (fp != 0)
3111 +    if (print_fd != 0)
3112      {
3113        fputs("PAGE: 1 1\n", stderr);
3114 -      lseek(fp, 0, SEEK_SET);
3115 +      lseek(print_fd, 0, SEEK_SET);
3116      }
3117  
3118 -    fputs("INFO: Connected to host, sending print job...\n", stderr);
3119 -
3120 -    tbytes = 0;
3121 -    while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
3122 -    {
3123 -     /*
3124 -      * Write the print data to the printer...
3125 -      */
3126 -
3127 -      tbytes += nbytes;
3128 -      bufptr = buffer;
3129 -
3130 -      while (nbytes > 0)
3131 -      {
3132 -       /*
3133 -        * See if we are ready to read or write...
3134 -       */
3135 -
3136 -        do
3137 -       {
3138 -          FD_ZERO(&input);
3139 -         FD_SET(fd, &input);
3140 -         FD_ZERO(&output);
3141 -         FD_SET(fd, &output);
3142 -        }
3143 -       while (select(fd + 1, &input, &output, NULL, NULL) < 0);
3144 -
3145 -        if (FD_ISSET(fd, &input))
3146 -       {
3147 -        /*
3148 -         * Read backchannel data...
3149 -         */
3150 -
3151 -         if ((rbytes = recv(fd, resource, sizeof(resource), 0)) > 0)
3152 -         {
3153 -           fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
3154 -                   rbytes);
3155 -            cupsBackChannelWrite(resource, rbytes, 1.0);
3156 -          }
3157 -       }
3158 -
3159 -        if (FD_ISSET(fd, &output))
3160 -       {
3161 -        /*
3162 -         * Write print data...
3163 -         */
3164 -
3165 -         if ((wbytes = send(fd, bufptr, nbytes, 0)) < 0)
3166 -         {
3167 -          /*
3168 -           * Check for retryable errors...
3169 -           */
3170 +    tbytes = backendRunLoop(print_fd, device_fd, 1);
3171  
3172 -           if (errno != EAGAIN && errno != EINTR)
3173 -           {
3174 -             perror("ERROR: Unable to send print file to printer");
3175 -             break;
3176 -           }
3177 -         }
3178 -         else
3179 -         {
3180 -          /*
3181 -           * Update count and pointer...
3182 -           */
3183 +    if (print_fd != 0 && tbytes >= 0)
3184 +      fprintf(stderr, "INFO: Sent print file, " CUPS_LLFMT " bytes...\n",
3185 +             CUPS_LLCAST tbytes);
3186 +  }
3187  
3188 -           nbytes -= wbytes;
3189 -           bufptr += wbytes;
3190 -         }
3191 -        }
3192 -      }
3193 +  if (waiteof)
3194 +  {
3195 +   /*
3196 +    * Shutdown the socket and wait for the other end to finish...
3197 +    */
3198  
3199 -      if (wbytes < 0)
3200 -        break;
3201 +    fputs("INFO: Print file sent, waiting for printer to finish...\n", stderr);
3202  
3203 -      if (argc > 6)
3204 -       fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
3205 -               (unsigned long)tbytes);
3206 -    }
3207 +    shutdown(device_fd, 1);
3208  
3209 -    if (waiteof)
3210 +    for (;;)
3211      {
3212       /*
3213 -      * Shutdown the socket and wait for the other end to finish...
3214 +      * Wait a maximum of 90 seconds for backchannel data or a closed
3215 +      * connection...
3216        */
3217  
3218 -      fputs("INFO: Print file sent, waiting for printer to finish...\n", stderr);
3219 +      timeout.tv_sec  = 90;
3220 +      timeout.tv_usec = 0;
3221  
3222 -      shutdown(fd, 1);
3223 +      FD_ZERO(&input);
3224 +      FD_SET(device_fd, &input);
3225  
3226 -      for (;;)
3227 +#ifdef __hpux
3228 +      if (select(device_fd + 1, (int *)&input, NULL, NULL, &timeout) > 0)
3229 +#else
3230 +      if (select(device_fd + 1, &input, NULL, NULL, &timeout) > 0)
3231 +#endif /* __hpux */
3232        {
3233         /*
3234 -       * Wait a maximum of 90 seconds for backchannel data or a closed
3235 -       * connection...
3236 +       * Grab the data coming back and spit it out to stderr...
3237         */
3238  
3239 -       timeout.tv_sec  = 90;
3240 -       timeout.tv_usec = 0;
3241 -
3242 -       FD_ZERO(&input);
3243 -       FD_SET(fd, &input);
3244 -
3245 -  #ifdef __hpux
3246 -       if (select(fd + 1, (int *)&input, NULL, NULL, &timeout) > 0)
3247 -  #else
3248 -       if (select(fd + 1, &input, NULL, NULL, &timeout) > 0)
3249 -  #endif /* __hpux */
3250 +       if ((bc_bytes = read(device_fd, resource, sizeof(resource))) > 0)
3251         {
3252 -        /*
3253 -         * Grab the data coming back and spit it out to stderr...
3254 -         */
3255 -
3256 -         if ((rbytes = recv(fd, resource, sizeof(resource), 0)) > 0)
3257 -         {
3258 -           fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
3259 -                   rbytes);
3260 -           cupsBackChannelWrite(resource, rbytes, 1.0);
3261 -         }
3262 -         else
3263 -           break;
3264 +         fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
3265 +                 (int)bc_bytes);
3266 +         cupsBackChannelWrite(resource, bc_bytes, 1.0);
3267         }
3268         else
3269           break;
3270        }
3271 +      else
3272 +       break;
3273      }
3274 +  }
3275  
3276 -   /*
3277 -    * Close the socket connection...
3278 -    */
3279 + /*
3280 +  * Close the socket connection...
3281 +  */
3282  
3283 -    close(fd);
3284 -  }
3285 +  close(device_fd);
3286  
3287    httpAddrFreeList(addrlist);
3288  
3289 @@ -481,16 +376,16 @@
3290    * Close the input file and return...
3291    */
3292  
3293 -  if (fp != 0)
3294 -    close(fp);
3295 +  if (print_fd != 0)
3296 +    close(print_fd);
3297  
3298 -  if (wbytes >= 0)
3299 +  if (tbytes >= 0)
3300      fputs("INFO: Ready to print.\n", stderr);
3301  
3302 -  return (wbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
3303 +  return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
3304  }
3305  
3306  
3307  /*
3308 - * End of "$Id$".
3309 + * End of "$Id$".
3310   */
3311 diff -durN release-1.2.1/backend/test1284.c cups-1.2.x/backend/test1284.c
3312 --- release-1.2.1/backend/test1284.c    2006-07-04 17:32:11.000000000 +0100
3313 +++ cups-1.2.x/backend/test1284.c       2006-06-26 12:42:40.000000000 +0100
3314 @@ -1,5 +1,5 @@
3315  /*
3316 - * "$Id$"
3317 + * "$Id$"
3318   *
3319   *   IEEE-1284 support functions test program for the Common UNIX Printing
3320   *   System (CUPS).
3321 @@ -41,6 +41,7 @@
3322  #  include <unistd.h>
3323  #  include <fcntl.h>
3324  #endif /* WIN32 */
3325 +
3326  #define DEBUG
3327  #include "ieee1284.c"
3328  
3329 @@ -76,8 +77,8 @@
3330  
3331      printf("%s:\n", argv[i]);
3332  
3333 -    get_device_id(fd, device_id, sizeof(device_id), make_model,
3334 -                  sizeof(make_model), "test", uri, sizeof(uri));
3335 +    backendGetDeviceID(fd, device_id, sizeof(device_id), make_model,
3336 +                       sizeof(make_model), "test", uri, sizeof(uri));
3337  
3338      printf("    device_id=\"%s\"\n", device_id);
3339      printf("    make_model=\"%s\"\n", make_model);
3340 @@ -91,5 +92,5 @@
3341  
3342  
3343  /*
3344 - * End of "$Id$".
3345 + * End of "$Id$".
3346   */
3347 diff -durN release-1.2.1/backend/usb.c cups-1.2.x/backend/usb.c
3348 --- release-1.2.1/backend/usb.c 2006-07-04 17:32:11.000000000 +0100
3349 +++ cups-1.2.x/backend/usb.c    2006-06-26 12:42:40.000000000 +0100
3350 @@ -1,5 +1,5 @@
3351  /*
3352 - * "$Id$"
3353 + * "$Id$"
3354   *
3355   *   USB port backend for the Common UNIX Printing System (CUPS).
3356   *
3357 @@ -63,7 +63,7 @@
3358  void   list_devices(void);
3359  int    print_device(const char *uri, const char *hostname,
3360                      const char *resource, const char *options,
3361 -                    int fp, int copies, int argc, char *argv[]);
3362 +                    int print_fd, int copies, int argc, char *argv[]);
3363  
3364  
3365  /*
3366 @@ -108,7 +108,7 @@
3367               const char *hostname,     /* I - Hostname/manufacturer */
3368               const char *resource,     /* I - Resource/modelname */
3369              const char *options,       /* I - Device options/serial number */
3370 -            int        fp,             /* I - File descriptor to print */
3371 +            int        print_fd,       /* I - File descriptor to print */
3372              int        copies,         /* I - Copies to print */
3373              int        argc,           /* I - Number of command-line arguments (6 or 7) */
3374              char       *argv[])        /* I - Command-line arguments */
3375 @@ -124,7 +124,7 @@
3376    (void)hostname;
3377    (void)resource;
3378    (void)options;
3379 -  (void)fp;
3380 +  (void)print_fd;
3381    (void)copies;
3382    (void)argc;
3383    (void)argv;
3384 @@ -146,7 +146,7 @@
3385  main(int  argc,                                /* I - Number of command-line arguments (6 or 7) */
3386       char *argv[])                     /* I - Command-line arguments */
3387  {
3388 -  int          fp;                     /* Print file */
3389 +  int          print_fd;               /* Print file */
3390    int          copies;                 /* Number of copies to print */
3391    int          status;                 /* Exit status */
3392    int          port;                   /* Port number (not used) */
3393 @@ -232,8 +232,8 @@
3394  
3395    if (argc == 6)
3396    {
3397 -    fp     = 0;
3398 -    copies = 1;
3399 +    print_fd = 0;
3400 +    copies   = 1;
3401    }
3402    else
3403    {
3404 @@ -241,7 +241,7 @@
3405      * Try to open the print file...
3406      */
3407  
3408 -    if ((fp = open(argv[6], O_RDONLY)) < 0)
3409 +    if ((print_fd = open(argv[6], O_RDONLY)) < 0)
3410      {
3411        fprintf(stderr, "ERROR: unable to open print file %s - %s\n",
3412                argv[6], strerror(errno));
3413 @@ -255,19 +255,20 @@
3414    * Finally, send the print file...
3415    */
3416  
3417 -  status = print_device(uri, hostname, resource, options, fp, copies, argc, argv);
3418 +  status = print_device(uri, hostname, resource, options, print_fd, copies,
3419 +                        argc, argv);
3420  
3421   /*
3422    * Close the input file and return...
3423    */
3424  
3425 -  if (fp != 0)
3426 -    close(fp);
3427 +  if (print_fd != 0)
3428 +    close(print_fd);
3429  
3430    return (status);
3431  }
3432  
3433  
3434  /*
3435 - * End of "$Id$".
3436 + * End of "$Id$".
3437   */
3438 diff -durN release-1.2.1/backend/usb-darwin.c cups-1.2.x/backend/usb-darwin.c
3439 --- release-1.2.1/backend/usb-darwin.c  2006-07-04 17:32:11.000000000 +0100
3440 +++ cups-1.2.x/backend/usb-darwin.c     2006-06-26 12:42:40.000000000 +0100
3441 @@ -1,5 +1,5 @@
3442  /*
3443 - * "$Id$"
3444 + * "$Id$"
3445   *
3446   * Â© Copyright 2005-2006 Apple Computer, Inc. All rights reserved.
3447   *
3448 @@ -1310,7 +1310,7 @@
3449       */
3450      start = mach_absolute_time();
3451  
3452 -    rbytes = sizeof(readbuffer) - 1;
3453 +    rbytes = sizeof(readbuffer);
3454      readstatus = (*classdriver)->ReadPipe( classdriver, readbuffer, &rbytes );
3455      if ( kIOReturnSuccess == readstatus && rbytes > 0 ) {
3456  
3457 @@ -1346,5 +1346,5 @@
3458  
3459  
3460  /*
3461 - * End of "$Id$".
3462 + * End of "$Id$".
3463   */
3464 diff -durN release-1.2.1/backend/usb-unix.c cups-1.2.x/backend/usb-unix.c
3465 --- release-1.2.1/backend/usb-unix.c    2006-07-04 17:32:11.000000000 +0100
3466 +++ cups-1.2.x/backend/usb-unix.c       2006-06-26 12:42:40.000000000 +0100
3467 @@ -1,5 +1,5 @@
3468  /*
3469 - * "$Id$"
3470 + * "$Id$"
3471   *
3472   *   USB port backend for the Common UNIX Printing System (CUPS).
3473   *
3474 @@ -27,8 +27,9 @@
3475   *
3476   * Contents:
3477   *
3478 - *   main()         - Send a file to the specified USB port.
3479 + *   print_device() - Print a file to a USB device.
3480   *   list_devices() - List all USB devices.
3481 + *   open_device()  - Open a USB device...
3482   */
3483  
3484  /*
3485 @@ -55,30 +56,20 @@
3486               const char *hostname,     /* I - Hostname/manufacturer */
3487               const char *resource,     /* I - Resource/modelname */
3488              const char *options,       /* I - Device options/serial number */
3489 -            int        fp,             /* I - File descriptor to print */
3490 +            int        print_fd,       /* I - File descriptor to print */
3491              int        copies,         /* I - Copies to print */
3492              int        argc,           /* I - Number of command-line arguments (6 or 7) */
3493              char       *argv[])        /* I - Command-line arguments */
3494  {
3495 -  int          usebc;                  /* Use backchannel path? */
3496 -  int          fd;                     /* USB device */
3497 -  int          rbytes;                 /* Number of bytes read */
3498 -  int          wbytes;                 /* Number of bytes written */
3499 -  size_t       nbytes,                 /* Number of bytes read */
3500 -               tbytes;                 /* Total number of bytes written */
3501 -  char         buffer[8192],           /* Output buffer */
3502 -               *bufptr,                /* Pointer into buffer */
3503 -               backbuf[1024];          /* Backchannel buffer */
3504 +  int          use_bc;                 /* Use backchannel path? */
3505 +  int          device_fd;              /* USB device */
3506 +  size_t       tbytes;                 /* Total number of bytes written */
3507    struct termios opts;                 /* Parallel port options */
3508 -  fd_set       input,                  /* Input set for select() */
3509 -               output;                 /* Output set for select() */
3510 -  int          paperout;               /* Paper out? */
3511 -#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
3512 -  struct sigaction action;             /* Actions for POSIX signals */
3513 -#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
3514 -#ifdef __linux
3515 +#if defined(__linux) && defined(LP_POUTPA)
3516    unsigned int status;                 /* Port status (off-line, out-of-paper, etc.) */
3517 -#endif /* __linux */
3518 +  int          paperout;               /* Paper out? */
3519 +#endif /* __linux && LP_POUTPA */
3520 +
3521  
3522    (void)argc;
3523    (void)argv;
3524 @@ -89,7 +80,7 @@
3525    * when they get a read request...
3526    */
3527  
3528 -  usebc = strcasecmp(hostname, "Canon") != 0;
3529 +  use_bc = strcasecmp(hostname, "Canon") != 0;
3530  
3531   /*
3532    * Open the USB port device...
3533 @@ -99,7 +90,7 @@
3534  
3535    do
3536    {
3537 -    if ((fd = open_device(uri)) == -1)
3538 +    if ((device_fd = open_device(uri)) == -1)
3539      {
3540        if (getenv("CLASS") != NULL)
3541        {
3542 @@ -127,7 +118,8 @@
3543          fputs("INFO: USB port busy; will retry in 30 seconds...\n", stderr);
3544         sleep(30);
3545        }
3546 -      else if (errno == ENXIO || errno == EIO || errno == ENOENT || errno == ENODEV)
3547 +      else if (errno == ENXIO || errno == EIO || errno == ENOENT ||
3548 +               errno == ENODEV)
3549        {
3550          fputs("INFO: Printer not connected; will retry in 30 seconds...\n", stderr);
3551         sleep(30);
3552 @@ -140,7 +132,7 @@
3553        }
3554      }
3555    }
3556 -  while (fd < 0);
3557 +  while (device_fd < 0);
3558  
3559    fputs("STATE: -connecting-to-device\n", stderr);
3560  
3561 @@ -148,28 +140,25 @@
3562    * Set any options provided...
3563    */
3564  
3565 -  tcgetattr(fd, &opts);
3566 +  tcgetattr(device_fd, &opts);
3567  
3568    opts.c_lflag &= ~(ICANON | ECHO | ISIG);     /* Raw mode */
3569  
3570    /**** No options supported yet ****/
3571  
3572 -  tcsetattr(fd, TCSANOW, &opts);
3573 -
3574 - /*
3575 -  * Check printer status...
3576 -  */
3577 -
3578 -  paperout = 0;
3579 +  tcsetattr(device_fd, TCSANOW, &opts);
3580  
3581  #if defined(__linux) && defined(LP_POUTPA)
3582   /*
3583    * Show the printer status before we send the file...
3584    */
3585  
3586 -  while (!ioctl(fd, LPGETSTATUS, &status))
3587 +  paperout = 0;
3588 +
3589 +  while (!ioctl(device_fd, LPGETSTATUS, &status))
3590    {
3591 -    fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n", status);
3592 +    fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n",
3593 +            status);
3594  
3595      if (status & LP_POUTPA)
3596      {
3597 @@ -191,146 +180,35 @@
3598  #endif /* __linux && LP_POUTPA */
3599  
3600   /*
3601 -  * Now that we are "connected" to the port, ignore SIGTERM so that we
3602 -  * can finish out any page data the driver sends (e.g. to eject the
3603 -  * current page...  Only ignore SIGTERM if we are printing data from
3604 -  * stdin (otherwise you can't cancel raw jobs...)
3605 -  */
3606 -
3607 -  if (!fp)
3608 -  {
3609 -#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
3610 -    sigset(SIGTERM, SIG_IGN);
3611 -#elif defined(HAVE_SIGACTION)
3612 -    memset(&action, 0, sizeof(action));
3613 -
3614 -    sigemptyset(&action.sa_mask);
3615 -    action.sa_handler = SIG_IGN;
3616 -    sigaction(SIGTERM, &action, NULL);
3617 -#else
3618 -    signal(SIGTERM, SIG_IGN);
3619 -#endif /* HAVE_SIGSET */
3620 -  }
3621 -
3622 - /*
3623    * Finally, send the print file...
3624    */
3625  
3626 -  wbytes = 0;
3627 +  tbytes = 0;
3628  
3629 -  while (copies > 0)
3630 +  while (copies > 0 && tbytes >= 0)
3631    {
3632      copies --;
3633  
3634 -    if (fp != 0)
3635 +    if (print_fd != 0)
3636      {
3637        fputs("PAGE: 1 1\n", stderr);
3638 -      lseek(fp, 0, SEEK_SET);
3639 +      lseek(print_fd, 0, SEEK_SET);
3640      }
3641  
3642 -    tbytes = 0;
3643 -    while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
3644 -    {
3645 -     /*
3646 -      * Write the print data to the printer...
3647 -      */
3648 -
3649 -      tbytes += nbytes;
3650 -      bufptr = buffer;
3651 -
3652 -      while (nbytes > 0)
3653 -      {
3654 -       /*
3655 -        * See if we are ready to read or write...
3656 -       */
3657 -
3658 -        do
3659 -       {
3660 -          FD_ZERO(&input);
3661 -         if (usebc)
3662 -           FD_SET(fd, &input);
3663 -
3664 -         FD_ZERO(&output);
3665 -         FD_SET(fd, &output);
3666 -        }
3667 -       while (select(fd + 1, &input, &output, NULL, NULL) < 0);
3668 -
3669 -        if (FD_ISSET(fd, &input))
3670 -       {
3671 -        /*
3672 -         * Read backchannel data...
3673 -         */
3674 -
3675 -         if ((rbytes = read(fd, backbuf, sizeof(backbuf))) > 0)
3676 -         {
3677 -           fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
3678 -                   rbytes);
3679 -            cupsBackChannelWrite(backbuf, rbytes, 1.0);
3680 -          }
3681 -       }
3682 -
3683 -        if (FD_ISSET(fd, &output))
3684 -       {
3685 -        /*
3686 -         * Write print data...
3687 -         */
3688 -
3689 -         if ((wbytes = write(fd, bufptr, nbytes)) < 0)
3690 -           if (errno == ENOTTY)
3691 -             wbytes = write(fd, bufptr, nbytes);
3692 -
3693 -         if (wbytes < 0)
3694 -         {
3695 -          /*
3696 -           * Check for retryable errors...
3697 -           */
3698 -
3699 -           if (errno == ENOSPC)
3700 -           {
3701 -             paperout = 1;
3702 -             fputs("ERROR: Out of paper!\n", stderr);
3703 -             fputs("STATUS: +media-tray-empty-error\n", stderr);
3704 -           }
3705 -           else if (errno != EAGAIN && errno != EINTR)
3706 -           {
3707 -             perror("ERROR: Unable to send print file to printer");
3708 -             break;
3709 -           }
3710 -         }
3711 -         else
3712 -         {
3713 -          /*
3714 -           * Update count and pointer...
3715 -           */
3716 -
3717 -            if (paperout)
3718 -           {
3719 -             fputs("STATUS: -media-tray-empty-error\n", stderr);
3720 -             paperout = 0;
3721 -           }
3722 -
3723 -           nbytes -= wbytes;
3724 -           bufptr += wbytes;
3725 -         }
3726 -       }
3727 -      }
3728 -
3729 -      if (wbytes < 0)
3730 -        break;
3731 +    tbytes = backendRunLoop(print_fd, device_fd, 1);
3732  
3733 -      if (fp)
3734 -       fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
3735 -               (unsigned long)tbytes);
3736 -    }
3737 +    if (print_fd != 0 && tbytes >= 0)
3738 +      fprintf(stderr, "INFO: Sent print file, " CUPS_LLFMT " bytes...\n",
3739 +             CUPS_LLCAST tbytes);
3740    }
3741  
3742   /*
3743    * Close the USB port and return...
3744    */
3745  
3746 -  close(fd);
3747 +  close(device_fd);
3748  
3749 -  return (wbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
3750 +  return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
3751  }
3752  
3753  
3754 @@ -372,9 +250,9 @@
3755  
3756      if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
3757      {
3758 -      if (!get_device_id(fd, device_id, sizeof(device_id),
3759 -                         make_model, sizeof(make_model),
3760 -                        "usb", device_uri, sizeof(device_uri)))
3761 +      if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
3762 +                              make_model, sizeof(make_model),
3763 +                             "usb", device_uri, sizeof(device_uri)))
3764         printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
3765                make_model, make_model, i + 1, device_id);
3766  
3767 @@ -401,9 +279,9 @@
3768  
3769      if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
3770      {
3771 -      if (!get_device_id(fd, device_id, sizeof(device_id),
3772 -                         make_model, sizeof(make_model),
3773 -                        "usb", device_uri, sizeof(device_uri)))
3774 +      if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
3775 +                              make_model, sizeof(make_model),
3776 +                             "usb", device_uri, sizeof(device_uri)))
3777         printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
3778                make_model, make_model, i + 1, device_id);
3779  
3780 @@ -446,7 +324,14 @@
3781  
3782    if (!strncmp(uri, "usb:/dev/", 9))
3783  #ifdef __linux
3784 -    return (-1); /* Do not allow direct devices anymore */
3785 +  {
3786 +   /*
3787 +    * Do not allow direct devices anymore...
3788 +    */
3789 +
3790 +    errno = ENODEV;
3791 +    return (-1);
3792 +  }
3793    else if (!strncmp(uri, "usb://", 6))
3794    {
3795     /*
3796 @@ -486,9 +371,9 @@
3797  
3798         if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
3799         {
3800 -         get_device_id(fd, device_id, sizeof(device_id),
3801 -                        make_model, sizeof(make_model),
3802 -                       "usb", device_uri, sizeof(device_uri));
3803 +         backendGetDeviceID(fd, device_id, sizeof(device_id),
3804 +                             make_model, sizeof(make_model),
3805 +                            "usb", device_uri, sizeof(device_uri));
3806         }
3807         else
3808         {
3809 @@ -545,7 +430,14 @@
3810      return (-1);
3811    }
3812  #elif defined(__sun) && defined(ECPPIOC_GETDEVID)
3813 -    return (-1); /* Do not allow direct devices anymore */
3814 +  {
3815 +   /*
3816 +    * Do not allow direct devices anymore...
3817 +    */
3818 +
3819 +    errno = ENODEV;
3820 +    return (-1);
3821 +  }
3822    else if (!strncmp(uri, "usb://", 6))
3823    {
3824     /*
3825 @@ -572,9 +464,9 @@
3826         sprintf(device, "/dev/usb/printer%d", i);
3827  
3828         if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
3829 -         get_device_id(fd, device_id, sizeof(device_id),
3830 -                        make_model, sizeof(make_model),
3831 -                       "usb", device_uri, sizeof(device_uri));
3832 +         backendGetDeviceID(fd, device_id, sizeof(device_id),
3833 +                             make_model, sizeof(make_model),
3834 +                            "usb", device_uri, sizeof(device_uri));
3835         else
3836         {
3837          /*
3838 @@ -633,5 +525,5 @@
3839  
3840  
3841  /*
3842 - * End of "$Id$".
3843 + * End of "$Id$".
3844   */
3845 diff -durN release-1.2.1/berkeley/lpq.c cups-1.2.x/berkeley/lpq.c
3846 --- release-1.2.1/berkeley/lpq.c        2006-07-04 17:32:18.000000000 +0100
3847 +++ cups-1.2.x/berkeley/lpq.c   2006-06-26 12:42:47.000000000 +0100
3848 @@ -1,5 +1,5 @@
3849  /*
3850 - * "$Id$"
3851 + * "$Id$"
3852   *
3853   *   "lpq" command for the Common UNIX Printing System (CUPS).
3854   *
3855 @@ -79,8 +79,6 @@
3856    cups_lang_t  *language;              /* Language */
3857  
3858  
3859 -
3860 -
3861   /*
3862    * Check for command-line options...
3863    */
3864 @@ -677,5 +675,5 @@
3865  
3866  
3867  /*
3868 - * End of "$Id$".
3869 + * End of "$Id$".
3870   */
3871 diff -durN release-1.2.1/berkeley/lprm.c cups-1.2.x/berkeley/lprm.c
3872 --- release-1.2.1/berkeley/lprm.c       2006-07-04 17:32:18.000000000 +0100
3873 +++ cups-1.2.x/berkeley/lprm.c  2006-06-28 09:59:03.000000000 +0100
3874 @@ -1,5 +1,5 @@
3875  /*
3876 - * "$Id$"
3877 + * "$Id$"
3878   *
3879   *   "lprm" command for the Common UNIX Printing System (CUPS).
3880   *
3881 @@ -57,7 +57,8 @@
3882    ipp_op_t     op;             /* Operation */
3883    cups_lang_t  *language;      /* Language */
3884    int          num_dests;      /* Number of destinations */
3885 -  cups_dest_t  *dests;         /* Destinations */
3886 +  cups_dest_t  *dests,         /* Destinations */
3887 +               *defdest;       /* Default destination */
3888    http_encryption_t encryption;        /* Encryption? */
3889  
3890  
3891 @@ -72,11 +73,6 @@
3892    http       = NULL;
3893    encryption = cupsEncryption();
3894    language   = cupsLangDefault();
3895 -  num_dests  = cupsGetDests(&dests);
3896 -
3897 -  for (i = 0; i < num_dests; i ++)
3898 -    if (dests[i].is_default)
3899 -      dest = dests[i].name;
3900  
3901   /*
3902    * Open a connection to the server...
3903 @@ -89,6 +85,10 @@
3904      return (1);
3905    }
3906  
3907 +  num_dests  = cupsGetDests2(http, &dests);
3908 +  defdest    = cupsGetDest(NULL, NULL, num_dests, dests);
3909 +  dest       = defdest ? defdest->name : NULL;
3910 +
3911   /*
3912    * Process command-line arguments...
3913    */
3914 @@ -102,6 +102,7 @@
3915             encryption = HTTP_ENCRYPT_REQUIRED;
3916  
3917             httpEncryption(http, encryption);
3918 +           cupsSetEncryption(encryption);
3919  #else
3920              _cupsLangPrintf(stderr,
3921                             _("%s: Sorry, no encryption support compiled in!\n"),
3922 @@ -152,9 +153,6 @@
3923             break;
3924             
3925          case 'h' : /* Connect to host */
3926 -           if (http != NULL)
3927 -             httpClose(http);
3928 -
3929             if (argv[i][2] != '\0')
3930                cupsSetServer(argv[i] + 2);
3931             else
3932 @@ -172,6 +170,21 @@
3933               else
3934                  cupsSetServer(argv[i]);
3935             }
3936 +
3937 +            httpClose(http);
3938 +            cupsFreeDests(num_dests, dests);
3939 +
3940 +           if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
3941 +                                          encryption)) == NULL)
3942 +           {
3943 +             _cupsLangPuts(stderr, _("lprm: Unable to contact server!\n"));
3944 +             cupsFreeDests(num_dests, dests);
3945 +             return (1);
3946 +           }
3947 +
3948 +           num_dests  = cupsGetDests2(http, &dests);
3949 +           defdest    = cupsGetDest(NULL, NULL, num_dests, dests);
3950 +           dest       = defdest ? defdest->name : NULL;
3951             break;
3952  
3953         default :
3954 @@ -283,5 +296,5 @@
3955  
3956  
3957  /*
3958 - * End of "$Id$".
3959 + * End of "$Id$".
3960   */
3961 diff -durN release-1.2.1/cgi-bin/help-index.c cups-1.2.x/cgi-bin/help-index.c
3962 --- release-1.2.1/cgi-bin/help-index.c  2006-07-04 17:35:24.000000000 +0100
3963 +++ cups-1.2.x/cgi-bin/help-index.c     2006-06-26 12:45:33.000000000 +0100
3964 @@ -1,5 +1,5 @@
3965  /*
3966 - * "$Id$"
3967 + * "$Id$"
3968   *
3969   *   On-line help index routines for the Common UNIX Printing System (CUPS).
3970   *
3971 @@ -842,7 +842,7 @@
3972         if (isspace(*ptr & 255))
3973         {
3974           while (isspace(*ptr & 255))
3975 -           *ptr ++;
3976 +           ptr ++;
3977  
3978           *text++ = ' ';
3979          }
3980 @@ -979,5 +979,5 @@
3981  
3982  
3983  /*
3984 - * End of "$Id$".
3985 + * End of "$Id$".
3986   */
3987 diff -durN release-1.2.1/CHANGES.txt cups-1.2.x/CHANGES.txt
3988 --- release-1.2.1/CHANGES.txt   2006-07-04 17:35:29.000000000 +0100
3989 +++ cups-1.2.x/CHANGES.txt      2006-06-28 09:59:05.000000000 +0100
3990 @@ -1,8 +1,102 @@
3991 -CHANGES.txt - 2006-05-22
3992 +CHANGES.txt - 2006-06-26
3993  ------------------------
3994  
3995 +CHANGES IN CUPS V1.2.2
3996 +
3997 +       - The scheduler used up the CPU if BrowseRemoteProtocols
3998 +         was empty (STR #1792)
3999 +       - Custom page sizes did not work (STR #1787)
4000 +       - The SNMP backend could crash on some systems when SNMP
4001 +         logging was enabled (STR #1789)
4002 +       - Browsing could produce some funny printer names when
4003 +         ServerName was set to an IP address (STR #1799)
4004 +       - Fixed the log message for BrowseRelay (STR #1798)
4005 +       - Fixes to allow CUPS to compile on MirBSD (STR #1796)
4006 +       - The scheduler incorrectly set the FINAL_CONTENT_TYPE
4007 +         environment variable (STR #1795)
4008 +       - The pdftops filter incorrectly embedded a "produced by"
4009 +         comment, causing PDF printing not to work on some
4010 +         operating systems (STR #1801)
4011 +       - Sending raw jobs from a client system could cause the
4012 +         client's scheduler to eventually crash (STR #1786)
4013 +       - The scheduler now checks that the notifier exists prior
4014 +         to accepting a new subscription request.
4015 +       - The scheduler now reports the supported
4016 +         notify-recipient schemes based on the contents of the
4017 +         ServerBin/notifier directory.
4018 +       - Event notifications did not include the
4019 +         notify-sequence-number or other required attributes
4020 +         (STR #1747)
4021 +       - Allow/Deny addresses of the form "11.22.33.*" did not
4022 +         work on Linux (STR #1769)
4023 +       - cupsGetPPD() did not work if the scheduler was only
4024 +         listening on a domain socket (STR #1766)
4025 +       - The scheduler could crash advertising a class (STR
4026 +         #1768)
4027 +       - The scheduler could crash if the default printer was
4028 +         deleted (STR #1776)
4029 +       - Added a new default CUPS raster format (v3) which does
4030 +         not compress the raster stream in order to provide the
4031 +         same cupsRasterReadPixels() and cupsRasterWritePixels()
4032 +         performance as CUPS 1.1.x.
4033 +       - The cupsaddsmb man page listed the wrong files for the
4034 +         CUPS driver.
4035 +       - Some configure --with options did not work (STR #1746)
4036 +       - "Allow @IF(name)" didn't work if "name" wasn't the
4037 +         first network interface (STR #1758)
4038 +       - The lpstat command did not use the correct character
4039 +         set when reporting the date and time (STR #1751)
4040 +       - The cupsaddsmb command and web interface did not update
4041 +         the Windows PPD files properly, resulting in corrupt
4042 +         PPD files for the Windows client to use (STR #1750)
4043 +       - The cupsd.conf man page didn't describe the Listen
4044 +         domain socket syntax (STR #1753)
4045 +       - The scheduler no longer tries to support more than
4046 +         FD_SETSIZE file descriptors.
4047 +       - CDSA (encryption) support fixes for MacOS X.
4048 +       - The lppasswd program needs to be setuid to root to
4049 +         create and update the /etc/cups/passwd.md5 file (STR
4050 +         #1735)
4051 +       - 32/64-bit library installation was broken (STR #1741)
4052 +       - The USB backend now reports a "no such device" error
4053 +         when using the old filename-based USB URIs instead of
4054 +         the "success" error.
4055 +       - Increased the HTTP and IPP read timeouts to 10 seconds,
4056 +         as 1 second was too short on congested networks (STR
4057 +         #1719)
4058 +       - The SNMP backend now uses the device description over
4059 +         the printer-make-and-model attribute when the attribute
4060 +         contains a generic name (STR #1728)
4061 +       - Fixed another file descriptor leak when printing raw
4062 +         files (STR #1736)
4063 +       - Raw queues were not shared via LDAP (STR #1739)
4064 +       - The pstops filter didn't always embed PageSetup
4065 +         commands from the PPD file (STR #1740)
4066 +       - "make install" didn't work if you disabled all of the
4067 +         localizations.
4068 +       - The scheduler didn't always choose the least costly
4069 +         filter.
4070 +       - Fixed parsing of IPv6 addresses in Allow, Deny,
4071 +         BrowseAllow, BrowseDeny, and BrowseRelay directives
4072 +         (STR #1713)
4073 +       - Printers that were shared via LDAP did not get added to
4074 +         the LDAP server properly (STR #1733)
4075 +       - LDAP browsing would crash the scheduler if a required
4076 +         value was missing (STR #1731)
4077 +       - Special cases for the "localhost" hostname did not
4078 +         work, causing printing to not work when the /etc/hosts
4079 +         file did not contain a localhost entry (STR #1723)
4080 +       - Updated the Spanish translation (STR #1720, STR #1770)
4081 +       - Reverse-order page output was broken when N-up or
4082 +         landscape orientations were used (STR #1725)
4083 +       - The parallel, serial, socket, and USB backends needed
4084 +         print data before they would report back-channel data,
4085 +         causing problems with several new drivers (STR #1724)
4086 +
4087 +
4088  CHANGES IN CUPS V1.2.1
4089  
4090 +       - "lprm -h hostname" did not work (STR #1800)
4091         - The web interface did not handle reloads properly for
4092           MSIE (STR #1716)
4093         - The configure script no longer adds linker rpath
4094 diff -durN release-1.2.1/config.h.in cups-1.2.x/config.h.in
4095 --- release-1.2.1/config.h.in   2006-07-04 17:35:29.000000000 +0100
4096 +++ cups-1.2.x/config.h.in      2006-06-26 12:45:38.000000000 +0100
4097 @@ -1,5 +1,5 @@
4098  /*
4099 - * "$Id$"
4100 + * "$Id$"
4101   *
4102   *   Configuration file for the Common UNIX Printing System (CUPS).
4103   *
4104 @@ -261,6 +261,13 @@
4105  
4106  
4107  /*
4108 + * Do we have <Security/SecBasePriv.h>?
4109 + */
4110 +
4111 +#undef HAVE_SECBASEPRIV_H
4112 +
4113 +
4114 +/*
4115   * Do we have the SLP library?
4116   */
4117  
4118 @@ -439,5 +446,5 @@
4119  #endif /* !_CUPS_CONFIG_H_ */
4120  
4121  /*
4122 - * End of "$Id$".
4123 + * End of "$Id$".
4124   */
4125 diff -durN release-1.2.1/config-scripts/cups-compiler.m4 cups-1.2.x/config-scripts/cups-compiler.m4
4126 --- release-1.2.1/config-scripts/cups-compiler.m4       2006-07-04 17:32:16.000000000 +0100
4127 +++ cups-1.2.x/config-scripts/cups-compiler.m4  2006-07-04 17:28:24.000000000 +0100
4128 @@ -1,5 +1,5 @@
4129  dnl
4130 -dnl "$Id$"
4131 +dnl "$Id$"
4132  dnl
4133  dnl   Compiler stuff for the Common UNIX Printing System (CUPS).
4134  dnl
4135 @@ -24,22 +24,31 @@
4136  
4137  dnl Clear the debugging and non-shared library options unless the user asks
4138  dnl for them...
4139 -ARCHFLAGS=""
4140  OPTIM=""
4141 -AC_SUBST(ARCHFLAGS)
4142  AC_SUBST(OPTIM)
4143  
4144  AC_ARG_WITH(optim, [  --with-optim="flags"    set optimization flags ])
4145 -AC_ARG_WITH(archflags, [  --with-arch="flags"     set default architecture flags ])
4146 -
4147  AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging, default=no],
4148         [if test x$enable_debug = xyes; then
4149                 OPTIM="-g"
4150         fi])
4151  
4152 +dnl Setup general architecture flags...
4153 +AC_ARG_WITH(archflags, [  --with-archflags="flags"
4154 +                          set default architecture flags ])
4155 +
4156 +if test -z "$with_archflags"; then
4157 +       ARCHFLAGS=""
4158 +else
4159 +       ARCHFLAGS="$with_archflags"
4160 +fi
4161 +
4162 +AC_SUBST(ARCHFLAGS)
4163 +
4164  dnl Setup support for separate 32/64-bit library generation...
4165  AC_ARG_ENABLE(32bit, [  --enable-32bit          generate 32-bit libraries on 32/64-bit systems, default=no])
4166 -AC_ARG_WITH(arch32flags, [  --with-arch32="flags"   specifies 32-bit architecture flags])
4167 +AC_ARG_WITH(arch32flags, [  --with-arch32flags="flags"
4168 +                          specifies 32-bit architecture flags])
4169  
4170  ARCH32FLAGS=""
4171  INSTALL32=""
4172 @@ -56,7 +65,8 @@
4173  AC_SUBST(UNINSTALL32)
4174  
4175  AC_ARG_ENABLE(64bit, [  --enable-64bit          generate 64-bit libraries on 32/64-bit systems, default=no])
4176 -AC_ARG_WITH(arch64flags, [  --with-arch64="flags"   specifies 64-bit architecture flags])
4177 +AC_ARG_WITH(arch64flags, [  --with-arch64flags="flags"
4178 +                          specifies 64-bit architecture flags])
4179  
4180  ARCH64FLAGS=""
4181  INSTALL64=""
4182 @@ -118,17 +128,6 @@
4183         fi
4184  
4185         case "$uname" in
4186 -               Darwin*)
4187 -                       if test -z "$with_archflags"; then
4188 -                               if test "x`uname -m`" = xi386; then
4189 -                                       # Build universal binaries for OSX on Intel...
4190 -                                       ARCHFLAGS="-arch i386 -arch ppc"
4191 -                               fi
4192 -                       else
4193 -                               ARCHFLAGS="$with_archflags"
4194 -                       fi
4195 -                       ;;
4196 -
4197                 IRIX)
4198                         if test "x$enable_32bit" = xyes; then
4199                                 # Build 32-bit libraries, 64-bit base...
4200 @@ -149,8 +148,6 @@
4201                                         else
4202                                                 ARCHFLAGS="$with_arch64flags"
4203                                         fi
4204 -                               else
4205 -                                       ARCHFLAGS="$with_archflags"
4206                                 fi
4207                         fi
4208  
4209 @@ -173,8 +170,6 @@
4210                                         else
4211                                                 ARCHFLAGS="$with_arch32flags"
4212                                         fi
4213 -                               else
4214 -                                       ARCHFLAGS="$with_archflags"
4215                                 fi
4216                         fi
4217                         ;;
4218 @@ -202,8 +197,6 @@
4219                                         else
4220                                                 ARCHFLAGS="$with_arch64flags"
4221                                         fi
4222 -                               else
4223 -                                       ARCHFLAGS="$with_archflags"
4224                                 fi
4225                         fi
4226  
4227 @@ -229,8 +222,6 @@
4228                                         else
4229                                                 ARCHFLAGS="$with_arch32flags"
4230                                         fi
4231 -                               else
4232 -                                       ARCHFLAGS="$with_archflags"
4233                                 fi
4234                         fi
4235                         ;;
4236 @@ -255,8 +246,6 @@
4237                                         else
4238                                                 ARCHFLAGS="$with_arch64flags"
4239                                         fi
4240 -                               else
4241 -                                       ARCHFLAGS="$with_archflags"
4242                                 fi
4243                         fi
4244  
4245 @@ -279,8 +268,6 @@
4246                                         else
4247                                                 ARCHFLAGS="$with_arch32flags"
4248                                         fi
4249 -                               else
4250 -                                       ARCHFLAGS="$with_archflags"
4251                                 fi
4252                         fi
4253                         ;;
4254 @@ -310,13 +297,6 @@
4255                         # Warning 829 is passing constant string as char *
4256                         CXXFLAGS="+W336,829 $CXXFLAGS"
4257  
4258 -                       if test -z "$with_archflags"; then
4259 -                               # Build portable binaries for all HP systems...
4260 -                               ARCHFLAGS="+DAportable"
4261 -                       else
4262 -                               ARCHFLAGS="$with_archflags"
4263 -                       fi
4264 -
4265                         if test $PICFLAG = 1; then
4266                                 OPTIM="+z $OPTIM"
4267                         fi
4268 @@ -353,8 +333,6 @@
4269                                         else
4270                                                 ARCHFLAGS="$with_arch64flags"
4271                                         fi
4272 -                               else
4273 -                                       ARCHFLAGS="$with_archflags"
4274                                 fi
4275                         fi
4276  
4277 @@ -377,8 +355,6 @@
4278                                         else
4279                                                 ARCHFLAGS="$with_arch32flags"
4280                                         fi
4281 -                               else
4282 -                                       ARCHFLAGS="$with_archflags"
4283                                 fi
4284                         fi
4285                         ;;
4286 @@ -386,7 +362,7 @@
4287                         # Solaris
4288                         if test -z "$OPTIM"; then
4289                                 if test "x$with_optim" = x; then
4290 -                                       OPTIM="-xO4"
4291 +                                       OPTIM="-xO2"
4292                                 else
4293                                         OPTIM="$with_optim $OPTIM"
4294                                 fi
4295 @@ -419,8 +395,6 @@
4296                                         else
4297                                                 ARCHFLAGS="$with_arch64flags"
4298                                         fi
4299 -                               else
4300 -                                       ARCHFLAGS="$with_archflags"
4301                                 fi
4302                         else
4303                                 if test "x$enable_64bit" = xyes; then
4304 @@ -446,8 +420,6 @@
4305                                         else
4306                                                 ARCHFLAGS="$with_arch32flags"
4307                                         fi
4308 -                               else
4309 -                                       ARCHFLAGS="$with_archflags"
4310                                 fi
4311                         fi
4312                         ;;
4313 @@ -488,5 +460,5 @@
4314  fi
4315  
4316  dnl
4317 -dnl End of "$Id$".
4318 +dnl End of "$Id$".
4319  dnl
4320 diff -durN release-1.2.1/config-scripts/cups-defaults.m4 cups-1.2.x/config-scripts/cups-defaults.m4
4321 --- release-1.2.1/config-scripts/cups-defaults.m4       2006-07-04 17:32:16.000000000 +0100
4322 +++ cups-1.2.x/config-scripts/cups-defaults.m4  2006-06-26 12:42:46.000000000 +0100
4323 @@ -1,5 +1,5 @@
4324  dnl
4325 -dnl "$Id$"
4326 +dnl "$Id$"
4327  dnl
4328  dnl   Default cupsd configuration settings for the Common UNIX Printing System
4329  dnl   (CUPS).
4330 @@ -30,7 +30,7 @@
4331  AC_SUBST(LANGUAGES)
4332  
4333  dnl Default ConfigFilePerm
4334 -AC_ARG_WITH(config_perm, [  --with-config-file-perm set default ConfigFilePerm value, default=0640],
4335 +AC_ARG_WITH(config_file_perm, [  --with-config-file-perm set default ConfigFilePerm value, default=0640],
4336         CUPS_CONFIG_FILE_PERM="$withval",
4337         if test "x$uname" = xDarwin; then
4338                 CUPS_CONFIG_FILE_PERM="644"
4339 @@ -41,7 +41,7 @@
4340  AC_DEFINE_UNQUOTED(CUPS_DEFAULT_CONFIG_FILE_PERM, 0$CUPS_CONFIG_FILE_PERM)
4341  
4342  dnl Default LogFilePerm
4343 -AC_ARG_WITH(log_perm, [  --with-log-file-perm    set default LogFilePerm value, default=0644],
4344 +AC_ARG_WITH(log_file_perm, [  --with-log-file-perm    set default LogFilePerm value, default=0644],
4345         CUPS_LOG_FILE_PERM="$withval",
4346         CUPS_LOG_FILE_PERM="644")
4347  AC_SUBST(CUPS_LOG_FILE_PERM)
4348 @@ -59,7 +59,7 @@
4349  AC_SUBST(CUPS_BROWSING)
4350  
4351  dnl Default BrowseLocalProtocols
4352 -AC_ARG_WITH(browse_local, [  --with-local-protocols  set default BrowseLocalProtocols, default="CUPS"],
4353 +AC_ARG_WITH(local_protocols, [  --with-local-protocols  set default BrowseLocalProtocols, default="CUPS"],
4354         CUPS_BROWSE_LOCAL_PROTOCOLS="$withval",
4355         CUPS_BROWSE_LOCAL_PROTOCOLS="CUPS")
4356  AC_SUBST(CUPS_BROWSE_LOCAL_PROTOCOLS)
4357 @@ -67,7 +67,7 @@
4358         "$CUPS_BROWSE_LOCAL_PROTOCOLS")
4359  
4360  dnl Default BrowseRemoteProtocols
4361 -AC_ARG_WITH(browse_remote, [  --with-remote-protocols set default BrowseRemoteProtocols, default="CUPS"],
4362 +AC_ARG_WITH(remote_protocols, [  --with-remote-protocols set default BrowseRemoteProtocols, default="CUPS"],
4363         CUPS_BROWSE_REMOTE_PROTOCOLS="$withval",
4364         CUPS_BROWSE_REMOTE_PROTOCOLS="CUPS")
4365  AC_SUBST(CUPS_BROWSE_REMOTE_PROTOCOLS)
4366 @@ -130,7 +130,7 @@
4367  AC_SUBST(CUPS_USE_NETWORK_DEFAULT)
4368  
4369  dnl Determine the correct username and group for this OS...
4370 -AC_ARG_WITH(cups-user, [  --with-cups-user        set default user for CUPS],
4371 +AC_ARG_WITH(cups_user, [  --with-cups-user        set default user for CUPS],
4372         CUPS_USER="$withval",
4373         AC_MSG_CHECKING(for default print user)
4374         if test -f /etc/passwd; then
4375 @@ -152,7 +152,7 @@
4376                 AC_MSG_RESULT(no password file, using "$CUPS_USER")
4377         fi)
4378  
4379 -AC_ARG_WITH(cups-group, [  --with-cups-group       set default group for CUPS],
4380 +AC_ARG_WITH(cups_group, [  --with-cups-group       set default group for CUPS],
4381         CUPS_GROUP="$withval",
4382         AC_MSG_CHECKING(for default print group)
4383         if test -f /etc/group; then
4384 @@ -175,7 +175,7 @@
4385                 AC_MSG_RESULT(no group file, using "$CUPS_GROUP")
4386         fi)
4387  
4388 -AC_ARG_WITH(system-groups, [  --with-system-groups    set default system groups for CUPS],
4389 +AC_ARG_WITH(system_groups, [  --with-system-groups    set default system groups for CUPS],
4390         CUPS_SYSTEM_GROUPS="$withval",
4391         if test x$uname = xDarwin; then
4392                 GROUP_LIST="admin"
4393 @@ -221,13 +221,25 @@
4394  dnl Default printcap file...
4395  AC_ARG_WITH(printcap, [  --with-printcap         set default printcap file],
4396         default_printcap="$withval",
4397 -       default_printcap="/etc/printcap")
4398 +       default_printcap="default")
4399  
4400  if test x$enable_printcap != xno -a x$default_printcap != xno; then
4401 -       if test "x$default_printcap" = "x/etc/printcap" -a "$uname" = "Darwin" -a $uversion -ge 90; then
4402 -               CUPS_DEFAULT_PRINTCAP=""
4403 -       else
4404 -               CUPS_DEFAULT_PRINTCAP="$default_printcap"
4405 +       if test "x$default_printcap" = "xdefault"; then
4406 +               case $uname in
4407 +                       Darwin*)
4408 +                               if test $uversion -ge 90; then
4409 +                                       CUPS_DEFAULT_PRINTCAP=""
4410 +                               else
4411 +                                       CUPS_DEFAULT_PRINTCAP="/etc/printcap"
4412 +                               fi
4413 +                               ;;
4414 +                       SunOS*)
4415 +                               CUPS_DEFAULT_PRINTCAP="/etc/printers.conf"
4416 +                               ;;
4417 +                       *)
4418 +                               CUPS_DEFAULT_PRINTCAP="/etc/printcap"
4419 +                               ;;
4420 +               esac
4421         fi
4422  else
4423         CUPS_DEFAULT_PRINTCAP=""
4424 @@ -236,5 +248,5 @@
4425  AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP")
4426  
4427  dnl
4428 -dnl End of "$Id$".
4429 +dnl End of "$Id$".
4430  dnl
4431 diff -durN release-1.2.1/config-scripts/cups-directories.m4 cups-1.2.x/config-scripts/cups-directories.m4
4432 --- release-1.2.1/config-scripts/cups-directories.m4    2006-07-04 17:32:16.000000000 +0100
4433 +++ cups-1.2.x/config-scripts/cups-directories.m4       2006-06-28 09:59:03.000000000 +0100
4434 @@ -1,5 +1,5 @@
4435  dnl
4436 -dnl "$Id$"
4437 +dnl "$Id$"
4438  dnl
4439  dnl   Directory stuff for the Common UNIX Printing System (CUPS).
4440  dnl
4441 @@ -115,7 +115,7 @@
4442  
4443  if test x$rcdir = x; then
4444         case "$uname" in
4445 -               FreeBSD* | OpenBSD*)
4446 +               FreeBSD* | OpenBSD* | MirBsD* | ekkoBSD*)
4447                         # FreeBSD and OpenBSD
4448                         INITDIR=""
4449                         INITDDIR=""
4450 @@ -302,5 +302,5 @@
4451  AC_SUBST(CUPS_STATEDIR)
4452  
4453  dnl
4454 -dnl End of "$Id$".
4455 +dnl End of "$Id$".
4456  dnl
4457 diff -durN release-1.2.1/config-scripts/cups-image.m4 cups-1.2.x/config-scripts/cups-image.m4
4458 --- release-1.2.1/config-scripts/cups-image.m4  2006-07-04 17:32:16.000000000 +0100
4459 +++ cups-1.2.x/config-scripts/cups-image.m4     2006-06-26 12:42:46.000000000 +0100
4460 @@ -1,5 +1,5 @@
4461  dnl
4462 -dnl "$Id$"
4463 +dnl "$Id$"
4464  dnl
4465  dnl   Image library/filter stuff for the Common UNIX Printing System (CUPS).
4466  dnl
4467 @@ -38,10 +38,6 @@
4468  
4469  AC_SUBST(IMGFILTERS)
4470  
4471 -dnl Save the current libraries since we don't want the image libraries
4472 -dnl included with every program...
4473 -SAVELIBS="$LIBS"
4474 -
4475  dnl Check for image libraries...
4476  AC_ARG_ENABLE(jpeg, [  --enable-jpeg           turn on JPEG support, default=yes])
4477  AC_ARG_ENABLE(png, [  --enable-png            turn on PNG support, default=yes])
4478 @@ -57,6 +53,14 @@
4479  AC_SUBST(LIBTIFF)
4480  AC_SUBST(LIBZ)
4481  
4482 +dnl Image libraries use math library functions...
4483 +AC_SEARCH_LIBS(pow, m)
4484 +
4485 +dnl Save the current libraries since we don't want the image libraries
4486 +dnl included with every program...
4487 +SAVELIBS="$LIBS"
4488 +
4489 +dnl JPEG library...
4490  if test x$enable_jpeg != xno; then
4491      AC_CHECK_HEADER(jpeglib.h,
4492         AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
4493 @@ -67,24 +71,24 @@
4494      AC_MSG_NOTICE([JPEG support disabled with --disable-jpeg.])
4495  fi
4496  
4497 +dnl ZLIB library...
4498  AC_CHECK_HEADER(zlib.h,
4499      AC_CHECK_LIB(z, gzgets,
4500         AC_DEFINE(HAVE_LIBZ)
4501         LIBZ="-lz"
4502         LIBS="$LIBS -lz"))
4503  
4504 -dnl PNG library uses math library functions...
4505 -AC_CHECK_LIB(m, pow)
4506 -
4507 +dnl PNG library...
4508  if test x$enable_png != xno; then
4509      AC_CHECK_HEADER(png.h,
4510         AC_CHECK_LIB(png, png_create_read_struct,
4511             AC_DEFINE(HAVE_LIBPNG)
4512 -           LIBPNG="-lpng -lm"))
4513 +           LIBPNG="-lpng"))
4514  else
4515      AC_MSG_NOTICE([PNG support disabled with --disable-png.])
4516  fi
4517  
4518 +dnl TIFF library...
4519  if test x$enable_tiff != xno; then
4520      AC_CHECK_HEADER(tiff.h,
4521         AC_CHECK_LIB(tiff, TIFFReadScanline,
4522 @@ -110,5 +114,5 @@
4523  AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
4524  
4525  dnl
4526 -dnl End of "$Id$".
4527 +dnl End of "$Id$".
4528  dnl
4529 diff -durN release-1.2.1/config-scripts/cups-network.m4 cups-1.2.x/config-scripts/cups-network.m4
4530 --- release-1.2.1/config-scripts/cups-network.m4        2006-07-04 17:32:16.000000000 +0100
4531 +++ cups-1.2.x/config-scripts/cups-network.m4   2006-06-26 12:42:46.000000000 +0100
4532 @@ -1,5 +1,5 @@
4533  dnl
4534 -dnl "$Id$"
4535 +dnl "$Id$"
4536  dnl
4537  dnl   Networking stuff for the Common UNIX Printing System (CUPS).
4538  dnl
4539 @@ -46,7 +46,7 @@
4540         maxfiles=4096
4541  fi
4542  
4543 -AC_ARG_WITH(maxfiles, [  --with-maxfiles=N       set maximum number of file descriptors for scheduler ],
4544 +AC_ARG_WITH(maxfiles, [  --with-maxfiles=N       set maximum number of file descriptors for scheduler (deprecated) ],
4545         maxfiles=$withval)
4546  
4547  AC_DEFINE_UNQUOTED(CUPS_MAX_FDS, $maxfiles)
4548 @@ -85,5 +85,5 @@
4549  AC_SUBST(CUPS_LISTEN_DOMAINSOCKET)
4550  
4551  dnl
4552 -dnl End of "$Id$".
4553 +dnl End of "$Id$".
4554  dnl
4555 diff -durN release-1.2.1/config-scripts/cups-sharedlibs.m4 cups-1.2.x/config-scripts/cups-sharedlibs.m4
4556 --- release-1.2.1/config-scripts/cups-sharedlibs.m4     2006-07-04 17:32:16.000000000 +0100
4557 +++ cups-1.2.x/config-scripts/cups-sharedlibs.m4        2006-06-26 12:42:46.000000000 +0100
4558 @@ -1,5 +1,5 @@
4559  dnl
4560 -dnl "$Id$"
4561 +dnl "$Id$"
4562  dnl
4563  dnl   Shared library support for the Common UNIX Printing System (CUPS).
4564  dnl
4565 @@ -117,7 +117,7 @@
4566         # rather than to the executables.  This makes things smaller if you
4567         # are using any static libraries, and it also allows us to distribute
4568         # a single DSO rather than a bunch...
4569 -       DSOLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
4570 +       DSOLIBS="\$(LIBTIFF) \$(LIBPNG) \$(LIBJPEG) \$(LIBZ)"
4571         IMGLIBS=""
4572  
4573         # Tell the run-time linkers where to find a DSO.  Some platforms
4574 @@ -126,46 +126,46 @@
4575         case $uname in
4576                  HP-UX*)
4577                         # HP-UX needs the path, even for /usr/lib...
4578 -                       DSOFLAGS="+s +b \$(libdir) $DSOFLAGS"
4579 -                       DSO32FLAGS="+s +b \$(LIB32DIR) $DSO32FLAGS"
4580 -                       DSO64FLAGS="+s +b \$(LIB64DIR) $DSO64FLAGS"
4581 -                       LDFLAGS="$LDFLAGS -Wl,+s,+b,\$(libdir)"
4582 -                       EXPORT_LDFLAGS="-Wl,+s,+b,\$(libdir)"
4583 +                       DSOFLAGS="+s +b $libdir $DSOFLAGS"
4584 +                       DSO32FLAGS="+s +b $LIB32DIR $DSO32FLAGS"
4585 +                       DSO64FLAGS="+s +b $LIB64DIR $DSO64FLAGS"
4586 +                       LDFLAGS="$LDFLAGS -Wl,+s,+b,$libdir"
4587 +                       EXPORT_LDFLAGS="-Wl,+s,+b,$libdir"
4588                         ;;
4589                  SunOS*)
4590                         # Solaris...
4591                         if test $exec_prefix != /usr; then
4592 -                               DSOFLAGS="-R\$(libdir) $DSOFLAGS"
4593 -                               DSO32FLAGS="-R\$(LIB32DIR) $DSO32FLAGS"
4594 -                               DSO64FLAGS="-R\$(LIB64DIR) $DSO64FLAGS"
4595 -                               LDFLAGS="$LDFLAGS -R\$(libdir)"
4596 -                               EXPORT_LDFLAGS="-R\$(libdir)"
4597 +                               DSOFLAGS="-R$libdir $DSOFLAGS"
4598 +                               DSO32FLAGS="-R$LIB32DIR $DSO32FLAGS"
4599 +                               DSO64FLAGS="-R$LIB64DIR $DSO64FLAGS"
4600 +                               LDFLAGS="$LDFLAGS -R$libdir"
4601 +                               EXPORT_LDFLAGS="-R$libdir"
4602                         fi
4603                         ;;
4604                  *BSD*)
4605                          # *BSD...
4606                         if test $exec_prefix != /usr; then
4607 -                               DSOFLAGS="-Wl,-R\$(libdir) $DSOFLAGS"
4608 -                               DSO32FLAGS="-Wl,-R\$(LIB32DIR) $DSO32FLAGS"
4609 -                               DSO64FLAGS="-Wl,-R\$(LIB64DIR) $DSO64FLAGS"
4610 -                               LDFLAGS="$LDFLAGS -Wl,-R\$(libdir)"
4611 -                               EXPORT_LDFLAGS="-Wl,-R\$(libdir)"
4612 +                               DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
4613 +                               DSO32FLAGS="-Wl,-R$LIB32DIR $DSO32FLAGS"
4614 +                               DSO64FLAGS="-Wl,-R$LIB64DIR $DSO64FLAGS"
4615 +                               LDFLAGS="$LDFLAGS -Wl,-R$libdir"
4616 +                               EXPORT_LDFLAGS="-Wl,-R$libdir"
4617                         fi
4618                         ;;
4619                  IRIX | Linux | GNU)
4620                          # IRIX, Linux, and HURD...
4621                         if test $exec_prefix != /usr; then
4622 -                               DSOFLAGS="-Wl,-rpath,\$(libdir) $DSOFLAGS"
4623 -                               DSO32FLAGS="-Wl,-rpath,\$(LIB32DIR) $DSO32FLAGS"
4624 -                               DSO64FLAGS="-Wl,-rpath,\$(LIB64DIR) $DSO64FLAGS"
4625 -                               LDFLAGS="$LDFLAGS -Wl,-rpath,\$(libdir)"
4626 -                               EXPORT_LDFLAGS="-Wl,-rpath,\$(libdir)"
4627 +                               DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
4628 +                               DSO32FLAGS="-Wl,-rpath,$LIB32DIR $DSO32FLAGS"
4629 +                               DSO64FLAGS="-Wl,-rpath,$LIB64DIR $DSO64FLAGS"
4630 +                               LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
4631 +                               EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
4632                         fi
4633                         ;;
4634         esac
4635  else
4636         DSOLIBS=""
4637 -       IMGLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
4638 +       IMGLIBS="\$(LIBTIFF) \$(LIBPNG) \$(LIBJPEG) \$(LIBZ)"
4639  fi
4640  
4641  AC_SUBST(DSOLIBS)
4642 @@ -173,5 +173,5 @@
4643  AC_SUBST(EXPORT_LDFLAGS)
4644  
4645  dnl
4646 -dnl End of "$Id$".
4647 +dnl End of "$Id$".
4648  dnl
4649 diff -durN release-1.2.1/config-scripts/cups-ssl.m4 cups-1.2.x/config-scripts/cups-ssl.m4
4650 --- release-1.2.1/config-scripts/cups-ssl.m4    2006-07-04 17:32:16.000000000 +0100
4651 +++ cups-1.2.x/config-scripts/cups-ssl.m4       2006-06-26 12:42:46.000000000 +0100
4652 @@ -1,5 +1,5 @@
4653  dnl
4654 -dnl "$Id$"
4655 +dnl "$Id$"
4656  dnl
4657  dnl   OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
4658  dnl
4659 @@ -48,6 +48,7 @@
4660                  # certificates for CUPS, so don't enable encryption on
4661                  # /admin just yet...
4662                  #ENCRYPTION_REQUIRED="  Encryption Required"
4663 +                AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
4664                  AC_DEFINE(HAVE_SSL)
4665                  AC_DEFINE(HAVE_CDSASSL)])
4666         fi
4667 @@ -114,5 +115,5 @@
4668  
4669  
4670  dnl
4671 -dnl End of "$Id$".
4672 +dnl End of "$Id$".
4673  dnl
4674 diff -durN release-1.2.1/configure.in cups-1.2.x/configure.in
4675 --- release-1.2.1/configure.in  2006-07-04 17:35:29.000000000 +0100
4676 +++ cups-1.2.x/configure.in     2006-06-26 12:45:38.000000000 +0100
4677 @@ -1,5 +1,5 @@
4678  dnl
4679 -dnl "$Id$"
4680 +dnl "$Id$"
4681  dnl
4682  dnl   Configuration script for the Common UNIX Printing System (CUPS).
4683  dnl
4684 @@ -47,8 +47,12 @@
4685  sinclude(config-scripts/cups-pdf.m4)
4686  sinclude(config-scripts/cups-scripting.m4)
4687  
4688 +INSTALL_LANGUAGES=""
4689 +UNINSTALL_LANGUAGES=""
4690  LANGFILES=""
4691  if test "x$LANGUAGES" != x; then
4692 +       INSTALL_LANGUAGES="install-languages"
4693 +       UNINSTALL_LANGUAGES="uninstall-languages"
4694         for lang in $LANGUAGES; do
4695                 LANGFILES="$LANGFILES doc/$lang/index.html"
4696                 LANGFILES="$LANGFILES templates/$lang/edit-config.tmpl"
4697 @@ -56,6 +60,9 @@
4698         done
4699  fi
4700  
4701 +AC_SUBST(INSTALL_LANGUAGES)
4702 +AC_SUBST(UNINSTALL_LANGUAGES)
4703 +
4704  AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config
4705           conf/cupsd.conf conf/pam.std doc/index.html
4706           doc/help/standard.html man/client.conf.man
4707 @@ -68,5 +75,5 @@
4708  chmod +x cups-config
4709  
4710  dnl
4711 -dnl End of "$Id$".
4712 +dnl End of "$Id$".
4713  dnl
4714 diff -durN release-1.2.1/cups/adminutil.c cups-1.2.x/cups/adminutil.c
4715 --- release-1.2.1/cups/adminutil.c      2006-07-04 17:32:59.000000000 +0100
4716 +++ cups-1.2.x/cups/adminutil.c 2006-06-26 12:43:29.000000000 +0100
4717 @@ -1,5 +1,5 @@
4718  /*
4719 - * "$Id$"
4720 + * "$Id$"
4721   *
4722   *   Administration utility API definitions for the Common UNIX Printing
4723   *   System (CUPS).
4724 @@ -222,18 +222,18 @@
4725        */
4726  
4727        cupsFilePrintf(dstfp, "*%% Commented out for CUPS Windows Driver...\n"
4728 -                            "*%%%s", line + 1);
4729 +                            "*%%%s\n", line + 1);
4730        continue;
4731      }
4732      else if (!strncmp(line, "*JCLOpenUI", 10))
4733      {
4734        jcloption = 1;
4735 -      cupsFilePuts(dstfp, line);
4736 +      cupsFilePrintf(dstfp, "%s\n", line);
4737      }
4738      else if (!strncmp(line, "*JCLCloseUI", 11))
4739      {
4740        jcloption = 0;
4741 -      cupsFilePuts(dstfp, line);
4742 +      cupsFilePrintf(dstfp, "%s\n", line);
4743      }
4744      else if (jcloption &&
4745               strncmp(line, "*End", 4) &&
4746 @@ -312,12 +312,13 @@
4747        }
4748  
4749        snprintf(ptr + 1, sizeof(line) - (ptr - line + 1),
4750 -               "%%cupsJobTicket: %s=%s\n\"\n*End\n", option, choice);
4751 +               "%%cupsJobTicket: %s=%s\n\"\n*End", option, choice);
4752  
4753 -      cupsFilePrintf(dstfp, "*%% Changed for CUPS Windows Driver...\n%s", line);
4754 +      cupsFilePrintf(dstfp, "*%% Changed for CUPS Windows Driver...\n%s\n",
4755 +                     line);
4756      }
4757      else
4758 -      cupsFilePuts(dstfp, line);
4759 +      cupsFilePrintf(dstfp, "%s\n", line);
4760    }
4761  
4762    cupsFileClose(srcfp);
4763 @@ -1927,5 +1928,5 @@
4764  
4765  
4766  /*
4767 - * End of "$Id$".
4768 + * End of "$Id$".
4769   */
4770 diff -durN release-1.2.1/cups/emit.c cups-1.2.x/cups/emit.c
4771 --- release-1.2.1/cups/emit.c   2006-07-04 17:32:59.000000000 +0100
4772 +++ cups-1.2.x/cups/emit.c      2006-06-28 09:59:04.000000000 +0100
4773 @@ -1,5 +1,5 @@
4774  /*
4775 - * "$Id$"
4776 + * "$Id$"
4777   *
4778   *   PPD code emission routines for the Common UNIX Printing System (CUPS).
4779   *
4780 @@ -50,6 +50,7 @@
4781  #include <stdlib.h>
4782  #include "string.h"
4783  #include <errno.h>
4784 +#include "debug.h"
4785  
4786  #if defined(WIN32) || defined(__EMX__)
4787  #  include <io.h>
4788 @@ -111,6 +112,9 @@
4789    ppd_choice_t **collect;              /* Collected choices */
4790  
4791  
4792 +  DEBUG_printf(("ppdCollect2(ppd=%p, section=%d, min_order=%f, choices=%p)\n",
4793 +                ppd, section, min_order, choices));
4794 +
4795    if (ppd == NULL)
4796      return (0);
4797  
4798 @@ -132,6 +136,8 @@
4799         for (k = o->num_choices, c = o->choices; k > 0; k --, c ++)
4800           if (c->marked && count < 1000)
4801           {
4802 +           DEBUG_printf(("ppdCollect2: %s=%s marked...\n", o->keyword,
4803 +                         c->choice));
4804              collect[count] = c;
4805             count ++;
4806           }
4807 @@ -142,6 +148,8 @@
4808           for (m = o->num_choices, c = o->choices; m > 0; m --, c ++)
4809             if (c->marked && count < 1000)
4810             {
4811 +             DEBUG_printf(("ppdCollect2: %s=%s marked...\n", o->keyword,
4812 +                           c->choice));
4813                collect[count] = c;
4814               count ++;
4815             }
4816 @@ -155,6 +163,8 @@
4817      qsort(collect, count, sizeof(ppd_choice_t *),
4818            (int (*)(const void *, const void *))ppd_sort);
4819  
4820 +  DEBUG_printf(("ppdCollect2: %d marked choices...\n", count));
4821 +
4822   /*
4823    * Return the array and number of choices; if 0, free the array since
4824    * it isn't needed.
4825 @@ -492,6 +502,9 @@
4826    struct lconv *loc;                   /* Locale data */
4827  
4828  
4829 +  DEBUG_printf(("ppdEmitString(ppd=%p, section=%d, min_order=%f)\n",
4830 +                ppd, section, min_order));
4831 +
4832   /*
4833    * Range check input...
4834    */
4835 @@ -527,6 +540,8 @@
4836             !strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
4837            !strcasecmp(choices[i]->choice, "Custom"))
4838        {
4839 +        DEBUG_puts("ppdEmitString: Custom size set!");
4840 +
4841          bufsize += 37;                 /* %%BeginFeature: *CustomPageSize True\n */
4842          bufsize += 50;                 /* Five 9-digit numbers + newline */
4843        }
4844 @@ -580,6 +595,8 @@
4845    * Allocate memory...
4846    */
4847  
4848 +  DEBUG_printf(("ppdEmitString: Allocating %d bytes for string...\n", bufsize));
4849 +
4850    if ((buffer = calloc(1, bufsize)) == NULL)
4851    {
4852      free(choices);
4853 @@ -608,6 +625,9 @@
4854        * Send DSC comments with option...
4855        */
4856  
4857 +      DEBUG_printf(("Adding code for %s=%s...\n", choices[i]->option->keyword,
4858 +                    choices[i]->choice));
4859 +
4860        if ((!strcasecmp(choices[i]->option->keyword, "PageSize") ||
4861             !strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
4862            !strcasecmp(choices[i]->choice, "Custom"))
4863 @@ -800,6 +820,9 @@
4864        strlcpy(bufptr, "%%EndFeature\n"
4865                       "} stopped cleartomark\n", bufend - bufptr + 1);
4866        bufptr += strlen(bufptr);
4867 +
4868 +      DEBUG_printf(("ppdEmitString: Offset in string is %d...\n",
4869 +                    bufptr - buffer));
4870      }
4871      else
4872      {
4873 @@ -917,5 +940,5 @@
4874  
4875  
4876  /*
4877 - * End of "$Id$".
4878 + * End of "$Id$".
4879   */
4880 diff -durN release-1.2.1/cups/http-addrlist.c cups-1.2.x/cups/http-addrlist.c
4881 --- release-1.2.1/cups/http-addrlist.c  2006-07-04 17:32:59.000000000 +0100
4882 +++ cups-1.2.x/cups/http-addrlist.c     2006-06-26 12:43:29.000000000 +0100
4883 @@ -1,5 +1,5 @@
4884  /*
4885 - * "$Id$"
4886 + * "$Id$"
4887   *
4888   *   HTTP address list routines for the Common UNIX Printing System (CUPS).
4889   *
4890 @@ -412,7 +412,7 @@
4891            if (host->h_addrtype == AF_INET6)
4892           {
4893              temp->addr.ipv6.sin6_family = AF_INET6;
4894 -           memcpy(&(temp->addr.ipv6), host->h_addr_list[i],
4895 +           memcpy(&(temp->addr.ipv6.sin6_addr), host->h_addr_list[i],
4896                    sizeof(temp->addr.ipv6));
4897              temp->addr.ipv6.sin6_port = htons(portnum);
4898           }
4899 @@ -420,7 +420,7 @@
4900  #  endif /* AF_INET6 */
4901           {
4902              temp->addr.ipv4.sin_family = AF_INET;
4903 -           memcpy(&(temp->addr.ipv4), host->h_addr_list[i],
4904 +           memcpy(&(temp->addr.ipv4.sin_addr), host->h_addr_list[i],
4905                    sizeof(temp->addr.ipv4));
4906              temp->addr.ipv4.sin_port = htons(portnum);
4907            }
4908 @@ -506,6 +506,9 @@
4909         temp->addr.ipv6.sin6_addr.s6_addr32[3] = htonl(1);
4910  #  endif /* WIN32 */
4911  
4912 +        if (!first)
4913 +          first = temp;
4914 +
4915          addr = temp;
4916        }
4917  
4918 @@ -527,6 +530,9 @@
4919         temp->addr.ipv4.sin_port        = htons(portnum);
4920         temp->addr.ipv4.sin_addr.s_addr = htonl(0x7f000001);
4921  
4922 +        if (!first)
4923 +          first = temp;
4924 +
4925          if (addr)
4926           addr->next = temp;
4927         else
4928 @@ -556,6 +562,9 @@
4929          temp->addr.ipv6.sin6_family = AF_INET6;
4930         temp->addr.ipv6.sin6_port   = htons(portnum);
4931  
4932 +        if (!first)
4933 +          first = temp;
4934 +
4935          addr = temp;
4936        }
4937  
4938 @@ -576,6 +585,9 @@
4939          temp->addr.ipv4.sin_family = AF_INET;
4940         temp->addr.ipv4.sin_port   = htons(portnum);
4941  
4942 +        if (!first)
4943 +          first = temp;
4944 +
4945          if (addr)
4946           addr->next = temp;
4947         else
4948 @@ -593,5 +605,5 @@
4949  
4950  
4951  /*
4952 - * End of "$Id$".
4953 + * End of "$Id$".
4954   */
4955 diff -durN release-1.2.1/cups/http.c cups-1.2.x/cups/http.c
4956 --- release-1.2.1/cups/http.c   2006-07-04 17:32:59.000000000 +0100
4957 +++ cups-1.2.x/cups/http.c      2006-06-26 12:43:29.000000000 +0100
4958 @@ -1,5 +1,5 @@
4959  /*
4960 - * "$Id$"
4961 + * "$Id$"
4962   *
4963   *   HTTP routines for the Common UNIX Printing System (CUPS).
4964   *
4965 @@ -866,7 +866,7 @@
4966        * No newline; see if there is more data to be read...
4967        */
4968  
4969 -      if (!http->blocking && !http_wait(http, 1000))
4970 +      if (!http->blocking && !http_wait(http, 10000))
4971        {
4972          DEBUG_puts("httpGets: Timed out!");
4973          http->error = ETIMEDOUT;
4974 @@ -1222,7 +1222,7 @@
4975      * Buffer small reads for better performance...
4976      */
4977  
4978 -    if (!http->blocking && !httpWait(http, 1000))
4979 +    if (!http->blocking && !httpWait(http, 10000))
4980        return (0);
4981  
4982      if (http->data_remaining > sizeof(http->buffer))
4983 @@ -1285,7 +1285,7 @@
4984  #ifdef HAVE_SSL
4985    else if (http->tls)
4986    {
4987 -    if (!http->blocking && !httpWait(http, 1000))
4988 +    if (!http->blocking && !httpWait(http, 10000))
4989        return (0);
4990  
4991      bytes = http_read_ssl(http, buffer, length);
4992 @@ -1293,7 +1293,7 @@
4993  #endif /* HAVE_SSL */
4994    else
4995    {
4996 -    if (!http->blocking && !httpWait(http, 1000))
4997 +    if (!http->blocking && !httpWait(http, 10000))
4998        return (0);
4999  
5000      DEBUG_printf(("httpRead2: reading %d bytes from socket...\n", length));
5001 @@ -1415,13 +1415,11 @@
5002      *dataLength = 0;
5003  
5004      if (bytes == 0)
5005 -      result = errSSLClosedAbort;
5006 +      result = errSSLClosedGraceful;
5007      else if (errno == EAGAIN)
5008        result = errSSLWouldBlock;
5009 -    else if (errno == EPIPE)
5010 -      result = errSSLClosedAbort;
5011      else
5012 -      result = errSSLInternal;
5013 +      result = errSSLClosedAbort;
5014    }
5015  
5016    return result;
5017 @@ -1994,10 +1992,8 @@
5018    
5019      if (errno == EAGAIN)
5020        result = errSSLWouldBlock;
5021 -    else if (errno == EPIPE)
5022 -      result = errSSLClosedAbort;
5023      else
5024 -      result = errSSLInternal;
5025 +      result = errSSLClosedAbort;
5026    }
5027  
5028    return result;
5029 @@ -2338,6 +2334,9 @@
5030      error = SSLSetAllowsAnyRoot(conn->session, true);
5031  
5032    if (!error)
5033 +    error = SSLSetProtocolVersionEnabled(conn->session, kSSLProtocol2, false);
5034 +
5035 +  if (!error)
5036    {
5037      while ((error = SSLHandshake(conn->session)) == errSSLWouldBlock)
5038        usleep(1000);
5039 @@ -2802,5 +2801,5 @@
5040  
5041  
5042  /*
5043 - * End of "$Id$".
5044 + * End of "$Id$".
5045   */
5046 diff -durN release-1.2.1/cups/http.h cups-1.2.x/cups/http.h
5047 --- release-1.2.1/cups/http.h   2006-07-04 17:32:59.000000000 +0100
5048 +++ cups-1.2.x/cups/http.h      2006-06-28 09:59:04.000000000 +0100
5049 @@ -1,5 +1,5 @@
5050  /*
5051 - * "$Id$"
5052 + * "$Id$"
5053   *
5054   *   Hyper-Text Transport Protocol definitions for the Common UNIX Printing
5055   *   System (CUPS).
5056 @@ -98,7 +98,7 @@
5057  #if defined(AF_INET6) && !defined(s6_addr32)
5058  #  if defined(__sun)
5059  #    define s6_addr32  _S6_un._S6_u32
5060 -#  elif defined(__FreeBSD__) || defined(__APPLE__)
5061 +#  elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
5062  #    define s6_addr32  __u6_addr.__u6_addr32
5063  #  elif defined(__osf__)
5064  #    define s6_addr32  s6_un.sa6_laddr
5065 @@ -322,6 +322,14 @@
5066  
5067  typedef struct _http_s                 /**** HTTP connection structure. ****/
5068  {
5069 + /*
5070 +  * DO NOT ACCESS MEMBERS OF THIS STRUCTURE DIRECTLY; INSTEAD, USE THE
5071 +  * PROVIDED APIS FOR ACCESSING THE VALUES INSTEAD.
5072 +  *
5073 +  * This structure definition will be removed from the public headers in
5074 +  * CUPS 1.3.
5075 +  */
5076 +
5077    int                  fd;             /* File descriptor for this socket */
5078    int                  blocking;       /* To block or not to block */
5079    int                  error;          /* Last error on read */
5080 @@ -496,5 +504,5 @@
5081  #endif /* !_CUPS_HTTP_H_ */
5082  
5083  /*
5084 - * End of "$Id$".
5085 + * End of "$Id$".
5086   */
5087 diff -durN release-1.2.1/cups/ipp.c cups-1.2.x/cups/ipp.c
5088 --- release-1.2.1/cups/ipp.c    2006-07-04 17:32:59.000000000 +0100
5089 +++ cups-1.2.x/cups/ipp.c       2006-06-26 12:43:29.000000000 +0100
5090 @@ -1,5 +1,5 @@
5091  /*
5092 - * "$Id$"
5093 + * "$Id$"
5094   *
5095   *   Internet Printing Protocol support functions for the Common UNIX
5096   *   Printing System (CUPS).
5097 @@ -2742,10 +2742,10 @@
5098        if (!http->blocking)
5099        {
5100         /*
5101 -        * Wait up to 1 second for more data on non-blocking sockets...
5102 +        * Wait up to 10 seconds for more data on non-blocking sockets...
5103         */
5104  
5105 -       if (!httpWait(http, 1000))
5106 +       if (!httpWait(http, 10000))
5107         {
5108          /*
5109            * Signal no data...
5110 @@ -2824,5 +2824,5 @@
5111  
5112  
5113  /*
5114 - * End of "$Id$".
5115 + * End of "$Id$".
5116   */
5117 diff -durN release-1.2.1/cups/Makefile cups-1.2.x/cups/Makefile
5118 --- release-1.2.1/cups/Makefile 2006-07-04 17:32:59.000000000 +0100
5119 +++ cups-1.2.x/cups/Makefile    2006-06-26 12:43:29.000000000 +0100
5120 @@ -1,5 +1,5 @@
5121  #
5122 -# "$Id$"
5123 +# "$Id$"
5124  #
5125  #   API library Makefile for the Common UNIX Printing System (CUPS).
5126  #
5127 @@ -138,7 +138,7 @@
5128  clean:
5129         $(RM) $(OBJS) $(TARGETS)
5130         $(RM) libcups.so libcups.sl libcups.dylib
5131 -       $(RM) -r 32bit 64it
5132 +       $(RM) -r 32bit 64bit
5133  
5134  
5135  #
5136 @@ -186,12 +186,12 @@
5137  install32bit:
5138         $(INSTALL_DIR) -m 755 $(LIB32DIR)
5139         $(INSTALL_LIB) 32bit/libcups.so.2 $(LIB32DIR)/libcups.so.2
5140 -       $(LN) libcups.so $(LIB32DIR)/libcups.so.2
5141 +       $(LN) libcups.so.2 $(LIB32DIR)/libcups.so
5142  
5143  install64bit:
5144         $(INSTALL_DIR) -m 755 $(LIB64DIR)
5145         $(INSTALL_LIB) 64bit/libcups.so.2 $(LIB64DIR)/libcups.so.2
5146 -       $(LN) libcups.so $(LIB64DIR)/libcups.so.2
5147 +       $(LN) libcups.so.2 $(LIB64DIR)/libcups.so
5148  
5149  
5150  #
5151 @@ -449,5 +449,5 @@
5152  
5153  
5154  #
5155 -# End of "$Id$".
5156 +# End of "$Id$".
5157  #
5158 diff -durN release-1.2.1/cups/mark.c cups-1.2.x/cups/mark.c
5159 --- release-1.2.1/cups/mark.c   2006-07-04 17:32:59.000000000 +0100
5160 +++ cups-1.2.x/cups/mark.c      2006-06-28 09:59:04.000000000 +0100
5161 @@ -1,5 +1,5 @@
5162  /*
5163 - * "$Id$"
5164 + * "$Id$"
5165   *
5166   *   Option marking routines for the Common UNIX Printing System (CUPS).
5167   *
5168 @@ -407,6 +407,7 @@
5169        ppd_cparam_t     *cparam;        /* Custom parameter */
5170        char             *units;         /* Custom points units */
5171  
5172 +
5173        if ((coption = ppdFindCustomOption(ppd, option)) != NULL)
5174        {
5175          if ((cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params)) == NULL)
5176 @@ -455,6 +456,12 @@
5177         }
5178        }
5179      }
5180 +
5181 +   /*
5182 +    * Make sure that we keep the option marked below...
5183 +    */
5184 +
5185 +    choice = "Custom";
5186    }
5187    else if (choice[0] == '{')
5188    {
5189 @@ -679,5 +686,5 @@
5190  
5191  
5192  /*
5193 - * End of "$Id$".
5194 + * End of "$Id$".
5195   */
5196 diff -durN release-1.2.1/cups/testhttp.c cups-1.2.x/cups/testhttp.c
5197 --- release-1.2.1/cups/testhttp.c       2006-07-04 17:32:59.000000000 +0100
5198 +++ cups-1.2.x/cups/testhttp.c  2006-06-26 12:43:29.000000000 +0100
5199 @@ -1,9 +1,9 @@
5200  /*
5201 - * "$Id$"
5202 + * "$Id$"
5203   *
5204   *   HTTP test program for the Common UNIX Printing System (CUPS).
5205   *
5206 - *   Copyright 1997-2005 by Easy Software Products.
5207 + *   Copyright 1997-2006 by Easy Software Products.
5208   *
5209   *   These coded instructions, statements, and computer programs are the
5210   *   property of Easy Software Products and are protected by Federal
5211 @@ -311,9 +311,21 @@
5212      addrlist = httpAddrGetList(hostname, AF_UNSPEC, NULL);
5213      if (addrlist)
5214      {
5215 -      for (i = 0, addr = addrlist; addr; i ++, addr = addr->next);
5216 +      for (i = 0, addr = addrlist; addr; i ++, addr = addr->next)
5217 +      {
5218 +        char   numeric[1024];          /* Numeric IP address */
5219 +
5220 +
5221 +       httpAddrString(&(addr->addr), numeric, sizeof(numeric));
5222 +       if (!strcmp(numeric, "UNKNOWN"))
5223 +         break;
5224 +      }
5225 +
5226 +      if (addr)
5227 +        printf("FAIL (bad address for %s)\n", hostname);
5228 +      else
5229 +        printf("PASS (%d address(es) for %s)\n", i, hostname);
5230  
5231 -      printf("PASS (%d address(es) for %s)\n", i, hostname);
5232        httpAddrFreeList(addrlist);
5233      }
5234      else
5235 @@ -519,5 +531,5 @@
5236  
5237  
5238  /*
5239 - * End of "$Id$".
5240 + * End of "$Id$".
5241   */
5242 diff -durN release-1.2.1/cups/testppd.c cups-1.2.x/cups/testppd.c
5243 --- release-1.2.1/cups/testppd.c        2006-07-04 17:32:59.000000000 +0100
5244 +++ cups-1.2.x/cups/testppd.c   2006-06-28 09:59:04.000000000 +0100
5245 @@ -1,5 +1,5 @@
5246  /*
5247 - * "$Id$"
5248 + * "$Id$"
5249   *
5250   *   PPD test program for the Common UNIX Printing System (CUPS).
5251   *
5252 @@ -59,6 +59,39 @@
5253                         "%%BeginFeature: *InputSlot Tray\n"
5254                         "InputSlot=Tray\n"
5255                         "%%EndFeature\n"
5256 +                       "} stopped cleartomark\n"
5257 +                       "[{\n"
5258 +                       "%%BeginFeature: *IntOption None\n"
5259 +                       "%%EndFeature\n"
5260 +                       "} stopped cleartomark\n"
5261 +                       "[{\n"
5262 +                       "%%BeginFeature: *StringOption None\n"
5263 +                       "%%EndFeature\n"
5264 +                       "} stopped cleartomark\n";
5265 +
5266 +static const char      *custom_code =
5267 +                       "[{\n"
5268 +                       "%%BeginFeature: *CustomPageSize True\n"
5269 +                       "400\n"
5270 +                       "500\n"
5271 +                       "0\n"
5272 +                       "0\n"
5273 +                       "0\n"
5274 +                       "PageSize=Custom\n"
5275 +                       "%%EndFeature\n"
5276 +                       "} stopped cleartomark\n"
5277 +                       "[{\n"
5278 +                       "%%BeginFeature: *InputSlot Tray\n"
5279 +                       "InputSlot=Tray\n"
5280 +                       "%%EndFeature\n"
5281 +                       "} stopped cleartomark\n"
5282 +                       "[{\n"
5283 +                       "%%BeginFeature: *IntOption None\n"
5284 +                       "%%EndFeature\n"
5285 +                       "} stopped cleartomark\n"
5286 +                       "[{\n"
5287 +                       "%%BeginFeature: *StringOption None\n"
5288 +                       "%%EndFeature\n"
5289                         "} stopped cleartomark\n";
5290  
5291  
5292 @@ -107,7 +140,7 @@
5293        printf("FAIL (%d conflicts)\n", conflicts);
5294      }
5295  
5296 -    fputs("ppdEmitString: ", stdout);
5297 +    fputs("ppdEmitString (defaults): ", stdout);
5298      if ((s = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL &&
5299         !strcmp(s, default_code))
5300        puts("PASS");
5301 @@ -123,6 +156,24 @@
5302      if (s)
5303        free(s);
5304  
5305 +    fputs("ppdEmitString (custom size): ", stdout);
5306 +    ppdMarkOption(ppd, "PageSize", "Custom.400x500");
5307 +
5308 +    if ((s = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL &&
5309 +       !strcmp(s, custom_code))
5310 +      puts("PASS");
5311 +    else
5312 +    {
5313 +      printf("FAIL (%d bytes instead of %d)\n", s ? (int)strlen(s) : 0,
5314 +            (int)strlen(custom_code));
5315 +
5316 +      if (s)
5317 +       puts(s);
5318 +    }
5319 +
5320 +    if (s)
5321 +      free(s);
5322 +
5323      ppdClose(ppd);
5324    }
5325    else
5326 @@ -172,5 +223,5 @@
5327  
5328  
5329  /*
5330 - * End of "$Id$".
5331 + * End of "$Id$".
5332   */
5333 diff -durN release-1.2.1/cups/util.c cups-1.2.x/cups/util.c
5334 --- release-1.2.1/cups/util.c   2006-07-04 17:32:59.000000000 +0100
5335 +++ cups-1.2.x/cups/util.c      2006-06-26 12:43:29.000000000 +0100
5336 @@ -1,5 +1,5 @@
5337  /*
5338 - * "$Id$"
5339 + * "$Id$"
5340   *
5341   *   Printing utilities for the Common UNIX Printing System (CUPS).
5342   *
5343 @@ -800,6 +800,8 @@
5344              const char *name)          /* I - Printer name */
5345  {
5346    int          http_port;              /* Port number */
5347 +  char         http_hostname[HTTP_MAX_HOST];
5348 +                                       /* Hostname associated with connection */
5349    http_t       *http2;                 /* Alternate HTTP connection */
5350    int          fd;                     /* PPD file */
5351    char         localhost[HTTP_MAX_URI],/* Local hostname */
5352 @@ -845,9 +847,11 @@
5353      strcpy(hostname, "localhost");
5354  
5355   /*
5356 -  * Get the port number we are connected to...
5357 +  * Get the hostname and port number we are connected to...
5358    */
5359  
5360 +  httpGetHostname(http, http_hostname, sizeof(http_hostname));
5361 +
5362  #ifdef AF_INET6
5363    if (http->hostaddr->addr.sa_family == AF_INET6)
5364      http_port = ntohs(http->hostaddr->ipv6.sin6_port);
5365 @@ -862,7 +866,7 @@
5366    * Reconnect to the correct server as needed...
5367    */
5368  
5369 -  if (!strcasecmp(http->hostname, hostname) && port == http_port)
5370 +  if (!strcasecmp(http_hostname, hostname) && port == http_port)
5371      http2 = http;
5372    else if ((http2 = httpConnectEncrypt(hostname, port,
5373                                         cupsEncryption())) == NULL)
5374 @@ -1394,7 +1398,8 @@
5375              char       *printer,       /* O - Printer name [HTTP_MAX_URI] */
5376               char       *hostname)     /* O - Hostname [HTTP_MAX_URI] */
5377  {
5378 -  char hostbuf[HTTP_MAX_URI];          /* Name of host */
5379 +  char hostbuf[HTTP_MAX_URI],          /* Name of host */
5380 +       http_hostname[HTTP_MAX_HOST];   /* Hostname associated with connection */
5381    _cups_globals_t  *cg = _cupsGlobals();/* Pointer to library globals */
5382  
5383  
5384 @@ -1415,6 +1420,8 @@
5385  
5386    strlcpy(hostbuf, cupsServer(), sizeof(hostbuf));
5387  
5388 +  httpGetHostname(cg->http, http_hostname, sizeof(http_hostname));
5389 +
5390    if (hostname != NULL)
5391      strlcpy(hostname, hostbuf, HTTP_MAX_URI);
5392    else
5393 @@ -1427,7 +1434,7 @@
5394  
5395    if (cg->http != NULL)
5396    {
5397 -    if (!strcasecmp(cg->http->hostname, hostname))
5398 +    if (!strcasecmp(http_hostname, hostname))
5399        return (printer);
5400  
5401      httpClose(cg->http);
5402 @@ -1473,7 +1480,9 @@
5403    char         uri[HTTP_MAX_URI],      /* printer-uri attribute */
5404                 scheme[HTTP_MAX_URI],   /* Scheme name */
5405                 username[HTTP_MAX_URI], /* Username:password */
5406 -               classname[255];         /* Temporary class name */
5407 +               classname[255],         /* Temporary class name */
5408 +               http_hostname[HTTP_MAX_HOST];
5409 +                                       /* Hostname associated with connection */
5410    static const char * const requested_attrs[] =
5411                 {                       /* Requested attributes */
5412                   "printer-uri-supported",
5413 @@ -1505,9 +1514,11 @@
5414    DEBUG_printf(("cups_get_printer_uri: printer-uri=\"%s\"\n", uri));
5415  
5416   /*
5417 -  * Get the port number we are connected to...
5418 +  * Get the hostname and port number we are connected to...
5419    */
5420  
5421 +  httpGetHostname(http, http_hostname, sizeof(http_hostname));
5422 +
5423  #ifdef AF_INET6
5424    if (http->hostaddr->addr.sa_family == AF_INET6)
5425      http_port = ntohs(http->hostaddr->ipv6.sin6_port);
5426 @@ -1585,7 +1596,7 @@
5427             * Found a class!  Connect to the right server...
5428             */
5429  
5430 -           if (!strcasecmp(http->hostname, host) && *port == http_port)
5431 +           if (!strcasecmp(http_hostname, host) && *port == http_port)
5432               http2 = http;
5433             else if ((http2 = httpConnectEncrypt(host, *port,
5434                                                  cupsEncryption())) == NULL)
5435 @@ -1641,5 +1652,5 @@
5436  
5437  
5438  /*
5439 - * End of "$Id$".
5440 + * End of "$Id$".
5441   */
5442 diff -durN release-1.2.1/cups-config.in cups-1.2.x/cups-config.in
5443 --- release-1.2.1/cups-config.in        2006-07-04 17:35:29.000000000 +0100
5444 +++ cups-1.2.x/cups-config.in   2006-06-26 12:45:38.000000000 +0100
5445 @@ -1,6 +1,6 @@
5446  #! /bin/sh
5447  #
5448 -# "$Id$"
5449 +# "$Id$"
5450  # 
5451  #   CUPS configuration utility.
5452  #
5453 @@ -42,8 +42,8 @@
5454  # flags for C++ compiler:
5455  CFLAGS=""
5456  LDFLAGS="@EXPORT_LDFLAGS@"
5457 -LIBS="@EXPORT_SSLLIBS@ @LIBS@"
5458 -IMGLIBS="@EXPORT_LIBTIFF@ @EXPORT_LIBJPEG@ @EXPORT_LIBPNG@ @EXPORT_LIBZ@"
5459 +LIBS="@EXPORT_SSLLIBS@ @EXPORT_LIBZ@ @LIBS@"
5460 +IMGLIBS="@EXPORT_LIBTIFF@ @EXPORT_LIBJPEG@ @EXPORT_LIBPNG@"
5461  
5462  # Check for local invocation...
5463  selfdir=`dirname $0`
5464 @@ -53,7 +53,7 @@
5465      LDFLAGS="-L$selfdir/cups -L$selfdir/filter $LDFLAGS"
5466      libdir="$selfdir/cups"
5467      imagelibdir="$selfdir/filter"
5468 -    if test ! -e "$selfdir/cups/raster.h"; then
5469 +    if test ! -f "$selfdir/cups/raster.h"; then
5470          ln -s ../filter/raster.h "$selfdir/cups"
5471      fi
5472  else
5473 @@ -115,13 +115,13 @@
5474                 if test $image = no; then
5475                     echo -lcups $LIBS
5476                 else
5477 -                   echo -lcupsimage $IMGLIBS -lcups $LIBS
5478 +                   echo -lcupsimage -lcups $IMGLIBS $LIBS
5479                 fi
5480             else
5481                 if test $image = no; then
5482                     echo $libdir/libcups.a $LIBS
5483                 else
5484 -                   echo $imagelibdir/libcupsimage.a $IMGLIBS $libdir/libcups.a $LIBS
5485 +                   echo $imagelibdir/libcupsimage.a $libdir/libcups.a $IMGLIBS $LIBS
5486                 fi
5487             fi
5488             ;;
5489 @@ -150,5 +150,5 @@
5490  done
5491  
5492  #
5493 -# End of "$Id$".
5494 +# End of "$Id$".
5495  #
5496 diff -durN release-1.2.1/doc/help/spec-raster.html cups-1.2.x/doc/help/spec-raster.html
5497 --- release-1.2.1/doc/help/spec-raster.html     2006-07-04 17:32:27.000000000 +0100
5498 +++ cups-1.2.x/doc/help/spec-raster.html        2006-06-26 12:42:55.000000000 +0100
5499 @@ -14,9 +14,10 @@
5500  a printable format.</P>
5501  
5502  <P>CUPS 1.0 and 1.1 used a version 1 raster format. CUPS 1.2
5503 -introduces a version 2 format that is a superset of the version 1
5504 -format. Applications using the CUPS Imaging API (the cupsRaster*
5505 -functions) can read both formats without code changes.</P>
5506 +introduces version 2 (compressed) and version 3 (uncompressed)
5507 +formats that are a superset of the version 1 format. Applications
5508 +using the CUPS Imaging API (the cupsRaster* functions) can read
5509 +all formats without code changes.</P>
5510  
5511  <P>The registered MIME media type for CUPS raster files is
5512  <CODE>application/vnd.cups-raster</CODE>.</P>
5513 @@ -485,6 +486,22 @@
5514  followed by the color value bytes.</P>
5515  
5516  
5517 +<H2 CLASS="title"><A NAME="V3">Version 3 Raster File Format</A></H2>
5518 +
5519 +<P>A version 3 raster file begins with a 32-bit synchronization
5520 +word: 0x52615333 ("RaS3") for big-endian architectures and
5521 +0x33536152 ("3SaR") for little-endian architectures. The writer
5522 +of the raster file will use the native word order, and the reader
5523 +is responsible for detecting a reversed word order file and
5524 +swapping bytes as needed. The CUPS Imaging API raster functions
5525 +perform this function automatically.</P>
5526 +
5527 +<P>Following the synchronization word are a series of raster
5528 +pages. Each page starts with a version 2 page device dictionary
5529 +header and is followed immediately by the uncompressed raster data
5530 +for that page.</P>
5531 +
5532 +
5533  <H2 CLASS="title"><A NAME="ENCODING">Pixel Value Coding</A></H2>
5534  
5535  <P>The following sections describe the encoding and decoding of
5536 @@ -673,6 +690,15 @@
5537  
5538  <H2 CLASS="title"><A NAME="HISTORY">Change History</A></H2>
5539  
5540 +<H3>Changes in CUPS 1.2.2</H3>
5541 +
5542 +<ul>
5543 +
5544 +       <li>Added version 3 (uncompressed) format.</li>
5545 +
5546 +</ul>
5547 +
5548 +
5549  <H3>Changes in CUPS 1.2.1</H3>
5550  
5551  <ul>
5552 cups-1.2.x/doc/ja/.svn/wcprops/index.html.in.svn-work
5553 diff -durN release-1.2.1/doc/Makefile cups-1.2.x/doc/Makefile
5554 --- release-1.2.1/doc/Makefile  2006-07-04 17:32:35.000000000 +0100
5555 +++ cups-1.2.x/doc/Makefile     2006-06-26 12:43:01.000000000 +0100
5556 @@ -1,5 +1,5 @@
5557  #
5558 -# "$Id$"
5559 +# "$Id$"
5560  #
5561  #   Documentation makefile for the Common UNIX Printing System (CUPS).
5562  #
5563 @@ -200,7 +200,7 @@
5564  # Install all documentation files...
5565  #
5566  
5567 -install:       all
5568 +install:       all $(INSTALL_LANGUAGES)
5569         $(INSTALL_DIR) -m 755 $(DOCDIR)
5570         for file in $(WEBPAGES); do \
5571                 $(INSTALL_MAN) $$file $(DOCDIR); \
5572 @@ -213,6 +213,8 @@
5573         for file in $(WEBIMAGES) $(WEBBUTTONS); do \
5574                 $(INSTALL_MAN) $$file $(DOCDIR)/images; \
5575         done
5576 +
5577 +install-languages:
5578         for lang in $(LANGUAGES); do \
5579                 $(INSTALL_DIR) -m 755 $(DOCDIR)/$$lang/images; \
5580                 if test -f $$lang/index.html; then \
5581 @@ -230,7 +232,7 @@
5582  # Unnstall all documentation files...
5583  #
5584  
5585 -uninstall:
5586 +uninstall: $(UNINSTALL_LANGUAGES)
5587         for file in $(WEBPAGES); do \
5588                 $(RM) $(DOCDIR)/$$file; \
5589         done
5590 @@ -240,6 +242,11 @@
5591         for file in $(WEBIMAGES) $(WEBBUTTONS); do \
5592                 $(INSTALL_MAN) $(DOCDIR)/images/$$file; \
5593         done
5594 +       -$(RMDIR) $(DOCDIR)/images
5595 +       -$(RMDIR) $(DOCDIR)/help
5596 +       -$(RMDIR) $(DOCDIR)
5597 +
5598 +uninstall-languages:
5599         -for lang in $(LANGUAGES); do \
5600                 $(RM) $(DOCDIR)/$$lang/index.html; \
5601                 for file in $(WEBBUTTONS); do \
5602 @@ -248,9 +255,6 @@
5603                 $(RMDIR) $(DOCDIR)/$$lang/images; \
5604                 $(RMDIR) $(DOCDIR)/$$lang; \
5605         done
5606 -       -$(RMDIR) $(DOCDIR)/images
5607 -       -$(RMDIR) $(DOCDIR)/help
5608 -       -$(RMDIR) $(DOCDIR)
5609  
5610  
5611  #
5612 diff -durN release-1.2.1/filter/Makefile cups-1.2.x/filter/Makefile
5613 --- release-1.2.1/filter/Makefile       2006-07-04 17:35:19.000000000 +0100
5614 +++ cups-1.2.x/filter/Makefile  2006-06-26 12:45:28.000000000 +0100
5615 @@ -1,5 +1,5 @@
5616  #
5617 -# "$Id$"
5618 +# "$Id$"
5619  #
5620  #   Filter makefile for the Common UNIX Printing System (CUPS).
5621  #
5622 @@ -33,6 +33,7 @@
5623                 libcupsimage.a \
5624                 $(LIB32CUPSIMAGE) \
5625                 $(LIB64CUPSIMAGE) \
5626 +               rasterbench \
5627                 testimage \
5628                 testraster
5629  
5630 @@ -47,7 +48,7 @@
5631  FORMOBJS =     form-attr.o form-main.o form-ps.o form-text.o form-tree.o
5632  OBJS   =       $(HPGLOBJS) $(IMAGEOBJS) $(FORMOBJS) \
5633                 gziptoany.o imagetops.o imagetoraster.o common.o pstops.o \
5634 -               raster.o rastertoepson.o rastertohp.o rastertolabel.o \
5635 +               rasterbench.o rastertoepson.o rastertohp.o rastertolabel.o \
5636                 testimage.o testraster.o textcommon.o texttops.o
5637  
5638  
5639 @@ -118,12 +119,12 @@
5640  install32bit:
5641         $(INSTALL_DIR) -m 755 $(LIB32DIR)
5642         $(INSTALL_LIB) 32bit/libcupsimage.so.2 $(LIB32DIR)/libcupsimage.so.2
5643 -       $(LN) libcupsimage.so $(LIB32DIR)/libcupsimage.so.2
5644 +       $(LN) libcupsimage.so.2 $(LIB32DIR)/libcupsimage.so
5645  
5646  install64bit:
5647         $(INSTALL_DIR) -m 755 $(LIB64DIR)
5648         $(INSTALL_LIB) 64bit/libcupsimage.so.2 $(LIB64DIR)/libcupsimage.so.2
5649 -       $(LN) libcupsimage.so $(LIB64DIR)/libcupsimage.so.2
5650 +       $(LN) libcupsimage.so.2 $(LIB64DIR)/libcupsimage.so
5651  
5652  
5653  #
5654 @@ -360,6 +361,15 @@
5655  
5656  
5657  #
5658 +# rasterbench
5659 +#
5660 +
5661 +rasterbench:   rasterbench.o raster.o
5662 +       echo Linking $@...
5663 +       $(CC) $(LDFLAGS) -o $@ rasterbench.o raster.o
5664 +
5665 +
5666 +#
5667  # texttops
5668  #
5669  
5670 @@ -377,5 +387,5 @@
5671  
5672  
5673  #
5674 -# End of "$Id$".
5675 +# End of "$Id$".
5676  #
5677 diff -durN release-1.2.1/filter/pstops.c cups-1.2.x/filter/pstops.c
5678 --- release-1.2.1/filter/pstops.c       2006-07-04 17:35:19.000000000 +0100
5679 +++ cups-1.2.x/filter/pstops.c  2006-06-26 12:45:28.000000000 +0100
5680 @@ -1,5 +1,5 @@
5681  /*
5682 - * "$Id$"
5683 + * "$Id$"
5684   *
5685   *   PostScript filter for the Common UNIX Printing System (CUPS).
5686   *
5687 @@ -49,6 +49,7 @@
5688   *   set_pstops_options() - Set pstops options...
5689   *   skip_page()          - Skip past a page that won't be printed...
5690   *   start_nup()          - Start processing for N-up printing...
5691 + *   write_labels()       - Write the actual page labels.
5692   */
5693  
5694  /*
5695 @@ -204,6 +205,7 @@
5696                                   size_t linesize);
5697  static void            start_nup(pstops_doc_t *doc, int number,
5698                                   int show_border, const int *bounding_box);
5699 +static void            write_labels(pstops_doc_t *doc, int orient);
5700  
5701  
5702  /*
5703 @@ -1305,6 +1307,9 @@
5704  
5705    if (first_page)
5706    {
5707 +    char       *page_setup;            /* PageSetup commands to send */
5708 +
5709 +
5710      doc_puts(doc, "%%BeginPageSetup\n");
5711  
5712      if (pageinfo->num_options > 0)
5713 @@ -1344,20 +1349,28 @@
5714        */
5715  
5716        if (doc_setup)
5717 +      {
5718         doc_puts(doc, doc_setup);
5719 +       free(doc_setup);
5720 +      }
5721  
5722        if (any_setup)
5723 +      {
5724         doc_puts(doc, any_setup);
5725 +       free(any_setup);
5726 +      }
5727 +    }
5728  
5729 -     /*
5730 -      * Free the command strings...
5731 -      */
5732 +   /*
5733 +    * Output commands for the current page...
5734 +    */
5735  
5736 -      if (doc_setup)
5737 -       free(doc_setup);
5738 +    page_setup = ppdEmitString(ppd, PPD_ORDER_PAGE, 0);
5739  
5740 -      if (any_setup)
5741 -       free(any_setup);
5742 +    if (page_setup)
5743 +    {
5744 +      doc_puts(doc, page_setup);
5745 +      free(page_setup);
5746      }
5747    }
5748  
5749 @@ -1856,15 +1869,15 @@
5750          int          number)           /* I - Page number */
5751  {
5752    if (doc->mirror || Orientation || doc->number_up > 1)
5753 -    puts("userdict/ESPsave get restore");
5754 +    doc_puts(doc, "userdict/ESPsave get restore\n");
5755  
5756    switch (doc->number_up)
5757    {
5758      case 1 :
5759         if (doc->use_ESPshowpage)
5760         {
5761 -         WriteLabels(Orientation);
5762 -          puts("ESPshowpage");
5763 +         write_labels(doc, Orientation);
5764 +          doc_puts(doc, "ESPshowpage\n");
5765         }
5766         break;
5767  
5768 @@ -1878,7 +1891,7 @@
5769             * Rotate the labels back to portrait...
5770             */
5771  
5772 -           WriteLabels(Orientation - 1);
5773 +           write_labels(doc, Orientation - 1);
5774           }
5775           else if (Orientation == 0)
5776           {
5777 @@ -1886,7 +1899,7 @@
5778             * Rotate the labels to landscape...
5779             */
5780  
5781 -           WriteLabels(doc->normal_landscape ? 1 : 3);
5782 +           write_labels(doc, doc->normal_landscape ? 1 : 3);
5783           }
5784           else
5785           {
5786 @@ -1894,18 +1907,18 @@
5787             * Rotate the labels to landscape...
5788             */
5789  
5790 -           WriteLabels(doc->normal_landscape ? 3 : 1);
5791 +           write_labels(doc, doc->normal_landscape ? 3 : 1);
5792           }
5793  
5794 -          puts("ESPshowpage");
5795 +          doc_puts(doc, "ESPshowpage\n");
5796         }
5797          break;
5798  
5799      default :
5800         if (is_last_page(number) && doc->use_ESPshowpage)
5801         {
5802 -         WriteLabels(Orientation);
5803 -          puts("ESPshowpage");
5804 +         write_labels(doc, Orientation);
5805 +          doc_puts(doc, "ESPshowpage\n");
5806         }
5807          break;
5808    }
5809 @@ -2935,5 +2948,51 @@
5810  
5811  
5812  /*
5813 - * End of "$Id$".
5814 + * 'write_labels()' - Write the actual page labels.
5815 + *
5816 + * This function is a copy of the one in common.c since we need to
5817 + * use doc_puts/doc_printf instead of puts/printf...
5818 + */
5819 +
5820 +static void
5821 +write_labels(pstops_doc_t *doc,                /* I - Document information */
5822 +             int          orient)      /* I - Orientation of the page */
5823 +{
5824 +  float        width,                          /* Width of page */
5825 +       length;                         /* Length of page */
5826 +
5827 +
5828 +  doc_puts(doc, "gsave\n");
5829 +
5830 +  if ((orient ^ Orientation) & 1)
5831 +  {
5832 +    width  = PageLength;
5833 +    length = PageWidth;
5834 +  }
5835 +  else
5836 +  {
5837 +    width  = PageWidth;
5838 +    length = PageLength;
5839 +  }
5840 +
5841 +  switch (orient & 3)
5842 +  {
5843 +    case 1 : /* Landscape */
5844 +        doc_printf(doc, "%.1f 0.0 translate 90 rotate\n", length);
5845 +        break;
5846 +    case 2 : /* Reverse Portrait */
5847 +        doc_printf(doc, "%.1f %.1f translate 180 rotate\n", width, length);
5848 +        break;
5849 +    case 3 : /* Reverse Landscape */
5850 +        doc_printf(doc, "0.0 %.1f translate -90 rotate\n", width);
5851 +        break;
5852 +  }
5853 +
5854 +  doc_puts(doc, "ESPwl\n");
5855 +  doc_puts(doc, "grestore\n");
5856 +}
5857 +
5858 +
5859 +/*
5860 + * End of "$Id$".
5861   */
5862 diff -durN release-1.2.1/filter/rasterbench.c cups-1.2.x/filter/rasterbench.c
5863 --- release-1.2.1/filter/rasterbench.c  1970-01-01 01:00:00.000000000 +0100
5864 +++ cups-1.2.x/filter/rasterbench.c     2006-06-26 12:45:28.000000000 +0100
5865 @@ -0,0 +1,355 @@
5866 +/*
5867 + * "$Id$"
5868 + *
5869 + *   Raster benchmark program for the Common UNIX Printing System (CUPS).
5870 + *
5871 + *   Copyright 1997-2006 by Easy Software Products.
5872 + *
5873 + *   These coded instructions, statements, and computer programs are the
5874 + *   property of Easy Software Products and are protected by Federal
5875 + *   copyright law.  Distribution and use rights for the CUPS Raster source
5876 + *   files are outlined in the GNU Library General Public License, located
5877 + *   in the "pstoraster" directory.  If this file is missing or damaged
5878 + *   please contact Easy Software Products at:
5879 + *
5880 + *       Attn: CUPS Licensing Information
5881 + *       Easy Software Products
5882 + *       44141 Airport View Drive, Suite 204
5883 + *       Hollywood, Maryland 20636 USA
5884 + *
5885 + *       Voice: (301) 373-9600
5886 + *       EMail: cups-info@cups.org
5887 + *         WWW: http://www.cups.org
5888 + *
5889 + *   This code and any derivative of it may be used and distributed
5890 + *   freely under the terms of the GNU General Public License when
5891 + *   used with GNU Ghostscript or its derivatives.  Use of the code
5892 + *   (or any derivative of it) with software other than GNU
5893 + *   GhostScript (or its derivatives) is governed by the CUPS license
5894 + *   agreement.
5895 + *
5896 + *   This file is subject to the Apple OS-Developed Software exception.
5897 + *
5898 + * Contents:
5899 + *
5900 + *   main()           - Benchmark the raster read/write functions.
5901 + *   compute_median() - Compute the median time for a test.
5902 + *   read_test()      - Benchmark the raster read functions.
5903 + *   write_test()     - Benchmark the raster write functions.
5904 + */
5905 +
5906 +/*
5907 + * Include necessary headers...
5908 + */
5909 +
5910 +#include "raster.h"
5911 +#include <stdlib.h>
5912 +#include <sys/time.h>
5913 +#include <signal.h>
5914 +#include <unistd.h>
5915 +#include <sys/wait.h>
5916 +
5917 +
5918 +/*
5919 + * Constants...
5920 + */
5921 +
5922 +#define TEST_WIDTH     1024
5923 +#define TEST_HEIGHT    1024
5924 +#define TEST_PAGES     16
5925 +#define TEST_PASSES    20
5926 +
5927 +
5928 +/*
5929 + * Local functions...
5930 + */
5931 +
5932 +static double  compute_median(double *secs);
5933 +static double  get_time(void);
5934 +static void    read_test(int fd);
5935 +static int     run_read_test(void);
5936 +static void    write_test(int fd);
5937 +
5938 +
5939 +/*
5940 + * 'main()' - Benchmark the raster read/write functions.
5941 + */
5942 +
5943 +int                                    /* O - Exit status */
5944 +main(void)
5945 +{
5946 +  int          i;                      /* Looping var */
5947 +  int          ras_fd,                 /* File descriptor for read process */
5948 +               status;                 /* Exit status of read process */
5949 +  double       start_secs,             /* Start time */
5950 +               write_secs,             /* Write time */
5951 +               read_secs,              /* Read time */
5952 +               pass_secs[TEST_PASSES]; /* Total test times */
5953 +
5954 +
5955 + /*
5956 +  * Ignore SIGPIPE...
5957 +  */
5958 +
5959 +  signal(SIGPIPE, SIG_IGN);
5960 +
5961 + /*
5962 +  * Run the tests several times to get a good average...
5963 +  */
5964 +
5965 +  printf("Test read/write speed of %d pages, %dx%d pixels...\n\n",
5966 +         TEST_PAGES, TEST_WIDTH, TEST_HEIGHT);
5967 +  for (i = 0; i < TEST_PASSES; i ++)
5968 +  {
5969 +    printf("PASS %2d: ", i + 1);
5970 +    fflush(stdout);
5971 +
5972 +    ras_fd     = run_read_test();
5973 +    start_secs = get_time();
5974 +
5975 +    write_test(ras_fd);
5976 +
5977 +    write_secs = get_time();
5978 +    printf(" %.3f write,", write_secs - start_secs);
5979 +    fflush(stdout);
5980 +
5981 +    close(ras_fd);
5982 +    wait(&status);
5983 +
5984 +    read_secs    = get_time();
5985 +    pass_secs[i] = read_secs - start_secs;
5986 +    printf(" %.3f read, %.3f total\n", read_secs - write_secs, pass_secs[i]);
5987 +  }
5988 +
5989 +  printf("\nMedian Total Time: %.3f seconds per document\n",
5990 +         compute_median(pass_secs));
5991 +
5992 +  return (0);
5993 +}
5994 +
5995 +
5996 +/*
5997 + * 'compute_median()' - Compute the median time for a test.
5998 + */
5999 +
6000 +static double                          /* O - Median time in seconds */
6001 +compute_median(double *secs)           /* I - Array of time samples */
6002 +{
6003 +  int          i, j;                   /* Looping vars */
6004 +  double       temp;                   /* Swap variable */
6005 +
6006 +
6007 + /*
6008 +  * Sort the array into ascending order using a quicky bubble sort...
6009 +  */
6010 +
6011 +  for (i = 0; i < (TEST_PASSES - 1); i ++)
6012 +    for (j = i + 1; j < TEST_PASSES; j ++)
6013 +      if (secs[i] > secs[j])
6014 +      {
6015 +        temp    = secs[i];
6016 +       secs[i] = secs[j];
6017 +       secs[j] = temp;
6018 +      }
6019 +
6020 + /*
6021 +  * Return the average of the middle two samples...
6022 +  */
6023 +
6024 +  return (0.5 * (secs[TEST_PASSES / 2 - 1] + secs[TEST_PASSES / 2]));
6025 +}
6026 +
6027 +
6028 +/*
6029 + * 'get_time()' - Get the current time in seconds.
6030 + */
6031 +
6032 +static double                          /* O - Time in seconds */
6033 +get_time(void)
6034 +{
6035 +  struct timeval       curtime;        /* Current time */
6036 +
6037 +
6038 +  gettimeofday(&curtime, NULL);
6039 +  return (curtime.tv_sec + 0.000001 * curtime.tv_usec);
6040 +}
6041 +
6042 +
6043 +/*
6044 + * 'read_test()' - Benchmark the raster read functions.
6045 + */
6046 +
6047 +static void
6048 +read_test(int fd)                      /* I - File descriptor to read from */
6049 +{
6050 +  int                  y;              /* Looping var */
6051 +  cups_raster_t                *r;             /* Raster stream */
6052 +  cups_page_header_t   header;         /* Page header */
6053 +  unsigned char                buffer[8 * TEST_WIDTH];
6054 +                                       /* Read buffer */
6055 +
6056 +
6057 + /*
6058 +  * Test read speed...
6059 +  */
6060 +
6061 +  if ((r = cupsRasterOpen(fd, CUPS_RASTER_READ)) == NULL)
6062 +  {
6063 +    perror("Unable to create raster input stream");
6064 +    return;
6065 +  }
6066 +
6067 +  while (cupsRasterReadHeader(r, &header))
6068 +  {
6069 +    for (y = 0; y < header.cupsHeight; y ++)
6070 +      cupsRasterReadPixels(r, buffer, header.cupsBytesPerLine);
6071 +  }
6072 +
6073 +  cupsRasterClose(r);
6074 +}
6075 +
6076 +
6077 +/*
6078 + * 'run_read_test()' - Run the read test as a child process via pipes.
6079 + */
6080 +
6081 +static int                             /* O - Standard input of child */
6082 +run_read_test(void)
6083 +{
6084 +  int  ras_pipes[2];                   /* Raster data pipes */
6085 +  int  pid;                            /* Child process ID */
6086 +
6087 +
6088 +  if (pipe(ras_pipes))
6089 +    return (-1);
6090 +
6091 +  if ((pid = fork()) < 0)
6092 +  {
6093 +   /*
6094 +    * Fork error - return -1 on error...
6095 +    */
6096 +
6097 +    close(ras_pipes[0]);
6098 +    close(ras_pipes[1]);
6099 +
6100 +    return (-1);
6101 +  }
6102 +  else if (pid == 0)
6103 +  {
6104 +   /*
6105 +    * Child comes here - read data from the input pipe...
6106 +    */
6107 +
6108 +    close(ras_pipes[1]);
6109 +    read_test(ras_pipes[0]);
6110 +    exit(0);
6111 +  }
6112 +  else
6113 +  {
6114 +   /*
6115 +    * Parent comes here - return the output pipe...
6116 +    */
6117 +
6118 +    close(ras_pipes[0]);
6119 +    return (ras_pipes[1]);
6120 +  }
6121 +}
6122 +
6123 +
6124 +/*
6125 + * 'write_test()' - Benchmark the raster write functions.
6126 + */
6127 +
6128 +static void
6129 +write_test(int fd)                     /* I - File descriptor to write to */
6130 +{
6131 +  int                  page, x, y;     /* Looping vars */
6132 +  int                  count;          /* Number of bytes to set */
6133 +  cups_raster_t                *r;             /* Raster stream */
6134 +  cups_page_header_t   header;         /* Page header */
6135 +  unsigned char                data[32][8 * TEST_WIDTH];
6136 +                                       /* Raster data to write */
6137 +
6138 +
6139 + /*
6140 +  * Create a combination of random data and repeated data to simulate
6141 +  * text with some whitespace.
6142 +  */
6143 +
6144 +  srand(time(NULL));
6145 +
6146 +  memset(data, 0, sizeof(data));
6147 +
6148 +  for (y = 0; y < 28; y ++)
6149 +  {
6150 +    for (x = rand() & 127, count = (rand() & 15) + 1;
6151 +         x < sizeof(data[0]);
6152 +         x ++, count --)
6153 +    {
6154 +      if (count <= 0)
6155 +      {
6156 +       x     += (rand() & 15) + 1;
6157 +       count = (rand() & 15) + 1;
6158 +
6159 +        if (x >= sizeof(data[0]))
6160 +         break;
6161 +      }
6162 +
6163 +      data[y][x] = rand();
6164 +    }
6165 +  }
6166 +
6167 + /*
6168 +  * Test write speed...
6169 +  */
6170 +
6171 +  if ((r = cupsRasterOpen(fd, CUPS_RASTER_WRITE)) == NULL)
6172 +  {
6173 +    perror("Unable to create raster output stream");
6174 +    return;
6175 +  }
6176 +
6177 +  for (page = 0; page < TEST_PAGES; page ++)
6178 +  {
6179 +    memset(&header, 0, sizeof(header));
6180 +    header.cupsWidth        = TEST_WIDTH;
6181 +    header.cupsHeight       = TEST_HEIGHT;
6182 +    header.cupsBytesPerLine = TEST_WIDTH;
6183 +
6184 +    if (page & 1)
6185 +    {
6186 +      header.cupsBytesPerLine *= 4;
6187 +      header.cupsColorSpace = CUPS_CSPACE_CMYK;
6188 +      header.cupsColorOrder = CUPS_ORDER_CHUNKED;
6189 +    }
6190 +    else
6191 +    {
6192 +      header.cupsColorSpace = CUPS_CSPACE_K;
6193 +      header.cupsColorOrder = CUPS_ORDER_BANDED;
6194 +    }
6195 +
6196 +    if (page & 2)
6197 +    {
6198 +      header.cupsBytesPerLine *= 2;
6199 +      header.cupsBitsPerColor = 16;
6200 +      header.cupsBitsPerPixel = (page & 1) ? 64 : 16;
6201 +    }
6202 +    else
6203 +    {
6204 +      header.cupsBitsPerColor = 8;
6205 +      header.cupsBitsPerPixel = (page & 1) ? 32 : 8;
6206 +    }
6207 +
6208 +    cupsRasterWriteHeader(r, &header);
6209 +
6210 +    for (y = 0; y < TEST_HEIGHT; y ++)
6211 +      cupsRasterWritePixels(r, data[y & 31], header.cupsBytesPerLine);
6212 +  }
6213 +
6214 +  cupsRasterClose(r);
6215 +}
6216 +
6217 +
6218 +/*
6219 + * End of "$Id$".
6220 + */
6221 diff -durN release-1.2.1/filter/raster.c cups-1.2.x/filter/raster.c
6222 --- release-1.2.1/filter/raster.c       2006-07-04 17:35:19.000000000 +0100
6223 +++ cups-1.2.x/filter/raster.c  2006-06-26 12:45:28.000000000 +0100
6224 @@ -1,5 +1,5 @@
6225  /*
6226 - * "$Id$"
6227 + * "$Id$"
6228   *
6229   *   Raster file routines for the Common UNIX Printing System (CUPS).
6230   *
6231 @@ -34,23 +34,25 @@
6232   *
6233   * Contents:
6234   *
6235 - *   cupsRasterClose()        - Close a raster stream.
6236 - *   cupsRasterOpen()         - Open a raster stream.
6237 - *   cupsRasterReadHeader()   - Read a raster page header and store it in a
6238 - *                              V1 page header structure.
6239 - *   cupsRasterReadHeader2()  - Read a raster page header and store it in a
6240 - *                              V2 page header structure.
6241 - *   cupsRasterReadPixels()   - Read raster pixels.
6242 - *   cupsRasterWriteHeader()  - Write a raster page header from a V1 page
6243 - *                              header structure.
6244 - *   cupsRasterWriteHeader2() - Write a raster page header from a V2 page
6245 - *                              header structure.
6246 - *   cupsRasterWritePixels()  - Write raster pixels.
6247 - *   cups_raster_update()     - Update the raster header and row count for the
6248 - *                              current page.
6249 - *   cups_raster_write()      - Write a row of raster data...
6250 - *   cups_read()              - Read bytes from a file.
6251 - *   cups_write()             - Write bytes to a file.
6252 + *   cupsRasterClose()         - Close a raster stream.
6253 + *   cupsRasterOpen()          - Open a raster stream.
6254 + *   cupsRasterReadHeader()    - Read a raster page header and store it in a
6255 + *                               V1 page header structure.
6256 + *   cupsRasterReadHeader2()   - Read a raster page header and store it in a
6257 + *                               V2 page header structure.
6258 + *   cupsRasterReadPixels()    - Read raster pixels.
6259 + *   cupsRasterWriteHeader()   - Write a raster page header from a V1 page
6260 + *                               header structure.
6261 + *   cupsRasterWriteHeader2()  - Write a raster page header from a V2 page
6262 + *                               header structure.
6263 + *   cupsRasterWritePixels()   - Write raster pixels.
6264 + *   cups_raster_read()        - Read through the raster buffer.
6265 + *   cups_raster_read_header() - Read a raster page header.
6266 + *   cups_raster_update()      - Update the raster header and row count for the
6267 + *                               current page.
6268 + *   cups_read()               - Read bytes from a file.
6269 + *   cups_swap()               - Swap bytes in raster data...
6270 + *   cups_write()              - Write bytes to a file.
6271   */
6272  
6273  /*
6274 @@ -58,7 +60,7 @@
6275   */
6276  
6277  #include "raster.h"
6278 -#include <stdio.h>
6279 +#include <cups/debug.h>
6280  #include <stdlib.h>
6281  #include <errno.h>
6282  #include <cups/string.h>
6283 @@ -86,16 +88,25 @@
6284    unsigned char                *pixels,        /* Pixels for current row */
6285                         *pend,          /* End of pixel buffer */
6286                         *pcurrent;      /* Current byte in pixel buffer */
6287 +  int                  compressed,     /* Non-zero if data is compressed */
6288 +                       swapped;        /* Non-zero if data is byte-swapped */
6289 +  unsigned char                *buffer,        /* Read/write buffer */
6290 +                       *bufptr,        /* Current (read) position in buffer */
6291 +                       *bufend;        /* End of current (read) buffer */
6292 +  int                  bufsize;        /* Buffer size */
6293  };
6294  
6295 +
6296  /*
6297   * Local functions...
6298   */
6299  
6300  static unsigned        cups_raster_read_header(cups_raster_t *r);
6301 +static int     cups_raster_read(cups_raster_t *r, unsigned char *buf,
6302 +                                int bytes);
6303  static void    cups_raster_update(cups_raster_t *r);
6304 -static int     cups_raster_write(cups_raster_t *r);
6305  static int     cups_read(int fd, unsigned char *buf, int bytes);
6306 +static void    cups_swap(unsigned char *buf, int bytes);
6307  static int     cups_write(int fd, const unsigned char *buf, int bytes);
6308  
6309  
6310 @@ -108,6 +119,9 @@
6311  {
6312    if (r != NULL)
6313    {
6314 +    if (r->buffer)
6315 +      free(r->buffer);
6316 +
6317      if (r->pixels)
6318        free(r->pixels);
6319  
6320 @@ -139,8 +153,7 @@
6321      * Open for read - get sync word...
6322      */
6323  
6324 -    if (cups_read(r->fd, (unsigned char *)&(r->sync), sizeof(r->sync))
6325 -            < sizeof(r->sync))
6326 +    if (!cups_read(r->fd, (unsigned char *)&(r->sync), sizeof(r->sync)))
6327      {
6328        free(r);
6329        return (NULL);
6330 @@ -149,11 +162,22 @@
6331      if (r->sync != CUPS_RASTER_SYNC &&
6332          r->sync != CUPS_RASTER_REVSYNC &&
6333          r->sync != CUPS_RASTER_SYNCv1 &&
6334 -        r->sync != CUPS_RASTER_REVSYNCv1)
6335 +        r->sync != CUPS_RASTER_REVSYNCv1 &&
6336 +        r->sync != CUPS_RASTER_SYNCv2 &&
6337 +        r->sync != CUPS_RASTER_REVSYNCv2)
6338      {
6339        free(r);
6340        return (NULL);
6341      }
6342 +
6343 +    if (r->sync == CUPS_RASTER_SYNCv2 ||
6344 +        r->sync == CUPS_RASTER_REVSYNCv2)
6345 +      r->compressed = 1;
6346 +
6347 +    if (r->sync == CUPS_RASTER_REVSYNC ||
6348 +        r->sync == CUPS_RASTER_REVSYNCv1 ||
6349 +        r->sync == CUPS_RASTER_REVSYNCv2)
6350 +      r->swapped = 1;
6351    }
6352    else
6353    {
6354 @@ -162,6 +186,7 @@
6355      */
6356  
6357      r->sync = CUPS_RASTER_SYNC;
6358 +
6359      if (cups_write(r->fd, (unsigned char *)&(r->sync), sizeof(r->sync))
6360              < sizeof(r->sync))
6361      {
6362 @@ -240,15 +265,51 @@
6363                      unsigned      len) /* I - Number of bytes to read */
6364  {
6365    int          bytes;                  /* Bytes read */
6366 +  unsigned     cupsBytesPerLine;       /* cupsBytesPerLine value */
6367    unsigned     remaining;              /* Bytes remaining */
6368    unsigned char        *ptr,                   /* Pointer to read buffer */
6369 -               byte;                   /* Byte from file */
6370 +               byte,                   /* Byte from file */
6371 +               *temp;                  /* Pointer into buffer */
6372 +  int          count;                  /* Repetition count */
6373  
6374  
6375    if (r == NULL || r->mode != CUPS_RASTER_READ || r->remaining == 0)
6376      return (0);
6377  
6378 -  remaining = len;
6379 +  if (!r->compressed)
6380 +  {
6381 +   /*
6382 +    * Read without compression...
6383 +    */
6384 +
6385 +    r->remaining -= len / r->header.cupsBytesPerLine;
6386 +
6387 +    if (!cups_read(r->fd, p, len))
6388 +      return (0);
6389 +
6390 +   /*
6391 +    * Swap bytes as needed...
6392 +    */
6393 +
6394 +    if ((r->header.cupsBitsPerColor == 16 ||
6395 +         r->header.cupsBitsPerPixel == 12 ||
6396 +         r->header.cupsBitsPerPixel == 16) &&
6397 +        r->swapped)
6398 +      cups_swap(p, len);
6399 +
6400 +   /*
6401 +    * Return...
6402 +    */
6403 +
6404 +    return (len);
6405 +  }
6406 +
6407 + /*
6408 +  * Read compressed data...
6409 +  */
6410 +
6411 +  remaining        = len;
6412 +  cupsBytesPerLine = r->header.cupsBytesPerLine;
6413  
6414    while (remaining > 0 && r->remaining > 0)
6415    {
6416 @@ -258,127 +319,99 @@
6417        * Need to read a new row...
6418        */
6419  
6420 -      if (remaining == r->header.cupsBytesPerLine)
6421 +      if (remaining == cupsBytesPerLine)
6422         ptr = p;
6423        else
6424         ptr = r->pixels;
6425  
6426 -      if (r->sync == CUPS_RASTER_SYNCv1 || r->sync == CUPS_RASTER_REVSYNCv1)
6427 -      {
6428 -       /*
6429 -       * Read without compression...
6430 -       */
6431 +     /*
6432 +      * Read using a modified TIFF "packbits" compression...
6433 +      */
6434  
6435 -        if (cups_read(r->fd, ptr, r->header.cupsBytesPerLine) <
6436 -               r->header.cupsBytesPerLine)
6437 -         return (0);
6438 +      if (!cups_raster_read(r, &byte, 1))
6439 +       return (0);
6440  
6441 -        r->count = 1;
6442 -      }
6443 -      else
6444 +      r->count = byte + 1;
6445 +
6446 +      if (r->count > 1)
6447 +       ptr = r->pixels;
6448 +
6449 +      temp  = ptr;
6450 +      bytes = cupsBytesPerLine;
6451 +
6452 +      while (bytes > 0)
6453        {
6454         /*
6455 -        * Read using a modified TIFF "packbits" compression...
6456 +       * Get a new repeat count...
6457         */
6458  
6459 -        unsigned char  *temp;          /* Pointer into buffer */
6460 -       int             count;          /* Repetition count */
6461 -
6462 -
6463 -        if (cups_read(r->fd, &byte, 1) < 1)
6464 +        if (!cups_raster_read(r, &byte, 1))
6465           return (0);
6466  
6467 -        r->count = byte + 1;
6468 -
6469 -        if (r->count > 1)
6470 -         ptr = r->pixels;
6471 -
6472 -        temp  = ptr;
6473 -       bytes = r->header.cupsBytesPerLine;
6474 -
6475 -       while (bytes > 0)
6476 +       if (byte & 128)
6477         {
6478          /*
6479 -         * Get a new repeat count...
6480 +         * Copy N literal pixels...
6481           */
6482  
6483 -          if (cups_read(r->fd, &byte, 1) < 1)
6484 -           return (0);
6485 -
6486 -         if (byte & 128)
6487 -         {
6488 -          /*
6489 -           * Copy N literal pixels...
6490 -           */
6491 +         count = (257 - byte) * r->bpp;
6492  
6493 -           count = (257 - byte) * r->bpp;
6494 +          if (count > bytes)
6495 +           count = bytes;
6496  
6497 -            if (count > bytes)
6498 -             count = bytes;
6499 +          if (!cups_raster_read(r, temp, count))
6500 +           return (0);
6501  
6502 -            if (cups_read(r->fd, temp, count) < count)
6503 -             return (0);
6504 +         temp  += count;
6505 +         bytes -= count;
6506 +       }
6507 +       else
6508 +       {
6509 +        /*
6510 +         * Repeat the next N bytes...
6511 +         */
6512  
6513 -           temp  += count;
6514 -           bytes -= count;
6515 -         }
6516 -         else
6517 -         {
6518 -          /*
6519 -           * Repeat the next N bytes...
6520 -           */
6521 +          count = (byte + 1) * r->bpp;
6522 +          if (count > bytes)
6523 +           count = bytes;
6524  
6525 -            count = (byte + 1) * r->bpp;
6526 -            if (count > bytes)
6527 -             count = bytes;
6528 +          if (count < r->bpp)
6529 +           break;
6530  
6531 -            if (count < r->bpp)
6532 -             break;
6533 +         bytes -= count;
6534  
6535 -           bytes -= count;
6536 +          if (!cups_raster_read(r, temp, r->bpp))
6537 +           return (0);
6538  
6539 -            if (cups_read(r->fd, temp, r->bpp) < r->bpp)
6540 -             return (0);
6541 +         temp  += r->bpp;
6542 +         count -= r->bpp;
6543  
6544 +         while (count > 0)
6545 +         {
6546 +           memcpy(temp, temp - r->bpp, r->bpp);
6547             temp  += r->bpp;
6548             count -= r->bpp;
6549 -
6550 -           while (count > 0)
6551 -           {
6552 -             memcpy(temp, temp - r->bpp, r->bpp);
6553 -             temp  += r->bpp;
6554 -             count -= r->bpp;
6555 -            }
6556 -         }
6557 +          }
6558         }
6559        }
6560  
6561 +     /*
6562 +      * Swap bytes as needed...
6563 +      */
6564 +
6565        if ((r->header.cupsBitsPerColor == 16 ||
6566             r->header.cupsBitsPerPixel == 12 ||
6567             r->header.cupsBitsPerPixel == 16) &&
6568 -          (r->sync == CUPS_RASTER_REVSYNC || r->sync == CUPS_RASTER_REVSYNCv1))
6569 -      {
6570 -       /*
6571 -       * Swap bytes in the pixel data...
6572 -       */
6573 -
6574 -        unsigned char  *temp;
6575 -       int             count;
6576 -
6577 +          r->swapped)
6578 +        cups_swap(ptr, bytes);
6579  
6580 -        for (temp = ptr, count = r->header.cupsBytesPerLine;
6581 -            count > 0;
6582 -            temp += 2, count -= 2)
6583 -       {
6584 -         byte    = temp[0];
6585 -         temp[0] = temp[1];
6586 -         temp[1] = byte;
6587 -       }
6588 -      }
6589 +     /*
6590 +      * Update pointers...
6591 +      */
6592  
6593 -      if (remaining >= r->header.cupsBytesPerLine)
6594 +      if (remaining >= cupsBytesPerLine)
6595        {
6596 -       bytes       = r->header.cupsBytesPerLine;
6597 +       bytes       = cupsBytesPerLine;
6598          r->pcurrent = r->pixels;
6599         r->count --;
6600         r->remaining --;
6601 @@ -389,6 +422,10 @@
6602          r->pcurrent = r->pixels + bytes;
6603        }
6604  
6605 +     /*
6606 +      * Copy data as needed...
6607 +      */
6608 +
6609        if (ptr != p)
6610          memcpy(p, ptr, bytes);
6611      }
6612 @@ -494,10 +531,6 @@
6613                        unsigned char *p,        /* I - Bytes to write */
6614                       unsigned      len)/* I - Number of bytes to write */
6615  {
6616 -  int          bytes;                  /* Bytes read */
6617 -  unsigned     remaining;              /* Bytes remaining */
6618 -
6619 -
6620  #ifdef DEBUG
6621    fprintf(stderr, "cupsRasterWritePixels(r=%p, p=%p, len=%u), remaining=%u\n",
6622            r, p, len, r->remaining);
6623 @@ -506,99 +539,13 @@
6624    if (r == NULL || r->mode != CUPS_RASTER_WRITE || r->remaining == 0)
6625      return (0);
6626  
6627 -  for (remaining = len; remaining > 0; remaining -= bytes, p += bytes)
6628 -
6629 -  {
6630 -   /*
6631 -    * Figure out the number of remaining bytes on the current line...
6632 -    */
6633 -
6634 -    if ((bytes = remaining) > (r->pend - r->pcurrent))
6635 -      bytes = r->pend - r->pcurrent;
6636 -
6637 -    if (r->count > 0)
6638 -    {
6639 -     /*
6640 -      * Check to see if this line is the same as the previous line...
6641 -      */
6642 -
6643 -      if (memcmp(p, r->pcurrent, bytes))
6644 -      {
6645 -        if (!cups_raster_write(r))
6646 -         return (0);
6647 -
6648 -       r->count = 0;
6649 -      }
6650 -      else
6651 -      {
6652 -       /*
6653 -        * Mark more bytes as the same...
6654 -       */
6655 -
6656 -        r->pcurrent += bytes;
6657 -
6658 -       if (r->pcurrent >= r->pend)
6659 -       {
6660 -        /*
6661 -          * Increase the repeat count...
6662 -         */
6663 -
6664 -         r->count ++;
6665 -         r->pcurrent = r->pixels;
6666 -
6667 -        /*
6668 -          * Flush out this line if it is the last one...
6669 -         */
6670 -
6671 -         r->remaining --;
6672 -
6673 -         if (r->remaining == 0)
6674 -           return (cups_raster_write(r));
6675 -         else if (r->count == 256)
6676 -         {
6677 -           if (cups_raster_write(r) == 0)
6678 -             return (0);
6679 -
6680 -           r->count = 0;
6681 -         }
6682 -       }
6683 -
6684 -       continue;
6685 -      }
6686 -    }
6687 -
6688 -    if (r->count == 0)
6689 -    {
6690 -     /*
6691 -      * Copy the raster data to the buffer...
6692 -      */
6693 -
6694 -      memcpy(r->pcurrent, p, bytes);
6695 -
6696 -      r->pcurrent += bytes;
6697 -
6698 -      if (r->pcurrent >= r->pend)
6699 -      {
6700 -       /*
6701 -        * Increase the repeat count...
6702 -       */
6703 -
6704 -       r->count ++;
6705 -       r->pcurrent = r->pixels;
6706 -
6707 -       /*
6708 -        * Flush out this line if it is the last one...
6709 -       */
6710 -
6711 -       r->remaining --;
6712 + /*
6713 +  * No write compression, just write the raster data raw...
6714 +  */
6715  
6716 -       if (r->remaining == 0)
6717 -         return (cups_raster_write(r));
6718 -      }
6719 -    }
6720 -  }
6721 +  r->remaining -= len / r->header.cupsBytesPerLine;
6722  
6723 -  return (len);
6724 +  return (cups_write(r->fd, p, len));
6725  }
6726  
6727  
6728 @@ -636,14 +583,14 @@
6729  
6730    memset(&(r->header), 0, sizeof(r->header));
6731  
6732 -  if (cups_read(r->fd, (unsigned char *)&(r->header), len) < len)
6733 +  if (cups_raster_read(r, (unsigned char *)&(r->header), len) < len)
6734      return (0);
6735  
6736   /*
6737    * Swap bytes as needed...
6738    */
6739  
6740 -  if (r->sync == CUPS_RASTER_REVSYNC || r->sync == CUPS_RASTER_REVSYNCv1)
6741 +  if (r->swapped)
6742      for (len = 81, s = (union swap_s *)&(r->header.AdvanceDistance);
6743          len > 0;
6744          len --, s ++)
6745 @@ -660,6 +607,144 @@
6746  
6747  
6748  /*
6749 + * 'cups_raster_read()' - Read through the raster buffer.
6750 + */
6751 +
6752 +static int                             /* O - Number of bytes read */
6753 +cups_raster_read(cups_raster_t *r,     /* I - Raster stream */
6754 +                 unsigned char *buf,   /* I - Buffer */
6755 +                 int           bytes)  /* I - Number of bytes to read */
6756 +{
6757 +  int          count,                  /* Number of bytes read */
6758 +               remaining,              /* Remaining bytes in buffer */
6759 +               total;                  /* Total bytes read */
6760 +
6761 +
6762 +  DEBUG_printf(("cups_raster_read(r=%p, buf=%p, bytes=%d)\n", r, buf, bytes));
6763 +
6764 +  if (!r->compressed)
6765 +    return (cups_read(r->fd, buf, bytes));
6766 +
6767 + /*
6768 +  * Allocate a read buffer as needed...
6769 +  */
6770 +
6771 +  count = 2 * r->header.cupsBytesPerLine;
6772 +
6773 +  if (count > r->bufsize)
6774 +  {
6775 +    int offset = r->bufptr - r->buffer;        /* Offset to current start of buffer */
6776 +    int end = r->bufend - r->buffer;   /* Offset to current end of buffer */
6777 +    unsigned char *rptr;               /* Pointer in read buffer */
6778 +
6779 +    if (r->buffer)
6780 +      rptr = realloc(r->buffer, count);
6781 +    else
6782 +      rptr = malloc(count);
6783 +
6784 +    if (!rptr)
6785 +      return (0);
6786 +
6787 +    r->buffer  = rptr;
6788 +    r->bufptr  = rptr + offset;
6789 +    r->bufend  = rptr + end;
6790 +    r->bufsize = count;
6791 +  }
6792 +
6793 + /*
6794 +  * Loop until we have read everything...
6795 +  */
6796 +
6797 +  for (total = 0, remaining = r->bufend - r->bufptr;
6798 +       total < bytes;
6799 +       total += count, buf += count)
6800 +  {
6801 +    count = bytes - total;
6802 +
6803 +    DEBUG_printf(("count=%d, remaining=%d, buf=%p, bufptr=%p, bufend=%p...\n",
6804 +                  count, remaining, buf, r->bufptr, r->bufend));
6805 +
6806 +    if (remaining == 0)
6807 +    {
6808 +      if (count < 16)
6809 +      {
6810 +       /*
6811 +        * Read into the raster buffer and then copy...
6812 +       */
6813 +
6814 +        remaining = cups_read(r->fd, r->buffer, r->bufsize);
6815 +       if (remaining <= 0)
6816 +         return (0);
6817 +
6818 +       r->bufptr = r->buffer;
6819 +       r->bufend = r->buffer + remaining;
6820 +      }
6821 +      else
6822 +      {
6823 +       /*
6824 +        * Read directly into "buf"...
6825 +       */
6826 +
6827 +       count = cups_read(r->fd, buf, count);
6828 +
6829 +       if (count <= 0)
6830 +         return (0);
6831 +
6832 +       continue;
6833 +      }
6834 +    }
6835 +
6836 +   /*
6837 +    * Copy bytes from raster buffer to "buf"...
6838 +    */
6839 +
6840 +    if (count > remaining)
6841 +      count = remaining;
6842 +
6843 +    if (count == 1)
6844 +    {
6845 +     /*
6846 +      * Copy 1 byte...
6847 +      */
6848 +
6849 +      *buf = *(r->bufptr)++;
6850 +      remaining --;
6851 +    }
6852 +    else if (count < 128)
6853 +    {
6854 +     /*
6855 +      * Copy up to 127 bytes without using memcpy(); this is
6856 +      * faster because it avoids an extra function call and is
6857 +      * often further optimized by the compiler...
6858 +      */
6859 +
6860 +      unsigned char    *bufptr;        /* Temporary buffer pointer */
6861 +
6862 +
6863 +      remaining -= count;
6864 +
6865 +      for (bufptr = r->bufptr; count > 0; count --, total ++)
6866 +       *buf++ = *bufptr++;
6867 +
6868 +      r->bufptr = bufptr;
6869 +    }
6870 +    else
6871 +    {
6872 +     /*
6873 +      * Use memcpy() for a large read...
6874 +      */
6875 +
6876 +      memcpy(buf, r->bufptr, count);
6877 +      r->bufptr += count;
6878 +      remaining -= count;
6879 +    }
6880 +  }
6881 +
6882 +  return (total);
6883 +}
6884 +
6885 +
6886 +/*
6887   * 'cups_raster_update()' - Update the raster header and row count for the
6888   *                          current page.
6889   */
6890 @@ -745,159 +830,19 @@
6891      r->remaining = r->header.cupsHeight;
6892  
6893   /*
6894 -  * Allocate the read/write buffer...
6895 -  */
6896 -
6897 -  if (r->pixels != NULL)
6898 -    free(r->pixels);
6899 -
6900 -  r->pixels   = calloc(r->header.cupsBytesPerLine, 1);
6901 -  r->pcurrent = r->pixels;
6902 -  r->pend     = r->pixels + r->header.cupsBytesPerLine;
6903 -  r->count    = 0;
6904 -}
6905 -
6906 -
6907 -/*
6908 - * 'cups_raster_write()' - Write a row of raster data...
6909 - */
6910 -
6911 -static int                             /* O - Number of bytes written */
6912 -cups_raster_write(cups_raster_t *r)    /* I - Raster stream */
6913 -{
6914 -  unsigned char        *start,                 /* Start of sequence */
6915 -               *ptr,                   /* Current pointer in sequence */
6916 -               byte;                   /* Byte to write */
6917 -  int          count;                  /* Count */
6918 -
6919 -
6920 -#ifdef DEBUG
6921 -  fprintf(stderr, "cups_raster_write(r=%p)\n", r);
6922 -#endif /* DEBUG */
6923 -
6924 - /*
6925 -  * Write the row repeat count...
6926 -  */
6927 -
6928 -  byte = r->count - 1;
6929 -
6930 -  if (cups_write(r->fd, &byte, 1) < 1)
6931 -  {
6932 -#ifdef DEBUG
6933 -    fputs("cups_raster_write: Unable to write row repeat count...\n",
6934 -          stderr);
6935 -#endif /* DEBUG */
6936 -
6937 -    return (0);
6938 -  }
6939 -
6940 - /*
6941 -  * Write using a modified TIFF "packbits" compression...
6942 +  * Allocate the compression buffer...
6943    */
6944  
6945 -  for (ptr = r->pixels; ptr < r->pend;)
6946 +  if (r->compressed)
6947    {
6948 -    start = ptr;
6949 -    ptr += r->bpp;
6950 -
6951 -    if (ptr == r->pend)
6952 -    {
6953 -     /*
6954 -      * Encode a single pixel at the end...
6955 -      */
6956 -
6957 -      byte = 0;
6958 -      if (cups_write(r->fd, &byte, 1) < 1)
6959 -      {
6960 -#ifdef DEBUG
6961 -        fputs("cups_raster_write: Unable to write last pixel count...\n", stderr);
6962 -#endif /* DEBUG */
6963 -
6964 -        return (0);
6965 -      }
6966 -
6967 -      if (cups_write(r->fd, start, r->bpp) < r->bpp)
6968 -      {
6969 -#ifdef DEBUG
6970 -        fputs("cups_raster_write: Unable to write last pixel data...\n", stderr);
6971 -#endif /* DEBUG */
6972 -
6973 -        return (0);
6974 -      }
6975 -    }
6976 -    else if (!memcmp(start, ptr, r->bpp))
6977 -    {
6978 -     /*
6979 -      * Encode a sequence of repeating pixels...
6980 -      */
6981 -
6982 -      for (count = 2; count < 128 && ptr < (r->pend - r->bpp); count ++, ptr += r->bpp)
6983 -        if (memcmp(ptr, ptr + r->bpp, r->bpp) != 0)
6984 -         break;
6985 -
6986 -      ptr += r->bpp;
6987 -
6988 -      byte = count - 1;
6989 -
6990 -      if (cups_write(r->fd, &byte, 1) < 1)
6991 -      {
6992 -#ifdef DEBUG
6993 -        fputs("cups_raster_write: Unable to write repeated pixel count...\n", stderr);
6994 -#endif /* DEBUG */
6995 -
6996 -        return (0);
6997 -      }
6998 -
6999 -      if (cups_write(r->fd, start, r->bpp) < r->bpp)
7000 -      {
7001 -#ifdef DEBUG
7002 -        fputs("cups_raster_write: Unable to write repeated pixel data...\n", stderr);
7003 -#endif /* DEBUG */
7004 -
7005 -        return (0);
7006 -      }
7007 -    }
7008 -    else
7009 -    {
7010 -     /*
7011 -      * Encode a sequence of non-repeating pixels...
7012 -      */
7013 -
7014 -      for (count = 1; count < 127 && ptr < (r->pend - r->bpp); count ++, ptr += r->bpp)
7015 -        if (!memcmp(ptr, ptr + r->bpp, r->bpp))
7016 -         break;
7017 -
7018 -      if (ptr >= (r->pend - r->bpp) && count < 128)
7019 -      {
7020 -        count ++;
7021 -       ptr += r->bpp;
7022 -      }
7023
7024 -      byte = 257 - count;
7025 -
7026 -      if (cups_write(r->fd, &byte, 1) < 1)
7027 -      {
7028 -#ifdef DEBUG
7029 -        fputs("cups_raster_write: Unable to write non-repeating pixel count...\n", stderr);
7030 -#endif /* DEBUG */
7031 -
7032 -        return (0);
7033 -      }
7034 -
7035 -      count *= r->bpp;
7036 -
7037 -      if (cups_write(r->fd, start, count) < count)
7038 -      {
7039 -#ifdef DEBUG
7040 -        fputs("cups_raster_write: Unable to write non-repeating pixel data...\n", stderr);
7041 -#endif /* DEBUG */
7042 +    if (r->pixels != NULL)
7043 +      free(r->pixels);
7044  
7045 -        return (0);
7046 -      }
7047 -    }
7048 +    r->pixels   = calloc(r->header.cupsBytesPerLine, 1);
7049 +    r->pcurrent = r->pixels;
7050 +    r->pend     = r->pixels + r->header.cupsBytesPerLine;
7051 +    r->count    = 0;
7052    }
7053 -
7054 -  return (r->header.cupsBytesPerLine);
7055  }
7056  
7057  
7058 @@ -934,6 +879,32 @@
7059  
7060  
7061  /*
7062 + * 'cups_swap()' - Swap bytes in raster data...
7063 + */
7064 +
7065 +static void
7066 +cups_swap(unsigned char *buf,          /* I - Buffer to swap */
7067 +          int           bytes)         /* I - Number of bytes to swap */
7068 +{
7069 +  unsigned char        even, odd;              /* Temporary variables */
7070 +
7071 +
7072 +  bytes /= 2;
7073 +
7074 +  while (bytes > 0)
7075 +  {
7076 +    even   = buf[0];
7077 +    odd    = buf[1];
7078 +    buf[0] = odd;
7079 +    buf[1] = even;
7080 +
7081 +    buf += 2;
7082 +    bytes --;
7083 +  }
7084 +}
7085 +
7086 +
7087 +/*
7088   * 'cups_write()' - Write bytes to a file.
7089   */
7090  
7091 @@ -964,5 +935,5 @@
7092  
7093  
7094  /*
7095 - * End of "$Id$".
7096 + * End of "$Id$".
7097   */
7098 diff -durN release-1.2.1/filter/raster.h cups-1.2.x/filter/raster.h
7099 --- release-1.2.1/filter/raster.h       2006-07-04 17:35:19.000000000 +0100
7100 +++ cups-1.2.x/filter/raster.h  2006-06-26 12:45:28.000000000 +0100
7101 @@ -1,5 +1,5 @@
7102  /*
7103 - * "$Id$"
7104 + * "$Id$"
7105   *
7106   *   Raster file definitions for the Common UNIX Printing System (CUPS).
7107   *
7108 @@ -60,12 +60,15 @@
7109   * Constants...
7110   */
7111  
7112 -#  define CUPS_RASTER_SYNC     0x52615332      /* RaS2 */
7113 -#  define CUPS_RASTER_REVSYNC  0x32536152      /* 2SaR */
7114 +#  define CUPS_RASTER_SYNC     0x52615333      /* RaS3 */
7115 +#  define CUPS_RASTER_REVSYNC  0x33536152      /* 3SaR */
7116  
7117  #  define CUPS_RASTER_SYNCv1   0x52615374      /* RaSt */
7118  #  define CUPS_RASTER_REVSYNCv1        0x74536152      /* tSaR */
7119  
7120 +#  define CUPS_RASTER_SYNCv2   0x52615332      /* RaS2 */
7121 +#  define CUPS_RASTER_REVSYNCv2        0x32536152      /* 2SaR */
7122 +
7123  
7124  /*
7125   * The following definition can be used to determine if the
7126 @@ -342,5 +345,5 @@
7127  #endif /* !_CUPS_RASTER_H_ */
7128  
7129  /*
7130 - * End of "$Id$".
7131 + * End of "$Id$".
7132   */
7133 diff -durN release-1.2.1/filter/rastertolabel.c cups-1.2.x/filter/rastertolabel.c
7134 --- release-1.2.1/filter/rastertolabel.c        2006-07-04 17:35:19.000000000 +0100
7135 +++ cups-1.2.x/filter/rastertolabel.c   2006-07-04 17:28:24.000000000 +0100
7136 @@ -1,5 +1,5 @@
7137  /*
7138 - * "$Id$"
7139 + * "$Id$"
7140   *
7141   *   Label printer filter for the Common UNIX Printing System (CUPS).
7142   *
7143 @@ -352,6 +352,8 @@
7144          printf("! 0 %u %u %u %u\r\n", header->HWResolution[0],
7145                header->HWResolution[1], header->cupsHeight,
7146                header->NumCopies);
7147 +       printf("PAGE-WIDTH %d\r\n", header->cupsWidth);
7148 +       printf("PAGE-HEIGHT %d\r\n", header->cupsWidth);
7149          break;
7150    }
7151  
7152 @@ -588,7 +590,10 @@
7153          * Print the label...
7154         */
7155  
7156 -        puts("FORM\r");
7157 +       if ((choice = ppdFindMarkedChoice(ppd, "zeMediaTracking")) == NULL ||
7158 +           strcmp(choice->choice, "Continuous"))
7159 +          puts("FORM\r");
7160 +
7161         puts("PRINT\r");
7162         break;
7163    }
7164 @@ -647,7 +652,7 @@
7165  {
7166    int          i;                      /* Looping var */
7167    unsigned char        *ptr;                   /* Pointer into buffer */
7168 -  char         *compptr;               /* Pointer into compression buffer */
7169 +  unsigned char        *compptr;               /* Pointer into compression buffer */
7170    char         repeat_char;            /* Repeated character */
7171    int          repeat_count;           /* Number of repeated characters */
7172    static const char *hex = "0123456789ABCDEF";
7173 @@ -1003,5 +1008,5 @@
7174  
7175  
7176  /*
7177 - * End of "$Id$".
7178 + * End of "$Id$".
7179   */
7180 diff -durN release-1.2.1/locale/cups_es.po cups-1.2.x/locale/cups_es.po
7181 --- release-1.2.1/locale/cups_es.po     2006-07-04 17:32:18.000000000 +0100
7182 +++ cups-1.2.x/locale/cups_es.po        2006-06-26 12:42:47.000000000 +0100
7183 @@ -1,29 +1,32 @@
7184 +#
7185  # "$Id$"
7186 -# Message catalog template for the Common UNIX Printing System (CUPS).
7187 -# Copyright 2005-2006 by Easy Software Products.
7188 -# These coded instructions, statements, and computer programs are the
7189 -# property of Easy Software Products and are protected by Federal
7190 -# copyright law.  Distribution and use rights are outlined in the file
7191 -# "LICENSE.txt" which should have been included with this file.  If this
7192 -# file is missing or damaged please contact Easy Software Products
7193 -# at:
7194 -# Attn: CUPS Licensing Information
7195 -# Easy Software Products
7196 -# 44141 Airport View Drive, Suite 204
7197 -# Hollywood, Maryland 20636 USA
7198 -# Voice: (301) 373-9600
7199 -# EMail: cups-info@cups.org
7200 -# WWW: http://www.cups.org
7201 -# , fuzzy
7202 -# <>, 2006.
7203 -# 
7204 -# 
7205 +#
7206 +#   Spanish message catalog for the Common UNIX Printing System (CUPS).
7207 +#
7208 +#   Copyright 2005-2006 by Easy Software Products.
7209 +#
7210 +#   These coded instructions, statements, and computer programs are the
7211 +#   property of Easy Software Products and are protected by Federal
7212 +#   copyright law.  Distribution and use rights are outlined in the file
7213 +#   "LICENSE.txt" which should have been included with this file.  If this
7214 +#   file is missing or damaged please contact Easy Software Products
7215 +#   at:
7216 +#
7217 +#       Attn: CUPS Licensing Information
7218 +#       Easy Software Products
7219 +#       44141 Airport View Drive, Suite 204
7220 +#       Hollywood, Maryland 20636 USA
7221 +#
7222 +#       Voice: (301) 373-9600
7223 +#       EMail: cups-info@cups.org
7224 +#         WWW: http://www.cups.org
7225 +#
7226  msgid ""
7227  msgstr ""
7228  "Project-Id-Version: CUPS 1.2\n"
7229  "Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
7230 -"POT-Creation-Date: 2006-05-21 10:08-0400\n"
7231 -"PO-Revision-Date: 2006-03-25 21:48+0100\n"
7232 +"POT-Creation-Date: 2006-05-21 10:07-0400\n"
7233 +"PO-Revision-Date: 2006-06-12 19:01+0100\n"
7234  "Last-Translator: Juan Pablo González Riopedre <riopedre@tiscali.es>\n"
7235  "Language-Team: Spanish\n"
7236  "MIME-Version: 1.0\n"
7237 @@ -72,19 +75,15 @@
7238  msgid "Auto"
7239  msgstr "Auto"
7240  
7241 -msgid ""
7242 -"Enter your username and password or the root username and password to access "
7243 -"this page."
7244 -msgstr ""
7245 -"Introduzca su nombre de usuario y contraseña o el nombre de usuario y "
7246 -"contraseña de root para poder acceder a esta página."
7247 +msgid "Enter your username and password or the root username and password to access this page."
7248 +msgstr "Introduzca su nombre de usuario y contraseña o el nombre de usuario y contraseña de root para poder acceder a esta página."
7249  
7250  msgid "You must use a https: URL to access this page."
7251  msgstr "Debe escribir un URL https para acceder a esta página."
7252  
7253  #, c-format
7254  msgid "Bad request version number %d.%d!"
7255 -msgstr "Petición incorrecta de número de versión %d %d."
7256 +msgstr "Petición incorrecta de número de versión %d.%d."
7257  
7258  msgid "No attributes in request!"
7259  msgstr "No hay atributos en la solicitud."
7260 @@ -103,11 +102,8 @@
7261  msgid "The printer or class was not found."
7262  msgstr "No se ha encontrado la impresora o la clase."
7263  
7264 -msgid ""
7265 -"The printer-uri must be of the form \"ipp://HOSTNAME/classes/CLASSNAME\"."
7266 -msgstr ""
7267 -"El printer-uri debe ser de la forma \"ipp://NOMBRE_ORDENADOR/classes/"
7268 -"NOMBRE_CLASE\"."
7269 +msgid "The printer-uri must be of the form \"ipp://HOSTNAME/classes/CLASSNAME\"."
7270 +msgstr "El printer-uri debe ser de la forma \"ipp://NOMBRE_ORDENADOR/classes/NOMBRE_CLASE\"."
7271  
7272  #, c-format
7273  msgid "The printer-uri \"%s\" contains invalid characters."
7274 @@ -119,9 +115,7 @@
7275  
7276  #, c-format
7277  msgid "Attempt to set %s printer-state to bad value %d!"
7278 -msgstr ""
7279 -"Se ha intentado cambiar el valor printer-state de %s a un valor incorrecto %"
7280 -"d."
7281 +msgstr "Se ha intentado cambiar el valor printer-state de %s a un valor incorrecto %d."
7282  
7283  #, c-format
7284  msgid "add_class: Unknown printer-op-policy \"%s\"."
7285 @@ -146,29 +140,19 @@
7286  msgid "The notify-user-data value is too large (%d > 63 octets)!"
7287  msgstr "El valor notify-user-data es demasiado grande (%d > 63 octetos)."
7288  
7289 -msgid ""
7290 -"The notify-lease-duration attribute cannot be used with job subscriptions."
7291 -msgstr ""
7292 -"El atributo notify-lease-duration no puede ser usado con subscripciones de "
7293 -"trabajos."
7294 +msgid "The notify-lease-duration attribute cannot be used with job subscriptions."
7295 +msgstr "El atributo notify-lease-duration no puede ser usado con subscripciones de trabajos."
7296  
7297 -msgid ""
7298 -"The printer-uri must be of the form \"ipp://HOSTNAME/printers/PRINTERNAME\"."
7299 -msgstr ""
7300 -"El printer-uri debe ser de la forma \"ipp://NOMBRE_ORDENADOR/printers/"
7301 -"NOMBRE_IMPRESORA\"."
7302 +msgid "The printer-uri must be of the form \"ipp://HOSTNAME/printers/PRINTERNAME\"."
7303 +msgstr "El printer-uri debe ser de la forma \"ipp://NOMBRE_ORDENADOR/printers/NOMBRE_IMPRESORA\"."
7304  
7305  #, c-format
7306  msgid "A class named \"%s\" already exists!"
7307  msgstr "Ya existe una clase llamada \"%s\"."
7308  
7309  #, c-format
7310 -msgid ""
7311 -"File device URIs have been disabled! To enable, see the FileDevice directive "
7312 -"in \"%s/cupsd.conf\"."
7313 -msgstr ""
7314 -"Los URIs del dispositivo de archivo han sido deshabilitados. Para "
7315 -"habilitarlos, vea la directiva FileDevice en \"%s/cupsd.conf\"."
7316 +msgid "File device URIs have been disabled! To enable, see the FileDevice directive in \"%s/cupsd.conf\"."
7317 +msgstr "Los URIs del dispositivo de archivo han sido deshabilitados. Para habilitarlos, vea la directiva FileDevice en \"%s/cupsd.conf\"."
7318  
7319  #, c-format
7320  msgid "Bad device-uri \"%s\"!"
7321 @@ -218,8 +202,7 @@
7322  
7323  #, c-format
7324  msgid "You are not authorized to authenticate job #%d owned by \"%s\"!"
7325 -msgstr ""
7326 -"No tiene permiso para autentificar el trabajo #%d que pertenece a \"%s\"."
7327 +msgstr "No tiene permiso para autentificar el trabajo #%d que pertenece a \"%s\"."
7328  
7329  msgid "The printer-uri attribute is required!"
7330  msgstr "Se necesita el atributo printer-uri."
7331 @@ -360,14 +343,11 @@
7332  
7333  #, c-format
7334  msgid "You are not authorized to restart job id %d owned by \"%s\"!"
7335 -msgstr ""
7336 -"No tiene permiso para reiniciar el trabajo id %d que pertenece a \"%s\"."
7337 +msgstr "No tiene permiso para reiniciar el trabajo id %d que pertenece a \"%s\"."
7338  
7339  #, c-format
7340  msgid "You are not authorized to send document for job #%d owned by \"%s\"!"
7341 -msgstr ""
7342 -"No tiene permiso para enviar el documento para el trabajo #%d que pertenece "
7343 -"a \"%s\"."
7344 +msgstr "No tiene permiso para enviar el documento para el trabajo #%d que pertenece a \"%s\"."
7345  
7346  #, c-format
7347  msgid "Bad document-format \"%s\"!"
7348 @@ -465,11 +445,8 @@
7349  msgstr "lpq: Destino desconocido \"%s\".\n"
7350  
7351  #, c-format
7352 -msgid ""
7353 -"lp: error - %s environment variable names non-existent destination \"%s\"!\n"
7354 -msgstr ""
7355 -"lp: error - los nombres de la variable de entorno %s no existentes en el "
7356 -"destino \"%s\".\n"
7357 +msgid "lp: error - %s environment variable names non-existent destination \"%s\"!\n"
7358 +msgstr "lp: error - los nombres de la variable de entorno %s no existentes en el destino \"%s\".\n"
7359  
7360  msgid "lpq: error - no default destination available.\n"
7361  msgstr "lpq: error - no está disponible el destino predeterminado.\n"
7362 @@ -478,10 +455,8 @@
7363  msgid "lpq: get-jobs failed: %s\n"
7364  msgstr "lpq: get-jobs ha fallado: %s\n"
7365  
7366 -msgid ""
7367 -"Rank   Owner      Pri  Job        Files                       Total Size\n"
7368 -msgstr ""
7369 -"Rango  Propiet.   Pri  Trabajo    Archivos                    Tamaño total\n"
7370 +msgid "Rank   Owner      Pri  Job        Files                       Total Size\n"
7371 +msgstr "Rango  Propiet.   Pri  Trabajo    Archivos                    Tamaño total\n"
7372  
7373  msgid "Rank    Owner   Job     File(s)                         Total Size\n"
7374  msgstr "Rango  Propiet. Trabajo Archivo(s)                      Tamaño total\n"
7375 @@ -492,15 +467,15 @@
7376  
7377  #, c-format
7378  msgid "        %-39.39s %.0f bytes\n"
7379 -msgstr "        %-39.39s %.de bytes\n"
7380 +msgstr "        %-39.39s %.0f bytes\n"
7381  
7382  #, c-format
7383  msgid "%-6s %-10.10s %-4d %-10d %-27.27s %.0f bytes\n"
7384 -msgstr "%-6s %-10.10s %-4d %-10d %-27.27s %.de bytes\n"
7385 +msgstr "%-6s %-10.10s %-4d %-10d %-27.27s %.0f bytes\n"
7386  
7387  #, c-format
7388  msgid "%-7s %-7.7s %-7d %-31.31s %.0f bytes\n"
7389 -msgstr "%-7s %-7.7s %-7d %-31.31s %.de bytes\n"
7390 +msgstr "%-7s %-7.7s %-7d %-31.31s %.0f bytes\n"
7391  
7392  msgid "no entries\n"
7393  msgstr "no hay entradas\n"
7394 @@ -529,20 +504,14 @@
7395  msgstr "lpr: error - se esperaba un valor tras la opción %c\n"
7396  
7397  #, c-format
7398 -msgid ""
7399 -"lpr: warning - '%c' format modifier not supported - output may not be "
7400 -"correct!\n"
7401 -msgstr ""
7402 -"lpr: advertencia - no admite el uso del modificador de formato '%c' - la "
7403 -"salida puede que no sea correcta.\n"
7404 +msgid "lpr: warning - '%c' format modifier not supported - output may not be correct!\n"
7405 +msgstr "lpr: advertencia - no admite el uso del modificador de formato '%c' - la salida puede que no sea correcta.\n"
7406  
7407  msgid "lpr: error - expected option=value after -o option!\n"
7408  msgstr "lpr: error - se esperaba opción=valor tras la opción -o.\n"
7409  
7410  msgid "lpr: warning - email notification is not currently supported!\n"
7411 -msgstr ""
7412 -"lpr: advertencia - actualmente no admite el uso de la notificación por "
7413 -"email.\n"
7414 +msgstr "lpr: advertencia - actualmente no admite el uso de la notificación por email.\n"
7415  
7416  msgid "lpr: error - expected destination after -P option!\n"
7417  msgstr "lpr: error - se esperaba un destino tras la opción -P.\n"
7418 @@ -563,18 +532,15 @@
7419  
7420  #, c-format
7421  msgid "lpr: error - unable to access \"%s\" - %s\n"
7422 -msgstr "lpr: error - no se ha podido acceder a \"%s\" - \"s\n"
7423 +msgstr "lpr: error - no se ha podido acceder a \"%s\" - %s\n"
7424  
7425  #, c-format
7426  msgid "lpr: error - too many files - \"%s\"\n"
7427  msgstr "lpr: error - demasiados archivos - \"%s\"\n"
7428  
7429  #, c-format
7430 -msgid ""
7431 -"lpr: error - %s environment variable names non-existent destination \"%s\"!\n"
7432 -msgstr ""
7433 -"lpr: error - los nombres de variables de entorno %s no existen en el destino "
7434 -"\"%s\".\n"
7435 +msgid "lpr: error - %s environment variable names non-existent destination \"%s\"!\n"
7436 +msgstr "lpr: error - los nombres de variables de entorno %s no existen en el destino \"%s\".\n"
7437  
7438  msgid "lpr: error - no default destination available.\n"
7439  msgstr "lpr: error - no está disponible el destino predeterminado.\n"
7440 @@ -588,13 +554,10 @@
7441  
7442  #, c-format
7443  msgid "lpr: error - unable to write to temporary file \"%s\" - %s\n"
7444 -msgstr ""
7445 -"lpr: error - no se ha podido escribir en el archivo temporal \"%s\" - %s\n"
7446 +msgstr "lpr: error - no se ha podido escribir en el archivo temporal \"%s\" - %s\n"
7447  
7448  msgid "lpr: error - stdin is empty, so no job has been sent.\n"
7449 -msgstr ""
7450 -"lpr: error - stdin está vacío, por lo tanto no se ha enviado ningún "
7451 -"trabajo.\n"
7452 +msgstr "lpr: error - stdin está vacío, por lo tanto no se ha enviado ningún trabajo.\n"
7453  
7454  #, c-format
7455  msgid "lpr: error - unable to print file: %s\n"
7456 @@ -652,12 +615,10 @@
7457  msgstr "%s: La operación ha fallado: %s\n"
7458  
7459  msgid "cancel: Error - expected hostname after '-h' option!\n"
7460 -msgstr ""
7461 -"cancel: Error - se esperaba un nombre de ordenador tras la opción '-h'.\n"
7462 +msgstr "cancel: Error - se esperaba un nombre de ordenador tras la opción '-h'.\n"
7463  
7464  msgid "cancel: Error - expected username after '-u' option!\n"
7465 -msgstr ""
7466 -"cancel: Error - se esperaba un nombre de usuario tras la opción '-u'.\n"
7467 +msgstr "cancel: Error - se esperaba un nombre de usuario tras la opción '-u'.\n"
7468  
7469  #, c-format
7470  msgid "cancel: Unknown option '%c'!\n"
7471 @@ -704,39 +665,27 @@
7472  
7473  #, c-format
7474  msgid "cupsaddsmb: Unable to copy Windows 2000 printer driver files (%d)!\n"
7475 -msgstr ""
7476 -"cupsaddsmb: No se han podido copiar los archivos de los controladores de "
7477 -"impresoras de Windows 2000 (%d).\n"
7478 +msgstr "cupsaddsmb: No se han podido copiar los archivos de los controladores de impresoras de Windows 2000 (%d).\n"
7479  
7480  #, c-format
7481  msgid "cupsaddsmb: Unable to copy CUPS printer driver files (%d)!\n"
7482 -msgstr ""
7483 -"cupsaddsmb: No se han podido copiar los archivos de los controladores de "
7484 -"impresoras de CUPS (%d).\n"
7485 +msgstr "cupsaddsmb: No se han podido copiar los archivos de los controladores de impresoras de CUPS (%d).\n"
7486  
7487  #, c-format
7488  msgid "cupsaddsmb: Unable to install Windows 2000 printer driver files (%d)!\n"
7489 -msgstr ""
7490 -"cupsaddsmb: No se han podido instalar los archivos de los controladores de "
7491 -"impresoras de Windows 2000 (%d).\n"
7492 +msgstr "cupsaddsmb: No se han podido instalar los archivos de los controladores de impresoras de Windows 2000 (%d).\n"
7493  
7494  #, c-format
7495  msgid "cupsaddsmb: Unable to copy Windows 9x printer driver files (%d)!\n"
7496 -msgstr ""
7497 -"cupsaddsmb: No se han podido copiar los archivos de los controladores de "
7498 -"impresoras de Windows 9x (%d).\n"
7499 +msgstr "cupsaddsmb: No se han podido copiar los archivos de los controladores de impresoras de Windows 9x (%d).\n"
7500  
7501  #, c-format
7502  msgid "cupsaddsmb: Unable to install Windows 9x printer driver files (%d)!\n"
7503 -msgstr ""
7504 -"cupsaddsmb: No se han podido instalar los archivos de los controladores de "
7505 -"impresoras de Windows 9x (%d).\n"
7506 +msgstr "cupsaddsmb: No se han podido instalar los archivos de los controladores de impresoras de Windows 9x (%d).\n"
7507  
7508  #, c-format
7509  msgid "cupsaddsmb: Unable to set Windows printer driver (%d)!\n"
7510 -msgstr ""
7511 -"cupsaddsmb: No se ha podido poner el controlador de impresora de Windows (%"
7512 -"d).\n"
7513 +msgstr "cupsaddsmb: No se ha podido poner el controlador de impresora de Windows (%d).\n"
7514  
7515  msgid ""
7516  "Usage: cupsaddsmb [options] printer1 ... printerN\n"
7517 @@ -1115,17 +1064,14 @@
7518  
7519  #, c-format
7520  msgid ""
7521 -"        WARN    Duplex option keyword %s should be named Duplex or "
7522 -"JCLDuplex!\n"
7523 +"        WARN    Duplex option keyword %s should be named Duplex or JCLDuplex!\n"
7524  "                REF: Page 122, section 5.17\n"
7525  msgstr ""
7526 -"        ADVERTENCIA    Clave de opción Duplex %s debería llamarse Duplex o "
7527 -"JCLDuplex.\n"
7528 +"        ADVERTENCIA    Clave de opción Duplex %s debería llamarse Duplex o JCLDuplex.\n"
7529  "                REF: Página 122, sección 5.17\n"
7530  
7531  msgid "        WARN    Default choices conflicting!\n"
7532 -msgstr ""
7533 -"        ADVERTENCIA    Las preferencias predeterminadas están en conflicto.\n"
7534 +msgstr "        ADVERTENCIA    Las preferencias predeterminadas están en conflicto.\n"
7535  
7536  #, c-format
7537  msgid ""
7538 @@ -1139,48 +1085,42 @@
7539  "        WARN    LanguageEncoding required by PPD 4.3 spec.\n"
7540  "                REF: Pages 56-57, section 5.3.\n"
7541  msgstr ""
7542 -"        ADVERTENCIA    Se necesita LanguageEncoding por especificación de "
7543 -"PPD 4.3.\n"
7544 +"        ADVERTENCIA    Se necesita LanguageEncoding por especificación de PPD 4.3.\n"
7545  "                REF: Páginas 56-57, sección 5.3.\n"
7546  
7547  msgid ""
7548  "        WARN    Manufacturer required by PPD 4.3 spec.\n"
7549  "                REF: Pages 58-59, section 5.3.\n"
7550  msgstr ""
7551 -"        ADVERTENCIA    Se necesita Manufacturer por especificación de PPD "
7552 -"4.3.\n"
7553 +"        ADVERTENCIA    Se necesita Manufacturer por especificación de PPD 4.3.\n"
7554  "                REF: Páginas 58-59, seccion 5.3.\n"
7555  
7556  msgid ""
7557  "        WARN    PCFileName longer than 8.3 in violation of PPD spec.\n"
7558  "                REF: Pages 61-62, section 5.3.\n"
7559  msgstr ""
7560 -"        ADVERTENCIA    PCFileName es mas largo que 8.3 violando la "
7561 -"especificación PPD.\n"
7562 +"        ADVERTENCIA    PCFileName es mas largo que 8.3 violando la especificación PPD.\n"
7563  "                REF: Páginas 61-62, sección 5.3.\n"
7564  
7565  msgid ""
7566  "        WARN    ShortNickName required by PPD 4.3 spec.\n"
7567  "                REF: Pages 64-65, section 5.3.\n"
7568  msgstr ""
7569 -"        ADVERTENCIA    Se necesita ShortNickName por especificación de PPD "
7570 -"4.3.\n"
7571 +"        ADVERTENCIA    Se necesita ShortNickName por especificación de PPD 4.3.\n"
7572  "                REF: Páginas 64-65, sección 5.3.\n"
7573  
7574  msgid ""
7575  "        WARN    Protocols contains both PJL and BCP; expected TBCP.\n"
7576  "                REF: Pages 78-79, section 5.7.\n"
7577  msgstr ""
7578 -"        ADVERTENCIA    Protocols contiene a ambos, PJL y BCP; se esperaba "
7579 -"TBCP.\n"
7580 +"        ADVERTENCIA    Protocols contiene a ambos, PJL y BCP; se esperaba TBCP.\n"
7581  "                REF: Páginas 78-79, sección 5.7.\n"
7582  
7583  msgid ""
7584  "        WARN    Protocols contains PJL but JCL attributes are not set.\n"
7585  "                REF: Pages 78-79, section 5.7.\n"
7586  msgstr ""
7587 -"        ADVERTENCIA    Protocols contiene a PJL pero no se especifican los "
7588 -"atributos JCL.\n"
7589 +"        ADVERTENCIA    Protocols contiene a PJL pero no se especifican los atributos JCL.\n"
7590  "                REF: Páginas 78-79, sección 5.7.\n"
7591  
7592  #, c-format
7593 @@ -1207,12 +1147,10 @@
7594  "                (restricción=\"%s %s %s %s\")\n"
7595  
7596  msgid ""
7597 -"Usage: cupstestppd [-q] [-r] [-v[v]] filename1.ppd[.gz] [... filenameN.ppd[."
7598 -"gz]]\n"
7599 +"Usage: cupstestppd [-q] [-r] [-v[v]] filename1.ppd[.gz] [... filenameN.ppd[.gz]]\n"
7600  "       program | cupstestppd [-q] [-r] [-v[v]] -\n"
7601  msgstr ""
7602 -"Uso: cupstestppd [-q] [-r] [-v[v]] nombre_archivo1.ppd[.gz] [... "
7603 -"nombre_archivoN.ppd[.gz]]\n"
7604 +"Uso: cupstestppd [-q] [-r] [-v[v]] nombre_archivo1.ppd[.gz] [... nombre_archivoN.ppd[.gz]]\n"
7605  "       programa | cupstestppd [-q] [-r] [-v[v]] -\n"
7606  
7607  msgid "lpstat: Need \"completed\" or \"not-completed\" after -W!\n"
7608 @@ -1285,20 +1223,15 @@
7609  msgstr "destino predeterminado del sistema: %s\n"
7610  
7611  #, c-format
7612 -msgid ""
7613 -"lpstat: error - %s environment variable names non-existent destination \"%s"
7614 -"\"!\n"
7615 -msgstr ""
7616 -"lpstat: error - Los nombre de variable de entorno %s no existen en el "
7617 -"destino \"%s\".\n"
7618 +msgid "lpstat: error - %s environment variable names non-existent destination \"%s\"!\n"
7619 +msgstr "lpstat: error - Los nombre de variable de entorno %s no existen en el destino \"%s\".\n"
7620  
7621  msgid "no system default destination\n"
7622  msgstr "no hay un destino predeterminado del sistema\n"
7623  
7624  #, c-format
7625  msgid "Output for printer %s is sent to remote printer %s on %s\n"
7626 -msgstr ""
7627 -"La salida de la impresora %s se ha enviado a la impresora remota %s en %s\n"
7628 +msgstr "La salida de la impresora %s se ha enviado a la impresora remota %s en %s\n"
7629  
7630  #, c-format
7631  msgid "Output for printer %s is sent to %s\n"
7632 @@ -1306,9 +1239,7 @@
7633  
7634  #, c-format
7635  msgid "Output for printer %s/%s is sent to remote printer %s on %s\n"
7636 -msgstr ""
7637 -"La salida de la impresora %s/%s se ha enviado a la impresora remota %s en %"
7638 -"s\n"
7639 +msgstr "La salida de la impresora %s/%s se ha enviado a la impresora remota %s en %s\n"
7640  
7641  #, c-format
7642  msgid "Output for printer %s/%s is sent to %s\n"
7643 @@ -1452,16 +1383,13 @@
7644  msgstr "lpadmin: Se esperaba un nombre de clase tras la opción '-c'\n"
7645  
7646  msgid "lpadmin: Class name can only contain printable characters!\n"
7647 -msgstr ""
7648 -"lpadmin: El nombre de la clase sólo puede contener caracteres imprimibles.\n"
7649 +msgstr "lpadmin: El nombre de la clase sólo puede contener caracteres imprimibles.\n"
7650  
7651  msgid "lpadmin: Expected printer name after '-d' option!\n"
7652  msgstr "lpadmin: Se esperaba un nombre de impresora tras la opción '-d'\n"
7653  
7654  msgid "lpadmin: Printer name can only contain printable characters!\n"
7655 -msgstr ""
7656 -"lpadmin: El nombre de la impresora sólo puede contener caracteres "
7657 -"imprimibles.\n"
7658 +msgstr "lpadmin: El nombre de la impresora sólo puede contener caracteres imprimibles.\n"
7659  
7660  msgid "lpadmin: Expected hostname after '-h' option!\n"
7661  msgstr "lpadmin: Se esperaba un nombre de ordenador tras la opción '-h'.\n"
7662 @@ -1536,8 +1464,7 @@
7663  msgstr "lpadmin: Se esperaba tipo(s) de archivo(s) tras la opción '-l'.\n"
7664  
7665  msgid "lpadmin: Warning - content type list ignored!\n"
7666 -msgstr ""
7667 -"lpadmin: Advertencia - lista de tipo de contenido no tenida en cuenta.\n"
7668 +msgstr "lpadmin: Advertencia - lista de tipo de contenido no tenida en cuenta.\n"
7669  
7670  msgid ""
7671  "lpadmin: Unable to set the printer location:\n"
7672 @@ -1640,9 +1567,7 @@
7673  msgstr "lp: Se esperaba un ID de trabajo tras la opción -i.\n"
7674  
7675  msgid "lp: Error - cannot print files and alter jobs simultaneously!\n"
7676 -msgstr ""
7677 -"lp: Error - no se pueden imprimir archivos y alterar trabajos al mismo "
7678 -"tiempo.\n"
7679 +msgstr "lp: Error - no se pueden imprimir archivos y alterar trabajos al mismo tiempo.\n"
7680  
7681  msgid "lp: Error - bad job ID!\n"
7682  msgstr "lp: Error - ID de trabajo incorrecta.\n"
7683 @@ -1694,11 +1619,8 @@
7684  msgid "lp: Unknown option '%c'!\n"
7685  msgstr "lp: Opción '%c' desconocida.\n"
7686  
7687 -msgid ""
7688 -"lp: Error - cannot print from stdin if files or a job ID are provided!\n"
7689 -msgstr ""
7690 -"lp: Error - no se puede imprimir desde stdin si se proporcionan archivos o "
7691 -"un ID de trabajo.\n"
7692 +msgid "lp: Error - cannot print from stdin if files or a job ID are provided!\n"
7693 +msgstr "lp: Error - no se puede imprimir desde stdin si se proporcionan archivos o un ID de trabajo.\n"
7694  
7695  #, c-format
7696  msgid "lp: Unable to access \"%s\" - %s\n"
7697 @@ -1720,8 +1642,7 @@
7698  
7699  #, c-format
7700  msgid "lp: error - unable to write to temporary file \"%s\" - %s\n"
7701 -msgstr ""
7702 -"lp: error - no se ha podido escribir en el archivo temporal \"%s\" - %s\n"
7703 +msgstr "lp: error - no se ha podido escribir en el archivo temporal \"%s\" - %s\n"
7704  
7705  msgid "lp: stdin is empty, so no job has been sent.\n"
7706  msgstr "lp: stdin está vacío, por lo tanto no se ha enviado ningún trabajo.\n"
7707 @@ -1883,9 +1804,7 @@
7708  
7709  #, c-format
7710  msgid "lppasswd: failed to backup old password file: %s\n"
7711 -msgstr ""
7712 -"lppasswd: falló al hacer una copia de seguridad del antiguo archivo de "
7713 -"contraseñas: %s\n"
7714 +msgstr "lppasswd: falló al hacer una copia de seguridad del antiguo archivo de contraseñas: %s\n"
7715  
7716  #, c-format
7717  msgid "lppasswd: failed to rename password file: %s\n"
7718 @@ -1936,12 +1855,8 @@
7719  msgid "Add Class"
7720  msgstr "Añadir clase"
7721  
7722 -msgid ""
7723 -"The class name may only contain up to 127 printable characters and may not "
7724 -"contain spaces, slashes (/), or the pound sign (#)."
7725 -msgstr ""
7726 -"El nombre de la clase sólo puede contener hasta 127 caracteres imprimibles y "
7727 -"no puede contener espacios, barras (/), o la almohadilla (#)."
7728 +msgid "The class name may only contain up to 127 printable characters and may not contain spaces, slashes (/), or the pound sign (#)."
7729 +msgstr "El nombre de la clase sólo puede contener hasta 127 caracteres imprimibles y no puede contener espacios, barras (/), o la almohadilla (#)."
7730  
7731  msgid "Unable to modify class:"
7732  msgstr "No se ha podido modificar la clase:"
7733 @@ -1955,12 +1870,8 @@
7734  msgid "Add Printer"
7735  msgstr "Añadir impresora"
7736  
7737 -msgid ""
7738 -"The printer name may only contain up to 127 printable characters and may not "
7739 -"contain spaces, slashes (/), or the pound sign (#)."
7740 -msgstr ""
7741 -"El nombre de la impresora sólo puede contener hasta 127 caracteres "
7742 -"imprimibles y no puede contener espacios, barras (/), o la almohadilla (#)."
7743 +msgid "The printer name may only contain up to 127 printable characters and may not contain spaces, slashes (/), or the pound sign (#)."
7744 +msgstr "El nombre de la impresora sólo puede contener hasta 127 caracteres imprimibles y no puede contener espacios, barras (/), o la almohadilla (#)."
7745  
7746  msgid "Unable to get list of printer drivers:"
7747  msgstr "No se ha podido obtener la lista de controladores de impresora:"
7748 @@ -2059,24 +1970,16 @@
7749  msgstr "No se ha podido convertir el archivo PPD."
7750  
7751  msgid "Unable to copy Windows 2000 printer driver files!"
7752 -msgstr ""
7753 -"No se han podido copiar los archivos del controlador de impresora de Windows "
7754 -"2000."
7755 +msgstr "No se han podido copiar los archivos del controlador de impresora de Windows 2000."
7756  
7757  msgid "Unable to install Windows 2000 printer driver files!"
7758 -msgstr ""
7759 -"No se han podido instalar los archivos del controlador de impresora de "
7760 -"Windows 2000."
7761 +msgstr "No se han podido instalar los archivos del controlador de impresora de Windows 2000."
7762  
7763  msgid "Unable to copy Windows 9x printer driver files!"
7764 -msgstr ""
7765 -"No se han podido copiar los archivos del controlador de impresora de Windows "
7766 -"9x."
7767 +msgstr "No se han podido copiar los archivos del controlador de impresora de Windows 9x."
7768  
7769  msgid "Unable to install Windows 9x printer driver files!"
7770 -msgstr ""
7771 -"No se han podido instalar los archivos del controlador de impresora de "
7772 -"Windows 9x."
7773 +msgstr "No se han podido instalar los archivos del controlador de impresora de Windows 9x."
7774  
7775  msgid "Unable to set Windows printer driver!"
7776  msgstr "No se ha podido configurar el controlador de impresora de Windows."
7777 @@ -2096,14 +1999,10 @@
7778  msgstr "cupsaddsmb se ha estropeado con señal %d"
7779  
7780  msgid "A Samba username is required to export printer drivers!"
7781 -msgstr ""
7782 -"Se requiere un nombre de usuario Samba para exportar los controladores de "
7783 -"impresora."
7784 +msgstr "Se requiere un nombre de usuario Samba para exportar los controladores de impresora."
7785  
7786  msgid "A Samba password is required to export printer drivers!"
7787 -msgstr ""
7788 -"Se requiere una contraseña Samba para exportar los controladores de "
7789 -"impresora."
7790 +msgstr "Se requiere una contraseña Samba para exportar los controladores de impresora."
7791  
7792  msgid "Unable to open cupsd.conf file:"
7793  msgstr "No se ha podido abrir el archivo cupsd.conf:"
7794 @@ -2256,13 +2155,10 @@
7795  msgstr "cupsaddsmb: No se ha podido ejecutar \"%s\": %s\n"
7796  
7797  msgid "cupsaddsmb: No Windows printer drivers are installed!\n"
7798 -msgstr ""
7799 -"cupsaddsmb: No está instalado ningún controlador de impresora de Windows.\n"
7800 +msgstr "cupsaddsmb: No está instalado ningún controlador de impresora de Windows.\n"
7801  
7802  msgid "cupsaddsmb: Warning, no Windows 2000 printer drivers are installed!\n"
7803 -msgstr ""
7804 -"cupsaddsmb: Advertencia, no está instalado ningún controlador de impresora "
7805 -"de Windows 2000.\n"
7806 +msgstr "cupsaddsmb: Advertencia, no está instalado ningún controlador de impresora de Windows 2000.\n"
7807  
7808  #, c-format
7809  msgid "lpadmin: Printer %s is already a member of class %s.\n"
7810 @@ -2305,8 +2201,7 @@
7811  msgstr "Uso: lpmove trabajo/fuente destino\n"
7812  
7813  msgid "lpstat: Need \"completed\", \"not-completed\", or \"all\" after -W!\n"
7814 -msgstr ""
7815 -"lpstat: Se necesita \"completed\", \"not completed\", o \"all\" tras -W.\n"
7816 +msgstr "lpstat: Se necesita \"completed\", \"not completed\", o \"all\" tras -W.\n"
7817  
7818  #, c-format
7819  msgid "%s accepting requests since %s\n"
7820 @@ -2356,21 +2251,15 @@
7821  msgstr "%s: Error - se esperaba un nombre de ordenador tras la opción '-h'.\n"
7822  
7823  #, c-format
7824 -msgid ""
7825 -"%s: error - %s environment variable names non-existent destination \"%s\"!\n"
7826 -msgstr ""
7827 -"%s: error - %s nombres de variables de entorno no existen en destino \"%s"
7828 -"\".\n"
7829 +msgid "%s: error - %s environment variable names non-existent destination \"%s\"!\n"
7830 +msgstr "%s: error - %s nombres de variables de entorno no existen en destino \"%s\".\n"
7831  
7832  #, c-format
7833  msgid "%s: error - no default destination available.\n"
7834  msgstr "%s: error - destino predeterminado no disponible.\n"
7835  
7836 -msgid ""
7837 -"Usage: lpq [-P dest] [-U username] [-h hostname[:port]] [-l] [+interval]\n"
7838 -msgstr ""
7839 -"Uso: lpq (-P dest) (-U nombre_usuario) (-h nombre_ordenador(:puerto)) (-l) "
7840 -"(+intervalo)\n"
7841 +msgid "Usage: lpq [-P dest] [-U username] [-h hostname[:port]] [-l] [+interval]\n"
7842 +msgstr "Uso: lpq (-P dest) (-U nombre_usuario) (-h nombre_ordenador(:puerto)) (-l) (+intervalo)\n"
7843  
7844  #, c-format
7845  msgid "%s: Error - expected hostname after '-H' option!\n"
7846 @@ -2381,12 +2270,8 @@
7847  msgstr "%s: Error - se esperaba un valor tras la opción '%c'.\n"
7848  
7849  #, c-format
7850 -msgid ""
7851 -"%s: Warning - '%c' format modifier not supported - output may not be "
7852 -"correct!\n"
7853 -msgstr ""
7854 -"%s: Advertencia - no se admite el uso del modificador de formato '%c' - la "
7855 -"salida puede no ser correcta.\n"
7856 +msgid "%s: Warning - '%c' format modifier not supported - output may not be correct!\n"
7857 +msgstr "%s: Advertencia - no se admite el uso del modificador de formato '%c' - la salida puede no ser correcta.\n"
7858  
7859  #, c-format
7860  msgid "%s: error - expected option=value after '-o' option!\n"
7861 @@ -2417,11 +2302,8 @@
7862  msgstr "%s: Error - demasiados archivos - \"%s\"\n"
7863  
7864  #, c-format
7865 -msgid ""
7866 -"%s: Error - %s environment variable names non-existent destination \"%s\"!\n"
7867 -msgstr ""
7868 -"%s: Error - %s nombres de variables de entorno no existen en destino \"%s"
7869 -"\".\n"
7870 +msgid "%s: Error - %s environment variable names non-existent destination \"%s\"!\n"
7871 +msgstr "%s: Error - %s nombres de variables de entorno no existen en destino \"%s\".\n"
7872  
7873  #, c-format
7874  msgid "%s: Error - no default destination available.\n"
7875 @@ -2441,8 +2323,7 @@
7876  
7877  #, c-format
7878  msgid "%s: Error - stdin is empty, so no job has been sent.\n"
7879 -msgstr ""
7880 -"%s: Error - stdin está vacío, por lo tanto no se ha enviado ningún trabajo.\n"
7881 +msgstr "%s: Error - stdin está vacío, por lo tanto no se ha enviado ningún trabajo.\n"
7882  
7883  #, c-format
7884  msgid "%s: Error - unknown destination \"%s\"!\n"
7885 @@ -2478,9 +2359,7 @@
7886  
7887  #, c-format
7888  msgid "%s: Error - cannot print files and alter jobs simultaneously!\n"
7889 -msgstr ""
7890 -"%s: Error - no se pueden imprimir archivos y alterar trabajos al mismo "
7891 -"tiempo.\n"
7892 +msgstr "%s: Error - no se pueden imprimir archivos y alterar trabajos al mismo tiempo.\n"
7893  
7894  #, c-format
7895  msgid "%s: Error - bad job ID!\n"
7896 @@ -2520,8 +2399,7 @@
7897  
7898  #, c-format
7899  msgid "%s: Need job ID ('-i jobid') before '-H restart'!\n"
7900 -msgstr ""
7901 -"%s: Se necesita un ID de trabajo ('-i id_trabajo') antes de '-H restart'.\n"
7902 +msgstr "%s: Se necesita un ID de trabajo ('-i id_trabajo') antes de '-H restart'.\n"
7903  
7904  #, c-format
7905  msgid "%s: Error - expected page list after '-P' option!\n"
7906 @@ -2544,19 +2422,12 @@
7907  msgstr "%s: Advertencia - opción de tipo de contenido no tenida en cuenta.\n"
7908  
7909  #, c-format
7910 -msgid ""
7911 -"%s: Error - cannot print from stdin if files or a job ID are provided!\n"
7912 -msgstr ""
7913 -"%s: Error - no se puede imprimir desde stdin si se proporcionan archivos o "
7914 -"una ID de trabajo.\n"
7915 +msgid "%s: Error - cannot print from stdin if files or a job ID are provided!\n"
7916 +msgstr "%s: Error - no se puede imprimir desde stdin si se proporcionan archivos o una ID de trabajo.\n"
7917  
7918  #, c-format
7919 -msgid ""
7920 -"%s: Error - need \"completed\", \"not-completed\", or \"all\" after '-W' "
7921 -"option!\n"
7922 -msgstr ""
7923 -"%s: Error - se necesita \"completed\", \"not completed\", o \"all\" tras la "
7924 -"opción '-W'.\n"
7925 +msgid "%s: Error - need \"completed\", \"not-completed\", or \"all\" after '-W' option!\n"
7926 +msgstr "%s: Error - se necesita \"completed\", \"not completed\", o \"all\" tras la opción '-W'.\n"
7927  
7928  #, c-format
7929  msgid "%s: Error - expected destination after '-b' option!\n"
7930 @@ -2613,14 +2484,10 @@
7931  msgstr "Las suscripciones de trabajos no han podido ser renovadas."
7932  
7933  msgid "cupsd: Expected config filename after \"-c\" option!\n"
7934 -msgstr ""
7935 -"cupsd: Se esperaba un nombre de archivo de configuración tras la opción \"-c"
7936 -"\".\n"
7937 +msgstr "cupsd: Se esperaba un nombre de archivo de configuración tras la opción \"-c\".\n"
7938  
7939  msgid "cupsd: launchd(8) support not compiled in, running in normal mode.\n"
7940 -msgstr ""
7941 -"cupsd: el uso de launchd(8) no ha sido compilado, ejecutándose en modo "
7942 -"normal.\n"
7943 +msgstr "cupsd: el uso de launchd(8) no ha sido compilado, ejecutándose en modo normal.\n"
7944  
7945  #, c-format
7946  msgid "cupsd: Unknown option \"%c\" - aborting!\n"
7947 @@ -2651,18 +2518,11 @@
7948  msgid "        WARN    Line %d only contains whitespace!\n"
7949  msgstr "        ADVERTENCIA    La línea %d solo contiene espacios en blanco.\n"
7950  
7951 -msgid ""
7952 -"        WARN    File contains a mix of CR, LF, and CR LF line endings!\n"
7953 -msgstr ""
7954 -"        ADVERTENCIA    El archivo contiene una mezcla de líneas acabadas en "
7955 -"CR, LF y CR LF.\n"
7956 +msgid "        WARN    File contains a mix of CR, LF, and CR LF line endings!\n"
7957 +msgstr "        ADVERTENCIA    El archivo contiene una mezcla de líneas acabadas en CR, LF y CR LF.\n"
7958  
7959 -msgid ""
7960 -"        WARN    Non-Windows PPD files should use lines ending with only LF, "
7961 -"not CR LF!\n"
7962 -msgstr ""
7963 -"        ADVERTENCIA    Los archivos PPD que no sean de Windows deben tener "
7964 -"líneas que acaben sólo en LF, no en CR LF.\n"
7965 +msgid "        WARN    Non-Windows PPD files should use lines ending with only LF, not CR LF!\n"
7966 +msgstr "        ADVERTENCIA    Los archivos PPD que no sean de Windows deben tener líneas que acaben sólo en LF, no en CR LF.\n"
7967  
7968  msgid "Printer Maintenance"
7969  msgstr "Mantenimiento de impresora"
7970 @@ -2684,31 +2544,19 @@
7971  
7972  #, c-format
7973  msgid "      **FAIL**  Missing \"%s\" translation string for option %s!\n"
7974 -msgstr ""
7975 -"      **FALLO**  Cadena de traducción \"%s\" para opción %s desaparecida.\n"
7976 +msgstr "      **FALLO**  Cadena de traducción \"%s\" para opción %s desaparecida.\n"
7977  
7978  #, c-format
7979 -msgid ""
7980 -"      **FAIL**  Default translation string for option %s contains 8-bit "
7981 -"characters!\n"
7982 -msgstr ""
7983 -"      **FALLO**  Cadena de traducción predeterminada para opción %s contiene "
7984 -"caracteres de 8-bits.\n"
7985 +msgid "      **FAIL**  Default translation string for option %s contains 8-bit characters!\n"
7986 +msgstr "      **FALLO**  Cadena de traducción predeterminada para opción %s contiene caracteres de 8-bits.\n"
7987  
7988  #, c-format
7989 -msgid ""
7990 -"      **FAIL**  Missing \"%s\" translation string for option %s, choice %s!\n"
7991 -msgstr ""
7992 -"      **FALLO**  Cadena de traducción \"%s\" para opción %s, preferencia %"
7993 -"s.\n"
7994 +msgid "      **FAIL**  Missing \"%s\" translation string for option %s, choice %s!\n"
7995 +msgstr "      **FALLO**  Cadena de traducción \"%s\" para opción %s, preferencia %s.\n"
7996  
7997  #, c-format
7998 -msgid ""
7999 -"      **FAIL**  Default translation string for option %s choice %s contains "
8000 -"8-bit characters!\n"
8001 -msgstr ""
8002 -"      **FALLO**  Cadena de traducción predeterminada para opción %s "
8003 -"preferencia %s contiene caracteres de 8-bits.\n"
8004 +msgid "      **FAIL**  Default translation string for option %s choice %s contains 8-bit characters!\n"
8005 +msgstr "      **FALLO**  Cadena de traducción predeterminada para opción %s preferencia %s contiene caracteres de 8-bits.\n"
8006  
8007  #, c-format
8008  msgid "      **FAIL**  Bad cupsFilter value \"%s\"!\n"
8009 @@ -2727,50 +2575,37 @@
8010  
8011  #, c-format
8012  msgid "Bad option + choice on line %d!\n"
8013 -msgstr "Opción incorrecta + preferencia en línea %s.\n"
8014 +msgstr "Opción incorrecta + preferencia en línea %d.\n"
8015  
8016  #, c-format
8017  msgid "Unable to copy Windows 2000 printer driver files (%d)!\n"
8018 -msgstr ""
8019 -"No se han podido copiar los archivos del controlador de impresora de Windows "
8020 -"2000 (%d).\n"
8021 +msgstr "No se han podido copiar los archivos del controlador de impresora de Windows 2000 (%d).\n"
8022  
8023  #, c-format
8024  msgid "Unable to copy CUPS printer driver files (%d)!\n"
8025 -msgstr ""
8026 -"No se han podido copiar los archivos del controlador de impresora de CUPS (%"
8027 -"d).\n"
8028 +msgstr "No se han podido copiar los archivos del controlador de impresora de CUPS (%d).\n"
8029  
8030  #, c-format
8031  msgid "Unable to install Windows 2000 printer driver files (%d)!\n"
8032 -msgstr ""
8033 -"No se han podido instalar los archivos del controlador de impresora de "
8034 -"Windows 2000 (%d).\n"
8035 +msgstr "No se han podido instalar los archivos del controlador de impresora de Windows 2000 (%d).\n"
8036  
8037  #, c-format
8038  msgid "Unable to copy Windows 9x printer driver files (%d)!\n"
8039 -msgstr ""
8040 -"No se han podido copiar los archivos del controlador de impresora de Windows "
8041 -"9x (%d).\n"
8042 +msgstr "No se han podido copiar los archivos del controlador de impresora de Windows 9x (%d).\n"
8043  
8044  #, c-format
8045  msgid "Unable to install Windows 9x printer driver files (%d)!\n"
8046 -msgstr ""
8047 -"No se han podido instalar los archivos del controlador de impresora de "
8048 -"Windows 9x (%d).\n"
8049 +msgstr "No se han podido instalar los archivos del controlador de impresora de Windows 9x (%d).\n"
8050  
8051  msgid "No Windows printer drivers are installed!\n"
8052  msgstr "No está instalado ningún controlador de impresora de Windows.\n"
8053  
8054  msgid "Warning, no Windows 2000 printer drivers are installed!\n"
8055 -msgstr ""
8056 -"Advertencia, no está instalado ningún controlador de impresora de Windows "
8057 -"2000.\n"
8058 +msgstr "Advertencia, no está instalado ningún controlador de impresora de Windows 2000.\n"
8059  
8060  #, c-format
8061  msgid "Unable to set Windows printer driver (%d)!\n"
8062 -msgstr ""
8063 -"No se ha podido configurar el controlador de impresora de Windows (%d).\n"
8064 +msgstr "No se ha podido configurar el controlador de impresora de Windows (%d).\n"
8065  
8066  msgid ""
8067  "Usage: cupsaddsmb [options] printer1 ... printerN\n"
8068 @@ -2788,8 +2623,7 @@
8069  "       cupsaddsmb [opciones] -a\n"
8070  "\n"
8071  "Opciones:\n"
8072 -"  -E               Hace que se use encriptación en la conexión con el "
8073 -"servidor\n"
8074 +"  -E               Hace que se use encriptación en la conexión con el servidor\n"
8075  "  -H servidor_samba  Usa el servidor SAMBA especificado\n"
8076  "  -U usuario_samba    Autentifica usando el usuario SAMBA especificado\n"
8077  "  -a               Exporta todas las impresoras\n"
8078 @@ -2798,41 +2632,29 @@
8079  
8080  #, c-format
8081  msgid "Unable to copy Windows 2000 printer driver files (%d)!"
8082 -msgstr ""
8083 -"No se han podido copiar los archivos del controlador de impresora de Windows "
8084 -"2000 (%d)."
8085 +msgstr "No se han podido copiar los archivos del controlador de impresora de Windows 2000 (%d)."
8086  
8087  #, c-format
8088  msgid "Unable to copy CUPS printer driver files (%d)!"
8089 -msgstr ""
8090 -"No se han podido copiar los archivos del controlador de impresora de CUPS (%"
8091 -"d)."
8092 +msgstr "No se han podido copiar los archivos del controlador de impresora de CUPS (%d)."
8093  
8094  #, c-format
8095  msgid "Unable to install Windows 2000 printer driver files (%d)!"
8096 -msgstr ""
8097 -"No se han podido instalar los archivos del controlador de impresora de "
8098 -"Windows 2000 (%d)."
8099 +msgstr "No se han podido instalar los archivos del controlador de impresora de Windows 2000 (%d)."
8100  
8101  #, c-format
8102  msgid "Unable to copy Windows 9x printer driver files (%d)!"
8103 -msgstr ""
8104 -"No se han podido copiar los archivos del controlador de impresora de Windows "
8105 -"9x (%d)."
8106 +msgstr "No se han podido copiar los archivos del controlador de impresora de Windows 9x (%d)."
8107  
8108  #, c-format
8109  msgid "Unable to install Windows 9x printer driver files (%d)!"
8110 -msgstr ""
8111 -"No se han podido instalar los archivos del controlador de impresora de "
8112 -"Windows 9x (%d)."
8113 +msgstr "No se han podido instalar los archivos del controlador de impresora de Windows 9x (%d)."
8114  
8115  msgid "No Windows printer drivers are installed!"
8116  msgstr "No está instalado ningún controlador de impresora de Windows."
8117  
8118  msgid "Warning, no Windows 2000 printer drivers are installed!"
8119 -msgstr ""
8120 -"Advertencia, no está instalado ningún controlador de impresora de Windows "
8121 -"2000."
8122 +msgstr "Advertencia, no está instalado ningún controlador de impresora de Windows 2000."
8123  
8124  #, c-format
8125  msgid "open of %s failed: %s"
8126 @@ -2859,12 +2681,8 @@
8127  msgstr "El trabajo #%d ya ha sido completado - no se puede cancelar."
8128  
8129  #, c-format
8130 -msgid ""
8131 -"You must access this page using the URL <A HREF=\"https://%s:%d%s\">https://%"
8132 -"s:%d%s</A>."
8133 -msgstr ""
8134 -"Debe acceder a esta página usando el URL <A HREF=\"https://%s:%d%s\">https://"
8135 -"%s:%d%s</A>."
8136 +msgid "You must access this page using the URL <A HREF=\"https://%s:%d%s\">https://%s:%d%s</A>."
8137 +msgstr "Debe acceder a esta página usando el URL <A HREF=\"https://%s:%d%s\">https://%s:%d%s</A>."
8138  
8139  #, c-format
8140  msgid "Unsupported format '%s'!"
8141 @@ -2978,8 +2796,7 @@
8142  "\n"
8143  "    -h       Show program usage\n"
8144  "\n"
8145 -"    Note: this program only validates the DSC comments, not the PostScript "
8146 -"itself.\n"
8147 +"    Note: this program only validates the DSC comments, not the PostScript itself.\n"
8148  msgstr ""
8149  "Uso: cupstestdsc [opciones] nombre_archivo.ps [... nombre_archivo.ps]\n"
8150  "       cupstestdsc [opciones] -\n"
8151 @@ -2988,17 +2805,16 @@
8152  "\n"
8153  "    -h       Muestra cómo se usa el programa\n"
8154  "\n"
8155 -"    Nota: este programa sólo valida los comentarios DSC, no el PostScript en "
8156 -"sí mismo.\n"
8157 +"    Nota: este programa sólo valida los comentarios DSC, no el PostScript en sí mismo.\n"
8158  
8159  #, c-format
8160  msgid "Password for %s on %s? "
8161 -msgstr ""
8162 +msgstr "¿Contraseña de %s en %s? "
8163  
8164 -#, fuzzy
8165  msgid ""
8166  "      **FAIL**  1284DeviceId must be 1284DeviceID!\n"
8167  "                REF: Page 72, section 5.5\n"
8168  msgstr ""
8169 -"      **FALLO**  Preferencia %s incorrecta %s.\n"
8170 -"                REF: Página 122, sección 5.17\n"
8171 +"      **FALLO**  1284DeviceId debe ser 1284DeviceID.\n"
8172 +"                REF: Página 72, sección 5.5\n"
8173 +
8174 diff -durN release-1.2.1/locale/Makefile cups-1.2.x/locale/Makefile
8175 --- release-1.2.1/locale/Makefile       2006-07-04 17:32:18.000000000 +0100
8176 +++ cups-1.2.x/locale/Makefile  2006-06-26 12:42:47.000000000 +0100
8177 @@ -1,5 +1,5 @@
8178  #
8179 -# "$Id$"
8180 +# "$Id$"
8181  #
8182  #   Locale file makefile for the Common UNIX Printing System (CUPS).
8183  #
8184 @@ -51,7 +51,9 @@
8185  # Install files...
8186  #
8187  
8188 -install:       all
8189 +install:       all $(INSTALL_LANGUAGES)
8190 +
8191 +install-languages:
8192         $(INSTALL_DIR) -m 755 $(LOCALEDIR)
8193         for loc in $(LANGUAGES) ; do \
8194                 if test -f cups_$$loc.po; then \
8195 @@ -65,12 +67,12 @@
8196  # Uninstall files...
8197  #
8198  
8199 -uninstall:
8200 +uninstall: $(UNINSTALL_LANGUAGES)
8201 +
8202 +uninstall-languages:
8203         -for loc in $(LANGUAGES) ; do \
8204                 $(RM) $(LOCALEDIR)/$$loc/cups_$$loc.po ; \
8205 -               $(RMDIR) $(LOCALEDIR)/$$loc ; \
8206         done
8207 -       -$(RMDIR) $(LOCALEDIR)
8208  
8209  
8210  #
8211 @@ -110,5 +112,5 @@
8212  
8213  
8214  #
8215 -# End of "$Id$".
8216 +# End of "$Id$".
8217  #
8218 diff -durN release-1.2.1/Makedefs.in cups-1.2.x/Makedefs.in
8219 --- release-1.2.1/Makedefs.in   2006-07-04 17:35:29.000000000 +0100
8220 +++ cups-1.2.x/Makedefs.in      2006-06-26 12:45:38.000000000 +0100
8221 @@ -1,5 +1,5 @@
8222  #
8223 -# "$Id$"
8224 +# "$Id$"
8225  #
8226  #   Common makefile definitions for the Common UNIX Printing System (CUPS).
8227  #
8228 @@ -78,6 +78,8 @@
8229  #
8230  
8231  LANGUAGES      =       @LANGUAGES@
8232 +INSTALL_LANGUAGES =    @INSTALL_LANGUAGES@
8233 +UNINSTALL_LANGUAGES =  @UNINSTALL_LANGUAGES@
8234  
8235  #
8236  # Libraries...
8237 @@ -127,9 +129,9 @@
8238  CXXLIBS                =       @CXXLIBS@
8239  DSOFLAGS       =       @DSOFLAGS@
8240  DSOLIBS                =       @DSOLIBS@ $(COMMONLIBS)
8241 -IMGLIBS                =       @IMGLIBS@ -lm
8242 +IMGLIBS                =       @IMGLIBS@
8243  IMGFILTERS     =       @IMGFILTERS@
8244 -LDFLAGS                =       -L../cups -L../filter $(RC_CFLAGS) $(ARCHFLAGS) \
8245 +LDFLAGS                =       -L../cups -L../filter $(ARCHFLAGS) \
8246                         @LDFLAGS@ @PIEFLAGS@ $(OPTIM)
8247  LINKCUPS       =       @LINKCUPS@ $(SSLLIBS)
8248  LINKCUPSIMAGE  =       @LINKCUPSIMAGE@
8249 @@ -263,5 +265,5 @@
8250  
8251  
8252  #
8253 -# End of "$Id$"
8254 +# End of "$Id$"
8255  #
8256 diff -durN release-1.2.1/man/cupsaddsmb.man.in cups-1.2.x/man/cupsaddsmb.man.in
8257 --- release-1.2.1/man/cupsaddsmb.man.in 2006-07-04 17:33:01.000000000 +0100
8258 +++ cups-1.2.x/man/cupsaddsmb.man.in    2006-06-26 12:43:31.000000000 +0100
8259 @@ -1,5 +1,5 @@
8260  .\"
8261 -.\" "$Id$"
8262 +.\" "$Id$"
8263  .\"
8264  .\"   cupsaddsmb man page for the Common UNIX Printing System (CUPS).
8265  .\"
8266 @@ -21,7 +21,7 @@
8267  .\"       EMail: cups-info@cups.org
8268  .\"         WWW: http://www.cups.org
8269  .\"
8270 -.TH cupsaddsmb 8 "Common UNIX Printing System" "19 April 2006" "Easy Software Products"
8271 +.TH cupsaddsmb 8 "Common UNIX Printing System" "13 June 2006" "Easy Software Products"
8272  .SH NAME
8273  cupsaddsmb \- export printers to samba for windows clients
8274  
8275 @@ -162,13 +162,14 @@
8276  .nf
8277  
8278      [Windows 2000 and higher]
8279 -    cups6.ini
8280 -    cupsui6.dll
8281 -    cupsdrv6.dll
8282 -    ps5ui.dll
8283 -    pscript.hlp
8284 -    pscript.ntf
8285 -    pscript5.dll
8286 +    cups6.inf (from www.cups.org)
8287 +    cups6.ini (from www.cups.org)
8288 +    cupsps6.dll (from www.cups.org)
8289 +    cupsui6.dll (from www.cups.org)
8290 +    ps5ui.dll (from your Windows system)
8291 +    pscript.hlp (from your Windows system)
8292 +    pscript.ntf (from your Windows system)
8293 +    pscript5.dll (from your Windows system)
8294  .fi
8295  .LP
8296  \fBNote:\fR Unlike Windows, case is significant - make sure that
8297 @@ -209,5 +210,5 @@
8298  .SH COPYRIGHT
8299  Copyright 1997-2006 by Easy Software Products, All Rights Reserved.
8300  .\"
8301 -.\" End of "$Id$".
8302 +.\" End of "$Id$".
8303  .\"
8304 diff -durN release-1.2.1/man/cupsd.conf.man.in cups-1.2.x/man/cupsd.conf.man.in
8305 --- release-1.2.1/man/cupsd.conf.man.in 2006-07-04 17:33:01.000000000 +0100
8306 +++ cups-1.2.x/man/cupsd.conf.man.in    2006-06-26 12:43:31.000000000 +0100
8307 @@ -1,5 +1,5 @@
8308  .\"
8309 -.\" "$Id$"
8310 +.\" "$Id$"
8311  .\"
8312  .\"   cupsd.conf man page for the Common UNIX Printing System (CUPS).
8313  .\"
8314 @@ -21,7 +21,7 @@
8315  .\"       EMail: cups-info@cups.org
8316  .\"         WWW: http://www.cups.org
8317  .\"
8318 -.TH cupsd.conf 5 "Common UNIX Printing System" "23 March 2006" "Easy Software Products"
8319 +.TH cupsd.conf 5 "Common UNIX Printing System" "6 June 2006" "Easy Software Products"
8320  .SH NAME
8321  cupsd.conf \- server configuration file for cups
8322  .SH DESCRIPTION
8323 @@ -367,8 +367,10 @@
8324  Listen ip-address:port
8325  .TP 5
8326  Listen *:port
8327 +.TP 5
8328 +Listen /path/to/domain/socket
8329  .br
8330 -Listens to the specified address and port.
8331 +Listens to the specified address and port or domain socket path.
8332  .TP 5
8333  <Location /path> ... </Location>
8334  .br
8335 @@ -607,5 +609,5 @@
8336  .SH COPYRIGHT
8337  Copyright 1997-2006 by Easy Software Products, All Rights Reserved.
8338  .\"
8339 -.\" End of "$Id$".
8340 +.\" End of "$Id$".
8341  .\"
8342 diff -durN release-1.2.1/packaging/cups.list.in cups-1.2.x/packaging/cups.list.in
8343 --- release-1.2.1/packaging/cups.list.in        2006-07-04 17:32:09.000000000 +0100
8344 +++ cups-1.2.x/packaging/cups.list.in   2006-06-26 12:42:38.000000000 +0100
8345 @@ -1,5 +1,5 @@
8346  #
8347 -# "$Id$"
8348 +# "$Id$"
8349  #
8350  #   ESP Package Manager (EPM) file list for the Common UNIX Printing
8351  #   System (CUPS).
8352 @@ -270,7 +270,7 @@
8353  f 0755 root sys $BINDIR/cupstestppd systemv/cupstestppd
8354  f 0755 root sys $BINDIR/lp systemv/lp
8355  f 0755 root sys $BINDIR/lpoptions systemv/lpoptions
8356 -f 4755 $CUPS_USER sys $BINDIR/lppasswd systemv/lppasswd
8357 +f 4755 root sys $BINDIR/lppasswd systemv/lppasswd
8358  f 0755 root sys $BINDIR/lpq berkeley/lpq
8359  f 0755 root sys $BINDIR/lpr berkeley/lpr
8360  f 0755 root sys $BINDIR/lprm berkeley/lprm
8361 @@ -342,7 +342,7 @@
8362  %subpackage ja
8363  f 0644 root sys $LOCALEDIR/ja/cups_ja.po locale/cups_ja.po
8364  %subpackage pl
8365 -#f 0644 root sys $LOCALEDIR/pl/cups_pl.po locale/cups_pl.po
8366 +f 0644 root sys $LOCALEDIR/pl/cups_pl.po locale/cups_pl.po
8367  %subpackage sv
8368  f 0644 root sys $LOCALEDIR/sv/cups_sv.po locale/cups_sv.po
8369  %subpackage
8370 @@ -550,5 +550,5 @@
8371  i 0755 root sys cups init/cups.sh
8372  
8373  #
8374 -# End of "$Id$".
8375 +# End of "$Id$".
8376  #
8377 diff -durN release-1.2.1/packaging/cups.spec.in cups-1.2.x/packaging/cups.spec.in
8378 --- release-1.2.1/packaging/cups.spec.in        2006-07-04 17:32:09.000000000 +0100
8379 +++ cups-1.2.x/packaging/cups.spec.in   2006-06-26 12:42:38.000000000 +0100
8380 @@ -1,5 +1,5 @@
8381  #
8382 -# "$Id$"
8383 +# "$Id$"
8384  #
8385  #   RPM "spec" file for the Common UNIX Printing System (CUPS).
8386  #
8387 @@ -399,7 +399,7 @@
8388  /usr/share/doc/cups/pl/images/*
8389  %dir /usr/share/cups/templates/pl
8390  /usr/share/cups/templates/pl/*
8391 -#/usr/share/locale/pl/cups_pl.po
8392 +/usr/share/locale/pl/cups_pl.po
8393  
8394  %files sv
8395  %defattr(-,root,root)
8396 @@ -419,5 +419,5 @@
8397  
8398  
8399  #
8400 -# End of "$Id$".
8401 +# End of "$Id$".
8402  #
8403 diff -durN release-1.2.1/pdftops/PSOutputDev.cxx cups-1.2.x/pdftops/PSOutputDev.cxx
8404 --- release-1.2.1/pdftops/PSOutputDev.cxx       2006-07-04 17:32:06.000000000 +0100
8405 +++ cups-1.2.x/pdftops/PSOutputDev.cxx  2006-06-28 09:59:03.000000000 +0100
8406 @@ -1158,7 +1158,7 @@
8407      break;
8408    }
8409  
8410 -  writePSFmt("% Produced by xpdf/pdftops %s\n", xpdfVersion);
8411 +  writePSFmt("%%Producer: xpdf/pdftops %s\n", xpdfVersion);
8412    xref->getDocInfo(&info);
8413    if (info.dictLookup("Creator", &obj1)->isString()) {
8414      writePS("%%Creator: ");
8415 diff -durN release-1.2.1/ppd/zebracpl.ppd cups-1.2.x/ppd/zebracpl.ppd
8416 --- release-1.2.1/ppd/zebracpl.ppd      2006-07-04 17:32:08.000000000 +0100
8417 +++ cups-1.2.x/ppd/zebracpl.ppd 2006-07-04 17:28:24.000000000 +0100
8418 @@ -120,6 +120,14 @@
8419  *Resolution 203dpi/203 DPI: "<</HWResolution[203 203]>>setpagedevice"
8420  *CloseUI: *Resolution
8421  
8422 +*OpenUI *zeMediaTracking/Media Tracking: PickOne
8423 +*OrderDependency: 20 AnySetup *zeMediaTracking
8424 +*DefaultzeMediaTracking: Web
8425 +*zeMediaTracking Continuous: ""
8426 +*zeMediaTracking Web/Non-continuous (Web sensing): ""
8427 +*zeMediaTracking Mark/Non-continuous (Mark sensing): ""
8428 +*CloseUI: *zeMediaTracking
8429 +
8430  *OpenGroup: PrinterSettings/Printer Settings
8431  *OpenUI *Darkness/Media Darkness: PickOne
8432  *OrderDependency: 20 AnySetup *Darkness
8433 diff -durN release-1.2.1/scheduler/auth.c cups-1.2.x/scheduler/auth.c
8434 --- release-1.2.1/scheduler/auth.c      2006-07-04 17:35:29.000000000 +0100
8435 +++ cups-1.2.x/scheduler/auth.c 2006-06-26 12:45:38.000000000 +0100
8436 @@ -1,5 +1,5 @@
8437  /*
8438 - * "$Id$"
8439 + * "$Id$"
8440   *
8441   *   Authorization routines for the Common UNIX Printing System (CUPS).
8442   *
8443 @@ -869,9 +869,12 @@
8444             */
8445  
8446             for (iface = (cupsd_netif_t *)cupsArrayFirst(NetIFList);
8447 -                iface && !strcmp(masks->mask.name.name, iface->name);
8448 +                iface;
8449                  iface = (cupsd_netif_t *)cupsArrayNext(NetIFList))
8450             {
8451 +              if (strcmp(masks->mask.name.name, iface->name))
8452 +                continue;
8453 +
8454                if (iface->address.addr.sa_family == AF_INET)
8455               {
8456                /*
8457 @@ -2168,5 +2171,5 @@
8458  
8459  
8460  /*
8461 - * End of "$Id$".
8462 + * End of "$Id$".
8463   */
8464 diff -durN release-1.2.1/scheduler/client.c cups-1.2.x/scheduler/client.c
8465 --- release-1.2.1/scheduler/client.c    2006-07-04 17:35:29.000000000 +0100
8466 +++ cups-1.2.x/scheduler/client.c       2006-06-26 12:45:38.000000000 +0100
8467 @@ -1,5 +1,5 @@
8468  /*
8469 - * "$Id$"
8470 + * "$Id$"
8471   *
8472   *   Client routines for the Common UNIX Printing System (CUPS) scheduler.
8473   *
8474 @@ -54,6 +54,11 @@
8475  
8476  #ifdef HAVE_CDSASSL
8477  #  include <Security/Security.h>
8478 +#  ifdef HAVE_SECBASEPRIV_H
8479 +#    include <Security/SecBasePriv.h>
8480 +#  else
8481 +     extern const char *cssmErrorString(int error);
8482 +#  endif /* HAVE_SECBASEPRIV_H */
8483  #endif /* HAVE_CDSASSL */
8484  #ifdef HAVE_GNUTLS
8485  #  include <gnutls/x509.h>
8486 @@ -1882,24 +1887,27 @@
8487  
8488  
8489    if (con->filename)
8490 +  {
8491      fd = open(con->filename, O_RDONLY);
8492 -  else
8493 -    fd = open("/dev/null", O_RDONLY);
8494  
8495 -  if (fd < 0)
8496 -  {
8497 -    cupsdLogMessage(CUPSD_LOG_ERROR,
8498 -                    "cupsdSendCommand: %d Unable to open \"%s\" for reading: %s",
8499 -                    con->http.fd, con->filename ? con->filename : "/dev/null",
8500 -                   strerror(errno));
8501 -    return (0);
8502 -  }
8503 +    if (fd < 0)
8504 +    {
8505 +      cupsdLogMessage(CUPSD_LOG_ERROR,
8506 +                      "cupsdSendCommand: %d Unable to open \"%s\" for reading: %s",
8507 +                      con->http.fd, con->filename ? con->filename : "/dev/null",
8508 +                     strerror(errno));
8509 +      return (0);
8510 +    }
8511  
8512 -  fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
8513 +    fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
8514 +  }
8515 +  else
8516 +    fd = -1;
8517  
8518    con->pipe_pid = pipe_command(con, fd, &(con->file), command, options, root);
8519  
8520 -  close(fd);
8521 +  if (fd >= 0)
8522 +    close(fd);
8523  
8524    cupsdLogMessage(CUPSD_LOG_INFO, "Started \"%s\" (pid=%d)", command,
8525                    con->pipe_pid);
8526 @@ -2659,7 +2667,7 @@
8527      error = SSLSetIOFuncs(conn->session, _httpReadCDSA, _httpWriteCDSA);
8528  
8529    if (!error)
8530 -    error = SSLSetProtocolVersion(conn->session, kSSLProtocol3);
8531 +    error = SSLSetProtocolVersionEnabled(conn->session, kSSLProtocol2, false);
8532  
8533    if (!error)
8534    {
8535 @@ -2697,8 +2705,8 @@
8536                      "encrypt_client: Unable to encrypt connection from %s!",
8537                      con->http.hostname);
8538  
8539 -    cupsdLogMessage(CUPSD_LOG_ERROR,
8540 -                    "encrypt_client: CDSA error code is %d", (int)error);
8541 +    cupsdLogMessage(CUPSD_LOG_ERROR, "encrypt_client: %s (%d)",
8542 +                    cssmErrorString(error), (int)error);
8543  
8544      con->http.error  = error;
8545      con->http.status = HTTP_ERROR;
8546 @@ -3825,5 +3833,5 @@
8547  
8548  
8549  /*
8550 - * End of "$Id$".
8551 + * End of "$Id$".
8552   */
8553 diff -durN release-1.2.1/scheduler/conf.c cups-1.2.x/scheduler/conf.c
8554 --- release-1.2.1/scheduler/conf.c      2006-07-04 17:35:29.000000000 +0100
8555 +++ cups-1.2.x/scheduler/conf.c 2006-06-28 09:59:05.000000000 +0100
8556 @@ -1,5 +1,5 @@
8557  /*
8558 - * "$Id$"
8559 + * "$Id$"
8560   *
8561   *   Configuration routines for the Common UNIX Printing System (CUPS).
8562   *
8563 @@ -289,6 +289,11 @@
8564    cupsdSetString(&ServerHeader, "CUPS/1.2");
8565    cupsdSetString(&StateDir, CUPS_STATEDIR);
8566  
8567 +  if (!strcmp(CUPS_DEFAULT_PRINTCAP, "/etc/printers.conf"))
8568 +    PrintcapFormat = PRINTCAP_SOLARIS;
8569 +  else
8570 +    PrintcapFormat = PRINTCAP_BSD;
8571 +
8572    strlcpy(temp, ConfigurationFile, sizeof(temp));
8573    if ((slash = strrchr(temp, '/')) != NULL)
8574      *slash = '\0';
8575 @@ -463,6 +468,14 @@
8576    RunUser = getuid();
8577  
8578   /*
8579 +  * See if the ServerName is an IP address...
8580 +  */
8581 +
8582 +  for (slash = ServerName; isdigit(*slash & 255) || *slash == '.'; slash ++);
8583 +
8584 +  ServerNameIsIP = !*slash;
8585 +
8586 + /*
8587    * Use the default system group if none was supplied in cupsd.conf...
8588    */
8589  
8590 @@ -1277,33 +1290,14 @@
8591    const char   *maskval,               /* Pointer to start of mask value */
8592                 *ptr,                   /* Pointer into value */
8593                 *ptr2;                  /* ... */
8594 -  static unsigned netmasks[4][4] =     /* Standard IPv4 netmasks... */
8595 -  {
8596 -    { 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000 },
8597 -    { 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0000 },
8598 -    { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffff00 },
8599 -    { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
8600 -  };
8601 -#ifdef AF_INET6
8602 -  static unsigned netmasks6[8][4] =    /* Standard IPv6 netmasks... */
8603 -  {
8604 -    { 0xffff0000, 0x00000000, 0x00000000, 0x00000000 },
8605 -    { 0xffffffff, 0x00000000, 0x00000000, 0x00000000 },
8606 -    { 0xffffffff, 0xffff0000, 0x00000000, 0x00000000 },
8607 -    { 0xffffffff, 0xffffffff, 0x00000000, 0x00000000 },
8608 -    { 0xffffffff, 0xffffffff, 0xffff0000, 0x00000000 },
8609 -    { 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000 },
8610 -    { 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0000 },
8611 -    { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
8612 -  };
8613 -#endif /* AF_INET6 */
8614  
8615  
8616   /*
8617    * Get the address...
8618    */
8619  
8620 -  memset(ip, 0, sizeof(unsigned) * 4);
8621 +  ip[0]   = ip[1]   = ip[2]   = ip[2]   = 0x00000000;
8622 +  mask[0] = mask[1] = mask[2] = mask[3] = 0xffffffff;
8623  
8624    if ((maskval = strchr(value, '/')) != NULL)
8625      maskval ++;
8626 @@ -1334,6 +1328,7 @@
8627              ptr2 = strchr(ptr2 + 1, ':'), j ++);
8628  
8629          i = 7 - j;
8630 +       ptr ++;
8631        }
8632        else if (isxdigit(*ptr & 255))
8633        {
8634 @@ -1343,9 +1338,9 @@
8635           return (0);
8636  
8637          if (i & 1)
8638 -          ip[i] |= ipval;
8639 +          ip[i / 2] |= ipval;
8640         else
8641 -          ip[i] |= ipval << 16;
8642 +          ip[i / 2] |= ipval << 16;
8643        }
8644        else
8645          return (0);
8646 @@ -1354,7 +1349,10 @@
8647          ptr ++;
8648      }
8649  
8650 -    ipcount = i;
8651 +    if (*ptr != ']')
8652 +      return (0);
8653 +
8654 +    ptr ++;
8655  
8656      if (*ptr && *ptr != '/')
8657        return (0);
8658 @@ -1366,70 +1364,55 @@
8659      * Parse dotted-decimal IPv4 address...
8660      */
8661  
8662 -    family  = AF_INET;
8663 -    ipcount = sscanf(value, "%u.%u.%u.%u", ip + 0, ip + 1, ip + 2, ip + 3);
8664 +    unsigned val[4];                   /* IPv4 address values */
8665  
8666 -    ip[3] |= ((((ip[0] << 8) | ip[1]) << 8) | ip[2]) << 8;
8667 -    ip[0] = ip[1] = ip[2] = 0;
8668 -  }
8669  
8670 -  if (*maskval)
8671 -  {
8672 +    family  = AF_INET;
8673 +    ipcount = sscanf(value, "%u.%u.%u.%u", val + 0, val + 1, val + 2, val + 3);
8674 +
8675     /*
8676 -    * Get the netmask value(s)...
8677 +    * Range check the IP numbers...
8678      */
8679  
8680 -    memset(mask, 0, sizeof(unsigned) * 4);
8681 +    for (i = 0; i < ipcount; i ++)
8682 +      if (val[i] > 255)
8683 +        return (0);
8684  
8685 -#ifdef AF_INET6
8686 -    if (*maskval == '[')
8687 -    {
8688 -     /*
8689 -      * Get hexadecimal mask value...
8690 -      */
8691 +   /*
8692 +    * Make sure the trailing values are zeroed, as some C libraries like
8693 +    * glibc apparently like to fill the unused arguments with garbage...
8694 +    */
8695  
8696 -      for (i = 0, ptr = maskval + 1; *ptr && i < 8; i ++)
8697 -      {
8698 -       if (*ptr == ']')
8699 -         break;
8700 -       else if (!strncmp(ptr, "::", 2))
8701 -       {
8702 -          for (ptr2 = strchr(ptr + 2, ':'), j = 0;
8703 -              ptr2;
8704 -              ptr2 = strchr(ptr2 + 1, ':'), j ++);
8705 +    for (i = ipcount; i < 4; i ++)
8706 +      val[i] = 0;
8707  
8708 -          i = 7 - j;
8709 -       }
8710 -       else if (isxdigit(*ptr & 255))
8711 -       {
8712 -          ipval = strtoul(ptr, (char **)&ptr, 16);
8713 +   /*
8714 +    * Merge everything into a 32-bit IPv4 address in ip[3]...
8715 +    */
8716  
8717 -         if (ipval > 0xffff)
8718 -           return (0);
8719 +    ip[3] = (((((val[0] << 8) | val[1]) << 8) | val[2]) << 8) | val[3];
8720  
8721 -          if (i & 1)
8722 -            mask[i] |= ipval;
8723 -         else
8724 -            mask[i] |= ipval << 16;
8725 -       }
8726 -       else
8727 -          return (0);
8728 +    if (ipcount < 4)
8729 +      mask[3] = (0xffffffff << (32 - 8 * ipcount)) & 0xffffffff;
8730 +  }
8731  
8732 -        while (*ptr == ':')
8733 -          ptr ++;
8734 -      }
8735 +  if (*maskval)
8736 +  {
8737 +   /*
8738 +    * Get the netmask value(s)...
8739 +    */
8740 +
8741 +    memset(mask, 0, sizeof(unsigned) * 4);
8742  
8743 -      if (*ptr)
8744 -       return (0);
8745 -    }
8746 -    else
8747 -#endif /* AF_INET6 */
8748      if (strchr(maskval, '.'))
8749      {
8750       /*
8751        * Get dotted-decimal mask...
8752        */
8753  
8754 +      if (family != AF_INET)
8755 +        return (0);
8756 +
8757        if (sscanf(maskval, "%u.%u.%u.%u", mask + 0, mask + 1, mask + 2, mask + 3) != 4)
8758          return (0);
8759  
8760 @@ -1447,6 +1430,9 @@
8761  #ifdef AF_INET6
8762        if (family == AF_INET6)
8763        {
8764 +        if (i > 128)
8765 +         return (0);
8766 +
8767          i = 128 - i;
8768  
8769         if (i <= 96)
8770 @@ -1478,25 +1464,20 @@
8771        else
8772  #endif /* AF_INET6 */
8773        {
8774 -        i = 32 - i;
8775 +        if (i > 32)
8776 +         return (0);
8777  
8778          mask[0] = 0xffffffff;
8779          mask[1] = 0xffffffff;
8780          mask[2] = 0xffffffff;
8781  
8782 -       if (i > 0)
8783 -          mask[3] = (0xffffffff << i) & 0xffffffff;
8784 +       if (i < 32)
8785 +          mask[3] = (0xffffffff << (32 - i)) & 0xffffffff;
8786         else
8787           mask[3] = 0xffffffff;
8788        }
8789      }
8790    }
8791 -#ifdef AF_INET6
8792 -  else if (family == AF_INET6)
8793 -    memcpy(mask, netmasks6[ipcount - 1], sizeof(unsigned) * 4);
8794 -#endif /* AF_INET6 */
8795 -  else
8796 -    memcpy(mask, netmasks[ipcount - 1], sizeof(unsigned) * 4);
8797  
8798    cupsdLogMessage(CUPSD_LOG_DEBUG2,
8799                    "get_addr_and_mask(value=\"%s\", "
8800 @@ -1634,7 +1615,12 @@
8801        else
8802         cupsdDenyIP(loc, ones, zeros);
8803      }
8804 +#ifdef AF_INET6
8805 +    else if (value[0] == '*' || value[0] == '.' || 
8806 +             (!isdigit(value[0] & 255) && value[0] != '['))
8807 +#else
8808      else if (value[0] == '*' || value[0] == '.' || !isdigit(value[0] & 255))
8809 +#endif /* AF_INET6 */
8810      {
8811       /*
8812        * Host or domain name...
8813 @@ -2406,7 +2392,12 @@
8814           else
8815             cupsdDenyIP(location, ones, zeros);
8816         }
8817 -       else if (value[0] == '*' || value[0] == '.' || !isdigit(value[0]))
8818 +#ifdef AF_INET6
8819 +       else if (value[0] == '*' || value[0] == '.' || 
8820 +                (!isdigit(value[0] & 255) && value[0] != '['))
8821 +#else
8822 +       else if (value[0] == '*' || value[0] == '.' || !isdigit(value[0] & 255))
8823 +#endif /* AF_INET6 */
8824         {
8825          /*
8826            * Host or domain name...
8827 @@ -2490,7 +2481,12 @@
8828        *    nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm
8829        */
8830  
8831 -      if (value[0] == '*' || value[0] == '.' || !isdigit(value[0]))
8832 +#ifdef AF_INET6
8833 +      if (value[0] == '*' || value[0] == '.' || 
8834 +          (!isdigit(value[0] & 255) && value[0] != '['))
8835 +#else
8836 +      if (value[0] == '*' || value[0] == '.' || !isdigit(value[0] & 255))
8837 +#endif /* AF_INET6 */
8838        {
8839         /*
8840          * Host or domain name...
8841 @@ -2584,7 +2580,7 @@
8842             strlcpy(temp2, relay->from.mask.name.name, sizeof(temp2));
8843    
8844           cupsdLogMessage(CUPSD_LOG_INFO, "Relaying from %s to %s:%d (IPv4)",
8845 -                         temp, temp2, ntohs(relay->to.ipv4.sin_port));
8846 +                         temp2, temp, ntohs(relay->to.ipv4.sin_port));
8847    
8848           NumRelays ++;
8849         }
8850 @@ -3261,5 +3257,5 @@
8851  
8852  
8853  /*
8854 - * End of "$Id$".
8855 + * End of "$Id$".
8856   */
8857 diff -durN release-1.2.1/scheduler/conf.h cups-1.2.x/scheduler/conf.h
8858 --- release-1.2.1/scheduler/conf.h      2006-07-04 17:35:29.000000000 +0100
8859 +++ cups-1.2.x/scheduler/conf.h 2006-06-28 09:59:05.000000000 +0100
8860 @@ -1,5 +1,5 @@
8861  /*
8862 - * "$Id$"
8863 + * "$Id$"
8864   *
8865   *   Configuration file definitions for the Common UNIX Printing System (CUPS)
8866   *   scheduler.
8867 @@ -74,6 +74,7 @@
8868                                         /* Directory for request files */
8869                         *DocumentRoot           VALUE(NULL);
8870                                         /* Root directory for documents */
8871 +VAR int                        ServerNameIsIP          VALUE(0);
8872  VAR int                        NumSystemGroups         VALUE(0);
8873                                         /* Number of system group names */
8874  VAR char               *SystemGroups[MAX_SYSTEM_GROUPS];
8875 @@ -210,5 +211,5 @@
8876  
8877  
8878  /*
8879 - * End of "$Id$".
8880 + * End of "$Id$".
8881   */
8882 diff -durN release-1.2.1/scheduler/dirsvc.c cups-1.2.x/scheduler/dirsvc.c
8883 --- release-1.2.1/scheduler/dirsvc.c    2006-07-04 17:35:29.000000000 +0100
8884 +++ cups-1.2.x/scheduler/dirsvc.c       2006-06-28 09:59:05.000000000 +0100
8885 @@ -1,5 +1,5 @@
8886  /*
8887 - * "$Id$"
8888 + * "$Id$"
8889   *
8890   *   Directory services routines for the Common UNIX Printing System (CUPS).
8891   *
8892 @@ -36,6 +36,7 @@
8893   *   cupsdStopPolling()            - Stop polling servers as needed.
8894   *   cupsdUpdateCUPSBrowse()       - Update the browse lists using the CUPS
8895   *                                   protocol.
8896 + *   cupsdUpdateLDAPBrowse()       - Scan for new printers via LDAP...
8897   *   cupsdUpdatePolling()          - Read status messages from the poll daemons.
8898   *   cupsdUpdateSLPBrowse()        - Get browsing information via SLP.
8899   *   dequote()                     - Remote quotes from a string.
8900 @@ -905,14 +906,21 @@
8901      fcntl(BrowseSocket, F_SETFD, fcntl(BrowseSocket, F_GETFD) | FD_CLOEXEC);
8902  
8903     /*
8904 -    * Finally, add the socket to the input selection set...
8905 +    * Finally, add the socket to the input selection set as needed...
8906      */
8907  
8908 -    cupsdLogMessage(CUPSD_LOG_DEBUG2,
8909 -                    "cupsdStartBrowsing: Adding fd %d to InputSet...",
8910 -                    BrowseSocket);
8911 +    if (BrowseRemoteProtocols & BROWSE_CUPS)
8912 +    {
8913 +     /*
8914 +      * We only listen if we want remote printers...
8915 +      */
8916  
8917 -    FD_SET(BrowseSocket, InputSet);
8918 +      cupsdLogMessage(CUPSD_LOG_DEBUG2,
8919 +                      "cupsdStartBrowsing: Adding fd %d to InputSet...",
8920 +                      BrowseSocket);
8921 +
8922 +      FD_SET(BrowseSocket, InputSet);
8923 +    }
8924    }
8925    else
8926      BrowseSocket = -1;
8927 @@ -1526,39 +1534,57 @@
8928    * Loop through the available printers...
8929    */
8930  
8931 -  if ((e = ldap_first_entry(BrowseLDAPHandle, res)) == NULL)
8932 +  for (e = ldap_first_entry(BrowseLDAPHandle, res);
8933 +       e;
8934 +       e = ldap_next_entry(BrowseLDAPHandle, e))
8935    {
8936 -    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to get LDAP printer entry!");
8937 -    return;
8938 -  }
8939 +   /*
8940 +    * Get the required values from this entry...
8941 +    */
8942 +
8943 +    if ((value = ldap_get_values(BrowseLDAPHandle, e,
8944 +                                 "printerDescription")) == NULL)
8945 +      continue;
8946  
8947 -  while (e)
8948 -  {
8949 -    value = ldap_get_values(BrowseLDAPHandle, e, "printerDescription");
8950      strlcpy(info, *value, sizeof(info));
8951      ldap_value_free(value);
8952  
8953 -    value = ldap_get_values(BrowseLDAPHandle, e, "printerLocation");
8954 +    if ((value = ldap_get_values(BrowseLDAPHandle, e,
8955 +                                 "printerLocation")) == NULL)
8956 +      continue;
8957 +
8958      strlcpy(location, *value, sizeof(location));
8959      ldap_value_free(value);
8960  
8961 -    value = ldap_get_values(BrowseLDAPHandle, e, "printerMakeAndModel");
8962 +    if ((value = ldap_get_values(BrowseLDAPHandle, e,
8963 +                                 "printerMakeAndModel")) == NULL)
8964 +      continue;
8965 +
8966      strlcpy(make_model, *value, sizeof(make_model));
8967      ldap_value_free(value);
8968  
8969 -    value = ldap_get_values(BrowseLDAPHandle, e, "printerType");
8970 +    if ((value = ldap_get_values(BrowseLDAPHandle, e,
8971 +                                 "printerType")) == NULL)
8972 +      continue;
8973 +
8974      type = atoi(*value);
8975      ldap_value_free(value);
8976  
8977 -    value = ldap_get_values(BrowseLDAPHandle, e, "printerURI");
8978 +    if ((value = ldap_get_values(BrowseLDAPHandle, e,
8979 +                                 "printerURI")) == NULL)
8980 +      continue;
8981 +
8982      strlcpy(uri, *value, sizeof(uri));
8983      ldap_value_free(value);
8984  
8985 +   /*
8986 +    * Process the entry as browse data...
8987 +    */
8988 +
8989      if (!is_local_queue(uri, host, sizeof(host), resource, sizeof(resource)))
8990        process_browse_data(uri, host, resource, type, IPP_PRINTER_IDLE,
8991                            location, info, make_model, 0, NULL);
8992  
8993 -    e = ldap_next_entry(BrowseLDAPHandle, e);
8994    }
8995  }
8996  #endif /* HAVE_OPENLDAP */
8997 @@ -1866,7 +1892,7 @@
8998    hptr   = strchr(host, '.');
8999    sptr   = strchr(ServerName, '.');
9000  
9001 -  if (sptr != NULL && hptr != NULL)
9002 +  if (!ServerNameIsIP && sptr != NULL && hptr != NULL)
9003    {
9004     /*
9005      * Strip the common domain name components...
9006 @@ -2521,7 +2547,7 @@
9007  
9008           httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
9009                            iface->hostname, iface->port,
9010 -                          (p->type & CUPS_PRINTER_CLASS) ? "/classes/%s%s" :
9011 +                          (p->type & CUPS_PRINTER_CLASS) ? "/classes/%s" :
9012                                                             "/printers/%s",
9013                            p->name);
9014           snprintf(packet, sizeof(packet), "%x %x %s \"%s\" \"%s\" \"%s\" %s\n",
9015 @@ -2660,13 +2686,13 @@
9016  
9017    sprintf(typestring, "%u", p->type);
9018  
9019 -  cn_value[0]   = p->info;
9020 +  cn_value[0]   = p->name;
9021    cn_value[1]   = NULL;
9022 -  info[0]       = p->info;
9023 +  info[0]       = p->info ? p->info : "Unknown";
9024    info[1]       = NULL;
9025 -  location[0]   = p->location;
9026 +  location[0]   = p->location ? p->location : "Unknown";
9027    location[1]   = NULL;
9028 -  make_model[0] = p->make_model;
9029 +  make_model[0] = p->make_model ? p->make_model : "Unknown";
9030    make_model[1] = NULL;
9031    type[0]       = typestring;
9032    type[1]       = NULL;
9033 @@ -2674,7 +2700,7 @@
9034    uri[1]        = NULL;
9035  
9036    snprintf(filter, sizeof(filter),
9037 -           "(&(objectclass=cupsPrinter)(printerDescription~=%s))", p->info);
9038 +           "(&(objectclass=cupsPrinter)(printerURI=%s))", p->uri);
9039  
9040    ldap_search_s(BrowseLDAPHandle, BrowseLDAPDN, LDAP_SCOPE_SUBTREE,
9041                  filter, (char **)ldap_attrs, 0, &res);
9042 @@ -2696,7 +2722,7 @@
9043    mods[6].mod_type = "objectClass";
9044    mods[6].mod_values = (char **)objectClass_values;
9045  
9046 -  snprintf(dn, sizeof(dn), "cn=%s,ou=printers,%s", p->info, BrowseLDAPDN);
9047 +  snprintf(dn, sizeof(dn), "cn=%s,ou=printers,%s", p->name, BrowseLDAPDN);
9048    cupsdLogMessage(CUPSD_LOG_DEBUG2, "send_ldap_browse: dn=\"%s\"", dn);
9049  
9050    if (ldap_count_entries(BrowseLDAPHandle, res) > 0)
9051 @@ -2724,7 +2750,7 @@
9052    else 
9053    {
9054     /*
9055 -    * Printer has already been registered, modify the current
9056 +    * Printer has never been registered, add the current
9057      * registration...
9058      */
9059  
9060 @@ -2734,11 +2760,11 @@
9061      for (i = 0; i < 7; i ++)
9062      {
9063        pmods[i]         = mods + i;
9064 -      pmods[i]->mod_op = LDAP_MOD_REPLACE;
9065 +      pmods[i]->mod_op = LDAP_MOD_ADD;
9066      }
9067      pmods[i] = NULL;
9068  
9069 -    if ((rc = ldap_modify_s(BrowseLDAPHandle, dn, pmods)) != LDAP_SUCCESS)
9070 +    if ((rc = ldap_add_s(BrowseLDAPHandle, dn, pmods)) != LDAP_SUCCESS)
9071        cupsdLogMessage(CUPSD_LOG_ERROR,
9072                        "LDAP add for %s failed with status %d: %s",
9073                        p->name, rc, ldap_err2string(rc));
9074 @@ -3130,5 +3156,5 @@
9075  
9076  
9077  /*
9078 - * End of "$Id$".
9079 + * End of "$Id$".
9080   */
9081 diff -durN release-1.2.1/scheduler/filter.c cups-1.2.x/scheduler/filter.c
9082 --- release-1.2.1/scheduler/filter.c    2006-07-04 17:35:29.000000000 +0100
9083 +++ cups-1.2.x/scheduler/filter.c       2006-06-26 12:45:38.000000000 +0100
9084 @@ -1,5 +1,5 @@
9085  /*
9086 - * "$Id$"
9087 + * "$Id$"
9088   *
9089   *   File type conversion routines for the Common UNIX Printing System (CUPS).
9090   *
9091 @@ -346,6 +346,8 @@
9092      * any...)
9093      */
9094  
9095 +    tempcost += current->cost;
9096 +
9097      if (tempcost < mincost)
9098      {
9099        cupsArrayDelete(mintemp);
9100 @@ -356,7 +358,7 @@
9101        */
9102  
9103        mintemp = temp;
9104 -      mincost = tempcost + current->cost;
9105 +      mincost = tempcost;
9106        cupsArrayInsert(mintemp, current);
9107      }
9108      else
9109 @@ -409,5 +411,5 @@
9110  
9111  
9112  /*
9113 - * End of "$Id$".
9114 + * End of "$Id$".
9115   */
9116 diff -durN release-1.2.1/scheduler/ipp.c cups-1.2.x/scheduler/ipp.c
9117 --- release-1.2.1/scheduler/ipp.c       2006-07-04 17:35:29.000000000 +0100
9118 +++ cups-1.2.x/scheduler/ipp.c  2006-06-26 12:45:38.000000000 +0100
9119 @@ -1,5 +1,5 @@
9120  /*
9121 - * "$Id$"
9122 + * "$Id$"
9123   *
9124   *   IPP routines for the Common UNIX Printing System (CUPS) scheduler.
9125   *
9126 @@ -4677,8 +4677,8 @@
9127    ipp_attribute_t      *attr;          /* Current attribute */
9128    const char           *dest;          /* Destination */
9129    cups_ptype_t         dtype;          /* Destination type (printer or class) */
9130 -  char                 method[HTTP_MAX_URI],
9131 -                                       /* Method portion of URI */
9132 +  char                 scheme[HTTP_MAX_URI],
9133 +                                       /* Scheme portion of URI */
9134                         userpass[HTTP_MAX_URI],
9135                                         /* Username portion of URI */
9136                         host[HTTP_MAX_URI],
9137 @@ -4718,8 +4718,8 @@
9138                    "cupsdCreateSubscription(con=%p(%d), uri=\"%s\")",
9139                    con, con->http.fd, uri->values[0].string.text);
9140  
9141 -  httpSeparateURI(HTTP_URI_CODING_ALL, uri->values[0].string.text, method,
9142 -                  sizeof(method), userpass, sizeof(userpass), host,
9143 +  httpSeparateURI(HTTP_URI_CODING_ALL, uri->values[0].string.text, scheme,
9144 +                  sizeof(scheme), userpass, sizeof(userpass), host,
9145                   sizeof(host), &port, resource, sizeof(resource));
9146  
9147    if (!strcmp(resource, "/"))
9148 @@ -4811,10 +4811,54 @@
9149      {
9150        if (!strcmp(attr->name, "notify-recipient") &&
9151            attr->value_tag == IPP_TAG_URI)
9152 +      {
9153 +       /*
9154 +        * Validate the recipient scheme against the ServerBin/notifier
9155 +       * directory...
9156 +       */
9157 +
9158 +       char    notifier[1024];         /* Notifier filename */
9159 +
9160 +
9161          recipient = attr->values[0].string.text;
9162 +
9163 +       if (httpSeparateURI(HTTP_URI_CODING_ALL, recipient, scheme,
9164 +                           sizeof(scheme), userpass, sizeof(userpass), host,
9165 +                           sizeof(host), &port, resource, sizeof(resource)))
9166 +        {
9167 +          send_ipp_status(con, IPP_NOT_POSSIBLE,
9168 +                         _("Bad notify-recipient URI \"%s\"!"), recipient);
9169 +         ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM,
9170 +                       "notify-status-code", IPP_URI_SCHEME);
9171 +         return;
9172 +       }
9173 +
9174 +        snprintf(notifier, sizeof(notifier), "%s/notifier/%s", ServerBin,
9175 +                scheme);
9176 +        if (access(notifier, X_OK))
9177 +       {
9178 +          send_ipp_status(con, IPP_NOT_POSSIBLE,
9179 +                         _("notify-recipient URI \"%s\" uses unknown scheme!"),
9180 +                         recipient);
9181 +         ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM,
9182 +                       "notify-status-code", IPP_URI_SCHEME);
9183 +         return;
9184 +       }
9185 +      }
9186        else if (!strcmp(attr->name, "notify-pull-method") &&
9187                 attr->value_tag == IPP_TAG_KEYWORD)
9188 +      {
9189          pullmethod = attr->values[0].string.text;
9190 +
9191 +        if (strcmp(pullmethod, "ippget"))
9192 +       {
9193 +          send_ipp_status(con, IPP_NOT_POSSIBLE,
9194 +                         _("Bad notify-pull-method \"%s\"!"), pullmethod);
9195 +         ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM,
9196 +                       "notify-status-code", IPP_ATTRIBUTES);
9197 +         return;
9198 +       }
9199 +      }
9200        else if (!strcmp(attr->name, "notify-charset") &&
9201                 attr->value_tag == IPP_TAG_CHARSET &&
9202                strcmp(attr->values[0].string.text, "us-ascii") &&
9203 @@ -9170,5 +9214,5 @@
9204  
9205  
9206  /*
9207 - * End of "$Id$".
9208 + * End of "$Id$".
9209   */
9210 diff -durN release-1.2.1/scheduler/job.c cups-1.2.x/scheduler/job.c
9211 --- release-1.2.1/scheduler/job.c       2006-07-04 17:35:29.000000000 +0100
9212 +++ cups-1.2.x/scheduler/job.c  2006-06-28 09:59:05.000000000 +0100
9213 @@ -1,5 +1,5 @@
9214  /*
9215 - * "$Id$"
9216 + * "$Id$"
9217   *
9218   *   Job management routines for the Common UNIX Printing System (CUPS).
9219   *
9220 @@ -506,8 +506,19 @@
9221           */
9222  
9223           cupsdStopJob(job, 0);
9224 -         job->state->values[0].integer = IPP_JOB_PENDING;
9225 -         job->state_value              = IPP_JOB_PENDING;
9226 +
9227 +          if (!(printer->type & CUPS_PRINTER_REMOTE) ||
9228 +             (printer->type & CUPS_PRINTER_IMPLICIT))
9229 +         {
9230 +          /*
9231 +           * Mark the job as pending again - we'll retry on another
9232 +           * printer...
9233 +           */
9234 +
9235 +           job->state->values[0].integer = IPP_JOB_PENDING;
9236 +           job->state_value              = IPP_JOB_PENDING;
9237 +          }
9238 +
9239           cupsdSaveJob(job);
9240  
9241          /*
9242 @@ -3011,7 +3022,7 @@
9243    {
9244      snprintf(final_content_type, sizeof(final_content_type),
9245               "FINAL_CONTENT_TYPE=%s/%s",
9246 -            filter->dst->super, filter->dst->type);
9247 +            filter->src->super, filter->src->type);
9248      envp[envc ++] = final_content_type;
9249    }
9250  
9251 @@ -3090,28 +3101,6 @@
9252    job->status = 0;
9253    memset(job->filters, 0, sizeof(job->filters));
9254  
9255 -  filterfds[1][0] = open("/dev/null", O_RDONLY);
9256 -
9257 -  if (filterfds[1][0] < 0)
9258 -  {
9259 -    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open \"/dev/null\" - %s.",
9260 -                    strerror(errno));
9261 -    snprintf(printer->state_message, sizeof(printer->state_message),
9262 -             "Unable to open \"/dev/null\" - %s.", strerror(errno));
9263 -
9264 -    cupsdAddPrinterHistory(printer);
9265 -
9266 -    cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
9267 -                  "Job canceled because the server could not open /dev/null.");
9268 -
9269 -    goto abort_job;
9270 -  }
9271 -
9272 -  fcntl(filterfds[1][0], F_SETFD, fcntl(filterfds[1][0], F_GETFD) | FD_CLOEXEC);
9273 -
9274 -  cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: filterfds[%d] = [ %d %d ]",
9275 -                  1, filterfds[1][0], filterfds[1][1]);
9276 -
9277    for (i = 0, slot = 0, filter = (mime_filter_t *)cupsArrayFirst(filters);
9278         filter;
9279         i ++, filter = (mime_filter_t *)cupsArrayNext(filters))
9280 @@ -3165,36 +3154,43 @@
9281         else
9282         {
9283           job->print_pipes[0] = -1;
9284 -         if (!strncmp(printer->device_uri, "file:/dev/", 10) &&
9285 -             strcmp(printer->device_uri, "file:/dev/null"))
9286 -           job->print_pipes[1] = open(printer->device_uri + 5,
9287 -                                      O_WRONLY | O_EXCL);
9288 -         else if (!strncmp(printer->device_uri, "file:///dev/", 12) &&
9289 -                  strcmp(printer->device_uri, "file:///dev/null"))
9290 -           job->print_pipes[1] = open(printer->device_uri + 7,
9291 -                                      O_WRONLY | O_EXCL);
9292 +         if (!strcmp(printer->device_uri, "file:/dev/null") ||
9293 +             !strcmp(printer->device_uri, "file:///dev/null"))
9294 +           job->print_pipes[1] = -1;
9295           else
9296 -           job->print_pipes[1] = open(printer->device_uri + 5,
9297 -                                      O_WRONLY | O_CREAT | O_TRUNC, 0600);
9298 -
9299 -         if (job->print_pipes[1] < 0)
9300           {
9301 -            cupsdLogMessage(CUPSD_LOG_ERROR,
9302 -                           "Unable to open output file \"%s\" - %s.",
9303 -                           printer->device_uri, strerror(errno));
9304 -            snprintf(printer->state_message, sizeof(printer->state_message),
9305 -                    "Unable to open output file \"%s\" - %s.",
9306 -                    printer->device_uri, strerror(errno));
9307 +           if (!strncmp(printer->device_uri, "file:/dev/", 10))
9308 +             job->print_pipes[1] = open(printer->device_uri + 5,
9309 +                                        O_WRONLY | O_EXCL);
9310 +           else if (!strncmp(printer->device_uri, "file:///dev/", 12))
9311 +             job->print_pipes[1] = open(printer->device_uri + 7,
9312 +                                        O_WRONLY | O_EXCL);
9313 +           else if (!strncmp(printer->device_uri, "file:///", 8))
9314 +             job->print_pipes[1] = open(printer->device_uri + 7,
9315 +                                        O_WRONLY | O_CREAT | O_TRUNC, 0600);
9316 +           else
9317 +             job->print_pipes[1] = open(printer->device_uri + 5,
9318 +                                        O_WRONLY | O_CREAT | O_TRUNC, 0600);
9319  
9320 -           cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
9321 -                         "Job canceled because the server could not open the "
9322 -                         "output file.");
9323 +           if (job->print_pipes[1] < 0)
9324 +           {
9325 +              cupsdLogMessage(CUPSD_LOG_ERROR,
9326 +                             "Unable to open output file \"%s\" - %s.",
9327 +                             printer->device_uri, strerror(errno));
9328 +              snprintf(printer->state_message, sizeof(printer->state_message),
9329 +                      "Unable to open output file \"%s\" - %s.",
9330 +                      printer->device_uri, strerror(errno));
9331  
9332 -            goto abort_job;
9333 -         }
9334 +             cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
9335 +                           "Job canceled because the server could not open the "
9336 +                           "output file.");
9337  
9338 -         fcntl(job->print_pipes[1], F_SETFD,
9339 -               fcntl(job->print_pipes[1], F_GETFD) | FD_CLOEXEC);
9340 +              goto abort_job;
9341 +           }
9342 +
9343 +           fcntl(job->print_pipes[1], F_SETFD,
9344 +                 fcntl(job->print_pipes[1], F_GETFD) | FD_CLOEXEC);
9345 +          }
9346         }
9347  
9348         cupsdLogMessage(CUPSD_LOG_DEBUG2,
9349 @@ -3274,25 +3270,7 @@
9350        argv[0] = sani_uri;
9351  
9352        filterfds[slot][0] = -1;
9353 -      filterfds[slot][1] = open("/dev/null", O_WRONLY);
9354 -
9355 -      if (filterfds[slot][1] < 0)
9356 -      {
9357 -       cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open \"/dev/null\" - %s.",
9358 -                       strerror(errno));
9359 -       snprintf(printer->state_message, sizeof(printer->state_message),
9360 -                "Unable to open \"/dev/null\" - %s.", strerror(errno));
9361 -
9362 -       cupsdAddPrinterHistory(printer);
9363 -
9364 -       cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
9365 -                      "Job canceled because the server could not open a file.");
9366 -
9367 -        goto abort_job;
9368 -      }
9369 -
9370 -      fcntl(filterfds[slot][1], F_SETFD,
9371 -            fcntl(filterfds[slot][1], F_GETFD) | FD_CLOEXEC);
9372 +      filterfds[slot][1] = -1;
9373  
9374        cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: backend=\"%s\"",
9375                        command);
9376 @@ -3455,5 +3433,5 @@
9377  
9378  
9379  /*
9380 - * End of "$Id$".
9381 + * End of "$Id$".
9382   */
9383 diff -durN release-1.2.1/scheduler/main.c cups-1.2.x/scheduler/main.c
9384 --- release-1.2.1/scheduler/main.c      2006-07-04 17:35:29.000000000 +0100
9385 +++ cups-1.2.x/scheduler/main.c 2006-06-26 12:45:38.000000000 +0100
9386 @@ -1,5 +1,5 @@
9387  /*
9388 - * "$Id$"
9389 + * "$Id$"
9390   *
9391   *   Scheduler main loop for the Common UNIX Printing System (CUPS).
9392   *
9393 @@ -357,8 +357,8 @@
9394  
9395    getrlimit(RLIMIT_NOFILE, &limit);
9396  
9397 -  if (limit.rlim_max > CUPS_MAX_FDS)
9398 -    MaxFDs = CUPS_MAX_FDS;
9399 +  if (limit.rlim_max > FD_SETSIZE)
9400 +    MaxFDs = FD_SETSIZE;
9401    else
9402      MaxFDs = limit.rlim_max;
9403  
9404 @@ -2253,5 +2253,5 @@
9405  
9406  
9407  /*
9408 - * End of "$Id$".
9409 + * End of "$Id$".
9410   */
9411 diff -durN release-1.2.1/scheduler/mime.c cups-1.2.x/scheduler/mime.c
9412 --- release-1.2.1/scheduler/mime.c      2006-07-04 17:35:29.000000000 +0100
9413 +++ cups-1.2.x/scheduler/mime.c 2006-06-26 12:45:38.000000000 +0100
9414 @@ -1,5 +1,5 @@
9415  /*
9416 - * "$Id$"
9417 + * "$Id$"
9418   *
9419   *   MIME database file routines for the Common UNIX Printing System (CUPS).
9420   *
9421 @@ -51,6 +51,7 @@
9422  #include <stdlib.h>
9423  #include <ctype.h>
9424  
9425 +#include <cups/debug.h>
9426  #include <cups/dir.h>
9427  #include <cups/string.h>
9428  #include "mime.h"
9429 @@ -486,6 +487,8 @@
9430    if ((fp = cupsFileOpen(filename, "r")) == NULL)
9431      return;
9432  
9433 +  DEBUG_printf(("\"%s\":\n", filename));
9434 +
9435   /*
9436    * Then read each line from the file, skipping any comments in the file...
9437    */
9438 @@ -496,6 +499,8 @@
9439      * Skip blank lines and lines starting with a #...
9440      */
9441  
9442 +    DEBUG_puts(line);
9443 +
9444      if (!line[0] || line[0] == '#')
9445        continue;
9446  
9447 @@ -544,7 +549,10 @@
9448        continue;
9449  
9450      if ((dsttype = mimeType(mime, super, type)) == NULL)
9451 +    {
9452 +      DEBUG_printf(("    Destination type %s/%s not found!\n", super, type));
9453        continue;
9454 +    }
9455  
9456     /*
9457      * Then get the cost and filter program...
9458 @@ -575,7 +583,10 @@
9459        */
9460  
9461        if (!add_fcache(filtercache, filter, filterpath))
9462 +      {
9463 +        DEBUG_printf(("    Filter %s not found in %s!\n", filter, filterpath)); 
9464          continue;
9465 +      }
9466      }
9467  
9468     /*
9469 @@ -655,6 +666,8 @@
9470    if ((fp = cupsFileOpen(filename, "r")) == NULL)
9471      return;
9472  
9473 +  DEBUG_printf(("\"%s\":\n", filename));
9474 +
9475   /*
9476    * Then read each line from the file, skipping any comments in the file...
9477    */
9478 @@ -665,6 +678,8 @@
9479      * Skip blank lines and lines starting with a #...
9480      */
9481  
9482 +    DEBUG_puts(line);
9483 +
9484      if (!line[0] || line[0] == '#')
9485        continue;
9486  
9487 @@ -723,5 +738,5 @@
9488  
9489  
9490  /*
9491 - * End of "$Id$".
9492 + * End of "$Id$".
9493   */
9494 diff -durN release-1.2.1/scheduler/printers.c cups-1.2.x/scheduler/printers.c
9495 --- release-1.2.1/scheduler/printers.c  2006-07-04 17:35:29.000000000 +0100
9496 +++ cups-1.2.x/scheduler/printers.c     2006-06-26 12:45:38.000000000 +0100
9497 @@ -1,5 +1,5 @@
9498  /*
9499 - * "$Id$"
9500 + * "$Id$"
9501   *
9502   *   Printer routines for the Common UNIX Printing System (CUPS).
9503   *
9504 @@ -62,6 +62,7 @@
9505   */
9506  
9507  #include "cupsd.h"
9508 +#include <cups/dir.h>
9509  
9510  
9511  /*
9512 @@ -257,6 +258,11 @@
9513  {
9514    int                  i;              /* Looping var */
9515    ipp_attribute_t      *attr;          /* Attribute data */
9516 +  cups_dir_t           *dir;           /* Notifier directory */
9517 +  cups_dentry_t                *dent;          /* Notifier directory entry */
9518 +  cups_array_t         *notifiers;     /* Notifier array */
9519 +  char                 filename[1024], /* Filename */
9520 +                       *notifier;      /* Current notifier */
9521    static const int nups[] =            /* number-up-supported values */
9522                 { 1, 2, 4, 6, 9, 16 };
9523    static const ipp_orient_t orients[4] =/* orientation-requested-supported values */
9524 @@ -502,11 +508,11 @@
9525    ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
9526                 "notify-max-events-supported", MaxEvents);
9527  
9528 -  /* notify-notify-events-default */
9529 +  /* notify-events-default */
9530    ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
9531                 "notify-events-default", NULL, "job-completed");
9532  
9533 -  /* notify-notify-events-supported */
9534 +  /* notify-events-supported */
9535    ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
9536                  "notify-events-supported",
9537                 (int)(sizeof(notify_events) / sizeof(notify_events[0])),
9538 @@ -516,10 +522,31 @@
9539    ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
9540                 "notify-pull-method-supported", NULL, "ippget");
9541  
9542 -  /* TODO: scan notifier directory */
9543    /* notify-schemes-supported */
9544 -  ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
9545 -               "notify-schemes-supported", NULL, "mailto");
9546 +  snprintf(filename, sizeof(filename), "%s/notifier", ServerBin);
9547 +  if ((dir = cupsDirOpen(filename)) != NULL)
9548 +  {
9549 +    notifiers = cupsArrayNew((cups_array_func_t)strcmp, NULL);
9550 +
9551 +    while ((dent = cupsDirRead(dir)) != NULL)
9552 +      if (S_ISREG(dent->fileinfo.st_mode) &&
9553 +          (dent->fileinfo.st_mode & S_IXOTH) != 0)
9554 +        cupsArrayAdd(notifiers, _cupsStrAlloc(dent->filename));
9555 +
9556 +    if (cupsArrayCount(notifiers) > 0)
9557 +    {
9558 +      attr = ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
9559 +                          "notify-schemes-supported",
9560 +                          cupsArrayCount(notifiers), NULL, NULL);
9561 +
9562 +      for (i = 0, notifier = (char *)cupsArrayFirst(notifiers);
9563 +           notifier;
9564 +          i ++, notifier = (char *)cupsArrayNext(notifiers))
9565 +       attr->values[i].string.text = notifier;
9566 +    }
9567 +
9568 +    cupsArrayDelete(notifiers);
9569 +  }
9570  
9571    /* number-up-supported */
9572    ippAddIntegers(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
9573 @@ -665,7 +692,7 @@
9574            dp = (cupsd_printer_t *)cupsArrayNext(Printers))
9575         if (dp != p && (dp->type & CUPS_PRINTER_DEFAULT))
9576         {
9577 -         DefaultPrinter = p;
9578 +         DefaultPrinter = dp;
9579           break;
9580         }
9581      }
9582 @@ -3280,5 +3307,5 @@
9583  
9584  
9585  /*
9586 - * End of "$Id$".
9587 + * End of "$Id$".
9588   */
9589 diff -durN release-1.2.1/scheduler/subscriptions.c cups-1.2.x/scheduler/subscriptions.c
9590 --- release-1.2.1/scheduler/subscriptions.c     2006-07-04 17:35:29.000000000 +0100
9591 +++ cups-1.2.x/scheduler/subscriptions.c        2006-06-26 12:45:38.000000000 +0100
9592 @@ -1,5 +1,5 @@
9593  /*
9594 - * "$Id$"
9595 + * "$Id$"
9596   *
9597   *   Subscription routines for the Common UNIX Printing System (CUPS) scheduler.
9598   *
9599 @@ -36,7 +36,6 @@
9600   *   cupsdStopAllNotifiers()       - Stop all notifier processes.
9601   *   cupsdUpdateNotifierStatus()   - Read messages from notifiers.
9602   *   cupsd_compare_subscriptions() - Compare two subscriptions.
9603 - *   cupsd_delete_all_events()     - Delete all cached events.
9604   *   cupsd_delete_event()          - Delete a single event...
9605   *   cupsd_send_dbus()             - Send a DBUS notification...
9606   *   cupsd_send_notification()     - Send a notification for the specified
9607 @@ -61,7 +60,6 @@
9608  static int     cupsd_compare_subscriptions(cupsd_subscription_t *first,
9609                                             cupsd_subscription_t *second,
9610                                             void *unused);
9611 -static void    cupsd_delete_all_events(void);
9612  static void    cupsd_delete_event(cupsd_event_t *event);
9613  #ifdef HAVE_DBUS
9614  static void    cupsd_send_dbus(cupsd_eventmask_t event, cupsd_printer_t *dest,
9615 @@ -114,29 +112,11 @@
9616    }
9617  
9618   /*
9619 -  * Allocate memory for the event cache as needed...
9620 -  */
9621 -
9622 -  if (!Events)
9623 -  {
9624 -    Events    = calloc(MaxEvents, sizeof(cupsd_event_t *));
9625 -    NumEvents = 0;
9626 -
9627 -    if (!Events)
9628 -    {
9629 -      cupsdLogMessage(CUPSD_LOG_CRIT,
9630 -                      "Unable to allocate memory for event cache - %s",
9631 -                     strerror(errno));
9632 -      return;
9633 -    }
9634 -  }
9635 -
9636 - /*
9637    * Then loop through the subscriptions and add the event to the corresponding
9638    * caches...
9639    */
9640  
9641 -  for (sub = (cupsd_subscription_t *)cupsArrayFirst(Subscriptions), temp = NULL;
9642 +  for (temp = NULL, sub = (cupsd_subscription_t *)cupsArrayFirst(Subscriptions);
9643         sub;
9644         sub = (cupsd_subscription_t *)cupsArrayNext(Subscriptions))
9645    {
9646 @@ -149,185 +129,168 @@
9647         (sub->job == job || !sub->job))
9648      {
9649       /*
9650 -      * Need this event...
9651 +      * Need this event, so create a new event record...
9652        */
9653  
9654 -      if (!temp)
9655 +      if ((temp = (cupsd_event_t *)calloc(1, sizeof(cupsd_event_t))) == NULL)
9656        {
9657 -       /*
9658 -       * Create the new event record...
9659 -       */
9660 +       cupsdLogMessage(CUPSD_LOG_CRIT,
9661 +                       "Unable to allocate memory for event - %s",
9662 +                       strerror(errno));
9663 +       return;
9664 +      }
9665  
9666 -       if ((temp = (cupsd_event_t *)calloc(1, sizeof(cupsd_event_t))) == NULL)
9667 -       {
9668 -         cupsdLogMessage(CUPSD_LOG_CRIT,
9669 -                         "Unable to allocate memory for event - %s",
9670 -                         strerror(errno));
9671 -         return;
9672 -       }
9673 +      temp->event = event;
9674 +      temp->time  = time(NULL);
9675 +      temp->attrs = ippNew();
9676 +      temp->job   = job;
9677 +      temp->dest  = dest;
9678  
9679 -       temp->event = event;
9680 -       temp->time  = time(NULL);
9681 -       temp->attrs = ippNew();
9682 -       temp->job   = job;
9683 -       temp->dest  = dest;
9684 +     /*
9685 +      * Add common event notification attributes...
9686 +      */
9687  
9688 -       /*
9689 -        * Add common event notification attributes...
9690 -       */
9691 +      ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_CHARSET,
9692 +                   "notify-charset", NULL, "utf-8");
9693  
9694 -        ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
9695 -                     "notify-subscription-id", sub->id);
9696 +      ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_LANGUAGE,
9697 +                   "notify-natural-langugage", NULL, "en-US");
9698  
9699 -       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD,
9700 -                    "notify-subscribed-event", NULL, cupsdEventName(event));
9701 +      ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
9702 +                   "notify-subscription-id", sub->id);
9703  
9704 -        ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
9705 -                     "printer-up-time", time(NULL));
9706 +      ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
9707 +                   "notify-sequence-number", sub->next_event_id);
9708  
9709 -        va_start(ap, text);
9710 -       vsnprintf(ftext, sizeof(ftext), text, ap);
9711 -       va_end(ap);
9712 +      ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD,
9713 +                  "notify-subscribed-event", NULL, cupsdEventName(event));
9714  
9715 -       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_TEXT,
9716 -                    "notify-text", NULL, ftext);
9717 +      if (sub->user_data_len > 0)
9718 +        ippAddOctetString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9719 +                         "notify-user-data", sub->user_data,
9720 +                         sub->user_data_len);
9721  
9722 -        if (dest)
9723 -       {
9724 -        /*
9725 -         * Add printer attributes...
9726 -         */
9727 +      ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
9728 +                   "printer-up-time", time(NULL));
9729  
9730 -         ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_URI,
9731 -                      "notify-printer-uri", NULL, dest->uri);
9732 +      va_start(ap, text);
9733 +      vsnprintf(ftext, sizeof(ftext), text, ap);
9734 +      va_end(ap);
9735  
9736 -         ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME,
9737 -                      "printer-name", NULL, dest->name);
9738 +      ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_TEXT,
9739 +                  "notify-text", NULL, ftext);
9740  
9741 -         ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM,
9742 -                       "printer-state", dest->state);
9743 +      if (dest)
9744 +      {
9745 +       /*
9746 +       * Add printer attributes...
9747 +       */
9748  
9749 -         if (dest->num_reasons == 0)
9750 -           ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9751 -                        IPP_TAG_KEYWORD, "printer-state-reasons", NULL,
9752 -                        dest->state == IPP_PRINTER_STOPPED ? "paused" : "none");
9753 -         else
9754 -           ippAddStrings(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9755 -                         IPP_TAG_KEYWORD, "printer-state-reasons",
9756 -                         dest->num_reasons, NULL,
9757 -                         (const char * const *)dest->reasons);
9758 +       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_URI,
9759 +                    "notify-printer-uri", NULL, dest->uri);
9760  
9761 -         ippAddBoolean(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9762 -                       "printer-is-accepting-jobs", dest->accepting);
9763 -        }
9764 +       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME,
9765 +                    "printer-name", NULL, dest->name);
9766  
9767 -        if (job)
9768 -       {
9769 -        /*
9770 -         * Add job attributes...
9771 -         */
9772 +       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM,
9773 +                     "printer-state", dest->state);
9774  
9775 -         ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
9776 -                       "notify-job-id", job->id);
9777 -         ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM,
9778 -                       "job-state", job->state_value);
9779 +       if (dest->num_reasons == 0)
9780 +         ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9781 +                      IPP_TAG_KEYWORD, "printer-state-reasons", NULL,
9782 +                      dest->state == IPP_PRINTER_STOPPED ? "paused" : "none");
9783 +       else
9784 +         ippAddStrings(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9785 +                       IPP_TAG_KEYWORD, "printer-state-reasons",
9786 +                       dest->num_reasons, NULL,
9787 +                       (const char * const *)dest->reasons);
9788  
9789 -          if ((attr = ippFindAttribute(job->attrs, "job-name",
9790 -                                      IPP_TAG_NAME)) != NULL)
9791 -           ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME,
9792 -                        "job-name", NULL, attr->values[0].string.text);
9793 +       ippAddBoolean(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9794 +                     "printer-is-accepting-jobs", dest->accepting);
9795 +      }
9796  
9797 -         switch (job->state_value)
9798 -         {
9799 -           case IPP_JOB_PENDING :
9800 -               if (dest && dest->state == IPP_PRINTER_STOPPED)
9801 -                 ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9802 -                              IPP_TAG_KEYWORD, "job-state-reasons", NULL,
9803 -                              "printer-stopped");
9804 -               else
9805 -                 ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9806 -                              IPP_TAG_KEYWORD, "job-state-reasons", NULL,
9807 -                              "none");
9808 -               break;
9809 +      if (job)
9810 +      {
9811 +       /*
9812 +       * Add job attributes...
9813 +       */
9814  
9815 -           case IPP_JOB_HELD :
9816 -               if (ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_KEYWORD) != NULL ||
9817 -                   ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_NAME) != NULL)
9818 -                 ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9819 -                              IPP_TAG_KEYWORD, "job-state-reasons", NULL,
9820 -                              "job-hold-until-specified");
9821 -               else
9822 -                 ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9823 -                              IPP_TAG_KEYWORD, "job-state-reasons", NULL,
9824 -                              "job-incoming");
9825 -               break;
9826 +       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
9827 +                     "notify-job-id", job->id);
9828 +       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM,
9829 +                     "job-state", job->state_value);
9830  
9831 -           case IPP_JOB_PROCESSING :
9832 -               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9833 -                            IPP_TAG_KEYWORD, "job-state-reasons", NULL,
9834 -                            "job-printing");
9835 -               break;
9836 +        if ((attr = ippFindAttribute(job->attrs, "job-name",
9837 +                                    IPP_TAG_NAME)) != NULL)
9838 +         ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME,
9839 +                      "job-name", NULL, attr->values[0].string.text);
9840  
9841 -           case IPP_JOB_STOPPED :
9842 +       switch (job->state_value)
9843 +       {
9844 +         case IPP_JOB_PENDING :
9845 +              if (dest && dest->state == IPP_PRINTER_STOPPED)
9846                 ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9847                              IPP_TAG_KEYWORD, "job-state-reasons", NULL,
9848 -                            "job-stopped");
9849 -               break;
9850 -
9851 -           case IPP_JOB_CANCELLED :
9852 +                            "printer-stopped");
9853 +              else
9854                 ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9855                              IPP_TAG_KEYWORD, "job-state-reasons", NULL,
9856 -                            "job-canceled-by-user");
9857 -               break;
9858 +                            "none");
9859 +              break;
9860  
9861 -           case IPP_JOB_ABORTED :
9862 +         case IPP_JOB_HELD :
9863 +              if (ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_KEYWORD) != NULL ||
9864 +                 ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_NAME) != NULL)
9865                 ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9866                              IPP_TAG_KEYWORD, "job-state-reasons", NULL,
9867 -                            "aborted-by-system");
9868 -               break;
9869 -
9870 -           case IPP_JOB_COMPLETED :
9871 +                            "job-hold-until-specified");
9872 +              else
9873                 ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9874                              IPP_TAG_KEYWORD, "job-state-reasons", NULL,
9875 -                            "job-completed-successfully");
9876 -               break;
9877 -         }
9878 -
9879 -         ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
9880 -                       "job-impressions-completed",
9881 -                       job->sheets ? job->sheets->values[0].integer : 0);
9882 -       }
9883 +                            "job-incoming");
9884 +              break;
9885  
9886 -       /*
9887 -       * Purge an old event as needed...
9888 -       */
9889 +         case IPP_JOB_PROCESSING :
9890 +              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9891 +                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
9892 +                          "job-printing");
9893 +              break;
9894  
9895 -       if (NumEvents >= MaxEvents)
9896 -       {
9897 -        /*
9898 -         * Purge the oldest event in the cache...
9899 -         */
9900 +         case IPP_JOB_STOPPED :
9901 +              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9902 +                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
9903 +                          "job-stopped");
9904 +              break;
9905  
9906 -         cupsd_delete_event(Events[0]);
9907 +         case IPP_JOB_CANCELLED :
9908 +              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9909 +                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
9910 +                          "job-canceled-by-user");
9911 +              break;
9912  
9913 -         NumEvents --;
9914 +         case IPP_JOB_ABORTED :
9915 +              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9916 +                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
9917 +                          "aborted-by-system");
9918 +              break;
9919  
9920 -         memmove(Events, Events + 1, NumEvents * sizeof(cupsd_event_t *));
9921 +         case IPP_JOB_COMPLETED :
9922 +              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
9923 +                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
9924 +                          "job-completed-successfully");
9925 +              break;
9926         }
9927  
9928 +       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
9929 +                     "job-impressions-completed",
9930 +                     job->sheets ? job->sheets->values[0].integer : 0);
9931 +
9932         /*
9933 -       * Add the new event to the main cache...
9934 +       * Send the notification for this subscription...
9935         */
9936  
9937 -       Events[NumEvents] = temp;
9938 -       NumEvents ++;
9939 +       cupsd_send_notification(sub, temp);
9940        }
9941 -
9942 -     /*
9943 -      * Send the notification for this subscription...
9944 -      */
9945 -
9946 -      cupsd_send_notification(sub, temp);
9947      }
9948    }
9949  
9950 @@ -438,8 +401,6 @@
9951    cupsd_subscription_t *sub;           /* Subscription */
9952  
9953  
9954 -  cupsd_delete_all_events();
9955 -
9956    if (!Subscriptions)
9957      return;
9958  
9959 @@ -462,6 +423,9 @@
9960      cupsd_subscription_t *sub,         /* I - Subscription object */
9961      int                  update)       /* I - 1 = update subscriptions.conf */
9962  {
9963 +  int  i;                              /* Looping var */
9964 +
9965 +
9966   /*
9967    * Close the pipe to the notifier as needed...
9968    */
9969 @@ -483,7 +447,12 @@
9970    cupsdClearString(&(sub->recipient));
9971  
9972    if (sub->events)
9973 +  {
9974 +    for (i = 0; i < sub->num_events; i ++)
9975 +      cupsd_delete_event(sub->events[i]);
9976 +
9977      free(sub->events);
9978 +  }
9979  
9980    free(sub);
9981  
9982 @@ -1300,27 +1269,6 @@
9983  
9984  
9985  /*
9986 - * 'cupsd_delete_all_events()' - Delete all cached events.
9987 - */
9988 -
9989 -static void
9990 -cupsd_delete_all_events(void)
9991 -{
9992 -  int  i;                              /* Looping var */
9993 -
9994 -
9995 -  if (MaxEvents <= 0 || !Events)
9996 -    return;
9997 -
9998 -  for (i = 0; i < NumEvents; i ++)
9999 -    cupsd_delete_event(Events[i]);
10000 -
10001 -  free(Events);
10002 -  Events = NULL;
10003 -}
10004 -
10005 -
10006 -/*
10007   * 'cupsd_delete_event()' - Delete a single event...
10008   *
10009   * Oldest events must be deleted first, otherwise the subscription cache
10010 @@ -1330,43 +1278,6 @@
10011  static void
10012  cupsd_delete_event(cupsd_event_t *event)/* I - Event to delete */
10013  {
10014 -  cupsd_subscription_t *sub;           /* Current subscription */
10015 -
10016 -
10017 - /*
10018 -  * Loop through the subscriptions and look for the event in the cache...
10019 -  */
10020 -
10021 -  for (sub = (cupsd_subscription_t *)cupsArrayFirst(Subscriptions);
10022 -       sub;
10023 -       sub = (cupsd_subscription_t *)cupsArrayNext(Subscriptions))
10024 -  {
10025 -   /*
10026 -    * Only check the first event in the subscription cache, since the
10027 -    * caller will only delete the oldest event in the cache...
10028 -    */
10029 -
10030 -    if (sub->num_events > 0 && sub->events[0] == event)
10031 -    {
10032 -     /*
10033 -      * Remove this event...
10034 -      */
10035 -
10036 -      sub->num_events --;
10037 -      sub->first_event_id ++;
10038 -
10039 -      if (sub->num_events > 0)
10040 -      {
10041 -       /*
10042 -        * Shift other events upward in cache...
10043 -       */
10044 -
10045 -        memmove(sub->events, sub->events + 1,
10046 -               sub->num_events * sizeof(cupsd_event_t *));
10047 -      }
10048 -    }
10049 -  }
10050 -
10051   /*
10052    * Free memory...
10053    */
10054 @@ -1490,6 +1401,25 @@
10055    }
10056  
10057   /*
10058 +  * Purge an old event as needed...
10059 +  */
10060 +
10061 +  if (sub->num_events >= MaxEvents)
10062 +  {
10063 +   /*
10064 +    * Purge the oldest event in the cache...
10065 +    */
10066 +
10067 +    cupsd_delete_event(sub->events[0]);
10068 +
10069 +    sub->num_events --;
10070 +    sub->first_event_id ++;
10071 +
10072 +    memmove(sub->events, sub->events + 1,
10073 +           sub->num_events * sizeof(cupsd_event_t *));
10074 +  }
10075 +
10076 + /*
10077    * Add the event to the subscription.  Since the events array is
10078    * always MaxEvents in length, and since we will have already
10079    * removed an event from the subscription cache if we hit the
10080 @@ -1661,5 +1591,5 @@
10081  
10082  
10083  /*
10084 - * End of "$Id$".
10085 + * End of "$Id$".
10086   */
10087 diff -durN release-1.2.1/scheduler/subscriptions.h cups-1.2.x/scheduler/subscriptions.h
10088 --- release-1.2.1/scheduler/subscriptions.h     2006-07-04 17:35:29.000000000 +0100
10089 +++ cups-1.2.x/scheduler/subscriptions.h        2006-06-26 12:45:38.000000000 +0100
10090 @@ -1,5 +1,5 @@
10091  /*
10092 - * "$Id$"
10093 + * "$Id$"
10094   *
10095   *   Subscription definitions for the Common UNIX Printing System (CUPS) scheduler.
10096   *
10097 @@ -131,11 +131,9 @@
10098  VAR cups_array_t *Subscriptions VALUE(NULL);
10099                                         /* Active subscriptions */
10100  
10101 -VAR int                MaxEvents VALUE(100),   /* Maximum number of events */
10102 -               NumEvents VALUE(0);     /* Number of active events */
10103 -VAR cupsd_event_t **Events VALUE(NULL);        /* Active events */
10104 +VAR int                MaxEvents VALUE(100);   /* Maximum number of events */
10105  
10106 -VAR unsigned   LastEvent VALUE(0);     /* Last events processed */
10107 +VAR unsigned   LastEvent VALUE(0);     /* Last event(s) processed */
10108  VAR int                NotifierPipes[2] VALUE2(-1, -1);
10109                                         /* Pipes for notifier error/debug output */
10110  VAR cupsd_statbuf_t *NotifierStatusBuffer VALUE(NULL);
10111 @@ -170,5 +168,5 @@
10112  
10113  
10114  /*
10115 - * End of "$Id$".
10116 + * End of "$Id$".
10117   */
10118 diff -durN release-1.2.1/scheduler/testmime.c cups-1.2.x/scheduler/testmime.c
10119 --- release-1.2.1/scheduler/testmime.c  2006-07-04 17:35:29.000000000 +0100
10120 +++ cups-1.2.x/scheduler/testmime.c     2006-06-26 12:45:38.000000000 +0100
10121 @@ -1,5 +1,5 @@
10122  /*
10123 - * "$Id$"
10124 + * "$Id$"
10125   *
10126   *   MIME test program for the Common UNIX Printing System (CUPS).
10127   *
10128 @@ -71,7 +71,7 @@
10129    mime        = NULL;
10130    src         = NULL;
10131    dst         = NULL;
10132 -  filter_path = "../filter:../pdftops";
10133 +  filter_path = "../filter:../pdftops:" CUPS_SERVERBIN "/filter";
10134  
10135    for (i = 1; i < argc; i ++)
10136      if (!strcmp(argv[i], "-d"))
10137 @@ -331,5 +331,5 @@
10138  
10139  
10140  /*
10141 - * End of "$Id$".
10142 + * End of "$Id$".
10143   */
10144 diff -durN release-1.2.1/systemv/cancel.c cups-1.2.x/systemv/cancel.c
10145 --- release-1.2.1/systemv/cancel.c      2006-07-04 17:33:00.000000000 +0100
10146 +++ cups-1.2.x/systemv/cancel.c 2006-06-28 09:59:04.000000000 +0100
10147 @@ -1,5 +1,5 @@
10148  /*
10149 - * "$Id$"
10150 + * "$Id$"
10151   *
10152   *   "cancel" command for the Common UNIX Printing System (CUPS).
10153   *
10154 @@ -121,7 +121,10 @@
10155  
10156          case 'h' : /* Connect to host */
10157             if (http != NULL)
10158 +           {
10159               httpClose(http);
10160 +             http = NULL;
10161 +           }
10162  
10163             if (argv[i][2] != '\0')
10164                cupsSetServer(argv[i] + 2);
10165 @@ -387,5 +390,5 @@
10166  
10167  
10168  /*
10169 - * End of "$Id$".
10170 + * End of "$Id$".
10171   */
10172 diff -durN release-1.2.1/systemv/lpstat.c cups-1.2.x/systemv/lpstat.c
10173 --- release-1.2.1/systemv/lpstat.c      2006-07-04 17:33:00.000000000 +0100
10174 +++ cups-1.2.x/systemv/lpstat.c 2006-06-26 12:43:30.000000000 +0100
10175 @@ -1,5 +1,5 @@
10176  /*
10177 - * "$Id$"
10178 + * "$Id$"
10179   *
10180   *   "lpstat" command for the Common UNIX Printing System (CUPS).
10181   *
10182 @@ -70,26 +70,59 @@
10183   */
10184  
10185  int
10186 -main(int  argc,                        /* I - Number of command-line arguments */
10187 -     char *argv[])             /* I - Command-line arguments */
10188 +main(int  argc,                                /* I - Number of command-line arguments */
10189 +     char *argv[])                     /* I - Command-line arguments */
10190  {
10191 -  int          i,              /* Looping var */
10192 -               status;         /* Exit status */
10193 -  http_t       *http;          /* Connection to server */
10194 -  int          num_dests;      /* Number of user destinations */
10195 -  cups_dest_t  *dests;         /* User destinations */
10196 -  int          long_status;    /* Long status report? */
10197 -  int          ranking;        /* Show job ranking? */
10198 -  const char   *which;         /* Which jobs to show? */
10199 -  char         op;             /* Last operation on command-line */
10200 +  int          i,                      /* Looping var */
10201 +               status;                 /* Exit status */
10202 +  http_t       *http;                  /* Connection to server */
10203 +  int          num_dests;              /* Number of user destinations */
10204 +  cups_dest_t  *dests;                 /* User destinations */
10205 +  int          long_status;            /* Long status report? */
10206 +  int          ranking;                /* Show job ranking? */
10207 +  const char   *which;                 /* Which jobs to show? */
10208 +  char         op;                     /* Last operation on command-line */
10209  
10210  
10211   /*
10212    * Set the locale so that times, etc. are displayed properly.
10213 +  *
10214 +  * Unfortunately, while we need the localized time value, we *don't*
10215 +  * want to use the localized charset for the time value, so we need
10216 +  * to set LC_TIME to the locale name with .UTF-8 on the end (if
10217 +  * the locale includes a character set specifier...)
10218    */
10219  
10220    setlocale(LC_ALL, "");
10221  
10222 +#ifdef LC_TIME
10223 +  {
10224 +    const char *lc_time;               /* Current LC_TIME value */
10225 +    char       new_lc_time[255],       /* New LC_TIME value */
10226 +               *charset;               /* Pointer to character set */
10227 +
10228 +    if ((lc_time = setlocale(LC_TIME, NULL)) == NULL)
10229 +      lc_time = setlocale(LC_ALL, NULL);
10230 +
10231 +    if (lc_time)
10232 +    {
10233 +      strlcpy(new_lc_time, lc_time, sizeof(new_lc_time));
10234 +      if ((charset = strchr(new_lc_time, '.')) == NULL)
10235 +        charset = new_lc_time + strlen(new_lc_time);
10236 +
10237 +      strlcpy(charset, ".UTF-8", sizeof(new_lc_time) - (charset - new_lc_time));
10238 +    }
10239 +    else
10240 +      strcpy(new_lc_time, "C");
10241 +
10242 +    setlocale(LC_TIME, new_lc_time);
10243 +  }
10244 +#endif /* LC_TIME */
10245 +  
10246 + /*
10247 +  * Parse command-line options...
10248 +  */
10249 +
10250    http        = NULL;
10251    num_dests   = 0;
10252    dests       = NULL;
10253 @@ -2248,5 +2281,5 @@
10254  
10255  
10256  /*
10257 - * End of "$Id$".
10258 + * End of "$Id$".
10259   */
10260 diff -durN release-1.2.1/systemv/Makefile cups-1.2.x/systemv/Makefile
10261 --- release-1.2.1/systemv/Makefile      2006-07-04 17:33:00.000000000 +0100
10262 +++ cups-1.2.x/systemv/Makefile 2006-06-26 12:43:30.000000000 +0100
10263 @@ -1,5 +1,5 @@
10264  #
10265 -# "$Id$"
10266 +# "$Id$"
10267  #
10268  #   System V commands makefile for the Common UNIX Printing System (CUPS).
10269  #
10270 @@ -78,7 +78,7 @@
10271         $(INSTALL_BIN) lp $(BINDIR)
10272         $(INSTALL_BIN) lpoptions $(BINDIR)
10273         $(INSTALL_BIN) lpstat $(BINDIR)
10274 -       $(INSTALL_BIN) -m 4755 -o $(CUPS_USER) -g $(CUPS_GROUP) lppasswd $(BINDIR) || $(INSTALL_BIN) lppasswd $(BINDIR)
10275 +       $(INSTALL_BIN) -m 4755 -o root lppasswd $(BINDIR) || $(INSTALL_BIN) lppasswd $(BINDIR)
10276  
10277  
10278  #
10279 @@ -225,5 +225,5 @@
10280  
10281  
10282  #
10283 -# End of "$Id$".
10284 +# End of "$Id$".
10285  #
10286 diff -durN release-1.2.1/templates/Makefile cups-1.2.x/templates/Makefile
10287 --- release-1.2.1/templates/Makefile    2006-07-04 17:35:22.000000000 +0100
10288 +++ cups-1.2.x/templates/Makefile       2006-06-26 12:45:31.000000000 +0100
10289 @@ -1,5 +1,5 @@
10290  #
10291 -# "$Id$"
10292 +# "$Id$"
10293  #
10294  #   Template makefile for the Common UNIX Printing System (CUPS).
10295  #
10296 @@ -118,11 +118,13 @@
10297  # Install files...
10298  #
10299  
10300 -install: all
10301 +install: all $(INSTALL_LANGUAGES)
10302         $(INSTALL_DIR) -m 755 $(DATADIR)/templates
10303         for file in $(FILES); do \
10304                 $(INSTALL_DATA) $$file $(DATADIR)/templates; \
10305         done
10306 +
10307 +install-languages:
10308         for lang in $(LANGUAGES); do \
10309                 $(INSTALL_DIR) -m 755 $(DATADIR)/templates/$$lang; \
10310                 for file in $(FILES); do \
10311 @@ -137,19 +139,21 @@
10312  # Uninstall files...
10313  #
10314  
10315 -uninstall:
10316 +uninstall: $(UNINSTALL_LANGUAGES)
10317         for file in $(FILES); do \
10318                 $(RM) $(DATADIR)/templates/$$file; \
10319         done
10320 +       -$(RMDIR) $(DATADIR)/templates
10321 +
10322 +uninstall-languages:
10323         for lang in $(LANGUAGES); do \
10324                 for file in $(FILES); do \
10325                         $(RM) $(DATADIR)/templates/$$lang/$$file; \
10326                 done \
10327                 $(RMDIR) $(DATADIR)/templates/$$lang; \
10328         done
10329 -       -$(RMDIR) $(DATADIR)/templates
10330  
10331  
10332  #
10333 -# End of "$Id$".
10334 +# End of "$Id$".
10335  #
This page took 0.998467 seconds and 3 git commands to generate.