[Pkg-cups-devel] r292 - in cupsys/branches/cups-1.2/debian: .

Kenshi Muto kmuto at costa.debian.org
Tue Jul 18 11:41:03 UTC 2006


Author: kmuto
Date: Tue Jul 18 11:41:00 2006
New Revision: 292

Added:
   cupsys/branches/cups-1.2/debian/patches/00_r5743.dpatch   (contents, props changed)
Removed:
   cupsys/branches/cups-1.2/debian/patches/00_r5673.dpatch
Modified:
   cupsys/branches/cups-1.2/debian/changelog
   cupsys/branches/cups-1.2/debian/patches/00list

Log:
apply r5743

Modified: cupsys/branches/cups-1.2/debian/changelog
==============================================================================
--- cupsys/branches/cups-1.2/debian/changelog	(original)
+++ cupsys/branches/cups-1.2/debian/changelog	Tue Jul 18 11:41:00 2006
@@ -3,6 +3,7 @@
   [Kenshi Muto]
   * Bug, bug, bug, ... our BTS is tainted by duplicate bugs like flood.
   * Include changelogs during 1.1.23-13 - 1.1.23-15. (closes: #374494)
+  * Apply upstream svn change r5743.
   * 56_cupsaddsmb: avoid infinite loop when connect with Samba fails
     by something reasons. (closes: #376232)
     This patch fixes missing localized message.

Added: cupsys/branches/cups-1.2/debian/patches/00_r5743.dpatch
==============================================================================
--- (empty file)
+++ cupsys/branches/cups-1.2/debian/patches/00_r5743.dpatch	Tue Jul 18 11:41:00 2006
@@ -0,0 +1,10148 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 00_r5743.dpatch by Kenshi Muto <kmuto at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad cupsys-1.2.1~/CHANGES.txt cupsys-1.2.1/CHANGES.txt
+--- cupsys-1.2.1~/CHANGES.txt	2006-05-22 18:47:09.000000000 +0000
++++ cupsys-1.2.1/CHANGES.txt	2006-07-18 11:27:13.000000000 +0000
+@@ -1,8 +1,134 @@
+-CHANGES.txt - 2006-05-22
++CHANGES.txt - 2006-07-17
+ ------------------------
+ 
++CHANGES IN CUPS V1.2.2
++
++	- Documentation updates (STR #1765, STR #1780)
++	- The scheduler now creates self-signed SSL certficates
++	  automatically when using OpenSSL and CDSA for
++	  encryption, just as for GNU TLS.
++	- The SNMP backend sporatically reported some printers as
++	  "unknown" (STR #1774)
++	- The scheduler now forces BrowseTimeout to be at least
++	  twice the BrowseInterval value and non-zero to avoid
++	  common configuration errors.
++	- The scheduler incorrectly returned printer URIs of the
++	  form "ipp://server/printers/classname" for classes (STR
++	  #1813)
++	- Updated Japanese localization (STR #1805)
++	- The scheduler's SSL certificate/key directory was not
++	  created on installation (STR #1788)
++	- Added a mailto.conf man page and help page (STR #1754)
++	- The parallel and USB backends no longer wait for the
++	  printer to go on-line - this caused problems with
++	  certain printers that don't follow with the IEEE-1284
++	  standard (STR #1738)
++	- The scheduler could crash on a reload when implicit
++	  classes were present (STR #1828)
++	- The IPP backend incorrectly used the CUPS_ENCRYPTION
++	  environment variable to determine the default
++	  encryption mode when printing (STR #1820)
++	- USB printing did not work on Solaris (STR #1756)
++	- The scheduler sorted job priorities in the wrong order
++	  (STR #1811)
++	- The scheduler did not automatically restart notifiers
++	  that exited or crashed (STR #1793)
++	- IPv6 support did not work on NetBSD (STR #1834)
++	- The EPM packaging file did not work (STR #1804)
++	- The scheduler used up the CPU if BrowseRemoteProtocols
++	  was empty (STR #1792)
++	- Custom page sizes did not work (STR #1787)
++	- The SNMP backend could crash on some systems when SNMP
++	  logging was enabled (STR #1789)
++	- Browsing could produce some funny printer names when
++	  ServerName was set to an IP address (STR #1799)
++	- Fixed the log message for BrowseRelay (STR #1798)
++	- Fixes to allow CUPS to compile on MirBSD (STR #1796)
++	- The scheduler incorrectly set the FINAL_CONTENT_TYPE
++	  environment variable (STR #1795)
++	- The pdftops filter incorrectly embedded a "produced by"
++	  comment, causing PDF printing not to work on some
++	  operating systems (STR #1801)
++	- Sending raw jobs from a client system could cause the
++	  client's scheduler to eventually crash (STR #1786)
++	- The scheduler now checks that the notifier exists prior
++	  to accepting a new subscription request.
++	- The scheduler now reports the supported
++	  notify-recipient schemes based on the contents of the
++	  ServerBin/notifier directory.
++	- Event notifications did not include the
++	  notify-sequence-number or other required attributes
++	  (STR #1747)
++	- Allow/Deny addresses of the form "11.22.33.*" did not
++	  work on Linux (STR #1769)
++	- cupsGetPPD() did not work if the scheduler was only
++	  listening on a domain socket (STR #1766)
++	- The scheduler could crash advertising a class (STR
++	  #1768)
++	- The scheduler could crash if the default printer was
++	  deleted (STR #1776)
++	- Added a new default CUPS raster format (v3) which does
++	  not compress the raster stream in order to provide the
++	  same cupsRasterReadPixels() and cupsRasterWritePixels()
++	  performance as CUPS 1.1.x.
++	- The cupsaddsmb man page listed the wrong files for the
++	  CUPS driver.
++	- Some configure --with options did not work (STR #1746)
++	- "Allow @IF(name)" didn't work if "name" wasn't the
++	  first network interface (STR #1758)
++	- The lpstat command did not use the correct character
++	  set when reporting the date and time (STR #1751)
++	- The cupsaddsmb command and web interface did not update
++	  the Windows PPD files properly, resulting in corrupt
++	  PPD files for the Windows client to use (STR #1750)
++	- The cupsd.conf man page didn't describe the Listen
++	  domain socket syntax (STR #1753)
++	- The scheduler no longer tries to support more than
++	  FD_SETSIZE file descriptors.
++	- CDSA (encryption) support fixes for MacOS X.
++	- The lppasswd program needs to be setuid to root to
++	  create and update the /etc/cups/passwd.md5 file (STR
++	  #1735)
++	- 32/64-bit library installation was broken (STR #1741)
++	- The USB backend now reports a "no such device" error
++	  when using the old filename-based USB URIs instead of
++	  the "success" error.
++	- Increased the HTTP and IPP read timeouts to 10 seconds,
++	  as 1 second was too short on congested networks (STR
++	  #1719)
++	- The SNMP backend now uses the device description over
++	  the printer-make-and-model attribute when the attribute
++	  contains a generic name (STR #1728)
++	- Fixed another file descriptor leak when printing raw
++	  files (STR #1736)
++	- Raw queues were not shared via LDAP (STR #1739)
++	- The pstops filter didn't always embed PageSetup
++	  commands from the PPD file (STR #1740)
++	- "make install" didn't work if you disabled all of the
++	  localizations.
++	- The scheduler didn't always choose the least costly
++	  filter.
++	- Fixed parsing of IPv6 addresses in Allow, Deny,
++	  BrowseAllow, BrowseDeny, and BrowseRelay directives
++	  (STR #1713)
++	- Printers that were shared via LDAP did not get added to
++	  the LDAP server properly (STR #1733)
++	- LDAP browsing would crash the scheduler if a required
++	  value was missing (STR #1731)
++	- Special cases for the "localhost" hostname did not
++	  work, causing printing to not work when the /etc/hosts
++	  file did not contain a localhost entry (STR #1723)
++	- Updated the Spanish translation (STR #1720, STR #1770)
++	- Reverse-order page output was broken when N-up or
++	  landscape orientations were used (STR #1725)
++	- The parallel, serial, socket, and USB backends needed
++	  print data before they would report back-channel data,
++	  causing problems with several new drivers (STR #1724)
++
++
+ CHANGES IN CUPS V1.2.1
+ 
++	- "lprm -h hostname" did not work (STR #1800)
+ 	- The web interface did not handle reloads properly for
+ 	  MSIE (STR #1716)
+ 	- The configure script no longer adds linker rpath
+diff -urNad cupsys-1.2.1~/Makedefs.in cupsys-1.2.1/Makedefs.in
+--- cupsys-1.2.1~/Makedefs.in	2006-05-22 00:59:11.000000000 +0000
++++ cupsys-1.2.1/Makedefs.in	2006-07-18 11:27:13.000000000 +0000
+@@ -77,7 +77,9 @@
+ # Languages to install...
+ #
+ 
+-LANGUAGES	=	@LANGUAGES@
++LANGUAGES	=	es ja pl sv
++INSTALL_LANGUAGES =	install-languages
++UNINSTALL_LANGUAGES =	uninstall-languages
+ 
+ #
+ # Libraries...
+@@ -127,9 +129,9 @@
+ CXXLIBS		=	@CXXLIBS@
+ DSOFLAGS	=	@DSOFLAGS@
+ DSOLIBS		=	@DSOLIBS@ $(COMMONLIBS)
+-IMGLIBS		=	@IMGLIBS@ -lm
++IMGLIBS		=	@IMGLIBS@
+ IMGFILTERS	=	@IMGFILTERS@
+-LDFLAGS		=	-L../cups -L../filter $(RC_CFLAGS) $(ARCHFLAGS) \
++LDFLAGS		=	-L../cups -L../filter $(ARCHFLAGS) \
+ 			@LDFLAGS@ @PIEFLAGS@ $(OPTIM)
+ LINKCUPS	=	@LINKCUPS@ $(SSLLIBS)
+ LINKCUPSIMAGE	=	@LINKCUPSIMAGE@
+diff -urNad cupsys-1.2.1~/backend/Dependencies cupsys-1.2.1/backend/Dependencies
+--- cupsys-1.2.1~/backend/Dependencies	2006-04-18 20:45:30.000000000 +0000
++++ cupsys-1.2.1/backend/Dependencies	2006-07-18 11:27:13.000000000 +0000
+@@ -9,26 +9,31 @@
+ lpd.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h
+ lpd.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
+ lpd.o: ../cups/string.h
+-parallel.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
+-parallel.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
+-parallel.o: ../cups/language.h ../cups/string.h ../config.h ieee1284.c
+-parallel.o: ../cups/debug.h
++pap.o: ../cups/http.h ../cups/md5.h
++parallel.o: backend-private.h ../cups/backend.h ../cups/cups.h ../cups/ipp.h
++parallel.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/array.h
++parallel.o: ../cups/file.h ../cups/language.h ../cups/debug.h
++parallel.o: ../cups/string.h ../config.h
+ scsi.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
+ scsi.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
+ scsi.o: ../cups/language.h ../cups/string.h ../config.h
+-serial.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
+-serial.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
+-serial.o: ../cups/language.h ../cups/string.h ../config.h
+-snmp.o: ../cups/backend.h ../cups/http-private.h ../config.h ../cups/http.h
+-snmp.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h
+-snmp.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
+-snmp.o: ../cups/string.h ../cups/array.h ../cups/file.h ieee1284.c
+-snmp.o: ../cups/debug.h
+-socket.o: ../cups/backend.h ../cups/http-private.h ../config.h ../cups/http.h
+-socket.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h ../cups/cups.h
+-socket.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
+-socket.o: ../cups/string.h
+-test1284.o: ../cups/string.h ../config.h ieee1284.c ../cups/debug.h
++serial.o: backend-private.h ../cups/backend.h ../cups/cups.h ../cups/ipp.h
++serial.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/array.h
++serial.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/string.h
++serial.o: ../config.h
++snmp.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/md5.h
++snmp.o: ../cups/ipp-private.h ../cups/ipp.h backend-private.h
++snmp.o: ../cups/backend.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
++snmp.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/string.h
++snmp.o: ../cups/array.h ../cups/file.h
++socket.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/md5.h
++socket.o: ../cups/ipp-private.h ../cups/ipp.h backend-private.h
++socket.o: ../cups/backend.h ../cups/cups.h ../cups/ppd.h ../cups/array.h
++socket.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/string.h
++test1284.o: ../cups/string.h ../config.h ieee1284.c backend-private.h
++test1284.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
++test1284.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
++test1284.o: ../cups/language.h ../cups/debug.h
+ usb.o: ../cups/backend.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
+ usb.o: ../cups/md5.h ../cups/ppd.h ../cups/array.h ../cups/file.h
+ usb.o: ../cups/language.h ../cups/string.h ../config.h
+diff -urNad cupsys-1.2.1~/backend/Makefile cupsys-1.2.1/backend/Makefile
+--- cupsys-1.2.1~/backend/Makefile	2006-04-27 13:58:43.000000000 +0000
++++ cupsys-1.2.1/backend/Makefile	2006-07-18 11:27:13.000000000 +0000
+@@ -28,7 +28,8 @@
+ 
+ RBACKENDS =	ipp lpd
+ UBACKENDS =	$(PAP) parallel scsi serial snmp socket usb
+-TARGETS	=	betest test1284 $(RBACKENDS) $(UBACKENDS)
++TARGETS	=	betest test1284 libbackend.a $(RBACKENDS) $(UBACKENDS)
++LIBOBJS	=	ieee1284.o runloop.o
+ OBJS	=	betest.o ipp.o lpd.o pap.o parallel.o scsi.o \
+ 		serial.o snmp.o socket.o test1284.o usb.o
+ 
+@@ -105,6 +106,17 @@
+ 
+ 
+ #
++# libbackend.a
++#
++
++libbackend.a:	$(LIBOBJS)
++	echo Archiving $@...
++	$(RM) $@
++	$(AR) $(ARFLAGS) $@ $(LIBOBJS)
++	$(RANLIB) $@
++
++
++#
+ # ieee1394
+ #
+ 
+@@ -149,9 +161,9 @@
+ # parallel
+ #
+ 
+-parallel:	parallel.o ../cups/$(LIBCUPS)
++parallel:	parallel.o ../cups/$(LIBCUPS) libbackend.a
+ 	echo Linking $@...
+-	$(CC) $(LDFLAGS) -o parallel parallel.o $(LIBS)
++	$(CC) $(LDFLAGS) -o parallel parallel.o libbackend.a $(LIBS)
+ 
+ 
+ #
+@@ -169,37 +181,37 @@
+ # serial
+ #
+ 
+-serial:	serial.o ../cups/$(LIBCUPS)
++serial:	serial.o ../cups/$(LIBCUPS) libbackend.a
+ 	echo Linking $@...
+-	$(CC) $(LDFLAGS) -o serial serial.o $(BACKLIBS) $(LIBS)
++	$(CC) $(LDFLAGS) -o serial serial.o libbackend.a $(BACKLIBS) $(LIBS)
+ 
+ 
+ #
+ # snmp
+ #
+ 
+-snmp:	snmp.o ../cups/$(LIBCUPS)
++snmp:	snmp.o ../cups/$(LIBCUPS) libbackend.a
+ 	echo Linking $@...
+-	$(CC) $(LDFLAGS) -o snmp snmp.o $(LIBS)
++	$(CC) $(LDFLAGS) -o snmp snmp.o libbackend.a $(LIBS)
+ 
+ 
+ #
+ # socket
+ #
+ 
+-socket:	socket.o ../cups/$(LIBCUPS)
++socket:	socket.o ../cups/$(LIBCUPS) libbackend.a
+ 	echo Linking $@...
+-	$(CC) $(LDFLAGS) -o socket socket.o $(LIBS)
++	$(CC) $(LDFLAGS) -o socket socket.o libbackend.a $(LIBS)
+ 
+ 
+ #
+ # usb
+ #
+ 
+-usb:	usb.o ../cups/$(LIBCUPS)
++usb:	usb.o ../cups/$(LIBCUPS) libbackend.a
+ 	echo Linking $@...
+-	$(CC) $(LDFLAGS) -o usb usb.o $(BACKLIBS) $(LIBS)
+-usb.o:	usb.c usb-darwin.c usb-unix.c ieee1284.c
++	$(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(BACKLIBS) $(LIBS)
++usb.o:	usb.c usb-darwin.c usb-unix.c
+ 
+ 
+ #
+diff -urNad cupsys-1.2.1~/backend/backend-private.h cupsys-1.2.1/backend/backend-private.h
+--- cupsys-1.2.1~/backend/backend-private.h	1970-01-01 00:00:00.000000000 +0000
++++ cupsys-1.2.1/backend/backend-private.h	2006-07-18 11:27:13.000000000 +0000
+@@ -0,0 +1,73 @@
++/*
++ * "$Id$"
++ *
++ *   Backend support definitions for the Common UNIX Printing System (CUPS).
++ *
++ *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
++ *
++ *   These coded instructions, statements, and computer programs are the
++ *   property of Easy Software Products and are protected by Federal
++ *   copyright law.  Distribution and use rights are outlined in the file
++ *   "LICENSE" which should have been included with this file.  If this
++ *   file is missing or damaged please contact Easy Software Products
++ *   at:
++ *
++ *       Attn: CUPS Licensing Information
++ *       Easy Software Products
++ *       44141 Airport View Drive, Suite 204
++ *       Hollywood, Maryland 20636 USA
++ *
++ *       Voice: (301) 373-9600
++ *       EMail: cups-info at cups.org
++ *         WWW: http://www.cups.org
++ *
++ *   This file is subject to the Apple OS-Developed Software exception.
++ */
++
++#ifndef _CUPS_BACKEND_PRIVATE_H_
++#  define _CUPS_BACKEND_PRIVATE_H_
++
++
++/*
++ * Include necessary headers.
++ */
++
++#  include <cups/backend.h>
++#  include <cups/cups.h>
++#  include <cups/debug.h>
++#  include <stdlib.h>
++#  include <errno.h>
++#  include <cups/string.h>
++#  include <signal.h>
++
++
++/*
++ * C++ magic...
++ */
++
++#  ifdef _cplusplus
++extern "C" {
++#  endif /* _cplusplus */
++
++
++/*
++ * Prototypes...
++ */
++
++extern int	backendGetDeviceID(int fd, char *device_id, int device_id_size,
++		                   char *make_model, int make_model_size,
++				   const char *scheme, char *uri, int uri_size);
++extern int	backendGetMakeModel(const char *device_id, char *make_model,
++			            int make_model_size);
++extern ssize_t	backendRunLoop(int print_fd, int device_fd, int use_bc);
++
++
++#  ifdef _cplusplus
++}
++#  endif /* _cplusplus */
++#endif /* !_CUPS_BACKEND_PRIVATE_H_ */
++
++
++/*
++ * End of "$Id$".
++ */
+diff -urNad cupsys-1.2.1~/backend/easysw-firewire-design.txt cupsys-1.2.1/backend/easysw-firewire-design.txt
+--- cupsys-1.2.1~/backend/easysw-firewire-design.txt	2002-05-24 18:15:46.000000000 +0000
++++ cupsys-1.2.1/backend/easysw-firewire-design.txt	2006-07-18 11:27:13.000000000 +0000
+@@ -1,71 +0,0 @@
+-Preliminary Design for CUPS Firewire Printer Backend - 03/19/2002
+------------------------------------------------------------------
+-
+-OVERVIEW
+-
+-    Easy Software Products will develop an IEEE-1394, a.k.a.
+-    Firewire, printing interface for its Common UNIX Printing
+-    System ("CUPS") for initial use under the Linux operating
+-    system.  A follow-on implementation for MacOS X is
+-    anticipated as well.
+-
+-    The operating system interfaces for IEEE-1394 ports vary
+-    widely; the CUPS printing interface will abstract the OS
+-    layer to a simpler interface geared towards discovering,
+-    opening, reading from, writing to, and closing IEEE-1394
+-    printers.
+-
+-    The initial development of the CUPS backend will be targeted
+-    at the EPSON Stylus Pro 10000 large format printer, which
+-    requires the bandwidth provided by Firewire in order to
+-    print at full speed.  This printer supports printing via
+-    Serial Bus Protocol 2 (SBP-2) using the SCSI and PWG command
+-    sets. The CUPS backend will implement the PWG command set on
+-    LUN 0 only.
+-
+-
+-OS ABSTRACTION LAYER
+-
+-    The OS abstraction layer will be a thin client library that
+-    implements the following functions:
+-
+-        ieee1394_list
+-	ieee1394_open
+-	ieee1394_close
+-	ieee1394_read
+-	ieee1394_write
+-	ieee1394_error
+-
+-    The "ieee1394_list" function will list all of the available
+-    printer devices on the bus.  The device information will
+-    consist of the device URI (ieee1394:/something) used to
+-    access the device and the make and model information, if
+-    available, for the device ("EPSON Stylus Printer").
+-
+-    The "ieee1394_open" and "ieee1394_close" functions will open
+-    and close a connection to the printer, respectively.
+-
+-    The "ieee1394_read" and "ieee1394_write" functions will read
+-    and write data to and from the printer, respectively.  The
+-    read function will be non-blocking, returning data only if
+-    there is data coming back from the printer.
+-
+-    The "ieee1394_error" function will return a string
+-    describing the last error or NULL if no error occurred.
+-
+-    The library will be responsible for creating any background
+-    threads that are needed to monitor the connection to the
+-    printer.
+-
+-
+-CUPS BACKEND
+-
+-    The CUPS backend will use the OS abstraction layer to list
+-    and access the Firewire printers.  The "main" function will
+-    read and write printer data, while the "list_devices"
+-    function will be called as necessary to identify the
+-    available devices.
+-
+-    The CUPS 1.1 backend will record any status information in
+-    the error log file, while the 1.2 backend will supply it to
+-    the printer driver process.
+diff -urNad cupsys-1.2.1~/backend/easysw-firewire-linux.txt cupsys-1.2.1/backend/easysw-firewire-linux.txt
+--- cupsys-1.2.1~/backend/easysw-firewire-linux.txt	2002-05-24 18:15:46.000000000 +0000
++++ cupsys-1.2.1/backend/easysw-firewire-linux.txt	2006-07-18 11:27:13.000000000 +0000
+@@ -1,35 +0,0 @@
+-Easy Software Products
+-44141 Airport View Drive
+-Suite 204
+-Hollywood, Maryland 20636
+-+1.301.373.9600
+-March 8, 2002
+-
+-
+-Subject: EPSON Firewire Printer Driver for Linux
+-
+-Currently, no Firewire printer support exists for Linux.  Since
+-the latest EPSON printer products depend on the Firewire
+-interface to print at full speed, a solution is needed to
+-support customers using Linux as their server platform.
+-
+-The Linux Firewire subsystem provides a user-mode driver
+-interface that allows driver programs to access Firewire
+-devices.  Easy Software Products will utilize this interface to
+-develop a "backend" program for the Common UNIX Printing System
+-that will allow users to print to EPSON printers using the
+-Firewire interface.
+-
+-After examining the Linux interface, we estimate that it will
+-require approximately 30 hours of development time to write,
+-test, and document the Firewire backend, for a total cost of
+-$3,000. The new backend will become a standard part of the CUPS
+-software distribution and will be included with at least the
+-following Linux distributions:
+-
+-    - Caldera Linux
+-    - Mandrake Linux
+-    - Red Hat Linux
+-    - SuSE Linux
+-
+-ESP will provide EPSON with binaries for Red Hat Linux 7.2.
+diff -urNad cupsys-1.2.1~/backend/ieee1284.c cupsys-1.2.1/backend/ieee1284.c
+--- cupsys-1.2.1~/backend/ieee1284.c	2006-04-19 21:36:43.000000000 +0000
++++ cupsys-1.2.1/backend/ieee1284.c	2006-07-18 11:27:13.000000000 +0000
+@@ -25,51 +25,41 @@
+  *
+  * Contents:
+  *
+- *   get_device_id()  - Get the IEEE-1284 device ID string and corresponding
+- *                      URI.
+- *   get_make_model() - Get the make and model string from the device ID.
++ *   backendGetDeviceID()  - Get the IEEE-1284 device ID string and
++ *                           corresponding URI.
++ *   backendGetMakeModel() - Get the make and model string from the device ID.
+  */
+ 
+ /*
+  * Include necessary headers.
+  */
+ 
+-#include <cups/debug.h>
+-
++#include "backend-private.h"
+ 
+-/*
+- * Prototypes...
+- */
++#ifdef __linux
++#  include <sys/ioctl.h>
++#  include <linux/lp.h>
++#  define IOCNR_GET_DEVICE_ID		1
++#  define LPIOC_GET_DEVICE_ID(len)	_IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
++#endif /* __linux */
+ 
+-static int	get_make_model(const char *device_id, char *make_model,
+-		               int make_model_size);
++#ifdef __sun
++#  ifdef __sparc
++#    include <sys/ecppio.h>
++#  else
++#    include <sys/ioccom.h>
++#    include <sys/ecppsys.h>
++#  endif /* __sparc */
++#endif /* __sun */
+ 
+ 
+ /*
+- * 'get_device_id()' - Get the IEEE-1284 device ID string and
+- *                     corresponding URI.
++ * 'backendGetDeviceID()' - Get the IEEE-1284 device ID string and
++ *                          corresponding URI.
+  */
+ 
+-#ifndef SNMP_BACKEND
+-#  ifdef __linux
+-#    include <sys/ioctl.h>
+-#    include <linux/lp.h>
+-#    define IOCNR_GET_DEVICE_ID		1
+-#    define LPIOC_GET_DEVICE_ID(len)	_IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
+-#  endif /* __linux */
+-
+-#  ifdef __sun
+-#    ifdef __sparc
+-#      include <sys/ecppio.h>
+-#    else
+-#      include <sys/ioccom.h>
+-#      include <sys/ecppsys.h>
+-#    endif /* __sparc */
+-#  endif /* __sun */
+-
+-
+ int					/* O - 0 on success, -1 on failure */
+-get_device_id(
++backendGetDeviceID(
+     int        fd,			/* I - File descriptor */
+     char       *device_id,		/* O - 1284 device ID */
+     int        device_id_size,		/* I - Size of buffer */
+@@ -93,7 +83,7 @@
+ #endif /* __sun && ECPPIOC_GETDEVID */
+ 
+ 
+-  DEBUG_printf(("get_device_id(fd=%d, device_id=%p, device_id_size=%d, "
++  DEBUG_printf(("backendGetDeviceID(fd=%d, device_id=%p, device_id_size=%d, "
+                 "make_model=%p, make_model_size=%d, scheme=\"%s\", "
+ 		"uri=%p, uri_size=%d)\n", fd, device_id, device_id_size,
+ 		make_model, make_model_size, scheme ? scheme : "(null)",
+@@ -107,7 +97,7 @@
+       !device_id || device_id_size < 32 ||
+       !make_model || make_model_size < 32)
+   {
+-    DEBUG_puts("get_device_id: Bad args!");
++    DEBUG_puts("backendGetDeviceID: Bad args!");
+     return (-1);
+   }
+ 
+@@ -155,7 +145,7 @@
+   }
+ #  ifdef DEBUG
+   else
+-    printf("get_device_id: ioctl failed - %s\n", strerror(errno));
++    printf("backendGetDeviceID: ioctl failed - %s\n", strerror(errno));
+ #  endif /* DEBUG */
+ #endif /* __linux */
+ 
+@@ -178,11 +168,11 @@
+   }
+ #  ifdef DEBUG
+   else
+-    printf("get_device_id: ioctl failed - %s\n", strerror(errno));
++    printf("backendGetDeviceID: ioctl failed - %s\n", strerror(errno));
+ #  endif /* DEBUG */
+ #endif /* __sun && ECPPIOC_GETDEVID */
+ 
+-  DEBUG_printf(("get_device_id: device_id=\"%s\"\n", device_id));
++  DEBUG_printf(("backendGetDeviceID: device_id=\"%s\"\n", device_id));
+ 
+   if (!*device_id)
+     return (-1);
+@@ -191,7 +181,7 @@
+   * Get the make and model...
+   */
+ 
+-  get_make_model(device_id, make_model, make_model_size);
++  backendGetMakeModel(device_id, make_model, make_model_size);
+ 
+  /*
+   * Then generate a device URI...
+@@ -303,15 +293,14 @@
+ 
+   return (0);
+ }
+-#endif /* !SNMP_BACKEND */
+ 
+ 
+ /*
+- * 'get_make_model()' - Get the make and model string from the device ID.
++ * 'backendGetMakeModel()' - Get the make and model string from the device ID.
+  */
+ 
+ int					/* O - 0 on success, -1 on failure */
+-get_make_model(
++backendGetMakeModel(
+     const char *device_id,		/* O - 1284 device ID */
+     char       *make_model,		/* O - Make/model */
+     int        make_model_size)		/* I - Size of buffer */
+@@ -322,7 +311,7 @@
+ 	*mdl;				/* Model string */
+ 
+ 
+-  DEBUG_printf(("get_make_model(device_id=\"%s\", "
++  DEBUG_printf(("backendGetMakeModel(device_id=\"%s\", "
+                 "make_model=%p, make_model_size=%d)\n", device_id,
+ 		make_model, make_model_size));
+ 
+@@ -332,7 +321,7 @@
+ 
+   if (!device_id || !*device_id || !make_model || make_model_size < 32)
+   {
+-    DEBUG_puts("get_make_model: Bad args!");
++    DEBUG_puts("backendGetMakeModel: Bad args!");
+     return (-1);
+   }
+ 
+diff -urNad cupsys-1.2.1~/backend/ipp.c cupsys-1.2.1/backend/ipp.c
+--- cupsys-1.2.1~/backend/ipp.c	2006-05-20 12:23:40.000000000 +0000
++++ cupsys-1.2.1/backend/ipp.c	2006-07-18 11:27:13.000000000 +0000
+@@ -211,7 +211,8 @@
+   */
+ 
+   if ((content_type = getenv("FINAL_CONTENT_TYPE")) == NULL)
+-    content_type = "application/octet-stream";
++    if ((content_type = getenv("CONTENT_TYPE")) == NULL)
++      content_type = "application/octet-stream";
+ 
+  /*
+   * Extract the hostname and printer name from the URI...
+@@ -229,6 +230,8 @@
+ 
+   if (!strcmp(method, "https"))
+     cupsSetEncryption(HTTP_ENCRYPT_ALWAYS);
++  else
++    cupsSetEncryption(HTTP_ENCRYPT_IF_REQUESTED);
+ 
+  /*
+   * See if there are any options...
+diff -urNad cupsys-1.2.1~/backend/parallel.c cupsys-1.2.1/backend/parallel.c
+--- cupsys-1.2.1~/backend/parallel.c	2006-04-10 02:51:12.000000000 +0000
++++ cupsys-1.2.1/backend/parallel.c	2006-07-18 11:27:13.000000000 +0000
+@@ -33,14 +33,7 @@
+  * Include necessary headers.
+  */
+ 
+-#include <cups/backend.h>
+-#include <cups/cups.h>
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <errno.h>
+-#include <cups/string.h>
+-#include <signal.h>
+-#include "ieee1284.c"
++#include "backend-private.h"
+ 
+ #ifdef __hpux
+ #  include <sys/time.h>
+@@ -94,25 +87,14 @@
+ 		resource[1024],		/* Resource info (device and options) */
+ 		*options;		/* Pointer to options */
+   int		port;			/* Port number (not used) */
+-  int		fp;			/* Print file */
++  int		print_fd,		/* Print file */
++		device_fd;		/* Parallel device */
+   int		copies;			/* Number of copies to print */
+-  int		fd;			/* Parallel device */
+-  int		rbytes;			/* Number of bytes read */
+-  int		wbytes;			/* Number of bytes written */
+-  size_t	nbytes,			/* Number of bytes read */
+-		tbytes;			/* Total number of bytes written */
+-  char		buffer[8192],		/* Output buffer */
+-		*bufptr;		/* Pointer into buffer */
++  size_t	tbytes;			/* Total number of bytes written */
+   struct termios opts;			/* Parallel port options */
+-  fd_set	input,			/* Input set for select() */
+-		output;			/* Output set for select() */
+-  int		paperout;		/* Paper out? */
+ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+   struct sigaction action;		/* Actions for POSIX signals */
+ #endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+-#ifdef __linux
+-  unsigned int	status;			/* Port status (off-line, out-of-paper, etc.) */
+-#endif /* __linux */
+ 
+ 
+  /*
+@@ -157,8 +139,8 @@
+ 
+   if (argc == 6)
+   {
+-    fp     = 0;
+-    copies = 1;
++    print_fd = 0;
++    copies   = 1;
+   }
+   else
+   {
+@@ -166,7 +148,7 @@
+     * Try to open the print file...
+     */
+ 
+-    if ((fp = open(argv[6], O_RDONLY)) < 0)
++    if ((print_fd = open(argv[6], O_RDONLY)) < 0)
+     {
+       perror("ERROR: unable to open print file");
+       return (CUPS_BACKEND_FAILED);
+@@ -206,7 +188,7 @@
+ 
+   do
+   {
+-    if ((fd = open(resource, O_WRONLY | O_EXCL)) == -1)
++    if ((device_fd = open(resource, O_WRONLY | O_EXCL)) == -1)
+     {
+       if (getenv("CLASS") != NULL)
+       {
+@@ -217,8 +199,8 @@
+ 	* available printer in the class.
+ 	*/
+ 
+-        fputs("INFO: Unable to open parallel port, queuing on next printer in class...\n",
+-	      stderr);
++        fputs("INFO: Unable to open parallel port, queuing on next printer "
++	      "in class...\n", stderr);
+ 
+        /*
+         * Sleep 5 seconds to keep the job from requeuing too rapidly...
+@@ -231,23 +213,26 @@
+ 
+       if (errno == EBUSY)
+       {
+-        fputs("INFO: Parallel port busy; will retry in 30 seconds...\n", stderr);
++        fputs("INFO: Parallel port busy; will retry in 30 seconds...\n",
++	      stderr);
+ 	sleep(30);
+       }
+       else if (errno == ENXIO || errno == EIO || errno == ENOENT)
+       {
+-        fputs("INFO: Printer not connected; will retry in 30 seconds...\n", stderr);
++        fputs("INFO: Printer not connected; will retry in 30 seconds...\n",
++	      stderr);
+ 	sleep(30);
+       }
+       else
+       {
+-	fprintf(stderr, "ERROR: Unable to open parallel port device file \"%s\": %s\n",
++	fprintf(stderr,
++	        "ERROR: Unable to open parallel port device file \"%s\": %s\n",
+ 	        resource, strerror(errno));
+ 	return (CUPS_BACKEND_FAILED);
+       }
+     }
+   }
+-  while (fd < 0);
++  while (device_fd < 0);
+ 
+   fputs("STATE: -connecting-to-device\n", stderr);
+ 
+@@ -255,189 +240,47 @@
+   * Set any options provided...
+   */
+ 
+-  tcgetattr(fd, &opts);
++  tcgetattr(device_fd, &opts);
+ 
+   opts.c_lflag &= ~(ICANON | ECHO | ISIG);	/* Raw mode */
+ 
+   /**** No options supported yet ****/
+ 
+-  tcsetattr(fd, TCSANOW, &opts);
+-
+- /*
+-  * Check printer status...
+-  */
+-
+-  paperout = 0;
+-
+-#if defined(__linux) && defined(LP_POUTPA)
+- /*
+-  * Show the printer status before we send the file...
+-  */
+-
+-  while (!ioctl(fd, LPGETSTATUS, &status))
+-  {
+-    fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n", status);
+-
+-    if (status & LP_POUTPA)
+-    {
+-      fputs("WARNING: Media tray empty!\n", stderr);
+-      fputs("STATUS: +media-tray-empty-error\n", stderr);
+-
+-      paperout = 1;
+-    }
+-
+-    if (!(status & LP_PERRORP))
+-      fputs("WARNING: Printer fault!\n", stderr);
+-    else if (!(status & LP_PSELECD))
+-      fputs("WARNING: Printer off-line.\n", stderr);
+-    else
+-      break;
+-
+-    sleep(5);
+-  }
+-#endif /* __linux && LP_POUTPA */
+-
+- /*
+-  * Now that we are "connected" to the port, ignore SIGTERM so that we
+-  * can finish out any page data the driver sends (e.g. to eject the
+-  * current page...  Only ignore SIGTERM if we are printing data from
+-  * stdin (otherwise you can't cancel raw jobs...)
+-  */
+-
+-  if (argc < 7)
+-  {
+-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+-    sigset(SIGTERM, SIG_IGN);
+-#elif defined(HAVE_SIGACTION)
+-    memset(&action, 0, sizeof(action));
+-
+-    sigemptyset(&action.sa_mask);
+-    action.sa_handler = SIG_IGN;
+-    sigaction(SIGTERM, &action, NULL);
+-#else
+-    signal(SIGTERM, SIG_IGN);
+-#endif /* HAVE_SIGSET */
+-  }
++  tcsetattr(device_fd, TCSANOW, &opts);
+ 
+  /*
+   * Finally, send the print file...
+   */
+ 
+-  wbytes = 0;
++  tbytes = 0;
+ 
+-  while (copies > 0)
++  while (copies > 0 && tbytes >= 0)
+   {
+     copies --;
+ 
+-    if (fp != 0)
++    if (print_fd != 0)
+     {
+       fputs("PAGE: 1 1\n", stderr);
+-      lseek(fp, 0, SEEK_SET);
++      lseek(print_fd, 0, SEEK_SET);
+     }
+ 
+-    tbytes = 0;
+-    while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
+-    {
+-     /*
+-      * Write the print data to the printer...
+-      */
+-
+-      tbytes += nbytes;
+-      bufptr = buffer;
+-
+-      while (nbytes > 0)
+-      {
+-       /*
+-        * See if we are ready to read or write...
+-	*/
+-
+-        do
+-	{
+-          FD_ZERO(&input);
+-	  FD_SET(fd, &input);
+-	  FD_ZERO(&output);
+-	  FD_SET(fd, &output);
+-        }
+-	while (select(fd + 1, &input, &output, NULL, NULL) < 0);
+-
+-        if (FD_ISSET(fd, &input))
+-	{
+-	 /*
+-	  * Read backchannel data...
+-	  */
+-
+-	  if ((rbytes = read(fd, resource, sizeof(resource))) > 0)
+-	  {
+-	    fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
+-	            rbytes);
+-            cupsBackChannelWrite(resource, rbytes, 1.0);
+-          }
+-	}
+-
+-        if (FD_ISSET(fd, &output))
+-	{
+-	 /*
+-	  * Write print data...
+-	  */
+-
+-	  if ((wbytes = write(fd, bufptr, nbytes)) < 0)
+-	    if (errno == ENOTTY)
+-	      wbytes = write(fd, bufptr, nbytes);
+-
+-	  if (wbytes < 0)
+-	  {
+-	   /*
+-	    * Check for retryable errors...
+-	    */
+-
+-            if (errno == ENOSPC)
+-	    {
+-	      paperout = 1;
+-	      fputs("ERROR: Out of paper!\n", stderr);
+-	      fputs("STATUS: +media-tray-empty-error\n", stderr);
+-	    }
+-	    else if (errno != EAGAIN && errno != EINTR)
+-	    {
+-	      perror("ERROR: Unable to send print file to printer");
+-	      break;
+-	    }
+-	  }
+-	  else
+-	  {
+-	   /*
+-	    * Update count and pointer...
+-	    */
+-
+-            if (paperout)
+-	    {
+-	      fputs("STATUS: -media-tray-empty-error\n", stderr);
+-	      paperout = 0;
+-	    }
+-
+-	    nbytes -= wbytes;
+-	    bufptr += wbytes;
+-	  }
+-	}
+-      }
+-
+-      if (wbytes < 0)
+-        break;
++    tbytes = backendRunLoop(print_fd, device_fd, 1);
+ 
+-      if (argc > 6)
+-	fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
+-	        (unsigned long)tbytes);
+-    }
++    if (print_fd != 0 && tbytes >= 0)
++      fprintf(stderr, "INFO: Sent print file, " CUPS_LLFMT " bytes...\n",
++	      CUPS_LLCAST tbytes);
+   }
+ 
+  /*
+   * Close the socket connection and input file and return...
+   */
+ 
+-  close(fd);
+-  if (fp != 0)
+-    close(fp);
++  close(device_fd);
+ 
+-  return (wbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
++  if (print_fd != 0)
++    close(print_fd);
++
++  return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
+ }
+ 
+ 
+@@ -485,9 +328,9 @@
+       * Now grab the IEEE 1284 device ID string...
+       */
+ 
+-      if (!get_device_id(fd, device_id, sizeof(device_id),
+-                         make_model, sizeof(make_model),
+-			 NULL, NULL, 0))
++      if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
++                              make_model, sizeof(make_model),
++			      NULL, NULL, 0))
+ 	printf("direct parallel:%s \"%s\" \"%s LPT #%d\" \"%s\"\n", device,
+ 	       make_model, make_model, i + 1, device_id);
+       else
+diff -urNad cupsys-1.2.1~/backend/runloop.c cupsys-1.2.1/backend/runloop.c
+--- cupsys-1.2.1~/backend/runloop.c	1970-01-01 00:00:00.000000000 +0000
++++ cupsys-1.2.1/backend/runloop.c	2006-07-18 11:27:13.000000000 +0000
+@@ -0,0 +1,258 @@
++/*
++ * "$Id$"
++ *
++ *   Common run loop API for the Common UNIX Printing System (CUPS).
++ *
++ *   Copyright 2006 by Easy Software Products, all rights reserved.
++ *
++ *   These coded instructions, statements, and computer programs are the
++ *   property of Easy Software Products and are protected by Federal
++ *   copyright law.  Distribution and use rights are outlined in the file
++ *   "LICENSE" which should have been included with this file.  If this
++ *   file is missing or damaged please contact Easy Software Products
++ *   at:
++ *
++ *       Attn: CUPS Licensing Information
++ *       Easy Software Products
++ *       44141 Airport View Drive, Suite 204
++ *       Hollywood, Maryland 20636 USA
++ *
++ *       Voice: (301) 373-9600
++ *       EMail: cups-info at cups.org
++ *         WWW: http://www.cups.org
++ *
++ *   This file is subject to the Apple OS-Developed Software exception.
++ *
++ * Contents:
++ *
++ *   backendRunLoop() - Read and write print and back-channel data.
++ */
++
++/*
++ * Include necessary headers.
++ */
++
++#include "backend-private.h"
++#include <sys/select.h>
++
++
++/*
++ * 'backendRunLoop()' - Read and write print and back-channel data.
++ */
++
++ssize_t					/* O - Total bytes on success, -1 on error */
++backendRunLoop(int print_fd,		/* I - Print file descriptor */
++               int device_fd,		/* I - Device file descriptor */
++	       int use_bc)		/* I - Use back-channel? */
++{
++  int		nfds;			/* Maximum file descriptor value + 1 */
++  fd_set	input,			/* Input set for reading */
++		output;			/* Output set for writing */
++  ssize_t	print_bytes,		/* Print bytes read */
++		bc_bytes,		/* Backchannel bytes read */
++		total_bytes,		/* Total bytes written */
++		bytes;			/* Bytes written */
++  int		paperout;		/* "Paper out" status */
++  int		offline;		/* "Off-line" status */
++  char		print_buffer[8192],	/* Print data buffer */
++		*print_ptr,		/* Pointer into print data buffer */
++		bc_buffer[1024];	/* Back-channel data buffer */
++#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
++  struct sigaction action;		/* Actions for POSIX signals */
++#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
++
++
++  fprintf(stderr, "DEBUG: backendRunLoop(print_fd=%d, device_fd=%d, use_bc=%d)\n",
++          print_fd, device_fd, use_bc);
++
++ /*
++  * If we are printing data from a print driver on stdin, ignore SIGTERM
++  * so that the driver can finish out any page data, e.g. to eject the
++  * current page.  We only do this for stdin printing as otherwise there
++  * is no way to cancel a raw print job...
++  */
++
++  if (!print_fd)
++  {
++#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
++    sigset(SIGTERM, SIG_IGN);
++#elif defined(HAVE_SIGACTION)
++    memset(&action, 0, sizeof(action));
++
++    sigemptyset(&action.sa_mask);
++    action.sa_handler = SIG_IGN;
++    sigaction(SIGTERM, &action, NULL);
++#else
++    signal(SIGTERM, SIG_IGN);
++#endif /* HAVE_SIGSET */
++  }
++
++ /*
++  * Figure out the maximum file descriptor value to use with select()...
++  */
++
++  nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
++
++ /*
++  * Now loop until we are out of data from print_fd...
++  */
++
++  for (print_bytes = 0, print_ptr = print_buffer, offline = 0, paperout = 0, total_bytes = 0;;)
++  {
++   /*
++    * Use select() to determine whether we have data to copy around...
++    */
++
++    FD_ZERO(&input);
++    if (!print_bytes)
++      FD_SET(print_fd, &input);
++    if (use_bc)
++      FD_SET(device_fd, &input);
++
++    FD_ZERO(&output);
++    if (print_bytes || !use_bc)
++      FD_SET(device_fd, &output);
++
++    if (use_bc)
++    {
++      if (select(nfds, &input, &output, NULL, NULL) < 0)
++      {
++       /*
++	* Pause printing to clear any pending errors...
++	*/
++
++	if (errno == ENXIO && !offline)
++	{
++	  fputs("STATE: +offline-error\n", stderr);
++	  fputs("INFO: Printer is currently off-line.\n", stderr);
++	  offline = 1;
++	}
++
++	sleep(1);
++	continue;
++      }
++    }
++
++   /*
++    * Check if we have back-channel data ready...
++    */
++
++    if (FD_ISSET(device_fd, &input))
++    {
++      if ((bc_bytes = read(device_fd, bc_buffer, sizeof(bc_buffer))) > 0)
++      {
++	fprintf(stderr,
++	        "DEBUG: Received " CUPS_LLFMT " bytes of back-channel data!\n",
++	        CUPS_LLCAST bc_bytes);
++        cupsBackChannelWrite(bc_buffer, bc_bytes, 1.0);
++      }
++    }
++
++   /*
++    * Check if we have print data ready...
++    */
++
++    if (FD_ISSET(print_fd, &input))
++    {
++      if ((print_bytes = read(print_fd, print_buffer,
++                              sizeof(print_buffer))) < 0)
++      {
++       /*
++        * Read error - bail if we don't see EAGAIN or EINTR...
++	*/
++
++	if (errno != EAGAIN || errno != EINTR)
++	{
++	  perror("ERROR: Unable to read print data");
++	  return (-1);
++	}
++
++        print_bytes = 0;
++      }
++      else if (print_bytes == 0)
++      {
++       /*
++        * End of file, break out of the loop...
++	*/
++
++        break;
++      }
++
++      print_ptr = print_buffer;
++
++      fprintf(stderr, "DEBUG: Read %d bytes of print data...\n",
++              (int)print_bytes);
++    }
++
++   /*
++    * Check if the device is ready to receive data and we have data to
++    * send...
++    */
++
++    if (print_bytes && FD_ISSET(device_fd, &output))
++    {
++      if ((bytes = write(device_fd, print_ptr, print_bytes)) < 0)
++      {
++       /*
++        * Write error - bail if we don't see an error we can retry...
++	*/
++
++        if (errno == ENOSPC)
++	{
++	  if (!paperout)
++	  {
++	    fputs("ERROR: Out of paper!\n", stderr);
++	    fputs("STATUS: +media-tray-empty-error\n", stderr);
++	    paperout = 1;
++	  }
++        }
++	else if (errno == ENXIO)
++	{
++	  if (!offline)
++	  {
++	    fputs("STATE: +offline-error\n", stderr);
++	    fputs("INFO: Printer is currently off-line.\n", stderr);
++	    offline = 1;
++	  }
++	}
++	else if (errno != EAGAIN && errno != EINTR && errno != ENOTTY)
++	{
++	  perror("ERROR: Unable to write print data");
++	  return (-1);
++	}
++      }
++      else
++      {
++        if (paperout)
++	{
++	  fputs("STATUS: -media-tray-empty-error\n", stderr);
++	  paperout = 0;
++	}
++
++	if (offline)
++	{
++	  fputs("STATE: -offline-error\n", stderr);
++	  fputs("INFO: Printer is now on-line.\n", stderr);
++	  offline = 0;
++	}
++
++        fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n", (int)bytes);
++
++        print_bytes -= bytes;
++	print_ptr   += bytes;
++	total_bytes += bytes;
++      }
++    }
++  }
++
++ /*
++  * Return with success...
++  */
++
++  return (total_bytes);
++}
++
++
++/*
++ * End of "$Id$".
++ */
+diff -urNad cupsys-1.2.1~/backend/serial.c cupsys-1.2.1/backend/serial.c
+--- cupsys-1.2.1~/backend/serial.c	2006-05-20 12:23:40.000000000 +0000
++++ cupsys-1.2.1/backend/serial.c	2006-07-18 11:27:13.000000000 +0000
+@@ -33,13 +33,7 @@
+  * Include necessary headers.
+  */
+ 
+-#include <cups/backend.h>
+-#include <cups/cups.h>
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <errno.h>
+-#include <cups/string.h>
+-#include <signal.h>
++#include "backend-private.h"
+ 
+ #ifdef __hpux
+ #  include <sys/modem.h>
+@@ -121,21 +115,23 @@
+ 		value[255],		/* Value of option */
+ 		*ptr;			/* Pointer into name or value */
+   int		port;			/* Port number (not used) */
+-  int		fp;			/* Print file */
+   int		copies;			/* Number of copies to print */
+-  int		fd;			/* Parallel device */
+-  int		rbytes;			/* Number of bytes read */
+-  int		wbytes;			/* Number of bytes written */
+-  size_t	nbytes,			/* Number of bytes read */
+-		tbytes;			/* Total number of bytes written */
++  int		print_fd,		/* Print file */
++		device_fd;		/* Serial device */
++  int		nfds;			/* Maximum file descriptor value + 1 */
++  fd_set	input,			/* Input set for reading */
++		output;			/* Output set for writing */
++  ssize_t	print_bytes,		/* Print bytes read */
++		bc_bytes,		/* Backchannel bytes read */
++		total_bytes,		/* Total bytes written */
++		bytes;			/* Bytes written */
+   int		dtrdsr;			/* Do dtr/dsr flow control? */
+-  int		bufsize;		/* Size of output buffer for writes */
+-  char		buffer[8192],		/* Output buffer */
+-		*bufptr;		/* Pointer into buffer */
++  int		print_size;		/* Size of output buffer for writes */
++  char		print_buffer[8192],	/* Print data buffer */
++		*print_ptr,		/* Pointer into print data buffer */
++		bc_buffer[1024];	/* Back-channel data buffer */
+   struct termios opts;			/* Serial port options */
+   struct termios origopts;		/* Original port options */
+-  fd_set	input,			/* Input set for select() */
+-		output;			/* Output set for select() */
+ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+   struct sigaction action;		/* Actions for POSIX signals */
+ #endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+@@ -183,8 +179,8 @@
+ 
+   if (argc == 6)
+   {
+-    fp     = 0;
+-    copies = 1;
++    print_fd = 0;
++    copies   = 1;
+   }
+   else
+   {
+@@ -192,7 +188,7 @@
+     * Try to open the print file...
+     */
+ 
+-    if ((fp = open(argv[6], O_RDONLY)) < 0)
++    if ((print_fd = open(argv[6], O_RDONLY)) < 0)
+     {
+       perror("ERROR: unable to open print file");
+       return (CUPS_BACKEND_FAILED);
+@@ -232,7 +228,8 @@
+ 
+   do
+   {
+-    if ((fd = open(resource, O_WRONLY | O_NOCTTY | O_EXCL | O_NDELAY)) == -1)
++    if ((device_fd = open(resource, O_RDWR | O_NOCTTY | O_EXCL |
++                                    O_NDELAY)) == -1)
+     {
+       if (getenv("CLASS") != NULL)
+       {
+@@ -268,7 +265,7 @@
+       }
+     }
+   }
+-  while (fd < 0);
++  while (device_fd < 0);
+ 
+   fputs("STATE: -connecting-to-device\n", stderr);
+ 
+@@ -276,16 +273,18 @@
+   * Set any options provided...
+   */
+ 
+-  tcgetattr(fd, &origopts);
+-  tcgetattr(fd, &opts);
++  tcgetattr(device_fd, &origopts);
++  tcgetattr(device_fd, &opts);
+ 
+-  opts.c_lflag &= ~(ICANON | ECHO | ISIG);	/* Raw mode */
+-  opts.c_oflag &= ~OPOST;			/* Don't post-process */
++  opts.c_lflag &= ~(ICANON | ECHO | ISIG);
++					/* Raw mode */
++  opts.c_oflag &= ~OPOST;		/* Don't post-process */
+ 
+-  bufsize = 96;		/* 9600 baud / 10 bits/char / 10Hz */
+-  dtrdsr  = 0;		/* No dtr/dsr flow control */
++  print_size = 96;			/* 9600 baud / 10 bits/char / 10Hz */
++  dtrdsr     = 0;			/* No dtr/dsr flow control */
+ 
+-  if (options != NULL)
++  if (options)
++  {
+     while (*options)
+     {
+      /*
+@@ -326,7 +325,7 @@
+         * Set the baud rate...
+ 	*/
+ 
+-        bufsize = atoi(value) / 100;
++        print_size = atoi(value) / 100;
+ 
+ #if B19200 == 19200
+         cfsetispeed(&opts, atoi(value));
+@@ -488,9 +487,10 @@
+ 	}
+       }
+     }
++  }
+ 
+-  tcsetattr(fd, TCSANOW, &opts);
+-  fcntl(fd, F_SETFL, 0);
++  tcsetattr(device_fd, TCSANOW, &opts);
++  fcntl(device_fd, F_SETFL, 0);
+ 
+  /*
+   * Now that we are "connected" to the port, ignore SIGTERM so that we
+@@ -499,7 +499,7 @@
+   * stdin (otherwise you can't cancel raw jobs...)
+   */
+ 
+-  if (argc < 7)
++  if (print_fd != 0)
+   {
+ #ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+     sigset(SIGTERM, SIG_IGN);
+@@ -515,133 +515,181 @@
+   }
+ 
+  /*
+-  * Finally, send the print file...
++  * Figure out the maximum file descriptor value to use with select()...
+   */
+ 
+-  if (bufsize > sizeof(buffer))
+-    bufsize = sizeof(buffer);
++  nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
+ 
+-  wbytes = 0;
++ /*
++  * Finally, send the print file.  Ordinarily we would just use the
++  * backendRunLoop() function, however since we need to use smaller
++  * writes and may need to do DSR/DTR flow control, we duplicate much
++  * of the code here instead...
++  */
++
++  if (print_size > sizeof(print_buffer))
++    print_size = sizeof(print_buffer);
++
++  total_bytes = 0;
+ 
+   while (copies > 0)
+   {
+     copies --;
+ 
+-    if (fp != 0)
++    if (print_fd != 0)
+     {
+       fputs("PAGE: 1 1\n", stderr);
+-      lseek(fp, 0, SEEK_SET);
++      lseek(print_fd, 0, SEEK_SET);
+     }
+ 
+-    if (dtrdsr)
++   /*
++    * Now loop until we are out of data from print_fd...
++    */
++
++    for (print_bytes = 0, print_ptr = print_buffer;;)
+     {
+      /*
+-      * Check the port and sleep until DSR is set...
++      * Use select() to determine whether we have data to copy around...
+       */
+ 
+-      int status;
++      FD_ZERO(&input);
++      if (!print_bytes)
++	FD_SET(print_fd, &input);
++      FD_SET(device_fd, &input);
+ 
++      FD_ZERO(&output);
++      if (print_bytes)
++	FD_SET(device_fd, &output);
+ 
+-      if (!ioctl(fd, TIOCMGET, &status))
+-        if (!(status & TIOCM_DSR))
++      if (select(nfds, &input, &output, NULL, NULL) < 0)
++	continue;			/* Ignore errors here */
++
++     /*
++      * Check if we have back-channel data ready...
++      */
++
++      if (FD_ISSET(device_fd, &input))
++      {
++	if ((bc_bytes = read(device_fd, bc_buffer, sizeof(bc_buffer))) > 0)
++	{
++	  fprintf(stderr,
++	          "DEBUG: Received " CUPS_LLFMT " bytes of back-channel data!\n",
++	          CUPS_LLCAST bc_bytes);
++          cupsBackChannelWrite(bc_buffer, bc_bytes, 1.0);
++	}
++      }
++
++     /*
++      * Check if we have print data ready...
++      */
++
++      if (FD_ISSET(print_fd, &input))
++      {
++	if ((print_bytes = read(print_fd, print_buffer, print_size)) < 0)
+ 	{
+ 	 /*
+-	  * Wait for DSR to go high...
++          * Read error - bail if we don't see EAGAIN or EINTR...
+ 	  */
+ 
+-	  fputs("DEBUG: DSR is low; waiting for device...\n", stderr);
+-
+-          do
++	  if (errno != EAGAIN || errno != EINTR)
+ 	  {
+-	    sleep(1);
+-	    if (ioctl(fd, TIOCMGET, &status))
+-	      break;
+-	  }
+-	  while (!(status & TIOCM_DSR));
+-
+-	  fputs("DEBUG: DSR is high; writing to device...\n", stderr);
+-        }
+-    }
++	    perror("ERROR: Unable to read print data");
+ 
+-    tbytes = 0;
+-    while ((nbytes = read(fp, buffer, bufsize)) > 0)
+-    {
+-     /*
+-      * Write the print data to the printer...
+-      */
++            tcsetattr(device_fd, TCSADRAIN, &origopts);
+ 
+-      tbytes += nbytes;
+-      bufptr = buffer;
++	    close(device_fd);
+ 
+-      while (nbytes > 0)
+-      {
+-       /*
+-        * See if we are ready to read or write...
+-	*/
++	    if (print_fd != 0)
++	      close(print_fd);
+ 
+-        do
+-	{
+-          FD_ZERO(&input);
+-	  FD_SET(fd, &input);
+-	  FD_ZERO(&output);
+-	  FD_SET(fd, &output);
+-        }
+-	while (select(fd + 1, &input, &output, NULL, NULL) < 0);
++	    return (CUPS_BACKEND_FAILED);
++	  }
+ 
+-        if (FD_ISSET(fd, &input))
++          print_bytes = 0;
++	}
++	else if (print_bytes == 0)
+ 	{
+ 	 /*
+-	  * Read backchannel data...
++          * End of file, break out of the loop...
+ 	  */
+ 
+-	  if ((rbytes = read(fd, resource, sizeof(resource))) > 0)
+-	  {
+-	    fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
+-	            rbytes);
+-            cupsBackChannelWrite(resource, rbytes, 1.0);
+-          }
++          break;
+ 	}
+ 
+-        if (FD_ISSET(fd, &output))
++	print_ptr = print_buffer;
++      }
++
++     /*
++      * Check if the device is ready to receive data and we have data to
++      * send...
++      */
++
++      if (print_bytes && FD_ISSET(device_fd, &output))
++      {
++	if (dtrdsr)
+ 	{
+ 	 /*
+-	  * Write print data...
++	  * Check the port and sleep until DSR is set...
+ 	  */
+ 
+-	  if ((wbytes = write(fd, bufptr, nbytes)) < 0)
+-	    if (errno == ENOTTY)
+-	      wbytes = write(fd, bufptr, nbytes);
++	  int status;
+ 
+-	  if (wbytes < 0)
+-	  {
+-	   /*
+-	    * Check for retryable errors...
+-	    */
+ 
+-	    if (errno != EAGAIN && errno != EINTR)
++	  if (!ioctl(device_fd, TIOCMGET, &status))
++            if (!(status & TIOCM_DSR))
+ 	    {
+-	      perror("ERROR: Unable to send print file to printer");
+-	      break;
+-	    }
+-	  }
+-	  else
++	     /*
++	      * Wait for DSR to go high...
++	      */
++
++	      fputs("DEBUG: DSR is low; waiting for device...\n", stderr);
++
++              do
++	      {
++	       /*
++	        * Poll every 100ms...
++		*/
++
++		usleep(100000);
++
++		if (ioctl(device_fd, TIOCMGET, &status))
++		  break;
++	      }
++	      while (!(status & TIOCM_DSR));
++
++	      fputs("DEBUG: DSR is high; writing to device...\n", stderr);
++            }
++	}
++
++	if ((bytes = write(device_fd, print_ptr, print_bytes)) < 0)
++	{
++	 /*
++          * Write error - bail if we don't see an error we can retry...
++	  */
++
++	  if (errno != EAGAIN && errno != EINTR && errno != ENOTTY)
+ 	  {
+-	   /*
+-	    * Update count and pointer...
+-	    */
++	    perror("ERROR: Unable to write print data");
+ 
+-	    nbytes -= wbytes;
+-	    bufptr += wbytes;
++            tcsetattr(device_fd, TCSADRAIN, &origopts);
++
++	    close(device_fd);
++
++	    if (print_fd != 0)
++	      close(print_fd);
++
++	    return (CUPS_BACKEND_FAILED);
+ 	  }
+ 	}
+-      }
+-
+-      if (wbytes < 0)
+-        break;
++	else
++	{
++          fprintf(stderr, "DEBUG: Wrote %d bytes...\n", (int)bytes);
+ 
+-      if (argc > 6)
+-	fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
+-	        (unsigned long)tbytes);
++          print_bytes -= bytes;
++	  print_ptr   += bytes;
++	  total_bytes += bytes;
++	}
++      }
+     }
+   }
+ 
+@@ -649,13 +697,14 @@
+   * Close the serial port and input file and return...
+   */
+ 
+-  tcsetattr(fd, TCSADRAIN, &origopts);
++  tcsetattr(device_fd, TCSADRAIN, &origopts);
+ 
+-  close(fd);
+-  if (fp != 0)
+-    close(fp);
++  close(device_fd);
+ 
+-  return (wbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
++  if (print_fd != 0)
++    close(print_fd);
++
++  return (total_bytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
+ }
+ 
+ 
+diff -urNad cupsys-1.2.1~/backend/snmp.c cupsys-1.2.1/backend/snmp.c
+--- cupsys-1.2.1~/backend/snmp.c	2006-05-02 15:03:17.000000000 +0000
++++ cupsys-1.2.1/backend/snmp.c	2006-07-18 11:27:13.000000000 +0000
+@@ -77,17 +77,10 @@
+  * Include necessary headers.
+  */
+ 
+-#include <cups/backend.h>
+ #include <cups/http-private.h>
+-#include <cups/cups.h>
+-#include <cups/string.h>
++#include "backend-private.h"
+ #include <cups/array.h>
+ #include <cups/file.h>
+-#include <errno.h>
+-#include <signal.h>
+-
+-#define SNMP_BACKEND
+-#include "ieee1284.c"
+ 
+ 
+ /*
+@@ -391,7 +384,7 @@
+ 
+   debug_printf("DEBUG: add_cache(addr=%p, addrname=\"%s\", uri=\"%s\", "
+                   "id=\"%s\", make_and_model=\"%s\")\n",
+-               addr, addrname, uri, id ? id :  "(null)",
++               addr, addrname, uri ? uri : "(null)", id ? id :  "(null)",
+ 	       make_and_model ? make_and_model : "(null)");
+ 
+   temp = calloc(1, sizeof(snmp_cache_t));
+@@ -1210,7 +1203,7 @@
+ compare_cache(snmp_cache_t *a,		/* I - First cache entry */
+               snmp_cache_t *b)		/* I - Second cache entry */
+ {
+-  return (a->address.ipv4.sin_addr.s_addr - b->address.ipv4.sin_addr.s_addr);
++  return (strcasecmp(a->addrname, b->addrname));
+ }
+ 
+ 
+@@ -1648,6 +1641,14 @@
+  	  info = NULL;
+ 
+        /*
++        * Don't use the printer-make-and-model if it contains a generic
++	* string like "Ricoh IPP Printer"...
++	*/
++
++	if (model && strstr(model->values[0].string.text, "IPP Printer"))
++	  model = NULL;
++
++       /*
+         * If we don't have a printer-make-and-model string from the printer
+ 	* but do have the 1284 device ID string, generate a make-and-model
+ 	* string from the device ID info...
+@@ -1656,7 +1657,9 @@
+ 	if (model)
+           strlcpy(temp, model->values[0].string.text, sizeof(temp));
+ 	else if (info)
+-	  get_make_model(info->values[0].string.text, temp, sizeof(temp));
++	  backendGetMakeModel(info->values[0].string.text, temp, sizeof(temp));
++        else
++	  temp[0] = '\0';
+ 
+         fix_make_model(make_model, temp, sizeof(make_model));
+ 
+@@ -1871,8 +1874,8 @@
+   * Find a matching device in the cache...
+   */
+ 
+-  key.address = addr;
+-  device      = (snmp_cache_t *)cupsArrayFind(Devices, &key);
++  key.addrname = addrname;
++  device       = (snmp_cache_t *)cupsArrayFind(Devices, &key);
+ 
+  /*
+   * Process the message...
+@@ -1928,8 +1931,8 @@
+       * Description is the IEEE-1284 device ID...
+       */
+ 
+-      get_make_model(packet.object_value.string, make_model,
+-                     sizeof(make_model));
++      backendGetMakeModel(packet.object_value.string, make_model,
++                	  sizeof(make_model));
+     }
+     else
+     {
+diff -urNad cupsys-1.2.1~/backend/socket.c cupsys-1.2.1/backend/socket.c
+--- cupsys-1.2.1~/backend/socket.c	2006-03-07 22:07:44.000000000 +0000
++++ cupsys-1.2.1/backend/socket.c	2006-07-18 11:27:13.000000000 +0000
+@@ -32,17 +32,11 @@
+  * Include necessary headers.
+  */
+ 
+-#include <cups/backend.h>
+ #include <cups/http-private.h>
+-#include <cups/cups.h>
+-#include <stdio.h>
+-#include <stdlib.h>
++#include "backend-private.h"
+ #include <stdarg.h>
+-#include <cups/string.h>
+-#include <errno.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+-#include <signal.h>
+ 
+ #ifdef WIN32
+ #  include <winsock.h>
+@@ -76,24 +70,19 @@
+ 		name[255],		/* Name of option */
+ 		value[255],		/* Value of option */
+ 		*ptr;			/* Pointer into name or value */
+-  int		fp;			/* Print file */
++  int		print_fd;		/* Print file */
+   int		copies;			/* Number of copies to print */
+   int		waiteof;		/* Wait for end-of-file? */
+   int		port;			/* Port number */
+   char		portname[255];		/* Port name */
+   int		delay;			/* Delay for retries... */
+-  int		fd;			/* AppSocket */
++  int		device_fd;		/* AppSocket */
+   int		error;			/* Error code (if any) */
+   http_addrlist_t *addrlist;		/* Address list */
+-  int		rbytes;			/* Number of bytes read */
+-  int		wbytes;			/* Number of bytes written */
+-  int		nbytes;			/* Number of bytes read */
+-  size_t	tbytes;			/* Total number of bytes written */
+-  char		buffer[8192],		/* Output buffer */
+-		*bufptr;		/* Pointer into buffer */
++  ssize_t	tbytes;			/* Total number of bytes written */
+   struct timeval timeout;		/* Timeout for select() */
+-  fd_set	input,			/* Input set for select() */
+-		output;			/* Output set for select() */
++  fd_set	input;			/* Input set for select() */
++  ssize_t	bc_bytes;		/* Number of back-channel bytes read */
+ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+   struct sigaction action;		/* Actions for POSIX signals */
+ #endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+@@ -142,8 +131,8 @@
+ 
+   if (argc == 6)
+   {
+-    fp     = 0;
+-    copies = 1;
++    print_fd = 0;
++    copies   = 1;
+   }
+   else
+   {
+@@ -151,7 +140,7 @@
+     * Try to open the print file...
+     */
+ 
+-    if ((fp = open(argv[6], O_RDONLY)) < 0)
++    if ((print_fd = open(argv[6], O_RDONLY)) < 0)
+     {
+       perror("ERROR: unable to open print file");
+       return (CUPS_BACKEND_FAILED);
+@@ -252,228 +241,134 @@
+   fprintf(stderr, "INFO: Attempting to connect to host %s on port %d\n",
+           hostname, port);
+ 
+-  wbytes = 0;
++  fputs("STATE: +connecting-to-device\n", stderr);
+ 
+-  while (copies > 0)
++  for (delay = 5;;)
+   {
+-    fputs("STATE: +connecting-to-device\n", stderr);
+-
+-    for (delay = 5;;)
++    if (!httpAddrConnect(addrlist, &device_fd))
+     {
+-      if (!httpAddrConnect(addrlist, &fd))
+-      {
+-	error = errno;
+-	fd    = -1;
++      error     = errno;
++      device_fd = -1;
+ 
+-	if (getenv("CLASS") != NULL)
+-	{
+-	 /*
+-          * If the CLASS environment variable is set, the job was submitted
+-	  * to a class and not to a specific queue.  In this case, we want
+-	  * to abort immediately so that the job can be requeued on the next
+-	  * available printer in the class.
+-	  */
++      if (getenv("CLASS") != NULL)
++      {
++       /*
++        * If the CLASS environment variable is set, the job was submitted
++	* to a class and not to a specific queue.  In this case, we want
++	* to abort immediately so that the job can be requeued on the next
++	* available printer in the class.
++	*/
+ 
+-          fprintf(stderr, "INFO: Unable to connect to \"%s\", queuing on next printer in class...\n",
+-		  hostname);
++        fprintf(stderr, "INFO: Unable to connect to \"%s\", queuing on next printer in class...\n",
++		hostname);
+ 
+-	 /*
+-          * Sleep 5 seconds to keep the job from requeuing too rapidly...
+-	  */
++       /*
++        * Sleep 5 seconds to keep the job from requeuing too rapidly...
++	*/
+ 
+-	  sleep(5);
++	sleep(5);
+ 
+-          return (CUPS_BACKEND_FAILED);
+-	}
++        return (CUPS_BACKEND_FAILED);
++      }
+ 
+-	if (error == ECONNREFUSED || error == EHOSTDOWN ||
+-            error == EHOSTUNREACH)
+-	{
+-	  fprintf(stderr, "INFO: Network host \'%s\' is busy; will retry in %d seconds...\n",
+-                  hostname, delay);
+-	  sleep(delay);
++      if (error == ECONNREFUSED || error == EHOSTDOWN ||
++          error == EHOSTUNREACH)
++      {
++	fprintf(stderr,
++	        "INFO: Network host \'%s\' is busy; will retry in %d seconds...\n",
++                hostname, delay);
++	sleep(delay);
+ 
+-	  if (delay < 30)
+-	    delay += 5;
+-	}
+-	else
+-	{
+-	  perror("ERROR: Unable to connect to printer (retrying in 30 seconds)");
+-	  sleep(30);
+-	}
++	if (delay < 30)
++	  delay += 5;
+       }
+       else
+-	break;
++      {
++	perror("ERROR: Unable to connect to printer (retrying in 30 seconds)");
++	sleep(30);
++      }
+     }
++    else
++      break;
++  }
+ 
+-    fputs("STATE: -connecting-to-device\n", stderr);
+-
+-   /*
+-    * Now that we are "connected" to the port, ignore SIGTERM so that we
+-    * can finish out any page data the driver sends (e.g. to eject the
+-    * current page...  Only ignore SIGTERM if we are printing data from
+-    * stdin (otherwise you can't cancel raw jobs...)
+-    */
+-
+-    if (argc < 7)
+-    {
+-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+-      sigset(SIGTERM, SIG_IGN);
+-#elif defined(HAVE_SIGACTION)
+-      memset(&action, 0, sizeof(action));
++  fputs("STATE: -connecting-to-device\n", stderr);
+ 
+-      sigemptyset(&action.sa_mask);
+-      action.sa_handler = SIG_IGN;
+-      sigaction(SIGTERM, &action, NULL);
+-#else
+-      signal(SIGTERM, SIG_IGN);
+-#endif /* HAVE_SIGSET */
+-    }
++ /*
++  * Print everything...
++  */
+ 
+-   /*
+-    * Finally, send the print file...
+-    */
++  tbytes = 0;
+ 
++  while (copies > 0 && tbytes >= 0)
++  {
+     copies --;
+ 
+-    if (fp != 0)
++    if (print_fd != 0)
+     {
+       fputs("PAGE: 1 1\n", stderr);
+-      lseek(fp, 0, SEEK_SET);
++      lseek(print_fd, 0, SEEK_SET);
+     }
+ 
+-    fputs("INFO: Connected to host, sending print job...\n", stderr);
+-
+-    tbytes = 0;
+-    while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
+-    {
+-     /*
+-      * Write the print data to the printer...
+-      */
+-
+-      tbytes += nbytes;
+-      bufptr = buffer;
+-
+-      while (nbytes > 0)
+-      {
+-       /*
+-        * See if we are ready to read or write...
+-	*/
+-
+-        do
+-	{
+-          FD_ZERO(&input);
+-	  FD_SET(fd, &input);
+-	  FD_ZERO(&output);
+-	  FD_SET(fd, &output);
+-        }
+-	while (select(fd + 1, &input, &output, NULL, NULL) < 0);
+-
+-        if (FD_ISSET(fd, &input))
+-	{
+-	 /*
+-	  * Read backchannel data...
+-	  */
+-
+-	  if ((rbytes = recv(fd, resource, sizeof(resource), 0)) > 0)
+-	  {
+-	    fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
+-	            rbytes);
+-            cupsBackChannelWrite(resource, rbytes, 1.0);
+-          }
+-	}
+-
+-        if (FD_ISSET(fd, &output))
+-	{
+-	 /*
+-	  * Write print data...
+-	  */
+-
+-	  if ((wbytes = send(fd, bufptr, nbytes, 0)) < 0)
+-	  {
+-	   /*
+-	    * Check for retryable errors...
+-	    */
++    tbytes = backendRunLoop(print_fd, device_fd, 1);
+ 
+-	    if (errno != EAGAIN && errno != EINTR)
+-	    {
+-	      perror("ERROR: Unable to send print file to printer");
+-	      break;
+-	    }
+-	  }
+-	  else
+-	  {
+-	   /*
+-	    * Update count and pointer...
+-	    */
++    if (print_fd != 0 && tbytes >= 0)
++      fprintf(stderr, "INFO: Sent print file, " CUPS_LLFMT " bytes...\n",
++	      CUPS_LLCAST tbytes);
++  }
+ 
+-	    nbytes -= wbytes;
+-	    bufptr += wbytes;
+-	  }
+-        }
+-      }
++  if (waiteof)
++  {
++   /*
++    * Shutdown the socket and wait for the other end to finish...
++    */
+ 
+-      if (wbytes < 0)
+-        break;
++    fputs("INFO: Print file sent, waiting for printer to finish...\n", stderr);
+ 
+-      if (argc > 6)
+-	fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
+-	        (unsigned long)tbytes);
+-    }
++    shutdown(device_fd, 1);
+ 
+-    if (waiteof)
++    for (;;)
+     {
+      /*
+-      * Shutdown the socket and wait for the other end to finish...
++      * Wait a maximum of 90 seconds for backchannel data or a closed
++      * connection...
+       */
+ 
+-      fputs("INFO: Print file sent, waiting for printer to finish...\n", stderr);
++      timeout.tv_sec  = 90;
++      timeout.tv_usec = 0;
+ 
+-      shutdown(fd, 1);
++      FD_ZERO(&input);
++      FD_SET(device_fd, &input);
+ 
+-      for (;;)
++#ifdef __hpux
++      if (select(device_fd + 1, (int *)&input, NULL, NULL, &timeout) > 0)
++#else
++      if (select(device_fd + 1, &input, NULL, NULL, &timeout) > 0)
++#endif /* __hpux */
+       {
+        /*
+-	* Wait a maximum of 90 seconds for backchannel data or a closed
+-	* connection...
++	* Grab the data coming back and spit it out to stderr...
+ 	*/
+ 
+-	timeout.tv_sec  = 90;
+-	timeout.tv_usec = 0;
+-
+-	FD_ZERO(&input);
+-	FD_SET(fd, &input);
+-
+-  #ifdef __hpux
+-	if (select(fd + 1, (int *)&input, NULL, NULL, &timeout) > 0)
+-  #else
+-	if (select(fd + 1, &input, NULL, NULL, &timeout) > 0)
+-  #endif /* __hpux */
++	if ((bc_bytes = read(device_fd, resource, sizeof(resource))) > 0)
+ 	{
+-	 /*
+-	  * Grab the data coming back and spit it out to stderr...
+-	  */
+-
+-	  if ((rbytes = recv(fd, resource, sizeof(resource), 0)) > 0)
+-	  {
+-	    fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
+-		    rbytes);
+-	    cupsBackChannelWrite(resource, rbytes, 1.0);
+-	  }
+-	  else
+-	    break;
++	  fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
++		  (int)bc_bytes);
++	  cupsBackChannelWrite(resource, bc_bytes, 1.0);
+ 	}
+ 	else
+ 	  break;
+       }
++      else
++	break;
+     }
++  }
+ 
+-   /*
+-    * Close the socket connection...
+-    */
++ /*
++  * Close the socket connection...
++  */
+ 
+-    close(fd);
+-  }
++  close(device_fd);
+ 
+   httpAddrFreeList(addrlist);
+ 
+@@ -481,13 +376,13 @@
+   * Close the input file and return...
+   */
+ 
+-  if (fp != 0)
+-    close(fp);
++  if (print_fd != 0)
++    close(print_fd);
+ 
+-  if (wbytes >= 0)
++  if (tbytes >= 0)
+     fputs("INFO: Ready to print.\n", stderr);
+ 
+-  return (wbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
++  return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
+ }
+ 
+ 
+diff -urNad cupsys-1.2.1~/backend/test1284.c cupsys-1.2.1/backend/test1284.c
+--- cupsys-1.2.1~/backend/test1284.c	2006-01-10 20:02:46.000000000 +0000
++++ cupsys-1.2.1/backend/test1284.c	2006-07-18 11:27:13.000000000 +0000
+@@ -41,6 +41,7 @@
+ #  include <unistd.h>
+ #  include <fcntl.h>
+ #endif /* WIN32 */
++
+ #define DEBUG
+ #include "ieee1284.c"
+ 
+@@ -76,8 +77,8 @@
+ 
+     printf("%s:\n", argv[i]);
+ 
+-    get_device_id(fd, device_id, sizeof(device_id), make_model,
+-                  sizeof(make_model), "test", uri, sizeof(uri));
++    backendGetDeviceID(fd, device_id, sizeof(device_id), make_model,
++                       sizeof(make_model), "test", uri, sizeof(uri));
+ 
+     printf("    device_id=\"%s\"\n", device_id);
+     printf("    make_model=\"%s\"\n", make_model);
+diff -urNad cupsys-1.2.1~/backend/usb-darwin.c cupsys-1.2.1/backend/usb-darwin.c
+--- cupsys-1.2.1~/backend/usb-darwin.c	2006-05-03 19:39:30.000000000 +0000
++++ cupsys-1.2.1/backend/usb-darwin.c	2006-07-18 11:27:13.000000000 +0000
+@@ -1310,7 +1310,7 @@
+      */
+     start = mach_absolute_time();
+ 
+-    rbytes = sizeof(readbuffer) - 1;
++    rbytes = sizeof(readbuffer);
+     readstatus = (*classdriver)->ReadPipe( classdriver, readbuffer, &rbytes );
+     if ( kIOReturnSuccess == readstatus && rbytes > 0 ) {
+ 
+diff -urNad cupsys-1.2.1~/backend/usb-unix.c cupsys-1.2.1/backend/usb-unix.c
+--- cupsys-1.2.1~/backend/usb-unix.c	2006-05-20 12:23:40.000000000 +0000
++++ cupsys-1.2.1/backend/usb-unix.c	2006-07-18 11:27:13.000000000 +0000
+@@ -27,8 +27,9 @@
+  *
+  * Contents:
+  *
+- *   main()         - Send a file to the specified USB port.
++ *   print_device() - Print a file to a USB device.
+  *   list_devices() - List all USB devices.
++ *   open_device()  - Open a USB device...
+  */
+ 
+ /*
+@@ -43,7 +44,7 @@
+  * Local functions...
+  */
+ 
+-int	open_device(const char *uri);
++int	open_device(const char *uri, int *use_bc);
+ 
+ 
+ /*
+@@ -55,43 +56,21 @@
+              const char *hostname,	/* I - Hostname/manufacturer */
+              const char *resource,	/* I - Resource/modelname */
+ 	     const char *options,	/* I - Device options/serial number */
+-	     int        fp,		/* I - File descriptor to print */
++	     int        print_fd,	/* I - File descriptor to print */
+ 	     int        copies,		/* I - Copies to print */
+ 	     int	argc,		/* I - Number of command-line arguments (6 or 7) */
+ 	     char	*argv[])	/* I - Command-line arguments */
+ {
+-  int		usebc;			/* Use backchannel path? */
+-  int		fd;			/* USB device */
+-  int		rbytes;			/* Number of bytes read */
+-  int		wbytes;			/* Number of bytes written */
+-  size_t	nbytes,			/* Number of bytes read */
+-		tbytes;			/* Total number of bytes written */
+-  char		buffer[8192],		/* Output buffer */
+-		*bufptr,		/* Pointer into buffer */
+-		backbuf[1024];		/* Backchannel buffer */
++  int		use_bc;			/* Use backchannel path? */
++  int		device_fd;		/* USB device */
++  size_t	tbytes;			/* Total number of bytes written */
+   struct termios opts;			/* Parallel port options */
+-  fd_set	input,			/* Input set for select() */
+-		output;			/* Output set for select() */
+-  int		paperout;		/* Paper out? */
+-#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+-  struct sigaction action;		/* Actions for POSIX signals */
+-#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
+-#ifdef __linux
+-  unsigned int	status;			/* Port status (off-line, out-of-paper, etc.) */
+-#endif /* __linux */
++
+ 
+   (void)argc;
+   (void)argv;
+ 
+  /*
+-  * Disable backchannel data when printing to Canon USB printers - apparently
+-  * Canon printers will return the IEEE-1284 device ID over and over and over
+-  * when they get a read request...
+-  */
+-
+-  usebc = strcasecmp(hostname, "Canon") != 0;
+-
+- /*
+   * Open the USB port device...
+   */
+ 
+@@ -99,7 +78,15 @@
+ 
+   do
+   {
+-    if ((fd = open_device(uri)) == -1)
++   /*
++    * Disable backchannel data when printing to Canon USB printers - apparently
++    * Canon printers will return the IEEE-1284 device ID over and over and over
++    * when they get a read request...
++    */
++
++    use_bc = strcasecmp(hostname, "Canon") != 0;
++
++    if ((device_fd = open_device(uri, &use_bc)) == -1)
+     {
+       if (getenv("CLASS") != NULL)
+       {
+@@ -127,7 +114,8 @@
+         fputs("INFO: USB port busy; will retry in 30 seconds...\n", stderr);
+ 	sleep(30);
+       }
+-      else if (errno == ENXIO || errno == EIO || errno == ENOENT || errno == ENODEV)
++      else if (errno == ENXIO || errno == EIO || errno == ENOENT ||
++               errno == ENODEV)
+       {
+         fputs("INFO: Printer not connected; will retry in 30 seconds...\n", stderr);
+ 	sleep(30);
+@@ -140,7 +128,7 @@
+       }
+     }
+   }
+-  while (fd < 0);
++  while (device_fd < 0);
+ 
+   fputs("STATE: -connecting-to-device\n", stderr);
+ 
+@@ -148,189 +136,44 @@
+   * Set any options provided...
+   */
+ 
+-  tcgetattr(fd, &opts);
++  tcgetattr(device_fd, &opts);
+ 
+   opts.c_lflag &= ~(ICANON | ECHO | ISIG);	/* Raw mode */
+ 
+   /**** No options supported yet ****/
+ 
+-  tcsetattr(fd, TCSANOW, &opts);
+-
+- /*
+-  * Check printer status...
+-  */
+-
+-  paperout = 0;
+-
+-#if defined(__linux) && defined(LP_POUTPA)
+- /*
+-  * Show the printer status before we send the file...
+-  */
+-
+-  while (!ioctl(fd, LPGETSTATUS, &status))
+-  {
+-    fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n", status);
+-
+-    if (status & LP_POUTPA)
+-    {
+-      fputs("WARNING: Media tray empty!\n", stderr);
+-      fputs("STATUS: +media-tray-empty-error\n", stderr);
+-
+-      paperout = 1;
+-    }
+-
+-    if (!(status & LP_PERRORP))
+-      fputs("WARNING: Printer fault!\n", stderr);
+-    else if (!(status & LP_PSELECD))
+-      fputs("WARNING: Printer off-line.\n", stderr);
+-    else
+-      break;
+-
+-    sleep(5);
+-  }
+-#endif /* __linux && LP_POUTPA */
+-
+- /*
+-  * Now that we are "connected" to the port, ignore SIGTERM so that we
+-  * can finish out any page data the driver sends (e.g. to eject the
+-  * current page...  Only ignore SIGTERM if we are printing data from
+-  * stdin (otherwise you can't cancel raw jobs...)
+-  */
+-
+-  if (!fp)
+-  {
+-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+-    sigset(SIGTERM, SIG_IGN);
+-#elif defined(HAVE_SIGACTION)
+-    memset(&action, 0, sizeof(action));
+-
+-    sigemptyset(&action.sa_mask);
+-    action.sa_handler = SIG_IGN;
+-    sigaction(SIGTERM, &action, NULL);
+-#else
+-    signal(SIGTERM, SIG_IGN);
+-#endif /* HAVE_SIGSET */
+-  }
++  tcsetattr(device_fd, TCSANOW, &opts);
+ 
+  /*
+   * Finally, send the print file...
+   */
+ 
+-  wbytes = 0;
++  tbytes = 0;
+ 
+-  while (copies > 0)
++  while (copies > 0 && tbytes >= 0)
+   {
+     copies --;
+ 
+-    if (fp != 0)
++    if (print_fd != 0)
+     {
+       fputs("PAGE: 1 1\n", stderr);
+-      lseek(fp, 0, SEEK_SET);
++      lseek(print_fd, 0, SEEK_SET);
+     }
+ 
+-    tbytes = 0;
+-    while ((nbytes = read(fp, buffer, sizeof(buffer))) > 0)
+-    {
+-     /*
+-      * Write the print data to the printer...
+-      */
+-
+-      tbytes += nbytes;
+-      bufptr = buffer;
+-
+-      while (nbytes > 0)
+-      {
+-       /*
+-        * See if we are ready to read or write...
+-	*/
+-
+-        do
+-	{
+-          FD_ZERO(&input);
+-	  if (usebc)
+-	    FD_SET(fd, &input);
+-
+-	  FD_ZERO(&output);
+-	  FD_SET(fd, &output);
+-        }
+-	while (select(fd + 1, &input, &output, NULL, NULL) < 0);
+-
+-        if (FD_ISSET(fd, &input))
+-	{
+-	 /*
+-	  * Read backchannel data...
+-	  */
+-
+-	  if ((rbytes = read(fd, backbuf, sizeof(backbuf))) > 0)
+-	  {
+-	    fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n",
+-	            rbytes);
+-            cupsBackChannelWrite(backbuf, rbytes, 1.0);
+-          }
+-	}
+-
+-        if (FD_ISSET(fd, &output))
+-	{
+-	 /*
+-	  * Write print data...
+-	  */
+-
+-	  if ((wbytes = write(fd, bufptr, nbytes)) < 0)
+-	    if (errno == ENOTTY)
+-	      wbytes = write(fd, bufptr, nbytes);
+-
+-	  if (wbytes < 0)
+-	  {
+-	   /*
+-	    * Check for retryable errors...
+-	    */
+-
+-	    if (errno == ENOSPC)
+-	    {
+-	      paperout = 1;
+-	      fputs("ERROR: Out of paper!\n", stderr);
+-	      fputs("STATUS: +media-tray-empty-error\n", stderr);
+-	    }
+-	    else if (errno != EAGAIN && errno != EINTR)
+-	    {
+-	      perror("ERROR: Unable to send print file to printer");
+-	      break;
+-	    }
+-	  }
+-	  else
+-	  {
+-	   /*
+-	    * Update count and pointer...
+-	    */
+-
+-            if (paperout)
+-	    {
+-	      fputs("STATUS: -media-tray-empty-error\n", stderr);
+-	      paperout = 0;
+-	    }
+-
+-	    nbytes -= wbytes;
+-	    bufptr += wbytes;
+-	  }
+-	}
+-      }
+-
+-      if (wbytes < 0)
+-        break;
++    tbytes = backendRunLoop(print_fd, device_fd, use_bc);
+ 
+-      if (fp)
+-	fprintf(stderr, "INFO: Sending print file, %lu bytes...\n",
+-	        (unsigned long)tbytes);
+-    }
++    if (print_fd != 0 && tbytes >= 0)
++      fprintf(stderr, "INFO: Sent print file, " CUPS_LLFMT " bytes...\n",
++	      CUPS_LLCAST tbytes);
+   }
+ 
+  /*
+   * Close the USB port and return...
+   */
+ 
+-  close(fd);
++  close(device_fd);
+ 
+-  return (wbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
++  return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
+ }
+ 
+ 
+@@ -372,9 +215,9 @@
+ 
+     if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
+     {
+-      if (!get_device_id(fd, device_id, sizeof(device_id),
+-                         make_model, sizeof(make_model),
+-			 "usb", device_uri, sizeof(device_uri)))
++      if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
++                              make_model, sizeof(make_model),
++			      "usb", device_uri, sizeof(device_uri)))
+ 	printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
+ 	       make_model, make_model, i + 1, device_id);
+ 
+@@ -399,11 +242,11 @@
+   {
+     sprintf(device, "/dev/usb/printer%d", i);
+ 
+-    if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
++    if ((fd = open(device, O_WRONLY | O_EXCL)) >= 0)
+     {
+-      if (!get_device_id(fd, device_id, sizeof(device_id),
+-                         make_model, sizeof(make_model),
+-			 "usb", device_uri, sizeof(device_uri)))
++      if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
++                              make_model, sizeof(make_model),
++			      "usb", device_uri, sizeof(device_uri)))
+ 	printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
+ 	       make_model, make_model, i + 1, device_id);
+ 
+@@ -436,8 +279,12 @@
+  */
+ 
+ int					/* O - File descriptor or -1 on error */
+-open_device(const char *uri)		/* I - Device URI */
++open_device(const char *uri,		/* I - Device URI */
++            int        *use_bc)		/* O - Set to 0 for unidirectional */
+ {
++  int	fd;				/* File descriptor */
++
++
+  /*
+   * The generic implementation just treats the URI as a device filename...
+   * Specific operating systems may also support using the device serial
+@@ -446,7 +293,14 @@
+ 
+   if (!strncmp(uri, "usb:/dev/", 9))
+ #ifdef __linux
+-    return (-1); /* Do not allow direct devices anymore */
++  {
++   /*
++    * Do not allow direct devices anymore...
++    */
++
++    errno = ENODEV;
++    return (-1);
++  }
+   else if (!strncmp(uri, "usb://", 6))
+   {
+    /*
+@@ -455,7 +309,6 @@
+ 
+     int		i;			/* Looping var */
+     int		busy;			/* Are any ports busy? */
+-    int		fd;			/* File descriptor */
+     char	format[255],		/* Format for device filename */
+ 		device[255],		/* Device filename */
+ 		device_id[1024],	/* Device ID string */
+@@ -486,9 +339,9 @@
+ 
+ 	if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
+ 	{
+-	  get_device_id(fd, device_id, sizeof(device_id),
+-                        make_model, sizeof(make_model),
+-			"usb", device_uri, sizeof(device_uri));
++	  backendGetDeviceID(fd, device_id, sizeof(device_id),
++                             make_model, sizeof(make_model),
++			     "usb", device_uri, sizeof(device_uri));
+ 	}
+ 	else
+ 	{
+@@ -545,7 +398,14 @@
+     return (-1);
+   }
+ #elif defined(__sun) && defined(ECPPIOC_GETDEVID)
+-    return (-1); /* Do not allow direct devices anymore */
++  {
++   /*
++    * Do not allow direct devices anymore...
++    */
++
++    errno = ENODEV;
++    return (-1);
++  }
+   else if (!strncmp(uri, "usb://", 6))
+   {
+    /*
+@@ -554,7 +414,6 @@
+ 
+     int		i;			/* Looping var */
+     int		busy;			/* Are any ports busy? */
+-    int		fd;			/* File descriptor */
+     char	device[255],		/* Device filename */
+ 		device_id[1024],	/* Device ID string */
+ 		make_model[1024],	/* Make and model */
+@@ -571,10 +430,10 @@
+       {
+ 	sprintf(device, "/dev/usb/printer%d", i);
+ 
+-	if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
+-	  get_device_id(fd, device_id, sizeof(device_id),
+-                        make_model, sizeof(make_model),
+-			"usb", device_uri, sizeof(device_uri));
++	if ((fd = open(device, O_WRONLY | O_EXCL)) >= 0)
++	  backendGetDeviceID(fd, device_id, sizeof(device_id),
++                             make_model, sizeof(make_model),
++			     "usb", device_uri, sizeof(device_uri));
+ 	else
+ 	{
+ 	 /*
+@@ -589,7 +448,17 @@
+         }
+ 
+         if (!strcmp(uri, device_uri))
+-	  return (fd);	/* Yes, return this file descriptor... */
++	{
++	 /*
++	  * Yes, return this file descriptor...
++	  */
++
++          fputs("DEBUG: Setting use_bc to 0!\n", stderr);
++
++          *use_bc = 0;
++
++	  return (fd);
++	}
+ 
+        /*
+ 	* This wasn't the one...
+@@ -622,7 +491,15 @@
+     return (-1);
+   }
+ #else
+-    return (open(uri + 4, O_RDWR | O_EXCL));
++  {
++    if ((fd = open(uri + 4, O_RDWR | O_EXCL)) < 0)
++    {
++      fd      = open(uri + 4, O_WRONLY | O_EXCL);
++      *use_bc = 0;
++    }
++
++    return (fd);
++  }
+ #endif /* __linux */
+   else
+   {
+diff -urNad cupsys-1.2.1~/backend/usb.c cupsys-1.2.1/backend/usb.c
+--- cupsys-1.2.1~/backend/usb.c	2006-04-06 20:03:32.000000000 +0000
++++ cupsys-1.2.1/backend/usb.c	2006-07-18 11:27:13.000000000 +0000
+@@ -63,7 +63,7 @@
+ void	list_devices(void);
+ int	print_device(const char *uri, const char *hostname,
+ 	             const char *resource, const char *options,
+-		     int fp, int copies, int argc, char *argv[]);
++		     int print_fd, int copies, int argc, char *argv[]);
+ 
+ 
+ /*
+@@ -108,7 +108,7 @@
+              const char *hostname,	/* I - Hostname/manufacturer */
+              const char *resource,	/* I - Resource/modelname */
+ 	     const char *options,	/* I - Device options/serial number */
+-	     int        fp,		/* I - File descriptor to print */
++	     int        print_fd,	/* I - File descriptor to print */
+ 	     int        copies,		/* I - Copies to print */
+ 	     int	argc,		/* I - Number of command-line arguments (6 or 7) */
+ 	     char	*argv[])	/* I - Command-line arguments */
+@@ -124,7 +124,7 @@
+   (void)hostname;
+   (void)resource;
+   (void)options;
+-  (void)fp;
++  (void)print_fd;
+   (void)copies;
+   (void)argc;
+   (void)argv;
+@@ -146,7 +146,7 @@
+ main(int  argc,				/* I - Number of command-line arguments (6 or 7) */
+      char *argv[])			/* I - Command-line arguments */
+ {
+-  int		fp;			/* Print file */
++  int		print_fd;		/* Print file */
+   int		copies;			/* Number of copies to print */
+   int		status;			/* Exit status */
+   int		port;			/* Port number (not used) */
+@@ -232,8 +232,8 @@
+ 
+   if (argc == 6)
+   {
+-    fp     = 0;
+-    copies = 1;
++    print_fd = 0;
++    copies   = 1;
+   }
+   else
+   {
+@@ -241,7 +241,7 @@
+     * Try to open the print file...
+     */
+ 
+-    if ((fp = open(argv[6], O_RDONLY)) < 0)
++    if ((print_fd = open(argv[6], O_RDONLY)) < 0)
+     {
+       fprintf(stderr, "ERROR: unable to open print file %s - %s\n",
+               argv[6], strerror(errno));
+@@ -255,14 +255,15 @@
+   * Finally, send the print file...
+   */
+ 
+-  status = print_device(uri, hostname, resource, options, fp, copies, argc, argv);
++  status = print_device(uri, hostname, resource, options, print_fd, copies,
++                        argc, argv);
+ 
+  /*
+   * Close the input file and return...
+   */
+ 
+-  if (fp != 0)
+-    close(fp);
++  if (print_fd != 0)
++    close(print_fd);
+ 
+   return (status);
+ }
+diff -urNad cupsys-1.2.1~/berkeley/lpq.c cupsys-1.2.1/berkeley/lpq.c
+--- cupsys-1.2.1~/berkeley/lpq.c	2006-03-28 16:00:17.000000000 +0000
++++ cupsys-1.2.1/berkeley/lpq.c	2006-07-18 11:27:13.000000000 +0000
+@@ -79,8 +79,6 @@
+   cups_lang_t	*language;		/* Language */
+ 
+ 
+-
+-
+  /*
+   * Check for command-line options...
+   */
+diff -urNad cupsys-1.2.1~/berkeley/lprm.c cupsys-1.2.1/berkeley/lprm.c
+--- cupsys-1.2.1~/berkeley/lprm.c	2006-01-29 14:39:44.000000000 +0000
++++ cupsys-1.2.1/berkeley/lprm.c	2006-07-18 11:27:13.000000000 +0000
+@@ -57,7 +57,8 @@
+   ipp_op_t	op;		/* Operation */
+   cups_lang_t	*language;	/* Language */
+   int		num_dests;	/* Number of destinations */
+-  cups_dest_t	*dests;		/* Destinations */
++  cups_dest_t	*dests,		/* Destinations */
++		*defdest;	/* Default destination */
+   http_encryption_t encryption;	/* Encryption? */
+ 
+ 
+@@ -72,11 +73,6 @@
+   http       = NULL;
+   encryption = cupsEncryption();
+   language   = cupsLangDefault();
+-  num_dests  = cupsGetDests(&dests);
+-
+-  for (i = 0; i < num_dests; i ++)
+-    if (dests[i].is_default)
+-      dest = dests[i].name;
+ 
+  /*
+   * Open a connection to the server...
+@@ -85,10 +81,13 @@
+   if ((http = httpConnectEncrypt(cupsServer(), ippPort(), encryption)) == NULL)
+   {
+     _cupsLangPuts(stderr, _("lprm: Unable to contact server!\n"));
+-    cupsFreeDests(num_dests, dests);
+     return (1);
+   }
+ 
++  num_dests  = cupsGetDests2(http, &dests);
++  defdest    = cupsGetDest(NULL, NULL, num_dests, dests);
++  dest       = defdest ? defdest->name : NULL;
++
+  /*
+   * Process command-line arguments...
+   */
+@@ -102,6 +101,7 @@
+ 	    encryption = HTTP_ENCRYPT_REQUIRED;
+ 
+ 	    httpEncryption(http, encryption);
++	    cupsSetEncryption(encryption);
+ #else
+             _cupsLangPrintf(stderr,
+ 	                    _("%s: Sorry, no encryption support compiled in!\n"),
+@@ -152,9 +152,6 @@
+ 	    break;
+ 	    
+         case 'h' : /* Connect to host */
+-	    if (http != NULL)
+-	      httpClose(http);
+-
+ 	    if (argv[i][2] != '\0')
+               cupsSetServer(argv[i] + 2);
+ 	    else
+@@ -172,6 +169,20 @@
+ 	      else
+                 cupsSetServer(argv[i]);
+ 	    }
++
++            httpClose(http);
++            cupsFreeDests(num_dests, dests);
++
++	    if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
++	                                   encryption)) == NULL)
++	    {
++	      _cupsLangPuts(stderr, _("lprm: Unable to contact server!\n"));
++	      return (1);
++	    }
++
++	    num_dests  = cupsGetDests2(http, &dests);
++	    defdest    = cupsGetDest(NULL, NULL, num_dests, dests);
++	    dest       = defdest ? defdest->name : NULL;
+ 	    break;
+ 
+ 	default :
+diff -urNad cupsys-1.2.1~/cgi-bin/help-index.c cupsys-1.2.1/cgi-bin/help-index.c
+--- cupsys-1.2.1~/cgi-bin/help-index.c	2006-02-21 19:13:01.000000000 +0000
++++ cupsys-1.2.1/cgi-bin/help-index.c	2006-07-18 11:27:13.000000000 +0000
+@@ -842,7 +842,7 @@
+ 	if (isspace(*ptr & 255))
+ 	{
+ 	  while (isspace(*ptr & 255))
+-	    *ptr ++;
++	    ptr ++;
+ 
+ 	  *text++ = ' ';
+         }
+diff -urNad cupsys-1.2.1~/config-scripts/cups-compiler.m4 cupsys-1.2.1/config-scripts/cups-compiler.m4
+--- cupsys-1.2.1~/config-scripts/cups-compiler.m4	2006-05-22 01:10:11.000000000 +0000
++++ cupsys-1.2.1/config-scripts/cups-compiler.m4	2006-07-18 11:27:13.000000000 +0000
+@@ -24,22 +24,31 @@
+ 
+ dnl Clear the debugging and non-shared library options unless the user asks
+ dnl for them...
+-ARCHFLAGS=""
+ OPTIM=""
+-AC_SUBST(ARCHFLAGS)
+ AC_SUBST(OPTIM)
+ 
+ AC_ARG_WITH(optim, [  --with-optim="flags"    set optimization flags ])
+-AC_ARG_WITH(archflags, [  --with-arch="flags"     set default architecture flags ])
+-
+ AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging, default=no],
+ 	[if test x$enable_debug = xyes; then
+ 		OPTIM="-g"
+ 	fi])
+ 
++dnl Setup general architecture flags...
++AC_ARG_WITH(archflags, [  --with-archflags="flags"
++                          set default architecture flags ])
++
++if test -z "$with_archflags"; then
++	ARCHFLAGS=""
++else
++	ARCHFLAGS="$with_archflags"
++fi
++
++AC_SUBST(ARCHFLAGS)
++
+ dnl Setup support for separate 32/64-bit library generation...
+ AC_ARG_ENABLE(32bit, [  --enable-32bit          generate 32-bit libraries on 32/64-bit systems, default=no])
+-AC_ARG_WITH(arch32flags, [  --with-arch32="flags"   specifies 32-bit architecture flags])
++AC_ARG_WITH(arch32flags, [  --with-arch32flags="flags"
++                          specifies 32-bit architecture flags])
+ 
+ ARCH32FLAGS=""
+ INSTALL32=""
+@@ -56,7 +65,8 @@
+ AC_SUBST(UNINSTALL32)
+ 
+ AC_ARG_ENABLE(64bit, [  --enable-64bit          generate 64-bit libraries on 32/64-bit systems, default=no])
+-AC_ARG_WITH(arch64flags, [  --with-arch64="flags"   specifies 64-bit architecture flags])
++AC_ARG_WITH(arch64flags, [  --with-arch64flags="flags"
++                          specifies 64-bit architecture flags])
+ 
+ ARCH64FLAGS=""
+ INSTALL64=""
+@@ -118,17 +128,6 @@
+ 	fi
+ 
+ 	case "$uname" in
+-		Darwin*)
+-			if test -z "$with_archflags"; then
+-				if test "x`uname -m`" = xi386; then
+-					# Build universal binaries for OSX on Intel...
+-					ARCHFLAGS="-arch i386 -arch ppc"
+-				fi
+-			else
+-				ARCHFLAGS="$with_archflags"
+-			fi
+-			;;
+-
+ 		IRIX)
+ 			if test "x$enable_32bit" = xyes; then
+ 				# Build 32-bit libraries, 64-bit base...
+@@ -149,8 +148,6 @@
+ 					else
+ 						ARCHFLAGS="$with_arch64flags"
+ 					fi
+-				else
+-					ARCHFLAGS="$with_archflags"
+ 				fi
+ 			fi
+ 
+@@ -173,8 +170,6 @@
+ 					else
+ 						ARCHFLAGS="$with_arch32flags"
+ 					fi
+-				else
+-					ARCHFLAGS="$with_archflags"
+ 				fi
+ 			fi
+ 			;;
+@@ -202,8 +197,6 @@
+ 					else
+ 						ARCHFLAGS="$with_arch64flags"
+ 					fi
+-				else
+-					ARCHFLAGS="$with_archflags"
+ 				fi
+ 			fi
+ 
+@@ -229,8 +222,6 @@
+ 					else
+ 						ARCHFLAGS="$with_arch32flags"
+ 					fi
+-				else
+-					ARCHFLAGS="$with_archflags"
+ 				fi
+ 			fi
+ 			;;
+@@ -255,8 +246,6 @@
+ 					else
+ 						ARCHFLAGS="$with_arch64flags"
+ 					fi
+-				else
+-					ARCHFLAGS="$with_archflags"
+ 				fi
+ 			fi
+ 
+@@ -279,8 +268,6 @@
+ 					else
+ 						ARCHFLAGS="$with_arch32flags"
+ 					fi
+-				else
+-					ARCHFLAGS="$with_archflags"
+ 				fi
+ 			fi
+ 			;;
+@@ -310,13 +297,6 @@
+ 			# Warning 829 is passing constant string as char *
+ 			CXXFLAGS="+W336,829 $CXXFLAGS"
+ 
+-			if test -z "$with_archflags"; then
+-				# Build portable binaries for all HP systems...
+-				ARCHFLAGS="+DAportable"
+-			else
+-				ARCHFLAGS="$with_archflags"
+-			fi
+-
+ 			if test $PICFLAG = 1; then
+ 				OPTIM="+z $OPTIM"
+ 			fi
+@@ -353,8 +333,6 @@
+ 					else
+ 						ARCHFLAGS="$with_arch64flags"
+ 					fi
+-				else
+-					ARCHFLAGS="$with_archflags"
+ 				fi
+ 			fi
+ 
+@@ -377,8 +355,6 @@
+ 					else
+ 						ARCHFLAGS="$with_arch32flags"
+ 					fi
+-				else
+-					ARCHFLAGS="$with_archflags"
+ 				fi
+ 			fi
+ 			;;
+@@ -386,7 +362,7 @@
+ 			# Solaris
+ 			if test -z "$OPTIM"; then
+ 				if test "x$with_optim" = x; then
+-					OPTIM="-xO4"
++					OPTIM="-xO2"
+ 				else
+ 					OPTIM="$with_optim $OPTIM"
+ 				fi
+@@ -419,8 +395,6 @@
+ 					else
+ 						ARCHFLAGS="$with_arch64flags"
+ 					fi
+-				else
+-					ARCHFLAGS="$with_archflags"
+ 				fi
+ 			else
+ 				if test "x$enable_64bit" = xyes; then
+@@ -446,8 +420,6 @@
+ 					else
+ 						ARCHFLAGS="$with_arch32flags"
+ 					fi
+-				else
+-					ARCHFLAGS="$with_archflags"
+ 				fi
+ 			fi
+ 			;;
+diff -urNad cupsys-1.2.1~/config-scripts/cups-defaults.m4 cupsys-1.2.1/config-scripts/cups-defaults.m4
+--- cupsys-1.2.1~/config-scripts/cups-defaults.m4	2006-04-26 19:52:27.000000000 +0000
++++ cupsys-1.2.1/config-scripts/cups-defaults.m4	2006-07-18 11:27:13.000000000 +0000
+@@ -30,7 +30,7 @@
+ AC_SUBST(LANGUAGES)
+ 
+ dnl Default ConfigFilePerm
+-AC_ARG_WITH(config_perm, [  --with-config-file-perm set default ConfigFilePerm value, default=0640],
++AC_ARG_WITH(config_file_perm, [  --with-config-file-perm set default ConfigFilePerm value, default=0640],
+ 	CUPS_CONFIG_FILE_PERM="$withval",
+ 	if test "x$uname" = xDarwin; then
+ 		CUPS_CONFIG_FILE_PERM="644"
+@@ -41,7 +41,7 @@
+ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_CONFIG_FILE_PERM, 0$CUPS_CONFIG_FILE_PERM)
+ 
+ dnl Default LogFilePerm
+-AC_ARG_WITH(log_perm, [  --with-log-file-perm    set default LogFilePerm value, default=0644],
++AC_ARG_WITH(log_file_perm, [  --with-log-file-perm    set default LogFilePerm value, default=0644],
+ 	CUPS_LOG_FILE_PERM="$withval",
+ 	CUPS_LOG_FILE_PERM="644")
+ AC_SUBST(CUPS_LOG_FILE_PERM)
+@@ -59,7 +59,7 @@
+ AC_SUBST(CUPS_BROWSING)
+ 
+ dnl Default BrowseLocalProtocols
+-AC_ARG_WITH(browse_local, [  --with-local-protocols  set default BrowseLocalProtocols, default="CUPS"],
++AC_ARG_WITH(local_protocols, [  --with-local-protocols  set default BrowseLocalProtocols, default="CUPS"],
+ 	CUPS_BROWSE_LOCAL_PROTOCOLS="$withval",
+ 	CUPS_BROWSE_LOCAL_PROTOCOLS="CUPS")
+ AC_SUBST(CUPS_BROWSE_LOCAL_PROTOCOLS)
+@@ -67,7 +67,7 @@
+ 	"$CUPS_BROWSE_LOCAL_PROTOCOLS")
+ 
+ dnl Default BrowseRemoteProtocols
+-AC_ARG_WITH(browse_remote, [  --with-remote-protocols set default BrowseRemoteProtocols, default="CUPS"],
++AC_ARG_WITH(remote_protocols, [  --with-remote-protocols set default BrowseRemoteProtocols, default="CUPS"],
+ 	CUPS_BROWSE_REMOTE_PROTOCOLS="$withval",
+ 	CUPS_BROWSE_REMOTE_PROTOCOLS="CUPS")
+ AC_SUBST(CUPS_BROWSE_REMOTE_PROTOCOLS)
+@@ -130,7 +130,7 @@
+ AC_SUBST(CUPS_USE_NETWORK_DEFAULT)
+ 
+ dnl Determine the correct username and group for this OS...
+-AC_ARG_WITH(cups-user, [  --with-cups-user        set default user for CUPS],
++AC_ARG_WITH(cups_user, [  --with-cups-user        set default user for CUPS],
+ 	CUPS_USER="$withval",
+ 	AC_MSG_CHECKING(for default print user)
+ 	if test -f /etc/passwd; then
+@@ -152,7 +152,7 @@
+ 		AC_MSG_RESULT(no password file, using "$CUPS_USER")
+ 	fi)
+ 
+-AC_ARG_WITH(cups-group, [  --with-cups-group       set default group for CUPS],
++AC_ARG_WITH(cups_group, [  --with-cups-group       set default group for CUPS],
+ 	CUPS_GROUP="$withval",
+ 	AC_MSG_CHECKING(for default print group)
+ 	if test -f /etc/group; then
+@@ -175,7 +175,7 @@
+ 		AC_MSG_RESULT(no group file, using "$CUPS_GROUP")
+ 	fi)
+ 
+-AC_ARG_WITH(system-groups, [  --with-system-groups    set default system groups for CUPS],
++AC_ARG_WITH(system_groups, [  --with-system-groups    set default system groups for CUPS],
+ 	CUPS_SYSTEM_GROUPS="$withval",
+ 	if test x$uname = xDarwin; then
+ 		GROUP_LIST="admin"
+@@ -221,13 +221,25 @@
+ dnl Default printcap file...
+ AC_ARG_WITH(printcap, [  --with-printcap         set default printcap file],
+ 	default_printcap="$withval",
+-	default_printcap="/etc/printcap")
++	default_printcap="default")
+ 
+ if test x$enable_printcap != xno -a x$default_printcap != xno; then
+-	if test "x$default_printcap" = "x/etc/printcap" -a "$uname" = "Darwin" -a $uversion -ge 90; then
+-		CUPS_DEFAULT_PRINTCAP=""
+-	else
+-		CUPS_DEFAULT_PRINTCAP="$default_printcap"
++	if test "x$default_printcap" = "xdefault"; then
++		case $uname in
++			Darwin*)
++				if test $uversion -ge 90; then
++					CUPS_DEFAULT_PRINTCAP=""
++				else
++					CUPS_DEFAULT_PRINTCAP="/etc/printcap"
++				fi
++				;;
++			SunOS*)
++				CUPS_DEFAULT_PRINTCAP="/etc/printers.conf"
++				;;
++			*)
++				CUPS_DEFAULT_PRINTCAP="/etc/printcap"
++				;;
++		esac
+ 	fi
+ else
+ 	CUPS_DEFAULT_PRINTCAP=""
+diff -urNad cupsys-1.2.1~/config-scripts/cups-directories.m4 cupsys-1.2.1/config-scripts/cups-directories.m4
+--- cupsys-1.2.1~/config-scripts/cups-directories.m4	2006-05-19 12:44:29.000000000 +0000
++++ cupsys-1.2.1/config-scripts/cups-directories.m4	2006-07-18 11:27:13.000000000 +0000
+@@ -115,7 +115,7 @@
+ 
+ if test x$rcdir = x; then
+ 	case "$uname" in
+-		FreeBSD* | OpenBSD*)
++		FreeBSD* | OpenBSD* | MirBsD* | ekkoBSD*)
+ 			# FreeBSD and OpenBSD
+ 			INITDIR=""
+ 			INITDDIR=""
+diff -urNad cupsys-1.2.1~/config-scripts/cups-image.m4 cupsys-1.2.1/config-scripts/cups-image.m4
+--- cupsys-1.2.1~/config-scripts/cups-image.m4	2006-04-26 19:52:27.000000000 +0000
++++ cupsys-1.2.1/config-scripts/cups-image.m4	2006-07-18 11:27:13.000000000 +0000
+@@ -38,10 +38,6 @@
+ 
+ AC_SUBST(IMGFILTERS)
+ 
+-dnl Save the current libraries since we don't want the image libraries
+-dnl included with every program...
+-SAVELIBS="$LIBS"
+-
+ dnl Check for image libraries...
+ AC_ARG_ENABLE(jpeg, [  --enable-jpeg           turn on JPEG support, default=yes])
+ AC_ARG_ENABLE(png, [  --enable-png            turn on PNG support, default=yes])
+@@ -57,6 +53,14 @@
+ AC_SUBST(LIBTIFF)
+ AC_SUBST(LIBZ)
+ 
++dnl Image libraries use math library functions...
++AC_SEARCH_LIBS(pow, m)
++
++dnl Save the current libraries since we don't want the image libraries
++dnl included with every program...
++SAVELIBS="$LIBS"
++
++dnl JPEG library...
+ if test x$enable_jpeg != xno; then
+     AC_CHECK_HEADER(jpeglib.h,
+ 	AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
+@@ -67,24 +71,24 @@
+     AC_MSG_NOTICE([JPEG support disabled with --disable-jpeg.])
+ fi
+ 
++dnl ZLIB library...
+ AC_CHECK_HEADER(zlib.h,
+     AC_CHECK_LIB(z, gzgets,
+ 	AC_DEFINE(HAVE_LIBZ)
+ 	LIBZ="-lz"
+ 	LIBS="$LIBS -lz"))
+ 
+-dnl PNG library uses math library functions...
+-AC_CHECK_LIB(m, pow)
+-
++dnl PNG library...
+ if test x$enable_png != xno; then
+     AC_CHECK_HEADER(png.h,
+ 	AC_CHECK_LIB(png, png_create_read_struct,
+ 	    AC_DEFINE(HAVE_LIBPNG)
+-	    LIBPNG="-lpng -lm"))
++	    LIBPNG="-lpng"))
+ else
+     AC_MSG_NOTICE([PNG support disabled with --disable-png.])
+ fi
+ 
++dnl TIFF library...
+ if test x$enable_tiff != xno; then
+     AC_CHECK_HEADER(tiff.h,
+ 	AC_CHECK_LIB(tiff, TIFFReadScanline,
+diff -urNad cupsys-1.2.1~/config-scripts/cups-network.m4 cupsys-1.2.1/config-scripts/cups-network.m4
+--- cupsys-1.2.1~/config-scripts/cups-network.m4	2006-04-26 19:52:27.000000000 +0000
++++ cupsys-1.2.1/config-scripts/cups-network.m4	2006-07-18 11:27:13.000000000 +0000
+@@ -46,7 +46,7 @@
+ 	maxfiles=4096
+ fi
+ 
+-AC_ARG_WITH(maxfiles, [  --with-maxfiles=N       set maximum number of file descriptors for scheduler ],
++AC_ARG_WITH(maxfiles, [  --with-maxfiles=N       set maximum number of file descriptors for scheduler (deprecated) ],
+ 	maxfiles=$withval)
+ 
+ AC_DEFINE_UNQUOTED(CUPS_MAX_FDS, $maxfiles)
+diff -urNad cupsys-1.2.1~/config-scripts/cups-sharedlibs.m4 cupsys-1.2.1/config-scripts/cups-sharedlibs.m4
+--- cupsys-1.2.1~/config-scripts/cups-sharedlibs.m4	2006-05-22 15:34:01.000000000 +0000
++++ cupsys-1.2.1/config-scripts/cups-sharedlibs.m4	2006-07-18 11:27:13.000000000 +0000
+@@ -117,7 +117,7 @@
+ 	# rather than to the executables.  This makes things smaller if you
+ 	# are using any static libraries, and it also allows us to distribute
+ 	# a single DSO rather than a bunch...
+-	DSOLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
++	DSOLIBS="\$(LIBTIFF) \$(LIBPNG) \$(LIBJPEG) \$(LIBZ)"
+ 	IMGLIBS=""
+ 
+ 	# Tell the run-time linkers where to find a DSO.  Some platforms
+@@ -126,46 +126,46 @@
+ 	case $uname in
+                 HP-UX*)
+ 			# HP-UX needs the path, even for /usr/lib...
+-                	DSOFLAGS="+s +b \$(libdir) $DSOFLAGS"
+-                	DSO32FLAGS="+s +b \$(LIB32DIR) $DSO32FLAGS"
+-                	DSO64FLAGS="+s +b \$(LIB64DIR) $DSO64FLAGS"
+-                	LDFLAGS="$LDFLAGS -Wl,+s,+b,\$(libdir)"
+-                	EXPORT_LDFLAGS="-Wl,+s,+b,\$(libdir)"
++                	DSOFLAGS="+s +b $libdir $DSOFLAGS"
++                	DSO32FLAGS="+s +b $LIB32DIR $DSO32FLAGS"
++                	DSO64FLAGS="+s +b $LIB64DIR $DSO64FLAGS"
++                	LDFLAGS="$LDFLAGS -Wl,+s,+b,$libdir"
++                	EXPORT_LDFLAGS="-Wl,+s,+b,$libdir"
+ 			;;
+                 SunOS*)
+                 	# Solaris...
+ 			if test $exec_prefix != /usr; then
+-				DSOFLAGS="-R\$(libdir) $DSOFLAGS"
+-				DSO32FLAGS="-R\$(LIB32DIR) $DSO32FLAGS"
+-				DSO64FLAGS="-R\$(LIB64DIR) $DSO64FLAGS"
+-				LDFLAGS="$LDFLAGS -R\$(libdir)"
+-				EXPORT_LDFLAGS="-R\$(libdir)"
++				DSOFLAGS="-R$libdir $DSOFLAGS"
++				DSO32FLAGS="-R$LIB32DIR $DSO32FLAGS"
++				DSO64FLAGS="-R$LIB64DIR $DSO64FLAGS"
++				LDFLAGS="$LDFLAGS -R$libdir"
++				EXPORT_LDFLAGS="-R$libdir"
+ 			fi
+ 			;;
+                 *BSD*)
+                         # *BSD...
+ 			if test $exec_prefix != /usr; then
+-				DSOFLAGS="-Wl,-R\$(libdir) $DSOFLAGS"
+-				DSO32FLAGS="-Wl,-R\$(LIB32DIR) $DSO32FLAGS"
+-				DSO64FLAGS="-Wl,-R\$(LIB64DIR) $DSO64FLAGS"
+-				LDFLAGS="$LDFLAGS -Wl,-R\$(libdir)"
+-				EXPORT_LDFLAGS="-Wl,-R\$(libdir)"
++				DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
++				DSO32FLAGS="-Wl,-R$LIB32DIR $DSO32FLAGS"
++				DSO64FLAGS="-Wl,-R$LIB64DIR $DSO64FLAGS"
++				LDFLAGS="$LDFLAGS -Wl,-R$libdir"
++				EXPORT_LDFLAGS="-Wl,-R$libdir"
+ 			fi
+ 			;;
+                 IRIX | Linux | GNU)
+                         # IRIX, Linux, and HURD...
+ 			if test $exec_prefix != /usr; then
+-				DSOFLAGS="-Wl,-rpath,\$(libdir) $DSOFLAGS"
+-				DSO32FLAGS="-Wl,-rpath,\$(LIB32DIR) $DSO32FLAGS"
+-				DSO64FLAGS="-Wl,-rpath,\$(LIB64DIR) $DSO64FLAGS"
+-				LDFLAGS="$LDFLAGS -Wl,-rpath,\$(libdir)"
+-				EXPORT_LDFLAGS="-Wl,-rpath,\$(libdir)"
++				DSOFLAGS="-Wl,-rpath,$libdir $DSOFLAGS"
++				DSO32FLAGS="-Wl,-rpath,$LIB32DIR $DSO32FLAGS"
++				DSO64FLAGS="-Wl,-rpath,$LIB64DIR $DSO64FLAGS"
++				LDFLAGS="$LDFLAGS -Wl,-rpath,$libdir"
++				EXPORT_LDFLAGS="-Wl,-rpath,$libdir"
+ 			fi
+ 			;;
+ 	esac
+ else
+ 	DSOLIBS=""
+-	IMGLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
++	IMGLIBS="\$(LIBTIFF) \$(LIBPNG) \$(LIBJPEG) \$(LIBZ)"
+ fi
+ 
+ AC_SUBST(DSOLIBS)
+diff -urNad cupsys-1.2.1~/config-scripts/cups-ssl.m4 cupsys-1.2.1/config-scripts/cups-ssl.m4
+--- cupsys-1.2.1~/config-scripts/cups-ssl.m4	2006-05-15 13:52:16.000000000 +0000
++++ cupsys-1.2.1/config-scripts/cups-ssl.m4	2006-07-18 11:27:13.000000000 +0000
+@@ -48,6 +48,7 @@
+ 		 # certificates for CUPS, so don't enable encryption on
+ 		 # /admin just yet...
+ 		 #ENCRYPTION_REQUIRED="  Encryption Required"
++		 AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
+ 		 AC_DEFINE(HAVE_SSL)
+ 		 AC_DEFINE(HAVE_CDSASSL)])
+ 	fi
+diff -urNad cupsys-1.2.1~/config.h.in cupsys-1.2.1/config.h.in
+--- cupsys-1.2.1~/config.h.in	2006-05-02 14:20:26.000000000 +0000
++++ cupsys-1.2.1/config.h.in	2006-07-18 11:27:13.000000000 +0000
+@@ -261,6 +261,13 @@
+ 
+ 
+ /*
++ * Do we have <Security/SecBasePriv.h>?
++ */
++
++#undef HAVE_SECBASEPRIV_H
++
++
++/*
+  * Do we have the SLP library?
+  */
+ 
+diff -urNad cupsys-1.2.1~/configure.in cupsys-1.2.1/configure.in
+--- cupsys-1.2.1~/configure.in	2006-04-27 13:40:30.000000000 +0000
++++ cupsys-1.2.1/configure.in	2006-07-18 11:27:13.000000000 +0000
+@@ -47,8 +47,12 @@
+ sinclude(config-scripts/cups-pdf.m4)
+ sinclude(config-scripts/cups-scripting.m4)
+ 
++INSTALL_LANGUAGES=""
++UNINSTALL_LANGUAGES=""
+ LANGFILES=""
+ if test "x$LANGUAGES" != x; then
++	INSTALL_LANGUAGES="install-languages"
++	UNINSTALL_LANGUAGES="uninstall-languages"
+ 	for lang in $LANGUAGES; do
+ 		LANGFILES="$LANGFILES doc/$lang/index.html"
+ 		LANGFILES="$LANGFILES templates/$lang/edit-config.tmpl"
+@@ -56,6 +60,9 @@
+ 	done
+ fi
+ 
++AC_SUBST(INSTALL_LANGUAGES)
++AC_SUBST(UNINSTALL_LANGUAGES)
++
+ AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config
+ 	  conf/cupsd.conf conf/pam.std doc/index.html
+ 	  doc/help/standard.html man/client.conf.man
+diff -urNad cupsys-1.2.1~/cups/Makefile cupsys-1.2.1/cups/Makefile
+--- cupsys-1.2.1~/cups/Makefile	2006-05-22 00:59:11.000000000 +0000
++++ cupsys-1.2.1/cups/Makefile	2006-07-18 11:27:13.000000000 +0000
+@@ -138,7 +138,7 @@
+ clean:
+ 	$(RM) $(OBJS) $(TARGETS)
+ 	$(RM) libcups.so libcups.sl libcups.dylib
+-	$(RM) -r 32bit 64it
++	$(RM) -r 32bit 64bit
+ 
+ 
+ #
+@@ -186,12 +186,12 @@
+ install32bit:
+ 	$(INSTALL_DIR) -m 755 $(LIB32DIR)
+ 	$(INSTALL_LIB) 32bit/libcups.so.2 $(LIB32DIR)/libcups.so.2
+-	$(LN) libcups.so $(LIB32DIR)/libcups.so.2
++	$(LN) libcups.so.2 $(LIB32DIR)/libcups.so
+ 
+ install64bit:
+ 	$(INSTALL_DIR) -m 755 $(LIB64DIR)
+ 	$(INSTALL_LIB) 64bit/libcups.so.2 $(LIB64DIR)/libcups.so.2
+-	$(LN) libcups.so $(LIB64DIR)/libcups.so.2
++	$(LN) libcups.so.2 $(LIB64DIR)/libcups.so
+ 
+ 
+ #
+diff -urNad cupsys-1.2.1~/cups/adminutil.c cupsys-1.2.1/cups/adminutil.c
+--- cupsys-1.2.1~/cups/adminutil.c	2006-03-14 02:38:07.000000000 +0000
++++ cupsys-1.2.1/cups/adminutil.c	2006-07-18 11:27:13.000000000 +0000
+@@ -222,18 +222,18 @@
+       */
+ 
+       cupsFilePrintf(dstfp, "*%% Commented out for CUPS Windows Driver...\n"
+-                            "*%%%s", line + 1);
++                            "*%%%s\n", line + 1);
+       continue;
+     }
+     else if (!strncmp(line, "*JCLOpenUI", 10))
+     {
+       jcloption = 1;
+-      cupsFilePuts(dstfp, line);
++      cupsFilePrintf(dstfp, "%s\n", line);
+     }
+     else if (!strncmp(line, "*JCLCloseUI", 11))
+     {
+       jcloption = 0;
+-      cupsFilePuts(dstfp, line);
++      cupsFilePrintf(dstfp, "%s\n", line);
+     }
+     else if (jcloption &&
+              strncmp(line, "*End", 4) &&
+@@ -312,12 +312,13 @@
+       }
+ 
+       snprintf(ptr + 1, sizeof(line) - (ptr - line + 1),
+-               "%%cupsJobTicket: %s=%s\n\"\n*End\n", option, choice);
++               "%%cupsJobTicket: %s=%s\n\"\n*End", option, choice);
+ 
+-      cupsFilePrintf(dstfp, "*%% Changed for CUPS Windows Driver...\n%s", line);
++      cupsFilePrintf(dstfp, "*%% Changed for CUPS Windows Driver...\n%s\n",
++                     line);
+     }
+     else
+-      cupsFilePuts(dstfp, line);
++      cupsFilePrintf(dstfp, "%s\n", line);
+   }
+ 
+   cupsFileClose(srcfp);
+diff -urNad cupsys-1.2.1~/cups/emit.c cupsys-1.2.1/cups/emit.c
+--- cupsys-1.2.1~/cups/emit.c	2006-03-09 15:27:27.000000000 +0000
++++ cupsys-1.2.1/cups/emit.c	2006-07-18 11:27:13.000000000 +0000
+@@ -50,6 +50,7 @@
+ #include <stdlib.h>
+ #include "string.h"
+ #include <errno.h>
++#include "debug.h"
+ 
+ #if defined(WIN32) || defined(__EMX__)
+ #  include <io.h>
+@@ -111,6 +112,9 @@
+   ppd_choice_t	**collect;		/* Collected choices */
+ 
+ 
++  DEBUG_printf(("ppdCollect2(ppd=%p, section=%d, min_order=%f, choices=%p)\n",
++                ppd, section, min_order, choices));
++
+   if (ppd == NULL)
+     return (0);
+ 
+@@ -132,6 +136,8 @@
+ 	for (k = o->num_choices, c = o->choices; k > 0; k --, c ++)
+ 	  if (c->marked && count < 1000)
+ 	  {
++	    DEBUG_printf(("ppdCollect2: %s=%s marked...\n", o->keyword,
++	                  c->choice));
+             collect[count] = c;
+ 	    count ++;
+ 	  }
+@@ -142,6 +148,8 @@
+ 	  for (m = o->num_choices, c = o->choices; m > 0; m --, c ++)
+ 	    if (c->marked && count < 1000)
+ 	    {
++	      DEBUG_printf(("ppdCollect2: %s=%s marked...\n", o->keyword,
++	                    c->choice));
+               collect[count] = c;
+ 	      count ++;
+ 	    }
+@@ -155,6 +163,8 @@
+     qsort(collect, count, sizeof(ppd_choice_t *),
+           (int (*)(const void *, const void *))ppd_sort);
+ 
++  DEBUG_printf(("ppdCollect2: %d marked choices...\n", count));
++
+  /*
+   * Return the array and number of choices; if 0, free the array since
+   * it isn't needed.
+@@ -492,6 +502,9 @@
+   struct lconv	*loc;			/* Locale data */
+ 
+ 
++  DEBUG_printf(("ppdEmitString(ppd=%p, section=%d, min_order=%f)\n",
++                ppd, section, min_order));
++
+  /*
+   * Range check input...
+   */
+@@ -527,6 +540,8 @@
+            !strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
+           !strcasecmp(choices[i]->choice, "Custom"))
+       {
++        DEBUG_puts("ppdEmitString: Custom size set!");
++
+         bufsize += 37;			/* %%BeginFeature: *CustomPageSize True\n */
+         bufsize += 50;			/* Five 9-digit numbers + newline */
+       }
+@@ -580,6 +595,8 @@
+   * Allocate memory...
+   */
+ 
++  DEBUG_printf(("ppdEmitString: Allocating %d bytes for string...\n", bufsize));
++
+   if ((buffer = calloc(1, bufsize)) == NULL)
+   {
+     free(choices);
+@@ -608,6 +625,9 @@
+       * Send DSC comments with option...
+       */
+ 
++      DEBUG_printf(("Adding code for %s=%s...\n", choices[i]->option->keyword,
++                    choices[i]->choice));
++
+       if ((!strcasecmp(choices[i]->option->keyword, "PageSize") ||
+            !strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
+           !strcasecmp(choices[i]->choice, "Custom"))
+@@ -800,6 +820,9 @@
+       strlcpy(bufptr, "%%EndFeature\n"
+ 		      "} stopped cleartomark\n", bufend - bufptr + 1);
+       bufptr += strlen(bufptr);
++
++      DEBUG_printf(("ppdEmitString: Offset in string is %d...\n",
++                    bufptr - buffer));
+     }
+     else
+     {
+diff -urNad cupsys-1.2.1~/cups/http-addrlist.c cupsys-1.2.1/cups/http-addrlist.c
+--- cupsys-1.2.1~/cups/http-addrlist.c	2006-03-29 15:36:15.000000000 +0000
++++ cupsys-1.2.1/cups/http-addrlist.c	2006-07-18 11:27:13.000000000 +0000
+@@ -412,7 +412,7 @@
+           if (host->h_addrtype == AF_INET6)
+ 	  {
+             temp->addr.ipv6.sin6_family = AF_INET6;
+-	    memcpy(&(temp->addr.ipv6), host->h_addr_list[i],
++	    memcpy(&(temp->addr.ipv6.sin6_addr), host->h_addr_list[i],
+ 	           sizeof(temp->addr.ipv6));
+             temp->addr.ipv6.sin6_port = htons(portnum);
+ 	  }
+@@ -420,7 +420,7 @@
+ #  endif /* AF_INET6 */
+ 	  {
+             temp->addr.ipv4.sin_family = AF_INET;
+-	    memcpy(&(temp->addr.ipv4), host->h_addr_list[i],
++	    memcpy(&(temp->addr.ipv4.sin_addr), host->h_addr_list[i],
+ 	           sizeof(temp->addr.ipv4));
+             temp->addr.ipv4.sin_port = htons(portnum);
+           }
+@@ -506,6 +506,9 @@
+ 	temp->addr.ipv6.sin6_addr.s6_addr32[3] = htonl(1);
+ #  endif /* WIN32 */
+ 
++        if (!first)
++          first = temp;
++
+         addr = temp;
+       }
+ 
+@@ -527,6 +530,9 @@
+ 	temp->addr.ipv4.sin_port        = htons(portnum);
+ 	temp->addr.ipv4.sin_addr.s_addr = htonl(0x7f000001);
+ 
++        if (!first)
++          first = temp;
++
+         if (addr)
+ 	  addr->next = temp;
+ 	else
+@@ -556,6 +562,9 @@
+         temp->addr.ipv6.sin6_family = AF_INET6;
+ 	temp->addr.ipv6.sin6_port   = htons(portnum);
+ 
++        if (!first)
++          first = temp;
++
+         addr = temp;
+       }
+ 
+@@ -576,6 +585,9 @@
+         temp->addr.ipv4.sin_family = AF_INET;
+ 	temp->addr.ipv4.sin_port   = htons(portnum);
+ 
++        if (!first)
++          first = temp;
++
+         if (addr)
+ 	  addr->next = temp;
+ 	else
+diff -urNad cupsys-1.2.1~/cups/http.c cupsys-1.2.1/cups/http.c
+--- cupsys-1.2.1~/cups/http.c	2006-04-17 21:24:17.000000000 +0000
++++ cupsys-1.2.1/cups/http.c	2006-07-18 11:27:13.000000000 +0000
+@@ -866,7 +866,7 @@
+       * No newline; see if there is more data to be read...
+       */
+ 
+-      if (!http->blocking && !http_wait(http, 1000))
++      if (!http->blocking && !http_wait(http, 10000))
+       {
+         DEBUG_puts("httpGets: Timed out!");
+         http->error = ETIMEDOUT;
+@@ -1222,7 +1222,7 @@
+     * Buffer small reads for better performance...
+     */
+ 
+-    if (!http->blocking && !httpWait(http, 1000))
++    if (!http->blocking && !httpWait(http, 10000))
+       return (0);
+ 
+     if (http->data_remaining > sizeof(http->buffer))
+@@ -1285,7 +1285,7 @@
+ #ifdef HAVE_SSL
+   else if (http->tls)
+   {
+-    if (!http->blocking && !httpWait(http, 1000))
++    if (!http->blocking && !httpWait(http, 10000))
+       return (0);
+ 
+     bytes = http_read_ssl(http, buffer, length);
+@@ -1293,7 +1293,7 @@
+ #endif /* HAVE_SSL */
+   else
+   {
+-    if (!http->blocking && !httpWait(http, 1000))
++    if (!http->blocking && !httpWait(http, 10000))
+       return (0);
+ 
+     DEBUG_printf(("httpRead2: reading %d bytes from socket...\n", length));
+@@ -1415,13 +1415,11 @@
+     *dataLength = 0;
+ 
+     if (bytes == 0)
+-      result = errSSLClosedAbort;
++      result = errSSLClosedGraceful;
+     else if (errno == EAGAIN)
+       result = errSSLWouldBlock;
+-    else if (errno == EPIPE)
+-      result = errSSLClosedAbort;
+     else
+-      result = errSSLInternal;
++      result = errSSLClosedAbort;
+   }
+ 
+   return result;
+@@ -1994,10 +1992,8 @@
+   
+     if (errno == EAGAIN)
+       result = errSSLWouldBlock;
+-    else if (errno == EPIPE)
+-      result = errSSLClosedAbort;
+     else
+-      result = errSSLInternal;
++      result = errSSLClosedAbort;
+   }
+ 
+   return result;
+@@ -2338,6 +2334,9 @@
+     error = SSLSetAllowsAnyRoot(conn->session, true);
+ 
+   if (!error)
++    error = SSLSetProtocolVersionEnabled(conn->session, kSSLProtocol2, false);
++
++  if (!error)
+   {
+     while ((error = SSLHandshake(conn->session)) == errSSLWouldBlock)
+       usleep(1000);
+diff -urNad cupsys-1.2.1~/cups/http.h cupsys-1.2.1/cups/http.h
+--- cupsys-1.2.1~/cups/http.h	2006-03-15 21:16:05.000000000 +0000
++++ cupsys-1.2.1/cups/http.h	2006-07-18 11:27:13.000000000 +0000
+@@ -98,7 +98,7 @@
+ #if defined(AF_INET6) && !defined(s6_addr32)
+ #  if defined(__sun)
+ #    define s6_addr32	_S6_un._S6_u32
+-#  elif defined(__FreeBSD__) || defined(__APPLE__)
++#  elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
+ #    define s6_addr32	__u6_addr.__u6_addr32
+ #  elif defined(__osf__)
+ #    define s6_addr32	s6_un.sa6_laddr
+@@ -322,6 +322,14 @@
+ 
+ typedef struct _http_s			/**** HTTP connection structure. ****/
+ {
++ /*
++  * DO NOT ACCESS MEMBERS OF THIS STRUCTURE DIRECTLY; INSTEAD, USE THE
++  * PROVIDED APIS FOR ACCESSING THE VALUES INSTEAD.
++  *
++  * This structure definition will be removed from the public headers in
++  * CUPS 1.3.
++  */
++
+   int			fd;		/* File descriptor for this socket */
+   int			blocking;	/* To block or not to block */
+   int			error;		/* Last error on read */
+diff -urNad cupsys-1.2.1~/cups/ipp.c cupsys-1.2.1/cups/ipp.c
+--- cupsys-1.2.1~/cups/ipp.c	2006-04-17 20:39:05.000000000 +0000
++++ cupsys-1.2.1/cups/ipp.c	2006-07-18 11:27:13.000000000 +0000
+@@ -2742,10 +2742,10 @@
+       if (!http->blocking)
+       {
+        /*
+-        * Wait up to 1 second for more data on non-blocking sockets...
++        * Wait up to 10 seconds for more data on non-blocking sockets...
+ 	*/
+ 
+-	if (!httpWait(http, 1000))
++	if (!httpWait(http, 10000))
+ 	{
+ 	 /*
+           * Signal no data...
+diff -urNad cupsys-1.2.1~/cups/mark.c cupsys-1.2.1/cups/mark.c
+--- cupsys-1.2.1~/cups/mark.c	2006-05-15 20:06:46.000000000 +0000
++++ cupsys-1.2.1/cups/mark.c	2006-07-18 11:27:13.000000000 +0000
+@@ -407,6 +407,7 @@
+       ppd_cparam_t	*cparam;	/* Custom parameter */
+       char		*units;		/* Custom points units */
+ 
++
+       if ((coption = ppdFindCustomOption(ppd, option)) != NULL)
+       {
+         if ((cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params)) == NULL)
+@@ -455,6 +456,12 @@
+ 	}
+       }
+     }
++
++   /*
++    * Make sure that we keep the option marked below...
++    */
++
++    choice = "Custom";
+   }
+   else if (choice[0] == '{')
+   {
+diff -urNad cupsys-1.2.1~/cups/testhttp.c cupsys-1.2.1/cups/testhttp.c
+--- cupsys-1.2.1~/cups/testhttp.c	2006-03-29 15:26:44.000000000 +0000
++++ cupsys-1.2.1/cups/testhttp.c	2006-07-18 11:27:13.000000000 +0000
+@@ -3,7 +3,7 @@
+  *
+  *   HTTP test program for the Common UNIX Printing System (CUPS).
+  *
+- *   Copyright 1997-2005 by Easy Software Products.
++ *   Copyright 1997-2006 by Easy Software Products.
+  *
+  *   These coded instructions, statements, and computer programs are the
+  *   property of Easy Software Products and are protected by Federal
+@@ -311,9 +311,21 @@
+     addrlist = httpAddrGetList(hostname, AF_UNSPEC, NULL);
+     if (addrlist)
+     {
+-      for (i = 0, addr = addrlist; addr; i ++, addr = addr->next);
++      for (i = 0, addr = addrlist; addr; i ++, addr = addr->next)
++      {
++        char	numeric[1024];		/* Numeric IP address */
++
++
++	httpAddrString(&(addr->addr), numeric, sizeof(numeric));
++	if (!strcmp(numeric, "UNKNOWN"))
++	  break;
++      }
++
++      if (addr)
++        printf("FAIL (bad address for %s)\n", hostname);
++      else
++        printf("PASS (%d address(es) for %s)\n", i, hostname);
+ 
+-      printf("PASS (%d address(es) for %s)\n", i, hostname);
+       httpAddrFreeList(addrlist);
+     }
+     else
+diff -urNad cupsys-1.2.1~/cups/testppd.c cupsys-1.2.1/cups/testppd.c
+--- cupsys-1.2.1~/cups/testppd.c	2006-05-02 20:38:12.000000000 +0000
++++ cupsys-1.2.1/cups/testppd.c	2006-07-18 11:27:13.000000000 +0000
+@@ -59,6 +59,39 @@
+ 			"%%BeginFeature: *InputSlot Tray\n"
+ 			"InputSlot=Tray\n"
+ 			"%%EndFeature\n"
++			"} stopped cleartomark\n"
++			"[{\n"
++			"%%BeginFeature: *IntOption None\n"
++			"%%EndFeature\n"
++			"} stopped cleartomark\n"
++			"[{\n"
++			"%%BeginFeature: *StringOption None\n"
++			"%%EndFeature\n"
++			"} stopped cleartomark\n";
++
++static const char	*custom_code =
++			"[{\n"
++			"%%BeginFeature: *CustomPageSize True\n"
++			"400\n"
++			"500\n"
++			"0\n"
++			"0\n"
++			"0\n"
++			"PageSize=Custom\n"
++			"%%EndFeature\n"
++			"} stopped cleartomark\n"
++			"[{\n"
++			"%%BeginFeature: *InputSlot Tray\n"
++			"InputSlot=Tray\n"
++			"%%EndFeature\n"
++			"} stopped cleartomark\n"
++			"[{\n"
++			"%%BeginFeature: *IntOption None\n"
++			"%%EndFeature\n"
++			"} stopped cleartomark\n"
++			"[{\n"
++			"%%BeginFeature: *StringOption None\n"
++			"%%EndFeature\n"
+ 			"} stopped cleartomark\n";
+ 
+ 
+@@ -107,7 +140,7 @@
+       printf("FAIL (%d conflicts)\n", conflicts);
+     }
+ 
+-    fputs("ppdEmitString: ", stdout);
++    fputs("ppdEmitString (defaults): ", stdout);
+     if ((s = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL &&
+ 	!strcmp(s, default_code))
+       puts("PASS");
+@@ -123,6 +156,24 @@
+     if (s)
+       free(s);
+ 
++    fputs("ppdEmitString (custom size): ", stdout);
++    ppdMarkOption(ppd, "PageSize", "Custom.400x500");
++
++    if ((s = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL &&
++	!strcmp(s, custom_code))
++      puts("PASS");
++    else
++    {
++      printf("FAIL (%d bytes instead of %d)\n", s ? (int)strlen(s) : 0,
++	     (int)strlen(custom_code));
++
++      if (s)
++	puts(s);
++    }
++
++    if (s)
++      free(s);
++
+     ppdClose(ppd);
+   }
+   else
+diff -urNad cupsys-1.2.1~/cups/util.c cupsys-1.2.1/cups/util.c
+--- cupsys-1.2.1~/cups/util.c	2006-03-06 13:02:23.000000000 +0000
++++ cupsys-1.2.1/cups/util.c	2006-07-18 11:27:13.000000000 +0000
+@@ -800,6 +800,8 @@
+             const char *name)		/* I - Printer name */
+ {
+   int		http_port;		/* Port number */
++  char		http_hostname[HTTP_MAX_HOST];
++					/* Hostname associated with connection */
+   http_t	*http2;			/* Alternate HTTP connection */
+   int		fd;			/* PPD file */
+   char		localhost[HTTP_MAX_URI],/* Local hostname */
+@@ -835,19 +837,25 @@
+                             resource, sizeof(resource), 0))
+     return (NULL);
+ 
++  DEBUG_printf(("Printer hostname=\"%s\", port=%d\n", hostname, port));
++
+  /*
+   * Remap local hostname to localhost...
+   */
+ 
+   httpGetHostname(NULL, localhost, sizeof(localhost));
+ 
++  DEBUG_printf(("Local hostname=\"%s\"\n", localhost));
++
+   if (!strcasecmp(localhost, hostname))
+     strcpy(hostname, "localhost");
+ 
+  /*
+-  * Get the port number we are connected to...
++  * Get the hostname and port number we are connected to...
+   */
+ 
++  httpGetHostname(http, http_hostname, sizeof(http_hostname));
++
+ #ifdef AF_INET6
+   if (http->hostaddr->addr.sa_family == AF_INET6)
+     http_port = ntohs(http->hostaddr->ipv6.sin6_port);
+@@ -858,11 +866,14 @@
+   else
+     http_port = ippPort(); 
+ 
++  DEBUG_printf(("Connection hostname=\"%s\", port=%d\n", http_hostname,
++                http_port));
++
+  /*
+   * Reconnect to the correct server as needed...
+   */
+ 
+-  if (!strcasecmp(http->hostname, hostname) && port == http_port)
++  if (!strcasecmp(http_hostname, hostname) && port == http_port)
+     http2 = http;
+   else if ((http2 = httpConnectEncrypt(hostname, port,
+                                        cupsEncryption())) == NULL)
+@@ -1394,7 +1405,8 @@
+ 	     char       *printer,	/* O - Printer name [HTTP_MAX_URI] */
+              char       *hostname)	/* O - Hostname [HTTP_MAX_URI] */
+ {
+-  char	hostbuf[HTTP_MAX_URI];		/* Name of host */
++  char	hostbuf[HTTP_MAX_URI],		/* Name of host */
++	http_hostname[HTTP_MAX_HOST];	/* Hostname associated with connection */
+   _cups_globals_t  *cg = _cupsGlobals();/* Pointer to library globals */
+ 
+ 
+@@ -1415,6 +1427,8 @@
+ 
+   strlcpy(hostbuf, cupsServer(), sizeof(hostbuf));
+ 
++  httpGetHostname(cg->http, http_hostname, sizeof(http_hostname));
++
+   if (hostname != NULL)
+     strlcpy(hostname, hostbuf, HTTP_MAX_URI);
+   else
+@@ -1427,7 +1441,7 @@
+ 
+   if (cg->http != NULL)
+   {
+-    if (!strcasecmp(cg->http->hostname, hostname))
++    if (!strcasecmp(http_hostname, hostname))
+       return (printer);
+ 
+     httpClose(cg->http);
+@@ -1473,7 +1487,9 @@
+   char		uri[HTTP_MAX_URI],	/* printer-uri attribute */
+ 		scheme[HTTP_MAX_URI],	/* Scheme name */
+ 		username[HTTP_MAX_URI],	/* Username:password */
+-		classname[255];		/* Temporary class name */
++		classname[255],		/* Temporary class name */
++		http_hostname[HTTP_MAX_HOST];
++					/* Hostname associated with connection */
+   static const char * const requested_attrs[] =
+ 		{			/* Requested attributes */
+ 		  "printer-uri-supported",
+@@ -1505,9 +1521,11 @@
+   DEBUG_printf(("cups_get_printer_uri: printer-uri=\"%s\"\n", uri));
+ 
+  /*
+-  * Get the port number we are connected to...
++  * Get the hostname and port number we are connected to...
+   */
+ 
++  httpGetHostname(http, http_hostname, sizeof(http_hostname));
++
+ #ifdef AF_INET6
+   if (http->hostaddr->addr.sa_family == AF_INET6)
+     http_port = ntohs(http->hostaddr->ipv6.sin6_port);
+@@ -1585,7 +1603,7 @@
+ 	    * Found a class!  Connect to the right server...
+ 	    */
+ 
+-	    if (!strcasecmp(http->hostname, host) && *port == http_port)
++	    if (!strcasecmp(http_hostname, host) && *port == http_port)
+ 	      http2 = http;
+ 	    else if ((http2 = httpConnectEncrypt(host, *port,
+ 						 cupsEncryption())) == NULL)
+diff -urNad cupsys-1.2.1~/cups-config.in cupsys-1.2.1/cups-config.in
+--- cupsys-1.2.1~/cups-config.in	2006-05-10 18:57:46.000000000 +0000
++++ cupsys-1.2.1/cups-config.in	2006-07-18 11:27:13.000000000 +0000
+@@ -42,8 +42,8 @@
+ # flags for C++ compiler:
+ CFLAGS=""
+ LDFLAGS="@EXPORT_LDFLAGS@"
+-LIBS="@EXPORT_SSLLIBS@ @LIBS@"
+-IMGLIBS="@EXPORT_LIBTIFF@ @EXPORT_LIBJPEG@ @EXPORT_LIBPNG@ @EXPORT_LIBZ@"
++LIBS="@EXPORT_SSLLIBS@ @EXPORT_LIBZ@ @LIBS@"
++IMGLIBS="@EXPORT_LIBTIFF@ @EXPORT_LIBJPEG@ @EXPORT_LIBPNG@"
+ 
+ # Check for local invocation...
+ selfdir=`dirname $0`
+@@ -53,7 +53,7 @@
+     LDFLAGS="-L$selfdir/cups -L$selfdir/filter $LDFLAGS"
+     libdir="$selfdir/cups"
+     imagelibdir="$selfdir/filter"
+-    if test ! -e "$selfdir/cups/raster.h"; then
++    if test ! -f "$selfdir/cups/raster.h"; then
+         ln -s ../filter/raster.h "$selfdir/cups"
+     fi
+ else
+@@ -115,13 +115,13 @@
+  	        if test $image = no; then
+  	            echo -lcups $LIBS
+  		else
+- 	            echo -lcupsimage $IMGLIBS -lcups $LIBS
++ 	            echo -lcupsimage -lcups $IMGLIBS $LIBS
+  		fi
+ 	    else
+ 	        if test $image = no; then
+ 	            echo $libdir/libcups.a $LIBS
+ 		else
+-	            echo $imagelibdir/libcupsimage.a $IMGLIBS $libdir/libcups.a $LIBS
++	            echo $imagelibdir/libcupsimage.a $libdir/libcups.a $IMGLIBS $LIBS
+ 		fi
+ 	    fi
+ 	    ;;
+diff -urNad cupsys-1.2.1~/doc/Makefile cupsys-1.2.1/doc/Makefile
+--- cupsys-1.2.1~/doc/Makefile	2006-05-08 20:32:27.000000000 +0000
++++ cupsys-1.2.1/doc/Makefile	2006-07-18 11:27:13.000000000 +0000
+@@ -153,11 +153,13 @@
+ 			help/network.html \
+ 			help/options.html \
+ 			help/overview.html \
++			help/policies.html \
+ 			help/ref-access_log.html \
+ 			help/ref-classes-conf.html \
+ 			help/ref-client-conf.html \
+ 			help/ref-cupsd-conf.html \
+ 			help/ref-error_log.html \
++			help/ref-mailto-conf.html \
+ 			help/ref-page_log.html \
+ 			help/ref-printers-conf.html \
+ 			help/ref-snmp-conf.html \
+@@ -200,7 +202,7 @@
+ # Install all documentation files...
+ #
+ 
+-install:	all
++install:	all $(INSTALL_LANGUAGES)
+ 	$(INSTALL_DIR) -m 755 $(DOCDIR)
+ 	for file in $(WEBPAGES); do \
+ 		$(INSTALL_MAN) $$file $(DOCDIR); \
+@@ -213,6 +215,8 @@
+ 	for file in $(WEBIMAGES) $(WEBBUTTONS); do \
+ 		$(INSTALL_MAN) $$file $(DOCDIR)/images; \
+ 	done
++
++install-languages:
+ 	for lang in $(LANGUAGES); do \
+ 		$(INSTALL_DIR) -m 755 $(DOCDIR)/$$lang/images; \
+ 		if test -f $$lang/index.html; then \
+@@ -230,7 +234,7 @@
+ # Unnstall all documentation files...
+ #
+ 
+-uninstall:
++uninstall: $(UNINSTALL_LANGUAGES)
+ 	for file in $(WEBPAGES); do \
+ 		$(RM) $(DOCDIR)/$$file; \
+ 	done
+@@ -240,6 +244,11 @@
+ 	for file in $(WEBIMAGES) $(WEBBUTTONS); do \
+ 		$(INSTALL_MAN) $(DOCDIR)/images/$$file; \
+ 	done
++	-$(RMDIR) $(DOCDIR)/images
++	-$(RMDIR) $(DOCDIR)/help
++	-$(RMDIR) $(DOCDIR)
++
++uninstall-languages:
+ 	-for lang in $(LANGUAGES); do \
+ 		$(RM) $(DOCDIR)/$$lang/index.html; \
+ 		for file in $(WEBBUTTONS); do \
+@@ -248,9 +257,6 @@
+ 		$(RMDIR) $(DOCDIR)/$$lang/images; \
+ 		$(RMDIR) $(DOCDIR)/$$lang; \
+ 	done
+-	-$(RMDIR) $(DOCDIR)/images
+-	-$(RMDIR) $(DOCDIR)/help
+-	-$(RMDIR) $(DOCDIR)
+ 
+ 
+ #
+diff -urNad cupsys-1.2.1~/doc/help/policies.html cupsys-1.2.1/doc/help/policies.html
+--- cupsys-1.2.1~/doc/help/policies.html	1970-01-01 00:00:00.000000000 +0000
++++ cupsys-1.2.1/doc/help/policies.html	2006-07-18 11:27:13.000000000 +0000
+@@ -0,0 +1,677 @@
++<HTML>
++<!-- SECTION: Getting Started -->
++<HEAD>
++	<TITLE>Managing Operation Policies</TITLE>
++</HEAD>
++<BODY>
++
++<P>Operation policies are the rules used for each IPP operation
++in CUPS. These rules include things like "user must provide a
++password", "user must be in the system group", "allow only from
++the local system", and so forth. Until CUPS 1.2, these rules were
++largely hardcoded and could only be customized at a very basic
++level.</P>
++
++<P>CUPS 1.2 adds a new fine-grained policy layer which allows you
++to completely redefine the rules for each operation and/or
++printer. Each policy is named and defines access control rules
++for each IPP operation. This document describes how to manage
++policies and their rules.</P>
++
++<H2 CLASS="title"><A NAME="BASICS">The Basics</A></H2>
++
++<P>Operation policies are used for all IPP requests sent to the
++scheduler and are evaluated <em>after</em> the <A
++HREF="ref-cupsd-conf.html#Location"><TT>Location</TT></A> based
++access control rules. This means that operation policies can only
++add additional security restrictions to a request, never relax
++them. Use <TT>Location</TT> based access control rules for
++server-wide limits and operation policies for limits on
++individual printers, tasks, or services.</P>
++
++<P>Policies are stored in the <VAR>cupsd.conf</VAR> file in <A
++HREF="ref-cupsd-conf.html#Policy"><TT>Policy</TT></A> sections.
++Each policy has an alphanumeric name that is used to select it.
++Inside the policy section are one or more <A
++HREF="ref-cupsd-conf.html#LimitIPP"><TT>Limit</TT></A>
++subsections which list the operations that are affected by the
++rules inside it. <A HREF="#LISTING01">Listing 1</A> shows the
++default operation policy, appropriately called "default", that is
++shipped with CUPS.</P>
++
++<P>The easiest way to add a policy to the <VAR>cupsd.conf</VAR>
++file is to use the web interface. Click on the
++<VAR>Administration</VAR> tab and then the <VAR>Edit
++Configuration File</VAR> button to edit the current
++<VAR>cupsd.conf</VAR> file. Click on the <VAR>Save Changes</VAR>
++button to save the changes and restart the scheduler. If you edit
++the <VAR>cupsd.conf</VAR> file from the console, make sure to <A
++HREF="ref-cupsd-conf.html">restart the cupsd process</A> before
++trying to use the new policy.</P>
++
++<PRE CLASS="command">
++<EM>Listing 1: <A NAME="LISTING01">Default Operation Policy</A></EM>
++
++ 1    &lt;Policy default>
++ 2      # Job-related operations must be done by the owner or an
++      adminstrator...
++ 3      &lt;Limit Send-Document Send-URI Hold-Job Release-Job
++      Restart-Job Purge-Jobs Set-Job-Attributes
++      Create-Job-Subscription Renew-Subscription
++      Cancel-Subscription Get-Notifications Reprocess-Job
++      Cancel-Current-Job Suspend-Current-Job Resume-Job
++      CUPS-Move-Job>
++ 4        Require user @OWNER @SYSTEM
++ 5        Order deny,allow
++ 6      &lt;/Limit>
++ 7    
++ 8      # All administration operations require an adminstrator
++      to authenticate...
++ 9      &lt;Limit Pause-Printer Resume-Printer
++      Set-Printer-Attributes Enable-Printer Disable-Printer
++      Pause-Printer-After-Current-Job Hold-New-Jobs
++      Release-Held-New-Jobs Deactivate-Printer Activate-Printer
++      Restart-Printer Shutdown-Printer Startup-Printer
++      Promote-Job Schedule-Job-After CUPS-Add-Printer
++      CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class
++      CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>
++10        AuthType Basic
++11        Require user @SYSTEM
++12        Order deny,allow
++13      &lt;/Limit>
++14    
++15      # Only the owner or an administrator can cancel or
++      authenticate a job...
++16      &lt;Limit Cancel-Job CUPS-Authenticate-Job>
++17        Require user @OWNER @SYSTEM
++18        Order deny,allow
++19      &lt;/Limit>
++20    
++21      &lt;Limit All>
++22        Order deny,allow
++23      &lt;/Limit>
++24    &lt;/Policy>
++</PRE>
++
++<H3>The Default CUPS Operation Policy</H3>
++
++<P>The policy definition starts with an opening <TT>Policy</TT>
++directive:</P>
++
++<PRE CLASS="command">
++ 1    &lt;Policy default>
++</PRE>
++
++<P>The first <TT>Limit</TT> subsection defines the rules for IPP
++job operations:</P>
++
++<PRE CLASS="command">
++ 3      &lt;Limit Send-Document Send-URI Hold-Job Release-Job
++      Restart-Job Purge-Jobs Set-Job-Attributes
++      Create-Job-Subscription Renew-Subscription
++      Cancel-Subscription Get-Notifications Reprocess-Job
++      Cancel-Current-Job Suspend-Current-Job Resume-Job
++      CUPS-Move-Job>
++ 4        Require user @OWNER @SYSTEM
++ 5        Order deny,allow
++ 6      &lt;/Limit>
++</PRE>
++
++<P>The operation names are listed on a single line
++with spaces separating them. Each name corresponds to the IPP
++operation described in any of the IETF or PWG standards documents
++for the Internet Printing Protocol. <A HREF="#TABLE01">Table
++1</A> lists all of the operations that have been defined along
++with their usage in CUPS.</P>
++
++<P>The access control rules are listed after the <TT>Limit</TT>
++line and are the same as those used for <A
++HREF="ref-cupsd-conf.html#Location"><TT>Location</TT></A>
++sections. In this case, we require the owner of the job
++("@OWNER") or a member of the <A
++HREF="ref-cupsd-conf.html#SystemGroup"><TT>SystemGroup</TT></A>
++("@SYSTEM") to do the operation. Because we do not include an <A
++HREF="ref-cupsd-conf.html#AuthType"><TT>AuthType</TT></A>
++directive here, the user information can come from the IPP
++request itself or the authenticated username from the HTTP
++request. The administrative operations starting on line 9,
++however, <em>do</em> use the <TT>AuthType</TT> directive, and so
++administrative operations need to be authenticated:</P>
++
++<PRE CLASS="command">
++ 9      &lt;Limit Pause-Printer Resume-Printer
++      Set-Printer-Attributes Enable-Printer Disable-Printer
++      Pause-Printer-After-Current-Job Hold-New-Jobs
++      Release-Held-New-Jobs Deactivate-Printer Activate-Printer
++      Restart-Printer Shutdown-Printer Startup-Printer
++      Promote-Job Schedule-Job-After CUPS-Add-Printer
++      CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class
++      CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>
++10        AuthType Basic
++11        Require user @SYSTEM
++12        Order deny,allow
++13      &lt;/Limit>
++</PRE>
++
++<P>The "Order deny,allow" line at the end of both <TT>Limit</TT>
++subsections allows the request to come from any system allowed by
++the <TT>Location</TT> sections elsewhere in the
++<VAR>cupsd.conf</VAR> file.</P>
++
++<P>The <TT>Cancel-Job</TT> and <TT>CUPS-Authenticate-Job</TT>
++operations are listed separately to allow the web interface to
++more easily edit their policy without disturbing the rest. Like
++the rest of the job operations, we want the job's owner
++("@OWNER") or an administrator ("@SYSTEM") to do it:</P>
++
++<PRE CLASS="command">
++16      &lt;Limit Cancel-Job CUPS-Authenticate-Job>
++17        Require user @OWNER @SYSTEM
++18        Order deny,allow
++19      &lt;/Limit>
++</PRE>
++
++<P>The last <TT>Limit</TT> subsection in any policy uses the
++special operation name <TT>All</TT>. CUPS will use the rules in
++this subsection for any operation you don't list specifically in
++the policy. In this case, all other operations are allowed
++without a username or authentication:</P>
++
++<PRE CLASS="command">
++21      &lt;Limit All>
++22        Order deny,allow
++23      &lt;/Limit>
++24    &lt;/Policy>
++</PRE>
++
++
++<DIV CLASS="table"><TABLE WIDTH="80%" SUMMARY="IPP Operation Names">
++<CAPTION>Table 1: <A NAME="TABLE01">IPP Operation Names</A></CAPTION>
++<THEAD>
++<TR>
++	<TH>Name</TH>
++	<TH>Used by CUPS?</TH>
++	<TH>Description</TH>
++</TR>
++</THEAD>
++<TBODY>
++<TR>
++	<TD NOWRAP><TT>Print-Job</TT></TD>
++	<TD>Yes</TD>
++	<TD>Creates a print job with a single file.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Print-URI</TT></TD>
++	<TD>No</TD>
++	<TD>Create a print job with a single URI.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Validate-Job</TT></TD>
++	<TD>Yes</TD>
++	<TD>Validates a print request before printing.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Create-Job</TT></TD>
++	<TD>Yes</TD>
++	<TD>Creates a print job with no files or URIs.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Send-Document</TT></TD>
++	<TD>Yes</TD>
++	<TD>Adds a file to a print job.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Send-URI</TT></TD>
++	<TD>No</TD>
++	<TD>Adds a URI to a print job.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Cancel-Job</TT></TD>
++	<TD>Yes</TD>
++	<TD>Cancels a print job.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Get-Job-Attributes</TT></TD>
++	<TD>Yes</TD>
++	<TD>Gets information and options associated with a job.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Get-Jobs</TT></TD>
++	<TD>Yes</TD>
++	<TD>Gets a list of jobs.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Get-Printer-Attributes</TT></TD>
++	<TD>Yes</TD>
++	<TD>Gets information and options associated with a printer or class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Hold-Job</TT></TD>
++	<TD>Yes</TD>
++	<TD>Holds a print job for printing.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Release-Job</TT></TD>
++	<TD>Yes</TD>
++	<TD>Releases a print job for printing.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Restart-Job</TT></TD>
++	<TD>Yes</TD>
++	<TD>Reprints a print job.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Pause-Printer</TT></TD>
++	<TD>Yes</TD>
++	<TD>Stops a printer or class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Resume-Printer</TT></TD>
++	<TD>Yes</TD>
++	<TD>Starts a printer or class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Purge-Jobs</TT></TD>
++	<TD>Yes</TD>
++	<TD>Cancels all jobs on the server or a printer or class
++	and removes the job history information.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Set-Printer-Attributes</TT></TD>
++	<TD>No</TD>
++	<TD>Sets printer or class information; CUPS uses
++	CUPS-Add-Modify-Printer and CUPS-Add-Modify-Class
++	instead.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Set-Job-Attributes</TT></TD>
++	<TD>Yes</TD>
++	<TD>Changes job options.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Get-Printer-Supported-Values</TT></TD>
++	<TD>No</TD>
++	<TD>Gets -supported attributes for a printer based on job
++	options.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Create-Printer-Subscription</TT></TD>
++	<TD>Yes</TD>
++	<TD>Creates an event subscription for a printer or the server.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Create-Job-Subscription</TT></TD>
++	<TD>Yes</TD>
++	<TD>Creates an event subscription for a job.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Get-Subscription-Attributes</TT></TD>
++	<TD>Yes</TD>
++	<TD>Gets information for an event subscription.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Get-Subscriptions</TT></TD>
++	<TD>Yes</TD>
++	<TD>Gets a list of event subscriptions.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Renew-Subscription</TT></TD>
++	<TD>Yes</TD>
++	<TD>Renews an event subscription that is about to expire.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Cancel-Subscription</TT></TD>
++	<TD>Yes</TD>
++	<TD>Cancels an event subscription.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Get-Notifications</TT></TD>
++	<TD>Yes</TD>
++	<TD>Gets (pending) events for an event subscription.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Send-Notifications</TT></TD>
++	<TD>No</TD>
++	<TD>Sends events for an event subscription.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Get-Printer-Support-Files</TT></TD>
++	<TD>No</TD>
++	<TD>Gets printer driver files for a Novell client.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Enable-Printer</TT></TD>
++	<TD>Yes</TD>
++	<TD>Starts a printer or class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Disable-Printer</TT></TD>
++	<TD>Yes</TD>
++	<TD>Stops a printer or class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Pause-Printer-After-Current-Job</TT></TD>
++	<TD>No</TD>
++	<TD>Stops a printer or class after the current job is finished.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Hold-New-Jobs</TT></TD>
++	<TD>No</TD>
++	<TD>Holds new jobs submitted to a printer or class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Release-Held-New-Jobs</TT></TD>
++	<TD>No</TD>
++	<TD>Releases jobs that were held because of the
++	Hold-New-Jobs operation.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Deactivate-Printer</TT></TD>
++	<TD>No</TD>
++	<TD>Deactivates a printer or class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Activate-Printer</TT></TD>
++	<TD>No</TD>
++	<TD>Activates a printer or class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Restart-Printer</TT></TD>
++	<TD>No</TD>
++	<TD>Restarts a printer or class, resuming print jobs as needed.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Shutdown-Printer</TT></TD>
++	<TD>No</TD>
++	<TD>Powers a printer or class off.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Startup-Printer</TT></TD>
++	<TD>No</TD>
++	<TD>Powers a printer or class on.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Reprocess-Job</TT></TD>
++	<TD>No</TD>
++	<TD>Reprints a job on a different printer or class; CUPS has the
++	CUPS-Move-Job operation instead.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Cancel-Current-Job</TT></TD>
++	<TD>No</TD>
++	<TD>Cancels the current job on a printer or class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Suspend-Current-Job</TT></TD>
++	<TD>No</TD>
++	<TD>Stops the current job on a printer or class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Resume-Job</TT></TD>
++	<TD>No</TD>
++	<TD>Resumes printing of a stopped job.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Promote-Job</TT></TD>
++	<TD>No</TD>
++	<TD>Prints a job before others.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>Schedule-Job-After</TT></TD>
++	<TD>No</TD>
++	<TD>Prints a job after others.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>CUPS-Get-Default</TT></TD>
++	<TD>Yes</TD>
++	<TD>Gets the server/network default printer or class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>CUPS-Get-Printers</TT></TD>
++	<TD>Yes</TD>
++	<TD>Gets a list of printers and/or classes.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>CUPS-Add-Modify-Printer</TT></TD>
++	<TD>Yes</TD>
++	<TD>Adds or modifies a printer.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>CUPS-Delete-Printer</TT></TD>
++	<TD>Yes</TD>
++	<TD>Removes a printer.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>CUPS-Get-Classes</TT></TD>
++	<TD>Yes</TD>
++	<TD>Gets a list of classes.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>CUPS-Add-Modify-Class</TT></TD>
++	<TD>Yes</TD>
++	<TD>Adds or modifies a class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>CUPS-Delete-Class</TT></TD>
++	<TD>Yes</TD>
++	<TD>Removes a class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>CUPS-Accept-Jobs</TT></TD>
++	<TD>Yes</TD>
++	<TD>Sets a printer's or class' printer-is-accepting-jobs
++	attribute to true.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>CUPS-Reject-Jobs</TT></TD>
++	<TD>Yes</TD>
++	<TD>Sets a printer's or class' printer-is-accepting-jobs
++	attribute to false.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>CUPS-Set-Default</TT></TD>
++	<TD>Yes</TD>
++	<TD>Sets the server/network default printer or class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>CUPS-Get-Devices</TT></TD>
++	<TD>Yes</TD>
++	<TD>Gets a list of printer devices.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>CUPS-Get-PPDs</TT></TD>
++	<TD>Yes</TD>
++	<TD>Gets a list of printer drivers or manufacturers.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>CUPS-Move-Job</TT></TD>
++	<TD>Yes</TD>
++	<TD>Moves a job to a different printer or class.</TD>
++</TR>
++<TR>
++	<TD NOWRAP><TT>CUPS-Authenticate-Job</TT></TD>
++	<TD>Yes</TD>
++	<TD>Authenticates a job for printing.</TD>
++</TR>
++</TBODY>
++</TABLE></DIV>
++
++
++<H2 CLASS="title"><A NAME="CREATING">Creating Your Own Policies</A></H2>
++
++<P>The easiest way to create a new policy is to start with the
++default policy and then make changes to the copy. The first
++change you'll make is to give the policy a new name. Policy names
++can use the same characters as a printer name, specifically all
++printable characters except space, slash (/), and pound (#):</P>
++
++<PRE CLASS="command">
++&lt;Policy mypolicy>
++</PRE>
++
++<P>Then you need to decide exactly what limits you want for the
++policy. For example, if you want to allow any user to cancel any
++other users' jobs, you can change the <TT>Cancel-Job</TT> limits
++to:</P>
++
++<PRE CLASS="command">
++&lt;Limit Cancel-Job>
++  Order deny,allow
++&lt;/Limit>
++</PRE>
++
++<P>The directives inside the <TT>Limit</TT> subsection can use
++any of the normal limiting directives: <A
++HREF="ref-cupsd-conf.html#Allow"><TT>Allow</TT></A>, <A
++HREF="ref-cupsd-conf.html#AuthType"><TT>AuthType</TT></A>, <A
++HREF="ref-cupsd-conf.html#Deny"><TT>Deny</TT></A>, <A
++HREF="ref-cupsd-conf.html#Encryption"><TT>Encryption</TT></A>, <A
++HREF="ref-cupsd-conf.html#Require"><TT>Require</TT></A>, and <A
++HREF="ref-cupsd-conf.html#Satisfy"><TT>Satisfy</TT></A>. <A
++HREF="#TABLE02">Table 2</A> lists some basic "recipes" for
++different access control rules.</P>
++
++<DIV CLASS="table"><TABLE WIDTH="80%" SUMMARY="Access Control Recipes">
++<CAPTION>Table 2: <A NAME="TABLE02">Access Control Recipes</A></CAPTION>
++<THEAD>
++<TR>
++	<TH>Access Level</TH>
++	<TH>Directives to Use</TH>
++</TR>
++</THEAD>
++<TBODY>
++<TR>
++	<TD>Allow Everyone</TD>
++	<TD><PRE>Order deny,allow
++Allow from all</PRE></TD>
++</TR>
++<TR>
++	<TD>Allow Everyone on the Local Network</TD>
++	<TD><PRE>Order deny,allow
++Allow from @LOCAL</PRE></TD>
++</TR>
++<TR>
++	<TD>Deny Everyone/Disable Operation(s)</TD>
++	<TD><PRE>Order allow,deny
++Deny from all</PRE></TD>
++</TR>
++<TR>
++	<TD>Require Login (System) Password</TD>
++	<TD><PRE>AuthType Basic</PRE></TD>
++</TR>
++<TR>
++	<TD>Require CUPS (lppasswd) Password</TD>
++	<TD><PRE>AuthType BasicDigest</PRE></TD>
++</TR>
++<TR>
++	<TD>Require the Owner of a Job or Subscription</TD>
++	<TD><PRE>Require user @OWNER</PRE></TD>
++</TR>
++<TR>
++	<TD>Require an Administrative User</TD>
++	<TD><PRE>Require user @SYSTEM</PRE></TD>
++</TR>
++<TR>
++	<TD>Require Member of Group "foogroup"</TD>
++	<TD><PRE>Require user @foogroup</PRE></TD>
++</TR>
++<TR>
++	<TD>Require "john" or "mary"</TD>
++	<TD><PRE>Require user john mary</PRE></TD>
++</TR>
++<TR>
++	<TD>Require Encryption</TD>
++	<TD><PRE>Encryption Required</PRE></TD>
++</TR>
++</TABLE></DIV>
++
++
++<H3>Creating a Policy for a Computer Lab</H3>
++
++<P>One common operating scenario is a computer lab. The lab is
++managed by one or more technicians that assist the users of the
++lab and handle the basic administration tasks. <A
++HREF="#LISTING02">Listing 2</A> shows an operation policy that
++only allows access from the lab's subnet, 10.0.2.x, and allows
++the lab technicians, who are members of a special UNIX group for
++that lab called "lab999", to do job, printer, and subscription
++management operations.</P>
++
++<PRE CLASS="command">
++<EM>Listing 2: <A NAME="LISTING02">Operation Policy for a Lab</A></EM>
++
++ 1    &lt;Policy lab999>
++ 2      # Job- and subscription-related operations must be done
++      by the owner, a lab technician, or an adminstrator...
++ 3      &lt;Limit Send-Document Send-URI Hold-Job Release-Job
++      Restart-Job Purge-Jobs Set-Job-Attributes
++      Create-Job-Subscription Renew-Subscription
++      Cancel-Subscription Get-Notifications Reprocess-Job
++      Cancel-Current-Job Suspend-Current-Job Resume-Job
++      CUPS-Move-Job Cancel-Job CUPS-Authenticate-Job>
++ 4        Require user @OWNER @lab999 @SYSTEM
++ 5        Order allow,deny
++ 6        Allow from 10.0.2.0/24
++ 7      &lt;/Limit>
++ 8    
++ 9      # All administration operations require a lab technician
++      or an adminstrator to authenticate...
++10      &lt;Limit Pause-Printer Resume-Printer
++      Set-Printer-Attributes Enable-Printer Disable-Printer
++      Pause-Printer-After-Current-Job Hold-New-Jobs
++      Release-Held-New-Jobs Deactivate-Printer Activate-Printer
++      Restart-Printer Shutdown-Printer Startup-Printer
++      Promote-Job Schedule-Job-After CUPS-Accept-Jobs
++      CUPS-Reject-Jobs CUPS-Set-Default>
++11        AuthType Basic
++12        Require user @lab999 @SYSTEM
++13        Order allow,deny
++14        Allow from 10.0.2.0/24
++15      &lt;/Limit>
++16
++17      # All other operations are allowed from the lab network...
++18      &lt;Limit All>
++19        Order allow,deny
++20        Allow from 10.0.2.0/24
++21      &lt;/Limit>
++22    &lt;/Policy>
++</PRE>
++
++
++<H2 CLASS="title"><A NAME="SELECT">Using Policies</A></H2>
++
++<P>Once you have created a policy, you can use it in two ways.
++The first way is to assign it as the default policy for the
++system using the <A
++HREF="ref-cupsd-conf.html#DefaultPolicy"><TT>DefaultPolicy</TT></A>
++directive in the <VAR>cupsd.conf</VAR> file. For example, add the
++following line to the <VAR>cupsd.conf</VAR> file to use the
++"lab999" policy from the previous section:</P>
++
++<PRE CLASS="command">
++DefaultPolicy lab999
++</PRE>
++
++<P>To associate the policy with one or more printers, use either
++the <A HREF="man-lpadmin.html">lpadmin(8)</A> command or the web
++interface to change the operation policy for each printer. When
++using the <B>lpadmin</B> command, the <TT>-o
++printer-op-policy=name</TT> option sets the operation policy for
++a printer. For example, enter the following command to use the
++"lab999" policy from the previous section with a printer named
++"LaserJet4000":</P>
++
++<PRE CLASS="command">
++lpadmin -p LaserJet4000 -o printer-op-policy=lab999
++</PRE>
++
++<P>To make the same change in the web interface, go to the
++printer's web page, for example
++"http://localhost:631/printers/LaserJet4000", and click on the
++<VAR>Set Printer Options</VAR> button. Scroll down to the bottom
++of the page and choose the desired policy from the pull-down
++list. Click on <VAR>Save Changes</VAR> to change the policy for
++the printer.</P>
++
++</BODY>
++</HTML>
+diff -urNad cupsys-1.2.1~/doc/help/ref-mailto-conf.html cupsys-1.2.1/doc/help/ref-mailto-conf.html
+--- cupsys-1.2.1~/doc/help/ref-mailto-conf.html	1970-01-01 00:00:00.000000000 +0000
++++ cupsys-1.2.1/doc/help/ref-mailto-conf.html	2006-07-18 11:27:13.000000000 +0000
+@@ -0,0 +1,105 @@
++<HTML>
++<!-- SECTION: References -->
++<HEAD>
++	<TITLE>mailto.conf</TITLE>
++</HEAD>
++<BODY>
++
++<P>The <VAR>/etc/cups/mailto.conf</VAR> file contains several
++directives that defines the local mail server and email
++notification preferences for CUPS. Each directive is listed on a
++line by itself followed by its value. Comments are introduced
++using the number sign ("#") character at the beginning of a
++line.</P>
++
++
++<H2 CLASS="title"><A NAME="Cc">Cc</A></H2>
++
++<H3>Examples</H3>
++
++<PRE CLASS="command">
++Cc bigbrother at domain.com
++Cc John Doe &lt;jd at domain.com>
++</PRE>
++
++<H3>Description</H3>
++
++<P>The <CODE>Cc</CODE> directive specifies an additional
++recipient ("carbon copy") for all email notifications. The
++default is to not send a copy to anyone but the subscriber.</P>
++
++
++<H2 CLASS="title"><A NAME="From">From</A></H2>
++
++<H3>Examples</H3>
++
++<PRE CLASS="command">
++From printserver at domain.com
++From Your Happy Printer &lt;printserver at domain.com>
++</PRE>
++
++<H3>Description</H3>
++
++<P>The <CODE>From</CODE> directive specifies the sender of email
++notifications. The default is the <A
++HREF="ref-cupsd-conf.html#ServerAdmin"><TT>ServerAdmin</TT><A>
++address defined in the <VAR>cupsd.conf</VAR> file.</P>
++
++
++<H2 CLASS="title"><A NAME="Sendmail">Sendmail</A></H2>
++
++<H3>Examples</H3>
++
++<PRE CLASS="command">
++Sendmail /usr/sbin/sendmail
++Sendmail /usr/lib/sendmail -bm -i
++</PRE>
++
++<H3>Description</H3>
++
++<P>The <CODE>Sendmail</CODE> directive specifies the command to
++run to deliver an email locally. This directive cannot be used
++with the <TT>SMTPServer</TT> directive, and if both
++<TT>Sendmail</TT> and <TT>SMTPServer</TT> lines appear in the
++<VAR>mailto.conf</VAR> file, only the last line is used. The
++default is <TT>/usr/sbin/sendmail</TT>.</P>
++
++
++<H2 CLASS="title"><A NAME="SMTPServer">SMTPServer</A></H2>
++
++<H3>Examples</H3>
++
++<PRE CLASS="command">
++SMTPServer mail.domain.com
++SMTPServer 192.168.2.1
++</PRE>
++
++<H3>Description</H3>
++
++<P>The <CODE>SMTPServer</CODE> directive specifies a hostname or
++IP address of a (possibly remote) SMTP mail server. This
++directive cannot be used with the <TT>Sendmail</TT> directive,
++and if both <TT>Sendmail</TT> and <TT>SMTPServer</TT> lines
++appear in the <VAR>mailto.conf</VAR> file, only the last line is
++used. The default is to use the <TT>Sendmail</TT> command
++instead.</P>
++
++
++<H2 CLASS="title"><A NAME="Subject">Subject</A></H2>
++
++<H3>Examples</H3>
++
++<PRE CLASS="command">
++Subject [CUPS]
++Subject URGENT EMAIL NOTIFICATION
++</PRE>
++
++<H3>Description</H3>
++
++<P>The <CODE>Subject</CODE> directive specifies a prefix string to
++add to the subject of each email notification. The default is to
++not add a prefix string.</P>
++
++
++</BODY>
++</HTML>
+diff -urNad cupsys-1.2.1~/doc/help/spec-raster.html cupsys-1.2.1/doc/help/spec-raster.html
+--- cupsys-1.2.1~/doc/help/spec-raster.html	2006-05-11 20:07:26.000000000 +0000
++++ cupsys-1.2.1/doc/help/spec-raster.html	2006-07-18 11:27:13.000000000 +0000
+@@ -14,9 +14,10 @@
+ a printable format.</P>
+ 
+ <P>CUPS 1.0 and 1.1 used a version 1 raster format. CUPS 1.2
+-introduces a version 2 format that is a superset of the version 1
+-format. Applications using the CUPS Imaging API (the cupsRaster*
+-functions) can read both formats without code changes.</P>
++introduces version 2 (compressed) and version 3 (uncompressed)
++formats that are a superset of the version 1 format. Applications
++using the CUPS Imaging API (the cupsRaster* functions) can read
++all formats without code changes.</P>
+ 
+ <P>The registered MIME media type for CUPS raster files is
+ <CODE>application/vnd.cups-raster</CODE>.</P>
+@@ -485,6 +486,22 @@
+ followed by the color value bytes.</P>
+ 
+ 
++<H2 CLASS="title"><A NAME="V3">Version 3 Raster File Format</A></H2>
++
++<P>A version 3 raster file begins with a 32-bit synchronization
++word: 0x52615333 ("RaS3") for big-endian architectures and
++0x33536152 ("3SaR") for little-endian architectures. The writer
++of the raster file will use the native word order, and the reader
++is responsible for detecting a reversed word order file and
++swapping bytes as needed. The CUPS Imaging API raster functions
++perform this function automatically.</P>
++
++<P>Following the synchronization word are a series of raster
++pages. Each page starts with a version 2 page device dictionary
++header and is followed immediately by the uncompressed raster data
++for that page.</P>
++
++
+ <H2 CLASS="title"><A NAME="ENCODING">Pixel Value Coding</A></H2>
+ 
+ <P>The following sections describe the encoding and decoding of
+@@ -673,6 +690,15 @@
+ 
+ <H2 CLASS="title"><A NAME="HISTORY">Change History</A></H2>
+ 
++<H3>Changes in CUPS 1.2.2</H3>
++
++<ul>
++
++	<li>Added version 3 (uncompressed) format.</li>
++
++</ul>
++
++
+ <H3>Changes in CUPS 1.2.1</H3>
+ 
+ <ul>
+diff -urNad cupsys-1.2.1~/filter/Makefile cupsys-1.2.1/filter/Makefile
+--- cupsys-1.2.1~/filter/Makefile	2006-05-22 00:59:11.000000000 +0000
++++ cupsys-1.2.1/filter/Makefile	2006-07-18 11:27:13.000000000 +0000
+@@ -33,6 +33,7 @@
+ 		libcupsimage.a \
+ 		$(LIB32CUPSIMAGE) \
+ 		$(LIB64CUPSIMAGE) \
++		rasterbench \
+ 		testimage \
+ 		testraster
+ 
+@@ -47,7 +48,7 @@
+ FORMOBJS =	form-attr.o form-main.o form-ps.o form-text.o form-tree.o
+ OBJS	=	$(HPGLOBJS) $(IMAGEOBJS) $(FORMOBJS) \
+ 		gziptoany.o imagetops.o imagetoraster.o common.o pstops.o \
+-		raster.o rastertoepson.o rastertohp.o rastertolabel.o \
++		rasterbench.o rastertoepson.o rastertohp.o rastertolabel.o \
+ 		testimage.o testraster.o textcommon.o texttops.o
+ 
+ 
+@@ -118,12 +119,12 @@
+ install32bit:
+ 	$(INSTALL_DIR) -m 755 $(LIB32DIR)
+ 	$(INSTALL_LIB) 32bit/libcupsimage.so.2 $(LIB32DIR)/libcupsimage.so.2
+-	$(LN) libcupsimage.so $(LIB32DIR)/libcupsimage.so.2
++	$(LN) libcupsimage.so.2 $(LIB32DIR)/libcupsimage.so
+ 
+ install64bit:
+ 	$(INSTALL_DIR) -m 755 $(LIB64DIR)
+ 	$(INSTALL_LIB) 64bit/libcupsimage.so.2 $(LIB64DIR)/libcupsimage.so.2
+-	$(LN) libcupsimage.so $(LIB64DIR)/libcupsimage.so.2
++	$(LN) libcupsimage.so.2 $(LIB64DIR)/libcupsimage.so
+ 
+ 
+ #
+@@ -360,6 +361,15 @@
+ 
+ 
+ #
++# rasterbench
++#
++
++rasterbench:	rasterbench.o raster.o
++	echo Linking $@...
++	$(CC) $(LDFLAGS) -o $@ rasterbench.o raster.o
++
++
++#
+ # texttops
+ #
+ 
+diff -urNad cupsys-1.2.1~/filter/pstops.c cupsys-1.2.1/filter/pstops.c
+--- cupsys-1.2.1~/filter/pstops.c	2006-05-22 18:31:23.000000000 +0000
++++ cupsys-1.2.1/filter/pstops.c	2006-07-18 11:27:13.000000000 +0000
+@@ -1,5 +1,5 @@
+ /*
+- * "$Id: pstops.c 5570 2006-05-22 18:31:23Z mike $"
++ * "$Id: pstops.c 5622 2006-06-01 23:43:21Z mike $"
+  *
+  *   PostScript filter for the Common UNIX Printing System (CUPS).
+  *
+@@ -49,6 +49,7 @@
+  *   set_pstops_options() - Set pstops options...
+  *   skip_page()          - Skip past a page that won't be printed...
+  *   start_nup()          - Start processing for N-up printing...
++ *   write_labels()       - Write the actual page labels.
+  */
+ 
+ /*
+@@ -204,6 +205,7 @@
+ 				  size_t linesize);
+ static void		start_nup(pstops_doc_t *doc, int number,
+ 				  int show_border, const int *bounding_box);
++static void		write_labels(pstops_doc_t *doc, int orient);
+ 
+ 
+ /*
+@@ -1305,6 +1307,9 @@
+ 
+   if (first_page)
+   {
++    char	*page_setup;		/* PageSetup commands to send */
++
++
+     doc_puts(doc, "%%BeginPageSetup\n");
+ 
+     if (pageinfo->num_options > 0)
+@@ -1344,20 +1349,28 @@
+       */
+ 
+       if (doc_setup)
++      {
+ 	doc_puts(doc, doc_setup);
++	free(doc_setup);
++      }
+ 
+       if (any_setup)
++      {
+ 	doc_puts(doc, any_setup);
++	free(any_setup);
++      }
++    }
+ 
+-     /*
+-      * Free the command strings...
+-      */
++   /*
++    * Output commands for the current page...
++    */
+ 
+-      if (doc_setup)
+-	free(doc_setup);
++    page_setup = ppdEmitString(ppd, PPD_ORDER_PAGE, 0);
+ 
+-      if (any_setup)
+-	free(any_setup);
++    if (page_setup)
++    {
++      doc_puts(doc, page_setup);
++      free(page_setup);
+     }
+   }
+ 
+@@ -1856,15 +1869,15 @@
+         int          number)		/* I - Page number */
+ {
+   if (doc->mirror || Orientation || doc->number_up > 1)
+-    puts("userdict/ESPsave get restore");
++    doc_puts(doc, "userdict/ESPsave get restore\n");
+ 
+   switch (doc->number_up)
+   {
+     case 1 :
+ 	if (doc->use_ESPshowpage)
+ 	{
+-	  WriteLabels(Orientation);
+-          puts("ESPshowpage");
++	  write_labels(doc, Orientation);
++          doc_puts(doc, "ESPshowpage\n");
+ 	}
+ 	break;
+ 
+@@ -1878,7 +1891,7 @@
+ 	    * Rotate the labels back to portrait...
+ 	    */
+ 
+-	    WriteLabels(Orientation - 1);
++	    write_labels(doc, Orientation - 1);
+ 	  }
+ 	  else if (Orientation == 0)
+ 	  {
+@@ -1886,7 +1899,7 @@
+ 	    * Rotate the labels to landscape...
+ 	    */
+ 
+-	    WriteLabels(doc->normal_landscape ? 1 : 3);
++	    write_labels(doc, doc->normal_landscape ? 1 : 3);
+ 	  }
+ 	  else
+ 	  {
+@@ -1894,18 +1907,18 @@
+ 	    * Rotate the labels to landscape...
+ 	    */
+ 
+-	    WriteLabels(doc->normal_landscape ? 3 : 1);
++	    write_labels(doc, doc->normal_landscape ? 3 : 1);
+ 	  }
+ 
+-          puts("ESPshowpage");
++          doc_puts(doc, "ESPshowpage\n");
+ 	}
+         break;
+ 
+     default :
+ 	if (is_last_page(number) && doc->use_ESPshowpage)
+ 	{
+-	  WriteLabels(Orientation);
+-          puts("ESPshowpage");
++	  write_labels(doc, Orientation);
++          doc_puts(doc, "ESPshowpage\n");
+ 	}
+         break;
+   }
+@@ -2935,5 +2948,51 @@
+ 
+ 
+ /*
+- * End of "$Id: pstops.c 5570 2006-05-22 18:31:23Z mike $".
++ * 'write_labels()' - Write the actual page labels.
++ *
++ * This function is a copy of the one in common.c since we need to
++ * use doc_puts/doc_printf instead of puts/printf...
++ */
++
++static void
++write_labels(pstops_doc_t *doc,		/* I - Document information */
++             int          orient)	/* I - Orientation of the page */
++{
++  float	width,				/* Width of page */
++	length;				/* Length of page */
++
++
++  doc_puts(doc, "gsave\n");
++
++  if ((orient ^ Orientation) & 1)
++  {
++    width  = PageLength;
++    length = PageWidth;
++  }
++  else
++  {
++    width  = PageWidth;
++    length = PageLength;
++  }
++
++  switch (orient & 3)
++  {
++    case 1 : /* Landscape */
++        doc_printf(doc, "%.1f 0.0 translate 90 rotate\n", length);
++        break;
++    case 2 : /* Reverse Portrait */
++        doc_printf(doc, "%.1f %.1f translate 180 rotate\n", width, length);
++        break;
++    case 3 : /* Reverse Landscape */
++        doc_printf(doc, "0.0 %.1f translate -90 rotate\n", width);
++        break;
++  }
++
++  doc_puts(doc, "ESPwl\n");
++  doc_puts(doc, "grestore\n");
++}
++
++
++/*
++ * End of "$Id: pstops.c 5622 2006-06-01 23:43:21Z mike $".
+  */
+diff -urNad cupsys-1.2.1~/filter/raster.c cupsys-1.2.1/filter/raster.c
+--- cupsys-1.2.1~/filter/raster.c	2006-05-15 05:02:15.000000000 +0000
++++ cupsys-1.2.1/filter/raster.c	2006-07-18 11:27:13.000000000 +0000
+@@ -34,23 +34,25 @@
+  *
+  * Contents:
+  *
+- *   cupsRasterClose()        - Close a raster stream.
+- *   cupsRasterOpen()         - Open a raster stream.
+- *   cupsRasterReadHeader()   - Read a raster page header and store it in a
+- *                              V1 page header structure.
+- *   cupsRasterReadHeader2()  - Read a raster page header and store it in a
+- *                              V2 page header structure.
+- *   cupsRasterReadPixels()   - Read raster pixels.
+- *   cupsRasterWriteHeader()  - Write a raster page header from a V1 page
+- *                              header structure.
+- *   cupsRasterWriteHeader2() - Write a raster page header from a V2 page
+- *                              header structure.
+- *   cupsRasterWritePixels()  - Write raster pixels.
+- *   cups_raster_update()     - Update the raster header and row count for the
+- *                              current page.
+- *   cups_raster_write()      - Write a row of raster data...
+- *   cups_read()              - Read bytes from a file.
+- *   cups_write()             - Write bytes to a file.
++ *   cupsRasterClose()         - Close a raster stream.
++ *   cupsRasterOpen()          - Open a raster stream.
++ *   cupsRasterReadHeader()    - Read a raster page header and store it in a
++ *                               V1 page header structure.
++ *   cupsRasterReadHeader2()   - Read a raster page header and store it in a
++ *                               V2 page header structure.
++ *   cupsRasterReadPixels()    - Read raster pixels.
++ *   cupsRasterWriteHeader()   - Write a raster page header from a V1 page
++ *                               header structure.
++ *   cupsRasterWriteHeader2()  - Write a raster page header from a V2 page
++ *                               header structure.
++ *   cupsRasterWritePixels()   - Write raster pixels.
++ *   cups_raster_read()        - Read through the raster buffer.
++ *   cups_raster_read_header() - Read a raster page header.
++ *   cups_raster_update()      - Update the raster header and row count for the
++ *                               current page.
++ *   cups_read()               - Read bytes from a file.
++ *   cups_swap()               - Swap bytes in raster data...
++ *   cups_write()              - Write bytes to a file.
+  */
+ 
+ /*
+@@ -58,7 +60,7 @@
+  */
+ 
+ #include "raster.h"
+-#include <stdio.h>
++#include <cups/debug.h>
+ #include <stdlib.h>
+ #include <errno.h>
+ #include <cups/string.h>
+@@ -86,16 +88,25 @@
+   unsigned char		*pixels,	/* Pixels for current row */
+ 			*pend,		/* End of pixel buffer */
+ 			*pcurrent;	/* Current byte in pixel buffer */
++  int			compressed,	/* Non-zero if data is compressed */
++			swapped;	/* Non-zero if data is byte-swapped */
++  unsigned char		*buffer,	/* Read/write buffer */
++			*bufptr,	/* Current (read) position in buffer */
++			*bufend;	/* End of current (read) buffer */
++  int			bufsize;	/* Buffer size */
+ };
+ 
++
+ /*
+  * Local functions...
+  */
+ 
+ static unsigned	cups_raster_read_header(cups_raster_t *r);
++static int	cups_raster_read(cups_raster_t *r, unsigned char *buf,
++		                 int bytes);
+ static void	cups_raster_update(cups_raster_t *r);
+-static int	cups_raster_write(cups_raster_t *r);
+ static int	cups_read(int fd, unsigned char *buf, int bytes);
++static void	cups_swap(unsigned char *buf, int bytes);
+ static int	cups_write(int fd, const unsigned char *buf, int bytes);
+ 
+ 
+@@ -108,6 +119,9 @@
+ {
+   if (r != NULL)
+   {
++    if (r->buffer)
++      free(r->buffer);
++
+     if (r->pixels)
+       free(r->pixels);
+ 
+@@ -139,8 +153,7 @@
+     * Open for read - get sync word...
+     */
+ 
+-    if (cups_read(r->fd, (unsigned char *)&(r->sync), sizeof(r->sync))
+-            < sizeof(r->sync))
++    if (!cups_read(r->fd, (unsigned char *)&(r->sync), sizeof(r->sync)))
+     {
+       free(r);
+       return (NULL);
+@@ -149,11 +162,22 @@
+     if (r->sync != CUPS_RASTER_SYNC &&
+         r->sync != CUPS_RASTER_REVSYNC &&
+         r->sync != CUPS_RASTER_SYNCv1 &&
+-        r->sync != CUPS_RASTER_REVSYNCv1)
++        r->sync != CUPS_RASTER_REVSYNCv1 &&
++        r->sync != CUPS_RASTER_SYNCv2 &&
++        r->sync != CUPS_RASTER_REVSYNCv2)
+     {
+       free(r);
+       return (NULL);
+     }
++
++    if (r->sync == CUPS_RASTER_SYNCv2 ||
++        r->sync == CUPS_RASTER_REVSYNCv2)
++      r->compressed = 1;
++
++    if (r->sync == CUPS_RASTER_REVSYNC ||
++        r->sync == CUPS_RASTER_REVSYNCv1 ||
++        r->sync == CUPS_RASTER_REVSYNCv2)
++      r->swapped = 1;
+   }
+   else
+   {
+@@ -162,6 +186,7 @@
+     */
+ 
+     r->sync = CUPS_RASTER_SYNC;
++
+     if (cups_write(r->fd, (unsigned char *)&(r->sync), sizeof(r->sync))
+             < sizeof(r->sync))
+     {
+@@ -240,15 +265,51 @@
+ 		     unsigned      len)	/* I - Number of bytes to read */
+ {
+   int		bytes;			/* Bytes read */
++  unsigned	cupsBytesPerLine;	/* cupsBytesPerLine value */
+   unsigned	remaining;		/* Bytes remaining */
+   unsigned char	*ptr,			/* Pointer to read buffer */
+-		byte;			/* Byte from file */
++		byte,			/* Byte from file */
++		*temp;			/* Pointer into buffer */
++  int		count;			/* Repetition count */
+ 
+ 
+   if (r == NULL || r->mode != CUPS_RASTER_READ || r->remaining == 0)
+     return (0);
+ 
+-  remaining = len;
++  if (!r->compressed)
++  {
++   /*
++    * Read without compression...
++    */
++
++    r->remaining -= len / r->header.cupsBytesPerLine;
++
++    if (!cups_read(r->fd, p, len))
++      return (0);
++
++   /*
++    * Swap bytes as needed...
++    */
++
++    if ((r->header.cupsBitsPerColor == 16 ||
++         r->header.cupsBitsPerPixel == 12 ||
++         r->header.cupsBitsPerPixel == 16) &&
++        r->swapped)
++      cups_swap(p, len);
++
++   /*
++    * Return...
++    */
++
++    return (len);
++  }
++
++ /*
++  * Read compressed data...
++  */
++
++  remaining        = len;
++  cupsBytesPerLine = r->header.cupsBytesPerLine;
+ 
+   while (remaining > 0 && r->remaining > 0)
+   {
+@@ -258,127 +319,99 @@
+       * Need to read a new row...
+       */
+ 
+-      if (remaining == r->header.cupsBytesPerLine)
++      if (remaining == cupsBytesPerLine)
+ 	ptr = p;
+       else
+ 	ptr = r->pixels;
+ 
+-      if (r->sync == CUPS_RASTER_SYNCv1 || r->sync == CUPS_RASTER_REVSYNCv1)
+-      {
+-       /*
+-	* Read without compression...
+-	*/
++     /*
++      * Read using a modified TIFF "packbits" compression...
++      */
+ 
+-        if (cups_read(r->fd, ptr, r->header.cupsBytesPerLine) <
+-	        r->header.cupsBytesPerLine)
+-	  return (0);
++      if (!cups_raster_read(r, &byte, 1))
++	return (0);
+ 
+-        r->count = 1;
+-      }
+-      else
++      r->count = byte + 1;
++
++      if (r->count > 1)
++	ptr = r->pixels;
++
++      temp  = ptr;
++      bytes = cupsBytesPerLine;
++
++      while (bytes > 0)
+       {
+        /*
+-        * Read using a modified TIFF "packbits" compression...
++	* Get a new repeat count...
+ 	*/
+ 
+-        unsigned char	*temp;		/* Pointer into buffer */
+-	int		count;		/* Repetition count */
+-
+-
+-        if (cups_read(r->fd, &byte, 1) < 1)
++        if (!cups_raster_read(r, &byte, 1))
+ 	  return (0);
+ 
+-        r->count = byte + 1;
+-
+-        if (r->count > 1)
+-	  ptr = r->pixels;
+-
+-        temp  = ptr;
+-	bytes = r->header.cupsBytesPerLine;
+-
+-	while (bytes > 0)
++	if (byte & 128)
+ 	{
+ 	 /*
+-	  * Get a new repeat count...
++	  * Copy N literal pixels...
+ 	  */
+ 
+-          if (cups_read(r->fd, &byte, 1) < 1)
+-	    return (0);
+-
+-	  if (byte & 128)
+-	  {
+-	   /*
+-	    * Copy N literal pixels...
+-	    */
++	  count = (257 - byte) * r->bpp;
+ 
+-	    count = (257 - byte) * r->bpp;
++          if (count > bytes)
++	    count = bytes;
+ 
+-            if (count > bytes)
+-	      count = bytes;
++          if (!cups_raster_read(r, temp, count))
++	    return (0);
+ 
+-            if (cups_read(r->fd, temp, count) < count)
+-	      return (0);
++	  temp  += count;
++	  bytes -= count;
++	}
++	else
++	{
++	 /*
++	  * Repeat the next N bytes...
++	  */
+ 
+-	    temp  += count;
+-	    bytes -= count;
+-	  }
+-	  else
+-	  {
+-	   /*
+-	    * Repeat the next N bytes...
+-	    */
++          count = (byte + 1) * r->bpp;
++          if (count > bytes)
++	    count = bytes;
+ 
+-            count = (byte + 1) * r->bpp;
+-            if (count > bytes)
+-	      count = bytes;
++          if (count < r->bpp)
++	    break;
+ 
+-            if (count < r->bpp)
+-	      break;
++	  bytes -= count;
+ 
+-	    bytes -= count;
++          if (!cups_raster_read(r, temp, r->bpp))
++	    return (0);
+ 
+-            if (cups_read(r->fd, temp, r->bpp) < r->bpp)
+-	      return (0);
++	  temp  += r->bpp;
++	  count -= r->bpp;
+ 
++	  while (count > 0)
++	  {
++	    memcpy(temp, temp - r->bpp, r->bpp);
+ 	    temp  += r->bpp;
+ 	    count -= r->bpp;
+-
+-	    while (count > 0)
+-	    {
+-	      memcpy(temp, temp - r->bpp, r->bpp);
+-	      temp  += r->bpp;
+-	      count -= r->bpp;
+-            }
+-	  }
++          }
+ 	}
+       }
+ 
++     /*
++      * Swap bytes as needed...
++      */
++
+       if ((r->header.cupsBitsPerColor == 16 ||
+            r->header.cupsBitsPerPixel == 12 ||
+            r->header.cupsBitsPerPixel == 16) &&
+-          (r->sync == CUPS_RASTER_REVSYNC || r->sync == CUPS_RASTER_REVSYNCv1))
+-      {
+-       /*
+-	* Swap bytes in the pixel data...
+-	*/
+-
+-        unsigned char	*temp;
+-	int		count;
+-
++          r->swapped)
++        cups_swap(ptr, bytes);
+ 
+-        for (temp = ptr, count = r->header.cupsBytesPerLine;
+-	     count > 0;
+-	     temp += 2, count -= 2)
+-	{
+-	  byte    = temp[0];
+-	  temp[0] = temp[1];
+-	  temp[1] = byte;
+-	}
+-      }
++     /*
++      * Update pointers...
++      */
+ 
+-      if (remaining >= r->header.cupsBytesPerLine)
++      if (remaining >= cupsBytesPerLine)
+       {
+-	bytes       = r->header.cupsBytesPerLine;
++	bytes       = cupsBytesPerLine;
+         r->pcurrent = r->pixels;
+ 	r->count --;
+ 	r->remaining --;
+@@ -389,6 +422,10 @@
+         r->pcurrent = r->pixels + bytes;
+       }
+ 
++     /*
++      * Copy data as needed...
++      */
++
+       if (ptr != p)
+         memcpy(p, ptr, bytes);
+     }
+@@ -494,10 +531,6 @@
+                       unsigned char *p,	/* I - Bytes to write */
+ 		      unsigned      len)/* I - Number of bytes to write */
+ {
+-  int		bytes;			/* Bytes read */
+-  unsigned	remaining;		/* Bytes remaining */
+-
+-
+ #ifdef DEBUG
+   fprintf(stderr, "cupsRasterWritePixels(r=%p, p=%p, len=%u), remaining=%u\n",
+           r, p, len, r->remaining);
+@@ -506,99 +539,13 @@
+   if (r == NULL || r->mode != CUPS_RASTER_WRITE || r->remaining == 0)
+     return (0);
+ 
+-  for (remaining = len; remaining > 0; remaining -= bytes, p += bytes)
+-
+-  {
+-   /*
+-    * Figure out the number of remaining bytes on the current line...
+-    */
+-
+-    if ((bytes = remaining) > (r->pend - r->pcurrent))
+-      bytes = r->pend - r->pcurrent;
+-
+-    if (r->count > 0)
+-    {
+-     /*
+-      * Check to see if this line is the same as the previous line...
+-      */
+-
+-      if (memcmp(p, r->pcurrent, bytes))
+-      {
+-        if (!cups_raster_write(r))
+-	  return (0);
+-
+-	r->count = 0;
+-      }
+-      else
+-      {
+-       /*
+-        * Mark more bytes as the same...
+-	*/
+-
+-        r->pcurrent += bytes;
+-
+-	if (r->pcurrent >= r->pend)
+-	{
+-	 /*
+-          * Increase the repeat count...
+-	  */
+-
+-	  r->count ++;
+-	  r->pcurrent = r->pixels;
+-
+-	 /*
+-          * Flush out this line if it is the last one...
+-	  */
+-
+-	  r->remaining --;
+-
+-	  if (r->remaining == 0)
+-	    return (cups_raster_write(r));
+-	  else if (r->count == 256)
+-	  {
+-	    if (cups_raster_write(r) == 0)
+-	      return (0);
+-
+-	    r->count = 0;
+-	  }
+-	}
+-
+-	continue;
+-      }
+-    }
+-
+-    if (r->count == 0)
+-    {
+-     /*
+-      * Copy the raster data to the buffer...
+-      */
+-
+-      memcpy(r->pcurrent, p, bytes);
+-
+-      r->pcurrent += bytes;
+-
+-      if (r->pcurrent >= r->pend)
+-      {
+-       /*
+-        * Increase the repeat count...
+-	*/
+-
+-	r->count ++;
+-	r->pcurrent = r->pixels;
+-
+-       /*
+-        * Flush out this line if it is the last one...
+-	*/
+-
+-	r->remaining --;
++ /*
++  * No write compression, just write the raster data raw...
++  */
+ 
+-	if (r->remaining == 0)
+-	  return (cups_raster_write(r));
+-      }
+-    }
+-  }
++  r->remaining -= len / r->header.cupsBytesPerLine;
+ 
+-  return (len);
++  return (cups_write(r->fd, p, len));
+ }
+ 
+ 
+@@ -636,14 +583,14 @@
+ 
+   memset(&(r->header), 0, sizeof(r->header));
+ 
+-  if (cups_read(r->fd, (unsigned char *)&(r->header), len) < len)
++  if (cups_raster_read(r, (unsigned char *)&(r->header), len) < len)
+     return (0);
+ 
+  /*
+   * Swap bytes as needed...
+   */
+ 
+-  if (r->sync == CUPS_RASTER_REVSYNC || r->sync == CUPS_RASTER_REVSYNCv1)
++  if (r->swapped)
+     for (len = 81, s = (union swap_s *)&(r->header.AdvanceDistance);
+ 	 len > 0;
+ 	 len --, s ++)
+@@ -660,6 +607,144 @@
+ 
+ 
+ /*
++ * 'cups_raster_read()' - Read through the raster buffer.
++ */
++
++static int				/* O - Number of bytes read */
++cups_raster_read(cups_raster_t *r,	/* I - Raster stream */
++                 unsigned char *buf,	/* I - Buffer */
++                 int           bytes)	/* I - Number of bytes to read */
++{
++  int		count,			/* Number of bytes read */
++		remaining,		/* Remaining bytes in buffer */
++		total;			/* Total bytes read */
++
++
++  DEBUG_printf(("cups_raster_read(r=%p, buf=%p, bytes=%d)\n", r, buf, bytes));
++
++  if (!r->compressed)
++    return (cups_read(r->fd, buf, bytes));
++
++ /*
++  * Allocate a read buffer as needed...
++  */
++
++  count = 2 * r->header.cupsBytesPerLine;
++
++  if (count > r->bufsize)
++  {
++    int offset = r->bufptr - r->buffer;	/* Offset to current start of buffer */
++    int end = r->bufend - r->buffer;	/* Offset to current end of buffer */
++    unsigned char *rptr;		/* Pointer in read buffer */
++
++    if (r->buffer)
++      rptr = realloc(r->buffer, count);
++    else
++      rptr = malloc(count);
++
++    if (!rptr)
++      return (0);
++
++    r->buffer  = rptr;
++    r->bufptr  = rptr + offset;
++    r->bufend  = rptr + end;
++    r->bufsize = count;
++  }
++
++ /*
++  * Loop until we have read everything...
++  */
++
++  for (total = 0, remaining = r->bufend - r->bufptr;
++       total < bytes;
++       total += count, buf += count)
++  {
++    count = bytes - total;
++
++    DEBUG_printf(("count=%d, remaining=%d, buf=%p, bufptr=%p, bufend=%p...\n",
++                  count, remaining, buf, r->bufptr, r->bufend));
++
++    if (remaining == 0)
++    {
++      if (count < 16)
++      {
++       /*
++        * Read into the raster buffer and then copy...
++	*/
++
++        remaining = cups_read(r->fd, r->buffer, r->bufsize);
++	if (remaining <= 0)
++	  return (0);
++
++	r->bufptr = r->buffer;
++	r->bufend = r->buffer + remaining;
++      }
++      else
++      {
++       /*
++        * Read directly into "buf"...
++	*/
++
++	count = cups_read(r->fd, buf, count);
++
++	if (count <= 0)
++	  return (0);
++
++	continue;
++      }
++    }
++
++   /*
++    * Copy bytes from raster buffer to "buf"...
++    */
++
++    if (count > remaining)
++      count = remaining;
++
++    if (count == 1)
++    {
++     /*
++      * Copy 1 byte...
++      */
++
++      *buf = *(r->bufptr)++;
++      remaining --;
++    }
++    else if (count < 128)
++    {
++     /*
++      * Copy up to 127 bytes without using memcpy(); this is
++      * faster because it avoids an extra function call and is
++      * often further optimized by the compiler...
++      */
++
++      unsigned char	*bufptr;	/* Temporary buffer pointer */
++
++
++      remaining -= count;
++
++      for (bufptr = r->bufptr; count > 0; count --, total ++)
++	*buf++ = *bufptr++;
++
++      r->bufptr = bufptr;
++    }
++    else
++    {
++     /*
++      * Use memcpy() for a large read...
++      */
++
++      memcpy(buf, r->bufptr, count);
++      r->bufptr += count;
++      remaining -= count;
++    }
++  }
++
++  return (total);
++}
++
++
++/*
+  * 'cups_raster_update()' - Update the raster header and row count for the
+  *                          current page.
+  */
+@@ -745,159 +830,19 @@
+     r->remaining = r->header.cupsHeight;
+ 
+  /*
+-  * Allocate the read/write buffer...
+-  */
+-
+-  if (r->pixels != NULL)
+-    free(r->pixels);
+-
+-  r->pixels   = calloc(r->header.cupsBytesPerLine, 1);
+-  r->pcurrent = r->pixels;
+-  r->pend     = r->pixels + r->header.cupsBytesPerLine;
+-  r->count    = 0;
+-}
+-
+-
+-/*
+- * 'cups_raster_write()' - Write a row of raster data...
+- */
+-
+-static int				/* O - Number of bytes written */
+-cups_raster_write(cups_raster_t *r)	/* I - Raster stream */
+-{
+-  unsigned char	*start,			/* Start of sequence */
+-		*ptr,			/* Current pointer in sequence */
+-		byte;			/* Byte to write */
+-  int		count;			/* Count */
+-
+-
+-#ifdef DEBUG
+-  fprintf(stderr, "cups_raster_write(r=%p)\n", r);
+-#endif /* DEBUG */
+-
+- /*
+-  * Write the row repeat count...
+-  */
+-
+-  byte = r->count - 1;
+-
+-  if (cups_write(r->fd, &byte, 1) < 1)
+-  {
+-#ifdef DEBUG
+-    fputs("cups_raster_write: Unable to write row repeat count...\n",
+-          stderr);
+-#endif /* DEBUG */
+-
+-    return (0);
+-  }
+-
+- /*
+-  * Write using a modified TIFF "packbits" compression...
++  * Allocate the compression buffer...
+   */
+ 
+-  for (ptr = r->pixels; ptr < r->pend;)
++  if (r->compressed)
+   {
+-    start = ptr;
+-    ptr += r->bpp;
+-
+-    if (ptr == r->pend)
+-    {
+-     /*
+-      * Encode a single pixel at the end...
+-      */
+-
+-      byte = 0;
+-      if (cups_write(r->fd, &byte, 1) < 1)
+-      {
+-#ifdef DEBUG
+-        fputs("cups_raster_write: Unable to write last pixel count...\n", stderr);
+-#endif /* DEBUG */
+-
+-        return (0);
+-      }
+-
+-      if (cups_write(r->fd, start, r->bpp) < r->bpp)
+-      {
+-#ifdef DEBUG
+-        fputs("cups_raster_write: Unable to write last pixel data...\n", stderr);
+-#endif /* DEBUG */
+-
+-        return (0);
+-      }
+-    }
+-    else if (!memcmp(start, ptr, r->bpp))
+-    {
+-     /*
+-      * Encode a sequence of repeating pixels...
+-      */
+-
+-      for (count = 2; count < 128 && ptr < (r->pend - r->bpp); count ++, ptr += r->bpp)
+-        if (memcmp(ptr, ptr + r->bpp, r->bpp) != 0)
+-	  break;
+-
+-      ptr += r->bpp;
+-
+-      byte = count - 1;
+-
+-      if (cups_write(r->fd, &byte, 1) < 1)
+-      {
+-#ifdef DEBUG
+-        fputs("cups_raster_write: Unable to write repeated pixel count...\n", stderr);
+-#endif /* DEBUG */
+-
+-        return (0);
+-      }
+-
+-      if (cups_write(r->fd, start, r->bpp) < r->bpp)
+-      {
+-#ifdef DEBUG
+-        fputs("cups_raster_write: Unable to write repeated pixel data...\n", stderr);
+-#endif /* DEBUG */
+-
+-        return (0);
+-      }
+-    }
+-    else
+-    {
+-     /*
+-      * Encode a sequence of non-repeating pixels...
+-      */
+-
+-      for (count = 1; count < 127 && ptr < (r->pend - r->bpp); count ++, ptr += r->bpp)
+-        if (!memcmp(ptr, ptr + r->bpp, r->bpp))
+-	  break;
+-
+-      if (ptr >= (r->pend - r->bpp) && count < 128)
+-      {
+-        count ++;
+-	ptr += r->bpp;
+-      }
+- 
+-      byte = 257 - count;
+-
+-      if (cups_write(r->fd, &byte, 1) < 1)
+-      {
+-#ifdef DEBUG
+-        fputs("cups_raster_write: Unable to write non-repeating pixel count...\n", stderr);
+-#endif /* DEBUG */
+-
+-        return (0);
+-      }
+-
+-      count *= r->bpp;
+-
+-      if (cups_write(r->fd, start, count) < count)
+-      {
+-#ifdef DEBUG
+-        fputs("cups_raster_write: Unable to write non-repeating pixel data...\n", stderr);
+-#endif /* DEBUG */
++    if (r->pixels != NULL)
++      free(r->pixels);
+ 
+-        return (0);
+-      }
+-    }
++    r->pixels   = calloc(r->header.cupsBytesPerLine, 1);
++    r->pcurrent = r->pixels;
++    r->pend     = r->pixels + r->header.cupsBytesPerLine;
++    r->count    = 0;
+   }
+-
+-  return (r->header.cupsBytesPerLine);
+ }
+ 
+ 
+@@ -934,6 +879,32 @@
+ 
+ 
+ /*
++ * 'cups_swap()' - Swap bytes in raster data...
++ */
++
++static void
++cups_swap(unsigned char *buf,		/* I - Buffer to swap */
++          int           bytes)		/* I - Number of bytes to swap */
++{
++  unsigned char	even, odd;		/* Temporary variables */
++
++
++  bytes /= 2;
++
++  while (bytes > 0)
++  {
++    even   = buf[0];
++    odd    = buf[1];
++    buf[0] = odd;
++    buf[1] = even;
++
++    buf += 2;
++    bytes --;
++  }
++}
++
++
++/*
+  * 'cups_write()' - Write bytes to a file.
+  */
+ 
+diff -urNad cupsys-1.2.1~/filter/raster.h cupsys-1.2.1/filter/raster.h
+--- cupsys-1.2.1~/filter/raster.h	2006-05-12 15:06:42.000000000 +0000
++++ cupsys-1.2.1/filter/raster.h	2006-07-18 11:27:13.000000000 +0000
+@@ -60,12 +60,15 @@
+  * Constants...
+  */
+ 
+-#  define CUPS_RASTER_SYNC	0x52615332	/* RaS2 */
+-#  define CUPS_RASTER_REVSYNC	0x32536152	/* 2SaR */
++#  define CUPS_RASTER_SYNC	0x52615333	/* RaS3 */
++#  define CUPS_RASTER_REVSYNC	0x33536152	/* 3SaR */
+ 
+ #  define CUPS_RASTER_SYNCv1	0x52615374	/* RaSt */
+ #  define CUPS_RASTER_REVSYNCv1	0x74536152	/* tSaR */
+ 
++#  define CUPS_RASTER_SYNCv2	0x52615332	/* RaS2 */
++#  define CUPS_RASTER_REVSYNCv2	0x32536152	/* 2SaR */
++
+ 
+ /*
+  * The following definition can be used to determine if the
+diff -urNad cupsys-1.2.1~/filter/rasterbench.c cupsys-1.2.1/filter/rasterbench.c
+--- cupsys-1.2.1~/filter/rasterbench.c	1970-01-01 00:00:00.000000000 +0000
++++ cupsys-1.2.1/filter/rasterbench.c	2006-07-18 11:27:13.000000000 +0000
+@@ -0,0 +1,355 @@
++/*
++ * "$Id$"
++ *
++ *   Raster benchmark program for the Common UNIX Printing System (CUPS).
++ *
++ *   Copyright 1997-2006 by Easy Software Products.
++ *
++ *   These coded instructions, statements, and computer programs are the
++ *   property of Easy Software Products and are protected by Federal
++ *   copyright law.  Distribution and use rights for the CUPS Raster source
++ *   files are outlined in the GNU Library General Public License, located
++ *   in the "pstoraster" directory.  If this file is missing or damaged
++ *   please contact Easy Software Products at:
++ *
++ *       Attn: CUPS Licensing Information
++ *       Easy Software Products
++ *       44141 Airport View Drive, Suite 204
++ *       Hollywood, Maryland 20636 USA
++ *
++ *       Voice: (301) 373-9600
++ *       EMail: cups-info at cups.org
++ *         WWW: http://www.cups.org
++ *
++ *   This code and any derivative of it may be used and distributed
++ *   freely under the terms of the GNU General Public License when
++ *   used with GNU Ghostscript or its derivatives.  Use of the code
++ *   (or any derivative of it) with software other than GNU
++ *   GhostScript (or its derivatives) is governed by the CUPS license
++ *   agreement.
++ *
++ *   This file is subject to the Apple OS-Developed Software exception.
++ *
++ * Contents:
++ *
++ *   main()           - Benchmark the raster read/write functions.
++ *   compute_median() - Compute the median time for a test.
++ *   read_test()      - Benchmark the raster read functions.
++ *   write_test()     - Benchmark the raster write functions.
++ */
++
++/*
++ * Include necessary headers...
++ */
++
++#include "raster.h"
++#include <stdlib.h>
++#include <sys/time.h>
++#include <signal.h>
++#include <unistd.h>
++#include <sys/wait.h>
++
++
++/*
++ * Constants...
++ */
++
++#define TEST_WIDTH	1024
++#define TEST_HEIGHT	1024
++#define TEST_PAGES	16
++#define TEST_PASSES	20
++
++
++/*
++ * Local functions...
++ */
++
++static double	compute_median(double *secs);
++static double	get_time(void);
++static void	read_test(int fd);
++static int	run_read_test(void);
++static void	write_test(int fd);
++
++
++/*
++ * 'main()' - Benchmark the raster read/write functions.
++ */
++
++int					/* O - Exit status */
++main(void)
++{
++  int		i;			/* Looping var */
++  int		ras_fd,			/* File descriptor for read process */
++		status;			/* Exit status of read process */
++  double	start_secs,		/* Start time */
++		write_secs,		/* Write time */
++		read_secs,		/* Read time */
++		pass_secs[TEST_PASSES];	/* Total test times */
++
++
++ /*
++  * Ignore SIGPIPE...
++  */
++
++  signal(SIGPIPE, SIG_IGN);
++
++ /*
++  * Run the tests several times to get a good average...
++  */
++
++  printf("Test read/write speed of %d pages, %dx%d pixels...\n\n",
++         TEST_PAGES, TEST_WIDTH, TEST_HEIGHT);
++  for (i = 0; i < TEST_PASSES; i ++)
++  {
++    printf("PASS %2d: ", i + 1);
++    fflush(stdout);
++
++    ras_fd     = run_read_test();
++    start_secs = get_time();
++
++    write_test(ras_fd);
++
++    write_secs = get_time();
++    printf(" %.3f write,", write_secs - start_secs);
++    fflush(stdout);
++
++    close(ras_fd);
++    wait(&status);
++
++    read_secs    = get_time();
++    pass_secs[i] = read_secs - start_secs;
++    printf(" %.3f read, %.3f total\n", read_secs - write_secs, pass_secs[i]);
++  }
++
++  printf("\nMedian Total Time: %.3f seconds per document\n",
++         compute_median(pass_secs));
++
++  return (0);
++}
++
++
++/*
++ * 'compute_median()' - Compute the median time for a test.
++ */
++
++static double				/* O - Median time in seconds */
++compute_median(double *secs)		/* I - Array of time samples */
++{
++  int		i, j;			/* Looping vars */
++  double	temp;			/* Swap variable */
++
++
++ /*
++  * Sort the array into ascending order using a quicky bubble sort...
++  */
++
++  for (i = 0; i < (TEST_PASSES - 1); i ++)
++    for (j = i + 1; j < TEST_PASSES; j ++)
++      if (secs[i] > secs[j])
++      {
++        temp    = secs[i];
++	secs[i] = secs[j];
++	secs[j] = temp;
++      }
++
++ /*
++  * Return the average of the middle two samples...
++  */
++
++  return (0.5 * (secs[TEST_PASSES / 2 - 1] + secs[TEST_PASSES / 2]));
++}
++
++
++/*
++ * 'get_time()' - Get the current time in seconds.
++ */
++
++static double				/* O - Time in seconds */
++get_time(void)
++{
++  struct timeval	curtime;	/* Current time */
++
++
++  gettimeofday(&curtime, NULL);
++  return (curtime.tv_sec + 0.000001 * curtime.tv_usec);
++}
++
++
++/*
++ * 'read_test()' - Benchmark the raster read functions.
++ */
++
++static void
++read_test(int fd)			/* I - File descriptor to read from */
++{
++  int			y;		/* Looping var */
++  cups_raster_t		*r;		/* Raster stream */
++  cups_page_header_t	header;		/* Page header */
++  unsigned char		buffer[8 * TEST_WIDTH];
++					/* Read buffer */
++
++
++ /*
++  * Test read speed...
++  */
++
++  if ((r = cupsRasterOpen(fd, CUPS_RASTER_READ)) == NULL)
++  {
++    perror("Unable to create raster input stream");
++    return;
++  }
++
++  while (cupsRasterReadHeader(r, &header))
++  {
++    for (y = 0; y < header.cupsHeight; y ++)
++      cupsRasterReadPixels(r, buffer, header.cupsBytesPerLine);
++  }
++
++  cupsRasterClose(r);
++}
++
++
++/*
++ * 'run_read_test()' - Run the read test as a child process via pipes.
++ */
++
++static int				/* O - Standard input of child */
++run_read_test(void)
++{
++  int	ras_pipes[2];			/* Raster data pipes */
++  int	pid;				/* Child process ID */
++
++
++  if (pipe(ras_pipes))
++    return (-1);
++
++  if ((pid = fork()) < 0)
++  {
++   /*
++    * Fork error - return -1 on error...
++    */
++
++    close(ras_pipes[0]);
++    close(ras_pipes[1]);
++
++    return (-1);
++  }
++  else if (pid == 0)
++  {
++   /*
++    * Child comes here - read data from the input pipe...
++    */
++
++    close(ras_pipes[1]);
++    read_test(ras_pipes[0]);
++    exit(0);
++  }
++  else
++  {
++   /*
++    * Parent comes here - return the output pipe...
++    */
++
++    close(ras_pipes[0]);
++    return (ras_pipes[1]);
++  }
++}
++
++
++/*
++ * 'write_test()' - Benchmark the raster write functions.
++ */
++
++static void
++write_test(int fd)			/* I - File descriptor to write to */
++{
++  int			page, x, y;	/* Looping vars */
++  int			count;		/* Number of bytes to set */
++  cups_raster_t		*r;		/* Raster stream */
++  cups_page_header_t	header;		/* Page header */
++  unsigned char		data[32][8 * TEST_WIDTH];
++					/* Raster data to write */
++
++
++ /*
++  * Create a combination of random data and repeated data to simulate
++  * text with some whitespace.
++  */
++
++  srand(time(NULL));
++
++  memset(data, 0, sizeof(data));
++
++  for (y = 0; y < 28; y ++)
++  {
++    for (x = rand() & 127, count = (rand() & 15) + 1;
++         x < sizeof(data[0]);
++         x ++, count --)
++    {
++      if (count <= 0)
++      {
++	x     += (rand() & 15) + 1;
++	count = (rand() & 15) + 1;
++
++        if (x >= sizeof(data[0]))
++	  break;
++      }
++
++      data[y][x] = rand();
++    }
++  }
++
++ /*
++  * Test write speed...
++  */
++
++  if ((r = cupsRasterOpen(fd, CUPS_RASTER_WRITE)) == NULL)
++  {
++    perror("Unable to create raster output stream");
++    return;
++  }
++
++  for (page = 0; page < TEST_PAGES; page ++)
++  {
++    memset(&header, 0, sizeof(header));
++    header.cupsWidth        = TEST_WIDTH;
++    header.cupsHeight       = TEST_HEIGHT;
++    header.cupsBytesPerLine = TEST_WIDTH;
++
++    if (page & 1)
++    {
++      header.cupsBytesPerLine *= 4;
++      header.cupsColorSpace = CUPS_CSPACE_CMYK;
++      header.cupsColorOrder = CUPS_ORDER_CHUNKED;
++    }
++    else
++    {
++      header.cupsColorSpace = CUPS_CSPACE_K;
++      header.cupsColorOrder = CUPS_ORDER_BANDED;
++    }
++
++    if (page & 2)
++    {
++      header.cupsBytesPerLine *= 2;
++      header.cupsBitsPerColor = 16;
++      header.cupsBitsPerPixel = (page & 1) ? 64 : 16;
++    }
++    else
++    {
++      header.cupsBitsPerColor = 8;
++      header.cupsBitsPerPixel = (page & 1) ? 32 : 8;
++    }
++
++    cupsRasterWriteHeader(r, &header);
++
++    for (y = 0; y < TEST_HEIGHT; y ++)
++      cupsRasterWritePixels(r, data[y & 31], header.cupsBytesPerLine);
++  }
++
++  cupsRasterClose(r);
++}
++
++
++/*
++ * End of "$Id$".
++ */
+diff -urNad cupsys-1.2.1~/filter/rastertolabel.c cupsys-1.2.1/filter/rastertolabel.c
+--- cupsys-1.2.1~/filter/rastertolabel.c	2006-03-13 16:41:45.000000000 +0000
++++ cupsys-1.2.1/filter/rastertolabel.c	2006-07-18 11:27:13.000000000 +0000
+@@ -352,6 +352,8 @@
+         printf("! 0 %u %u %u %u\r\n", header->HWResolution[0],
+ 	       header->HWResolution[1], header->cupsHeight,
+ 	       header->NumCopies);
++	printf("PAGE-WIDTH %d\r\n", header->cupsWidth);
++	printf("PAGE-HEIGHT %d\r\n", header->cupsWidth);
+         break;
+   }
+ 
+@@ -588,7 +590,10 @@
+         * Print the label...
+ 	*/
+ 
+-        puts("FORM\r");
++	if ((choice = ppdFindMarkedChoice(ppd, "zeMediaTracking")) == NULL ||
++	    strcmp(choice->choice, "Continuous"))
++          puts("FORM\r");
++
+ 	puts("PRINT\r");
+ 	break;
+   }
+@@ -647,7 +652,7 @@
+ {
+   int		i;			/* Looping var */
+   unsigned char	*ptr;			/* Pointer into buffer */
+-  char		*compptr;		/* Pointer into compression buffer */
++  unsigned char	*compptr;		/* Pointer into compression buffer */
+   char		repeat_char;		/* Repeated character */
+   int		repeat_count;		/* Number of repeated characters */
+   static const char *hex = "0123456789ABCDEF";
+diff -urNad cupsys-1.2.1~/locale/Makefile cupsys-1.2.1/locale/Makefile
+--- cupsys-1.2.1~/locale/Makefile	2006-04-22 04:05:45.000000000 +0000
++++ cupsys-1.2.1/locale/Makefile	2006-07-18 11:27:13.000000000 +0000
+@@ -51,7 +51,9 @@
+ # Install files...
+ #
+ 
+-install:	all
++install:	all $(INSTALL_LANGUAGES)
++
++install-languages:
+ 	$(INSTALL_DIR) -m 755 $(LOCALEDIR)
+ 	for loc in $(LANGUAGES) ; do \
+ 		if test -f cups_$$loc.po; then \
+@@ -65,12 +67,12 @@
+ # Uninstall files...
+ #
+ 
+-uninstall:
++uninstall: $(UNINSTALL_LANGUAGES)
++
++uninstall-languages:
+ 	-for loc in $(LANGUAGES) ; do \
+ 		$(RM) $(LOCALEDIR)/$$loc/cups_$$loc.po ; \
+-		$(RMDIR) $(LOCALEDIR)/$$loc ; \
+ 	done
+-	-$(RMDIR) $(LOCALEDIR)
+ 
+ 
+ #
+diff -urNad cupsys-1.2.1~/locale/cups_es.po cupsys-1.2.1/locale/cups_es.po
+--- cupsys-1.2.1~/locale/cups_es.po	2006-05-21 14:08:21.000000000 +0000
++++ cupsys-1.2.1/locale/cups_es.po	2006-07-18 11:27:13.000000000 +0000
+@@ -1,29 +1,32 @@
++#
+ # "$Id$"
+-# Message catalog template for the Common UNIX Printing System (CUPS).
+-# Copyright 2005-2006 by Easy Software Products.
+-# These coded instructions, statements, and computer programs are the
+-# property of Easy Software Products and are protected by Federal
+-# copyright law.  Distribution and use rights are outlined in the file
+-# "LICENSE.txt" which should have been included with this file.  If this
+-# file is missing or damaged please contact Easy Software Products
+-# at:
+-# Attn: CUPS Licensing Information
+-# Easy Software Products
+-# 44141 Airport View Drive, Suite 204
+-# Hollywood, Maryland 20636 USA
+-# Voice: (301) 373-9600
+-# EMail: cups-info at cups.org
+-# WWW: http://www.cups.org
+-# , fuzzy
+-# <>, 2006.
+-# 
+-# 
++#
++#   Spanish message catalog for the Common UNIX Printing System (CUPS).
++#
++#   Copyright 2005-2006 by Easy Software Products.
++#
++#   These coded instructions, statements, and computer programs are the
++#   property of Easy Software Products and are protected by Federal
++#   copyright law.  Distribution and use rights are outlined in the file
++#   "LICENSE.txt" which should have been included with this file.  If this
++#   file is missing or damaged please contact Easy Software Products
++#   at:
++#
++#       Attn: CUPS Licensing Information
++#       Easy Software Products
++#       44141 Airport View Drive, Suite 204
++#       Hollywood, Maryland 20636 USA
++#
++#       Voice: (301) 373-9600
++#       EMail: cups-info at cups.org
++#         WWW: http://www.cups.org
++#
+ msgid ""
+ msgstr ""
+ "Project-Id-Version: CUPS 1.2\n"
+ "Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
+-"POT-Creation-Date: 2006-05-21 10:08-0400\n"
+-"PO-Revision-Date: 2006-03-25 21:48+0100\n"
++"POT-Creation-Date: 2006-05-21 10:07-0400\n"
++"PO-Revision-Date: 2006-06-12 19:01+0100\n"
+ "Last-Translator: Juan Pablo González Riopedre <riopedre at tiscali.es>\n"
+ "Language-Team: Spanish\n"
+ "MIME-Version: 1.0\n"
+@@ -72,19 +75,15 @@
+ msgid "Auto"
+ msgstr "Auto"
+ 
+-msgid ""
+-"Enter your username and password or the root username and password to access "
+-"this page."
+-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."
++msgid "Enter your username and password or the root username and password to access this page."
++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."
+ 
+ msgid "You must use a https: URL to access this page."
+ msgstr "Debe escribir un URL https para acceder a esta página."
+ 
+ #, c-format
+ msgid "Bad request version number %d.%d!"
+-msgstr "Petición incorrecta de número de versión %d %d."
++msgstr "Petición incorrecta de número de versión %d.%d."
+ 
+ msgid "No attributes in request!"
+ msgstr "No hay atributos en la solicitud."
+@@ -103,11 +102,8 @@
+ msgid "The printer or class was not found."
+ msgstr "No se ha encontrado la impresora o la clase."
+ 
+-msgid ""
+-"The printer-uri must be of the form \"ipp://HOSTNAME/classes/CLASSNAME\"."
+-msgstr ""
+-"El printer-uri debe ser de la forma \"ipp://NOMBRE_ORDENADOR/classes/"
+-"NOMBRE_CLASE\"."
++msgid "The printer-uri must be of the form \"ipp://HOSTNAME/classes/CLASSNAME\"."
++msgstr "El printer-uri debe ser de la forma \"ipp://NOMBRE_ORDENADOR/classes/NOMBRE_CLASE\"."
+ 
+ #, c-format
+ msgid "The printer-uri \"%s\" contains invalid characters."
+@@ -119,9 +115,7 @@
+ 
+ #, c-format
+ msgid "Attempt to set %s printer-state to bad value %d!"
+-msgstr ""
+-"Se ha intentado cambiar el valor printer-state de %s a un valor incorrecto %"
+-"d."
++msgstr "Se ha intentado cambiar el valor printer-state de %s a un valor incorrecto %d."
+ 
+ #, c-format
+ msgid "add_class: Unknown printer-op-policy \"%s\"."
+@@ -146,29 +140,19 @@
+ msgid "The notify-user-data value is too large (%d > 63 octets)!"
+ msgstr "El valor notify-user-data es demasiado grande (%d > 63 octetos)."
+ 
+-msgid ""
+-"The notify-lease-duration attribute cannot be used with job subscriptions."
+-msgstr ""
+-"El atributo notify-lease-duration no puede ser usado con subscripciones de "
+-"trabajos."
++msgid "The notify-lease-duration attribute cannot be used with job subscriptions."
++msgstr "El atributo notify-lease-duration no puede ser usado con subscripciones de trabajos."
+ 
+-msgid ""
+-"The printer-uri must be of the form \"ipp://HOSTNAME/printers/PRINTERNAME\"."
+-msgstr ""
+-"El printer-uri debe ser de la forma \"ipp://NOMBRE_ORDENADOR/printers/"
+-"NOMBRE_IMPRESORA\"."
++msgid "The printer-uri must be of the form \"ipp://HOSTNAME/printers/PRINTERNAME\"."
++msgstr "El printer-uri debe ser de la forma \"ipp://NOMBRE_ORDENADOR/printers/NOMBRE_IMPRESORA\"."
+ 
+ #, c-format
+ msgid "A class named \"%s\" already exists!"
+ msgstr "Ya existe una clase llamada \"%s\"."
+ 
+ #, c-format
+-msgid ""
+-"File device URIs have been disabled! To enable, see the FileDevice directive "
+-"in \"%s/cupsd.conf\"."
+-msgstr ""
+-"Los URIs del dispositivo de archivo han sido deshabilitados. Para "
+-"habilitarlos, vea la directiva FileDevice en \"%s/cupsd.conf\"."
++msgid "File device URIs have been disabled! To enable, see the FileDevice directive in \"%s/cupsd.conf\"."
++msgstr "Los URIs del dispositivo de archivo han sido deshabilitados. Para habilitarlos, vea la directiva FileDevice en \"%s/cupsd.conf\"."
+ 
+ #, c-format
+ msgid "Bad device-uri \"%s\"!"
+@@ -218,8 +202,7 @@
+ 
+ #, c-format
+ msgid "You are not authorized to authenticate job #%d owned by \"%s\"!"
+-msgstr ""
+-"No tiene permiso para autentificar el trabajo #%d que pertenece a \"%s\"."
++msgstr "No tiene permiso para autentificar el trabajo #%d que pertenece a \"%s\"."
+ 
+ msgid "The printer-uri attribute is required!"
+ msgstr "Se necesita el atributo printer-uri."
+@@ -360,14 +343,11 @@
+ 
+ #, c-format
+ msgid "You are not authorized to restart job id %d owned by \"%s\"!"
+-msgstr ""
+-"No tiene permiso para reiniciar el trabajo id %d que pertenece a \"%s\"."
++msgstr "No tiene permiso para reiniciar el trabajo id %d que pertenece a \"%s\"."
+ 
+ #, c-format
+ msgid "You are not authorized to send document for job #%d owned by \"%s\"!"
+-msgstr ""
+-"No tiene permiso para enviar el documento para el trabajo #%d que pertenece "
+-"a \"%s\"."
++msgstr "No tiene permiso para enviar el documento para el trabajo #%d que pertenece a \"%s\"."
+ 
+ #, c-format
+ msgid "Bad document-format \"%s\"!"
+@@ -465,11 +445,8 @@
+ msgstr "lpq: Destino desconocido \"%s\".\n"
+ 
+ #, c-format
+-msgid ""
+-"lp: error - %s environment variable names non-existent destination \"%s\"!\n"
+-msgstr ""
+-"lp: error - los nombres de la variable de entorno %s no existentes en el "
+-"destino \"%s\".\n"
++msgid "lp: error - %s environment variable names non-existent destination \"%s\"!\n"
++msgstr "lp: error - los nombres de la variable de entorno %s no existentes en el destino \"%s\".\n"
+ 
+ msgid "lpq: error - no default destination available.\n"
+ msgstr "lpq: error - no está disponible el destino predeterminado.\n"
+@@ -478,10 +455,8 @@
+ msgid "lpq: get-jobs failed: %s\n"
+ msgstr "lpq: get-jobs ha fallado: %s\n"
+ 
+-msgid ""
+-"Rank   Owner      Pri  Job        Files                       Total Size\n"
+-msgstr ""
+-"Rango  Propiet.   Pri  Trabajo    Archivos                    Tamaño total\n"
++msgid "Rank   Owner      Pri  Job        Files                       Total Size\n"
++msgstr "Rango  Propiet.   Pri  Trabajo    Archivos                    Tamaño total\n"
+ 
+ msgid "Rank    Owner   Job     File(s)                         Total Size\n"
+ msgstr "Rango  Propiet. Trabajo Archivo(s)                      Tamaño total\n"
+@@ -492,15 +467,15 @@
+ 
+ #, c-format
+ msgid "        %-39.39s %.0f bytes\n"
+-msgstr "        %-39.39s %.de bytes\n"
++msgstr "        %-39.39s %.0f bytes\n"
+ 
+ #, c-format
+ msgid "%-6s %-10.10s %-4d %-10d %-27.27s %.0f bytes\n"
+-msgstr "%-6s %-10.10s %-4d %-10d %-27.27s %.de bytes\n"
++msgstr "%-6s %-10.10s %-4d %-10d %-27.27s %.0f bytes\n"
+ 
+ #, c-format
+ msgid "%-7s %-7.7s %-7d %-31.31s %.0f bytes\n"
+-msgstr "%-7s %-7.7s %-7d %-31.31s %.de bytes\n"
++msgstr "%-7s %-7.7s %-7d %-31.31s %.0f bytes\n"
+ 
+ msgid "no entries\n"
+ msgstr "no hay entradas\n"
+@@ -529,20 +504,14 @@
+ msgstr "lpr: error - se esperaba un valor tras la opción %c\n"
+ 
+ #, c-format
+-msgid ""
+-"lpr: warning - '%c' format modifier not supported - output may not be "
+-"correct!\n"
+-msgstr ""
+-"lpr: advertencia - no admite el uso del modificador de formato '%c' - la "
+-"salida puede que no sea correcta.\n"
++msgid "lpr: warning - '%c' format modifier not supported - output may not be correct!\n"
++msgstr "lpr: advertencia - no admite el uso del modificador de formato '%c' - la salida puede que no sea correcta.\n"
+ 
+ msgid "lpr: error - expected option=value after -o option!\n"
+ msgstr "lpr: error - se esperaba opción=valor tras la opción -o.\n"
+ 
+ msgid "lpr: warning - email notification is not currently supported!\n"
+-msgstr ""
+-"lpr: advertencia - actualmente no admite el uso de la notificación por "
+-"email.\n"
++msgstr "lpr: advertencia - actualmente no admite el uso de la notificación por email.\n"
+ 
+ msgid "lpr: error - expected destination after -P option!\n"
+ msgstr "lpr: error - se esperaba un destino tras la opción -P.\n"
+@@ -563,18 +532,15 @@
+ 
+ #, c-format
+ msgid "lpr: error - unable to access \"%s\" - %s\n"
+-msgstr "lpr: error - no se ha podido acceder a \"%s\" - \"s\n"
++msgstr "lpr: error - no se ha podido acceder a \"%s\" - %s\n"
+ 
+ #, c-format
+ msgid "lpr: error - too many files - \"%s\"\n"
+ msgstr "lpr: error - demasiados archivos - \"%s\"\n"
+ 
+ #, c-format
+-msgid ""
+-"lpr: error - %s environment variable names non-existent destination \"%s\"!\n"
+-msgstr ""
+-"lpr: error - los nombres de variables de entorno %s no existen en el destino "
+-"\"%s\".\n"
++msgid "lpr: error - %s environment variable names non-existent destination \"%s\"!\n"
++msgstr "lpr: error - los nombres de variables de entorno %s no existen en el destino \"%s\".\n"
+ 
+ msgid "lpr: error - no default destination available.\n"
+ msgstr "lpr: error - no está disponible el destino predeterminado.\n"
+@@ -588,13 +554,10 @@
+ 
+ #, c-format
+ msgid "lpr: error - unable to write to temporary file \"%s\" - %s\n"
+-msgstr ""
+-"lpr: error - no se ha podido escribir en el archivo temporal \"%s\" - %s\n"
++msgstr "lpr: error - no se ha podido escribir en el archivo temporal \"%s\" - %s\n"
+ 
+ msgid "lpr: error - stdin is empty, so no job has been sent.\n"
+-msgstr ""
+-"lpr: error - stdin está vacío, por lo tanto no se ha enviado ningún "
+-"trabajo.\n"
++msgstr "lpr: error - stdin está vacío, por lo tanto no se ha enviado ningún trabajo.\n"
+ 
+ #, c-format
+ msgid "lpr: error - unable to print file: %s\n"
+@@ -652,12 +615,10 @@
+ msgstr "%s: La operación ha fallado: %s\n"
+ 
+ msgid "cancel: Error - expected hostname after '-h' option!\n"
+-msgstr ""
+-"cancel: Error - se esperaba un nombre de ordenador tras la opción '-h'.\n"
++msgstr "cancel: Error - se esperaba un nombre de ordenador tras la opción '-h'.\n"
+ 
+ msgid "cancel: Error - expected username after '-u' option!\n"
+-msgstr ""
+-"cancel: Error - se esperaba un nombre de usuario tras la opción '-u'.\n"
++msgstr "cancel: Error - se esperaba un nombre de usuario tras la opción '-u'.\n"
+ 
+ #, c-format
+ msgid "cancel: Unknown option '%c'!\n"
+@@ -704,39 +665,27 @@
+ 
+ #, c-format
+ msgid "cupsaddsmb: Unable to copy Windows 2000 printer driver files (%d)!\n"
+-msgstr ""
+-"cupsaddsmb: No se han podido copiar los archivos de los controladores de "
+-"impresoras de Windows 2000 (%d).\n"
++msgstr "cupsaddsmb: No se han podido copiar los archivos de los controladores de impresoras de Windows 2000 (%d).\n"
+ 
+ #, c-format
+ msgid "cupsaddsmb: Unable to copy CUPS printer driver files (%d)!\n"
+-msgstr ""
+-"cupsaddsmb: No se han podido copiar los archivos de los controladores de "
+-"impresoras de CUPS (%d).\n"
++msgstr "cupsaddsmb: No se han podido copiar los archivos de los controladores de impresoras de CUPS (%d).\n"
+ 
+ #, c-format
+ msgid "cupsaddsmb: Unable to install Windows 2000 printer driver files (%d)!\n"
+-msgstr ""
+-"cupsaddsmb: No se han podido instalar los archivos de los controladores de "
+-"impresoras de Windows 2000 (%d).\n"
++msgstr "cupsaddsmb: No se han podido instalar los archivos de los controladores de impresoras de Windows 2000 (%d).\n"
+ 
+ #, c-format
+ msgid "cupsaddsmb: Unable to copy Windows 9x printer driver files (%d)!\n"
+-msgstr ""
+-"cupsaddsmb: No se han podido copiar los archivos de los controladores de "
+-"impresoras de Windows 9x (%d).\n"
++msgstr "cupsaddsmb: No se han podido copiar los archivos de los controladores de impresoras de Windows 9x (%d).\n"
+ 
+ #, c-format
+ msgid "cupsaddsmb: Unable to install Windows 9x printer driver files (%d)!\n"
+-msgstr ""
+-"cupsaddsmb: No se han podido instalar los archivos de los controladores de "
+-"impresoras de Windows 9x (%d).\n"
++msgstr "cupsaddsmb: No se han podido instalar los archivos de los controladores de impresoras de Windows 9x (%d).\n"
+ 
+ #, c-format
+ msgid "cupsaddsmb: Unable to set Windows printer driver (%d)!\n"
+-msgstr ""
+-"cupsaddsmb: No se ha podido poner el controlador de impresora de Windows (%"
+-"d).\n"
++msgstr "cupsaddsmb: No se ha podido poner el controlador de impresora de Windows (%d).\n"
+ 
+ msgid ""
+ "Usage: cupsaddsmb [options] printer1 ... printerN\n"
+@@ -1115,17 +1064,14 @@
+ 
+ #, c-format
+ msgid ""
+-"        WARN    Duplex option keyword %s should be named Duplex or "
+-"JCLDuplex!\n"
++"        WARN    Duplex option keyword %s should be named Duplex or JCLDuplex!\n"
+ "                REF: Page 122, section 5.17\n"
+ msgstr ""
+-"        ADVERTENCIA    Clave de opción Duplex %s debería llamarse Duplex o "
+-"JCLDuplex.\n"
++"        ADVERTENCIA    Clave de opción Duplex %s debería llamarse Duplex o JCLDuplex.\n"
+ "                REF: Página 122, sección 5.17\n"
+ 
+ msgid "        WARN    Default choices conflicting!\n"
+-msgstr ""
+-"        ADVERTENCIA    Las preferencias predeterminadas están en conflicto.\n"
++msgstr "        ADVERTENCIA    Las preferencias predeterminadas están en conflicto.\n"
+ 
+ #, c-format
+ msgid ""
+@@ -1139,48 +1085,42 @@
+ "        WARN    LanguageEncoding required by PPD 4.3 spec.\n"
+ "                REF: Pages 56-57, section 5.3.\n"
+ msgstr ""
+-"        ADVERTENCIA    Se necesita LanguageEncoding por especificación de "
+-"PPD 4.3.\n"
++"        ADVERTENCIA    Se necesita LanguageEncoding por especificación de PPD 4.3.\n"
+ "                REF: Páginas 56-57, sección 5.3.\n"
+ 
+ msgid ""
+ "        WARN    Manufacturer required by PPD 4.3 spec.\n"
+ "                REF: Pages 58-59, section 5.3.\n"
+ msgstr ""
+-"        ADVERTENCIA    Se necesita Manufacturer por especificación de PPD "
+-"4.3.\n"
++"        ADVERTENCIA    Se necesita Manufacturer por especificación de PPD 4.3.\n"
+ "                REF: Páginas 58-59, seccion 5.3.\n"
+ 
+ msgid ""
+ "        WARN    PCFileName longer than 8.3 in violation of PPD spec.\n"
+ "                REF: Pages 61-62, section 5.3.\n"
+ msgstr ""
+-"        ADVERTENCIA    PCFileName es mas largo que 8.3 violando la "
+-"especificación PPD.\n"
++"        ADVERTENCIA    PCFileName es mas largo que 8.3 violando la especificación PPD.\n"
+ "                REF: Páginas 61-62, sección 5.3.\n"
+ 
+ msgid ""
+ "        WARN    ShortNickName required by PPD 4.3 spec.\n"
+ "                REF: Pages 64-65, section 5.3.\n"
+ msgstr ""
+-"        ADVERTENCIA    Se necesita ShortNickName por especificación de PPD "
+-"4.3.\n"
++"        ADVERTENCIA    Se necesita ShortNickName por especificación de PPD 4.3.\n"
+ "                REF: Páginas 64-65, sección 5.3.\n"
+ 
+ msgid ""
+ "        WARN    Protocols contains both PJL and BCP; expected TBCP.\n"
+ "                REF: Pages 78-79, section 5.7.\n"
+ msgstr ""
+-"        ADVERTENCIA    Protocols contiene a ambos, PJL y BCP; se esperaba "
+-"TBCP.\n"
++"        ADVERTENCIA    Protocols contiene a ambos, PJL y BCP; se esperaba TBCP.\n"
+ "                REF: Páginas 78-79, sección 5.7.\n"
+ 
+ msgid ""
+ "        WARN    Protocols contains PJL but JCL attributes are not set.\n"
+ "                REF: Pages 78-79, section 5.7.\n"
+ msgstr ""
+-"        ADVERTENCIA    Protocols contiene a PJL pero no se especifican los "
+-"atributos JCL.\n"
++"        ADVERTENCIA    Protocols contiene a PJL pero no se especifican los atributos JCL.\n"
+ "                REF: Páginas 78-79, sección 5.7.\n"
+ 
+ #, c-format
+@@ -1207,12 +1147,10 @@
+ "                (restricción=\"%s %s %s %s\")\n"
+ 
+ msgid ""
+-"Usage: cupstestppd [-q] [-r] [-v[v]] filename1.ppd[.gz] [... filenameN.ppd[."
+-"gz]]\n"
++"Usage: cupstestppd [-q] [-r] [-v[v]] filename1.ppd[.gz] [... filenameN.ppd[.gz]]\n"
+ "       program | cupstestppd [-q] [-r] [-v[v]] -\n"
+ msgstr ""
+-"Uso: cupstestppd [-q] [-r] [-v[v]] nombre_archivo1.ppd[.gz] [... "
+-"nombre_archivoN.ppd[.gz]]\n"
++"Uso: cupstestppd [-q] [-r] [-v[v]] nombre_archivo1.ppd[.gz] [... nombre_archivoN.ppd[.gz]]\n"
+ "       programa | cupstestppd [-q] [-r] [-v[v]] -\n"
+ 
+ msgid "lpstat: Need \"completed\" or \"not-completed\" after -W!\n"
+@@ -1285,20 +1223,15 @@
+ msgstr "destino predeterminado del sistema: %s\n"
+ 
+ #, c-format
+-msgid ""
+-"lpstat: error - %s environment variable names non-existent destination \"%s"
+-"\"!\n"
+-msgstr ""
+-"lpstat: error - Los nombre de variable de entorno %s no existen en el "
+-"destino \"%s\".\n"
++msgid "lpstat: error - %s environment variable names non-existent destination \"%s\"!\n"
++msgstr "lpstat: error - Los nombre de variable de entorno %s no existen en el destino \"%s\".\n"
+ 
+ msgid "no system default destination\n"
+ msgstr "no hay un destino predeterminado del sistema\n"
+ 
+ #, c-format
+ msgid "Output for printer %s is sent to remote printer %s on %s\n"
+-msgstr ""
+-"La salida de la impresora %s se ha enviado a la impresora remota %s en %s\n"
++msgstr "La salida de la impresora %s se ha enviado a la impresora remota %s en %s\n"
+ 
+ #, c-format
+ msgid "Output for printer %s is sent to %s\n"
+@@ -1306,9 +1239,7 @@
+ 
+ #, c-format
+ msgid "Output for printer %s/%s is sent to remote printer %s on %s\n"
+-msgstr ""
+-"La salida de la impresora %s/%s se ha enviado a la impresora remota %s en %"
+-"s\n"
++msgstr "La salida de la impresora %s/%s se ha enviado a la impresora remota %s en %s\n"
+ 
+ #, c-format
+ msgid "Output for printer %s/%s is sent to %s\n"
+@@ -1452,16 +1383,13 @@
+ msgstr "lpadmin: Se esperaba un nombre de clase tras la opción '-c'\n"
+ 
+ msgid "lpadmin: Class name can only contain printable characters!\n"
+-msgstr ""
+-"lpadmin: El nombre de la clase sólo puede contener caracteres imprimibles.\n"
++msgstr "lpadmin: El nombre de la clase sólo puede contener caracteres imprimibles.\n"
+ 
+ msgid "lpadmin: Expected printer name after '-d' option!\n"
+ msgstr "lpadmin: Se esperaba un nombre de impresora tras la opción '-d'\n"
+ 
+ msgid "lpadmin: Printer name can only contain printable characters!\n"
+-msgstr ""
+-"lpadmin: El nombre de la impresora sólo puede contener caracteres "
+-"imprimibles.\n"
++msgstr "lpadmin: El nombre de la impresora sólo puede contener caracteres imprimibles.\n"
+ 
+ msgid "lpadmin: Expected hostname after '-h' option!\n"
+ msgstr "lpadmin: Se esperaba un nombre de ordenador tras la opción '-h'.\n"
+@@ -1536,8 +1464,7 @@
+ msgstr "lpadmin: Se esperaba tipo(s) de archivo(s) tras la opción '-l'.\n"
+ 
+ msgid "lpadmin: Warning - content type list ignored!\n"
+-msgstr ""
+-"lpadmin: Advertencia - lista de tipo de contenido no tenida en cuenta.\n"
++msgstr "lpadmin: Advertencia - lista de tipo de contenido no tenida en cuenta.\n"
+ 
+ msgid ""
+ "lpadmin: Unable to set the printer location:\n"
+@@ -1640,9 +1567,7 @@
+ msgstr "lp: Se esperaba un ID de trabajo tras la opción -i.\n"
+ 
+ msgid "lp: Error - cannot print files and alter jobs simultaneously!\n"
+-msgstr ""
+-"lp: Error - no se pueden imprimir archivos y alterar trabajos al mismo "
+-"tiempo.\n"
++msgstr "lp: Error - no se pueden imprimir archivos y alterar trabajos al mismo tiempo.\n"
+ 
+ msgid "lp: Error - bad job ID!\n"
+ msgstr "lp: Error - ID de trabajo incorrecta.\n"
+@@ -1694,11 +1619,8 @@
+ msgid "lp: Unknown option '%c'!\n"
+ msgstr "lp: Opción '%c' desconocida.\n"
+ 
+-msgid ""
+-"lp: Error - cannot print from stdin if files or a job ID are provided!\n"
+-msgstr ""
+-"lp: Error - no se puede imprimir desde stdin si se proporcionan archivos o "
+-"un ID de trabajo.\n"
++msgid "lp: Error - cannot print from stdin if files or a job ID are provided!\n"
++msgstr "lp: Error - no se puede imprimir desde stdin si se proporcionan archivos o un ID de trabajo.\n"
+ 
+ #, c-format
+ msgid "lp: Unable to access \"%s\" - %s\n"
+@@ -1720,8 +1642,7 @@
+ 
+ #, c-format
+ msgid "lp: error - unable to write to temporary file \"%s\" - %s\n"
+-msgstr ""
+-"lp: error - no se ha podido escribir en el archivo temporal \"%s\" - %s\n"
++msgstr "lp: error - no se ha podido escribir en el archivo temporal \"%s\" - %s\n"
+ 
+ msgid "lp: stdin is empty, so no job has been sent.\n"
+ msgstr "lp: stdin está vacío, por lo tanto no se ha enviado ningún trabajo.\n"
+@@ -1883,9 +1804,7 @@
+ 
+ #, c-format
+ msgid "lppasswd: failed to backup old password file: %s\n"
+-msgstr ""
+-"lppasswd: falló al hacer una copia de seguridad del antiguo archivo de "
+-"contraseñas: %s\n"
++msgstr "lppasswd: falló al hacer una copia de seguridad del antiguo archivo de contraseñas: %s\n"
+ 
+ #, c-format
+ msgid "lppasswd: failed to rename password file: %s\n"
+@@ -1936,12 +1855,8 @@
+ msgid "Add Class"
+ msgstr "Añadir clase"
+ 
+-msgid ""
+-"The class name may only contain up to 127 printable characters and may not "
+-"contain spaces, slashes (/), or the pound sign (#)."
+-msgstr ""
+-"El nombre de la clase sólo puede contener hasta 127 caracteres imprimibles y "
+-"no puede contener espacios, barras (/), o la almohadilla (#)."
++msgid "The class name may only contain up to 127 printable characters and may not contain spaces, slashes (/), or the pound sign (#)."
++msgstr "El nombre de la clase sólo puede contener hasta 127 caracteres imprimibles y no puede contener espacios, barras (/), o la almohadilla (#)."
+ 
+ msgid "Unable to modify class:"
+ msgstr "No se ha podido modificar la clase:"
+@@ -1955,12 +1870,8 @@
+ msgid "Add Printer"
+ msgstr "Añadir impresora"
+ 
+-msgid ""
+-"The printer name may only contain up to 127 printable characters and may not "
+-"contain spaces, slashes (/), or the pound sign (#)."
+-msgstr ""
+-"El nombre de la impresora sólo puede contener hasta 127 caracteres "
+-"imprimibles y no puede contener espacios, barras (/), o la almohadilla (#)."
++msgid "The printer name may only contain up to 127 printable characters and may not contain spaces, slashes (/), or the pound sign (#)."
++msgstr "El nombre de la impresora sólo puede contener hasta 127 caracteres imprimibles y no puede contener espacios, barras (/), o la almohadilla (#)."
+ 
+ msgid "Unable to get list of printer drivers:"
+ msgstr "No se ha podido obtener la lista de controladores de impresora:"
+@@ -2059,24 +1970,16 @@
+ msgstr "No se ha podido convertir el archivo PPD."
+ 
+ msgid "Unable to copy Windows 2000 printer driver files!"
+-msgstr ""
+-"No se han podido copiar los archivos del controlador de impresora de Windows "
+-"2000."
++msgstr "No se han podido copiar los archivos del controlador de impresora de Windows 2000."
+ 
+ msgid "Unable to install Windows 2000 printer driver files!"
+-msgstr ""
+-"No se han podido instalar los archivos del controlador de impresora de "
+-"Windows 2000."
++msgstr "No se han podido instalar los archivos del controlador de impresora de Windows 2000."
+ 
+ msgid "Unable to copy Windows 9x printer driver files!"
+-msgstr ""
+-"No se han podido copiar los archivos del controlador de impresora de Windows "
+-"9x."
++msgstr "No se han podido copiar los archivos del controlador de impresora de Windows 9x."
+ 
+ msgid "Unable to install Windows 9x printer driver files!"
+-msgstr ""
+-"No se han podido instalar los archivos del controlador de impresora de "
+-"Windows 9x."
++msgstr "No se han podido instalar los archivos del controlador de impresora de Windows 9x."
+ 
+ msgid "Unable to set Windows printer driver!"
+ msgstr "No se ha podido configurar el controlador de impresora de Windows."
+@@ -2096,14 +1999,10 @@
+ msgstr "cupsaddsmb se ha estropeado con señal %d"
+ 
+ msgid "A Samba username is required to export printer drivers!"
+-msgstr ""
+-"Se requiere un nombre de usuario Samba para exportar los controladores de "
+-"impresora."
++msgstr "Se requiere un nombre de usuario Samba para exportar los controladores de impresora."
+ 
+ msgid "A Samba password is required to export printer drivers!"
+-msgstr ""
+-"Se requiere una contraseña Samba para exportar los controladores de "
+-"impresora."
++msgstr "Se requiere una contraseña Samba para exportar los controladores de impresora."
+ 
+ msgid "Unable to open cupsd.conf file:"
+ msgstr "No se ha podido abrir el archivo cupsd.conf:"
+@@ -2256,13 +2155,10 @@
+ msgstr "cupsaddsmb: No se ha podido ejecutar \"%s\": %s\n"
+ 
+ msgid "cupsaddsmb: No Windows printer drivers are installed!\n"
+-msgstr ""
+-"cupsaddsmb: No está instalado ningún controlador de impresora de Windows.\n"
++msgstr "cupsaddsmb: No está instalado ningún controlador de impresora de Windows.\n"
+ 
+ msgid "cupsaddsmb: Warning, no Windows 2000 printer drivers are installed!\n"
+-msgstr ""
+-"cupsaddsmb: Advertencia, no está instalado ningún controlador de impresora "
+-"de Windows 2000.\n"
++msgstr "cupsaddsmb: Advertencia, no está instalado ningún controlador de impresora de Windows 2000.\n"
+ 
+ #, c-format
+ msgid "lpadmin: Printer %s is already a member of class %s.\n"
+@@ -2305,8 +2201,7 @@
+ msgstr "Uso: lpmove trabajo/fuente destino\n"
+ 
+ msgid "lpstat: Need \"completed\", \"not-completed\", or \"all\" after -W!\n"
+-msgstr ""
+-"lpstat: Se necesita \"completed\", \"not completed\", o \"all\" tras -W.\n"
++msgstr "lpstat: Se necesita \"completed\", \"not completed\", o \"all\" tras -W.\n"
+ 
+ #, c-format
+ msgid "%s accepting requests since %s\n"
+@@ -2356,21 +2251,15 @@
+ msgstr "%s: Error - se esperaba un nombre de ordenador tras la opción '-h'.\n"
+ 
+ #, c-format
+-msgid ""
+-"%s: error - %s environment variable names non-existent destination \"%s\"!\n"
+-msgstr ""
+-"%s: error - %s nombres de variables de entorno no existen en destino \"%s"
+-"\".\n"
++msgid "%s: error - %s environment variable names non-existent destination \"%s\"!\n"
++msgstr "%s: error - %s nombres de variables de entorno no existen en destino \"%s\".\n"
+ 
+ #, c-format
+ msgid "%s: error - no default destination available.\n"
+ msgstr "%s: error - destino predeterminado no disponible.\n"
+ 
+-msgid ""
+-"Usage: lpq [-P dest] [-U username] [-h hostname[:port]] [-l] [+interval]\n"
+-msgstr ""
+-"Uso: lpq (-P dest) (-U nombre_usuario) (-h nombre_ordenador(:puerto)) (-l) "
+-"(+intervalo)\n"
++msgid "Usage: lpq [-P dest] [-U username] [-h hostname[:port]] [-l] [+interval]\n"
++msgstr "Uso: lpq (-P dest) (-U nombre_usuario) (-h nombre_ordenador(:puerto)) (-l) (+intervalo)\n"
+ 
+ #, c-format
+ msgid "%s: Error - expected hostname after '-H' option!\n"
+@@ -2381,12 +2270,8 @@
+ msgstr "%s: Error - se esperaba un valor tras la opción '%c'.\n"
+ 
+ #, c-format
+-msgid ""
+-"%s: Warning - '%c' format modifier not supported - output may not be "
+-"correct!\n"
+-msgstr ""
+-"%s: Advertencia - no se admite el uso del modificador de formato '%c' - la "
+-"salida puede no ser correcta.\n"
++msgid "%s: Warning - '%c' format modifier not supported - output may not be correct!\n"
++msgstr "%s: Advertencia - no se admite el uso del modificador de formato '%c' - la salida puede no ser correcta.\n"
+ 
+ #, c-format
+ msgid "%s: error - expected option=value after '-o' option!\n"
+@@ -2417,11 +2302,8 @@
+ msgstr "%s: Error - demasiados archivos - \"%s\"\n"
+ 
+ #, c-format
+-msgid ""
+-"%s: Error - %s environment variable names non-existent destination \"%s\"!\n"
+-msgstr ""
+-"%s: Error - %s nombres de variables de entorno no existen en destino \"%s"
+-"\".\n"
++msgid "%s: Error - %s environment variable names non-existent destination \"%s\"!\n"
++msgstr "%s: Error - %s nombres de variables de entorno no existen en destino \"%s\".\n"
+ 
+ #, c-format
+ msgid "%s: Error - no default destination available.\n"
+@@ -2441,8 +2323,7 @@
+ 
+ #, c-format
+ msgid "%s: Error - stdin is empty, so no job has been sent.\n"
+-msgstr ""
+-"%s: Error - stdin está vacío, por lo tanto no se ha enviado ningún trabajo.\n"
++msgstr "%s: Error - stdin está vacío, por lo tanto no se ha enviado ningún trabajo.\n"
+ 
+ #, c-format
+ msgid "%s: Error - unknown destination \"%s\"!\n"
+@@ -2478,9 +2359,7 @@
+ 
+ #, c-format
+ msgid "%s: Error - cannot print files and alter jobs simultaneously!\n"
+-msgstr ""
+-"%s: Error - no se pueden imprimir archivos y alterar trabajos al mismo "
+-"tiempo.\n"
++msgstr "%s: Error - no se pueden imprimir archivos y alterar trabajos al mismo tiempo.\n"
+ 
+ #, c-format
+ msgid "%s: Error - bad job ID!\n"
+@@ -2520,8 +2399,7 @@
+ 
+ #, c-format
+ msgid "%s: Need job ID ('-i jobid') before '-H restart'!\n"
+-msgstr ""
+-"%s: Se necesita un ID de trabajo ('-i id_trabajo') antes de '-H restart'.\n"
++msgstr "%s: Se necesita un ID de trabajo ('-i id_trabajo') antes de '-H restart'.\n"
+ 
+ #, c-format
+ msgid "%s: Error - expected page list after '-P' option!\n"
+@@ -2544,19 +2422,12 @@
+ msgstr "%s: Advertencia - opción de tipo de contenido no tenida en cuenta.\n"
+ 
+ #, c-format
+-msgid ""
+-"%s: Error - cannot print from stdin if files or a job ID are provided!\n"
+-msgstr ""
+-"%s: Error - no se puede imprimir desde stdin si se proporcionan archivos o "
+-"una ID de trabajo.\n"
++msgid "%s: Error - cannot print from stdin if files or a job ID are provided!\n"
++msgstr "%s: Error - no se puede imprimir desde stdin si se proporcionan archivos o una ID de trabajo.\n"
+ 
+ #, c-format
+-msgid ""
+-"%s: Error - need \"completed\", \"not-completed\", or \"all\" after '-W' "
+-"option!\n"
+-msgstr ""
+-"%s: Error - se necesita \"completed\", \"not completed\", o \"all\" tras la "
+-"opción '-W'.\n"
++msgid "%s: Error - need \"completed\", \"not-completed\", or \"all\" after '-W' option!\n"
++msgstr "%s: Error - se necesita \"completed\", \"not completed\", o \"all\" tras la opción '-W'.\n"
+ 
+ #, c-format
+ msgid "%s: Error - expected destination after '-b' option!\n"
+@@ -2613,14 +2484,10 @@
+ msgstr "Las suscripciones de trabajos no han podido ser renovadas."
+ 
+ msgid "cupsd: Expected config filename after \"-c\" option!\n"
+-msgstr ""
+-"cupsd: Se esperaba un nombre de archivo de configuración tras la opción \"-c"
+-"\".\n"
++msgstr "cupsd: Se esperaba un nombre de archivo de configuración tras la opción \"-c\".\n"
+ 
+ msgid "cupsd: launchd(8) support not compiled in, running in normal mode.\n"
+-msgstr ""
+-"cupsd: el uso de launchd(8) no ha sido compilado, ejecutándose en modo "
+-"normal.\n"
++msgstr "cupsd: el uso de launchd(8) no ha sido compilado, ejecutándose en modo normal.\n"
+ 
+ #, c-format
+ msgid "cupsd: Unknown option \"%c\" - aborting!\n"
+@@ -2651,18 +2518,11 @@
+ msgid "        WARN    Line %d only contains whitespace!\n"
+ msgstr "        ADVERTENCIA    La línea %d solo contiene espacios en blanco.\n"
+ 
+-msgid ""
+-"        WARN    File contains a mix of CR, LF, and CR LF line endings!\n"
+-msgstr ""
+-"        ADVERTENCIA    El archivo contiene una mezcla de líneas acabadas en "
+-"CR, LF y CR LF.\n"
++msgid "        WARN    File contains a mix of CR, LF, and CR LF line endings!\n"
++msgstr "        ADVERTENCIA    El archivo contiene una mezcla de líneas acabadas en CR, LF y CR LF.\n"
+ 
+-msgid ""
+-"        WARN    Non-Windows PPD files should use lines ending with only LF, "
+-"not CR LF!\n"
+-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"
++msgid "        WARN    Non-Windows PPD files should use lines ending with only LF, not CR LF!\n"
++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"
+ 
+ msgid "Printer Maintenance"
+ msgstr "Mantenimiento de impresora"
+@@ -2684,31 +2544,19 @@
+ 
+ #, c-format
+ msgid "      **FAIL**  Missing \"%s\" translation string for option %s!\n"
+-msgstr ""
+-"      **FALLO**  Cadena de traducción \"%s\" para opción %s desaparecida.\n"
++msgstr "      **FALLO**  Cadena de traducción \"%s\" para opción %s desaparecida.\n"
+ 
+ #, c-format
+-msgid ""
+-"      **FAIL**  Default translation string for option %s contains 8-bit "
+-"characters!\n"
+-msgstr ""
+-"      **FALLO**  Cadena de traducción predeterminada para opción %s contiene "
+-"caracteres de 8-bits.\n"
++msgid "      **FAIL**  Default translation string for option %s contains 8-bit characters!\n"
++msgstr "      **FALLO**  Cadena de traducción predeterminada para opción %s contiene caracteres de 8-bits.\n"
+ 
+ #, c-format
+-msgid ""
+-"      **FAIL**  Missing \"%s\" translation string for option %s, choice %s!\n"
+-msgstr ""
+-"      **FALLO**  Cadena de traducción \"%s\" para opción %s, preferencia %"
+-"s.\n"
++msgid "      **FAIL**  Missing \"%s\" translation string for option %s, choice %s!\n"
++msgstr "      **FALLO**  Cadena de traducción \"%s\" para opción %s, preferencia %s.\n"
+ 
+ #, c-format
+-msgid ""
+-"      **FAIL**  Default translation string for option %s choice %s contains "
+-"8-bit characters!\n"
+-msgstr ""
+-"      **FALLO**  Cadena de traducción predeterminada para opción %s "
+-"preferencia %s contiene caracteres de 8-bits.\n"
++msgid "      **FAIL**  Default translation string for option %s choice %s contains 8-bit characters!\n"
++msgstr "      **FALLO**  Cadena de traducción predeterminada para opción %s preferencia %s contiene caracteres de 8-bits.\n"
+ 
+ #, c-format
+ msgid "      **FAIL**  Bad cupsFilter value \"%s\"!\n"
+@@ -2727,50 +2575,37 @@
+ 
+ #, c-format
+ msgid "Bad option + choice on line %d!\n"
+-msgstr "Opción incorrecta + preferencia en línea %s.\n"
++msgstr "Opción incorrecta + preferencia en línea %d.\n"
+ 
+ #, c-format
+ msgid "Unable to copy Windows 2000 printer driver files (%d)!\n"
+-msgstr ""
+-"No se han podido copiar los archivos del controlador de impresora de Windows "
+-"2000 (%d).\n"
++msgstr "No se han podido copiar los archivos del controlador de impresora de Windows 2000 (%d).\n"
+ 
+ #, c-format
+ msgid "Unable to copy CUPS printer driver files (%d)!\n"
+-msgstr ""
+-"No se han podido copiar los archivos del controlador de impresora de CUPS (%"
+-"d).\n"
++msgstr "No se han podido copiar los archivos del controlador de impresora de CUPS (%d).\n"
+ 
+ #, c-format
+ msgid "Unable to install Windows 2000 printer driver files (%d)!\n"
+-msgstr ""
+-"No se han podido instalar los archivos del controlador de impresora de "
+-"Windows 2000 (%d).\n"
++msgstr "No se han podido instalar los archivos del controlador de impresora de Windows 2000 (%d).\n"
+ 
+ #, c-format
+ msgid "Unable to copy Windows 9x printer driver files (%d)!\n"
+-msgstr ""
+-"No se han podido copiar los archivos del controlador de impresora de Windows "
+-"9x (%d).\n"
++msgstr "No se han podido copiar los archivos del controlador de impresora de Windows 9x (%d).\n"
+ 
+ #, c-format
+ msgid "Unable to install Windows 9x printer driver files (%d)!\n"
+-msgstr ""
+-"No se han podido instalar los archivos del controlador de impresora de "
+-"Windows 9x (%d).\n"
++msgstr "No se han podido instalar los archivos del controlador de impresora de Windows 9x (%d).\n"
+ 
+ msgid "No Windows printer drivers are installed!\n"
+ msgstr "No está instalado ningún controlador de impresora de Windows.\n"
+ 
+ msgid "Warning, no Windows 2000 printer drivers are installed!\n"
+-msgstr ""
+-"Advertencia, no está instalado ningún controlador de impresora de Windows "
+-"2000.\n"
++msgstr "Advertencia, no está instalado ningún controlador de impresora de Windows 2000.\n"
+ 
+ #, c-format
+ msgid "Unable to set Windows printer driver (%d)!\n"
+-msgstr ""
+-"No se ha podido configurar el controlador de impresora de Windows (%d).\n"
++msgstr "No se ha podido configurar el controlador de impresora de Windows (%d).\n"
+ 
+ msgid ""
+ "Usage: cupsaddsmb [options] printer1 ... printerN\n"
+@@ -2788,8 +2623,7 @@
+ "       cupsaddsmb [opciones] -a\n"
+ "\n"
+ "Opciones:\n"
+-"  -E               Hace que se use encriptación en la conexión con el "
+-"servidor\n"
++"  -E               Hace que se use encriptación en la conexión con el servidor\n"
+ "  -H servidor_samba  Usa el servidor SAMBA especificado\n"
+ "  -U usuario_samba    Autentifica usando el usuario SAMBA especificado\n"
+ "  -a               Exporta todas las impresoras\n"
+@@ -2798,41 +2632,29 @@
+ 
+ #, c-format
+ msgid "Unable to copy Windows 2000 printer driver files (%d)!"
+-msgstr ""
+-"No se han podido copiar los archivos del controlador de impresora de Windows "
+-"2000 (%d)."
++msgstr "No se han podido copiar los archivos del controlador de impresora de Windows 2000 (%d)."
+ 
+ #, c-format
+ msgid "Unable to copy CUPS printer driver files (%d)!"
+-msgstr ""
+-"No se han podido copiar los archivos del controlador de impresora de CUPS (%"
+-"d)."
++msgstr "No se han podido copiar los archivos del controlador de impresora de CUPS (%d)."
+ 
+ #, c-format
+ msgid "Unable to install Windows 2000 printer driver files (%d)!"
+-msgstr ""
+-"No se han podido instalar los archivos del controlador de impresora de "
+-"Windows 2000 (%d)."
++msgstr "No se han podido instalar los archivos del controlador de impresora de Windows 2000 (%d)."
+ 
+ #, c-format
+ msgid "Unable to copy Windows 9x printer driver files (%d)!"
+-msgstr ""
+-"No se han podido copiar los archivos del controlador de impresora de Windows "
+-"9x (%d)."
++msgstr "No se han podido copiar los archivos del controlador de impresora de Windows 9x (%d)."
+ 
+ #, c-format
+ msgid "Unable to install Windows 9x printer driver files (%d)!"
+-msgstr ""
+-"No se han podido instalar los archivos del controlador de impresora de "
+-"Windows 9x (%d)."
++msgstr "No se han podido instalar los archivos del controlador de impresora de Windows 9x (%d)."
+ 
+ msgid "No Windows printer drivers are installed!"
+ msgstr "No está instalado ningún controlador de impresora de Windows."
+ 
+ msgid "Warning, no Windows 2000 printer drivers are installed!"
+-msgstr ""
+-"Advertencia, no está instalado ningún controlador de impresora de Windows "
+-"2000."
++msgstr "Advertencia, no está instalado ningún controlador de impresora de Windows 2000."
+ 
+ #, c-format
+ msgid "open of %s failed: %s"
+@@ -2859,12 +2681,8 @@
+ msgstr "El trabajo #%d ya ha sido completado - no se puede cancelar."
+ 
+ #, c-format
+-msgid ""
+-"You must access this page using the URL <A HREF=\"https://%s:%d%s\">https://%"
+-"s:%d%s</A>."
+-msgstr ""
+-"Debe acceder a esta página usando el URL <A HREF=\"https://%s:%d%s\">https://"
+-"%s:%d%s</A>."
++msgid "You must access this page using the URL <A HREF=\"https://%s:%d%s\">https://%s:%d%s</A>."
++msgstr "Debe acceder a esta página usando el URL <A HREF=\"https://%s:%d%s\">https://%s:%d%s</A>."
+ 
+ #, c-format
+ msgid "Unsupported format '%s'!"
+@@ -2978,8 +2796,7 @@
+ "\n"
+ "    -h       Show program usage\n"
+ "\n"
+-"    Note: this program only validates the DSC comments, not the PostScript "
+-"itself.\n"
++"    Note: this program only validates the DSC comments, not the PostScript itself.\n"
+ msgstr ""
+ "Uso: cupstestdsc [opciones] nombre_archivo.ps [... nombre_archivo.ps]\n"
+ "       cupstestdsc [opciones] -\n"
+@@ -2988,17 +2805,16 @@
+ "\n"
+ "    -h       Muestra cómo se usa el programa\n"
+ "\n"
+-"    Nota: este programa sólo valida los comentarios DSC, no el PostScript en "
+-"sí mismo.\n"
++"    Nota: este programa sólo valida los comentarios DSC, no el PostScript en sí mismo.\n"
+ 
+ #, c-format
+ msgid "Password for %s on %s? "
+-msgstr ""
++msgstr "¿Contraseña de %s en %s? "
+ 
+-#, fuzzy
+ msgid ""
+ "      **FAIL**  1284DeviceId must be 1284DeviceID!\n"
+ "                REF: Page 72, section 5.5\n"
+ msgstr ""
+-"      **FALLO**  Preferencia %s incorrecta %s.\n"
+-"                REF: Página 122, sección 5.17\n"
++"      **FALLO**  1284DeviceId debe ser 1284DeviceID.\n"
++"                REF: Página 72, sección 5.5\n"
++
+diff -urNad cupsys-1.2.1~/locale/cups_ja.po cupsys-1.2.1/locale/cups_ja.po
+--- cupsys-1.2.1~/locale/cups_ja.po	2006-05-21 14:08:21.000000000 +0000
++++ cupsys-1.2.1/locale/cups_ja.po	2006-07-18 11:27:13.000000000 +0000
+@@ -26,7 +26,7 @@
+ "Project-Id-Version: CUPS 1.2\n"
+ "Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
+ "POT-Creation-Date: 2006-05-21 10:08-0400\n"
+-"PO-Revision-Date: 2006-03-29 23:44+0900\n"
++"PO-Revision-Date: 2006-06-27 22:55+0900\n"
+ "Last-Translator: Kenshi Muto <kmuto at debian.org>\n"
+ "Language-Team: Japanese <LL at li.org>\n"
+ "MIME-Version: 1.0\n"
+@@ -2929,12 +2929,11 @@
+ 
+ #, c-format
+ msgid "Password for %s on %s? "
+-msgstr ""
++msgstr "%s のパスワード (%s 上)? "
+ 
+-#, fuzzy
+ msgid ""
+ "      **FAIL**  1284DeviceId must be 1284DeviceID!\n"
+ "                REF: Page 72, section 5.5\n"
+ msgstr ""
+-"      **FAIL**  不正な %s が %s を選んでいます!\n"
+-"                REF: 122 ページ、セクション 5.17\n"
++"      **FAIL**  1284DeviceId は 1284DeviceID でなければなりません!\n"
++"                REF: 72 ページ、セクション 5.5\n"
+diff -urNad cupsys-1.2.1~/man/Makefile cupsys-1.2.1/man/Makefile
+--- cupsys-1.2.1~/man/Makefile	2006-04-30 16:27:50.000000000 +0000
++++ cupsys-1.2.1/man/Makefile	2006-07-18 11:27:13.000000000 +0000
+@@ -44,6 +44,7 @@
+ 		client.conf.$(MAN5EXT) \
+ 		cups-snmp.conf.$(MAN5EXT) \
+ 		cupsd.conf.$(MAN5EXT) \
++		mailto.conf.$(MAN5EXT) \
+ 		mime.convs.$(MAN5EXT) \
+ 		mime.types.$(MAN5EXT) \
+ 		printers.conf.$(MAN5EXT) \
+diff -urNad cupsys-1.2.1~/man/cupsaddsmb.man.in cupsys-1.2.1/man/cupsaddsmb.man.in
+--- cupsys-1.2.1~/man/cupsaddsmb.man.in	2006-04-20 18:25:40.000000000 +0000
++++ cupsys-1.2.1/man/cupsaddsmb.man.in	2006-07-18 11:27:13.000000000 +0000
+@@ -21,7 +21,7 @@
+ .\"       EMail: cups-info at cups.org
+ .\"         WWW: http://www.cups.org
+ .\"
+-.TH cupsaddsmb 8 "Common UNIX Printing System" "19 April 2006" "Easy Software Products"
++.TH cupsaddsmb 8 "Common UNIX Printing System" "13 June 2006" "Easy Software Products"
+ .SH NAME
+ cupsaddsmb \- export printers to samba for windows clients
+ 
+@@ -162,13 +162,14 @@
+ .nf
+ 
+     [Windows 2000 and higher]
+-    cups6.ini
+-    cupsui6.dll
+-    cupsdrv6.dll
+-    ps5ui.dll
+-    pscript.hlp
+-    pscript.ntf
+-    pscript5.dll
++    cups6.inf (from www.cups.org)
++    cups6.ini (from www.cups.org)
++    cupsps6.dll (from www.cups.org)
++    cupsui6.dll (from www.cups.org)
++    ps5ui.dll (from your Windows system)
++    pscript.hlp (from your Windows system)
++    pscript.ntf (from your Windows system)
++    pscript5.dll (from your Windows system)
+ .fi
+ .LP
+ \fBNote:\fR Unlike Windows, case is significant - make sure that
+diff -urNad cupsys-1.2.1~/man/cupsd.conf.man.in cupsys-1.2.1/man/cupsd.conf.man.in
+--- cupsys-1.2.1~/man/cupsd.conf.man.in	2006-03-23 19:53:24.000000000 +0000
++++ cupsys-1.2.1/man/cupsd.conf.man.in	2006-07-18 11:27:13.000000000 +0000
+@@ -21,7 +21,7 @@
+ .\"       EMail: cups-info at cups.org
+ .\"         WWW: http://www.cups.org
+ .\"
+-.TH cupsd.conf 5 "Common UNIX Printing System" "23 March 2006" "Easy Software Products"
++.TH cupsd.conf 5 "Common UNIX Printing System" "6 June 2006" "Easy Software Products"
+ .SH NAME
+ cupsd.conf \- server configuration file for cups
+ .SH DESCRIPTION
+@@ -367,8 +367,10 @@
+ Listen ip-address:port
+ .TP 5
+ Listen *:port
++.TP 5
++Listen /path/to/domain/socket
+ .br
+-Listens to the specified address and port.
++Listens to the specified address and port or domain socket path.
+ .TP 5
+ <Location /path> ... </Location>
+ .br
+diff -urNad cupsys-1.2.1~/man/lpadmin.man cupsys-1.2.1/man/lpadmin.man
+--- cupsys-1.2.1~/man/lpadmin.man	2006-03-23 19:53:24.000000000 +0000
++++ cupsys-1.2.1/man/lpadmin.man	2006-07-18 11:27:13.000000000 +0000
+@@ -21,7 +21,7 @@
+ .\"       EMail: cups-info at cups.org
+ .\"         WWW: http://www.cups.org
+ .\"
+-.TH lpadmin 8 "Common UNIX Printing System" "23 March 2006" "Easy Software Products"
++.TH lpadmin 8 "Common UNIX Printing System" "13 July 2006" "Easy Software Products"
+ .SH NAME
+ lpadmin \- configure cups printers and classes
+ .SH SYNOPSIS
+@@ -123,6 +123,27 @@
+ Sets the binary communications program to use when printing,
+ "none", "bcp", or "tbcp". The default program is "none".
+ .TP 5
++-o printer-error-policy=name
++.br
++Sets the error policy to be used when the printer backend is 
++unable to send the job to the printer. The name must be one of 
++"cancel-job", "retry-job" or "stop-printer". The default error 
++policy is "stop-printer".
++.TP 5
++-o printer-is-shared=true/false
++.br
++Sets the printer to shared/published or unshared/unpublished.
++Shared/published printers are publically announced by the server
++on the LAN based on the browsing configuration in
++\fBcupsd.conf\fR, while unshared/unpublished printers are not
++announced. The default value is "true".
++.TP 5
++-o printer-op-policy=name
++.br
++Sets the IPP operation policy associated with the printer. The
++name must be defined in the \fBcupsd.conf\fR in a Policy section.
++The default operation policy is "default".
++.TP 5
+ -r class
+ .br
+ Removes the named \fIprinter\fR from \fIclass\fR.  If the
+@@ -144,7 +165,8 @@
+ .br
+ Sets the \fIdevice-uri\fR attribute of the printer queue.  If
+ \fIdevice-uri\fR is a filename it is automatically converted to
+-the form \fIfile:///file/name\fR.
++the form \fIfile:///file/name\fR. Use the \fIlpinfo(8)\fR command
++to get a list of supported device URIs and schemes.
+ .TP 5
+ -D "info"
+ .br
+@@ -176,7 +198,8 @@
+ The CUPS version of \fIlpadmin\fR does not support all of the
+ System V or Solaris printing system configuration options.
+ .SH SEE ALSO
+-\fIaccept(8)\fR, \fIcupsenable(8)\fR, \fIlpoptions(1)\fR,
++\fIaccept(8)\fR, \fIcupsenable(8)\fR, \fIlpinfo(8)\fR,
++\fIlpoptions(1)\fR,
+ .br
+ http://localhost:631/help
+ .SH COPYRIGHT
+diff -urNad cupsys-1.2.1~/man/mailto.conf.man cupsys-1.2.1/man/mailto.conf.man
+--- cupsys-1.2.1~/man/mailto.conf.man	1970-01-01 00:00:00.000000000 +0000
++++ cupsys-1.2.1/man/mailto.conf.man	2006-07-18 11:27:13.000000000 +0000
+@@ -0,0 +1,69 @@
++.\"
++.\" "$Id$"
++.\"
++.\"   mailto.conf man page for the Common UNIX Printing System (CUPS).
++.\"
++.\"   Copyright 1997-2006 by Easy Software Products.
++.\"
++.\"   These coded instructions, statements, and computer programs are the
++.\"   property of Easy Software Products and are protected by Federal
++.\"   copyright law.  Distribution and use rights are outlined in the file
++.\"   "LICENSE.txt" which should have been included with this file.  If this
++.\"   file is missing or damaged please contact Easy Software Products
++.\"   at:
++.\"
++.\"       Attn: CUPS Licensing Information
++.\"       Easy Software Products
++.\"       44141 Airport View Drive, Suite 204
++.\"       Hollywood, Maryland 20636 USA
++.\"
++.\"       Voice: (301) 373-9600
++.\"       EMail: cups-info at cups.org
++.\"         WWW: http://www.cups.org
++.\"
++.TH mailto.conf 5 "Common UNIX Printing System" "12 July 2006" "Easy Software Products"
++.SH NAME
++mailto.conf \- configuration file for cups email notifier
++.SH DESCRIPTION
++The \fImailto.conf\fR file defines the local mail server and
++email notification preferences for CUPS.
++.LP
++Each line in the file can be a configuration directive, a blank line,
++or a comment. Comment lines start with the # character.
++.SH DIRECTIVES
++.TP 5
++Cc \fIcc-address at domain.com\fR
++.br
++Specifies an additional recipient for all email notifications.
++.TP 5
++From \fIfrom-address at domain.com\fR
++.br
++Specifies the sender of email notifications.
++.TP 5
++Sendmail \fIsendmail command and options\fR
++.br
++Specifies the sendmail command to use when sending email
++notifications. Only one \fISendmail\fR or \fISMTPServer\fR line
++may be present in the \fImailto.conf\fR file. If multiple lines
++are present, only the last one is used.
++.TP 5
++SMTPServer \fIservername\fR
++.br
++Specifies a SMTP server to send email notifications to. Only one
++\fISendmail\fR or \fISMTPServer\fR line may be present in the
++\fImailto.conf\fR file. If multiple lines are present, only the
++last one is used.
++.TP 5
++Subject \fIsubject-prefix\fR
++.br
++Specifies a prefix string for the subject line of an email notification.
++.SH SEE ALSO
++\fIclasses.conf(5)\fR, \fIcupsd(8)\fR, \fIcupsd.conf(5)\fR,
++\fImime.convs(5)\fR, \fImime.types(5)\fR, \fIprinters.conf(5)\fR,
++.br
++http://localhost:631/help
++.SH COPYRIGHT
++Copyright 1997-2006 by Easy Software Products, All Rights Reserved.
++.\"
++.\" End of "$Id$".
++.\"
+diff -urNad cupsys-1.2.1~/notifier/testnotify.c cupsys-1.2.1/notifier/testnotify.c
+--- cupsys-1.2.1~/notifier/testnotify.c	2005-11-12 03:15:10.000000000 +0000
++++ cupsys-1.2.1/notifier/testnotify.c	2006-07-18 11:27:13.000000000 +0000
+@@ -82,6 +82,14 @@
+ 
+     print_attributes(event, 4);
+     ippDelete(event);
++
++   /*
++    * If the recipient URI is "testnotify://nowait", then we exit after each
++    * event...
++    */
++
++    if (!strcmp(argv[1], "testnotify://nowait"))
++      return (0);
+   }
+ }
+ 
+diff -urNad cupsys-1.2.1~/packaging/cups.list.in cupsys-1.2.1/packaging/cups.list.in
+--- cupsys-1.2.1~/packaging/cups.list.in	2006-04-30 16:27:50.000000000 +0000
++++ cupsys-1.2.1/packaging/cups.list.in	2006-07-18 11:27:13.000000000 +0000
+@@ -173,6 +173,7 @@
+ $MAN1EXT=@MAN1EXT@
+ $MAN5EXT=@MAN5EXT@
+ $MAN7EXT=@MAN7EXT@
++$MAN8EXT=@MAN8EXT@
+ $MAN8DIR=@MAN8DIR@
+ 
+ $DSOLIBS=@DSOLIBS@
+@@ -270,7 +271,7 @@
+ f 0755 root sys $BINDIR/cupstestppd systemv/cupstestppd
+ f 0755 root sys $BINDIR/lp systemv/lp
+ f 0755 root sys $BINDIR/lpoptions systemv/lpoptions
+-f 4755 $CUPS_USER sys $BINDIR/lppasswd systemv/lppasswd
++f 4755 root sys $BINDIR/lppasswd systemv/lppasswd
+ f 0755 root sys $BINDIR/lpq berkeley/lpq
+ f 0755 root sys $BINDIR/lpr berkeley/lpr
+ f 0755 root sys $BINDIR/lprm berkeley/lprm
+@@ -342,7 +343,7 @@
+ %subpackage ja
+ f 0644 root sys $LOCALEDIR/ja/cups_ja.po locale/cups_ja.po
+ %subpackage pl
+-#f 0644 root sys $LOCALEDIR/pl/cups_pl.po locale/cups_pl.po
++f 0644 root sys $LOCALEDIR/pl/cups_pl.po locale/cups_pl.po
+ %subpackage sv
+ f 0644 root sys $LOCALEDIR/sv/cups_sv.po locale/cups_sv.po
+ %subpackage
+@@ -418,6 +419,7 @@
+ d 0755 root sys $SERVERROOT -
+ d 0755 root $CUPS_GROUP $SERVERROOT/interfaces -
+ d 0755 root $CUPS_GROUP $SERVERROOT/ppd -
++d 0700 root $CUPS_GROUP $SERVERROOT/ssl -
+ c $CUPS_PERM root $CUPS_GROUP $SERVERROOT conf/*.conf
+ f $CUPS_PERM root $CUPS_GROUP $SERVERROOT/cupsd.conf.default conf/cupsd.conf
+ f 0644 root $CUPS_GROUP $SERVERROOT/mime.convs conf/mime.convs
+@@ -462,6 +464,7 @@
+ f 0644 root sys $DOCDIR/help/network.html doc/help/network.html
+ f 0644 root sys $DOCDIR/help/options.html doc/help/options.html
+ f 0644 root sys $DOCDIR/help/overview.html doc/help/overview.html
++f 0644 root sys $DOCDIR/help/policies.html doc/help/policies.html
+ f 0644 root sys $DOCDIR/help/security.html doc/help/security.html
+ f 0644 root sys $DOCDIR/help/standard.html doc/help/standard.html
+ f 0644 root sys $DOCDIR/help/translation.html doc/help/translation.html
+@@ -518,6 +521,7 @@
+ 
+ f 0644 root sys $MANDIR/man5/classes.conf.$MAN5EXT man/classes.conf.$MAN5EXT
+ f 0644 root sys $MANDIR/man5/cupsd.conf.$MAN5EXT man/cupsd.conf.$MAN5EXT
++f 0644 root sys $MANDIR/man5/mailto.conf.$MAN5EXT man/mailto.conf.$MAN5EXT
+ f 0644 root sys $MANDIR/man5/mime.convs.$MAN5EXT man/mime.convs.$MAN5EXT
+ f 0644 root sys $MANDIR/man5/mime.types.$MAN5EXT man/mime.types.$MAN5EXT
+ f 0644 root sys $MANDIR/man5/printers.conf.$MAN5EXT man/printers.conf.$MAN5EXT
+diff -urNad cupsys-1.2.1~/packaging/cups.spec.in cupsys-1.2.1/packaging/cups.spec.in
+--- cupsys-1.2.1~/packaging/cups.spec.in	2006-04-22 04:05:45.000000000 +0000
++++ cupsys-1.2.1/packaging/cups.spec.in	2006-07-18 11:27:13.000000000 +0000
+@@ -204,6 +204,7 @@
+ /etc/cups/mime.types
+ /etc/cups/mime.convs
+ %dir /etc/cups/ppd
++%attr(0700,root,root) %dir /etc/cups/ssl
+ 
+ %if %{?_with_dbus:1}%{!?_with_dbus:0}
+ # DBUS
+@@ -291,6 +292,7 @@
+ /usr/share/doc/cups/help/network.html
+ /usr/share/doc/cups/help/options.html
+ /usr/share/doc/cups/help/overview.html
++/usr/share/doc/cups/help/policies.html
+ /usr/share/doc/cups/help/ref-*.html
+ /usr/share/doc/cups/help/security.html
+ /usr/share/doc/cups/help/standard.html
+@@ -399,7 +401,7 @@
+ /usr/share/doc/cups/pl/images/*
+ %dir /usr/share/cups/templates/pl
+ /usr/share/cups/templates/pl/*
+-#/usr/share/locale/pl/cups_pl.po
++/usr/share/locale/pl/cups_pl.po
+ 
+ %files sv
+ %defattr(-,root,root)
+diff -urNad cupsys-1.2.1~/pdftops/PSOutputDev.cxx cupsys-1.2.1/pdftops/PSOutputDev.cxx
+--- cupsys-1.2.1~/pdftops/PSOutputDev.cxx	2005-09-22 18:11:02.000000000 +0000
++++ cupsys-1.2.1/pdftops/PSOutputDev.cxx	2006-07-18 11:27:13.000000000 +0000
+@@ -1158,7 +1158,7 @@
+     break;
+   }
+ 
+-  writePSFmt("% Produced by xpdf/pdftops %s\n", xpdfVersion);
++  writePSFmt("%%Producer: xpdf/pdftops %s\n", xpdfVersion);
+   xref->getDocInfo(&info);
+   if (info.dictLookup("Creator", &obj1)->isString()) {
+     writePS("%%Creator: ");
+diff -urNad cupsys-1.2.1~/ppd/zebracpl.ppd cupsys-1.2.1/ppd/zebracpl.ppd
+--- cupsys-1.2.1~/ppd/zebracpl.ppd	2006-05-11 17:43:12.000000000 +0000
++++ cupsys-1.2.1/ppd/zebracpl.ppd	2006-07-18 11:27:13.000000000 +0000
+@@ -120,6 +120,14 @@
+ *Resolution 203dpi/203 DPI: "<</HWResolution[203 203]>>setpagedevice"
+ *CloseUI: *Resolution
+ 
++*OpenUI *zeMediaTracking/Media Tracking: PickOne
++*OrderDependency: 20 AnySetup *zeMediaTracking
++*DefaultzeMediaTracking: Web
++*zeMediaTracking Continuous: ""
++*zeMediaTracking Web/Non-continuous (Web sensing): ""
++*zeMediaTracking Mark/Non-continuous (Mark sensing): ""
++*CloseUI: *zeMediaTracking
++
+ *OpenGroup: PrinterSettings/Printer Settings
+ *OpenUI *Darkness/Media Darkness: PickOne
+ *OrderDependency: 20 AnySetup *Darkness
+diff -urNad cupsys-1.2.1~/scheduler/Makefile cupsys-1.2.1/scheduler/Makefile
+--- cupsys-1.2.1~/scheduler/Makefile	2006-03-05 16:48:12.000000000 +0000
++++ cupsys-1.2.1/scheduler/Makefile	2006-07-18 11:27:13.000000000 +0000
+@@ -127,6 +127,9 @@
+ 	echo Creating $(SERVERROOT)/ppd...
+ 	$(INSTALL_DIR) -m 755 $(SERVERROOT)/ppd
+ 	-chgrp $(CUPS_GROUP) $(SERVERROOT)/ppd
++	echo Creating $(SERVERROOT)/ssl...
++	$(INSTALL_DIR) -m 700 $(SERVERROOT)/ssl
++	-chgrp $(CUPS_GROUP) $(SERVERROOT)/ssl
+ 	echo Creating $(STATEDIR)...
+ 	$(INSTALL_DIR) -m 755 $(STATEDIR)
+ 	echo Creating $(STATEDIR)/certs...
+diff -urNad cupsys-1.2.1~/scheduler/auth.c cupsys-1.2.1/scheduler/auth.c
+--- cupsys-1.2.1~/scheduler/auth.c	2006-05-22 15:34:01.000000000 +0000
++++ cupsys-1.2.1/scheduler/auth.c	2006-07-18 11:27:13.000000000 +0000
+@@ -869,9 +869,12 @@
+ 	    */
+ 
+ 	    for (iface = (cupsd_netif_t *)cupsArrayFirst(NetIFList);
+-	         iface && !strcmp(masks->mask.name.name, iface->name);
++	         iface;
+ 		 iface = (cupsd_netif_t *)cupsArrayNext(NetIFList))
+ 	    {
++              if (strcmp(masks->mask.name.name, iface->name))
++                continue;
++
+               if (iface->address.addr.sa_family == AF_INET)
+ 	      {
+ 	       /*
+diff -urNad cupsys-1.2.1~/scheduler/client.c cupsys-1.2.1/scheduler/client.c
+--- cupsys-1.2.1~/scheduler/client.c	2006-05-22 15:34:01.000000000 +0000
++++ cupsys-1.2.1/scheduler/client.c	2006-07-18 11:27:13.000000000 +0000
+@@ -54,6 +54,11 @@
+ 
+ #ifdef HAVE_CDSASSL
+ #  include <Security/Security.h>
++#  ifdef HAVE_SECBASEPRIV_H
++#    include <Security/SecBasePriv.h>
++#  else
++     extern const char *cssmErrorString(int error);
++#  endif /* HAVE_SECBASEPRIV_H */
+ #endif /* HAVE_CDSASSL */
+ #ifdef HAVE_GNUTLS
+ #  include <gnutls/x509.h>
+@@ -78,9 +83,9 @@
+ static int		is_cgi(cupsd_client_t *con, const char *filename,
+ 		               struct stat *filestats, mime_type_t *type);
+ static int		is_path_absolute(const char *path);
+-#ifdef HAVE_GNUTLS
+-static void		make_certificate(void);
+-#endif /* HAVE_GNUTLS */
++#ifdef HAVE_SSL
++static int		make_certificate(void);
++#endif /* HAVE_SSL */
+ static int		pipe_command(cupsd_client_t *con, int infile, int *outfile,
+ 			             char *command, char *options, int root);
+ static int		write_file(cupsd_client_t *con, http_status_t code,
+@@ -1882,24 +1887,27 @@
+ 
+ 
+   if (con->filename)
++  {
+     fd = open(con->filename, O_RDONLY);
+-  else
+-    fd = open("/dev/null", O_RDONLY);
+ 
+-  if (fd < 0)
+-  {
+-    cupsdLogMessage(CUPSD_LOG_ERROR,
+-                    "cupsdSendCommand: %d Unable to open \"%s\" for reading: %s",
+-                    con->http.fd, con->filename ? con->filename : "/dev/null",
+-	            strerror(errno));
+-    return (0);
+-  }
++    if (fd < 0)
++    {
++      cupsdLogMessage(CUPSD_LOG_ERROR,
++                      "cupsdSendCommand: %d Unable to open \"%s\" for reading: %s",
++                      con->http.fd, con->filename ? con->filename : "/dev/null",
++	              strerror(errno));
++      return (0);
++    }
+ 
+-  fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
++    fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
++  }
++  else
++    fd = -1;
+ 
+   con->pipe_pid = pipe_command(con, fd, &(con->file), command, options, root);
+ 
+-  close(fd);
++  if (fd >= 0)
++    close(fd);
+ 
+   cupsdLogMessage(CUPSD_LOG_INFO, "Started \"%s\" (pid=%d)", command,
+                   con->pipe_pid);
+@@ -2520,6 +2528,20 @@
+ 
+ 
+  /*
++  * Verify that we have a certificate...
++  */
++
++  if (access(ServerKey, 0) || access(ServerCertificate, 0))
++  {
++   /*
++    * Nope, make a self-signed certificate...
++    */
++
++    if (!make_certificate())
++      return (0);
++  }
++
++ /*
+   * Create the SSL context and accept the connection...
+   */
+ 
+@@ -2571,7 +2593,8 @@
+     * Nope, make a self-signed certificate...
+     */
+ 
+-    make_certificate();
++    if (!make_certificate())
++      return (0);
+   }
+ 
+  /*
+@@ -2646,6 +2669,16 @@
+ 
+   if (!conn->certsArray)
+   {
++   /*
++    * No keychain (yet), make a self-signed certificate...
++    */
++
++    if (make_certificate())
++      conn->certsArray = get_cdsa_server_certs();
++  }
++
++  if (!conn->certsArray)
++  {
+     cupsdLogMessage(CUPSD_LOG_ERROR,
+         	    "EncryptClient: Could not find signing key in keychain "
+ 		    "\"%s\"", ServerCertificate);
+@@ -2659,7 +2692,7 @@
+     error = SSLSetIOFuncs(conn->session, _httpReadCDSA, _httpWriteCDSA);
+ 
+   if (!error)
+-    error = SSLSetProtocolVersion(conn->session, kSSLProtocol3);
++    error = SSLSetProtocolVersionEnabled(conn->session, kSSLProtocol2, false);
+ 
+   if (!error)
+   {
+@@ -2697,8 +2730,8 @@
+                     "encrypt_client: Unable to encrypt connection from %s!",
+                     con->http.hostname);
+ 
+-    cupsdLogMessage(CUPSD_LOG_ERROR,
+-                    "encrypt_client: CDSA error code is %d", (int)error);
++    cupsdLogMessage(CUPSD_LOG_ERROR, "encrypt_client: %s (%d)",
++                    cssmErrorString(error), (int)error);
+ 
+     con->http.error  = error;
+     con->http.status = HTTP_ERROR;
+@@ -3308,14 +3341,92 @@
+ }
+ 
+ 
+-#ifdef HAVE_GNUTLS
++#ifdef HAVE_SSL
+ /*
+  * 'make_certificate()' - Make a self-signed SSL/TLS certificate.
+  */
+ 
+-static void
++static int				/* O - 1 on success, 0 on failure */
+ make_certificate(void)
+ {
++#if defined(HAVE_LIBSSL) && defined(HAVE_WAITPID)
++  int	pid,				/* Process ID of command */
++	status;				/* Status of command */
++  char	command[1024],			/* Command */
++	*argv[11],			/* Command-line arguments */
++	*envp[MAX_ENV];			/* Environment variables */
++
++
++ /*
++  * Run the "openssl" command to generate a self-signed certificate
++  * that is good for 10 years:
++  *
++  *     openssl req -new -x509 -keyout ServerKey \
++  *             -out ServerCertificate -days 3650 -nodes
++  */
++
++  if (!cupsFileFind("openssl", getenv("PATH"), 1, command, sizeof(command)))
++  {
++    cupsdLogMessage(CUPSD_LOG_ERROR,
++                    "No SSL certificate and openssl command not found!");
++    return (0);
++  }
++
++  cupsdLogMessage(CUPSD_LOG_INFO,
++                  "Generating SSL server key and certificate...");
++
++  argv[0]  = "openssl";
++  argv[1]  = "req";
++  argv[2]  = "-new";
++  argv[3]  = "-x509";
++  argv[4]  = "-keyout";
++  argv[5]  = ServerKey;
++  argv[6]  = "-out";
++  argv[7]  = ServerCertificate;
++  argv[8]  = "-days";
++  argv[9]  = "3650";
++  argv[10] = "-nodes";
++  argv[11] = NULL;
++
++  cupsdLoadEnv(envp, MAX_ENV);
++
++  if (!cupsdStartProcess(command, argv, envp, -1, -1, -1, -1, 1, &pid))
++    return (0);
++
++  while (waitpid(pid, &status, 0) < 0)
++    if (errno != EINTR)
++    {
++      status = 1;
++      break;
++    }
++
++  cupsdFinishProcess(pid, command, sizeof(command));
++
++  if (status)
++  {
++    if (WIFEXITED(status))
++      cupsdLogMessage(CUPSD_LOG_ERROR,
++                      "Unable to create SSL server key and certificate - "
++		      "the openssl command stopped with status %d!",
++	              WEXITSTATUS(status));
++    else
++      cupsdLogMessage(CUPSD_LOG_ERROR,
++                      "Unable to create SSL server key and certificate - "
++		      "the openssl command crashed on signal %d!",
++	              WTERMSIG(status));
++  }
++  else
++  {
++    cupsdLogMessage(CUPSD_LOG_INFO, "Created SSL server key file \"%s\"...",
++		    ServerKey);
++    cupsdLogMessage(CUPSD_LOG_INFO,
++                    "Created SSL server certificate file \"%s\"...",
++		    ServerCertificate);
++  }
++
++  return (!status);
++
++#elif defined(HAVE_GNUTLS)
+   gnutls_x509_crt	crt;		/* Self-signed certificate */
+   gnutls_x509_privkey	key;		/* Encryption key */
+   cups_lang_t		*language;	/* Default language info */
+@@ -3331,7 +3442,7 @@
+   * Create the encryption key...
+   */
+ 
+-  cupsdLogMessage(CUPSD_LOG_INFO, "Generating server key...");
++  cupsdLogMessage(CUPSD_LOG_INFO, "Generating SSL server key...");
+ 
+   gnutls_x509_privkey_init(&key);
+   gnutls_x509_privkey_generate(key, GNUTLS_PK_RSA, 2048, 0);
+@@ -3345,33 +3456,33 @@
+   if ((result = gnutls_x509_privkey_export(key, GNUTLS_X509_FMT_PEM,
+                                            buffer, &bytes)) < 0)
+   {
+-    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to export server key - %s",
++    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to export SSL server key - %s",
+                     gnutls_strerror(result));
+     gnutls_x509_privkey_deinit(key);
+-    return;
++    return (0);
+   }
+   else if ((fp = cupsFileOpen(ServerKey, "w")) != NULL)
+   {
+     cupsFileWrite(fp, (char *)buffer, bytes);
+     cupsFileClose(fp);
+ 
+-    cupsdLogMessage(CUPSD_LOG_INFO, "Created server key file \"%s\"...",
++    cupsdLogMessage(CUPSD_LOG_INFO, "Created SSL server key file \"%s\"...",
+ 		    ServerKey);
+   }
+   else
+   {
+     cupsdLogMessage(CUPSD_LOG_ERROR,
+-                    "Unable to create server key file \"%s\" - %s",
++                    "Unable to create SSL server key file \"%s\" - %s",
+ 		    ServerKey, strerror(errno));
+     gnutls_x509_privkey_deinit(key);
+-    return;
++    return (0);
+   }
+ 
+  /*
+   * Create the self-signed certificate...
+   */
+ 
+-  cupsdLogMessage(CUPSD_LOG_INFO, "Generating self-signed certificate...");
++  cupsdLogMessage(CUPSD_LOG_INFO, "Generating self-signed SSL certificate...");
+ 
+   language  = cupsLangDefault();
+   curtime   = time(NULL);
+@@ -3424,7 +3535,7 @@
+   if ((result = gnutls_x509_crt_export(crt, GNUTLS_X509_FMT_PEM,
+                                        buffer, &bytes)) < 0)
+     cupsdLogMessage(CUPSD_LOG_ERROR,
+-                    "Unable to export server certificate - %s",
++                    "Unable to export SSL server certificate - %s",
+ 		    gnutls_strerror(result));
+   else if ((fp = cupsFileOpen(ServerCertificate, "w")) != NULL)
+   {
+@@ -3432,12 +3543,12 @@
+     cupsFileClose(fp);
+ 
+     cupsdLogMessage(CUPSD_LOG_INFO,
+-                    "Created 10-year server certificate file \"%s\"...",
++                    "Created SSL server certificate file \"%s\"...",
+ 		    ServerCertificate);
+   }
+   else
+     cupsdLogMessage(CUPSD_LOG_ERROR,
+-                    "Unable to create server certificate file \"%s\" - %s",
++                    "Unable to create SSL server certificate file \"%s\" - %s",
+ 		    ServerCertificate, strerror(errno));
+ 
+  /*
+@@ -3446,8 +3557,83 @@
+ 
+   gnutls_x509_crt_deinit(crt);
+   gnutls_x509_privkey_deinit(key);
++
++  return (1);
++
++#elif defined(HAVE_CDSASSL) && defined(HAVE_WAITPID)
++  int	pid,				/* Process ID of command */
++	status;				/* Status of command */
++  char	command[1024],			/* Command */
++	keychain[1024],			/* Keychain argument */
++	*argv[5],			/* Command-line arguments */
++	*envp[MAX_ENV];			/* Environment variables */
++
++
++ /*
++  * Run the "certtool" command to generate a self-signed certificate:
++  *
++  *     certtool c Z k=ServerCertificate
++  */
++
++  if (!cupsFileFind("certtool", getenv("PATH"), 1, command, sizeof(command)))
++  {
++    cupsdLogMessage(CUPSD_LOG_ERROR,
++                    "No SSL certificate and certtool command not found!");
++    return (0);
++  }
++
++  cupsdLogMessage(CUPSD_LOG_INFO,
++                  "Generating SSL server key and certificate...");
++
++  snprintf(keychain, sizeof(keychain), "k=%s", ServerCertificate);
++
++  argv[0] = "certtool";
++  argv[1] = "c";
++  argv[2] = "Z";
++  argv[3] = keychain;
++  argv[4] = NULL;
++
++  cupsdLoadEnv(envp, MAX_ENV);
++
++  if (!cupsdStartProcess(command, argv, envp, -1, -1, -1, -1, 1, &pid))
++    return (0);
++
++  while (waitpid(pid, &status, 0) < 0)
++    if (errno != EINTR)
++    {
++      status = 1;
++      break;
++    }
++
++  cupsdFinishProcess(pid, command, sizeof(command));
++
++  if (status)
++  {
++    if (WIFEXITED(status))
++      cupsdLogMessage(CUPSD_LOG_ERROR,
++                      "Unable to create SSL server key and certificate - "
++		      "the certtool command stopped with status %d!",
++	              WEXITSTATUS(status));
++    else
++      cupsdLogMessage(CUPSD_LOG_ERROR,
++                      "Unable to create SSL server key and certificate - "
++		      "the certtool command crashed on signal %d!",
++	              WTERMSIG(status));
++  }
++  else
++  {
++    cupsdLogMessage(CUPSD_LOG_INFO,
++                    "Created SSL server certificate file \"%s\"...",
++		    ServerCertificate);
++  }
++
++  return (!status);
++
++#else
++  return (0);
++#endif /* HAVE_LIBSSL && HAVE_WAITPID */
+ }
+-#endif /* HAVE_GNUTLS */
++#endif /* HAVE_SSL */
+ 
+ 
+ /*
+diff -urNad cupsys-1.2.1~/scheduler/conf.c cupsys-1.2.1/scheduler/conf.c
+--- cupsys-1.2.1~/scheduler/conf.c	2006-05-02 18:13:40.000000000 +0000
++++ cupsys-1.2.1/scheduler/conf.c	2006-07-18 11:27:13.000000000 +0000
+@@ -289,6 +289,11 @@
+   cupsdSetString(&ServerHeader, "CUPS/1.2");
+   cupsdSetString(&StateDir, CUPS_STATEDIR);
+ 
++  if (!strcmp(CUPS_DEFAULT_PRINTCAP, "/etc/printers.conf"))
++    PrintcapFormat = PRINTCAP_SOLARIS;
++  else
++    PrintcapFormat = PRINTCAP_BSD;
++
+   strlcpy(temp, ConfigurationFile, sizeof(temp));
+   if ((slash = strrchr(temp, '/')) != NULL)
+     *slash = '\0';
+@@ -463,6 +468,14 @@
+   RunUser = getuid();
+ 
+  /*
++  * See if the ServerName is an IP address...
++  */
++
++  for (slash = ServerName; isdigit(*slash & 255) || *slash == '.'; slash ++);
++
++  ServerNameIsIP = !*slash;
++
++ /*
+   * Use the default system group if none was supplied in cupsd.conf...
+   */
+ 
+@@ -780,6 +793,24 @@
+                   MaxClientsPerHost);
+ 
+  /*
++  * Make sure that BrowseTimeout is at least twice the interval...
++  */
++
++  if (BrowseTimeout < (2 * BrowseInterval) || BrowseTimeout <= 0)
++  {
++    cupsdLogMessage(CUPSD_LOG_ALERT, "Invalid BrowseTimeout value %d!",
++                    BrowseTimeout);
++
++    if (BrowseInterval)
++      BrowseTimeout = BrowseInterval * 2;
++    else
++      BrowseTimeout = DEFAULT_TIMEOUT;
++
++    cupsdLogMessage(CUPSD_LOG_ALERT, "Reset BrowseTimeout to %d!",
++                    BrowseTimeout);
++  }
++
++ /*
+   * Update the default policy, as needed...
+   */
+ 
+@@ -1277,33 +1308,14 @@
+   const char	*maskval,		/* Pointer to start of mask value */
+ 		*ptr,			/* Pointer into value */
+ 		*ptr2;			/* ... */
+-  static unsigned netmasks[4][4] =	/* Standard IPv4 netmasks... */
+-  {
+-    { 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000 },
+-    { 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0000 },
+-    { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffff00 },
+-    { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
+-  };
+-#ifdef AF_INET6
+-  static unsigned netmasks6[8][4] =	/* Standard IPv6 netmasks... */
+-  {
+-    { 0xffff0000, 0x00000000, 0x00000000, 0x00000000 },
+-    { 0xffffffff, 0x00000000, 0x00000000, 0x00000000 },
+-    { 0xffffffff, 0xffff0000, 0x00000000, 0x00000000 },
+-    { 0xffffffff, 0xffffffff, 0x00000000, 0x00000000 },
+-    { 0xffffffff, 0xffffffff, 0xffff0000, 0x00000000 },
+-    { 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000 },
+-    { 0xffffffff, 0xffffffff, 0xffffffff, 0xffff0000 },
+-    { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
+-  };
+-#endif /* AF_INET6 */
+ 
+ 
+  /*
+   * Get the address...
+   */
+ 
+-  memset(ip, 0, sizeof(unsigned) * 4);
++  ip[0]   = ip[1]   = ip[2]   = ip[2]   = 0x00000000;
++  mask[0] = mask[1] = mask[2] = mask[3] = 0xffffffff;
+ 
+   if ((maskval = strchr(value, '/')) != NULL)
+     maskval ++;
+@@ -1334,6 +1346,7 @@
+ 	     ptr2 = strchr(ptr2 + 1, ':'), j ++);
+ 
+         i = 7 - j;
++	ptr ++;
+       }
+       else if (isxdigit(*ptr & 255))
+       {
+@@ -1343,9 +1356,9 @@
+ 	  return (0);
+ 
+         if (i & 1)
+-          ip[i] |= ipval;
++          ip[i / 2] |= ipval;
+ 	else
+-          ip[i] |= ipval << 16;
++          ip[i / 2] |= ipval << 16;
+       }
+       else
+         return (0);
+@@ -1354,7 +1367,10 @@
+         ptr ++;
+     }
+ 
+-    ipcount = i;
++    if (*ptr != ']')
++      return (0);
++
++    ptr ++;
+ 
+     if (*ptr && *ptr != '/')
+       return (0);
+@@ -1366,70 +1382,55 @@
+     * Parse dotted-decimal IPv4 address...
+     */
+ 
+-    family  = AF_INET;
+-    ipcount = sscanf(value, "%u.%u.%u.%u", ip + 0, ip + 1, ip + 2, ip + 3);
++    unsigned val[4];			/* IPv4 address values */
+ 
+-    ip[3] |= ((((ip[0] << 8) | ip[1]) << 8) | ip[2]) << 8;
+-    ip[0] = ip[1] = ip[2] = 0;
+-  }
+ 
+-  if (*maskval)
+-  {
++    family  = AF_INET;
++    ipcount = sscanf(value, "%u.%u.%u.%u", val + 0, val + 1, val + 2, val + 3);
++
+    /*
+-    * Get the netmask value(s)...
++    * Range check the IP numbers...
+     */
+ 
+-    memset(mask, 0, sizeof(unsigned) * 4);
++    for (i = 0; i < ipcount; i ++)
++      if (val[i] > 255)
++        return (0);
+ 
+-#ifdef AF_INET6
+-    if (*maskval == '[')
+-    {
+-     /*
+-      * Get hexadecimal mask value...
+-      */
++   /*
++    * Make sure the trailing values are zeroed, as some C libraries like
++    * glibc apparently like to fill the unused arguments with garbage...
++    */
+ 
+-      for (i = 0, ptr = maskval + 1; *ptr && i < 8; i ++)
+-      {
+-	if (*ptr == ']')
+-	  break;
+-	else if (!strncmp(ptr, "::", 2))
+-	{
+-          for (ptr2 = strchr(ptr + 2, ':'), j = 0;
+-	       ptr2;
+-	       ptr2 = strchr(ptr2 + 1, ':'), j ++);
++    for (i = ipcount; i < 4; i ++)
++      val[i] = 0;
+ 
+-          i = 7 - j;
+-	}
+-	else if (isxdigit(*ptr & 255))
+-	{
+-          ipval = strtoul(ptr, (char **)&ptr, 16);
++   /*
++    * Merge everything into a 32-bit IPv4 address in ip[3]...
++    */
+ 
+-	  if (ipval > 0xffff)
+-	    return (0);
++    ip[3] = (((((val[0] << 8) | val[1]) << 8) | val[2]) << 8) | val[3];
+ 
+-          if (i & 1)
+-            mask[i] |= ipval;
+-	  else
+-            mask[i] |= ipval << 16;
+-	}
+-	else
+-          return (0);
++    if (ipcount < 4)
++      mask[3] = (0xffffffff << (32 - 8 * ipcount)) & 0xffffffff;
++  }
+ 
+-        while (*ptr == ':')
+-          ptr ++;
+-      }
++  if (*maskval)
++  {
++   /*
++    * Get the netmask value(s)...
++    */
++
++    memset(mask, 0, sizeof(unsigned) * 4);
+ 
+-      if (*ptr)
+-	return (0);
+-    }
+-    else
+-#endif /* AF_INET6 */
+     if (strchr(maskval, '.'))
+     {
+      /*
+       * Get dotted-decimal mask...
+       */
+ 
++      if (family != AF_INET)
++        return (0);
++
+       if (sscanf(maskval, "%u.%u.%u.%u", mask + 0, mask + 1, mask + 2, mask + 3) != 4)
+         return (0);
+ 
+@@ -1447,6 +1448,9 @@
+ #ifdef AF_INET6
+       if (family == AF_INET6)
+       {
++        if (i > 128)
++	  return (0);
++
+         i = 128 - i;
+ 
+ 	if (i <= 96)
+@@ -1478,25 +1482,20 @@
+       else
+ #endif /* AF_INET6 */
+       {
+-        i = 32 - i;
++        if (i > 32)
++	  return (0);
+ 
+         mask[0] = 0xffffffff;
+         mask[1] = 0xffffffff;
+         mask[2] = 0xffffffff;
+ 
+-	if (i > 0)
+-          mask[3] = (0xffffffff << i) & 0xffffffff;
++	if (i < 32)
++          mask[3] = (0xffffffff << (32 - i)) & 0xffffffff;
+ 	else
+ 	  mask[3] = 0xffffffff;
+       }
+     }
+   }
+-#ifdef AF_INET6
+-  else if (family == AF_INET6)
+-    memcpy(mask, netmasks6[ipcount - 1], sizeof(unsigned) * 4);
+-#endif /* AF_INET6 */
+-  else
+-    memcpy(mask, netmasks[ipcount - 1], sizeof(unsigned) * 4);
+ 
+   cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                   "get_addr_and_mask(value=\"%s\", "
+@@ -1634,7 +1633,12 @@
+       else
+ 	cupsdDenyIP(loc, ones, zeros);
+     }
++#ifdef AF_INET6
++    else if (value[0] == '*' || value[0] == '.' || 
++             (!isdigit(value[0] & 255) && value[0] != '['))
++#else
+     else if (value[0] == '*' || value[0] == '.' || !isdigit(value[0] & 255))
++#endif /* AF_INET6 */
+     {
+      /*
+       * Host or domain name...
+@@ -2406,7 +2410,12 @@
+ 	  else
+ 	    cupsdDenyIP(location, ones, zeros);
+ 	}
+-	else if (value[0] == '*' || value[0] == '.' || !isdigit(value[0]))
++#ifdef AF_INET6
++	else if (value[0] == '*' || value[0] == '.' || 
++        	 (!isdigit(value[0] & 255) && value[0] != '['))
++#else
++	else if (value[0] == '*' || value[0] == '.' || !isdigit(value[0] & 255))
++#endif /* AF_INET6 */
+ 	{
+ 	 /*
+           * Host or domain name...
+@@ -2490,7 +2499,12 @@
+       *    nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm
+       */
+ 
+-      if (value[0] == '*' || value[0] == '.' || !isdigit(value[0]))
++#ifdef AF_INET6
++      if (value[0] == '*' || value[0] == '.' || 
++          (!isdigit(value[0] & 255) && value[0] != '['))
++#else
++      if (value[0] == '*' || value[0] == '.' || !isdigit(value[0] & 255))
++#endif /* AF_INET6 */
+       {
+        /*
+         * Host or domain name...
+@@ -2584,7 +2598,7 @@
+ 	    strlcpy(temp2, relay->from.mask.name.name, sizeof(temp2));
+   
+ 	  cupsdLogMessage(CUPSD_LOG_INFO, "Relaying from %s to %s:%d (IPv4)",
+-			  temp, temp2, ntohs(relay->to.ipv4.sin_port));
++			  temp2, temp, ntohs(relay->to.ipv4.sin_port));
+   
+ 	  NumRelays ++;
+ 	}
+@@ -2973,7 +2987,12 @@
+ 		  n *= 262144;
+ 	      }
+ 
+-	      *((int *)var->ptr) = n;
++              if (n < 0)
++		cupsdLogMessage(CUPSD_LOG_ERROR,
++	                	"Bad negative integer value for %s on line %d!",
++				line, linenum);
++	      else
++		*((int *)var->ptr) = n;
+ 	    }
+ 	    break;
+ 
+diff -urNad cupsys-1.2.1~/scheduler/conf.h cupsys-1.2.1/scheduler/conf.h
+--- cupsys-1.2.1~/scheduler/conf.h	2006-03-02 17:47:53.000000000 +0000
++++ cupsys-1.2.1/scheduler/conf.h	2006-07-18 11:27:13.000000000 +0000
+@@ -74,6 +74,7 @@
+ 					/* Directory for request files */
+ 			*DocumentRoot		VALUE(NULL);
+ 					/* Root directory for documents */
++VAR int			ServerNameIsIP		VALUE(0);
+ VAR int			NumSystemGroups		VALUE(0);
+ 					/* Number of system group names */
+ VAR char		*SystemGroups[MAX_SYSTEM_GROUPS];
+diff -urNad cupsys-1.2.1~/scheduler/dirsvc.c cupsys-1.2.1/scheduler/dirsvc.c
+--- cupsys-1.2.1~/scheduler/dirsvc.c	2006-05-19 19:39:28.000000000 +0000
++++ cupsys-1.2.1/scheduler/dirsvc.c	2006-07-18 11:27:13.000000000 +0000
+@@ -36,6 +36,7 @@
+  *   cupsdStopPolling()            - Stop polling servers as needed.
+  *   cupsdUpdateCUPSBrowse()       - Update the browse lists using the CUPS
+  *                                   protocol.
++ *   cupsdUpdateLDAPBrowse()       - Scan for new printers via LDAP...
+  *   cupsdUpdatePolling()          - Read status messages from the poll daemons.
+  *   cupsdUpdateSLPBrowse()        - Get browsing information via SLP.
+  *   dequote()                     - Remote quotes from a string.
+@@ -211,10 +212,11 @@
+ 	else
+           p = cupsdAddPrinter(value);
+ 
+-	p->accepting   = 1;
+-	p->state       = IPP_PRINTER_IDLE;
+-	p->type        |= CUPS_PRINTER_REMOTE;
+-	p->browse_time = now + BrowseTimeout;
++	p->accepting     = 1;
++	p->state         = IPP_PRINTER_IDLE;
++	p->type          |= CUPS_PRINTER_REMOTE;
++	p->browse_time   = now;
++	p->browse_expire = now + BrowseTimeout;
+ 
+        /*
+         * Set the default printer as needed...
+@@ -251,10 +253,11 @@
+ 	else
+           p = cupsdAddClass(value);
+ 
+-	p->accepting   = 1;
+-	p->state       = IPP_PRINTER_IDLE;
+-	p->type        |= CUPS_PRINTER_REMOTE;
+-	p->browse_time = now + BrowseTimeout;
++	p->accepting     = 1;
++	p->state         = IPP_PRINTER_IDLE;
++	p->type          |= CUPS_PRINTER_REMOTE;
++	p->browse_time   = now;
++	p->browse_expire = now + BrowseTimeout;
+ 
+        /*
+         * Set the default printer as needed...
+@@ -415,8 +418,8 @@
+       {
+         time_t t = atoi(value);
+ 
+-	if (t > (now + BrowseInterval))
+-          p->browse_time = t;
++	if (t > p->browse_expire)
++          p->browse_expire = t;
+       }
+       else
+       {
+@@ -590,7 +593,7 @@
+ 
+     cupsFilePrintf(fp, "Type %d\n", printer->type);
+ 
+-    cupsFilePrintf(fp, "BrowseTime %d\n", (int)printer->browse_time);
++    cupsFilePrintf(fp, "BrowseTime %d\n", (int)printer->browse_expire);
+ 
+     if (printer->info)
+       cupsFilePrintf(fp, "Info %s\n", printer->info);
+@@ -905,14 +908,21 @@
+     fcntl(BrowseSocket, F_SETFD, fcntl(BrowseSocket, F_GETFD) | FD_CLOEXEC);
+ 
+    /*
+-    * Finally, add the socket to the input selection set...
++    * Finally, add the socket to the input selection set as needed...
+     */
+ 
+-    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+-                    "cupsdStartBrowsing: Adding fd %d to InputSet...",
+-                    BrowseSocket);
++    if (BrowseRemoteProtocols & BROWSE_CUPS)
++    {
++     /*
++      * We only listen if we want remote printers...
++      */
+ 
+-    FD_SET(BrowseSocket, InputSet);
++      cupsdLogMessage(CUPSD_LOG_DEBUG2,
++                      "cupsdStartBrowsing: Adding fd %d to InputSet...",
++                      BrowseSocket);
++
++      FD_SET(BrowseSocket, InputSet);
++    }
+   }
+   else
+     BrowseSocket = -1;
+@@ -1526,39 +1536,57 @@
+   * Loop through the available printers...
+   */
+ 
+-  if ((e = ldap_first_entry(BrowseLDAPHandle, res)) == NULL)
++  for (e = ldap_first_entry(BrowseLDAPHandle, res);
++       e;
++       e = ldap_next_entry(BrowseLDAPHandle, e))
+   {
+-    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to get LDAP printer entry!");
+-    return;
+-  }
++   /*
++    * Get the required values from this entry...
++    */
++
++    if ((value = ldap_get_values(BrowseLDAPHandle, e,
++                                 "printerDescription")) == NULL)
++      continue;
+ 
+-  while (e)
+-  {
+-    value = ldap_get_values(BrowseLDAPHandle, e, "printerDescription");
+     strlcpy(info, *value, sizeof(info));
+     ldap_value_free(value);
+ 
+-    value = ldap_get_values(BrowseLDAPHandle, e, "printerLocation");
++    if ((value = ldap_get_values(BrowseLDAPHandle, e,
++                                 "printerLocation")) == NULL)
++      continue;
++
+     strlcpy(location, *value, sizeof(location));
+     ldap_value_free(value);
+ 
+-    value = ldap_get_values(BrowseLDAPHandle, e, "printerMakeAndModel");
++    if ((value = ldap_get_values(BrowseLDAPHandle, e,
++                                 "printerMakeAndModel")) == NULL)
++      continue;
++
+     strlcpy(make_model, *value, sizeof(make_model));
+     ldap_value_free(value);
+ 
+-    value = ldap_get_values(BrowseLDAPHandle, e, "printerType");
++    if ((value = ldap_get_values(BrowseLDAPHandle, e,
++                                 "printerType")) == NULL)
++      continue;
++
+     type = atoi(*value);
+     ldap_value_free(value);
+ 
+-    value = ldap_get_values(BrowseLDAPHandle, e, "printerURI");
++    if ((value = ldap_get_values(BrowseLDAPHandle, e,
++                                 "printerURI")) == NULL)
++      continue;
++
+     strlcpy(uri, *value, sizeof(uri));
+     ldap_value_free(value);
+ 
++   /*
++    * Process the entry as browse data...
++    */
++
+     if (!is_local_queue(uri, host, sizeof(host), resource, sizeof(resource)))
+       process_browse_data(uri, host, resource, type, IPP_PRINTER_IDLE,
+                           location, info, make_model, 0, NULL);
+ 
+-    e = ldap_next_entry(BrowseLDAPHandle, e);
+   }
+ }
+ #endif /* HAVE_OPENLDAP */
+@@ -1866,7 +1894,7 @@
+   hptr   = strchr(host, '.');
+   sptr   = strchr(ServerName, '.');
+ 
+-  if (sptr != NULL && hptr != NULL)
++  if (!ServerNameIsIP && sptr != NULL && hptr != NULL)
+   {
+    /*
+     * Strip the common domain name components...
+@@ -2521,7 +2549,7 @@
+ 
+ 	  httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
+ 	                   iface->hostname, iface->port,
+-			   (p->type & CUPS_PRINTER_CLASS) ? "/classes/%s%s" :
++			   (p->type & CUPS_PRINTER_CLASS) ? "/classes/%s" :
+ 			                                    "/printers/%s",
+ 			   p->name);
+ 	  snprintf(packet, sizeof(packet), "%x %x %s \"%s\" \"%s\" \"%s\" %s\n",
+@@ -2660,13 +2688,13 @@
+ 
+   sprintf(typestring, "%u", p->type);
+ 
+-  cn_value[0]   = p->info;
++  cn_value[0]   = p->name;
+   cn_value[1]   = NULL;
+-  info[0]       = p->info;
++  info[0]       = p->info ? p->info : "Unknown";
+   info[1]       = NULL;
+-  location[0]   = p->location;
++  location[0]   = p->location ? p->location : "Unknown";
+   location[1]   = NULL;
+-  make_model[0] = p->make_model;
++  make_model[0] = p->make_model ? p->make_model : "Unknown";
+   make_model[1] = NULL;
+   type[0]       = typestring;
+   type[1]       = NULL;
+@@ -2674,7 +2702,7 @@
+   uri[1]        = NULL;
+ 
+   snprintf(filter, sizeof(filter),
+-           "(&(objectclass=cupsPrinter)(printerDescription~=%s))", p->info);
++           "(&(objectclass=cupsPrinter)(printerURI=%s))", p->uri);
+ 
+   ldap_search_s(BrowseLDAPHandle, BrowseLDAPDN, LDAP_SCOPE_SUBTREE,
+                 filter, (char **)ldap_attrs, 0, &res);
+@@ -2696,7 +2724,7 @@
+   mods[6].mod_type = "objectClass";
+   mods[6].mod_values = (char **)objectClass_values;
+ 
+-  snprintf(dn, sizeof(dn), "cn=%s,ou=printers,%s", p->info, BrowseLDAPDN);
++  snprintf(dn, sizeof(dn), "cn=%s,ou=printers,%s", p->name, BrowseLDAPDN);
+   cupsdLogMessage(CUPSD_LOG_DEBUG2, "send_ldap_browse: dn=\"%s\"", dn);
+ 
+   if (ldap_count_entries(BrowseLDAPHandle, res) > 0)
+@@ -2724,7 +2752,7 @@
+   else 
+   {
+    /*
+-    * Printer has already been registered, modify the current
++    * Printer has never been registered, add the current
+     * registration...
+     */
+ 
+@@ -2734,11 +2762,11 @@
+     for (i = 0; i < 7; i ++)
+     {
+       pmods[i]         = mods + i;
+-      pmods[i]->mod_op = LDAP_MOD_REPLACE;
++      pmods[i]->mod_op = LDAP_MOD_ADD;
+     }
+     pmods[i] = NULL;
+ 
+-    if ((rc = ldap_modify_s(BrowseLDAPHandle, dn, pmods)) != LDAP_SUCCESS)
++    if ((rc = ldap_add_s(BrowseLDAPHandle, dn, pmods)) != LDAP_SUCCESS)
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "LDAP add for %s failed with status %d: %s",
+                       p->name, rc, ldap_err2string(rc));
+diff -urNad cupsys-1.2.1~/scheduler/filter.c cupsys-1.2.1/scheduler/filter.c
+--- cupsys-1.2.1~/scheduler/filter.c	2006-05-05 16:33:57.000000000 +0000
++++ cupsys-1.2.1/scheduler/filter.c	2006-07-18 11:27:13.000000000 +0000
+@@ -346,6 +346,8 @@
+     * any...)
+     */
+ 
++    tempcost += current->cost;
++
+     if (tempcost < mincost)
+     {
+       cupsArrayDelete(mintemp);
+@@ -356,7 +358,7 @@
+       */
+ 
+       mintemp = temp;
+-      mincost = tempcost + current->cost;
++      mincost = tempcost;
+       cupsArrayInsert(mintemp, current);
+     }
+     else
+diff -urNad cupsys-1.2.1~/scheduler/ipp.c cupsys-1.2.1/scheduler/ipp.c
+--- cupsys-1.2.1~/scheduler/ipp.c	2006-05-20 12:23:40.000000000 +0000
++++ cupsys-1.2.1/scheduler/ipp.c	2006-07-18 11:27:13.000000000 +0000
+@@ -4334,7 +4334,8 @@
+   {
+     httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri, sizeof(printer_uri),
+                      "ipp", NULL, con->servername, con->serverport,
+-		     "/printers/%s", printer->name);
++		     (printer->type & CUPS_PRINTER_CLASS) ?
++		         "/classes/%s" : "/printers/%s", printer->name);
+     ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_URI,
+         	 "printer-uri-supported", NULL, printer_uri);
+     cupsdLogMessage(CUPSD_LOG_DEBUG2, "printer-uri-supported=\"%s\"",
+@@ -4677,8 +4678,8 @@
+   ipp_attribute_t	*attr;		/* Current attribute */
+   const char		*dest;		/* Destination */
+   cups_ptype_t		dtype;		/* Destination type (printer or class) */
+-  char			method[HTTP_MAX_URI],
+-					/* Method portion of URI */
++  char			scheme[HTTP_MAX_URI],
++					/* Scheme portion of URI */
+ 			userpass[HTTP_MAX_URI],
+ 					/* Username portion of URI */
+ 			host[HTTP_MAX_URI],
+@@ -4718,8 +4719,8 @@
+                   "cupsdCreateSubscription(con=%p(%d), uri=\"%s\")",
+                   con, con->http.fd, uri->values[0].string.text);
+ 
+-  httpSeparateURI(HTTP_URI_CODING_ALL, uri->values[0].string.text, method,
+-                  sizeof(method), userpass, sizeof(userpass), host,
++  httpSeparateURI(HTTP_URI_CODING_ALL, uri->values[0].string.text, scheme,
++                  sizeof(scheme), userpass, sizeof(userpass), host,
+ 		  sizeof(host), &port, resource, sizeof(resource));
+ 
+   if (!strcmp(resource, "/"))
+@@ -4811,10 +4812,55 @@
+     {
+       if (!strcmp(attr->name, "notify-recipient") &&
+           attr->value_tag == IPP_TAG_URI)
++      {
++       /*
++        * Validate the recipient scheme against the ServerBin/notifier
++	* directory...
++	*/
++
++	char	notifier[1024];		/* Notifier filename */
++
++
+         recipient = attr->values[0].string.text;
++
++	if (httpSeparateURI(HTTP_URI_CODING_ALL, recipient,
++	                    scheme, sizeof(scheme), userpass, sizeof(userpass),
++			    host, sizeof(host), &port,
++			    resource, sizeof(resource)) < HTTP_URI_OK)
++        {
++          send_ipp_status(con, IPP_NOT_POSSIBLE,
++	                  _("Bad notify-recipient URI \"%s\"!"), recipient);
++	  ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM,
++	                "notify-status-code", IPP_URI_SCHEME);
++	  return;
++	}
++
++        snprintf(notifier, sizeof(notifier), "%s/notifier/%s", ServerBin,
++	         scheme);
++        if (access(notifier, X_OK))
++	{
++          send_ipp_status(con, IPP_NOT_POSSIBLE,
++	                  _("notify-recipient URI \"%s\" uses unknown scheme!"),
++			  recipient);
++	  ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM,
++	                "notify-status-code", IPP_URI_SCHEME);
++	  return;
++	}
++      }
+       else if (!strcmp(attr->name, "notify-pull-method") &&
+                attr->value_tag == IPP_TAG_KEYWORD)
++      {
+         pullmethod = attr->values[0].string.text;
++
++        if (strcmp(pullmethod, "ippget"))
++	{
++          send_ipp_status(con, IPP_NOT_POSSIBLE,
++	                  _("Bad notify-pull-method \"%s\"!"), pullmethod);
++	  ippAddInteger(con->response, IPP_TAG_SUBSCRIPTION, IPP_TAG_ENUM,
++	                "notify-status-code", IPP_ATTRIBUTES);
++	  return;
++	}
++      }
+       else if (!strcmp(attr->name, "notify-charset") &&
+                attr->value_tag == IPP_TAG_CHARSET &&
+ 	       strcmp(attr->values[0].string.text, "us-ascii") &&
+@@ -8764,19 +8810,11 @@
+   cupsdStartPrinter(printer, 1);
+ 
+   if (dtype & CUPS_PRINTER_CLASS)
+-  {
+     cupsdLogMessage(CUPSD_LOG_INFO, "Class \"%s\" started by \"%s\".", name,
+                     get_username(con));
+-    cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED, printer, NULL,
+-                  "Class \"%s\" started by \"%s\".", name, get_username(con));
+-  }
+   else
+-  {
+     cupsdLogMessage(CUPSD_LOG_INFO, "Printer \"%s\" started by \"%s\".", name,
+                     get_username(con));
+-    cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED, printer, NULL,
+-                  "Printer \"%s\" started by \"%s\".", name, get_username(con));
+-  }
+ 
+   cupsdCheckJobs();
+ 
+@@ -8860,19 +8898,11 @@
+   cupsdStopPrinter(printer, 1);
+ 
+   if (dtype & CUPS_PRINTER_CLASS)
+-  {
+     cupsdLogMessage(CUPSD_LOG_INFO, "Class \"%s\" stopped by \"%s\".", name,
+                     get_username(con));
+-    cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED, printer, NULL,
+-                  "Class \"%s\" stopped by \"%s\".", name, get_username(con));
+-  }
+   else
+-  {
+     cupsdLogMessage(CUPSD_LOG_INFO, "Printer \"%s\" stopped by \"%s\".", name,
+                     get_username(con));
+-    cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED, printer, NULL,
+-                  "Printer \"%s\" stopped by \"%s\".", name, get_username(con));
+-  }
+ 
+  /*
+   * Everything was ok, so return OK status...
+diff -urNad cupsys-1.2.1~/scheduler/job.c cupsys-1.2.1/scheduler/job.c
+--- cupsys-1.2.1~/scheduler/job.c	2006-05-18 21:00:56.000000000 +0000
++++ cupsys-1.2.1/scheduler/job.c	2006-07-18 11:27:13.000000000 +0000
+@@ -506,8 +506,19 @@
+ 	  */
+ 
+ 	  cupsdStopJob(job, 0);
+-	  job->state->values[0].integer = IPP_JOB_PENDING;
+-	  job->state_value              = IPP_JOB_PENDING;
++
++          if (!(printer->type & CUPS_PRINTER_REMOTE) ||
++	      (printer->type & CUPS_PRINTER_IMPLICIT))
++	  {
++	   /*
++	    * Mark the job as pending again - we'll retry on another
++	    * printer...
++	    */
++
++	    job->state->values[0].integer = IPP_JOB_PENDING;
++	    job->state_value              = IPP_JOB_PENDING;
++          }
++
+ 	  cupsdSaveJob(job);
+ 
+ 	 /*
+@@ -1753,8 +1764,8 @@
+   int	diff;				/* Difference */
+ 
+ 
+-  if ((diff = ((cupsd_job_t *)first)->priority -
+-              ((cupsd_job_t *)second)->priority) != 0)
++  if ((diff = ((cupsd_job_t *)second)->priority -
++              ((cupsd_job_t *)first)->priority) != 0)
+     return (diff);
+   else
+     return (((cupsd_job_t *)first)->id - ((cupsd_job_t *)second)->id);
+@@ -3011,7 +3022,7 @@
+   {
+     snprintf(final_content_type, sizeof(final_content_type),
+              "FINAL_CONTENT_TYPE=%s/%s",
+-	     filter->dst->super, filter->dst->type);
++	     filter->src->super, filter->src->type);
+     envp[envc ++] = final_content_type;
+   }
+ 
+@@ -3090,28 +3101,6 @@
+   job->status = 0;
+   memset(job->filters, 0, sizeof(job->filters));
+ 
+-  filterfds[1][0] = open("/dev/null", O_RDONLY);
+-
+-  if (filterfds[1][0] < 0)
+-  {
+-    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open \"/dev/null\" - %s.",
+-                    strerror(errno));
+-    snprintf(printer->state_message, sizeof(printer->state_message),
+-             "Unable to open \"/dev/null\" - %s.", strerror(errno));
+-
+-    cupsdAddPrinterHistory(printer);
+-
+-    cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
+-                  "Job canceled because the server could not open /dev/null.");
+-
+-    goto abort_job;
+-  }
+-
+-  fcntl(filterfds[1][0], F_SETFD, fcntl(filterfds[1][0], F_GETFD) | FD_CLOEXEC);
+-
+-  cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: filterfds[%d] = [ %d %d ]",
+-                  1, filterfds[1][0], filterfds[1][1]);
+-
+   for (i = 0, slot = 0, filter = (mime_filter_t *)cupsArrayFirst(filters);
+        filter;
+        i ++, filter = (mime_filter_t *)cupsArrayNext(filters))
+@@ -3165,36 +3154,43 @@
+ 	else
+ 	{
+ 	  job->print_pipes[0] = -1;
+-	  if (!strncmp(printer->device_uri, "file:/dev/", 10) &&
+-	      strcmp(printer->device_uri, "file:/dev/null"))
+-	    job->print_pipes[1] = open(printer->device_uri + 5,
+-	                               O_WRONLY | O_EXCL);
+-	  else if (!strncmp(printer->device_uri, "file:///dev/", 12) &&
+-	           strcmp(printer->device_uri, "file:///dev/null"))
+-	    job->print_pipes[1] = open(printer->device_uri + 7,
+-	                               O_WRONLY | O_EXCL);
++	  if (!strcmp(printer->device_uri, "file:/dev/null") ||
++	      !strcmp(printer->device_uri, "file:///dev/null"))
++	    job->print_pipes[1] = -1;
+ 	  else
+-	    job->print_pipes[1] = open(printer->device_uri + 5,
+-	                               O_WRONLY | O_CREAT | O_TRUNC, 0600);
+-
+-	  if (job->print_pipes[1] < 0)
+ 	  {
+-            cupsdLogMessage(CUPSD_LOG_ERROR,
+-	                    "Unable to open output file \"%s\" - %s.",
+-	                    printer->device_uri, strerror(errno));
+-            snprintf(printer->state_message, sizeof(printer->state_message),
+-		     "Unable to open output file \"%s\" - %s.",
+-	             printer->device_uri, strerror(errno));
++	    if (!strncmp(printer->device_uri, "file:/dev/", 10))
++	      job->print_pipes[1] = open(printer->device_uri + 5,
++	                        	 O_WRONLY | O_EXCL);
++	    else if (!strncmp(printer->device_uri, "file:///dev/", 12))
++	      job->print_pipes[1] = open(printer->device_uri + 7,
++	                        	 O_WRONLY | O_EXCL);
++	    else if (!strncmp(printer->device_uri, "file:///", 8))
++	      job->print_pipes[1] = open(printer->device_uri + 7,
++	                        	 O_WRONLY | O_CREAT | O_TRUNC, 0600);
++	    else
++	      job->print_pipes[1] = open(printer->device_uri + 5,
++	                        	 O_WRONLY | O_CREAT | O_TRUNC, 0600);
+ 
+-	    cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
+-                	  "Job canceled because the server could not open the "
+-			  "output file.");
++	    if (job->print_pipes[1] < 0)
++	    {
++              cupsdLogMessage(CUPSD_LOG_ERROR,
++	                      "Unable to open output file \"%s\" - %s.",
++	                      printer->device_uri, strerror(errno));
++              snprintf(printer->state_message, sizeof(printer->state_message),
++		       "Unable to open output file \"%s\" - %s.",
++	               printer->device_uri, strerror(errno));
+ 
+-            goto abort_job;
+-	  }
++	      cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
++                	    "Job canceled because the server could not open the "
++			    "output file.");
+ 
+-	  fcntl(job->print_pipes[1], F_SETFD,
+-        	fcntl(job->print_pipes[1], F_GETFD) | FD_CLOEXEC);
++              goto abort_job;
++	    }
++
++	    fcntl(job->print_pipes[1], F_SETFD,
++        	  fcntl(job->print_pipes[1], F_GETFD) | FD_CLOEXEC);
++          }
+ 	}
+ 
+ 	cupsdLogMessage(CUPSD_LOG_DEBUG2,
+@@ -3274,25 +3270,7 @@
+       argv[0] = sani_uri;
+ 
+       filterfds[slot][0] = -1;
+-      filterfds[slot][1] = open("/dev/null", O_WRONLY);
+-
+-      if (filterfds[slot][1] < 0)
+-      {
+-	cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open \"/dev/null\" - %s.",
+-	                strerror(errno));
+-	snprintf(printer->state_message, sizeof(printer->state_message),
+-        	 "Unable to open \"/dev/null\" - %s.", strerror(errno));
+-
+-	cupsdAddPrinterHistory(printer);
+-
+-	cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
+-                      "Job canceled because the server could not open a file.");
+-
+-        goto abort_job;
+-      }
+-
+-      fcntl(filterfds[slot][1], F_SETFD,
+-            fcntl(filterfds[slot][1], F_GETFD) | FD_CLOEXEC);
++      filterfds[slot][1] = -1;
+ 
+       cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: backend=\"%s\"",
+                       command);
+diff -urNad cupsys-1.2.1~/scheduler/listen.c cupsys-1.2.1/scheduler/listen.c
+--- cupsys-1.2.1~/scheduler/listen.c	2006-02-06 02:57:43.000000000 +0000
++++ cupsys-1.2.1/scheduler/listen.c	2006-07-18 11:27:13.000000000 +0000
+@@ -331,7 +331,7 @@
+     * "any" address...
+     */
+ 
+-    if (!LocalPort && p > 0 &&
++    if ((!LocalPort || LocalEncryption == HTTP_ENCRYPT_ALWAYS) && p > 0 &&
+         (httpAddrLocalhost(&(lis->address)) ||
+          httpAddrAny(&(lis->address))))
+     {
+@@ -373,6 +373,8 @@
+     */
+ 
+     cupsdSetEnv("CUPS_SERVER", have_domain);
++
++    LocalEncryption = HTTP_ENCRYPT_IF_REQUESTED;
+   }
+   else
+   {
+diff -urNad cupsys-1.2.1~/scheduler/main.c cupsys-1.2.1/scheduler/main.c
+--- cupsys-1.2.1~/scheduler/main.c	2006-05-04 20:53:35.000000000 +0000
++++ cupsys-1.2.1/scheduler/main.c	2006-07-18 11:27:13.000000000 +0000
+@@ -357,8 +357,8 @@
+ 
+   getrlimit(RLIMIT_NOFILE, &limit);
+ 
+-  if (limit.rlim_max > CUPS_MAX_FDS)
+-    MaxFDs = CUPS_MAX_FDS;
++  if (limit.rlim_max > FD_SETSIZE)
++    MaxFDs = FD_SETSIZE;
+   else
+     MaxFDs = limit.rlim_max;
+ 
+diff -urNad cupsys-1.2.1~/scheduler/mime.c cupsys-1.2.1/scheduler/mime.c
+--- cupsys-1.2.1~/scheduler/mime.c	2006-05-05 17:58:07.000000000 +0000
++++ cupsys-1.2.1/scheduler/mime.c	2006-07-18 11:27:13.000000000 +0000
+@@ -51,6 +51,7 @@
+ #include <stdlib.h>
+ #include <ctype.h>
+ 
++#include <cups/debug.h>
+ #include <cups/dir.h>
+ #include <cups/string.h>
+ #include "mime.h"
+@@ -486,6 +487,8 @@
+   if ((fp = cupsFileOpen(filename, "r")) == NULL)
+     return;
+ 
++  DEBUG_printf(("\"%s\":\n", filename));
++
+  /*
+   * Then read each line from the file, skipping any comments in the file...
+   */
+@@ -496,6 +499,8 @@
+     * Skip blank lines and lines starting with a #...
+     */
+ 
++    DEBUG_puts(line);
++
+     if (!line[0] || line[0] == '#')
+       continue;
+ 
+@@ -544,7 +549,10 @@
+       continue;
+ 
+     if ((dsttype = mimeType(mime, super, type)) == NULL)
++    {
++      DEBUG_printf(("    Destination type %s/%s not found!\n", super, type));
+       continue;
++    }
+ 
+    /*
+     * Then get the cost and filter program...
+@@ -575,7 +583,10 @@
+       */
+ 
+       if (!add_fcache(filtercache, filter, filterpath))
++      {
++        DEBUG_printf(("    Filter %s not found in %s!\n", filter, filterpath)); 
+         continue;
++      }
+     }
+ 
+    /*
+@@ -655,6 +666,8 @@
+   if ((fp = cupsFileOpen(filename, "r")) == NULL)
+     return;
+ 
++  DEBUG_printf(("\"%s\":\n", filename));
++
+  /*
+   * Then read each line from the file, skipping any comments in the file...
+   */
+@@ -665,6 +678,8 @@
+     * Skip blank lines and lines starting with a #...
+     */
+ 
++    DEBUG_puts(line);
++
+     if (!line[0] || line[0] == '#')
+       continue;
+ 
+diff -urNad cupsys-1.2.1~/scheduler/printers.c cupsys-1.2.1/scheduler/printers.c
+--- cupsys-1.2.1~/scheduler/printers.c	2006-05-16 19:47:26.000000000 +0000
++++ cupsys-1.2.1/scheduler/printers.c	2006-07-18 11:27:13.000000000 +0000
+@@ -62,6 +62,7 @@
+  */
+ 
+ #include "cupsd.h"
++#include <cups/dir.h>
+ 
+ 
+ /*
+@@ -257,6 +258,11 @@
+ {
+   int			i;		/* Looping var */
+   ipp_attribute_t	*attr;		/* Attribute data */
++  cups_dir_t		*dir;		/* Notifier directory */
++  cups_dentry_t		*dent;		/* Notifier directory entry */
++  cups_array_t		*notifiers;	/* Notifier array */
++  char			filename[1024],	/* Filename */
++			*notifier;	/* Current notifier */
+   static const int nups[] =		/* number-up-supported values */
+ 		{ 1, 2, 4, 6, 9, 16 };
+   static const ipp_orient_t orients[4] =/* orientation-requested-supported values */
+@@ -502,11 +508,11 @@
+   ippAddInteger(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
+                "notify-max-events-supported", MaxEvents);
+ 
+-  /* notify-notify-events-default */
++  /* notify-events-default */
+   ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+                "notify-events-default", NULL, "job-completed");
+ 
+-  /* notify-notify-events-supported */
++  /* notify-events-supported */
+   ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+                 "notify-events-supported",
+ 		(int)(sizeof(notify_events) / sizeof(notify_events[0])),
+@@ -516,10 +522,32 @@
+   ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+                "notify-pull-method-supported", NULL, "ippget");
+ 
+-  /* TODO: scan notifier directory */
+   /* notify-schemes-supported */
+-  ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+-               "notify-schemes-supported", NULL, "mailto");
++  snprintf(filename, sizeof(filename), "%s/notifier", ServerBin);
++  if ((dir = cupsDirOpen(filename)) != NULL)
++  {
++    notifiers = cupsArrayNew((cups_array_func_t)strcmp, NULL);
++
++    while ((dent = cupsDirRead(dir)) != NULL)
++      if (S_ISREG(dent->fileinfo.st_mode) &&
++          (dent->fileinfo.st_mode & S_IXOTH) != 0)
++        cupsArrayAdd(notifiers, _cupsStrAlloc(dent->filename));
++
++    if (cupsArrayCount(notifiers) > 0)
++    {
++      attr = ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
++        	           "notify-schemes-supported",
++			   cupsArrayCount(notifiers), NULL, NULL);
++
++      for (i = 0, notifier = (char *)cupsArrayFirst(notifiers);
++           notifier;
++	   i ++, notifier = (char *)cupsArrayNext(notifiers))
++	attr->values[i].string.text = notifier;
++    }
++
++    cupsArrayDelete(notifiers);
++    cupsDirClose(dir);
++  }
+ 
+   /* number-up-supported */
+   ippAddIntegers(CommonData, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
+@@ -618,6 +646,9 @@
+ 
+   cupsArrayRemove(Printers, p);
+ 
++  if (p->type & CUPS_PRINTER_IMPLICIT)
++    cupsArrayRemove(ImplicitPrinters, p);
++
+  /*
+   * Remove the dummy interface/icon/option files under IRIX...
+   */
+@@ -665,7 +696,7 @@
+ 	   dp = (cupsd_printer_t *)cupsArrayNext(Printers))
+ 	if (dp != p && (dp->type & CUPS_PRINTER_DEFAULT))
+ 	{
+-	  DefaultPrinter = p;
++	  DefaultPrinter = dp;
+ 	  break;
+ 	}
+     }
+@@ -1233,6 +1264,7 @@
+   */
+ 
+   cupsArrayAdd(Printers, p);
++
+   if (p->type & CUPS_PRINTER_IMPLICIT)
+     cupsArrayAdd(ImplicitPrinters, p);
+ }
+diff -urNad cupsys-1.2.1~/scheduler/subscriptions.c cupsys-1.2.1/scheduler/subscriptions.c
+--- cupsys-1.2.1~/scheduler/subscriptions.c	2006-03-18 03:05:12.000000000 +0000
++++ cupsys-1.2.1/scheduler/subscriptions.c	2006-07-18 11:27:13.000000000 +0000
+@@ -36,7 +36,6 @@
+  *   cupsdStopAllNotifiers()       - Stop all notifier processes.
+  *   cupsdUpdateNotifierStatus()   - Read messages from notifiers.
+  *   cupsd_compare_subscriptions() - Compare two subscriptions.
+- *   cupsd_delete_all_events()     - Delete all cached events.
+  *   cupsd_delete_event()          - Delete a single event...
+  *   cupsd_send_dbus()             - Send a DBUS notification...
+  *   cupsd_send_notification()     - Send a notification for the specified
+@@ -61,7 +60,6 @@
+ static int	cupsd_compare_subscriptions(cupsd_subscription_t *first,
+ 		                            cupsd_subscription_t *second,
+ 		                            void *unused);
+-static void	cupsd_delete_all_events(void);
+ static void	cupsd_delete_event(cupsd_event_t *event);
+ #ifdef HAVE_DBUS
+ static void	cupsd_send_dbus(cupsd_eventmask_t event, cupsd_printer_t *dest,
+@@ -91,6 +89,11 @@
+   cupsd_subscription_t	*sub;		/* Current subscription */
+ 
+ 
++  cupsdLogMessage(CUPSD_LOG_DEBUG2,
++                  "cupsdAddEvent(event=%s, dest=%p(%s), job=%p(%d), text=\"%s\", ...)",
++		  cupsdEventName(event), dest, dest ? dest->name : "",
++		  job, job ? job->id : 0, text);
++
+  /*
+   * Keep track of events with any OS-supplied notification mechanisms...
+   */
+@@ -114,29 +117,11 @@
+   }
+ 
+  /*
+-  * Allocate memory for the event cache as needed...
+-  */
+-
+-  if (!Events)
+-  {
+-    Events    = calloc(MaxEvents, sizeof(cupsd_event_t *));
+-    NumEvents = 0;
+-
+-    if (!Events)
+-    {
+-      cupsdLogMessage(CUPSD_LOG_CRIT,
+-                      "Unable to allocate memory for event cache - %s",
+-        	      strerror(errno));
+-      return;
+-    }
+-  }
+-
+- /*
+   * Then loop through the subscriptions and add the event to the corresponding
+   * caches...
+   */
+ 
+-  for (sub = (cupsd_subscription_t *)cupsArrayFirst(Subscriptions), temp = NULL;
++  for (temp = NULL, sub = (cupsd_subscription_t *)cupsArrayFirst(Subscriptions);
+        sub;
+        sub = (cupsd_subscription_t *)cupsArrayNext(Subscriptions))
+   {
+@@ -149,178 +134,161 @@
+ 	(sub->job == job || !sub->job))
+     {
+      /*
+-      * Need this event...
++      * Need this event, so create a new event record...
+       */
+ 
+-      if (!temp)
++      if ((temp = (cupsd_event_t *)calloc(1, sizeof(cupsd_event_t))) == NULL)
+       {
+-       /*
+-	* Create the new event record...
+-	*/
++	cupsdLogMessage(CUPSD_LOG_CRIT,
++	                "Unable to allocate memory for event - %s",
++        	        strerror(errno));
++	return;
++      }
+ 
+-	if ((temp = (cupsd_event_t *)calloc(1, sizeof(cupsd_event_t))) == NULL)
+-	{
+-	  cupsdLogMessage(CUPSD_LOG_CRIT,
+-	                  "Unable to allocate memory for event - %s",
+-        	          strerror(errno));
+-	  return;
+-	}
++      temp->event = event;
++      temp->time  = time(NULL);
++      temp->attrs = ippNew();
++      temp->job   = job;
++      temp->dest  = dest;
+ 
+-	temp->event = event;
+-	temp->time  = time(NULL);
+-	temp->attrs = ippNew();
+-	temp->job   = job;
+-	temp->dest  = dest;
++     /*
++      * Add common event notification attributes...
++      */
+ 
+-       /*
+-        * Add common event notification attributes...
+-	*/
++      ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_CHARSET,
++                   "notify-charset", NULL, "utf-8");
+ 
+-        ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
+-	              "notify-subscription-id", sub->id);
++      ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_LANGUAGE,
++                   "notify-natural-langugage", NULL, "en-US");
+ 
+-	ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD,
+-	             "notify-subscribed-event", NULL, cupsdEventName(event));
++      ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
++	            "notify-subscription-id", sub->id);
+ 
+-        ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
+-	              "printer-up-time", time(NULL));
++      ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
++	            "notify-sequence-number", sub->next_event_id);
+ 
+-        va_start(ap, text);
+-	vsnprintf(ftext, sizeof(ftext), text, ap);
+-	va_end(ap);
++      ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD,
++	           "notify-subscribed-event", NULL, cupsdEventName(event));
+ 
+-	ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_TEXT,
+-	             "notify-text", NULL, ftext);
++      if (sub->user_data_len > 0)
++        ippAddOctetString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
++	                  "notify-user-data", sub->user_data,
++			  sub->user_data_len);
+ 
+-        if (dest)
+-	{
+-	 /*
+-	  * Add printer attributes...
+-	  */
++      ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
++	            "printer-up-time", time(NULL));
+ 
+-	  ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_URI,
+-	               "notify-printer-uri", NULL, dest->uri);
++      va_start(ap, text);
++      vsnprintf(ftext, sizeof(ftext), text, ap);
++      va_end(ap);
+ 
+-	  ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME,
+-	               "printer-name", NULL, dest->name);
++      ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_TEXT,
++	           "notify-text", NULL, ftext);
+ 
+-	  ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM,
+-	                "printer-state", dest->state);
++      if (dest)
++      {
++       /*
++	* Add printer attributes...
++	*/
+ 
+-	  if (dest->num_reasons == 0)
+-	    ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
+-	                 IPP_TAG_KEYWORD, "printer-state-reasons", NULL,
+-			 dest->state == IPP_PRINTER_STOPPED ? "paused" : "none");
+-	  else
+-	    ippAddStrings(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
+-	                  IPP_TAG_KEYWORD, "printer-state-reasons",
+-			  dest->num_reasons, NULL,
+-			  (const char * const *)dest->reasons);
++	ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_URI,
++	             "notify-printer-uri", NULL, dest->uri);
+ 
+-	  ippAddBoolean(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
+-	                "printer-is-accepting-jobs", dest->accepting);
+-        }
++	ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME,
++	             "printer-name", NULL, dest->name);
+ 
+-        if (job)
+-	{
+-	 /*
+-	  * Add job attributes...
+-	  */
++	ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM,
++	              "printer-state", dest->state);
+ 
+-	  ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
+-	                "notify-job-id", job->id);
+-	  ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM,
+-	                "job-state", job->state_value);
++	if (dest->num_reasons == 0)
++	  ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
++	               IPP_TAG_KEYWORD, "printer-state-reasons", NULL,
++		       dest->state == IPP_PRINTER_STOPPED ? "paused" : "none");
++	else
++	  ippAddStrings(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
++	                IPP_TAG_KEYWORD, "printer-state-reasons",
++			dest->num_reasons, NULL,
++			(const char * const *)dest->reasons);
+ 
+-          if ((attr = ippFindAttribute(job->attrs, "job-name",
+-	                               IPP_TAG_NAME)) != NULL)
+-	    ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME,
+-	        	 "job-name", NULL, attr->values[0].string.text);
++	ippAddBoolean(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
++	              "printer-is-accepting-jobs", dest->accepting);
++      }
+ 
+-	  switch (job->state_value)
+-	  {
+-	    case IPP_JOB_PENDING :
+-        	if (dest && dest->state == IPP_PRINTER_STOPPED)
+-        	  ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
+-		               IPP_TAG_KEYWORD, "job-state-reasons", NULL,
+-			       "printer-stopped");
+-        	else
+-        	  ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
+-		               IPP_TAG_KEYWORD, "job-state-reasons", NULL,
+-			       "none");
+-        	break;
++      if (job)
++      {
++       /*
++	* Add job attributes...
++	*/
+ 
+-	    case IPP_JOB_HELD :
+-        	if (ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_KEYWORD) != NULL ||
+-		    ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_NAME) != NULL)
+-        	  ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
+-		               IPP_TAG_KEYWORD, "job-state-reasons", NULL,
+-			       "job-hold-until-specified");
+-        	else
+-        	  ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
+-		               IPP_TAG_KEYWORD, "job-state-reasons", NULL,
+-			       "job-incoming");
+-        	break;
++	ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
++	              "notify-job-id", job->id);
++	ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM,
++	              "job-state", job->state_value);
+ 
+-	    case IPP_JOB_PROCESSING :
+-        	ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
+-		             IPP_TAG_KEYWORD, "job-state-reasons", NULL,
+-			     "job-printing");
+-        	break;
++        if ((attr = ippFindAttribute(job->attrs, "job-name",
++	                             IPP_TAG_NAME)) != NULL)
++	  ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME,
++	               "job-name", NULL, attr->values[0].string.text);
+ 
+-	    case IPP_JOB_STOPPED :
++	switch (job->state_value)
++	{
++	  case IPP_JOB_PENDING :
++              if (dest && dest->state == IPP_PRINTER_STOPPED)
+         	ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
+ 		             IPP_TAG_KEYWORD, "job-state-reasons", NULL,
+-			     "job-stopped");
+-        	break;
+-
+-	    case IPP_JOB_CANCELLED :
++			     "printer-stopped");
++              else
+         	ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
+ 		             IPP_TAG_KEYWORD, "job-state-reasons", NULL,
+-			     "job-canceled-by-user");
+-        	break;
++			     "none");
++              break;
+ 
+-	    case IPP_JOB_ABORTED :
++	  case IPP_JOB_HELD :
++              if (ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_KEYWORD) != NULL ||
++		  ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_NAME) != NULL)
+         	ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
+ 		             IPP_TAG_KEYWORD, "job-state-reasons", NULL,
+-			     "aborted-by-system");
+-        	break;
+-
+-	    case IPP_JOB_COMPLETED :
++			     "job-hold-until-specified");
++              else
+         	ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
+ 		             IPP_TAG_KEYWORD, "job-state-reasons", NULL,
+-			     "job-completed-successfully");
+-        	break;
+-	  }
+-
+-	  ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
+-	                "job-impressions-completed",
+-			job->sheets ? job->sheets->values[0].integer : 0);
+-	}
++			     "job-incoming");
++              break;
+ 
+-       /*
+-	* Purge an old event as needed...
+-	*/
++	  case IPP_JOB_PROCESSING :
++              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
++		           IPP_TAG_KEYWORD, "job-state-reasons", NULL,
++			   "job-printing");
++              break;
+ 
+-	if (NumEvents >= MaxEvents)
+-	{
+-	 /*
+-	  * Purge the oldest event in the cache...
+-	  */
++	  case IPP_JOB_STOPPED :
++              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
++		           IPP_TAG_KEYWORD, "job-state-reasons", NULL,
++			   "job-stopped");
++              break;
+ 
+-	  cupsd_delete_event(Events[0]);
++	  case IPP_JOB_CANCELLED :
++              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
++		           IPP_TAG_KEYWORD, "job-state-reasons", NULL,
++			   "job-canceled-by-user");
++              break;
+ 
+-	  NumEvents --;
++	  case IPP_JOB_ABORTED :
++              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
++		           IPP_TAG_KEYWORD, "job-state-reasons", NULL,
++			   "aborted-by-system");
++              break;
+ 
+-	  memmove(Events, Events + 1, NumEvents * sizeof(cupsd_event_t *));
++	  case IPP_JOB_COMPLETED :
++              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
++		           IPP_TAG_KEYWORD, "job-state-reasons", NULL,
++			   "job-completed-successfully");
++              break;
+ 	}
+ 
+-       /*
+-	* Add the new event to the main cache...
+-	*/
+-
+-	Events[NumEvents] = temp;
+-	NumEvents ++;
++	ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
++	              "job-impressions-completed",
++		      job->sheets ? job->sheets->values[0].integer : 0);
+       }
+ 
+      /*
+@@ -438,8 +406,6 @@
+   cupsd_subscription_t	*sub;		/* Subscription */
+ 
+ 
+-  cupsd_delete_all_events();
+-
+   if (!Subscriptions)
+     return;
+ 
+@@ -462,6 +428,9 @@
+     cupsd_subscription_t *sub,		/* I - Subscription object */
+     int                  update)	/* I - 1 = update subscriptions.conf */
+ {
++  int	i;				/* Looping var */
++
++
+  /*
+   * Close the pipe to the notifier as needed...
+   */
+@@ -483,7 +452,12 @@
+   cupsdClearString(&(sub->recipient));
+ 
+   if (sub->events)
++  {
++    for (i = 0; i < sub->num_events; i ++)
++      cupsd_delete_event(sub->events[i]);
++
+     free(sub->events);
++  }
+ 
+   free(sub);
+ 
+@@ -1300,27 +1274,6 @@
+ 
+ 
+ /*
+- * 'cupsd_delete_all_events()' - Delete all cached events.
+- */
+-
+-static void
+-cupsd_delete_all_events(void)
+-{
+-  int	i;				/* Looping var */
+-
+-
+-  if (MaxEvents <= 0 || !Events)
+-    return;
+-
+-  for (i = 0; i < NumEvents; i ++)
+-    cupsd_delete_event(Events[i]);
+-
+-  free(Events);
+-  Events = NULL;
+-}
+-
+-
+-/*
+  * 'cupsd_delete_event()' - Delete a single event...
+  *
+  * Oldest events must be deleted first, otherwise the subscription cache
+@@ -1330,43 +1283,6 @@
+ static void
+ cupsd_delete_event(cupsd_event_t *event)/* I - Event to delete */
+ {
+-  cupsd_subscription_t	*sub;		/* Current subscription */
+-
+-
+- /*
+-  * Loop through the subscriptions and look for the event in the cache...
+-  */
+-
+-  for (sub = (cupsd_subscription_t *)cupsArrayFirst(Subscriptions);
+-       sub;
+-       sub = (cupsd_subscription_t *)cupsArrayNext(Subscriptions))
+-  {
+-   /*
+-    * Only check the first event in the subscription cache, since the
+-    * caller will only delete the oldest event in the cache...
+-    */
+-
+-    if (sub->num_events > 0 && sub->events[0] == event)
+-    {
+-     /*
+-      * Remove this event...
+-      */
+-
+-      sub->num_events --;
+-      sub->first_event_id ++;
+-
+-      if (sub->num_events > 0)
+-      {
+-       /*
+-        * Shift other events upward in cache...
+-	*/
+-
+-        memmove(sub->events, sub->events + 1,
+-	        sub->num_events * sizeof(cupsd_event_t *));
+-      }
+-    }
+-  }
+-
+  /*
+   * Free memory...
+   */
+@@ -1468,7 +1384,7 @@
+   ipp_state_t	state;			/* IPP event state */
+ 
+ 
+-  cupsdLogMessage(CUPSD_LOG_DEBUG,
++  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                   "cupsd_send_notification(sub=%p(%d), event=%p(%s))\n",
+                   sub, sub->id, event, cupsdEventName(event->event));
+ 
+@@ -1490,6 +1406,25 @@
+   }
+ 
+  /*
++  * Purge an old event as needed...
++  */
++
++  if (sub->num_events >= MaxEvents)
++  {
++   /*
++    * Purge the oldest event in the cache...
++    */
++
++    cupsd_delete_event(sub->events[0]);
++
++    sub->num_events --;
++    sub->first_event_id ++;
++
++    memmove(sub->events, sub->events + 1,
++	    sub->num_events * sizeof(cupsd_event_t *));
++  }
++
++ /*
+   * Add the event to the subscription.  Since the events array is
+   * always MaxEvents in length, and since we will have already
+   * removed an event from the subscription cache if we hit the
+@@ -1505,13 +1440,16 @@
+ 
+   if (sub->recipient)
+   {
+-    if (sub->pipe < 0)
+-      cupsd_start_notifier(sub);
++    for (;;)
++    {
++      if (sub->pipe < 0)
++	cupsd_start_notifier(sub);
+ 
+-    cupsdLogMessage(CUPSD_LOG_DEBUG, "sub->pipe=%d", sub->pipe);
++      cupsdLogMessage(CUPSD_LOG_DEBUG2, "sub->pipe=%d", sub->pipe);
++
++      if (sub->pipe < 0)
++	break;
+ 
+-    if (sub->pipe >= 0)
+-    {
+       event->attrs->state = IPP_IDLE;
+ 
+       while ((state = ippWriteFile(sub->pipe, event->attrs)) != IPP_DATA)
+@@ -1519,9 +1457,34 @@
+ 	  break;
+ 
+       if (state == IPP_ERROR)
++      {
++        if (errno == EPIPE)
++	{
++	 /*
++	  * Notifier died, try restarting it...
++	  */
++
++          cupsdLogMessage(CUPSD_LOG_WARN,
++	                  "Notifier for subscription %d (%s) went away, "
++			  "retrying!",
++			  sub->id, sub->recipient);
++	  cupsdEndProcess(sub->pid, 0);
++
++	  close(sub->pipe);
++	  sub->pipe = -1;
++          continue;
++	}
++
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+ 	                "Unable to send event for subscription %d (%s)!",
+ 			sub->id, sub->recipient);
++      }
++
++     /*
++      * If we get this far, break out of the loop...
++      */
++
++      break;
+     }
+   }
+ 
+diff -urNad cupsys-1.2.1~/scheduler/subscriptions.h cupsys-1.2.1/scheduler/subscriptions.h
+--- cupsys-1.2.1~/scheduler/subscriptions.h	2006-04-06 20:03:32.000000000 +0000
++++ cupsys-1.2.1/scheduler/subscriptions.h	2006-07-18 11:27:13.000000000 +0000
+@@ -131,11 +131,9 @@
+ VAR cups_array_t *Subscriptions VALUE(NULL);
+ 					/* Active subscriptions */
+ 
+-VAR int		MaxEvents VALUE(100),	/* Maximum number of events */
+-		NumEvents VALUE(0);	/* Number of active events */
+-VAR cupsd_event_t **Events VALUE(NULL);	/* Active events */
++VAR int		MaxEvents VALUE(100);	/* Maximum number of events */
+ 
+-VAR unsigned	LastEvent VALUE(0);	/* Last events processed */
++VAR unsigned	LastEvent VALUE(0);	/* Last event(s) processed */
+ VAR int		NotifierPipes[2] VALUE2(-1, -1);
+ 					/* Pipes for notifier error/debug output */
+ VAR cupsd_statbuf_t *NotifierStatusBuffer VALUE(NULL);
+diff -urNad cupsys-1.2.1~/scheduler/testmime.c cupsys-1.2.1/scheduler/testmime.c
+--- cupsys-1.2.1~/scheduler/testmime.c	2006-05-16 19:47:26.000000000 +0000
++++ cupsys-1.2.1/scheduler/testmime.c	2006-07-18 11:27:13.000000000 +0000
+@@ -71,7 +71,7 @@
+   mime        = NULL;
+   src         = NULL;
+   dst         = NULL;
+-  filter_path = "../filter:../pdftops";
++  filter_path = "../filter:../pdftops:" CUPS_SERVERBIN "/filter";
+ 
+   for (i = 1; i < argc; i ++)
+     if (!strcmp(argv[i], "-d"))
+diff -urNad cupsys-1.2.1~/systemv/Makefile cupsys-1.2.1/systemv/Makefile
+--- cupsys-1.2.1~/systemv/Makefile	2006-03-21 02:35:37.000000000 +0000
++++ cupsys-1.2.1/systemv/Makefile	2006-07-18 11:27:13.000000000 +0000
+@@ -78,7 +78,7 @@
+ 	$(INSTALL_BIN) lp $(BINDIR)
+ 	$(INSTALL_BIN) lpoptions $(BINDIR)
+ 	$(INSTALL_BIN) lpstat $(BINDIR)
+-	$(INSTALL_BIN) -m 4755 -o $(CUPS_USER) -g $(CUPS_GROUP) lppasswd $(BINDIR) || $(INSTALL_BIN) lppasswd $(BINDIR)
++	$(INSTALL_BIN) -m 4755 -o root lppasswd $(BINDIR) || $(INSTALL_BIN) lppasswd $(BINDIR)
+ 
+ 
+ #
+diff -urNad cupsys-1.2.1~/systemv/cancel.c cupsys-1.2.1/systemv/cancel.c
+--- cupsys-1.2.1~/systemv/cancel.c	2006-02-08 18:39:56.000000000 +0000
++++ cupsys-1.2.1/systemv/cancel.c	2006-07-18 11:27:13.000000000 +0000
+@@ -121,7 +121,10 @@
+ 
+         case 'h' : /* Connect to host */
+ 	    if (http != NULL)
++	    {
+ 	      httpClose(http);
++	      http = NULL;
++	    }
+ 
+ 	    if (argv[i][2] != '\0')
+               cupsSetServer(argv[i] + 2);
+diff -urNad cupsys-1.2.1~/systemv/lpstat.c cupsys-1.2.1/systemv/lpstat.c
+--- cupsys-1.2.1~/systemv/lpstat.c	2006-05-15 20:06:46.000000000 +0000
++++ cupsys-1.2.1/systemv/lpstat.c	2006-07-18 11:27:13.000000000 +0000
+@@ -70,26 +70,59 @@
+  */
+ 
+ int
+-main(int  argc,			/* I - Number of command-line arguments */
+-     char *argv[])		/* I - Command-line arguments */
++main(int  argc,				/* I - Number of command-line arguments */
++     char *argv[])			/* I - Command-line arguments */
+ {
+-  int		i,		/* Looping var */
+-		status;		/* Exit status */
+-  http_t	*http;		/* Connection to server */
+-  int		num_dests;	/* Number of user destinations */
+-  cups_dest_t	*dests;		/* User destinations */
+-  int		long_status;	/* Long status report? */
+-  int		ranking;	/* Show job ranking? */
+-  const char	*which;		/* Which jobs to show? */
+-  char		op;		/* Last operation on command-line */
++  int		i,			/* Looping var */
++		status;			/* Exit status */
++  http_t	*http;			/* Connection to server */
++  int		num_dests;		/* Number of user destinations */
++  cups_dest_t	*dests;			/* User destinations */
++  int		long_status;		/* Long status report? */
++  int		ranking;		/* Show job ranking? */
++  const char	*which;			/* Which jobs to show? */
++  char		op;			/* Last operation on command-line */
+ 
+ 
+  /*
+   * Set the locale so that times, etc. are displayed properly.
++  *
++  * Unfortunately, while we need the localized time value, we *don't*
++  * want to use the localized charset for the time value, so we need
++  * to set LC_TIME to the locale name with .UTF-8 on the end (if
++  * the locale includes a character set specifier...)
+   */
+ 
+   setlocale(LC_ALL, "");
+ 
++#ifdef LC_TIME
++  {
++    const char	*lc_time;		/* Current LC_TIME value */
++    char	new_lc_time[255],	/* New LC_TIME value */
++		*charset;		/* Pointer to character set */
++
++    if ((lc_time = setlocale(LC_TIME, NULL)) == NULL)
++      lc_time = setlocale(LC_ALL, NULL);
++
++    if (lc_time)
++    {
++      strlcpy(new_lc_time, lc_time, sizeof(new_lc_time));
++      if ((charset = strchr(new_lc_time, '.')) == NULL)
++        charset = new_lc_time + strlen(new_lc_time);
++
++      strlcpy(charset, ".UTF-8", sizeof(new_lc_time) - (charset - new_lc_time));
++    }
++    else
++      strcpy(new_lc_time, "C");
++
++    setlocale(LC_TIME, new_lc_time);
++  }
++#endif /* LC_TIME */
++  
++ /*
++  * Parse command-line options...
++  */
++
+   http        = NULL;
+   num_dests   = 0;
+   dests       = NULL;
+diff -urNad cupsys-1.2.1~/templates/Makefile cupsys-1.2.1/templates/Makefile
+--- cupsys-1.2.1~/templates/Makefile	2006-03-18 13:18:18.000000000 +0000
++++ cupsys-1.2.1/templates/Makefile	2006-07-18 11:27:13.000000000 +0000
+@@ -118,11 +118,13 @@
+ # Install files...
+ #
+ 
+-install: all
++install: all $(INSTALL_LANGUAGES)
+ 	$(INSTALL_DIR) -m 755 $(DATADIR)/templates
+ 	for file in $(FILES); do \
+ 		$(INSTALL_DATA) $$file $(DATADIR)/templates; \
+ 	done
++
++install-languages:
+ 	for lang in $(LANGUAGES); do \
+ 		$(INSTALL_DIR) -m 755 $(DATADIR)/templates/$$lang; \
+ 		for file in $(FILES); do \
+@@ -137,17 +139,19 @@
+ # Uninstall files...
+ #
+ 
+-uninstall:
++uninstall: $(UNINSTALL_LANGUAGES)
+ 	for file in $(FILES); do \
+ 		$(RM) $(DATADIR)/templates/$$file; \
+ 	done
++	-$(RMDIR) $(DATADIR)/templates
++
++uninstall-languages:
+ 	for lang in $(LANGUAGES); do \
+ 		for file in $(FILES); do \
+ 			$(RM) $(DATADIR)/templates/$$lang/$$file; \
+ 		done \
+ 		$(RMDIR) $(DATADIR)/templates/$$lang; \
+ 	done
+-	-$(RMDIR) $(DATADIR)/templates
+ 
+ 
+ #
+diff -urNad cupsys-1.2.1~/templates/ja/printers.tmpl cupsys-1.2.1/templates/ja/printers.tmpl
+--- cupsys-1.2.1~/templates/ja/printers.tmpl	2006-04-25 17:15:45.000000000 +0000
++++ cupsys-1.2.1/templates/ja/printers.tmpl	2006-07-18 11:27:13.000000000 +0000
+@@ -12,7 +12,7 @@
+ <B>場所:</B> {printer_location}<BR>
+ <B>メーカとモデル:</B> {printer_make_and_model}<BR>
+ <B>プリンタの状態:</B> {printer_state=3?待機中:{printer_state=4?処理中:停止}},
+-{printer_is_accepting_jobs=0?ジョブを拒否中:ジョブを受け付け中}, {printer_is_shared=0?not:} 公開。
++{printer_is_accepting_jobs=0?ジョブを拒否中:ジョブを受け付け中}, {printer_is_shared=0?非:}公開。
+ {?device_uri=?:<BR><B>デバイス URI:</B> {device_uri}}
+ 
+ <P>
+diff -urNad cupsys-1.2.1~/test/ipptest.c cupsys-1.2.1/test/ipptest.c
+--- cupsys-1.2.1~/test/ipptest.c	2006-04-17 20:07:24.000000000 +0000
++++ cupsys-1.2.1/test/ipptest.c	2006-07-18 11:27:13.000000000 +0000
+@@ -122,6 +122,7 @@
+   int		status;			/* Status of tests... */
+   const char	*uri;			/* URI to use */
+   const char	*testfile;		/* Test file to use */
++  int		interval;		/* Test interval */
+ 
+ 
+  /*
+@@ -133,6 +134,7 @@
+   uri      = NULL;
+   testfile = NULL;
+   status   = 0;
++  interval = 0;
+ 
+   for (i = 1; i < argc; i ++)
+   {
+@@ -140,6 +142,15 @@
+     {
+       if (!strcmp(argv[i], "-v"))
+         Verbosity ++;
++      else if (!strcmp(argv[i], "-i"))
++      {
++        i++;
++
++	if (i >= argc)
++	  usage(NULL);
++	else
++	  interval = atoi(argv[i]);
++      }
+       else
+         usage(argv[i]);
+     }
+@@ -174,6 +185,19 @@
+     usage(NULL);
+ 
+  /*
++  * Loop if the interval is set...
++  */
++
++  if (interval)
++  {
++    for (;;)
++    {
++      sleep(interval);
++      do_tests(uri, testfile);
++    }
++  }
++
++ /*
+   * Exit...
+   */
+ 
+@@ -890,7 +914,8 @@
+   fputs("Usage: ipptest [options] URL testfile [ ... testfileN ]\n", stderr);
+   fputs("Options:\n", stderr);
+   fputs("\n", stderr);
+-  fputs("-v     Show all attributes in response, even on success.\n", stderr);
++  fputs("-i N    Repeat the last test file once every N seconds.\n", stderr);
++  fputs("-v      Show all attributes in response, even on success.\n", stderr);
+ 
+   exit(1);
+ }

Modified: cupsys/branches/cups-1.2/debian/patches/00list
==============================================================================
--- cupsys/branches/cups-1.2/debian/patches/00list	(original)
+++ cupsys/branches/cups-1.2/debian/patches/00list	Tue Jul 18 11:41:00 2006
@@ -1,4 +1,4 @@
-00_r5673.dpatch
+00_r5743.dpatch
 02_configure.dpatch
 #03_manext.dpatch
 03_clean.dpatch
@@ -20,4 +20,4 @@
 53_usr_share_ppd_support.dpatch
 55_ppd_okidata_name.dpatch
 #56_dirsvc.dpatch
-57_cupsaddsmb.dpatch
+#57_cupsaddsmb.dpatch



More information about the Pkg-cups-devel mailing list