]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
File cleanup.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 3 Mar 2006 18:57:56 +0000 (18:57 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 3 Mar 2006 18:57:56 +0000 (18:57 +0000)
svn:ignores cleanup.

Cleanup GNU TLS support.

Automatically generate a self-signed certificate and private key
as needed when using GNU TLS.

Add DefaultEncryption option so that we can require encryption by
default for authenticated access.

Map 401 unauthorized to 426 upgrade required when encryption is
required.

More documentation updates and reorg.

cups/http.c:
    - http_setup_ssl(): Add cast to gnutls_transport_set_ptr()
      call.

scheduler/auth.c:
    - cupsdIsAuthorized(): Fix inline comment (::1, not :::1).

scheduler/auth.h:
    - Add DefaultEncryption variable.

scheduler/client.c:
    - cupsdEncryptClient(): When setting up a GNU TLS session,
      check whether the key and certificate are present, and
      create them if not. Also add cast to
      gnutls_transport_set_ptr() call.
    - cupsdSendError(): Map HTTP_UNAUTHORIZED to
      HTTP_UPGRADE_REQUIRED if we need to encrypt the connection
      before authenticating.
    - cupsdWriteClient(): Use cupsdSendError() for Status:
      headers, only send transfer-encoding header for successful
      CGI calls, and don't return early otherwise cupsd will spin
      on the socket FD.
    - make_certificate(): Added for GNU TLS configurations.

scheduler/conf.c:
    - cupsdReadConfiguration(): Initialize DefaultEncryption to
      Required.
    - read_configuration(): Add support for DefaultEncryption
      directive.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@5222 7a7537e8-13f0-0310-91df-b6672ffda945

31 files changed:
INSTALL.txt
LICENSE.txt
README.txt
cups/http.c
doc/Makefile
doc/help/license.html [moved from LICENSE.html with 95% similarity]
doc/images/classes.gif
doc/images/classes.svg [moved from doc/images/class.svg with 100% similarity]
doc/images/cups-browser-admin.png [deleted file]
packaging/cups.readme [new file with mode: 0644]
pstoraster/README.pstoraster [deleted file]
pstoraster/cups.mak [deleted file]
pstoraster/gdevcups.c [deleted file]
pstoraster/gs707-lib.patch [deleted file]
pstoraster/gs811-lib.patch [deleted file]
pstoraster/pstopxl [deleted file]
pstoraster/pstopxl.in [deleted file]
pstoraster/pstoraster [deleted file]
pstoraster/pstoraster.convs [deleted file]
pstoraster/pstoraster.in [deleted file]
pstoraster/pxlcolor.ppd [deleted file]
pstoraster/pxlmono.ppd [deleted file]
scheduler/auth.c
scheduler/auth.h
scheduler/client.c
scheduler/conf.c
standards/rfc4122.txt [new file with mode: 0644]
standards/wake-on-lan.pdf [new file with mode: 0644]
systemv/Makefile
templates/Makefile
templates/edit-config.tmpl.in

index fd2e5ec576b711258d133228ee647e8ac9234032..86b6c66aab8e28e9625a39d3e08bceb0e01647b6 100644 (file)
-INSTALL - CUPS v1.2.0a1 - 01/07/2003
-------------------------------------
+INSTALL - CUPS v1.2b1 - 2006-03-03
+----------------------------------
 
 This file describes how to compile and install CUPS from source
 code. For more information on CUPS see the file called
 "README.txt".  A complete change log can be found in
 "CHANGES.txt".
 
-**** IF YOU HAVE A NON-POSTSCRIPT PRINTER, YOU WILL ALSO  ****
-**** NEED TO INSTALL ESP GHOSTSCRIPT OR A PATCHED VERSION ****
-**** OF THE STANDARD GHOSTSCRIPT RELEASES.                ****
+**** IF YOU HAVE A NON-POSTSCRIPT PRINTER, YOU WILL ALSO    ****
+**** NEED TO INSTALL ESP GHOSTSCRIPT AFTER YOU INSTALL CUPS ****
 
 
 BEFORE YOU BEGIN
 
-You'll need ANSI-compliant C and C++ compilers, plus a make
-program and Bourne shell.  The GNU compiler tools work well -
-we've tested the current CUPS code against GCC 2.95.x with
-excellent results.
+    You'll need ANSI-compliant C and C++ compilers, plus a make
+    program and Bourne shell.  The GNU compiler tools work well -
+    we've tested the current CUPS code against several versions
+    of GCC with excellent results.
 
-The makefiles used by the project should work with all versions
-of make.  We've tested them with GNU make as well as the make
-programs shipped by Compaq, HP, SGI, and Sun.  FreeBSD users
-should use GNU make (gmake).
+    The makefiles used by the project should work with all
+    versions of make.  We've tested them with GNU make as well as
+    the make programs shipped by Compaq, HP, SGI, and Sun. 
+    FreeBSD users should use GNU make (gmake).
 
-Besides these tools you'll want the following libraries:
+    Besides these tools you'll want the JPEG, PNG, TIFF, and ZLIB
+    libraries for image support, the CDSA, GNU TLS, or OpenSSL
+    libraries for encryption support, and the OpenLDAP and
+    OpenSLP libraries for directory services support. CUPS will
+    compile and run without these, however you'll miss out on
+    many of the features provided by CUPS.
 
-    - JPEG 6b or higher
-    - PNG 1.0.6 or higher
-    - TIFF 3.4 or higher
-    - ZLIB 1.1.3 or higher
+    Also, please note that CUPS no longer includes the
+    Ghostscript- based pstoraster filter.  You *must* download
+    ESP Ghostscript separately from the CUPS web site if you want
+    to print PostScript files to non-PostScript printers.
 
-CUPS will compile and run without these, however you'll miss out on
-many of the features provided by CUPS.
 
-Also, please note that CUPS no longer includes the Ghostscript-
-based pstoraster filter.  You *must* download Ghostscript
-separately and patch it using the files in the pstoraster
-subdirectory, or download the ESP Ghostscript distribution from
-the CUPS web site. For more information see the README file in
-the pstoraster subdirectory.
+COMPILING FROM SUBVERSION
 
+    The CUPS Subversion repository doesn't hold a copy of the
+    pre-built configure script.  You'll need to run the GNU
+    autoconf software (2.52 or higher) before compiling the
+    software from Subversion:
 
-COMPILING FROM CVS
-
-The CUPS CVS repository doesn't hold a copy of the pre-built
-configure script.  You'll need to run the GNU autoconf software
-(2.52 or higher) before compiling the software from CVS:
-
-    autoconf ENTER
+       autoconf -f
 
 
 CONFIGURATION
 
-CUPS uses GNU autoconf, so you should find the usual "configure"
-script in the main CUPS source directory.  To configure CUPS for
-your system, type:
-
-    ./configure ENTER
-
-The default installation will put the CUPS software in the
-"/etc", "/usr", and "/var" directories on your system, which
-will overwrite any existing printing commands on your system.
-Use the "--prefix" option to install the CUPS software in
-another location:
-
-    ./configure --prefix=/some/directory ENTER
+    CUPS uses GNU autoconf, so you should find the usual
+    "configure" script in the main CUPS source directory.  To
+    configure CUPS for your system, type:
 
-If the PNG, JPEG, TIFF, and ZLIB libraries are not installed in
-a system default location (typically "/usr/include" and
-"/usr/lib") you'll need to set the CFLAGS, CXXFLAGS, DSOFLAGS,
-and LDFLAGS environment variables prior to running configure:
+       ./configure
 
-    setenv CFLAGS "-I/some/directory" ENTER
-    setenv CXXFLAGS "-I/some/directory" ENTER
-    setenv DSOFLAGS "-L/some/directory" ENTER
-    setenv LDFLAGS "-L/some/directory" ENTER
-    ./configure ... ENTER
+    The default installation will put the CUPS software in the
+    "/etc", "/usr", and "/var" directories on your system, which
+    will overwrite any existing printing commands on your system.
+    Use the "--prefix" option to install the CUPS software in
+    another location:
 
-or:
+       ./configure --prefix=/some/directory
 
-    CFLAGS="-I/some/directory"; export CFLAGS ENTER
-    CXXFLAGS="-I/some/directory"; export CXXFLAGS ENTER
-    DSOFLAGS="-L/some/directory"; export DSOFLAGS ENTER
-    LDFLAGS="-L/some/directory"; export LDFLAGS ENTER
-    ./configure ... ENTER
+    To see a complete list of configuration options, use the
+    --help option:
 
-To enable support for encryption, you'll also want to add the
-"--enable-ssl" option:
+        ./configure --help
 
-    ./configure --enable-ssl
+    If any of the dependent libraries are not installed in a
+    system default location (typically "/usr/include" and
+    "/usr/lib") you'll need to set the CFLAGS, CPPFLAGS,
+    CXXFLAGS, DSOFLAGS, and LDFLAGS environment variables prior
+    to running configure:
 
-SSL and TLS support require the OpenSSL library, available at:
+       setenv CFLAGS "-I/some/directory"
+       setenv CPPFLAGS "-I/some/directory"
+       setenv CXXFLAGS "-I/some/directory"
+       setenv DSOFLAGS "-L/some/directory"
+       setenv LDFLAGS "-L/some/directory"
+       ./configure ...
 
-    http://www.openssl.org
+    or:
 
-If the OpenSSL header files and libraries are not in a standard
-location, specify the locations of these files using the
---with-openssl-includes and --with-openssl-libs directives:
+       CFLAGS="-I/some/directory" \
+       CPPFLAGS="-I/some/directory" \
+       CXXFLAGS="-I/some/directory" \
+       DSOFLAGS="-L/some/directory" \
+       LDFLAGS="-L/some/directory" \
+       ./configure ...
 
-    ./configure --enable-ssl \
-        --with-openssl-includes=/foo/bar/include \
-        --with-openssl-libs=/foo/bar/lib
+    Once you have configured things, just type:
 
-See the file "ENCRYPTION.txt" for information on using the
-encryption support in CUPS.
+       make ENTER
 
-Once you have configured things, just type:
+    or if you have FreeBSD, NetBSD, or OpenBSD type:
 
-    make ENTER
+       gmake ENTER
 
-or if you have FreeBSD, NetBSD, or OpenBSD type:
-
-    gmake ENTER
-
-to build the software.
+    to build the software.
 
 
 INSTALLING THE SOFTWARE
 
-Once you have built the software you need to install it.  The
-"install" target provides a quick way to install the software on
-your local system:
+    Once you have built the software you need to install it.  The
+    "install" target provides a quick way to install the software
+    on your local system:
 
-    make install ENTER
+       make install ENTER
 
-or for FreeBSD, NetBSD, or OpenBSD:
+    or for FreeBSD, NetBSD, or OpenBSD:
 
-    gmake install ENTER
+       gmake install ENTER
 
-You can also build binary packages that can be installed on other
-machines using the RPM spec file ("cups.spec") or EPM list file
-("cups.list").  The latter also supports building of binary RPMs,
-so it may be more convenient to use - we use EPM to build all of
-our binary distributions.
+    You can also build binary packages that can be installed on
+    other machines using the RPM spec file
+    ("packaging/cups.spec") or EPM list file
+    ("packaging/cups.list").  The latter also supports building
+    of binary RPMs, so it may be more convenient to use - we use
+    EPM to build all of our binary distributions.
 
-You can find the RPM software at:
+    You can find the RPM software at:
 
-    http://www.rpm.org
+       http://www.rpm.org/
 
-The EPM software is at:
+    The EPM software is available at:
 
-    http://www.easysw.com/epm/
+       http://www.easysw.com/epm/
 
 
 CREATING BINARY DISTRIBUTIONS WITH EPM
 
-The top level makefile supports generation of many types of binary
-distributions using EPM.  To build a binary distribution type:
+    The top level makefile supports generation of many types of binary
+    distributions using EPM.  To build a binary distribution type:
 
-    make <format> ENTER
+       make <format> ENTER
 
-or
+    or
 
-    gmake <format> ENTER
+       gmake <format> ENTER
 
-for FreeBSD, NetBSD, and OpenBSD.  The <format> target is one of
-the following:
+    for FreeBSD, NetBSD, and OpenBSD.  The <format> target is one of
+    the following:
 
-    epm      - Builds a portable shell script and tar file based
-               distribution.  This format will also backup your
-              existing printing system if you decide to remove
-              CUPS at some future time.
-    aix      - Builds an AIX binary distribution.
-    bsd      - Builds a *BSD binary distribution.
-    deb      - Builds a Debian binary distribution.
-    depot    - Builds a HP-UX binary distribution.
-    pkg      - Builds a Solaris binary distribution.
-    rpm      - Builds a RPM binary distribution.
-    tardist  - Builds an IRIX binary distribution.
+       epm       - Builds a script + tarfile package
+       aix       - Builds an AIX package
+       bsd       - Builds a *BSD package
+       deb       - Builds a Debian package
+       depot     - Builds a HP-UX package (also swinstall)
+       inst      - Builds an IRIX package (also tardist)
+       osx       - Builds a MacOS X package
+       pkg       - Builds a Solaris package
+       rpm       - Builds a RPM package
+       setld     - Build a Tru64 UNIX package
+       slackware - Build a Slackware package
+       swinstall - Build a HP-UX package (also depot)
+       tardist   - Builds an IRIX package (also inst)
 
 
 REPORTING PROBLEMS
 
-If you have problems, READ THE DOCUMENTATION FIRST!  If the
-documentation does not solve your problems please send an email
-to "cups-support@cups.org".  Include your operating system and
-version, compiler and version, and any errors or problems you've
-run into. The "/var/log/cups/error_log" file should also be sent,
-as it often helps to determine the cause of your problem.
-
-If you are running a version of Linux, be sure to provide the
-Linux distribution you have, too.
-
-Please note that the "cups-support@cups.org" email address goes
-to the CUPS developers; they are busy people, so your email may
-go unanswered for days or weeks.  In general, only general build
-or distribution problems will actually get answered - for
-end-user support see the "README.txt" for a summary of the
-resources available.
+    If you have problems, READ THE DOCUMENTATION FIRST!  If the
+    documentation does not solve your problems, please post a
+    message on the "cups.general" forum at:
+
+        http://www.cups.org/newsgroups.php
+
+    Include your operating system and version, compiler and
+    version, and any errors or problems you've run into. The
+    "config.log" file and the output from the configure script
+    and make should also be sent, as it often helps to determine
+    the cause of your problem.
+
+    If you are running a version of Linux, be sure to provide the
+    Linux distribution you have, too.
index 12e4af6bcdeb87a394e0bafc4583f4432222c2d6..797ee5db95a6acb0d7130ac66baf1e3009e64254 100644 (file)
@@ -128,8 +128,8 @@ is based on the Xpdf software. For binary distribution licensing
 of this software, please contact:
 
      Derek B. Noonburg
-     Email: derekn@foolabs.com
-     WWW: http://www.foolabs.com/xpdf/
+     Email: derekn@glyphandcog.com
+     WWW: http://www.glyphandcog.com/
 
 
 SUPPORT
index c2f96483249d462afb6c6734ce538772b96d702a..28c192d368ca2d1d8c650c0d0c0320facb7a1b2d 100644 (file)
-README - CUPS v1.2.0b1 - 01/10/2006
------------------------------------
-
-*****************************************************************
-*****************************************************************
-****                                                         ****
-**** WARNING: THIS IS BETA RELEASE SOFTWARE AND MAY BE       ****
-****          TOTALLY UNSTABLE.  DO NOT USE IN ENVIRONMENTS  ****
-****          WHERE RELIABLE SOFTWARE IS REQUIRED!           ****
-****                                                         ****
-*****************************************************************
-*****************************************************************
+README - CUPS v1.2b1 - 2006-03-03
+---------------------------------
 
 Looking for compile instructions?  Read the file "INSTALL.txt"
 instead...
 
-*****************************************************************
-*****************************************************************
-****                                                         ****
-**** IF YOU HAVE A NON-POSTSCRIPT PRINTER, YOU WILL ALSO     ****
-**** NEED TO INSTALL ESP GHOSTSCRIPT OR A PATCHED VERSION    ****
-**** OF A STANDARD GHOSTSCRIPT RELEASE.                      ****
-****                                                         ****
-*****************************************************************
-*****************************************************************
-
 
 INTRODUCTION
 
-CUPS provides a portable printing layer for UNIX(r)-based
-operating systems.  It has been developed by Easy Software
-Products to promote a standard printing solution for all UNIX
-vendors and users.  CUPS provides the System V and Berkeley
-command-line interfaces.
-
-CUPS uses the Internet Printing Protocol ("IPP") as the basis
-for managing print jobs and queues.  The Line Printer Daemon
-("LPD") Server Message Block ("SMB"), and AppSocket (a.k.a.
-JetDirect) protocols are also supported with reduced
-functionality.  CUPS adds network printer browsing and
-PostScript Printer Description ("PPD") based printing options to
-support real-world printing under UNIX.
-
-CUPS includes an image file RIP that supports printing of image
-files to non-PostScript printers.  A customized version of GNU
-Ghostscript for CUPS called ESP Ghostscript is available
-separately to support printing of PostScript files within the
-CUPS driver framework.  Sample drivers for Dymo, EPSON, HP, and
-OKIDATA printers are included that use these filters.
-
-Drivers for thousands of printers are provided with our ESP
-Print Pro software, available at:
-
-       http://www.easysw.com/printpro/
-
-CUPS is licensed under the GNU General Public License and GNU
-Library General Public License.  Please contact Easy Software
-Products for commercial support and "binary distribution"
-rights.
-
-
-SYSTEM REQUIREMENTS
-
-Binary distributions require a minimum of 10MB of free disk
-space. We do not recommend using CUPS on a workstation with less
-than 32MB of RAM or a PC with less than 16MB of RAM.
-
-If you are installing from source you'll need ANSI-compliant C
-and C++ compilers and optionally one or more image file support
-libraries.  Complete source installation instructions can be
-found in the file "INSTALL.txt".
-
-
-SOFTWARE REQUIREMENTS
-
-The following operating system software is required to install
-one of the binary distributions from Easy Software Products:
+    CUPS provides a portable printing layer for UNIX(r)-based
+    operating systems.  It has been developed by Easy Software
+    Products to promote a standard printing solution for all UNIX
+    vendors and users.  CUPS provides the System V and Berkeley
+    command-line interfaces.
 
-    - AIX 4.3 or higher
-    - HP-UX 11.00 or higher
-    - IRIX 6.5 or higher
-    - Linux 2.4 with glibc 2.2 or higher
-    - Solaris 7 or higher (SPARC or Intel)
+    CUPS uses the Internet Printing Protocol ("IPP") as the basis
+    for managing print jobs and queues.  The Line Printer Daemon
+    ("LPD") Server Message Block ("SMB"), and AppSocket (a.k.a.
+    JetDirect) protocols are also supported with reduced
+    functionality.  CUPS adds network printer browsing and
+    PostScript Printer Description ("PPD") based printing options
+    to support real-world printing under UNIX.
 
+    CUPS includes an image file RIP that supports printing of
+    image files to non-PostScript printers.  A customized version
+    of GPL Ghostscript for CUPS called ESP Ghostscript is
+    available separately to support printing of PostScript files
+    within the CUPS driver framework.  Sample drivers for Dymo,
+    EPSON, HP, and OKIDATA printers are included that use these
+    filters.
 
-INSTALLING "PORTABLE" CUPS DISTRIBUTIONS
+    Drivers for thousands of printers are provided with our ESP
+    Print Pro software, available at:
 
-We are currently distributing "portable" CUPS binary
-distributions in TAR format with installation and removal
-scripts generated by our ESP Package Manager (EPM) software,
-which is available from:
+           http://www.easysw.com/printpro/
 
-    http://www.easysw.com/epm
-
-WARNING: Installing CUPS will overwrite your existing printing
-system. Backup files are made by the installation script and
-restored by the removal script, so if you experience problems
-you should be able to remove the CUPS software to restore your
-previous configuration.  However, Easy Software Products makes
-no warranty for this and will not be liable for any lost
-revenues, etc.
-
-To install the CUPS software you will need to be logged in as
-root (doing an "su" is good enough).  Once you are the root
-user, run the installation script with:
-
-    ./cups.install ENTER
-
-After asking you a few yes/no questions the CUPS software will
-be installed and the scheduler will be started automatically.
-
-
-INSTALLING HOST-SPECIFIC (RPM, DEBIAN, ETC.) DISTRIBUTIONS
-
-The host-specific distributions use the operating system
-software installation tools.  To install a host-specific
-distribution please consult the CUPS Software Administrators
-Manual or your operating system documentation.
+    CUPS is licensed under the GNU General Public License and GNU
+    Library General Public License.  Please contact Easy Software
+    Products for commercial support and "binary distribution"
+    rights.
 
 
 READING THE DOCUMENTATION
 
-Once you have installed the software you can access the
-documentation (and a bunch of other stuff) on-line at:
+    Once you have installed the software you can access the
+    documentation (and a bunch of other stuff) on-line at:
 
-    http://localhost:631
+       http://localhost:631/
 
-If you're having trouble getting that far, the documentation is
-located in the "/usr/share/doc/cups" directory in the binary
-distributions, and under the "doc" directory in the source
-archives.
+    If you're having trouble getting that far, the documentation
+    is located under the "doc/help" directory.
 
-Please read the documentation before asking questions.
+    Please read the documentation before asking questions.
 
 
 GETTING SUPPORT AND OTHER RESOURCES
 
-If you have problems, READ THE DOCUMENTATION FIRST!  We also
-provide many discussion forums which are available at:
+    If you have problems, READ THE DOCUMENTATION FIRST!  We also
+    provide many discussion forums which are available at:
 
-    http://www.cups.org/newsgroups.php
+       http://www.cups.org/newsgroups.php
 
-Commercial support (with a guaranteed response time) is available
-from Easy Software Products.  For more information see:
+    Commercial support (with a guaranteed response time) is
+    available from Easy Software Products.  For more information
+    see:
 
-    http://www.easysw.com/cups/
+       http://www.easysw.com/cups/
 
-See the CUPS web site at "http://www.cups.org/" for other site
-links.
+    See the CUPS web site at "http://www.cups.org/" for other
+    site links.
 
 
 SETTING UP PRINTER QUEUES USING YOUR WEB BROWSER
 
-CUPS 1.2 includes a web-based administration tool that allows you
-to manage printers, classes, and jobs on your server.  To access
-the printer administration tools open the following URL in your
-browser:
+    CUPS 1.2 includes a web-based administration tool that allows
+    you to manage printers, classes, and jobs on your server. 
+    Open the following URL in your browser to access the printer
+    administration tools:
 
-    http://localhost:631/admin
+       http://localhost:631/admin/
 
-You will be asked for the administration password (root or any
-other user in the sys/system/root group on your system) and then
-shown a menu of available functions.
+    DO NOT use the hostname for your machine - it will not work
+    with the default CUPS configuration.  To enable
+    administration access on other addresses, check the "Allow
+    Remote Administration" box and click on the "Change Settings"
+    button.
 
-DO NOT use the hostname for your machine - it will not work with
-the default CUPS configuration.  To enable administration access
-on other addresses, consult the CUPS Software Administrators
-Manual.
+    You will be asked for the administration password (root or
+    any other user in the sys/system/root group on your system)
+    when performing any administrative function.
 
 
 SETTING UP PRINTER QUEUES FROM THE COMMAND-LINE
 
-CUPS works best with PPD (PostScript Printer Description)
-files.  In a pinch you can also use System V style printer
-interface scripts.
-
-Six sample PPD files are provided with this distribution that
-utilize the PostScript and image file RIPs and the sample EPSON
-and HP printer drivers.  To add the sample DeskJet driver to the
-system for a printer connected to the parallel port, use one of
-the following commands:
-
-    HP-UX:
+    CUPS works best with PPD (PostScript Printer Description)
+    files.  In a pinch you can also use System V style printer
+    interface scripts.
 
-        /usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/c2t0d0_lp -E
+    CUPS includes several sample PPD files you can use:
 
-    IRIX:
+       Driver                         PPD File
+       -----------------------------  ------------
+       Dymo Label Printers            dymo.ppd
+       EPSON Stylus Color Series      stcolor.ppd
+       EPSON Stylus Photo Series      stphoto.ppd
+       EPSON Stylus New Color Series  stcolor2.ppd
+       EPSON Stylus New Photo Series  stphoto2.ppd
+       EPSON 9-pin Series             epson9.ppd
+       EPSON 24-pin Series            epson24.ppd
+       HP DeskJet Series              deskjet.ppd
+       HP LaserJet Series             laserjet.ppd
+       OKIDATA 9-Pin Series           okidata9.ppd
+       OKIDATA 24-Pin Series          okidat24.ppd
+       Zebra EPL1 Label Printer       zebraep1.ppd
+       Zebra EPL2 Label Printer       zebraep2.ppd
+       Zebra ZPL Label Printer        zebra.ppd
 
-        /usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/plp -E
+    Run the "lpinfo" command to list the available printers:
 
-    Linux:
+        lpinfo -v
 
-        /usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/lp0 -E
-        /usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/lp1 -E
-        /usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/lp2 -E
+    Then use the correct URI to add the printer using the
+    "lpadmin" command:
 
-    Solaris:
+        lpadmin -p printername -E -v URI -m filename.ppd
 
-        /usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/bpp0 -E
-        /usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/ecpp0 -E
+    Network printers typically use "socket" or "lpd" URIs:
 
-Similarly, for the other sample drivers you can use:
+        lpadmin -p printername -E -v socket://11.22.33.44 -m filename.ppd
+        lpadmin -p printername -E -v lpd://11.22.33.44/ -m filename.ppd
 
-    Driver                         PPD File
-    -----------------------------  ------------
-    Dymo Label Printers            dymo.ppd
-    EPSON Stylus Color Series      stcolor.ppd
-    EPSON Stylus Photo Series      stphoto.ppd
-    EPSON Stylus New Color Series  stcolor2.ppd
-    EPSON Stylus New Photo Series  stphoto2.ppd
-    EPSON 9-pin Series             epson9.ppd
-    EPSON 24-pin Series            epson24.ppd
-    HP DeskJet Series              deskjet.ppd
-    HP New DeskJet Series          deskjet2.ppd
-    HP LaserJet Series             laserjet.ppd
-    OKIDATA 9-Pin Series           okidata9.ppd
-    OKIDATA 24-Pin Series          okidat24.ppd
+    The sample drivers provide basic printing capabilities, but
+    generally do not exercise the full potential of the printers
+    or CUPS.  For fully-functional commercial printer drivers
+    check out our ESP Print Pro software at:
 
-These sample drivers provide basic printing capabilities, but
-generally do not exercise the full potential of the printers or
-CUPS.  For commercial printer drivers check out our ESP Print
-Pro software at:
-
-    http://www.easysw.com/printpro/
+       http://www.easysw.com/printpro/
 
 
 PRINTING FILES
 
-CUPS provides both the System V "lp" and Berkeley "lpr" commands
-for printing:
+    CUPS provides both the System V "lp" and Berkeley "lpr"
+    commands for printing:
 
-    lp filename
-    lpr filename
+       lp filename
+       lpr filename
 
-Both the "lp" and "lpr" commands support printing options for
-the driver:
+    Both the "lp" and "lpr" commands support printing options for
+    the driver:
 
-    lp -omedia=A4 -oresolution=600dpi filename
-    lpr -omedia=A4 -oresolution=600dpi filename
+       lp -omedia=A4 -oresolution=600dpi filename
+       lpr -omedia=A4 -oresolution=600dpi filename
 
-CUPS recognizes many types of images files as well as PDF,
-PostScript, HP-GL/2, and text files, so you can print those
-files directly rather than through an application.
+    CUPS recognizes many types of images files as well as PDF,
+    PostScript, HP-GL/2, and text files, so you can print those
+    files directly rather than through an application.
 
-If you have an application that generates output specifically
-for your printer then you need to use the "-oraw" or "-l"
-options:
+    If you have an application that generates output specifically
+    for your printer then you need to use the "-oraw" or "-l"
+    options:
 
-    lp -oraw filename
-    lpr -l filename
+       lp -oraw filename
+       lpr -l filename
 
-This will prevent the filters from misinterpreting your print
-file.
+    This will prevent the filters from misinterpreting your print
+    file.
 
 
 LEGAL STUFF
 
-CUPS is Copyright 1993-2006 by Easy Software Products.  CUPS,
-the CUPS logo, and the Common UNIX Printing System are the
-trademark property of Easy Software Products.
+    CUPS is Copyright 1993-2006 by Easy Software Products.  CUPS,
+    the CUPS logo, and the Common UNIX Printing System are the
+    trademark property of Easy Software Products.
 
-The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
+    The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
 
-The PDF filter (pdftops) is based on the Xpdf software,
-Copyright 1996-2005 by Derek B. Noonburg.
+    The PDF filter (pdftops) is based on the Xpdf software,
+    Copyright 1996-2005 by Derek B. Noonburg.
 
-This software is based in part on the work of the Independent
-JPEG Group.
+    This software is based in part on the work of the Independent
+    JPEG Group.
 
-CUPS is provided under the terms of the GNU General Public
-License and GNU Library General Public License. This program is
-distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE.  See the "LICENSE.html",
-"LICENSE.txt", or "cups.license" files for more information.
+    CUPS is provided under the terms of the GNU General Public
+    License and GNU Library General Public License. This program
+    is distributed in the hope that it will be useful, but
+    WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    "doc/help/license.html" or "LICENSE.txt" files for more
+    information.
 
-For commercial licensing information, please contact:
+    For commercial licensing information, please contact:
 
-    Attn: CUPS Licensing Information
-    Easy Software Products
-    44141 Airport View Drive, Suite 204
-    Hollywood, Maryland 20636 USA
+       Attn: CUPS Licensing Information
+       Easy Software Products
+       44141 Airport View Drive, Suite 204
+       Hollywood, Maryland 20636 USA
 
-    Voice: +1.301.373.9600
-    Email: cups-info@cups.org
-    WWW: http://www.cups.org
+       Voice: +1.301.373.9600
+       Email: cups-info@cups.org
+       WWW: http://www.cups.org/
 
-Note that commercial licensors may also require a license from
-Derek B. Noonburg who developed the Xpdf software used to print
-PDF files.
+    Note that commercial licensors may also require a license from
+    Derek B. Noonburg who developed the Xpdf software used to print
+    PDF files.
index 6274cd6fe8b7da1aaa4fa70c8078d2ae76d8c06b..83396ea4191a748e800ff6f8a7e8824c67a34726 100644 (file)
@@ -2278,7 +2278,7 @@ http_setup_ssl(http_t *http)              /* I - HTTP connection */
   gnutls_init(&(conn->session), GNUTLS_CLIENT);
   gnutls_set_default_priority(conn->session);
   gnutls_credentials_set(conn->session, GNUTLS_CRD_CERTIFICATE, *credentials);
-  gnutls_transport_set_ptr(conn->session, http->fd);
+  gnutls_transport_set_ptr(conn->session, (gnutls_transport_ptr)http->fd);
 
   if ((gnutls_handshake(conn->session)) != GNUTLS_E_SUCCESS)
   {
index 5d5108a3982b3ee4b0537ccc9d678442c8d79967..d9512b17e0262d0378f137e066cb32020ace741e 100644 (file)
@@ -120,6 +120,7 @@ HELPFILES   =       \
                        help/api-ppd.html \
                        help/api-raster.html \
                        help/glossary.html \
+                       help/license.html \
                        help/man-accept.html \
                        help/man-backend.html \
                        help/man-cancel.html \
@@ -207,7 +208,7 @@ install:    all
                $(INSTALL_DIR) -m 755 $(DOCDIR)/$$lang/images; \
                $(INSTALL_MAN) $$lang/index.html $(DOCDIR)/$$lang; \
                for file in $(WEBBUTTONS); do \
-                       if test -e $$lang/$$file; then \
+                       if test -f $$lang/$$file; then \
                                $(INSTALL_MAN) $$lang/$$file $(DOCDIR)/$$lang/images; \
                        fi \
                done \
similarity index 95%
rename from LICENSE.html
rename to doc/help/license.html
index 2008a631201998d8d7972e475a415e581f0b4024..888da5fc735c80743e5158775b75a78304eb2123 100644 (file)
@@ -1,11 +1,9 @@
 <HTML>
+<!-- SECTION: Getting Started -->
 <HEAD>
-       <TITLE>Software License Agreement - Common UNIX Printing System</TITLE>
+       <TITLE>Software License Agreement</TITLE>
 </HEAD>
-
-<BODY BGCOLOR="#ffffff" TEXT="#000000">
-
-<H2 ALIGN="CENTER">Common UNIX Printing System License Agreement</H2>
+<BODY>
 
 <P ALIGN="CENTER">Copyright 1997-2006 by Easy Software Products<BR>
 44141 AIRPORT VIEW DR STE 204<BR>
@@ -15,24 +13,24 @@ Voice: +1.301.373.9600<BR>
 Email: <A HREF="mailto:cups-info@cups.org">cups-info@cups.org</A><BR>
 WWW: <A HREF="http://www.cups.org">http://www.cups.org</A>
 
-<H3>Introduction</H3>
+<H2 CLASS="title"><A NAME="INTRO">Introduction</A></H2>
 
 <P>The Common UNIX Printing System<SUP>TM</SUP>,
 ("CUPS<SUP>TM</SUP>"), is provided under the GNU General Public
 License ("GPL") and GNU Library General Public License ("LGPL"),
 Version 2, with exceptions for Apple operating systems and the
 OpenSSL toolkit. A copy of the exceptions and licenses follow
-this introduction.
+this introduction.</P>
 
 <P>The GNU LGPL applies to the CUPS API library, located in the
 "cups" subdirectory of the CUPS source distribution and in the
 "cups" include directory and library files in the binary
 distributions. The GNU GPL applies to the remainder of the CUPS
 distribution, including the "pdftops" filter which is based upon
-Xpdf and the CUPS imaging library.
+Xpdf and the CUPS imaging library.</P>
 
 <P>For those not familiar with the GNU GPL, the license basically
-allows you to:
+allows you to:</P>
 
 <UL>
 
@@ -50,24 +48,25 @@ allows you to:
 
 </UL>
 
-<P>What this license <B>does not</B> allow you to do is make
+<P>What this license <EM>does not</EM> allow you to do is make
 changes or add features to CUPS and then sell a binary
-distribution without source code. You must provide source for
-any new drivers, changes, or additions to the software, and all
-code must be provided under the GPL or LGPL as appropriate. The
-only exceptions to this are the portions of the CUPS software
-covered by the Apple operating system license exceptions
-outlined later in this license agreement.
+distribution without source code. You must provide source for any
+new drivers, changes, or additions to the software, and all code
+must be provided under the GPL or LGPL as appropriate. The only
+exceptions to this are the portions of the CUPS software covered
+by the Apple operating system license exceptions outlined later
+in this license agreement.</P>
 
 <P>The GNU LGPL relaxes the "link-to" restriction, allowing you
-to develop applications that use the CUPS API library under
-other licenses and/or conditions as appropriate for your
-application.
+to develop applications that use the CUPS API library under other
+licenses and/or conditions as appropriate for your
+application.</P>
 
-<H3>License Exceptions</H3>
+
+<H2 CLASS="title"><A NAME="EXCEPTIONS">License Exceptions</A></H2>
 
 <P>In addition, as the copyright holder of CUPS, Easy Software
-Products grants the following special exceptions:
+Products grants the following special exceptions:</P>
 
 <OL>
 
@@ -133,48 +132,51 @@ Products grants the following special exceptions:
 </OL>
 
 <P>No developer is required to provide these exceptions in a
-derived work.
+derived work.</P>
+
 
-<H3>Trademarks</H3>
+<H2 CLASS="title"><A NAME="TRADEMARKS">Trademarks</A></H2>
 
 <P>Easy Software Products has trademarked the Common UNIX
-Printing System, CUPS, and CUPS logo. You may use these names
-and logos in any direct port or binary distribution of CUPS.
-Please contact Easy Software Products for written permission to
-use them in derivative products. Our intention is to protect the
-value of these trademarks and ensure that any derivative product
-meets the same high-quality standards as the original.
+Printing System, CUPS, and CUPS logo. You may use these names and
+logos in any direct port or binary distribution of CUPS. Please
+contact Easy Software Products for written permission to use them
+in derivative products. Our intention is to protect the value of
+these trademarks and ensure that any derivative product meets the
+same high-quality standards as the original.</P>
 
-<H3>Binary Distribution Rights</H3>
+
+<H2 CLASS="title"><A NAME="BINARY">Binary Distribution Rights</A></H2>
 
 <P>Easy Software Products also sells rights to the CUPS source
 code under a binary distribution license for vendors that are
 unable to release source code for their drivers, additions, and
-modifications to CUPS under the GNU GPL and LGPL. For
-information please contact us at the address shown above.
+modifications to CUPS under the GNU GPL and LGPL. For information
+please contact us at the address shown above.</P>
 
 <P>The Common UNIX Printing System provides a "pdftops" filter
 that is based on the Xpdf software. For binary distribution
-licensing of this software, please contact:
+licensing of this software, please contact:</P>
 
 <BLOCKQUOTE>
 Derek B. Noonburg<BR>
-Email: <A HREF="mailto:derekn@foolabs.com">derekn@foolabs.com</A><BR>
-WWW: <A HREF="http://www.foolabs.com/xpdf/">http://www.foolabs.com/xpdf/</A>
+Email: <A HREF="mailto:derekn@glyphandcog.com">derekn@glyphandcog.com</A><BR>
+WWW: <A HREF="http://www.glyphandcog.com/">http://www.glyphandcog.com/</A>
 </BLOCKQUOTE>
 
-<H3>Support</H3>
 
-<P>Easy Software Products sells software support for CUPS as
-well as a commercial printing product based on CUPS called ESP
-Print Pro. You can find out more at our web site:
+<H2 CLASS="title"><A NAME="SUPPORT">Support</A></H2>
+
+<P>Easy Software Products sells software support for CUPS as well
+as a commercial printing product based on CUPS called ESP Print
+Pro. You can find out more at our web site:</P>
 
 <UL><PRE>
 <A HREF="http://www.easysw.com/">http://www.easysw.com/</A>
 </PRE></UL>
 
-<!-- NEW PAGE -->
-<H2>GNU GENERAL PUBLIC LICENSE</H2>
+
+<H2 CLASS="title"><A NAME="GPL">GNU GENERAL PUBLIC LICENSE</A></H2>
 
 <P>Version 2, June 1991
 
@@ -186,7 +188,7 @@ Everyone is permitted to copy and distribute verbatim
 copies of this license document, but changing it is not allowed.
 </PRE>
 
-<H4>Preamble</H4>
+<H3>Preamble</H3>
 
 <P>The licenses for most software are designed to take away your
 freedom to share and change it.  By contrast, the GNU General Public
@@ -236,8 +238,8 @@ patent must be licensed for everyone's free use or not licensed at all.
 <P>The precise terms and conditions for copying, distribution and
 modification follow.
 
-<H4>GNU GENERAL PUBLIC LICENSE<BR>
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</H4>
+<H3>GNU GENERAL PUBLIC LICENSE<BR>
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</H3>
 
 <OL START="0">
 
@@ -447,7 +449,7 @@ of promoting the sharing and reuse of software generally.
 
 </OL>
 
-<H4>NO WARRANTY</H4>
+<H3>NO WARRANTY</H3>
 
 <OL START="11">
 
@@ -473,9 +475,9 @@ POSSIBILITY OF SUCH DAMAGES.
 
 </OL>
 
-<H4>END OF TERMS AND CONDITIONS</H4>
+<H3>END OF TERMS AND CONDITIONS</H3>
 
-<H4>How to Apply These Terms to Your New Programs</H4>
+<H3>How to Apply These Terms to Your New Programs</H3>
 
 <P>If you develop a new program, and you want it to be of the greatest
 possible use to the public, the best way to achieve this is to make it
@@ -538,8 +540,7 @@ by James Hacker.
 Ty Coon, President of Vice
 </PRE>
 
-<!-- NEW PAGE -->
-<H2>GNU LIBRARY GENERAL PUBLIC LICENSE</H2>
+<H2 CLASS="title"><A NAME="LGPL">GNU LIBRARY GENERAL PUBLIC LICENSE</A></H2>
 
 <P>Version 2, June 1991
 
@@ -553,7 +554,7 @@ of this license document, but changing it is not allowed.
  numbered 2 because it goes with version 2 of the ordinary GPL.]
 </PRE>
 
-<H4>Preamble</H4>
+<H3>Preamble</H3>
 
 <P>The licenses for most software are designed to take away your
 freedom to share and change it.  By contrast, the GNU General Public
@@ -643,7 +644,7 @@ works together with the library.
 <P>Note that it is possible for a library to be covered by the ordinary
 General Public License rather than by this special one.
 
-<H4>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</H4>
+<H3>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</H3>
 
 <P><STRONG>0.</STRONG>
 This License Agreement applies to any software library which
@@ -1013,9 +1014,9 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 DAMAGES.
 
-<H4>END OF TERMS AND CONDITIONS</H4>
+<H3>END OF TERMS AND CONDITIONS</H3>
 
-<H4>How to Apply These Terms to Your New Libraries</H4>
+<H3>How to Apply These Terms to Your New Libraries</H3>
 
 <P>If you develop a new library, and you want it to be of the greatest
 possible use to the public, we recommend making it free software that
index ace15df98035c8ff3e41036b0be59f2664f7d0d3..0ac11977e782780fa9a4539ed382457b3d31f49c 100644 (file)
Binary files a/doc/images/classes.gif and b/doc/images/classes.gif differ
similarity index 100%
rename from doc/images/class.svg
rename to doc/images/classes.svg
diff --git a/doc/images/cups-browser-admin.png b/doc/images/cups-browser-admin.png
deleted file mode 100644 (file)
index 36f5b93..0000000
Binary files a/doc/images/cups-browser-admin.png and /dev/null differ
diff --git a/packaging/cups.readme b/packaging/cups.readme
new file mode 100644 (file)
index 0000000..c2f9648
--- /dev/null
@@ -0,0 +1,290 @@
+README - CUPS v1.2.0b1 - 01/10/2006
+-----------------------------------
+
+*****************************************************************
+*****************************************************************
+****                                                         ****
+**** WARNING: THIS IS BETA RELEASE SOFTWARE AND MAY BE       ****
+****          TOTALLY UNSTABLE.  DO NOT USE IN ENVIRONMENTS  ****
+****          WHERE RELIABLE SOFTWARE IS REQUIRED!           ****
+****                                                         ****
+*****************************************************************
+*****************************************************************
+
+Looking for compile instructions?  Read the file "INSTALL.txt"
+instead...
+
+*****************************************************************
+*****************************************************************
+****                                                         ****
+**** IF YOU HAVE A NON-POSTSCRIPT PRINTER, YOU WILL ALSO     ****
+**** NEED TO INSTALL ESP GHOSTSCRIPT OR A PATCHED VERSION    ****
+**** OF A STANDARD GHOSTSCRIPT RELEASE.                      ****
+****                                                         ****
+*****************************************************************
+*****************************************************************
+
+
+INTRODUCTION
+
+CUPS provides a portable printing layer for UNIX(r)-based
+operating systems.  It has been developed by Easy Software
+Products to promote a standard printing solution for all UNIX
+vendors and users.  CUPS provides the System V and Berkeley
+command-line interfaces.
+
+CUPS uses the Internet Printing Protocol ("IPP") as the basis
+for managing print jobs and queues.  The Line Printer Daemon
+("LPD") Server Message Block ("SMB"), and AppSocket (a.k.a.
+JetDirect) protocols are also supported with reduced
+functionality.  CUPS adds network printer browsing and
+PostScript Printer Description ("PPD") based printing options to
+support real-world printing under UNIX.
+
+CUPS includes an image file RIP that supports printing of image
+files to non-PostScript printers.  A customized version of GNU
+Ghostscript for CUPS called ESP Ghostscript is available
+separately to support printing of PostScript files within the
+CUPS driver framework.  Sample drivers for Dymo, EPSON, HP, and
+OKIDATA printers are included that use these filters.
+
+Drivers for thousands of printers are provided with our ESP
+Print Pro software, available at:
+
+       http://www.easysw.com/printpro/
+
+CUPS is licensed under the GNU General Public License and GNU
+Library General Public License.  Please contact Easy Software
+Products for commercial support and "binary distribution"
+rights.
+
+
+SYSTEM REQUIREMENTS
+
+Binary distributions require a minimum of 10MB of free disk
+space. We do not recommend using CUPS on a workstation with less
+than 32MB of RAM or a PC with less than 16MB of RAM.
+
+If you are installing from source you'll need ANSI-compliant C
+and C++ compilers and optionally one or more image file support
+libraries.  Complete source installation instructions can be
+found in the file "INSTALL.txt".
+
+
+SOFTWARE REQUIREMENTS
+
+The following operating system software is required to install
+one of the binary distributions from Easy Software Products:
+
+    - AIX 4.3 or higher
+    - HP-UX 11.00 or higher
+    - IRIX 6.5 or higher
+    - Linux 2.4 with glibc 2.2 or higher
+    - Solaris 7 or higher (SPARC or Intel)
+
+
+INSTALLING "PORTABLE" CUPS DISTRIBUTIONS
+
+We are currently distributing "portable" CUPS binary
+distributions in TAR format with installation and removal
+scripts generated by our ESP Package Manager (EPM) software,
+which is available from:
+
+    http://www.easysw.com/epm
+
+WARNING: Installing CUPS will overwrite your existing printing
+system. Backup files are made by the installation script and
+restored by the removal script, so if you experience problems
+you should be able to remove the CUPS software to restore your
+previous configuration.  However, Easy Software Products makes
+no warranty for this and will not be liable for any lost
+revenues, etc.
+
+To install the CUPS software you will need to be logged in as
+root (doing an "su" is good enough).  Once you are the root
+user, run the installation script with:
+
+    ./cups.install ENTER
+
+After asking you a few yes/no questions the CUPS software will
+be installed and the scheduler will be started automatically.
+
+
+INSTALLING HOST-SPECIFIC (RPM, DEBIAN, ETC.) DISTRIBUTIONS
+
+The host-specific distributions use the operating system
+software installation tools.  To install a host-specific
+distribution please consult the CUPS Software Administrators
+Manual or your operating system documentation.
+
+
+READING THE DOCUMENTATION
+
+Once you have installed the software you can access the
+documentation (and a bunch of other stuff) on-line at:
+
+    http://localhost:631
+
+If you're having trouble getting that far, the documentation is
+located in the "/usr/share/doc/cups" directory in the binary
+distributions, and under the "doc" directory in the source
+archives.
+
+Please read the documentation before asking questions.
+
+
+GETTING SUPPORT AND OTHER RESOURCES
+
+If you have problems, READ THE DOCUMENTATION FIRST!  We also
+provide many discussion forums which are available at:
+
+    http://www.cups.org/newsgroups.php
+
+Commercial support (with a guaranteed response time) is available
+from Easy Software Products.  For more information see:
+
+    http://www.easysw.com/cups/
+
+See the CUPS web site at "http://www.cups.org/" for other site
+links.
+
+
+SETTING UP PRINTER QUEUES USING YOUR WEB BROWSER
+
+CUPS 1.2 includes a web-based administration tool that allows you
+to manage printers, classes, and jobs on your server.  To access
+the printer administration tools open the following URL in your
+browser:
+
+    http://localhost:631/admin
+
+You will be asked for the administration password (root or any
+other user in the sys/system/root group on your system) and then
+shown a menu of available functions.
+
+DO NOT use the hostname for your machine - it will not work with
+the default CUPS configuration.  To enable administration access
+on other addresses, consult the CUPS Software Administrators
+Manual.
+
+
+SETTING UP PRINTER QUEUES FROM THE COMMAND-LINE
+
+CUPS works best with PPD (PostScript Printer Description)
+files.  In a pinch you can also use System V style printer
+interface scripts.
+
+Six sample PPD files are provided with this distribution that
+utilize the PostScript and image file RIPs and the sample EPSON
+and HP printer drivers.  To add the sample DeskJet driver to the
+system for a printer connected to the parallel port, use one of
+the following commands:
+
+    HP-UX:
+
+        /usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/c2t0d0_lp -E
+
+    IRIX:
+
+        /usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/plp -E
+
+    Linux:
+
+        /usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/lp0 -E
+        /usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/lp1 -E
+        /usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/lp2 -E
+
+    Solaris:
+
+        /usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/bpp0 -E
+        /usr/lib/lpadmin -p DeskJet -m deskjet.ppd -v parallel:/dev/ecpp0 -E
+
+Similarly, for the other sample drivers you can use:
+
+    Driver                         PPD File
+    -----------------------------  ------------
+    Dymo Label Printers            dymo.ppd
+    EPSON Stylus Color Series      stcolor.ppd
+    EPSON Stylus Photo Series      stphoto.ppd
+    EPSON Stylus New Color Series  stcolor2.ppd
+    EPSON Stylus New Photo Series  stphoto2.ppd
+    EPSON 9-pin Series             epson9.ppd
+    EPSON 24-pin Series            epson24.ppd
+    HP DeskJet Series              deskjet.ppd
+    HP New DeskJet Series          deskjet2.ppd
+    HP LaserJet Series             laserjet.ppd
+    OKIDATA 9-Pin Series           okidata9.ppd
+    OKIDATA 24-Pin Series          okidat24.ppd
+
+These sample drivers provide basic printing capabilities, but
+generally do not exercise the full potential of the printers or
+CUPS.  For commercial printer drivers check out our ESP Print
+Pro software at:
+
+    http://www.easysw.com/printpro/
+
+
+PRINTING FILES
+
+CUPS provides both the System V "lp" and Berkeley "lpr" commands
+for printing:
+
+    lp filename
+    lpr filename
+
+Both the "lp" and "lpr" commands support printing options for
+the driver:
+
+    lp -omedia=A4 -oresolution=600dpi filename
+    lpr -omedia=A4 -oresolution=600dpi filename
+
+CUPS recognizes many types of images files as well as PDF,
+PostScript, HP-GL/2, and text files, so you can print those
+files directly rather than through an application.
+
+If you have an application that generates output specifically
+for your printer then you need to use the "-oraw" or "-l"
+options:
+
+    lp -oraw filename
+    lpr -l filename
+
+This will prevent the filters from misinterpreting your print
+file.
+
+
+LEGAL STUFF
+
+CUPS is Copyright 1993-2006 by Easy Software Products.  CUPS,
+the CUPS logo, and the Common UNIX Printing System are the
+trademark property of Easy Software Products.
+
+The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
+
+The PDF filter (pdftops) is based on the Xpdf software,
+Copyright 1996-2005 by Derek B. Noonburg.
+
+This software is based in part on the work of the Independent
+JPEG Group.
+
+CUPS is provided under the terms of the GNU General Public
+License and GNU Library General Public License. This program is
+distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the "LICENSE.html",
+"LICENSE.txt", or "cups.license" files for more information.
+
+For commercial licensing information, please contact:
+
+    Attn: CUPS Licensing Information
+    Easy Software Products
+    44141 Airport View Drive, Suite 204
+    Hollywood, Maryland 20636 USA
+
+    Voice: +1.301.373.9600
+    Email: cups-info@cups.org
+    WWW: http://www.cups.org
+
+Note that commercial licensors may also require a license from
+Derek B. Noonburg who developed the Xpdf software used to print
+PDF files.
diff --git a/pstoraster/README.pstoraster b/pstoraster/README.pstoraster
deleted file mode 100644 (file)
index 980def2..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-README.pstoraster - 11/14/2003
-------------------------------
-
-INTRODUCTION
-
-    This directory contains the CUPS "driver" for Ghostscript
-    7.x and 8.x, the pstoraster script that is used to run
-    Ghostscript as a CUPS filter, the pstoraster.convs file that
-    defines the PostScript to raster filter for CUPS drivers, a
-    makefile fragment that adds the CUPS driver, and the wrapper
-    script (pstopxl) and PPD files (pxl*.ppd) to support PCL
-    XL/PCL 6 printers.
-
-    This software is included with both the CUPS and ESP
-    Ghostscript 7.07.1 distributions.  While the files will also
-    compile with earlier versions of Ghostscript, there are bugs
-    in older versions of Ghostscript which may cause problems.
-
-    Also, this driver may not be used in any commercial
-    Ghostscript distributions without prior written
-    permission/licensing from Easy Software Products.  See the
-    contact information in the file "gdevcups.c" for more
-    information.
-
-
-COMPILING ESP GHOSTSCRIPT WITH THE CUPS DRIVER
-
-    Normally the CUPS driver will be automatically included when
-    you use the configure script supplied with ESP Ghostscript.
-
-    Once you have compiled and installed Ghostscript, restart
-    the cupsd process, either by sending the HUP signal to the
-    process or using the init script supplied with CUPS.
-
-    To use the PCL XL/PCL 6 drivers, make sure that you also
-    configure Ghostscript with the pxlmono and pxlcolor drivers.
-
-
-COMPILING AFPL/GNU GHOSTSCRIPT WITH THE CUPS DRIVER
-
-    Before configuring AFPL or GNU Ghostscript, first copy this
-    directory to the Ghostscript source directory, e.g.:
-
-        cp -r pstoraster /some/path/to/ghostscript-7.07
-
-    Then apply the appropriate patch:
-
-        cd /some/path/to/ghostscript-7.07
-        patch -p1 pstoraster/gs707-lib.patch
-
-    or:
-
-        cd /some/path/to/ghostscript-8.11
-        patch -p1 pstoraster/gs811-lib.patch
-
-    Next, run the configure script to configure the Ghostscript
-    software:
-
-        ./configure [any configure options you want]
-
-    Finally, add the following include line to the end of the
-    makefile:
-
-        include pstoraster/cups.mak
-
-    and add "$(DD)cups.dev" to any of the DEVICE_DEVS lines.
-
-    Once you have compiled and installed Ghostscript, restart
-    the cupsd process, either by sending the HUP signal to the
-    process or using the init script supplied with CUPS.
-
-    To use the PCL XL/PCL 6 drivers, make sure that you also
-    configure Ghostscript with the pxlmono and pxlcolor drivers.
diff --git a/pstoraster/cups.mak b/pstoraster/cups.mak
deleted file mode 100644 (file)
index 40d98db..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# "$Id$"
-#
-# CUPS driver makefile for Ghostscript.
-#
-# Copyright 2001-2005 by Easy Software Products.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-### ----------------- CUPS Ghostscript Driver ---------------------- ###
-
-cups_= $(GLOBJ)gdevcups.$(OBJ)
-
-CUPSSERVER= $(install_prefix)`cups-config --serverbin`
-CUPSCONFIG= $(install_prefix)`cups-config --serverroot`
-CUPSDATA= $(install_prefix)`cups-config --datadir`
-
-$(DD)cups.dev: $(cups_) $(GLD)page.dev
-       $(ADDMOD) $(DD)cups -lib cupsimage -lib cups
-       $(SETPDEV2) $(DD)cups $(cups_)
-
-$(GLOBJ)gdevcups.$(OBJ): pstoraster/gdevcups.c $(PDEVH)
-       $(GLCC) $(GLO_)gdevcups.$(OBJ) $(C_) pstoraster/gdevcups.c
-
-install:       install-cups
-
-install-cups:
-       -mkdir -p $(CUPSSERVER)/filter
-       $(INSTALL_PROGRAM) pstoraster/pstoraster $(CUPSSERVER)/filter
-       $(INSTALL_PROGRAM) pstoraster/pstopxl $(CUPSSERVER)/filter
-       -mkdir -p $(CUPSCONFIG)
-       $(INSTALL_DATA) pstoraster/pstoraster.convs $(CUPSCONFIG)
-       -mkdir -p $(CUPSDATA)/model
-       $(INSTALL_DATA) pstoraster/pxlcolor.ppd $(CUPSDATA)/model
-       $(INSTALL_DATA) pstoraster/pxlmono.ppd $(CUPSDATA)/model
-
-
-#
-# End of "$Id$".
-#
diff --git a/pstoraster/gdevcups.c b/pstoraster/gdevcups.c
deleted file mode 100644 (file)
index 93c9d47..0000000
+++ /dev/null
@@ -1,4464 +0,0 @@
-/*
- * "$Id$"
- *
- *   GNU Ghostscript raster output driver for the Common UNIX Printing
- *   System (CUPS).
- *
- *   Copyright 1993-2005 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@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.
- *
- * Contents:
- *
- *   cups_close()            - Close the output file.
- *   cups_get_matrix()       - Generate the default page matrix.
- *   cups_get_params()       - Get pagedevice parameters.
- *   cups_get_space_params() - Get space parameters from the RIP_CACHE env var.
- *   cups_map_color_rgb()    - Map a color index to an RGB color.
- *   cups_map_cielab()       - Map CIE Lab transformation...
- *   cups_map_rgb_color()    - Map an RGB color to a color index.  We map the
- *                             RGB color to the output colorspace & bits (we
- *                             figure out the format when we output a page).
- *   cups_open()             - Open the output file and initialize things.
- *   cups_print_pages()      - Send one or more pages to the output file.
- *   cups_put_params()       - Set pagedevice parameters.
- *   cups_set_color_info()   - Set the color information structure based on
- *                             the required output.
- *   cups_print_chunked()    - Print a page of chunked pixels.
- *   cups_print_banded()     - Print a page of banded pixels.
- *   cups_print_planar()     - Print a page of planar pixels.
- */
-
-/*
- * Include necessary headers...
- */
-
-#include "std.h"                /* to stop stdlib.h redefining types */
-#include "gdevprn.h"
-#include "gsparam.h"
-#include "gsexit.h"
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <cups/raster.h>
-#include <cups/ppd.h>
-#include <math.h>
-
-#undef private
-#define private
-
-
-/*
- * Check if we are compiling against CUPS 1.2.  If so, enable
- * certain extended attributes and use a different page header
- * structure and write function...
- */
-
-#ifdef CUPS_RASTER_SYNCv1
-#  define cups_page_header_t cups_page_header2_t
-#  define cupsRasterWriteHeader cupsRasterWriteHeader2
-#endif /* CUPS_RASTER_SYNCv1 */
-
-
-/*
- * Newer versions of Ghostscript don't provide gs_exit() function anymore.
- * It has been renamed to gs_to_exit()...
- */
-
-#ifdef dev_t_proc_encode_color
-#  define gs_exit gs_to_exit
-#endif /* dev_t_proc_encode_color */
-
-
-/*
- * CIE XYZ color constants...
- */
-
-#define D65_X  (0.412453 + 0.357580 + 0.180423)
-#define D65_Y  (0.212671 + 0.715160 + 0.072169)
-#define D65_Z  (0.019334 + 0.119193 + 0.950227)
-
-
-/*
- * Size of a tile in pixels...
- */
-
-#define CUPS_TILE_SIZE 256
-
-
-/*
- * Size of profile LUTs...
- */
-
-#ifdef dev_t_proc_encode_color
-#  define CUPS_MAX_VALUE       frac_1
-#else
-#  define CUPS_MAX_VALUE       gx_max_color_value
-#endif /* dev_t_proc_encode_color */
-
-
-/*
- * Macros...
- */
-
-#define x_dpi          (pdev->HWResolution[0])
-#define y_dpi          (pdev->HWResolution[1])
-#define cups           ((gx_device_cups *)pdev)
-
-/*
- * Macros from <macros.h>; we can't include <macros.h> because it also
- * defines DEBUG, one of our flags to insert various debugging code.
- */
-
-#ifndef max
-#  define max(a,b)     ((a)<(b) ? (b) : (a))
-#endif /* !max */
-
-#ifndef min
-#  define min(a,b)     ((a)>(b) ? (b) : (a))
-#endif /* !min */
-
-#ifndef abs
-#  define abs(x)       ((x)>=0 ? (x) : -(x))
-#endif /* !abs */
-
-
-/*
- * Procedures
- */
-
-private dev_proc_close_device(cups_close);
-private dev_proc_get_initial_matrix(cups_get_matrix);
-private int cups_get_params(gx_device *, gs_param_list *);
-private dev_proc_open_device(cups_open);
-private int cups_print_pages(gx_device_printer *, FILE *, int);
-private int cups_put_params(gx_device *, gs_param_list *);
-private void cups_set_color_info(gx_device *);
-private dev_proc_sync_output(cups_sync_output);
-private prn_dev_proc_get_space_params(cups_get_space_params);
-
-#ifdef dev_t_proc_encode_color
-private cm_map_proc_gray(cups_map_gray);
-private cm_map_proc_rgb(cups_map_rgb);
-private cm_map_proc_cmyk(cups_map_cmyk);
-private dev_proc_decode_color(cups_decode_color);
-private dev_proc_encode_color(cups_encode_color);
-private dev_proc_get_color_mapping_procs(cups_get_color_mapping_procs);
-
-static const gx_cm_color_map_procs cups_color_mapping_procs =
-{
-  cups_map_gray,
-  cups_map_rgb,
-  cups_map_cmyk
-};
-#else
-private dev_proc_map_cmyk_color(cups_map_cmyk_color);
-private dev_proc_map_color_rgb(cups_map_color_rgb);
-private dev_proc_map_rgb_color(cups_map_rgb_color);
-#endif /* dev_t_proc_encode_color */
-
-
-/*
- * The device descriptors...
- */
-
-typedef struct gx_device_cups_s
-{
-  gx_device_common;                    /* Standard GhostScript device stuff */
-  gx_prn_device_common;                        /* Standard printer device stuff */
-  int                  page;           /* Page number */
-  cups_raster_t                *stream;        /* Raster stream */
-  cups_page_header_t   header;         /* PostScript page device info */
-  int                  landscape;      /* Non-zero if this is landscape */
-} gx_device_cups;
-
-private gx_device_procs        cups_procs =
-{
-   cups_open,
-   cups_get_matrix,
-   cups_sync_output,
-   gdev_prn_output_page,
-   cups_close,
-#ifdef dev_t_proc_encode_color
-   NULL,                               /* map_rgb_color */
-   NULL,                               /* map_color_rgb */
-#else
-   cups_map_rgb_color,
-   cups_map_color_rgb,
-#endif /* dev_t_proc_encode_color */
-   NULL,                               /* fill_rectangle */
-   NULL,                               /* tile_rectangle */
-   NULL,                               /* copy_mono */
-   NULL,                               /* copy_color */
-   NULL,                               /* draw_line */
-   gx_default_get_bits,
-   cups_get_params,
-   cups_put_params,
-#ifdef dev_t_proc_encode_color
-   NULL,                               /* map_cmyk_color */
-#else
-   cups_map_cmyk_color,
-#endif /* dev_t_proc_encode_color */
-   NULL,                               /* get_xfont_procs */
-   NULL,                               /* get_xfont_device */
-   NULL,                               /* map_rgb_alpha_color */
-   gx_page_device_get_page_device,
-   NULL,                               /* get_alpha_bits */
-   NULL,                               /* copy_alpha */
-   NULL,                               /* get_band */
-   NULL,                               /* copy_rop */
-   NULL,                               /* fill_path */
-   NULL,                               /* stroke_path */
-   NULL,                               /* fill_mask */
-   NULL,                               /* fill_trapezoid */
-   NULL,                               /* fill_parallelogram */
-   NULL,                               /* fill_triangle */
-   NULL,                               /* draw_thin_line */
-   NULL,                               /* begin_image */
-   NULL,                               /* image_data */
-   NULL,                               /* end_image */
-   NULL,                               /* strip_tile_rectangle */
-   NULL                                        /* strip_copy_rop */
-#ifdef dev_t_proc_encode_color
-   ,
-   NULL,                               /* get_clipping_box */
-   NULL,                               /* begin_typed_image */
-   NULL,                               /* get_bits_rectangle */
-   NULL,                               /* map_color_rgb_alpha */
-   NULL,                               /* create_compositor */
-   NULL,                               /* get_hardware_params */
-   NULL,                               /* text_begin */
-   NULL,                               /* finish_copydevice */
-   NULL,                               /* begin_transparency_group */
-   NULL,                               /* end_transparency_group */
-   NULL,                               /* begin_transparency_mask */
-   NULL,                               /* end_transparency_mask */
-   NULL,                               /* discard_transparency_layer */
-   cups_get_color_mapping_procs,
-   NULL,                               /* get_color_comp_index */
-   cups_encode_color,
-   cups_decode_color
-#endif /* dev_t_proc_encode_color */
-};
-
-#define prn_device_body_copies(dtype, procs, dname, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_pages)\
-       std_device_full_body_type(dtype, &procs, dname, &st_device_printer,\
-         (int)((long)(w10) * (xdpi) / 10),\
-         (int)((long)(h10) * (ydpi) / 10),\
-         xdpi, ydpi,\
-         ncomp, depth, mg, mc, dg, dc,\
-         -(lo) * (xdpi), -(to) * (ydpi),\
-         (lm) * 72.0, (bm) * 72.0,\
-         (rm) * 72.0, (tm) * 72.0\
-       ),\
-       prn_device_body_copies_rest_(print_pages)
-
-gx_device_cups gs_cups_device =
-{
-  prn_device_body_copies(gx_device_cups,/* type */
-                         cups_procs,   /* procedures */
-                        "cups",        /* device name */
-                        85,            /* initial width */
-                        110,           /* initial height */
-                        100,           /* initial x resolution */
-                        100,           /* initial y resolution */
-                         0,            /* initial left offset */
-                        0,             /* initial top offset */
-                        0,             /* initial left margin */
-                        0,             /* initial bottom margin */
-                        0,             /* initial right margin */
-                        0,             /* initial top margin */
-                        1,             /* number of color components */
-                        1,             /* number of color bits */
-                        1,             /* maximum gray value */
-                        0,             /* maximum color value */
-                        2,             /* number of gray values */
-                        0,             /* number of color values */
-                        cups_print_pages),
-                                       /* print procedure */
-  0,                                   /* page */
-  NULL,                                        /* stream */
-  {                                    /* header */
-    "",                                        /* MediaClass */
-    "",                                        /* MediaColor */
-    "",                                        /* MediaType */
-    "",                                        /* OutputType */
-    0,                                 /* AdvanceDistance */
-    CUPS_ADVANCE_NONE,                 /* AdvanceMedia */
-    CUPS_FALSE,                                /* Collate */
-    CUPS_CUT_NONE,                     /* CutMedia */
-    CUPS_FALSE,                                /* Duplex */
-    { 100, 100 },                      /* HWResolution */
-    { 0, 0, 612, 792 },                        /* ImagingBoundingBox */
-    CUPS_FALSE,                                /* InsertSheet */
-    CUPS_JOG_NONE,                     /* Jog */
-    CUPS_EDGE_TOP,                     /* LeadingEdge */
-    { 0, 0 },                          /* Margins */
-    CUPS_FALSE,                                /* ManualFeed */
-    0,                                 /* MediaPosition */
-    0,                                 /* MediaWeight */
-    CUPS_FALSE,                                /* MirrorPrint */
-    CUPS_FALSE,                                /* NegativePrint */
-    1,                                 /* NumCopies */
-    CUPS_ORIENT_0,                     /* Orientation */
-    CUPS_FALSE,                                /* OutputFaceUp */
-    { 612, 792 },                      /* PageSize */
-    CUPS_FALSE,                                /* Separations */
-    CUPS_FALSE,                                /* TraySwitch */
-    CUPS_FALSE,                                /* Tumble */
-    850,                               /* cupsWidth */
-    1100,                              /* cupsHeight */
-    0,                                 /* cupsMediaType */
-    1,                                 /* cupsBitsPerColor */
-    1,                                 /* cupsBitsPerPixel */
-    107,                               /* cupsBytesPerLine */
-    CUPS_ORDER_CHUNKED,                        /* cupsColorOrder */
-    CUPS_CSPACE_K,                     /* cupsColorSpace */
-    0,                                 /* cupsCompression */
-    0,                                 /* cupsRowCount */
-    0,                                 /* cupsRowFeed */
-    0                                  /* cupsRowStep */
-  }
-};
-
-/*
- * Globals...
- */
-
-static gx_color_value  cupsDecodeLUT[256];
-                                       /* Output color to RGB value LUT */
-static unsigned char   cupsEncodeLUT[gx_max_color_value + 1];
-                                       /* RGB value to output color LUT */
-
-static ppd_file_t      *cupsPPD = 0;   /* PPD file for this device */
-static char            *cupsProfile = NULL;
-                                       /* Current simple color profile string */
-static int             cupsHaveProfile = 0;
-                                       /* Has a color profile been defined? */
-static int             cupsMatrix[3][3][CUPS_MAX_VALUE + 1];
-                                       /* Color transform matrix LUT */
-static int             cupsDensity[CUPS_MAX_VALUE + 1];
-                                       /* Density LUT */
-static unsigned char   cupsRevLower1[16] =
-                       {               /* Lower 1-bit reversal table */
-                         0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e,
-                         0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b, 0x07, 0x0f
-                       },
-                       cupsRevUpper1[16] =
-                       {               /* Upper 1-bit reversal table */
-                         0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
-                         0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0
-                       },
-                       cupsRevLower2[16] =
-                       {               /* Lower 2-bit reversal table */
-                         0x00, 0x04, 0x08, 0x0c, 0x01, 0x05, 0x09, 0x0d,
-                         0x02, 0x06, 0x0a, 0x0e, 0x03, 0x07, 0x0b, 0x0f
-                       },
-                       cupsRevUpper2[16] =
-                       {               /* Upper 2-bit reversal table */
-                         0x00, 0x40, 0x80, 0xc0, 0x10, 0x50, 0x90, 0xd0,
-                         0x20, 0x60, 0xa0, 0xe0, 0x30, 0x70, 0xb0, 0xf0
-                       };
-
-
-/*
- * Local functions...
- */
-
-static double  cups_map_cielab(double, double);
-static void    cups_print_chunked(gx_device_printer *, unsigned char *,
-                                  unsigned char *, int);
-static void    cups_print_banded(gx_device_printer *, unsigned char *,
-                                 unsigned char *, int);
-static void    cups_print_planar(gx_device_printer *, unsigned char *,
-                                 unsigned char *, int);
-
-/*static void  cups_set_margins(gx_device *);*/
-
-
-/*
- * 'cups_close()' - Close the output file.
- */
-
-private int
-cups_close(gx_device *pdev)            /* I - Device info */
-{
-#ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cups_close(%p)\n", pdev);
-#endif /* DEBUG */
-
-  if (cups->stream != NULL)
-  {
-    cupsRasterClose(cups->stream);
-    cups->stream = NULL;
-  }
-
-#if 0 /* Can't do this here because put_params() might close the device */
-  if (cupsPPD != NULL)
-  {
-    ppdClose(cupsPPD);
-    cupsPPD = NULL;
-  }
-
-  if (cupsProfile != NULL)
-  {
-    free(cupsProfile);
-    cupsProfile = NULL;
-  }
-#endif /* 0 */
-
-  return (gdev_prn_close(pdev));
-}
-
-
-#ifdef dev_t_proc_encode_color
-/*
- * 'cups_decode_color()' - Decode a color value.
- */
-
-private int                            /* O - Status (0 = OK) */
-cups_decode_color(gx_device      *pdev,        /* I - Device info */
-                  gx_color_index ci,   /* I - Color index */
-                  gx_color_value *cv)  /* O - Colors */
-{
-  int                  i;              /* Looping var */
-  int                  shift;          /* Bits to shift */
-  int                  mask;           /* Bits to mask */
-
-
-  if (cups->header.cupsColorSpace == CUPS_CSPACE_KCMYcm &&
-      cups->header.cupsBitsPerColor == 1)
-  {
-   /*
-    * KCMYcm data is represented internally by Ghostscript as CMYK...
-    */
-
-    cv[0] = (ci & 0x20) ? frac_1 : frac_0;
-    cv[1] = (ci & 0x12) ? frac_1 : frac_0;
-    cv[2] = (ci & 0x09) ? frac_1 : frac_0;
-    cv[3] = (ci & 0x04) ? frac_1 : frac_0;
-  }
-  else
-  {
-    shift = cups->header.cupsBitsPerColor;
-    mask  = (1 << shift) - 1;
-
-    for (i = cups->color_info.num_components - 1; i > 0; i --, ci >>= shift)
-      cv[i] = cupsDecodeLUT[ci & mask];
-
-    cv[0] = cupsDecodeLUT[ci & mask];
-  }
-
-  return (0);
-}
-
-
-/*
- * 'cups_encode_color()' - Encode a color value.
- */
-
-private gx_color_index                 /* O - Color index */
-cups_encode_color(gx_device            *pdev,
-                                       /* I - Device info */
-                  const gx_color_value *cv)
-                                       /* I - Colors */
-{
-  int                  i;              /* Looping var */
-  gx_color_index       ci;             /* Color index */
-  int                  shift;          /* Bits to shift */
-
-
- /*
-  * Encode the color index...
-  */
-
-  shift = cups->header.cupsBitsPerColor;
-
-  for (ci = cupsEncodeLUT[cv[0]], i = 1;
-       i < cups->color_info.num_components;
-       i ++)
-    ci = (ci << shift) | cupsEncodeLUT[cv[i]];
-
- /*
-  * Handle 6-color output...
-  */
-
-  if (cups->header.cupsColorSpace == CUPS_CSPACE_KCMYcm &&
-      cups->header.cupsBitsPerColor == 1)
-  {
-   /*
-    * Welcome to hackville, where we map CMYK data to the
-    * light inks in draft mode...  Map blue to light magenta and
-    * cyan and green to light cyan and yellow...
-    */
-
-    ci <<= 2;                          /* Leave room for light inks */
-
-    if (ci == 0x18)                    /* Blue */
-      ci = 0x11;                       /* == cyan + light magenta */
-    else if (ci == 0x14)               /* Green */
-      ci = 0x06;                       /* == light cyan + yellow */
-  }
-
- /*
-  * Range check the return value...
-  */
-
-  if (ci == gx_no_color_index)
-    ci --;
-
- /*
-  * Return the color index...
-  */
-
-  return (ci);
-}
-
-
-/*
- * 'cups_get_color_mapping_procs()' - Get the list of color mapping procedures.
- */
-
-private const gx_cm_color_map_procs *  /* O - List of device procedures */
-cups_get_color_mapping_procs(const gx_device *pdev)
-                                       /* I - Device info */
-{
-  return (&cups_color_mapping_procs);
-}
-#endif /* dev_t_proc_encode_color */
-
-
-/*
- * 'cups_get_matrix()' - Generate the default page matrix.
- */
-
-private void
-cups_get_matrix(gx_device *pdev,       /* I - Device info */
-                gs_matrix *pmat)       /* O - Physical transform matrix */
-{
-#ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cups_get_matrix(%p, %p)\n", pdev, pmat);
-#endif /* DEBUG */
-
- /*
-  * Set the raster width and height...
-  */
-
-  cups->header.cupsWidth  = cups->width;
-  cups->header.cupsHeight = cups->height;
-
- /*
-  * Set the transform matrix...
-  */
-
-  fprintf(stderr, "DEBUG: cups->header.Duplex = %d\n", cups->header.Duplex);
-  fprintf(stderr, "DEBUG: cups->page = %d\n", cups->page);
-
-  if (cupsPPD)
-  {
-    fprintf(stderr, "DEBUG: cupsPPD = %p\n", cupsPPD);
-    fprintf(stderr, "DEBUG: cupsPPD->flip_duplex = %d\n", cupsPPD->flip_duplex);
-  }
-
-  if (cups->landscape)
-  {
-   /*
-    * Do landscape orientation...
-    */
-
-    if (cups->header.Duplex && !cups->header.Tumble &&
-       cupsPPD && cupsPPD->flip_duplex && !(cups->page & 1))
-    {
-      pmat->xx = 0.0;
-      pmat->xy = (float)cups->header.HWResolution[0] / 72.0;
-      pmat->yx = -(float)cups->header.HWResolution[1] / 72.0;
-      pmat->yy = 0.0;
-      pmat->tx = -(float)cups->header.HWResolution[0] * pdev->HWMargins[2] / 72.0;
-      pmat->ty = (float)cups->header.HWResolution[1] *
-                 ((float)cups->header.PageSize[0] - pdev->HWMargins[3]) / 72.0;
-    }
-    else
-    {
-      pmat->xx = 0.0;
-      pmat->xy = (float)cups->header.HWResolution[0] / 72.0;
-      pmat->yx = (float)cups->header.HWResolution[1] / 72.0;
-      pmat->yy = 0.0;
-      pmat->tx = -(float)cups->header.HWResolution[0] * pdev->HWMargins[0] / 72.0;
-      pmat->ty = -(float)cups->header.HWResolution[1] * pdev->HWMargins[1] / 72.0;
-    }
-  }
-  else if (cups->header.Duplex && !cups->header.Tumble &&
-           cupsPPD && cupsPPD->flip_duplex && !(cups->page & 1))
-  {
-    pmat->xx = (float)cups->header.HWResolution[0] / 72.0;
-    pmat->xy = 0.0;
-    pmat->yx = 0.0;
-    pmat->yy = (float)cups->header.HWResolution[1] / 72.0;
-    pmat->tx = -(float)cups->header.HWResolution[0] * pdev->HWMargins[2] / 72.0;
-    pmat->ty = -(float)cups->header.HWResolution[1] * pdev->HWMargins[3] / 72.0;
-  }
-  else
-  {
-    pmat->xx = (float)cups->header.HWResolution[0] / 72.0;
-    pmat->xy = 0.0;
-    pmat->yx = 0.0;
-    pmat->yy = -(float)cups->header.HWResolution[1] / 72.0;
-    pmat->tx = -(float)cups->header.HWResolution[0] * pdev->HWMargins[0] / 72.0;
-    pmat->ty = (float)cups->header.HWResolution[1] *
-               ((float)cups->header.PageSize[1] - pdev->HWMargins[3]) / 72.0;
-  }
-
-  fprintf(stderr, "DEBUG: width = %d, height = %d\n", cups->width,
-          cups->height);
-  fprintf(stderr, "DEBUG: PageSize = [ %d %d ], HWResolution = [ %d %d ]\n",
-          cups->header.PageSize[0], cups->header.PageSize[1],
-          cups->header.HWResolution[0], cups->header.HWResolution[1]);
-  fprintf(stderr, "DEBUG: HWMargins = [ %.3f %.3f %.3f %.3f ]\n",
-         pdev->HWMargins[0], pdev->HWMargins[1], pdev->HWMargins[2],
-         pdev->HWMargins[3]);
-  fprintf(stderr, "DEBUG: matrix = [ %.3f %.3f %.3f %.3f %.3f %.3f ]\n",
-          pmat->xx, pmat->xy, pmat->yx, pmat->yy, pmat->tx, pmat->ty);
-}
-
-
-/*
- * 'cups_get_params()' - Get pagedevice parameters.
- */
-
-private int                            /* O - Error status */
-cups_get_params(gx_device     *pdev,   /* I - Device info */
-                gs_param_list *plist)  /* I - Parameter list */
-{
-#ifdef CUPS_RASTER_SYNCv1
-  int                  i;              /* Looping var */
-  char                 name[255];      /* Attribute name */
-#endif /* CUPS_RASTER_SYNCv1 */
-  int                  code;           /* Return code */
-  gs_param_string      s;              /* Temporary string value */
-  bool                 b;              /* Temporary boolean value */
-
-
-#ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cups_get_params(%p, %p)\n", pdev, plist);
-#endif /* DEBUG */
-
- /*
-  * First process the "standard" page device parameters...
-  */
-
-#ifdef DEBUG
-  fputs("DEBUG2: before gdev_prn_get_params()\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = gdev_prn_get_params(pdev, plist)) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: after gdev_prn_get_params()\n", stderr);
-#endif /* DEBUG */
-
- /*
-  * Then write the CUPS parameters...
-  */
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding MediaClass\n", stderr);
-#endif /* DEBUG */
-
-  param_string_from_string(s, cups->header.MediaClass);
-  if ((code = param_write_string(plist, "MediaClass", &s)) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding AdvanceDistance\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "AdvanceDistance",
-                              (int *)&(cups->header.AdvanceDistance))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding AdvanceDistance\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "AdvanceMedia",
-                              (int *)&(cups->header.AdvanceMedia))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding Collate\n", stderr);
-#endif /* DEBUG */
-
-  b = cups->header.Collate;
-  if ((code = param_write_bool(plist, "Collate", &b)) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding CutMedia\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "CutMedia",
-                              (int *)&(cups->header.CutMedia))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding InsertSheet\n", stderr);
-#endif /* DEBUG */
-
-  b = cups->header.InsertSheet;
-  if ((code = param_write_bool(plist, "InsertSheet", &b)) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding Jog\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "Jog",
-                              (int *)&(cups->header.Jog))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding LeadingEdge\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "LeadingEdge",
-                              (int *)&(cups->header.LeadingEdge))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding ManualFeed\n", stderr);
-#endif /* DEBUG */
-
-  b = cups->header.ManualFeed;
-  if ((code = param_write_bool(plist, "ManualFeed", &b)) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding MediaPosition\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "MediaPosition",
-                              (int *)&(cups->header.MediaPosition))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding MirrorPrint\n", stderr);
-#endif /* DEBUG */
-
-  b = cups->header.MirrorPrint;
-  if ((code = param_write_bool(plist, "MirrorPrint", &b)) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding NegativePrint\n", stderr);
-#endif /* DEBUG */
-
-  b = cups->header.NegativePrint;
-  if ((code = param_write_bool(plist, "NegativePrint", &b)) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding OutputFaceUp\n", stderr);
-#endif /* DEBUG */
-
-  b = cups->header.OutputFaceUp;
-  if ((code = param_write_bool(plist, "OutputFaceUp", &b)) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding Separations\n", stderr);
-#endif /* DEBUG */
-
-  b = cups->header.Separations;
-  if ((code = param_write_bool(plist, "Separations", &b)) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding TraySwitch\n", stderr);
-#endif /* DEBUG */
-
-  b = cups->header.TraySwitch;
-  if ((code = param_write_bool(plist, "TraySwitch", &b)) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding Tumble\n", stderr);
-#endif /* DEBUG */
-
-  b = cups->header.Tumble;
-  if ((code = param_write_bool(plist, "Tumble", &b)) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding cupsWidth\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "cupsWidth",
-                              (int *)&(cups->header.cupsWidth))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding cupsHeight\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "cupsHeight",
-                              (int *)&(cups->header.cupsHeight))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding cupsMediaType\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "cupsMediaType",
-                              (int *)&(cups->header.cupsMediaType))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding cupsBitsPerColor\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "cupsBitsPerColor",
-                              (int *)&(cups->header.cupsBitsPerColor))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding cupsBitsPerPixel\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "cupsBitsPerPixel",
-                              (int *)&(cups->header.cupsBitsPerPixel))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding cupsBytesPerLine\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "cupsBytesPerLine",
-                              (int *)&(cups->header.cupsBytesPerLine))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding cupsColorOrder\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "cupsColorOrder",
-                              (int *)&(cups->header.cupsColorOrder))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding cupsColorSpace\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "cupsColorSpace",
-                              (int *)&(cups->header.cupsColorSpace))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding cupsCompression\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "cupsCompression",
-                              (int *)&(cups->header.cupsCompression))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding cupsRowCount\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "cupsRowCount",
-                              (int *)&(cups->header.cupsRowCount))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding cupsRowFeed\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "cupsRowFeed",
-                              (int *)&(cups->header.cupsRowFeed))) < 0)
-    return (code);
-
-#ifdef DEBUG
-  fputs("DEBUG2: Adding cupsRowStep\n", stderr);
-#endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "cupsRowStep",
-                              (int *)&(cups->header.cupsRowStep))) < 0)
-    return (code);
-
-#ifdef CUPS_RASTER_SYNCv1
-#  ifdef DEBUG
-  fputs("DEBUG2: Adding cupsNumColors\n", stderr);
-#  endif /* DEBUG */
-
-  if ((code = param_write_int(plist, "cupsNumColors",
-                              (int *)&(cups->header.cupsNumColors))) < 0)
-    return (code);
-
-#  ifdef DEBUG
-  fputs("DEBUG2: Adding cupsInteger\n", stderr);
-#  endif /* DEBUG */
-
-  for (i = 0; i < 16; i ++)
-  {
-    sprintf(name, "cupsInteger%d", i);
-    if ((code = param_write_int(plist, name,
-                               (int *)(cups->header.cupsInteger + i))) < 0)
-      return (code);
-  }
-
-#  ifdef DEBUG
-  fputs("DEBUG2: Adding cupsReal\n", stderr);
-#  endif /* DEBUG */
-
-  for (i = 0; i < 16; i ++)
-  {
-    sprintf(name, "cupsReal%d", i);
-    if ((code = param_write_float(plist, name,
-                                 cups->header.cupsReal + i)) < 0)
-      return (code);
-  }
-
-#  ifdef DEBUG
-  fputs("DEBUG2: Adding cupsString\n", stderr);
-#  endif /* DEBUG */
-
-  for (i = 0; i < 16; i ++)
-  {
-    sprintf(name, "cupsReal%d", i);
-    param_string_from_string(s, cups->header.cupsString[i]);
-    if ((code = param_write_string(plist, name, &s)) < 0)
-      return (code);
-  }
-
-#  ifdef DEBUG
-  fputs("DEBUG2: Adding cupsMarkerType\n", stderr);
-#  endif /* DEBUG */
-
-  param_string_from_string(s, cups->header.cupsMarkerType);
-  if ((code = param_write_string(plist, "cupsMarkerType", &s)) < 0)
-    return (code);
-
-#  ifdef DEBUG
-  fputs("DEBUG2: Adding cupsRenderingIntent\n", stderr);
-#  endif /* DEBUG */
-
-  param_string_from_string(s, cups->header.cupsRenderingIntent);
-  if ((code = param_write_string(plist, "cupsRenderingIntent", &s)) < 0)
-    return (code);
-#endif /* CUPS_RASTER_SYNCv1 */
-
-#ifdef DEBUG
-  fputs("DEBUG2: Leaving cups_get_params()\n", stderr);
-#endif /* DEBUG */
-
-  return (0);
-}
-
-
-/*
- * 'cups_get_space_params()' - Get space parameters from the RIP_CACHE env var.
- */
-
-void
-cups_get_space_params(const gx_device_printer *pdev,
-                                       /* I - Printer device */
-                      gdev_prn_space_params   *space_params)
-                                       /* O - Space parameters */
-{
-  float        cache_size;                     /* Size of tile cache in bytes */
-  char *cache_env,                     /* Cache size environment variable */
-       cache_units[255];               /* Cache size units */
-
-
-#ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cups_get_space_params(%p, %p)\n", pdev, space_params);
-#endif /* DEBUG */
-
-  if ((cache_env = getenv("RIP_MAX_CACHE")) != NULL)
-  {
-    switch (sscanf(cache_env, "%f%254s", &cache_size, cache_units))
-    {
-      case 0 :
-          cache_size = 8 * 1024 * 1024;
-         break;
-      case 1 :
-          cache_size *= 4 * CUPS_TILE_SIZE * CUPS_TILE_SIZE;
-         break;
-      case 2 :
-          if (tolower(cache_units[0]) == 'g')
-           cache_size *= 1024 * 1024 * 1024;
-          else if (tolower(cache_units[0]) == 'm')
-           cache_size *= 1024 * 1024;
-         else if (tolower(cache_units[0]) == 'k')
-           cache_size *= 1024;
-         else if (tolower(cache_units[0]) == 't')
-           cache_size *= 4 * CUPS_TILE_SIZE * CUPS_TILE_SIZE;
-         break;
-    }
-  }
-  else
-    cache_size = 8 * 1024 * 1024;
-
-  fprintf(stderr, "DEBUG: cache_size = %.0f\n", cache_size);
-
-  space_params->MaxBitmap   = (int)cache_size;
-  space_params->BufferSpace = (int)cache_size / 10;
-}
-
-
-/*
- * 'cups_map_cielab()' - Map CIE Lab transformation...
- */
-
-static double                          /* O - Adjusted color value */
-cups_map_cielab(double x,              /* I - Raw color value */
-                double xn)             /* I - Whitepoint color value */
-{
-  double x_xn;                         /* Fraction of whitepoint */
-
-
-  x_xn = x / xn;
-
-  if (x_xn > 0.008856)
-    return (cbrt(x_xn));
-  else
-    return (7.787 * x_xn + 16.0 / 116.0);
-}
-
-
-#ifdef dev_t_proc_encode_color
-/*
- * 'cups_map_cmyk()' - Map a CMYK color value to device colors.
- */
-
-private void
-cups_map_cmyk(gx_device *pdev,         /* I - Device info */
-              frac      c,             /* I - Cyan value */
-             frac      m,              /* I - Magenta value */
-             frac      y,              /* I - Yellow value */
-             frac      k,              /* I - Black value */
-             frac      *out)           /* O - Device colors */
-{
-  int  c0, c1, c2;                     /* Temporary color values */
-  float        rr, rg, rb,                     /* Real RGB colors */
-       ciex, ciey, ciez,               /* CIE XYZ colors */
-       ciey_yn,                        /* Normalized luminance */
-       ciel, ciea, cieb;               /* CIE Lab colors */
-
-
-#ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cups_map_cmyk(%p, %d, %d, %d, %d, %p)\n",
-          pdev, c, m, y, k, out);
-#endif /* DEBUG */
-
- /*
-  * Convert the CMYK color to the destination colorspace...
-  */
-
-  switch (cups->header.cupsColorSpace)
-  {
-    case CUPS_CSPACE_W :
-        c0 = frac_1 - (c * 31 + m * 61 + y * 8) / 100 - k;
-
-       if (c0 < 0)
-         out[0] = 0;
-       else if (c0 > frac_1)
-         out[0] = (frac)cupsDensity[frac_1];
-       else
-         out[0] = (frac)cupsDensity[c0];
-        break;
-
-    case CUPS_CSPACE_RGBA :
-        out[3] = frac_1;
-
-    case CUPS_CSPACE_RGB :
-        c0 = frac_1 - c - k;
-       c1 = frac_1 - m - k;
-       c2 = frac_1 - y - k;
-
-        if (c0 < 0)
-         out[0] = 0;
-       else if (c0 > frac_1)
-         out[0] = (frac)cupsDensity[frac_1];
-       else
-         out[0] = (frac)cupsDensity[c0];
-
-        if (c1 < 0)
-         out[1] = 0;
-       else if (c1 > frac_1)
-         out[1] = (frac)cupsDensity[frac_1];
-       else
-         out[1] = (frac)cupsDensity[c1];
-
-        if (c2 < 0)
-         out[2] = 0;
-       else if (c2 > frac_1)
-         out[2] = (frac)cupsDensity[frac_1];
-       else
-         out[2] = (frac)cupsDensity[c2];
-        break;
-
-    default :
-    case CUPS_CSPACE_K :
-        c0 = (c * 31 + m * 61 + y * 8) / 100 + k;
-
-       if (c0 < 0)
-         out[0] = 0;
-       else if (c0 > frac_1)
-         out[0] = (frac)cupsDensity[frac_1];
-       else
-         out[0] = (frac)cupsDensity[c0];
-        break;
-
-    case CUPS_CSPACE_CMY :
-        c0 = c + k;
-       c1 = m + k;
-       c2 = y + k;
-
-        if (c0 < 0)
-         out[0] = 0;
-       else if (c0 > frac_1)
-         out[0] = (frac)cupsDensity[frac_1];
-       else
-         out[0] = (frac)cupsDensity[c0];
-
-        if (c1 < 0)
-         out[1] = 0;
-       else if (c1 > frac_1)
-         out[1] = (frac)cupsDensity[frac_1];
-       else
-         out[1] = (frac)cupsDensity[c1];
-
-        if (c2 < 0)
-         out[2] = 0;
-       else if (c2 > frac_1)
-         out[2] = (frac)cupsDensity[frac_1];
-       else
-         out[2] = (frac)cupsDensity[c2];
-        break;
-
-    case CUPS_CSPACE_YMC :
-        c0 = y + k;
-       c1 = m + k;
-       c2 = c + k;
-
-        if (c0 < 0)
-         out[0] = 0;
-       else if (c0 > frac_1)
-         out[0] = (frac)cupsDensity[frac_1];
-       else
-         out[0] = (frac)cupsDensity[c0];
-
-        if (c1 < 0)
-         out[1] = 0;
-       else if (c1 > frac_1)
-         out[1] = (frac)cupsDensity[frac_1];
-       else
-         out[1] = (frac)cupsDensity[c1];
-
-        if (c2 < 0)
-         out[2] = 0;
-       else if (c2 > frac_1)
-         out[2] = (frac)cupsDensity[frac_1];
-       else
-         out[2] = (frac)cupsDensity[c2];
-        break;
-
-    case CUPS_CSPACE_CMYK :
-        if (c < 0)
-         out[0] = 0;
-       else if (c > frac_1)
-         out[0] = (frac)cupsDensity[frac_1];
-       else
-         out[0] = (frac)cupsDensity[c];
-
-        if (m < 0)
-         out[1] = 0;
-       else if (m > frac_1)
-         out[1] = (frac)cupsDensity[frac_1];
-       else
-         out[1] = (frac)cupsDensity[m];
-
-        if (y < 0)
-         out[2] = 0;
-       else if (y > frac_1)
-         out[2] = (frac)cupsDensity[frac_1];
-       else
-         out[2] = (frac)cupsDensity[y];
-
-        if (k < 0)
-         out[3] = 0;
-       else if (k > frac_1)
-         out[3] = (frac)cupsDensity[frac_1];
-       else
-         out[3] = (frac)cupsDensity[k];
-        break;
-
-    case CUPS_CSPACE_YMCK :
-    case CUPS_CSPACE_GMCK :
-    case CUPS_CSPACE_GMCS :
-        if (y < 0)
-         out[0] = 0;
-       else if (y > frac_1)
-         out[0] = (frac)cupsDensity[frac_1];
-       else
-         out[0] = (frac)cupsDensity[y];
-
-        if (m < 0)
-         out[1] = 0;
-       else if (m > frac_1)
-         out[1] = (frac)cupsDensity[frac_1];
-       else
-         out[1] = (frac)cupsDensity[m];
-
-        if (c < 0)
-         out[2] = 0;
-       else if (c > frac_1)
-         out[2] = (frac)cupsDensity[frac_1];
-       else
-         out[2] = (frac)cupsDensity[c];
-
-        if (k < 0)
-         out[3] = 0;
-       else if (k > frac_1)
-         out[3] = (frac)cupsDensity[frac_1];
-       else
-         out[3] = (frac)cupsDensity[k];
-        break;
-
-    case CUPS_CSPACE_KCMYcm :
-    case CUPS_CSPACE_KCMY :
-        if (k < 0)
-         out[0] = 0;
-       else if (k > frac_1)
-         out[0] = (frac)cupsDensity[frac_1];
-       else
-         out[0] = (frac)cupsDensity[k];
-
-        if (c < 0)
-         out[1] = 0;
-       else if (c > frac_1)
-         out[1] = (frac)cupsDensity[frac_1];
-       else
-         out[1] = (frac)cupsDensity[c];
-
-        if (m < 0)
-         out[2] = 0;
-       else if (m > frac_1)
-         out[2] = (frac)cupsDensity[frac_1];
-       else
-         out[2] = (frac)cupsDensity[m];
-
-        if (y < 0)
-         out[3] = 0;
-       else if (y > frac_1)
-         out[3] = (frac)cupsDensity[frac_1];
-       else
-         out[3] = (frac)cupsDensity[y];
-        break;
-
-#  ifdef CUPS_RASTER_HAVE_COLORIMETRIC
-    case CUPS_CSPACE_CIEXYZ :
-    case CUPS_CSPACE_CIELab :
-    case CUPS_CSPACE_ICC1 :
-    case CUPS_CSPACE_ICC2 :
-    case CUPS_CSPACE_ICC3 :
-    case CUPS_CSPACE_ICC4 :
-    case CUPS_CSPACE_ICC5 :
-    case CUPS_CSPACE_ICC6 :
-    case CUPS_CSPACE_ICC7 :
-    case CUPS_CSPACE_ICC8 :
-    case CUPS_CSPACE_ICC9 :
-    case CUPS_CSPACE_ICCA :
-    case CUPS_CSPACE_ICCB :
-    case CUPS_CSPACE_ICCC :
-    case CUPS_CSPACE_ICCD :
-    case CUPS_CSPACE_ICCE :
-    case CUPS_CSPACE_ICCF :
-       /*
-        * Convert CMYK to sRGB...
-       */
-
-        c0 = frac_1 - c - k;
-       c1 = frac_1 - m - k;
-       c2 = frac_1 - y - k;
-
-        if (c0 < 0)
-         c0 = 0;
-       else if (c0 > frac_1)
-         c0 = frac_1;
-
-        if (c1 < 0)
-         c1 = 0;
-       else if (c1 > frac_1)
-         c1 = frac_1;
-
-        if (c2 < 0)
-         c2 = 0;
-       else if (c2 > frac_1)
-         c2 = frac_1;
-
-       /*
-        * Convert sRGB to linear RGB...
-       */
-
-       rr = pow((double)c0 / (double)frac_1, 0.58823529412);
-       rg = pow((double)c1 / (double)frac_1, 0.58823529412);
-       rb = pow((double)c2 / (double)frac_1, 0.58823529412);
-
-       /*
-        * Convert to CIE XYZ...
-       */
-
-       ciex = 0.412453 * rr + 0.357580 * rg + 0.180423 * rb;
-       ciey = 0.212671 * rr + 0.715160 * rg + 0.072169 * rb;
-       ciez = 0.019334 * rr + 0.119193 * rg + 0.950227 * rb;
-
-        if (cups->header.cupsColorSpace == CUPS_CSPACE_CIEXYZ)
-       {
-        /*
-         * Convert to an integer XYZ color value...
-         */
-
-          if (ciex > 1.0)
-           c0 = frac_1;
-         else if (ciex > 0.0)
-           c0 = (int)(ciex * frac_1);
-         else
-           c0 = 0;
-
-          if (ciey > 1.0)
-           c1 = frac_1;
-         else if (ciey > 0.0)
-           c1 = (int)(ciey * frac_1);
-         else
-           c1 = 0;
-
-          if (ciez > 1.0)
-           c2 = frac_1;
-         else if (ciez > 0.0)
-           c2 = (int)(ciez * frac_1);
-         else
-           c2 = 0;
-       }
-       else
-       {
-        /*
-         * Convert CIE XYZ to Lab...
-         */
-
-         ciey_yn = ciey / D65_Y;
-
-         if (ciey_yn > 0.008856)
-           ciel = 116 * cbrt(ciey_yn) - 16;
-         else
-           ciel = 903.3 * ciey_yn;
-
-         ciea = 500 * (cups_map_cielab(ciex, D65_X) -
-                       cups_map_cielab(ciey, D65_Y));
-         cieb = 200 * (cups_map_cielab(ciey, D65_Y) -
-                       cups_map_cielab(ciez, D65_Z));
-
-         /*
-         * Scale the L value and bias the a and b values by 128
-         * so that all values are in the range of 0 to 255.
-         */
-
-         ciel *= 2.55;
-         ciea += 128;
-         cieb += 128;
-
-         /*
-         * Convert to frac values...
-         */
-
-          if (ciel < 0.0)
-           c0 = 0;
-         else if (ciel < 255.0)
-           c0 = (int)(ciel * frac_1 / 255.0);
-         else
-           c0 = frac_1;
-
-          if (ciea < 0.0)
-           c1 = 0;
-         else if (ciea < 255.0)
-           c1 = (int)(ciea * frac_1 / 255.0);
-         else
-           c1 = frac_1;
-
-          if (cieb < 0.0)
-           c2 = 0;
-         else if (cieb < 255.0)
-           c2 = (int)(cieb * frac_1 / 255.0);
-         else
-           c2 = frac_1;
-       }
-
-       /*
-        * Put the final color value together...
-       */
-
-        out[0] = c0;
-       out[1] = c1;
-       out[2] = c2;
-        break;
-#  endif /* CUPS_RASTER_HAVE_COLORIMETRIC */
-  }
-
-  switch (cups->color_info.num_components)
-  {
-    default :
-    case 1 :
-#ifdef DEBUG
-        fprintf(stderr, "DEBUG2:   \\=== COLOR %d\n", out[0]);
-#endif /* DEBUG */
-       break;
-
-    case 3 :
-#ifdef DEBUG
-        fprintf(stderr, "DEBUG2:   \\=== COLOR %d, %d, %d\n",
-               out[0], out[1], out[2]);
-#endif /* DEBUG */
-       break;
-
-    case 4 :
-#ifdef DEBUG
-        fprintf(stderr, "DEBUG2:   \\=== COLOR %d, %d, %d, %d\n",
-               out[0], out[1], out[2], out[3]);
-#endif /* DEBUG */
-       break;
-  }
-}
-
-
-/*
- * 'cups_map_gray()' - Map a grayscale value to device colors.
- */
-
-private void
-cups_map_gray(gx_device *pdev,         /* I - Device info */
-              frac      g,             /* I - Grayscale value */
-             frac      *out)           /* O - Device colors */
-{
-#ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cups_map_gray(%p, %d, %p)\n",
-          pdev, g, out);
-#endif /* DEBUG */
-
- /*
-  * Just use the CMYK mapper...
-  */
-
-  cups_map_cmyk(pdev, 0, 0, 0, frac_1 - g, out);
-}
-
-
-/*
- * 'cups_map_rgb()' - Map a RGB color value to device colors.
- */
-
-private void
-cups_map_rgb(gx_device             *pdev,
-                                       /* I - Device info */
-             const gs_imager_state *pis,/* I - Device state */
-             frac                  r,  /* I - Red value */
-            frac                  g,   /* I - Green value */
-            frac                  b,   /* I - Blue value */
-            frac                  *out)/* O - Device colors */
-{
-  frac         c, m, y, k;             /* CMYK values */
-  frac         mk;                     /* Maximum K value */
-  int          tc, tm, ty;             /* Temporary color values */
-
-
-#ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cups_map_rgb(%p, %p, %d, %d, %d, %p)\n",
-          pdev, pis, r, g, b, out);
-#endif /* DEBUG */
-
- /*
-  * Compute CMYK values...
-  */
-
-  c = frac_1 - r;
-  m = frac_1 - g;
-  y = frac_1 - b;
-  k = min(c, min(m, y));
-
-  if ((mk = max(c, max(m, y))) > k)
-    k = (int)((float)k * (float)k * (float)k / ((float)mk * (float)mk));
-
-  c -= k;
-  m -= k;
-  y -= k;
-
- /*
-  * Do color correction as needed...
-  */
-
-  if (cupsHaveProfile)
-  {
-   /*
-    * Color correct CMY...
-    */
-
-    tc = cupsMatrix[0][0][c] +
-         cupsMatrix[0][1][m] +
-        cupsMatrix[0][2][y];
-    tm = cupsMatrix[1][0][c] +
-         cupsMatrix[1][1][m] +
-        cupsMatrix[1][2][y];
-    ty = cupsMatrix[2][0][c] +
-         cupsMatrix[2][1][m] +
-        cupsMatrix[2][2][y];
-
-    if (tc < 0)
-      c = 0;
-    else if (tc > frac_1)
-      c = frac_1;
-    else
-      c = (frac)tc;
-
-    if (tm < 0)
-      m = 0;
-    else if (tm > frac_1)
-      m = frac_1;
-    else
-      m = (frac)tm;
-
-    if (ty < 0)
-      y = 0;
-    else if (ty > frac_1)
-      y = frac_1;
-    else
-      y = (frac)ty;
-  }
-
- /*
-  * Use the CMYK mapping function to produce the device colors...
-  */
-
-  cups_map_cmyk(pdev, c, m, y, k, out);
-}
-#else
-/*
- * 'cups_map_cmyk_color()' - Map a CMYK color to a color index.
- *
- * This function is only called when a 4 or 6 color colorspace is
- * selected for output.  CMYK colors are *not* corrected but *are*
- * density adjusted.
- */
-
-private gx_color_index                 /* O - Color index */
-cups_map_cmyk_color(gx_device      *pdev,
-                                       /* I - Device info */
-                    gx_color_value c,  /* I - Cyan value */
-                    gx_color_value m,  /* I - Magenta value */
-                    gx_color_value y,  /* I - Yellow value */
-                   gx_color_value k)   /* I - Black value */
-{
-  gx_color_index       i;              /* Temporary index */
-  gx_color_value       ic, im, iy, ik; /* Integral CMYK values */
-
-
-#  ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cups_map_cmyk_color(%p, %d, %d, %d, %d)\n", pdev,
-          c, m, y, k);
-#  endif /* DEBUG */
-
- /*
-  * Setup the color info data as needed...
-  */
-
-  if (pdev->color_info.num_components == 0)
-    cups_set_color_info(pdev);
-
- /*
-  * Density correct...
-  */
-
-  if (cupsHaveProfile)
-  {
-    c = cupsDensity[c];
-    m = cupsDensity[m];
-    y = cupsDensity[y];
-    k = cupsDensity[k];
-  }
-
-  ic = cupsEncodeLUT[c];
-  im = cupsEncodeLUT[m];
-  iy = cupsEncodeLUT[y];
-  ik = cupsEncodeLUT[k];
-
- /*
-  * Convert the CMYK color to a color index...
-  */
-
-  switch (cups->header.cupsColorSpace)
-  {
-    default :
-        switch (cups->header.cupsBitsPerColor)
-        {
-          default :
-              i = (((((ic << 1) | im) << 1) | iy) << 1) | ik;
-              break;
-          case 2 :
-              i = (((((ic << 2) | im) << 2) | iy) << 2) | ik;
-              break;
-          case 4 :
-              i = (((((ic << 4) | im) << 4) | iy) << 4) | ik;
-              break;
-          case 8 :
-              i = (((((ic << 8) | im) << 8) | iy) << 8) | ik;
-              break;
-        }
-        break;
-
-    case CUPS_CSPACE_YMCK :
-    case CUPS_CSPACE_GMCK :
-    case CUPS_CSPACE_GMCS :
-        switch (cups->header.cupsBitsPerColor)
-        {
-          default :
-              i = (((((iy << 1) | im) << 1) | ic) << 1) | ik;
-              break;
-          case 2 :
-              i = (((((iy << 2) | im) << 2) | ic) << 2) | ik;
-              break;
-          case 4 :
-              i = (((((iy << 4) | im) << 4) | ic) << 4) | ik;
-              break;
-          case 8 :
-              i = (((((iy << 8) | im) << 8) | ic) << 8) | ik;
-              break;
-        }
-        break;
-
-    case CUPS_CSPACE_KCMYcm :
-        if (cups->header.cupsBitsPerColor == 1)
-       {
-         if (ik)
-           i = 32;
-         else
-           i = 0;
-
-         if (ic && im)
-           i |= 17;
-         else if (ic && iy)
-           i |= 6;
-         else if (im && iy)
-           i |= 12;
-         else if (ic)
-           i |= 16;
-         else if (im)
-           i |= 8;
-         else if (iy)
-           i |= 4;
-         break;
-       }
-
-    case CUPS_CSPACE_KCMY :
-        switch (cups->header.cupsBitsPerColor)
-        {
-          default :
-              i = (((((ik << 1) | ic) << 1) | im) << 1) | iy;
-              break;
-          case 2 :
-              i = (((((ik << 2) | ic) << 2) | im) << 2) | iy;
-              break;
-          case 4 :
-              i = (((((ik << 4) | ic) << 4) | im) << 4) | iy;
-              break;
-          case 8 :
-              i = (((((ik << 8) | ic) << 8) | im) << 8) | iy;
-              break;
-        }
-        break;
-  }
-
-#  ifdef DEBUG
-  fprintf(stderr, "DEBUG2: CMYK (%d,%d,%d,%d) -> CMYK %08x (%d,%d,%d,%d)\n",
-          c, m, y, k, (unsigned)i, ic, im, iy, ik);
-#  endif /* DEBUG */
-
- /*
-  * Make sure we don't get a CMYK color of 255, 255, 255, 255...
-  */
-
-  if (i == gx_no_color_index)
-    i --;
-
-  return (i);
-}
-
-
-/*
- * 'cups_map_color_rgb()' - Map a color index to an RGB color.
- */
-
-private int
-cups_map_color_rgb(gx_device      *pdev,/* I - Device info */
-                   gx_color_index color,/* I - Color index */
-                  gx_color_value prgb[3])
-                                       /* O - RGB values */
-{
-  unsigned char                c0, c1, c2, c3; /* Color index components */
-  gx_color_value       k, divk;        /* Black & divisor */
-
-
-#  ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cups_map_color_rgb(%p, %d, %p)\n", pdev,
-          (unsigned)color, prgb);
-#  endif /* DEBUG */
-
- /*
-  * Setup the color info data as needed...
-  */
-
-  if (pdev->color_info.num_components == 0)
-    cups_set_color_info(pdev);
-
-#  ifdef DEBUG
-  fprintf(stderr, "DEBUG2: COLOR %08x = ", (unsigned)color);
-#  endif /* DEBUG */
-
- /*
-  * Extract the color components from the color index...
-  */
-
-  switch (cups->header.cupsBitsPerColor)
-  {
-    default :
-        c3 = color & 1;
-        color >>= 1;
-        c2 = color & 1;
-        color >>= 1;
-        c1 = color & 1;
-        color >>= 1;
-        c0 = color;
-        break;
-    case 2 :
-        c3 = color & 3;
-        color >>= 2;
-        c2 = color & 3;
-        color >>= 2;
-        c1 = color & 3;
-        color >>= 2;
-        c0 = color;
-        break;
-    case 4 :
-        c3 = color & 15;
-        color >>= 4;
-        c2 = color & 15;
-        color >>= 4;
-        c1 = color & 15;
-        color >>= 4;
-        c0 = color;
-        break;
-    case 8 :
-        c3 = color & 255;
-        color >>= 8;
-        c2 = color & 255;
-        color >>= 8;
-        c1 = color & 255;
-        color >>= 8;
-        c0 = color;
-        break;
-  }
-
- /*
-  * Convert the color components to RGB...
-  */
-
-  switch (cups->header.cupsColorSpace)
-  {
-    case CUPS_CSPACE_K :
-    case CUPS_CSPACE_WHITE :
-    case CUPS_CSPACE_GOLD :
-    case CUPS_CSPACE_SILVER :
-        prgb[0] =
-        prgb[1] =
-        prgb[2] = cupsDecodeLUT[c3];
-        break;
-
-    case CUPS_CSPACE_W :
-        prgb[0] =
-        prgb[1] =
-        prgb[2] = cupsDecodeLUT[c3];
-        break;
-
-    case CUPS_CSPACE_RGB :
-        prgb[0] = cupsDecodeLUT[c1];
-        prgb[1] = cupsDecodeLUT[c2];
-        prgb[2] = cupsDecodeLUT[c3];
-        break;
-
-    case CUPS_CSPACE_RGBA :
-        prgb[0] = cupsDecodeLUT[c0];
-        prgb[1] = cupsDecodeLUT[c1];
-        prgb[2] = cupsDecodeLUT[c2];
-        break;
-
-    case CUPS_CSPACE_CMY :
-        prgb[0] = cupsDecodeLUT[c1];
-        prgb[1] = cupsDecodeLUT[c2];
-        prgb[2] = cupsDecodeLUT[c3];
-        break;
-
-    case CUPS_CSPACE_YMC :
-        prgb[0] = cupsDecodeLUT[c3];
-        prgb[1] = cupsDecodeLUT[c2];
-        prgb[2] = cupsDecodeLUT[c1];
-        break;
-
-    case CUPS_CSPACE_KCMY :
-    case CUPS_CSPACE_KCMYcm :
-        k    = cupsDecodeLUT[c0];
-        divk = gx_max_color_value - k;
-        if (divk == 0)
-        {
-          prgb[0] = 0;
-          prgb[1] = 0;
-          prgb[2] = 0;
-        }
-        else
-        {
-          prgb[0] = gx_max_color_value + divk -
-                    gx_max_color_value * c1 / divk;
-          prgb[1] = gx_max_color_value + divk -
-                    gx_max_color_value * c2 / divk;
-          prgb[2] = gx_max_color_value + divk -
-                    gx_max_color_value * c3 / divk;
-        }
-        break;
-
-    case CUPS_CSPACE_CMYK :
-        k    = cupsDecodeLUT[c3];
-        divk = gx_max_color_value - k;
-        if (divk == 0)
-        {
-          prgb[0] = 0;
-          prgb[1] = 0;
-          prgb[2] = 0;
-        }
-        else
-        {
-          prgb[0] = gx_max_color_value + divk -
-                    gx_max_color_value * c0 / divk;
-          prgb[1] = gx_max_color_value + divk -
-                    gx_max_color_value * c1 / divk;
-          prgb[2] = gx_max_color_value + divk -
-                    gx_max_color_value * c2 / divk;
-        }
-        break;
-
-    case CUPS_CSPACE_YMCK :
-    case CUPS_CSPACE_GMCK :
-    case CUPS_CSPACE_GMCS :
-        k    = cupsDecodeLUT[c3];
-        divk = gx_max_color_value - k;
-        if (divk == 0)
-        {
-          prgb[0] = 0;
-          prgb[1] = 0;
-          prgb[2] = 0;
-        }
-        else
-        {
-          prgb[0] = gx_max_color_value + divk -
-                    gx_max_color_value * c2 / divk;
-          prgb[1] = gx_max_color_value + divk -
-                    gx_max_color_value * c1 / divk;
-          prgb[2] = gx_max_color_value + divk -
-                    gx_max_color_value * c0 / divk;
-        }
-        break;
-
-#  ifdef CUPS_RASTER_HAVE_COLORIMETRIC
-    case CUPS_CSPACE_CIEXYZ :
-    case CUPS_CSPACE_CIELab :
-    case CUPS_CSPACE_ICC1 :
-    case CUPS_CSPACE_ICC2 :
-    case CUPS_CSPACE_ICC3 :
-    case CUPS_CSPACE_ICC4 :
-    case CUPS_CSPACE_ICC5 :
-    case CUPS_CSPACE_ICC6 :
-    case CUPS_CSPACE_ICC7 :
-    case CUPS_CSPACE_ICC8 :
-    case CUPS_CSPACE_ICC9 :
-    case CUPS_CSPACE_ICCA :
-    case CUPS_CSPACE_ICCB :
-    case CUPS_CSPACE_ICCC :
-    case CUPS_CSPACE_ICCD :
-    case CUPS_CSPACE_ICCE :
-    case CUPS_CSPACE_ICCF :
-        break;
-#  endif /* CUPS_RASTER_HAVE_COLORIMETRIC */
-  }
-
-#  ifdef DEBUG
-  fprintf(stderr, "%d,%d,%d\n", prgb[0], prgb[1], prgb[2]);
-#  endif /* DEBUG */
-
-  return (0);
-}
-
-
-/*
- * 'cups_map_rgb_color()' - Map an RGB color to a color index.  We map the
- *                          RGB color to the output colorspace & bits (we
- *                          figure out the format when we output a page).
- */
-
-private gx_color_index                 /* O - Color index */
-cups_map_rgb_color(gx_device      *pdev,/* I - Device info */
-                   gx_color_value r,   /* I - Red value */
-                   gx_color_value g,   /* I - Green value */
-                   gx_color_value b)   /* I - Blue value */
-{
-  gx_color_index       i;              /* Temporary index */
-  gx_color_value       ic, im, iy, ik; /* Integral CMYK values */
-  gx_color_value       mk;             /* Maximum K value */
-  int                  tc, tm, ty;     /* Temporary color values */
-  float                        rr, rg, rb,     /* Real RGB colors */
-                       ciex, ciey, ciez,
-                                       /* CIE XYZ colors */
-                       ciey_yn,        /* Normalized luminance */
-                       ciel, ciea, cieb;
-                                       /* CIE Lab colors */
-
-
-#  ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cups_map_rgb_color(%p, %d, %d, %d)\n", pdev, r, g, b);
-#  endif /* DEBUG */
-
- /*
-  * Setup the color info data as needed...
-  */
-
-  if (pdev->color_info.num_components == 0)
-    cups_set_color_info(pdev);
-
- /*
-  * Do color correction as needed...
-  */
-
-  if (cupsHaveProfile)
-  {
-   /*
-    * Compute CMYK values...
-    */
-
-    ic = gx_max_color_value - r;
-    im = gx_max_color_value - g;
-    iy = gx_max_color_value - b;
-    ik = min(ic, min(im, iy));
-
-    if ((mk = max(ic, max(im, iy))) > ik)
-      ik = (int)((float)ik * (float)ik * (float)ik / ((float)mk * (float)mk));
-
-    ic -= ik;
-    im -= ik;
-    iy -= ik;
-
-   /*
-    * Color correct CMY...
-    */
-
-    tc = cupsMatrix[0][0][ic] +
-         cupsMatrix[0][1][im] +
-        cupsMatrix[0][2][iy] +
-        ik;
-    tm = cupsMatrix[1][0][ic] +
-         cupsMatrix[1][1][im] +
-        cupsMatrix[1][2][iy] +
-        ik;
-    ty = cupsMatrix[2][0][ic] +
-         cupsMatrix[2][1][im] +
-        cupsMatrix[2][2][iy] +
-        ik;
-
-   /*
-    * Density correct combined CMYK...
-    */
-
-    if (tc < 0)
-      r = gx_max_color_value;
-    else if (tc > gx_max_color_value)
-      r = gx_max_color_value - cupsDensity[gx_max_color_value];
-    else
-      r = gx_max_color_value - cupsDensity[tc];
-
-    if (tm < 0)
-      g = gx_max_color_value;
-    else if (tm > gx_max_color_value)
-      g = gx_max_color_value - cupsDensity[gx_max_color_value];
-    else
-      g = gx_max_color_value - cupsDensity[tm];
-
-    if (ty < 0)
-      b = gx_max_color_value;
-    else if (ty > gx_max_color_value)
-      b = gx_max_color_value - cupsDensity[gx_max_color_value];
-    else
-      b = gx_max_color_value - cupsDensity[ty];
-  }
-
- /*
-  * Convert the RGB color to a color index...
-  */
-
-  switch (cups->header.cupsColorSpace)
-  {
-    case CUPS_CSPACE_W :
-        i = cupsEncodeLUT[(r * 31 + g * 61 + b * 8) / 100];
-        break;
-
-    case CUPS_CSPACE_RGB :
-        ic = cupsEncodeLUT[r];
-        im = cupsEncodeLUT[g];
-        iy = cupsEncodeLUT[b];
-
-        switch (cups->header.cupsBitsPerColor)
-        {
-          default :
-              i = (((ic << 1) | im) << 1) | iy;
-              break;
-          case 2 :
-              i = (((ic << 2) | im) << 2) | iy;
-              break;
-          case 4 :
-              i = (((ic << 4) | im) << 4) | iy;
-              break;
-          case 8 :
-              i = (((ic << 8) | im) << 8) | iy;
-              break;
-        }
-        break;
-
-    case CUPS_CSPACE_RGBA :
-        ic = cupsEncodeLUT[r];
-        im = cupsEncodeLUT[g];
-        iy = cupsEncodeLUT[b];
-
-        switch (cups->header.cupsBitsPerColor)
-        {
-          default :
-              i = (((((ic << 1) | im) << 1) | iy) << 1) | 0x01;
-              break;
-          case 2 :
-              i = (((((ic << 2) | im) << 2) | iy) << 2) | 0x03;
-              break;
-          case 4 :
-              i = (((((ic << 4) | im) << 4) | iy) << 4) | 0x0f;
-              break;
-          case 8 :
-              i = (((((ic << 8) | im) << 8) | iy) << 8) | 0xff;
-              break;
-        }
-        break;
-
-    default :
-        i = cupsEncodeLUT[gx_max_color_value - (r * 31 + g * 61 + b * 8) / 100];
-        break;
-
-    case CUPS_CSPACE_CMY :
-        ic = cupsEncodeLUT[gx_max_color_value - r];
-        im = cupsEncodeLUT[gx_max_color_value - g];
-        iy = cupsEncodeLUT[gx_max_color_value - b];
-
-        switch (cups->header.cupsBitsPerColor)
-        {
-          default :
-              i = (((ic << 1) | im) << 1) | iy;
-              break;
-          case 2 :
-              i = (((ic << 2) | im) << 2) | iy;
-              break;
-          case 4 :
-              i = (((ic << 4) | im) << 4) | iy;
-              break;
-          case 8 :
-              i = (((ic << 8) | im) << 8) | iy;
-              break;
-        }
-        break;
-
-    case CUPS_CSPACE_YMC :
-        ic = cupsEncodeLUT[gx_max_color_value - r];
-        im = cupsEncodeLUT[gx_max_color_value - g];
-        iy = cupsEncodeLUT[gx_max_color_value - b];
-
-        switch (cups->header.cupsBitsPerColor)
-        {
-          default :
-              i = (((iy << 1) | im) << 1) | ic;
-              break;
-          case 2 :
-              i = (((iy << 2) | im) << 2) | ic;
-              break;
-          case 4 :
-              i = (((iy << 4) | im) << 4) | ic;
-              break;
-          case 8 :
-              i = (((iy << 8) | im) << 8) | ic;
-              break;
-        }
-        break;
-
-    case CUPS_CSPACE_CMYK :
-       ic = gx_max_color_value - r;
-       im = gx_max_color_value - g;
-       iy = gx_max_color_value - b;
-        ik = min(ic, min(im, iy));
-
-       if ((mk = max(ic, max(im, iy))) > ik)
-         ik = (int)((float)ik * (float)ik * (float)ik /
-                    ((float)mk * (float)mk));
-
-        ic = cupsEncodeLUT[ic - ik];
-        im = cupsEncodeLUT[im - ik];
-        iy = cupsEncodeLUT[iy - ik];
-        ik = cupsEncodeLUT[ik];
-
-        switch (cups->header.cupsBitsPerColor)
-        {
-          default :
-              i = (((((ic << 1) | im) << 1) | iy) << 1) | ik;
-              break;
-          case 2 :
-              i = (((((ic << 2) | im) << 2) | iy) << 2) | ik;
-              break;
-          case 4 :
-              i = (((((ic << 4) | im) << 4) | iy) << 4) | ik;
-              break;
-          case 8 :
-              i = (((((ic << 8) | im) << 8) | iy) << 8) | ik;
-              break;
-        }
-
-#  ifdef DEBUG
-       fprintf(stderr, "DEBUG2: CMY (%d,%d,%d) -> CMYK %08x (%d,%d,%d,%d)\n",
-               r, g, b, (unsigned)i, ic, im, iy, ik);
-#  endif /* DEBUG */
-        break;
-
-    case CUPS_CSPACE_YMCK :
-    case CUPS_CSPACE_GMCK :
-    case CUPS_CSPACE_GMCS :
-       ic = gx_max_color_value - r;
-       im = gx_max_color_value - g;
-       iy = gx_max_color_value - b;
-        ik = min(ic, min(im, iy));
-
-       if ((mk = max(ic, max(im, iy))) > ik)
-         ik = (int)((float)ik * (float)ik * (float)ik /
-                    ((float)mk * (float)mk));
-
-        ic = cupsEncodeLUT[ic - ik];
-        im = cupsEncodeLUT[im - ik];
-        iy = cupsEncodeLUT[iy - ik];
-        ik = cupsEncodeLUT[ik];
-
-        switch (cups->header.cupsBitsPerColor)
-        {
-          default :
-              i = (((((iy << 1) | im) << 1) | ic) << 1) | ik;
-              break;
-          case 2 :
-              i = (((((iy << 2) | im) << 2) | ic) << 2) | ik;
-              break;
-          case 4 :
-              i = (((((iy << 4) | im) << 4) | ic) << 4) | ik;
-              break;
-          case 8 :
-              i = (((((iy << 8) | im) << 8) | ic) << 8) | ik;
-              break;
-        }
-        break;
-
-    case CUPS_CSPACE_KCMYcm :
-        if (cups->header.cupsBitsPerColor == 1)
-       {
-         ic = gx_max_color_value - r;
-         im = gx_max_color_value - g;
-         iy = gx_max_color_value - b;
-          ik = min(ic, min(im, iy));
-
-         if ((mk = max(ic, max(im, iy))) > ik)
-           ik = (int)((float)ik * (float)ik * (float)ik /
-                      ((float)mk * (float)mk));
-
-          ic = cupsEncodeLUT[ic - ik];
-          im = cupsEncodeLUT[im - ik];
-          iy = cupsEncodeLUT[iy - ik];
-          ik = cupsEncodeLUT[ik];
-         if (ik)
-           i = 32;
-         else if (ic && im)
-           i = 17;
-         else if (ic && iy)
-           i = 6;
-         else if (im && iy)
-           i = 12;
-         else if (ic)
-           i = 16;
-         else if (im)
-           i = 8;
-         else if (iy)
-           i = 4;
-         else
-           i = 0;
-         break;
-       }
-
-    case CUPS_CSPACE_KCMY :
-       ic = gx_max_color_value - r;
-       im = gx_max_color_value - g;
-       iy = gx_max_color_value - b;
-        ik = min(ic, min(im, iy));
-
-       if ((mk = max(ic, max(im, iy))) > ik)
-         ik = (int)((float)ik * (float)ik * (float)ik /
-                    ((float)mk * (float)mk));
-
-        ic = cupsEncodeLUT[ic - ik];
-        im = cupsEncodeLUT[im - ik];
-        iy = cupsEncodeLUT[iy - ik];
-        ik = cupsEncodeLUT[ik];
-
-        switch (cups->header.cupsBitsPerColor)
-        {
-          default :
-              i = (((((ik << 1) | ic) << 1) | im) << 1) | iy;
-              break;
-          case 2 :
-              i = (((((ik << 2) | ic) << 2) | im) << 2) | iy;
-              break;
-          case 4 :
-              i = (((((ik << 4) | ic) << 4) | im) << 4) | iy;
-              break;
-          case 8 :
-              i = (((((ik << 8) | ic) << 8) | im) << 8) | iy;
-              break;
-        }
-        break;
-
-#  ifdef CUPS_RASTER_HAVE_COLORIMETRIC
-    case CUPS_CSPACE_CIEXYZ :
-    case CUPS_CSPACE_CIELab :
-    case CUPS_CSPACE_ICC1 :
-    case CUPS_CSPACE_ICC2 :
-    case CUPS_CSPACE_ICC3 :
-    case CUPS_CSPACE_ICC4 :
-    case CUPS_CSPACE_ICC5 :
-    case CUPS_CSPACE_ICC6 :
-    case CUPS_CSPACE_ICC7 :
-    case CUPS_CSPACE_ICC8 :
-    case CUPS_CSPACE_ICC9 :
-    case CUPS_CSPACE_ICCA :
-    case CUPS_CSPACE_ICCB :
-    case CUPS_CSPACE_ICCC :
-    case CUPS_CSPACE_ICCD :
-    case CUPS_CSPACE_ICCE :
-    case CUPS_CSPACE_ICCF :
-       /*
-        * Convert sRGB to linear RGB...
-       */
-
-       rr = pow((double)r / (double)gx_max_color_value, 0.58823529412);
-       rg = pow((double)g / (double)gx_max_color_value, 0.58823529412);
-       rb = pow((double)b / (double)gx_max_color_value, 0.58823529412);
-
-       /*
-        * Convert to CIE XYZ...
-       */
-
-       ciex = 0.412453 * rr + 0.357580 * rg + 0.180423 * rb;
-       ciey = 0.212671 * rr + 0.715160 * rg + 0.072169 * rb;
-       ciez = 0.019334 * rr + 0.119193 * rg + 0.950227 * rb;
-
-        if (cups->header.cupsColorSpace == CUPS_CSPACE_CIEXYZ)
-       {
-        /*
-         * Convert to an integer XYZ color value...
-         */
-
-          if (ciex > 1.0)
-           ic = 255;
-         else if (ciex > 0.0)
-           ic = (int)(ciex * 255.0);
-         else
-           ic = 0;
-
-          if (ciey > 1.0)
-           im = 255;
-         else if (ciey > 0.0)
-           im = (int)(ciey * 255.0);
-         else
-           im = 0;
-
-          if (ciez > 1.0)
-           iy = 255;
-         else if (ciez > 0.0)
-           iy = (int)(ciez * 255.0);
-         else
-           iy = 0;
-       }
-       else
-       {
-        /*
-         * Convert CIE XYZ to Lab...
-         */
-
-         ciey_yn = ciey / D65_Y;
-
-         if (ciey_yn > 0.008856)
-           ciel = 116 * cbrt(ciey_yn) - 16;
-         else
-           ciel = 903.3 * ciey_yn;
-
-         ciea = 500 * (cups_map_cielab(ciex, D65_X) -
-                       cups_map_cielab(ciey, D65_Y));
-         cieb = 200 * (cups_map_cielab(ciey, D65_Y) -
-                       cups_map_cielab(ciez, D65_Z));
-
-         /*
-         * Scale the L value and bias the a and b values by 128
-         * so that all values are in the range of 0 to 255.
-         */
-
-         ciel *= 2.55;
-         ciea += 128;
-         cieb += 128;
-
-         /*
-         * Convert to 8-bit values...
-         */
-
-          if (ciel < 0.0)
-           ic = 0;
-         else if (ciel < 255.0)
-           ic = ciel;
-         else
-           ic = 255;
-
-          if (ciea < 0.0)
-           im = 0;
-         else if (ciea < 255.0)
-           im = ciea;
-         else
-           im = 255;
-
-          if (cieb < 0.0)
-           iy = 0;
-         else if (cieb < 255.0)
-           iy = cieb;
-         else
-           iy = 255;
-       }
-
-       /*
-        * Put the final color value together...
-       */
-
-        switch (cups->header.cupsBitsPerColor)
-        {
-          default :
-              i = (((ic << 1) | im) << 1) | iy;
-              break;
-          case 2 :
-              i = (((ic << 2) | im) << 2) | iy;
-              break;
-          case 4 :
-              i = (((ic << 4) | im) << 4) | iy;
-              break;
-          case 8 :
-              i = (((ic << 8) | im) << 8) | iy;
-              break;
-        }
-        break;
-#  endif /* CUPS_RASTER_HAVE_COLORIMETRIC */
-  }
-
-#  ifdef DEBUG
-  fprintf(stderr, "DEBUG2: RGB %d,%d,%d = %08x\n", r, g, b, (unsigned)i);
-#  endif /* DEBUG */
-
-  return (i);
-}
-#endif /* dev_t_proc_encode_color */
-
-
-/*
- * 'cups_open()' - Open the output file and initialize things.
- */
-
-private int                            /* O - Error status */
-cups_open(gx_device *pdev)             /* I - Device info */
-{
-  int  code;                           /* Return status */
-
-
-#ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cups_open(%p)\n", pdev);
-#endif /* DEBUG */
-
-  cups->printer_procs.get_space_params = cups_get_space_params;
-
-  if (cups->page == 0)
-  {
-    fputs("INFO: Processing page 1...\n", stderr);
-    cups->page = 1;
-  }
-
-  cups_set_color_info(pdev);
-
-  if ((code = gdev_prn_open(pdev)) != 0)
-    return (code);
-
-  if (cupsPPD == NULL)
-    cupsPPD = ppdOpenFile(getenv("PPD"));
-
-  return (0);
-}
-
-
-/*
- * 'cups_print_pages()' - Send one or more pages to the output file.
- */
-
-private int                            /* O - 0 if everything is OK */
-cups_print_pages(gx_device_printer *pdev,
-                                       /* I - Device info */
-                 FILE              *fp,        /* I - Output file */
-                int               num_copies)
-                                       /* I - Number of copies */
-{
-  int          copy;                   /* Copy number */
-  int          srcbytes;               /* Byte width of scanline */
-  unsigned char        *src,                   /* Scanline data */
-               *dst;                   /* Bitmap data */
-
-
-  (void)fp; /* reference unused file pointer to prevent compiler warning */
-
-#ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cups_print_pages(%p, %p, %d)\n", pdev, fp,
-          num_copies);
-#endif /* DEBUG */
-
- /*
-  * Figure out the number of bytes per line...
-  */
-
-  switch (cups->header.cupsColorOrder)
-  {
-    case CUPS_ORDER_CHUNKED :
-        cups->header.cupsBytesPerLine = (cups->header.cupsBitsPerPixel *
-                                        cups->header.cupsWidth + 7) / 8;
-        break;
-
-    case CUPS_ORDER_BANDED :
-        if (cups->header.cupsColorSpace == CUPS_CSPACE_KCMYcm &&
-           cups->header.cupsBitsPerColor == 1)
-          cups->header.cupsBytesPerLine = (cups->header.cupsBitsPerColor *
-                                           cups->header.cupsWidth + 7) / 8 * 6;
-        else
-          cups->header.cupsBytesPerLine = (cups->header.cupsBitsPerColor *
-                                           cups->header.cupsWidth + 7) / 8 *
-                                         cups->color_info.num_components;
-        break;
-
-    case CUPS_ORDER_PLANAR :
-        cups->header.cupsBytesPerLine = (cups->header.cupsBitsPerColor *
-                                        cups->header.cupsWidth + 7) / 8;
-        break;
-  }
-
- /*
-  * Compute the width of a scanline and allocate input/output buffers...
-  */
-
-  srcbytes = gdev_prn_raster(pdev);
-
-#ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cupsBitsPerPixel = %d, cupsWidth = %d, cupsBytesPerLine = %d, srcbytes = %d\n",
-          cups->header.cupsBitsPerPixel, cups->header.cupsWidth,
-         cups->header.cupsBytesPerLine, srcbytes);
-#endif /* DEBUG */
-
-  src = (unsigned char *)gs_malloc(srcbytes, 1, "cups_print_pages");
-
-  if (src == NULL)     /* can't allocate input buffer */
-    return_error(gs_error_VMerror);
-
- /*
-  * Need an output buffer, too...
-  */
-
-  dst = (unsigned char *)gs_malloc(cups->header.cupsBytesPerLine, 2,
-                                   "cups_print_pages");
-
-  if (dst == NULL)     /* can't allocate working area */
-    return_error(gs_error_VMerror);
-
- /*
-  * See if the stream has been initialized yet...
-  */
-
-  if (cups->stream == NULL)
-  {
-    if ((cups->stream = cupsRasterOpen(fileno(cups->file),
-                                       CUPS_RASTER_WRITE)) == NULL)
-    {
-      perror("ERROR: Unable to open raster stream - ");
-      gs_exit(0);
-    }
-  }
-
- /*
-  * Output a page of graphics...
-  */
-
-  if (num_copies < 1)
-    num_copies = 1;
-
-  if (cupsPPD != NULL && !cupsPPD->manual_copies)
-  {
-    cups->header.NumCopies = num_copies;
-    num_copies = 1;
-  }
-
-#ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cupsWidth = %d, cupsHeight = %d, cupsBytesPerLine = %d\n",
-          cups->header.cupsWidth, cups->header.cupsHeight,
-         cups->header.cupsBytesPerLine);
-#endif /* DEBUG */
-
-  for (copy = num_copies; copy > 0; copy --)
-  {
-    cupsRasterWriteHeader(cups->stream, &(cups->header));
-
-    if (pdev->color_info.num_components == 1)
-      cups_print_chunked(pdev, src, dst, srcbytes);
-    else
-      switch (cups->header.cupsColorOrder)
-      {
-       case CUPS_ORDER_CHUNKED :
-            cups_print_chunked(pdev, src, dst, srcbytes);
-           break;
-       case CUPS_ORDER_BANDED :
-            cups_print_banded(pdev, src, dst, srcbytes);
-           break;
-       case CUPS_ORDER_PLANAR :
-            cups_print_planar(pdev, src, dst, srcbytes);
-           break;
-      }
-  }
-
- /*
-  * Free temporary storage and return...
-  */
-
-  gs_free((char *)src, srcbytes, 1, "cups_print_pages");
-  gs_free((char *)dst, cups->header.cupsBytesPerLine, 1, "cups_print_pages");
-
-  cups->page ++;
-  fprintf(stderr, "INFO: Processing page %d...\n", cups->page);
-
-  return (0);
-}
-
-
-/*
- * 'cups_put_params()' - Set pagedevice parameters.
- */
-
-private int                            /* O - Error status */
-cups_put_params(gx_device     *pdev,   /* I - Device info */
-                gs_param_list *plist)  /* I - Parameter list */
-{
-  int                  i;              /* Looping var */
-#ifdef CUPS_RASTER_SYNCv1
-  char                 name[255];      /* Name of attribute */
-#endif /* CUPS_RASTER_SYNCv1 */
-  float                        margins[4];     /* Physical margins of print */
-  ppd_size_t           *size;          /* Page size */
-  int                  code;           /* Error code */
-  int                  intval;         /* Integer value */
-  bool                 boolval;        /* Boolean value */
-  float                        floatval;       /* Floating point value */
-  gs_param_string      stringval;      /* String value */
-  gs_param_float_array arrayval;       /* Float array value */
-  int                  size_set;       /* Was the size set? */
-  int                  color_set;      /* Were the color attrs set? */
-  gdev_prn_space_params        sp;             /* Space parameter data */
-  int                  width,          /* New width of page */
-                       height;         /* New height of page */
-
-
-#ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cups_put_params(%p, %p)\n", pdev, plist);
-#endif /* DEBUG */
-
- /*
-  * Process other options for CUPS...
-  */
-
-#define stringoption(name, sname) \
-  if ((code = param_read_string(plist, sname, &stringval)) < 0) \
-  { \
-    param_signal_error(plist, sname, code); \
-    return (code); \
-  } \
-  else if (code == 0) \
-  { \
-    strncpy(cups->header.name, (const char *)stringval.data, \
-            stringval.size); \
-    cups->header.name[stringval.size] = '\0'; \
-  }
-
-#define intoption(name, sname, type) \
-  if ((code = param_read_int(plist, sname, &intval)) < 0) \
-  { \
-    param_signal_error(plist, sname, code); \
-    return (code); \
-  } \
-  else if (code == 0) \
-  { \
-    fprintf(stderr, "DEBUG: Setting %s to %d...\n", sname, intval); \
-    cups->header.name = (type)intval; \
-  }
-
-#define floatoption(name, sname) \
-  if ((code = param_read_float(plist, sname, &floatval)) < 0) \
-  { \
-    param_signal_error(plist, sname, code); \
-    return (code); \
-  } \
-  else if (code == 0) \
-    cups->header.name = (unsigned)floatval;
-
-#define booloption(name, sname) \
-  if ((code = param_read_bool(plist, sname, &boolval)) < 0) \
-  { \
-    if ((code = param_read_null(plist, sname)) < 0) \
-    { \
-      param_signal_error(plist, sname, code); \
-      return (code); \
-    } \
-    if (code == 0) \
-      cups->header.name = CUPS_FALSE; \
-  } \
-  else if (code == 0) \
-    cups->header.name = (cups_bool_t)boolval;
-
-#define arrayoption(name, sname, count) \
-  if ((code = param_read_float_array(plist, sname, &arrayval)) < 0) \
-  { \
-    if ((code = param_read_null(plist, sname)) < 0) \
-    { \
-      param_signal_error(plist, sname, code); \
-      return (code); \
-    } \
-    if (code == 0) \
-      for (i = 0; i < count; i ++) \
-       cups->header.name[i] = 0; \
-  } \
-  else if (code == 0) \
-  { \
-    for (i = 0; i < count; i ++) \
-      cups->header.name[i] = (unsigned)arrayval.data[i]; \
-  }
-
-  size_set  = param_read_float_array(plist, ".MediaSize", &arrayval) == 0 ||
-              param_read_float_array(plist, "PageSize", &arrayval) == 0;
-  color_set = param_read_int(plist, "cupsColorSpace", &intval) == 0 ||
-              param_read_int(plist, "cupsBitsPerColor", &intval) == 0;
-
-  stringoption(MediaClass, "MediaClass")
-  stringoption(MediaColor, "MediaColor")
-  stringoption(MediaType, "MediaType")
-  stringoption(OutputType, "OutputType")
-  floatoption(AdvanceDistance, "AdvanceDistance")
-  intoption(AdvanceMedia, "AdvanceMedia", cups_adv_t)
-  booloption(Collate, "Collate")
-  intoption(CutMedia, "CutMedia", cups_cut_t)
-  booloption(Duplex, "Duplex")
-  arrayoption(ImagingBoundingBox, "ImagingBoundingBox", 4)
-  booloption(InsertSheet, "InsertSheet")
-  intoption(Jog, "Jog", cups_jog_t)
-  intoption(LeadingEdge, "LeadingEdge", cups_edge_t)
-  arrayoption(Margins, "Margins", 2)
-  booloption(ManualFeed, "ManualFeed")
-  intoption(MediaPosition, "cupsMediaPosition", unsigned) /* Compatibility */
-  intoption(MediaPosition, "MediaPosition", unsigned)
-  floatoption(MediaWeight, "MediaWeight")
-  booloption(MirrorPrint, "MirrorPrint")
-  booloption(NegativePrint, "NegativePrint")
-  intoption(Orientation, "Orientation", cups_orient_t)
-  booloption(OutputFaceUp, "OutputFaceUp")
-  booloption(Separations, "Separations")
-  booloption(TraySwitch, "TraySwitch")
-  booloption(Tumble, "Tumble")
-  intoption(cupsMediaType, "cupsMediaType", unsigned)
-  intoption(cupsBitsPerColor, "cupsBitsPerColor", unsigned)
-  intoption(cupsColorOrder, "cupsColorOrder", cups_order_t)
-  intoption(cupsColorSpace, "cupsColorSpace", cups_cspace_t)
-  intoption(cupsCompression, "cupsCompression", unsigned)
-  intoption(cupsRowCount, "cupsRowCount", unsigned)
-  intoption(cupsRowFeed, "cupsRowFeed", unsigned)
-  intoption(cupsRowStep, "cupsRowStep", unsigned)
-
-#ifdef CUPS_RASTER_SYNCv1
-  for (i = 0; i < 16; i ++)
-  {
-    sprintf(name, "cupsInteger%d", i);
-    intoption(cupsInteger[i], name, unsigned)
-  }
-
-  for (i = 0; i < 16; i ++)
-  {
-    sprintf(name, "cupsReal%d", i);
-    floatoption(cupsReal[i], name)
-  }
-
-  for (i = 0; i < 16; i ++)
-  {
-    sprintf(name, "cupsString%d", i);
-    stringoption(cupsString[i], name)
-  }
-
-  stringoption(cupsMarkerType, "cupsMarkerType");
-  stringoption(cupsRenderingIntent, "cupsRenderingIntent");
-#endif /* CUPS_RASTER_SYNCv1 */
-
-  if ((code = param_read_string(plist, "cupsProfile", &stringval)) < 0)
-  {
-    param_signal_error(plist, "cupsProfile", code);
-    return (code);
-  }
-  else if (code == 0)
-  {
-    if (cupsProfile != NULL)
-      free(cupsProfile);
-
-    cupsProfile = strdup(stringval.data);
-  }
-
-  cups_set_color_info(pdev);
-
- /*
-  * Then process standard page device options...
-  */
-
-  if ((code = gdev_prn_put_params(pdev, plist)) < 0)
-    return (code);
-
- /*
-  * Update margins/sizes as needed...
-  */
-
-  if (size_set)
-  {
-   /*
-    * Compute the page margins...
-    */
-
-    fprintf(stderr, "DEBUG: Updating PageSize to [%.0f %.0f]...\n",
-            cups->MediaSize[0], cups->MediaSize[1]);
-
-    memset(margins, 0, sizeof(margins));
-
-    cups->landscape = 0;
-
-    if (cupsPPD != NULL)
-    {
-     /*
-      * Find the matching page size...
-      */
-
-      for (i = cupsPPD->num_sizes, size = cupsPPD->sizes;
-           i > 0;
-           i --, size ++)
-       if (fabs(cups->MediaSize[1] - size->length) < 5.0 &&
-            fabs(cups->MediaSize[0] - size->width) < 5.0)
-         break;
-
-      if (i > 0)
-      {
-       /*
-       * Standard size...
-       */
-
-       fprintf(stderr, "DEBUG: size = %s\n", size->name);
-
-       gx_device_set_media_size(pdev, size->width, size->length);
-
-       margins[0] = size->left / 72.0;
-       margins[1] = size->bottom / 72.0;
-       margins[2] = (size->width - size->right) / 72.0;
-       margins[3] = (size->length - size->top) / 72.0;
-      }
-      else
-      {
-       /*
-       * No matching portrait size; look for a matching size in
-       * landscape orientation...
-       */
-
-       for (i = cupsPPD->num_sizes, size = cupsPPD->sizes;
-             i > 0;
-             i --, size ++)
-         if (fabs(cups->MediaSize[0] - size->length) < 5.0 &&
-              fabs(cups->MediaSize[1] - size->width) < 5.0)
-           break;
-
-       if (i > 0)
-       {
-        /*
-         * Standard size in landscape orientation...
-         */
-
-         fprintf(stderr, "DEBUG: landscape size = %s\n", size->name);
-
-         gx_device_set_media_size(pdev, size->length, size->width);
-
-          cups->landscape = 1;
-
-         margins[0] = size->left / 72.0;
-         margins[1] = size->bottom / 72.0;
-         margins[2] = (size->width - size->right) / 72.0;
-         margins[3] = (size->length - size->top) / 72.0;
-       }
-       else
-       {
-        /*
-         * Custom size...
-         */
-
-         fputs("DEBUG: size = Custom\n", stderr);
-
-         for (i = 0; i < 4; i ++)
-            margins[i] = cupsPPD->custom_margins[i] / 72.0;
-       }
-      }
-
-      fprintf(stderr, "DEBUG: margins[] = [ %f %f %f %f ]\n",
-             margins[0], margins[1], margins[2], margins[3]);
-    }
-
-   /*
-    * Set the margins to update the bitmap size...
-    */
-
-    gx_device_set_margins(pdev, margins, false);
-  }
-
- /*
-  * Set CUPS raster header values...
-  */
-
-  cups->header.HWResolution[0] = pdev->HWResolution[0];
-  cups->header.HWResolution[1] = pdev->HWResolution[1];
-
-  cups->header.Margins[0] = pdev->HWMargins[0];
-  cups->header.Margins[1] = pdev->HWMargins[1];
-
-  cups->header.PageSize[0] = pdev->MediaSize[0];
-  cups->header.PageSize[1] = pdev->MediaSize[1];
-
-  cups->header.ImagingBoundingBox[0] = pdev->HWMargins[0];
-  cups->header.ImagingBoundingBox[1] = pdev->HWMargins[3];
-  cups->header.ImagingBoundingBox[2] = pdev->MediaSize[0] - pdev->HWMargins[2];
-  cups->header.ImagingBoundingBox[3] = pdev->MediaSize[1] - pdev->HWMargins[1];
-
- /*
-  * Reallocate memory if the size or color depth was changed...
-  */
-
-  if (color_set || size_set)
-  {
-   /*
-    * Make sure the page image is the correct size - current Ghostscript
-    * does not keep track of the margins in the bitmap size...
-    */
-
-    if (cups->landscape)
-    {
-      width  = (pdev->MediaSize[1] - pdev->HWMargins[0] - pdev->HWMargins[2]) *
-               pdev->HWResolution[0] / 72.0f + 0.499f;
-      height = (pdev->MediaSize[0] - pdev->HWMargins[1] - pdev->HWMargins[3]) *
-               pdev->HWResolution[1] / 72.0f + 0.499f;
-    }
-    else
-    {
-      width  = (pdev->MediaSize[0] - pdev->HWMargins[0] - pdev->HWMargins[2]) *
-               pdev->HWResolution[0] / 72.0f + 0.499f;
-      height = (pdev->MediaSize[1] - pdev->HWMargins[1] - pdev->HWMargins[3]) *
-               pdev->HWResolution[1] / 72.0f + 0.499f;
-    }
-
-   /*
-    * Don't reallocate memory unless the device has been opened...
-    */
-
-    if (pdev->is_open)
-    {
-     /*
-      * Device is open, so reallocate...
-      */
-
-      fprintf(stderr, "DEBUG: Reallocating memory, [%.0f %.0f] = %dx%d pixels...\n",
-              pdev->MediaSize[0], pdev->MediaSize[1], width, height);
-
-      sp = ((gx_device_printer *)pdev)->space_params;
-
-      if ((code = gdev_prn_reallocate_memory(pdev, &sp, width, height)) < 0)
-       return (code);
-    }
-    else
-    {
-     /*
-      * Device isn't yet open, so just save the new width and height...
-      */
-
-      fprintf(stderr, "DEBUG: Setting initial media size, [%.0f %.0f] = %dx%d pixels...\n",
-              pdev->MediaSize[0], pdev->MediaSize[1], width, height);
-
-      pdev->width  = width;
-      pdev->height = height;
-    }
-  }
-
-#ifdef DEBUG
-  fprintf(stderr, "DEBUG2: ppd = %p\n", cupsPPD);
-  fprintf(stderr, "DEBUG2: PageSize = [ %.3f %.3f ]\n",
-          pdev->MediaSize[0], pdev->MediaSize[1]);
-  fprintf(stderr, "DEBUG2: margins = [ %.3f %.3f %.3f %.3f ]\n",
-          margins[0], margins[1], margins[2], margins[3]);
-  fprintf(stderr, "DEBUG2: HWResolution = [ %.3f %.3f ]\n",
-          pdev->HWResolution[0], pdev->HWResolution[1]);
-  fprintf(stderr, "DEBUG2: width = %d, height = %d\n",
-          pdev->width, pdev->height);
-  fprintf(stderr, "DEBUG2: HWMargins = [ %.3f %.3f %.3f %.3f ]\n",
-          pdev->HWMargins[0], pdev->HWMargins[1],
-         pdev->HWMargins[2], pdev->HWMargins[3]);
-#endif /* DEBUG */
-
-  return (0);
-}
-
-
-/*
- * 'cups_set_color_info()' - Set the color information structure based on
- *                           the required output.
- */
-
-private void
-cups_set_color_info(gx_device *pdev)   /* I - Device info */
-{
-  int          i, j, k;                /* Looping vars */
-  int          max_lut;                /* Maximum LUT value */
-  float                d, g;                   /* Density and gamma correction */
-  float                m[3][3];                /* Color correction matrix */
-  char         resolution[41];         /* Resolution string */
-  ppd_profile_t        *profile;               /* Color profile information */
-
-
-#ifdef DEBUG
-  fprintf(stderr, "DEBUG2: cups_set_color_info(%p)\n", pdev);
-#endif /* DEBUG */
-
-  switch (cups->header.cupsColorSpace)
-  {
-    default :
-    case CUPS_CSPACE_W :
-    case CUPS_CSPACE_K :
-    case CUPS_CSPACE_WHITE :
-    case CUPS_CSPACE_GOLD :
-    case CUPS_CSPACE_SILVER :
-        cups->header.cupsBitsPerPixel   = cups->header.cupsBitsPerColor;
-        cups->color_info.depth          = cups->header.cupsBitsPerPixel;
-        cups->color_info.num_components = 1;
-        break;
-
-    case CUPS_CSPACE_CMY :
-    case CUPS_CSPACE_YMC :
-    case CUPS_CSPACE_RGB :
-        if (cups->header.cupsColorOrder != CUPS_ORDER_CHUNKED)
-          cups->header.cupsBitsPerPixel = cups->header.cupsBitsPerColor;
-       else if (cups->header.cupsBitsPerColor < 8)
-         cups->header.cupsBitsPerPixel = 4 * cups->header.cupsBitsPerColor;
-       else
-         cups->header.cupsBitsPerPixel = 3 * cups->header.cupsBitsPerColor;
-
-       if (cups->header.cupsBitsPerColor < 8)
-         cups->color_info.depth = 4 * cups->header.cupsBitsPerColor;
-       else
-         cups->color_info.depth = 3 * cups->header.cupsBitsPerColor;
-
-        cups->color_info.num_components = 3;
-        break;
-
-    case CUPS_CSPACE_KCMYcm :
-        if (cups->header.cupsBitsPerColor == 1)
-       {
-         cups->header.cupsBitsPerPixel   = 8;
-         cups->color_info.depth          = 8;
-         cups->color_info.num_components = 4;
-         break;
-       }
-
-    case CUPS_CSPACE_CMYK :
-    case CUPS_CSPACE_YMCK :
-    case CUPS_CSPACE_KCMY :
-    case CUPS_CSPACE_GMCK :
-    case CUPS_CSPACE_GMCS :
-        if (cups->header.cupsColorOrder != CUPS_ORDER_CHUNKED)
-          cups->header.cupsBitsPerPixel = cups->header.cupsBitsPerColor;
-       else
-         cups->header.cupsBitsPerPixel = 4 * cups->header.cupsBitsPerColor;
-
-        cups->color_info.depth          = 4 * cups->header.cupsBitsPerColor;
-        cups->color_info.num_components = 4;
-        break;
-
-#ifdef CUPS_RASTER_HAVE_COLORIMETRIC
-    case CUPS_CSPACE_CIEXYZ :
-    case CUPS_CSPACE_CIELab :
-    case CUPS_CSPACE_ICC1 :
-    case CUPS_CSPACE_ICC2 :
-    case CUPS_CSPACE_ICC3 :
-    case CUPS_CSPACE_ICC4 :
-    case CUPS_CSPACE_ICC5 :
-    case CUPS_CSPACE_ICC6 :
-    case CUPS_CSPACE_ICC7 :
-    case CUPS_CSPACE_ICC8 :
-    case CUPS_CSPACE_ICC9 :
-    case CUPS_CSPACE_ICCA :
-    case CUPS_CSPACE_ICCB :
-    case CUPS_CSPACE_ICCC :
-    case CUPS_CSPACE_ICCD :
-    case CUPS_CSPACE_ICCE :
-    case CUPS_CSPACE_ICCF :
-       /*
-       * Colorimetric color spaces currently are implemented as 24-bit
-       * mapping to XYZ or Lab, which are then converted as needed to
-       * the final representation...
-       *
-       * This code enforces a minimum output depth of 8 bits per
-       * component...
-       */
-
-       if (cups->header.cupsBitsPerColor < 8)
-          cups->header.cupsBitsPerColor = 8;
-
-       if (cups->header.cupsColorOrder != CUPS_ORDER_CHUNKED)
-          cups->header.cupsBitsPerPixel = cups->header.cupsBitsPerColor;
-       else
-          cups->header.cupsBitsPerPixel = 3 * cups->header.cupsBitsPerColor;
-
-       cups->color_info.depth          = 24;
-       cups->color_info.num_components = 3;
-       break;
-#endif /* CUPS_RASTER_HAVE_COLORIMETRIC */
-  }
-
-#ifdef dev_t_proc_encode_color
-  switch (cups->header.cupsColorSpace)
-  {
-    default :
-        cups->color_info.gray_index = GX_CINFO_COMP_NO_INDEX;
-       break;
-
-    case CUPS_CSPACE_W :
-    case CUPS_CSPACE_WHITE :
-    case CUPS_CSPACE_K :
-    case CUPS_CSPACE_GOLD :
-    case CUPS_CSPACE_SILVER :
-    case CUPS_CSPACE_KCMYcm :
-    case CUPS_CSPACE_KCMY :
-        cups->color_info.gray_index = 0;
-       break;
-
-    case CUPS_CSPACE_CMYK :
-    case CUPS_CSPACE_YMCK :
-    case CUPS_CSPACE_GMCK :
-    case CUPS_CSPACE_GMCS :
-        cups->color_info.gray_index = 3;
-       break;
-  }
-
-  switch (cups->header.cupsColorSpace)
-  {
-    default :
-    case CUPS_CSPACE_W :
-    case CUPS_CSPACE_WHITE :
-    case CUPS_CSPACE_RGB :
-#  ifdef CUPS_RASTER_HAVE_COLORIMETRIC
-    case CUPS_CSPACE_CIEXYZ :
-    case CUPS_CSPACE_CIELab :
-    case CUPS_CSPACE_ICC1 :
-    case CUPS_CSPACE_ICC2 :
-    case CUPS_CSPACE_ICC3 :
-    case CUPS_CSPACE_ICC4 :
-    case CUPS_CSPACE_ICC5 :
-    case CUPS_CSPACE_ICC6 :
-    case CUPS_CSPACE_ICC7 :
-    case CUPS_CSPACE_ICC8 :
-    case CUPS_CSPACE_ICC9 :
-    case CUPS_CSPACE_ICCA :
-    case CUPS_CSPACE_ICCB :
-    case CUPS_CSPACE_ICCC :
-    case CUPS_CSPACE_ICCD :
-    case CUPS_CSPACE_ICCE :
-    case CUPS_CSPACE_ICCF :
-#  endif /* CUPS_RASTER_HAVE_COLORIMETRIC */
-        cups->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
-        break;
-
-    case CUPS_CSPACE_K :
-    case CUPS_CSPACE_GOLD :
-    case CUPS_CSPACE_SILVER :
-    case CUPS_CSPACE_CMY :
-    case CUPS_CSPACE_YMC :
-    case CUPS_CSPACE_KCMYcm :
-    case CUPS_CSPACE_CMYK :
-    case CUPS_CSPACE_YMCK :
-    case CUPS_CSPACE_KCMY :
-    case CUPS_CSPACE_GMCK :
-    case CUPS_CSPACE_GMCS :
-        cups->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
-        break;
-  }
-
-  cups->color_info.separable_and_linear = GX_CINFO_SEP_LIN_NONE;
-#endif /* dev_t_proc_encode_color */
-
-  if ((i = cups->header.cupsBitsPerColor) > 8)
-    i = 8;
-
-  max_lut = (1 << i) - 1;
-
-  switch (cups->color_info.num_components)
-  {
-    default :
-    case 1 :
-       cups->color_info.max_gray      = max_lut;
-       cups->color_info.max_color     = 0;
-       cups->color_info.dither_grays  = max_lut + 1;
-       cups->color_info.dither_colors = 0;
-        break;
-
-    case 3 :
-       cups->color_info.max_gray      = 0;
-       cups->color_info.max_color     = max_lut;
-       cups->color_info.dither_grays  = 0;
-       cups->color_info.dither_colors = max_lut + 1;
-       break;
-
-    case 4 :
-       cups->color_info.max_gray      = max_lut;
-       cups->color_info.max_color     = max_lut;
-       cups->color_info.dither_grays  = max_lut + 1;
-       cups->color_info.dither_colors = max_lut + 1;
-       break;
-  }
-
- /*
-  * Enable/disable CMYK color support...
-  */
-
-#ifdef dev_t_proc_encode_color
-  cups->color_info.max_components = cups->color_info.num_components;
-#endif /* dev_t_proc_encode_color */
-
- /*
-  * Tell Ghostscript to forget any colors it has cached...
-  */
-
-  gx_device_decache_colors(pdev);
-
- /*
-  * Compute the lookup tables...
-  */
-
-  for (i = 0; i <= gx_max_color_value; i ++)
-  {
-    cupsEncodeLUT[i] = (max_lut * i + gx_max_color_value / 2) /
-                       gx_max_color_value;
-
-#ifdef DEBUG
-    if (i == 0 || cupsEncodeLUT[i] != cupsEncodeLUT[i - 1])
-      fprintf(stderr, "DEBUG2: cupsEncodeLUT[%d] = %d\n", i, cupsEncodeLUT[i]);
-#endif /* DEBUG */
-  }
-
-  for (i = 0; i < cups->color_info.dither_grays; i ++)
-    cupsDecodeLUT[i] = gx_max_color_value * i / max_lut;
-
-  fprintf(stderr, "DEBUG: num_components = %d, depth = %d\n",
-          cups->color_info.num_components, cups->color_info.depth);
-  fprintf(stderr, "DEBUG: cupsColorSpace = %d, cupsColorOrder = %d\n",
-          cups->header.cupsColorSpace, cups->header.cupsColorOrder);
-  fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d, cupsBitsPerColor = %d\n",
-          cups->header.cupsBitsPerPixel, cups->header.cupsBitsPerColor);
-  fprintf(stderr, "DEBUG: max_gray = %d, dither_grays = %d\n",
-          cups->color_info.max_gray, cups->color_info.dither_grays);
-  fprintf(stderr, "DEBUG: max_color = %d, dither_colors = %d\n",
-          cups->color_info.max_color, cups->color_info.dither_colors);
-
- /*
-  * Set the color profile as needed...
-  */
-
-  cupsHaveProfile = 0;
-
-#ifdef dev_t_proc_encode_color
-  if (cupsProfile)
-#else
-  if (cupsProfile && cups->header.cupsBitsPerColor == 8)
-#endif /* dev_t_proc_encode_color */
-  {
-    fprintf(stderr, "DEBUG: Using user-defined profile \"%s\"...\n", cupsProfile);
-
-    if (sscanf(cupsProfile, "%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f", &d, &g,
-               m[0] + 0, m[0] + 1, m[0] + 2,
-               m[1] + 0, m[1] + 1, m[1] + 2,
-               m[2] + 0, m[2] + 1, m[2] + 2) != 11)
-      fputs("DEBUG: User-defined profile does not contain 11 integers!\n", stderr);
-    else
-    {
-      cupsHaveProfile = 1;
-
-      d       *= 0.001f;
-      g       *= 0.001f;
-      m[0][0] *= 0.001f;
-      m[0][1] *= 0.001f;
-      m[0][2] *= 0.001f;
-      m[1][0] *= 0.001f;
-      m[1][1] *= 0.001f;
-      m[1][2] *= 0.001f;
-      m[2][0] *= 0.001f;
-      m[2][1] *= 0.001f;
-      m[2][2] *= 0.001f;
-    }
-  }
-#ifdef dev_t_proc_encode_color
-  else if (cupsPPD)
-#else
-  else if (cupsPPD && cups->header.cupsBitsPerColor == 8)
-#endif /* dev_t_proc_encode_color */
-  {
-   /*
-    * Find the appropriate color profile...
-    */
-
-    if (pdev->HWResolution[0] != pdev->HWResolution[1])
-      sprintf(resolution, "%.0fx%.0fdpi", pdev->HWResolution[0],
-              pdev->HWResolution[1]);
-    else
-      sprintf(resolution, "%.0fdpi", pdev->HWResolution[0]);
-
-    for (i = 0, profile = cupsPPD->profiles;
-         i < cupsPPD->num_profiles;
-        i ++, profile ++)
-      if ((strcmp(profile->resolution, resolution) == 0 ||
-           profile->resolution[0] == '-') &&
-          (strcmp(profile->media_type, cups->header.MediaType) == 0 ||
-           profile->media_type[0] == '-'))
-       break;
-
-   /*
-    * If we found a color profile, use it!
-    */
-
-    if (i < cupsPPD->num_profiles)
-    {
-      fputs("DEBUG: Using color profile in PPD file!\n", stderr);
-
-      cupsHaveProfile = 1;
-
-      d = profile->density;
-      g = profile->gamma;
-
-      memcpy(m, profile->matrix, sizeof(m));
-    }
-  }
-
-  if (cupsHaveProfile)
-  {
-    for (i = 0; i < 3; i ++)
-      for (j = 0; j < 3; j ++)
-       for (k = 0; k <= CUPS_MAX_VALUE; k ++)
-       {
-          cupsMatrix[i][j][k] = (int)((float)k * m[i][j] + 0.5);
-
-#ifdef DEBUG
-          if ((k & 4095) == 0)
-            fprintf(stderr, "DEBUG2: cupsMatrix[%d][%d][%d] = %d\n",
-                   i, j, k, cupsMatrix[i][j][k]);
-#endif /* DEBUG */
-        }
-
-
-    for (k = 0; k <= CUPS_MAX_VALUE; k ++)
-    {
-      cupsDensity[k] = (int)((float)CUPS_MAX_VALUE * d *
-                            pow((float)k / (float)CUPS_MAX_VALUE, g) +
-                            0.5);
-
-#ifdef DEBUG
-      if ((k & 4095) == 0)
-        fprintf(stderr, "DEBUG2: cupsDensity[%d] = %d\n", k, cupsDensity[k]);
-#endif /* DEBUG */
-    }
-  }
-  else
-  {
-    for (k = 0; k <= CUPS_MAX_VALUE; k ++)
-      cupsDensity[k] = k;
-  }
-}
-
-
-/*
- * 'cups_sync_output()' - Keep the user informed of our status...
- */
-
-private int                            /* O - Error status */
-cups_sync_output(gx_device *pdev)      /* I - Device info */
-{
-  fprintf(stderr, "INFO: Processing page %d...\n", cups->page);
-
-  return (0);
-}
-
-
-/*
- * 'cups_print_chunked()' - Print a page of chunked pixels.
- */
-
-static void
-cups_print_chunked(gx_device_printer *pdev,
-                                       /* I - Printer device */
-                   unsigned char     *src,
-                                       /* I - Scanline buffer */
-                  unsigned char     *dst,
-                                       /* I - Bitmap buffer */
-                  int               srcbytes)
-                                       /* I - Number of bytes in src */
-{
-  int          y;                      /* Looping var */
-  unsigned char        *srcptr,                /* Pointer to data */
-               *dstptr;                /* Pointer to bits */
-  int          count;                  /* Count for loop */
-  int          flip;                   /* Flip scanline? */
-
-
-  if (cups->header.Duplex && !cups->header.Tumble &&
-      cupsPPD && cupsPPD->flip_duplex && !(cups->page & 1))
-    flip = 1;
-  else
-    flip = 0;
-
-  fprintf(stderr, "DEBUG: cups_print_chunked - flip = %d, height = %d\n",
-          flip, cups->height);
-
- /*
-  * Loop through the page bitmap and write chunked pixels, reversing as
-  * needed...
-  */
-
-  for (y = 0; y < cups->height; y ++)
-  {
-   /*
-    * Grab the scanline data...
-    */
-
-    if (gdev_prn_get_bits((gx_device_printer *)pdev, y, src, &srcptr) < 0)
-    {
-      fprintf(stderr, "ERROR: Unable to get scanline %d!\n", y);
-      gs_exit(1);
-    }
-
-    if (flip)
-    {
-     /*
-      * Flip the raster data before writing it...
-      */
-
-      if (srcptr[0] == 0 && memcmp(srcptr, srcptr + 1, srcbytes - 1) == 0)
-       memset(dst, 0, cups->header.cupsBytesPerLine);
-      else
-      {
-        dstptr = dst;
-       count  = srcbytes;
-
-       switch (cups->color_info.depth)
-       {
-          case 1 : /* B&W bitmap */
-             for (srcptr += srcbytes - 1;
-                  count > 0;
-                  count --, srcptr --, dstptr ++)
-             {
-               *dstptr = cupsRevUpper1[*srcptr & 15] |
-                         cupsRevLower1[*srcptr >> 4];
-              }
-             break;
-
-         case 2 : /* 2-bit grayscale */
-             for (srcptr += srcbytes - 1;
-                  count > 0;
-                  count --, srcptr --, dstptr ++)
-             {
-               *dstptr = cupsRevUpper2[*srcptr & 15] |
-                         cupsRevLower2[*srcptr >> 4];
-              }
-             break;
-
-         case 4 : /* 4-bit grayscale, or RGB, CMY, or CMYK bitmap */
-             for (srcptr += srcbytes - 1;
-                  count > 0;
-                  count --, srcptr --, dstptr ++)
-               *dstptr = (*srcptr >> 4) | (*srcptr << 4);
-             break;
-
-          case 8 : /* 8-bit grayscale, or 2-bit RGB, CMY, or CMYK image */
-             for (srcptr += srcbytes - 1;
-                  count > 0;
-                  count --, srcptr --, dstptr ++)
-               *dstptr = *srcptr;
-             break;
-
-          case 16 : /* 4-bit RGB, CMY or CMYK image */
-             for (srcptr += srcbytes - 2;
-                  count > 0;
-                  count -= 2, srcptr -= 2, dstptr += 2)
-             {
-               dstptr[0] = srcptr[0];
-               dstptr[1] = srcptr[1];
-              }
-             break;
-
-          case 24 : /* 8-bit RGB or CMY image */
-             for (srcptr += srcbytes - 3;
-                  count > 0;
-                  count -= 3, srcptr -= 3, dstptr += 3)
-             {
-               dstptr[0] = srcptr[0];
-               dstptr[1] = srcptr[1];
-               dstptr[2] = srcptr[2];
-              }
-             break;
-
-          case 32 : /* 4-bit RGB, CMY or CMYK bitmap */
-             for (srcptr += srcbytes - 4;
-                  count > 0;
-                  count -= 4, srcptr -= 4, dstptr += 4)
-             {
-               dstptr[0] = srcptr[0];
-               dstptr[1] = srcptr[1];
-               dstptr[2] = srcptr[2];
-               dstptr[3] = srcptr[3];
-              }
-             break;
-        }
-      }
-
-     /*
-      * Write the bitmap data to the raster stream...
-      */
-
-      cupsRasterWritePixels(cups->stream, dst, cups->header.cupsBytesPerLine);
-    }
-    else
-    {
-     /*
-      * Write the scanline data to the raster stream...
-      */
-
-      cupsRasterWritePixels(cups->stream, srcptr, cups->header.cupsBytesPerLine);
-    }
-  }
-}
-
-
-/*
- * 'cups_print_banded()' - Print a page of banded pixels.
- */
-
-static void
-cups_print_banded(gx_device_printer *pdev,
-                                       /* I - Printer device */
-                  unsigned char     *src,
-                                       /* I - Scanline buffer */
-                 unsigned char     *dst,
-                                       /* I - Bitmap buffer */
-                 int               srcbytes)
-                                       /* I - Number of bytes in src */
-{
-  int          x;                      /* Looping var */
-  int          y;                      /* Looping var */
-  int          bandbytes;              /* Bytes per band */
-  unsigned char        bit;                    /* Current bit */
-  unsigned char        temp;                   /* Temporary variable */
-  unsigned char        *srcptr;                /* Pointer to data */
-  unsigned char        *cptr, *mptr, *yptr,    /* Pointer to components */
-               *kptr, *lcptr, *lmptr;  /* ... */
-  int          flip;                   /* Flip scanline? */
-
-
-  if (cups->header.Duplex && !cups->header.Tumble &&
-      cupsPPD && cupsPPD->flip_duplex && !(cups->page & 1))
-    flip = 1;
-  else
-    flip = 0;
-
-  fprintf(stderr, "DEBUG: cups_print_banded - flip = %d, height = %d\n",
-          flip, cups->height);
-
- /*
-  * Loop through the page bitmap and write banded pixels...  We have
-  * to separate each chunked color as needed...
-  */
-
-  bandbytes = (cups->header.cupsWidth * cups->header.cupsBitsPerColor + 7) / 8;
-
-  for (y = 0; y < cups->height; y ++)
-  {
-   /*
-    * Grab the scanline data...
-    */
-
-    if (gdev_prn_get_bits((gx_device_printer *)pdev, y, src, &srcptr) < 0)
-    {
-      fprintf(stderr, "ERROR: Unable to get scanline %d!\n", y);
-      gs_exit(1);
-    }
-
-   /*
-    * Separate the chunked colors into their components...
-    */
-
-    if (srcptr[0] == 0 && memcmp(srcptr, srcptr + 1, srcbytes - 1) == 0)
-      memset(dst, 0, cups->header.cupsBytesPerLine);
-    else
-    {
-      if (flip)
-        cptr = dst + bandbytes - 1;
-      else
-        cptr = dst;
-
-      mptr  = cptr + bandbytes;
-      yptr  = mptr + bandbytes;
-      kptr  = yptr + bandbytes;
-      lcptr = yptr + bandbytes;
-      lmptr = lcptr + bandbytes;
-
-      switch (cups->header.cupsBitsPerColor)
-      {
-       default :
-            memset(dst, 0, cups->header.cupsBytesPerLine);
-
-            switch (cups->header.cupsColorSpace)
-           {
-             default :
-                 for (x = cups->width, bit = flip ? 1 << (x & 7) : 128;
-                      x > 0;
-                      x --, srcptr ++)
-                 {
-                   if (*srcptr & 0x40)
-                     *cptr |= bit;
-                   if (*srcptr & 0x20)
-                     *mptr |= bit;
-                   if (*srcptr & 0x10)
-                     *yptr |= bit;
-
-                    if (flip)
-                   {
-                     if (bit < 128)
-                       bit <<= 1;
-                     else
-                     {
-                       cptr --;
-                       mptr --;
-                       yptr --;
-                       bit = 1;
-                     }
-                   }
-                   else
-                     bit >>= 1;
-
-                   x --;
-                   if (x == 0)
-                     break;
-
-                   if (*srcptr & 0x4)
-                     *cptr |= bit;
-                   if (*srcptr & 0x2)
-                     *mptr |= bit;
-                   if (*srcptr & 0x1)
-                     *yptr |= bit;
-
-                    if (flip)
-                   {
-                     if (bit < 128)
-                       bit <<= 1;
-                     else
-                     {
-                       cptr --;
-                       mptr --;
-                       yptr --;
-                       bit = 1;
-                     }
-                   }
-                   else if (bit > 1)
-                     bit >>= 1;
-                   else
-                   {
-                     cptr ++;
-                     mptr ++;
-                     yptr ++;
-                     bit = 128;
-                   }
-                 }
-                 break;
-             case CUPS_CSPACE_GMCK :
-             case CUPS_CSPACE_GMCS :
-             case CUPS_CSPACE_RGBA :
-             case CUPS_CSPACE_CMYK :
-             case CUPS_CSPACE_YMCK :
-             case CUPS_CSPACE_KCMY :
-                 for (x = cups->width, bit = flip ? 1 << (x & 7) : 128;
-                      x > 0;
-                      x --, srcptr ++)
-                 {
-                   if (*srcptr & 0x80)
-                     *cptr |= bit;
-                   if (*srcptr & 0x40)
-                     *mptr |= bit;
-                   if (*srcptr & 0x20)
-                     *yptr |= bit;
-                   if (*srcptr & 0x10)
-                     *kptr |= bit;
-
-                    if (flip)
-                   {
-                     if (bit < 128)
-                       bit <<= 1;
-                     else
-                     {
-                       cptr --;
-                       mptr --;
-                       yptr --;
-                       kptr --;
-                       bit = 1;
-                     }
-                   }
-                   else
-                     bit >>= 1;
-
-                   x --;
-                   if (x == 0)
-                     break;
-
-                   if (*srcptr & 0x8)
-                     *cptr |= bit;
-                   if (*srcptr & 0x4)
-                     *mptr |= bit;
-                   if (*srcptr & 0x2)
-                     *yptr |= bit;
-                   if (*srcptr & 0x1)
-                     *kptr |= bit;
-
-                    if (flip)
-                   {
-                     if (bit < 128)
-                       bit <<= 1;
-                     else
-                     {
-                       cptr --;
-                       mptr --;
-                       yptr --;
-                       kptr --;
-                       bit = 1;
-                     }
-                   }
-                   else if (bit > 1)
-                     bit >>= 1;
-                   else
-                   {
-                     cptr ++;
-                     mptr ++;
-                     yptr ++;
-                     kptr ++;
-                     bit = 128;
-                   }
-                 }
-                 break;
-             case CUPS_CSPACE_KCMYcm :
-                 for (x = cups->width, bit = flip ? 1 << (x & 7) : 128;
-                      x > 0;
-                      x --, srcptr ++)
-                 {
-                   /*
-                    * Note: Because of the way the pointers are setup,
-                    *       the following code is correct even though
-                    *       the names don't match...
-                    */
-
-                   if (*srcptr & 0x20)
-                     *cptr |= bit;
-                   if (*srcptr & 0x10)
-                     *mptr |= bit;
-                   if (*srcptr & 0x08)
-                     *yptr |= bit;
-                   if (*srcptr & 0x04)
-                     *kptr |= bit;
-                   if (*srcptr & 0x02)
-                     *lcptr |= bit;
-                   if (*srcptr & 0x01)
-                     *lmptr |= bit;
-
-                    if (flip)
-                   {
-                     if (bit < 128)
-                       bit <<= 1;
-                     else
-                     {
-                       cptr --;
-                       mptr --;
-                       yptr --;
-                       kptr --;
-                       lcptr --;
-                       lmptr --;
-                       bit = 1;
-                     }
-                   }
-                   else if (bit > 1)
-                     bit >>= 1;
-                   else
-                   {
-                     cptr ++;
-                     mptr ++;
-                     yptr ++;
-                     kptr ++;
-                     lcptr ++;
-                     lmptr ++;
-                     bit = 128;
-                   }
-                 }
-                 break;
-           }
-            break;
-
-       case 2 :
-            memset(dst, 0, cups->header.cupsBytesPerLine);
-
-            switch (cups->header.cupsColorSpace)
-           {
-             default :
-                 for (x = cups->width, bit = flip ? 3 << (2 * (x & 3)) : 0xc0;
-                      x > 0;
-                      x --, srcptr ++)
-                   switch (bit)
-                   {
-                     case 0xc0 :
-                         if ((temp = *srcptr & 0x30) != 0)
-                           *cptr |= temp << 2;
-                         if ((temp = *srcptr & 0x0c) != 0)
-                           *mptr |= temp << 4;
-                         if ((temp = *srcptr & 0x03) != 0)
-                           *yptr |= temp << 6;
-
-                          if (flip)
-                         {
-                           bit = 0x03;
-                           cptr --;
-                           mptr --;
-                           yptr --;
-                         }
-                         else
-                           bit = 0x30;
-                         break;
-                     case 0x30 :
-                         if ((temp = *srcptr & 0x30) != 0)
-                           *cptr |= temp;
-                         if ((temp = *srcptr & 0x0c) != 0)
-                           *mptr |= temp << 2;
-                         if ((temp = *srcptr & 0x03) != 0)
-                           *yptr |= temp << 4;
-
-                         if (flip)
-                           bit = 0xc0;
-                         else
-                           bit = 0x0c;
-                         break;
-                     case 0x0c :
-                         if ((temp = *srcptr & 0x30) != 0)
-                           *cptr |= temp >> 2;
-                         if ((temp = *srcptr & 0x0c) != 0)
-                           *mptr |= temp;
-                         if ((temp = *srcptr & 0x03) != 0)
-                           *yptr |= temp << 2;
-
-                         if (flip)
-                           bit = 0x30;
-                         else
-                           bit = 0x03;
-                         break;
-                     case 0x03 :
-                         if ((temp = *srcptr & 0x30) != 0)
-                           *cptr |= temp >> 4;
-                         if ((temp = *srcptr & 0x0c) != 0)
-                           *mptr |= temp >> 2;
-                         if ((temp = *srcptr & 0x03) != 0)
-                           *yptr |= temp;
-
-                         if (flip)
-                           bit = 0x0c;
-                         else
-                         {
-                           bit = 0xc0;
-                           cptr ++;
-                           mptr ++;
-                           yptr ++;
-                         }
-                         break;
-                    }
-                 break;
-             case CUPS_CSPACE_GMCK :
-             case CUPS_CSPACE_GMCS :
-             case CUPS_CSPACE_RGBA :
-             case CUPS_CSPACE_CMYK :
-             case CUPS_CSPACE_YMCK :
-             case CUPS_CSPACE_KCMY :
-             case CUPS_CSPACE_KCMYcm :
-                 for (x = cups->width, bit = flip ? 3 << (2 * (x & 3)) : 0xc0;
-                      x > 0;
-                      x --, srcptr ++)
-                   switch (bit)
-                   {
-                     case 0xc0 :
-                         if ((temp = *srcptr & 0xc0) != 0)
-                           *cptr |= temp;
-                         if ((temp = *srcptr & 0x30) != 0)
-                           *mptr |= temp << 2;
-                         if ((temp = *srcptr & 0x0c) != 0)
-                           *yptr |= temp << 4;
-                         if ((temp = *srcptr & 0x03) != 0)
-                           *kptr |= temp << 6;
-
-                          if (flip)
-                         {
-                           bit = 0x03;
-                           cptr --;
-                           mptr --;
-                           yptr --;
-                           kptr --;
-                         }
-                         else
-                           bit = 0x30;
-                         break;
-                     case 0x30 :
-                         if ((temp = *srcptr & 0xc0) != 0)
-                           *cptr |= temp >> 2;
-                         if ((temp = *srcptr & 0x30) != 0)
-                           *mptr |= temp;
-                         if ((temp = *srcptr & 0x0c) != 0)
-                           *yptr |= temp << 2;
-                         if ((temp = *srcptr & 0x03) != 0)
-                           *kptr |= temp << 4;
-
-                         if (flip)
-                           bit = 0xc0;
-                         else
-                           bit = 0x0c;
-                         break;
-                     case 0x0c :
-                         if ((temp = *srcptr & 0xc0) != 0)
-                           *cptr |= temp >> 4;
-                         if ((temp = *srcptr & 0x30) != 0)
-                           *mptr |= temp >> 2;
-                         if ((temp = *srcptr & 0x0c) != 0)
-                           *yptr |= temp;
-                         if ((temp = *srcptr & 0x03) != 0)
-                           *kptr |= temp << 2;
-
-                         if (flip)
-                           bit = 0x30;
-                         else
-                           bit = 0x03;
-                         break;
-                     case 0x03 :
-                         if ((temp = *srcptr & 0xc0) != 0)
-                           *cptr |= temp >> 6;
-                         if ((temp = *srcptr & 0x30) != 0)
-                           *mptr |= temp >> 4;
-                         if ((temp = *srcptr & 0x0c) != 0)
-                           *yptr |= temp >> 2;
-                         if ((temp = *srcptr & 0x03) != 0)
-                           *kptr |= temp;
-
-                         if (flip)
-                           bit = 0x0c;
-                         else
-                         {
-                           bit = 0xc0;
-                           cptr ++;
-                           mptr ++;
-                           yptr ++;
-                           kptr ++;
-                         }
-                         break;
-                    }
-                 break;
-           }
-            break;
-
-       case 4 :
-            memset(dst, 0, cups->header.cupsBytesPerLine);
-
-            switch (cups->header.cupsColorSpace)
-           {
-             default :
-                 for (x = cups->width, bit = flip && (x & 1) ? 0xf0 : 0x0f;
-                      x > 0;
-                      x --, srcptr += 2)
-                   switch (bit)
-                   {
-                     case 0xf0 :
-                         if ((temp = srcptr[0] & 0x0f) != 0)
-                           *cptr |= temp << 4;
-                         if ((temp = srcptr[1] & 0xf0) != 0)
-                           *mptr |= temp;
-                         if ((temp = srcptr[1] & 0x0f) != 0)
-                           *yptr |= temp << 4;
-
-                         bit = 0x0f;
-
-                          if (flip)
-                         {
-                           cptr --;
-                           mptr --;
-                           yptr --;
-                         }
-                         break;
-                     case 0x0f :
-                         if ((temp = srcptr[0] & 0x0f) != 0)
-                           *cptr |= temp;
-                         if ((temp = srcptr[1] & 0xf0) != 0)
-                           *mptr |= temp >> 4;
-                         if ((temp = srcptr[1] & 0x0f) != 0)
-                           *yptr |= temp;
-
-                         bit = 0xf0;
-
-                          if (!flip)
-                         {
-                           cptr ++;
-                           mptr ++;
-                           yptr ++;
-                         }
-                         break;
-                    }
-                 break;
-             case CUPS_CSPACE_GMCK :
-             case CUPS_CSPACE_GMCS :
-             case CUPS_CSPACE_RGBA :
-             case CUPS_CSPACE_CMYK :
-             case CUPS_CSPACE_YMCK :
-             case CUPS_CSPACE_KCMY :
-             case CUPS_CSPACE_KCMYcm :
-                 for (x = cups->width, bit = flip && (x & 1) ? 0xf0 : 0x0f;
-                      x > 0;
-                      x --, srcptr += 2)
-                   switch (bit)
-                   {
-                     case 0xf0 :
-                         if ((temp = srcptr[0] & 0xf0) != 0)
-                           *cptr |= temp;
-                         if ((temp = srcptr[0] & 0x0f) != 0)
-                           *mptr |= temp << 4;
-                         if ((temp = srcptr[1] & 0xf0) != 0)
-                           *yptr |= temp;
-                         if ((temp = srcptr[1] & 0x0f) != 0)
-                           *kptr |= temp << 4;
-
-                         bit = 0x0f;
-
-                          if (flip)
-                         {
-                           cptr --;
-                           mptr --;
-                           yptr --;
-                           kptr --;
-                         }
-                         break;
-                     case 0x0f :
-                         if ((temp = srcptr[0] & 0xf0) != 0)
-                           *cptr |= temp >> 4;
-                         if ((temp = srcptr[0] & 0x0f) != 0)
-                           *mptr |= temp;
-                         if ((temp = srcptr[1] & 0xf0) != 0)
-                           *yptr |= temp >> 4;
-                         if ((temp = srcptr[1] & 0x0f) != 0)
-                           *kptr |= temp;
-
-                         bit = 0xf0;
-
-                          if (!flip)
-                         {
-                           cptr ++;
-                           mptr ++;
-                           yptr ++;
-                           kptr ++;
-                         }
-                         break;
-                    }
-                 break;
-           }
-            break;
-
-       case 8 :
-            switch (cups->header.cupsColorSpace)
-           {
-             default :
-                 if (flip)
-                   for (x = cups->width; x > 0; x --)
-                   {
-                     *cptr-- = *srcptr++;
-                     *mptr-- = *srcptr++;
-                     *yptr-- = *srcptr++;
-                   }
-                 else
-                   for (x = cups->width; x > 0; x --)
-                   {
-                     *cptr++ = *srcptr++;
-                     *mptr++ = *srcptr++;
-                     *yptr++ = *srcptr++;
-                   }
-                 break;
-             case CUPS_CSPACE_GMCK :
-             case CUPS_CSPACE_GMCS :
-             case CUPS_CSPACE_RGBA :
-             case CUPS_CSPACE_CMYK :
-             case CUPS_CSPACE_YMCK :
-             case CUPS_CSPACE_KCMY :
-             case CUPS_CSPACE_KCMYcm :
-                 if (flip)
-                   for (x = cups->width; x > 0; x --)
-                   {
-                     *cptr-- = *srcptr++;
-                     *mptr-- = *srcptr++;
-                     *yptr-- = *srcptr++;
-                     *kptr-- = *srcptr++;
-                   }
-                 else
-                   for (x = cups->width; x > 0; x --)
-                   {
-                     *cptr++ = *srcptr++;
-                     *mptr++ = *srcptr++;
-                     *yptr++ = *srcptr++;
-                     *kptr++ = *srcptr++;
-                   }
-                 break;
-           }
-            break;
-      }
-    }
-
-   /*
-    * Write the bitmap data to the raster stream...
-    */
-
-    cupsRasterWritePixels(cups->stream, dst, cups->header.cupsBytesPerLine);
-  }
-}
-
-
-/*
- * 'cups_print_planar()' - Print a page of planar pixels.
- */
-
-static void
-cups_print_planar(gx_device_printer *pdev,
-                                       /* I - Printer device */
-                  unsigned char     *src,
-                                       /* I - Scanline buffer */
-                 unsigned char     *dst,
-                                       /* I - Bitmap buffer */
-                 int               srcbytes)
-                                       /* I - Number of bytes in src */
-{
-  int          x;                      /* Looping var */
-  int          y;                      /* Looping var */
-  int          z;                      /* Looping var */
-  unsigned char        srcbit;                 /* Current source bit */
-  unsigned char        dstbit;                 /* Current destination bit */
-  unsigned char        temp;                   /* Temporary variable */
-  unsigned char        *srcptr;                /* Pointer to data */
-  unsigned char        *dstptr;                /* Pointer to bitmap */
-
-
- /**** NOTE: Currently planar output doesn't support flipped duplex!!! ****/
-
- /*
-  * Loop through the page bitmap and write planar pixels...  We have
-  * to separate each chunked color as needed...
-  */
-
-  for (z = 0; z < pdev->color_info.num_components; z ++)
-    for (y = 0; y < cups->height; y ++)
-    {
-     /*
-      * Grab the scanline data...
-      */
-
-      if (gdev_prn_get_bits((gx_device_printer *)pdev, y, src, &srcptr) < 0)
-      {
-       fprintf(stderr, "ERROR: Unable to get scanline %d!\n", y);
-       gs_exit(1);
-      }
-
-     /*
-      * Pull the individual color planes out of the pixels...
-      */
-
-      if (srcptr[0] == 0 && memcmp(srcptr, srcptr + 1, srcbytes - 1) == 0)
-       memset(dst, 0, cups->header.cupsBytesPerLine);
-      else
-       switch (cups->header.cupsBitsPerColor)
-       {
-          default :
-             memset(dst, 0, cups->header.cupsBytesPerLine);
-
-             switch (cups->header.cupsColorSpace)
-             {
-               default :
-                   for (dstptr = dst, x = cups->width, srcbit = 64 >> z,
-                            dstbit = 128;
-                        x > 0;
-                        x --)
-                   {
-                     if (*srcptr & srcbit)
-                       *dstptr |= dstbit;
-
-                      if (srcbit >= 16)
-                       srcbit >>= 4;
-                     else
-                     {
-                       srcbit = 64 >> z;
-                       srcptr ++;
-                     }
-
-                      if (dstbit > 1)
-                       dstbit >>= 1;
-                     else
-                     {
-                       dstbit = 128;
-                       dstptr ++;
-                     }
-                   }
-                   break;
-               case CUPS_CSPACE_GMCK :
-               case CUPS_CSPACE_GMCS :
-               case CUPS_CSPACE_RGBA :
-               case CUPS_CSPACE_CMYK :
-               case CUPS_CSPACE_YMCK :
-               case CUPS_CSPACE_KCMY :
-                   for (dstptr = dst, x = cups->width, srcbit = 128 >> z,
-                            dstbit = 128;
-                        x > 0;
-                        x --)
-                   {
-                     if (*srcptr & srcbit)
-                       *dstptr |= dstbit;
-
-                      if (srcbit >= 16)
-                       srcbit >>= 4;
-                     else
-                     {
-                       srcbit = 128 >> z;
-                       srcptr ++;
-                     }
-
-                      if (dstbit > 1)
-                       dstbit >>= 1;
-                     else
-                     {
-                       dstbit = 128;
-                       dstptr ++;
-                     }
-                   }
-                   break;
-               case CUPS_CSPACE_KCMYcm :
-                   for (dstptr = dst, x = cups->width, srcbit = 32 >> z,
-                            dstbit = 128;
-                        x > 0;
-                        x --, srcptr ++)
-                   {
-                     if (*srcptr & srcbit)
-                       *dstptr |= dstbit;
-
-                      if (dstbit > 1)
-                       dstbit >>= 1;
-                     else
-                     {
-                       dstbit = 128;
-                       dstptr ++;
-                     }
-                   }
-                   break;
-              }
-             break;
-
-         case 2 :
-             memset(dst, 0, cups->header.cupsBytesPerLine);
-
-             switch (cups->header.cupsColorSpace)
-             {
-               default :
-                   for (dstptr = dst, x = cups->width, srcbit = 48 >> (z * 2),
-                            dstbit = 0xc0;
-                        x > 0;
-                        x --, srcptr ++)
-                   {
-                     if ((temp = *srcptr & srcbit) != 0)
-                     {
-                       if (srcbit == dstbit)
-                         *dstptr |= temp;
-                       else
-                       {
-                         switch (srcbit)
-                         {
-                           case 0x30 :
-                               temp >>= 4;
-                               break;
-                           case 0x0c :
-                               temp >>= 2;
-                               break;
-                          }
-
-                         switch (dstbit)
-                         {
-                           case 0xc0 :
-                               *dstptr |= temp << 6;
-                               break;
-                           case 0x30 :
-                               *dstptr |= temp << 4;
-                               break;
-                           case 0x0c :
-                               *dstptr |= temp << 2;
-                               break;
-                           case 0x03 :
-                               *dstptr |= temp;
-                               break;
-                          }
-                       }
-                     }
-
-                     if (dstbit > 0x03)
-                       dstbit >>= 2;
-                     else
-                     {
-                       dstbit = 0xc0;
-                       dstptr ++;
-                     }
-                   }
-                   break;
-               case CUPS_CSPACE_GMCK :
-               case CUPS_CSPACE_GMCS :
-               case CUPS_CSPACE_RGBA :
-               case CUPS_CSPACE_CMYK :
-               case CUPS_CSPACE_YMCK :
-               case CUPS_CSPACE_KCMY :
-               case CUPS_CSPACE_KCMYcm :
-                   for (dstptr = dst, x = cups->width, srcbit = 192 >> (z * 2),
-                            dstbit = 0xc0;
-                        x > 0;
-                        x --, srcptr ++)
-                   {
-                     if ((temp = *srcptr & srcbit) != 0)
-                     {
-                       if (srcbit == dstbit)
-                         *dstptr |= temp;
-                       else
-                       {
-                         switch (srcbit)
-                         {
-                           case 0xc0 :
-                               temp >>= 6;
-                               break;
-                           case 0x30 :
-                               temp >>= 4;
-                               break;
-                           case 0x0c :
-                               temp >>= 2;
-                               break;
-                          }
-
-                         switch (dstbit)
-                         {
-                           case 0xc0 :
-                               *dstptr |= temp << 6;
-                               break;
-                           case 0x30 :
-                               *dstptr |= temp << 4;
-                               break;
-                           case 0x0c :
-                               *dstptr |= temp << 2;
-                               break;
-                           case 0x03 :
-                               *dstptr |= temp;
-                               break;
-                          }
-                       }
-                     }
-
-                     if (dstbit > 0x03)
-                       dstbit >>= 2;
-                     else
-                     {
-                       dstbit = 0xc0;
-                       dstptr ++;
-                     }
-                   }
-                   break;
-              }
-             break;
-
-         case 4 :
-             memset(dst, 0, cups->header.cupsBytesPerLine);
-
-             switch (cups->header.cupsColorSpace)
-             {
-               default :
-                   if (z > 0)
-                     srcptr ++;
-
-                   if (z == 1)
-                     srcbit = 0xf0;
-                   else
-                     srcbit = 0x0f;
-
-                   for (dstptr = dst, x = cups->width, dstbit = 0xf0;
-                        x > 0;
-                        x --, srcptr += 2)
-                   {
-                     if ((temp = *srcptr & srcbit) != 0)
-                     {
-                       if (srcbit == dstbit)
-                         *dstptr |= temp;
-                       else
-                       {
-                         if (srcbit == 0xf0)
-                           temp >>= 4;
-
-                         if (dstbit == 0xf0)
-                           *dstptr |= temp << 4;
-                         else
-                           *dstptr |= temp;
-                       }
-                     }
-
-                     if (dstbit == 0xf0)
-                       dstbit = 0x0f;
-                     else
-                     {
-                       dstbit = 0xf0;
-                       dstptr ++;
-                     }
-                   }
-                   break;
-               case CUPS_CSPACE_GMCK :
-               case CUPS_CSPACE_GMCS :
-               case CUPS_CSPACE_RGBA :
-               case CUPS_CSPACE_CMYK :
-               case CUPS_CSPACE_YMCK :
-               case CUPS_CSPACE_KCMY :
-               case CUPS_CSPACE_KCMYcm :
-                   if (z > 1)
-                     srcptr ++;
-
-                   if (z & 1)
-                     srcbit = 0x0f;
-                   else
-                     srcbit = 0xf0;
-
-                   for (dstptr = dst, x = cups->width, dstbit = 0xf0;
-                        x > 0;
-                        x --, srcptr += 2)
-                   {
-                     if ((temp = *srcptr & srcbit) != 0)
-                     {
-                       if (srcbit == dstbit)
-                         *dstptr |= temp;
-                       else
-                       {
-                         if (srcbit == 0xf0)
-                           temp >>= 4;
-
-                         if (dstbit == 0xf0)
-                           *dstptr |= temp << 4;
-                         else
-                           *dstptr |= temp;
-                       }
-                     }
-
-                     if (dstbit == 0xf0)
-                       dstbit = 0x0f;
-                     else
-                     {
-                       dstbit = 0xf0;
-                       dstptr ++;
-                     }
-                   }
-                   break;
-              }
-             break;
-
-         case 8 :
-             for (srcptr += z, dstptr = dst, x = cups->header.cupsBytesPerLine;
-                  x > 0;
-                  srcptr += pdev->color_info.num_components, x --)
-               *dstptr++ = *srcptr;
-             break;
-       }
-
-     /*
-      * Write the bitmap data to the raster stream...
-      */
-
-      cupsRasterWritePixels(cups->stream, dst, cups->header.cupsBytesPerLine);
-    }
-}
-
-
-/*
- * End of "$Id$".
- */
diff --git a/pstoraster/gs707-lib.patch b/pstoraster/gs707-lib.patch
deleted file mode 100644 (file)
index 32b011d..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-diff -u ghostscript-7.07/lib/gs_init.ps ghostscript-7.07-easysw/lib/gs_init.ps
---- ghostscript-7.07/lib/gs_init.ps    2003-04-12 10:02:38.000000000 -0400
-+++ ghostscript-7.07-easysw/lib/gs_init.ps     2003-11-14 16:38:44.000000000 -0500
-@@ -119,6 +119,7 @@
- currentdict /NOFONTPATH known   /NOFONTPATH exch def
- currentdict /NOGC known   /NOGC exch def
- currentdict /NOINTERPOLATE .knownget { /INTERPOLATE exch not def } if
-+currentdict /NOMEDIAATTRS known /NOMEDIAATTRS exch def
- currentdict /NOPAGEPROMPT known   /NOPAGEPROMPT exch def
- currentdict /NOPAUSE known   /NOPAUSE exch def
- currentdict /NOPLATFONTS known   /NOPLATFONTS exch def
-diff -u ghostscript-7.07/lib/gs_setpd.ps ghostscript-7.07-easysw/lib/gs_setpd.ps
---- ghostscript-7.07/lib/gs_setpd.ps   2003-04-12 10:02:38.000000000 -0400
-+++ ghostscript-7.07-easysw/lib/gs_setpd.ps    2003-11-14 16:38:06.000000000 -0500
-@@ -324,21 +324,42 @@
-     } bind
- .dicttomark readonly def
--% Define the keys used in input attribute matching.
--/.inputattrkeys [
--  /PageSize /MediaColor /MediaWeight /MediaType /InsertSheet
--      % The following are documented in Adobe's supplement for v2017.
--  /LeadingEdge /MediaClass
--] readonly def
--% Define other keys used in media selection.
--/.inputselectionkeys [
--  /MediaPosition /Orientation
--] readonly def
--
--% Define the keys used in output attribute matching.
--/.outputattrkeys [
--  /OutputType
--] readonly def
-+% M. Sweet, Easy Software Products:
-+%
-+% Define NOMEDIAATTRS to turn off the default (but unimplementable) media
-+% selection policies for setpagedevice.  This is used by CUPS to support
-+% the standard Adobe media attributes.
-+NOMEDIAATTRS {
-+  % Define only PageSize for input attribute matching.
-+  /.inputattrkeys [
-+    /PageSize
-+  ] readonly def
-+  % Define no other keys used in media selection.
-+  /.inputselectionkeys [
-+    /noInputSelectionsKeys
-+  ] readonly def
-+
-+  % Define no keys used in output attribute matching.
-+  /.outputattrkeys [
-+    /noOutputAttrKeys
-+  ] readonly def
-+} {
-+  % Define the keys used in input attribute matching.
-+  /.inputattrkeys [
-+    /PageSize /MediaColor /MediaWeight /MediaType /InsertSheet
-+        % The following are documented in Adobe's supplement for v2017.
-+    /LeadingEdge /MediaClass
-+  ] readonly def
-+  % Define other keys used in media selection.
-+  /.inputselectionkeys [
-+    /MediaPosition /Orientation
-+  ] readonly def
-+
-+  % Define the keys used in output attribute matching.
-+  /.outputattrkeys [
-+    /OutputType
-+  ] readonly def
-+} ifelse
- % Define all the parameters that should always be copied to the merged
- % dictionary.
-@@ -367,7 +388,13 @@
-   /PageSize false             % obsolete alias for .MediaSize
-   /InputAttributes false
-   .inputattrkeys
--    { dup /PageSize eq
-+    % M. Sweet, Easy Software Products:
-+    %
-+    % Treat LeadingEdge like PageSize so that a common Ghostscript driver
-+    % doesn't need the NOMEDIAATTRS definition.
-+    %
-+    % { dup /PageSize eq
-+    { dup dup /PageSize eq exch /LeadingEdge eq or
-        { pop }
-        { { 2 index /InputAttributes .knownget { null eq } { true } ifelse } }
-       ifelse
-@@ -442,11 +469,22 @@
- % They are expected to consume the top 2 operands.
- % NOTE: we currently treat all values other than 0, 1, or 7 (for PageSize)
- % the same as 0, i.e., we signal an error.
-+%
-+% M. Sweet, Easy Software Products:
-+%
-+% Define NOMEDIAATTRS to turn off the default (but unimplementable) media
-+% selection policies for setpagedevice.  This is used by CUPS to support
-+% the standard Adobe media attributes.
-   0 {         % Set errorinfo and signal a configurationerror.
-+      NOMEDIAATTRS {
-+        % NOMEDIAATTRS means that the default policy is 7...
-+        pop 2 index exch 7 put
-+      } {
-       pop dup 4 index exch get 2 array astore
-       $error /errorinfo 3 -1 roll put
-       cleartomark
-       /setpagedevice load /configurationerror signalerror
-+      } ifelse
-   } bind
-   1 {         % Roll back the failed request to its previous status.
- DEBUG { (Rolling back.) = pstack flush } if
diff --git a/pstoraster/gs811-lib.patch b/pstoraster/gs811-lib.patch
deleted file mode 100644 (file)
index 9cd1253..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-diff -u ghostscript-8.11/lib/gs_init.ps ghostscript-8.11-easysw/lib/gs_init.ps
---- ghostscript-8.11/lib/gs_init.ps    2003-07-30 03:26:55.000000000 -0400
-+++ ghostscript-8.11-easysw/lib/gs_init.ps     2003-11-13 13:04:17.000000000 -0500
-@@ -139,6 +139,7 @@
- currentdict /NOFONTPATH known   /NOFONTPATH exch def
- currentdict /NOGC known   /NOGC exch def
- currentdict /NOINTERPOLATE .knownget { /INTERPOLATE exch not def } if
-+currentdict /NOMEDIAATTRS known /NOMEDIAATTRS exch def
- currentdict /NOOUTERSAVE known   /NOOUTERSAVE exch def
- currentdict /NOPAGEPROMPT known   /NOPAGEPROMPT exch def
- currentdict /NOPAUSE known   /NOPAUSE exch def
-diff -u ghostscript-8.11/lib/gs_setpd.ps ghostscript-8.11-easysw/lib/gs_setpd.ps
---- ghostscript-8.11/lib/gs_setpd.ps   2003-04-12 14:08:18.000000000 -0400
-+++ ghostscript-8.11-easysw/lib/gs_setpd.ps    2003-11-14 16:32:55.000000000 -0500
-@@ -344,21 +344,42 @@
-     } bind
- .dicttomark readonly def
--% Define the keys used in input attribute matching.
--/.inputattrkeys [
--  /PageSize /MediaColor /MediaWeight /MediaType /InsertSheet
--      % The following are documented in Adobe's supplement for v2017.
--  /LeadingEdge /MediaClass
--] readonly def
--% Define other keys used in media selection.
--/.inputselectionkeys [
--  /MediaPosition /Orientation
--] readonly def
--
--% Define the keys used in output attribute matching.
--/.outputattrkeys [
--  /OutputType
--] readonly def
-+% M. Sweet, Easy Software Products:
-+%
-+% Define NOMEDIAATTRS to turn off the default (but unimplementable) media
-+% selection policies for setpagedevice.  This is used by CUPS to support
-+% the standard Adobe media attributes.
-+NOMEDIAATTRS {
-+  % Define only PageSize for input attribute matching.
-+  /.inputattrkeys [
-+    /PageSize
-+  ] readonly def
-+  % Define no other keys used in media selection.
-+  /.inputselectionkeys [
-+    /noInputSelectionsKeys
-+  ] readonly def
-+
-+  % Define no keys used in output attribute matching.
-+  /.outputattrkeys [
-+    /noOutputAttrKeys
-+  ] readonly def
-+} {
-+  % Define the keys used in input attribute matching.
-+  /.inputattrkeys [
-+    /PageSize /MediaColor /MediaWeight /MediaType /InsertSheet
-+        % The following are documented in Adobe's supplement for v2017.
-+    /LeadingEdge /MediaClass
-+  ] readonly def
-+  % Define other keys used in media selection.
-+  /.inputselectionkeys [
-+    /MediaPosition /Orientation
-+  ] readonly def
-+
-+  % Define the keys used in output attribute matching.
-+  /.outputattrkeys [
-+    /OutputType
-+  ] readonly def
-+} ifelse
- % Define all the parameters that should always be copied to the merged
- % dictionary.
-@@ -387,7 +408,13 @@
-   /PageSize //false           % obsolete alias for .MediaSize
-   /InputAttributes //false
-   .inputattrkeys
--    { dup /PageSize eq
-+    % M. Sweet, Easy Software Products:
-+    %
-+    % Treat LeadingEdge like PageSize so that a common Ghostscript driver
-+    % doesn't need the NOMEDIAATTRS definition.
-+    %
-+    % { dup /PageSize eq
-+    { dup dup /PageSize eq exch /LeadingEdge eq or
-        { pop }
-        { { 2 index /InputAttributes .knownget { //null eq } { //true } ifelse } }
-       ifelse
-@@ -468,11 +495,22 @@
- % They are expected to consume the top 2 operands.
- % NOTE: we currently treat all values other than 0, 1, or 7 (for PageSize)
- % the same as 0, i.e., we signal an error.
-+%
-+% M. Sweet, Easy Software Products:
-+%
-+% Define NOMEDIAATTRS to turn off the default (but unimplementable) media
-+% selection policies for setpagedevice.  This is used by CUPS to support
-+% the standard Adobe media attributes.
-   0 {         % Set errorinfo and signal a configurationerror.
-+      NOMEDIAATTRS {
-+        % NOMEDIAATTRS means that the default policy is 7...
-+        pop 2 index exch 7 put
-+      } {
-       pop dup 4 index exch get 2 array astore
-       $error /errorinfo 3 -1 roll put
-       cleartomark
-       /setpagedevice load /configurationerror signalerror
-+      } ifelse
-   } bind
-   1 {         % Roll back the failed request to its previous status.
- SETPDDEBUG { (Rolling back.) = pstack flush } if
diff --git a/pstoraster/pstopxl b/pstoraster/pstopxl
deleted file mode 100644 (file)
index 227f5f4..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-#
-# "$Id: pstopxl 4076 2004-02-24 21:59:13Z mike $"
-#
-# CUPS PCL XL/PCL 6 filter script for Ghostscript.
-#
-# Copyright 2001-2003 by Easy Software Products.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-# Installation directories...
-prefix=/usr/local
-exec_prefix=${prefix}
-bindir=/usr/lib/cups/filter
-
-# Set the library/font path...
-GS_LIB="${CUPS_FONTPATH:=/usr/share/cups/fonts}"
-export GS_LIB
-
-# Determine the PCL XL/PCL 6 driver to use...
-if test "x$PPD" != x; then
-    colordevice=`grep '^*ColorDevice:' "$PPD" | awk -F: '{print $2}'`
-    case "$colordevice" in
-       *True* | *true*)
-           device="pxlcolor"
-           ;;
-       *)
-           device="pxlmono"
-           ;;
-    esac
-else
-    device="pxlmono"
-fi
-
-# Options we use with Ghostscript...
-gsopts="-dQUIET -dDEBUG -dPARANOIDSAFER -dNOPAUSE -dBATCH"
-gsopts="$gsopts -dNOMEDIAATTRS -sDEVICE=$device -sstdout=%stderr"
-
-# See if we have a filename on the command-line...
-if test -z "$6"; then
-       ifile="-"
-else
-       ifile="$6"
-fi
-
-echo INFO: Starting ESP Ghostscript 7.07.1... 1>&2
-echo DEBUG: Running $bindir/gsrip $gsopts -sOUTPUTFILE="%stdout" "$ifile" 1>&2
-
-# Now run Ghostscript...
-$bindir/gsrip $gsopts -sOUTPUTFILE="%stdout" "$ifile"
-
-#
-# End of "$Id: pstopxl 4076 2004-02-24 21:59:13Z mike $".
-#
diff --git a/pstoraster/pstopxl.in b/pstoraster/pstopxl.in
deleted file mode 100755 (executable)
index c169ff4..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-#
-# "$Id$"
-#
-# CUPS PCL XL/PCL 6 filter script for Ghostscript.
-#
-# Copyright 2001-2005 by Easy Software Products.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-# Installation directories...
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-
-# Set the library/font path...
-GS_LIB="${CUPS_FONTPATH:=/usr/share/cups/fonts}"
-export GS_LIB
-
-# Determine the PCL XL/PCL 6 driver to use...
-if test "x$PPD" != x; then
-    colordevice=`grep '^*ColorDevice:' "$PPD" | awk -F: '{print $2}'`
-    case "$colordevice" in
-       *True* | *true*)
-           device="pxlcolor"
-           ;;
-       *)
-           device="pxlmono"
-           ;;
-    esac
-else
-    device="pxlmono"
-fi
-
-# Options we use with Ghostscript...
-gsopts="-dQUIET -dDEBUG -dPARANOIDSAFER -dNOPAUSE -dBATCH"
-gsopts="$gsopts -dNOMEDIAATTRS -sDEVICE=$device -sstdout=%stderr"
-
-# See if we have a filename on the command-line...
-if test -z "$6"; then
-       ifile="-"
-else
-       ifile="$6"
-fi
-
-echo INFO: Starting ESP Ghostscript 7.07.1... 1>&2
-echo DEBUG: Running $bindir/@GS@ $gsopts -sOUTPUTFILE="%stdout" "$ifile" 1>&2
-
-# Now run Ghostscript...
-$bindir/@GS@ $gsopts -sOUTPUTFILE="%stdout" "$ifile"
-
-#
-# End of "$Id$".
-#
diff --git a/pstoraster/pstoraster b/pstoraster/pstoraster
deleted file mode 100755 (executable)
index ec2c5be..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-#
-# "$Id$"
-#
-# CUPS filter script for Ghostscript.
-#
-# Copyright 2001-2005 by Easy Software Products.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-# Installation directories...
-prefix=/usr/local
-exec_prefix=${prefix}
-bindir=${exec_prefix}/bin
-
-# Set the library/font path...
-GS_FONTPATH="$CUPS_FONTPATH"
-export GS_FONTPATH
-
-# Options we use with Ghostscript...
-gsopts="-dQUIET -dDEBUG -dPARANOIDSAFER -dNOPAUSE -dBATCH "
-gsopts="$gsopts -dNOMEDIAATTRS -sDEVICE=cups -sstdout=%stderr"
-
-# See if we have a profile=n,n,n,n,n,n,n,n,n,n,n option...
-profile=""
-for option in $5; do
-    case $option in
-        profile=*)
-           profile="-scupsProfile=`echo $option | awk -F= '{print $2}'`"
-           ;;
-    esac
-done
-
-# Now run Ghostscript...
-$bindir/gs $gsopts -sOUTPUTFILE="%stdout" $profile $6
-
-#
-# End of "$Id$".
-#
diff --git a/pstoraster/pstoraster.convs b/pstoraster/pstoraster.convs
deleted file mode 100644 (file)
index 424c531..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# "$Id$"
-#
-#   MIME converts file for Ghostscript.
-#
-#   Copyright 1997-2005 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@cups.org
-#         WWW: http://www.cups.org
-#
-
-application/vnd.cups-postscript        application/vnd.cups-raster     100     pstoraster
-
-#
-# End of "$Id$".
-#
diff --git a/pstoraster/pstoraster.in b/pstoraster/pstoraster.in
deleted file mode 100755 (executable)
index 5a99bb6..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/sh
-#
-# "$Id$"
-#
-# CUPS raster filter script for Ghostscript.
-#
-# Copyright 2001-2005 by Easy Software Products.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-# Installation directories...
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-
-# Set the library/font path...
-GS_LIB="${CUPS_FONTPATH:=/usr/share/cups/fonts}"
-export GS_LIB
-
-# Options we use with Ghostscript...
-gsopts="-dQUIET -dDEBUG -dPARANOIDSAFER -dNOPAUSE -dBATCH"
-gsopts="$gsopts -dNOMEDIAATTRS -sDEVICE=cups -sstdout=%stderr"
-
-# See if we have a profile=n,n,n,n,n,n,n,n,n,n,n option...
-profile=""
-for option in $5; do
-    case $option in
-        profile=*)
-           profile="<</cupsProfile(`echo $option | awk -F= '{print $2}'`)>>setpagedevice"
-           ;;
-    esac
-done
-
-# See if we have a filename on the command-line...
-if test -z "$6"; then
-       ifile="-"
-else
-       ifile="$6"
-fi
-
-echo INFO: Starting ESP Ghostscript 7.07.1... 1>&2
-echo DEBUG: Running $bindir/@GS@ $gsopts -sOUTPUTFILE="%stdout" -c"$profile" "$ifile" 1>&2
-
-# Now run Ghostscript...
-$bindir/@GS@ $gsopts -sOUTPUTFILE="%stdout" -c"$profile" "$ifile"
-
-#
-# End of "$Id$".
-#
diff --git a/pstoraster/pxlcolor.ppd b/pstoraster/pxlcolor.ppd
deleted file mode 100644 (file)
index 9422699..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-*PPD-Adobe: "4.3"
-*%
-*% "$Id$"
-*%
-*%   Sample color PCL XL/PCL 6 driver PPD file for the Common UNIX
-*%   Printing System (CUPS).
-*%
-*%   Copyright 1997-2005 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@cups.org
-*%         WWW: http://www.cups.org
-*%
-*FormatVersion:        "4.3"
-*FileVersion:  "1.1"
-*LanguageVersion: English 
-*LanguageEncoding: ISOLatin1
-*PCFileName:   "PCLCOLOR.PPD"
-*Manufacturer: "ESP"
-*Product:      "(CUPS v1.1)"
-*cupsVersion:  1.1
-*cupsManualCopies: False
-*cupsFilter:   "application/vnd.cups-postscript 0 pstopxl"
-*ModelName:     "HP Color LaserJet Series PCL 6"
-*ShortNickName: "HP Color LaserJet Series PCL 6"
-*NickName:      "HP Color LaserJet Series PCL 6 CUPS v1.1"
-*PSVersion:    "(3010.000) 707"
-*LanguageLevel:        "3"
-*ColorDevice:  True
-*DefaultColorSpace: RGB
-*FileSystem:   False
-*Throughput:   "8"
-*LandscapeOrientation: Plus90
-*TTRasterizer: Type42
-
-*UIConstraints: *PageSize Executive *InputSlot Envelope
-*UIConstraints: *PageSize Letter *InputSlot Envelope
-*UIConstraints: *PageSize Legal *InputSlot Envelope
-*UIConstraints: *PageSize Tabloid *InputSlot Envelope
-*UIConstraints: *PageSize A3 *InputSlot Envelope
-*UIConstraints: *PageSize A4 *InputSlot Envelope
-*UIConstraints: *PageSize A5 *InputSlot Envelope
-*UIConstraints: *PageSize B5 *InputSlot Envelope
-*UIConstraints:        *Duplex *Option1 False
-
-*OpenUI *PageSize/Media Size: PickOne
-*OrderDependency: 10 AnySetup *PageSize
-*DefaultPageSize: Letter
-*PageSize Letter/US Letter:    "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
-*PageSize Legal/US Legal:      "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
-*PageSize Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"
-*PageSize Tabloid/US Tabloid:  "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice"
-*PageSize A3/A3:               "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice"
-*PageSize A4/A4:               "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
-*PageSize A5/A5:               "<</PageSize[421 595]/ImagingBBox null>>setpagedevice"
-*PageSize B5/B5 (JIS):         "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
-*PageSize EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice"
-*PageSize Env10/Envelope #10:  "<</PageSize[297 684]/ImagingBBox null>>setpagedevice"
-*PageSize EnvC5/Envelope C5:   "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"
-*PageSize EnvDL/Envelope DL:   "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"
-*PageSize EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"
-*CloseUI: *PageSize
-
-*OpenUI *PageRegion: PickOne
-*OrderDependency: 10 AnySetup *PageRegion
-*DefaultPageRegion: Letter
-*PageRegion Letter/US Letter:  "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
-*PageRegion Legal/US Legal:    "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
-*PageRegion Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"
-*PageRegion Tabloid/US Tabloid:        "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice"
-*PageRegion A3/A3:             "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice"
-*PageRegion A4/A4:             "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
-*PageRegion A5/A5:             "<</PageSize[421 595]/ImagingBBox null>>setpagedevice"
-*PageRegion B5/B5 (JIS):       "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
-*PageRegion EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice"
-*PageRegion Env10/Envelope #10:        "<</PageSize[297 684]/ImagingBBox null>>setpagedevice"
-*PageRegion EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"
-*PageRegion EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"
-*PageRegion EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"
-*CloseUI: *PageRegion
-
-*DefaultImageableArea: Letter 
-*ImageableArea Letter/US Letter:       "12 12 600 780"
-*ImageableArea Legal/US Legal:         "12 12 600 996"
-*ImageableArea Executive/US Executive: "12 12 510 708"
-*ImageableArea Tabloid/US Tabloid:     "12 12 780 1212"
-*ImageableArea A3/A3:                  "12 12 830 1179"
-*ImageableArea A4/A4:                  "12 12 583 830"
-*ImageableArea A5/A5:                  "12 12 409 583"
-*ImageableArea B5/JIS B5:              "12 12 504 717"
-*ImageableArea EnvISOB5/B5 (ISO):      "12 12 469 697"
-*ImageableArea Env10/Com-10:           "12 12 285 672"
-*ImageableArea EnvC5/EnvC5:            "12 12 447 637"
-*ImageableArea EnvDL/EnvDL:            "12 12 300 612"
-*ImageableArea EnvMonarch/Envelope Monarch: "12 12 267 528"
-
-*DefaultPaperDimension: Letter
-*PaperDimension Letter/US Letter:      "612 792"
-*PaperDimension Legal/US Legal:                "612 1008"
-*PaperDimension Executive/US Executive:        "522 756"
-*PaperDimension Tabloid/US Tabloid:    "792 1224"
-*PaperDimension A3/A3:                 "842 1191"
-*PaperDimension A4/A4:                 "595 842"
-*PaperDimension A5/A5:                 "421 595"
-*PaperDimension B5/B5 (JIS):           "516 729"
-*PaperDimension EnvISOB5/Envelope B5:  "499 709"
-*PaperDimension Env10/Envelope #10:    "297 684"
-*PaperDimension EnvC5/Envelope C5:     "459 649"
-*PaperDimension EnvDL/Envelope DL:     "312 624"
-*PaperDimension EnvMonarch/Envelope Monarch: "279 540"
-
-*OpenUI *InputSlot/Media Source: PickOne
-*OrderDependency: 10 AnySetup *InputSlot
-*DefaultInputSlot: Default
-*InputSlot Default/Default: "<</MediaPosition 0>>setpagedevice"
-*InputSlot Tray1/Tray 1: "<</MediaPosition 8>>setpagedevice"
-*InputSlot Tray2/Tray 2: "<</MediaPosition 1>>setpagedevice"
-*InputSlot Tray3/Tray 3: "<</MediaPosition 4>>setpagedevice"
-*InputSlot Tray4/Tray 4: "<</MediaPosition 5>>setpagedevice"
-*InputSlot Manual/Manual Feed: "<</MediaPosition 2>>setpagedevice"
-*InputSlot Envelope/Envelope Feed: "<</MediaPosition 3>>setpagedevice"
-*CloseUI: *InputSlot
-
-*OpenUI *ColorModel/Output Mode: PickOne
-*OrderDependency: 10 AnySetup *ColorModel
-*DefaultColorModel: RGB
-*ColorModel RGB/Color: "<</BitsPerPixel 24>>setpagedevice"
-*ColorModel Gray/Grayscale: "<</BitsPerPixel 8>>setpagedevice"
-*CloseUI: *ColorModel
-
-*OpenUI *Resolution/Output Resolution: PickOne
-*OrderDependency: 20 AnySetup *Resolution
-*DefaultResolution: 300dpi
-*Resolution 150dpi/150 DPI: "<</HWResolution[150 150]>>setpagedevice"
-*Resolution 300dpi/300 DPI: "<</HWResolution[300 300]>>setpagedevice"
-*Resolution 600dpi/600 DPI: "<</HWResolution[600 600]>>setpagedevice"
-*CloseUI: *Resolution
-
-*OpenUI *Duplex/Double-Sided Printing: PickOne
-*OrderDependency: 20 AnySetup *Duplex
-*DefaultDuplex: None
-*Duplex None/Off:      "<</Duplex false>>setpagedevice"
-*Duplex DuplexNoTumble/Long Edge (Standard):   "<</Duplex true/Tumble false>>setpagedevice"
-*Duplex DuplexTumble/Short Edge (Flip):        "<</Duplex true/Tumble true>>setpagedevice"
-*CloseUI:      *Duplex
-
-*OpenGroup: InstallableOptions
-*OpenUI *Option1/Duplexer: Boolean
-*DefaultOption1: False
-*Option1 True/Installed:       ""
-*Option1 False/Not Installed:  ""
-*CloseUI: *Option1
-*CloseGroup: InstallableOptions
-
-*DefaultFont: Courier
-*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
-*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
-*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
-*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
-*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
-*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
-*Font Bookman-Light: Standard "(001.004S)" Standard ROM
-*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
-*Font Courier: Standard "(002.004S)" Standard ROM
-*Font Courier-Bold: Standard "(002.004S)" Standard ROM
-*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
-*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
-*Font Helvetica: Standard "(001.006S)" Standard ROM
-*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
-*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
-*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
-*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
-*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
-*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
-*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
-*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
-*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
-*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
-*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
-*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
-*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
-*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
-*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
-*Font Symbol: Special "(001.007S)" Special ROM
-*Font Times-Bold: Standard "(001.007S)" Standard ROM
-*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
-*Font Times-Italic: Standard "(001.007S)" Standard ROM
-*Font Times-Roman: Standard "(001.007S)" Standard ROM
-*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
-*Font ZapfDingbats: Special "(001.004S)" Standard ROM
-*%
-*% End of "$Id$".
-*%
diff --git a/pstoraster/pxlmono.ppd b/pstoraster/pxlmono.ppd
deleted file mode 100644 (file)
index f765aa9..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-*PPD-Adobe: "4.3"
-*%
-*% "$Id$"
-*%
-*%   Sample monochrome PCL XL/PCL 6 driver PPD file for the Common UNIX
-*%   Printing System (CUPS).
-*%
-*%   Copyright 1997-2005 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@cups.org
-*%         WWW: http://www.cups.org
-*%
-*FormatVersion:        "4.3"
-*FileVersion:  "1.1"
-*LanguageVersion: English 
-*LanguageEncoding: ISOLatin1
-*PCFileName:   "PCLMONO.PPD"
-*Manufacturer: "ESP"
-*Product:      "(CUPS v1.1)"
-*cupsVersion:  1.1
-*cupsManualCopies: False
-*cupsFilter:   "application/vnd.cups-postscript 0 pstopxl"
-*ModelName:     "HP LaserJet Series PCL 6"
-*ShortNickName: "HP LaserJet Series PCL 6"
-*NickName:      "HP LaserJet Series PCL 6 CUPS v1.1"
-*PSVersion:    "(3010.000) 707"
-*LanguageLevel:        "3"
-*ColorDevice:  False
-*DefaultColorSpace: Gray
-*FileSystem:   False
-*Throughput:   "8"
-*LandscapeOrientation: Plus90
-*TTRasterizer: Type42
-
-*UIConstraints: *PageSize Executive *InputSlot Envelope
-*UIConstraints: *PageSize Letter *InputSlot Envelope
-*UIConstraints: *PageSize Legal *InputSlot Envelope
-*UIConstraints: *PageSize Tabloid *InputSlot Envelope
-*UIConstraints: *PageSize A3 *InputSlot Envelope
-*UIConstraints: *PageSize A4 *InputSlot Envelope
-*UIConstraints: *PageSize A5 *InputSlot Envelope
-*UIConstraints: *PageSize B5 *InputSlot Envelope
-*UIConstraints:        *Duplex *Option1 False
-
-*OpenUI *PageSize/Media Size: PickOne
-*OrderDependency: 10 AnySetup *PageSize
-*DefaultPageSize: Letter
-*PageSize Letter/US Letter:    "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
-*PageSize Legal/US Legal:      "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
-*PageSize Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"
-*PageSize Tabloid/US Tabloid:  "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice"
-*PageSize A3/A3:               "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice"
-*PageSize A4/A4:               "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
-*PageSize A5/A5:               "<</PageSize[421 595]/ImagingBBox null>>setpagedevice"
-*PageSize B5/B5 (JIS):         "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
-*PageSize EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice"
-*PageSize Env10/Envelope #10:  "<</PageSize[297 684]/ImagingBBox null>>setpagedevice"
-*PageSize EnvC5/Envelope C5:   "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"
-*PageSize EnvDL/Envelope DL:   "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"
-*PageSize EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"
-*CloseUI: *PageSize
-
-*OpenUI *PageRegion: PickOne
-*OrderDependency: 10 AnySetup *PageRegion
-*DefaultPageRegion: Letter
-*PageRegion Letter/US Letter:  "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
-*PageRegion Legal/US Legal:    "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"
-*PageRegion Executive/US Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"
-*PageRegion Tabloid/US Tabloid:        "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice"
-*PageRegion A3/A3:             "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice"
-*PageRegion A4/A4:             "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"
-*PageRegion A5/A5:             "<</PageSize[421 595]/ImagingBBox null>>setpagedevice"
-*PageRegion B5/B5 (JIS):       "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"
-*PageRegion EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice"
-*PageRegion Env10/Envelope #10:        "<</PageSize[297 684]/ImagingBBox null>>setpagedevice"
-*PageRegion EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"
-*PageRegion EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"
-*PageRegion EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"
-*CloseUI: *PageRegion
-
-*DefaultImageableArea: Letter 
-*ImageableArea Letter/US Letter:       "12 12 600 780"
-*ImageableArea Legal/US Legal:         "12 12 600 996"
-*ImageableArea Executive/US Executive: "12 12 510 708"
-*ImageableArea Tabloid/US Tabloid:     "12 12 780 1212"
-*ImageableArea A3/A3:                  "12 12 830 1179"
-*ImageableArea A4/A4:                  "12 12 583 830"
-*ImageableArea A5/A5:                  "12 12 409 583"
-*ImageableArea B5/JIS B5:              "12 12 504 717"
-*ImageableArea EnvISOB5/B5 (ISO):      "12 12 469 697"
-*ImageableArea Env10/Com-10:           "12 12 285 672"
-*ImageableArea EnvC5/EnvC5:            "12 12 447 637"
-*ImageableArea EnvDL/EnvDL:            "12 12 300 612"
-*ImageableArea EnvMonarch/Envelope Monarch: "12 12 267 528"
-
-*DefaultPaperDimension: Letter
-*PaperDimension Letter/US Letter:      "612 792"
-*PaperDimension Legal/US Legal:                "612 1008"
-*PaperDimension Executive/US Executive:        "522 756"
-*PaperDimension Tabloid/US Tabloid:    "792 1224"
-*PaperDimension A3/A3:                 "842 1191"
-*PaperDimension A4/A4:                 "595 842"
-*PaperDimension A5/A5:                 "421 595"
-*PaperDimension B5/B5 (JIS):           "516 729"
-*PaperDimension EnvISOB5/Envelope B5:  "499 709"
-*PaperDimension Env10/Envelope #10:    "297 684"
-*PaperDimension EnvC5/Envelope C5:     "459 649"
-*PaperDimension EnvDL/Envelope DL:     "312 624"
-*PaperDimension EnvMonarch/Envelope Monarch: "279 540"
-
-*OpenUI *InputSlot/Media Source: PickOne
-*OrderDependency: 10 AnySetup *InputSlot
-*DefaultInputSlot: Default
-*InputSlot Default/Default: "<</MediaPosition 0>>setpagedevice"
-*InputSlot Tray1/Tray 1: "<</MediaPosition 8>>setpagedevice"
-*InputSlot Tray2/Tray 2: "<</MediaPosition 1>>setpagedevice"
-*InputSlot Tray3/Tray 3: "<</MediaPosition 4>>setpagedevice"
-*InputSlot Tray4/Tray 4: "<</MediaPosition 5>>setpagedevice"
-*InputSlot Manual/Manual Feed: "<</MediaPosition 2>>setpagedevice"
-*InputSlot Envelope/Envelope Feed: "<</MediaPosition 3>>setpagedevice"
-*CloseUI: *InputSlot
-
-*OpenUI *Resolution/Output Resolution: PickOne
-*OrderDependency: 20 AnySetup *Resolution
-*DefaultResolution: 600dpi
-*Resolution 150dpi/150 DPI: "<</HWResolution[150 150]>>setpagedevice"
-*Resolution 300dpi/300 DPI: "<</HWResolution[300 300]>>setpagedevice"
-*Resolution 600dpi/600 DPI: "<</HWResolution[600 600]>>setpagedevice"
-*Resolution 1200dpi/1200 DPI: "<</HWResolution[1200 1200]>>setpagedevice"
-*CloseUI: *Resolution
-
-*OpenUI *Duplex/Double-Sided Printing: PickOne
-*OrderDependency: 20 AnySetup *Duplex
-*DefaultDuplex: None
-*Duplex None/Off:      "<</Duplex false>>setpagedevice"
-*Duplex DuplexNoTumble/Long Edge (Standard):   "<</Duplex true/Tumble false>>setpagedevice"
-*Duplex DuplexTumble/Short Edge (Flip):        "<</Duplex true/Tumble true>>setpagedevice"
-*CloseUI:      *Duplex
-
-*OpenGroup: InstallableOptions
-*OpenUI *Option1/Duplexer: Boolean
-*DefaultOption1: False
-*Option1 True/Installed:       ""
-*Option1 False/Not Installed:  ""
-*CloseUI: *Option1
-*CloseGroup: InstallableOptions
-
-*DefaultFont: Courier
-*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
-*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
-*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
-*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
-*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
-*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
-*Font Bookman-Light: Standard "(001.004S)" Standard ROM
-*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
-*Font Courier: Standard "(002.004S)" Standard ROM
-*Font Courier-Bold: Standard "(002.004S)" Standard ROM
-*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
-*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
-*Font Helvetica: Standard "(001.006S)" Standard ROM
-*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
-*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
-*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
-*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
-*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
-*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
-*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
-*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
-*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
-*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
-*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
-*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
-*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
-*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
-*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
-*Font Symbol: Special "(001.007S)" Special ROM
-*Font Times-Bold: Standard "(001.007S)" Standard ROM
-*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
-*Font Times-Italic: Standard "(001.007S)" Standard ROM
-*Font Times-Roman: Standard "(001.007S)" Standard ROM
-*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
-*Font ZapfDingbats: Special "(001.004S)" Standard ROM
-*%
-*% End of "$Id$".
-*%
index 5c0b54d49a2b764b353dc52d4f280cef99a1b5e1..02d504a747f393610dcecff58c8dc531526c770f 100644 (file)
@@ -1618,7 +1618,7 @@ cupsdIsAuthorized(cupsd_client_t *con,    /* I - Connection */
   if (!strcasecmp(con->http.hostname, "localhost"))
   {
    /*
-    * Access from localhost (127.0.0.1 or :::1) is always allowed...
+    * Access from localhost (127.0.0.1 or ::1) is always allowed...
     */
 
     auth = AUTH_ALLOW;
index 49371cac74cd64517faddd0aa1958474ca149297..1819f7f33c52318df19233fafc78ae97620922a3 100644 (file)
@@ -125,6 +125,10 @@ VAR cups_array_t   *Locations      VALUE(NULL);
                                        /* Authorization locations */
 VAR int                        DefaultAuthType VALUE(AUTH_BASIC);
                                        /* Default AuthType, if not specified */
+#ifdef HAVE_SSL
+VAR http_encryption_t  DefaultEncryption VALUE(HTTP_ENCRYPT_REQUIRED);
+                                       /* Default encryption for authentication */
+#endif /* HAVE_SSL */
 
 
 /*
index 1b67885d61dee07a5de27ff4e28b629e76ea17ef..8a0f3ee5623525fadb07d7a6720c73f0e345b157 100644 (file)
@@ -41,6 +41,7 @@
  *   get_file()              - Get a filename and state info.
  *   install_conf_file()     - Install a configuration file.
  *   is_path_absolute()      - Is a path absolute and free of relative elements.
+ *   make_certificate()      - Make a self-signed SSL/TLS certificate.
  *   pipe_command()          - Pipe the output of a command to the remote client.
  */
 
@@ -54,6 +55,9 @@
 #ifdef HAVE_CDSASSL
 #  include <Security/Security.h>
 #endif /* HAVE_CDSASSL */
+#ifdef HAVE_GNUTLS
+#  include <gnutls/x509.h>
+#endif /* HAVE_GNUTLS */
 
 
 /*
@@ -69,6 +73,9 @@ static char           *get_file(cupsd_client_t *con, struct stat *filestats,
                                  char *filename, int len);
 static http_status_t   install_conf_file(cupsd_client_t *con);
 static int             is_path_absolute(const char *path);
+#ifdef HAVE_GNUTLS
+static void            make_certificate(void);
+#endif /* HAVE_GNUTLS */
 static int             pipe_command(cupsd_client_t *con, int infile, int *outfile,
                                     char *command, char *options, int root);
 
@@ -698,6 +705,20 @@ cupsdEncryptClient(cupsd_client_t *con)    /* I - Client to encrypt */
   gnutls_certificate_server_credentials *credentials;
                                        /* TLS credentials */
 
+
+ /*
+  * Verify that we have a certificate...
+  */
+
+  if (access(ServerKey, 0) || access(ServerCertificate, 0))
+  {
+   /*
+    * Nope, make a self-signed certificate...
+    */
+
+    make_certificate();
+  }
+
  /*
   * Create the SSL object and perform the SSL handshake...
   */
@@ -727,7 +748,7 @@ cupsdEncryptClient(cupsd_client_t *con)     /* I - Client to encrypt */
   gnutls_init(&(conn->session), GNUTLS_SERVER);
   gnutls_set_default_priority(conn->session);
   gnutls_credentials_set(conn->session, GNUTLS_CRD_CERTIFICATE, *credentials);
-  gnutls_transport_set_ptr(conn->session, con->http.fd);
+  gnutls_transport_set_ptr(conn->session, (gnutls_transport_ptr)con->http.fd);
 
   error = gnutls_handshake(conn->session);
 
@@ -2256,6 +2277,21 @@ int                                      /* O - 1 if successful, 0 otherwise */
 cupsdSendError(cupsd_client_t *con,    /* I - Connection */
                http_status_t  code)    /* I - Error code */
 {
+ /*
+  * Force client to upgrade for authentication if that is how the
+  * server is configured...
+  */
+
+  if (code == HTTP_UNAUTHORIZED &&
+      DefaultEncryption == HTTP_ENCRYPT_REQUIRED &&
+      strcasecmp(con->http.hostname, "localhost") &&
+      !con->http.tls)
+  {
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdSendError: Encryption before authentication!");
+    code = HTTP_UPGRADE_REQUIRED;
+  }
+
  /*
   * Put the request in the access_log file...
   */
@@ -2416,12 +2452,20 @@ cupsdSendHeader(cupsd_client_t *con,    /* I - Client to send to */
                 http_status_t  code,   /* I - HTTP status code */
                char           *type)   /* I - MIME type of document */
 {
+ /*
+  * Send the HTTP status header...
+  */
+
   if (httpPrintf(HTTP(con), "HTTP/%d.%d %d %s\r\n", con->http.version / 100,
                  con->http.version % 100, code, httpStatus(code)) < 0)
     return (0);
 
   if (code == HTTP_CONTINUE)
   {
+   /*
+    * 100-continue doesn't send any headers...
+    */
+
     if (httpPrintf(HTTP(con), "\r\n") < 0)
       return (0);
     else
@@ -2589,17 +2633,19 @@ cupsdWriteClient(cupsd_client_t *con)   /* I - Client connection */
             if (!strncasecmp(buf, "Location:", 9))
              cupsdSendHeader(con, HTTP_SEE_OTHER, NULL);
            else if (!strncasecmp(buf, "Status:", 7))
-             cupsdSendHeader(con, atoi(buf + 7), NULL);
+             cupsdSendError(con, atoi(buf + 7));
            else
+           {
              cupsdSendHeader(con, HTTP_OK, NULL);
 
-           if (con->http.version == HTTP_1_1)
-           {
-             con->http.data_encoding = HTTP_ENCODE_CHUNKED;
+             if (con->http.version == HTTP_1_1)
+             {
+               con->http.data_encoding = HTTP_ENCODE_CHUNKED;
 
-             if (httpPrintf(HTTP(con), "Transfer-Encoding: chunked\r\n") < 0)
-               return (0);
-           }
+               if (httpPrintf(HTTP(con), "Transfer-Encoding: chunked\r\n") < 0)
+                 return (0);
+             }
+            }
 
            con->sent_header = 1;
          }
@@ -2646,26 +2692,26 @@ cupsdWriteClient(cupsd_client_t *con)   /* I - Client connection */
         return (1);
       }
       else if (bytes == 0)
-      {
         con->http.activity = time(NULL);
-        return (1);
-      }
     }
 
-    if (httpWrite2(HTTP(con), buf, bytes) < 0)
+    if (bytes > 0)
     {
-      cupsdLogMessage(CUPSD_LOG_DEBUG2,
-                      "cupsdWriteClient: %d Write of %d bytes failed!",
-                      con->http.fd, bytes);
+      if (httpWrite2(HTTP(con), buf, bytes) < 0)
+      {
+       cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                       "cupsdWriteClient: %d Write of %d bytes failed!",
+                       con->http.fd, bytes);
 
-      cupsdCloseClient(con);
-      return (0);
-    }
+       cupsdCloseClient(con);
+       return (0);
+      }
 
-    con->bytes += bytes;
+      con->bytes += bytes;
 
-    if (con->http.state == HTTP_WAITING)
-      bytes = 0;
+      if (con->http.state == HTTP_WAITING)
+       bytes = 0;
+    }
   }
 
   if (bytes <= 0)
@@ -3247,6 +3293,148 @@ is_path_absolute(const char *path)      /* I - Input path */
 }
 
 
+#ifdef HAVE_GNUTLS
+/*
+ * 'make_certificate()' - Make a self-signed SSL/TLS certificate.
+ */
+
+static void
+make_certificate(void)
+{
+  gnutls_x509_crt      crt;            /* Self-signed certificate */
+  gnutls_x509_privkey  key;            /* Encryption key */
+  cups_lang_t          *language;      /* Default language info */
+  cups_file_t          *fp;            /* Key/cert file */
+  unsigned char                buffer[8192];   /* Buffer for x509 data */
+  size_t               bytes;          /* Number of bytes of data */
+  unsigned char                serial[4];      /* Serial number buffer */
+  time_t               curtime;        /* Current time */
+  int                  result;         /* Result of GNU TLS calls */
+
+
+ /*
+  * Create the encryption key...
+  */
+
+  cupsdLogMessage(CUPSD_LOG_INFO, "Generating server key...");
+
+  gnutls_x509_privkey_init(&key);
+  gnutls_x509_privkey_generate(key, GNUTLS_PK_RSA, 2048, 0);
+
+ /*
+  * Save it...
+  */
+
+  bytes = sizeof(buffer);
+
+  if ((result = gnutls_x509_privkey_export(key, GNUTLS_X509_FMT_PEM,
+                                           buffer, &bytes)) < 0)
+  {
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to export server key - %s",
+                    gnutls_strerror(result));
+    gnutls_x509_privkey_deinit(key);
+    return;
+  }
+  else if ((fp = cupsFileOpen(ServerKey, "w")) != NULL)
+  {
+    cupsFileWrite(fp, (char *)buffer, bytes);
+    cupsFileClose(fp);
+
+    cupsdLogMessage(CUPSD_LOG_INFO, "Created server key file \"%s\"...",
+                   ServerKey);
+  }
+  else
+  {
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "Unable to create server key file \"%s\" - %s",
+                   ServerKey, strerror(errno));
+    gnutls_x509_privkey_deinit(key);
+    return;
+  }
+
+ /*
+  * Create the self-signed certificate...
+  */
+
+  cupsdLogMessage(CUPSD_LOG_INFO, "Generating self-signed certificate...");
+
+  language  = cupsLangDefault();
+  curtime   = time(NULL);
+  serial[0] = curtime >> 24;
+  serial[1] = curtime >> 16;
+  serial[2] = curtime >> 8;
+  serial[3] = curtime;
+
+  gnutls_x509_crt_init(&crt);
+  if (strlen(language->language) == 5)
+    gnutls_x509_crt_set_dn_by_oid(crt, GNUTLS_OID_X520_COUNTRY_NAME, 0,
+                                  language->language + 3, 2);
+  else
+    gnutls_x509_crt_set_dn_by_oid(crt, GNUTLS_OID_X520_COUNTRY_NAME, 0,
+                                  "US", 2);
+  gnutls_x509_crt_set_dn_by_oid(crt, GNUTLS_OID_X520_COMMON_NAME, 0,
+                                ServerName, strlen(ServerName));
+  gnutls_x509_crt_set_dn_by_oid(crt, GNUTLS_OID_X520_ORGANIZATION_NAME, 0,
+                                ServerName, strlen(ServerName));
+  gnutls_x509_crt_set_dn_by_oid(crt, GNUTLS_OID_X520_ORGANIZATIONAL_UNIT_NAME,
+                                0, "Unknown", 7);
+  gnutls_x509_crt_set_dn_by_oid(crt, GNUTLS_OID_X520_STATE_OR_PROVINCE_NAME, 0,
+                                "Unknown", 7);
+  gnutls_x509_crt_set_dn_by_oid(crt, GNUTLS_OID_X520_LOCALITY_NAME, 0,
+                                "Unknown", 7);
+  gnutls_x509_crt_set_dn_by_oid(crt, GNUTLS_OID_PKCS9_EMAIL, 0,
+                                ServerAdmin, strlen(ServerAdmin));
+  gnutls_x509_crt_set_key(crt, key);
+  gnutls_x509_crt_set_serial(crt, serial, sizeof(serial));
+  gnutls_x509_crt_set_activation_time(crt, curtime);
+  gnutls_x509_crt_set_expiration_time(crt, curtime + 10 * 365 * 86400);
+  gnutls_x509_crt_set_ca_status(crt, 0);
+  gnutls_x509_crt_set_subject_alternative_name(crt, GNUTLS_SAN_DNSNAME,
+                                               ServerName);
+  gnutls_x509_crt_set_key_purpose_oid(crt, GNUTLS_KP_TLS_WWW_SERVER, 0);
+  gnutls_x509_crt_set_key_usage(crt, GNUTLS_KEY_KEY_ENCIPHERMENT);
+  gnutls_x509_crt_set_version(crt, 3);
+
+  bytes = sizeof(buffer);
+  if (gnutls_x509_crt_get_key_id(crt, 0, buffer, &bytes) >= 0)
+    gnutls_x509_crt_set_subject_key_id(crt, buffer, bytes);
+
+  gnutls_x509_crt_sign(crt, crt, key);
+
+ /*
+  * Save it...
+  */
+
+  bytes = sizeof(buffer);
+  if ((result = gnutls_x509_crt_export(crt, GNUTLS_X509_FMT_PEM,
+                                       buffer, &bytes)) < 0)
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "Unable to export server certificate - %s",
+                   gnutls_strerror(result));
+  else if ((fp = cupsFileOpen(ServerCertificate, "w")) != NULL)
+  {
+    cupsFileWrite(fp, (char *)buffer, bytes);
+    cupsFileClose(fp);
+
+    cupsdLogMessage(CUPSD_LOG_INFO,
+                    "Created 10-year server certificate file \"%s\"...",
+                   ServerCertificate);
+  }
+  else
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "Unable to create server certificate file \"%s\" - %s",
+                   ServerCertificate, strerror(errno));
+
+ /*
+  * Cleanup...
+  */
+
+  gnutls_x509_crt_deinit(crt);
+  gnutls_x509_privkey_deinit(key);
+}
+#endif /* HAVE_GNUTLS */
+
+
 /*
  * 'pipe_command()' - Pipe the output of a command to the remote client.
  */
