]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Merge changes from CUPS 1.7b1-r10947.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 9 Apr 2013 20:10:23 +0000 (20:10 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 9 Apr 2013 20:10:23 +0000 (20:10 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@4274 a1ca3aef-8c08-0410-bb20-df032aa958be

57 files changed:
CHANGES-1.6.txt
CHANGES.txt
INSTALL.txt
README.txt
backend/ipp.c
backend/usb-darwin.c
backend/usb-libusb.c
config-scripts/cups-common.m4
config-scripts/cups-directories.m4
config.h.in
cups/Makefile
cups/auth.c
cups/cups-private.h
cups/cups.h
cups/dest-job.c
cups/dest-options.c
cups/dest.c
cups/http-addr.c
cups/http-addrlist.c
cups/http-support.c
cups/http.c
cups/ipp-support.c
cups/ipp.c
cups/ipp.h
cups/ppd-cache.c
cups/ppd-private.h
cups/pwg-media.c
cups/pwg-private.h
cups/pwg.h [new file with mode: 0644]
cups/request.c
cups/testhttp.c
cups/testpwg.c
cups/usersys.c
doc/help/api-cups.html
doc/help/api-httpipp.html
doc/help/whatsnew.html
locale/cups.pot
locale/cups.strings
locale/cups_ca.po
locale/cups_es.po
locale/cups_fr.po
locale/cups_ja.po
locale/cups_ru.po
scheduler/Makefile
scheduler/auth.c
scheduler/client.c
scheduler/conf.c
scheduler/cups-exec.c
scheduler/cupsfilter.c
scheduler/ipp.c
scheduler/job.c
scheduler/printers.c
systemv/cupstestppd.c
test/Makefile
test/ipptool.c
test/validate-job.test [new file with mode: 0644]
xcode/CUPS.xcodeproj/project.pbxproj

index f0794e2b68130f1416d76448d3a0540aea33e848..6d94e5e03c0b87947597d096a8fcf850a4ac7c26 100644 (file)
@@ -1,6 +1,24 @@
 CHANGES-1.6.txt
 ---------------
 
+CHANGES IN CUPS V1.6.3
+
+       - The configure script now prefers Clang over GCC.
+       - Fixed a compile problem on AIX (STR #4307)
+       - The Russian web interface templates were broken (STR #4310)
+       - The scheduler no longer tries to do Kerberos authentication over the
+         loopback interface.
+       - The IPP backend could fail to pause a job for authentication
+         (STR #4298)
+       - Fixed a regression on the handling of auth keys on OS X if the
+         cups-files.conf was not present or did not contain a SystemAuthKey
+         value.
+       - The scheduler incorrectly did a reverse lookup of the server address
+         when HostNameLookups was turned off (STR #4302)
+       - The scheduler incorrectly computed the final content type value when
+         null filters were present.
+
+
 CHANGES IN CUPS V1.6.2
 
        - Documentation fixes (STR #4229, STR #4239, STR #4234, STR #4248,
@@ -12,6 +30,9 @@ CHANGES IN CUPS V1.6.2
        - Added a French localization (STR #4247)
        - Added a Russian localization (STR #4228, STR #4285)
        - Updated the Catalan localization (STR #4202)
+       - Local certificate authentication did not guard against an empty
+         certification file (STR #4293)
+       - The scheduler did not reject device URIs with spaces.
        - Added USB quirk rule for Epson Stylus Photo 750 (STR #4286)
        - The IPP backend could crash if the printer disconnects early
          (STR #4284)
@@ -47,7 +68,7 @@ CHANGES IN CUPS V1.6.2
        - The scheduler incorrectly advertised auth-info-required for local
          queues needing local authentication (STR #4205)
        - CUPS 1.6 clients using the ServerName directive in client.conf did not
-         work with CUPS 1.3.x or older servers (STR #4231)
+         work with CUPS 1.3.x or older servers (STR #4231, STR #4291)
        - The SNMP backend now tries to work around broken printers that use a
          newline to separate key/value pairs.
        - The IPP backend did not send a cancel request to printers when a job
index 40b67344c9e5b0aa9598a37b63f7d90ed229f232..f85fc21ce0984249a0057653828d4e545a78f61d 100644 (file)
@@ -1,9 +1,24 @@
-CHANGES.txt - 1.7b1 - 2013-01-30
+CHANGES.txt - 1.7b1 - 2013-04-09
 --------------------------------
 
 CHANGES IN CUPS V1.7b1
 
+       - The configure script now supports a --with-rundir option to change
+         the transient run-time state directory from the default to other
+         locations like /run/cups (STR #4306)
+       - The scheduler now supports PPD lookups for classes (STR #4296)
+       - The cupsfilter program did not set the FINAL_CONTENT_TYPE
+         environment variable for filters.
        - Added a new "-x" option to the cancel command (STR #4103)
+       - Made the PWG media handling APIs public (STR #4267)
+       - Implemented ready media support for the cupsGetDestMediaXxx APIs
+         (STR #4289)
+       - Added new cupsFindDestDefault, cupsFindDestReady, and
+         cupsFindDestSupported APIs (STR #4289)
+       - Added new cupsGetDestMediaByIndex, cupsGetDestMediaCount, and
+         cupsGetDestMediaDefault APIs (STR #4289)
+       - Added new ippGet/SetOctetString APIs for getting and setting an
+         octetString value (STR #4289)
        - Added new ippCreateRequestedArray API for generating a array of
          attributes from the requested-attributes attribute.
        - The ipptool utility now supports compression, conditional tests based
index e5081eace8b0bc67804888a267ee9ae6a5b85b55..1295bbc297b18d014554f127e6747233e46c4414 100644 (file)
@@ -1,4 +1,4 @@
-INSTALL - CUPS v1.7b1 - 2013-01-11
+INSTALL - CUPS v1.7b1 - 2013-04-09
 ----------------------------------
 
 This file describes how to compile and install CUPS from source code. For more
@@ -29,18 +29,16 @@ BEFORE YOU BEGIN
     Compaq, HP, SGI, and Sun.  BSD users should use GNU make (gmake) since BSD
     make does not support "include".
 
-    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, the OpenLDAP and OpenSLP libraries for directory services support,
-    and either MIT (1.6.3 or higher) or Heimdal Kerberos for Kerberos support.
-    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 does not include the Ghostscript-based
-    PostScript filter needed by non-PostScript printers.  You *must* download
-    GPL Ghostscript separately from the CUPS web site if you want to print
-    PostScript files to non-PostScript printers on operating systems other than
-    OS X.
+    Besides these tools you'll want ZLIB library for compression support, the
+    CDSA, GNU TLS, or OpenSSL libraries for encryption support, and either MIT
+    (1.6.3 or higher) or Heimdal Kerberos for Kerberos support.  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 does not include print filters to support PDF
+    or raster printing.  You *must* download GPL Ghostscript and/or the Open
+    Printing CUPS filters package separately to print on operating systems
+    other than OS X.
 
 
 COMPILING THE SUBVERSION REPOSITORY CODE
index 824d286f47f479623478bdae85ffddd45e4e7a6b..4792fe5ad372b877b1367cd22870d838f7af7193 100644 (file)
@@ -1,4 +1,4 @@
-README - CUPS v1.7b1 - 2013-01-11
+README - CUPS v1.7b1 - 2013-04-09
 ---------------------------------
 
 ************************************************
index c9f7305b90ed6f696638ce330a4a13c03c8d20a1..85029a69b611ab572f6da477606eacdb339dd698 100644 (file)
@@ -115,8 +115,6 @@ static char         username[256] = "",
                                        /* Username for device URI */
                        *password = NULL;
                                        /* Password for device URI */
-static int             password_tries = 0;
-                                       /* Password tries */
 static const char * const pattrs[] =   /* Printer attributes we want */
 {
 #ifdef HAVE_LIBZ
@@ -185,7 +183,7 @@ static ipp_t                *new_request(ipp_op_t op, int version, const char *uri,
                                     int print_color_mode);
 static const char      *password_cb(const char *prompt, http_t *http,
                                     const char *method, const char *resource,
-                                    void *user_data);
+                                    int *user_data);
 static const char      *quote_string(const char *s, char *q, size_t qsize);
 static void            report_attr(ipp_attribute_t *attr);
 static void            report_printer_state(ipp_t *ipp);
@@ -223,6 +221,7 @@ main(int  argc,                             /* I - Number of command-line args */
                *name,                  /* Name of option */
                *value,                 /* Value of option */
                sep;                    /* Separator character */
+  int          password_tries = 0;     /* Password tries */
   http_addrlist_t *addrlist;           /* Address of printer */
   int          snmp_enabled = 1;       /* Is SNMP enabled? */
   int          snmp_fd,                /* SNMP socket */
@@ -635,7 +634,7 @@ main(int  argc,                             /* I - Number of command-line args */
   * Set the authentication info, if any...
   */
 
-  cupsSetPasswordCB2(password_cb, NULL);
+  cupsSetPasswordCB2((cups_password_cb2_t)password_cb, &password_tries);
 
   if (username[0])
   {
@@ -1603,6 +1602,7 @@ main(int  argc,                           /* I - Number of command-line args */
       }
       else if (ipp_status == IPP_STATUS_ERROR_JOB_CANCELED ||
                ipp_status == IPP_STATUS_ERROR_NOT_AUTHORIZED ||
+               ipp_status == IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES ||
               ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_INFO_NEEDED ||
               ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_CLOSED ||
               ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_LIMIT_REACHED ||
@@ -1887,6 +1887,9 @@ main(int  argc,                           /* I - Number of command-line args */
 
       check_printer_state(http, uri, resource, argv[2], version);
 
+      if (cupsLastError() <= IPP_OK_CONFLICT)
+        password_tries = 0;
+
      /*
       * Build an IPP_GET_JOB_ATTRIBUTES request...
       */
@@ -2037,6 +2040,9 @@ main(int  argc,                           /* I - Number of command-line args */
 
   check_printer_state(http, uri, resource, argv[2], version);
 
+  if (cupsLastError() <= IPP_OK_CONFLICT)
+    password_tries = 0;
+
  /*
   * Collect the final page count as needed...
   */
@@ -2096,17 +2102,19 @@ main(int  argc,                         /* I - Number of command-line args */
     fputs("JOBSTATE: account-authorization-failed\n", stderr);
 
   if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN ||
-      ipp_status == IPP_AUTHENTICATION_CANCELED ||
-      ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_INFO_NEEDED ||
-      ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_CLOSED ||
-      ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_LIMIT_REACHED ||
-      ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_AUTHORIZATION_FAILED)
+      ipp_status == IPP_AUTHENTICATION_CANCELED)
     return (CUPS_BACKEND_AUTH_REQUIRED);
+  else if (ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_LIMIT_REACHED ||
+          ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_INFO_NEEDED ||
+          ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_CLOSED ||
+          ipp_status == IPP_STATUS_ERROR_CUPS_ACCOUNT_AUTHORIZATION_FAILED)
+    return (CUPS_BACKEND_HOLD);
   else if (ipp_status == IPP_INTERNAL_ERROR)
     return (CUPS_BACKEND_STOP);
   else if (ipp_status == IPP_CONFLICT)
     return (CUPS_BACKEND_FAILED);
   else if (ipp_status == IPP_REQUEST_VALUE ||
+          ipp_status == IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES ||
            ipp_status == IPP_DOCUMENT_FORMAT || job_canceled < 0)
   {
     if (ipp_status == IPP_REQUEST_VALUE)
@@ -2114,6 +2122,9 @@ main(int  argc,                           /* I - Number of command-line args */
     else if (ipp_status == IPP_DOCUMENT_FORMAT)
       _cupsLangPrintFilter(stderr, "ERROR",
                            _("Printer cannot print supplied content."));
+    else if (ipp_status == IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES)
+      _cupsLangPrintFilter(stderr, "ERROR",
+                           _("Printer cannot print with supplied options."));
     else
       _cupsLangPrintFilter(stderr, "ERROR", _("Print job canceled at printer."));
 
@@ -2218,9 +2229,6 @@ check_printer_state(
   fprintf(stderr, "DEBUG: Get-Printer-Attributes: %s (%s)\n",
          ippErrorString(cupsLastError()), cupsLastErrorString());
 
-  if (cupsLastError() <= IPP_OK_CONFLICT)
-    password_tries = 0;
-
  /*
   * Return the printer-state value...
   */
@@ -2248,6 +2256,7 @@ monitor_printer(
   const char   *job_name;              /* Job name */
   ipp_jstate_t job_state;              /* Job state */
   const char   *job_user;              /* Job originating user name */
+  int          password_tries = 0;     /* Password tries */
 
 
  /*
@@ -2259,7 +2268,8 @@ monitor_printer(
   httpSetTimeout(http, 30.0, timeout_cb, NULL);
   if (username[0])
     cupsSetUser(username);
-  cupsSetPasswordCB2(password_cb, NULL);
+
+  cupsSetPasswordCB2((cups_password_cb2_t)password_cb, &password_tries);
 
  /*
   * Loop until the job is canceled, aborted, or completed.
@@ -2285,6 +2295,8 @@ monitor_printer(
                                                    monitor->resource,
                                                   monitor->user,
                                                   monitor->version);
+      if (cupsLastError() <= IPP_OK_CONFLICT)
+        password_tries = 0;
 
      /*
       * Check the status of the job itself...
@@ -2595,7 +2607,7 @@ new_request(
         ippAddString(request, IPP_TAG_JOB, IPP_TAG_NAME, "job-account-id",
                      NULL, keyword);
 
-      if (pc->account_id &&
+      if (pc->accounting_user_id &&
           (keyword = cupsGetOption("job-accounting-user-id", num_options,
                                    options)) != NULL)
         ippAddString(request, IPP_TAG_JOB, IPP_TAG_NAME,
@@ -2927,18 +2939,19 @@ password_cb(const char *prompt,         /* I - Prompt (not used) */
             http_t     *http,          /* I - Connection */
             const char *method,                /* I - Request method (not used) */
             const char *resource,      /* I - Resource path (not used) */
-            void       *user_data)     /* I - User data (not used) */
+            int        *password_tries)        /* I - Password tries */
 {
   char def_username[HTTP_MAX_VALUE];   /* Default username */
 
 
-  fprintf(stderr, "DEBUG: password_cb(prompt=\"%s\"), password=%p, "
-          "password_tries=%d\n", prompt, password, password_tries);
+  fprintf(stderr, "DEBUG: password_cb(prompt=\"%s\", http=%p, method=\"%s\", "
+                  "resource=\"%s\", password_tries=%p(%d)), password=%p\n",
+          prompt, http, method, resource, password_tries, *password_tries,
+          password);
 
   (void)prompt;
   (void)method;
   (void)resource;
-  (void)user_data;
 
  /*
   * Remember that we need to authenticate...
@@ -2956,9 +2969,9 @@ password_cb(const char *prompt,           /* I - Prompt (not used) */
             quote_string(def_username, quoted, sizeof(quoted)));
   }
 
-  if (password && *password && password_tries < 3)
+  if (password && *password && *password_tries < 3)
   {
-    password_tries ++;
+    (*password_tries) ++;
 
     return (password);
   }
index 509bb89f0082a4ee8372cb6d1557ec768846d20c..2b423c2a44d16eec2a949c944fe539d9540e46f4 100644 (file)
@@ -1603,11 +1603,12 @@ static kern_return_t registry_close(void)
 static OSStatus copy_deviceid(classdriver_t **classdriver,
                              CFStringRef *deviceID)
 {
-  CFStringRef devID = NULL,
-
-  deviceMake = NULL,
-  deviceModel = NULL,
-  deviceSerial = NULL;
+  CFStringRef devID = NULL;
+  CFStringRef deviceMake = NULL;
+  CFStringRef deviceModel = NULL;
+  CFStringRef deviceSerial = NULL;
+  
+  *deviceID = NULL;
 
   OSStatus err = (*classdriver)->GetDeviceID(classdriver, &devID, DEFAULT_TIMEOUT);
 
@@ -1653,12 +1654,10 @@ static OSStatus copy_deviceid(classdriver_t **classdriver,
 
       if (deviceSerial == NULL && desc.iSerialNumber != 0)
       {
-       CFStringRef data = NULL;
-       err = (*classdriver)->GetString(classdriver, desc.iSerialNumber, kUSBLanguageEnglish, DEFAULT_TIMEOUT, &data);
-       if (data != NULL)
+       err = (*classdriver)->GetString(classdriver, desc.iSerialNumber, kUSBLanguageEnglish, DEFAULT_TIMEOUT, &deviceSerial);
+       if (deviceSerial != NULL)
        {
-         CFStringAppendFormat(newDevID, NULL, CFSTR("SERN:%@;"), data);
-         CFRelease(data);
+         CFStringAppendFormat(newDevID, NULL, CFSTR("SERN:%@;"), deviceSerial);
        }
       }
 
@@ -1675,6 +1674,21 @@ static OSStatus copy_deviceid(classdriver_t **classdriver,
   {
     *deviceID = devID;
   }
+
+  if (*deviceID == NULL)
+      return err;
+
+  /* Remove special characters from the serial number */
+  CFRange range = (deviceSerial != NULL ? CFStringFind(deviceSerial, CFSTR("+"), 0) : CFRangeMake(0, 0));
+  if (range.length == 1) {
+      range = CFStringFind(*deviceID, deviceSerial, 0);
+      
+      CFMutableStringRef deviceIDString = CFStringCreateMutableCopy(NULL, 0, *deviceID);
+      CFStringFindAndReplace(deviceIDString, CFSTR("+"), CFSTR(""), range, 0);
+      CFRelease(*deviceID);
+      *deviceID = deviceIDString;
+  }
+  
   release_deviceinfo(&deviceMake, &deviceModel, &deviceSerial);
 
   return err;
index 44e71e7b77325e9d67807b2d21b403d776b21a64..4c71e6586cc36d3e05fa207c8d5c1da893b05e11 100644 (file)
@@ -122,7 +122,7 @@ struct quirk_printer_struct {
 #define USBLP_QUIRK_USB_INIT   0x2     /* needs vendor USB init string */
 #define USBLP_QUIRK_BAD_CLASS  0x4     /* descriptor uses vendor-specific
                                           Class or SubClass */
-#define USBLP_QUICK_BLACKLIST  0x8     /* these printers do not conform to the USB print spec */
+#define USBLP_QUIRK_BLACKLIST  0x8     /* these printers do not conform to the USB print spec */
 #define USBLP_QUIRK_RESET      0x4000  /* After printing do a reset
                                           for clean-up */
 #define USBLP_QUIRK_NO_REATTACH        0x8000  /* After printing we cannot re-attach
index fbc5de72a3c946b495555aabf57c17192cf48625..6a30e4809f2275b363e1cebc5b91e0f95a36893f 100644 (file)
@@ -20,11 +20,11 @@ dnl Set the name of the config header file...
 AC_CONFIG_HEADER(config.h)
 
 dnl Version number information...
-CUPS_VERSION="1.7svn"
+CUPS_VERSION="1.7b1"
 CUPS_REVISION=""
-if test -z "$CUPS_REVISION" -a -d .svn; then
-       CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`"
-fi
+#if test -z "$CUPS_REVISION" -a -d .svn; then
+#      CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`"
+#fi
 CUPS_BUILD="cups-$CUPS_VERSION"
 
 AC_ARG_WITH(cups_build, [  --with-cups-build       set "cups-config --build" string ],
@@ -44,9 +44,9 @@ LDFLAGS="${LDFLAGS:=}"
 
 dnl Checks for programs...
 AC_PROG_AWK
-AC_PROG_CC
+AC_PROG_CC(clang cc gcc)
 AC_PROG_CPP
-AC_PROG_CXX
+AC_PROG_CXX(clang++ c++ g++)
 AC_PROG_RANLIB
 AC_PATH_PROG(AR,ar)
 AC_PATH_PROG(CHMOD,chmod)
@@ -338,6 +338,7 @@ AC_SUBST(DBUS_NOTIFIERLIBS)
 
 dnl Extra platform-specific libraries...
 CUPS_DEFAULT_PRINTOPERATOR_AUTH="@SYSTEM"
+CUPS_DEFAULT_SYSTEM_AUTHKEY=""
 CUPS_SYSTEM_AUTHKEY=""
 INSTALLXPC=""
 
@@ -385,10 +386,13 @@ case $uname in
 
                        if test "x$default_adminkey" != xdefault; then
                                CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
+                               CUPS_DEFAULT_SYSTEM_AUTHKEY="$default_adminkey"
                        elif grep -q system.print.operator /etc/authorization; then
                                CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
+                               CUPS_DEFAULT_SYSTEM_AUTHKEY="system.print.admin"
                        else
                                CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"
+                               CUPS_DEFAULT_SYSTEM_AUTHKEY="system.preferences"
                        fi
 
                        if test "x$default_operkey" != xdefault; then
@@ -426,6 +430,7 @@ esac
 
 AC_SUBST(CUPS_DEFAULT_PRINTOPERATOR_AUTH)
 AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTOPERATOR_AUTH, "$CUPS_DEFAULT_PRINTOPERATOR_AUTH")
+AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SYSTEM_AUTHKEY, "$CUPS_DEFAULT_SYSTEM_AUTHKEY")
 AC_SUBST(CUPS_SYSTEM_AUTHKEY)
 AC_SUBST(INSTALLXPC)
 
index e6ab4e97b510cc8c7d1bf974ea0942837f86af8c..eec3dec02085e598c8d690bd0d524166b7a15db1 100644 (file)
@@ -3,7 +3,7 @@ dnl "$Id: cups-directories.m4 7799 2008-07-25 20:06:08Z mike $"
 dnl
 dnl   Directory stuff for CUPS.
 dnl
-dnl   Copyright 2007-2012 by Apple Inc.
+dnl   Copyright 2007-2013 by Apple Inc.
 dnl   Copyright 1997-2007 by Easy Software Products, all rights reserved.
 dnl
 dnl   These coded instructions, statements, and computer programs are the
@@ -412,16 +412,17 @@ AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$sysconfdir/cups")
 AC_SUBST(CUPS_SERVERROOT)
 
 # Transient run-time state
-case "$uname" in
-       Darwin*)
-               # Darwin (OS X)
-               CUPS_STATEDIR="$CUPS_SERVERROOT"
-               ;;
-       *)
-               # All others
-               CUPS_STATEDIR="$localstatedir/run/cups"
-               ;;
-esac
+AC_ARG_WITH(rundir, [  --with-rundir           set transient run-time state directory],CUPS_STATEDIR="$withval",[
+       case "$uname" in
+               Darwin*)
+                       # Darwin (OS X)
+                       CUPS_STATEDIR="$CUPS_SERVERROOT"
+                       ;;
+               *)
+                       # All others
+                       CUPS_STATEDIR="$localstatedir/run/cups"
+                       ;;
+       esac])
 AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR")
 AC_SUBST(CUPS_STATEDIR)
 
index f8dbf4199a8e4741e2596338b74d5e7bb735392c..3aa648210a30dbf5a7d3d36609d5e2c1a9c76baf 100644 (file)
@@ -32,6 +32,7 @@
 #define CUPS_DEFAULT_GROUP     "sys"
 #define CUPS_DEFAULT_SYSTEM_GROUPS     "sys root system"
 #define CUPS_DEFAULT_PRINTOPERATOR_AUTH        "@SYSTEM"
+#define CUPS_DEFAULT_SYSTEM_AUTHKEY    "system.print.admin"
 
 
 /*
index 063e194a5cec8a30082b6e069ec234f6c8cdc5a7..f1c3a336ff6fea4d1a12e684022b5e693fdc93d1 100644 (file)
@@ -113,6 +113,7 @@ HEADERS     =       \
                ipp.h \
                language.h \
                ppd.h \
+               pwg.h \
                raster.h \
                sidechannel.h \
                transcode.h \
@@ -200,6 +201,14 @@ depend:
        $(CC) -MM $(ALL_CFLAGS) $(OBJS:.o=.c) >Dependencies
 
 
+#
+# Run oclint to check code coverage...
+#
+
+oclint:
+       oclint -o=oclint.html -html $(LIBOBJS:.o=.c) -- $(ALL_CFLAGS)
+
+
 #
 # Install all targets...
 #
@@ -527,8 +536,8 @@ apihelp:
                --css ../doc/cups-printable.css \
                --header api-cups.header --intro api-cups.shtml \
                api-cups.xml \
-               cups.h adminutil.c dest*.c language.c notify.c \
-               options.c tempfile.c usersys.c \
+               cups.h pwg.h adminutil.c dest*.c language.c notify.c \
+               options.c pwg-media.c tempfile.c usersys.c \
                util.c >../doc/help/api-cups.html
        mxmldoc --tokens help/api-cups.html api-cups.xml >../doc/help/api-cups.tokens
        $(RM) api-cups.xml
index bcbfef25089eb5007694b61f45896c833310eb79..b0d2d1dd1196e7597122a37fd44de9f3d0d09d92 100644 (file)
@@ -667,8 +667,7 @@ cups_local_auth(http_t *http)               /* I - HTTP connection to server */
   int                  pid;            /* Current process ID */
   FILE                 *fp;            /* Certificate file */
   char                 trc[16],        /* Try Root Certificate parameter */
-                       filename[1024], /* Certificate filename */
-                       certificate[33];/* Certificate string */
+                       filename[1024]; /* Certificate filename */
   _cups_globals_t *cg = _cupsGlobals();        /* Global data */
 #  if defined(HAVE_AUTHORIZATION_H)
   OSStatus             status;         /* Status */
@@ -862,19 +861,25 @@ cups_local_auth(http_t *http)             /* I - HTTP connection to server */
     * Read the certificate from the file...
     */
 
-    fgets(certificate, sizeof(certificate), fp);
+    char       certificate[33],        /* Certificate string */
+               *certptr;               /* Pointer to certificate string */
+
+    certptr = fgets(certificate, sizeof(certificate), fp);
     fclose(fp);
 
-   /*
-    * Set the authorization string and return...
-    */
+    if (certptr)
+    {
+     /*
+      * Set the authorization string and return...
+      */
 
-    httpSetAuthString(http, "Local", certificate);
+      httpSetAuthString(http, "Local", certificate);
 
-    DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
-                 http->authstring));
+      DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
+                   http->authstring));
 
-    return (0);
+      return (0);
+    }
   }
 
   return (1);
index bf96201f74c4bdc25eb3646858f66b4a404c9b39..6d68be444ffc28b84b1ed62117799ec174eea9de 100644 (file)
@@ -131,7 +131,7 @@ typedef struct _cups_globals_s              /**** CUPS global state data ****/
   cups_array_t         *leg_size_lut,  /* Lookup table for legacy names */
                        *ppd_size_lut,  /* Lookup table for PPD names */
                        *pwg_size_lut;  /* Lookup table for PWG names */
-  _pwg_media_t         pwg_media;      /* PWG media data for custom size */
+  pwg_media_t          pwg_media;      /* PWG media data for custom size */
   char                 pwg_name[65];   /* PWG media name for custom size */
 
   /* request.c */
@@ -207,6 +207,7 @@ typedef struct _cups_dconstres_s    /* Constraint/resolver */
 struct _cups_dinfo_s                   /* Destination capability and status
                                         * information */
 {
+  int                  version;        /* IPP version */
   const char           *uri;           /* Printer URI */
   char                 *resource;      /* Resource path */
   ipp_t                        *attrs;         /* Printer attributes */
@@ -218,6 +219,11 @@ struct _cups_dinfo_s                       /* Destination capability and status
   cups_array_t         *media_db;      /* Media database */
   _cups_media_db_t     min_size,       /* Minimum size */
                        max_size;       /* Maximum size */
+  unsigned             cached_flags;   /* Flags used for cached media */
+  cups_array_t         *cached_db;     /* Cache of media from last index/default */
+  time_t               ready_time;     /* When xxx-ready attributes were last queried */
+  ipp_t                        *ready_attrs;   /* xxx-ready attributes */
+  cups_array_t         *ready_db;      /* media[-col]-ready media database */
 };
 
 
index 5254c28c700772bed028d459e6aadefd03284377..fd1ced1f5c95797227f2e0455875583a34f3dec6 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   API definitions for CUPS.
  *
- *   Copyright 2007-2012 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -37,6 +37,7 @@ typedef off_t ssize_t;                        /* @private@ */
 #  include "file.h"
 #  include "ipp.h"
 #  include "language.h"
+#  include "pwg.h"
 
 
 /*
@@ -591,6 +592,29 @@ extern http_status_t       cupsStartDestDocument(http_t *http, cups_dest_t *dest,
                                              int last_document) _CUPS_API_1_6;
 
 /* New in CUPS 1.7 */
+extern ipp_attribute_t *cupsFindDestDefault(http_t *http, cups_dest_t *dest,
+                                            cups_dinfo_t *dinfo,
+                                            const char *option) _CUPS_API_1_7;
+extern ipp_attribute_t *cupsFindDestReady(http_t *http, cups_dest_t *dest,
+                                          cups_dinfo_t *dinfo,
+                                          const char *option) _CUPS_API_1_7;
+extern ipp_attribute_t *cupsFindDestSupported(http_t *http, cups_dest_t *dest,
+                                              cups_dinfo_t *dinfo,
+                                              const char *option)
+                                              _CUPS_API_1_7;
+extern int             cupsGetDestMediaByIndex(http_t *http, cups_dest_t *dest,
+                                               cups_dinfo_t *dinfo, int n,
+                                               unsigned flags,
+                                               cups_size_t *size)
+                                               _CUPS_API_1_7;
+extern  int            cupsGetDestMediaCount(http_t *http, cups_dest_t *dest,
+                                             cups_dinfo_t *dinfo,
+                                             unsigned flags) _CUPS_API_1_7;
+extern int             cupsGetDestMediaDefault(http_t *http, cups_dest_t *dest,
+                                               cups_dinfo_t *dinfo,
+                                               unsigned flags,
+                                               cups_size_t *size)
+                                               _CUPS_API_1_7;
 extern void            cupsSetUserAgent(const char *user_agent) _CUPS_API_1_7;
 extern const char      *cupsUserAgent(void) _CUPS_API_1_7;
 
index 9131b3ca43c156b7891b60f2fbc9ebdc8b218f54..85009faecec9c8f57d829ab6d95a68accf60cc68 100644 (file)
@@ -112,6 +112,8 @@ cupsCloseDestJob(
     return (IPP_STATUS_ERROR_INTERNAL);
   }
 
+  ippSetVersion(request, info->version / 10, info->version % 10);
+
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
                NULL, info->uri);
   ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id",
@@ -189,6 +191,8 @@ cupsCreateDestJob(
     return (IPP_STATUS_ERROR_INTERNAL);
   }
 
+  ippSetVersion(request, info->version / 10, info->version % 10);
+
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
                NULL, info->uri);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
@@ -327,6 +331,8 @@ cupsStartDestDocument(
     return (HTTP_STATUS_ERROR);
   }
 
+  ippSetVersion(request, info->version / 10, info->version % 10);
+
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
                NULL, info->uri);
   ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", job_id);
index 873d2e2cd19c924df3a90a71dce369b7d337c7bf..5201302a85054121369fcc88e0e0efd8326276a0 100644 (file)
  *                              option/value pair.
  *   cupsCopyDestInfo()        - Get the supported values/capabilities for the
  *                              destination.
+ *   cupsFindDestDefault()     - Find the default value(s) for the given
+ *                              option.
+ *   cupsFindDestReady()       - Find the default value(s) for the given
+ *                              option.
+ *   cupsFindDestSupported()   - Find the default value(s) for the given
+ *                              option.
  *   cupsFreeDestInfo()        - Free destination information obtained using
  *                              @link cupsCopyDestInfo@.
+ *   cupsGetDestMediaByIndex() - Get a media name, dimension, and margins for a
+ *                              specific size.
  *   cupsGetDestMediaByName()  - Get media names, dimensions, and margins.
  *   cupsGetDestMediaBySize()  - Get media names, dimensions, and margins.
+ *   cupsGetDestMediaCount()   - Get the number of sizes supported by a
+ *                              destination.
+ *   cupsGetDestMediaDefault() - Get the default size for a destination.
  *   cups_add_dconstres()      - Add a constraint or resolver to an array.
  *   cups_compare_dconstres()  - Compare to resolver entries.
  *   cups_compare_media_db()   - Compare two media entries.
  *   cups_copy_media_db()      - Copy a media entry.
+ *   cups_create_cached()      - Create the media selection cache.
  *   cups_create_constraints() - Create the constraints and resolvers arrays.
  *   cups_create_defaults()    - Create the -default option array.
  *   cups_create_media_db()    - Create the media database.
@@ -37,6 +49,7 @@
  *   cups_is_close_media_db()  - Compare two media entries to see if they are
  *                              close to the same size.
  *   cups_test_constraints()   - Test constraints.
+ *   cups_update_ready()       - Update xxx-ready attributes for the printer.
  */
 
 /*
 #include "cups-private.h"
 
 
+/*
+ * Local constants...
+ */
+
+#define _CUPS_MEDIA_READY_TTL  30      /* Life of xxx-ready values */
+
+
 /*
  * Local functions...
  */
@@ -56,12 +76,15 @@ static int          cups_compare_dconstres(_cups_dconstres_t *a,
 static int             cups_compare_media_db(_cups_media_db_t *a,
                                              _cups_media_db_t *b);
 static _cups_media_db_t        *cups_copy_media_db(_cups_media_db_t *mdb);
+static void            cups_create_cached(http_t *http, cups_dinfo_t *dinfo,
+                                          unsigned flags);
 static void            cups_create_constraints(cups_dinfo_t *dinfo);
 static void            cups_create_defaults(cups_dinfo_t *dinfo);
-static void            cups_create_media_db(cups_dinfo_t *dinfo);
+static void            cups_create_media_db(cups_dinfo_t *dinfo,
+                                            unsigned flags);
 static void            cups_free_media_db(_cups_media_db_t *mdb);
-static int             cups_get_media_db(cups_dinfo_t *dinfo,
-                                         _pwg_media_t *pwg, unsigned flags,
+static int             cups_get_media_db(http_t *http, cups_dinfo_t *dinfo,
+                                         pwg_media_t *pwg, unsigned flags,
                                          cups_size_t *size);
 static int             cups_is_close_media_db(_cups_media_db_t *a,
                                               _cups_media_db_t *b);
@@ -72,6 +95,7 @@ static cups_array_t   *cups_test_constraints(cups_dinfo_t *dinfo,
                                               cups_option_t *options,
                                               int *num_conflicts,
                                               cups_option_t **conflicts);
+static void            cups_update_ready(http_t *http, cups_dinfo_t *dinfo);
 
 
 /*
@@ -133,7 +157,7 @@ cupsCheckDestSupported(
     * Check range of custom media sizes...
     */
 
-    _pwg_media_t       *pwg;           /* Current PWG media size info */
+    pwg_media_t        *pwg;           /* Current PWG media size info */
     int                        min_width,      /* Minimum width */
                        min_length,     /* Minimum length */
                        max_width,      /* Maximum width */
@@ -151,13 +175,13 @@ cupsCheckDestSupported(
         i --, attrval ++)
     {
       if (!strncmp(attrval->string.text, "custom_min_", 11) &&
-          (pwg = _pwgMediaForPWG(attrval->string.text)) != NULL)
+          (pwg = pwgMediaForPWG(attrval->string.text)) != NULL)
       {
         min_width  = pwg->width;
         min_length = pwg->length;
       }
       else if (!strncmp(attrval->string.text, "custom_max_", 11) &&
-              (pwg = _pwgMediaForPWG(attrval->string.text)) != NULL)
+              (pwg = pwgMediaForPWG(attrval->string.text)) != NULL)
       {
         max_width  = pwg->width;
         max_length = pwg->length;
@@ -169,7 +193,7 @@ cupsCheckDestSupported(
     */
 
     if (min_width < INT_MAX && max_width > 0 &&
-        (pwg = _pwgMediaForPWG(value)) != NULL &&
+        (pwg = pwgMediaForPWG(value)) != NULL &&
         pwg->width >= min_width && pwg->width <= max_width &&
         pwg->length >= min_length && pwg->length <= max_length)
       return (1);
@@ -623,8 +647,8 @@ cupsCopyDestInfo(
     request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
                 uri);
-    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-                NULL, cupsUser());
+    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+                 "requesting-user-name", NULL, cupsUser());
     ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
                  "requested-attributes",
                  (int)(sizeof(requested_attrs) / sizeof(requested_attrs[0])),
@@ -671,6 +695,7 @@ cupsCopyDestInfo(
     return (NULL);
   }
 
+  dinfo->version  = version;
   dinfo->uri      = uri;
   dinfo->resource = _cupsStrAlloc(resource);
   dinfo->attrs    = response;
@@ -679,6 +704,129 @@ cupsCopyDestInfo(
 }
 
 
+/*
+ * 'cupsFindDestDefault()' - Find the default value(s) for the given option.
+ *
+ * The returned value is an IPP attribute. Use the @code ippGetBoolean@,
+ * @code ippGetCollection@, @code ippGetCount@, @code ippGetDate@,
+ * @code ippGetInteger@, @code ippGetOctetString@, @code ippGetRange@,
+ * @code ippGetResolution@, @code ippGetString@, and @code ippGetValueTag@
+ * functions to inspect the default value(s) as needed.
+ *
+ * @since CUPS 1.7@
+ */
+
+ipp_attribute_t        *                       /* O - Default attribute or @code NULL@ for none */
+cupsFindDestDefault(
+    http_t       *http,                        /* I - Connection to destination */
+    cups_dest_t  *dest,                        /* I - Destination */
+    cups_dinfo_t *dinfo,               /* I - Destination information */
+    const char   *option)              /* I - Option/attribute name */
+{
+  char name[IPP_MAX_NAME];             /* Attribute name */
+
+
+ /*
+  * Range check input...
+  */
+
+  if (!http || !dest || !dinfo || !option)
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+    return (NULL);
+  }
+
+ /*
+  * Find and return the attribute...
+  */
+
+  snprintf(name, sizeof(name), "%s-default", option);
+  return (ippFindAttribute(dinfo->attrs, name, IPP_TAG_ZERO));
+}
+
+/*
+ * 'cupsFindDestReady()' - Find the default value(s) for the given option.
+ *
+ * The returned value is an IPP attribute. Use the @code ippGetBoolean@,
+ * @code ippGetCollection@, @code ippGetCount@, @code ippGetDate@,
+ * @code ippGetInteger@, @code ippGetOctetString@, @code ippGetRange@,
+ * @code ippGetResolution@, @code ippGetString@, and @code ippGetValueTag@
+ * functions to inspect the default value(s) as needed.
+ *
+ * @since CUPS 1.7@
+ */
+
+ipp_attribute_t        *                       /* O - Default attribute or @code NULL@ for none */
+cupsFindDestReady(
+    http_t       *http,                        /* I - Connection to destination */
+    cups_dest_t  *dest,                        /* I - Destination */
+    cups_dinfo_t *dinfo,               /* I - Destination information */
+    const char   *option)              /* I - Option/attribute name */
+{
+  char name[IPP_MAX_NAME];             /* Attribute name */
+
+
+ /*
+  * Range check input...
+  */
+
+  if (!http || !dest || !dinfo || !option)
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+    return (NULL);
+  }
+
+ /*
+  * Find and return the attribute...
+  */
+
+  cups_update_ready(http, dinfo);
+
+  snprintf(name, sizeof(name), "%s-ready", option);
+  return (ippFindAttribute(dinfo->ready_attrs, name, IPP_TAG_ZERO));
+}
+
+/*
+ * 'cupsFindDestSupported()' - Find the default value(s) for the given option.
+ *
+ * The returned value is an IPP attribute. Use the @code ippGetBoolean@,
+ * @code ippGetCollection@, @code ippGetCount@, @code ippGetDate@,
+ * @code ippGetInteger@, @code ippGetOctetString@, @code ippGetRange@,
+ * @code ippGetResolution@, @code ippGetString@, and @code ippGetValueTag@
+ * functions to inspect the default value(s) as needed.
+ *
+ * @since CUPS 1.7@
+ */
+
+ipp_attribute_t        *                       /* O - Default attribute or @code NULL@ for none */
+cupsFindDestSupported(
+    http_t       *http,                        /* I - Connection to destination */
+    cups_dest_t  *dest,                        /* I - Destination */
+    cups_dinfo_t *dinfo,               /* I - Destination information */
+    const char   *option)              /* I - Option/attribute name */
+{
+  char name[IPP_MAX_NAME];             /* Attribute name */
+
+
+ /*
+  * Range check input...
+  */
+
+  if (!http || !dest || !dinfo || !option)
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+    return (NULL);
+  }
+
+ /*
+  * Find and return the attribute...
+  */
+
+  snprintf(name, sizeof(name), "%s-supported", option);
+  return (ippFindAttribute(dinfo->attrs, name, IPP_TAG_ZERO));
+}
+
+
 /*
  * 'cupsFreeDestInfo()' - Free destination information obtained using
  *                        @link cupsCopyDestInfo@.
@@ -707,12 +855,79 @@ cupsFreeDestInfo(cups_dinfo_t *dinfo)     /* I - Destination information */
 
   cupsArrayDelete(dinfo->media_db);
 
+  cupsArrayDelete(dinfo->cached_db);
+
+  ippDelete(dinfo->ready_attrs);
+  cupsArrayDelete(dinfo->ready_db);
+
   ippDelete(dinfo->attrs);
 
   free(dinfo);
 }
 
 
+/*
+ * 'cupsGetDestMediaByIndex()' - Get a media name, dimension, and margins for a
+ *                               specific size.
+ *
+ * The @code flags@ parameter determines which set of media are indexed.  For
+ * example, passing @code CUPS_MEDIA_FLAGS_BORDERLESS@ will get the Nth
+ * borderless size supported by the printer.
+ *
+ * @since CUPS 1.7@
+ */
+
+int                                    /* O - 1 on success, 0 on failure */
+cupsGetDestMediaByIndex(
+    http_t       *http,                        /* I - Connection to destination */
+    cups_dest_t  *dest,                        /* I - Destination */
+    cups_dinfo_t *dinfo,               /* I - Destination information */
+    int          n,                    /* I - Media size number (0-based) */
+    unsigned     flags,                        /* I - Media flags */
+    cups_size_t  *size)                        /* O - Media size information */
+{
+  cups_size_t  *nsize;                 /* Size for N */
+
+
+ /*
+  * Range check input...
+  */
+
+  if (size)
+    memset(size, 0, sizeof(cups_size_t));
+
+  if (!http || !dest || !dinfo || n < 0 || !size)
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+    return (0);
+  }
+
+ /*
+  * Load media list as needed...
+  */
+
+  if (flags & CUPS_MEDIA_FLAGS_READY)
+    cups_update_ready(http, dinfo);
+
+  if (!dinfo->cached_db || dinfo->cached_flags != flags)
+    cups_create_cached(http, dinfo, flags);
+
+ /*
+  * Copy the size over and return...
+  */
+
+  if ((nsize = (cups_size_t *)cupsArrayIndex(dinfo->cached_db, n)) == NULL)
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+    return (0);
+  }
+
+  memcpy(size, nsize, sizeof(cups_size_t));
+
+  return (1);
+}
+
+
 /*
  * 'cupsGetDestMediaByName()' - Get media names, dimensions, and margins.
  *
@@ -742,7 +957,7 @@ cupsGetDestMediaByName(
     unsigned     flags,                        /* I - Media matching flags */
     cups_size_t  *size)                        /* O - Media size information */
 {
-  _pwg_media_t         *pwg;           /* PWG media info */
+  pwg_media_t          *pwg;           /* PWG media info */
 
 
  /*
@@ -762,8 +977,8 @@ cupsGetDestMediaByName(
   * Lookup the media size name...
   */
 
-  if ((pwg = _pwgMediaForPWG(media)) == NULL)
-    if ((pwg = _pwgMediaForLegacy(media)) == NULL)
+  if ((pwg = pwgMediaForPWG(media)) == NULL)
+    if ((pwg = pwgMediaForLegacy(media)) == NULL)
     {
       DEBUG_printf(("1cupsGetDestMediaByName: Unknown size '%s'.", media));
       _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unknown media size name."), 1);
@@ -774,7 +989,7 @@ cupsGetDestMediaByName(
   * Lookup the size...
   */
 
-  return (cups_get_media_db(dinfo, pwg, flags, size));
+  return (cups_get_media_db(http, dinfo, pwg, flags, size));
 }
 
 
@@ -810,7 +1025,7 @@ cupsGetDestMediaBySize(
     unsigned     flags,                        /* I - Media matching flags */
     cups_size_t  *size)                        /* O - Media size information */
 {
-  _pwg_media_t         *pwg;           /* PWG media info */
+  pwg_media_t          *pwg;           /* PWG media info */
 
 
  /*
@@ -830,7 +1045,7 @@ cupsGetDestMediaBySize(
   * Lookup the media size name...
   */
 
-  if ((pwg = _pwgMediaForSize(width, length)) == NULL)
+  if ((pwg = pwgMediaForSize(width, length)) == NULL)
   {
     DEBUG_printf(("1cupsGetDestMediaBySize: Invalid size %dx%d.", width,
                   length));
@@ -842,7 +1057,116 @@ cupsGetDestMediaBySize(
   * Lookup the size...
   */
 
-  return (cups_get_media_db(dinfo, pwg, flags, size));
+  return (cups_get_media_db(http, dinfo, pwg, flags, size));
+}
+
+
+/*
+ * 'cupsGetDestMediaCount()' - Get the number of sizes supported by a
+ *                             destination.
+ *
+ * The @code flags@ parameter determines the set of media sizes that are
+ * counted.  For example, passing @code CUPS_MEDIA_FLAGS_BORDERLESS@ will return
+ * the number of borderless sizes.
+ *
+ * @since CUPS 1.7@
+ */
+
+int                                    /* O - Number of sizes */
+cupsGetDestMediaCount(
+    http_t       *http,                        /* I - Connection to destination */
+    cups_dest_t  *dest,                        /* I - Destination */
+    cups_dinfo_t *dinfo,               /* I - Destination information */
+    unsigned     flags)                        /* I - Media flags */
+{
+ /*
+  * Range check input...
+  */
+
+  if (!http || !dest || !dinfo)
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+    return (0);
+  }
+
+ /*
+  * Load media list as needed...
+  */
+
+  if (flags & CUPS_MEDIA_FLAGS_READY)
+    cups_update_ready(http, dinfo);
+
+  if (!dinfo->cached_db || dinfo->cached_flags != flags)
+    cups_create_cached(http, dinfo, flags);
+
+  return (cupsArrayCount(dinfo->cached_db));
+}
+
+
+/*
+ * 'cupsGetDestMediaDefault()' - Get the default size for a destination.
+ *
+ * The @code flags@ parameter determines which default size is returned.  For
+ * example, passing @code CUPS_MEDIA_FLAGS_BORDERLESS@ will return the default
+ * borderless size, typically US Letter or A4, but sometimes 4x6 photo media.
+ *
+ * @since CUPS 1.7@
+ */
+
+int                                    /* O - 1 on success, 0 on failure */
+cupsGetDestMediaDefault(
+    http_t       *http,                        /* I - Connection to destination */
+    cups_dest_t  *dest,                        /* I - Destination */
+    cups_dinfo_t *dinfo,               /* I - Destination information */
+    unsigned     flags,                        /* I - Media flags */
+    cups_size_t  *size)                        /* O - Media size information */
+{
+  const char   *media;                 /* Default media size */
+
+
+ /*
+  * Range check input...
+  */
+
+  if (size)
+    memset(size, 0, sizeof(cups_size_t));
+
+  if (!http || !dest || !dinfo || !size)
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+    return (0);
+  }
+
+ /*
+  * Get the default media size, if any...
+  */
+
+  if ((media = cupsGetOption("media", dest->num_options,
+                             dest->options)) == NULL)
+    media = "na_letter_8.5x11in";
+
+  if (cupsGetDestMediaByName(http, dest, dinfo, media, flags, size))
+    return (1);
+
+  if (strcmp(media, "na_letter_8.5x11in") &&
+      cupsGetDestMediaByName(http, dest, dinfo, "iso_a4_210x297mm", flags,
+                             size))
+    return (1);
+
+  if (strcmp(media, "iso_a4_210x297mm") &&
+      cupsGetDestMediaByName(http, dest, dinfo, "na_letter_8.5x11in", flags,
+                             size))
+    return (1);
+
+  if ((flags & CUPS_MEDIA_FLAGS_BORDERLESS) &&
+      cupsGetDestMediaByName(http, dest, dinfo, "na_index_4x6in", flags, size))
+    return (1);
+
+ /*
+  * Fall back to the first matching media size...
+  */
+
+  return (cupsGetDestMediaByIndex(http, dest, dinfo, flags, 0, size));
 }
 
 
@@ -943,6 +1267,66 @@ cups_copy_media_db(
 }
 
 
+/*
+ * 'cups_create_cached()' - Create the media selection cache.
+ */
+
+static void
+cups_create_cached(http_t       *http, /* I - Connection to destination */
+                   cups_dinfo_t *dinfo,        /* I - Destination information */
+                   unsigned     flags) /* I - Media selection flags */
+{
+  cups_array_t         *db;            /* Media database array to use */
+  _cups_media_db_t     *mdb,           /* Media database entry */
+                       *first;         /* First entry this size */
+
+
+  if (dinfo->cached_db)
+    cupsArrayDelete(dinfo->cached_db);
+
+  dinfo->cached_db    = cupsArrayNew(NULL, NULL);
+  dinfo->cached_flags = flags;
+
+  if (flags & CUPS_MEDIA_FLAGS_READY)
+  {
+    cups_update_ready(http, dinfo);
+    db = dinfo->ready_db;
+  }
+  else
+  {
+    if (!dinfo->media_db)
+      cups_create_media_db(dinfo, CUPS_MEDIA_FLAGS_DEFAULT);
+
+    db = dinfo->media_db;
+  }
+
+  for (mdb = (_cups_media_db_t *)cupsArrayFirst(db), first = mdb;
+       mdb;
+       mdb = (_cups_media_db_t *)cupsArrayNext(db))
+  {
+    if (flags & CUPS_MEDIA_FLAGS_BORDERLESS)
+    {
+      if (!mdb->left && !mdb->right && !mdb->top && !mdb->bottom)
+        cupsArrayAdd(dinfo->cached_db, mdb);
+    }
+    else if (flags & CUPS_MEDIA_FLAGS_DUPLEX)
+    {
+      if (first->width != mdb->width || first->length != mdb->length)
+      {
+        cupsArrayAdd(dinfo->cached_db, first);
+        first = mdb;
+      }
+      else if (mdb->left >= first->left && mdb->right >= first->right &&
+               mdb->top >= first->top && mdb->bottom >= first->bottom)
+        first = mdb;
+    }
+  }
+
+  if (flags & CUPS_MEDIA_FLAGS_DUPLEX)
+    cupsArrayAdd(dinfo->cached_db, first);
+}
+
+
 /*
  * 'cups_create_constraints()' - Create the constraints and resolvers arrays.
  */
@@ -1036,7 +1420,8 @@ cups_create_defaults(
 
 static void
 cups_create_media_db(
-    cups_dinfo_t *dinfo)               /* I - Destination information */
+    cups_dinfo_t *dinfo,               /* I - Destination information */
+    unsigned     flags)                        /* I - Media flags */
 {
   int                  i;              /* Looping var */
   _ipp_value_t         *val;           /* Current value */
@@ -1044,21 +1429,40 @@ cups_create_media_db(
                        *media_attr,    /* media-xxx */
                        *x_dimension,   /* x-dimension */
                        *y_dimension;   /* y-dimension */
-  _pwg_media_t         *pwg;           /* PWG media info */
+  pwg_media_t          *pwg;           /* PWG media info */
+  cups_array_t         *db;            /* New media database array */
   _cups_media_db_t     mdb;            /* Media entry */
 
 
-  dinfo->media_db = cupsArrayNew3((cups_array_func_t)cups_compare_media_db,
-                                  NULL, NULL, 0,
-                                  (cups_acopy_func_t)cups_copy_media_db,
-                                  (cups_afree_func_t)cups_free_media_db);
-  dinfo->min_size.width  = INT_MAX;
-  dinfo->min_size.length = INT_MAX;
-  dinfo->max_size.width  = 0;
-  dinfo->max_size.length = 0;
+  db = cupsArrayNew3((cups_array_func_t)cups_compare_media_db,
+                    NULL, NULL, 0,
+                    (cups_acopy_func_t)cups_copy_media_db,
+                    (cups_afree_func_t)cups_free_media_db);
 
-  if ((media_col_db = ippFindAttribute(dinfo->attrs, "media-col-database",
-                                       IPP_TAG_BEGIN_COLLECTION)) != NULL)
+  if (flags == CUPS_MEDIA_FLAGS_READY)
+  {
+    dinfo->ready_db = db;
+
+    media_col_db = ippFindAttribute(dinfo->ready_attrs, "media-col-ready",
+                                   IPP_TAG_BEGIN_COLLECTION);
+    media_attr   = ippFindAttribute(dinfo->ready_attrs, "media-ready",
+                                   IPP_TAG_ZERO);
+  }
+  else
+  {
+    dinfo->media_db        = db;
+    dinfo->min_size.width  = INT_MAX;
+    dinfo->min_size.length = INT_MAX;
+    dinfo->max_size.width  = 0;
+    dinfo->max_size.length = 0;
+
+    media_col_db = ippFindAttribute(dinfo->attrs, "media-col-database",
+                                   IPP_TAG_BEGIN_COLLECTION);
+    media_attr   = ippFindAttribute(dinfo->attrs, "media-supported",
+                                   IPP_TAG_ZERO);
+  }
+
+  if (media_col_db)
   {
     _ipp_value_t       *custom = NULL; /* Custom size range value */
 
@@ -1075,15 +1479,32 @@ cups_create_media_db(
                                        /* media-size collection value */
 
         if ((x_dimension = ippFindAttribute(media_size, "x-dimension",
-                                          IPP_TAG_INTEGER)) != NULL &&
+                                            IPP_TAG_INTEGER)) != NULL &&
            (y_dimension = ippFindAttribute(media_size, "y-dimension",
                                            IPP_TAG_INTEGER)) != NULL)
        {
+        /*
+         * Fixed size...
+         */
+
          mdb.width  = x_dimension->values[0].integer;
          mdb.length = y_dimension->values[0].integer;
        }
-        else if ((x_dimension = ippFindAttribute(media_size, "x-dimension",
-                                              IPP_TAG_RANGE)) != NULL &&
+       else if ((x_dimension = ippFindAttribute(media_size, "x-dimension",
+                                                IPP_TAG_INTEGER)) != NULL &&
+                (y_dimension = ippFindAttribute(media_size, "y-dimension",
+                                                IPP_TAG_RANGE)) != NULL)
+       {
+        /*
+         * Roll limits...
+         */
+
+         mdb.width  = x_dimension->values[0].integer;
+         mdb.length = y_dimension->values[0].range.upper;
+       }
+        else if (flags != CUPS_MEDIA_FLAGS_READY &&
+                 (x_dimension = ippFindAttribute(media_size, "x-dimension",
+                                                IPP_TAG_RANGE)) != NULL &&
                 (y_dimension = ippFindAttribute(media_size, "y-dimension",
                                                 IPP_TAG_RANGE)) != NULL)
        {
@@ -1107,7 +1528,6 @@ cups_create_media_db(
          dinfo->max_size.right  = 635; /* Default 1/4" side margins */
          dinfo->max_size.top    =
          dinfo->max_size.bottom = 1270; /* Default 1/2" top/bottom margins */
-
          continue;
        }
       }
@@ -1167,7 +1587,7 @@ cups_create_media_db(
                                          IPP_TAG_INTEGER)) != NULL)
         mdb.top = media_attr->values[0].integer;
 
-      cupsArrayAdd(dinfo->media_db, &mdb);
+      cupsArrayAdd(db, &mdb);
     }
 
     if (custom)
@@ -1205,8 +1625,7 @@ cups_create_media_db(
       }
     }
   }
-  else if ((media_attr = ippFindAttribute(dinfo->attrs, "media-supported",
-                                          IPP_TAG_ZERO)) != NULL &&
+  else if (media_attr &&
            (media_attr->value_tag == IPP_TAG_NAME ||
             media_attr->value_tag == IPP_TAG_NAMELANG ||
             media_attr->value_tag == IPP_TAG_KEYWORD))
@@ -1222,8 +1641,8 @@ cups_create_media_db(
          i > 0;
          i --, val ++)
     {
-      if ((pwg = _pwgMediaForPWG(val->string.text)) == NULL)
-        if ((pwg = _pwgMediaForLegacy(val->string.text)) == NULL)
+      if ((pwg = pwgMediaForPWG(val->string.text)) == NULL)
+        if ((pwg = pwgMediaForLegacy(val->string.text)) == NULL)
        {
          DEBUG_printf(("3cups_create_media_db: Ignoring unknown size '%s'.",
                        val->string.text));
@@ -1233,12 +1652,14 @@ cups_create_media_db(
       mdb.width  = pwg->width;
       mdb.length = pwg->length;
 
-      if (!strncmp(val->string.text, "custom_min_", 11))
+      if (flags != CUPS_MEDIA_FLAGS_READY &&
+          !strncmp(val->string.text, "custom_min_", 11))
       {
         mdb.size_name   = NULL;
         dinfo->min_size = mdb;
       }
-      else if (!strncmp(val->string.text, "custom_max_", 11))
+      else if (flags != CUPS_MEDIA_FLAGS_READY &&
+              !strncmp(val->string.text, "custom_max_", 11))
       {
         mdb.size_name   = NULL;
         dinfo->max_size = mdb;
@@ -1247,7 +1668,7 @@ cups_create_media_db(
       {
         mdb.size_name = val->string.text;
 
-        cupsArrayAdd(dinfo->media_db, &mdb);
+        cupsArrayAdd(db, &mdb);
       }
     }
   }
@@ -1284,11 +1705,13 @@ cups_free_media_db(
  */
 
 static int                             /* O - 1 on match, 0 on failure */
-cups_get_media_db(cups_dinfo_t *dinfo, /* I - Destination information */
-                  _pwg_media_t *pwg,   /* I - PWG media info */
+cups_get_media_db(http_t       *http,  /* I - Connection to destination */
+                  cups_dinfo_t *dinfo, /* I - Destination information */
+                  pwg_media_t  *pwg,   /* I - PWG media info */
                   unsigned     flags,  /* I - Media matching flags */
-                  cups_size_t *size)   /* O - Media size/margin/name info */
+                  cups_size_t  *size)  /* O - Media size/margin/name info */
 {
+  cups_array_t         *db;            /* Which media database to query */
   _cups_media_db_t     *mdb,           /* Current media database entry */
                        *best = NULL,   /* Best matching entry */
                        key;            /* Search key */
@@ -1298,8 +1721,18 @@ cups_get_media_db(cups_dinfo_t *dinfo,   /* I - Destination information */
   * Create the media database as needed...
   */
 
-  if (!dinfo->media_db)
-    cups_create_media_db(dinfo);
+  if (flags & CUPS_MEDIA_FLAGS_READY)
+  {
+    cups_update_ready(http, dinfo);
+    db = dinfo->ready_db;
+  }
+  else
+  {
+    if (!dinfo->media_db)
+      cups_create_media_db(dinfo, CUPS_MEDIA_FLAGS_DEFAULT);
+
+    db = dinfo->media_db;
+  }
 
  /*
   * Find a match...
@@ -1309,7 +1742,7 @@ cups_get_media_db(cups_dinfo_t *dinfo,    /* I - Destination information */
   key.width  = pwg->width;
   key.length = pwg->length;
 
-  if ((mdb = cupsArrayFind(dinfo->media_db, &key)) != NULL)
+  if ((mdb = cupsArrayFind(db, &key)) != NULL)
   {
    /*
     * Found an exact match, let's figure out the best margins for the flags
@@ -1327,9 +1760,9 @@ cups_get_media_db(cups_dinfo_t *dinfo,    /* I - Destination information */
       if (best->left != 0 || best->right != 0 || best->top != 0 ||
           best->bottom != 0)
       {
-       for (mdb = (_cups_media_db_t *)cupsArrayNext(dinfo->media_db);
+       for (mdb = (_cups_media_db_t *)cupsArrayNext(db);
             mdb && !cups_compare_media_db(mdb, &key);
-            mdb = (_cups_media_db_t *)cupsArrayNext(dinfo->media_db))
+            mdb = (_cups_media_db_t *)cupsArrayNext(db))
        {
          if (mdb->left <= best->left && mdb->right <= best->right &&
              mdb->top <= best->top && mdb->bottom <= best->bottom)
@@ -1357,9 +1790,9 @@ cups_get_media_db(cups_dinfo_t *dinfo,    /* I - Destination information */
       * Look for the largest margins...
       */
 
-      for (mdb = (_cups_media_db_t *)cupsArrayNext(dinfo->media_db);
+      for (mdb = (_cups_media_db_t *)cupsArrayNext(db);
           mdb && !cups_compare_media_db(mdb, &key);
-          mdb = (_cups_media_db_t *)cupsArrayNext(dinfo->media_db))
+          mdb = (_cups_media_db_t *)cupsArrayNext(db))
       {
        if (mdb->left >= best->left && mdb->right >= best->right &&
            mdb->top >= best->top && mdb->bottom >= best->bottom)
@@ -1372,9 +1805,9 @@ cups_get_media_db(cups_dinfo_t *dinfo,    /* I - Destination information */
       * Look for the smallest non-zero margins...
       */
 
-      for (mdb = (_cups_media_db_t *)cupsArrayNext(dinfo->media_db);
+      for (mdb = (_cups_media_db_t *)cupsArrayNext(db);
           mdb && !cups_compare_media_db(mdb, &key);
-          mdb = (_cups_media_db_t *)cupsArrayNext(dinfo->media_db))
+          mdb = (_cups_media_db_t *)cupsArrayNext(db))
       {
        if (((mdb->left > 0 && mdb->left <= best->left) || best->left == 0) &&
            ((mdb->right > 0 && mdb->right <= best->right) ||
@@ -1434,9 +1867,9 @@ cups_get_media_db(cups_dinfo_t *dinfo,    /* I - Destination information */
     * Find a close size...
     */
 
-    for (mdb = (_cups_media_db_t *)cupsArrayFirst(dinfo->media_db);
+    for (mdb = (_cups_media_db_t *)cupsArrayFirst(db);
          mdb;
-         mdb = (_cups_media_db_t *)cupsArrayNext(dinfo->media_db))
+         mdb = (_cups_media_db_t *)cupsArrayNext(db))
       if (cups_is_close_media_db(mdb, &key))
         break;
 
@@ -1454,9 +1887,9 @@ cups_get_media_db(cups_dinfo_t *dinfo,    /* I - Destination information */
       if (best->left != 0 || best->right != 0 || best->top != 0 ||
           best->bottom != 0)
       {
-       for (mdb = (_cups_media_db_t *)cupsArrayNext(dinfo->media_db);
+       for (mdb = (_cups_media_db_t *)cupsArrayNext(db);
             mdb && cups_is_close_media_db(mdb, &key);
-            mdb = (_cups_media_db_t *)cupsArrayNext(dinfo->media_db))
+            mdb = (_cups_media_db_t *)cupsArrayNext(db))
        {
          if (mdb->left <= best->left && mdb->right <= best->right &&
              mdb->top <= best->top && mdb->bottom <= best->bottom)
@@ -1475,9 +1908,9 @@ cups_get_media_db(cups_dinfo_t *dinfo,    /* I - Destination information */
       * Look for the largest margins...
       */
 
-      for (mdb = (_cups_media_db_t *)cupsArrayNext(dinfo->media_db);
+      for (mdb = (_cups_media_db_t *)cupsArrayNext(db);
           mdb && cups_is_close_media_db(mdb, &key);
-          mdb = (_cups_media_db_t *)cupsArrayNext(dinfo->media_db))
+          mdb = (_cups_media_db_t *)cupsArrayNext(db))
       {
        if (mdb->left >= best->left && mdb->right >= best->right &&
            mdb->top >= best->top && mdb->bottom >= best->bottom)
@@ -1490,9 +1923,9 @@ cups_get_media_db(cups_dinfo_t *dinfo,    /* I - Destination information */
       * Look for the smallest non-zero margins...
       */
 
-      for (mdb = (_cups_media_db_t *)cupsArrayNext(dinfo->media_db);
+      for (mdb = (_cups_media_db_t *)cupsArrayNext(db);
           mdb && cups_is_close_media_db(mdb, &key);
-          mdb = (_cups_media_db_t *)cupsArrayNext(dinfo->media_db))
+          mdb = (_cups_media_db_t *)cupsArrayNext(db))
       {
        if (((mdb->left > 0 && mdb->left <= best->left) || best->left == 0) &&
            ((mdb->right > 0 && mdb->right <= best->right) ||
@@ -1758,6 +2191,81 @@ cups_test_constraints(
 }
 
 
+/*
+ * 'cups_update_ready()' - Update xxx-ready attributes for the printer.
+ */
+
+static void
+cups_update_ready(http_t       *http,  /* I - Connection to destination */
+                  cups_dinfo_t *dinfo) /* I - Destination information */
+{
+  ipp_t        *request;                       /* Get-Printer-Attributes request */
+  static const char * const pattrs[] = /* Printer attributes we want */
+  {
+    "finishings-col-ready",
+    "finishings-ready",
+    "job-finishings-col-ready",
+    "job-finishings-ready",
+    "media-col-ready",
+    "media-ready"
+  };
+
+
+ /*
+  * Don't update more than once every 30 seconds...
+  */
+
+  if ((time(NULL) - dinfo->ready_time) < _CUPS_MEDIA_READY_TTL)
+    return;
+
+ /*
+  * Free any previous results...
+  */
+
+  if (dinfo->cached_flags & CUPS_MEDIA_FLAGS_READY)
+  {
+    cupsArrayDelete(dinfo->cached_db);
+    dinfo->cached_db    = NULL;
+    dinfo->cached_flags = CUPS_MEDIA_FLAGS_DEFAULT;
+  }
+
+  ippDelete(dinfo->ready_attrs);
+  dinfo->ready_attrs = NULL;
+
+  cupsArrayDelete(dinfo->ready_db);
+  dinfo->ready_db = NULL;
+
+ /*
+  * Query the xxx-ready values...
+  */
+
+  request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
+  ippSetVersion(request, dinfo->version / 10, dinfo->version % 10);
+
+  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
+               dinfo->uri);
+  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
+               NULL, cupsUser());
+  ippAddStrings(request, IPP_TAG_OPERATION,
+                IPP_TAG_KEYWORD | IPP_TAG_CUPS_CONST, "requested-attributes",
+                (int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
+
+  dinfo->ready_attrs = cupsDoRequest(http, request, dinfo->resource);
+
+ /*
+  * Update the ready media database...
+  */
+
+  cups_create_media_db(dinfo, CUPS_MEDIA_FLAGS_READY);
+
+ /*
+  * Update last lookup time and return...
+  */
+
+  dinfo->ready_time = time(NULL);
+}
+
+
 /*
  * End of "$Id$".
  */
index 03ee73c4c1112aef050863d922f17b14b0322a02..7736baa4cdd841813a20fb7bebc9e17f19541f25 100644 (file)
@@ -2458,7 +2458,7 @@ appleGetPaperSize(char *name,             /* I - Paper size name buffer */
                   int  namesize)       /* I - Size of buffer */
 {
   CFStringRef  defaultPaperID;         /* Default paper ID */
-  _pwg_media_t *pwgmedia;              /* PWG media size */
+  pwg_media_t  *pwgmedia;              /* PWG media size */
 
 
   defaultPaperID = _cupsAppleCopyDefaultPaperID();
@@ -2467,7 +2467,7 @@ appleGetPaperSize(char *name,             /* I - Paper size name buffer */
       !CFStringGetCString(defaultPaperID, name, namesize,
                          kCFStringEncodingUTF8))
     name[0] = '\0';
-  else if ((pwgmedia = _pwgMediaForLegacy(name)) != NULL)
+  else if ((pwgmedia = pwgMediaForLegacy(name)) != NULL)
     strlcpy(name, pwgmedia->pwg, namesize);
 
   if (defaultPaperID)
index 77e3fc11651659101a13b15e82e624283eed10ac..64ac1b71349318910bffdcdb7cceb64c977140de 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   HTTP address routines for CUPS.
  *
- *   Copyright 2007-2012 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
index 6d859b658add68fa5947130e9964bf073f5fbd65..97923ae6f63098efcc947388a745d724f908e4d2 100644 (file)
@@ -34,7 +34,7 @@
 #  include <poll.h>
 #endif /* HAVE_POLL */
 #ifndef WIN32
-#  include <sys/fcntl.h>
+#  include <fcntl.h>
 #endif /* WIN32 */
 
 
@@ -59,7 +59,7 @@ httpAddrConnect(
  * 'httpAddrConnect2()' - Connect to any of the addresses in the list with a
  *                        timeout and optional cancel.
  *
- * @since CUPS 1.6/OS X 10.8@
+ * @since CUPS 1.7@
  */
 
 http_addrlist_t *                      /* O - Connected address or NULL on failure */
index 64c1810286cd304f4cc0ef02ee4bcf5acde7a029..4c7cbc9a4718a726b56cd26b52d15375f18e5c3d 100644 (file)
@@ -474,6 +474,8 @@ httpAssembleURIf(
  * number.  The result is formatted as a UUID URN as defined in RFC 4122.
  *
  * The buffer needs to be at least 46 bytes in size.
+ *
+ * @since CUPS 1.7@
  */
 
 char *                                 /* I - UUID string */
@@ -1869,6 +1871,11 @@ http_copy_decode(char       *dst,        /* O - Destination buffer */
          return (NULL);
        }
       }
+      else if ((*src & 255) <= 0x20 || (*src & 255) >= 0x7f)
+      {
+        *ptr = '\0';
+        return (NULL);
+      }
       else
        *ptr++ = *src;
     }
index 8ea4d93c373020c4cebcfa4a150f4ada9e5646ca..919e73adf31089e0f5667406cb7ef68a5e87af7b 100644 (file)
  *   _httpFreeCredentials()      - Free internal credentials.
  *   httpFreeCredentials()       - Free an array of credentials.
  *   httpGet()                   - Send a GET request to the server.
- *   httpGetContentEncoding()    - Get a common content encoding, if any,
- *                                 between the client and server.
  *   httpGetAuthString()         - Get the current authorization string.
  *   httpGetBlocking()           - Get the blocking/non-block state of a
  *                                 connection.
+ *   httpGetContentEncoding()    - Get a common content encoding, if any,
+ *                                 between the client and server.
  *   httpGetCookie()             - Get any cookie data from the response.
  *   httpGetExpect()             - Get the value of the Expect header, if any.
  *   httpGetFd()                 - Get the file descriptor associated with a
@@ -1043,6 +1043,40 @@ httpGet(http_t     *http,                /* I - Connection to server */
 }
 
 
+/*
+ * 'httpGetAuthString()' - Get the current authorization string.
+ *
+ * The authorization string is set by cupsDoAuthentication() and
+ * httpSetAuthString().  Use httpGetAuthString() to retrieve the
+ * string to use with httpSetField() for the HTTP_FIELD_AUTHORIZATION
+ * value.
+ *
+ * @since CUPS 1.3/OS X 10.5@
+ */
+
+char *                                 /* O - Authorization string */
+httpGetAuthString(http_t *http)                /* I - Connection to server */
+{
+  if (http)
+    return (http->authstring);
+  else
+    return (NULL);
+}
+
+
+/*
+ * 'httpGetBlocking()' - Get the blocking/non-block state of a connection.
+ *
+ * @since CUPS 1.2/OS X 10.5@
+ */
+
+int                                    /* O - 1 if blocking, 0 if non-blocking */
+httpGetBlocking(http_t *http)          /* I - Connection to server */
+{
+  return (http ? http->blocking : 0);
+}
+
+
 /*
  * 'httpGetContentEncoding()' - Get a common content encoding, if any, between
  *                              the client and server.
@@ -1131,40 +1165,6 @@ httpGetContentEncoding(http_t *http)     /* I - Connection to client/server */
 }
 
 
-/*
- * 'httpGetAuthString()' - Get the current authorization string.
- *
- * The authorization string is set by cupsDoAuthentication() and
- * httpSetAuthString().  Use httpGetAuthString() to retrieve the
- * string to use with httpSetField() for the HTTP_FIELD_AUTHORIZATION
- * value.
- *
- * @since CUPS 1.3/OS X 10.5@
- */
-
-char *                                 /* O - Authorization string */
-httpGetAuthString(http_t *http)                /* I - Connection to server */
-{
-  if (http)
-    return (http->authstring);
-  else
-    return (NULL);
-}
-
-
-/*
- * 'httpGetBlocking()' - Get the blocking/non-block state of a connection.
- *
- * @since CUPS 1.2/OS X 10.5@
- */
-
-int                                    /* O - 1 if blocking, 0 if non-blocking */
-httpGetBlocking(http_t *http)          /* I - Connection to server */
-{
-  return (http ? http->blocking : 0);
-}
-
-
 /*
  * 'httpGetCookie()' - Get any cookie data from the response.
  *
@@ -2358,6 +2358,9 @@ httpRead2(http_t *http,                   /* I - Connection to server */
 
     if (http->state == HTTP_STATE_POST_RECV)
       http->state ++;
+    else if (http->state == HTTP_STATE_GET_SEND ||
+             http->state == HTTP_STATE_POST_SEND)
+      http->state = HTTP_STATE_WAITING;
     else
       http->state = HTTP_STATE_STATUS;
 
@@ -2898,8 +2901,8 @@ httpSetCookie(http_t     *http,           /* I - Connection */
 /*
  * 'httpSetDefaultField()' - Set the default value of an HTTP header.
  *
- * Currently only HTTP_FIELD_ACCEPT_ENCODING, HTTP_FIELD_SERVER, and
- * HTTP_FIELD_USER_AGENT can be set.
+ * Currently only @code HTTP_FIELD_ACCEPT_ENCODING@, @code HTTP_FIELD_SERVER@,
+ * and @code HTTP_FIELD_USER_AGENT@ can be set.
  *
  * @since CUPS 1.7@
  */
@@ -4602,7 +4605,7 @@ http_read(http_t *http,                   /* I - Connection to server */
                CUPS_LLCAST bytes));
 #ifdef DEBUG
   if (bytes > 0)
-    http_debug_hex("http_read", http->buffer, (int)bytes);
+    http_debug_hex("http_read", buffer, (int)bytes);
 #endif /* DEBUG */
 
   if (bytes < 0)
@@ -5293,7 +5296,7 @@ http_setup_ssl(http_t *http)              /* I - Connection to server */
       http->error  = EIO;
       http->status = HTTP_STATUS_ERROR;
 
-      _cupsSetError(IPP_PKI_ERROR, gnutls_strerror(status), 0);
+      _cupsSetError(IPP_STATUS_ERROR_CUPS_PKI, gnutls_strerror(status), 0);
 
       gnutls_deinit(http->tls);
       gnutls_certificate_free_credentials(*credentials);
index 265d33c5ad6ef181a8aa97e23ab5496cb0a3102d..6c7aadeda7ddec36cc7f57b76fa9793598430f08 100644 (file)
@@ -489,13 +489,29 @@ static const char * const ipp_document_states[] =
                  "punch-dual-bottom",
                  "punch-triple-left",
                  "punch-triple-top",
-                 /* 0x40000050 - 0x40000055 */
+                 /* 0x40000050 - 0x4000005F */
                  "punch-triple-right",
                  "punch-triple-bottom",
                  "punch-quad-left",
                  "punch-quad-top",
                  "punch-quad-right",
                  "punch-quad-bottom",
+                 "0x40000056",
+                 "0x40000057",
+                 "0x40000058",
+                 "0x40000059",
+                 "fold-accordian",
+                 "fold-double-gate",
+                 "fold-gate",
+                 "fold-half",
+                 "fold-half-z",
+                 "fold-left-gate",
+                 /* 0x40000060 - 0x40000064 */
+                 "fold-letter",
+                 "fold-parallel",
+                 "fold-poster",
+                 "fold-right-gate",
+                 "fold-z"
                },
                * const ipp_job_collation_types[] =
                {                       /* job-collation-type enums */
@@ -863,6 +879,7 @@ ippCreateRequestedArray(ipp_t *request)     /* I - IPP request */
     "print-content-optimize-actual",
     "print-quality-actual",
     "print-rendering-intent-actual",
+    "print-scaling-actual",            /* IPP Paid Printing */
     "printer-resolution-actual",
     "printer-up-time",
     "separator-sheets-actual",
@@ -955,6 +972,9 @@ ippCreateRequestedArray(ipp_t *request)     /* I - IPP request */
     "orientation-requested",
     "orientation-requested-default",
     "orientation-requested-supported",
+    "output-mode",                     /* CUPS extension */
+    "output-mode-default",             /* CUPS extension */
+    "output-mode-supported",           /* CUPS extension */
     "overrides",
     "overrides-supported",
     "page-delivery",
@@ -989,6 +1009,9 @@ ippCreateRequestedArray(ipp_t *request)    /* I - IPP request */
     "print-rendering-intent",
     "print-rendering-intent-default",
     "print-rendering-intent-supported",
+    "print-scaling",                   /* IPP Paid Printing */
+    "print-scaling-default",           /* IPP Paid Printing */
+    "print-scaling-supported",         /* IPP Paid Printing */
     "printer-resolution",
     "printer-resolution-default",
     "printer-resolution-supported",
@@ -1123,6 +1146,7 @@ ippCreateRequestedArray(ipp_t *request)   /* I - IPP request */
     "print-content-optimize-actual",
     "print-quality-actual",
     "print-rendering-intent-actual",
+    "print-scaling-actual",            /* IPP Paid Printing */
     "printer-resolution-actual",
     "separator-sheets-actual",
     "sheet-collate-actual",
@@ -1299,6 +1323,9 @@ ippCreateRequestedArray(ipp_t *request)   /* I - IPP request */
     "output-device",
     "output-device-default",
     "output-device-supported",
+    "output-mode",                     /* CUPS extension */
+    "output-mode-default",             /* CUPS extension */
+    "output-mode-supported",           /* CUPS extension */
     "overrides",
     "overrides-supported",
     "page-delivery",
@@ -1333,6 +1360,9 @@ ippCreateRequestedArray(ipp_t *request)   /* I - IPP request */
     "print-rendering-intent",
     "print-rendering-intent-default",
     "print-rendering-intent-supported",
+    "print-scaling",                   /* IPP Paid Printing */
+    "print-scaling-default",           /* IPP Paid Printing */
+    "print-scaling-supported",         /* IPP Paid Printing */
     "printer-resolution",
     "printer-resolution-default",
     "printer-resolution-supported",
@@ -1488,6 +1518,8 @@ ippCreateRequestedArray(ipp_t *request)   /* I - IPP request */
     "printer-icons",
     "printer-info",
     "printer-is-accepting-jobs",
+    "printer-is-shared",               /* CUPS extension */
+    "printer-kind",                    /* IPP Paid Printing */
     "printer-location",
     "printer-make-and-model",
     "printer-mandatory-job-attributes",
@@ -1497,6 +1529,7 @@ ippCreateRequestedArray(ipp_t *request)   /* I - IPP request */
     "printer-more-info",
     "printer-more-info-manufacturer",
     "printer-name",
+    "printer-native-formats",
     "printer-organization",
     "printer-organizational-unit",
     "printer-settable-attributes-supported",
@@ -1523,6 +1556,7 @@ ippCreateRequestedArray(ipp_t *request)   /* I - IPP request */
     "requesting-user-name-denied",     /* CUPS extension */
     "requesting-user-uri-supported",
     "subordinate-printers-supported",
+    "urf-supported",                   /* CUPS extension */
     "uri-authentication-supported",
     "uri-security-supported",
     "user-defined-value-supported",
@@ -1714,7 +1748,10 @@ ippEnumString(const char *attrname,      /* I - Attribute name */
           !strcmp(attrname, "finishings-actual") ||
           !strcmp(attrname, "finishings-default") ||
           !strcmp(attrname, "finishings-ready") ||
-          !strcmp(attrname, "finishings-supported"))
+          !strcmp(attrname, "finishings-supported") ||
+          !strcmp(attrname, "job-finishings") ||
+          !strcmp(attrname, "job-finishings-default") ||
+          !strcmp(attrname, "job-finishings-supported"))
   {
     if (enumvalue >= 3 &&
         enumvalue < (3 + (int)(sizeof(ipp_finishings) /
index 68665ebc54f3fb4b867a20005f8a7a5bd41abfa1..8c1ace0f1f631eca82d93a83aa419b819eca6b58 100644 (file)
@@ -57,6 +57,7 @@
  *   ippGetGroupTag()       - Get the group associated with an attribute.
  *   ippGetInteger()        - Get the integer/enum value for an attribute.
  *   ippGetName()           - Get the attribute name.
+ *   ippGetOctetString()     - Get an octetString value from an IPP attribute.
  *   ippGetOperation()      - Get the operation ID in an IPP message.
  *   ippGetRange()          - Get a rangeOfInteger value from an attribute.
  *   ippGetRequestId()      - Get the request ID from an IPP message.
@@ -84,6 +85,7 @@
  *   ippSetGroupTag()       - Set the group tag of an attribute.
  *   ippSetInteger()        - Set an integer or enum value in an attribute.
  *   ippSetName()           - Set the name of an attribute.
+ *   ippSetOctetString()     - Set an octetString value in an IPP attribute.
  *   ippSetOperation()      - Set the operation ID in an IPP request message.
  *   ippSetRange()          - Set a rangeOfInteger value in an attribute.
  *   ippSetRequestId()      - Set the request ID in an IPP message.
@@ -2382,6 +2384,45 @@ ippGetName(ipp_attribute_t *attr)        /* I - IPP attribute */
 }
 
 
+/*
+ * 'ippGetOctetString()' - Get an octetString value from an IPP attribute.
+ *
+ * The @code element@ parameter specifies which value to get from 0 to
+ * @link ippGetCount(attr)@ - 1.
+ *
+ * @since CUPS 1.7@
+ */
+
+void *                                 /* O - Pointer to octetString data */
+ippGetOctetString(
+    ipp_attribute_t *attr,             /* I - IPP attribute */
+    int             element,           /* I - Value number (0-based) */
+    int             *datalen)          /* O - Length of octetString data */
+{
+ /*
+  * Range check input...
+  */
+
+  if (!attr || attr->value_tag != IPP_TAG_STRING ||
+      element < 0 || element >= attr->num_values)
+  {
+    if (datalen)
+      *datalen = 0;
+
+    return (NULL);
+  }
+
+ /*
+  * Return the values...
+  */
+
+  if (datalen)
+    *datalen = attr->values[element].unknown.length;
+
+  return (attr->values[element].unknown.data);
+}
+
+
 /*
  * 'ippGetOperation()' - Get the operation ID in an IPP message.
  *
@@ -3712,7 +3753,7 @@ ippReadIO(void       *src,                /* I - Data source */
  */
 
 int                                    /* O  - 1 on success, 0 on failure */
-ippSetBoolean(ipp_t           *ipp,    /* IO - IPP message */
+ippSetBoolean(ipp_t           *ipp,    /* I  - IPP message */
               ipp_attribute_t **attr,  /* IO - IPP attribute */
               int             element, /* I  - Value number (0-based) */
               int             boolvalue)/* I  - Boolean value */
@@ -3755,7 +3796,7 @@ ippSetBoolean(ipp_t           *ipp,       /* IO - IPP message */
 
 int                                    /* O  - 1 on success, 0 on failure */
 ippSetCollection(
-    ipp_t           *ipp,              /* IO - IPP message */
+    ipp_t           *ipp,              /* I  - IPP message */
     ipp_attribute_t **attr,            /* IO - IPP attribute */
     int             element,           /* I  - Value number (0-based) */
     ipp_t           *colvalue)         /* I  - Collection value */
@@ -3803,7 +3844,7 @@ ippSetCollection(
  */
 
 int                                    /* O  - 1 on success, 0 on failure */
-ippSetDate(ipp_t             *ipp,     /* IO - IPP message */
+ippSetDate(ipp_t             *ipp,     /* I  - IPP message */
            ipp_attribute_t   **attr,   /* IO - IPP attribute */
            int               element,  /* I  - Value number (0-based) */
            const ipp_uchar_t *datevalue)/* I  - Date value */
@@ -3849,7 +3890,7 @@ ippSetDate(ipp_t             *ipp,        /* IO - IPP message */
 
 int                                    /* O  - 1 on success, 0 on failure */
 ippSetGroupTag(
-    ipp_t           *ipp,              /* IO - IPP message */
+    ipp_t           *ipp,              /* I  - IPP message */
     ipp_attribute_t **attr,            /* IO - Attribute */
     ipp_tag_t       group_tag)         /* I  - Group tag */
 {
@@ -3887,7 +3928,7 @@ ippSetGroupTag(
  */
 
 int                                    /* O  - 1 on success, 0 on failure */
-ippSetInteger(ipp_t           *ipp,    /* IO - IPP message */
+ippSetInteger(ipp_t           *ipp,    /* I  - IPP message */
               ipp_attribute_t **attr,  /* IO - IPP attribute */
               int             element, /* I  - Value number (0-based) */
               int             intvalue)        /* I  - Integer/enum value */
@@ -3927,7 +3968,7 @@ ippSetInteger(ipp_t           *ipp,       /* IO - IPP message */
  */
 
 int                                    /* O  - 1 on success, 0 on failure */
-ippSetName(ipp_t           *ipp,       /* IO - IPP message */
+ippSetName(ipp_t           *ipp,       /* I  - IPP message */
           ipp_attribute_t **attr,      /* IO - IPP attribute */
           const char      *name)       /* I  - Attribute name */
 {
@@ -3957,6 +3998,94 @@ ippSetName(ipp_t           *ipp, /* IO - IPP message */
 }
 
 
+/*
+ * 'ippSetOctetString()' - Set an octetString value in an IPP attribute.
+ *
+ * The @code ipp@ parameter refers to an IPP message previously created using
+ * the @link ippNew@, @link ippNewRequest@, or  @link ippNewResponse@ functions.
+ *
+ * The @code attr@ parameter may be modified as a result of setting the value.
+ *
+ * The @code element@ parameter specifies which value to set from 0 to
+ * @link ippGetCount(attr)@.
+ *
+ * @since CUPS 1.7@
+ */
+
+int                                    /* O  - 1 on success, 0 on failure */
+ippSetOctetString(
+    ipp_t           *ipp,              /* I  - IPP message */
+    ipp_attribute_t **attr,            /* IO - IPP attribute */
+    int             element,           /* I  - Value number (0-based) */
+    const void      *data,             /* I  - Pointer to octetString data */
+    int             datalen)           /* I  - Length of octetString data */
+{
+  _ipp_value_t *value;                 /* Current value */
+
+
+ /*
+  * Range check input...
+  */
+
+  if (!ipp || !attr || !*attr || (*attr)->value_tag != IPP_TAG_STRING ||
+      element < 0 || element > (*attr)->num_values ||
+      datalen < 0 || datalen > IPP_MAX_LENGTH)
+    return (0);
+
+ /*
+  * Set the value and return...
+  */
+
+  if ((value = ipp_set_value(ipp, attr, element)) != NULL)
+  {
+    if ((int)((*attr)->value_tag) & IPP_TAG_CUPS_CONST)
+    {
+     /*
+      * Just copy the pointer...
+      */
+
+      value->unknown.data   = (void *)data;
+      value->unknown.length = datalen;
+    }
+    else
+    {
+     /*
+      * Copy the data...
+      */
+
+      if (value->unknown.data)
+      {
+       /*
+       * Free previous data...
+       */
+
+       free(value->unknown.data);
+
+       value->unknown.data   = NULL;
+        value->unknown.length = 0;
+      }
+
+      if (datalen > 0)
+      {
+       void    *temp;                  /* Temporary data pointer */
+
+       if ((temp = malloc(datalen)) != NULL)
+       {
+         memcpy(temp, data, datalen);
+
+         value->unknown.data   = temp;
+         value->unknown.length = datalen;
+       }
+       else
+         return (0);
+      }
+    }
+  }
+
+  return (value != NULL);
+}
+
+
 /*
  * 'ippSetOperation()' - Set the operation ID in an IPP request message.
  *
@@ -4002,7 +4131,7 @@ ippSetOperation(ipp_t    *ipp,            /* I - IPP request message */
  */
 
 int                                    /* O  - 1 on success, 0 on failure */
-ippSetRange(ipp_t           *ipp,      /* IO - IPP message */
+ippSetRange(ipp_t           *ipp,      /* I  - IPP message */
             ipp_attribute_t **attr,    /* IO - IPP attribute */
             int             element,   /* I  - Value number (0-based) */
            int             lowervalue, /* I  - Lower bound for range */
@@ -4083,7 +4212,7 @@ ippSetRequestId(ipp_t *ipp,               /* I - IPP message */
 
 int                                    /* O  - 1 on success, 0 on failure */
 ippSetResolution(
-    ipp_t           *ipp,              /* IO - IPP message */
+    ipp_t           *ipp,              /* I  - IPP message */
     ipp_attribute_t **attr,            /* IO - IPP attribute */
     int             element,           /* I  - Value number (0-based) */
     ipp_res_t       unitsvalue,                /* I  - Resolution units */
@@ -4190,7 +4319,7 @@ ippSetStatusCode(ipp_t        *ipp,       /* I - IPP response or event message */
  */
 
 int                                    /* O  - 1 on success, 0 on failure */
-ippSetString(ipp_t           *ipp,     /* IO - IPP message */
+ippSetString(ipp_t           *ipp,     /* I  - IPP message */
              ipp_attribute_t **attr,   /* IO - IPP attribute */
              int             element,  /* I  - Value number (0-based) */
             const char      *strvalue) /* I  - String value */
@@ -4257,7 +4386,7 @@ ippSetString(ipp_t           *ipp,        /* IO - IPP message */
  */
 
 int                                    /* O  - 1 on success, 0 on failure */
-ippSetStringf(ipp_t           *ipp,    /* IO - IPP message */
+ippSetStringf(ipp_t           *ipp,    /* I  - IPP message */
               ipp_attribute_t **attr,  /* IO - IPP attribute */
               int             element, /* I  - Value number (0-based) */
              const char      *format,  /* I  - Printf-style format string */
@@ -4295,7 +4424,7 @@ ippSetStringf(ipp_t           *ipp,       /* IO - IPP message */
  */
 
 int                                    /* O  - 1 on success, 0 on failure */
-ippSetStringfv(ipp_t           *ipp,   /* IO - IPP message */
+ippSetStringfv(ipp_t           *ipp,   /* I  - IPP message */
                ipp_attribute_t **attr, /* IO - IPP attribute */
                int             element,        /* I  - Value number (0-based) */
               const char      *format, /* I  - Printf-style format string */
@@ -4448,7 +4577,7 @@ ippSetStringfv(ipp_t           *ipp,      /* IO - IPP message */
 
 int                                    /* O  - 1 on success, 0 on failure */
 ippSetValueTag(
-    ipp_t          *ipp,               /* IO - IPP message */
+    ipp_t          *ipp,               /* I  - IPP message */
     ipp_attribute_t **attr,            /* IO - IPP attribute */
     ipp_tag_t       value_tag)         /* I  - Value tag */
 {
index 3e343a2fd542d569c225a4f64203daf58d86df7e..5360ff1a7a7c8c63c7ae4f6f4392d6d3daa7f52e 100644 (file)
@@ -102,7 +102,7 @@ typedef enum ipp_finishings_e               /**** Finishings ****/
   IPP_FINISHINGS_TRIM,                 /* Trim (any type) */
   IPP_FINISHINGS_BALE,                 /* Bale (any type) */
   IPP_FINISHINGS_BOOKLET_MAKER,                /* Fold to make booklet */
-  IPP_FINISHINGS_JOB_OFFSET,           /* Offset for binding (any type) */
+  IPP_FINISHINGS_JOG_OFFSET,           /* Offset for binding (any type) */
   IPP_FINISHINGS_STAPLE_TOP_LEFT = 20, /* Staple top left corner */
   IPP_FINISHINGS_STAPLE_BOTTOM_LEFT,   /* Staple bottom left corner */
   IPP_FINISHINGS_STAPLE_TOP_RIGHT,     /* Staple top right corner */
@@ -144,9 +144,24 @@ typedef enum ipp_finishings_e              /**** Finishings ****/
   IPP_FINISHINGS_CUPS_PUNCH_QUAD_LEFT, /* Punch 4 holes left side */
   IPP_FINISHINGS_CUPS_PUNCH_QUAD_TOP,  /* Punch 4 holes top edge */
   IPP_FINISHINGS_CUPS_PUNCH_QUAD_RIGHT,        /* Punch 4 holes right side */
-  IPP_FINISHINGS_CUPS_PUNCH_QUAD_BOTTOM        /* Punch 4 holes bottom edge */
+  IPP_FINISHINGS_CUPS_PUNCH_QUAD_BOTTOM,/* Punch 4 holes bottom edge */
+
+  IPP_FINISHINGS_CUPS_FOLD_ACCORDIAN = 0x4000005A,
+                                       /* Accordian-fold the paper vertically into four sections */
+  IPP_FINISHINGS_CUPS_FOLD_DOUBLE_GATE,        /* Fold the top and bottom quarters of the paper towards the midline, then fold in half vertically */
+  IPP_FINISHINGS_CUPS_FOLD_GATE,       /* Fold the top and bottom quarters of the paper towards the midline */
+  IPP_FINISHINGS_CUPS_FOLD_HALF,       /* Fold the paper in half vertically */
+  IPP_FINISHINGS_CUPS_FOLD_HALF_Z,     /* Fold the paper in half horizontally, then Z-fold the paper vertically */
+  IPP_FINISHINGS_CUPS_FOLD_LEFT_GATE,  /* Fold the top quarter of the paper towards the midline */
+  IPP_FINISHINGS_CUPS_FOLD_LETTER,     /* Fold the paper into three sections vertically; sometimes also known as a C fold*/
+  IPP_FINISHINGS_CUPS_FOLD_PARALLEL,   /* Fold the paper in half vertically two times, yielding four sections */
+  IPP_FINISHINGS_CUPS_FOLD_POSTER,     /* Fold the paper in half horizontally and vertically; sometimes also called a cross fold */
+  IPP_FINISHINGS_CUPS_FOLD_RIGHT_GATE, /* Fold the bottom quarter of the paper towards the midline */
+  IPP_FINISHINGS_CUPS_FOLD_Z           /* Fold the paper vertically into three sections, forming a Z */
 } ipp_finishings_t;
 #  ifndef _CUPS_NO_DEPRECATED
+#    define IPP_FINISHINGS_JOB_OFFSET  IPP_FINISHINGS_JOG_OFFSET
+                                       /* Long-time misspelling... */
 typedef enum ipp_finishings_e ipp_finish_t;
 #  endif /* !_CUPS_NO_DEPRECATED */
 
@@ -921,7 +936,12 @@ extern int         ippContainsInteger(ipp_attribute_t *attr, int value)
 extern int             ippContainsString(ipp_attribute_t *attr,
                                          const char *value) _CUPS_API_1_7;
 extern cups_array_t    *ippCreateRequestedArray(ipp_t *request) _CUPS_API_1_7;
+extern void            *ippGetOctetString(ipp_attribute_t *attr, int element,
+                                          int *datalen) _CUPS_API_1_7;
 extern ipp_t           *ippNewResponse(ipp_t *request) _CUPS_API_1_7;
+extern int             ippSetOctetString(ipp_t *ipp, ipp_attribute_t **attr,
+                                         int element, const void *data,
+                                         int datalen) _CUPS_API_1_7;
 extern int             ippSetStringf(ipp_t *ipp, ipp_attribute_t **attr,
                                      int element, const char *format,
                                      ...) _CUPS_API_1_7;
index c1febfa9d4919d9efacf22ddd1511372bc921ae6..ceae66df9098260c913339b69d760f55f395909e 100644 (file)
@@ -88,8 +88,8 @@ _ppdCacheCreateWithFile(
 {
   cups_file_t  *fp;                    /* File */
   _ppd_cache_t *pc;                    /* PWG mapping data */
-  _pwg_size_t  *size;                  /* Current size */
-  _pwg_map_t   *map;                   /* Current map */
+  pwg_size_t   *size;                  /* Current size */
+  pwg_map_t    *map;                   /* Current map */
   _pwg_finishings_t *finishings;       /* Current finishings option */
   int          linenum,                /* Current line number */
                num_bins,               /* Number of bins in file */
@@ -290,7 +290,7 @@ _ppdCacheCreateWithFile(
        goto create_error;
       }
 
-      if ((pc->bins = calloc(num_bins, sizeof(_pwg_map_t))) == NULL)
+      if ((pc->bins = calloc(num_bins, sizeof(pwg_map_t))) == NULL)
       {
         DEBUG_printf(("_ppdCacheCreateWithFile: Unable to allocate %d bins.",
                      num_sizes));
@@ -340,7 +340,7 @@ _ppdCacheCreateWithFile(
 
       if (num_sizes > 0)
       {
-       if ((pc->sizes = calloc(num_sizes, sizeof(_pwg_size_t))) == NULL)
+       if ((pc->sizes = calloc(num_sizes, sizeof(pwg_size_t))) == NULL)
        {
          DEBUG_printf(("_ppdCacheCreateWithFile: Unable to allocate %d sizes.",
                        num_sizes));
@@ -398,12 +398,12 @@ _ppdCacheCreateWithFile(
        goto create_error;
       }
 
-      _pwgGenerateSize(pwg_keyword, sizeof(pwg_keyword), "custom", "max",
-                      pc->custom_max_width, pc->custom_max_length);
+      pwgFormatSizeName(pwg_keyword, sizeof(pwg_keyword), "custom", "max",
+                       pc->custom_max_width, pc->custom_max_length, NULL);
       pc->custom_max_keyword = _cupsStrAlloc(pwg_keyword);
 
-      _pwgGenerateSize(pwg_keyword, sizeof(pwg_keyword), "custom", "min",
-                      pc->custom_min_width, pc->custom_min_length);
+      pwgFormatSizeName(pwg_keyword, sizeof(pwg_keyword), "custom", "min",
+                       pc->custom_min_width, pc->custom_min_length, NULL);
       pc->custom_min_keyword = _cupsStrAlloc(pwg_keyword);
     }
     else if (!_cups_strcasecmp(line, "SourceOption"))
@@ -428,7 +428,7 @@ _ppdCacheCreateWithFile(
        goto create_error;
       }
 
-      if ((pc->sources = calloc(num_sources, sizeof(_pwg_map_t))) == NULL)
+      if ((pc->sources = calloc(num_sources, sizeof(pwg_map_t))) == NULL)
       {
         DEBUG_printf(("_ppdCacheCreateWithFile: Unable to allocate %d sources.",
                      num_sources));
@@ -477,7 +477,7 @@ _ppdCacheCreateWithFile(
        goto create_error;
       }
 
-      if ((pc->types = calloc(num_types, sizeof(_pwg_map_t))) == NULL)
+      if ((pc->types = calloc(num_types, sizeof(pwg_map_t))) == NULL)
       {
         DEBUG_printf(("_ppdCacheCreateWithFile: Unable to allocate %d types.",
                      num_types));
@@ -654,24 +654,24 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd)   /* I - PPD file */
                        *color_model,   /* ColorModel option */
                        *duplex;        /* Duplex option */
   ppd_choice_t         *choice;        /* Current InputSlot/MediaType */
-  _pwg_map_t           *map;           /* Current source/type map */
+  pwg_map_t            *map;           /* Current source/type map */
   ppd_attr_t           *ppd_attr;      /* Current PPD preset attribute */
   int                  num_options;    /* Number of preset options and props */
   cups_option_t                *options;       /* Preset options and properties */
   ppd_size_t           *ppd_size;      /* Current PPD size */
-  _pwg_size_t          *pwg_size;      /* Current PWG size */
+  pwg_size_t           *pwg_size;      /* Current PWG size */
   char                 pwg_keyword[3 + PPD_MAX_NAME + 1 + 12 + 1 + 12 + 3],
                                        /* PWG keyword string */
                        ppd_name[PPD_MAX_NAME];
                                        /* Normalized PPD name */
   const char           *pwg_name;      /* Standard PWG media name */
-  _pwg_media_t         *pwg_media;     /* PWG media data */
+  pwg_media_t          *pwg_media;     /* PWG media data */
   _pwg_print_color_mode_t pwg_print_color_mode;
                                        /* print-color-mode index */
   _pwg_print_quality_t pwg_print_quality;
                                        /* print-quality index */
   int                  similar;        /* Are the old and new size similar? */
-  _pwg_size_t           *old_size;     /* Current old size */
+  pwg_size_t           *old_size;      /* Current old size */
   int                  old_imageable,  /* Old imageable length in 2540ths */
                        old_borderless, /* Old borderless state */
                        old_known_pwg;  /* Old PWG name is well-known */
@@ -684,7 +684,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd)     /* I - PPD file */
                        new_imageable,  /* New imageable length in 2540ths */
                        new_borderless, /* New borderless state */
                        new_known_pwg;  /* New PWG name is well-known */
-  _pwg_size_t           *new_size;     /* New size to add, if any */
+  pwg_size_t           *new_size;      /* New size to add, if any */
   const char           *filter;        /* Current filter */
   _pwg_finishings_t    *finishings;    /* Current finishings value */
 
@@ -714,10 +714,10 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd)   /* I - PPD file */
 
   if (ppd->num_sizes > 0)
   {
-    if ((pc->sizes = calloc(ppd->num_sizes, sizeof(_pwg_size_t))) == NULL)
+    if ((pc->sizes = calloc(ppd->num_sizes, sizeof(pwg_size_t))) == NULL)
     {
       DEBUG_printf(("_ppdCacheCreateWithPPD: Unable to allocate %d "
-                   "_pwg_size_t's.", ppd->num_sizes));
+                   "pwg_size_t's.", ppd->num_sizes));
       goto create_error;
     }
 
@@ -736,7 +736,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd)     /* I - PPD file */
       * Convert the PPD size name to the corresponding PWG keyword name.
       */
 
-      if ((pwg_media = _pwgMediaForPPD(ppd_size->name)) != NULL)
+      if ((pwg_media = pwgMediaForPPD(ppd_size->name)) != NULL)
       {
        /*
        * Standard name, do we have conflicts?
@@ -771,9 +771,9 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd)     /* I - PPD file */
        new_known_pwg = 0;
 
        pwg_unppdize_name(ppd_size->name, ppd_name, sizeof(ppd_name), "_.");
-       _pwgGenerateSize(pwg_keyword, sizeof(pwg_keyword), NULL, ppd_name,
-                        _PWG_FROMPTS(ppd_size->width),
-                        _PWG_FROMPTS(ppd_size->length));
+       pwgFormatSizeName(pwg_keyword, sizeof(pwg_keyword), NULL, ppd_name,
+                         PWG_FROM_POINTS(ppd_size->width),
+                         PWG_FROM_POINTS(ppd_size->length), NULL);
       }
 
      /*
@@ -782,16 +782,16 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd)   /* I - PPD file */
       * dimensions that are <= 0...
       */
 
-      if ((pwg_media = _pwgMediaForSize(_PWG_FROMPTS(ppd_size->width),
-                                       _PWG_FROMPTS(ppd_size->length))) == NULL)
+      if ((pwg_media = pwgMediaForSize(PWG_FROM_POINTS(ppd_size->width),
+                                       PWG_FROM_POINTS(ppd_size->length))) == NULL)
        continue;
 
       new_width      = pwg_media->width;
       new_length     = pwg_media->length;
-      new_left       = _PWG_FROMPTS(ppd_size->left);
-      new_bottom     = _PWG_FROMPTS(ppd_size->bottom);
-      new_right      = _PWG_FROMPTS(ppd_size->width - ppd_size->right);
-      new_top        = _PWG_FROMPTS(ppd_size->length - ppd_size->top);
+      new_left       = PWG_FROM_POINTS(ppd_size->left);
+      new_bottom     = PWG_FROM_POINTS(ppd_size->bottom);
+      new_right      = PWG_FROM_POINTS(ppd_size->width - ppd_size->right);
+      new_top        = PWG_FROM_POINTS(ppd_size->length - ppd_size->top);
       new_imageable  = new_length - new_top - new_bottom;
       new_borderless = new_bottom == 0 && new_top == 0 &&
                       new_left == 0 && new_right == 0;
@@ -860,24 +860,24 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd)   /* I - PPD file */
     * Generate custom size data...
     */
 
-    _pwgGenerateSize(pwg_keyword, sizeof(pwg_keyword), "custom", "max",
-                    _PWG_FROMPTS(ppd->custom_max[0]),
-                    _PWG_FROMPTS(ppd->custom_max[1]));
+    pwgFormatSizeName(pwg_keyword, sizeof(pwg_keyword), "custom", "max",
+                     PWG_FROM_POINTS(ppd->custom_max[0]),
+                     PWG_FROM_POINTS(ppd->custom_max[1]), NULL);
     pc->custom_max_keyword = _cupsStrAlloc(pwg_keyword);
-    pc->custom_max_width   = _PWG_FROMPTS(ppd->custom_max[0]);
-    pc->custom_max_length  = _PWG_FROMPTS(ppd->custom_max[1]);
+    pc->custom_max_width   = PWG_FROM_POINTS(ppd->custom_max[0]);
+    pc->custom_max_length  = PWG_FROM_POINTS(ppd->custom_max[1]);
 
-    _pwgGenerateSize(pwg_keyword, sizeof(pwg_keyword), "custom", "min",
-                    _PWG_FROMPTS(ppd->custom_min[0]),
-                    _PWG_FROMPTS(ppd->custom_min[1]));
+    pwgFormatSizeName(pwg_keyword, sizeof(pwg_keyword), "custom", "min",
+                     PWG_FROM_POINTS(ppd->custom_min[0]),
+                     PWG_FROM_POINTS(ppd->custom_min[1]), NULL);
     pc->custom_min_keyword = _cupsStrAlloc(pwg_keyword);
-    pc->custom_min_width   = _PWG_FROMPTS(ppd->custom_min[0]);
-    pc->custom_min_length  = _PWG_FROMPTS(ppd->custom_min[1]);
+    pc->custom_min_width   = PWG_FROM_POINTS(ppd->custom_min[0]);
+    pc->custom_min_length  = PWG_FROM_POINTS(ppd->custom_min[1]);
 
-    pc->custom_size.left   = _PWG_FROMPTS(ppd->custom_margins[0]);
-    pc->custom_size.bottom = _PWG_FROMPTS(ppd->custom_margins[1]);
-    pc->custom_size.right  = _PWG_FROMPTS(ppd->custom_margins[2]);
-    pc->custom_size.top    = _PWG_FROMPTS(ppd->custom_margins[3]);
+    pc->custom_size.left   = PWG_FROM_POINTS(ppd->custom_margins[0]);
+    pc->custom_size.bottom = PWG_FROM_POINTS(ppd->custom_margins[1]);
+    pc->custom_size.right  = PWG_FROM_POINTS(ppd->custom_margins[2]);
+    pc->custom_size.top    = PWG_FROM_POINTS(ppd->custom_margins[3]);
   }
 
  /*
@@ -892,10 +892,10 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd)   /* I - PPD file */
     pc->source_option = _cupsStrAlloc(input_slot->keyword);
 
     if ((pc->sources = calloc(input_slot->num_choices,
-                               sizeof(_pwg_map_t))) == NULL)
+                               sizeof(pwg_map_t))) == NULL)
     {
       DEBUG_printf(("_ppdCacheCreateWithPPD: Unable to allocate %d "
-                    "_pwg_map_t's for InputSlot.", input_slot->num_choices));
+                    "pwg_map_t's for InputSlot.", input_slot->num_choices));
       goto create_error;
     }
 
@@ -954,10 +954,10 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd)   /* I - PPD file */
   if ((media_type = ppdFindOption(ppd, "MediaType")) != NULL)
   {
     if ((pc->types = calloc(media_type->num_choices,
-                             sizeof(_pwg_map_t))) == NULL)
+                             sizeof(pwg_map_t))) == NULL)
     {
       DEBUG_printf(("_ppdCacheCreateWithPPD: Unable to allocate %d "
-                    "_pwg_map_t's for MediaType.", media_type->num_choices));
+                    "pwg_map_t's for MediaType.", media_type->num_choices));
       goto create_error;
     }
 
@@ -1019,10 +1019,10 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
   if ((output_bin = ppdFindOption(ppd, "OutputBin")) != NULL)
   {
     if ((pc->bins = calloc(output_bin->num_choices,
-                             sizeof(_pwg_map_t))) == NULL)
+                           sizeof(pwg_map_t))) == NULL)
     {
       DEBUG_printf(("_ppdCacheCreateWithPPD: Unable to allocate %d "
-                    "_pwg_map_t's for OutputBin.", output_bin->num_choices));
+                    "pwg_map_t's for OutputBin.", output_bin->num_choices));
       goto create_error;
     }
 
@@ -1456,8 +1456,8 @@ void
 _ppdCacheDestroy(_ppd_cache_t *pc)     /* I - PPD cache and mapping data */
 {
   int          i;                      /* Looping var */
-  _pwg_map_t   *map;                   /* Current map */
-  _pwg_size_t  *size;                  /* Current size */
+  pwg_map_t    *map;                   /* Current map */
+  pwg_size_t   *size;                  /* Current size */
 
 
  /*
@@ -1720,7 +1720,7 @@ _ppdCacheGetInputSlot(
 
     ipp_attribute_t    *media_col,     /* media-col attribute */
                        *media_source;  /* media-source attribute */
-    _pwg_size_t                size;           /* Dimensional size */
+    pwg_size_t         size;           /* Dimensional size */
     int                        margins_set;    /* Were the margins set? */
 
     media_col = ippFindAttribute(job, "media-col", IPP_TAG_BEGIN_COLLECTION);
@@ -1735,7 +1735,7 @@ _ppdCacheGetInputSlot(
 
       keyword = ippGetString(media_source, 0, NULL);
     }
-    else if (_pwgInitSize(&size, job, &margins_set))
+    else if (pwgInitSize(&size, job, &margins_set))
     {
      /*
       * For media <= 5x7, look for a photo tray...
@@ -1859,7 +1859,7 @@ _ppdCacheGetPageSize(
     int          *exact)               /* O - 1 if exact match, 0 otherwise */
 {
   int          i;                      /* Looping var */
-  _pwg_size_t  *size,                  /* Current size */
+  pwg_size_t   *size,                  /* Current size */
                *closest,               /* Closest size */
                jobsize;                /* Size data from job */
   int          margins_set,            /* Were the margins set? */
@@ -1947,7 +1947,7 @@ _ppdCacheGetPageSize(
     * media-col.
     */
 
-    if (!_pwgInitSize(&jobsize, job, &margins_set))
+    if (!pwgInitSize(&jobsize, job, &margins_set))
       return (NULL);
   }
   else
@@ -1956,12 +1956,12 @@ _ppdCacheGetPageSize(
     * Get the size using a media keyword...
     */
 
-    _pwg_media_t       *media;         /* Media definition */
+    pwg_media_t        *media;         /* Media definition */
 
 
-    if ((media = _pwgMediaForPWG(keyword)) == NULL)
-      if ((media = _pwgMediaForLegacy(keyword)) == NULL)
-        if ((media = _pwgMediaForPPD(keyword)) == NULL)
+    if ((media = pwgMediaForPWG(keyword)) == NULL)
+      if ((media = pwgMediaForLegacy(keyword)) == NULL)
+        if ((media = pwgMediaForPPD(keyword)) == NULL)
          return (NULL);
 
     jobsize.width  = media->width;
@@ -2054,7 +2054,7 @@ _ppdCacheGetPageSize(
     */
 
     snprintf(pc->custom_ppd_size, sizeof(pc->custom_ppd_size), "Custom.%dx%d",
-             (int)_PWG_TOPTS(jobsize.width), (int)_PWG_TOPTS(jobsize.length));
+             (int)PWG_TO_POINTS(jobsize.width), (int)PWG_TO_POINTS(jobsize.length));
 
     if (margins_set && exact)
     {
@@ -2090,14 +2090,14 @@ _ppdCacheGetPageSize(
  * '_ppdCacheGetSize()' - Get the PWG size associated with a PPD PageSize.
  */
 
-_pwg_size_t *                          /* O - PWG size or NULL */
+pwg_size_t *                           /* O - PWG size or NULL */
 _ppdCacheGetSize(
     _ppd_cache_t *pc,                  /* I - PPD cache and mapping data */
     const char   *page_size)           /* I - PPD PageSize */
 {
   int          i;                      /* Looping var */
-  _pwg_media_t *media;                 /* Media */
-  _pwg_size_t  *size;                  /* Current size */
+  pwg_media_t  *media;                 /* Media */
+  pwg_size_t   *size;                  /* Current size */
 
 
  /*
@@ -2183,9 +2183,9 @@ _ppdCacheGetSize(
   * Look up standard sizes...
   */
 
-  if ((media = _pwgMediaForPPD(page_size)) == NULL)
-    if ((media = _pwgMediaForLegacy(page_size)) == NULL)
-      media = _pwgMediaForPWG(page_size);
+  if ((media = pwgMediaForPPD(page_size)) == NULL)
+    if ((media = pwgMediaForLegacy(page_size)) == NULL)
+      media = pwgMediaForPWG(page_size);
 
   if (media)
   {
@@ -2210,7 +2210,7 @@ _ppdCacheGetSource(
     const char   *input_slot)          /* I - PPD InputSlot */
 {
   int          i;                      /* Looping var */
-  _pwg_map_t   *source;                /* Current source */
+  pwg_map_t    *source;                /* Current source */
 
 
  /*
@@ -2239,7 +2239,7 @@ _ppdCacheGetType(
     const char   *media_type)          /* I - PPD MediaType */
 {
   int          i;                      /* Looping var */
-  _pwg_map_t   *type;                  /* Current type */
+  pwg_map_t    *type;                  /* Current type */
 
 
  /*
@@ -2269,8 +2269,8 @@ _ppdCacheWriteFile(
 {
   int                  i, j, k;        /* Looping vars */
   cups_file_t          *fp;            /* Output file */
-  _pwg_size_t          *size;          /* Current size */
-  _pwg_map_t           *map;           /* Current map */
+  pwg_size_t           *size;          /* Current size */
+  pwg_map_t            *map;           /* Current map */
   _pwg_finishings_t    *f;             /* Current finishing option */
   cups_option_t                *option;        /* Current option */
   const char           *value;         /* Filter/pre-filter value */
@@ -2584,7 +2584,7 @@ _pwgMediaTypeForType(
 
 const char *                           /* O - PageSize name */
 _pwgPageSizeForMedia(
-    _pwg_media_t *media,               /* I - Media */
+    pwg_media_t *media,                /* I - Media */
     char         *name,                        /* I - PageSize name buffer */
     size_t       namesize)             /* I - Size of name buffer */
 {
@@ -2620,8 +2620,8 @@ _pwgPageSizeForMedia(
     * Use a name of the form "wNNNhNNN"...
     */
 
-    snprintf(name, namesize, "w%dh%d", (int)_PWG_TOPTS(media->width),
-             (int)_PWG_TOPTS(media->length));
+    snprintf(name, namesize, "w%dh%d", (int)PWG_TO_POINTS(media->width),
+             (int)PWG_TO_POINTS(media->length));
   }
   else
   {
index 28016d632437d9f6bb049295b156265291805733..c6c25325bdcc32af068259a26b22fbe2fcf91da3 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   Private PPD definitions for CUPS.
  *
- *   Copyright 2007-2011 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -112,9 +112,9 @@ typedef struct _pwg_finishings_s    /**** PWG finishings mapping data ****/
 struct _ppd_cache_s                    /**** PPD cache and PWG conversion data ****/
 {
   int          num_bins;               /* Number of output bins */
-  _pwg_map_t   *bins;                  /* Output bins */
+  pwg_map_t    *bins;                  /* Output bins */
   int          num_sizes;              /* Number of media sizes */
-  _pwg_size_t  *sizes;                 /* Media sizes */
+  pwg_size_t   *sizes;                 /* Media sizes */
   int          custom_max_width,       /* Maximum custom width in 2540ths */
                custom_max_length,      /* Maximum custom length in 2540ths */
                custom_min_width,       /* Minimum custom width in 2540ths */
@@ -122,12 +122,12 @@ struct _ppd_cache_s                       /**** PPD cache and PWG conversion data ****/
   char         *custom_max_keyword,    /* Maximum custom size PWG keyword */
                *custom_min_keyword,    /* Minimum custom size PWG keyword */
                custom_ppd_size[41];    /* Custom PPD size name */
-  _pwg_size_t  custom_size;            /* Custom size record */
+  pwg_size_t   custom_size;            /* Custom size record */
   char         *source_option;         /* PPD option for media source */
   int          num_sources;            /* Number of media sources */
-  _pwg_map_t   *sources;               /* Media sources */
+  pwg_map_t    *sources;               /* Media sources */
   int          num_types;              /* Number of media types */
-  _pwg_map_t   *types;                 /* Media types */
+  pwg_map_t    *types;                 /* Media types */
   int          num_presets[_PWG_PRINT_COLOR_MODE_MAX][_PWG_PRINT_QUALITY_MAX];
                                        /* Number of print-color-mode/print-quality options */
   cups_option_t        *presets[_PWG_PRINT_COLOR_MODE_MAX][_PWG_PRINT_QUALITY_MAX];
@@ -179,7 +179,7 @@ extern const char   *_ppdCacheGetOutputBin(_ppd_cache_t *pc,
                                               const char *keyword);
 extern const char      *_ppdCacheGetPageSize(_ppd_cache_t *pc, ipp_t *job,
                                              const char *keyword, int *exact);
-extern _pwg_size_t     *_ppdCacheGetSize(_ppd_cache_t *pc,
+extern pwg_size_t      *_ppdCacheGetSize(_ppd_cache_t *pc,
                                          const char *page_size);
 extern const char      *_ppdCacheGetSource(_ppd_cache_t *pc,
                                            const char *input_slot);
@@ -207,7 +207,7 @@ extern const char   *_pwgInputSlotForSource(const char *media_source,
                                                char *name, size_t namesize);
 extern const char      *_pwgMediaTypeForType(const char *media_type,
                                              char *name, size_t namesize);
-extern const char      *_pwgPageSizeForMedia(_pwg_media_t *media,
+extern const char      *_pwgPageSizeForMedia(pwg_media_t *media,
                                              char *name, size_t namesize);
 
 
index 1c2940bf8824089b429cdfa9ef56ababe3ad21a4..cd392ef980220d8ad0d7e94c900fc3076607bbaf 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   PWG media name API implementation for CUPS.
  *
- *   Copyright 2009-2012 by Apple Inc.
+ *   Copyright 2009-2013 by Apple Inc.
  *
  *   These coded instructions, statements, and computer programs are the
  *   property of Apple Inc. and are protected by Federal copyright
  *
  * Contents:
  *
- *   _pwgFormatInches()      - Convert and format PWG units as inches.
- *   _pwgFormatMillimeters() - Convert and format PWG units as millimeters.
- *   _pwgGenerateSize()      - Generate a PWG size keyword.
- *   _pwgInitSize()         - Initialize a PWG size using IPP job template
- *                            attributes.
- *   _pwgMediaForLegacy()    - Find a PWG media size by ISO/IPP legacy name.
- *   _pwgMediaForPPD()      - Find a PWG media size by Adobe PPD name.
- *   _pwgMediaForPWG()      - Find a PWG media size by 5101.1 self-describing
- *                            name.
- *   _pwgMediaForSize()      - Get the PWG media name for a given size.
- *   pwg_compare_legacy()    - Compare two sizes using the legacy names.
- *   pwg_compare_ppd()      - Compare two sizes using the PPD names.
- *   pwg_compare_pwg()      - Compare two sizes using the PWG names.
+ *   pwgFormatSizeName()      - Generate a PWG self-describing media size name.
+ *   pwgInitSize()           - Initialize a pwg_size_t structure using IPP Job
+ *                             Template attributes.
+ *   pwgMediaForLegacy()      - Find a PWG media size by ISO/IPP legacy name.
+ *   pwgMediaForPPD()        - Find a PWG media size by Adobe PPD name.
+ *   pwgMediaForPWG()        - Find a PWG media size by 5101.1 self-describing
+ *                             name.
+ *   pwgMediaForSize()       - Get the PWG media size for the given
+ *                             dimensions.
+ *   pwg_compare_legacy()     - Compare two sizes using the legacy names.
+ *   pwg_compare_ppd()       - Compare two sizes using the PPD names.
+ *   pwg_compare_pwg()       - Compare two sizes using the PWG names.
+ *   pwg_format_inches()      - Convert and format PWG units as inches.
+ *   pwg_format_millimeters() - Convert and format PWG units as millimeters.
  */
 
 /*
  * Local functions...
  */
 
-static int     pwg_compare_legacy(_pwg_media_t *a, _pwg_media_t *b);
-static int     pwg_compare_pwg(_pwg_media_t *a, _pwg_media_t *b);
-static int     pwg_compare_ppd(_pwg_media_t *a, _pwg_media_t *b);
+static int     pwg_compare_legacy(pwg_media_t *a, pwg_media_t *b);
+static int     pwg_compare_pwg(pwg_media_t *a, pwg_media_t *b);
+static int     pwg_compare_ppd(pwg_media_t *a, pwg_media_t *b);
+static char    *pwg_format_inches(char *buf, size_t bufsize, int val);
+static char    *pwg_format_millimeters(char *buf, size_t bufsize, int val);
 
 
 /*
  * Local globals...
  */
 
-static _pwg_media_t const cups_pwg_media[] =
+static pwg_media_t const cups_pwg_media[] =
 {                                      /* Media size lookup table */
   /* North American Standard Sheet Media Sizes */
   _PWG_MEDIA_IN("na_index-3x5_3x5in", NULL, "3x5", 3, 5),
@@ -255,126 +258,122 @@ static _pwg_media_t const cups_pwg_media[] =
 
 
 /*
- * '_pwgFormatInches()' - Convert and format PWG units as inches.
+ * 'pwgFormatSizeName()' - Generate a PWG self-describing media size name.
+ *
+ * This function generates a PWG self-describing media size name of the form
+ * "prefix_name_WIDTHxLENGTHunits".  The prefix is typically "custom" or "roll"
+ * for user-supplied sizes but can also be "disc", "iso", "jis", "jpn", "na",
+ * "oe", "om", "prc", or "roc".  A value of @code NULL@ automatically chooses
+ * "oe" or "om" depending on the units.
+ *
+ * The size name may only contain lowercase letters, numbers, "-", and ".".  If
+ * @code NULL@ is passed, the size name will contain the formatted dimensions.
+ *
+ * The width and length are specified in hundredths of millimeters, equivalent
+ * to 1/100000th of a meter or 1/2540th of an inch.  The width, length, and
+ * units used for the generated size name are calculated automatically if the
+ * units string is @code NULL@, otherwise inches ("in") or millimeters ("mm")
+ * are used.
+ *
+ * @since CUPS 1.7@
  */
 
-char *                                 /* O - String */
-_pwgFormatInches(char   *buf,          /* I - Buffer */
-                 size_t bufsize,       /* I - Size of buffer */
-                 int    val)           /* I - Value in hundredths of millimeters */
+int                                    /* O - 1 on success, 0 on failure */
+pwgFormatSizeName(char       *keyword, /* I - Keyword buffer */
+                 size_t     keysize,   /* I - Size of keyword buffer */
+                 const char *prefix,   /* I - Prefix for PWG size or @code NULL@ for automatic */
+                 const char *name,     /* I - Size name or @code NULL@ */
+                 int        width,     /* I - Width of page in 2540ths */
+                 int        length,    /* I - Length of page in 2540ths */
+                 const char *units)    /* I - Units - "in", "mm", or @code NULL@ for automatic */
 {
-  int  thousandths,                    /* Thousandths of inches */
-       integer,                        /* Integer portion */
-       fraction;                       /* Fractional portion */
+  char         usize[12 + 1 + 12 + 3], /* Unit size: NNNNNNNNNNNNxNNNNNNNNNNNNuu */
+               *uptr;                  /* Pointer into unit size */
+  char         *(*format)(char *, size_t, int);
+                                       /* Formatting function */
 
 
  /*
-  * Convert hundredths of millimeters to thousandths of inches and round to
-  * the nearest thousandth.
+  * Range check input...
   */
 
-  thousandths = (val * 1000 + 1270) / 2540;
-  integer     = thousandths / 1000;
-  fraction    = thousandths % 1000;
+  DEBUG_printf(("pwgFormatSize(keyword=%p, keysize=" CUPS_LLFMT
+                ", prefix=\"%s\", name=\"%s\", width=%d, length=%d, "
+                "units=\"%s\")", keyword, CUPS_LLCAST keysize, prefix, name,
+                width, length, units));
 
- /*
-  * Format as a pair of integers (avoids locale stuff), avoiding trailing
-  * zeros...
-  */
+  if (keyword)
+    *keyword = '\0';
 
-  if (fraction == 0)
-    snprintf(buf, bufsize, "%d", integer);
-  else if (fraction % 10)
-    snprintf(buf, bufsize, "%d.%03d", integer, fraction);
-  else if (fraction % 100)
-    snprintf(buf, bufsize, "%d.%02d", integer, fraction / 10);
-  else
-    snprintf(buf, bufsize, "%d.%01d", integer, fraction / 100);
-
-  return (buf);
-}
-
-
-/*
- * '_pwgFormatMillimeters()' - Convert and format PWG units as millimeters.
- */
-
-char *                                 /* O - String */
-_pwgFormatMillimeters(char   *buf,     /* I - Buffer */
-                      size_t bufsize,  /* I - Size of buffer */
-                      int    val)      /* I - Value in hundredths of millimeters */
-{
-  int  integer,                        /* Integer portion */
-       fraction;                       /* Fractional portion */
-
-
- /*
-  * Convert hundredths of millimeters to integer and fractional portions.
-  */
+  if (!keyword || keysize < 32 || width < 0 || length < 0 ||
+      (units && strcmp(units, "in") && strcmp(units, "mm")))
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Invalid media name arguments."),
+                  1);
+    return (0);
+  }
 
-  integer     = val / 100;
-  fraction    = val % 100;
+  if (name)
+  {
+   /*
+    * Validate name...
+    */
 
- /*
-  * Format as a pair of integers (avoids locale stuff), avoiding trailing
-  * zeros...
-  */
+    const char *nameptr;               /* Pointer into name */
 
-  if (fraction == 0)
-    snprintf(buf, bufsize, "%d", integer);
-  else if (fraction % 10)
-    snprintf(buf, bufsize, "%d.%02d", integer, fraction);
+    for (nameptr = name; *nameptr; nameptr ++)
+      if (!(*nameptr >= 'a' && *nameptr <= 'z') &&
+          !(*nameptr >= '0' && *nameptr <= '9') &&
+          *nameptr != '.' && *nameptr != '-')
+      {
+        _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
+                      _("Invalid media name arguments."), 1);
+        return (0);
+      }
+  }
   else
-    snprintf(buf, bufsize, "%d.%01d", integer, fraction / 10);
-
-  return (buf);
-}
+    name = usize;
 
 
-/*
- * '_pwgGenerateSize()' - Generate a PWG size keyword.
- */
+  if (!units)
+  {
+    if ((width % 635) == 0 && (length % 635) == 0)
+    {
+     /*
+      * Use inches since the size is a multiple of 1/4 inch.
+      */
 
-void
-_pwgGenerateSize(char       *keyword,  /* I - Keyword buffer */
-                 size_t     keysize,   /* I - Size of keyword buffer */
-                const char *prefix,    /* I - Prefix for PWG size or NULL */
-                const char *name,      /* I - Size name or NULL */
-                int        width,      /* I - Width of page in 2540ths */
-                int        length)     /* I - Length of page in 2540ths */
-{
-  const char   *units;                 /* Units to report */
-  char         usize[12 + 1 + 12 + 3], /* Unit size: NNNNNNNNNNNNxNNNNNNNNNNNNuu */
-               *uptr;                  /* Pointer into unit size */
-  char         *(*format)(char *, size_t, int);
-                                       /* Formatting function */
+      units = "in";
+    }
+    else
+    {
+     /*
+      * Use millimeters since the size is not a multiple of 1/4 inch.
+      */
 
+      units = "mm";
+    }
+  }
 
-  if ((width % 635) == 0 && (length % 635) == 0)
+  if (!strcmp(units, "in"))
   {
-   /*
-    * Use inches since the size is a multiple of 1/4 inch.
-    */
-
-    units   = "in";
-    format  = _pwgFormatInches;
+    format = pwg_format_inches;
 
     if (!prefix)
       prefix = "oe";
   }
   else
   {
-   /*
-    * Use millimeters since the size is not a multiple of 1/4 inch.
-    */
-
-    units   = "mm";
-    format  = _pwgFormatMillimeters;
+    format = pwg_format_millimeters;
 
     if (!prefix)
       prefix = "om";
   }
 
+ /*
+  * Format the size string...
+  */
+
   uptr = usize;
   (*format)(uptr, sizeof(usize) - (uptr - usize), width);
   uptr += strlen(uptr);
@@ -388,25 +387,40 @@ _pwgGenerateSize(char       *keyword,     /* I - Keyword buffer */
 
   memcpy(uptr, units, 3);
 
-  if (!name)
-    name = usize;
-
  /*
   * Format the name...
   */
 
   snprintf(keyword, keysize, "%s_%s_%s", prefix, name, usize);
+
+  return (1);
 }
 
+/* For OS X 10.8 and earlier... */
+void _pwgGenerateSize(char *keyword, size_t keysize, const char *prefix,
+                     const char *name, int width, int length)
+{ pwgFormatSizeName(keyword, keysize, prefix, name, width, length, NULL); }
+
 
 /*
- * '_pwgInitSize()' - Initialize a PWG size using IPP job template attributes.
+ * 'pwgInitSize()' - Initialize a pwg_size_t structure using IPP Job Template
+ *                   attributes.
+ *
+ * This function initializes a pwg_size_t structure from an IPP "media" or
+ * "media-col" attribute in the specified IPP message.  0 is returned if neither
+ * attribute is found in the message or the values are not valid.
+ *
+ * The "margins_set" variable is initialized to 1 if any "media-xxx-margin"
+ * member attribute was specified in the "media-col" Job Template attribute,
+ * otherwise it is initialized to 0.
+ *
+ * @since CUPS 1.7@
  */
 
-int                                    /* O - 1 if size was initialize, 0 otherwise */
-_pwgInitSize(_pwg_size_t *size,                /* I - Size to initialize */
-             ipp_t       *job,         /* I - Job template attributes */
-            int         *margins_set)  /* O - 1 if margins were set, 0 otherwise */
+int                                    /* O - 1 if size was initialized, 0 otherwise */
+pwgInitSize(pwg_size_t *size,          /* I - Size to initialize */
+           ipp_t      *job,            /* I - Job template attributes */
+           int        *margins_set)    /* O - 1 if margins were set, 0 otherwise */
 {
   ipp_attribute_t *media,              /* media attribute */
                *media_bottom_margin,   /* media-bottom-margin member attribute */
@@ -417,7 +431,7 @@ _pwgInitSize(_pwg_size_t *size,             /* I - Size to initialize */
                *media_top_margin,      /* media-top-margin member attribute */
                *x_dimension,           /* x-dimension member attribute */
                *y_dimension;           /* y-dimension member attribute */
-  _pwg_media_t *pwg;                   /* PWG media value */
+  pwg_media_t  *pwg;                   /* PWG media value */
 
 
  /*
@@ -431,7 +445,7 @@ _pwgInitSize(_pwg_size_t *size,             /* I - Size to initialize */
   * Look for media-col and then media...
   */
 
-  memset(size, 0, sizeof(_pwg_size_t));
+  memset(size, 0, sizeof(pwg_size_t));
   *margins_set = 0;
 
   if ((media_col = ippFindAttribute(job, "media-col",
@@ -515,13 +529,13 @@ _pwgInitSize(_pwg_size_t *size,           /* I - Size to initialize */
       const char *name = media->values[0].string.text;
                                        /* Name string */
 
-      if ((pwg = _pwgMediaForPWG(name)) == NULL)
+      if ((pwg = pwgMediaForPWG(name)) == NULL)
       {
        /*
         * Not a PWG name, try a legacy name...
        */
 
-       if ((pwg = _pwgMediaForLegacy(name)) == NULL)
+       if ((pwg = pwgMediaForLegacy(name)) == NULL)
        {
         /*
          * Not a legacy name, try a PPD name...
@@ -529,7 +543,7 @@ _pwgInitSize(_pwg_size_t *size,             /* I - Size to initialize */
 
          const char    *suffix;        /* Suffix on media string */
 
-         pwg = _pwgMediaForPPD(name);
+         pwg = pwgMediaForPPD(name);
          if (pwg &&
              (suffix = name + strlen(name) - 10 /* .FullBleed */) > name &&
              !_cups_strcasecmp(suffix, ".FullBleed"))
@@ -564,16 +578,24 @@ _pwgInitSize(_pwg_size_t *size,           /* I - Size to initialize */
   return (1);
 }
 
+/* For OS X 10.8 and earlier */
+int _pwgInitSize(pwg_size_t *size, ipp_t *job, int *margins_set)
+{ return (pwgInitSize(size, job, margins_set)); }
+
 
 /*
- * '_pwgMediaForLegacy()' - Find a PWG media size by ISO/IPP legacy name.
+ * 'pwgMediaForLegacy()' - Find a PWG media size by ISO/IPP legacy name.
+ *
+ * The "name" argument specifies the legacy ISO media size name, for example
+ * "iso-a4" or "na-letter".
+ *
+ * @since CUPS 1.7@
  */
 
-_pwg_media_t *                         /* O - Matching size or NULL */
-_pwgMediaForLegacy(
-    const char *legacy)                        /* I - Legacy size name */
+pwg_media_t *                          /* O - Matching size or NULL */
+pwgMediaForLegacy(const char *legacy)  /* I - Legacy size name */
 {
-  _pwg_media_t key;                    /* Search key */
+  pwg_media_t  key;                    /* Search key */
   _cups_globals_t *cg = _cupsGlobals();        /* Global data */
 
 
@@ -591,13 +613,13 @@ _pwgMediaForLegacy(
   if (!cg->leg_size_lut)
   {
     int                        i;              /* Looping var */
-    _pwg_media_t       *size;          /* Current size */
+    pwg_media_t        *size;          /* Current size */
 
     cg->leg_size_lut = cupsArrayNew((cups_array_func_t)pwg_compare_legacy,
                                     NULL);
 
     for (i = (int)(sizeof(cups_pwg_media) / sizeof(cups_pwg_media[0])),
-             size = (_pwg_media_t *)cups_pwg_media;
+             size = (pwg_media_t *)cups_pwg_media;
         i > 0;
         i --, size ++)
       if (size->legacy)
@@ -609,18 +631,33 @@ _pwgMediaForLegacy(
   */
 
   key.legacy = legacy;
-  return ((_pwg_media_t *)cupsArrayFind(cg->leg_size_lut, &key));
+  return ((pwg_media_t *)cupsArrayFind(cg->leg_size_lut, &key));
 }
 
+/* For OS X 10.8 and earlier */
+pwg_media_t *_pwgMediaForLegacy(const char *legacy)
+{ return (pwgMediaForLegacy(legacy)); }
+
 
 /*
- * '_pwgMediaForPPD()' - Find a PWG media size by Adobe PPD name.
+ * 'pwgMediaForPPD()' - Find a PWG media size by Adobe PPD name.
+ *
+ * The "ppd" argument specifies an Adobe page size name as defined in Table B.1
+ * of the Adobe PostScript Printer Description File Format Specification Version
+ * 4.3.
+ *
+ * If the name is non-standard, the returned PWG media size is stored in
+ * thread-local storage and is overwritten by each call to the function in the
+ * thread.  Custom names can be of the form "Custom.WIDTHxLENGTH[units]" or
+ * "WIDTHxLENGTH[units]".
+ *
+ * @since CUPS 1.7@
  */
 
-_pwg_media_t *                         /* O - Matching size or NULL */
-_pwgMediaForPPD(const char *ppd)       /* I - PPD size name */
+pwg_media_t *                          /* O - Matching size or NULL */
+pwgMediaForPPD(const char *ppd)                /* I - PPD size name */
 {
-  _pwg_media_t key,                    /* Search key */
+  pwg_media_t  key,                    /* Search key */
                *size;                  /* Matching size */
   _cups_globals_t *cg = _cupsGlobals();        /* Global data */
 
@@ -643,7 +680,7 @@ _pwgMediaForPPD(const char *ppd)    /* I - PPD size name */
     cg->ppd_size_lut = cupsArrayNew((cups_array_func_t)pwg_compare_ppd, NULL);
 
     for (i = (int)(sizeof(cups_pwg_media) / sizeof(cups_pwg_media[0])),
-             size = (_pwg_media_t *)cups_pwg_media;
+             size = (pwg_media_t *)cups_pwg_media;
         i > 0;
         i --, size ++)
       if (size->ppd)
@@ -655,7 +692,7 @@ _pwgMediaForPPD(const char *ppd)    /* I - PPD size name */
   */
 
   key.ppd = ppd;
-  if ((size = (_pwg_media_t *)cupsArrayFind(cg->ppd_size_lut, &key)) == NULL)
+  if ((size = (pwg_media_t *)cupsArrayFind(cg->ppd_size_lut, &key)) == NULL)
   {
    /*
     * See if the name is of the form:
@@ -737,9 +774,9 @@ _pwgMediaForPPD(const char *ppd)    /* I - PPD size name */
        size->length = (int)(l * factor);
        size->pwg    = cg->pwg_name;
 
-       _pwgGenerateSize(cg->pwg_name, sizeof(cg->pwg_name),
-                        custom ? "custom" : NULL, custom ? ppd + 7 : NULL,
-                        size->width, size->length);
+       pwgFormatSizeName(cg->pwg_name, sizeof(cg->pwg_name),
+                         custom ? "custom" : NULL, custom ? ppd + 7 : NULL,
+                         size->width, size->length, NULL);
       }
     }
   }
@@ -747,16 +784,29 @@ _pwgMediaForPPD(const char *ppd)  /* I - PPD size name */
   return (size);
 }
 
+/* For OS X 10.8 and earlier */
+pwg_media_t *_pwgMediaForPPD(const char *ppd)
+{ return (pwgMediaForPPD(ppd)); }
+
 
 /*
- * '_pwgMediaForPWG()' - Find a PWG media size by 5101.1 self-describing name.
+ * 'pwgMediaForPWG()' - Find a PWG media size by 5101.1 self-describing name.
+ *
+ * The "pwg" argument specifies a self-describing media size name of the form
+ * "prefix_name_WIDTHxLENGTHunits" as defined in PWG 5101.1.
+ *
+ * If the name is non-standard, the returned PWG media size is stored in
+ * thread-local storage and is overwritten by each call to the function in the
+ * thread.
+ *
+ * @since CUPS 1.7@
  */
 
-_pwg_media_t *                         /* O - Matching size or NULL */
-_pwgMediaForPWG(const char *pwg)       /* I - PWG size name */
+pwg_media_t *                          /* O - Matching size or NULL */
+pwgMediaForPWG(const char *pwg)                /* I - PWG size name */
 {
   char         *ptr;                   /* Pointer into name */
-  _pwg_media_t key,                    /* Search key */
+  pwg_media_t  key,                    /* Search key */
                *size;                  /* Matching size */
   _cups_globals_t *cg = _cupsGlobals();        /* Global data */
 
@@ -779,7 +829,7 @@ _pwgMediaForPWG(const char *pwg)    /* I - PWG size name */
     cg->pwg_size_lut = cupsArrayNew((cups_array_func_t)pwg_compare_pwg, NULL);
 
     for (i = (int)(sizeof(cups_pwg_media) / sizeof(cups_pwg_media[0])),
-             size = (_pwg_media_t *)cups_pwg_media;
+             size = (pwg_media_t *)cups_pwg_media;
         i > 0;
         i --, size ++)
       cupsArrayAdd(cg->pwg_size_lut, size);
@@ -790,7 +840,7 @@ _pwgMediaForPWG(const char *pwg)    /* I - PWG size name */
   */
 
   key.pwg = pwg;
-  if ((size = (_pwg_media_t *)cupsArrayFind(cg->pwg_size_lut, &key)) == NULL &&
+  if ((size = (pwg_media_t *)cupsArrayFind(cg->pwg_size_lut, &key)) == NULL &&
       (ptr = (char *)strchr(pwg, '_')) != NULL &&
       (ptr = (char *)strchr(ptr + 1, '_')) != NULL)
   {
@@ -836,17 +886,30 @@ _pwgMediaForPWG(const char *pwg)  /* I - PWG size name */
   return (size);
 }
 
+/* For OS X 10.8 and earlier */
+pwg_media_t *_pwgMediaForPWG(const char *pwg)
+{ return (pwgMediaForPWG(pwg)); }
+
 
 /*
- * '_pwgMediaForSize()' - Get the PWG media name for a given size.
+ * 'pwgMediaForSize()' - Get the PWG media size for the given dimensions.
+ *
+ * The "width" and "length" are in hundredths of millimeters, equivalent to
+ * 1/100000th of a meter or 1/2540th of an inch.
+ *
+ * If the dimensions are non-standard, the returned PWG media size is stored in
+ * thread-local storage and is overwritten by each call to the function in the
+ * thread.
+ *
+ * @since CUPS 1.7@
  */
 
-_pwg_media_t *                         /* O - PWG media name */
-_pwgMediaForSize(int width,            /* I - Width in 2540ths */
-                int length)            /* I - Length in 2540ths */
+pwg_media_t *                          /* O - PWG media name */
+pwgMediaForSize(int width,             /* I - Width in hundredths of millimeters */
+               int length)             /* I - Length in hundredths of millimeters */
 {
   int          i;                      /* Looping var */
-  _pwg_media_t *media,                 /* Current media */
+  pwg_media_t  *media,                 /* Current media */
                *best_media = NULL;     /* Best match */
   int          dw, dl,                 /* Difference in width and length */
                best_dw = 999,          /* Best difference in width and length */
@@ -866,7 +929,7 @@ _pwgMediaForSize(int width,         /* I - Width in 2540ths */
   */
 
   for (i = (int)(sizeof(cups_pwg_media) / sizeof(cups_pwg_media[0])),
-          media = (_pwg_media_t *)cups_pwg_media;
+          media = (pwg_media_t *)cups_pwg_media;
        i > 0;
        i --, media ++)
   {
@@ -900,8 +963,8 @@ _pwgMediaForSize(int width,         /* I - Width in 2540ths */
   *     custom_WIDTHxHEIGHTuu_WIDTHxHEIGHTuu
   */
 
-  _pwgGenerateSize(cg->pwg_name, sizeof(cg->pwg_name), "custom", NULL, width,
-                   length);
+  pwgFormatSizeName(cg->pwg_name, sizeof(cg->pwg_name), "custom", NULL, width,
+                    length, NULL);
 
   cg->pwg_media.pwg    = cg->pwg_name;
   cg->pwg_media.width  = width;
@@ -910,14 +973,18 @@ _pwgMediaForSize(int width,               /* I - Width in 2540ths */
   return (&(cg->pwg_media));
 }
 
+/* For OS X 10.8 and earlier */
+pwg_media_t *_pwgMediaForSize(int width, int length)
+{ return (pwgMediaForSize(width, length)); }
+
 
 /*
  * 'pwg_compare_legacy()' - Compare two sizes using the legacy names.
  */
 
 static int                             /* O - Result of comparison */
-pwg_compare_legacy(_pwg_media_t *a,    /* I - First size */
-                   _pwg_media_t *b)    /* I - Second size */
+pwg_compare_legacy(pwg_media_t *a,     /* I - First size */
+                   pwg_media_t *b)     /* I - Second size */
 {
   return (strcmp(a->legacy, b->legacy));
 }
@@ -928,8 +995,8 @@ pwg_compare_legacy(_pwg_media_t *a, /* I - First size */
  */
 
 static int                             /* O - Result of comparison */
-pwg_compare_ppd(_pwg_media_t *a,       /* I - First size */
-                _pwg_media_t *b)       /* I - Second size */
+pwg_compare_ppd(pwg_media_t *a,        /* I - First size */
+                pwg_media_t *b)        /* I - Second size */
 {
   return (strcmp(a->ppd, b->ppd));
 }
@@ -940,13 +1007,90 @@ pwg_compare_ppd(_pwg_media_t *a, /* I - First size */
  */
 
 static int                             /* O - Result of comparison */
-pwg_compare_pwg(_pwg_media_t *a,       /* I - First size */
-                _pwg_media_t *b)       /* I - Second size */
+pwg_compare_pwg(pwg_media_t *a,        /* I - First size */
+                pwg_media_t *b)        /* I - Second size */
 {
   return (strcmp(a->pwg, b->pwg));
 }
 
 
+/*
+ * 'pwg_format_inches()' - Convert and format PWG units as inches.
+ */
+
+static char *                          /* O - String */
+pwg_format_inches(char   *buf,         /* I - Buffer */
+                 size_t bufsize,       /* I - Size of buffer */
+                 int    val)           /* I - Value in hundredths of millimeters */
+{
+  int  thousandths,                    /* Thousandths of inches */
+       integer,                        /* Integer portion */
+       fraction;                       /* Fractional portion */
+
+
+ /*
+  * Convert hundredths of millimeters to thousandths of inches and round to
+  * the nearest thousandth.
+  */
+
+  thousandths = (val * 1000 + 1270) / 2540;
+  integer     = thousandths / 1000;
+  fraction    = thousandths % 1000;
+
+ /*
+  * Format as a pair of integers (avoids locale stuff), avoiding trailing
+  * zeros...
+  */
+
+  if (fraction == 0)
+    snprintf(buf, bufsize, "%d", integer);
+  else if (fraction % 10)
+    snprintf(buf, bufsize, "%d.%03d", integer, fraction);
+  else if (fraction % 100)
+    snprintf(buf, bufsize, "%d.%02d", integer, fraction / 10);
+  else
+    snprintf(buf, bufsize, "%d.%01d", integer, fraction / 100);
+
+  return (buf);
+}
+
+
+/*
+ * 'pwg_format_millimeters()' - Convert and format PWG units as millimeters.
+ */
+
+static char *                          /* O - String */
+pwg_format_millimeters(char   *buf,    /* I - Buffer */
+                      size_t bufsize,  /* I - Size of buffer */
+                      int    val)      /* I - Value in hundredths of millimeters */
+{
+  int  integer,                        /* Integer portion */
+       fraction;                       /* Fractional portion */
+
+
+ /*
+  * Convert hundredths of millimeters to integer and fractional portions.
+  */
+
+  integer     = val / 100;
+  fraction    = val % 100;
+
+ /*
+  * Format as a pair of integers (avoids locale stuff), avoiding trailing
+  * zeros...
+  */
+
+  if (fraction == 0)
+    snprintf(buf, bufsize, "%d", integer);
+  else if (fraction % 10)
+    snprintf(buf, bufsize, "%d.%02d", integer, fraction);
+  else
+    snprintf(buf, bufsize, "%d.%01d", integer, fraction / 10);
+
+  return (buf);
+}
+
+
 /*
  * End of "$Id$".
  */
index 33361c1c04f59a53fe28d5ba4019b0c445a3eef4..ad097bf531b96387cdf4b279c480bdf43575f6e1 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   Private PWG media API definitions for CUPS.
  *
- *   Copyright 2009-2012 by Apple Inc.
+ *   Copyright 2009-2013 by Apple Inc.
  *
  *   These coded instructions, statements, and computer programs are the
  *   property of Apple Inc. and are protected by Federal copyright
@@ -35,63 +35,36 @@ extern "C" {
 
 
 /*
- * Macros...
+ * Deprecated stuff for prior users of the private PWG media API...
  */
 
-/* Convert from points to 2540ths */
-#  define _PWG_FROMPTS(n)      (int)(((n) * 2540 + 36) / 72)
-/* Convert from 2540ths to points */
-#  define _PWG_TOPTS(n)                ((n) * 72.0 / 2540.0)
-
-
-/*
- * Types and structures...
- */
-
-typedef struct _pwg_map_s              /**** Map element - PPD to/from PWG */
-{
-  char         *pwg,                   /* PWG media keyword */
-               *ppd;                   /* PPD option keyword */
-} _pwg_map_t;
-
-typedef struct _pwg_media_s            /**** Common media size data ****/
-{
-  const char   *pwg,                   /* PWG 5101.1 "self describing" name */
-               *legacy,                /* IPP/ISO legacy name */
-               *ppd;                   /* Standard Adobe PPD name */
-  int          width,                  /* Width in 2540ths */
-               length;                 /* Length in 2540ths */
-} _pwg_media_t;
-
-typedef struct _pwg_size_s             /**** Size element - PPD to/from PWG */
-{
-  _pwg_map_t   map;                    /* Map element */
-  int          width,                  /* Width in 2540ths */
-               length,                 /* Length in 2540ths */
-               left,                   /* Left margin in 2540ths */
-               bottom,                 /* Bottom margin in 2540ths */
-               right,                  /* Right margin in 2540ths */
-               top;                    /* Top margin in 2540ths */
-} _pwg_size_t;
+#  ifndef _CUPS_NO_DEPRECATED
+typedef struct pwg_map_s _pwg_map_t;
+typedef struct pwg_media_s _pwg_media_t;
+typedef struct pwg_size_s _pwg_size_t;
+#  endif /* _CUPS_NO_DEPRECATED */
 
 
 /*
  * Functions...
  */
 
-extern char            *_pwgFormatInches(char *buf, size_t bufsize, int val);
-extern char            *_pwgFormatMillimeters(char *buf, size_t bufsize,
-                                              int val);
 extern void            _pwgGenerateSize(char *keyword, size_t keysize,
                                         const char *prefix,
                                         const char *name,
-                                        int width, int length);
-extern int             _pwgInitSize(_pwg_size_t *size, ipp_t *job,
-                                    int *margins_set);
-extern _pwg_media_t    *_pwgMediaForLegacy(const char *legacy);
-extern _pwg_media_t    *_pwgMediaForPPD(const char *ppd);
-extern _pwg_media_t    *_pwgMediaForPWG(const char *pwg);
-extern _pwg_media_t    *_pwgMediaForSize(int width, int length);
+                                        int width, int length)
+                                        _CUPS_INTERNAL_MSG("Use pwgFormatSizeName instead.");
+extern int             _pwgInitSize(pwg_size_t *size, ipp_t *job,
+                                    int *margins_set)
+                                    _CUPS_INTERNAL_MSG("Use pwgInitSize instead.");
+extern pwg_media_t     *_pwgMediaForLegacy(const char *legacy)
+                           _CUPS_INTERNAL_MSG("Use pwgMediaForLegacy instead.");
+extern pwg_media_t     *_pwgMediaForPPD(const char *ppd)
+                           _CUPS_INTERNAL_MSG("Use pwgMediaForPPD instead.");
+extern pwg_media_t     *_pwgMediaForPWG(const char *pwg)
+                           _CUPS_INTERNAL_MSG("Use pwgMediaForPWG instead.");
+extern pwg_media_t     *_pwgMediaForSize(int width, int length)
+                           _CUPS_INTERNAL_MSG("Use pwgMediaForSize instead.");
 
 #  ifdef __cplusplus
 }
diff --git a/cups/pwg.h b/cups/pwg.h
new file mode 100644 (file)
index 0000000..505778e
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * "$Id$"
+ *
+ *   PWG media API definitions for CUPS.
+ *
+ *   Copyright 2009-2013 by Apple Inc.
+ *
+ *   These coded instructions, statements, and computer programs are the
+ *   property of Apple Inc. 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
+ *   file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ *   This file is subject to the Apple OS-Developed Software exception.
+ */
+
+#ifndef _CUPS_PWG_H_
+#  define _CUPS_PWG_H_
+
+
+/*
+ * C++ magic...
+ */
+
+#  ifdef __cplusplus
+extern "C" {
+#  endif /* __cplusplus */
+
+
+/*
+ * Macros...
+ */
+
+/* Convert from points to hundredths of millimeters */
+#  define PWG_FROM_POINTS(n)   (int)(((n) * 2540 + 36) / 72)
+/* Convert from hundredths of millimeters to points */
+#  define PWG_TO_POINTS(n)     ((n) * 72.0 / 2540.0)
+
+
+/*
+ * Types and structures...
+ */
+
+typedef struct pwg_map_s               /**** Map element - PPD to/from PWG */
+{
+  char         *pwg,                   /* PWG media keyword */
+               *ppd;                   /* PPD option keyword */
+} pwg_map_t;
+
+typedef struct pwg_media_s             /**** Common media size data ****/
+{
+  const char   *pwg,                   /* PWG 5101.1 "self describing" name */
+               *legacy,                /* IPP/ISO legacy name */
+               *ppd;                   /* Standard Adobe PPD name */
+  int          width,                  /* Width in 2540ths */
+               length;                 /* Length in 2540ths */
+} pwg_media_t;
+
+typedef struct pwg_size_s              /**** Size element - PPD to/from PWG */
+{
+  pwg_map_t    map;                    /* Map element */
+  int          width,                  /* Width in 2540ths */
+               length,                 /* Length in 2540ths */
+               left,                   /* Left margin in 2540ths */
+               bottom,                 /* Bottom margin in 2540ths */
+               right,                  /* Right margin in 2540ths */
+               top;                    /* Top margin in 2540ths */
+} pwg_size_t;
+
+
+/*
+ * Functions...
+ */
+
+extern int             pwgFormatSizeName(char *keyword, size_t keysize,
+                                         const char *prefix, const char *name,
+                                         int width, int length,
+                                         const char *units) _CUPS_API_1_7;
+extern int             pwgInitSize(pwg_size_t *size, ipp_t *job,
+                                   int *margins_set) _CUPS_API_1_7;
+extern pwg_media_t     *pwgMediaForLegacy(const char *legacy) _CUPS_API_1_7;
+extern pwg_media_t     *pwgMediaForPPD(const char *ppd) _CUPS_API_1_7;
+extern pwg_media_t     *pwgMediaForPWG(const char *pwg) _CUPS_API_1_7;
+extern pwg_media_t     *pwgMediaForSize(int width, int length) _CUPS_API_1_7;
+
+#  ifdef __cplusplus
+}
+#  endif /* __cplusplus */
+
+#endif /* !_CUPS_PWG_H_ */
+
+/*
+ * End of "$Id$".
+ */
index f5f2638d03bb3bd731b61a785433b9a9f463619c..5b0559dc7f1519639b4198c71b70917f318473d0 100644 (file)
@@ -358,7 +358,8 @@ cupsGetResponse(http_t     *http,   /* I - Connection to server or @code CUPS_HTTP
   if (!http)
     http = _cupsConnect();
 
-  if (!http || (http->state != HTTP_STATE_POST_RECV && http->state != HTTP_STATE_POST_SEND))
+  if (!http || (http->state != HTTP_STATE_POST_RECV &&
+                http->state != HTTP_STATE_POST_SEND))
     return (NULL);
 
  /*
index c4bd08e9b725f41180f8ab3f59b286d6097c1cc7..e6823abd1265b73fc2fc6e287a1b3fc1ba86ca7c 100644 (file)
@@ -131,6 +131,8 @@ static uri_test_t   uri_tests[] =   /* URI test data */
                            "http", "", "", "", 80, 0 },
                          { HTTP_URI_STATUS_BAD_HOSTNAME, "http://serve%7/index.html",
                            "http", "", "", "", 80, 0 },
+                         { HTTP_URI_STATUS_BAD_HOSTNAME, "http://server with spaces/index.html",
+                           "http", "", "", "", 80, 0 },
 
                          /* Bad port number */
                          { HTTP_URI_STATUS_BAD_PORT, "http://127.0.0.1:9999a/index.html",
@@ -138,6 +140,8 @@ static uri_test_t   uri_tests[] =   /* URI test data */
 
                          /* Bad resource */
                          { HTTP_URI_STATUS_BAD_RESOURCE, "http://server/index.html%",
+                           "http", "", "server", "", 80, 0 },
+                         { HTTP_URI_STATUS_BAD_RESOURCE, "http://server/index with spaces.html",
                            "http", "", "server", "", 80, 0 }
                        };
 static const char * const base64_tests[][2] =
index a352f9ffc9192b6c1ae1be3ecb1799be2483a3b7..b3d5cead52fddfcca1949036e30e32e1639552a1 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   PWG test program for CUPS.
  *
- *   Copyright 2009-2012 by Apple Inc.
+ *   Copyright 2009-2013 by Apple Inc.
  *
  *   These coded instructions, statements, and computer programs are the
  *   property of Apple Inc. and are protected by Federal copyright
@@ -49,7 +49,7 @@ main(int  argc,                               /* I - Number of command-line args */
   const char   *ppdfile;               /* PPD filename */
   ppd_file_t   *ppd;                   /* PPD file */
   _ppd_cache_t *pc;                    /* PPD cache and PWG mapping data */
-  _pwg_media_t *pwgmedia;              /* PWG media size */
+  pwg_media_t  *pwgmedia;              /* PWG media size */
 
 
   status = 0;
@@ -151,8 +151,8 @@ main(int  argc,                             /* I - Number of command-line args */
     puts("PASS");
   }
 
-  fputs("_pwgMediaForPWG(\"iso_a4_210x297mm\"): ", stdout);
-  if ((pwgmedia = _pwgMediaForPWG("iso_a4_210x297mm")) == NULL)
+  fputs("pwgMediaForPWG(\"iso_a4_210x297mm\"): ", stdout);
+  if ((pwgmedia = pwgMediaForPWG("iso_a4_210x297mm")) == NULL)
   {
     puts("FAIL (not found)");
     status ++;
@@ -170,8 +170,8 @@ main(int  argc,                             /* I - Number of command-line args */
   else
     puts("PASS");
 
-  fputs("_pwgMediaForLegacy(\"na-letter\"): ", stdout);
-  if ((pwgmedia = _pwgMediaForLegacy("na-letter")) == NULL)
+  fputs("pwgMediaForLegacy(\"na-letter\"): ", stdout);
+  if ((pwgmedia = pwgMediaForLegacy("na-letter")) == NULL)
   {
     puts("FAIL (not found)");
     status ++;
@@ -189,8 +189,8 @@ main(int  argc,                             /* I - Number of command-line args */
   else
     puts("PASS");
 
-  fputs("_pwgMediaForPPD(\"4x6\"): ", stdout);
-  if ((pwgmedia = _pwgMediaForPPD("4x6")) == NULL)
+  fputs("pwgMediaForPPD(\"4x6\"): ", stdout);
+  if ((pwgmedia = pwgMediaForPPD("4x6")) == NULL)
   {
     puts("FAIL (not found)");
     status ++;
@@ -208,8 +208,8 @@ main(int  argc,                             /* I - Number of command-line args */
   else
     puts("PASS");
 
-  fputs("_pwgMediaForPPD(\"10x15cm\"): ", stdout);
-  if ((pwgmedia = _pwgMediaForPPD("10x15cm")) == NULL)
+  fputs("pwgMediaForPPD(\"10x15cm\"): ", stdout);
+  if ((pwgmedia = pwgMediaForPPD("10x15cm")) == NULL)
   {
     puts("FAIL (not found)");
     status ++;
@@ -227,8 +227,8 @@ main(int  argc,                             /* I - Number of command-line args */
   else
     puts("PASS");
 
-  fputs("_pwgMediaForPPD(\"Custom.10x15cm\"): ", stdout);
-  if ((pwgmedia = _pwgMediaForPPD("Custom.10x15cm")) == NULL)
+  fputs("pwgMediaForPPD(\"Custom.10x15cm\"): ", stdout);
+  if ((pwgmedia = pwgMediaForPPD("Custom.10x15cm")) == NULL)
   {
     puts("FAIL (not found)");
     status ++;
@@ -246,8 +246,8 @@ main(int  argc,                             /* I - Number of command-line args */
   else
     puts("PASS");
 
-  fputs("_pwgMediaForSize(29700, 42000): ", stdout);
-  if ((pwgmedia = _pwgMediaForSize(29700, 42000)) == NULL)
+  fputs("pwgMediaForSize(29700, 42000): ", stdout);
+  if ((pwgmedia = pwgMediaForSize(29700, 42000)) == NULL)
   {
     puts("FAIL (not found)");
     status ++;
@@ -260,8 +260,8 @@ main(int  argc,                             /* I - Number of command-line args */
   else
     puts("PASS");
 
-  fputs("_pwgMediaForSize(9842, 19050): ", stdout);
-  if ((pwgmedia = _pwgMediaForSize(9842, 19050)) == NULL)
+  fputs("pwgMediaForSize(9842, 19050): ", stdout);
+  if ((pwgmedia = pwgMediaForSize(9842, 19050)) == NULL)
   {
     puts("FAIL (not found)");
     status ++;
@@ -274,8 +274,8 @@ main(int  argc,                             /* I - Number of command-line args */
   else
     printf("PASS (%s)\n", pwgmedia->pwg);
 
-  fputs("_pwgMediaForSize(9800, 19000): ", stdout);
-  if ((pwgmedia = _pwgMediaForSize(9800, 19000)) == NULL)
+  fputs("pwgMediaForSize(9800, 19000): ", stdout);
+  if ((pwgmedia = pwgMediaForSize(9800, 19000)) == NULL)
   {
     puts("FAIL (not found)");
     status ++;
@@ -361,9 +361,9 @@ test_ppd_cache(_ppd_cache_t *pc,    /* I - PWG mapping data */
   int          i,                      /* Looping var */
                status = 0;             /* Return status */
   _ppd_cache_t *pc2;                   /* Loaded data */
-  _pwg_size_t  *size,                  /* Size from original */
+  pwg_size_t   *size,                  /* Size from original */
                *size2;                 /* Size from saved */
-  _pwg_map_t   *map,                   /* Map from original */
+  pwg_map_t    *map,                   /* Map from original */
                *map2;                  /* Map from saved */
 
 
index 244dbe772e60ee1732aa5ee33ccf6b6f5c960d27..e9f215ec0758888ae6f894affd2b8d8e48771615 100644 (file)
@@ -1031,36 +1031,7 @@ cups_read_client_conf(
   }
 
   if ((!cg->server[0] || !cg->ipp_port) && cups_server)
-  {
-    if (!cg->server[0])
-    {
-     /*
-      * Copy server name...
-      */
-
-      strlcpy(cg->server, cups_server, sizeof(cg->server));
-
-      if (cg->server[0] != '/' && (value = strrchr(cg->server, ':')) != NULL &&
-         !strchr(value, ']') && isdigit(value[1] & 255))
-        *value++ = '\0';
-      else
-        value = NULL;
-
-      if (cg->server[0] == '/')
-       strlcpy(cg->servername, "localhost", sizeof(cg->servername));
-      else
-       strlcpy(cg->servername, cg->server, sizeof(cg->servername));
-    }
-    else if (cups_server[0] != '/' &&
-             (value = strrchr(cups_server, ':')) != NULL &&
-            !strchr(value, ']') && isdigit(value[1] & 255))
-      value ++;
-    else
-      value = NULL;
-
-    if (!cg->ipp_port && value)
-      cg->ipp_port = atoi(value);
-  }
+    cupsSetServer(cups_server);
 
   if (!cg->server[0])
   {
index 12f18e83b1ec0ce715cf6cdaaf69f9f8722f390f..0ce2a199ca081e7bcb8d4d87c4b41216385d4c6d 100644 (file)
@@ -415,6 +415,9 @@ destination.">cupsCopyDestInfo</a></li>
        <li><a href="#cupsEncryption" title="Get the current encryption settings.">cupsEncryption</a></li>
        <li><a href="#cupsEnumDests" title="Enumerate available destinations with a callback function.">cupsEnumDests</a></li>
        <li><a href="#cupsEnumDestsBlock" title="Enumerate available destinations with a block.">cupsEnumDestsBlock</a></li>
+       <li><a href="#cupsFindDestDefault" title="Find the default value(s) for the given option.">cupsFindDestDefault</a></li>
+       <li><a href="#cupsFindDestReady" title="Find the default value(s) for the given option.">cupsFindDestReady</a></li>
+       <li><a href="#cupsFindDestSupported" title="Find the default value(s) for the given option.">cupsFindDestSupported</a></li>
        <li><a href="#cupsFinishDestDocument" title="Finish the current document.">cupsFinishDestDocument</a></li>
        <li><a href="#cupsFinishDocument" title="Finish sending a document.">cupsFinishDocument</a></li>
        <li><a href="#cupsFreeDestInfo" title="Free destination information obtained using
@@ -426,8 +429,13 @@ cupsCopyDestInfo.">cupsFreeDestInfo</a></li>
        <li><a href="#cupsGetDefault" title="Get the default printer or class for the default server.">cupsGetDefault</a></li>
        <li><a href="#cupsGetDefault2" title="Get the default printer or class for the specified server.">cupsGetDefault2</a></li>
        <li><a href="#cupsGetDest" title="Get the named destination from the list.">cupsGetDest</a></li>
+       <li><a href="#cupsGetDestMediaByIndex" title="Get a media name, dimension, and margins for a
+specific size.">cupsGetDestMediaByIndex</a></li>
        <li><a href="#cupsGetDestMediaByName" title="Get media names, dimensions, and margins.">cupsGetDestMediaByName</a></li>
        <li><a href="#cupsGetDestMediaBySize" title="Get media names, dimensions, and margins.">cupsGetDestMediaBySize</a></li>
+       <li><a href="#cupsGetDestMediaCount" title="Get the number of sizes supported by a
+destination.">cupsGetDestMediaCount</a></li>
+       <li><a href="#cupsGetDestMediaDefault" title="Get the default size for a destination.">cupsGetDestMediaDefault</a></li>
        <li><a href="#cupsGetDests" title="Get the list of destinations from the default server.">cupsGetDests</a></li>
        <li><a href="#cupsGetDests2" title="Get the list of destinations from the specified server.">cupsGetDests2</a></li>
        <li><a href="#cupsGetJobs" title="Get the jobs from the default server.">cupsGetJobs</a></li>
@@ -486,6 +494,13 @@ connections.">cupsSetCredentials</a></li>
        <li><a href="#cupsTempFile2" title="Creates a temporary CUPS file.">cupsTempFile2</a></li>
        <li><a href="#cupsUser" title="Return the current user's name.">cupsUser</a></li>
        <li><a href="#cupsUserAgent" title="Return the default HTTP User-Agent string.">cupsUserAgent</a></li>
+       <li><a href="#pwgFormatSizeName" title="Generate a PWG self-describing media size name.">pwgFormatSizeName</a></li>
+       <li><a href="#pwgInitSize" title="Initialize a pwg_size_t structure using IPP Job Template
+attributes.">pwgInitSize</a></li>
+       <li><a href="#pwgMediaForLegacy" title="Find a PWG media size by ISO/IPP legacy name.">pwgMediaForLegacy</a></li>
+       <li><a href="#pwgMediaForPPD" title="Find a PWG media size by Adobe PPD name.">pwgMediaForPPD</a></li>
+       <li><a href="#pwgMediaForPWG" title="Find a PWG media size by 5101.1 self-describing name.">pwgMediaForPWG</a></li>
+       <li><a href="#pwgMediaForSize" title="Get the PWG media size for the given dimensions.">pwgMediaForSize</a></li>
 </ul></li>
 <li><a href="#TYPES">Data Types</a><ul class="code">
        <li><a href="#cups_client_cert_cb_t" title="Client credentials callback
@@ -508,6 +523,9 @@ information ">cups_dinfo_t</a></li>
        <li><a href="#cups_server_cert_cb_t" title="Server credentials callback
 ">cups_server_cert_cb_t</a></li>
        <li><a href="#cups_size_t" title="Media Size ">cups_size_t</a></li>
+       <li><a href="#pwg_map_t" title="Map element - PPD to/from PWG">pwg_map_t</a></li>
+       <li><a href="#pwg_media_t" title="Common media size data">pwg_media_t</a></li>
+       <li><a href="#pwg_size_t" title="Size element - PPD to/from PWG">pwg_size_t</a></li>
 </ul></li>
 <li><a href="#STRUCTURES">Structures</a><ul class="code">
        <li><a href="#cups_dest_s" title="Destination">cups_dest_s</a></li>
@@ -515,6 +533,9 @@ information ">cups_dinfo_t</a></li>
        <li><a href="#cups_option_s" title="Printer Options">cups_option_s</a></li>
        <li><a href="#cups_size_s" title="Media Size ">cups_size_s</a></li>
        <li><a href="#pollfd" title="User data (unused)">pollfd</a></li>
+       <li><a href="#pwg_map_s" title="Map element - PPD to/from PWG">pwg_map_s</a></li>
+       <li><a href="#pwg_media_s" title="Common media size data">pwg_media_s</a></li>
+       <li><a href="#pwg_size_s" title="Size element - PPD to/from PWG">pwg_size_s</a></li>
 </ul></li>
 <li><a href="#VARIABLES">Variables</a><ul class="code">
        <li><a href="#CF_RETURNS_RETAINED" title="Get the Apple language identifier associated with a
@@ -1141,7 +1162,7 @@ ipp_status_t cupsCancelDestJob (<br>
 <p class="description">Cancel a job on a destination.</p>
 <p class="discussion">The &quot;job_id&quot; is the number returned by cupsCreateDestJob.<br>
 <br>
-Returns IPP_OK on success and IPP_NOT_AUTHORIZED or IPP_FORBIDDEN on
+Returns IPP_STATUS_OK on success and IPP_NOT_AUTHORIZED or IPP_FORBIDDEN on
 failure.
 
 </p>
@@ -1254,7 +1275,7 @@ ipp_status_t cupsCloseDestJob (<br>
 <p class="description">IPP status code</p>
 <h4 class="discussion">Discussion</h4>
 <p class="discussion">Use when the last call to cupsStartDocument passed 0 for &quot;last_document&quot;.
-&quot;job_id&quot; is the job ID returned by cupsCreateDestJob. Returns <code>IPP_OK</code>
+&quot;job_id&quot; is the job ID returned by cupsCreateDestJob. Returns <code>IPP_STATUS_OK</code>
 on success.
 
 </p>
@@ -1475,7 +1496,7 @@ ipp_status_t cupsCreateDestJob (<br>
 <h4 class="returnvalue">Return Value</h4>
 <p class="description">IPP status code</p>
 <h4 class="discussion">Discussion</h4>
-<p class="discussion">Returns <code>IPP_OK</code> or <code>IPP_OK_SUBST</code> on success, saving the job ID
+<p class="discussion">Returns <code>IPP_STATUS_OK</code> or <code>IPP_STATUS_OK_SUBST</code> on success, saving the job ID
 in the variable pointed to by &quot;job_id&quot;.
 
 </p>
@@ -1522,7 +1543,7 @@ http_encryption_t cupsEncryption (void);</p>
 <p class="discussion">The default encryption setting comes from the CUPS_ENCRYPTION
 environment variable, then the ~/.cups/client.conf file, and finally the
 /etc/cups/client.conf file. If not set, the default is
-<code>HTTP_ENCRYPT_IF_REQUESTED</code>.<br>
+<code>HTTP_ENCRYPTION_IF_REQUESTED</code>.<br>
 <br>
 Note: The current encryption setting is tracked separately for each thread
 in a program. Multi-threaded programs that override the setting via the
@@ -1607,6 +1628,96 @@ continue enumeration or 0 to stop.<br>
 Enumeration happens on the current thread and does not return until all
 destinations have been enumerated or the block returns 0.
 
+</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="cupsFindDestDefault">cupsFindDestDefault</a></h3>
+<p class="description">Find the default value(s) for the given option.</p>
+<p class="code">
+ipp_attribute_t *cupsFindDestDefault (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *dinfo,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *option<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>http</dt>
+<dd class="description">Connection to destination</dd>
+<dt>dest</dt>
+<dd class="description">Destination</dd>
+<dt>dinfo</dt>
+<dd class="description">Destination information</dd>
+<dt>option</dt>
+<dd class="description">Option/attribute name</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">Default attribute or <code>NULL</code> for none</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">The returned value is an IPP attribute. Use the <code>ippGetBoolean</code>,
+<code>ippGetCollection</code>, <code>ippGetCount</code>, <code>ippGetDate</code>,
+<code>ippGetInteger</code>, <code>ippGetOctetString</code>, <code>ippGetRange</code>,
+<code>ippGetResolution</code>, <code>ippGetString</code>, and <code>ippGetValueTag</code>
+functions to inspect the default value(s) as needed.
+
+</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="cupsFindDestReady">cupsFindDestReady</a></h3>
+<p class="description">Find the default value(s) for the given option.</p>
+<p class="code">
+ipp_attribute_t *cupsFindDestReady (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *dinfo,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *option<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>http</dt>
+<dd class="description">Connection to destination</dd>
+<dt>dest</dt>
+<dd class="description">Destination</dd>
+<dt>dinfo</dt>
+<dd class="description">Destination information</dd>
+<dt>option</dt>
+<dd class="description">Option/attribute name</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">Default attribute or <code>NULL</code> for none</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">The returned value is an IPP attribute. Use the <code>ippGetBoolean</code>,
+<code>ippGetCollection</code>, <code>ippGetCount</code>, <code>ippGetDate</code>,
+<code>ippGetInteger</code>, <code>ippGetOctetString</code>, <code>ippGetRange</code>,
+<code>ippGetResolution</code>, <code>ippGetString</code>, and <code>ippGetValueTag</code>
+functions to inspect the default value(s) as needed.
+
+</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="cupsFindDestSupported">cupsFindDestSupported</a></h3>
+<p class="description">Find the default value(s) for the given option.</p>
+<p class="code">
+ipp_attribute_t *cupsFindDestSupported (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *dinfo,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *option<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>http</dt>
+<dd class="description">Connection to destination</dd>
+<dt>dest</dt>
+<dd class="description">Destination</dd>
+<dt>dinfo</dt>
+<dd class="description">Destination information</dd>
+<dt>option</dt>
+<dd class="description">Option/attribute name</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">Default attribute or <code>NULL</code> for none</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">The returned value is an IPP attribute. Use the <code>ippGetBoolean</code>,
+<code>ippGetCollection</code>, <code>ippGetCount</code>, <code>ippGetDate</code>,
+<code>ippGetInteger</code>, <code>ippGetOctetString</code>, <code>ippGetRange</code>,
+<code>ippGetResolution</code>, <code>ippGetString</code>, and <code>ippGetValueTag</code>
+functions to inspect the default value(s) as needed.
+
 </p>
 <h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsFinishDestDocument">cupsFinishDestDocument</a></h3>
 <p class="description">Finish the current document.</p>
@@ -1628,7 +1739,7 @@ ipp_status_t cupsFinishDestDocument (<br>
 <h4 class="returnvalue">Return Value</h4>
 <p class="description">Status of document submission</p>
 <h4 class="discussion">Discussion</h4>
-<p class="discussion">Returns <code>IPP_OK</code> or <code>IPP_OK_SUBST</code> on success.
+<p class="discussion">Returns <code>IPP_STATUS_OK</code> or <code>IPP_STATUS_OK_SUBST</code> on success.
 
 </p>
 <h3 class="function"><span class="info">&nbsp;CUPS 1.4/OS X 10.6&nbsp;</span><a name="cupsFinishDocument">cupsFinishDocument</a></h3>
@@ -1782,6 +1893,41 @@ not support the lpoptions-defined default printer.
 <h4 class="discussion">Discussion</h4>
 <p class="discussion">Use the <a href="#cupsGetDests"><code>cupsGetDests</code></a> or <a href="#cupsGetDests2"><code>cupsGetDests2</code></a> functions to get a
 list of supported destinations for the current user.</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="cupsGetDestMediaByIndex">cupsGetDestMediaByIndex</a></h3>
+<p class="description">Get a media name, dimension, and margins for a
+specific size.</p>
+<p class="code">
+int cupsGetDestMediaByIndex (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *dinfo,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;int n,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;unsigned flags,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_size_t">cups_size_t</a> *size<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>http</dt>
+<dd class="description">Connection to destination</dd>
+<dt>dest</dt>
+<dd class="description">Destination</dd>
+<dt>dinfo</dt>
+<dd class="description">Destination information</dd>
+<dt>n</dt>
+<dd class="description">Media size number (0-based)</dd>
+<dt>flags</dt>
+<dd class="description">Media flags</dd>
+<dt>size</dt>
+<dd class="description">Media size information</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">1 on success, 0 on failure</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">The <code>flags</code> parameter determines which set of media are indexed.  For
+example, passing <code>CUPS_MEDIA_FLAGS_BORDERLESS</code> will get the Nth
+borderless size supported by the printer.
+
+</p>
 <h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="cupsGetDestMediaByName">cupsGetDestMediaByName</a></h3>
 <p class="description">Get media names, dimensions, and margins.</p>
 <p class="code">
@@ -1874,6 +2020,66 @@ The matching result (if any) is returned in the &quot;cups_size_t&quot; structur
 <br>
 Returns 1 when there is a match and 0 if there is not a match.
 
+</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="cupsGetDestMediaCount">cupsGetDestMediaCount</a></h3>
+<p class="description">Get the number of sizes supported by a
+destination.</p>
+<p class="code">
+int cupsGetDestMediaCount (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *dinfo,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;unsigned flags<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>http</dt>
+<dd class="description">Connection to destination</dd>
+<dt>dest</dt>
+<dd class="description">Destination</dd>
+<dt>dinfo</dt>
+<dd class="description">Destination information</dd>
+<dt>flags</dt>
+<dd class="description">Media flags</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">Number of sizes</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">The <code>flags</code> parameter determines the set of media sizes that are
+counted.  For example, passing <code>CUPS_MEDIA_FLAGS_BORDERLESS</code> will return
+the number of borderless sizes.
+
+</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="cupsGetDestMediaDefault">cupsGetDestMediaDefault</a></h3>
+<p class="description">Get the default size for a destination.</p>
+<p class="code">
+int cupsGetDestMediaDefault (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dest,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dinfo_t">cups_dinfo_t</a> *dinfo,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;unsigned flags,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_size_t">cups_size_t</a> *size<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>http</dt>
+<dd class="description">Connection to destination</dd>
+<dt>dest</dt>
+<dd class="description">Destination</dd>
+<dt>dinfo</dt>
+<dd class="description">Destination information</dd>
+<dt>flags</dt>
+<dd class="description">Media flags</dd>
+<dt>size</dt>
+<dd class="description">Media size information</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">1 on success, 0 on failure</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">The <code>flags</code> parameter determines which default size is returned.  For
+example, passing <code>CUPS_MEDIA_FLAGS_BORDERLESS</code> will return the default
+borderless size, typically US Letter or A4, but sometimes 4x6 photo media.
+
 </p>
 <h3 class="function"><a name="cupsGetDests">cupsGetDests</a></h3>
 <p class="description">Get the list of destinations from the default server.</p>
@@ -2123,8 +2329,8 @@ the empty string, a new temporary file is created, otherwise the existing
 file will be overwritten as needed.  The caller &quot;owns&quot; the file that is
 created and must <code>unlink</code> the returned filename.<br>
 <br>
-On success, <code>HTTP_OK</code> is returned for a new PPD file and
-<code>HTTP_NOT_MODIFIED</code> if the existing PPD file is up-to-date.  Any other
+On success, <code>HTTP_STATUS_OK</code> is returned for a new PPD file and
+<code>HTTP_STATUS_NOT_MODIFIED</code> if the existing PPD file is up-to-date.  Any other
 status is an error.<br>
 <br>
 For classes, <code>cupsGetPPD3</code> returns the PPD file for the first printer
@@ -2703,7 +2909,7 @@ void cupsSetEncryption (<br>
 <p class="discussion">The default encryption setting comes from the CUPS_ENCRYPTION
 environment variable, then the ~/.cups/client.conf file, and finally the
 /etc/cups/client.conf file. If not set, the default is
-<code>HTTP_ENCRYPT_IF_REQUESTED</code>.<br>
+<code>HTTP_ENCRYPTION_IF_REQUESTED</code>.<br>
 <br>
 Note: The current encryption setting is tracked separately for each thread
 in a program. Multi-threaded programs that override the setting need to do
@@ -2992,6 +3198,173 @@ name to be used.</p>
 const char *cupsUserAgent (void);</p>
 <h4 class="returnvalue">Return Value</h4>
 <p class="description">User-Agent string</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="pwgFormatSizeName">pwgFormatSizeName</a></h3>
+<p class="description">Generate a PWG self-describing media size name.</p>
+<p class="code">
+int pwgFormatSizeName (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;char *keyword,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;size_t keysize,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *prefix,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;int width,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;int length,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *units<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>keyword</dt>
+<dd class="description">Keyword buffer</dd>
+<dt>keysize</dt>
+<dd class="description">Size of keyword buffer</dd>
+<dt>prefix</dt>
+<dd class="description">Prefix for PWG size or <code>NULL</code> for automatic</dd>
+<dt>name</dt>
+<dd class="description">Size name or <code>NULL</code></dd>
+<dt>width</dt>
+<dd class="description">Width of page in 2540ths</dd>
+<dt>length</dt>
+<dd class="description">Length of page in 2540ths</dd>
+<dt>units</dt>
+<dd class="description">Units - &quot;in&quot;, &quot;mm&quot;, or <code>NULL</code> for automatic</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">1 on success, 0 on failure</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">This function generates a PWG self-describing media size name of the form
+&quot;prefix_name_WIDTHxLENGTHunits&quot;.  The prefix is typically &quot;custom&quot; or &quot;roll&quot;
+for user-supplied sizes but can also be &quot;disc&quot;, &quot;iso&quot;, &quot;jis&quot;, &quot;jpn&quot;, &quot;na&quot;,
+&quot;oe&quot;, &quot;om&quot;, &quot;prc&quot;, or &quot;roc&quot;.  A value of <code>NULL</code> automatically chooses
+&quot;oe&quot; or &quot;om&quot; depending on the units.<br>
+<br>
+The size name may only contain lowercase letters, numbers, &quot;-&quot;, and &quot;.&quot;.  If
+<code>NULL</code> is passed, the size name will contain the formatted dimensions.<br>
+<br>
+The width and length are specified in hundredths of millimeters, equivalent
+to 1/100000th of a meter or 1/2540th of an inch.  The width, length, and
+units used for the generated size name are calculated automatically if the
+units string is <code>NULL</code>, otherwise inches (&quot;in&quot;) or millimeters (&quot;mm&quot;)
+are used.
+
+</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="pwgInitSize">pwgInitSize</a></h3>
+<p class="description">Initialize a pwg_size_t structure using IPP Job Template
+attributes.</p>
+<p class="code">
+int pwgInitSize (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#pwg_size_t">pwg_size_t</a> *size,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;ipp_t *job,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;int *margins_set<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>size</dt>
+<dd class="description">Size to initialize</dd>
+<dt>job</dt>
+<dd class="description">Job template attributes</dd>
+<dt>margins_set</dt>
+<dd class="description">1 if margins were set, 0 otherwise</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">1 if size was initialized, 0 otherwise</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">This function initializes a pwg_size_t structure from an IPP &quot;media&quot; or
+&quot;media-col&quot; attribute in the specified IPP message.  0 is returned if neither
+attribute is found in the message or the values are not valid.<br>
+<br>
+The &quot;margins_set&quot; variable is initialized to 1 if any &quot;media-xxx-margin&quot;
+member attribute was specified in the &quot;media-col&quot; Job Template attribute,
+otherwise it is initialized to 0.
+
+</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="pwgMediaForLegacy">pwgMediaForLegacy</a></h3>
+<p class="description">Find a PWG media size by ISO/IPP legacy name.</p>
+<p class="code">
+<a href="#pwg_media_t">pwg_media_t</a> *pwgMediaForLegacy (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *legacy<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>legacy</dt>
+<dd class="description">Legacy size name</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">Matching size or NULL</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">The &quot;name&quot; argument specifies the legacy ISO media size name, for example
+&quot;iso-a4&quot; or &quot;na-letter&quot;.
+
+</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="pwgMediaForPPD">pwgMediaForPPD</a></h3>
+<p class="description">Find a PWG media size by Adobe PPD name.</p>
+<p class="code">
+<a href="#pwg_media_t">pwg_media_t</a> *pwgMediaForPPD (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *ppd<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>ppd</dt>
+<dd class="description">PPD size name</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">Matching size or NULL</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">The &quot;ppd&quot; argument specifies an Adobe page size name as defined in Table B.1
+of the Adobe PostScript Printer Description File Format Specification Version
+4.3.<br>
+<br>
+If the name is non-standard, the returned PWG media size is stored in
+thread-local storage and is overwritten by each call to the function in the
+thread.  Custom names can be of the form &quot;Custom.WIDTHxLENGTH[units]&quot; or
+&quot;WIDTHxLENGTH[units]&quot;.
+
+</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="pwgMediaForPWG">pwgMediaForPWG</a></h3>
+<p class="description">Find a PWG media size by 5101.1 self-describing name.</p>
+<p class="code">
+<a href="#pwg_media_t">pwg_media_t</a> *pwgMediaForPWG (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *pwg<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>pwg</dt>
+<dd class="description">PWG size name</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">Matching size or NULL</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">The &quot;pwg&quot; argument specifies a self-describing media size name of the form
+&quot;prefix_name_WIDTHxLENGTHunits&quot; as defined in PWG 5101.1.<br>
+<br>
+If the name is non-standard, the returned PWG media size is stored in
+thread-local storage and is overwritten by each call to the function in the
+thread.
+
+</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="pwgMediaForSize">pwgMediaForSize</a></h3>
+<p class="description">Get the PWG media size for the given dimensions.</p>
+<p class="code">
+<a href="#pwg_media_t">pwg_media_t</a> *pwgMediaForSize (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;int width,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;int length<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>width</dt>
+<dd class="description">Width in hundredths of millimeters</dd>
+<dt>length</dt>
+<dd class="description">Length in hundredths of millimeters</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">PWG media name</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">The &quot;width&quot; and &quot;length&quot; are in hundredths of millimeters, equivalent to
+1/100000th of a meter or 1/2540th of an inch.<br>
+<br>
+If the dimensions are non-standard, the returned PWG media size is stored in
+thread-local storage and is overwritten by each call to the function in the
+thread.
+
+</p>
 <h2 class="title"><a name="TYPES">Data Types</a></h2>
 <h3 class="typedef"><span class="info">&nbsp;CUPS 1.5/OS X 10.7&nbsp;</span><a name="cups_client_cert_cb_t">cups_client_cert_cb_t</a></h3>
 <p class="description">Client credentials callback
@@ -3065,6 +3438,21 @@ typedef int (*cups_server_cert_cb_t)(http_t *http, void *tls, cups_array_t *cert
 <p class="code">
 typedef struct <a href="#cups_size_s">cups_size_s</a> cups_size_t;
 </p>
+<h3 class="typedef"><a name="pwg_map_t">pwg_map_t</a></h3>
+<p class="description">Map element - PPD to/from PWG</p>
+<p class="code">
+typedef struct <a href="#pwg_map_s">pwg_map_s</a> pwg_map_t;
+</p>
+<h3 class="typedef"><a name="pwg_media_t">pwg_media_t</a></h3>
+<p class="description">Common media size data</p>
+<p class="code">
+typedef struct <a href="#pwg_media_s">pwg_media_s</a> pwg_media_t;
+</p>
+<h3 class="typedef"><a name="pwg_size_t">pwg_size_t</a></h3>
+<p class="description">Size element - PPD to/from PWG</p>
+<p class="code">
+typedef struct <a href="#pwg_size_s">pwg_size_s</a> pwg_size_t;
+</p>
 <h2 class="title"><a name="STRUCTURES">Structures</a></h2>
 <h3 class="struct"><a name="cups_dest_s">cups_dest_s</a></h3>
 <p class="description">Destination</p>
@@ -3169,6 +3557,42 @@ millimeters</dd>
 <dt>val </dt>
 <dd class="description">Return value</dd>
 </dl>
+<h3 class="struct"><a name="pwg_map_s">pwg_map_s</a></h3>
+<p class="description">Map element - PPD to/from PWG</p>
+<p class="code">struct pwg_map_s {<br>
+&nbsp;&nbsp;&nbsp;&nbsp;char *pwg, *ppd;<br>
+};</p>
+<h4 class="members">Members</h4>
+<dl>
+<dt>ppd </dt>
+<dd class="description">PPD option keyword</dd>
+</dl>
+<h3 class="struct"><a name="pwg_media_s">pwg_media_s</a></h3>
+<p class="description">Common media size data</p>
+<p class="code">struct pwg_media_s {<br>
+&nbsp;&nbsp;&nbsp;&nbsp;int width, length;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const char *pwg, *legacy, *ppd;<br>
+};</p>
+<h4 class="members">Members</h4>
+<dl>
+<dt>length </dt>
+<dd class="description">Length in 2540ths</dd>
+<dt>ppd </dt>
+<dd class="description">Standard Adobe PPD name</dd>
+</dl>
+<h3 class="struct"><a name="pwg_size_s">pwg_size_s</a></h3>
+<p class="description">Size element - PPD to/from PWG</p>
+<p class="code">struct pwg_size_s {<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#pwg_map_t">pwg_map_t</a> map;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;int width, length, left, bottom, right, top;<br>
+};</p>
+<h4 class="members">Members</h4>
+<dl>
+<dt>map </dt>
+<dd class="description">Map element</dd>
+<dt>top </dt>
+<dd class="description">Top margin in 2540ths</dd>
+</dl>
 <h2 class="title"><a name="VARIABLES">Variables</a></h2>
 <h3 class="variable"><a name="CF_RETURNS_RETAINED">CF_RETURNS_RETAINED</a></h3>
 <p class="description">Get the Apple language identifier associated with a
index 0e50514c87608771d97d7cba5e39a4023e268ecd..d6736d9ddb787ab4f714be2292a5e7693be9f18b 100644 (file)
@@ -552,6 +552,7 @@ in seconds.">ippDateToTime</a></li>
        <li><a href="#ippGetGroupTag" title="Get the group associated with an attribute.">ippGetGroupTag</a></li>
        <li><a href="#ippGetInteger" title="Get the integer/enum value for an attribute.">ippGetInteger</a></li>
        <li><a href="#ippGetName" title="Get the attribute name.">ippGetName</a></li>
+       <li><a href="#ippGetOctetString" title="Get an octetString value from an IPP attribute.">ippGetOctetString</a></li>
        <li><a href="#ippGetOperation" title="Get the operation ID in an IPP message.">ippGetOperation</a></li>
        <li><a href="#ippGetRange" title="Get a rangeOfInteger value from an attribute.">ippGetRange</a></li>
        <li><a href="#ippGetRequestId" title="Get the request ID from an IPP message.">ippGetRequestId</a></li>
@@ -578,6 +579,7 @@ in seconds.">ippDateToTime</a></li>
        <li><a href="#ippSetGroupTag" title="Set the group tag of an attribute.">ippSetGroupTag</a></li>
        <li><a href="#ippSetInteger" title="Set an integer or enum value in an attribute.">ippSetInteger</a></li>
        <li><a href="#ippSetName" title="Set the name of an attribute.">ippSetName</a></li>
+       <li><a href="#ippSetOctetString" title="Set an octetString value in an IPP attribute.">ippSetOctetString</a></li>
        <li><a href="#ippSetOperation" title="Set the operation ID in an IPP request message.">ippSetOperation</a></li>
        <li><a href="#ippSetPort" title="Set the default port number.">ippSetPort</a></li>
        <li><a href="#ippSetRange" title="Set a rangeOfInteger value in an attribute.">ippSetRange</a></li>
@@ -1011,7 +1013,7 @@ int cupsDoAuthentication (<br>
 <h4 class="returnvalue">Return Value</h4>
 <p class="description">0 on success, -1 on error</p>
 <h4 class="discussion">Discussion</h4>
-<p class="discussion">This function should be called in response to a <code>HTTP_UNAUTHORIZED</code>
+<p class="discussion">This function should be called in response to a <code>HTTP_STATUS_UNAUTHORIZED</code>
 status, prior to resubmitting your request.
 
 </p>
@@ -1203,7 +1205,7 @@ http_status_t cupsGetFd (<br>
 <h4 class="returnvalue">Return Value</h4>
 <p class="description">HTTP status</p>
 <h4 class="discussion">Discussion</h4>
-<p class="discussion">This function returns <code>HTTP_OK</code> when the file is successfully retrieved.
+<p class="discussion">This function returns <code>HTTP_STATUS_OK</code> when the file is successfully retrieved.
 
 </p>
 <h3 class="function"><span class="info">&nbsp;CUPS 1.1.20/OS X 10.4&nbsp;</span><a name="cupsGetFile">cupsGetFile</a></h3>
@@ -1226,7 +1228,7 @@ http_status_t cupsGetFile (<br>
 <h4 class="returnvalue">Return Value</h4>
 <p class="description">HTTP status</p>
 <h4 class="discussion">Discussion</h4>
-<p class="discussion">This function returns <code>HTTP_OK</code> when the file is successfully retrieved.
+<p class="discussion">This function returns <code>HTTP_STATUS_OK</code> when the file is successfully retrieved.
 
 </p>
 <h3 class="function"><span class="info">&nbsp;CUPS 1.4/OS X 10.6&nbsp;</span><a name="cupsGetResponse">cupsGetResponse</a></h3>
@@ -1286,7 +1288,7 @@ http_status_t cupsPutFd (<br>
 <h4 class="returnvalue">Return Value</h4>
 <p class="description">HTTP status</p>
 <h4 class="discussion">Discussion</h4>
-<p class="discussion">This function returns <code>HTTP_CREATED</code> when the file is stored
+<p class="discussion">This function returns <code>HTTP_STATUS_CREATED</code> when the file is stored
 successfully.
 
 </p>
@@ -1368,7 +1370,7 @@ and <a href="#cupsReadResponseData"><code>cupsReadResponseData</code></a> to rea
 response. Only one request can be sent/queued at a time per <code>http_t</code>
 connection.<br>
 <br>
-Returns the initial HTTP status code, which will be <code>HTTP_CONTINUE</code>
+Returns the initial HTTP status code, which will be <code>HTTP_STATUS_CONTINUE</code>
 on a successful send of the request.<br>
 <br>
 Note: Unlike <a href="#cupsDoFileRequest"><code>cupsDoFileRequest</code></a>, <a href="#cupsDoIORequest"><code>cupsDoIORequest</code></a>, and
@@ -1393,7 +1395,7 @@ http_status_t cupsWriteRequestData (<br>
 <dd class="description">Number of bytes to write</dd>
 </dl>
 <h4 class="returnvalue">Return Value</h4>
-<p class="description"><code>HTTP_CONTINUE</code> if OK or HTTP status on error</p>
+<p class="description"><code>HTTP_STATUS_CONTINUE</code> if OK or HTTP status on error</p>
 <h4 class="discussion">Discussion</h4>
 <p class="discussion">This function is used after <a href="#cupsSendRequest"><code>cupsSendRequest</code></a> to provide a PPD and
 after <a href="#cupsStartDocument"><code>cupsStartDocument</code></a> to provide a document file.
@@ -1651,7 +1653,7 @@ this function in place of traditional string functions whenever
 you need to create a URI string.
 
 </p>
-<h3 class="function"><a name="httpAssembleUUID">httpAssembleUUID</a></h3>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="httpAssembleUUID">httpAssembleUUID</a></h3>
 <p class="description">Assemble a name-based UUID URN conforming to RFC 4122.</p>
 <p class="code">
 char *httpAssembleUUID (<br>
@@ -1684,7 +1686,9 @@ char *httpAssembleUUID (<br>
 name, port number, random data, and optionally an object name and/or object
 number.  The result is formatted as a UUID URN as defined in RFC 4122.<br>
 <br>
-The buffer needs to be at least 46 bytes in size.</p>
+The buffer needs to be at least 46 bytes in size.
+
+</p>
 <h3 class="function"><a name="httpBlocking">httpBlocking</a></h3>
 <p class="description">Set blocking/non-blocking behavior on a connection.</p>
 <p class="code">
@@ -2813,8 +2817,8 @@ void httpSetDefaultField (<br>
 <dd class="description">Value</dd>
 </dl>
 <h4 class="discussion">Discussion</h4>
-<p class="discussion">Currently only HTTP_FIELD_ACCEPT_ENCODING, HTTP_FIELD_SERVER, and
-HTTP_FIELD_USER_AGENT can be set.
+<p class="discussion">Currently only <code>HTTP_FIELD_ACCEPT_ENCODING</code>, <code>HTTP_FIELD_SERVER</code>,
+and <code>HTTP_FIELD_USER_AGENT</code> can be set.
 
 </p>
 <h3 class="function"><span class="info">&nbsp;CUPS 1.2/OS X 10.5&nbsp;</span><a name="httpSetExpect">httpSetExpect</a></h3>
@@ -2830,7 +2834,7 @@ void httpSetExpect (<br>
 <dd class="description">Connection to server</dd>
 <dt>expect</dt>
 <dd class="description">HTTP status to expect
-(<code>HTTP_CONTINUE</code>)</dd>
+(<code>HTTP_STATUS_CONTINUE</code>)</dd>
 </dl>
 <h4 class="discussion">Discussion</h4>
 <p class="discussion">Currently only <code>HTTP_STATUS_CONTINUE</code> is supported for the &quot;expect&quot;
@@ -4176,6 +4180,30 @@ const char *ippGetName (<br>
 </dl>
 <h4 class="returnvalue">Return Value</h4>
 <p class="description">Attribute name or <code>NULL</code> for separators</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="ippGetOctetString">ippGetOctetString</a></h3>
+<p class="description">Get an octetString value from an IPP attribute.</p>
+<p class="code">
+void *ippGetOctetString (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#ipp_attribute_t">ipp_attribute_t</a> *attr,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;int element,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;int *datalen<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>attr</dt>
+<dd class="description">IPP attribute</dd>
+<dt>element</dt>
+<dd class="description">Value number (0-based)</dd>
+<dt>datalen</dt>
+<dd class="description">Length of octetString data</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">Pointer to octetString data</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">The <code>element</code> parameter specifies which value to get from 0 to
+<a href="#ippGetCount(attr)"><code>ippGetCount(attr)</code></a> - 1.
+
+</p>
 <h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="ippGetOperation">ippGetOperation</a></h3>
 <p class="description">Get the operation ID in an IPP message.</p>
 <p class="code">
@@ -4678,6 +4706,41 @@ the <a href="#ippNew"><code>ippNew</code></a>, <a href="#ippNewRequest"><code>ip
 <br>
 The <code>attr</code> parameter may be modified as a result of setting the value.
 
+</p>
+<h3 class="function"><span class="info">&nbsp;CUPS 1.7&nbsp;</span><a name="ippSetOctetString">ippSetOctetString</a></h3>
+<p class="description">Set an octetString value in an IPP attribute.</p>
+<p class="code">
+int ippSetOctetString (<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#ipp_t">ipp_t</a> *ipp,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;<a href="#ipp_attribute_t">ipp_attribute_t</a> **attr,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;int element,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;const void *data,<br>
+&nbsp;&nbsp;&nbsp;&nbsp;int datalen<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>ipp</dt>
+<dd class="description">IPP message</dd>
+<dt>attr</dt>
+<dd class="description">IPP attribute</dd>
+<dt>element</dt>
+<dd class="description">Value number (0-based)</dd>
+<dt>data</dt>
+<dd class="description">Pointer to octetString data</dd>
+<dt>datalen</dt>
+<dd class="description">Length of octetString data</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">1 on success, 0 on failure</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">The <code>ipp</code> parameter refers to an IPP message previously created using
+the <a href="#ippNew"><code>ippNew</code></a>, <a href="#ippNewRequest"><code>ippNewRequest</code></a>, or  <a href="#ippNewResponse"><code>ippNewResponse</code></a> functions.<br>
+<br>
+The <code>attr</code> parameter may be modified as a result of setting the value.<br>
+<br>
+The <code>element</code> parameter specifies which value to set from 0 to
+<a href="#ippGetCount(attr)"><code>ippGetCount(attr)</code></a>.
+
 </p>
 <h3 class="function"><span class="info">&nbsp;CUPS 1.6/OS X 10.8&nbsp;</span><a name="ippSetOperation">ippSetOperation</a></h3>
 <p class="description">Set the operation ID in an IPP request message.</p>
@@ -5538,10 +5601,6 @@ are server-oriented...</p>
 <p class="description">HTTP status codes</p>
 <h4 class="constants">Constants</h4>
 <dl>
-<dt>CUPS_STATUS_AUTHORIZATION_CANCELED <span class="info">&nbsp;CUPS 1.4&nbsp;</span></dt>
-<dd class="description">User canceled authorization </dd>
-<dt>CUPS_STATUS_PKI_ERROR <span class="info">&nbsp;CUPS 1.5/OS X 10.7&nbsp;</span></dt>
-<dd class="description">Error negotiating a secure connection </dd>
 <dt>HTTP_STATUS_ACCEPTED </dt>
 <dd class="description">DELETE command was successful</dd>
 <dt>HTTP_STATUS_BAD_GATEWAY </dt>
@@ -5554,6 +5613,10 @@ are server-oriented...</p>
 <dd class="description">Everything OK, keep going...</dd>
 <dt>HTTP_STATUS_CREATED </dt>
 <dd class="description">PUT command was successful</dd>
+<dt>HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED <span class="info">&nbsp;CUPS 1.4&nbsp;</span></dt>
+<dd class="description">User canceled authorization </dd>
+<dt>HTTP_STATUS_CUPS_PKI_ERROR <span class="info">&nbsp;CUPS 1.5/OS X 10.7&nbsp;</span></dt>
+<dd class="description">Error negotiating a secure connection </dd>
 <dt>HTTP_STATUS_ERROR </dt>
 <dd class="description">An error response from httpXxxx()</dd>
 <dt>HTTP_STATUS_EXPECTATION_FAILED </dt>
@@ -5721,6 +5784,28 @@ are server-oriented...</p>
 <dd class="description">Fold to make booklet</dd>
 <dt>IPP_FINISHINGS_COVER </dt>
 <dd class="description">Add cover</dd>
+<dt>IPP_FINISHINGS_CUPS_FOLD_ACCORDIAN </dt>
+<dd class="description">Accordian-fold the paper vertically into four sections</dd>
+<dt>IPP_FINISHINGS_CUPS_FOLD_DOUBLE_GATE </dt>
+<dd class="description">Fold the top and bottom quarters of the paper towards the midline, then fold in half vertically</dd>
+<dt>IPP_FINISHINGS_CUPS_FOLD_GATE </dt>
+<dd class="description">Fold the top and bottom quarters of the paper towards the midline</dd>
+<dt>IPP_FINISHINGS_CUPS_FOLD_HALF </dt>
+<dd class="description">Fold the paper in half vertically</dd>
+<dt>IPP_FINISHINGS_CUPS_FOLD_HALF_Z </dt>
+<dd class="description">Fold the paper in half horizontally, then Z-fold the paper vertically</dd>
+<dt>IPP_FINISHINGS_CUPS_FOLD_LEFT_GATE </dt>
+<dd class="description">Fold the top quarter of the paper towards the midline</dd>
+<dt>IPP_FINISHINGS_CUPS_FOLD_LETTER </dt>
+<dd class="description">Fold the paper into three sections vertically; sometimes also known as a C fold</dd>
+<dt>IPP_FINISHINGS_CUPS_FOLD_PARALLEL </dt>
+<dd class="description">Fold the paper in half vertically two times, yielding four sections</dd>
+<dt>IPP_FINISHINGS_CUPS_FOLD_POSTER </dt>
+<dd class="description">Fold the paper in half horizontally and vertically; sometimes also called a cross fold</dd>
+<dt>IPP_FINISHINGS_CUPS_FOLD_RIGHT_GATE </dt>
+<dd class="description">Fold the bottom quarter of the paper towards the midline</dd>
+<dt>IPP_FINISHINGS_CUPS_FOLD_Z </dt>
+<dd class="description">Fold the paper vertically into three sections, forming a Z</dd>
 <dt>IPP_FINISHINGS_CUPS_PUNCH_BOTTOM_LEFT </dt>
 <dd class="description">Punch 1 hole bottom left</dd>
 <dt>IPP_FINISHINGS_CUPS_PUNCH_BOTTOM_RIGHT </dt>
@@ -5765,7 +5850,7 @@ are server-oriented...</p>
 <dd class="description">Stitch along top edge</dd>
 <dt>IPP_FINISHINGS_FOLD </dt>
 <dd class="description">Fold (any type)</dd>
-<dt>IPP_FINISHINGS_JOB_OFFSET </dt>
+<dt>IPP_FINISHINGS_JOG_OFFSET </dt>
 <dd class="description">Offset for binding (any type)</dd>
 <dt>IPP_FINISHINGS_NONE </dt>
 <dd class="description">No finishing</dd>
index 73ae2ab39efc7f8ac39407a5024748fa21f2cfe1..2bfc86fda80ea96779f81bfdd7543d4f4f3d433c 100644 (file)
@@ -8,33 +8,13 @@
 
 <H1 CLASS="title">What's New in CUPS 1.7</H1>
 
-<P>CUPS 1.7 provides many changes and new features to CUPS 1.6.x. This page provides a high-level outline of these changes. If you have never used CUPS before, read the <A HREF="overview.html">"Overview of CUPS"</A> document instead.</P>
+<P>This page provides a high-level outline of these changes. If you have never used CUPS before, read the <A HREF="overview.html">"Overview of CUPS"</A> document instead.</P>
 
-<H2 CLASS="title"><A NAME="COMMANDS">General</A></H2>
+<P>CUPS 1.7 is primarily a "polish" release. Users will appreciate improved support for paid, PIN, and release printing, as well as expanded support for printers conforming to the <a href="http://www.pwg.org/ipp/everywhere.html">IPP Everywhere</a> specification. Full support for this functionality depends on additional software from your operating system vendor.</p>
 
-<OL START="1">
+<P>When supported by the printer or the remote server, CUPS now compresses print data sent over the network to greatly improve print speed and reduce bandwidth usage. This happens automatically when printing through IPP and is available as an option when using the <code>ipptool</code> utility.</P>
 
-       <LI><EM>What;</EM> Description.</LI>
-
-</OL>
-
-
-<H2 CLASS="title"><A NAME="SCHEDULER">Scheduler</A></H2>
-
-<OL START="2">
-
-       <LI><EM>What;</EM> Description.</LI>
-
-</OL>
-
-
-<H2 CLASS="title"><A NAME="CUPSAPI">CUPS API</A></H2>
-
-<OL START="3">
-
-       <LI><EM>What;</EM> Description.</LI>
-
-</OL>
+<P>Developers can now enumerate supported sizes and option values, as well as query a printer to discovery which media is loaded, making it possible to easily build customized user interfaces without the use of printer drivers or PPD files.</P>
 
 </BODY>
 </HTML>
index 452aa36010337ae1bc16390d2d395e8b75611111..62c857d761cd4526b25985f53766ed6944ac012c 100644 (file)
@@ -30,7 +30,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: CUPS 1.6\n"
 "Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
-"POT-Creation-Date: 2013-03-08 13:23-0500\n"
+"POT-Creation-Date: 2013-03-20 15:42-0400\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1289,172 +1289,172 @@ msgstr ""
 msgid " PASS"
 msgstr ""
 
-#: cups/ipp.c:5114
+#: cups/ipp.c:5243
 #, c-format
 msgid "\"%s\": Bad URI value \"%s\" - %s (RFC 2911 section 4.1.5)."
 msgstr ""
 
-#: cups/ipp.c:5125
+#: cups/ipp.c:5254
 #, c-format
 msgid "\"%s\": Bad URI value \"%s\" - bad length %d (RFC 2911 section 4.1.5)."
 msgstr ""
 
-#: cups/ipp.c:4745
+#: cups/ipp.c:4874
 #, c-format
 msgid "\"%s\": Bad attribute name - bad length %d (RFC 2911 section 4.1.3)."
 msgstr ""
 
-#: cups/ipp.c:4737
+#: cups/ipp.c:4866
 #, c-format
 msgid "\"%s\": Bad attribute name - invalid character (RFC 2911 section 4.1.3)."
 msgstr ""
 
-#: cups/ipp.c:4763
+#: cups/ipp.c:4892
 #, c-format
 msgid "\"%s\": Bad boolen value %d (RFC 2911 section 4.1.11)."
 msgstr ""
 
-#: cups/ipp.c:5177
+#: cups/ipp.c:5306
 #, c-format
 msgid "\"%s\": Bad charset value \"%s\" - bad characters (RFC 2911 section 4.1.7)."
 msgstr ""
 
-#: cups/ipp.c:5186
+#: cups/ipp.c:5315
 #, c-format
 msgid "\"%s\": Bad charset value \"%s\" - bad length %d (RFC 2911 section 4.1.7)."
 msgstr ""
 
-#: cups/ipp.c:4863
+#: cups/ipp.c:4992
 #, c-format
 msgid "\"%s\": Bad dateTime UTC hours %u (RFC 2911 section 4.1.14)."
 msgstr ""
 
-#: cups/ipp.c:4871
+#: cups/ipp.c:5000
 #, c-format
 msgid "\"%s\": Bad dateTime UTC minutes %u (RFC 2911 section 4.1.14)."
 msgstr ""
 
-#: cups/ipp.c:4855
+#: cups/ipp.c:4984
 #, c-format
 msgid "\"%s\": Bad dateTime UTC sign '%c' (RFC 2911 section 4.1.14)."
 msgstr ""
 
-#: cups/ipp.c:4815
+#: cups/ipp.c:4944
 #, c-format
 msgid "\"%s\": Bad dateTime day %u (RFC 2911 section 4.1.14)."
 msgstr ""
 
-#: cups/ipp.c:4847
+#: cups/ipp.c:4976
 #, c-format
 msgid "\"%s\": Bad dateTime deciseconds %u (RFC 2911 section 4.1.14)."
 msgstr ""
 
-#: cups/ipp.c:4823
+#: cups/ipp.c:4952
 #, c-format
 msgid "\"%s\": Bad dateTime hours %u (RFC 2911 section 4.1.14)."
 msgstr ""
 
-#: cups/ipp.c:4831
+#: cups/ipp.c:4960
 #, c-format
 msgid "\"%s\": Bad dateTime minutes %u (RFC 2911 section 4.1.14)."
 msgstr ""
 
-#: cups/ipp.c:4807
+#: cups/ipp.c:4936
 #, c-format
 msgid "\"%s\": Bad dateTime month %u (RFC 2911 section 4.1.14)."
 msgstr ""
 
-#: cups/ipp.c:4839
+#: cups/ipp.c:4968
 #, c-format
 msgid "\"%s\": Bad dateTime seconds %u (RFC 2911 section 4.1.14)."
 msgstr ""
 
-#: cups/ipp.c:4777
+#: cups/ipp.c:4906
 #, c-format
 msgid "\"%s\": Bad enum value %d - out of range (RFC 2911 section 4.1.4)."
 msgstr ""
 
-#: cups/ipp.c:5092
+#: cups/ipp.c:5221
 #, c-format
 msgid "\"%s\": Bad keyword value \"%s\" - bad length %d (RFC 2911 section 4.1.3)."
 msgstr ""
 
-#: cups/ipp.c:5083
+#: cups/ipp.c:5212
 #, c-format
 msgid "\"%s\": Bad keyword value \"%s\" - invalid character (RFC 2911 section 4.1.3)."
 msgstr ""
 
-#: cups/ipp.c:5286
+#: cups/ipp.c:5415
 #, c-format
 msgid "\"%s\": Bad mimeMediaType value \"%s\" - bad characters (RFC 2911 section 4.1.9)."
 msgstr ""
 
-#: cups/ipp.c:5296
+#: cups/ipp.c:5425
 #, c-format
 msgid "\"%s\": Bad mimeMediaType value \"%s\" - bad length %d (RFC 2911 section 4.1.9)."
 msgstr ""
 
-#: cups/ipp.c:5054
+#: cups/ipp.c:5183
 #, c-format
 msgid "\"%s\": Bad name value \"%s\" - bad UTF-8 sequence (RFC 2911 section 4.1.2)."
 msgstr ""
 
-#: cups/ipp.c:5063
+#: cups/ipp.c:5192
 #, c-format
 msgid "\"%s\": Bad name value \"%s\" - bad length %d (RFC 2911 section 4.1.2)."
 msgstr ""
 
-#: cups/ipp.c:5232
+#: cups/ipp.c:5361
 #, c-format
 msgid "\"%s\": Bad naturalLanguage value \"%s\" - bad characters (RFC 2911 section 4.1.8)."
 msgstr ""
 
-#: cups/ipp.c:5242
+#: cups/ipp.c:5371
 #, c-format
 msgid "\"%s\": Bad naturalLanguage value \"%s\" - bad length %d (RFC 2911 section 4.1.8)."
 msgstr ""
 
-#: cups/ipp.c:4791
+#: cups/ipp.c:4920
 #, c-format
 msgid "\"%s\": Bad octetString value - bad length %d (RFC 2911 section 4.1.10)."
 msgstr ""
 
-#: cups/ipp.c:4934
+#: cups/ipp.c:5063
 #, c-format
 msgid "\"%s\": Bad rangeOfInteger value %d-%d - lower greater than upper (RFC 2911 section 4.1.13)."
 msgstr ""
 
-#: cups/ipp.c:4915
+#: cups/ipp.c:5044
 #, c-format
 msgid "\"%s\": Bad resolution value %dx%d%s - bad units value (RFC 2911 section 4.1.15)."
 msgstr ""
 
-#: cups/ipp.c:4884
+#: cups/ipp.c:5013
 #, c-format
 msgid "\"%s\": Bad resolution value %dx%d%s - cross feed resolution must be positive (RFC 2911 section 4.1.15)."
 msgstr ""
 
-#: cups/ipp.c:4899
+#: cups/ipp.c:5028
 #, c-format
 msgid "\"%s\": Bad resolution value %dx%d%s - feed resolution must be positive (RFC 2911 section 4.1.15)."
 msgstr ""
 
-#: cups/ipp.c:4996
+#: cups/ipp.c:5125
 #, c-format
 msgid "\"%s\": Bad text value \"%s\" - bad UTF-8 sequence (RFC 2911 section 4.1.1)."
 msgstr ""
 
-#: cups/ipp.c:5005
+#: cups/ipp.c:5134
 #, c-format
 msgid "\"%s\": Bad text value \"%s\" - bad length %d (RFC 2911 section 4.1.1)."
 msgstr ""
 
-#: cups/ipp.c:5148
+#: cups/ipp.c:5277
 #, c-format
 msgid "\"%s\": Bad uriScheme value \"%s\" - bad characters (RFC 2911 section 4.1.6)."
 msgstr ""
 
-#: cups/ipp.c:5157
+#: cups/ipp.c:5286
 #, c-format
 msgid "\"%s\": Bad uriScheme value \"%s\" - bad length %d (RFC 2911 section 4.1.6)."
 msgstr ""
@@ -1474,7 +1474,7 @@ msgstr ""
 msgid "%s accepting requests since %s"
 msgstr ""
 
-#: scheduler/ipp.c:9907
+#: scheduler/ipp.c:9924
 #, c-format
 msgid "%s cannot be changed."
 msgstr ""
@@ -2796,7 +2796,7 @@ msgstr ""
 msgid "Accept Jobs"
 msgstr ""
 
-#: cups/http-support.c:1296
+#: cups/http-support.c:1298
 msgid "Accepted"
 msgstr ""
 
@@ -2891,7 +2891,7 @@ msgstr ""
 msgid "B9"
 msgstr ""
 
-#: scheduler/ipp.c:10833
+#: scheduler/ipp.c:10850
 #, c-format
 msgid "Bad 'document-format' value \"%s\"."
 msgstr ""
@@ -2925,7 +2925,7 @@ msgstr ""
 msgid "Bad PPD cache file."
 msgstr ""
 
-#: cups/http-support.c:1311
+#: cups/http-support.c:1313
 msgid "Bad Request"
 msgstr ""
 
@@ -2946,22 +2946,22 @@ msgstr ""
 msgid "Bad custom parameter"
 msgstr ""
 
-#: cups/http-support.c:1463 scheduler/ipp.c:2427
+#: cups/http-support.c:1465 scheduler/ipp.c:2446
 #, c-format
 msgid "Bad device-uri \"%s\"."
 msgstr ""
 
-#: scheduler/ipp.c:2468
+#: scheduler/ipp.c:2485
 #, c-format
 msgid "Bad device-uri scheme \"%s\"."
 msgstr ""
 
-#: scheduler/ipp.c:8085 scheduler/ipp.c:8101 scheduler/ipp.c:9316
+#: scheduler/ipp.c:8102 scheduler/ipp.c:8118 scheduler/ipp.c:9333
 #, c-format
 msgid "Bad document-format \"%s\"."
 msgstr ""
 
-#: scheduler/ipp.c:9332
+#: scheduler/ipp.c:9349
 #, c-format
 msgid "Bad document-format-default \"%s\"."
 msgstr ""
@@ -2979,7 +2979,7 @@ msgstr ""
 msgid "Bad job-name value: Wrong type or count."
 msgstr ""
 
-#: scheduler/ipp.c:9922
+#: scheduler/ipp.c:9939
 msgid "Bad job-priority value."
 msgstr ""
 
@@ -2992,24 +2992,24 @@ msgstr ""
 msgid "Bad job-sheets value type."
 msgstr ""
 
-#: scheduler/ipp.c:9952
+#: scheduler/ipp.c:9969
 msgid "Bad job-state value."
 msgstr ""
 
-#: scheduler/ipp.c:3051 scheduler/ipp.c:3511 scheduler/ipp.c:5950
-#: scheduler/ipp.c:6097 scheduler/ipp.c:7519 scheduler/ipp.c:7788
-#: scheduler/ipp.c:8637 scheduler/ipp.c:8863 scheduler/ipp.c:9212
-#: scheduler/ipp.c:9815
+#: scheduler/ipp.c:3068 scheduler/ipp.c:3528 scheduler/ipp.c:5967
+#: scheduler/ipp.c:6114 scheduler/ipp.c:7536 scheduler/ipp.c:7805
+#: scheduler/ipp.c:8654 scheduler/ipp.c:8880 scheduler/ipp.c:9229
+#: scheduler/ipp.c:9832
 #, c-format
 msgid "Bad job-uri \"%s\"."
 msgstr ""
 
-#: scheduler/ipp.c:2126 scheduler/ipp.c:5494
+#: scheduler/ipp.c:2126 scheduler/ipp.c:5511
 #, c-format
 msgid "Bad notify-pull-method \"%s\"."
 msgstr ""
 
-#: scheduler/ipp.c:2090 scheduler/ipp.c:5458
+#: scheduler/ipp.c:2090 scheduler/ipp.c:5475
 #, c-format
 msgid "Bad notify-recipient-uri \"%s\"."
 msgstr ""
@@ -3029,7 +3029,7 @@ msgstr ""
 msgid "Bad page-ranges values %d-%d."
 msgstr ""
 
-#: scheduler/ipp.c:2511
+#: scheduler/ipp.c:2528
 #, c-format
 msgid "Bad port-monitor \"%s\"."
 msgstr ""
@@ -3038,7 +3038,7 @@ msgstr ""
 msgid "Bad printer URI."
 msgstr ""
 
-#: scheduler/ipp.c:2572
+#: scheduler/ipp.c:2589
 #, c-format
 msgid "Bad printer-state value %d."
 msgstr ""
@@ -3069,7 +3069,7 @@ msgstr ""
 msgid "Bond Paper"
 msgstr ""
 
-#: backend/usb-darwin.c:1880
+#: backend/usb-darwin.c:1894
 #, c-format
 msgid "Boolean expected for waiteof option \"%s\"."
 msgstr ""
@@ -3090,11 +3090,11 @@ msgstr ""
 msgid "Cancel RSS Subscription"
 msgstr ""
 
-#: backend/ipp.c:2144
+#: backend/ipp.c:2150
 msgid "Canceling print job."
 msgstr ""
 
-#: scheduler/ipp.c:2552
+#: scheduler/ipp.c:2569
 msgid "Cannot share a remote Kerberized printer."
 msgstr ""
 
@@ -3107,7 +3107,7 @@ msgstr ""
 msgid "Change Settings"
 msgstr ""
 
-#: scheduler/ipp.c:2138 scheduler/ipp.c:5506
+#: scheduler/ipp.c:2138 scheduler/ipp.c:5523
 #, c-format
 msgid "Character set \"%s\" not supported."
 msgstr ""
@@ -3120,7 +3120,7 @@ msgstr ""
 msgid "Clean Print Heads"
 msgstr ""
 
-#: scheduler/ipp.c:3963
+#: scheduler/ipp.c:3980
 msgid "Close-Job doesn't support the job-uri attribute."
 msgstr ""
 
@@ -3151,7 +3151,7 @@ msgstr ""
 msgid "Connecting to printer."
 msgstr ""
 
-#: cups/http-support.c:1284
+#: cups/http-support.c:1286
 msgid "Continue"
 msgstr ""
 
@@ -3167,7 +3167,7 @@ msgstr ""
 msgid "Copying print data."
 msgstr ""
 
-#: cups/http-support.c:1293
+#: cups/http-support.c:1295
 msgid "Created"
 msgstr ""
 
@@ -3264,7 +3264,7 @@ msgstr ""
 msgid "Disabled"
 msgstr ""
 
-#: scheduler/ipp.c:5999
+#: scheduler/ipp.c:6016
 #, c-format
 msgid "Document #%d does not exist in job #%d."
 msgstr ""
@@ -3593,7 +3593,7 @@ msgstr ""
 msgid "Executive"
 msgstr ""
 
-#: cups/http-support.c:1339
+#: cups/http-support.c:1341
 msgid "Expectation Failed"
 msgstr ""
 
@@ -3652,7 +3652,7 @@ msgstr ""
 msgid "File Folder "
 msgstr ""
 
-#: scheduler/ipp.c:2447
+#: scheduler/ipp.c:2464
 #, c-format
 msgid "File device URIs have been disabled. To enable, see the FileDevice directive in \"%s/cups-files.conf\"."
 msgstr ""
@@ -3667,7 +3667,7 @@ msgstr ""
 msgid "Folio"
 msgstr ""
 
-#: cups/http-support.c:1318
+#: cups/http-support.c:1320
 msgid "Forbidden"
 msgstr ""
 
@@ -3687,10 +3687,10 @@ msgstr ""
 msgid "Glossy Paper"
 msgstr ""
 
-#: scheduler/ipp.c:3029 scheduler/ipp.c:3437 scheduler/ipp.c:3975
-#: scheduler/ipp.c:5928 scheduler/ipp.c:6075 scheduler/ipp.c:7496
-#: scheduler/ipp.c:8615 scheduler/ipp.c:8841 scheduler/ipp.c:9190
-#: scheduler/ipp.c:9793
+#: scheduler/ipp.c:3046 scheduler/ipp.c:3454 scheduler/ipp.c:3992
+#: scheduler/ipp.c:5945 scheduler/ipp.c:6092 scheduler/ipp.c:7513
+#: scheduler/ipp.c:8632 scheduler/ipp.c:8858 scheduler/ipp.c:9207
+#: scheduler/ipp.c:9810
 msgid "Got a printer-uri attribute but no job-id."
 msgstr ""
 
@@ -3710,95 +3710,95 @@ msgstr ""
 msgid "Help file not in index."
 msgstr ""
 
-#: cups/ipp.c:3157 cups/ipp.c:3184 cups/ipp.c:3207
+#: cups/ipp.c:3198 cups/ipp.c:3225 cups/ipp.c:3248
 msgid "IPP 1setOf attribute with incompatible value tags."
 msgstr ""
 
-#: cups/ipp.c:3120
+#: cups/ipp.c:3161
 msgid "IPP attribute has no name."
 msgstr ""
 
-#: cups/ipp.c:6885
+#: cups/ipp.c:7014
 msgid "IPP attribute is not a member of the message."
 msgstr ""
 
-#: cups/ipp.c:3569
+#: cups/ipp.c:3610
 msgid "IPP begCollection value not 0 bytes."
 msgstr ""
 
-#: cups/ipp.c:3350
+#: cups/ipp.c:3391
 msgid "IPP boolean value not 1 byte."
 msgstr ""
 
-#: cups/ipp.c:3411
+#: cups/ipp.c:3452
 msgid "IPP date value not 11 bytes."
 msgstr ""
 
-#: cups/ipp.c:3590
+#: cups/ipp.c:3631
 msgid "IPP endCollection value not 0 bytes."
 msgstr ""
 
-#: cups/ipp.c:3325
+#: cups/ipp.c:3366
 msgid "IPP enum value not 4 bytes."
 msgstr ""
 
-#: cups/ipp.c:3049
+#: cups/ipp.c:3090
 msgid "IPP extension tag larger than 0x7FFFFFFF."
 msgstr ""
 
-#: cups/ipp.c:3322
+#: cups/ipp.c:3363
 msgid "IPP integer value not 4 bytes."
 msgstr ""
 
-#: cups/ipp.c:3522
+#: cups/ipp.c:3563
 msgid "IPP language length overflows value."
 msgstr ""
 
-#: cups/ipp.c:3531
+#: cups/ipp.c:3572
 msgid "IPP language length too large."
 msgstr ""
 
-#: cups/ipp.c:3234
+#: cups/ipp.c:3275
 msgid "IPP member name is not empty."
 msgstr ""
 
-#: cups/ipp.c:3616
+#: cups/ipp.c:3657
 msgid "IPP memberName value is empty."
 msgstr ""
 
-#: cups/ipp.c:3608
+#: cups/ipp.c:3649
 msgid "IPP memberName with no attribute."
 msgstr ""
 
-#: cups/ipp.c:3103
+#: cups/ipp.c:3144
 msgid "IPP name larger than 32767 bytes."
 msgstr ""
 
-#: cups/ipp.c:3488
+#: cups/ipp.c:3529
 msgid "IPP nameWithLanguage value less than minimum 4 bytes."
 msgstr ""
 
-#: cups/ipp.c:3646
+#: cups/ipp.c:3687
 msgid "IPP octetString length too large."
 msgstr ""
 
-#: cups/ipp.c:3456
+#: cups/ipp.c:3497
 msgid "IPP rangeOfInteger value not 8 bytes."
 msgstr ""
 
-#: cups/ipp.c:3429
+#: cups/ipp.c:3470
 msgid "IPP resolution value not 9 bytes."
 msgstr ""
 
-#: cups/ipp.c:3549
+#: cups/ipp.c:3590
 msgid "IPP string length overflows value."
 msgstr ""
 
-#: cups/ipp.c:3484
+#: cups/ipp.c:3525
 msgid "IPP textWithLanguage value less than minimum 4 bytes."
 msgstr ""
 
-#: cups/ipp.c:3308
+#: cups/ipp.c:3349
 msgid "IPP value larger than 32767 bytes."
 msgstr ""
 
@@ -3842,7 +3842,7 @@ msgstr ""
 msgid "Intellitech"
 msgstr ""
 
-#: cups/http-support.c:1345
+#: cups/http-support.c:1347
 msgid "Internal Server Error"
 msgstr ""
 
@@ -3862,7 +3862,11 @@ msgstr ""
 msgid "Internet Printing Protocol"
 msgstr ""
 
-#: cups/dest-options.c:837
+#: cups/pwg-media.c:311 cups/pwg-media.c:330
+msgid "Invalid media name arguments."
+msgstr ""
+
+#: cups/dest-options.c:1052
 msgid "Invalid media size."
 msgstr ""
 
@@ -3931,52 +3935,52 @@ msgstr ""
 msgid "JIS B9"
 msgstr ""
 
-#: scheduler/ipp.c:8913
+#: scheduler/ipp.c:8930
 #, c-format
 msgid "Job #%d cannot be restarted - no files."
 msgstr ""
 
-#: scheduler/ipp.c:3069 scheduler/ipp.c:3303 scheduler/ipp.c:3362
-#: scheduler/ipp.c:3539 scheduler/ipp.c:3985 scheduler/ipp.c:5592
-#: scheduler/ipp.c:5968 scheduler/ipp.c:6115 scheduler/ipp.c:6404
-#: scheduler/ipp.c:7343 scheduler/ipp.c:7365 scheduler/ipp.c:7537
-#: scheduler/ipp.c:7762 scheduler/ipp.c:7805 scheduler/ipp.c:8655
-#: scheduler/ipp.c:8881 scheduler/ipp.c:9230 scheduler/ipp.c:9833
+#: scheduler/ipp.c:3086 scheduler/ipp.c:3320 scheduler/ipp.c:3379
+#: scheduler/ipp.c:3556 scheduler/ipp.c:4002 scheduler/ipp.c:5609
+#: scheduler/ipp.c:5985 scheduler/ipp.c:6132 scheduler/ipp.c:6421
+#: scheduler/ipp.c:7360 scheduler/ipp.c:7382 scheduler/ipp.c:7554
+#: scheduler/ipp.c:7779 scheduler/ipp.c:7822 scheduler/ipp.c:8672
+#: scheduler/ipp.c:8898 scheduler/ipp.c:9247 scheduler/ipp.c:9850
 #, c-format
 msgid "Job #%d does not exist."
 msgstr ""
 
-#: scheduler/ipp.c:3571
+#: scheduler/ipp.c:3588
 #, c-format
 msgid "Job #%d is already aborted - can't cancel."
 msgstr ""
 
-#: scheduler/ipp.c:3565
+#: scheduler/ipp.c:3582
 #, c-format
 msgid "Job #%d is already canceled - can't cancel."
 msgstr ""
 
-#: scheduler/ipp.c:3577
+#: scheduler/ipp.c:3594
 #, c-format
 msgid "Job #%d is already completed - can't cancel."
 msgstr ""
 
-#: scheduler/ipp.c:7563 scheduler/ipp.c:7847 scheduler/ipp.c:9848
+#: scheduler/ipp.c:7580 scheduler/ipp.c:7864 scheduler/ipp.c:9865
 #, c-format
 msgid "Job #%d is finished and cannot be altered."
 msgstr ""
 
-#: scheduler/ipp.c:8895
+#: scheduler/ipp.c:8912
 #, c-format
 msgid "Job #%d is not complete."
 msgstr ""
 
-#: scheduler/ipp.c:3084
+#: scheduler/ipp.c:3101
 #, c-format
 msgid "Job #%d is not held for authentication."
 msgstr ""
 
-#: scheduler/ipp.c:8669
+#: scheduler/ipp.c:8686
 #, c-format
 msgid "Job #%d is not held."
 msgstr ""
@@ -3997,7 +4001,7 @@ msgstr ""
 msgid "Job Stopped"
 msgstr ""
 
-#: scheduler/ipp.c:9930
+#: scheduler/ipp.c:9947
 msgid "Job is completed and cannot be changed."
 msgstr ""
 
@@ -4005,11 +4009,11 @@ msgstr ""
 msgid "Job operation failed"
 msgstr ""
 
-#: scheduler/ipp.c:9966 scheduler/ipp.c:9985 scheduler/ipp.c:9996
+#: scheduler/ipp.c:9983 scheduler/ipp.c:10002 scheduler/ipp.c:10013
 msgid "Job state cannot be changed."
 msgstr ""
 
-#: scheduler/ipp.c:8761
+#: scheduler/ipp.c:8778
 msgid "Job subscriptions cannot be renewed."
 msgstr ""
 
@@ -4029,7 +4033,7 @@ msgstr ""
 msgid "Label Top"
 msgstr ""
 
-#: scheduler/ipp.c:2147 scheduler/ipp.c:5515
+#: scheduler/ipp.c:2147 scheduler/ipp.c:5532
 #, c-format
 msgid "Language \"%s\" not supported."
 msgstr ""
@@ -4066,7 +4070,7 @@ msgstr ""
 msgid "Long-Edge (Portrait)"
 msgstr ""
 
-#: cups/http-support.c:1577
+#: cups/http-support.c:1579
 msgid "Looking for printer."
 msgstr ""
 
@@ -4110,7 +4114,7 @@ msgstr ""
 msgid "Missing asterisk in column 1"
 msgstr ""
 
-#: scheduler/ipp.c:5991
+#: scheduler/ipp.c:6008
 msgid "Missing document-number attribute."
 msgstr ""
 
@@ -4125,19 +4129,19 @@ msgstr ""
 msgid "Missing form variable"
 msgstr ""
 
-#: scheduler/ipp.c:9284
+#: scheduler/ipp.c:9301
 msgid "Missing last-document attribute in request."
 msgstr ""
 
-#: cups/pwg-media.c:559
+#: cups/pwg-media.c:573
 msgid "Missing media or media-col."
 msgstr ""
 
-#: cups/pwg-media.c:478
+#: cups/pwg-media.c:492
 msgid "Missing media-size in media-col."
 msgstr ""
 
-#: scheduler/ipp.c:6534
+#: scheduler/ipp.c:6551
 msgid "Missing notify-subscription-ids attribute."
 msgstr ""
 
@@ -4145,7 +4149,7 @@ msgstr ""
 msgid "Missing option keyword"
 msgstr ""
 
-#: scheduler/ipp.c:3210 scheduler/ipp.c:3235
+#: scheduler/ipp.c:3227 scheduler/ipp.c:3252
 msgid "Missing requesting-user-name attribute."
 msgstr ""
 
@@ -4162,11 +4166,11 @@ msgstr ""
 msgid "Missing value string"
 msgstr ""
 
-#: cups/pwg-media.c:466
+#: cups/pwg-media.c:480
 msgid "Missing x-dimension in media-size."
 msgstr ""
 
-#: cups/pwg-media.c:472
+#: cups/pwg-media.c:486
 msgid "Missing y-dimension in media-size."
 msgstr ""
 
@@ -4195,7 +4199,7 @@ msgstr ""
 msgid "Move Job"
 msgstr ""
 
-#: cups/http-support.c:1302
+#: cups/http-support.c:1304
 msgid "Moved Permanently"
 msgstr ""
 
@@ -4227,7 +4231,7 @@ msgstr ""
 msgid "No"
 msgstr ""
 
-#: cups/http-support.c:1299
+#: cups/http-support.c:1301
 msgid "No Content"
 msgstr ""
 
@@ -4247,7 +4251,7 @@ msgstr ""
 msgid "No active connection"
 msgstr ""
 
-#: scheduler/ipp.c:3488
+#: scheduler/ipp.c:3505
 #, c-format
 msgid "No active jobs on %s."
 msgstr ""
@@ -4256,7 +4260,7 @@ msgstr ""
 msgid "No attributes in request."
 msgstr ""
 
-#: scheduler/ipp.c:3111
+#: scheduler/ipp.c:3128
 msgid "No authentication information provided."
 msgstr ""
 
@@ -4264,11 +4268,11 @@ msgstr ""
 msgid "No community name"
 msgstr ""
 
-#: scheduler/ipp.c:5791
+#: scheduler/ipp.c:5808
 msgid "No default printer."
 msgstr ""
 
-#: cgi-bin/ipp-var.c:436 scheduler/ipp.c:7109
+#: cgi-bin/ipp-var.c:436 scheduler/ipp.c:7126
 msgid "No destinations added."
 msgstr ""
 
@@ -4284,7 +4288,7 @@ msgstr ""
 msgid "No error-status"
 msgstr ""
 
-#: scheduler/ipp.c:8051 scheduler/ipp.c:9298
+#: scheduler/ipp.c:8068 scheduler/ipp.c:9315
 msgid "No file in print request."
 msgstr ""
 
@@ -4313,7 +4317,7 @@ msgstr ""
 msgid "No printer-uri found for class"
 msgstr ""
 
-#: scheduler/ipp.c:6194
+#: scheduler/ipp.c:6211
 msgid "No printer-uri in request."
 msgstr ""
 
@@ -4321,11 +4325,11 @@ msgstr ""
 msgid "No request-id"
 msgstr ""
 
-#: scheduler/ipp.c:5400
+#: scheduler/ipp.c:5417
 msgid "No subscription attributes in request."
 msgstr ""
 
-#: scheduler/ipp.c:7436
+#: scheduler/ipp.c:7453
 msgid "No subscriptions found."
 msgstr ""
 
@@ -4349,11 +4353,11 @@ msgstr ""
 msgid "Normal"
 msgstr ""
 
-#: cups/http-support.c:1321
+#: cups/http-support.c:1323
 msgid "Not Found"
 msgstr ""
 
-#: cups/http-support.c:1333
+#: cups/http-support.c:1335
 msgid "Not Implemented"
 msgstr ""
 
@@ -4361,15 +4365,15 @@ msgstr ""
 msgid "Not Installed"
 msgstr ""
 
-#: cups/http-support.c:1308
+#: cups/http-support.c:1310
 msgid "Not Modified"
 msgstr ""
 
-#: cups/http-support.c:1336
+#: cups/http-support.c:1338
 msgid "Not Supported"
 msgstr ""
 
-#: scheduler/ipp.c:1577 scheduler/ipp.c:10529
+#: scheduler/ipp.c:1577 scheduler/ipp.c:10546
 msgid "Not allowed to print."
 msgstr ""
 
@@ -4381,7 +4385,7 @@ msgstr ""
 msgid "Note: this program only validates the DSC comments, not the PostScript itself."
 msgstr ""
 
-#: cups/http-support.c:1290 cups/ppd.c:338
+#: cups/http-support.c:1292 cups/ppd.c:338
 msgid "OK"
 msgstr ""
 
@@ -4616,15 +4620,15 @@ msgstr ""
 msgid "Print file sent."
 msgstr ""
 
-#: backend/ipp.c:2118
+#: backend/ipp.c:2124
 msgid "Print job canceled at printer."
 msgstr ""
 
-#: backend/ipp.c:2113
+#: backend/ipp.c:2116
 msgid "Print job too large."
 msgstr ""
 
-#: backend/ipp.c:1618
+#: backend/ipp.c:1619
 msgid "Print job was not accepted."
 msgstr ""
 
@@ -4652,10 +4656,14 @@ msgstr ""
 msgid "Printer Settings"
 msgstr ""
 
-#: backend/ipp.c:2116
+#: backend/ipp.c:2119
 msgid "Printer cannot print supplied content."
 msgstr ""
 
+#: backend/ipp.c:2122
+msgid "Printer cannot print with supplied options."
+msgstr ""
+
 #: cups/notify.c:126
 msgid "Printer:"
 msgstr ""
@@ -4678,7 +4686,7 @@ msgstr ""
 msgid "Quarto"
 msgstr ""
 
-#: scheduler/ipp.c:1572 scheduler/ipp.c:10524
+#: scheduler/ipp.c:1572 scheduler/ipp.c:10541
 msgid "Quota limit reached."
 msgstr ""
 
@@ -4709,7 +4717,7 @@ msgstr ""
 msgid "Reprint After Error"
 msgstr ""
 
-#: cups/http-support.c:1324
+#: cups/http-support.c:1326
 msgid "Request Entity Too Large"
 msgstr ""
 
@@ -4742,15 +4750,15 @@ msgstr ""
 msgid "SEQUENCE uses indefinite length"
 msgstr ""
 
-#: cups/http-support.c:1348
+#: cups/http-support.c:1350
 msgid "SSL/TLS Negotiation Error"
 msgstr ""
 
-#: cups/http-support.c:1305
+#: cups/http-support.c:1307
 msgid "See Other"
 msgstr ""
 
-#: backend/usb-darwin.c:573 backend/usb-libusb.c:441
+#: backend/usb-darwin.c:573 backend/usb-libusb.c:443
 msgid "Sending data to printer."
 msgstr ""
 
@@ -4770,7 +4778,7 @@ msgstr ""
 msgid "Server Stopped"
 msgstr ""
 
-#: cups/http-support.c:1342
+#: cups/http-support.c:1344
 msgid "Service Unavailable"
 msgstr ""
 
@@ -4839,8 +4847,8 @@ msgstr ""
 msgid "Stylus Photo Series"
 msgstr ""
 
-#: scheduler/ipp.c:3634 scheduler/ipp.c:6550 scheduler/ipp.c:7249
-#: scheduler/ipp.c:8749
+#: scheduler/ipp.c:3651 scheduler/ipp.c:6567 scheduler/ipp.c:7266
+#: scheduler/ipp.c:8766
 #, c-format
 msgid "Subscription #%d does not exist."
 msgstr ""
@@ -4857,7 +4865,7 @@ msgstr ""
 msgid "Super B/A3"
 msgstr ""
 
-#: cups/http-support.c:1287
+#: cups/http-support.c:1289
 msgid "Switching Protocols"
 msgstr ""
 
@@ -4890,8 +4898,8 @@ msgstr ""
 msgid "The \"%s\" attribute is required for print jobs."
 msgstr ""
 
-#: scheduler/ipp.c:6265 scheduler/ipp.c:6343 scheduler/ipp.c:6359
-#: scheduler/ipp.c:6377
+#: scheduler/ipp.c:6282 scheduler/ipp.c:6360 scheduler/ipp.c:6376
+#: scheduler/ipp.c:6394
 #, c-format
 msgid "The %s attribute cannot be provided with job-ids."
 msgstr ""
@@ -4901,17 +4909,17 @@ msgstr ""
 msgid "The '%s' Job Description attribute cannot be supplied in a job creation request."
 msgstr ""
 
-#: scheduler/ipp.c:5207
+#: scheduler/ipp.c:5224
 #, c-format
 msgid "The '%s' operation attribute cannot be supplied in a Create-Job request."
 msgstr ""
 
-#: scheduler/ipp.c:6780
+#: scheduler/ipp.c:6797
 #, c-format
 msgid "The PPD file \"%s\" could not be found."
 msgstr ""
 
-#: scheduler/ipp.c:6767
+#: scheduler/ipp.c:6784
 #, c-format
 msgid "The PPD file \"%s\" could not be opened: %s"
 msgstr ""
@@ -4945,7 +4953,7 @@ msgstr ""
 msgid "The notify-lease-duration attribute cannot be used with job subscriptions."
 msgstr ""
 
-#: scheduler/ipp.c:2157 scheduler/ipp.c:5525
+#: scheduler/ipp.c:2157 scheduler/ipp.c:5542
 #, c-format
 msgid "The notify-user-data value is too large (%d > 63 octets)."
 msgstr ""
@@ -5049,14 +5057,14 @@ msgstr ""
 msgid "The printer name may only contain up to 127 printable characters and may not contain spaces, slashes (/), or the pound sign (#)."
 msgstr ""
 
-#: scheduler/ipp.c:875 scheduler/ipp.c:1135 scheduler/ipp.c:3275
-#: scheduler/ipp.c:3454 scheduler/ipp.c:5190 scheduler/ipp.c:5359
-#: scheduler/ipp.c:5673 scheduler/ipp.c:6231 scheduler/ipp.c:6985
-#: scheduler/ipp.c:7041 scheduler/ipp.c:7355 scheduler/ipp.c:7621
-#: scheduler/ipp.c:7710 scheduler/ipp.c:7743 scheduler/ipp.c:8066
-#: scheduler/ipp.c:8459 scheduler/ipp.c:8541 scheduler/ipp.c:9702
-#: scheduler/ipp.c:10156 scheduler/ipp.c:10487 scheduler/ipp.c:10569
-#: scheduler/ipp.c:10943
+#: scheduler/ipp.c:875 scheduler/ipp.c:1135 scheduler/ipp.c:3292
+#: scheduler/ipp.c:3471 scheduler/ipp.c:5207 scheduler/ipp.c:5376
+#: scheduler/ipp.c:5690 scheduler/ipp.c:6248 scheduler/ipp.c:7002
+#: scheduler/ipp.c:7058 scheduler/ipp.c:7372 scheduler/ipp.c:7638
+#: scheduler/ipp.c:7727 scheduler/ipp.c:7760 scheduler/ipp.c:8083
+#: scheduler/ipp.c:8476 scheduler/ipp.c:8558 scheduler/ipp.c:9719
+#: scheduler/ipp.c:10173 scheduler/ipp.c:10504 scheduler/ipp.c:10586
+#: scheduler/ipp.c:10960
 msgid "The printer or class does not exist."
 msgstr ""
 
@@ -5089,7 +5097,7 @@ msgstr ""
 msgid "The printer-uri \"%s\" contains invalid characters."
 msgstr ""
 
-#: scheduler/ipp.c:3252
+#: scheduler/ipp.c:3269
 msgid "The printer-uri attribute is required."
 msgstr ""
 
@@ -5109,12 +5117,12 @@ msgstr ""
 msgid "The web interface is currently disabled. Run \"cupsctl WebInterface=yes\" to enable it."
 msgstr ""
 
-#: scheduler/ipp.c:6326
+#: scheduler/ipp.c:6343
 #, c-format
 msgid "The which-jobs value \"%s\" is not supported."
 msgstr ""
 
-#: scheduler/ipp.c:5603
+#: scheduler/ipp.c:5620
 msgid "There are too many subscriptions."
 msgstr ""
 
@@ -5123,7 +5131,7 @@ msgid "There is a paper jam."
 msgstr ""
 
 #: backend/usb-darwin.c:412 backend/usb-darwin.c:471 backend/usb-darwin.c:535
-#: backend/usb-darwin.c:556 backend/usb-libusb.c:366 backend/usb-libusb.c:420
+#: backend/usb-darwin.c:556 backend/usb-libusb.c:368 backend/usb-libusb.c:422
 msgid "There was an unrecoverable USB error."
 msgstr ""
 
@@ -5140,7 +5148,7 @@ msgstr ""
 msgid "Too many job-sheets values (%d > 2)."
 msgstr ""
 
-#: scheduler/ipp.c:2606
+#: scheduler/ipp.c:2623
 #, c-format
 msgid "Too many printer-state-reasons values (%d > %d)."
 msgstr ""
@@ -5169,7 +5177,7 @@ msgstr ""
 msgid "Tray 4"
 msgstr ""
 
-#: cups/http-support.c:1327
+#: cups/http-support.c:1329
 msgid "URI Too Long"
 msgstr ""
 
@@ -5221,7 +5229,7 @@ msgstr ""
 msgid "Unable to add class"
 msgstr ""
 
-#: backend/ipp.c:1773
+#: backend/ipp.c:1774
 msgid "Unable to add document to print job."
 msgstr ""
 
@@ -5250,7 +5258,7 @@ msgstr ""
 msgid "Unable to cancel RSS subscription"
 msgstr ""
 
-#: backend/ipp.c:2165
+#: backend/ipp.c:2171
 msgid "Unable to cancel print job."
 msgstr ""
 
@@ -5266,12 +5274,12 @@ msgstr ""
 msgid "Unable to change server settings"
 msgstr ""
 
-#: cups/ipp.c:5276
+#: cups/ipp.c:5405
 #, c-format
 msgid "Unable to compile mimeMediaType regular expression: %s."
 msgstr ""
 
-#: cups/ipp.c:5222
+#: cups/ipp.c:5351
 #, c-format
 msgid "Unable to compile naturalLanguage regular expression: %s."
 msgstr ""
@@ -5304,12 +5312,12 @@ msgstr ""
 msgid "Unable to copy CUPS printer driver files (%d)."
 msgstr ""
 
-#: scheduler/ipp.c:2726
+#: scheduler/ipp.c:2743
 #, c-format
 msgid "Unable to copy PPD file - %s"
 msgstr ""
 
-#: scheduler/ipp.c:2781
+#: scheduler/ipp.c:2798
 msgid "Unable to copy PPD file."
 msgstr ""
 
@@ -5323,7 +5331,7 @@ msgstr ""
 msgid "Unable to copy Windows 9x printer driver files (%d)."
 msgstr ""
 
-#: scheduler/ipp.c:2703
+#: scheduler/ipp.c:2720
 #, c-format
 msgid "Unable to copy interface script - %s"
 msgstr ""
@@ -5352,35 +5360,35 @@ msgstr ""
 msgid "Unable to edit cupsd.conf files larger than 1MB"
 msgstr ""
 
-#: cups/http.c:5473
+#: cups/http.c:5478
 msgid "Unable to establish a secure connection to host (certificate chain invalid)."
 msgstr ""
 
-#: cups/http.c:5463
+#: cups/http.c:5468
 msgid "Unable to establish a secure connection to host (certificate not yet valid)."
 msgstr ""
 
-#: cups/http.c:5458
+#: cups/http.c:5463
 msgid "Unable to establish a secure connection to host (expired certificate)."
 msgstr ""
 
-#: cups/http.c:5468
+#: cups/http.c:5473
 msgid "Unable to establish a secure connection to host (host name mismatch)."
 msgstr ""
 
-#: cups/http.c:5478
+#: cups/http.c:5483
 msgid "Unable to establish a secure connection to host (peer dropped connection before responding)."
 msgstr ""
 
-#: cups/http.c:5453
+#: cups/http.c:5458
 msgid "Unable to establish a secure connection to host (self-signed certificate)."
 msgstr ""
 
-#: cups/http.c:5448
+#: cups/http.c:5453
 msgid "Unable to establish a secure connection to host (untrusted certificate)."
 msgstr ""
 
-#: cups/http.c:5249 cups/http.c:5505 cups/http.c:5538 cups/http.c:5555
+#: cups/http.c:5254 cups/http.c:5510 cups/http.c:5543 cups/http.c:5560
 msgid "Unable to establish a secure connection to host."
 msgstr ""
 
@@ -5388,11 +5396,11 @@ msgstr ""
 msgid "Unable to find destination for job"
 msgstr ""
 
-#: cups/http-support.c:1767
+#: cups/http-support.c:1769
 msgid "Unable to find printer."
 msgstr ""
 
-#: backend/ipp.c:3387
+#: backend/ipp.c:3393
 msgid "Unable to get backend exit status."
 msgstr ""
 
@@ -5476,7 +5484,7 @@ msgstr ""
 msgid "Unable to open device file"
 msgstr ""
 
-#: scheduler/ipp.c:6012
+#: scheduler/ipp.c:6029
 #, c-format
 msgid "Unable to open document #%d in job #%d."
 msgstr ""
@@ -5485,7 +5493,7 @@ msgstr ""
 msgid "Unable to open help file."
 msgstr ""
 
-#: backend/ipp.c:393 backend/ipp.c:1520 backend/ipp.c:1728 backend/lpd.c:505
+#: backend/ipp.c:393 backend/ipp.c:1520 backend/ipp.c:1729 backend/lpd.c:505
 #: backend/socket.c:155 backend/usb.c:237 filter/gziptoany.c:71
 #: filter/pstops.c:300
 msgid "Unable to open print file"
@@ -5501,7 +5509,7 @@ msgid "Unable to print test page"
 msgstr ""
 
 #: backend/runloop.c:96 backend/runloop.c:325 backend/usb-darwin.c:643
-#: backend/usb-darwin.c:687 backend/usb-libusb.c:511 backend/usb-libusb.c:546
+#: backend/usb-darwin.c:687 backend/usb-libusb.c:513 backend/usb-libusb.c:548
 msgid "Unable to read print data."
 msgstr ""
 
@@ -5522,7 +5530,7 @@ msgstr ""
 msgid "Unable to send command to printer driver"
 msgstr ""
 
-#: backend/usb-darwin.c:765 backend/usb-libusb.c:622
+#: backend/usb-darwin.c:765 backend/usb-libusb.c:624
 msgid "Unable to send data to printer."
 msgstr ""
 
@@ -5539,7 +5547,7 @@ msgstr ""
 msgid "Unable to set server default"
 msgstr ""
 
-#: backend/ipp.c:3246 backend/ipp.c:3323 backend/ipp.c:3331
+#: backend/ipp.c:3252 backend/ipp.c:3329 backend/ipp.c:3337
 msgid "Unable to start backend process."
 msgstr ""
 
@@ -5547,7 +5555,7 @@ msgstr ""
 msgid "Unable to upload cupsd.conf file"
 msgstr ""
 
-#: backend/usb-darwin.c:2019 backend/usb-darwin.c:2043
+#: backend/usb-darwin.c:2033 backend/usb-darwin.c:2057
 msgid "Unable to use legacy USB class driver."
 msgstr ""
 
@@ -5560,7 +5568,7 @@ msgstr ""
 msgid "Unable to write uncompressed print data: %s"
 msgstr ""
 
-#: cups/http-support.c:1315
+#: cups/http-support.c:1317
 msgid "Unauthorized"
 msgstr ""
 
@@ -5568,7 +5576,7 @@ msgstr ""
 msgid "Units"
 msgstr ""
 
-#: cups/http-support.c:1355 cups/ppd.c:366
+#: cups/http-support.c:1357 cups/ppd.c:366
 msgid "Unknown"
 msgstr ""
 
@@ -5592,7 +5600,7 @@ msgstr ""
 msgid "Unknown format character: \"%c\"."
 msgstr ""
 
-#: cups/dest-options.c:769
+#: cups/dest-options.c:984
 msgid "Unknown media size name."
 msgstr ""
 
@@ -5611,12 +5619,12 @@ msgstr ""
 msgid "Unknown print mode: \"%s\"."
 msgstr ""
 
-#: scheduler/ipp.c:10358
+#: scheduler/ipp.c:10375
 #, c-format
 msgid "Unknown printer-error-policy \"%s\"."
 msgstr ""
 
-#: scheduler/ipp.c:10341
+#: scheduler/ipp.c:10358
 #, c-format
 msgid "Unknown printer-op-policy \"%s\"."
 msgstr ""
@@ -5630,17 +5638,17 @@ msgstr ""
 msgid "Unknown version option value: \"%s\"."
 msgstr ""
 
-#: scheduler/ipp.c:10814
+#: scheduler/ipp.c:10831
 #, c-format
 msgid "Unsupported 'compression' value \"%s\"."
 msgstr ""
 
-#: scheduler/ipp.c:10844
+#: scheduler/ipp.c:10861
 #, c-format
 msgid "Unsupported 'document-format' value \"%s\"."
 msgstr ""
 
-#: scheduler/ipp.c:10919
+#: scheduler/ipp.c:10936
 msgid "Unsupported 'job-name' value."
 msgstr ""
 
@@ -5649,17 +5657,17 @@ msgstr ""
 msgid "Unsupported character set \"%s\"."
 msgstr ""
 
-#: scheduler/ipp.c:8032 scheduler/ipp.c:9263
+#: scheduler/ipp.c:8049 scheduler/ipp.c:9280
 #, c-format
 msgid "Unsupported compression \"%s\"."
 msgstr ""
 
-#: scheduler/ipp.c:8166 scheduler/ipp.c:9413
+#: scheduler/ipp.c:8183 scheduler/ipp.c:9430
 #, c-format
 msgid "Unsupported document-format \"%s\"."
 msgstr ""
 
-#: scheduler/ipp.c:9396
+#: scheduler/ipp.c:9413
 #, c-format
 msgid "Unsupported document-format \"%s/%s\"."
 msgstr ""
@@ -5673,7 +5681,7 @@ msgstr ""
 msgid "Unsupported margins."
 msgstr ""
 
-#: cups/pwg-media.c:553
+#: cups/pwg-media.c:567
 msgid "Unsupported media value."
 msgstr ""
 
@@ -5700,7 +5708,7 @@ msgstr ""
 msgid "Unsupported value type"
 msgstr ""
 
-#: cups/http-support.c:1330
+#: cups/http-support.c:1332
 msgid "Upgrade Required"
 msgstr ""
 
@@ -5815,11 +5823,11 @@ msgstr ""
 msgid "Version uses indefinite length"
 msgstr ""
 
-#: backend/ipp.c:1874
+#: backend/ipp.c:1875
 msgid "Waiting for job to complete."
 msgstr ""
 
-#: backend/usb-darwin.c:490 backend/usb-libusb.c:318
+#: backend/usb-darwin.c:490 backend/usb-libusb.c:320
 msgid "Waiting for printer to become available."
 msgstr ""
 
@@ -5831,7 +5839,7 @@ msgstr ""
 msgid "Warning, no Windows 2000 printer drivers are installed."
 msgstr ""
 
-#: cups/http-support.c:1351
+#: cups/http-support.c:1353
 msgid "Web Interface is Disabled"
 msgstr ""
 
@@ -5868,11 +5876,11 @@ msgstr ""
 msgid "completed"
 msgstr ""
 
-#: scheduler/ipp.c:5884
+#: scheduler/ipp.c:5901
 msgid "cups-deviced failed to execute."
 msgstr ""
 
-#: scheduler/ipp.c:6703 scheduler/ipp.c:6952
+#: scheduler/ipp.c:6720 scheduler/ipp.c:6969
 msgid "cups-driverd failed to execute."
 msgstr ""
 
@@ -6046,7 +6054,7 @@ msgstr ""
 msgid "ipptool: Unknown option \"-%c\"."
 msgstr ""
 
-#: scheduler/ipp.c:7699
+#: scheduler/ipp.c:7716
 msgid "job-printer-uri attribute missing."
 msgstr ""
 
@@ -6352,16 +6360,16 @@ msgstr ""
 msgid "no system default destination"
 msgstr ""
 
-#: scheduler/ipp.c:5574
+#: scheduler/ipp.c:5591
 msgid "notify-events not specified."
 msgstr ""
 
-#: scheduler/ipp.c:2111 scheduler/ipp.c:5479
+#: scheduler/ipp.c:2111 scheduler/ipp.c:5496
 #, c-format
 msgid "notify-recipient-uri URI \"%s\" is already used."
 msgstr ""
 
-#: scheduler/ipp.c:2101 scheduler/ipp.c:5469
+#: scheduler/ipp.c:2101 scheduler/ipp.c:5486
 #, c-format
 msgid "notify-recipient-uri URI \"%s\" uses unknown scheme."
 msgstr ""
index 53508f5ad38472f04827c8faf392c8ecbb14307a..e125be903752e7616ce8f1cc4f35804c8229d16c 100644 (file)
 "Internet Postage 2-Part" = "Internet Postage 2-Part";
 "Internet Postage 3-Part" = "Internet Postage 3-Part";
 "Internet Printing Protocol" = "Internet Printing Protocol";
+"Invalid media name arguments." = "Invalid media name arguments.";
 "Invalid media size." = "Invalid media size.";
 "Invalid printer command \"%s\"." = "Invalid printer command \"%s\".";
 "JCL" = "JCL";
 "Printer Paused" = "Printer Paused";
 "Printer Settings" = "Printer Settings";
 "Printer cannot print supplied content." = "Printer cannot print supplied content.";
+"Printer cannot print with supplied options." = "Printer cannot print with supplied options.";
 "Printer:" = "Printer:";
 "Printers" = "Printers";
 "Printing page %d, %d%% complete." = "Printing page %d, %d%% complete.";
index 350a535a90a4f47099a4782700dfb9896089ec51..be78334cf34fb9a20e08bb8f9d6c7deb69d33ab2 100644 (file)
@@ -32,7 +32,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: CUPS 1.4.6\n"
 "Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
-"POT-Creation-Date: 2013-03-08 13:23-0500\n"
+"POT-Creation-Date: 2013-03-20 15:42-0400\n"
 "PO-Revision-Date: 2012-09-29 11:21+0200\n"
 "Last-Translator: Àngel Mompó <mecatxis@gmail.com>\n"
 "Language-Team: Catalan <ca@dodds.net>\n"
@@ -3178,6 +3178,9 @@ msgstr "Franqueig per Internet en 3 parts"
 msgid "Internet Printing Protocol"
 msgstr "Protocol d'impressió per Internet"
 
+msgid "Invalid media name arguments."
+msgstr ""
+
 msgid "Invalid media size."
 msgstr "Mida del suport no vàlida."
 
@@ -3782,6 +3785,9 @@ msgstr "Configuració de la impressora"
 msgid "Printer cannot print supplied content."
 msgstr "La impressora no pot imprimir el contingut subministrat."
 
+msgid "Printer cannot print with supplied options."
+msgstr ""
+
 msgid "Printer:"
 msgstr "Impressora:"
 
index 1a8c18ba7eb0d40a49d72f785956e4c04825836b..7e9161c273d7758e08ff1a242abe89b0dccbd2ac 100644 (file)
@@ -16,7 +16,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: CUPS 1.6\n"
 "Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
-"POT-Creation-Date: 2013-03-08 13:23-0500\n"
+"POT-Creation-Date: 2013-03-20 15:42-0400\n"
 "PO-Revision-Date: 2012-07-01 20:21+0100\n"
 "Last-Translator: Juan Pablo González Riopedre <riopedre13@yahoo.es>\n"
 "Language-Team: Spanish\n"
@@ -3165,6 +3165,9 @@ msgstr "Correo por Internet Parte-3"
 msgid "Internet Printing Protocol"
 msgstr "Protocolo de Impresión de Internet IPP"
 
+msgid "Invalid media name arguments."
+msgstr ""
+
 msgid "Invalid media size."
 msgstr "Tamaño del papel no válido"
 
@@ -3770,6 +3773,9 @@ msgstr "Configuración de la impresora"
 msgid "Printer cannot print supplied content."
 msgstr "La impresora no puede imprimir el contenido suministrado."
 
+msgid "Printer cannot print with supplied options."
+msgstr ""
+
 msgid "Printer:"
 msgstr "Impresora:"
 
index 7b6666ea823f9bf8809690cc41b6f493fdb298cb..3887b327998087b4d74377c877122342f598aee7 100644 (file)
@@ -29,7 +29,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: CUPS 1.6\n"
 "Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
-"POT-Creation-Date: 2013-03-08 13:23-0500\n"
+"POT-Creation-Date: 2013-03-20 15:42-0400\n"
 "PO-Revision-Date: 2012-12-12 11:12+0100\n"
 "Last-Translator: denis meramdjougoma <dcmeram@libertysurf.fr>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -2969,6 +2969,9 @@ msgstr "Affranchissement Internet en 3 parties"
 msgid "Internet Printing Protocol"
 msgstr "Internet Printing Protocol"
 
+msgid "Invalid media name arguments."
+msgstr ""
+
 msgid "Invalid media size."
 msgstr ""
 
@@ -3565,6 +3568,9 @@ msgstr "Réglages de l’imprimante"
 msgid "Printer cannot print supplied content."
 msgstr ""
 
+msgid "Printer cannot print with supplied options."
+msgstr ""
+
 msgid "Printer:"
 msgstr "Imprimante :"
 
index 55eecb18c81046f22a60dbbbec35ed12580e0695..ab16be3e7b34d7812466f852d7785d369793f85a 100644 (file)
@@ -28,7 +28,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: CUPS 1.6\n"
 "Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
-"POT-Creation-Date: 2013-03-08 13:23-0500\n"
+"POT-Creation-Date: 2013-03-20 15:42-0400\n"
 "PO-Revision-Date: 2012-06-13 01:20+0900\n"
 "Last-Translator: OPFC TRANSCUPS <opfc-transcups@sourceforge.jp>\n"
 "Language-Team: OPFC TRANSCUPS <opfc-transcups@sourceforge.jp>\n"
@@ -3162,6 +3162,9 @@ msgstr "Internet Postage 3-Part"
 msgid "Internet Printing Protocol"
 msgstr "インターネット印刷プロトコル"
 
+msgid "Invalid media name arguments."
+msgstr ""
+
 msgid "Invalid media size."
 msgstr "無効なメディアサイズです。"
 
@@ -3765,6 +3768,9 @@ msgstr "プリンター設定"
 msgid "Printer cannot print supplied content."
 msgstr "プリンターは受信した内容を印刷できませんでした。"
 
+msgid "Printer cannot print with supplied options."
+msgstr ""
+
 msgid "Printer:"
 msgstr "プリンター:"
 
index 022aee704ac111aa3ef1fedeaffcdc6931913428..53ae955c4bec1812456c5139d8f4187ab8860bc1 100644 (file)
@@ -2,7 +2,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: CUPS 1.4\n"
 "Report-Msgid-Bugs-To: http://www.cups.org/str.php\n"
-"POT-Creation-Date: 2013-03-08 13:23-0500\n"
+"POT-Creation-Date: 2013-03-20 15:42-0400\n"
 "PO-Revision-Date: 2009-02-16 12:00-0800\n"
 "Last-Translator: Apple Inc.\n"
 "Language-Team: Apple Inc.\n"
@@ -2945,6 +2945,9 @@ msgstr "Наклейки Internet Postage 3-Part"
 msgid "Internet Printing Protocol"
 msgstr "Протокол интернет-печати"
 
+msgid "Invalid media name arguments."
+msgstr ""
+
 msgid "Invalid media size."
 msgstr ""
 
@@ -3541,6 +3544,9 @@ msgstr "Параметры принтера"
 msgid "Printer cannot print supplied content."
 msgstr ""
 
+msgid "Printer cannot print with supplied options."
+msgstr ""
+
 msgid "Printer:"
 msgstr "Принтер:"
 
index 19e16069d4373a291ebecc779a15f43f024e133a..b03d347cbfb84fc3a5e2e3b530d37ffde5835c08 100644 (file)
@@ -126,6 +126,14 @@ depend:
        $(CXX) -MM $(ALL_CXXFLAGS) $(CXXOBJS:.o=.cxx) >>Dependencies
 
 
+#
+# Run oclint to check code coverage...
+#
+
+oclint:
+       oclint -o=oclint.html -html $(CUPSDOBJS:.o=.c) $(LIBOBJS:.o=.c) -- $(ALL_CFLAGS)
+
+
 #
 # Install all targets...
 #
index c8e89b9ce990ae77f86f8724158d760edbbb10a4..292a7f29cb8001c905642ba7797b14be4ed64b71 100644 (file)
@@ -513,18 +513,37 @@ cupsdAuthorize(cupsd_client_t *con)       /* I - Client connection */
     socklen_t          peersize;       /* Size of peer credentials */
 #ifdef HAVE_AUTHORIZATION_H
     const char         *name;          /* Authorizing name */
+    int                        no_peer = 0;    /* Don't allow peer credentials? */
+
+   /*
+    * See if we should allow peer credentials...
+    */
 
     for (name = (char *)cupsArrayFirst(con->best->names);
          name;
          name = (char *)cupsArrayNext(con->best->names))
+    {
       if (!_cups_strncasecmp(name, "@AUTHKEY(", 9) ||
           !_cups_strcasecmp(name, "@SYSTEM"))
       {
-       cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "[Client %d] PeerCred authentication not allowed for "
-                       "resource.", con->http.fd);
-       return;
+       /* Normally don't want peer credentials if we need an auth key... */
+       no_peer = 1;
       }
+      else if (!_cups_strcasecmp(name, "@OWNER"))
+      {
+       /* but if @OWNER is present then we allow it... */
+        no_peer = 0;
+        break;
+      }
+    }
+
+    if (no_peer)
+    {
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                     "[Client %d] PeerCred authentication not allowed for "
+                     "resource per AUTHKEY policy.", con->http.fd);
+      return;
+    }
 #endif /* HAVE_AUTHORIZATION_H */
 
     if ((pwd = getpwnam(authorization + 9)) == NULL)
index 24d077bbd563e4694a71f33b149d7be6210026da..6cd00fc349f1c190a2215b889df02a9bdf059a56 100644 (file)
@@ -436,7 +436,7 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
   {
     if (httpAddrLocalhost(&temp))
       strlcpy(con->servername, "localhost", sizeof(con->servername));
-    else if (HostNameLookups || RemotePort)
+    else if (HostNameLookups)
       httpAddrLookup(&temp, con->servername, sizeof(con->servername));
     else
       httpAddrString(&temp, con->servername, sizeof(con->servername));
@@ -1302,7 +1302,8 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
       {
        case HTTP_STATE_GET_SEND :
             if ((!strncmp(con->uri, "/ppd/", 5) ||
-                !strncmp(con->uri, "/printers/", 10)) &&
+                !strncmp(con->uri, "/printers/", 10) ||
+                !strncmp(con->uri, "/classes/", 9)) &&
                !strcmp(con->uri + strlen(con->uri) - 4, ".ppd"))
            {
             /*
@@ -1314,8 +1315,36 @@ cupsdReadClient(cupsd_client_t *con)     /* I - Client to read from */
 
              if (!strncmp(con->uri, "/ppd/", 5))
                p = cupsdFindPrinter(con->uri + 5);
-             else
+             else if (!strncmp(con->uri, "/printers/", 10))
                p = cupsdFindPrinter(con->uri + 10);
+             else
+             {
+               p = cupsdFindClass(con->uri + 9);
+
+               if (p)
+               {
+                 int i;                /* Looping var */
+
+                 for (i = 0; i < p->num_printers; i ++)
+                 {
+                   if (!(p->printers[i]->type & CUPS_PRINTER_CLASS))
+                   {
+                     char ppdname[1024];/* PPD filename */
+
+                     snprintf(ppdname, sizeof(ppdname), "%s/ppd/%s.ppd",
+                              ServerRoot, p->printers[i]->name);
+                     if (!access(ppdname, 0))
+                     {
+                       p = p->printers[i];
+                       break;
+                     }
+                   }
+                 }
+
+                  if (i >= p->num_printers)
+                    p = NULL;
+               }
+             }
 
              if (p)
              {
@@ -1349,7 +1378,33 @@ cupsdReadClient(cupsd_client_t *con)     /* I - Client to read from */
               else if (!strncmp(con->uri, "/printers/", 10))
                 p = cupsdFindPrinter(con->uri + 10);
               else
-                p = cupsdFindClass(con->uri + 9);
+              {
+               p = cupsdFindClass(con->uri + 9);
+
+               if (p)
+               {
+                 int i;                /* Looping var */
+
+                 for (i = 0; i < p->num_printers; i ++)
+                 {
+                   if (!(p->printers[i]->type & CUPS_PRINTER_CLASS))
+                   {
+                     char ppdname[1024];/* PPD filename */
+
+                     snprintf(ppdname, sizeof(ppdname), "%s/ppd/%s.ppd",
+                              ServerRoot, p->printers[i]->name);
+                     if (!access(ppdname, 0))
+                     {
+                       p = p->printers[i];
+                       break;
+                     }
+                   }
+                 }
+
+                  if (i >= p->num_printers)
+                    p = NULL;
+               }
+             }
 
               if (p)
                snprintf(con->uri, sizeof(con->uri), "/icons/%s.png", p->name);
@@ -2128,6 +2183,8 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
                return;
              }
 
+             if (data_ready(con))
+               continue;
              break;
             }
            else
@@ -2619,7 +2676,14 @@ cupsdSendHeader(
               con->http.hostname);
 #ifdef HAVE_GSSAPI
     else if (auth_type == CUPSD_AUTH_NEGOTIATE)
+    {
+#  ifdef AF_LOCAL
+      if (_httpAddrFamily(con->http.hostaddr) == AF_LOCAL)
+        strlcpy(auth_str, "Basic realm=\"CUPS\"", sizeof(auth_str));
+      else
+#  endif /* AF_LOCAL */
       strlcpy(auth_str, "Negotiate", sizeof(auth_str));
+    }
 #endif /* HAVE_GSSAPI */
 
     if (con->best && auth_type != CUPSD_AUTH_NEGOTIATE &&
index 5492eb5d71e755efe2f65069cddcf91e1ceb549b..28cfbd24c481be3df147561ea3bbbdd011890eca 100644 (file)
@@ -704,7 +704,7 @@ cupsdReadConfiguration(void)
   AccessLogLevel           = CUPSD_ACCESSLOG_ACTIONS;
   ConfigFilePerm           = CUPS_DEFAULT_CONFIG_FILE_PERM;
   FatalErrors              = parse_fatal_errors(CUPS_DEFAULT_FATAL_ERRORS);
-  default_auth_type          = CUPSD_AUTH_BASIC;
+  default_auth_type        = CUPSD_AUTH_BASIC;
 #ifdef HAVE_SSL
   DefaultEncryption        = HTTP_ENCRYPT_REQUIRED;
   SSLOptions               = CUPSD_SSL_NONE;
@@ -766,7 +766,7 @@ cupsdReadConfiguration(void)
   cupsdClearString(&DefaultPolicy);
 
 #ifdef HAVE_AUTHORIZATION_H
-  cupsdClearString(&SystemGroupAuthKey);
+  cupsdSetString(&SystemGroupAuthKey, CUPS_DEFAULT_SYSTEM_AUTHKEY);
 #endif /* HAVE_AUTHORIZATION_H */
 
   MaxSubscriptions           = 100;
@@ -3349,7 +3349,7 @@ read_cupsd_conf(cups_file_t *fp)  /* I - File to read from */
              !_cups_strcasecmp(line, "TempDir") ||
             !_cups_strcasecmp(line, "User"))
     {
-      cupsdLogMessage(CUPSD_LOG_WARN,
+      cupsdLogMessage(CUPSD_LOG_INFO,
                      "Please move \"%s%s%s\" on line %d of %s to the %s file; "
                      "this will become an error in a future release.",
                      line, value ? " " : "", value ? value : "", linenum,
index cc7056768a38056c92ae350ed261418e7e975d9e..1541a785f019bd7b35696ef757d0238fc9c5b882 100644 (file)
@@ -31,6 +31,7 @@
 #  ifndef SANDBOX_NAMED_EXTERNAL
 #    define SANDBOX_NAMED_EXTERNAL  0x0003
 #  endif /* !SANDBOX_NAMED_EXTERNAL */
+#  pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 #endif /* HAVE_SANDBOX_H */
 
 
@@ -60,7 +61,6 @@ main(int  argc,                               /* I - Number of command-line args */
   }
 
 #ifdef HAVE_SANDBOX_H
-#  pragma GCC diagnostic ignored "-Wdeprecated-declarations"
  /*
   * Run in a separate security profile...
   */
index c4806f569da2404a67a61db637671341a83553ba..84eefde5f5a2f99c90879147487fb3bcc0a9f334 100644 (file)
@@ -917,7 +917,7 @@ exec_filters(mime_type_t   *srctype,        /* I - Source type */
 {
   int          i;                      /* Looping var */
   const char   *argv[8],               /* Command-line arguments */
-               *envp[16],              /* Environment variables */
+               *envp[17],              /* Environment variables */
                *temp;                  /* Temporary string */
   char         *optstr,                /* Filter options */
                content_type[1024],     /* CONTENT_TYPE */
@@ -925,6 +925,8 @@ exec_filters(mime_type_t   *srctype,        /* I - Source type */
                cups_fontpath[1024],    /* CUPS_FONTPATH */
                cups_serverbin[1024],   /* CUPS_SERVERBIN */
                cups_serverroot[1024],  /* CUPS_SERVERROOT */
+               final_content_type[1024] = "",
+                                       /* FINAL_CONTENT_TYPE */
                lang[1024],             /* LANG */
                path[1024],             /* PATH */
                ppd[1024],              /* PPD */
@@ -947,6 +949,39 @@ exec_filters(mime_type_t   *srctype,       /* I - Source type */
   cups_dest_t  *dest;                  /* Destination information */
 
 
+ /*
+  * Figure out the final content type...
+  */
+
+  for (filter = (mime_filter_t *)cupsArrayLast(filters);
+       filter && filter->dst;
+       filter = (mime_filter_t *)cupsArrayPrev(filters))
+    if (strcmp(filter->dst->super, "printer"))
+      break;
+
+  if (filter && filter->dst)
+  {
+    const char *ptr;                   /* Pointer in type name */
+
+    if ((ptr = strchr(filter->dst->type, '/')) != NULL)
+      snprintf(final_content_type, sizeof(final_content_type),
+              "FINAL_CONTENT_TYPE=%s", ptr + 1);
+    else
+      snprintf(final_content_type, sizeof(final_content_type),
+              "FINAL_CONTENT_TYPE=%s/%s", filter->dst->super,
+              filter->dst->type);
+  }
+
+ /*
+  * Remove NULL ("-") filters...
+  */
+
+  for (filter = (mime_filter_t *)cupsArrayFirst(filters);
+       filter;
+       filter = (mime_filter_t *)cupsArrayNext(filters))
+    if (!strcmp(filter->filter, "-"))
+      cupsArrayRemove(filters, filter);
+
  /*
   * Setup the filter environment and command-line...
   */
@@ -1041,7 +1076,13 @@ exec_filters(mime_type_t   *srctype,     /* I - Source type */
   envp[12] = rip_max_cache;
   envp[13] = userenv;
   envp[14] = "CHARSET=utf-8";
-  envp[15] = NULL;
+  if (final_content_type[0])
+  {
+    envp[15] = final_content_type;
+    envp[16] = NULL;
+  }
+  else
+    envp[15] = NULL;
 
   for (i = 0; argv[i]; i ++)
     fprintf(stderr, "DEBUG: argv[%d]=\"%s\"\n", i, argv[i]);
index febd66dfe2e536549b1db258441e3c7f0dd2f69c..4cd065d969739d2cd77a3b515cad5eeec31e0d97 100644 (file)
@@ -2411,6 +2411,21 @@ add_printer(cupsd_client_t  *con,        /* I - Client connection */
     http_uri_status_t  uri_status;     /* URI separation status */
     char               old_device_uri[1024];
                                        /* Old device URI */
+    static const char * const uri_status_strings[] =
+    {
+      "URI too large.",
+      "Bad arguments to function.",
+      "Bad resource path.",
+      "Bad port number.",
+      "Bad hostname/address.",
+      "Bad username/password.",
+      "Bad URI scheme.",
+      "Bad URI.",
+      "OK",
+      "Missing URI scheme.",
+      "Unknown URI scheme",
+      "Missing resource path."
+    };
 
 
     need_restart_job = 1;
@@ -2422,12 +2437,14 @@ add_printer(cupsd_client_t  *con,       /* I - Client connection */
                                 host, sizeof(host), &port,
                                 resource, sizeof(resource));
 
+    cupsdLogMessage(CUPSD_LOG_DEBUG,
+                   "%s device-uri: %s", printer->name,
+                   uri_status_strings[uri_status - HTTP_URI_STATUS_OVERFLOW]);
+
     if (uri_status < HTTP_URI_OK)
     {
       send_ipp_status(con, IPP_NOT_POSSIBLE, _("Bad device-uri \"%s\"."),
                      attr->values[0].string.text);
-      cupsdLogMessage(CUPSD_LOG_DEBUG,
-                      "add_printer: httpSeparateURI returned %d", uri_status);
       return;
     }
 
index c325d06804212b22dd4202f05a9e99081c8c5b9e..a2ef65f71948f3344a50f829ef306b74155c4ec9 100644 (file)
@@ -560,7 +560,7 @@ cupsdContinueJob(cupsd_job_t *job)  /* I - Job */
                                        /* CONTENT_TYPE env variable */
                        device_uri[1024],
                                        /* DEVICE_URI env variable */
-                       final_content_type[1024],
+                       final_content_type[1024] = "",
                                        /* FINAL_CONTENT_TYPE env variable */
                        lang[255],      /* LANG env variable */
 #ifdef __APPLE__
@@ -598,7 +598,6 @@ cupsdContinueJob(cupsd_job_t *job)  /* I - Job */
 
   memset(job->filters, 0, sizeof(job->filters));
 
-
   if (job->printer->raw)
   {
    /*
@@ -636,6 +635,44 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */
       goto abort_job;
     }
 
+   /*
+    * Figure out the final content type...
+    */
+
+    cupsdLogJob(job, CUPSD_LOG_DEBUG, "%d filters for job:",
+                cupsArrayCount(filters));
+    for (filter = (mime_filter_t *)cupsArrayFirst(filters);
+         filter;
+         filter = (mime_filter_t *)cupsArrayNext(filters))
+      cupsdLogJob(job, CUPSD_LOG_DEBUG, "%s (%s/%s to %s/%s, cost %d)",
+                 filter->filter,
+                 filter->src ? filter->src->super : "???",
+                 filter->src ? filter->src->type : "???",
+                 filter->dst ? filter->dst->super : "???",
+                 filter->dst ? filter->dst->type : "???",
+                 filter->cost);
+
+    if (!job->printer->remote)
+    {
+      for (filter = (mime_filter_t *)cupsArrayLast(filters);
+           filter && filter->dst;
+           filter = (mime_filter_t *)cupsArrayPrev(filters))
+        if (strcmp(filter->dst->super, "printer") ||
+            strcmp(filter->dst->type, job->printer->name))
+          break;
+
+      if (filter && filter->dst)
+      {
+       if ((ptr = strchr(filter->dst->type, '/')) != NULL)
+         snprintf(final_content_type, sizeof(final_content_type),
+                  "FINAL_CONTENT_TYPE=%s", ptr + 1);
+       else
+         snprintf(final_content_type, sizeof(final_content_type),
+                  "FINAL_CONTENT_TYPE=%s/%s", filter->dst->super,
+                  filter->dst->type);
+      }
+    }
+
    /*
     * Remove NULL ("-") filters...
     */
@@ -1034,25 +1071,8 @@ cupsdContinueJob(cupsd_job_t *job)       /* I - Job */
   envp[envc ++] = banner_page ? "CUPS_FILETYPE=job-sheet" :
                                 "CUPS_FILETYPE=document";
 
-  if (!job->printer->remote && !job->printer->raw)
-  {
-    filter = (mime_filter_t *)cupsArrayLast(filters);
-
-    if (job->printer->port_monitor)
-      filter = (mime_filter_t *)cupsArrayPrev(filters);
-
-    if (filter && filter->dst)
-    {
-      if ((ptr = strchr(filter->dst->type, '/')) != NULL)
-       snprintf(final_content_type, sizeof(final_content_type),
-                "FINAL_CONTENT_TYPE=%s", ptr + 1);
-      else
-       snprintf(final_content_type, sizeof(final_content_type),
-                "FINAL_CONTENT_TYPE=%s/%s", filter->dst->super,
-                filter->dst->type);
-      envp[envc ++] = final_content_type;
-    }
-  }
+  if (final_content_type[0])
+    envp[envc ++] = final_content_type;
 
   if (Classification && !banner_page)
   {
@@ -3040,8 +3060,9 @@ finalize_job(cupsd_job_t *job,            /* I - Job */
        job_state = IPP_JOB_COMPLETED;
        message   = "Job completed.";
 
-       ippSetString(job->attrs, &job->reasons, 0,
-                    "job-completed-successfully");
+        if (!job->status)
+         ippSetString(job->attrs, &job->reasons, 0,
+                      "job-completed-successfully");
         break;
 
     case IPP_JOB_STOPPED :
@@ -3227,13 +3248,48 @@ finalize_job(cupsd_job_t *job,          /* I - Job */
            * Hold the job...
            */
 
-           cupsdSetJobHoldUntil(job, "indefinite", 1);
-           ippSetString(job->attrs, &job->reasons, 0,
-                        "job-hold-until-specified");
+           const char *reason = ippGetString(job->reasons, 0, NULL);
 
-           job_state = IPP_JOB_HELD;
-           message   = "Job held indefinitely due to backend errors; please "
+           cupsdLogJob(job, CUPSD_LOG_DEBUG, "job-state-reasons=\"%s\"",
+                       reason);
+
+           if (!reason || strncmp(reason, "account-", 8))
+           {
+             cupsdSetJobHoldUntil(job, "indefinite", 1);
+
+             ippSetString(job->attrs, &job->reasons, 0,
+                          "job-hold-until-specified");
+             message = "Job held indefinitely due to backend errors; please "
                        "consult the error_log file for details.";
+            }
+            else if (!strcmp(reason, "account-info-needed"))
+            {
+             cupsdSetJobHoldUntil(job, "indefinite", 0);
+
+             message = "Job held indefinitely - account information is "
+                       "required.";
+            }
+            else if (!strcmp(reason, "account-closed"))
+            {
+             cupsdSetJobHoldUntil(job, "indefinite", 0);
+
+             message = "Job held indefinitely - account has been closed.";
+           }
+            else if (!strcmp(reason, "account-limit-reached"))
+            {
+             cupsdSetJobHoldUntil(job, "indefinite", 0);
+
+             message = "Job held indefinitely - account limit has been "
+                       "reached.";
+           }
+            else
+            {
+             cupsdSetJobHoldUntil(job, "indefinite", 0);
+
+             message = "Job held indefinitely - account authorization failed.";
+           }
+
+           job_state = IPP_JOB_HELD;
           }
           break;
 
index 3baa45ca2dd62d9acc55304e633a14592392878c..17ad5116e6c287af1679f64de780f6542a3a17a3 100644 (file)
@@ -2128,7 +2128,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
     for (i = 0, name = (char *)cupsArrayFirst(p->users);
          name;
         i ++, name = (char *)cupsArrayNext(p->users))
-      attr->values[i].string.text = _cupsStrRetain(name);
+      attr->values[i].string.text = _cupsStrAlloc(name);
   }
 
   ippAddInteger(p->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
@@ -2195,7 +2195,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
       for (i = 0; i < p->num_printers; i ++)
       {
        if (attr != NULL)
-         attr->values[i].string.text = _cupsStrRetain(p->printers[i]->name);
+         attr->values[i].string.text = _cupsStrAlloc(p->printers[i]->name);
 
        p->type &= ~CUPS_PRINTER_OPTIONS | p->printers[i]->type;
       }
@@ -2295,7 +2295,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
       {
        for (i = 0; i < oldattr->num_values; i ++)
          attr->values[i].string.text =
-             _cupsStrRetain(oldattr->values[i].string.text);
+             _cupsStrAlloc(oldattr->values[i].string.text);
       }
     }
 
@@ -2349,7 +2349,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
       {
        for (i = 0; i < oldattr->num_values; i ++)
          attr->values[i].string.text =
-             _cupsStrRetain(oldattr->values[i].string.text);
+             _cupsStrAlloc(oldattr->values[i].string.text);
       }
     }
 
@@ -2362,7 +2362,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
       {
        for (i = 0; i < oldattr->num_values; i ++)
          attr->values[i].string.text =
-             _cupsStrRetain(oldattr->values[i].string.text);
+             _cupsStrAlloc(oldattr->values[i].string.text);
       }
     }
 
@@ -3935,13 +3935,13 @@ load_ppd(cupsd_printer_t *p)            /* I - Printer */
         for (i = p->pc->num_sizes, pwgsize = p->pc->sizes;
             i > 0;
             i --, pwgsize ++, val ++)
-         val->string.text = _cupsStrRetain(pwgsize->map.pwg);
+         val->string.text = _cupsStrAlloc(pwgsize->map.pwg);
 
         if (p->pc->custom_min_keyword)
        {
-         val->string.text = _cupsStrRetain(p->pc->custom_min_keyword);
+         val->string.text = _cupsStrAlloc(p->pc->custom_min_keyword);
          val ++;
-         val->string.text = _cupsStrRetain(p->pc->custom_max_keyword);
+         val->string.text = _cupsStrAlloc(p->pc->custom_max_keyword);
         }
       }
 
@@ -3993,7 +3993,7 @@ load_ppd(cupsd_printer_t *p)              /* I - Printer */
                 val = attr->values;
             i > 0;
             i --, pwgsource ++, val ++)
-         val->string.text = _cupsStrRetain(pwgsource->pwg);
+         val->string.text = _cupsStrAlloc(pwgsource->pwg);
       }
 
      /*
@@ -4009,7 +4009,7 @@ load_ppd(cupsd_printer_t *p)              /* I - Printer */
                 val = attr->values;
             i > 0;
             i --, pwgtype ++, val ++)
-         val->string.text = _cupsStrRetain(pwgtype->pwg);
+         val->string.text = _cupsStrAlloc(pwgtype->pwg);
       }
 
      /*
@@ -4295,7 +4295,7 @@ load_ppd(cupsd_printer_t *p)              /* I - Printer */
                mandatory = (char *)cupsArrayFirst(p->pc->mandatory);
            mandatory;
            val ++, mandatory = (char *)cupsArrayNext(p->pc->mandatory))
-        val->string.text = _cupsStrRetain(mandatory);
+        val->string.text = _cupsStrAlloc(mandatory);
     }
 
    /*
index 9a17f3e722d175c11a59f997ce1843f7f507c6ca..9973417c1245fbdc5da5d5e6839a2645e4b0175e 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   PPD test program for CUPS.
  *
- *   Copyright 2007-2012 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -3210,11 +3210,11 @@ check_sizes(ppd_file_t *ppd,            /* I - PPD file */
     {
       is_ok          = 1;
       width_2540ths  = (size->length > size->width) ?
-                           _PWG_FROMPTS(size->width) :
-                          _PWG_FROMPTS(size->length);
+                           PWG_FROM_POINTS(size->width) :
+                          PWG_FROM_POINTS(size->length);
       length_2540ths = (size->length > size->width) ?
-                           _PWG_FROMPTS(size->length) :
-                          _PWG_FROMPTS(size->width);
+                           PWG_FROM_POINTS(size->length) :
+                          PWG_FROM_POINTS(size->width);
       pwg_media      = _pwgMediaForSize(width_2540ths, length_2540ths);
 
       if (pwg_media &&
index 2cec84c34743a64f068e9c045dbfbb094934ec5a..66b5353782a28e925498b248750e239333b1915c 100644 (file)
@@ -49,7 +49,8 @@ TESTFILES     =       \
                        ipp-everywhere.test \
                        print-job.test \
                        print-job-deflate.test \
-                       print-job-gzip.test
+                       print-job-gzip.test \
+                       validate-job.test
 OBJS           =       \
                        ippserver.o \
                        ipptool.o \
index 99f3b5236abd07769c61f0e02e9d6e5b9d01f2b4..166336cd24768bb07af65c0646a054d6b0862baa 100644 (file)
@@ -2474,6 +2474,10 @@ do_tests(_cups_vars_t *vars,             /* I - Variables */
          else if (status != HTTP_OK)
          {
            httpFlush(http);
+
+           if (status == HTTP_STATUS_UNAUTHORIZED)
+             continue;
+
            break;
          }
        }
diff --git a/test/validate-job.test b/test/validate-job.test
new file mode 100644 (file)
index 0000000..c4140ea
--- /dev/null
@@ -0,0 +1,23 @@
+# Validate a test page using Validate-Job
+{
+       # The name of the test...
+       NAME "Validate file/ticket using Validate-Job"
+
+       # The operation to use
+       OPERATION Validate-Job
+
+       # Attributes, starting in the operation group...
+       GROUP operation-attributes-tag
+       ATTR charset attributes-charset utf-8
+       ATTR language attributes-natural-language en
+       ATTR uri printer-uri $uri
+       ATTR name requesting-user-name $user
+       ATTR mimeMediaType document-format $filetype
+
+       GROUP job-attributes-tag
+       ATTR integer copies 1
+
+       # What statuses are OK?
+       STATUS successful-ok
+       STATUS successful-ok-ignored-or-substituted-attributes
+}
index 4f8a2419bbb38ade2007f36ea3a24a500ea811a1..18990f2befddc451f1356c68392953ecd0e3ced3 100644 (file)
                                273BF6B81333B4A90022CAAB /* tests */,
                                72220EAF1333047D00FCA411 /* Products */,
                        );
+                       indentWidth = 2;
                        sourceTree = "<group>";
+                       tabWidth = 8;
+                       wrapsLines = 0;
                };
                72F75A681336FA42004BB496 /* libcupsimage */ = {
                        isa = PBXGroup;