index e8ba527eef9e90e6474b6d1852159c80cc10696f..4320ce660af97fd6456e4444595f571fc1e6d617 100644 (file)
@@ -362,6 +362,9 @@ cupsdReadConfiguration(void)
 
   ConfigFilePerm        = CUPS_DEFAULT_CONFIG_FILE_PERM;
   DefaultAuthType       = AUTH_BASIC;
+#ifdef HAVE_SSL
+  DefaultEncryption     = HTTP_ENCRYPT_REQUIRED;
+#endif /* HAVE_SSL */
   JobRetryLimit         = 5;
   JobRetryInterval      = 300;
   FileDevice            = FALSE;
@@ -2667,6 +2670,28 @@ read_configuration(cups_file_t *fp)      /* I - File to read from */
        return (0);
       }
     }
+#ifdef HAVE_SSL
+    else if (!strcasecmp(line, "DefaultEncryption"))
+    {
+     /*
+      * DefaultEncryption {Never,IfRequested,Required}
+      */
+
+      if (!value || !strcasecmp(value, "never"))
+       DefaultEncryption = HTTP_ENCRYPT_NEVER;
+      else if (!strcasecmp(value, "required"))
+       DefaultEncryption = HTTP_ENCRYPT_REQUIRED;
+      else if (!strcasecmp(value, "ifrequested"))
+       DefaultEncryption = HTTP_ENCRYPT_IF_REQUESTED;
+      else
+      {
+       cupsdLogMessage(CUPSD_LOG_WARN,
+                       "Unknown default encryption %s on line %d.",
+                       value, linenum);
+       return (0);
+      }
+    }
+#endif /* HAVE_SSL */
     else if (!strcasecmp(line, "User"))
     {
      /*
diff --git a/standards/rfc4122.txt b/standards/rfc4122.txt
new file mode 100644 (file)
index 0000000..31ceaab
--- /dev/null
@@ -0,0 +1,1795 @@
+
+
+
+
+
+
+Network Working Group                                           P. Leach
+Request for Comments: 4122                                     Microsoft
+Category: Standards Track                                    M. Mealling
+                                                Refactored Networks, LLC
+                                                                 R. Salz
+                                              DataPower Technology, Inc.
+                                                               July 2005
+
+
+          A Universally Unique IDentifier (UUID) URN Namespace
+
+Status of This Memo
+
+   This document specifies an Internet standards track protocol for the
+   Internet community, and requests discussion and suggestions for
+   improvements.  Please refer to the current edition of the "Internet
+   Official Protocol Standards" (STD 1) for the standardization state
+   and status of this protocol.  Distribution of this memo is unlimited.
+
+Copyright Notice
+
+   Copyright (C) The Internet Society (2005).
+
+Abstract
+
+   This specification defines a Uniform Resource Name namespace for
+   UUIDs (Universally Unique IDentifier), also known as GUIDs (Globally
+   Unique IDentifier).  A UUID is 128 bits long, and can guarantee
+   uniqueness across space and time.  UUIDs were originally used in the
+   Apollo Network Computing System and later in the Open Software
+   Foundation's (OSF) Distributed Computing Environment (DCE), and then
+   in Microsoft Windows platforms.
+
+   This specification is derived from the DCE specification with the
+   kind permission of the OSF (now known as The Open Group).
+   Information from earlier versions of the DCE specification have been
+   incorporated into this document.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Leach, et al.               Standards Track                     [Page 1]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+Table of Contents
+
+   1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  2
+   2. Motivation . . . . . . . . . . . . . . . . . . . . . . . . . .  3
+   3. Namespace Registration Template  . . . . . . . . . . . . . . .  3
+   4. Specification  . . . . . . . . . . . . . . . . . . . . . . . .  5
+      4.1. Format. . . . . . . . . . . . . . . . . . . . . . . . . .  5
+           4.1.1. Variant. . . . . . . . . . . . . . . . . . . . . .  6
+           4.1.2. Layout and Byte Order. . . . . . . . . . . . . . .  6
+           4.1.3. Version. . . . . . . . . . . . . . . . . . . . . .  7
+           4.1.4. Timestamp. . . . . . . . . . . . . . . . . . . . .  8
+           4.1.5. Clock Sequence . . . . . . . . . . . . . . . . . .  8
+           4.1.6. Node . . . . . . . . . . . . . . . . . . . . . . .  9
+           4.1.7. Nil UUID . . . . . . . . . . . . . . . . . . . . .  9
+      4.2. Algorithms for Creating a Time-Based UUID . . . . . . . .  9
+           4.2.1. Basic Algorithm. . . . . . . . . . . . . . . . . . 10
+           4.2.2. Generation Details . . . . . . . . . . . . . . . . 12
+      4.3. Algorithm for Creating a Name-Based UUID. . . . . . . . . 13
+      4.4. Algorithms for Creating a UUID from Truly Random or
+           Pseudo-Random Numbers . . . . . . . . . . . . . . . . . . 14
+      4.5. Node IDs that Do Not Identify the Host. . . . . . . . . . 15
+   5. Community Considerations . . . . . . . . . . . . . . . . . . . 15
+   6. Security Considerations  . . . . . . . . . . . . . . . . . . . 16
+   7. Acknowledgments  . . . . . . . . . . . . . . . . . . . . . . . 16
+   8. Normative References . . . . . . . . . . . . . . . . . . . . . 16
+   A. Appendix A - Sample Implementation . . . . . . . . . . . . . . 18
+   B. Appendix B - Sample Output of utest  . . . . . . . . . . . . . 29
+   C. Appendix C - Some Name Space IDs . . . . . . . . . . . . . . . 30
+
+1.  Introduction
+
+   This specification defines a Uniform Resource Name namespace for
+   UUIDs (Universally Unique IDentifier), also known as GUIDs (Globally
+   Unique IDentifier).  A UUID is 128 bits long, and requires no central
+   registration process.
+
+   The information here is meant to be a concise guide for those wishing
+   to implement services using UUIDs as URNs.  Nothing in this document
+   should be construed to override the DCE standards that defined UUIDs.
+
+   There is an ITU-T Recommendation and ISO/IEC Standard [3] that are
+   derived from earlier versions of this document.  Both sets of
+   specifications have been aligned, and are fully technically
+   compatible.  In addition, a global registration function is being
+   provided by the Telecommunications Standardisation Bureau of ITU-T;
+   for details see <http://www.itu.int/ITU-T/asn1/uuid.html>.
+
+
+
+
+
+Leach, et al.               Standards Track                     [Page 2]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+2.  Motivation
+
+   One of the main reasons for using UUIDs is that no centralized
+   authority is required to administer them (although one format uses
+   IEEE 802 node identifiers, others do not).  As a result, generation
+   on demand can be completely automated, and used for a variety of
+   purposes.  The UUID generation algorithm described here supports very
+   high allocation rates of up to 10 million per second per machine if
+   necessary, so that they could even be used as transaction IDs.
+
+   UUIDs are of a fixed size (128 bits) which is reasonably small
+   compared to other alternatives.  This lends itself well to sorting,
+   ordering, and hashing of all sorts, storing in databases, simple
+   allocation, and ease of programming in general.
+
+   Since UUIDs are unique and persistent, they make excellent Uniform
+   Resource Names.  The unique ability to generate a new UUID without a
+   registration process allows for UUIDs to be one of the URNs with the
+   lowest minting cost.
+
+3.  Namespace Registration Template
+
+   Namespace ID:  UUID
+   Registration Information:
+      Registration date: 2003-10-01
+
+   Declared registrant of the namespace:
+      JTC 1/SC6 (ASN.1 Rapporteur Group)
+
+   Declaration of syntactic structure:
+      A UUID is an identifier that is unique across both space and time,
+      with respect to the space of all UUIDs.  Since a UUID is a fixed
+      size and contains a time field, it is possible for values to
+      rollover (around A.D. 3400, depending on the specific algorithm
+      used).  A UUID can be used for multiple purposes, from tagging
+      objects with an extremely short lifetime, to reliably identifying
+      very persistent objects across a network.
+
+      The internal representation of a UUID is a specific sequence of
+      bits in memory, as described in Section 4.  To accurately
+      represent a UUID as a URN, it is necessary to convert the bit
+      sequence to a string representation.
+
+      Each field is treated as an integer and has its value printed as a
+      zero-filled hexadecimal digit string with the most significant
+      digit first.  The hexadecimal values "a" through "f" are output as
+      lower case characters and are case insensitive on input.
+
+
+
+
+Leach, et al.               Standards Track                     [Page 3]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+      The formal definition of the UUID string representation is
+      provided by the following ABNF [7]:
+
+      UUID                   = time-low "-" time-mid "-"
+                               time-high-and-version "-"
+                               clock-seq-and-reserved
+                               clock-seq-low "-" node
+      time-low               = 4hexOctet
+      time-mid               = 2hexOctet
+      time-high-and-version  = 2hexOctet
+      clock-seq-and-reserved = hexOctet
+      clock-seq-low          = hexOctet
+      node                   = 6hexOctet
+      hexOctet               = hexDigit hexDigit
+      hexDigit =
+            "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" /
+            "a" / "b" / "c" / "d" / "e" / "f" /
+            "A" / "B" / "C" / "D" / "E" / "F"
+
+   The following is an example of the string representation of a UUID as
+   a URN:
+
+   urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6
+
+   Relevant ancillary documentation:
+      [1][2]
+   Identifier uniqueness considerations:
+      This document specifies three algorithms to generate UUIDs: the
+      first leverages the unique values of 802 MAC addresses to
+      guarantee uniqueness, the second uses pseudo-random number
+      generators, and the third uses cryptographic hashing and
+      application-provided text strings.  As a result, the UUIDs
+      generated according to the mechanisms here will be unique from all
+      other UUIDs that have been or will be assigned.
+
+   Identifier persistence considerations:
+      UUIDs are inherently very difficult to resolve in a global sense.
+      This, coupled with the fact that UUIDs are temporally unique
+      within their spatial context, ensures that UUIDs will remain as
+      persistent as possible.
+
+   Process of identifier assignment:
+      Generating a UUID does not require that a registration authority
+      be contacted.  One algorithm requires a unique value over space
+      for each generator.  This value is typically an IEEE 802 MAC
+      address, usually already available on network-connected hosts.
+      The address can be assigned from an address block obtained from
+      the IEEE registration authority.  If no such address is available,
+
+
+
+Leach, et al.               Standards Track                     [Page 4]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+      or privacy concerns make its use undesirable, Section 4.5
+      specifies two alternatives.  Another approach is to use version 3
+      or version 4 UUIDs as defined below.
+
+   Process for identifier resolution:
+      Since UUIDs are not globally resolvable, this is not applicable.
+
+   Rules for Lexical Equivalence:
+      Consider each field of the UUID to be an unsigned integer as shown
+      in the table in section Section 4.1.2.  Then, to compare a pair of
+      UUIDs, arithmetically compare the corresponding fields from each
+      UUID in order of significance and according to their data type.
+      Two UUIDs are equal if and only if all the corresponding fields
+      are equal.
+
+      As an implementation note, equality comparison can be performed on
+      many systems by doing the appropriate byte-order canonicalization,
+      and then treating the two UUIDs as 128-bit unsigned integers.
+
+      UUIDs, as defined in this document, can also be ordered
+      lexicographically.  For a pair of UUIDs, the first one follows the
+      second if the most significant field in which the UUIDs differ is
+      greater for the first UUID.  The second precedes the first if the
+      most significant field in which the UUIDs differ is greater for
+      the second UUID.
+
+   Conformance with URN Syntax:
+      The string representation of a UUID is fully compatible with the
+      URN syntax.  When converting from a bit-oriented, in-memory
+      representation of a UUID into a URN, care must be taken to
+      strictly adhere to the byte order issues mentioned in the string
+      representation section.
+
+   Validation mechanism:
+      Apart from determining whether the timestamp portion of the UUID
+      is in the future and therefore not yet assignable, there is no
+      mechanism for determining whether a UUID is 'valid'.
+
+   Scope:
+      UUIDs are global in scope.
+
+4.  Specification
+
+4.1.  Format
+
+   The UUID format is 16 octets; some bits of the eight octet variant
+   field specified below determine finer structure.
+
+
+
+
+Leach, et al.               Standards Track                     [Page 5]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+4.1.1.  Variant
+
+   The variant field determines the layout of the UUID.  That is, the
+   interpretation of all other bits in the UUID depends on the setting
+   of the bits in the variant field.  As such, it could more accurately
+   be called a type field; we retain the original term for
+   compatibility.  The variant field consists of a variable number of
+   the most significant bits of octet 8 of the UUID.
+
+   The following table lists the contents of the variant field, where
+   the letter "x" indicates a "don't-care" value.
+
+   Msb0  Msb1  Msb2  Description
+
+    0     x     x    Reserved, NCS backward compatibility.
+
+    1     0     x    The variant specified in this document.
+
+    1     1     0    Reserved, Microsoft Corporation backward
+                     compatibility
+
+    1     1     1    Reserved for future definition.
+
+   Interoperability, in any form, with variants other than the one
+   defined here is not guaranteed, and is not likely to be an issue in
+   practice.
+
+4.1.2.  Layout and Byte Order
+
+   To minimize confusion about bit assignments within octets, the UUID
+   record definition is defined only in terms of fields that are
+   integral numbers of octets.  The fields are presented with the most
+   significant one first.
+
+   Field                  Data Type     Octet  Note
+                                        #
+
+   time_low               unsigned 32   0-3    The low field of the
+                          bit integer          timestamp
+
+   time_mid               unsigned 16   4-5    The middle field of the
+                          bit integer          timestamp
+
+   time_hi_and_version    unsigned 16   6-7    The high field of the
+                          bit integer          timestamp multiplexed
+                                               with the version number
+
+
+
+
+
+Leach, et al.               Standards Track                     [Page 6]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+   clock_seq_hi_and_rese  unsigned 8    8      The high field of the
+   rved                   bit integer          clock sequence
+                                               multiplexed with the
+                                               variant
+
+   clock_seq_low          unsigned 8    9      The low field of the
+                          bit integer          clock sequence
+
+   node                   unsigned 48   10-15  The spatially unique
+                          bit integer          node identifier
+
+   In the absence of explicit application or presentation protocol
+   specification to the contrary, a UUID is encoded as a 128-bit object,
+   as follows:
+
+   The fields are encoded as 16 octets, with the sizes and order of the
+   fields defined above, and with each field encoded with the Most
+   Significant Byte first (known as network byte order).  Note that the
+   field names, particularly for multiplexed fields, follow historical
+   practice.
+
+   0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                          time_low                             |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |       time_mid                |         time_hi_and_version   |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |clk_seq_hi_res |  clk_seq_low  |         node (0-1)            |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                         node (2-5)                            |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+4.1.3.  Version
+
+   The version number is in the most significant 4 bits of the time
+   stamp (bits 4 through 7 of the time_hi_and_version field).
+
+   The following table lists the currently-defined versions for this
+   UUID variant.
+
+   Msb0  Msb1  Msb2  Msb3   Version  Description
+
+    0     0     0     1        1     The time-based version
+                                     specified in this document.
+
+    0     0     1     0        2     DCE Security version, with
+                                     embedded POSIX UIDs.
+
+
+
+Leach, et al.               Standards Track                     [Page 7]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+    0     0     1     1        3     The name-based version
+                                     specified in this document
+                                     that uses MD5 hashing.
+
+    0     1     0     0        4     The randomly or pseudo-
+                                     randomly generated version
+                                     specified in this document.
+
+    0     1     0     1        5     The name-based version
+                                     specified in this document
+                                     that uses SHA-1 hashing.
+
+   The version is more accurately a sub-type; again, we retain the term
+   for compatibility.
+
+4.1.4.  Timestamp
+
+   The timestamp is a 60-bit value.  For UUID version 1, this is
+   represented by Coordinated Universal Time (UTC) as a count of 100-
+   nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of
+   Gregorian reform to the Christian calendar).
+
+   For systems that do not have UTC available, but do have the local
+   time, they may use that instead of UTC, as long as they do so
+   consistently throughout the system.  However, this is not recommended
+   since generating the UTC from local time only needs a time zone
+   offset.
+
+   For UUID version 3 or 5, the timestamp is a 60-bit value constructed
+   from a name as described in Section 4.3.
+
+   For UUID version 4, the timestamp is a randomly or pseudo-randomly
+   generated 60-bit value, as described in Section 4.4.
+
+4.1.5.  Clock Sequence
+
+   For UUID version 1, the clock sequence is used to help avoid
+   duplicates that could arise when the clock is set backwards in time
+   or if the node ID changes.
+
+   If the clock is set backwards, or might have been set backwards
+   (e.g., while the system was powered off), and the UUID generator can
+   not be sure that no UUIDs were generated with timestamps larger than
+   the value to which the clock was set, then the clock sequence has to
+   be changed.  If the previous value of the clock sequence is known, it
+   can just be incremented; otherwise it should be set to a random or
+   high-quality pseudo-random value.
+
+
+
+
+Leach, et al.               Standards Track                     [Page 8]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+   Similarly, if the node ID changes (e.g., because a network card has
+   been moved between machines), setting the clock sequence to a random
+   number minimizes the probability of a duplicate due to slight
+   differences in the clock settings of the machines.  If the value of
+   clock sequence associated with the changed node ID were known, then
+   the clock sequence could just be incremented, but that is unlikely.
+
+   The clock sequence MUST be originally (i.e., once in the lifetime of
+   a system) initialized to a random number to minimize the correlation
+   across systems.  This provides maximum protection against node
+   identifiers that may move or switch from system to system rapidly.
+   The initial value MUST NOT be correlated to the node identifier.
+
+   For UUID version 3 or 5, the clock sequence is a 14-bit value
+   constructed from a name as described in Section 4.3.
+
+   For UUID version 4, clock sequence is a randomly or pseudo-randomly
+   generated 14-bit value as described in Section 4.4.
+
+4.1.6.  Node
+
+   For UUID version 1, the node field consists of an IEEE 802 MAC
+   address, usually the host address.  For systems with multiple IEEE
+   802 addresses, any available one can be used.  The lowest addressed
+   octet (octet number 10) contains the global/local bit and the
+   unicast/multicast bit, and is the first octet of the address
+   transmitted on an 802.3 LAN.
+
+   For systems with no IEEE address, a randomly or pseudo-randomly
+   generated value may be used; see Section 4.5.  The multicast bit must
+   be set in such addresses, in order that they will never conflict with
+   addresses obtained from network cards.
+
+   For UUID version 3 or 5, the node field is a 48-bit value constructed
+   from a name as described in Section 4.3.
+
+   For UUID version 4, the node field is a randomly or pseudo-randomly
+   generated 48-bit value as described in Section 4.4.
+
+4.1.7.  Nil UUID
+
+   The nil UUID is special form of UUID that is specified to have all
+   128 bits set to zero.
+
+4.2.  Algorithms for Creating a Time-Based UUID
+
+   Various aspects of the algorithm for creating a version 1 UUID are
+   discussed in the following sections.
+
+
+
+Leach, et al.               Standards Track                     [Page 9]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+4.2.1.  Basic Algorithm
+
+   The following algorithm is simple, correct, and inefficient:
+
+   o  Obtain a system-wide global lock
+
+   o  From a system-wide shared stable store (e.g., a file), read the
+      UUID generator state: the values of the timestamp, clock sequence,
+      and node ID used to generate the last UUID.
+
+   o  Get the current time as a 60-bit count of 100-nanosecond intervals
+      since 00:00:00.00, 15 October 1582.
+
+   o  Get the current node ID.
+
+   o  If the state was unavailable (e.g., non-existent or corrupted), or
+      the saved node ID is different than the current node ID, generate
+      a random clock sequence value.
+
+   o  If the state was available, but the saved timestamp is later than
+      the current timestamp, increment the clock sequence value.
+
+   o  Save the state (current timestamp, clock sequence, and node ID)
+      back to the stable store.
+
+   o  Release the global lock.
+
+   o  Format a UUID from the current timestamp, clock sequence, and node
+      ID values according to the steps in Section 4.2.2.
+
+   If UUIDs do not need to be frequently generated, the above algorithm
+   may be perfectly adequate.  For higher performance requirements,
+   however, issues with the basic algorithm include:
+
+   o  Reading the state from stable storage each time is inefficient.
+
+   o  The resolution of the system clock may not be 100-nanoseconds.
+
+   o  Writing the state to stable storage each time is inefficient.
+
+   o  Sharing the state across process boundaries may be inefficient.
+
+   Each of these issues can be addressed in a modular fashion by local
+   improvements in the functions that read and write the state and read
+   the clock.  We address each of them in turn in the following
+   sections.
+
+
+
+
+
+Leach, et al.               Standards Track                    [Page 10]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+4.2.1.1.  Reading Stable Storage
+
+   The state only needs to be read from stable storage once at boot
+   time, if it is read into a system-wide shared volatile store (and
+   updated whenever the stable store is updated).
+
+   If an implementation does not have any stable store available, then
+   it can always say that the values were unavailable.  This is the
+   least desirable implementation because it will increase the frequency
+   of creation of new clock sequence numbers, which increases the
+   probability of duplicates.
+
+   If the node ID can never change (e.g., the net card is inseparable
+   from the system), or if any change also reinitializes the clock
+   sequence to a random value, then instead of keeping it in stable
+   store, the current node ID may be returned.
+
+4.2.1.2.  System Clock Resolution
+
+   The timestamp is generated from the system time, whose resolution may
+   be less than the resolution of the UUID timestamp.
+
+   If UUIDs do not need to be frequently generated, the timestamp can
+   simply be the system time multiplied by the number of 100-nanosecond
+   intervals per system time interval.
+
+   If a system overruns the generator by requesting too many UUIDs
+   within a single system time interval, the UUID service MUST either
+   return an error, or stall the UUID generator until the system clock
+   catches up.
+
+   A high resolution timestamp can be simulated by keeping a count of
+   the number of UUIDs that have been generated with the same value of
+   the system time, and using it to construct the low order bits of the
+   timestamp.  The count will range between zero and the number of
+   100-nanosecond intervals per system time interval.
+
+   Note: If the processors overrun the UUID generation frequently,
+   additional node identifiers can be allocated to the system, which
+   will permit higher speed allocation by making multiple UUIDs
+   potentially available for each time stamp value.
+
+4.2.1.3.  Writing Stable Storage
+
+   The state does not always need to be written to stable store every
+   time a UUID is generated.  The timestamp in the stable store can be
+   periodically set to a value larger than any yet used in a UUID.  As
+   long as the generated UUIDs have timestamps less than that value, and
+
+
+
+Leach, et al.               Standards Track                    [Page 11]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+   the clock sequence and node ID remain unchanged, only the shared
+   volatile copy of the state needs to be updated.  Furthermore, if the
+   timestamp value in stable store is in the future by less than the
+   typical time it takes the system to reboot, a crash will not cause a
+   reinitialization of the clock sequence.
+
+4.2.1.4.  Sharing State Across Processes
+
+   If it is too expensive to access shared state each time a UUID is
+   generated, then the system-wide generator can be implemented to
+   allocate a block of time stamps each time it is called; a per-
+   process generator can allocate from that block until it is exhausted.
+
+4.2.2.  Generation Details
+
+   Version 1 UUIDs are generated according to the following algorithm:
+
+   o  Determine the values for the UTC-based timestamp and clock
+      sequence to be used in the UUID, as described in Section 4.2.1.
+
+   o  For the purposes of this algorithm, consider the timestamp to be a
+      60-bit unsigned integer and the clock sequence to be a 14-bit
+      unsigned integer.  Sequentially number the bits in a field,
+      starting with zero for the least significant bit.
+
+   o  Set the time_low field equal to the least significant 32 bits
+      (bits zero through 31) of the timestamp in the same order of
+      significance.
+
+   o  Set the time_mid field equal to bits 32 through 47 from the
+      timestamp in the same order of significance.
+
+   o  Set the 12 least significant bits (bits zero through 11) of the
+      time_hi_and_version field equal to bits 48 through 59 from the
+      timestamp in the same order of significance.
+
+   o  Set the four most significant bits (bits 12 through 15) of the
+      time_hi_and_version field to the 4-bit version number
+      corresponding to the UUID version being created, as shown in the
+      table above.
+
+   o  Set the clock_seq_low field to the eight least significant bits
+      (bits zero through 7) of the clock sequence in the same order of
+      significance.
+
+
+
+
+
+
+
+Leach, et al.               Standards Track                    [Page 12]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+   o  Set the 6 least significant bits (bits zero through 5) of the
+      clock_seq_hi_and_reserved field to the 6 most significant bits
+      (bits 8 through 13) of the clock sequence in the same order of
+      significance.
+
+   o  Set the two most significant bits (bits 6 and 7) of the
+      clock_seq_hi_and_reserved to zero and one, respectively.
+
+   o  Set the node field to the 48-bit IEEE address in the same order of
+      significance as the address.
+
+4.3.  Algorithm for Creating a Name-Based UUID
+
+   The version 3 or 5 UUID is meant for generating UUIDs from "names"
+   that are drawn from, and unique within, some "name space".  The
+   concept of name and name space should be broadly construed, and not
+   limited to textual names.  For example, some name spaces are the
+   domain name system, URLs, ISO Object IDs (OIDs), X.500 Distinguished
+   Names (DNs), and reserved words in a programming language.  The
+   mechanisms or conventions used for allocating names and ensuring
+   their uniqueness within their name spaces are beyond the scope of
+   this specification.
+
+   The requirements for these types of UUIDs are as follows:
+
+   o  The UUIDs generated at different times from the same name in the
+      same namespace MUST be equal.
+
+   o  The UUIDs generated from two different names in the same namespace
+      should be different (with very high probability).
+
+   o  The UUIDs generated from the same name in two different namespaces
+      should be different with (very high probability).
+
+   o  If two UUIDs that were generated from names are equal, then they
+      were generated from the same name in the same namespace (with very
+      high probability).
+
+   The algorithm for generating a UUID from a name and a name space are
+   as follows:
+
+   o  Allocate a UUID to use as a "name space ID" for all UUIDs
+      generated from names in that name space; see Appendix C for some
+      pre-defined values.
+
+   o  Choose either MD5 [4] or SHA-1 [8] as the hash algorithm; If
+      backward compatibility is not an issue, SHA-1 is preferred.
+
+
+
+
+Leach, et al.               Standards Track                    [Page 13]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+   o  Convert the name to a canonical sequence of octets (as defined by
+      the standards or conventions of its name space); put the name
+      space ID in network byte order.
+
+   o  Compute the hash of the name space ID concatenated with the name.
+
+   o  Set octets zero through 3 of the time_low field to octets zero
+      through 3 of the hash.
+
+   o  Set octets zero and one of the time_mid field to octets 4 and 5 of
+      the hash.
+
+   o  Set octets zero and one of the time_hi_and_version field to octets
+      6 and 7 of the hash.
+
+   o  Set the four most significant bits (bits 12 through 15) of the
+      time_hi_and_version field to the appropriate 4-bit version number
+      from Section 4.1.3.
+
+   o  Set the clock_seq_hi_and_reserved field to octet 8 of the hash.
+
+   o  Set the two most significant bits (bits 6 and 7) of the
+      clock_seq_hi_and_reserved to zero and one, respectively.
+
+   o  Set the clock_seq_low field to octet 9 of the hash.
+
+   o  Set octets zero through five of the node field to octets 10
+      through 15 of the hash.
+
+   o  Convert the resulting UUID to local byte order.
+
+4.4.  Algorithms for Creating a UUID from Truly Random or
+      Pseudo-Random Numbers
+
+   The version 4 UUID is meant for generating UUIDs from truly-random or
+   pseudo-random numbers.
+
+   The algorithm is as follows:
+
+   o  Set the two most significant bits (bits 6 and 7) of the
+      clock_seq_hi_and_reserved to zero and one, respectively.
+
+   o  Set the four most significant bits (bits 12 through 15) of the
+      time_hi_and_version field to the 4-bit version number from
+      Section 4.1.3.
+
+   o  Set all the other bits to randomly (or pseudo-randomly) chosen
+      values.
+
+
+
+Leach, et al.               Standards Track                    [Page 14]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+   See Section 4.5 for a discussion on random numbers.
+
+4.5.  Node IDs that Do Not Identify the Host
+
+   This section describes how to generate a version 1 UUID if an IEEE
+   802 address is not available, or its use is not desired.
+
+   One approach is to contact the IEEE and get a separate block of
+   addresses.  At the time of writing, the application could be found at
+   <http://standards.ieee.org/regauth/oui/pilot-ind.html>, and the cost
+   was US$550.
+
+   A better solution is to obtain a 47-bit cryptographic quality random
+   number and use it as the low 47 bits of the node ID, with the least
+   significant bit of the first octet of the node ID set to one.  This
+   bit is the unicast/multicast bit, which will never be set in IEEE 802
+   addresses obtained from network cards.  Hence, there can never be a
+   conflict between UUIDs generated by machines with and without network
+   cards.  (Recall that the IEEE 802 spec talks about transmission
+   order, which is the opposite of the in-memory representation that is
+   discussed in this document.)
+
+   For compatibility with earlier specifications, note that this
+   document uses the unicast/multicast bit, instead of the arguably more
+   correct local/global bit.
+
+   Advice on generating cryptographic-quality random numbers can be
+   found in RFC1750 [5].
+
+   In addition, items such as the computer's name and the name of the
+   operating system, while not strictly speaking random, will help
+   differentiate the results from those obtained by other systems.
+
+   The exact algorithm to generate a node ID using these data is system
+   specific, because both the data available and the functions to obtain
+   them are often very system specific.  A generic approach, however, is
+   to accumulate as many sources as possible into a buffer, use a
+   message digest such as MD5 [4] or SHA-1 [8], take an arbitrary 6
+   bytes from the hash value, and set the multicast bit as described
+   above.
+
+5.  Community Considerations
+
+   The use of UUIDs is extremely pervasive in computing.  They comprise
+   the core identifier infrastructure for many operating systems
+   (Microsoft Windows) and applications (the Mozilla browser) and in
+   many cases, become exposed to the Web in many non-standard ways.
+
+
+
+
+Leach, et al.               Standards Track                    [Page 15]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+   This specification attempts to standardize that practice as openly as
+   possible and in a way that attempts to benefit the entire Internet.
+
+6.  Security Considerations
+
+   Do not assume that UUIDs are hard to guess; they should not be used
+   as security capabilities (identifiers whose mere possession grants
+   access), for example.  A predictable random number source will
+   exacerbate the situation.
+
+   Do not assume that it is easy to determine if a UUID has been
+   slightly transposed in order to redirect a reference to another
+   object.  Humans do not have the ability to easily check the integrity
+   of a UUID by simply glancing at it.
+
+   Distributed applications generating UUIDs at a variety of hosts must
+   be willing to rely on the random number source at all hosts.  If this
+   is not feasible, the namespace variant should be used.
+
+7.  Acknowledgments
+
+   This document draws heavily on the OSF DCE specification for UUIDs.
+   Ted Ts'o provided helpful comments, especially on the byte ordering
+   section which we mostly plagiarized from a proposed wording he
+   supplied (all errors in that section are our responsibility,
+   however).
+
+   We are also grateful to the careful reading and bit-twiddling of Ralf
+   S. Engelschall, John Larmouth, and Paul Thorpe.  Professor Larmouth
+   was also invaluable in achieving coordination with ISO/IEC.
+
+8.  Normative References
+
+   [1]  Zahn, L., Dineen, T., and P. Leach, "Network Computing
+        Architecture", ISBN 0-13-611674-4, January 1990.
+
+   [2]  "DCE: Remote Procedure Call", Open Group CAE Specification C309,
+        ISBN 1-85912-041-5, August 1994.
+
+   [3]  ISO/IEC 9834-8:2004 Information Technology, "Procedures for the
+        operation of OSI Registration Authorities: Generation and
+        registration of Universally Unique Identifiers (UUIDs) and their
+        use as ASN.1 Object Identifier components" ITU-T Rec. X.667,
+        2004.
+
+   [4]  Rivest, R., "The MD5 Message-Digest Algorithm ", RFC 1321, April
+        1992.
+
+
+
+
+Leach, et al.               Standards Track                    [Page 16]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+   [5]  Eastlake, D., 3rd, Schiller, J., and S. Crocker, "Randomness
+        Requirements for Security", BCP 106, RFC 4086, June 2005.
+
+   [6]  Moats, R., "URN Syntax", RFC 2141, May 1997.
+
+   [7]  Crocker, D. and P. Overell, "Augmented BNF for Syntax
+        Specifications: ABNF", RFC 2234, November 1997.
+
+   [8]  National Institute of Standards and Technology, "Secure Hash
+        Standard", FIPS PUB 180-1, April 1995,
+        <http://www.itl.nist.gov/fipspubs/fip180-1.htm>.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Leach, et al.               Standards Track                    [Page 17]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+Appendix A.  Appendix A - Sample Implementation
+
+   This implementation consists of 5 files: uuid.h, uuid.c, sysdep.h,
+   sysdep.c and utest.c.  The uuid.* files are the system independent
+   implementation of the UUID generation algorithms described above,
+   with all the optimizations described above except efficient state
+   sharing across processes included.  The code has been tested on Linux
+   (Red Hat 4.0) with GCC (2.7.2), and Windows NT 4.0 with VC++ 5.0.
+   The code assumes 64-bit integer support, which makes it much clearer.
+
+   All the following source files should have the following copyright
+   notice included:
+
+copyrt.h
+
+/*
+** Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
+** Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
+** Digital Equipment Corporation, Maynard, Mass.
+** Copyright (c) 1998 Microsoft.
+** To anyone who acknowledges that this file is provided "AS IS"
+** without any express or implied warranty: permission to use, copy,
+** modify, and distribute this file for any purpose is hereby
+** granted without fee, provided that the above copyright notices and
+** this notice appears in all source code copies, and that none of
+** the names of Open Software Foundation, Inc., Hewlett-Packard
+** Company, Microsoft, or Digital Equipment Corporation be used in
+** advertising or publicity pertaining to distribution of the software
+** without specific, written prior permission. Neither Open Software
+** Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital
+** Equipment Corporation makes any representations about the
+** suitability of this software for any purpose.
+*/
+
+
+uuid.h
+
+#include "copyrt.h"
+#undef uuid_t
+typedef struct {
+    unsigned32  time_low;
+    unsigned16  time_mid;
+    unsigned16  time_hi_and_version;
+    unsigned8   clock_seq_hi_and_reserved;
+    unsigned8   clock_seq_low;
+    byte        node[6];
+} uuid_t;
+
+
+
+
+Leach, et al.               Standards Track                    [Page 18]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+/* uuid_create -- generate a UUID */
+int uuid_create(uuid_t * uuid);
+
+/* uuid_create_md5_from_name -- create a version 3 (MD5) UUID using a
+   "name" from a "name space" */
+void uuid_create_md5_from_name(
+    uuid_t *uuid,         /* resulting UUID */
+    uuid_t nsid,          /* UUID of the namespace */
+    void *name,           /* the name from which to generate a UUID */
+    int namelen           /* the length of the name */
+);
+
+/* uuid_create_sha1_from_name -- create a version 5 (SHA-1) UUID
+   using a "name" from a "name space" */
+void uuid_create_sha1_from_name(
+
+    uuid_t *uuid,         /* resulting UUID */
+    uuid_t nsid,          /* UUID of the namespace */
+    void *name,           /* the name from which to generate a UUID */
+    int namelen           /* the length of the name */
+);
+
+/* uuid_compare --  Compare two UUID's "lexically" and return
+        -1   u1 is lexically before u2
+         0   u1 is equal to u2
+         1   u1 is lexically after u2
+   Note that lexical ordering is not temporal ordering!
+*/
+int uuid_compare(uuid_t *u1, uuid_t *u2);
+
+
+uuid.c
+
+#include "copyrt.h"
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include "sysdep.h"
+#include "uuid.h"
+
+/* various forward declarations */
+static int read_state(unsigned16 *clockseq, uuid_time_t *timestamp,
+    uuid_node_t *node);
+static void write_state(unsigned16 clockseq, uuid_time_t timestamp,
+    uuid_node_t node);
+static void format_uuid_v1(uuid_t *uuid, unsigned16 clockseq,
+    uuid_time_t timestamp, uuid_node_t node);
+
+
+
+Leach, et al.               Standards Track                    [Page 19]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+static void format_uuid_v3or5(uuid_t *uuid, unsigned char hash[16],
+    int v);
+static void get_current_time(uuid_time_t *timestamp);
+static unsigned16 true_random(void);
+
+/* uuid_create -- generator a UUID */
+int uuid_create(uuid_t *uuid)
+{
+     uuid_time_t timestamp, last_time;
+     unsigned16 clockseq;
+     uuid_node_t node;
+     uuid_node_t last_node;
+     int f;
+
+     /* acquire system-wide lock so we're alone */
+     LOCK;
+     /* get time, node ID, saved state from non-volatile storage */
+     get_current_time(&timestamp);
+     get_ieee_node_identifier(&node);
+     f = read_state(&clockseq, &last_time, &last_node);
+
+     /* if no NV state, or if clock went backwards, or node ID
+        changed (e.g., new network card) change clockseq */
+     if (!f || memcmp(&node, &last_node, sizeof node))
+         clockseq = true_random();
+     else if (timestamp < last_time)
+         clockseq++;
+
+     /* save the state for next time */
+     write_state(clockseq, timestamp, node);
+
+     UNLOCK;
+
+     /* stuff fields into the UUID */
+     format_uuid_v1(uuid, clockseq, timestamp, node);
+     return 1;
+}
+
+/* format_uuid_v1 -- make a UUID from the timestamp, clockseq,
+                     and node ID */
+void format_uuid_v1(uuid_t* uuid, unsigned16 clock_seq,
+                    uuid_time_t timestamp, uuid_node_t node)
+{
+    /* Construct a version 1 uuid with the information we've gathered
+       plus a few constants. */
+    uuid->time_low = (unsigned long)(timestamp & 0xFFFFFFFF);
+    uuid->time_mid = (unsigned short)((timestamp >> 32) & 0xFFFF);
+    uuid->time_hi_and_version =
+
+
+
+Leach, et al.               Standards Track                    [Page 20]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+        (unsigned short)((timestamp >> 48) & 0x0FFF);
+    uuid->time_hi_and_version |= (1 << 12);
+    uuid->clock_seq_low = clock_seq & 0xFF;
+    uuid->clock_seq_hi_and_reserved = (clock_seq & 0x3F00) >> 8;
+    uuid->clock_seq_hi_and_reserved |= 0x80;
+    memcpy(&uuid->node, &node, sizeof uuid->node);
+}
+
+/* data type for UUID generator persistent state */
+typedef struct {
+    uuid_time_t  ts;       /* saved timestamp */
+    uuid_node_t  node;     /* saved node ID */
+    unsigned16   cs;       /* saved clock sequence */
+} uuid_state;
+
+static uuid_state st;
+
+/* read_state -- read UUID generator state from non-volatile store */
+int read_state(unsigned16 *clockseq, uuid_time_t *timestamp,
+               uuid_node_t *node)
+{
+    static int inited = 0;
+    FILE *fp;
+
+    /* only need to read state once per boot */
+    if (!inited) {
+        fp = fopen("state", "rb");
+        if (fp == NULL)
+            return 0;
+        fread(&st, sizeof st, 1, fp);
+        fclose(fp);
+        inited = 1;
+    }
+    *clockseq = st.cs;
+    *timestamp = st.ts;
+    *node = st.node;
+    return 1;
+}
+
+/* write_state -- save UUID generator state back to non-volatile
+   storage */
+void write_state(unsigned16 clockseq, uuid_time_t timestamp,
+                 uuid_node_t node)
+{
+    static int inited = 0;
+    static uuid_time_t next_save;
+    FILE* fp;
+
+
+
+
+Leach, et al.               Standards Track                    [Page 21]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+    if (!inited) {
+        next_save = timestamp;
+        inited = 1;
+    }
+
+    /* always save state to volatile shared state */
+    st.cs = clockseq;
+    st.ts = timestamp;
+    st.node = node;
+    if (timestamp >= next_save) {
+        fp = fopen("state", "wb");
+        fwrite(&st, sizeof st, 1, fp);
+        fclose(fp);
+        /* schedule next save for 10 seconds from now */
+        next_save = timestamp + (10 * 10 * 1000 * 1000);
+    }
+}
+
+/* get-current_time -- get time as 60-bit 100ns ticks since UUID epoch.
+   Compensate for the fact that real clock resolution is
+   less than 100ns. */
+void get_current_time(uuid_time_t *timestamp)
+{
+    static int inited = 0;
+    static uuid_time_t time_last;
+    static unsigned16 uuids_this_tick;
+    uuid_time_t time_now;
+
+    if (!inited) {
+        get_system_time(&time_now);
+        uuids_this_tick = UUIDS_PER_TICK;
+        inited = 1;
+    }
+
+    for ( ; ; ) {
+        get_system_time(&time_now);
+
+        /* if clock reading changed since last UUID generated, */
+        if (time_last != time_now) {
+            /* reset count of uuids gen'd with this clock reading */
+            uuids_this_tick = 0;
+            time_last = time_now;
+            break;
+        }
+        if (uuids_this_tick < UUIDS_PER_TICK) {
+            uuids_this_tick++;
+            break;
+        }
+
+
+
+Leach, et al.               Standards Track                    [Page 22]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+        /* going too fast for our clock; spin */
+    }
+    /* add the count of uuids to low order bits of the clock reading */
+    *timestamp = time_now + uuids_this_tick;
+}
+
+/* true_random -- generate a crypto-quality random number.
+   **This sample doesn't do that.** */
+static unsigned16 true_random(void)
+{
+    static int inited = 0;
+    uuid_time_t time_now;
+
+    if (!inited) {
+        get_system_time(&time_now);
+        time_now = time_now / UUIDS_PER_TICK;
+        srand((unsigned int)
+               (((time_now >> 32) ^ time_now) & 0xffffffff));
+        inited = 1;
+    }
+
+    return rand();
+}
+
+/* uuid_create_md5_from_name -- create a version 3 (MD5) UUID using a
+   "name" from a "name space" */
+void uuid_create_md5_from_name(uuid_t *uuid, uuid_t nsid, void *name,
+                               int namelen)
+{
+    MD5_CTX c;
+    unsigned char hash[16];
+    uuid_t net_nsid;
+
+    /* put name space ID in network byte order so it hashes the same
+       no matter what endian machine we're on */
+    net_nsid = nsid;
+    net_nsid.time_low = htonl(net_nsid.time_low);
+    net_nsid.time_mid = htons(net_nsid.time_mid);
+    net_nsid.time_hi_and_version = htons(net_nsid.time_hi_and_version);
+
+    MD5Init(&c);
+    MD5Update(&c, &net_nsid, sizeof net_nsid);
+    MD5Update(&c, name, namelen);
+    MD5Final(hash, &c);
+
+    /* the hash is in network byte order at this point */
+    format_uuid_v3or5(uuid, hash, 3);
+}
+
+
+
+Leach, et al.               Standards Track                    [Page 23]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+void uuid_create_sha1_from_name(uuid_t *uuid, uuid_t nsid, void *name,
+                                int namelen)
+{
+    SHA_CTX c;
+    unsigned char hash[20];
+    uuid_t net_nsid;
+
+    /* put name space ID in network byte order so it hashes the same
+       no matter what endian machine we're on */
+    net_nsid = nsid;
+    net_nsid.time_low = htonl(net_nsid.time_low);
+    net_nsid.time_mid = htons(net_nsid.time_mid);
+    net_nsid.time_hi_and_version = htons(net_nsid.time_hi_and_version);
+
+    SHA1_Init(&c);
+    SHA1_Update(&c, &net_nsid, sizeof net_nsid);
+    SHA1_Update(&c, name, namelen);
+    SHA1_Final(hash, &c);
+
+    /* the hash is in network byte order at this point */
+    format_uuid_v3or5(uuid, hash, 5);
+}
+
+/* format_uuid_v3or5 -- make a UUID from a (pseudo)random 128-bit
+   number */
+void format_uuid_v3or5(uuid_t *uuid, unsigned char hash[16], int v)
+{
+    /* convert UUID to local byte order */
+    memcpy(uuid, hash, sizeof *uuid);
+    uuid->time_low = ntohl(uuid->time_low);
+    uuid->time_mid = ntohs(uuid->time_mid);
+    uuid->time_hi_and_version = ntohs(uuid->time_hi_and_version);
+
+    /* put in the variant and version bits */
+    uuid->time_hi_and_version &= 0x0FFF;
+    uuid->time_hi_and_version |= (v << 12);
+    uuid->clock_seq_hi_and_reserved &= 0x3F;
+    uuid->clock_seq_hi_and_reserved |= 0x80;
+}
+
+/* uuid_compare --  Compare two UUID's "lexically" and return */
+#define CHECK(f1, f2) if (f1 != f2) return f1 < f2 ? -1 : 1;
+int uuid_compare(uuid_t *u1, uuid_t *u2)
+{
+    int i;
+
+    CHECK(u1->time_low, u2->time_low);
+    CHECK(u1->time_mid, u2->time_mid);
+
+
+
+Leach, et al.               Standards Track                    [Page 24]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+    CHECK(u1->time_hi_and_version, u2->time_hi_and_version);
+    CHECK(u1->clock_seq_hi_and_reserved, u2->clock_seq_hi_and_reserved);
+    CHECK(u1->clock_seq_low, u2->clock_seq_low)
+    for (i = 0; i < 6; i++) {
+        if (u1->node[i] < u2->node[i])
+            return -1;
+        if (u1->node[i] > u2->node[i])
+            return 1;
+    }
+    return 0;
+}
+#undef CHECK
+
+
+sysdep.h
+
+#include "copyrt.h"
+/* remove the following define if you aren't running WIN32 */
+#define WININC 0
+
+#ifdef WININC
+#include <windows.h>
+#else
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/sysinfo.h>
+#endif
+
+#include "global.h"
+/* change to point to where MD5 .h's live; RFC 1321 has sample
+   implementation */
+#include "md5.h"
+
+/* set the following to the number of 100ns ticks of the actual
+   resolution of your system's clock */
+#define UUIDS_PER_TICK 1024
+
+/* Set the following to a calls to get and release a global lock */
+#define LOCK
+#define UNLOCK
+
+typedef unsigned long   unsigned32;
+typedef unsigned short  unsigned16;
+typedef unsigned char   unsigned8;
+typedef unsigned char   byte;
+
+/* Set this to what your compiler uses for 64-bit data type */
+#ifdef WININC
+
+
+
+Leach, et al.               Standards Track                    [Page 25]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+#define unsigned64_t unsigned __int64
+#define I64(C) C
+#else
+#define unsigned64_t unsigned long long
+#define I64(C) C##LL
+#endif
+
+typedef unsigned64_t uuid_time_t;
+typedef struct {
+    char nodeID[6];
+} uuid_node_t;
+
+void get_ieee_node_identifier(uuid_node_t *node);
+void get_system_time(uuid_time_t *uuid_time);
+void get_random_info(char seed[16]);
+
+
+sysdep.c
+
+#include "copyrt.h"
+#include <stdio.h>
+#include "sysdep.h"
+
+/* system dependent call to get IEEE node ID.
+   This sample implementation generates a random node ID. */
+void get_ieee_node_identifier(uuid_node_t *node)
+{
+    static inited = 0;
+    static uuid_node_t saved_node;
+    char seed[16];
+    FILE *fp;
+
+    if (!inited) {
+        fp = fopen("nodeid", "rb");
+        if (fp) {
+            fread(&saved_node, sizeof saved_node, 1, fp);
+            fclose(fp);
+        }
+        else {
+            get_random_info(seed);
+            seed[0] |= 0x01;
+            memcpy(&saved_node, seed, sizeof saved_node);
+            fp = fopen("nodeid", "wb");
+            if (fp) {
+                fwrite(&saved_node, sizeof saved_node, 1, fp);
+                fclose(fp);
+            }
+        }
+
+
+
+Leach, et al.               Standards Track                    [Page 26]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+        inited = 1;
+    }
+
+    *node = saved_node;
+}
+
+/* system dependent call to get the current system time. Returned as
+   100ns ticks since UUID epoch, but resolution may be less than
+   100ns. */
+#ifdef _WINDOWS_
+
+void get_system_time(uuid_time_t *uuid_time)
+{
+    ULARGE_INTEGER time;
+
+    /* NT keeps time in FILETIME format which is 100ns ticks since
+       Jan 1, 1601. UUIDs use time in 100ns ticks since Oct 15, 1582.
+       The difference is 17 Days in Oct + 30 (Nov) + 31 (Dec)
+       + 18 years and 5 leap days. */
+    GetSystemTimeAsFileTime((FILETIME *)&time);
+    time.QuadPart +=
+
+          (unsigned __int64) (1000*1000*10)       // seconds
+        * (unsigned __int64) (60 * 60 * 24)       // days
+        * (unsigned __int64) (17+30+31+365*18+5); // # of days
+    *uuid_time = time.QuadPart;
+}
+
+/* Sample code, not for use in production; see RFC 1750 */
+void get_random_info(char seed[16])
+{
+    MD5_CTX c;
+    struct {
+        MEMORYSTATUS m;
+        SYSTEM_INFO s;
+        FILETIME t;
+        LARGE_INTEGER pc;
+        DWORD tc;
+        DWORD l;
+        char hostname[MAX_COMPUTERNAME_LENGTH + 1];
+    } r;
+
+    MD5Init(&c);
+    GlobalMemoryStatus(&r.m);
+    GetSystemInfo(&r.s);
+    GetSystemTimeAsFileTime(&r.t);
+    QueryPerformanceCounter(&r.pc);
+    r.tc = GetTickCount();
+
+
+
+Leach, et al.               Standards Track                    [Page 27]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+    r.l = MAX_COMPUTERNAME_LENGTH + 1;
+    GetComputerName(r.hostname, &r.l);
+    MD5Update(&c, &r, sizeof r);
+    MD5Final(seed, &c);
+}
+
+#else
+
+void get_system_time(uuid_time_t *uuid_time)
+{
+    struct timeval tp;
+
+    gettimeofday(&tp, (struct timezone *)0);
+
+    /* Offset between UUID formatted times and Unix formatted times.
+       UUID UTC base time is October 15, 1582.
+       Unix base time is January 1, 1970.*/
+    *uuid_time = ((unsigned64)tp.tv_sec * 10000000)
+        + ((unsigned64)tp.tv_usec * 10)
+        + I64(0x01B21DD213814000);
+}
+
+/* Sample code, not for use in production; see RFC 1750 */
+void get_random_info(char seed[16])
+{
+    MD5_CTX c;
+    struct {
+        struct sysinfo s;
+        struct timeval t;
+        char hostname[257];
+    } r;
+
+    MD5Init(&c);
+    sysinfo(&r.s);
+    gettimeofday(&r.t, (struct timezone *)0);
+    gethostname(r.hostname, 256);
+    MD5Update(&c, &r, sizeof r);
+    MD5Final(seed, &c);
+}
+
+#endif
+
+utest.c
+
+#include "copyrt.h"
+#include "sysdep.h"
+#include <stdio.h>
+#include "uuid.h"
+
+
+
+Leach, et al.               Standards Track                    [Page 28]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+uuid_t NameSpace_DNS = { /* 6ba7b810-9dad-11d1-80b4-00c04fd430c8 */
+    0x6ba7b810,
+    0x9dad,
+    0x11d1,
+    0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8
+};
+
+/* puid -- print a UUID */
+void puid(uuid_t u)
+{
+    int i;
+
+    printf("%8.8x-%4.4x-%4.4x-%2.2x%2.2x-", u.time_low, u.time_mid,
+    u.time_hi_and_version, u.clock_seq_hi_and_reserved,
+    u.clock_seq_low);
+    for (i = 0; i < 6; i++)
+        printf("%2.2x", u.node[i]);
+    printf("\n");
+}
+
+/* Simple driver for UUID generator */
+void main(int argc, char **argv)
+{
+    uuid_t u;
+    int f;
+
+    uuid_create(&u);
+    printf("uuid_create(): "); puid(u);
+
+    f = uuid_compare(&u, &u);
+    printf("uuid_compare(u,u): %d\n", f);     /* should be 0 */
+    f = uuid_compare(&u, &NameSpace_DNS);
+    printf("uuid_compare(u, NameSpace_DNS): %d\n", f); /* s.b. 1 */
+    f = uuid_compare(&NameSpace_DNS, &u);
+    printf("uuid_compare(NameSpace_DNS, u): %d\n", f); /* s.b. -1 */
+    uuid_create_md5_from_name(&u, NameSpace_DNS, "www.widgets.com", 15);
+    printf("uuid_create_md5_from_name(): "); puid(u);
+}
+
+Appendix B.  Appendix B - Sample Output of utest
+
+     uuid_create(): 7d444840-9dc0-11d1-b245-5ffdce74fad2
+     uuid_compare(u,u): 0
+     uuid_compare(u, NameSpace_DNS): 1
+     uuid_compare(NameSpace_DNS, u): -1
+     uuid_create_md5_from_name(): e902893a-9d22-3c7e-a7b8-d6e313b71d9f
+
+
+
+
+
+Leach, et al.               Standards Track                    [Page 29]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+Appendix C.  Appendix C - Some Name Space IDs
+
+   This appendix lists the name space IDs for some potentially
+   interesting name spaces, as initialized C structures and in the
+   string representation defined above.
+
+   /* Name string is a fully-qualified domain name */
+   uuid_t NameSpace_DNS = { /* 6ba7b810-9dad-11d1-80b4-00c04fd430c8 */
+       0x6ba7b810,
+       0x9dad,
+       0x11d1,
+       0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8
+   };
+
+   /* Name string is a URL */
+   uuid_t NameSpace_URL = { /* 6ba7b811-9dad-11d1-80b4-00c04fd430c8 */
+       0x6ba7b811,
+       0x9dad,
+       0x11d1,
+       0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8
+   };
+
+   /* Name string is an ISO OID */
+   uuid_t NameSpace_OID = { /* 6ba7b812-9dad-11d1-80b4-00c04fd430c8 */
+       0x6ba7b812,
+       0x9dad,
+       0x11d1,
+       0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8
+   };
+
+   /* Name string is an X.500 DN (in DER or a text output format) */
+   uuid_t NameSpace_X500 = { /* 6ba7b814-9dad-11d1-80b4-00c04fd430c8 */
+       0x6ba7b814,
+       0x9dad,
+       0x11d1,
+       0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8
+   };
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Leach, et al.               Standards Track                    [Page 30]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+Authors' Addresses
+
+   Paul J. Leach
+   Microsoft
+   1 Microsoft Way
+   Redmond, WA  98052
+   US
+
+   Phone: +1 425-882-8080
+   EMail: paulle@microsoft.com
+
+
+   Michael Mealling
+   Refactored Networks, LLC
+   1635 Old Hwy 41
+   Suite 112, Box 138
+   Kennesaw, GA 30152
+   US
+
+   Phone: +1-678-581-9656
+   EMail: michael@refactored-networks.com
+   URI: http://www.refactored-networks.com
+
+
+   Rich Salz
+   DataPower Technology, Inc.
+   1 Alewife Center
+   Cambridge, MA  02142
+   US
+
+   Phone: +1 617-864-0455
+   EMail: rsalz@datapower.com
+   URI:   http://www.datapower.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Leach, et al.               Standards Track                    [Page 31]
+\f
+RFC 4122                  A UUID URN Namespace                 July 2005
+
+
+Full Copyright Statement
+
+   Copyright (C) The Internet Society (2005).
+
+   This document is subject to the rights, licenses and restrictions
+   contained in BCP 78, and except as set forth therein, the authors
+   retain all their rights.
+
+   This document and the information contained herein are provided on an
+   "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
+   OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
+   ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
+   INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
+   INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
+   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+Intellectual Property
+
+   The IETF takes no position regarding the validity or scope of any
+   Intellectual Property Rights or other rights that might be claimed to
+   pertain to the implementation or use of the technology described in
+   this document or the extent to which any license under such rights
+   might or might not be available; nor does it represent that it has
+   made any independent effort to identify any such rights.  Information
+   on the procedures with respect to rights in RFC documents can be
+   found in BCP 78 and BCP 79.
+
+   Copies of IPR disclosures made to the IETF Secretariat and any
+   assurances of licenses to be made available, or the result of an
+   attempt made to obtain a general license or permission for the use of
+   such proprietary rights by implementers or users of this
+   specification can be obtained from the IETF on-line IPR repository at
+   http://www.ietf.org/ipr.
+
+   The IETF invites any interested party to bring to its attention any
+   copyrights, patents or patent applications, or other proprietary
+   rights that may cover technology that may be required to implement
+   this standard.  Please address the information to the IETF at ietf-
+   ipr@ietf.org.
+
+Acknowledgement
+
+   Funding for the RFC Editor function is currently provided by the
+   Internet Society.
+
+
+
+
+
+
+
+Leach, et al.               Standards Track                    [Page 32]
+\f
diff --git a/standards/wake-on-lan.pdf b/standards/wake-on-lan.pdf
new file mode 100644 (file)
index 0000000..07d97f4
Binary files /dev/null and b/standards/wake-on-lan.pdf differ
index 5720469f602be01af3e108cc89b003535f8e8ef4..daf44608a5c4b0f039f651b670bc93b314074313 100644 (file)
@@ -43,7 +43,7 @@ all:  $(TARGETS)
 #
 
 clean:
-       $(RM) $(OBJS) $(TARGETS) disable enable reject
+       $(RM) $(OBJS) $(TARGETS) cupsdisable cupsenable reject
 
 
 #
@@ -87,10 +87,10 @@ install:    all
 accept:        accept.o ../cups/$(LIBCUPS)
        echo Linking $@...
        $(CC) $(LDFLAGS) -o accept accept.o $(LIBS)
-       $(RM) reject enable disable
+       $(RM) reject cupsenable cupsdisable
        $(LN) accept reject
-       $(LN) accept enable
-       $(LN) accept disable
+       $(LN) accept cupsenable
+       $(LN) accept cupsdisable
 
 
 #
index 497e0b9ad90c084657d5c8a4c535ea1e5a0deb19..47aab6a261b38c7f2fecdd07421d4faa7c5f8541 100644 (file)
@@ -120,7 +120,7 @@ install: all
        for lang in $(LANGUAGES); do \
                $(INSTALL_DIR) -m 755 $(DATADIR)/templates/$$lang; \
                for file in $(FILES); do \
-                       if test -e $$lang/$$file; then \
+                       if test -f $$lang/$$file; then \
                                $(INSTALL_DATA) $$lang/$$file $(DATADIR)/templates/$$lang; \
                        fi \
                done \
index 7ca5da79515b8f4d566413be637e612615107822..775938cf61a640cc618696ef59e4a6a80d198ad5 100644 (file)
@@ -22,6 +22,9 @@ function reset_config()
 "BrowseAllow @LOCAL\\n" +
 "\\n" +
 "\\n" +
+"# Authenticate against system accounts by default...\\n" +
+"DefaultAuthType Basic\\n" +
+"\\n" +
 "# Restrict access to the server...\\n" +
 "<Location />\\n" +
 "  Order allow,deny\\n" +
@@ -42,9 +45,6 @@ function reset_config()
 "  Allow localhost\\n" +
 "</Location>\\n" +
 "\\n" +
-"# Authenticate against system accounts by default...\\n" +
-"DefaultAuthType Basic\\n" +
-"\\n" +
 "# Set the default printer/job policies...\\n" +
 "<Policy default>\\n" +
 "  # Job-related operations must be done by the owner or an adminstrator...\\n" +