summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2012-10-25 20:52:33 +0200
committerDidier Raboud <odyx@debian.org>2012-10-25 20:52:33 +0200
commit505bb5aeae558718c3acafc63797fc652368279f (patch)
tree1dd916f29a4bde76d9288508a1d13830e18e2ef1
parentb0950df0920600c7b76f0aada5fb2d7dfe01eb7b (diff)
downloadcups-505bb5aeae558718c3acafc63797fc652368279f.tar.gz
Imported Upstream version 1.4.5upstream/1.4.5
-rw-r--r--CHANGES.txt69
-rw-r--r--INSTALL.txt9
-rw-r--r--README.txt2
-rw-r--r--backend/runloop.c10
-rw-r--r--backend/serial.c6
-rw-r--r--backend/usb-darwin.c148
-rw-r--r--backend/usb-libusb.c13
-rw-r--r--cgi-bin/admin.c10
-rw-r--r--cgi-bin/ipp-var.c12
-rw-r--r--conf/cupsd.conf.in10
-rw-r--r--config-scripts/cups-common.m414
-rw-r--r--config-scripts/cups-ssl.m415
-rw-r--r--config.h.in31
-rwxr-xr-xconfigure917
-rw-r--r--configure.in6
-rw-r--r--cups/adminutil.c105
-rw-r--r--cups/api-filter.header4
-rw-r--r--cups/attr.c24
-rw-r--r--cups/auth.c6
-rw-r--r--cups/conflicts.c18
-rw-r--r--cups/cups.h8
-rw-r--r--cups/dest.c21
-rw-r--r--cups/emit.c44
-rw-r--r--cups/encode.c5
-rw-r--r--cups/file.c14
-rw-r--r--cups/globals.h5
-rw-r--r--cups/http-support.c24
-rw-r--r--cups/http.c18
-rw-r--r--cups/ipp.c14
-rw-r--r--cups/ipp.h7
-rw-r--r--cups/language.c18
-rw-r--r--cups/libcups.exp16
-rw-r--r--cups/localize.c20
-rw-r--r--cups/mark.c176
-rw-r--r--cups/options.c16
-rw-r--r--cups/ppd-private.h16
-rw-r--r--cups/ppd.c34
-rw-r--r--cups/pwg-file.c86
-rw-r--r--cups/pwg-media.c219
-rw-r--r--cups/pwg-ppd.c489
-rw-r--r--cups/pwg-private.h28
-rw-r--r--cups/raster.h62
-rw-r--r--cups/request.c8
-rw-r--r--cups/string.c7
-rw-r--r--cups/string.h60
-rw-r--r--cups/test.ppd12
-rw-r--r--cups/testpwg.c245
-rw-r--r--doc/Makefile4
-rw-r--r--doc/help/api-filter.html6
-rw-r--r--doc/help/api-httpipp.html6
-rw-r--r--doc/help/api-raster.html91
-rw-r--r--doc/help/ref-cupsd-conf.html.in12
-rw-r--r--doc/help/spec-ppd.html90
-rw-r--r--doc/images/generic.pngbin0 -> 16913 bytes
-rw-r--r--filter/imagetoraster.c44
-rw-r--r--filter/pstops.c41
-rw-r--r--filter/raster.c30
-rw-r--r--init/cups.xml.in10
-rw-r--r--man/Makefile5
-rw-r--r--man/drv.man.in40
-rw-r--r--man/lp.man11
-rw-r--r--man/lpadmin.man53
-rw-r--r--notifier/mailto.c10
-rw-r--r--packaging/cups.list.in6
-rw-r--r--packaging/cups.spec10
-rw-r--r--packaging/cups.spec.in6
-rw-r--r--ppdc/ppdc-source.cxx20
-rw-r--r--scheduler/auth.c14
-rw-r--r--scheduler/classes.c13
-rw-r--r--scheduler/client.c319
-rw-r--r--scheduler/conf.c41
-rw-r--r--scheduler/cupsd.h8
-rw-r--r--scheduler/ipp.c81
-rw-r--r--scheduler/job.c221
-rw-r--r--scheduler/main.c21
-rw-r--r--scheduler/printers.c249
-rw-r--r--systemv/cupsaddsmb.c7
-rw-r--r--systemv/lpadmin.c759
-rw-r--r--systemv/lppasswd.c8
-rw-r--r--systemv/lpstat.c31
-rw-r--r--templates/de/add-class.tmpl2
-rw-r--r--templates/de/add-rss-subscription.tmpl2
-rw-r--r--templates/de/search.tmpl2
-rw-r--r--templates/it/jobs-header.tmpl4
-rw-r--r--templates/ja/option-pickone.tmpl2
-rw-r--r--templates/pl/set-printer-options-header.tmpl2
-rwxr-xr-xtest/run-stp-tests.sh6
-rw-r--r--vcnet/config.h5
88 files changed, 3813 insertions, 1580 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 0e537d9f..4170e43e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,73 @@
-CHANGES.txt - 2010-06-17
+CHANGES.txt - 2010-11-11
------------------------
+CHANGES IN CUPS V1.4.5
+
+ - Documentation fixes (STR #3542, STR #3650)
+ - Localization fixes (STR #3635, STR #3636, STR #3647, STR #3666)
+ - Security: Fixed a memory corruption bug reported in CVE-2010-2941
+ (STR #3648)
+ - The CUPS API incorrectly mapped the HTTP_UNAUTHORIZED status to the
+ IPP_NOT_AUTHORIZED status code, when IPP_NOT_AUTHENTICATED would be
+ the correct mapping (STR #3684)
+ - The scheduler would restart jobs while shutting down (STR #3679)
+ - Fixed a PPD loader bug that could cause a crash in cupsd (STR #3680)
+ - Improved the mapping of non-standard PPD and PWG names (STR #3671)
+ - The scheduler did not initialize Kerberos in all cases (STR #3662)
+ - cupsAdminSetServerSettings duplicated Listen and Order lines
+ (STR #3645)
+ - Added DeviceN colorspace support to the CUPS Raster format (STR #3419)
+ - ppdMarkDefaults() did not clear the marked field of the previous
+ choices (STR #3642)
+ - The serial backend would not allow a raw job to be canceled
+ (STR #3649)
+ - The socket backend could go into an infinite loop with certain
+ printers (STR #3622)
+ - Setting the PRINTER or LPDEST environment variables to "name/instance"
+ did not work (STR #3485)
+ - The scheduler did not handle the JobRetryLimit setting properly
+ (STR #3466)
+ - The lpstat command always showed a remote job ID of 0 for shared
+ printers (STR #3627)
+ - Increased the write timeout for the libusb-based USB backend to 5
+ minutes (STR #3595)
+ - The libusb-base USB backend did not check whether the printer has a
+ serial number (STR #3590)
+ - The lpadmin command did not support setting of custom option values
+ (STR #3631)
+ - The lpadmin command did not support setting of the location or
+ description of a class (STR #3613)
+ - The cupsaddsmb command did not give up after too many failed attempts
+ (STR #3615)
+ - The CUPS library no longer uses certain problematic ctype macros that
+ change based on the locale's character set.
+ - PJL value substitution of more than 9 values was broken (STR #3621)
+ - Custom options with missing string values caused ppdEmit* to segfault
+ (STR #3620)
+ - Fixed an issue with the Italian version of the web interface
+ (STR #3624)
+ - Fixed the Solaris SMF configuration file for cups-lpd (STR #3611)
+ - The scheduler did not set the notify-subscribed-event attribute when
+ delivering printer-added or printer-modified events (STR #3608)
+ - The mailto notifier could get into an infinite loop (STR #3609)
+ - Date/time information was not shown in banner pages.
+ - Relational operators were broken in #if/#elif/#else/#endif expressions
+ for the PPD compiler.
+ - Moving a job via the web interface failed without asking for
+ authentication (STR #3559)
+ - The scheduler now clears the printer-state-reasons when the driver is
+ changed (STR #3570)
+ - The web interface did not allow a user to change the driver
+ (STR #3537, STR #3601)
+ - The scheduler was not setting the PATH_INFO environment variable when
+ needed (STR #3600)
+ - The scheduler incorrectly set the CUPSD_AUTH_TYPE environment
+ variable instead of AUTH_TYPE (STR #3599)
+ - Fixed a buffer overrun in the PPD compiler (STR #3594)
+ - Fixed some additional IPP job template attribute mapping issues in the
+ scheduler.
+
+
CHANGES IN CUPS V1.4.4
- Documentation updates (STR #3453, STR #3527, STR #3528, STR #3529)
diff --git a/INSTALL.txt b/INSTALL.txt
index 071fee1b..01842f98 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -1,14 +1,13 @@
-INSTALL - CUPS v1.4.4 - 2010-06-17
+INSTALL - CUPS v1.4.5 - 2010-11-11
----------------------------------
This file describes how to compile and install CUPS from source code. For more
information on CUPS see the file called "README.txt". A complete change log can
be found in "CHANGES.txt".
-**** IF YOU HAVE A NON-POSTSCRIPT PRINTER AND ARE NOT ****
-**** RUNNING MAC OS X, YOU WILL ALSO NEED TO INSTALL GPL ****
-**** GHOSTSCRIPT WITH THE "cups" DRIVER AFTER YOU INSTALL ****
-**** CUPS. ****
+**** IF YOU HAVE A NON-POSTSCRIPT PRINTER AND ARE NOT RUNNING MAC OS X, ****
+**** YOU WILL ALSO NEED TO INSTALL GPL GHOSTSCRIPT WITH THE "cups" DRIVER ****
+**** AFTER YOU INSTALL CUPS. ****
BEFORE YOU BEGIN
diff --git a/README.txt b/README.txt
index 85491e55..2bdd8aa1 100644
--- a/README.txt
+++ b/README.txt
@@ -1,4 +1,4 @@
-README - CUPS v1.4.4 - 2010-06-17
+README - CUPS v1.4.4 - 2010-11-11
---------------------------------
Looking for compile instructions? Read the file "INSTALL.txt"
diff --git a/backend/runloop.c b/backend/runloop.c
index 05f82b2f..6cc1b7be 100644
--- a/backend/runloop.c
+++ b/backend/runloop.c
@@ -1,9 +1,9 @@
/*
- * "$Id: runloop.c 8896 2009-11-20 01:27:57Z mike $"
+ * "$Id: runloop.c 9258 2010-08-13 01:34:04Z mike $"
*
- * Common run loop APIs for the Common UNIX Printing System (CUPS).
+ * Common run loop APIs for CUPS.
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2010 by Apple Inc.
* Copyright 2006-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -299,6 +299,8 @@ backendRunLoop(
strerror(errno));
use_bc = 0;
}
+ else if (bc_bytes == 0)
+ use_bc = 0;
}
/*
@@ -420,5 +422,5 @@ backendRunLoop(
/*
- * End of "$Id: runloop.c 8896 2009-11-20 01:27:57Z mike $".
+ * End of "$Id: runloop.c 9258 2010-08-13 01:34:04Z mike $".
*/
diff --git a/backend/serial.c b/backend/serial.c
index 4feb8b78..73ad9a0b 100644
--- a/backend/serial.c
+++ b/backend/serial.c
@@ -1,5 +1,5 @@
/*
- * "$Id: serial.c 8807 2009-08-31 18:45:43Z mike $"
+ * "$Id: serial.c 9282 2010-08-31 15:56:40Z mike $"
*
* Serial port backend for the Common UNIX Printing System (CUPS).
*
@@ -502,7 +502,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
* stdin (otherwise you can't cancel raw jobs...)
*/
- if (print_fd != 0)
+ if (!print_fd)
{
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGTERM, SIG_IGN);
@@ -1326,5 +1326,5 @@ side_cb(int print_fd, /* I - Print file */
/*
- * End of "$Id: serial.c 8807 2009-08-31 18:45:43Z mike $".
+ * End of "$Id: serial.c 9282 2010-08-31 15:56:40Z mike $".
*/
diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c
index 085089fb..a9484c76 100644
--- a/backend/usb-darwin.c
+++ b/backend/usb-darwin.c
@@ -1,7 +1,7 @@
/*
-* "$Id: usb-darwin.c 9157 2010-06-16 05:27:41Z mike $"
+* "$Id: usb-darwin.c 9319 2010-09-28 19:10:26Z mike $"
*
-* Copyright 2005-2009 Apple Inc. All rights reserved.
+* Copyright 2005-2010 Apple Inc. All rights reserved.
*
* IMPORTANT: This Apple software is supplied to you by Apple Computer,
* Inc. ("Apple") in consideration of your agreement to the following
@@ -112,6 +112,12 @@ extern char **environ;
#define DEBUG_WRITES 0
+/*
+ * WAIT_EOF_DELAY is number of seconds we'll wait for responses from
+ * the printer after we've finished sending all the data
+ */
+#define WAIT_EOF_DELAY 7
+#define WAIT_SIDE_DELAY 3
#define DEFAULT_TIMEOUT 5000L
#define USB_INTERFACE_KIND CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID190)
@@ -241,6 +247,11 @@ typedef struct globals_s
Boolean wait_eof;
int drain_output; /* Drain all pending output */
int bidi_flag; /* 0=unidirectional, 1=bidirectional */
+
+ pthread_mutex_t sidechannel_thread_mutex;
+ pthread_cond_t sidechannel_thread_cond;
+ int sidechannel_thread_stop;
+ int sidechannel_thread_done;
} globals_t;
@@ -281,8 +292,8 @@ static void status_timer_cb(CFRunLoopTimerRef timer, void *info);
#if defined(__i386__) || defined(__x86_64__)
static pid_t child_pid; /* Child PID */
static void run_legacy_backend(int argc, char *argv[], int fd); /* Starts child backend process running as a ppc executable */
-static void sigterm_handler(int sig); /* SIGTERM handler */
#endif /* __i386__ || __x86_64__ */
+static void sigterm_handler(int sig); /* SIGTERM handler */
#ifdef PARSE_PS_ERRORS
static const char *next_line (const char *buffer);
@@ -333,6 +344,7 @@ print_device(const char *uri, /* I - Device URI */
UInt32 bytes; /* Bytes written */
struct timeval *timeout, /* Timeout pointer */
stimeout; /* Timeout for select() */
+ struct timespec cond_timeout; /* pthread condition timeout */
/*
@@ -476,6 +488,12 @@ print_device(const char *uri, /* I - Device URI */
if (have_sidechannel)
{
+ g.sidechannel_thread_stop = 0;
+ g.sidechannel_thread_done = 0;
+
+ pthread_cond_init(&g.sidechannel_thread_cond, NULL);
+ pthread_mutex_init(&g.sidechannel_thread_mutex, NULL);
+
if (pthread_create(&sidechannel_thread_id, NULL, sidechannel_thread, NULL))
{
_cupsLangPuts(stderr, _("ERROR: Fatal USB error\n"));
@@ -732,6 +750,104 @@ print_device(const char *uri, /* I - Device URI */
fprintf(stderr, "DEBUG: Sent %lld bytes...\n", (off_t)total_bytes);
+ if (!print_fd)
+ {
+ /*
+ * Re-enable the SIGTERM handler so pthread_kill() will work...
+ */
+
+ struct sigaction action; /* POSIX signal action */
+
+ memset(&action, 0, sizeof(action));
+
+ sigemptyset(&action.sa_mask);
+ sigaddset(&action.sa_mask, SIGTERM);
+ action.sa_handler = sigterm_handler;
+ sigaction(SIGTERM, &action, NULL);
+ }
+
+ /*
+ * Wait for the side channel thread to exit...
+ */
+
+ if (have_sidechannel)
+ {
+ close(CUPS_SC_FD);
+ pthread_mutex_lock(&g.readwrite_lock_mutex);
+ g.readwrite_lock = 0;
+ pthread_cond_signal(&g.readwrite_lock_cond);
+ pthread_mutex_unlock(&g.readwrite_lock_mutex);
+
+ g.sidechannel_thread_stop = 1;
+ pthread_mutex_lock(&g.sidechannel_thread_mutex);
+ if (!g.sidechannel_thread_done)
+ {
+ /*
+ * Wait for the side-channel thread to exit...
+ */
+
+ cond_timeout.tv_sec = time(NULL) + WAIT_SIDE_DELAY;
+ cond_timeout.tv_nsec = 0;
+ if (pthread_cond_timedwait(&g.sidechannel_thread_cond,
+ &g.sidechannel_thread_mutex,
+ &cond_timeout) != 0)
+ {
+ /*
+ * Force the side-channel thread to exit...
+ */
+
+ fputs("DEBUG: Force the side-channel thread to exit...\n", stderr);
+ pthread_kill(sidechannel_thread_id, SIGTERM);
+ }
+ }
+ pthread_mutex_unlock(&g.sidechannel_thread_mutex);
+
+ pthread_join(sidechannel_thread_id, NULL);
+
+ pthread_cond_destroy(&g.sidechannel_thread_cond);
+ pthread_mutex_destroy(&g.sidechannel_thread_mutex);
+ }
+
+ pthread_cond_destroy(&g.readwrite_lock_cond);
+ pthread_mutex_destroy(&g.readwrite_lock_mutex);
+
+ /*
+ * Signal the read thread to stop...
+ */
+
+ g.read_thread_stop = 1;
+
+ /*
+ * Give the read thread WAIT_EOF_DELAY seconds to complete all the data. If
+ * we are not signaled in that time then force the thread to exit.
+ */
+
+ pthread_mutex_lock(&g.read_thread_mutex);
+
+ if (!g.read_thread_done)
+ {
+ cond_timeout.tv_sec = time(NULL) + WAIT_EOF_DELAY;
+ cond_timeout.tv_nsec = 0;
+
+ if (pthread_cond_timedwait(&g.read_thread_cond, &g.read_thread_mutex,
+ &cond_timeout) != 0)
+ {
+ /*
+ * Force the read thread to exit...
+ */
+
+ g.wait_eof = 0;
+ fputs("DEBUG: Force the read thread to exit...\n", stderr);
+ pthread_kill(read_thread_id, SIGTERM);
+ }
+ }
+ pthread_mutex_unlock(&g.read_thread_mutex);
+
+ pthread_join(read_thread_id, NULL); /* wait for the read thread to return */
+
+ pthread_cond_destroy(&g.read_thread_cond);
+ pthread_mutex_destroy(&g.read_thread_mutex);
+
/*
* Close the connection and input file and general clean up...
*/
@@ -940,7 +1056,12 @@ sidechannel_thread(void *reference)
break;
}
}
- while (1);
+ while (!g.sidechannel_thread_stop);
+
+ pthread_mutex_lock(&g.sidechannel_thread_mutex);
+ g.sidechannel_thread_done = 1;
+ pthread_cond_signal(&g.sidechannel_thread_cond);
+ pthread_mutex_unlock(&g.sidechannel_thread_mutex);
return NULL;
}
@@ -1276,7 +1397,10 @@ static kern_return_t load_classdriver(CFStringRef driverPath,
{
fprintf(stderr, "DEBUG: Unable to load class driver \"%s\": %s\n",
bundlestr, strerror(errno));
- return (kr);
+ if (errno == ENOENT)
+ return (load_classdriver(NULL, intf, printerDriver));
+ else
+ return (kr);
}
else if (bundleinfo.st_mode & S_IWOTH)
{
@@ -1928,6 +2052,8 @@ static void run_legacy_backend(int argc,
exit(exitstatus);
}
+#endif /* __i386__ || __x86_64__ */
+
/*
* 'sigterm_handler()' - SIGTERM handler.
@@ -1936,8 +2062,11 @@ static void run_legacy_backend(int argc,
static void
sigterm_handler(int sig) /* I - Signal */
{
- /* If we started a child process pass the signal on to it...
- */
+#if defined(__i386__) || defined(__x86_64__)
+ /*
+ * If we started a child process pass the signal on to it...
+ */
+
if (child_pid)
{
/*
@@ -1959,9 +2088,8 @@ sigterm_handler(int sig) /* I - Signal */
exit(CUPS_BACKEND_STOP);
}
}
-}
-
#endif /* __i386__ || __x86_64__ */
+}
#ifdef PARSE_PS_ERRORS
@@ -2128,5 +2256,5 @@ static void get_device_id(cups_sc_status_t *status,
/*
- * End of "$Id: usb-darwin.c 9157 2010-06-16 05:27:41Z mike $".
+ * End of "$Id: usb-darwin.c 9319 2010-09-28 19:10:26Z mike $".
*/
diff --git a/backend/usb-libusb.c b/backend/usb-libusb.c
index 0c62a79a..2690845e 100644
--- a/backend/usb-libusb.c
+++ b/backend/usb-libusb.c
@@ -1,9 +1,9 @@
/*
- * "$Id: usb-libusb.c 8813 2009-09-11 20:03:31Z mike $"
+ * "$Id: usb-libusb.c 9258 2010-08-13 01:34:04Z mike $"
*
- * Libusb interface code for the Common UNIX Printing System (CUPS).
+ * Libusb interface code for CUPS.
*
- * Copyright 2007-2009 by Apple Inc.
+ * Copyright 2007-2010 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -172,7 +172,7 @@ print_device(const char *uri, /* I - Device URI */
if ((bytes = read(print_fd, buffer, sizeof(buffer))) > 0)
{
if (usb_bulk_write(printer->handle, printer->write_endp, buffer,
- bytes, 45000) < 0)
+ bytes, 3600000) < 0)
{
_cupsLangPrintf(stderr,
_("ERROR: Unable to write %d bytes to printer!\n"),
@@ -518,7 +518,8 @@ make_device_uri(
if ((sern = cupsGetOption("SERIALNUMBER", num_values, values)) == NULL)
if ((sern = cupsGetOption("SERN", num_values, values)) == NULL)
- if ((sern = cupsGetOption("SN", num_values, values)) == NULL)
+ if ((sern = cupsGetOption("SN", num_values, values)) == NULL &&
+ printer->device->descriptor.iSerialNumber)
{
/*
* Try getting the serial number from the device itself...
@@ -827,6 +828,6 @@ side_cb(usb_printer_t *printer, /* I - Printer */
/*
- * End of "$Id: usb-libusb.c 8813 2009-09-11 20:03:31Z mike $".
+ * End of "$Id: usb-libusb.c 9258 2010-08-13 01:34:04Z mike $".
*/
diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c
index 742b0cac..ff8885d7 100644
--- a/cgi-bin/admin.c
+++ b/cgi-bin/admin.c
@@ -1,5 +1,5 @@
/*
- * "$Id: admin.c 9133 2010-05-05 00:44:55Z mike $"
+ * "$Id: admin.c 9181 2010-06-22 21:42:44Z mike $"
*
* Administration CGI for the Common UNIX Printing System (CUPS).
*
@@ -951,8 +951,6 @@ do_am_printer(http_t *http, /* I - HTTP connection */
if (!cgiGetVariable("CURRENT_MAKE"))
cgiSetVariable("CURRENT_MAKE", make);
- cgiSetVariable("PPD_MAKE", make);
-
if (!cgiGetVariable("CURRENT_MAKE_AND_MODEL"))
cgiSetVariable("CURRENT_MAKE_AND_MODEL", uriptr);
@@ -1218,8 +1216,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, "ipp://localhost/printers/");
- if ((var = cgiGetVariable("CURRENT_MAKE")) == NULL)
- var = cgiGetVariable("PPD_MAKE");
+ if ((var = cgiGetVariable("PPD_MAKE")) == NULL)
+ var = cgiGetVariable("CURRENT_MAKE");
if (var && !cgiGetVariable("SELECT_MAKE"))
{
const char *make_model; /* Make and model */
@@ -4297,5 +4295,5 @@ get_points(double number, /* I - Original number */
/*
- * End of "$Id: admin.c 9133 2010-05-05 00:44:55Z mike $".
+ * End of "$Id: admin.c 9181 2010-06-22 21:42:44Z mike $".
*/
diff --git a/cgi-bin/ipp-var.c b/cgi-bin/ipp-var.c
index 7abe3619..ccf31a73 100644
--- a/cgi-bin/ipp-var.c
+++ b/cgi-bin/ipp-var.c
@@ -1,5 +1,5 @@
/*
- * "$Id: ipp-var.c 8912 2009-12-08 02:13:42Z mike $"
+ * "$Id: ipp-var.c 9181 2010-06-22 21:42:44Z mike $"
*
* CGI <-> IPP variable routines for the Common UNIX Printing System (CUPS).
*
@@ -285,10 +285,14 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
/*
- * See who is logged in...
+ * Make sure we have a username...
*/
- user = getenv("REMOTE_USER");
+ if ((user = getenv("REMOTE_USER")) == NULL)
+ {
+ puts("Status: 401\n");
+ exit(0);
+ }
/*
* See if the user has already selected a new destination...
@@ -1584,5 +1588,5 @@ cgiText(const char *message) /* I - Message */
/*
- * End of "$Id: ipp-var.c 8912 2009-12-08 02:13:42Z mike $".
+ * End of "$Id: ipp-var.c 9181 2010-06-22 21:42:44Z mike $".
*/
diff --git a/conf/cupsd.conf.in b/conf/cupsd.conf.in
index afb15c7f..eb4065d4 100644
--- a/conf/cupsd.conf.in
+++ b/conf/cupsd.conf.in
@@ -1,5 +1,5 @@
#
-# "$Id: cupsd.conf.in 8805 2009-08-31 16:34:06Z mike $"
+# "$Id: cupsd.conf.in 9310 2010-09-21 22:34:57Z mike $"
#
# Sample configuration file for the CUPS scheduler. See "man cupsd.conf" for a
# complete description of this file.
@@ -46,6 +46,10 @@ DefaultAuthType Basic
# Set the default printer/job policies...
<Policy default>
# Job-related operations must be done by the owner or an administrator...
+ <Limit Create-Job Print-Job Print-URI Validate-Job>
+ Order deny,allow
+ </Limit>
+
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job CUPS-Get-Document>
Require user @OWNER @SYSTEM
Order deny,allow
@@ -79,7 +83,7 @@ DefaultAuthType Basic
# Set the authenticated printer/job policies...
<Policy authenticated>
# Job-related operations must be done by the owner or an administrator...
- <Limit Create-Job Print-Job Print-URI>
+ <Limit Create-Job Print-Job Print-URI Validate-Job>
AuthType Default
Order deny,allow
</Limit>
@@ -117,5 +121,5 @@ DefaultAuthType Basic
</Policy>
#
-# End of "$Id: cupsd.conf.in 8805 2009-08-31 16:34:06Z mike $".
+# End of "$Id: cupsd.conf.in 9310 2010-09-21 22:34:57Z mike $".
#
diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4
index 758e8c04..7bbfb906 100644
--- a/config-scripts/cups-common.m4
+++ b/config-scripts/cups-common.m4
@@ -1,5 +1,5 @@
dnl
-dnl "$Id: cups-common.m4 9160 2010-06-16 20:25:12Z mike $"
+dnl "$Id: cups-common.m4 9259 2010-08-13 04:11:46Z mike $"
dnl
dnl Common configuration stuff for CUPS.
dnl
@@ -20,7 +20,7 @@ dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Version number information...
-CUPS_VERSION=1.4.4
+CUPS_VERSION=1.4.5
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'`"
@@ -133,6 +133,13 @@ AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
+dnl Checks for statfs and its many headers...
+AC_CHECK_HEADER(sys/mount.h,AC_DEFINE(HAVE_SYS_MOUNT_H))
+AC_CHECK_HEADER(sys/statfs.h,AC_DEFINE(HAVE_SYS_STATFS_H))
+AC_CHECK_HEADER(sys/statvfs.h,AC_DEFINE(HAVE_SYS_STATVFS_H))
+AC_CHECK_HEADER(sys/vfs.h,AC_DEFINE(HAVE_SYS_VFS_H))
+AC_CHECK_FUNCS(statfs statvfs)
+
dnl Checks for string functions.
AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
@@ -300,6 +307,7 @@ case $uname in
LIBS="-framework SystemConfiguration -framework CoreFoundation -framework Security $LIBS"
dnl Check for framework headers...
+ AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h,AC_DEFINE(HAVE_APPLICATIONSERVICES_H))
AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
@@ -362,5 +370,5 @@ AC_SUBST(FONTS)
AC_SUBST(LEGACY_BACKENDS)
dnl
-dnl End of "$Id: cups-common.m4 9160 2010-06-16 20:25:12Z mike $".
+dnl End of "$Id: cups-common.m4 9259 2010-08-13 04:11:46Z mike $".
dnl
diff --git a/config-scripts/cups-ssl.m4 b/config-scripts/cups-ssl.m4
index fef9843d..efa9e80c 100644
--- a/config-scripts/cups-ssl.m4
+++ b/config-scripts/cups-ssl.m4
@@ -1,5 +1,5 @@
dnl
-dnl "$Id: cups-ssl.m4 9165 2010-06-17 18:20:39Z mike $"
+dnl "$Id: cups-ssl.m4 9203 2010-07-14 23:58:04Z mike $"
dnl
dnl OpenSSL/GNUTLS stuff for CUPS.
dnl
@@ -38,6 +38,8 @@ if test x$enable_ssl != xno; then
AC_DEFINE(HAVE_CDSASSL)
dnl Check for the various security headers...
+ AC_CHECK_HEADER(Security/SecItemPriv.h,
+ AC_DEFINE(HAVE_SECITEMPRIV_H))
AC_CHECK_HEADER(Security/SecPolicy.h,
AC_DEFINE(HAVE_SECPOLICY_H))
AC_CHECK_HEADER(Security/SecPolicyPriv.h,
@@ -54,6 +56,15 @@ if test x$enable_ssl != xno; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
+ fi
+
+ dnl Check for SecPolicyCreateSSL...
+ AC_MSG_CHECKING(for SecPolicyCreateSSL)
+ if test $uversion -ge 110; then
+ AC_DEFINE(HAVE_SECPOLICYCREATESSL)
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
fi])
fi
fi
@@ -143,5 +154,5 @@ AC_SUBST(EXPORT_SSLLIBS)
dnl
-dnl End of "$Id: cups-ssl.m4 9165 2010-06-17 18:20:39Z mike $".
+dnl End of "$Id: cups-ssl.m4 9203 2010-07-14 23:58:04Z mike $".
dnl
diff --git a/config.h.in b/config.h.in
index 9a840929..0526db1d 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,5 +1,5 @@
/*
- * "$Id: config.h.in 9160 2010-06-16 20:25:12Z mike $"
+ * "$Id: config.h.in 9259 2010-08-13 04:11:46Z mike $"
*
* Configuration file for CUPS.
*
@@ -289,6 +289,7 @@
*/
#undef HAVE_AUTHORIZATION_H
+#undef HAVE_SECITEMPRIV_H
#undef HAVE_SECPOLICY_H
#undef HAVE_SECPOLICYPRIV_H
#undef HAVE_SECBASEPRIV_H
@@ -303,6 +304,13 @@
/*
+ * Do we have the SecPolicyCreateSSL function?
+ */
+
+#undef HAVE_SECPOLICYCREATESSL
+
+
+/*
* Do we have the SLP library?
*/
@@ -489,6 +497,13 @@
/*
+ * Do we have ApplicationServices public headers?
+ */
+
+#undef HAVE_APPLICATIONSERVICES_H
+
+
+/*
* Do we have the SCDynamicStoreCopyComputerName function?
*/
@@ -639,8 +654,20 @@
#undef HAVE_TCPD_H
+/*
+ * Do we have statfs or statvfs and one of the corresponding headers?
+ */
+
+#undef HAVE_STATFS
+#undef HAVE_STATVFS
+#undef HAVE_SYS_MOUNT_H
+#undef HAVE_SYS_STATFS_H
+#undef HAVE_SYS_STATVFS_H
+#undef HAVE_SYS_VFS_H
+
+
#endif /* !_CUPS_CONFIG_H_ */
/*
- * End of "$Id: config.h.in 9160 2010-06-16 20:25:12Z mike $".
+ * End of "$Id: config.h.in 9259 2010-08-13 04:11:46Z mike $".
*/
diff --git a/configure b/configure
index b4936c0f..4f4defd8 100755
--- a/configure
+++ b/configure
@@ -1989,7 +1989,7 @@ esac
ac_config_headers="$ac_config_headers config.h"
-CUPS_VERSION=1.4.4
+CUPS_VERSION=1.4.5
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'`"
@@ -6466,6 +6466,634 @@ fi
+if test "${ac_cv_header_sys_mount_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for sys/mount.h" >&5
+echo $ECHO_N "checking for sys/mount.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_mount_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_mount_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_mount_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking sys/mount.h usability" >&5
+echo $ECHO_N "checking sys/mount.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <sys/mount.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking sys/mount.h presence" >&5
+echo $ECHO_N "checking sys/mount.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/mount.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: sys/mount.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/mount.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/mount.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sys/mount.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: sys/mount.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/mount.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/mount.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/mount.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/mount.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sys/mount.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/mount.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sys/mount.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/mount.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/mount.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/mount.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sys/mount.h: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for sys/mount.h" >&5
+echo $ECHO_N "checking for sys/mount.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_mount_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_sys_mount_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_mount_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_mount_h" >&6; }
+
+fi
+if test $ac_cv_header_sys_mount_h = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SYS_MOUNT_H 1
+_ACEOF
+
+fi
+
+
+if test "${ac_cv_header_sys_statfs_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for sys/statfs.h" >&5
+echo $ECHO_N "checking for sys/statfs.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_statfs_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_statfs_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_statfs_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking sys/statfs.h usability" >&5
+echo $ECHO_N "checking sys/statfs.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <sys/statfs.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking sys/statfs.h presence" >&5
+echo $ECHO_N "checking sys/statfs.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/statfs.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: sys/statfs.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/statfs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/statfs.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sys/statfs.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: sys/statfs.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/statfs.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/statfs.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/statfs.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/statfs.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sys/statfs.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/statfs.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sys/statfs.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/statfs.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/statfs.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/statfs.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sys/statfs.h: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for sys/statfs.h" >&5
+echo $ECHO_N "checking for sys/statfs.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_statfs_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_sys_statfs_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_statfs_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_statfs_h" >&6; }
+
+fi
+if test $ac_cv_header_sys_statfs_h = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SYS_STATFS_H 1
+_ACEOF
+
+fi
+
+
+if test "${ac_cv_header_sys_statvfs_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for sys/statvfs.h" >&5
+echo $ECHO_N "checking for sys/statvfs.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_statvfs_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_statvfs_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_statvfs_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking sys/statvfs.h usability" >&5
+echo $ECHO_N "checking sys/statvfs.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <sys/statvfs.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking sys/statvfs.h presence" >&5
+echo $ECHO_N "checking sys/statvfs.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/statvfs.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: sys/statvfs.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/statvfs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/statvfs.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sys/statvfs.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: sys/statvfs.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/statvfs.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/statvfs.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/statvfs.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/statvfs.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sys/statvfs.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/statvfs.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sys/statvfs.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/statvfs.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/statvfs.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/statvfs.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sys/statvfs.h: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for sys/statvfs.h" >&5
+echo $ECHO_N "checking for sys/statvfs.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_statvfs_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_sys_statvfs_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_statvfs_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_statvfs_h" >&6; }
+
+fi
+if test $ac_cv_header_sys_statvfs_h = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SYS_STATVFS_H 1
+_ACEOF
+
+fi
+
+
+if test "${ac_cv_header_sys_vfs_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for sys/vfs.h" >&5
+echo $ECHO_N "checking for sys/vfs.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_vfs_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_vfs_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_vfs_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking sys/vfs.h usability" >&5
+echo $ECHO_N "checking sys/vfs.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <sys/vfs.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking sys/vfs.h presence" >&5
+echo $ECHO_N "checking sys/vfs.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/vfs.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: sys/vfs.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/vfs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/vfs.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sys/vfs.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: sys/vfs.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/vfs.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/vfs.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/vfs.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/vfs.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sys/vfs.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/vfs.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sys/vfs.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/vfs.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/vfs.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/vfs.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sys/vfs.h: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for sys/vfs.h" >&5
+echo $ECHO_N "checking for sys/vfs.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_vfs_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_sys_vfs_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_vfs_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_vfs_h" >&6; }
+
+fi
+if test $ac_cv_header_sys_vfs_h = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SYS_VFS_H 1
+_ACEOF
+
+fi
+
+
+
+
+for ac_func in statfs statvfs
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
@@ -8153,7 +8781,140 @@ case $uname in
CUPSDLIBS="$CUPSDLIBS -sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration -weak_framework ApplicationServices"
LIBS="-framework SystemConfiguration -framework CoreFoundation -framework Security $LIBS"
- if test "${ac_cv_header_CoreFoundation_CoreFoundation_h+set}" = set; then
+ if test "${ac_cv_header_ApplicationServices_ApplicationServices_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for ApplicationServices/ApplicationServices.h" >&5
+echo $ECHO_N "checking for ApplicationServices/ApplicationServices.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_ApplicationServices_ApplicationServices_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_ApplicationServices_ApplicationServices_h" >&5
+echo "${ECHO_T}$ac_cv_header_ApplicationServices_ApplicationServices_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking ApplicationServices/ApplicationServices.h usability" >&5
+echo $ECHO_N "checking ApplicationServices/ApplicationServices.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <ApplicationServices/ApplicationServices.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking ApplicationServices/ApplicationServices.h presence" >&5
+echo $ECHO_N "checking ApplicationServices/ApplicationServices.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ApplicationServices/ApplicationServices.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: ApplicationServices/ApplicationServices.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ApplicationServices/ApplicationServices.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ApplicationServices/ApplicationServices.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ApplicationServices/ApplicationServices.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: ApplicationServices/ApplicationServices.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ApplicationServices/ApplicationServices.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ApplicationServices/ApplicationServices.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ApplicationServices/ApplicationServices.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ApplicationServices/ApplicationServices.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ApplicationServices/ApplicationServices.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ApplicationServices/ApplicationServices.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ApplicationServices/ApplicationServices.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ApplicationServices/ApplicationServices.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ApplicationServices/ApplicationServices.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: ApplicationServices/ApplicationServices.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ApplicationServices/ApplicationServices.h: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for ApplicationServices/ApplicationServices.h" >&5
+echo $ECHO_N "checking for ApplicationServices/ApplicationServices.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_ApplicationServices_ApplicationServices_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_ApplicationServices_ApplicationServices_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_ApplicationServices_ApplicationServices_h" >&5
+echo "${ECHO_T}$ac_cv_header_ApplicationServices_ApplicationServices_h" >&6; }
+
+fi
+if test $ac_cv_header_ApplicationServices_ApplicationServices_h = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_APPLICATIONSERVICES_H 1
+_ACEOF
+
+fi
+
+
+ if test "${ac_cv_header_CoreFoundation_CoreFoundation_h+set}" = set; then
{ echo "$as_me:$LINENO: checking for CoreFoundation/CoreFoundation.h" >&5
echo $ECHO_N "checking for CoreFoundation/CoreFoundation.h... $ECHO_C" >&6; }
if test "${ac_cv_header_CoreFoundation_CoreFoundation_h+set}" = set; then
@@ -16905,7 +17666,140 @@ _ACEOF
_ACEOF
- if test "${ac_cv_header_Security_SecPolicy_h+set}" = set; then
+ if test "${ac_cv_header_Security_SecItemPriv_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for Security/SecItemPriv.h" >&5
+echo $ECHO_N "checking for Security/SecItemPriv.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_Security_SecItemPriv_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_Security_SecItemPriv_h" >&5
+echo "${ECHO_T}$ac_cv_header_Security_SecItemPriv_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking Security/SecItemPriv.h usability" >&5
+echo $ECHO_N "checking Security/SecItemPriv.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <Security/SecItemPriv.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking Security/SecItemPriv.h presence" >&5
+echo $ECHO_N "checking Security/SecItemPriv.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <Security/SecItemPriv.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: Security/SecItemPriv.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: Security/SecItemPriv.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: Security/SecItemPriv.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: Security/SecItemPriv.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: Security/SecItemPriv.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: Security/SecItemPriv.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: Security/SecItemPriv.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: Security/SecItemPriv.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: Security/SecItemPriv.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: Security/SecItemPriv.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: Security/SecItemPriv.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: Security/SecItemPriv.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: Security/SecItemPriv.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: Security/SecItemPriv.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: Security/SecItemPriv.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: Security/SecItemPriv.h: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for Security/SecItemPriv.h" >&5
+echo $ECHO_N "checking for Security/SecItemPriv.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_Security_SecItemPriv_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_Security_SecItemPriv_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_Security_SecItemPriv_h" >&5
+echo "${ECHO_T}$ac_cv_header_Security_SecItemPriv_h" >&6; }
+
+fi
+if test $ac_cv_header_Security_SecItemPriv_h = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SECITEMPRIV_H 1
+_ACEOF
+
+fi
+
+
+ if test "${ac_cv_header_Security_SecPolicy_h+set}" = set; then
{ echo "$as_me:$LINENO: checking for Security/SecPolicy.h" >&5
echo $ECHO_N "checking for Security/SecPolicy.h... $ECHO_C" >&6; }
if test "${ac_cv_header_Security_SecPolicy_h+set}" = set; then
@@ -17451,6 +18345,20 @@ echo "${ECHO_T}yes" >&6; }
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
+
+ { echo "$as_me:$LINENO: checking for SecPolicyCreateSSL" >&5
+echo $ECHO_N "checking for SecPolicyCreateSSL... $ECHO_C" >&6; }
+ if test $uversion -ge 110; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SECPOLICYCREATESSL 1
+_ACEOF
+
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ fi
fi
@@ -21003,7 +21911,7 @@ fi
-ac_config_files="$ac_config_files Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf data/testprint desktop/cups.desktop doc/index.html doc/help/ref-cupsd-conf.html doc/help/standard.html init/org.cups.cups-lpd.plist init/cups.xml man/client.conf.man man/cups-deviced.man man/cups-driverd.man man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man man/cupsd.conf.man man/drv.man man/lpoptions.man templates/header.tmpl $LANGFILES"
+ac_config_files="$ac_config_files Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf data/testprint desktop/cups.desktop doc/index.html doc/help/ref-cupsd-conf.html doc/help/standard.html init/org.cups.cups-lpd.plist init/cups.xml man/client.conf.man man/cups-deviced.man man/cups-driverd.man man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man man/cupsd.conf.man man/lpoptions.man templates/header.tmpl $LANGFILES"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -21581,7 +22489,6 @@ do
"man/cupsaddsmb.man") CONFIG_FILES="$CONFIG_FILES man/cupsaddsmb.man" ;;
"man/cupsd.man") CONFIG_FILES="$CONFIG_FILES man/cupsd.man" ;;
"man/cupsd.conf.man") CONFIG_FILES="$CONFIG_FILES man/cupsd.conf.man" ;;
- "man/drv.man") CONFIG_FILES="$CONFIG_FILES man/drv.man" ;;
"man/lpoptions.man") CONFIG_FILES="$CONFIG_FILES man/lpoptions.man" ;;
"templates/header.tmpl") CONFIG_FILES="$CONFIG_FILES templates/header.tmpl" ;;
"$LANGFILES") CONFIG_FILES="$CONFIG_FILES $LANGFILES" ;;
diff --git a/configure.in b/configure.in
index 844ad5be..1766b5a2 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
dnl
-dnl "$Id: configure.in 9152 2010-06-16 00:39:16Z mike $"
+dnl "$Id: configure.in 9181 2010-06-22 21:42:44Z mike $"
dnl
dnl Configuration script for the Common UNIX Printing System (CUPS).
dnl
@@ -70,12 +70,12 @@ AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config
init/org.cups.cups-lpd.plist init/cups.xml
man/client.conf.man man/cups-deviced.man man/cups-driverd.man
man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man
- man/cupsd.conf.man man/drv.man man/lpoptions.man
+ man/cupsd.conf.man man/lpoptions.man
templates/header.tmpl
$LANGFILES)
chmod +x cups-config
dnl
-dnl End of "$Id: configure.in 9152 2010-06-16 00:39:16Z mike $".
+dnl End of "$Id: configure.in 9181 2010-06-22 21:42:44Z mike $".
dnl
diff --git a/cups/adminutil.c b/cups/adminutil.c
index d3ec6ebe..196b03a6 100644
--- a/cups/adminutil.c
+++ b/cups/adminutil.c
@@ -1,5 +1,5 @@
/*
- * "$Id: adminutil.c 9061 2010-03-30 22:07:33Z mike $"
+ * "$Id: adminutil.c 9282 2010-08-31 15:56:40Z mike $"
*
* Administration utility API definitions for the Common UNIX Printing
* System (CUPS).
@@ -243,7 +243,7 @@ cupsAdminCreateWindowsPPD(
}
else if (jcloption && !strncmp(line, "*OrderDependency:", 17))
{
- for (ptr = line + 17; *ptr && isspace(*ptr & 255); ptr ++);
+ for (ptr = line + 17; _cups_isspace(*ptr); ptr ++);
ptr = strchr(ptr, ' ');
@@ -1069,7 +1069,7 @@ cupsAdminGetServerSettings(
while (*value)
{
- for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
+ for (valptr = value; *valptr && !_cups_isspace(*valptr); valptr ++);
if (*valptr)
*valptr++ = '\0';
@@ -1080,7 +1080,7 @@ cupsAdminGetServerSettings(
break;
}
- for (value = valptr; isspace(*value & 255); value ++);
+ for (value = valptr; _cups_isspace(*value); value ++);
}
}
else if (!strcasecmp(line, "</Limit>"))
@@ -1463,7 +1463,7 @@ cupsAdminSetServerSettings(
while (cupsFileGetConf(cupsd, line, sizeof(line), &value, &linenum))
{
if ((!strcasecmp(line, "Port") || !strcasecmp(line, "Listen")) &&
- (remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
+ (remote_admin >= 0 || remote_any >= 0 || share_printers >= 0))
{
if (!wrote_port_listen)
{
@@ -1707,83 +1707,86 @@ cupsAdminSetServerSettings(
cupsFilePuts(temp, "</Location>\n");
}
- else if (!strcasecmp(line, "<Limit") && in_default_policy)
+ else if (!strcasecmp(line, "<Limit"))
{
- /*
- * See if the policy limit is for the Cancel-Job operation...
- */
-
- char *valptr; /* Pointer into value */
-
-
- indent += 2;
-
- if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
+ if (in_default_policy)
{
/*
- * Don't write anything for this limit section...
+ * See if the policy limit is for the Cancel-Job operation...
*/
-
- in_cancel_job = 2;
- }
- else
- {
- cupsFilePrintf(temp, " %s", line);
-
- while (*value)
+
+ char *valptr; /* Pointer into value */
+
+
+ if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
{
- for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
-
- if (*valptr)
- *valptr++ = '\0';
-
- if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
+ /*
+ * Don't write anything for this limit section...
+ */
+
+ in_cancel_job = 2;
+ }
+ else
+ {
+ cupsFilePrintf(temp, "%*s%s", indent, "", line);
+
+ while (*value)
{
- /*
- * Write everything except for this definition...
- */
-
- in_cancel_job = 1;
+ for (valptr = value; *valptr && !_cups_isspace(*valptr); valptr ++);
+
+ if (*valptr)
+ *valptr++ = '\0';
+
+ if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
+ {
+ /*
+ * Write everything except for this definition...
+ */
+
+ in_cancel_job = 1;
+ }
+ else
+ cupsFilePrintf(temp, " %s", value);
+
+ for (value = valptr; _cups_isspace(*value); value ++);
}
- else
- cupsFilePrintf(temp, " %s", value);
-
- for (value = valptr; isspace(*value & 255); value ++);
+
+ cupsFilePuts(temp, ">\n");
}
-
- cupsFilePuts(temp, ">\n");
}
+ else
+ cupsFilePrintf(temp, "%*s%s %s>\n", indent, "", line, value);
+
+ indent += 2;
}
else if (!strcasecmp(line, "</Limit>") && in_cancel_job)
{
indent -= 2;
if (in_cancel_job == 1)
- cupsFilePuts(temp, " </Limit>\n");
+ cupsFilePuts(temp, " </Limit>\n");
wrote_policy = 1;
if (!user_cancel_any)
cupsFilePuts(temp, " # Only the owner or an administrator can cancel "
- "a job...\n"
- " <Limit Cancel-Job>\n"
- " Order deny,allow\n"
- " Require user @OWNER "
+ "a job...\n"
+ " <Limit Cancel-Job>\n"
+ " Order deny,allow\n"
+ " Require user @OWNER "
CUPS_DEFAULT_PRINTOPERATOR_AUTH "\n"
" </Limit>\n");
in_cancel_job = 0;
}
else if ((((in_admin_location || in_conf_location || in_root_location) &&
- remote_admin >= 0) ||
+ (remote_admin >= 0 || remote_any >= 0)) ||
(in_root_location && share_printers >= 0)) &&
(!strcasecmp(line, "Allow") || !strcasecmp(line, "Deny") ||
!strcasecmp(line, "Order")))
continue;
else if (in_cancel_job == 2)
continue;
- else if (!strcasecmp(line, "<Limit") && value)
- cupsFilePrintf(temp, " %s %s>\n", line, value);
else if (line[0] == '<')
{
if (value)
@@ -2427,5 +2430,5 @@ write_option(cups_file_t *dstfp, /* I - PPD file */
/*
- * End of "$Id: adminutil.c 9061 2010-03-30 22:07:33Z mike $".
+ * End of "$Id: adminutil.c 9282 2010-08-31 15:56:40Z mike $".
*/
diff --git a/cups/api-filter.header b/cups/api-filter.header
index 4e55505d..1b1d1e10 100644
--- a/cups/api-filter.header
+++ b/cups/api-filter.header
@@ -1,5 +1,5 @@
<!--
- "$Id: api-filter.header 8673 2009-05-22 17:34:15Z mike $"
+ "$Id: api-filter.header 9272 2010-08-27 16:51:43Z mike $"
Filter and backend programming header for the Common UNIX Printing System
(CUPS).
@@ -36,7 +36,7 @@
Programming: <a href='api-raster.html' target='_top'>Raster API</a><br>
Programming: <a href='postscript-driver.html' target='_top'>Developing PostScript Printer Drivers</a><br>
Programming: <a href='raster-driver.html' target='_top'>Developing Raster Printer Drivers</a><br>
- Specifications: <a href='spec-design' target='_top'>CUPS Design Description</a></td>
+ Specifications: <a href='spec-design.html' target='_top'>CUPS Design Description</a></td>
</tr>
</tbody>
</table></div>
diff --git a/cups/attr.c b/cups/attr.c
index bbfb394a..6f2b5249 100644
--- a/cups/attr.c
+++ b/cups/attr.c
@@ -1,10 +1,10 @@
/*
- * "$Id: attr.c 8532 2009-04-20 21:37:14Z mike $"
+ * "$Id: attr.c 9233 2010-08-10 06:15:55Z mike $"
*
* PPD model-specific attribute routines for the Common UNIX Printing System
* (CUPS).
*
- * Copyright 2007-2009 by Apple Inc.
+ * Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -15,8 +15,10 @@
*
* Contents:
*
- * ppdFindAttr() - Find the first matching attribute.
- * ppdFindNextAttr() - Find the next matching attribute.
+ * ppdFindAttr() - Find the first matching attribute.
+ * ppdFindNextAttr() - Find the next matching attribute.
+ * _ppdGet1284Values() - Get 1284 device ID keys and values.
+ * _ppdNormalizeMakeAndModel() - Normalize a product/make-and-model string.
*/
/*
@@ -178,7 +180,7 @@ _ppdGet1284Values(
num_values = 0;
while (*device_id)
{
- while (isspace(*device_id & 255))
+ while (_cups_isspace(*device_id))
device_id ++;
if (!*device_id)
@@ -191,13 +193,13 @@ _ppdGet1284Values(
if (!*device_id)
break;
- while (ptr > key && isspace(ptr[-1] & 255))
+ while (ptr > key && _cups_isspace(ptr[-1]))
ptr --;
*ptr = '\0';
device_id ++;
- while (isspace(*device_id & 255))
+ while (_cups_isspace(*device_id))
device_id ++;
if (!*device_id)
@@ -210,7 +212,7 @@ _ppdGet1284Values(
if (!*device_id)
break;
- while (ptr > value && isspace(ptr[-1] & 255))
+ while (ptr > value && _cups_isspace(ptr[-1]))
ptr --;
*ptr = '\0';
@@ -251,7 +253,7 @@ _ppdNormalizeMakeAndModel(
* Skip leading whitespace...
*/
- while (isspace(*make_and_model & 255))
+ while (_cups_isspace(*make_and_model))
make_and_model ++;
/*
@@ -406,7 +408,7 @@ _ppdNormalizeMakeAndModel(
*/
for (bufptr = buffer + strlen(buffer) - 1;
- bufptr >= buffer && isspace(*bufptr & 255);
+ bufptr >= buffer && _cups_isspace(*bufptr);
bufptr --);
bufptr[1] = '\0';
@@ -416,5 +418,5 @@ _ppdNormalizeMakeAndModel(
/*
- * End of "$Id: attr.c 8532 2009-04-20 21:37:14Z mike $".
+ * End of "$Id: attr.c 9233 2010-08-10 06:15:55Z mike $".
*/
diff --git a/cups/auth.c b/cups/auth.c
index de4dc620..eea2535b 100644
--- a/cups/auth.c
+++ b/cups/auth.c
@@ -1,5 +1,5 @@
/*
- * "$Id: auth.c 9061 2010-03-30 22:07:33Z mike $"
+ * "$Id: auth.c 9233 2010-08-10 06:15:55Z mike $"
*
* Authentication functions for the Common UNIX Printing System (CUPS).
*
@@ -251,7 +251,7 @@ cupsDoAuthentication(
authorization = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
authorization += 9;
- while (*authorization && isspace(*authorization & 255))
+ while (*authorization && _cups_isspace(*authorization))
authorization ++;
if (*authorization)
@@ -720,5 +720,5 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
/*
- * End of "$Id: auth.c 9061 2010-03-30 22:07:33Z mike $".
+ * End of "$Id: auth.c 9233 2010-08-10 06:15:55Z mike $".
*/
diff --git a/cups/conflicts.c b/cups/conflicts.c
index 84bdf751..d2cf5adf 100644
--- a/cups/conflicts.c
+++ b/cups/conflicts.c
@@ -1,5 +1,5 @@
/*
- * "$Id: conflicts.c 8912 2009-12-08 02:13:42Z mike $"
+ * "$Id: conflicts.c 9233 2010-08-10 06:15:55Z mike $"
*
* Option marking routines for the Common UNIX Printing System (CUPS).
*
@@ -290,25 +290,25 @@ cupsResolveConflicts(
for (resval = resolver->value; *resval && !changed;)
{
- while (isspace(*resval & 255))
+ while (_cups_isspace(*resval))
resval ++;
if (*resval != '*')
break;
for (resval ++, resptr = resoption;
- *resval && !isspace(*resval & 255);
+ *resval && !_cups_isspace(*resval);
resval ++)
if (resptr < (resoption + sizeof(resoption) - 1))
*resptr++ = *resval;
*resptr = '\0';
- while (isspace(*resval & 255))
+ while (_cups_isspace(*resval))
resval ++;
for (resptr = reschoice;
- *resval && !isspace(*resval & 255);
+ *resval && !_cups_isspace(*resval);
resval ++)
if (resptr < (reschoice + sizeof(reschoice) - 1))
*resptr++ = *resval;
@@ -887,20 +887,20 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
* Extract "*Option Choice" or just "*Option"...
*/
- for (vptr ++, ptr = option; *vptr && !isspace(*vptr & 255); vptr ++)
+ for (vptr ++, ptr = option; *vptr && !_cups_isspace(*vptr); vptr ++)
if (ptr < (option + sizeof(option) - 1))
*ptr++ = *vptr;
*ptr = '\0';
- while (isspace(*vptr & 255))
+ while (_cups_isspace(*vptr))
vptr ++;
if (*vptr == '*')
choice[0] = '\0';
else
{
- for (ptr = choice; *vptr && !isspace(*vptr & 255); vptr ++)
+ for (ptr = choice; *vptr && !_cups_isspace(*vptr); vptr ++)
if (ptr < (choice + sizeof(choice) - 1))
*ptr++ = *vptr;
@@ -1143,5 +1143,5 @@ ppd_test_constraints(
/*
- * End of "$Id: conflicts.c 8912 2009-12-08 02:13:42Z mike $".
+ * End of "$Id: conflicts.c 9233 2010-08-10 06:15:55Z mike $".
*/
diff --git a/cups/cups.h b/cups/cups.h
index 3ad8c5ee..20a8d8b2 100644
--- a/cups/cups.h
+++ b/cups/cups.h
@@ -1,5 +1,5 @@
/*
- * "$Id: cups.h 9120 2010-04-23 18:56:34Z mike $"
+ * "$Id: cups.h 9171 2010-06-22 03:18:27Z mike $"
*
* API definitions for CUPS.
*
@@ -61,10 +61,10 @@ extern "C" {
* Constants...
*/
-# define CUPS_VERSION 1.0404
+# define CUPS_VERSION 1.0405
# define CUPS_VERSION_MAJOR 1
# define CUPS_VERSION_MINOR 4
-# define CUPS_VERSION_PATCH 4
+# define CUPS_VERSION_PATCH 5
# define CUPS_BC_FD 3 /* Back-channel file descriptor for select/poll */
# define CUPS_DATE_ANY (time_t)-1
@@ -336,5 +336,5 @@ extern http_status_t cupsWriteRequestData(http_t *http, const char *buffer,
#endif /* !_CUPS_CUPS_H_ */
/*
- * End of "$Id: cups.h 9120 2010-04-23 18:56:34Z mike $".
+ * End of "$Id: cups.h 9171 2010-06-22 03:18:27Z mike $".
*/
diff --git a/cups/dest.c b/cups/dest.c
index a0d48971..a9288379 100644
--- a/cups/dest.c
+++ b/cups/dest.c
@@ -1,5 +1,5 @@
/*
- * "$Id: dest.c 9061 2010-03-30 22:07:33Z mike $"
+ * "$Id: dest.c 9258 2010-08-13 01:34:04Z mike $"
*
* User-defined destination (and option) support for the Common UNIX
* Printing System (CUPS).
@@ -509,7 +509,19 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
set_as_default = 1;
name = _cupsUserDefault(defname, sizeof(defname));
- if (!name && home)
+ if (name)
+ {
+ char *ptr; /* Temporary pointer... */
+
+ if ((ptr = strchr(defname, '/')) != NULL)
+ {
+ *ptr++ = '\0';
+ instance = ptr;
+ }
+ else
+ instance = NULL;
+ }
+ else if (home)
{
/*
* No default in the environment, try the user's lpoptions files...
@@ -1234,7 +1246,8 @@ appleSetDefault(const char *name) /* I - Default printer/class name */
CFArrayRemoveValueAtIndex(newlocations, locindex);
}
else
- newlocations = CFArrayCreateMutable(kCFAllocatorDefault, 0, NULL);
+ newlocations = CFArrayCreateMutable(kCFAllocatorDefault, 0,
+ &kCFTypeArrayCallBacks);
newlocation = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
&kCFTypeDictionaryKeyCallBacks,
@@ -2060,5 +2073,5 @@ cups_make_string(
/*
- * End of "$Id: dest.c 9061 2010-03-30 22:07:33Z mike $".
+ * End of "$Id: dest.c 9258 2010-08-13 01:34:04Z mike $".
*/
diff --git a/cups/emit.c b/cups/emit.c
index e8f18813..79d41312 100644
--- a/cups/emit.c
+++ b/cups/emit.c
@@ -1,5 +1,5 @@
/*
- * "$Id: emit.c 8938 2009-12-18 23:52:01Z mike $"
+ * "$Id: emit.c 9233 2010-08-10 06:15:55Z mike $"
*
* PPD code emission routines for the Common UNIX Printing System (CUPS).
*
@@ -484,7 +484,8 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
*/
for (title += 7; *title && isdigit(*title & 255); title ++);
- for (; *title && isspace(*title & 255); title ++);
+ while (_cups_isspace(*title))
+ title ++;
if ((ptr = strstr(title, " - ")) != NULL)
{
@@ -683,7 +684,8 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
case PPD_CUSTOM_PASSCODE :
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
- bufsize += strlen(cparam->current.custom_string);
+ if (cparam->current.custom_string)
+ bufsize += strlen(cparam->current.custom_string);
break;
}
}
@@ -728,7 +730,9 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
case PPD_CUSTOM_PASSCODE :
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
- bufsize += 3 + 4 * strlen(cparam->current.custom_string);
+ bufsize += 3;
+ if (cparam->current.custom_string)
+ bufsize += 4 * strlen(cparam->current.custom_string);
break;
}
}
@@ -797,8 +801,8 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
*/
pnum = *cptr++ - '0';
- while (isalnum(*cptr & 255))
- pnum = pnum * 10 + *cptr - '0';
+ while (isdigit(*cptr & 255))
+ pnum = pnum * 10 + *cptr++ - '0';
for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
cparam;
@@ -828,9 +832,12 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
case PPD_CUSTOM_PASSCODE :
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
- strlcpy(bufptr, cparam->current.custom_string,
- bufend - bufptr);
- bufptr += strlen(bufptr);
+ if (cparam->current.custom_string)
+ {
+ strlcpy(bufptr, cparam->current.custom_string,
+ bufend - bufptr);
+ bufptr += strlen(bufptr);
+ }
break;
}
}
@@ -1033,14 +1040,19 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
case PPD_CUSTOM_STRING :
*bufptr++ = '(';
- for (s = cparam->current.custom_string; *s; s ++)
- if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
+ if (cparam->current.custom_string)
+ {
+ for (s = cparam->current.custom_string; *s; s ++)
{
- snprintf(bufptr, bufend - bufptr + 1, "\\%03o", *s & 255);
- bufptr += strlen(bufptr);
+ if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
+ {
+ snprintf(bufptr, bufend - bufptr + 1, "\\%03o", *s & 255);
+ bufptr += strlen(bufptr);
+ }
+ else
+ *bufptr++ = *s;
}
- else
- *bufptr++ = *s;
+ }
*bufptr++ = ')';
*bufptr++ = '\n';
@@ -1206,5 +1218,5 @@ ppd_handle_media(ppd_file_t *ppd) /* I - PPD file */
/*
- * End of "$Id: emit.c 8938 2009-12-18 23:52:01Z mike $".
+ * End of "$Id: emit.c 9233 2010-08-10 06:15:55Z mike $".
*/
diff --git a/cups/encode.c b/cups/encode.c
index 5d2cb448..68f16844 100644
--- a/cups/encode.c
+++ b/cups/encode.c
@@ -1,5 +1,5 @@
/*
- * "$Id: encode.c 8532 2009-04-20 21:37:14Z mike $"
+ * "$Id: encode.c 9258 2010-08-13 01:34:04Z mike $"
*
* Option encoding routines for the Common UNIX Printing System (CUPS).
*
@@ -125,6 +125,7 @@ static const _ipp_option_t ipp_options[] =
{ 0, "penwidth", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ 0, "penwidth-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 0, "port-monitor", IPP_TAG_NAME, IPP_TAG_PRINTER },
+ { 0, "ppd-name", IPP_TAG_NAME, IPP_TAG_PRINTER },
{ 0, "ppi", IPP_TAG_INTEGER, IPP_TAG_JOB },
{ 0, "ppi-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
{ 0, "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
@@ -636,5 +637,5 @@ compare_ipp_options(_ipp_option_t *a, /* I - First option */
/*
- * End of "$Id: encode.c 8532 2009-04-20 21:37:14Z mike $".
+ * End of "$Id: encode.c 9258 2010-08-13 01:34:04Z mike $".
*/
diff --git a/cups/file.c b/cups/file.c
index 1ae41832..1af3f9c4 100644
--- a/cups/file.c
+++ b/cups/file.c
@@ -1,5 +1,5 @@
/*
- * "$Id: file.c 9160 2010-06-16 20:25:12Z mike $"
+ * "$Id: file.c 9233 2010-08-10 06:15:55Z mike $"
*
* File functions for the Common UNIX Printing System (CUPS).
*
@@ -494,7 +494,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
// Strip the comment and any trailing whitespace...
while (ptr > buf)
{
- if (!isspace(ptr[-1] & 255))
+ if (!_cups_isspace(ptr[-1]))
break;
ptr --;
@@ -508,7 +508,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
* Strip leading whitespace...
*/
- for (ptr = buf; isspace(*ptr & 255); ptr ++);
+ for (ptr = buf; _cups_isspace(*ptr); ptr ++);
if (ptr > buf)
_cups_strcpy(buf, ptr);
@@ -524,7 +524,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
*/
for (ptr = buf; *ptr; ptr ++)
- if (isspace(*ptr & 255))
+ if (_cups_isspace(*ptr))
break;
if (*ptr)
@@ -533,7 +533,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
* Have a value, skip any other spaces...
*/
- while (isspace(*ptr & 255))
+ while (_cups_isspace(*ptr))
*ptr++ = '\0';
if (*ptr)
@@ -557,7 +557,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
return (buf);
}
- while (ptr > *value && isspace(*ptr & 255))
+ while (ptr > *value && _cups_isspace(*ptr))
*ptr-- = '\0';
}
@@ -2437,5 +2437,5 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
/*
- * End of "$Id: file.c 9160 2010-06-16 20:25:12Z mike $".
+ * End of "$Id: file.c 9233 2010-08-10 06:15:55Z mike $".
*/
diff --git a/cups/globals.h b/cups/globals.h
index aac2c692..a4305b9a 100644
--- a/cups/globals.h
+++ b/cups/globals.h
@@ -1,5 +1,5 @@
/*
- * "$Id: globals.h 9061 2010-03-30 22:07:33Z mike $"
+ * "$Id: globals.h 9170 2010-06-22 03:06:13Z mike $"
*
* Global variable definitions for the Common UNIX Printing System (CUPS).
*
@@ -26,6 +26,7 @@
# include "http-private.h"
# include "cups.h"
# include "i18n.h"
+# include "ppd-private.h"
# include "pwg-private.h"
# ifdef HAVE_PTHREAD_H
@@ -164,5 +165,5 @@ extern char *_cupsUserDefault(char *name, size_t namesize);
#endif /* !_CUPS_GLOBALS_H_ */
/*
- * End of "$Id: globals.h 9061 2010-03-30 22:07:33Z mike $".
+ * End of "$Id: globals.h 9170 2010-06-22 03:06:13Z mike $".
*/
diff --git a/cups/http-support.c b/cups/http-support.c
index 3dbe5d8b..89d52f02 100644
--- a/cups/http-support.c
+++ b/cups/http-support.c
@@ -1,5 +1,5 @@
/*
- * "$Id: http-support.c 8705 2009-06-12 00:21:58Z mike $"
+ * "$Id: http-support.c 9322 2010-10-01 22:40:38Z mike $"
*
* HTTP support routines for the Common UNIX Printing System (CUPS) scheduler.
*
@@ -917,7 +917,9 @@ httpSeparateURI(
for (ptr = scheme, end = scheme + schemelen - 1;
*uri && *uri != ':' && ptr < end;)
- if (isalnum(*uri & 255) || *uri == '-' || *uri == '+' || *uri == '.')
+ if (strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789-+.", *uri) != NULL)
*ptr++ = *uri++;
else
break;
@@ -1353,7 +1355,8 @@ _httpResolveURI(
DNSServiceRef ref, /* DNS-SD master service reference */
domainref, /* DNS-SD service reference for domain */
localref; /* DNS-SD service reference for .local */
- int domainsent = 0; /* Send the domain resolve? */
+ int domainsent = 0, /* Send the domain resolve? */
+ offline = 0; /* offline-report state set? */
char *regtype, /* Pointer to type in hostname */
*domain; /* Pointer to domain in hostname */
_http_uribuf_t uribuf; /* URI buffer */
@@ -1467,6 +1470,17 @@ _httpResolveURI(
&uribuf) == kDNSServiceErr_NoError)
domainsent = 1;
}
+
+ /*
+ * If it hasn't resolved within 5 seconds set the offline-report
+ * printer-state-reason...
+ */
+
+ if (logit && offline == 0 && time(NULL) > (start_time + 5))
+ {
+ fputs("STATE: +offline-report\n", stderr);
+ offline = 1;
+ }
}
else
{
@@ -1494,7 +1508,7 @@ _httpResolveURI(
else
fputs("DEBUG: Unable to resolve URI!\n", stderr);
- fputs("STATE: -connecting-to-device\n", stderr);
+ fputs("STATE: -connecting-to-device,offline-report\n", stderr);
}
#else
@@ -1710,5 +1724,5 @@ resolve_callback(
/*
- * End of "$Id: http-support.c 8705 2009-06-12 00:21:58Z mike $".
+ * End of "$Id: http-support.c 9322 2010-10-01 22:40:38Z mike $".
*/
diff --git a/cups/http.c b/cups/http.c
index de5cc316..65d623ea 100644
--- a/cups/http.c
+++ b/cups/http.c
@@ -1,5 +1,5 @@
/*
- * "$Id: http.c 9157 2010-06-16 05:27:41Z mike $"
+ * "$Id: http.c 9233 2010-08-10 06:15:55Z mike $"
*
* HTTP routines for CUPS.
*
@@ -910,7 +910,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
* Skip leading whitespace...
*/
- while (isspace(*fptr & 255))
+ while (_cups_isspace(*fptr))
fptr ++;
if (*fptr == ',')
@@ -924,7 +924,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
*/
for (ptr = temp;
- *fptr && *fptr != '=' && !isspace(*fptr & 255) &&
+ *fptr && *fptr != '=' && !_cups_isspace(*fptr) &&
ptr < (temp + sizeof(temp) - 1);
*ptr++ = *fptr++);
@@ -936,7 +936,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
* Skip trailing chars up to the '='...
*/
- while (isspace(*fptr & 255))
+ while (_cups_isspace(*fptr))
fptr ++;
if (!*fptr)
@@ -951,7 +951,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
fptr ++;
- while (isspace(*fptr & 255))
+ while (_cups_isspace(*fptr))
fptr ++;
if (*fptr == '\"')
@@ -979,12 +979,12 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
*/
for (ptr = value;
- *fptr && !isspace(*fptr & 255) && *fptr != ',' && ptr < end;
+ *fptr && !_cups_isspace(*fptr) && *fptr != ',' && ptr < end;
*ptr++ = *fptr++);
*ptr = '\0';
- while (*fptr && !isspace(*fptr & 255) && *fptr != ',')
+ while (*fptr && !_cups_isspace(*fptr) && *fptr != ',')
fptr ++;
}
@@ -2129,7 +2129,7 @@ httpUpdate(http_t *http) /* I - Connection to server */
*/
*value++ = '\0';
- while (isspace(*value & 255))
+ while (_cups_isspace(*value))
value ++;
/*
@@ -3511,5 +3511,5 @@ http_write_ssl(http_t *http, /* I - Connection to server */
/*
- * End of "$Id: http.c 9157 2010-06-16 05:27:41Z mike $".
+ * End of "$Id: http.c 9233 2010-08-10 06:15:55Z mike $".
*/
diff --git a/cups/ipp.c b/cups/ipp.c
index e6dce257..06a776a8 100644
--- a/cups/ipp.c
+++ b/cups/ipp.c
@@ -1,5 +1,5 @@
/*
- * "$Id: ipp.c 9120 2010-04-23 18:56:34Z mike $"
+ * "$Id: ipp.c 9357 2010-11-11 17:40:35Z mike $"
*
* Internet Printing Protocol functions for CUPS.
*
@@ -1275,7 +1275,9 @@ ippReadIO(void *src, /* I - Data source */
attr->value_tag = tag;
}
- else if ((value_tag >= IPP_TAG_TEXTLANG &&
+ else if (value_tag == IPP_TAG_TEXTLANG ||
+ value_tag == IPP_TAG_NAMELANG ||
+ (value_tag >= IPP_TAG_TEXT &&
value_tag <= IPP_TAG_MIMETYPE))
{
/*
@@ -1283,8 +1285,9 @@ ippReadIO(void *src, /* I - Data source */
* forms; accept sets of differing values...
*/
- if ((tag < IPP_TAG_TEXTLANG || tag > IPP_TAG_MIMETYPE) &&
- tag != IPP_TAG_NOVALUE)
+ if (tag != IPP_TAG_TEXTLANG && tag != IPP_TAG_NAMELANG &&
+ (tag < IPP_TAG_TEXT || tag > IPP_TAG_MIMETYPE) &&
+ tag != IPP_TAG_NOVALUE)
{
DEBUG_printf(("1ippReadIO: 1setOf value tag %x(%s) != %x(%s)",
value_tag, ippTagString(value_tag), tag,
@@ -2766,6 +2769,7 @@ _ippFreeAttr(ipp_attribute_t *attr) /* I - Attribute to free */
{
case IPP_TAG_TEXT :
case IPP_TAG_NAME :
+ case IPP_TAG_RESERVED_STRING :
case IPP_TAG_KEYWORD :
case IPP_TAG_URI :
case IPP_TAG_URISCHEME :
@@ -3202,5 +3206,5 @@ _ipp_free_attr(ipp_attribute_t *attr) /* I - Attribute to free */
/*
- * End of "$Id: ipp.c 9120 2010-04-23 18:56:34Z mike $".
+ * End of "$Id: ipp.c 9357 2010-11-11 17:40:35Z mike $".
*/
diff --git a/cups/ipp.h b/cups/ipp.h
index 01c0870f..18c046a5 100644
--- a/cups/ipp.h
+++ b/cups/ipp.h
@@ -1,5 +1,5 @@
/*
- * "$Id: ipp.h 9120 2010-04-23 18:56:34Z mike $"
+ * "$Id: ipp.h 9357 2010-11-11 17:40:35Z mike $"
*
* Internet Printing Protocol definitions for CUPS.
*
@@ -93,7 +93,8 @@ typedef enum ipp_tag_e /**** Format tags for attributes ****/
IPP_TAG_END_COLLECTION, /* End of collection value */
IPP_TAG_TEXT = 0x41, /* Text value */
IPP_TAG_NAME, /* Name value */
- IPP_TAG_KEYWORD = 0x44, /* Keyword value */
+ IPP_TAG_RESERVED_STRING, /* Reserved for future string value @private@ */
+ IPP_TAG_KEYWORD, /* Keyword value */
IPP_TAG_URI, /* URI value */
IPP_TAG_URISCHEME, /* URI scheme value */
IPP_TAG_CHARSET, /* Character set value */
@@ -500,5 +501,5 @@ extern ipp_tag_t ippTagValue(const char *name) _CUPS_API_1_4;
#endif /* !_CUPS_IPP_H_ */
/*
- * End of "$Id: ipp.h 9120 2010-04-23 18:56:34Z mike $".
+ * End of "$Id: ipp.h 9357 2010-11-11 17:40:35Z mike $".
*/
diff --git a/cups/language.c b/cups/language.c
index 0fe08fc4..bcbc58e8 100644
--- a/cups/language.c
+++ b/cups/language.c
@@ -1,5 +1,5 @@
/*
- * "$Id: language.c 8669 2009-05-21 22:17:54Z mike $"
+ * "$Id: language.c 9233 2010-08-10 06:15:55Z mike $"
*
* I18N/language support for the Common UNIX Printing System (CUPS).
*
@@ -267,9 +267,17 @@ _cupsEncodingName(
{
if (encoding < 0 ||
encoding >= (sizeof(lang_encodings) / sizeof(const char *)))
+ {
+ DEBUG_printf(("1_cupsEncodingName(encoding=%d) = out of range (\"%s\")",
+ encoding, lang_encodings[0]));
return (lang_encodings[0]);
+ }
else
+ {
+ DEBUG_printf(("1_cupsEncodingName(encoding=%d) = \"%s\"",
+ encoding, lang_encodings[encoding]));
return (lang_encodings[encoding]);
+ }
}
@@ -497,7 +505,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
*/
for (ptr = charset, csptr ++; *csptr; csptr ++)
- if (ptr < (charset + sizeof(charset) - 1) && isalnum(*csptr & 255))
+ if (ptr < (charset + sizeof(charset) - 1) && _cups_isalnum(*csptr))
*ptr++ = *csptr;
*ptr = '\0';
@@ -557,7 +565,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
*/
for (ptr = charset; *csptr; csptr ++)
- if (isalnum(*csptr & 255) && ptr < (charset + sizeof(charset) - 1))
+ if (_cups_isalnum(*csptr) && ptr < (charset + sizeof(charset) - 1))
*ptr++ = *csptr;
*ptr = '\0';
@@ -624,7 +632,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
*/
for (language ++, ptr = charset; *language; language ++)
- if (isalnum(*language & 255) && ptr < (charset + sizeof(charset) - 1))
+ if (_cups_isalnum(*language) && ptr < (charset + sizeof(charset) - 1))
*ptr++ = toupper(*language & 255);
*ptr = '\0';
@@ -1325,5 +1333,5 @@ cups_unquote(char *d, /* O - Unquoted string */
/*
- * End of "$Id: language.c 8669 2009-05-21 22:17:54Z mike $".
+ * End of "$Id: language.c 9233 2010-08-10 06:15:55Z mike $".
*/
diff --git a/cups/libcups.exp b/cups/libcups.exp
index d268e96f..ea87af4f 100644
--- a/cups/libcups.exp
+++ b/cups/libcups.exp
@@ -58,24 +58,26 @@ __ppdLocalizedAttr
__ppdNormalizeMakeAndModel
__ppdParseOptions
__pwgCreateWithFile
+__pwgCreateWithPPD
__pwgDestroy
-__pwgWriteFile
__pwgGenerateSize
-__pwgInitSize
-__pwgMediaForLegacy
-__pwgMediaForPPD
-__pwgMediaForPWG
-__pwgMediaForSize
-__pwgCreateWithPPD
+__pwgGetBin
__pwgGetInputSlot
__pwgGetMediaType
+__pwgGetOutputBin
__pwgGetPageSize
__pwgGetSize
__pwgGetSource
__pwgGetType
+__pwgInitSize
__pwgInputSlotForSource
+__pwgMediaForLegacy
+__pwgMediaForPPD
+__pwgMediaForPWG
+__pwgMediaForSize
__pwgMediaTypeForType
__pwgPageSizeForMedia
+__pwgWriteFile
_cupsAddDest
_cupsAddOption
_cupsAdminCreateWindowsPPD
diff --git a/cups/localize.c b/cups/localize.c
index 869f5919..827af391 100644
--- a/cups/localize.c
+++ b/cups/localize.c
@@ -1,5 +1,5 @@
/*
- * "$Id: localize.c 8627 2009-05-13 21:39:17Z mike $"
+ * "$Id: localize.c 9233 2010-08-10 06:15:55Z mike $"
*
* PPD localization routines for the Common UNIX Printing System (CUPS).
*
@@ -389,7 +389,7 @@ ppdLocalizeIPPReason(
valptr += 5;
- while (*valptr && !isspace(*valptr & 255) && bufptr < bufend)
+ while (*valptr && !_cups_isspace(*valptr) && bufptr < bufend)
{
if (*valptr == '%' && isxdigit(valptr[1] & 255) &&
isxdigit(valptr[2] & 255))
@@ -427,7 +427,7 @@ ppdLocalizeIPPReason(
* Skip this URI...
*/
- while (*valptr && !isspace(*valptr & 255))
+ while (*valptr && !_cups_isspace(*valptr))
valptr++;
}
@@ -435,7 +435,7 @@ ppdLocalizeIPPReason(
* Skip whitespace...
*/
- while (isspace(*valptr & 255))
+ while (_cups_isspace(*valptr))
valptr ++;
}
@@ -463,7 +463,7 @@ ppdLocalizeIPPReason(
* Copy URI...
*/
- while (*valptr && !isspace(*valptr & 255) && bufptr < bufend)
+ while (*valptr && !_cups_isspace(*valptr) && bufptr < bufend)
*bufptr++ = *valptr++;
*bufptr = '\0';
@@ -476,7 +476,7 @@ ppdLocalizeIPPReason(
* Skip this URI...
*/
- while (*valptr && !isspace(*valptr & 255))
+ while (*valptr && !_cups_isspace(*valptr))
valptr++;
}
@@ -484,7 +484,7 @@ ppdLocalizeIPPReason(
* Skip whitespace...
*/
- while (isspace(*valptr & 255))
+ while (_cups_isspace(*valptr))
valptr ++;
}
@@ -598,7 +598,7 @@ _ppdGetLanguages(ppd_file_t *ppd) /* I - PPD file */
* Skip leading whitespace...
*/
- while (isspace(*ptr & 255))
+ while (_cups_isspace(*ptr))
ptr ++;
if (!*ptr)
@@ -608,7 +608,7 @@ _ppdGetLanguages(ppd_file_t *ppd) /* I - PPD file */
* Find the end of this language name...
*/
- for (start = ptr; *ptr && !isspace(*ptr & 255); ptr ++);
+ for (start = ptr; *ptr && !_cups_isspace(*ptr); ptr ++);
if (*ptr)
*ptr++ = '\0';
@@ -777,5 +777,5 @@ ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */
/*
- * End of "$Id: localize.c 8627 2009-05-13 21:39:17Z mike $".
+ * End of "$Id: localize.c 9233 2010-08-10 06:15:55Z mike $".
*/
diff --git a/cups/mark.c b/cups/mark.c
index a7d98c1e..b5bc43af 100644
--- a/cups/mark.c
+++ b/cups/mark.c
@@ -1,5 +1,5 @@
/*
- * "$Id: mark.c 9127 2010-04-28 23:43:14Z mike $"
+ * "$Id: mark.c 9293 2010-09-02 17:52:24Z mike $"
*
* Option marking routines for CUPS.
*
@@ -43,6 +43,7 @@
#include "cups.h"
#include "string.h"
#include "debug.h"
+#include "ppd-private.h"
#include "pwg-private.h"
@@ -75,7 +76,7 @@ cupsMarkOptions(
int num_options, /* I - Number of options */
cups_option_t *options) /* I - Options */
{
- int i, j, k; /* Looping vars */
+ int i, j; /* Looping vars */
char *ptr, /* Pointer into string */
s[255]; /* Temporary string */
const char *val, /* Pointer into value */
@@ -83,33 +84,7 @@ cupsMarkOptions(
*page_size, /* PageSize option */
*ppd_keyword; /* PPD keyword */
cups_option_t *optptr; /* Current option */
- ppd_option_t *option; /* PPD option */
ppd_attr_t *attr; /* PPD attribute */
- static const char * const duplex_options[] =
- { /* Duplex option names */
- "Duplex", /* Adobe */
- "EFDuplex", /* EFI */
- "EFDuplexing", /* EFI */
- "KD03Duplex", /* Kodak */
- "JCLDuplex" /* Samsung */
- };
- static const char * const duplex_one[] =
- { /* one-sided names */
- "None",
- "False"
- };
- static const char * const duplex_two_long[] =
- { /* two-sided-long-edge names */
- "DuplexNoTumble", /* Adobe */
- "LongEdge", /* EFI */
- "Top" /* EFI */
- };
- static const char * const duplex_two_short[] =
- { /* two-sided-long-edge names */
- "DuplexTumble", /* Adobe */
- "ShortEdge", /* EFI */
- "Bottom" /* EFI */
- };
/*
@@ -188,98 +163,11 @@ cupsMarkOptions(
*/
for (i = num_options, optptr = options; i > 0; i --, optptr ++)
- if (!strcasecmp(optptr->name, "media"))
+ if (!strcasecmp(optptr->name, "media") ||
+ !strcasecmp(optptr->name, "output-bin") ||
+ !strcasecmp(optptr->name, "output-mode") ||
+ !strcasecmp(optptr->name, "sides"))
continue;
- else if (!strcasecmp(optptr->name, "sides"))
- {
- for (j = 0;
- j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
- j ++)
- if (cupsGetOption(duplex_options[j], num_options, options))
- break;
-
- if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
- {
- /*
- * Don't override the PPD option with the IPP attribute...
- */
-
- continue;
- }
-
- if (!strcasecmp(optptr->value, "one-sided"))
- {
- /*
- * Mark the appropriate duplex option for one-sided output...
- */
-
- for (j = 0;
- j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
- j ++)
- if ((option = ppdFindOption(ppd, duplex_options[j])) != NULL)
- break;
-
- if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
- {
- for (k = 0;
- k < (int)(sizeof(duplex_one) / sizeof(duplex_one[0]));
- k ++)
- if (ppdFindChoice(option, duplex_one[k]))
- {
- ppd_mark_option(ppd, duplex_options[j], duplex_one[k]);
- break;
- }
- }
- }
- else if (!strcasecmp(optptr->value, "two-sided-long-edge"))
- {
- /*
- * Mark the appropriate duplex option for two-sided-long-edge output...
- */
-
- for (j = 0;
- j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
- j ++)
- if ((option = ppdFindOption(ppd, duplex_options[j])) != NULL)
- break;
-
- if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
- {
- for (k = 0;
- k < (int)(sizeof(duplex_two_long) / sizeof(duplex_two_long[0]));
- k ++)
- if (ppdFindChoice(option, duplex_two_long[k]))
- {
- ppd_mark_option(ppd, duplex_options[j], duplex_two_long[k]);
- break;
- }
- }
- }
- else if (!strcasecmp(optptr->value, "two-sided-short-edge"))
- {
- /*
- * Mark the appropriate duplex option for two-sided-short-edge output...
- */
-
- for (j = 0;
- j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
- j ++)
- if ((option = ppdFindOption(ppd, duplex_options[j])) != NULL)
- break;
-
- if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
- {
- for (k = 0;
- k < (int)(sizeof(duplex_two_short) / sizeof(duplex_two_short[0]));
- k ++)
- if (ppdFindChoice(option, duplex_two_short[k]))
- {
- ppd_mark_option(ppd, duplex_options[j], duplex_two_short[k]);
- break;
- }
- }
- }
- }
else if (!strcasecmp(optptr->name, "resolution") ||
!strcasecmp(optptr->name, "printer-resolution"))
{
@@ -291,13 +179,6 @@ cupsMarkOptions(
ppd_mark_option(ppd, "CNRes_PGP", optptr->value);
/* Canon */
}
- else if (!strcasecmp(optptr->name, "output-bin"))
- {
- if (!cupsGetOption("OutputBin", num_options, options) &&
- (ppd_keyword = _pwgGetOutputBin((_pwg_t *)ppd->pwg,
- optptr->value)) != NULL)
- ppd_mark_option(ppd, "OutputBin", ppd_keyword);
- }
else if (!strcasecmp(optptr->name, "multiple-document-handling"))
{
if (!cupsGetOption("Collate", num_options, options) &&
@@ -584,7 +465,10 @@ ppdMarkDefaults(ppd_file_t *ppd) /* I - PPD file record */
for (c = (ppd_choice_t *)cupsArrayFirst(ppd->marked);
c;
c = (ppd_choice_t *)cupsArrayNext(ppd->marked))
+ {
cupsArrayRemove(ppd->marked, c);
+ c->marked = 0;
+ }
/*
* Then repopulate it with the defaults...
@@ -671,6 +555,7 @@ ppdNextOption(ppd_file_t *ppd) /* I - PPD file */
* This function looks for strings of the form:
*
* *option choice ... *optionN choiceN
+ * property value ... propertyN valueN
*
* It stops when it finds a string that doesn't match this format.
*/
@@ -679,10 +564,11 @@ int /* O - Number of options */
_ppdParseOptions(
const char *s, /* I - String to parse */
int num_options, /* I - Number of options */
- cups_option_t **options) /* IO - Options */
+ cups_option_t **options, /* IO - Options */
+ _ppd_parse_t which) /* I - What to parse */
{
- char option[PPD_MAX_NAME], /* Current option */
- choice[PPD_MAX_NAME], /* Current choice */
+ char option[PPD_MAX_NAME * 2 + 1], /* Current option/property */
+ choice[PPD_MAX_NAME], /* Current choice/value */
*ptr; /* Pointer into option or choice */
@@ -690,8 +576,8 @@ _ppdParseOptions(
return (num_options);
/*
- * Read all of the "*Option Choice" pairs from the string, marking PPD
- * options as we go...
+ * Read all of the "*Option Choice" and "property value" pairs from the
+ * string, add them to an options array as we go...
*/
while (*s)
@@ -700,22 +586,18 @@ _ppdParseOptions(
* Skip leading whitespace...
*/
- while (isspace(*s & 255))
+ while (_cups_isspace(*s))
s ++;
- if (*s != '*')
- break;
-
/*
- * Get the option name...
+ * Get the option/property name...
*/
- s ++;
ptr = option;
- while (*s && !isspace(*s & 255) && ptr < (option + sizeof(option) - 1))
+ while (*s && !_cups_isspace(*s) && ptr < (option + sizeof(option) - 1))
*ptr++ = *s++;
- if (ptr == s)
+ if (ptr == s || !_cups_isspace(*s))
break;
*ptr = '\0';
@@ -724,23 +606,29 @@ _ppdParseOptions(
* Get the choice...
*/
- while (isspace(*s & 255))
+ while (_cups_isspace(*s))
s ++;
if (!*s)
break;
ptr = choice;
- while (*s && !isspace(*s & 255) && ptr < (choice + sizeof(choice) - 1))
+ while (*s && !_cups_isspace(*s) && ptr < (choice + sizeof(choice) - 1))
*ptr++ = *s++;
+ if (*s && !_cups_isspace(*s))
+ break;
+
*ptr = '\0';
/*
* Add it to the options array...
*/
- num_options = cupsAddOption(option, choice, num_options, options);
+ if (option[0] == '*' && which != _PPD_PARSE_PROPERTIES)
+ num_options = cupsAddOption(option + 1, choice, num_options, options);
+ else if (option[0] != '*' && which != _PPD_PARSE_OPTIONS)
+ num_options = cupsAddOption(option, choice, num_options, options);
}
return (num_options);
@@ -809,7 +697,7 @@ ppd_mark_choices(ppd_file_t *ppd, /* I - PPD file */
return;
options = NULL;
- num_options = _ppdParseOptions(s, 0, &options);
+ num_options = _ppdParseOptions(s, 0, &options, 0);
for (i = num_options, option = options; i > 0; i --, option ++)
ppd_mark_option(ppd, option->name, option->value);
@@ -1152,5 +1040,5 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
/*
- * End of "$Id: mark.c 9127 2010-04-28 23:43:14Z mike $".
+ * End of "$Id: mark.c 9293 2010-09-02 17:52:24Z mike $".
*/
diff --git a/cups/options.c b/cups/options.c
index cf1d2d70..5ea6114c 100644
--- a/cups/options.c
+++ b/cups/options.c
@@ -1,5 +1,5 @@
/*
- * "$Id: options.c 8554 2009-04-27 17:18:37Z mike $"
+ * "$Id: options.c 9233 2010-08-10 06:15:55Z mike $"
*
* Option routines for the Common UNIX Printing System (CUPS).
*
@@ -282,7 +282,7 @@ cupsParseOptions(
* Skip leading spaces...
*/
- while (isspace(*ptr & 255))
+ while (_cups_isspace(*ptr))
ptr ++;
/*
@@ -296,7 +296,7 @@ cupsParseOptions(
*/
name = ptr;
- while (!isspace(*ptr & 255) && *ptr != '=' && *ptr)
+ while (!strchr("\f\n\r\t\v =", *ptr) && *ptr)
ptr ++;
/*
@@ -310,7 +310,7 @@ cupsParseOptions(
* Skip trailing spaces...
*/
- while (isspace(*ptr & 255))
+ while (_cups_isspace(*ptr))
*ptr++ = '\0';
if ((sep = *ptr) == '=')
@@ -339,7 +339,7 @@ cupsParseOptions(
value = ptr;
- while (*ptr && !isspace(*ptr & 255))
+ while (*ptr && !_cups_isspace(*ptr))
{
if (*ptr == ',')
ptr ++;
@@ -394,7 +394,7 @@ cupsParseOptions(
* Normal space-delimited string...
*/
- while (!isspace(*ptr & 255) && *ptr)
+ while (*ptr && !_cups_isspace(*ptr))
{
if (*ptr == '\\' && ptr[1])
_cups_strcpy(ptr, ptr + 1);
@@ -413,7 +413,7 @@ cupsParseOptions(
* Skip trailing whitespace...
*/
- while (isspace(*ptr & 255))
+ while (_cups_isspace(*ptr))
ptr ++;
/*
@@ -625,5 +625,5 @@ cups_find_option(
/*
- * End of "$Id: options.c 8554 2009-04-27 17:18:37Z mike $".
+ * End of "$Id: options.c 9233 2010-08-10 06:15:55Z mike $".
*/
diff --git a/cups/ppd-private.h b/cups/ppd-private.h
index 5a23b834..e94d081b 100644
--- a/cups/ppd-private.h
+++ b/cups/ppd-private.h
@@ -1,5 +1,5 @@
/*
- * "$Id: ppd-private.h 7757 2008-07-18 16:43:43Z mike $"
+ * "$Id: ppd-private.h 9170 2010-06-22 03:06:13Z mike $"
*
* Private PPD definitions for the Common UNIX Printing System (CUPS).
*
@@ -44,9 +44,16 @@ extern "C" {
/*
- * Structures...
+ * Types and structures...
*/
+typedef enum _ppd_parse_e /**** Selector for _ppdParseOptions ****/
+{
+ _PPD_PARSE_OPTIONS, /* Parse only the options */
+ _PPD_PARSE_PROPERTIES, /* Parse only the properties */
+ _PPD_PARSE_ALL /* Parse everything */
+} _ppd_parse_t;
+
typedef struct _ppd_cups_uiconst_s /**** Constraint from cupsUIConstraints ****/
{
ppd_option_t *option; /* Constrained option */
@@ -79,7 +86,8 @@ extern char *_ppdNormalizeMakeAndModel(const char *make_and_model,
char *buffer,
size_t bufsize);
extern int _ppdParseOptions(const char *s, int num_options,
- cups_option_t **options);
+ cups_option_t **options,
+ _ppd_parse_t which);
/*
@@ -92,5 +100,5 @@ extern int _ppdParseOptions(const char *s, int num_options,
#endif /* !_CUPS_PPD_PRIVATE_H_ */
/*
- * End of "$Id: ppd-private.h 7757 2008-07-18 16:43:43Z mike $".
+ * End of "$Id: ppd-private.h 9170 2010-06-22 03:06:13Z mike $".
*/
diff --git a/cups/ppd.c b/cups/ppd.c
index 8e352c4a..e28dc60d 100644
--- a/cups/ppd.c
+++ b/cups/ppd.c
@@ -1,5 +1,5 @@
/*
- * "$Id: ppd.c 9061 2010-03-30 22:07:33Z mike $"
+ * "$Id: ppd.c 9310 2010-09-21 22:34:57Z mike $"
*
* PPD file routines for CUPS.
*
@@ -666,6 +666,8 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
goto error;
}
+ else if (!string)
+ continue;
/*
* Certain main keywords (as defined by the PPD spec) may be used
@@ -1258,7 +1260,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
if (name[0] == '*')
_cups_strcpy(name, name + 1); /* Eliminate leading asterisk */
- for (i = (int)strlen(name) - 1; i > 0 && isspace(name[i] & 255); i --)
+ for (i = (int)strlen(name) - 1; i > 0 && _cups_isspace(name[i]); i --)
name[i] = '\0'; /* Eliminate trailing spaces */
DEBUG_printf(("2ppdOpen2: OpenUI of %s in group %s...", name,
@@ -2358,7 +2360,7 @@ ppd_decode(char *string) /* I - String to decode */
inptr ++;
while (isxdigit(*inptr & 255))
{
- if (isalpha(*inptr))
+ if (_cups_isalpha(*inptr))
*outptr = (tolower(*inptr) - 'a' + 10) << 4;
else
*outptr = (*inptr - '0') << 4;
@@ -2368,7 +2370,7 @@ ppd_decode(char *string) /* I - String to decode */
if (!isxdigit(*inptr & 255))
break;
- if (isalpha(*inptr))
+ if (_cups_isalpha(*inptr))
*outptr |= tolower(*inptr) - 'a' + 10;
else
*outptr |= *inptr - '0';
@@ -2999,7 +3001,7 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
*/
for (lineptr = line->buffer; *lineptr; lineptr ++)
- if (!isspace(*lineptr & 255))
+ if (*lineptr && !_cups_isspace(*lineptr))
break;
if (*lineptr)
@@ -3019,7 +3021,7 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
keyptr = keyword;
- while (*lineptr != '\0' && *lineptr != ':' && !isspace(*lineptr & 255))
+ while (*lineptr && *lineptr != ':' && !_cups_isspace(*lineptr))
{
if (*lineptr <= ' ' || *lineptr > 126 || *lineptr == '/' ||
(keyptr - keyword) >= (PPD_MAX_NAME - 1))
@@ -3038,18 +3040,18 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
mask |= PPD_KEYWORD;
- if (isspace(*lineptr & 255))
+ if (_cups_isspace(*lineptr))
{
/*
* Get an option name...
*/
- while (isspace(*lineptr & 255))
+ while (_cups_isspace(*lineptr))
lineptr ++;
optptr = option;
- while (*lineptr != '\0' && !isspace(*lineptr & 255) && *lineptr != ':' &&
+ while (*lineptr && !_cups_isspace(*lineptr) && *lineptr != ':' &&
*lineptr != '/')
{
if (*lineptr <= ' ' || *lineptr > 126 ||
@@ -3064,13 +3066,13 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
*optptr = '\0';
- if (isspace(*lineptr & 255) && cg->ppd_conform == PPD_CONFORM_STRICT)
+ if (_cups_isspace(*lineptr) && cg->ppd_conform == PPD_CONFORM_STRICT)
{
cg->ppd_status = PPD_ILLEGAL_WHITESPACE;
return (0);
}
- while (isspace(*lineptr & 255))
+ while (_cups_isspace(*lineptr))
lineptr ++;
mask |= PPD_OPTION;
@@ -3110,13 +3112,13 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
}
}
- if (isspace(*lineptr & 255) && cg->ppd_conform == PPD_CONFORM_STRICT)
+ if (_cups_isspace(*lineptr) && cg->ppd_conform == PPD_CONFORM_STRICT)
{
cg->ppd_status = PPD_ILLEGAL_WHITESPACE;
return (0);
}
- while (isspace(*lineptr & 255))
+ while (_cups_isspace(*lineptr))
lineptr ++;
if (*lineptr == ':')
@@ -3126,11 +3128,11 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
*/
lineptr ++;
- while (isspace(*lineptr & 255))
+ while (_cups_isspace(*lineptr))
lineptr ++;
strptr = lineptr + strlen(lineptr) - 1;
- while (strptr >= lineptr && isspace(*strptr & 255))
+ while (strptr >= lineptr && _cups_isspace(*strptr))
*strptr-- = '\0';
if (*strptr == '\"')
@@ -3155,5 +3157,5 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
/*
- * End of "$Id: ppd.c 9061 2010-03-30 22:07:33Z mike $".
+ * End of "$Id: ppd.c 9310 2010-09-21 22:34:57Z mike $".
*/
diff --git a/cups/pwg-file.c b/cups/pwg-file.c
index 30005f01..51c746fc 100644
--- a/cups/pwg-file.c
+++ b/cups/pwg-file.c
@@ -1,5 +1,5 @@
/*
- * "$Id: pwg-file.c 9120 2010-04-23 18:56:34Z mike $"
+ * "$Id: pwg-file.c 9216 2010-07-27 00:38:16Z mike $"
*
* PWG load/save API implementation for CUPS.
*
@@ -47,11 +47,14 @@ _pwgCreateWithFile(const char *filename)/* I - File to read */
num_sizes, /* Number of sizes in file */
num_sources, /* Number of sources in file */
num_types; /* Number of types in file */
- char line[512], /* Current line */
+ char line[2048], /* Current line */
*value, /* Pointer to value in line */
+ *valueptr, /* Pointer into value */
pwg_keyword[128], /* PWG keyword */
ppd_keyword[PPD_MAX_NAME];
/* PPD keyword */
+ _pwg_output_mode_t output_mode; /* Output mode for preset */
+ _pwg_print_quality_t print_quality; /* Print quality for preset */
DEBUG_printf(("_pwgCreateWithFile(filename=\"%s\")", filename));
@@ -236,6 +239,10 @@ _pwgCreateWithFile(const char *filename)/* I - File to read */
pwg->custom_min_width, pwg->custom_min_length);
pwg->custom_min_keyword = _cupsStrAlloc(pwg_keyword);
}
+ else if (!strcasecmp(line, "SourceOption"))
+ {
+ pwg->source_option = _cupsStrAlloc(value);
+ }
else if (!strcasecmp(line, "NumSources"))
{
if (num_sources > 0)
@@ -332,6 +339,38 @@ _pwgCreateWithFile(const char *filename)/* I - File to read */
pwg->num_types ++;
}
+ else if (!strcasecmp(line, "Preset"))
+ {
+ /*
+ * Preset output-mode print-quality name=value ...
+ */
+
+ output_mode = (_pwg_output_mode_t)strtol(value, &valueptr, 10);
+ print_quality = (_pwg_print_quality_t)strtol(valueptr, &valueptr, 10);
+
+ if (output_mode < _PWG_OUTPUT_MODE_MONOCHROME ||
+ output_mode >= _PWG_OUTPUT_MODE_MAX ||
+ print_quality < _PWG_PRINT_QUALITY_DRAFT ||
+ print_quality >= _PWG_PRINT_QUALITY_MAX ||
+ valueptr == value || !*valueptr)
+ {
+ DEBUG_printf(("_pwgCreateWithFile: Bad Preset on line %d.", linenum));
+ _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
+ goto create_error;
+ }
+
+ pwg->num_presets[output_mode][print_quality] =
+ cupsParseOptions(valueptr, 0,
+ pwg->presets[output_mode] + print_quality);
+ }
+ else if (!strcasecmp(line, "SidesOption"))
+ pwg->sides_option = _cupsStrAlloc(value);
+ else if (!strcasecmp(line, "Sides1Sided"))
+ pwg->sides_1sided = _cupsStrAlloc(value);
+ else if (!strcasecmp(line, "Sides2SidedLong"))
+ pwg->sides_2sided_long = _cupsStrAlloc(value);
+ else if (!strcasecmp(line, "Sides2SidedShort"))
+ pwg->sides_2sided_short = _cupsStrAlloc(value);
else
{
DEBUG_printf(("_pwgCreateWithFile: Unknown %s on line %d.", line,
@@ -427,6 +466,9 @@ _pwgDestroy(_pwg_t *pwg) /* I - PWG mapping data */
free(pwg->sizes);
}
+ if (pwg->source_option)
+ _cupsStrFree(pwg->source_option);
+
if (pwg->sources)
{
for (i = pwg->num_sources, map = pwg->sources; i > 0; i --, map ++)
@@ -467,10 +509,11 @@ int /* O - 1 on success, 0 on failure */
_pwgWriteFile(_pwg_t *pwg, /* I - PWG mapping data */
const char *filename) /* I - File to write */
{
- int i; /* Looping var */
+ int i, j, k; /* Looping vars */
cups_file_t *fp; /* Output file */
_pwg_size_t *size; /* Current size */
_pwg_map_t *map; /* Current map */
+ cups_option_t *option; /* Current option */
/*
@@ -530,6 +573,9 @@ _pwgWriteFile(_pwg_t *pwg, /* I - PWG mapping data */
* Media sources...
*/
+ if (pwg->source_option)
+ cupsFilePrintf(fp, "SourceOption %s\n", pwg->source_option);
+
if (pwg->num_sources > 0)
{
cupsFilePrintf(fp, "NumSources %d\n", pwg->num_sources);
@@ -549,6 +595,38 @@ _pwgWriteFile(_pwg_t *pwg, /* I - PWG mapping data */
}
/*
+ * Presets...
+ */
+
+ for (i = _PWG_OUTPUT_MODE_MONOCHROME; i < _PWG_OUTPUT_MODE_MAX; i ++)
+ for (j = _PWG_PRINT_QUALITY_DRAFT; j < _PWG_PRINT_QUALITY_MAX; j ++)
+ if (pwg->num_presets[i][j])
+ {
+ cupsFilePrintf(fp, "Preset %d %d", i, j);
+ for (k = pwg->num_presets[i][j], option = pwg->presets[i][j];
+ k > 0;
+ k --, option ++)
+ cupsFilePrintf(fp, " %s=%s", option->name, option->value);
+ cupsFilePutChar(fp, '\n');
+ }
+
+ /*
+ * Duplex/sides...
+ */
+
+ if (pwg->sides_option)
+ cupsFilePrintf(fp, "SidesOption %s\n", pwg->sides_option);
+
+ if (pwg->sides_1sided)
+ cupsFilePrintf(fp, "Sides1Sided %s\n", pwg->sides_1sided);
+
+ if (pwg->sides_2sided_long)
+ cupsFilePrintf(fp, "Sides2SidedLong %s\n", pwg->sides_2sided_long);
+
+ if (pwg->sides_2sided_short)
+ cupsFilePrintf(fp, "Sides2SidedShort %s\n", pwg->sides_2sided_short);
+
+ /*
* Close and return...
*/
@@ -557,5 +635,5 @@ _pwgWriteFile(_pwg_t *pwg, /* I - PWG mapping data */
/*
- * End of "$Id: pwg-file.c 9120 2010-04-23 18:56:34Z mike $".
+ * End of "$Id: pwg-file.c 9216 2010-07-27 00:38:16Z mike $".
*/
diff --git a/cups/pwg-media.c b/cups/pwg-media.c
index 95c40921..966f82eb 100644
--- a/cups/pwg-media.c
+++ b/cups/pwg-media.c
@@ -1,5 +1,5 @@
/*
- * "$Id: pwg-media.c 9067 2010-04-01 20:05:31Z mike $"
+ * "$Id: pwg-media.c 9310 2010-09-21 22:34:57Z mike $"
*
* PWG media name API implementation for CUPS.
*
@@ -61,26 +61,26 @@ static int pwg_compare_ppd(_pwg_media_t *a, _pwg_media_t *b);
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, NULL, 3, 5),
+ _PWG_MEDIA_IN("na_index-3x5_3x5in", NULL, "3x5", 3, 5),
_PWG_MEDIA_IN("na_personal_3.625x6.5in", NULL, "EnvPersonal", 3.625, 6.5),
_PWG_MEDIA_IN("na_monarch_3.875x7.5in", "monarch-envelope", "EnvMonarch", 3.875, 7.5),
_PWG_MEDIA_IN("na_number-9_3.875x8.875in", "na-number-9-envelope", "Env9", 3.875, 8.875),
- _PWG_MEDIA_IN("na_index-4x6_4x6in", NULL, NULL, 4, 6),
+ _PWG_MEDIA_IN("na_index-4x6_4x6in", NULL, "4x6", 4, 6),
_PWG_MEDIA_IN("na_number-10_4.125x9.5in", "na-number-10-envelope", "Env10", 4.125, 9.5),
_PWG_MEDIA_IN("na_a2_4.375x5.75in", NULL, NULL, 4.375, 5.75),
_PWG_MEDIA_IN("na_number-11_4.5x10.375in", NULL, "Env11", 4.5, 10.375),
_PWG_MEDIA_IN("na_number-12_4.75x11in", NULL, "Env12", 4.75, 11),
- _PWG_MEDIA_IN("na_5x7_5x7in", NULL, NULL, 5, 7),
- _PWG_MEDIA_IN("na_index-5x8_5x8in", NULL, NULL, 5, 8),
+ _PWG_MEDIA_IN("na_5x7_5x7in", NULL, "5x7", 5, 7),
+ _PWG_MEDIA_IN("na_index-5x8_5x8in", NULL, "5x8", 5, 8),
_PWG_MEDIA_IN("na_number-14_5x11.5in", NULL, "Env14", 5, 11.5),
_PWG_MEDIA_IN("na_invoice_5.5x8.5in", "invoice", "Statement", 5.5, 8.5),
_PWG_MEDIA_IN("na_index-4x6-ext_6x8in", NULL, NULL, 6, 8),
- _PWG_MEDIA_IN("na_6x9_6x9in", "na-6x9-envelope", NULL, 6, 9),
- _PWG_MEDIA_IN("na_c5_6.5x9.5in", NULL, NULL, 6.5, 9.5),
+ _PWG_MEDIA_IN("na_6x9_6x9in", "na-6x9-envelope", "6x9", 6, 9),
+ _PWG_MEDIA_IN("na_c5_6.5x9.5in", NULL, "6.5x9.5", 6.5, 9.5),
_PWG_MEDIA_IN("na_7x9_7x9in", "na-7x9-envelope", "7x9", 7, 9),
_PWG_MEDIA_IN("na_executive_7.25x10.5in", "executive", "Executive", 7.25, 10.5),
_PWG_MEDIA_IN("na_govt-letter_8x10in", "na-8x10", "8x10", 8, 10),
- _PWG_MEDIA_IN("na_govt-legal_8x13in", NULL, NULL, 8, 13),
+ _PWG_MEDIA_IN("na_govt-legal_8x13in", NULL, "8x13", 8, 13),
_PWG_MEDIA_IN("na_quarto_8.5x10.83in", "quarto", "Quarto", 8.5, 10.83),
_PWG_MEDIA_IN("na_letter_8.5x11in", "na-letter", "Letter", 8.5, 11),
_PWG_MEDIA_IN("na_fanfold-eur_8.5x12in", NULL, "FanFoldGerman", 8.5, 12),
@@ -95,15 +95,15 @@ static _pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_IN("na_10x11_10x11in", NULL, "10x11", 10, 11),
_PWG_MEDIA_IN("na_10x13_10x13in", "na-10x13-envelope", "10x13", 10, 13),
_PWG_MEDIA_IN("na_10x14_10x14in", "na-10x14-envelope", "10x14", 10, 14),
- _PWG_MEDIA_IN("na_10x15_10x15in", "na-10x15-envelope", NULL, 10, 15),
- _PWG_MEDIA_IN("na_11x12_11x12in", NULL, NULL, 11, 12),
- _PWG_MEDIA_IN("na_edp_11x14in", NULL, NULL, 11, 14),
+ _PWG_MEDIA_IN("na_10x15_10x15in", "na-10x15-envelope", "10x15", 10, 15),
+ _PWG_MEDIA_IN("na_11x12_11x12in", NULL, "11x12", 11, 12),
+ _PWG_MEDIA_IN("na_edp_11x14in", NULL, "11x14", 11, 14),
_PWG_MEDIA_IN("na_fanfold-us_11x14.875in", NULL, NULL, 11, 14.875),
- _PWG_MEDIA_IN("na_11x15_11x15in", NULL, NULL, 11, 15),
+ _PWG_MEDIA_IN("na_11x15_11x15in", NULL, "11x15", 11, 15),
_PWG_MEDIA_IN("na_ledger_11x17in", "tabloid", "Tabloid", 11, 17),
_PWG_MEDIA_IN("na_eur-edp_12x14in", NULL, NULL, 12, 14),
_PWG_MEDIA_IN("na_arch-b_12x18in", "arch-b", "ARCHB", 12, 18),
- _PWG_MEDIA_IN("na_12x19_12x19in", NULL, NULL, 12, 19),
+ _PWG_MEDIA_IN("na_12x19_12x19in", NULL, "12x19", 12, 19),
_PWG_MEDIA_IN("na_b-plus_12x19.17in", NULL, "SuperB", 12, 19.17),
_PWG_MEDIA_IN("na_super-b_13x19in", "super-b", NULL, 13, 19),
_PWG_MEDIA_IN("na_c_17x22in", "c", "AnsiC", 17, 22),
@@ -114,7 +114,7 @@ static _pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_IN("na_wide-format_30x42in", NULL, NULL, 30, 42),
_PWG_MEDIA_IN("na_e_34x44in", "e", "AnsiE", 34, 44),
_PWG_MEDIA_IN("na_arch-e_36x48in", "arch-e", "ARCHE", 36, 48),
- _PWG_MEDIA_IN("na_f_44x68in", NULL, NULL, 44, 68),
+ _PWG_MEDIA_IN("na_f_44x68in", NULL, "AnsiF", 44, 68),
/* Chinese Standard Sheet Media Inch Sizes */
_PWG_MEDIA_IN("roc_16k_7.75x10.75in", NULL, NULL, 7.75, 10.75),
@@ -354,8 +354,8 @@ _pwgInitSize(_pwg_size_t *size, /* I - Size to initialize */
*/
if ((media_size = ippFindAttribute(media_col->values[0].collection,
- "media-size",
- IPP_TAG_BEGIN_COLLECTION)) != NULL)
+ "media-size",
+ IPP_TAG_BEGIN_COLLECTION)) != NULL)
{
/*
* Got media-size, look for x-dimension and y-dimension member
@@ -418,12 +418,42 @@ _pwgInitSize(_pwg_size_t *size, /* I - Size to initialize */
else
{
if ((media = ippFindAttribute(job, "media", IPP_TAG_NAME)) == NULL)
- media = ippFindAttribute(job, "media", IPP_TAG_KEYWORD);
+ if ((media = ippFindAttribute(job, "media", IPP_TAG_KEYWORD)) == NULL)
+ if ((media = ippFindAttribute(job, "PageSize", IPP_TAG_NAME)) == NULL)
+ media = ippFindAttribute(job, "PageRegion", IPP_TAG_NAME);
if (media)
{
- if ((pwg = _pwgMediaForPWG(media->values[0].string.text)) == NULL)
- pwg = _pwgMediaForLegacy(media->values[0].string.text);
+ const char *name = media->values[0].string.text;
+ /* Name string */
+
+ if ((pwg = _pwgMediaForPWG(name)) == NULL)
+ {
+ /*
+ * Not a PWG name, try a legacy name...
+ */
+
+ if ((pwg = _pwgMediaForLegacy(name)) == NULL)
+ {
+ /*
+ * Not a legacy name, try a PPD name...
+ */
+
+ const char *suffix; /* Suffix on media string */
+
+ pwg = _pwgMediaForPPD(name);
+ if (pwg &&
+ (suffix = name + strlen(name) - 10 /* .FullBleed */) > name &&
+ !strcasecmp(suffix, ".FullBleed"))
+ {
+ /*
+ * Indicate that margins are set with the default values of 0.
+ */
+
+ *margins_set = 1;
+ }
+ }
+ }
if (pwg)
{
@@ -502,7 +532,8 @@ _pwgMediaForLegacy(
_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 */
@@ -519,8 +550,7 @@ _pwgMediaForPPD(const char *ppd) /* I - PPD size name */
if (!cg->ppd_size_lut)
{
- int i; /* Looping var */
- _pwg_media_t *size; /* Current size */
+ int i; /* Looping var */
cg->ppd_size_lut = cupsArrayNew((cups_array_func_t)pwg_compare_ppd, NULL);
@@ -537,7 +567,96 @@ _pwgMediaForPPD(const char *ppd) /* I - PPD size name */
*/
key.ppd = ppd;
- return ((_pwg_media_t *)cupsArrayFind(cg->ppd_size_lut, &key));
+ if ((size = (_pwg_media_t *)cupsArrayFind(cg->ppd_size_lut, &key)) == NULL)
+ {
+ /*
+ * See if the name is of the form:
+ *
+ * [Custom.]WIDTHxLENGTH[.FullBleed] - Size in points/inches [borderless]
+ * [Custom.]WIDTHxLENGTHcm[.FullBleed] - Size in centimeters [borderless]
+ * [Custom.]WIDTHxLENGTHft[.FullBleed] - Size in feet [borderless]
+ * [Custom.]WIDTHxLENGTHin[.FullBleed] - Size in inches [borderless]
+ * [Custom.]WIDTHxLENGTHm[.FullBleed] - Size in meters [borderless]
+ * [Custom.]WIDTHxLENGTHmm[.FullBleed] - Size in millimeters [borderless]
+ * [Custom.]WIDTHxLENGTHpt[.FullBleed] - Size in points [borderless]
+ */
+
+ double w, l, /* Width and length of page */
+ factor; /* Unit scaling factor */
+ char *ptr; /* Pointer into name */
+ struct lconv *loc; /* Locale data */
+ int custom; /* Custom page size? */
+
+ if (!strncasecmp(ppd, "Custom.", 7))
+ {
+ custom = 1;
+ factor = 2540.0 / 72.0;
+ ptr = (char *)ppd + 7;
+ }
+ else
+ {
+ custom = 0;
+ factor = 2540.0;
+ ptr = (char *)ppd;
+ }
+
+ loc = localeconv();
+ w = _cupsStrScand(ptr, &ptr, loc);
+
+ if (ptr && ptr > ppd && *ptr == 'x')
+ {
+ l = _cupsStrScand(ptr + 1, &ptr, loc);
+
+ if (ptr &&
+ (!*ptr ||
+ !strcasecmp(ptr, "FullBleed") ||
+ !strcasecmp(ptr, ".FullBleed") ||
+ !strcasecmp(ptr, "cm") ||
+ !strcasecmp(ptr, "cm.FullBleed") ||
+ !strcasecmp(ptr, "ft") ||
+ !strcasecmp(ptr, "ft.FullBleed") ||
+ !strcasecmp(ptr, "in") ||
+ !strcasecmp(ptr, "in.FullBleed") ||
+ !strcasecmp(ptr, "m") ||
+ !strcasecmp(ptr, "m.FullBleed") ||
+ !strcasecmp(ptr, "mm") ||
+ !strcasecmp(ptr, "mm.FullBleed") ||
+ !strcasecmp(ptr, "pt") ||
+ !strcasecmp(ptr, "pt.FullBleed")))
+ {
+ size = &(cg->pwg_media);
+
+ if (!strncasecmp(ptr, "cm", 2))
+ factor = 1000.0;
+ else if (!strncasecmp(ptr, "ft", 2))
+ factor = 2540.0 * 12.0;
+ else if (!strncasecmp(ptr, "in", 2))
+ factor = 2540.0;
+ else if (!strncasecmp(ptr, "mm", 2))
+ factor = 100.0;
+ else if (*ptr == 'm' || *ptr == 'M')
+ factor = 100000.0;
+ else if (!strncasecmp(ptr, "pt", 2))
+ factor = 2540.0 / 72.0;
+
+ /*
+ * Not a standard size; convert it to a PWG custom name of the form:
+ *
+ * [oe|om]_WIDTHxHEIGHTuu_WIDTHxHEIGHTuu
+ */
+
+ size->width = (int)(w * factor);
+ 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);
+ }
+ }
+ }
+
+ return (size);
}
@@ -548,7 +667,9 @@ _pwgMediaForPPD(const char *ppd) /* I - PPD size name */
_pwg_media_t * /* O - Matching size or NULL */
_pwgMediaForPWG(const char *pwg) /* I - PWG size name */
{
- _pwg_media_t key; /* Search key */
+ char *ptr; /* Pointer into name */
+ _pwg_media_t key, /* Search key */
+ *size; /* Matching size */
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
@@ -565,8 +686,7 @@ _pwgMediaForPWG(const char *pwg) /* I - PWG size name */
if (!cg->pwg_size_lut)
{
- int i; /* Looping var */
- _pwg_media_t *size; /* Current size */
+ int i; /* Looping var */
cg->pwg_size_lut = cupsArrayNew((cups_array_func_t)pwg_compare_pwg, NULL);
@@ -582,7 +702,50 @@ _pwgMediaForPWG(const char *pwg) /* I - PWG size name */
*/
key.pwg = pwg;
- return ((_pwg_media_t *)cupsArrayFind(cg->pwg_size_lut, &key));
+ if ((size = (_pwg_media_t *)cupsArrayFind(cg->pwg_size_lut, &key)) == NULL &&
+ (ptr = (char *)strchr(pwg, '_')) != NULL &&
+ (ptr = (char *)strchr(ptr + 1, '_')) != NULL)
+ {
+ /*
+ * Try decoding the self-describing name of the form:
+ *
+ * class_name_WWWxHHHin
+ * class_name_WWWxHHHmm
+ */
+
+ double w, l; /* Width and length of page */
+ struct lconv *loc; /* Locale data */
+
+ ptr ++;
+ loc = localeconv();
+ w = _cupsStrScand(ptr, &ptr, loc);
+
+ if (ptr && *ptr == 'x')
+ {
+ l = _cupsStrScand(ptr + 1, &ptr, loc);
+
+ if (ptr && (!strcmp(ptr, "in") || !strcmp(ptr, "mm")))
+ {
+ size = &(cg->pwg_media);
+
+ if (!strcmp(ptr, "mm"))
+ {
+ size->width = (int)(w * 100);
+ size->length = (int)(l * 100);
+ }
+ else
+ {
+ size->width = (int)(w * 2540);
+ size->length = (int)(l * 2540);
+ }
+
+ strlcpy(cg->pwg_name, pwg, sizeof(cg->pwg_name));
+ size->pwg = cg->pwg_name;
+ }
+ }
+ }
+
+ return (size);
}
@@ -682,5 +845,5 @@ pwg_compare_pwg(_pwg_media_t *a, /* I - First size */
/*
- * End of "$Id: pwg-media.c 9067 2010-04-01 20:05:31Z mike $".
+ * End of "$Id: pwg-media.c 9310 2010-09-21 22:34:57Z mike $".
*/
diff --git a/cups/pwg-ppd.c b/cups/pwg-ppd.c
index e76dfb6d..51787331 100644
--- a/cups/pwg-ppd.c
+++ b/cups/pwg-ppd.c
@@ -1,5 +1,5 @@
/*
- * "$Id: pwg-ppd.c 9120 2010-04-23 18:56:34Z mike $"
+ * "$Id: pwg-ppd.c 9328 2010-10-06 19:57:14Z mike $"
*
* PWG PPD mapping API implementation for CUPS.
*
@@ -49,6 +49,13 @@
/*
+ * Macro to test for two almost-equal PWG measurements.
+ */
+
+#define _PWG_EQUIVALENT(x, y) (abs((x)-(y)) < 2)
+
+
+/*
* Local functions...
*/
@@ -63,20 +70,44 @@ static void pwg_unppdize_name(const char *ppd, char *name, size_t namesize);
_pwg_t * /* O - PWG mapping data */
_pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
{
- int i, j; /* Looping vars */
- _pwg_t *pwg; /* PWG mapping data */
- ppd_option_t *input_slot, /* InputSlot option */
- *media_type, /* MediaType option */
- *output_bin; /* OutputBin option */
- ppd_choice_t *choice; /* Current InputSlot/MediaType */
- _pwg_map_t *map; /* Current source/type map */
- ppd_size_t *ppd_size; /* Current PPD size */
- _pwg_size_t *pwg_size; /* Current PWG size */
- char pwg_keyword[3 + PPD_MAX_NAME + 1 + 12 + 1 + 12 + 3],
+ int i, j, k; /* Looping vars */
+ _pwg_t *pwg; /* PWG mapping data */
+ ppd_option_t *input_slot, /* InputSlot option */
+ *media_type, /* MediaType option */
+ *output_bin, /* OutputBin option */
+ *color_model, /* ColorModel option */
+ *duplex; /* Duplex option */
+ ppd_choice_t *choice; /* Current InputSlot/MediaType */
+ _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 */
+ 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 */
+ 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_output_mode_t pwg_output_mode;/* output-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 */
+ int old_imageable, /* Old imageable length in 2540ths */
+ old_borderless, /* Old borderless state */
+ old_known_pwg; /* Old PWG name is well-known */
+ int new_width, /* New width in 2540ths */
+ new_length, /* New length in 2540ths */
+ new_left, /* New left margin in 2540ths */
+ new_bottom, /* New bottom margin in 2540ths */
+ new_right, /* New right margin in 2540ths */
+ new_top, /* New top margin in 2540ths */
+ 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 */
DEBUG_printf(("_pwgCreateWithPPD(ppd=%p)", ppd));
@@ -125,7 +156,7 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
if (!strcasecmp(ppd_size->name, "Custom"))
continue;
-
+
/*
* Convert the PPD size name to the corresponding PWG keyword name.
*/
@@ -150,7 +181,8 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
* Standard name and no conflicts, use it!
*/
- pwg_name = pwg_media->pwg;
+ pwg_name = pwg_media->pwg;
+ new_known_pwg = 1;
}
else
{
@@ -160,7 +192,8 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
* pp_lowerppd_WIDTHxHEIGHTuu
*/
- pwg_name = pwg_keyword;
+ pwg_name = pwg_keyword;
+ new_known_pwg = 0;
pwg_unppdize_name(ppd_size->name, ppd_name, sizeof(ppd_name));
_pwgGenerateSize(pwg_keyword, sizeof(pwg_keyword), NULL, ppd_name,
@@ -169,20 +202,75 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
}
/*
- * Save this size...
+ * If we have a similar paper with non-zero margins then we only
+ * want to keep it if it has a larger imageable area length.
*/
- pwg_size->map.ppd = _cupsStrAlloc(ppd_size->name);
- pwg_size->map.pwg = _cupsStrAlloc(pwg_name);
- pwg_size->width = _PWG_FROMPTS(ppd_size->width);
- pwg_size->length = _PWG_FROMPTS(ppd_size->length);
- pwg_size->left = _PWG_FROMPTS(ppd_size->left);
- pwg_size->bottom = _PWG_FROMPTS(ppd_size->bottom);
- pwg_size->right = _PWG_FROMPTS(ppd_size->width - ppd_size->right);
- pwg_size->top = _PWG_FROMPTS(ppd_size->length - ppd_size->top);
-
- pwg->num_sizes ++;
- pwg_size ++;
+ new_width = _PWG_FROMPTS(ppd_size->width);
+ new_length = _PWG_FROMPTS(ppd_size->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_imageable = new_length - new_top - new_bottom;
+ new_borderless = new_bottom == 0 && new_top == 0 &&
+ new_left == 0 && new_right == 0;
+
+ for (k = pwg->num_sizes, similar = 0, old_size = pwg->sizes, new_size = NULL;
+ k > 0 && !similar;
+ k --, old_size ++)
+ {
+ old_imageable = old_size->length - old_size->top - old_size->bottom;
+ old_borderless = old_size->left == 0 && old_size->bottom == 0 &&
+ old_size->right == 0 && old_size->top == 0;
+ old_known_pwg = strncmp(old_size->map.pwg, "oe_", 3) &&
+ strncmp(old_size->map.pwg, "om_", 3);
+
+ similar = old_borderless == new_borderless &&
+ _PWG_EQUIVALENT(old_size->width, new_width) &&
+ _PWG_EQUIVALENT(old_size->length, new_length);
+
+ if (similar &&
+ (new_known_pwg || (!old_known_pwg && new_imageable > old_imageable)))
+ {
+ /*
+ * The new paper has a larger imageable area so it could replace
+ * the older paper. Regardless of the imageable area, we always
+ * prefer the size with a well-known PWG name.
+ */
+
+ new_size = old_size;
+ _cupsStrFree(old_size->map.ppd);
+ _cupsStrFree(old_size->map.pwg);
+ }
+ }
+
+ if (!similar)
+ {
+ /*
+ * The paper was unique enough to deserve its own entry so add it to the
+ * end.
+ */
+
+ new_size = pwg_size ++;
+ pwg->num_sizes ++;
+ }
+
+ if (new_size)
+ {
+ /*
+ * Save this size...
+ */
+
+ new_size->map.ppd = _cupsStrAlloc(ppd_size->name);
+ new_size->map.pwg = _cupsStrAlloc(pwg_name);
+ new_size->width = new_width;
+ new_size->length = new_length;
+ new_size->left = new_left;
+ new_size->bottom = new_bottom;
+ new_size->right = new_right;
+ new_size->top = new_top;
+ }
}
if (ppd->variable_sizes)
@@ -215,8 +303,13 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
* Copy and convert InputSlot data...
*/
- if ((input_slot = ppdFindOption(ppd, "InputSlot")) != NULL)
+ if ((input_slot = ppdFindOption(ppd, "InputSlot")) == NULL)
+ input_slot = ppdFindOption(ppd, "HPPaperSource");
+
+ if (input_slot)
{
+ pwg->source_option = _cupsStrAlloc(input_slot->keyword);
+
if ((pwg->sources = calloc(input_slot->num_choices,
sizeof(_pwg_map_t))) == NULL)
{
@@ -237,6 +330,10 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
pwg_name = "auto";
else if (!strcasecmp(choice->choice, "Cassette"))
pwg_name = "main";
+ else if (!strcasecmp(choice->choice, "PhotoTray"))
+ pwg_name = "photo";
+ else if (!strcasecmp(choice->choice, "CDTray"))
+ pwg_name = "disc";
else if (!strncasecmp(choice->choice, "Multipurpose", 12) ||
!strcasecmp(choice->choice, "MP") ||
!strcasecmp(choice->choice, "MPTray"))
@@ -362,6 +459,238 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
}
}
+ if ((ppd_attr = ppdFindAttr(ppd, "APPrinterPreset", NULL)) != NULL)
+ {
+ /*
+ * Copy and convert APPrinterPreset (output-mode + print-quality) data...
+ */
+
+ const char *quality, /* com.apple.print.preset.quality value */
+ *output_mode, /* com.apple.print.preset.output-mode value */
+ *color_model_val, /* ColorModel choice */
+ *graphics_type, /* com.apple.print.preset.graphicsType value */
+ *paper_coating; /* com.apple.print.preset.media-front-coating value */
+
+
+ do
+ {
+ num_options = _ppdParseOptions(ppd_attr->value, 0, &options,
+ _PPD_PARSE_ALL);
+
+ if ((quality = cupsGetOption("com.apple.print.preset.quality",
+ num_options, options)) != NULL)
+ {
+ /*
+ * Get the print-quality for this preset...
+ */
+
+ if (!strcmp(quality, "low"))
+ pwg_print_quality = _PWG_PRINT_QUALITY_DRAFT;
+ else if (!strcmp(quality, "high"))
+ pwg_print_quality = _PWG_PRINT_QUALITY_HIGH;
+ else
+ pwg_print_quality = _PWG_PRINT_QUALITY_NORMAL;
+
+ /*
+ * Ignore graphicsType "Photo" presets that are not high quality.
+ */
+
+ graphics_type = cupsGetOption("com.apple.print.preset.graphicsType",
+ num_options, options);
+
+ if (pwg_print_quality != _PWG_PRINT_QUALITY_HIGH && graphics_type &&
+ !strcmp(graphics_type, "Photo"))
+ continue;
+
+ /*
+ * Ignore presets for normal and draft quality where the coating
+ * isn't "none" or "autodetect".
+ */
+
+ paper_coating = cupsGetOption(
+ "com.apple.print.preset.media-front-coating",
+ num_options, options);
+
+ if (pwg_print_quality != _PWG_PRINT_QUALITY_HIGH && paper_coating &&
+ strcmp(paper_coating, "none") &&
+ strcmp(paper_coating, "autodetect"))
+ continue;
+
+ /*
+ * Get the output mode for this preset...
+ */
+
+ output_mode = cupsGetOption("com.apple.print.preset.output-mode",
+ num_options, options);
+ color_model_val = cupsGetOption("ColorModel", num_options, options);
+
+ if (output_mode)
+ {
+ if (!strcmp(output_mode, "monochrome"))
+ pwg_output_mode = _PWG_OUTPUT_MODE_MONOCHROME;
+ else
+ pwg_output_mode = _PWG_OUTPUT_MODE_COLOR;
+ }
+ else if (color_model_val)
+ {
+ if (!strcasecmp(color_model_val, "Gray"))
+ pwg_output_mode = _PWG_OUTPUT_MODE_MONOCHROME;
+ else
+ pwg_output_mode = _PWG_OUTPUT_MODE_COLOR;
+ }
+ else
+ pwg_output_mode = _PWG_OUTPUT_MODE_COLOR;
+
+ /*
+ * Save the options for this combination as needed...
+ */
+
+ if (!pwg->num_presets[pwg_output_mode][pwg_print_quality])
+ pwg->num_presets[pwg_output_mode][pwg_print_quality] =
+ _ppdParseOptions(ppd_attr->value, 0,
+ pwg->presets[pwg_output_mode] +
+ pwg_print_quality, _PPD_PARSE_OPTIONS);
+ }
+
+ cupsFreeOptions(num_options, options);
+ }
+ while ((ppd_attr = ppdFindNextAttr(ppd, "APPrinterPreset", NULL)) != NULL);
+ }
+
+ if (!pwg->num_presets[_PWG_OUTPUT_MODE_MONOCHROME][_PWG_PRINT_QUALITY_DRAFT] &&
+ !pwg->num_presets[_PWG_OUTPUT_MODE_MONOCHROME][_PWG_PRINT_QUALITY_NORMAL] &&
+ !pwg->num_presets[_PWG_OUTPUT_MODE_MONOCHROME][_PWG_PRINT_QUALITY_HIGH])
+ {
+ /*
+ * Try adding some common color options to create grayscale presets. These
+ * are listed in order of popularity...
+ */
+
+ const char *color_option = NULL, /* Color control option */
+ *gray_choice = NULL; /* Choice to select grayscale */
+
+ if ((color_model = ppdFindOption(ppd, "ColorModel")) != NULL &&
+ ppdFindChoice(color_model, "Gray"))
+ {
+ color_option = "ColorModel";
+ gray_choice = "Gray";
+ }
+ else if ((color_model = ppdFindOption(ppd, "HPColorMode")) != NULL &&
+ ppdFindChoice(color_model, "grayscale"))
+ {
+ color_option = "HPColorMode";
+ gray_choice = "grayscale";
+ }
+ else if ((color_model = ppdFindOption(ppd, "BRMonoColor")) != NULL &&
+ ppdFindChoice(color_model, "Mono"))
+ {
+ color_option = "BRMonoColor";
+ gray_choice = "Mono";
+ }
+ else if ((color_model = ppdFindOption(ppd, "CNIJSGrayScale")) != NULL &&
+ ppdFindChoice(color_model, "1"))
+ {
+ color_option = "CNIJSGrayScale";
+ gray_choice = "1";
+ }
+ else if ((color_model = ppdFindOption(ppd, "HPColorAsGray")) != NULL &&
+ ppdFindChoice(color_model, "True"))
+ {
+ color_option = "HPColorAsGray";
+ gray_choice = "True";
+ }
+
+ if (color_option && gray_choice)
+ {
+ /*
+ * Copy and convert ColorModel (output-mode) data...
+ */
+
+ cups_option_t *coption, /* Color option */
+ *moption; /* Monochrome option */
+
+ for (pwg_print_quality = _PWG_PRINT_QUALITY_DRAFT;
+ pwg_print_quality < _PWG_PRINT_QUALITY_MAX;
+ pwg_print_quality ++)
+ {
+ if (pwg->num_presets[_PWG_OUTPUT_MODE_COLOR][pwg_print_quality])
+ {
+ /*
+ * Copy the color options...
+ */
+
+ num_options = pwg->num_presets[_PWG_OUTPUT_MODE_COLOR]
+ [pwg_print_quality];
+ options = calloc(sizeof(cups_option_t), num_options);
+
+ if (options)
+ {
+ for (i = num_options, moption = options,
+ coption = pwg->presets[_PWG_OUTPUT_MODE_COLOR]
+ [pwg_print_quality];
+ i > 0;
+ i --, moption ++, coption ++)
+ {
+ moption->name = _cupsStrRetain(coption->name);
+ moption->value = _cupsStrRetain(coption->value);
+ }
+
+ pwg->num_presets[_PWG_OUTPUT_MODE_MONOCHROME][pwg_print_quality] =
+ num_options;
+ pwg->presets[_PWG_OUTPUT_MODE_MONOCHROME][pwg_print_quality] =
+ options;
+ }
+ }
+ else if (pwg_print_quality != _PWG_PRINT_QUALITY_NORMAL)
+ continue;
+
+ /*
+ * Add the grayscale option to the preset...
+ */
+
+ pwg->num_presets[_PWG_OUTPUT_MODE_MONOCHROME][pwg_print_quality] =
+ cupsAddOption(color_option, gray_choice,
+ pwg->num_presets[_PWG_OUTPUT_MODE_MONOCHROME]
+ [pwg_print_quality],
+ pwg->presets[_PWG_OUTPUT_MODE_MONOCHROME] +
+ pwg_print_quality);
+ }
+ }
+ }
+
+ /*
+ * Copy and convert Duplex (sides) data...
+ */
+
+ if ((duplex = ppdFindOption(ppd, "Duplex")) == NULL)
+ if ((duplex = ppdFindOption(ppd, "JCLDuplex")) == NULL)
+ if ((duplex = ppdFindOption(ppd, "EFDuplex")) == NULL)
+ if ((duplex = ppdFindOption(ppd, "EFDuplexing")) == NULL)
+ duplex = ppdFindOption(ppd, "KD03Duplex");
+
+ if (duplex)
+ {
+ pwg->sides_option = _cupsStrAlloc(duplex->keyword);
+
+ for (i = duplex->num_choices, choice = duplex->choices;
+ i > 0;
+ i --, choice ++)
+ {
+ if ((!strcasecmp(choice->choice, "None") ||
+ !strcasecmp(choice->choice, "False")) && !pwg->sides_1sided)
+ pwg->sides_1sided = _cupsStrAlloc(choice->choice);
+ else if ((!strcasecmp(choice->choice, "DuplexNoTumble") ||
+ !strcasecmp(choice->choice, "LongEdge") ||
+ !strcasecmp(choice->choice, "Top")) && !pwg->sides_2sided_long)
+ pwg->sides_2sided_long = _cupsStrAlloc(choice->choice);
+ else if ((!strcasecmp(choice->choice, "DuplexTumble") ||
+ !strcasecmp(choice->choice, "ShortEdge") ||
+ !strcasecmp(choice->choice, "Bottom")) &&
+ !pwg->sides_2sided_short)
+ pwg->sides_2sided_short = _cupsStrAlloc(choice->choice);
+ }
+ }
+
return (pwg);
/*
@@ -434,13 +763,30 @@ _pwgGetInputSlot(_pwg_t *pwg, /* I - PWG mapping data */
ipp_attribute_t *media_col, /* media-col attribute */
*media_source; /* media-source attribute */
+ _pwg_size_t size; /* Dimensional size */
+ int margins_set; /* Were the margins set? */
media_col = ippFindAttribute(job, "media-col", IPP_TAG_BEGIN_COLLECTION);
if (media_col &&
(media_source = ippFindAttribute(media_col->values[0].collection,
"media-source",
IPP_TAG_KEYWORD)) != NULL)
+ {
+ /*
+ * Use the media-source value from media-col...
+ */
+
keyword = media_source->values[0].string.text;
+ }
+ else if (_pwgInitSize(&size, job, &margins_set))
+ {
+ /*
+ * For media <= 5x7, look for a photo tray...
+ */
+
+ if (size.width <= (5 * 2540) && size.length <= (7 * 2540))
+ keyword = "photo";
+ }
}
if (keyword)
@@ -565,8 +911,12 @@ _pwgGetPageSize(_pwg_t *pwg, /* I - PWG mapping data */
dtop, /* Difference in top margins */
dmin, /* Minimum difference */
dclosest; /* Closest difference */
+ const char *ppd_name; /* PPD media name */
+ DEBUG_printf(("_pwgGetPageSize(pwg=%p, job=%p, keyword=\"%s\", exact=%p)",
+ pwg, job, keyword, exact));
+
/*
* Range check input...
*/
@@ -577,6 +927,58 @@ _pwgGetPageSize(_pwg_t *pwg, /* I - PWG mapping data */
if (exact)
*exact = 0;
+ ppd_name = keyword;
+
+ if (job)
+ {
+ /*
+ * Try getting the PPD media name from the job attributes...
+ */
+
+ ipp_attribute_t *attr; /* Job attribute */
+
+ if ((attr = ippFindAttribute(job, "PageSize", IPP_TAG_ZERO)) == NULL)
+ if ((attr = ippFindAttribute(job, "PageRegion", IPP_TAG_ZERO)) == NULL)
+ attr = ippFindAttribute(job, "media", IPP_TAG_ZERO);
+
+#ifdef DEBUG
+ if (attr)
+ DEBUG_printf(("1_pwgGetPageSize: Found attribute %s (%s)", attr->name,
+ ippTagString(attr->value_tag)));
+ else
+ DEBUG_puts("1_pwgGetPageSize: Did not find media attribute.");
+#endif /* DEBUG */
+
+ if (attr && (attr->value_tag == IPP_TAG_NAME ||
+ attr->value_tag == IPP_TAG_KEYWORD))
+ ppd_name = attr->values[0].string.text;
+ }
+
+ DEBUG_printf(("1_pwgGetPageSize: ppd_name=\"%s\"", ppd_name));
+
+ if (ppd_name)
+ {
+ /*
+ * Try looking up the named PPD size first...
+ */
+
+ for (i = pwg->num_sizes, size = pwg->sizes; i > 0; i --, size ++)
+ {
+ DEBUG_printf(("2_pwgGetPageSize: size[%d]=[\"%s\" \"%s\"]",
+ (int)(size - pwg->sizes), size->map.pwg, size->map.ppd));
+
+ if (!strcasecmp(ppd_name, size->map.ppd))
+ {
+ if (exact)
+ *exact = 1;
+
+ DEBUG_printf(("1_pwgGetPageSize: Returning \"%s\"", ppd_name));
+
+ return (ppd_name);
+ }
+ }
+ }
+
if (job && !keyword)
{
/*
@@ -598,7 +1000,8 @@ _pwgGetPageSize(_pwg_t *pwg, /* I - PWG mapping data */
if ((media = _pwgMediaForPWG(keyword)) == NULL)
if ((media = _pwgMediaForLegacy(keyword)) == NULL)
- return (NULL);
+ if ((media = _pwgMediaForPPD(keyword)) == NULL)
+ return (NULL);
jobsize.width = media->width;
jobsize.length = media->length;
@@ -659,11 +1062,18 @@ _pwgGetPageSize(_pwg_t *pwg, /* I - PWG mapping data */
if (exact)
*exact = 1;
+ DEBUG_printf(("1_pwgGetPageSize: Returning \"%s\"", size->map.ppd));
+
return (size->map.ppd);
}
if (closest)
+ {
+ DEBUG_printf(("1_pwgGetPageSize: Returning \"%s\" (closest)",
+ closest->map.ppd));
+
return (closest->map.ppd);
+ }
/*
* If we get here we need to check for custom page size support...
@@ -695,6 +1105,9 @@ _pwgGetPageSize(_pwg_t *pwg, /* I - PWG mapping data */
else if (exact)
*exact = 1;
+ DEBUG_printf(("1_pwgGetPageSize: Returning \"%s\" (custom)",
+ pwg->custom_ppd_size));
+
return (pwg->custom_ppd_size);
}
@@ -702,6 +1115,8 @@ _pwgGetPageSize(_pwg_t *pwg, /* I - PWG mapping data */
* No custom page size support or the size is out of range - return NULL.
*/
+ DEBUG_puts("1_pwgGetPageSize: Returning NULL");
+
return (NULL);
}
@@ -1024,7 +1439,7 @@ pwg_ppdize_name(const char *ipp, /* I - IPP keyword */
for (ptr = name + 1, end = name + namesize - 1; *ipp && ptr < end;)
{
- if (*ipp == '-' && isalpha(ipp[1] & 255))
+ if (*ipp == '-' && _cups_isalpha(ipp[1]))
{
ipp ++;
*ptr++ = toupper(*ipp++ & 255);
@@ -1052,13 +1467,13 @@ pwg_unppdize_name(const char *ppd, /* I - PPD keyword */
for (ptr = name, end = name + namesize - 1; *ppd && ptr < end; ppd ++)
{
- if (isalnum(*ppd & 255) || *ppd == '-' || *ppd == '.')
+ if (_cups_isalnum(*ppd) || *ppd == '-')
*ptr++ = tolower(*ppd & 255);
- else if (*ppd == '_')
+ else if (*ppd == '_' || *ppd == '.')
*ptr++ = '-';
- if (!isupper(*ppd & 255) && isalnum(*ppd & 255) &&
- isupper(ppd[1] & 255) && ptr < end)
+ if (!_cups_isupper(*ppd) && _cups_isalnum(*ppd) &&
+ _cups_isupper(ppd[1]) && ptr < end)
*ptr++ = '-';
}
@@ -1067,5 +1482,5 @@ pwg_unppdize_name(const char *ppd, /* I - PPD keyword */
/*
- * End of "$Id: pwg-ppd.c 9120 2010-04-23 18:56:34Z mike $".
+ * End of "$Id: pwg-ppd.c 9328 2010-10-06 19:57:14Z mike $".
*/
diff --git a/cups/pwg-private.h b/cups/pwg-private.h
index 274238b8..e908d3d0 100644
--- a/cups/pwg-private.h
+++ b/cups/pwg-private.h
@@ -1,5 +1,5 @@
/*
- * "$Id: pwg-private.h 9120 2010-04-23 18:56:34Z mike $"
+ * "$Id: pwg-private.h 9212 2010-07-26 23:05:18Z mike $"
*
* Private PWG media API definitions for CUPS.
*
@@ -48,6 +48,21 @@ extern "C" {
* Types and structures...
*/
+typedef enum _pwg_output_mode_e /**** PWG output-mode indices ****/
+{
+ _PWG_OUTPUT_MODE_MONOCHROME = 0, /* output-mode=monochrome */
+ _PWG_OUTPUT_MODE_COLOR, /* output-mode=color */
+ _PWG_OUTPUT_MODE_MAX
+} _pwg_output_mode_t;
+
+typedef enum _pwg_print_quality_e /**** PWG print-quality indices ****/
+{
+ _PWG_PRINT_QUALITY_DRAFT = 0, /* print-quality=3 */
+ _PWG_PRINT_QUALITY_NORMAL, /* print-quality=4 */
+ _PWG_PRINT_QUALITY_HIGH, /* print-quality=5 */
+ _PWG_PRINT_QUALITY_MAX
+} _pwg_print_quality_t;
+
typedef struct _pwg_media_s /**** Common media size data ****/
{
const char *pwg, /* PWG 5101.1 "self describing" name */
@@ -88,10 +103,19 @@ typedef struct _pwg_s /**** PWG-PPD conversion data ****/
*custom_min_keyword, /* Minimum custom size PWG keyword */
custom_ppd_size[41]; /* Custom PPD size name */
_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 */
int num_types; /* Number of media types */
_pwg_map_t *types; /* Media types */
+ int num_presets[_PWG_OUTPUT_MODE_MAX][_PWG_PRINT_QUALITY_MAX];
+ /* Number of output-mode/print-quality options */
+ cups_option_t *presets[_PWG_OUTPUT_MODE_MAX][_PWG_PRINT_QUALITY_MAX];
+ /* output-mode/print-quality options */
+ char *sides_option, /* PPD option for sides */
+ *sides_1sided, /* Choice for one-sided */
+ *sides_2sided_long, /* Choice for two-sided-long-edge */
+ *sides_2sided_short; /* Choice for two-sided-short-edge */
} _pwg_t;
@@ -139,5 +163,5 @@ extern int _pwgWriteFile(_pwg_t *pwg, const char *filename);
#endif /* !_CUPS_PWG_PRIVATE_H_ */
/*
- * End of "$Id: pwg-private.h 9120 2010-04-23 18:56:34Z mike $".
+ * End of "$Id: pwg-private.h 9212 2010-07-26 23:05:18Z mike $".
*/
diff --git a/cups/raster.h b/cups/raster.h
index a28984bd..3ea1e5cd 100644
--- a/cups/raster.h
+++ b/cups/raster.h
@@ -1,9 +1,9 @@
/*
- * "$Id: raster.h 8179 2008-12-10 05:03:11Z mike $"
+ * "$Id: raster.h 9282 2010-08-31 15:56:40Z mike $"
*
- * Raster file definitions for the Common UNIX Printing System (CUPS).
+ * Raster file definitions for CUPS.
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* This file is part of the CUPS Imaging library.
@@ -84,26 +84,28 @@ typedef enum cups_bool_e /**** Boolean type ****/
typedef enum cups_cspace_e /**** cupsColorSpace attribute values ****/
{
- CUPS_CSPACE_W = 0, /* Luminance */
- CUPS_CSPACE_RGB = 1, /* Red, green, blue */
- CUPS_CSPACE_RGBA = 2, /* Red, green, blue, alpha */
- CUPS_CSPACE_K = 3, /* Black */
- CUPS_CSPACE_CMY = 4, /* Cyan, magenta, yellow */
- CUPS_CSPACE_YMC = 5, /* Yellow, magenta, cyan */
- CUPS_CSPACE_CMYK = 6, /* Cyan, magenta, yellow, black */
- CUPS_CSPACE_YMCK = 7, /* Yellow, magenta, cyan, black */
- CUPS_CSPACE_KCMY = 8, /* Black, cyan, magenta, yellow */
- CUPS_CSPACE_KCMYcm = 9, /* Black, cyan, magenta, yellow, *
- * light-cyan, light-magenta */
- CUPS_CSPACE_GMCK = 10, /* Gold, magenta, yellow, black */
- CUPS_CSPACE_GMCS = 11, /* Gold, magenta, yellow, silver */
- CUPS_CSPACE_WHITE = 12, /* White ink (as black) */
- CUPS_CSPACE_GOLD = 13, /* Gold foil */
- CUPS_CSPACE_SILVER = 14, /* Silver foil */
+ CUPS_CSPACE_W = 0, /* Luminance (DeviceGray, gamma 2.2 by default) */
+ CUPS_CSPACE_RGB = 1, /* Red, green, blue (DeviceRGB, sRGB by default) */
+ CUPS_CSPACE_RGBA = 2, /* Red, green, blue, alpha (DeviceRGB, sRGB by default) */
+ CUPS_CSPACE_K = 3, /* Black (DeviceK) */
+ CUPS_CSPACE_CMY = 4, /* Cyan, magenta, yellow (DeviceCMY) */
+ CUPS_CSPACE_YMC = 5, /* Yellow, magenta, cyan @deprecated@ */
+ CUPS_CSPACE_CMYK = 6, /* Cyan, magenta, yellow, black (DeviceCMYK) */
+ CUPS_CSPACE_YMCK = 7, /* Yellow, magenta, cyan, black @deprecated@ */
+ CUPS_CSPACE_KCMY = 8, /* Black, cyan, magenta, yellow @deprecated@ */
+ CUPS_CSPACE_KCMYcm = 9, /* Black, cyan, magenta, yellow, light-cyan, light-magenta @deprecated@ */
+ CUPS_CSPACE_GMCK = 10, /* Gold, magenta, yellow, black @deprecated@ */
+ CUPS_CSPACE_GMCS = 11, /* Gold, magenta, yellow, silver @deprecated@ */
+ CUPS_CSPACE_WHITE = 12, /* White ink (as black) @deprecated@ */
+ CUPS_CSPACE_GOLD = 13, /* Gold foil @deprecated@ */
+ CUPS_CSPACE_SILVER = 14, /* Silver foil @deprecated@ */
CUPS_CSPACE_CIEXYZ = 15, /* CIE XYZ @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_CIELab = 16, /* CIE Lab @since CUPS 1.1.19/Mac OS X 10.3@ */
- CUPS_CSPACE_RGBW = 17, /* Red, green, blue, white @since CUPS 1.2/Mac OS X 10.5@ */
+ CUPS_CSPACE_RGBW = 17, /* Red, green, blue, white (DeviceRGB, sRGB by default) @since CUPS 1.2/Mac OS X 10.5@ */
+ CUPS_CSPACE_SW = 18, /* Luminance (gamma 2.2) @since CUPS 1.4.5@ */
+ CUPS_CSPACE_SRGB = 19, /* Red, green, blue (sRGB) @since CUPS 1.4.5@ */
+ CUPS_CSPACE_ADOBERGB = 20, /* Red, green, blue (Adobe RGB) @since CUPS 1.4.5@ */
CUPS_CSPACE_ICC1 = 32, /* ICC-based, 1 color @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICC2 = 33, /* ICC-based, 2 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
@@ -119,7 +121,23 @@ typedef enum cups_cspace_e /**** cupsColorSpace attribute values ****/
CUPS_CSPACE_ICCC = 43, /* ICC-based, 12 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICCD = 44, /* ICC-based, 13 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICCE = 45, /* ICC-based, 14 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
- CUPS_CSPACE_ICCF = 46 /* ICC-based, 15 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICCF = 46, /* ICC-based, 15 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+
+ CUPS_CSPACE_DEVICE1 = 48, /* DeviceN, 1 color @since CUPS 1.4.5@ */
+ CUPS_CSPACE_DEVICE2 = 49, /* DeviceN, 2 colors @since CUPS 1.4.5@ */
+ CUPS_CSPACE_DEVICE3 = 50, /* DeviceN, 3 colors @since CUPS 1.4.5@ */
+ CUPS_CSPACE_DEVICE4 = 51, /* DeviceN, 4 colors @since CUPS 1.4.5@ */
+ CUPS_CSPACE_DEVICE5 = 52, /* DeviceN, 5 colors @since CUPS 1.4.5@ */
+ CUPS_CSPACE_DEVICE6 = 53, /* DeviceN, 6 colors @since CUPS 1.4.5@ */
+ CUPS_CSPACE_DEVICE7 = 54, /* DeviceN, 7 colors @since CUPS 1.4.5@ */
+ CUPS_CSPACE_DEVICE8 = 55, /* DeviceN, 8 colors @since CUPS 1.4.5@ */
+ CUPS_CSPACE_DEVICE9 = 56, /* DeviceN, 9 colors @since CUPS 1.4.5@ */
+ CUPS_CSPACE_DEVICEA = 57, /* DeviceN, 10 colors @since CUPS 1.4.5@ */
+ CUPS_CSPACE_DEVICEB = 58, /* DeviceN, 11 colors @since CUPS 1.4.5@ */
+ CUPS_CSPACE_DEVICEC = 59, /* DeviceN, 12 colors @since CUPS 1.4.5@ */
+ CUPS_CSPACE_DEVICED = 60, /* DeviceN, 13 colors @since CUPS 1.4.5@ */
+ CUPS_CSPACE_DEVICEE = 61, /* DeviceN, 14 colors @since CUPS 1.4.5@ */
+ CUPS_CSPACE_DEVICEF = 62 /* DeviceN, 15 colors @since CUPS 1.4.5@ */
} cups_cspace_t;
typedef enum cups_cut_e /**** CutMedia attribute values ****/
@@ -348,5 +366,5 @@ extern const char *cupsRasterErrorString(void) _CUPS_API_1_3;
#endif /* !_CUPS_RASTER_H_ */
/*
- * End of "$Id: raster.h 8179 2008-12-10 05:03:11Z mike $".
+ * End of "$Id: raster.h 9282 2010-08-31 15:56:40Z mike $".
*/
diff --git a/cups/request.c b/cups/request.c
index 1800e365..2ee139f7 100644
--- a/cups/request.c
+++ b/cups/request.c
@@ -1,5 +1,5 @@
/*
- * "$Id: request.c 9061 2010-03-30 22:07:33Z mike $"
+ * "$Id: request.c 9322 2010-10-01 22:40:38Z mike $"
*
* IPP utilities for the Common UNIX Printing System (CUPS).
*
@@ -884,10 +884,10 @@ _cupsSetHTTPError(http_status_t status) /* I - HTTP status code */
break;
case HTTP_UNAUTHORIZED :
- case HTTP_AUTHORIZATION_CANCELED :
- _cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status), 0);
+ _cupsSetError(IPP_NOT_AUTHENTICATED, httpStatus(status), 0);
break;
+ case HTTP_AUTHORIZATION_CANCELED :
case HTTP_FORBIDDEN :
_cupsSetError(IPP_FORBIDDEN, httpStatus(status), 0);
break;
@@ -918,5 +918,5 @@ _cupsSetHTTPError(http_status_t status) /* I - HTTP status code */
/*
- * End of "$Id: request.c 9061 2010-03-30 22:07:33Z mike $".
+ * End of "$Id: request.c 9322 2010-10-01 22:40:38Z mike $".
*/
diff --git a/cups/string.c b/cups/string.c
index 070af528..1dc03e9d 100644
--- a/cups/string.c
+++ b/cups/string.c
@@ -1,5 +1,5 @@
/*
- * "$Id: string.c 8532 2009-04-20 21:37:14Z mike $"
+ * "$Id: string.c 9261 2010-08-13 21:54:11Z mike $"
*
* String functions for the Common UNIX Printing System (CUPS).
*
@@ -41,6 +41,7 @@
#include <limits.h>
#include "array.h"
#include "debug.h"
+#define _CUPS_STRING_C_
#include "string.h"
#ifdef HAVE_PTHREAD_H
# include <pthread.h>
@@ -428,7 +429,7 @@ _cupsStrScand(const char *buf, /* I - Pointer to number */
* Skip leading whitespace...
*/
- while (isspace(*buf & 255))
+ while (_cups_isspace(*buf))
buf ++;
/*
@@ -789,5 +790,5 @@ compare_sp_items(_cups_sp_item_t *a, /* I - First item */
/*
- * End of "$Id: string.c 8532 2009-04-20 21:37:14Z mike $".
+ * End of "$Id: string.c 9261 2010-08-13 21:54:11Z mike $".
*/
diff --git a/cups/string.h b/cups/string.h
index 05489eb3..30dae2ea 100644
--- a/cups/string.h
+++ b/cups/string.h
@@ -1,5 +1,5 @@
/*
- * "$Id: string.h 9072 2010-04-03 17:03:06Z mike $"
+ * "$Id: string.h 9261 2010-08-13 21:54:11Z mike $"
*
* String definitions for CUPS.
*
@@ -80,6 +80,62 @@ typedef struct _cups_sp_item_s /**** String Pool Item ****/
/*
+ * Replacements for the ctype macros that are not affected by locale, since we
+ * really only care about testing for ASCII characters when parsing files, etc.
+ * These are used only within libcups since the rest of CUPS doesn't call
+ * setlocale() for LC_CTYPE and doesn't have to worry about third-party
+ * libraries doing so (and if they do that is a bug: NetSNMP, I'm looking at
+ * you!)
+ *
+ * The _CUPS_INLINE definition controls whether we get an inline function body,
+ * and external function body, or an external definition.
+ */
+
+# if defined(__GNUC__) || __STDC_VERSION__ >= 199901L
+# define _CUPS_INLINE static inline
+# elif defined(_MSC_VER)
+# define _CUPS_INLINE static __inline
+# elif defined(_CUPS_STRING_C_)
+# define _CUPS_INLINE
+# endif /* __GNUC__ || __STDC_VERSION__ */
+
+# ifdef _CUPS_INLINE
+_CUPS_INLINE int /* O - 1 on match, 0 otherwise */
+_cups_isalnum(int ch) /* I - Character to test */
+{
+ return ((ch >= '0' && ch <= '9') ||
+ (ch >= 'A' && ch <= 'Z') ||
+ (ch >= 'a' && ch <= 'z'));
+}
+
+_CUPS_INLINE int /* O - 1 on match, 0 otherwise */
+_cups_isalpha(int ch) /* I - Character to test */
+{
+ return ((ch >= 'A' && ch <= 'Z') ||
+ (ch >= 'a' && ch <= 'z'));
+}
+
+_CUPS_INLINE int /* O - 1 on match, 0 otherwise */
+_cups_isspace(int ch) /* I - Character to test */
+{
+ return (ch == ' ' || ch == '\f' || ch == '\n' || ch == '\r' || ch == '\t' ||
+ ch == '\v');
+}
+
+_CUPS_INLINE int /* O - 1 on match, 0 otherwise */
+_cups_isupper(int ch) /* I - Character to test */
+{
+ return (ch >= 'A' && ch <= 'Z');
+}
+# else
+extern int _cups_isalnum(int ch);
+extern int _cups_isalpha(int ch);
+extern int _cups_isspace(int ch);
+extern int _cups_isupper(int ch);
+# endif /* _CUPS_INLINE */
+
+
+/*
* Prototypes...
*/
@@ -156,5 +212,5 @@ extern double _cupsStrScand(const char *buf, char **bufptr,
#endif /* !_CUPS_STRING_H_ */
/*
- * End of "$Id: string.h 9072 2010-04-03 17:03:06Z mike $".
+ * End of "$Id: string.h 9261 2010-08-13 21:54:11Z mike $".
*/
diff --git a/cups/test.ppd b/cups/test.ppd
index 34c338d7..a09b9337 100644
--- a/cups/test.ppd
+++ b/cups/test.ppd
@@ -1,6 +1,6 @@
*PPD-Adobe: "4.3"
*%
-*% "$Id: test.ppd 9061 2010-03-30 22:07:33Z mike $"
+*% "$Id: test.ppd 9315 2010-09-24 02:42:51Z mike $"
*%
*% Test PPD file for CUPS.
*%
@@ -65,6 +65,9 @@
*PageSize Letter/US Letter: "PageSize=Letter"
*fr.PageSize Letter/French US Letter: ""
*fr_CA.PageSize Letter/French Canadian US Letter: ""
+*PageSize Letter.Banner/US Letter Banner: "PageSize=Letter.Banner"
+*fr.PageSize Letter.Banner/French US Letter Banner: ""
+*fr_CA.PageSize Letter.Banner/French Canadian US Letter Banner: ""
*PageSize Letter.Fullbleed/US Letter Borderless: "PageSize=Letter.Fullbleed"
*fr.PageSize Letter.Fullbleed/French US Letter Borderless: ""
*fr_CA.PageSize Letter.Fullbleed/French Canadian US Letter Borderless: ""
@@ -81,6 +84,7 @@
*OrderDependency: 10 AnySetup *PageRegion
*DefaultPageRegion: Letter
*PageRegion Letter/US Letter: "PageRegion=Letter"
+*PageRegion Letter.Banner/US Letter Banner: "PageRegion=Letter.Fullbleed"
*PageRegion Letter.Fullbleed/US Letter Borderless: "PageRegion=Letter.Fullbleed"
*PageRegion A4/A4: "PageRegion=A4"
*PageRegion Env10/#10 Envelope: "PageRegion=Env10"
@@ -88,24 +92,28 @@
*fr.Translation PageRegion/French Page Region: ""
*fr.PageRegion Letter/French US Letter: ""
+*fr.PageRegion Letter.Banner/French US Letter Banner: ""
*fr.PageRegion Letter.Fullbleed/French US Letter Borderless: ""
*fr.PageRegion A4/French A4: ""
*fr.PageRegion Env10/French #10 Envelope: ""
*fr_CA.Translation PageRegion/French Canadian Page Region: ""
*fr_CA.PageRegion Letter/French Canadian US Letter: ""
+*fr_CA.PageRegion Letter.Banner/French Canadian US Letter Banner: ""
*fr_CA.PageRegion Letter.Fullbleed/French Canadian US Letter Borderless: ""
*fr_CA.PageRegion A4/French Canadian A4: ""
*fr_CA.PageRegion Env10/French Canadian #10 Envelope: ""
*DefaultImageableArea: Letter
*ImageableArea Letter: "18 36 594 756"
+*ImageableArea Letter.Banner: "18 0 594 792"
*ImageableArea Letter.Fullbleed: "0 0 612 792"
*ImageableArea A4: "18 36 577 806"
*ImageableArea Env10: "18 36 279 648"
*DefaultPaperDimension: Letter
*PaperDimension Letter: "612 792"
+*PaperDimension Letter.Banner: "612 792"
*PaperDimension Letter.Fullbleed: "612 792"
*PaperDimension A4: "595 842"
*PaperDimension Env10: "297 684"
@@ -250,5 +258,5 @@ help:anchor='foo'%20bookID=Vendor%20Help
*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
*Font ZapfDingbats: Special "(001.004S)" Standard ROM
*%
-*% End of "$Id: test.ppd 9061 2010-03-30 22:07:33Z mike $".
+*% End of "$Id: test.ppd 9315 2010-09-24 02:42:51Z mike $".
*%
diff --git a/cups/testpwg.c b/cups/testpwg.c
index cfcc66d5..3c428ed6 100644
--- a/cups/testpwg.c
+++ b/cups/testpwg.c
@@ -1,5 +1,5 @@
/*
- * "$Id: testpwg.c 9061 2010-03-30 22:07:33Z mike $"
+ * "$Id: testpwg.c 9317 2010-09-24 18:21:54Z mike $"
*
* PWG test program for CUPS.
*
@@ -15,22 +15,26 @@
*
* Contents:
*
- * main() - Main entry.
- * test_pwg() - Test the PWG mapping functions.
+ * main() - Main entry.
+ * test_pagesize() - Test the PWG mapping functions.
+ * test_pwg() - Test the PWG mapping functions.
*/
/*
* Include necessary headers...
*/
-#include "pwg-private.h"
+#include "ppd-private.h"
+#include "file-private.h"
/*
* Local functions...
*/
-static int test_pwg(_pwg_t *pwg);
+static int test_pwg(_pwg_t *pwg, ppd_file_t *ppd);
+static int test_pagesize(_pwg_t *pwg, ppd_file_t *ppd,
+ const char *ppdsize);
/*
@@ -50,13 +54,13 @@ main(int argc, /* I - Number of command-line args */
status = 0;
- if (argc != 2)
+ if (argc < 2 || argc > 3)
{
- puts("Usage: ./testpwg filename.ppd");
+ puts("Usage: ./testpwg filename.ppd [jobfile]");
return (1);
}
- else
- ppdfile = argv[1];
+
+ ppdfile = argv[1];
printf("ppdOpenFile(%s): ", ppdfile);
if ((ppd = ppdOpenFile(ppdfile)) == NULL)
@@ -83,7 +87,59 @@ main(int argc, /* I - Number of command-line args */
else
{
puts("PASS");
- status += test_pwg(pwg);
+ status += test_pwg(pwg, ppd);
+
+ if (argc == 3)
+ {
+ /*
+ * Test PageSize mapping code.
+ */
+
+ int fd; /* Job file descriptor */
+ const char *pagesize; /* PageSize value */
+ ipp_t *job; /* Job attributes */
+ ipp_attribute_t *media; /* Media attribute */
+
+ if ((fd = open(argv[2], O_RDONLY)) >= 0)
+ {
+ job = ippNew();
+ ippReadFile(fd, job);
+ close(fd);
+
+ if ((media = ippFindAttribute(job, "media", IPP_TAG_ZERO)) != NULL &&
+ media->value_tag != IPP_TAG_NAME &&
+ media->value_tag != IPP_TAG_KEYWORD)
+ media = NULL;
+
+ if (media)
+ printf("_pwgGetPageSize(media=%s): ", media->values[0].string.text);
+ else
+ fputs("_pwgGetPageSize(media-col): ", stdout);
+
+ fflush(stdout);
+
+ if ((pagesize = _pwgGetPageSize(pwg, job, NULL, NULL)) == NULL)
+ {
+ puts("FAIL (Not Found)");
+ status = 1;
+ }
+ else if (media && strcasecmp(pagesize, media->values[0].string.text))
+ {
+ printf("FAIL (Got \"%s\", Expected \"%s\")\n", pagesize,
+ media->values[0].string.text);
+ status = 1;
+ }
+ else
+ printf("PASS (%s)\n", pagesize);
+
+ ippDelete(job);
+ }
+ else
+ {
+ perror(argv[2]);
+ status = 1;
+ }
+ }
/*
* _pwgDestroy should never fail...
@@ -94,6 +150,101 @@ main(int argc, /* I - Number of command-line args */
puts("PASS");
}
+ fputs("_pwgMediaForPWG(\"iso_a4_210x297mm\"): ", stdout);
+ if ((pwgmedia = _pwgMediaForPWG("iso_a4_210x297mm")) == NULL)
+ {
+ puts("FAIL (not found)");
+ status ++;
+ }
+ else if (strcmp(pwgmedia->pwg, "iso_a4_210x297mm"))
+ {
+ printf("FAIL (%s)\n", pwgmedia->pwg);
+ status ++;
+ }
+ else if (pwgmedia->width != 21000 || pwgmedia->length != 29700)
+ {
+ printf("FAIL (%dx%d)\n", pwgmedia->width, pwgmedia->length);
+ status ++;
+ }
+ else
+ puts("PASS");
+
+ fputs("_pwgMediaForLegacy(\"na-letter\"): ", stdout);
+ if ((pwgmedia = _pwgMediaForLegacy("na-letter")) == NULL)
+ {
+ puts("FAIL (not found)");
+ status ++;
+ }
+ else if (strcmp(pwgmedia->pwg, "na_letter_8.5x11in"))
+ {
+ printf("FAIL (%s)\n", pwgmedia->pwg);
+ status ++;
+ }
+ else if (pwgmedia->width != 21590 || pwgmedia->length != 27940)
+ {
+ printf("FAIL (%dx%d)\n", pwgmedia->width, pwgmedia->length);
+ status ++;
+ }
+ else
+ puts("PASS");
+
+ fputs("_pwgMediaForPPD(\"4x6\"): ", stdout);
+ if ((pwgmedia = _pwgMediaForPPD("4x6")) == NULL)
+ {
+ puts("FAIL (not found)");
+ status ++;
+ }
+ else if (strcmp(pwgmedia->pwg, "na_index-4x6_4x6in"))
+ {
+ printf("FAIL (%s)\n", pwgmedia->pwg);
+ status ++;
+ }
+ else if (pwgmedia->width != 10160 || pwgmedia->length != 15240)
+ {
+ printf("FAIL (%dx%d)\n", pwgmedia->width, pwgmedia->length);
+ status ++;
+ }
+ else
+ puts("PASS");
+
+ fputs("_pwgMediaForPPD(\"10x15cm\"): ", stdout);
+ if ((pwgmedia = _pwgMediaForPPD("10x15cm")) == NULL)
+ {
+ puts("FAIL (not found)");
+ status ++;
+ }
+ else if (strcmp(pwgmedia->pwg, "om_100x150mm_100x150mm"))
+ {
+ printf("FAIL (%s)\n", pwgmedia->pwg);
+ status ++;
+ }
+ else if (pwgmedia->width != 10000 || pwgmedia->length != 15000)
+ {
+ printf("FAIL (%dx%d)\n", pwgmedia->width, pwgmedia->length);
+ status ++;
+ }
+ else
+ puts("PASS");
+
+ fputs("_pwgMediaForPPD(\"Custom.10x15cm\"): ", stdout);
+ if ((pwgmedia = _pwgMediaForPPD("Custom.10x15cm")) == NULL)
+ {
+ puts("FAIL (not found)");
+ status ++;
+ }
+ else if (strcmp(pwgmedia->pwg, "custom_10x15cm_100x150mm"))
+ {
+ printf("FAIL (%s)\n", pwgmedia->pwg);
+ status ++;
+ }
+ else if (pwgmedia->width != 10000 || pwgmedia->length != 15000)
+ {
+ printf("FAIL (%dx%d)\n", pwgmedia->width, pwgmedia->length);
+ status ++;
+ }
+ else
+ puts("PASS");
+
fputs("_pwgMediaForSize(29700, 42000): ", stdout);
if ((pwgmedia = _pwgMediaForSize(29700, 42000)) == NULL)
{
@@ -113,11 +264,70 @@ main(int argc, /* I - Number of command-line args */
/*
+ * 'test_pagesize()' - Test the PWG mapping functions.
+ */
+
+static int /* O - 1 on failure, 0 on success */
+test_pagesize(_pwg_t *pwg, /* I - PWG mapping data */
+ ppd_file_t *ppd, /* I - PPD file */
+ const char *ppdsize) /* I - PPD page size */
+{
+ int status = 0; /* Return status */
+ ipp_t *job; /* Job attributes */
+ const char *pagesize; /* PageSize value */
+
+
+ if (ppdPageSize(ppd, ppdsize))
+ {
+ printf("_pwgGetPageSize(keyword=%s): ", ppdsize);
+ fflush(stdout);
+
+ if ((pagesize = _pwgGetPageSize(pwg, NULL, ppdsize, NULL)) == NULL)
+ {
+ puts("FAIL (Not Found)");
+ status = 1;
+ }
+ else if (strcasecmp(pagesize, ppdsize))
+ {
+ printf("FAIL (Got \"%s\", Expected \"%s\")\n", pagesize, ppdsize);
+ status = 1;
+ }
+ else
+ puts("PASS");
+
+ job = ippNew();
+ ippAddString(job, IPP_TAG_JOB, IPP_TAG_KEYWORD, "media", NULL, ppdsize);
+
+ printf("_pwgGetPageSize(media=%s): ", ppdsize);
+ fflush(stdout);
+
+ if ((pagesize = _pwgGetPageSize(pwg, job, NULL, NULL)) == NULL)
+ {
+ puts("FAIL (Not Found)");
+ status = 1;
+ }
+ else if (strcasecmp(pagesize, ppdsize))
+ {
+ printf("FAIL (Got \"%s\", Expected \"%s\")\n", pagesize, ppdsize);
+ status = 1;
+ }
+ else
+ puts("PASS");
+
+ ippDelete(job);
+ }
+
+ return (status);
+}
+
+
+/*
* 'test_pwg()' - Test the PWG mapping functions.
*/
static int /* O - 1 on failure, 0 on success */
-test_pwg(_pwg_t *pwg) /* I - PWG mapping data */
+test_pwg(_pwg_t *pwg, /* I - PWG mapping data */
+ ppd_file_t *ppd) /* I - PPD file */
{
int i, /* Looping var */
status = 0; /* Return status */
@@ -263,12 +473,23 @@ test_pwg(_pwg_t *pwg) /* I - PWG mapping data */
if (!status)
puts("PASS");
+
+ _pwgDestroy(pwg2);
}
+ /*
+ * Test PageSize mapping code...
+ */
+
+ status += test_pagesize(pwg, ppd, "Letter");
+ status += test_pagesize(pwg, ppd, "na-letter");
+ status += test_pagesize(pwg, ppd, "A4");
+ status += test_pagesize(pwg, ppd, "iso-a4");
+
return (status);
}
/*
- * End of "$Id: testpwg.c 9061 2010-03-30 22:07:33Z mike $".
+ * End of "$Id: testpwg.c 9317 2010-09-24 18:21:54Z mike $".
*/
diff --git a/doc/Makefile b/doc/Makefile
index 24cf5962..7e4e44c1 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,5 +1,5 @@
#
-# "$Id: Makefile 8841 2009-10-07 16:24:25Z mike $"
+# "$Id: Makefile 9259 2010-08-13 04:11:46Z mike $"
#
# Documentation makefile for the Common UNIX Printing System (CUPS).
#
@@ -28,6 +28,7 @@ WEBIMAGES = \
images/color-wheel.png \
images/cups.png \
images/cups-icon.png \
+ images/generic.png \
images/left.gif \
images/right.gif \
images/sel.gif \
@@ -69,7 +70,6 @@ HELPFILES = \
help/man-cupsenable.html \
help/man-cupstestdsc.html \
help/man-cupstestppd.html \
- help/man-drv.html \
help/man-filter.html \
help/man-lp.html \
help/man-lpadmin.html \
diff --git a/doc/help/api-filter.html b/doc/help/api-filter.html
index 21ed6697..4b0ff8fa 100644
--- a/doc/help/api-filter.html
+++ b/doc/help/api-filter.html
@@ -338,7 +338,7 @@ div.contents ul.subcontents li {
<body>
<div class='body'>
<!--
- "$Id: api-filter.html 9121 2010-04-23 18:57:00Z mike $"
+ "$Id: api-filter.html 9283 2010-08-31 18:07:49Z mike $"
Filter and backend programming header for the Common UNIX Printing System
(CUPS).
@@ -375,7 +375,7 @@ div.contents ul.subcontents li {
Programming: <a href='api-raster.html' target='_top'>Raster API</a><br>
Programming: <a href='postscript-driver.html' target='_top'>Developing PostScript Printer Drivers</a><br>
Programming: <a href='raster-driver.html' target='_top'>Developing Raster Printer Drivers</a><br>
- Specifications: <a href='spec-design' target='_top'>CUPS Design Description</a></td>
+ Specifications: <a href='spec-design.html' target='_top'>CUPS Design Description</a></td>
</tr>
</tbody>
</table></div>
@@ -421,7 +421,7 @@ div.contents ul.subcontents li {
<li><a href="#cups_sc_status_e" title="Response status codes">cups_sc_status_e</a></li>
</ul></li>
<!--
- "$Id: api-filter.html 9121 2010-04-23 18:57:00Z mike $"
+ "$Id: api-filter.html 9283 2010-08-31 18:07:49Z mike $"
Filter and backend programming introduction for the Common UNIX Printing
System (CUPS).
diff --git a/doc/help/api-httpipp.html b/doc/help/api-httpipp.html
index 19840091..715d71fe 100644
--- a/doc/help/api-httpipp.html
+++ b/doc/help/api-httpipp.html
@@ -338,7 +338,7 @@ div.contents ul.subcontents li {
<body>
<div class='body'>
<!--
- "$Id: api-httpipp.html 9121 2010-04-23 18:57:00Z mike $"
+ "$Id: api-httpipp.html 9283 2010-08-31 18:07:49Z mike $"
HTTP and IPP API header for the Common UNIX Printing System (CUPS).
@@ -588,7 +588,7 @@ are server-oriented...">http_state_e</a></li>
<li><a href="#ipp_tag_e" title="Format tags for attributes">ipp_tag_e</a></li>
</ul></li>
<!--
- "$Id: api-httpipp.html 9121 2010-04-23 18:57:00Z mike $"
+ "$Id: api-httpipp.html 9283 2010-08-31 18:07:49Z mike $"
HTTP and IPP API introduction for the Common UNIX Printing System (CUPS).
@@ -3647,7 +3647,7 @@ are server-oriented...</p>
<dt>HTTP_ACCEPTED </dt>
<dd class="description">DELETE command was successful</dd>
<dt>HTTP_AUTHORIZATION_CANCELED </dt>
-<dd class="description">User cancelled authorization</dd>
+<dd class="description">User canceled authorization</dd>
<dt>HTTP_BAD_GATEWAY </dt>
<dd class="description">Bad gateway</dd>
<dt>HTTP_BAD_REQUEST </dt>
diff --git a/doc/help/api-raster.html b/doc/help/api-raster.html
index 86438bf5..51263cb0 100644
--- a/doc/help/api-raster.html
+++ b/doc/help/api-raster.html
@@ -338,7 +338,7 @@ div.contents ul.subcontents li {
<body>
<div class='body'>
<!--
- "$Id: api-raster.html 8653 2009-05-16 23:53:28Z mike $"
+ "$Id: api-raster.html 9283 2010-08-31 18:07:49Z mike $"
Raster API header for the Common UNIX Printing System (CUPS).
@@ -429,7 +429,7 @@ page header structure.">cupsRasterWriteHeader2</a></li>
<li><a href="#cups_orient_e" title="Orientation attribute values">cups_orient_e</a></li>
</ul></li>
<!--
- "$Id: api-raster.html 8653 2009-05-16 23:53:28Z mike $"
+ "$Id: api-raster.html 9283 2010-08-31 18:07:49Z mike $"
Raster API introduction for the Common UNIX Printing System (CUPS).
@@ -1186,20 +1186,52 @@ factor not applied) </dd>
<p class="description">cupsColorSpace attribute values</p>
<h4 class="constants">Constants</h4>
<dl>
+<dt>CUPS_CSPACE_ADOBERGB <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">Red, green, blue (Adobe RGB) </dd>
<dt>CUPS_CSPACE_CIELab <span class="info">&nbsp;CUPS 1.1.19/Mac OS X 10.3&nbsp;</span></dt>
<dd class="description">CIE Lab </dd>
<dt>CUPS_CSPACE_CIEXYZ <span class="info">&nbsp;CUPS 1.1.19/Mac OS X 10.3&nbsp;</span></dt>
<dd class="description">CIE XYZ </dd>
<dt>CUPS_CSPACE_CMY </dt>
-<dd class="description">Cyan, magenta, yellow</dd>
+<dd class="description">Cyan, magenta, yellow (DeviceCMY)</dd>
<dt>CUPS_CSPACE_CMYK </dt>
-<dd class="description">Cyan, magenta, yellow, black</dd>
-<dt>CUPS_CSPACE_GMCK </dt>
-<dd class="description">Gold, magenta, yellow, black</dd>
-<dt>CUPS_CSPACE_GMCS </dt>
-<dd class="description">Gold, magenta, yellow, silver</dd>
-<dt>CUPS_CSPACE_GOLD </dt>
-<dd class="description">Gold foil</dd>
+<dd class="description">Cyan, magenta, yellow, black (DeviceCMYK)</dd>
+<dt>CUPS_CSPACE_DEVICE1 <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 1 color </dd>
+<dt>CUPS_CSPACE_DEVICE2 <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 2 colors </dd>
+<dt>CUPS_CSPACE_DEVICE3 <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 3 colors </dd>
+<dt>CUPS_CSPACE_DEVICE4 <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 4 colors </dd>
+<dt>CUPS_CSPACE_DEVICE5 <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 5 colors </dd>
+<dt>CUPS_CSPACE_DEVICE6 <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 6 colors </dd>
+<dt>CUPS_CSPACE_DEVICE7 <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 7 colors </dd>
+<dt>CUPS_CSPACE_DEVICE8 <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 8 colors </dd>
+<dt>CUPS_CSPACE_DEVICE9 <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 9 colors </dd>
+<dt>CUPS_CSPACE_DEVICEA <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 10 colors </dd>
+<dt>CUPS_CSPACE_DEVICEB <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 11 colors </dd>
+<dt>CUPS_CSPACE_DEVICEC <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 12 colors </dd>
+<dt>CUPS_CSPACE_DEVICED <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 13 colors </dd>
+<dt>CUPS_CSPACE_DEVICEE <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 14 colors </dd>
+<dt>CUPS_CSPACE_DEVICEF <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">DeviceN, 15 colors </dd>
+<dt>CUPS_CSPACE_GMCK <span class="info">&nbsp;DEPRECATED&nbsp;</span></dt>
+<dd class="description">Gold, magenta, yellow, black </dd>
+<dt>CUPS_CSPACE_GMCS <span class="info">&nbsp;DEPRECATED&nbsp;</span></dt>
+<dd class="description">Gold, magenta, yellow, silver </dd>
+<dt>CUPS_CSPACE_GOLD <span class="info">&nbsp;DEPRECATED&nbsp;</span></dt>
+<dd class="description">Gold foil </dd>
<dt>CUPS_CSPACE_ICC1 <span class="info">&nbsp;CUPS 1.1.19/Mac OS X 10.3&nbsp;</span></dt>
<dd class="description">ICC-based, 1 color </dd>
<dt>CUPS_CSPACE_ICC2 <span class="info">&nbsp;CUPS 1.1.19/Mac OS X 10.3&nbsp;</span></dt>
@@ -1231,28 +1263,31 @@ factor not applied) </dd>
<dt>CUPS_CSPACE_ICCF <span class="info">&nbsp;CUPS 1.1.19/Mac OS X 10.3&nbsp;</span></dt>
<dd class="description">ICC-based, 15 colors </dd>
<dt>CUPS_CSPACE_K </dt>
-<dd class="description">Black</dd>
-<dt>CUPS_CSPACE_KCMY </dt>
-<dd class="description">Black, cyan, magenta, yellow</dd>
-<dt>CUPS_CSPACE_KCMYcm </dt>
-<dd class="description">Black, cyan, magenta, yellow, *
-light-cyan, light-magenta</dd>
+<dd class="description">Black (DeviceK)</dd>
+<dt>CUPS_CSPACE_KCMY <span class="info">&nbsp;DEPRECATED&nbsp;</span></dt>
+<dd class="description">Black, cyan, magenta, yellow </dd>
+<dt>CUPS_CSPACE_KCMYcm <span class="info">&nbsp;DEPRECATED&nbsp;</span></dt>
+<dd class="description">Black, cyan, magenta, yellow, light-cyan, light-magenta </dd>
<dt>CUPS_CSPACE_RGB </dt>
-<dd class="description">Red, green, blue</dd>
+<dd class="description">Red, green, blue (DeviceRGB, sRGB by default)</dd>
<dt>CUPS_CSPACE_RGBA </dt>
-<dd class="description">Red, green, blue, alpha</dd>
+<dd class="description">Red, green, blue, alpha (DeviceRGB, sRGB by default)</dd>
<dt>CUPS_CSPACE_RGBW <span class="info">&nbsp;CUPS 1.2/Mac OS X 10.5&nbsp;</span></dt>
-<dd class="description">Red, green, blue, white </dd>
-<dt>CUPS_CSPACE_SILVER </dt>
-<dd class="description">Silver foil</dd>
+<dd class="description">Red, green, blue, white (DeviceRGB, sRGB by default) </dd>
+<dt>CUPS_CSPACE_SILVER <span class="info">&nbsp;DEPRECATED&nbsp;</span></dt>
+<dd class="description">Silver foil </dd>
+<dt>CUPS_CSPACE_SRGB <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">Red, green, blue (sRGB) </dd>
+<dt>CUPS_CSPACE_SW <span class="info">&nbsp;CUPS 1.4.5&nbsp;</span></dt>
+<dd class="description">Luminance (gamma 2.2) </dd>
<dt>CUPS_CSPACE_W </dt>
-<dd class="description">Luminance</dd>
-<dt>CUPS_CSPACE_WHITE </dt>
-<dd class="description">White ink (as black)</dd>
-<dt>CUPS_CSPACE_YMC </dt>
-<dd class="description">Yellow, magenta, cyan</dd>
-<dt>CUPS_CSPACE_YMCK </dt>
-<dd class="description">Yellow, magenta, cyan, black</dd>
+<dd class="description">Luminance (DeviceGray, gamma 2.2 by default)</dd>
+<dt>CUPS_CSPACE_WHITE <span class="info">&nbsp;DEPRECATED&nbsp;</span></dt>
+<dd class="description">White ink (as black) </dd>
+<dt>CUPS_CSPACE_YMC <span class="info">&nbsp;DEPRECATED&nbsp;</span></dt>
+<dd class="description">Yellow, magenta, cyan </dd>
+<dt>CUPS_CSPACE_YMCK <span class="info">&nbsp;DEPRECATED&nbsp;</span></dt>
+<dd class="description">Yellow, magenta, cyan, black </dd>
</dl>
<h3 class="enumeration"><a name="cups_cut_e">cups_cut_e</a></h3>
<p class="description">CutMedia attribute values</p>
diff --git a/doc/help/ref-cupsd-conf.html.in b/doc/help/ref-cupsd-conf.html.in
index 4f1089a1..a35ca4af 100644
--- a/doc/help/ref-cupsd-conf.html.in
+++ b/doc/help/ref-cupsd-conf.html.in
@@ -2931,23 +2931,23 @@ SetEnv MY_ENV_VAR foo
variable that should be passed to child processes.</P>
-<H2 CLASS="title"><A NAME="SSLOptions">SSLOptions</A></H2>
+<H2 CLASS="title"><A NAME="SSLListen">SSLListen</A></H2>
<H3>Examples</H3>
<PRE CLASS="command">
-SSLOptions 127.0.0.1:443
-SSLOptions 192.0.2.1:443
+SSLListen 127.0.0.1:443
+SSLListen 192.0.2.1:443
</PRE>
<H3>Description</H3>
-<P>The <CODE>SSLOptions</CODE> directive specifies a network
+<P>The <CODE>SSLListen</CODE> directive specifies a network
address and port to listen for secure connections. Multiple
-<CODE>SSLOptions</CODE> directives can be provided to listen on
+<CODE>SSLListen</CODE> directives can be provided to listen on
multiple addresses.</P>
-<P>The <CODE>SSLOptions</CODE> directive is similar to the <A
+<P>The <CODE>SSLListen</CODE> directive is similar to the <A
HREF="#SSLPort"><CODE>SSLPort</CODE></A> directive but allows you
to restrict access to specific interfaces or networks.</P>
diff --git a/doc/help/spec-ppd.html b/doc/help/spec-ppd.html
index bc308fe7..8d400575 100644
--- a/doc/help/spec-ppd.html
+++ b/doc/help/spec-ppd.html
@@ -8,11 +8,11 @@
</head>
<body>
<!--
- "$Id: spec-ppd.html 9143 2010-05-21 15:36:30Z mike $"
+ "$Id: spec-ppd.html 9170 2010-06-22 03:06:13Z mike $"
- CUPS PPD extensions specification for the Common UNIX Printing System (CUPS).
+ CUPS PPD extensions specification for CUPS.
- Copyright 2007-2009 by Apple Inc.
+ Copyright 2007-2010 by Apple Inc.
Copyright 1997-2007 by Easy Software Products.
These coded instructions, statements, and computer programs are the
@@ -1566,6 +1566,31 @@ before the filter that accepts the given MIME type.</p>
*cupsPreFilter: "image/png 0 mypngprefilter"
</pre>
+
+<h3><span class='info'>CUPS 1.5</span><a name='cupsPrintQuality'>cupsPrintQuality</a></h3>
+
+<p class='summary'>*cupsPrintQuality keyword/text: "code"</p>
+
+<p>This UI keyword defines standard print qualities that directly map from the IPP "print-quality" job template attribute. Standard keyword values are "Draft", "Normal", and "High" which are mapped from the IPP "print-quality" values 3, 4, and 5 respectively. Each <code>cupsPrintQuality</code> option typically sets output mode and resolution parameters in the page device dictionary, eliminating the need for separate (and sometimes confusing) output mode and resolution options.</p>
+
+<blockquote><b>Note:</b>
+
+<p>Unlike all of the other keywords defined in this document, <code>cupsPrintQuality</code> is a UI keyword that MUST be enclosed inside the PPD <code>OpenUI</code> and <code>CloseUI</code> keywords.</p>
+
+</blockquote>
+
+<p>Examples:</p>
+
+<pre class='command'>
+*OpenUI *cupsPrintQuality/Print Quality: PickOne
+*OrderDependency: 10 AnySetup *cupsPrintQuality
+*DefaultcupsPrintQuality: Normal
+*cupsPrintQuality Draft/Draft: "code"
+*cupsPrintQuality Normal/Normal: "code"
+*cupsPrintQuality High/Photo: "code"
+*CloseUI: *cupsPrintQuality
+</pre>
+
<h3><span class='info'>CUPS 1.4/Mac OS X 10.6</span><a name='cupsSNMPSupplies'>cupsSNMPSupplies</a></h3>
<p class='summary'>*cupsSNMPSupplies: boolean</p>
@@ -1775,39 +1800,51 @@ Technical Note TN2144</a> for more information.</p>
in the print dialog of applications (such as iPhoto) that set the job
style hint to <tt>NSPrintPhotoJobStyleHint</tt>. Each preset maps to one or
more pairs of PPD options and choices as well as providing key/value data for
-the application. The following preset names are currently defined:</p>
+the application. The following standard preset names are currently defined:</p>
<ul>
- <li><code>Photo_with_Paper_Auto-Detect</code>; Photo printing
- with paper auto-detect</li>
+ <li><code>General_with_Paper_Auto-Detect</code>; Normal quality general printing with auto-detected media.</li>
+
+ <li><code>General_with_Paper_Auto-Detect_-_Draft</code>; Draft quality general printing with auto-detected media.</li>
+
+ <li><code>General_on_Plain_Paper</code>; Normal quality general printing on plain paper.</li>
+
+ <li><code>General_on_Plain_Paper_-_Draft</code>; Draft quality general printing on plain paper.</li>
- <li><code>Photo_with_Paper_Auto-Detect_-_Fine</code>; Photo printing
- with paper auto-detect - fine</li>
+ <li><code>Photo_with_Paper_Auto-Detect</code>; Normal quality photo printing with auto-detected media.</li>
- <li><code>Photo_on_Plain_Paper</code>; Photo printing on plain paper</li>
+ <li><code>Photo_with_Paper_Auto-Detect_-_Fine</code>; High quality photo printing with auto-detected media.</li>
- <li><code>Photo_on_Plain_Paper_-_Fine</code>; Photo printing on plain
- paper - fine</li>
+ <li><code>Photo_on_Plain_Paper</code>; Normal quality photo printing on plain paper.</li>
- <li><code>Photo_on_Photo_Paper</code>; Photo printing on photo paper</li>
+ <li><code>Photo_on_Plain_Paper_-_Fine</code>; High quality photo printing on plain paper.</li>
- <li><code>Photo_on_Photo_Paper_-_Fine</code>; Photo printing on photo
- paper - fine</li>
+ <li><code>Photo_on_Photo_Paper</code>; Normal quality photo printing on glossy photo paper.</li>
- <li><code>Photo_on_Matte_Paper</code>; Photo printing on matte paper</li>
+ <li><code>Photo_on_Photo_Paper_-_Fine</code>; High quality photo printing on glossy photo paper.</li>
- <li><code>Photo_on_Matte_Paper_-_Fine</code>; Photo printing on matte
- paper - fine</li>
+ <li><code>Photo_on_Matte_Paper</code>; Normal quality photo printing on matte paper.</li>
+
+ <li><code>Photo_on_Matte_Paper_-_Fine</code>; High quality photo printing on matte paper.</li>
</ul>
<p>The value string consists of pairs of keywords, either an option name and
choice (*MainKeyword OptionKeyword) or a preset identifier and value
-(com.apple.print.preset.foo value). Preset identifiers and their supported
-values are documented in "<a
-href='http://developer.apple.com/mac/library/documentation/Printing/Conceptual/PresetDraft/presets_intro/presets_intro.html'
->Creating Printing Presets for iPhoto: Printing Presets File Format</a>".</p>
+(com.apple.print.preset.foo value). The following preset identifiers are currently used:</p>
+
+<ul>
+
+ <li><code>com.apple.print.preset.graphicsType</code>; specifies the type of printing used for this printing - "General" for general purpose printing and "Photo" for photo printing.</li>
+
+ <li><code>com.apple.print.preset.media-front-coating</code>; specifies the media type selected by this preset - "none" (plain paper), "glossy", "high-gloss", "semi-gloss", "satin", "matte", and "autodetect".</li>
+
+ <li><code>com.apple.print.preset.output-mode</code>; specifies the output mode for this preset - "color" (default for color printers) or "monochrome" (grayscale, default for B&amp;W printers).</li>
+
+ <li><code>com.apple.print.preset.quality</code>; specifies the overall print quality selected by this preset - "low" (draft), "mid" (normal), or "high".</li>
+
+</ul>
<p>Presets, like options, can also be localized in multiple languages.</p>
@@ -1871,6 +1908,17 @@ the device.</p>
<h2 class='title'><a name='HISTORY'>Change History</a></h2>
+<h3>Changes in CUPS 1.4.5</h3>
+
+<ul>
+
+ <li>Added <a href='#cupsPrintQuality'><tt>cupsPrintQuality</tt></a> UI keyword.</li>
+
+ <li>Added new properties and values for the <a href='#APPrinterPreset'><tt>APPrinterPreset</tt></a> keyword.</li>
+
+</ul>
+
+
<h3>Changes in CUPS 1.4</h3>
<ul>
diff --git a/doc/images/generic.png b/doc/images/generic.png
new file mode 100644
index 00000000..2abe9de9
--- /dev/null
+++ b/doc/images/generic.png
Binary files differ
diff --git a/filter/imagetoraster.c b/filter/imagetoraster.c
index 406b3da4..39fd50df 100644
--- a/filter/imagetoraster.c
+++ b/filter/imagetoraster.c
@@ -1,5 +1,5 @@
/*
- * "$Id: imagetoraster.c 8700 2009-06-05 21:38:52Z mike $"
+ * "$Id: imagetoraster.c 9282 2010-08-31 15:56:40Z mike $"
*
* Image file to raster filter for the Common UNIX Printing System (CUPS).
*
@@ -481,6 +481,7 @@ main(int argc, /* I - Number of command-line arguments */
switch (header.cupsColorSpace)
{
case CUPS_CSPACE_W :
+ case CUPS_CSPACE_SW :
if (header.cupsBitsPerColor >= 8)
{
primary = CUPS_IMAGE_WHITE;
@@ -493,10 +494,11 @@ main(int argc, /* I - Number of command-line arguments */
}
break;
- default :
case CUPS_CSPACE_RGB :
case CUPS_CSPACE_RGBA :
case CUPS_CSPACE_RGBW :
+ case CUPS_CSPACE_SRGB :
+ case CUPS_CSPACE_ADOBERGB :
if (header.cupsBitsPerColor >= 8)
{
primary = CUPS_IMAGE_RGB;
@@ -540,6 +542,42 @@ main(int argc, /* I - Number of command-line arguments */
primary = CUPS_IMAGE_CMY;
secondary = CUPS_IMAGE_CMY;
break;
+
+ case CUPS_CSPACE_CIEXYZ :
+ case CUPS_CSPACE_CIELab :
+ case CUPS_CSPACE_ICC1 :
+ case CUPS_CSPACE_ICC2 :
+ case CUPS_CSPACE_ICC3 :
+ case CUPS_CSPACE_ICC4 :
+ case CUPS_CSPACE_ICC5 :
+ case CUPS_CSPACE_ICC6 :
+ case CUPS_CSPACE_ICC7 :
+ case CUPS_CSPACE_ICC8 :
+ case CUPS_CSPACE_ICC9 :
+ case CUPS_CSPACE_ICCA :
+ case CUPS_CSPACE_ICCB :
+ case CUPS_CSPACE_ICCC :
+ case CUPS_CSPACE_ICCD :
+ case CUPS_CSPACE_ICCE :
+ case CUPS_CSPACE_ICCF :
+ case CUPS_CSPACE_DEVICE1 :
+ case CUPS_CSPACE_DEVICE2 :
+ case CUPS_CSPACE_DEVICE3 :
+ case CUPS_CSPACE_DEVICE4 :
+ case CUPS_CSPACE_DEVICE5 :
+ case CUPS_CSPACE_DEVICE6 :
+ case CUPS_CSPACE_DEVICE7 :
+ case CUPS_CSPACE_DEVICE8 :
+ case CUPS_CSPACE_DEVICE9 :
+ case CUPS_CSPACE_DEVICEA :
+ case CUPS_CSPACE_DEVICEB :
+ case CUPS_CSPACE_DEVICEC :
+ case CUPS_CSPACE_DEVICED :
+ case CUPS_CSPACE_DEVICEE :
+ case CUPS_CSPACE_DEVICEF :
+ fprintf(stderr, "ERROR: Colorspace %d not supported.\n",
+ header.cupsColorSpace);
+ exit(1);
break;
}
@@ -4313,5 +4351,5 @@ raster_cb(
/*
- * End of "$Id: imagetoraster.c 8700 2009-06-05 21:38:52Z mike $".
+ * End of "$Id: imagetoraster.c 9282 2010-08-31 15:56:40Z mike $".
*/
diff --git a/filter/pstops.c b/filter/pstops.c
index 696465c4..82520ce5 100644
--- a/filter/pstops.c
+++ b/filter/pstops.c
@@ -1,5 +1,5 @@
/*
- * "$Id: pstops.c 9061 2010-03-30 22:07:33Z mike $"
+ * "$Id: pstops.c 9286 2010-08-31 18:36:08Z mike $"
*
* PostScript filter for the Common UNIX Printing System (CUPS).
*
@@ -2393,6 +2393,7 @@ set_pstops_options(
ppd_attr_t *attr; /* PPD attribute */
ppd_option_t *option; /* PPD option */
ppd_choice_t *choice; /* PPD choice */
+ const char *content_type; /* Original content type */
/*
@@ -2420,6 +2421,18 @@ set_pstops_options(
doc->new_bounding_box[3] = INT_MIN;
/*
+ * See what the source content type is. When printing PostScript content we
+ * want to do scaling and orientation, but otherwise we don't want to change
+ * anything...
+ */
+
+ if ((content_type = getenv("CONTENT_TYPE")) == NULL)
+ content_type = "application/postscript";
+
+ if (!strcasecmp(content_type, "application/postscript"))
+ Orientation = 0;
+
+ /*
* AP_FIRSTPAGE_* and the corresponding non-first-page options.
*/
@@ -2449,7 +2462,6 @@ set_pstops_options(
if ((choice = ppdFindMarkedChoice(ppd, "PageSize")) != NULL)
doc->page_size = choice->choice;
-
/*
* brightness
*/
@@ -2509,15 +2521,24 @@ set_pstops_options(
doc->emit_jcl = 1;
/*
- * fitplot/fit-to-page
+ * fitplot/fit-to-page/ipp-attribute-fidelity
+ *
+ * (Only for original PostScript content)
*/
- if ((val = cupsGetOption("fitplot", num_options, options)) != NULL &&
- !strcasecmp(val, "true"))
- doc->fitplot = 1;
- else if ((val = cupsGetOption("fit-to-page", num_options, options)) != NULL &&
- !strcasecmp(val, "true"))
- doc->fitplot = 1;
+ if (!strcasecmp(content_type, "application/postscript"))
+ {
+ if ((val = cupsGetOption("fitplot", num_options, options)) != NULL &&
+ !strcasecmp(val, "true"))
+ doc->fitplot = 1;
+ else if ((val = cupsGetOption("fit-to-page", num_options, options)) != NULL &&
+ !strcasecmp(val, "true"))
+ doc->fitplot = 1;
+ else if ((val = cupsGetOption("ipp-attribute-fidelity", num_options,
+ options)) != NULL &&
+ !strcasecmp(val, "true"))
+ doc->fitplot = 1;
+ }
/*
* gamma
@@ -3511,5 +3532,5 @@ write_options(
/*
- * End of "$Id: pstops.c 9061 2010-03-30 22:07:33Z mike $".
+ * End of "$Id: pstops.c 9286 2010-08-31 18:36:08Z mike $".
*/
diff --git a/filter/raster.c b/filter/raster.c
index c19db725..c3106318 100644
--- a/filter/raster.c
+++ b/filter/raster.c
@@ -1,9 +1,9 @@
/*
- * "$Id: raster.c 7720 2008-07-11 22:46:21Z mike $"
+ * "$Id: raster.c 9282 2010-08-31 15:56:40Z mike $"
*
- * Raster file routines for the Common UNIX Printing System (CUPS).
+ * Raster file routines for CUPS.
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* This file is part of the CUPS Imaging library.
@@ -920,6 +920,7 @@ cups_raster_update(cups_raster_t *r) /* I - Raster stream */
case CUPS_CSPACE_WHITE :
case CUPS_CSPACE_GOLD :
case CUPS_CSPACE_SILVER :
+ case CUPS_CSPACE_SW :
r->header.cupsNumColors = 1;
break;
@@ -928,6 +929,8 @@ cups_raster_update(cups_raster_t *r) /* I - Raster stream */
case CUPS_CSPACE_YMC :
case CUPS_CSPACE_CIEXYZ :
case CUPS_CSPACE_CIELab :
+ case CUPS_CSPACE_SRGB :
+ case CUPS_CSPACE_ADOBERGB :
case CUPS_CSPACE_ICC1 :
case CUPS_CSPACE_ICC2 :
case CUPS_CSPACE_ICC3 :
@@ -962,6 +965,25 @@ cups_raster_update(cups_raster_t *r) /* I - Raster stream */
else
r->header.cupsNumColors = 4;
break;
+
+ case CUPS_CSPACE_DEVICE1 :
+ case CUPS_CSPACE_DEVICE2 :
+ case CUPS_CSPACE_DEVICE3 :
+ case CUPS_CSPACE_DEVICE4 :
+ case CUPS_CSPACE_DEVICE5 :
+ case CUPS_CSPACE_DEVICE6 :
+ case CUPS_CSPACE_DEVICE7 :
+ case CUPS_CSPACE_DEVICE8 :
+ case CUPS_CSPACE_DEVICE9 :
+ case CUPS_CSPACE_DEVICEA :
+ case CUPS_CSPACE_DEVICEB :
+ case CUPS_CSPACE_DEVICEC :
+ case CUPS_CSPACE_DEVICED :
+ case CUPS_CSPACE_DEVICEE :
+ case CUPS_CSPACE_DEVICEF :
+ r->header.cupsNumColors = r->header.cupsColorSpace -
+ CUPS_CSPACE_DEVICE1 + 1;
+ break;
}
}
@@ -1199,5 +1221,5 @@ cups_write(int fd, /* I - File descriptor */
/*
- * End of "$Id: raster.c 7720 2008-07-11 22:46:21Z mike $".
+ * End of "$Id: raster.c 9282 2010-08-31 15:56:40Z mike $".
*/
diff --git a/init/cups.xml.in b/init/cups.xml.in
index 398e8e83..2c03ce9a 100644
--- a/init/cups.xml.in
+++ b/init/cups.xml.in
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
- $Id: cups.xml.in 7818 2008-07-31 17:16:48Z mike $
+ $Id: cups.xml.in 9198 2010-07-08 17:24:14Z mike $
Service manifest for CUPS.
@@ -116,6 +116,10 @@
type='service'
version='1'>
+ <restarter>
+ <service_fmri value='svc:/network/inetd:default' />
+ </restarter>
+
<dependency
name='filesystem_minimal'
grouping='require_all'
@@ -155,10 +159,6 @@
timeout_seconds='60' />
<instance name='default' enabled='false' >
- <restarter>
- <service_fmri value='svc:/network/inetd:default' />
- </restarter>
-
<dependency
name='cupsd'
grouping='require_all'
diff --git a/man/Makefile b/man/Makefile
index 7b7840ec..41f0dd9b 100644
--- a/man/Makefile
+++ b/man/Makefile
@@ -1,5 +1,5 @@
#
-# "$Id: Makefile 8627 2009-05-13 21:39:17Z mike $"
+# "$Id: Makefile 9181 2010-06-22 21:42:44Z mike $"
#
# Man page makefile for the Common UNIX Printing System (CUPS).
#
@@ -47,7 +47,6 @@ MAN5 = classes.conf.$(MAN5EXT) \
printers.conf.$(MAN5EXT) \
subscriptions.conf.$(MAN5EXT)
MAN7 = backend.$(MAN7EXT) \
- drv.$(MAN7EXT) \
filter.$(MAN7EXT) \
notifier.$(MAN7EXT)
MAN8 = cupsaccept.$(MAN8EXT) \
@@ -231,5 +230,5 @@ mantohtml: mantohtml.o
#
-# End of "$Id: Makefile 8627 2009-05-13 21:39:17Z mike $".
+# End of "$Id: Makefile 9181 2010-06-22 21:42:44Z mike $".
#
diff --git a/man/drv.man.in b/man/drv.man.in
deleted file mode 100644
index 00e3f432..00000000
--- a/man/drv.man.in
+++ /dev/null
@@ -1,40 +0,0 @@
-.\"
-.\" "$Id: drv.man.in 8421 2009-03-09 21:59:55Z mike $"
-.\"
-.\" drv man page for the Common UNIX Printing System.
-.\"
-.\" Copyright 2008-2009 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/".
-.\"
-.TH drv 1 "CUPS" "9 March 2009" "Apple Inc."
-.SH NAME
-drv \- cups driver interface for ppd compiler files
-.SH SYNOPSIS
-.B drv list
-.br
-.B drv cat
-.I drv:///filename.drv/pcfilename
-.SH DESCRIPTION
-\fIdrv\fR lists and compiles PPDC source files installed in the
-@CUPS_DATADIR@/drv and (on Mac OS X) /Library/Printers/PPDs/Contents/Resources
-directories on behalf of the scheduler, \fIcupsd(8)\fR.
-.PP
-The first form of the command lists all of the PPD files that can be produced
-by the driver information files in the two directories.
-.PP
-The second form of the command compiles the requested PPD and sends it to the
-standard output.
-.SH SEE ALSO
-ppdc(1), ppdhtml(1), ppdi(1), ppdmerge(1), ppdpo(1), ppdcfile(5)
-.br
-http://localhost:631/help
-.SH COPYRIGHT
-Copyright 2008-2009 by Apple Inc.
-.\"
-.\" End of "$Id: drv.man.in 8421 2009-03-09 21:59:55Z mike $".
-.\"
diff --git a/man/lp.man b/man/lp.man
index 8b6e600d..2af1652b 100644
--- a/man/lp.man
+++ b/man/lp.man
@@ -1,9 +1,9 @@
.\"
-.\" "$Id: lp.man 8421 2009-03-09 21:59:55Z mike $"
+.\" "$Id: lp.man 9282 2010-08-31 15:56:40Z mike $"
.\"
.\" lp man page for the Common UNIX Printing System (CUPS).
.\"
-.\" Copyright 2007-2009 by Apple Inc.
+.\" Copyright 2007-2010 by Apple Inc.
.\" Copyright 1997-2006 by Easy Software Products.
.\"
.\" These coded instructions, statements, and computer programs are the
@@ -12,7 +12,7 @@
.\" 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/".
.\"
-.TH lp 1 "CUPS" "17 November 2008" "Apple Inc."
+.TH lp 1 "CUPS" "31 August 2010" "Apple Inc."
.SH NAME
lp - print files
.SH SYNOPSIS
@@ -157,7 +157,6 @@ contain a list of numbers and ranges (#-#) separated by commas
(e.g. 1,3-5,16). The page numbers refer to the output pages and
not the document's original pages - options like "number-up" can
affect the numbering of the pages.
-that are
.SH COMMON JOB OPTIONS
Aside from the printer-specific options reported by the
\fIlpoptions(1)\fR command, the following generic options are
@@ -258,7 +257,7 @@ is highest priority).
.br
http://localhost:631/help
.SH COPYRIGHT
-Copyright 2007-2009 by Apple Inc.
+Copyright 2007-2010 by Apple Inc.
.\"
-.\" End of "$Id: lp.man 8421 2009-03-09 21:59:55Z mike $".
+.\" End of "$Id: lp.man 9282 2010-08-31 15:56:40Z mike $".
.\"
diff --git a/man/lpadmin.man b/man/lpadmin.man
index 37084bc6..f05108ac 100644
--- a/man/lpadmin.man
+++ b/man/lpadmin.man
@@ -1,9 +1,9 @@
.\"
-.\" "$Id: lpadmin.man 8421 2009-03-09 21:59:55Z mike $"
+.\" "$Id: lpadmin.man 9291 2010-09-01 15:51:59Z mike $"
.\"
.\" lpadmin man page for the Common UNIX Printing System (CUPS).
.\"
-.\" Copyright 2007-2009 by Apple Inc.
+.\" Copyright 2007-2010 by Apple Inc.
.\" Copyright 1997-2006 by Easy Software Products.
.\"
.\" These coded instructions, statements, and computer programs are the
@@ -12,7 +12,7 @@
.\" 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/".
.\"
-.TH lpadmin 8 "CUPS" "3 November 2008" "Apple Inc."
+.TH lpadmin 8 "CUPS" "1 September 2010" "Apple Inc."
.SH NAME
lpadmin \- configure cups printers and classes
.SH SYNOPSIS
@@ -30,7 +30,7 @@ lpadmin \- configure cups printers and classes
] [ -h
.I server[:port]
] -p
-.I printer option(s)
+.I destination option(s)
.br
.B lpadmin
[ -E ] [-U
@@ -55,7 +55,7 @@ destination unless the user specifies otherwise with the
\fIlpoptions(1)\fR command.
.LP
The second form of the command (\fI-p\fR) configures the named
-printer. The additional options are described below.
+printer or class. The additional options are described below.
.LP
The third form of the command (\fI-x\fR) deletes the printer or
class \fIdestination\fR. Any jobs that are pending for the
@@ -78,8 +78,9 @@ and is intended for providing support for legacy printer drivers.
.TP 5
-m model
.br
-Sets a standard System V interface script or PPD file from the
-\fImodel\fR directory.
+Sets a standard System V interface script or PPD file for the printer from the
+\fImodel\fR directory or using one of the driver interfaces. Use the \fI-m\fR
+option with the \fIlpinfo(8)\fR command to get a list of supported models.
.TP 5
-o job-k-limit=value
.br
@@ -105,13 +106,12 @@ Sets the default banner page(s) to use for print jobs.
.TP 5
-o name=value
.br
-Sets a PPD option for the printer. PPD options can be
-listed using the \fI-l\fR option with the \fIlpoptions(1)\fR
-command.
+Sets a PPD option for the printer. PPD options can be listed using the \fI-l\fR
+option with the \fIlpoptions(1)\fR command.
.TP 5
-o name-default=value
.br
-Sets a default server-side option for the printer. Any print-time
+Sets a default server-side option for the destination. Any print-time
option can be defaulted, e.g. "-o cpi-default=17" to set the default
"cpi" option value to 17.
.TP 5
@@ -125,20 +125,21 @@ specified port monitor must be listed in the printer's PPD file.
.br
Sets the error policy to be used when the printer backend is
unable to send the job to the printer. The name must be one of
-"abort-job", "retry-job" or "stop-printer". The default error
-policy is "stop-printer".
+"abort-job", "retry-job", "retry-current-job", or "stop-printer". The default
+error policy is "stop-printer" for printers and "retry-current-job" for
+classes.
.TP 5
-o printer-is-shared=true/false
.br
-Sets the printer to shared/published or unshared/unpublished.
-Shared/published printers are publically announced by the server
+Sets the destination to shared/published or unshared/unpublished.
+Shared/published destinations are publically announced by the server
on the LAN based on the browsing configuration in
-\fBcupsd.conf\fR, while unshared/unpublished printers are not
+\fBcupsd.conf\fR, while unshared/unpublished destinations are not
announced. The default value is "true".
.TP 5
-o printer-op-policy=name
.br
-Sets the IPP operation policy associated with the printer. The
+Sets the IPP operation policy associated with the destination. The
name must be defined in the \fBcupsd.conf\fR in a Policy section.
The default operation policy is "default".
.TP 5
@@ -155,7 +156,7 @@ resulting class becomes empty it is removed.
.TP 5
-u deny:none
.br
-Sets user-level access control on a printer. Names starting with
+Sets user-level access control on a destination. Names starting with
"@" are interpreted as UNIX groups. The latter two forms turn
user-level access control off.
.TP 5
@@ -163,21 +164,21 @@ user-level access control off.
.br
Sets the \fIdevice-uri\fR attribute of the printer queue. If
\fIdevice-uri\fR is a filename it is automatically converted to
-the form \fIfile:///file/name\fR. Use the \fIlpinfo(8)\fR command
-to get a list of supported device URIs and schemes.
+the form \fIfile:///file/name\fR. Use the \fI-v\fR option with the
+\fIlpinfo(8)\fR command to get a list of supported device URIs and schemes.
.TP 5
-D "info"
.br
-Provides a textual description of the printer.
+Provides a textual description of the destination.
.TP 5
-E
.br
-Enables the printer and accepts jobs; this is the same as running the
-\fIcupsaccept(8)\fR and \fIcupsenable(8)\fR programs on the printer.
+Enables the destination and accepts jobs; this is the same as running the
+\fIcupsaccept(8)\fR and \fIcupsenable(8)\fR programs on the destination.
.TP 5
-L "location"
.br
-Provides a textual location of the printer.
+Provides a textual location of the destination.
.TP 5
-P ppd-file
.br
@@ -201,7 +202,7 @@ System V or Solaris printing system configuration options.
.br
http://localhost:631/help
.SH COPYRIGHT
-Copyright 2007-2009 by Apple Inc.
+Copyright 2007-2010 by Apple Inc.
.\"
-.\" End of "$Id: lpadmin.man 8421 2009-03-09 21:59:55Z mike $".
+.\" End of "$Id: lpadmin.man 9291 2010-09-01 15:51:59Z mike $".
.\"
diff --git a/notifier/mailto.c b/notifier/mailto.c
index ca6c85f0..01d863ea 100644
--- a/notifier/mailto.c
+++ b/notifier/mailto.c
@@ -1,5 +1,5 @@
/*
- * "$Id: mailto.c 7460 2008-04-16 02:19:54Z mike $"
+ * "$Id: mailto.c 9198 2010-07-08 17:24:14Z mike $"
*
* "mailto" notifier for the Common UNIX Printing System (CUPS).
*
@@ -369,8 +369,10 @@ email_message(const char *to, /* I - Recipient of message */
fputs("DEBUG: QUIT\n", stderr);
if (!cupsFileGets(fp, response, sizeof(response)) || atoi(response) >= 500)
- goto smtp_error;
- fprintf(stderr, "DEBUG: <<< %s\n", response);
+ fprintf(stderr, "ERROR: Got \"%s\" trying to QUIT connection.\n",
+ response);
+ else
+ fprintf(stderr, "DEBUG: <<< %s\n", response);
cupsFileClose(fp);
@@ -786,5 +788,5 @@ print_attributes(ipp_t *ipp, /* I - IPP request */
/*
- * End of "$Id: mailto.c 7460 2008-04-16 02:19:54Z mike $".
+ * End of "$Id: mailto.c 9198 2010-07-08 17:24:14Z mike $".
*/
diff --git a/packaging/cups.list.in b/packaging/cups.list.in
index f08502ad..7a9e031a 100644
--- a/packaging/cups.list.in
+++ b/packaging/cups.list.in
@@ -1,5 +1,5 @@
#
-# "$Id: cups.list.in 9120 2010-04-23 18:56:34Z mike $"
+# "$Id: cups.list.in 9181 2010-06-22 21:42:44Z mike $"
#
# ESP Package Manager (EPM) file list for CUPS.
#
@@ -707,8 +707,6 @@ f 0444 root sys $MANDIR/man5/mime.convs.$MAN5EXT man/mime.convs.$MAN5EXT
f 0444 root sys $MANDIR/man5/mime.types.$MAN5EXT man/mime.types.$MAN5EXT
f 0444 root sys $MANDIR/man5/printers.conf.$MAN5EXT man/printers.conf.$MAN5EXT
-f 0444 root sys $MANDIR/man7/drv.$MAN7EXT man/drv.$MAN7EXT
-
l 0644 root sys $AMANDIR/man$MAN8DIR/accept.$MAN8EXT cupsaccept.$MAN8EXT
f 0444 root sys $AMANDIR/man$MAN8DIR/cupsaccept.$MAN8EXT man/cupsaccept.$MAN8EXT
l 0644 root sys $AMANDIR/man$MAN8DIR/cupsreject.$MAN8EXT cupsaccept.$MAN8EXT
@@ -777,5 +775,5 @@ f 0444 root sys $XINETD/cups-lpd init/cups-lpd
%subpackage
#
-# End of "$Id: cups.list.in 9120 2010-04-23 18:56:34Z mike $".
+# End of "$Id: cups.list.in 9181 2010-06-22 21:42:44Z mike $".
#
diff --git a/packaging/cups.spec b/packaging/cups.spec
index 3ff52e78..974de6fd 100644
--- a/packaging/cups.spec
+++ b/packaging/cups.spec
@@ -1,5 +1,5 @@
#
-# "$Id: cups.spec.in 9120 2010-04-23 18:56:34Z mike $"
+# "$Id: cups.spec.in 9359 2010-11-11 19:09:24Z mike $"
#
# RPM "spec" file for CUPS.
#
@@ -34,12 +34,12 @@
Summary: CUPS
Name: cups
-Version: 1.4.4
+Version: 1.4.5
Release: 1
Epoch: 1
License: GPL
Group: System Environment/Daemons
-Source: http://ftp.easysw.com/pub/cups/1.4.4/cups-1.4.4-source.tar.gz
+Source: http://ftp.easysw.com/pub/cups/1.4.5/cups-1.4.5-source.tar.gz
Url: http://www.cups.org
Packager: Anonymous <anonymous@foo.com>
Vendor: Apple Inc.
@@ -285,8 +285,6 @@ rm -rf $RPM_BUILD_ROOT
%dir /usr/share/man/man5
/usr/share/man/man5/*.conf.5.gz
/usr/share/man/man5/mime.*.5.gz
-%dir /usr/share/man/man7
-/usr/share/man/man7/drv*
%dir /usr/share/man/man8
/usr/share/man/man8/accept.8.gz
/usr/share/man/man8/cupsaddsmb.8.gz
@@ -369,5 +367,5 @@ rm -rf $RPM_BUILD_ROOT
#
-# End of "$Id: cups.spec.in 9120 2010-04-23 18:56:34Z mike $".
+# End of "$Id: cups.spec.in 9359 2010-11-11 19:09:24Z mike $".
#
diff --git a/packaging/cups.spec.in b/packaging/cups.spec.in
index e08955b8..b6aefe10 100644
--- a/packaging/cups.spec.in
+++ b/packaging/cups.spec.in
@@ -1,5 +1,5 @@
#
-# "$Id: cups.spec.in 9120 2010-04-23 18:56:34Z mike $"
+# "$Id: cups.spec.in 9359 2010-11-11 19:09:24Z mike $"
#
# RPM "spec" file for CUPS.
#
@@ -285,8 +285,6 @@ rm -rf $RPM_BUILD_ROOT
%dir /usr/share/man/man5
/usr/share/man/man5/*.conf.5.gz
/usr/share/man/man5/mime.*.5.gz
-%dir /usr/share/man/man7
-/usr/share/man/man7/drv*
%dir /usr/share/man/man8
/usr/share/man/man8/accept.8.gz
/usr/share/man/man8/cupsaddsmb.8.gz
@@ -369,5 +367,5 @@ rm -rf $RPM_BUILD_ROOT
#
-# End of "$Id: cups.spec.in 9120 2010-04-23 18:56:34Z mike $".
+# End of "$Id: cups.spec.in 9359 2010-11-11 19:09:24Z mike $".
#
diff --git a/ppdc/ppdc-source.cxx b/ppdc/ppdc-source.cxx
index b65dcc22..18b84871 100644
--- a/ppdc/ppdc-source.cxx
+++ b/ppdc/ppdc-source.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: ppdc-source.cxx 8950 2010-01-14 22:40:19Z mike $"
+// "$Id: ppdc-source.cxx 9189 2010-06-25 19:23:10Z mike $"
//
// Source class for the CUPS PPD Compiler.
//
@@ -1364,17 +1364,17 @@ ppdcSource::get_integer(const char *v) // I - Value string
while (isspace(*newv & 255))
newv ++;
- if (strncmp(newv, "==", 2))
+ if (!strncmp(newv, "==", 2))
{
compop = PPDC_EQ;
newv += 2;
}
- else if (strncmp(newv, "!=", 2))
+ else if (!strncmp(newv, "!=", 2))
{
compop = PPDC_NE;
newv += 2;
}
- else if (strncmp(newv, "<=", 2))
+ else if (!strncmp(newv, "<=", 2))
{
compop = PPDC_LE;
newv += 2;
@@ -1384,7 +1384,7 @@ ppdcSource::get_integer(const char *v) // I - Value string
compop = PPDC_LT;
newv ++;
}
- else if (strncmp(newv, ">=", 2))
+ else if (!strncmp(newv, ">=", 2))
{
compop = PPDC_GE;
newv += 2;
@@ -1405,7 +1405,7 @@ ppdcSource::get_integer(const char *v) // I - Value string
if (*newv == ')' || !*newv)
return (-1);
- if (isdigit(*v & 255) || *v == '-' || *v == '+')
+ if (isdigit(*newv & 255) || *newv == '-' || *newv == '+')
{
// Get the second number...
temp2 = strtol(newv, &newv, 0);
@@ -2046,8 +2046,8 @@ ppdcSource::get_token(ppdcFile *fp, // I - File to read
var = find_variable(name);
if (var)
{
- strncpy(bufptr, var->value->value, bufend - bufptr);
- bufptr += strlen(var->value->value);
+ strlcpy(bufptr, var->value->value, bufend - bufptr + 1);
+ bufptr += strlen(bufptr);
}
else
{
@@ -2057,7 +2057,7 @@ ppdcSource::get_token(ppdcFile *fp, // I - File to read
"%s.\n"), name, fp->line, fp->filename);
snprintf(bufptr, bufend - bufptr + 1, "$%s", name);
- bufptr += strlen(name) + 1;
+ bufptr += strlen(bufptr);
}
}
}
@@ -3897,5 +3897,5 @@ ppdcSource::write_file(const char *f) // I - File to write
//
-// End of "$Id: ppdc-source.cxx 8950 2010-01-14 22:40:19Z mike $".
+// End of "$Id: ppdc-source.cxx 9189 2010-06-25 19:23:10Z mike $".
//
diff --git a/scheduler/auth.c b/scheduler/auth.c
index a7d78930..70c204a2 100644
--- a/scheduler/auth.c
+++ b/scheduler/auth.c
@@ -1,5 +1,5 @@
/*
- * "$Id: auth.c 8685 2009-05-26 22:01:23Z mike $"
+ * "$Id: auth.c 9329 2010-10-06 20:07:44Z mike $"
*
* Authorization routines for the Common UNIX Printing System (CUPS).
*
@@ -1003,7 +1003,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
if (!*authorization)
{
cupsdLogMessage(CUPSD_LOG_DEBUG2,
- "cupsdAuthorize: No authentication data specified.");
+ "cupsdAuthorize: No authentication data specified.");
return;
}
@@ -1014,7 +1014,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
len = strlen(authorization);
input_token.value = malloc(len);
input_token.value = httpDecode64_2(input_token.value, &len,
- authorization);
+ authorization);
input_token.length = len;
/*
@@ -1038,7 +1038,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
if (GSS_ERROR(major_status))
{
cupsdLogGSSMessage(CUPSD_LOG_DEBUG, major_status, minor_status,
- "cupsdAuthorize: Error accepting GSSAPI security "
+ "cupsdAuthorize: Error accepting GSSAPI security "
"context");
if (context != GSS_C_NO_CONTEXT)
@@ -1054,7 +1054,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
if (!con->gss_creds)
cupsdLogMessage(CUPSD_LOG_DEBUG,
- "cupsdAuthorize: No delegated credentials!");
+ "cupsdAuthorize: No delegated credentials!");
if (major_status == GSS_S_CONTINUE_NEEDED)
cupsdLogGSSMessage(CUPSD_LOG_DEBUG, major_status, minor_status,
@@ -1067,7 +1067,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
if (GSS_ERROR(major_status))
{
cupsdLogGSSMessage(CUPSD_LOG_DEBUG, major_status, minor_status,
- "cupsdAuthorize: Error getting username");
+ "cupsdAuthorize: Error getting username");
gss_release_cred(&minor_status, &con->gss_creds);
gss_release_name(&minor_status, &client_name);
gss_delete_sec_context(&minor_status, &context, GSS_C_NO_BUFFER);
@@ -2857,5 +2857,5 @@ to64(char *s, /* O - Output string */
/*
- * End of "$Id: auth.c 8685 2009-05-26 22:01:23Z mike $".
+ * End of "$Id: auth.c 9329 2010-10-06 20:07:44Z mike $".
*/
diff --git a/scheduler/classes.c b/scheduler/classes.c
index 2003c9bb..29e99f56 100644
--- a/scheduler/classes.c
+++ b/scheduler/classes.c
@@ -1,5 +1,5 @@
/*
- * "$Id: classes.c 9061 2010-03-30 22:07:33Z mike $"
+ * "$Id: classes.c 9258 2010-08-13 01:34:04Z mike $"
*
* Printer class routines for the Common UNIX Printing System (CUPS).
*
@@ -41,6 +41,7 @@ cupsd_printer_t * /* O - New class */
cupsdAddClass(const char *name) /* I - Name of class */
{
cupsd_printer_t *c; /* New class */
+ char uri[1024]; /* Class URI */
/*
@@ -55,8 +56,10 @@ cupsdAddClass(const char *name) /* I - Name of class */
c->type = CUPS_PRINTER_CLASS;
- cupsdSetStringf(&c->uri, "ipp://%s:%d/classes/%s", ServerName, RemotePort,
- name);
+ httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
+ ServerName, RemotePort, "/classes/%s", name);
+ cupsdSetString(&c->uri, uri);
+
cupsdSetString(&c->error_policy, "retry-current-job");
}
@@ -722,7 +725,7 @@ cupsdSaveAllClasses(void)
*/
fchown(cupsFileNumber(fp), RunUser, Group);
- fchmod(cupsFileNumber(fp), 0600);
+ fchmod(cupsFileNumber(fp), ConfigFilePerm);
/*
* Write a small header to the file...
@@ -877,5 +880,5 @@ cupsdUpdateImplicitClasses(void)
/*
- * End of "$Id: classes.c 9061 2010-03-30 22:07:33Z mike $".
+ * End of "$Id: classes.c 9258 2010-08-13 01:34:04Z mike $".
*/
diff --git a/scheduler/client.c b/scheduler/client.c
index e5cc809b..7303a5a7 100644
--- a/scheduler/client.c
+++ b/scheduler/client.c
@@ -1,5 +1,5 @@
/*
- * "$Id: client.c 9120 2010-04-23 18:56:34Z mike $"
+ * "$Id: client.c 9337 2010-10-17 04:13:56Z mike $"
*
* Client routines for the Common UNIX Printing System (CUPS) scheduler.
*
@@ -54,19 +54,25 @@
#ifdef HAVE_CDSASSL
# include <Security/Security.h>
+# include <Security/SecItem.h>
+# ifdef HAVE_SECITEMPRIV_H
+# include <Security/SecItemPriv.h>
+# else /* Declare constant from that header... */
+extern const CFTypeRef kSecClassIdentity;
+# endif /* HAVE_SECITEMPRIV_H */
# ifdef HAVE_SECIDENTITYSEARCHPRIV_H
# include <Security/SecIdentitySearchPriv.h>
# else /* Declare prototype for function in that header... */
-extern OSStatus SecIdentitySearchCreateWithPolicy(SecPolicyRef policy,
- CFStringRef idString, CSSM_KEYUSE keyUsage,
- CFTypeRef keychainOrArray,
- Boolean returnOnlyValidIdentities,
+extern OSStatus SecIdentitySearchCreateWithPolicy(SecPolicyRef policy,
+ CFStringRef idString, CSSM_KEYUSE keyUsage,
+ CFTypeRef keychainOrArray,
+ Boolean returnOnlyValidIdentities,
SecIdentitySearchRef* searchRef);
# endif /* HAVE_SECIDENTITYSEARCHPRIV_H */
# ifdef HAVE_SECPOLICYPRIV_H
# include <Security/SecPolicyPriv.h>
# else /* Declare prototype for function in that header... */
-extern OSStatus SecPolicySetValue(SecPolicyRef policyRef,
+extern OSStatus SecPolicySetValue(SecPolicyRef policyRef,
const CSSM_DATA *value);
# endif /* HAVE_SECPOLICYPRIV_H */
# ifdef HAVE_SECBASEPRIV_H
@@ -1376,6 +1382,35 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
break;
}
}
+ else if ((!strncmp(con->uri, "/printers/", 10) ||
+ !strncmp(con->uri, "/classes/", 9)) &&
+ !strcmp(con->uri + strlen(con->uri) - 4, ".png"))
+ {
+ /*
+ * Send icon file - get the real queue name since queue names are
+ * not case sensitive but filenames can be...
+ */
+
+ con->uri[strlen(con->uri) - 4] = '\0'; /* Drop ".png" */
+
+ if (!strncmp(con->uri, "/printers/", 10))
+ p = cupsdFindPrinter(con->uri + 10);
+ else
+ p = cupsdFindClass(con->uri + 9);
+
+ if (p)
+ snprintf(con->uri, sizeof(con->uri), "/icons/%s.png", p->name);
+ else
+ {
+ if (!cupsdSendError(con, HTTP_NOT_FOUND, CUPSD_AUTH_NONE))
+ {
+ cupsdCloseClient(con);
+ return;
+ }
+
+ break;
+ }
+ }
if ((!strncmp(con->uri, "/admin", 6) &&
strncmp(con->uri, "/admin/conf/", 12) &&
@@ -3353,49 +3388,125 @@ get_cdsa_certificate(
cupsd_client_t *con) /* I - Client connection */
{
OSStatus err; /* Error info */
- SecKeychainRef keychain; /* Keychain reference */
- SecIdentitySearchRef search; /* Search reference */
- SecIdentityRef identity; /* Identity */
+ SecKeychainRef keychain = NULL;/* Keychain reference */
+ SecIdentitySearchRef search = NULL; /* Search reference */
+ SecIdentityRef identity = NULL;/* Identity */
CFArrayRef certificates = NULL;
/* Certificate array */
+# if HAVE_SECPOLICYCREATESSL
+ SecPolicyRef policy = NULL; /* Policy ref */
+ CFStringRef servername = NULL;
+ /* Server name */
+ CFMutableDictionaryRef query = NULL; /* Query qualifiers */
+ char localname[1024];/* Local hostname */
+# elif defined(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY)
+ SecPolicyRef policy = NULL; /* Policy ref */
+ SecPolicySearchRef policy_search = NULL;
+ /* Policy search ref */
+ CSSM_DATA options; /* Policy options */
+ CSSM_APPLE_TP_SSL_OPTIONS
+ ssl_options; /* SSL Option for hostname */
+ char localname[1024];/* Local hostname */
+# endif /* HAVE_SECPOLICYCREATESSL */
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "get_cdsa_certificate: Looking for certs for \"%s\"...",
+ con->servername);
+
if ((err = SecKeychainOpen(ServerCertificate, &keychain)))
{
cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot open keychain \"%s\" - %s (%d)",
ServerCertificate, cssmErrorString(err), (int)err);
- return (NULL);
+ goto cleanup;
+ }
+
+# if HAVE_SECPOLICYCREATESSL
+ servername = CFStringCreateWithCString(kCFAllocatorDefault, con->servername,
+ kCFStringEncodingUTF8);
+
+ if ((policy = SecPolicyCreateSSL(1, servername)) == NULL)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create ssl policy reference");
+ goto cleanup;
+ }
+
+ if (servername)
+ CFRelease(servername);
+
+ if (!(query = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks)))
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create query dictionary");
+ goto cleanup;
}
-# if HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY
+ CFDictionaryAddValue(query, kSecClass, kSecClassIdentity);
+ CFDictionaryAddValue(query, kSecMatchPolicy, policy);
+ CFDictionaryAddValue(query, kSecReturnRef, kCFBooleanTrue);
+ CFDictionaryAddValue(query, kSecMatchLimit, kSecMatchLimitOne);
+
+ err = SecItemCopyMatching(query, (CFTypeRef *)&identity);
+
+ if (err && DNSSDHostName)
+ {
+ /*
+ * Search for the connection server name failed; try the DNS-SD .local
+ * hostname instead...
+ */
+
+ snprintf(localname, sizeof(localname), "%s.local", DNSSDHostName);
+
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "get_cdsa_certificate: Looking for certs for \"%s\"...",
+ localname);
+
+ servername = CFStringCreateWithCString(kCFAllocatorDefault, localname,
+ kCFStringEncodingUTF8);
+
+ CFRelease(policy);
+
+ if ((policy = SecPolicyCreateSSL(1, servername)) == NULL)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create ssl policy reference");
+ goto cleanup;
+ }
+
+ if (servername)
+ CFRelease(servername);
+
+ CFDictionarySetValue(query, kSecMatchPolicy, policy);
+
+ err = SecItemCopyMatching(query, (CFTypeRef *)&identity);
+ }
+
+ if (err)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "Cannot find signing key in keychain \"%s\": %s (%d)",
+ ServerCertificate, cssmErrorString(err), (int)err);
+ goto cleanup;
+ }
+
+# elif defined(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY)
/*
* Use a policy to search for valid certificates who's common name matches the
* servername...
*/
- SecPolicySearchRef policy_search; /* Policy search ref */
- SecPolicyRef policy; /* Policy ref */
- CSSM_DATA options; /* Policy options */
- CSSM_APPLE_TP_SSL_OPTIONS
- ssl_options; /* SSL Option for hostname */
- char localname[1024];/* Local hostname */
-
-
- if (SecPolicySearchCreate(CSSM_CERT_X_509v3, &CSSMOID_APPLE_TP_SSL,
+ if (SecPolicySearchCreate(CSSM_CERT_X_509v3, &CSSMOID_APPLE_TP_SSL,
NULL, &policy_search))
{
cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create a policy search reference");
- CFRelease(keychain);
- return (NULL);
+ goto cleanup;
}
if (SecPolicySearchCopyNext(policy_search, &policy))
{
cupsdLogMessage(CUPSD_LOG_ERROR,
"Cannot find a policy to use for searching");
- CFRelease(keychain);
- CFRelease(policy_search);
- return (NULL);
+ goto cleanup;
}
memset(&ssl_options, 0, sizeof(ssl_options));
@@ -3403,10 +3514,6 @@ get_cdsa_certificate(
ssl_options.ServerName = con->servername;
ssl_options.ServerNameLen = strlen(con->servername);
- cupsdLogMessage(CUPSD_LOG_DEBUG,
- "get_cdsa_certificate: Looking for certs for \"%s\"...",
- con->servername);
-
options.Data = (uint8 *)&ssl_options;
options.Length = sizeof(ssl_options);
@@ -3414,13 +3521,20 @@ get_cdsa_certificate(
{
cupsdLogMessage(CUPSD_LOG_ERROR,
"Cannot set policy value to use for searching");
- CFRelease(keychain);
- CFRelease(policy_search);
- return (NULL);
+ goto cleanup;
}
- err = SecIdentitySearchCreateWithPolicy(policy, NULL, CSSM_KEYUSE_SIGN,
- keychain, FALSE, &search);
+ if ((err = SecIdentitySearchCreateWithPolicy(policy, NULL, CSSM_KEYUSE_SIGN,
+ keychain, FALSE, &search)))
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "Cannot create identity search reference: %s (%d)",
+ cssmErrorString(err), (int)err);
+ goto cleanup;
+ }
+
+ err = SecIdentitySearchCopyNext(search, &identity);
+
if (err && DNSSDHostName)
{
/*
@@ -3441,13 +3555,30 @@ get_cdsa_certificate(
{
cupsdLogMessage(CUPSD_LOG_ERROR,
"Cannot set policy value to use for searching");
- CFRelease(keychain);
- CFRelease(policy_search);
- return (NULL);
+ goto cleanup;
}
- err = SecIdentitySearchCreateWithPolicy(policy, NULL, CSSM_KEYUSE_SIGN,
- keychain, FALSE, &search);
+ CFRelease(search);
+ search = NULL;
+ if ((err = SecIdentitySearchCreateWithPolicy(policy, NULL, CSSM_KEYUSE_SIGN,
+ keychain, FALSE, &search)))
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "Cannot create identity search reference: %s (%d)",
+ cssmErrorString(err), (int)err);
+ goto cleanup;
+ }
+
+ err = SecIdentitySearchCopyNext(search, &identity);
+
+ }
+
+ if (err)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "Cannot find signing key in keychain \"%s\": %s (%d)",
+ ServerCertificate, cssmErrorString(err), (int)err);
+ goto cleanup;
}
# else
@@ -3455,43 +3586,56 @@ get_cdsa_certificate(
* Assume there is exactly one SecIdentity in the keychain...
*/
- err = SecIdentitySearchCreate(keychain, CSSM_KEYUSE_SIGN, &search);
-# endif /* HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY */
-
- if (err)
+ if ((err = SecIdentitySearchCreate(keychain, CSSM_KEYUSE_SIGN, &search)))
+ {
cupsdLogMessage(CUPSD_LOG_DEBUG,
- "Cannot create keychain search reference: %s (%d)",
- cssmErrorString(err), (int)err);
- else
+ "Cannot create identity search reference (%d)", (int)err);
+ goto cleanup;
+ }
+
+ if ((err = SecIdentitySearchCopyNext(search, &identity)))
{
- if ((err = SecIdentitySearchCopyNext(search, &identity)))
- {
- cupsdLogMessage(CUPSD_LOG_DEBUG,
- "Cannot find signing key in keychain \"%s\": %s (%d)",
- ServerCertificate, cssmErrorString(err), (int)err);
- }
- else
- {
- if (CFGetTypeID(identity) != SecIdentityGetTypeID())
- cupsdLogMessage(CUPSD_LOG_ERROR,
- "SecIdentitySearchCopyNext CFTypeID failure!");
- else
- {
- if ((certificates = CFArrayCreate(NULL, (const void **)&identity,
- 1, &kCFTypeArrayCallBacks)) == NULL)
- cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create certificate array");
- }
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "Cannot find signing key in keychain \"%s\": %s (%d)",
+ ServerCertificate, cssmErrorString(err), (int)err);
+ goto cleanup;
+ }
+# endif /* HAVE_SECPOLICYCREATESSL */
- CFRelease(identity);
- }
+ if (CFGetTypeID(identity) != SecIdentityGetTypeID())
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "SecIdentity CFTypeID failure!");
+ goto cleanup;
+ }
- CFRelease(search);
+ if ((certificates = CFArrayCreate(NULL, (const void **)&identity,
+ 1, &kCFTypeArrayCallBacks)) == NULL)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create certificate array");
+ goto cleanup;
}
-# if HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY
- CFRelease(policy);
- CFRelease(policy_search);
-# endif /* HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY */
+ cleanup :
+
+ if (keychain)
+ CFRelease(keychain);
+ if (search)
+ CFRelease(search);
+ if (identity)
+ CFRelease(identity);
+
+# if HAVE_SECPOLICYCREATESSL
+ if (policy)
+ CFRelease(policy);
+ if (query)
+ CFRelease(query);
+
+# elif defined(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY)
+ if (policy)
+ CFRelease(policy);
+ if (policy_search)
+ CFRelease(policy_search);
+# endif /* HAVE_SECPOLICYCREATESSL */
return (certificates);
}
@@ -3522,6 +3666,12 @@ get_file(cupsd_client_t *con, /* I - Client connection */
if (!strncmp(con->uri, "/ppd/", 5))
snprintf(filename, len, "%s%s", ServerRoot, con->uri);
+ else if (!strncmp(con->uri, "/icons/", 7) && !strchr(con->uri + 7, '/'))
+ {
+ snprintf(filename, len, "%s/%s", CacheDir, con->uri + 7);
+ if (access(filename, F_OK) < 0)
+ snprintf(filename, len, "%s/images/generic.png", DocumentRoot);
+ }
else if (!strncmp(con->uri, "/rss/", 5) && !strchr(con->uri + 5, '/'))
snprintf(filename, len, "%s/rss/%s", CacheDir, con->uri + 5);
else if (!strncmp(con->uri, "/admin/conf/", 12))
@@ -3554,6 +3704,7 @@ get_file(cupsd_client_t *con, /* I - Client connection */
*/
if ((status = stat(filename, filestats)) != 0 && language[0] &&
+ strncmp(con->uri, "/icons/", 7) &&
strncmp(con->uri, "/ppd/", 5) &&
strncmp(con->uri, "/admin/conf/", 12) &&
strncmp(con->uri, "/admin/log/", 11))
@@ -4383,11 +4534,20 @@ make_certificate(cupsd_client_t *con) /* I - Client connection */
*argv[4], /* Command-line arguments */
*envp[MAX_ENV + 1], /* Environment variables */
keychain[1024], /* Keychain argument */
- infofile[1024]; /* Type-in information for cert */
+ infofile[1024], /* Type-in information for cert */
+ localname[1024], /* Local hostname */
+ *servername; /* Name of server in cert */
cups_file_t *fp; /* Seed/info file */
int infofd; /* Info file descriptor */
-
+ if (con->servername && isdigit(con->servername[0] & 255) && DNSSDHostName)
+ {
+ snprintf(localname, sizeof(localname), "%s.local", DNSSDHostName);
+ servername = localname;
+ }
+ else
+ servername = con->servername;
+
/*
* Run the "certtool" command to generate a self-signed certificate...
*/
@@ -4415,7 +4575,7 @@ make_certificate(cupsd_client_t *con) /* I - Client connection */
}
cupsFilePrintf(fp, "%s\nr\n\ny\nb\ns\ny\n%s\n\n\n\n\n%s\ny\n",
- con->servername, con->servername, ServerAdmin);
+ servername, servername, ServerAdmin);
cupsFileClose(fp);
cupsdLogMessage(CUPSD_LOG_INFO,
@@ -4504,7 +4664,7 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */
char argbuf[10240], /* Argument buffer */
*argv[100], /* Argument strings */
*envp[MAX_ENV + 20]; /* Environment variables */
- char auth_type[256], /* CUPSD_AUTH_TYPE environment variable */
+ char auth_type[256], /* AUTH_TYPE environment variable */
content_length[1024], /* CONTENT_LENGTH environment variable */
content_type[1024], /* CONTENT_TYPE environment variable */
http_cookie[32768], /* HTTP_COOKIE environment variable */
@@ -4550,7 +4710,12 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */
argv[0] = command;
if (options)
- strlcpy(argbuf, options, sizeof(argbuf));
+ {
+ commptr = options;
+ if (*commptr == ' ')
+ commptr ++;
+ strlcpy(argbuf, commptr, sizeof(argbuf));
+ }
else
argbuf[0] = '\0';
@@ -4649,7 +4814,7 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */
if (con->username[0])
{
- snprintf(auth_type, sizeof(auth_type), "CUPSD_AUTH_TYPE=%s",
+ snprintf(auth_type, sizeof(auth_type), "AUTH_TYPE=%s",
httpGetField(HTTP(con), HTTP_FIELD_AUTHORIZATION));
if ((uriptr = strchr(auth_type + 10, ' ')) != NULL)
@@ -5111,5 +5276,5 @@ write_pipe(cupsd_client_t *con) /* I - Client connection */
/*
- * End of "$Id: client.c 9120 2010-04-23 18:56:34Z mike $".
+ * End of "$Id: client.c 9337 2010-10-17 04:13:56Z mike $".
*/
diff --git a/scheduler/conf.c b/scheduler/conf.c
index dffff6d0..e72ecead 100644
--- a/scheduler/conf.c
+++ b/scheduler/conf.c
@@ -1,5 +1,5 @@
/*
- * "$Id: conf.c 9120 2010-04-23 18:56:34Z mike $"
+ * "$Id: conf.c 9273 2010-08-31 04:18:38Z mike $"
*
* Configuration routines for the Common UNIX Printing System (CUPS).
*
@@ -1174,6 +1174,19 @@ cupsdReadConfiguration(void)
cupsdLogMessage(CUPSD_LOG_INFO, "<Policy default>");
cupsdLogMessage(CUPSD_LOG_INFO,
+ "<Limit Create-Job Print-Job Print-URI Validate-Job>");
+ cupsdLogMessage(CUPSD_LOG_INFO, "Order Deny,Allow");
+
+ po = cupsdAddPolicyOp(p, NULL, IPP_CREATE_JOB);
+ po->order_type = CUPSD_AUTH_ALLOW;
+
+ cupsdAddPolicyOp(p, po, IPP_PRINT_JOB);
+ cupsdAddPolicyOp(p, po, IPP_PRINT_URI);
+ cupsdAddPolicyOp(p, po, IPP_VALIDATE_JOB);
+
+ cupsdLogMessage(CUPSD_LOG_INFO, "</Limit>");
+
+ cupsdLogMessage(CUPSD_LOG_INFO,
"<Limit Send-Document Send-URI Cancel-Job Hold-Job "
"Release-Job Restart-Job Purge-Jobs "
"Set-Job-Attributes Create-Job-Subscription "
@@ -3685,10 +3698,30 @@ read_policy(cups_file_t *fp, /* I - Configuration file */
linenum);
/*
- * Verify that we have an explicit policy for CUPS-Get-Document
- * (ensures that upgrades do not introduce new security issues...)
+ * Verify that we have an explicit policy for Validate-Job and
+ * CUPS-Get-Document, which ensures that upgrades do not introduce new
+ * security issues...
*/
+ if ((op = cupsdFindPolicyOp(pol, IPP_VALIDATE_JOB)) == NULL ||
+ op->op == IPP_ANY_OPERATION)
+ {
+ if ((op = cupsdFindPolicyOp(pol, IPP_PRINT_JOB)) != NULL &&
+ op->op != IPP_ANY_OPERATION)
+ {
+ /*
+ * Add a new limit for Validate-Job using the Print-Job limit as a
+ * template...
+ */
+
+ cupsdLogMessage(CUPSD_LOG_WARN,
+ "No limit for Validate-Job defined in policy %s "
+ "- using Print-Job's policy", pol->name);
+
+ cupsdAddPolicyOp(pol, op, IPP_VALIDATE_JOB);
+ }
+ }
+
if ((op = cupsdFindPolicyOp(pol, CUPS_GET_DOCUMENT)) == NULL ||
op->op == IPP_ANY_OPERATION)
{
@@ -3820,5 +3853,5 @@ read_policy(cups_file_t *fp, /* I - Configuration file */
/*
- * End of "$Id: conf.c 9120 2010-04-23 18:56:34Z mike $".
+ * End of "$Id: conf.c 9273 2010-08-31 04:18:38Z mike $".
*/
diff --git a/scheduler/cupsd.h b/scheduler/cupsd.h
index b8f5c840..2e80e9c8 100644
--- a/scheduler/cupsd.h
+++ b/scheduler/cupsd.h
@@ -1,5 +1,5 @@
/*
- * "$Id: cupsd.h 8481 2009-04-02 22:53:56Z mike $"
+ * "$Id: cupsd.h 9310 2010-09-21 22:34:57Z mike $"
*
* Main header file for the Common UNIX Printing System (CUPS) scheduler.
*
@@ -161,8 +161,10 @@ VAR int MaxFDs VALUE(0);
VAR time_t ReloadTime VALUE(0);
/* Time of reload request... */
-VAR int NeedReload VALUE(RELOAD_ALL);
+VAR int NeedReload VALUE(RELOAD_ALL),
/* Need to load configuration? */
+ DoingShutdown VALUE(0);
+ /* Shutting down the scheduler? */
VAR void *DefaultProfile VALUE(0);
/* Default security profile */
@@ -242,5 +244,5 @@ extern int cupsdRemoveFile(const char *filename);
/*
- * End of "$Id: cupsd.h 8481 2009-04-02 22:53:56Z mike $".
+ * End of "$Id: cupsd.h 9310 2010-09-21 22:34:57Z mike $".
*/
diff --git a/scheduler/ipp.c b/scheduler/ipp.c
index 2faade8c..e1600e47 100644
--- a/scheduler/ipp.c
+++ b/scheduler/ipp.c
@@ -1,5 +1,5 @@
/*
- * "$Id: ipp.c 9120 2010-04-23 18:56:34Z mike $"
+ * "$Id: ipp.c 9329 2010-10-06 20:07:44Z mike $"
*
* IPP routines for the Common UNIX Printing System (CUPS) scheduler.
*
@@ -1245,7 +1245,7 @@ add_class(cupsd_client_t *con, /* I - Client connection */
if (modify)
{
- cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED | CUPSD_EVENT_PRINTER_CONFIG,
+ cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED,
pclass, NULL, "Class \"%s\" modified by \"%s\".",
pclass->name, get_username(con));
@@ -1256,7 +1256,7 @@ add_class(cupsd_client_t *con, /* I - Client connection */
{
cupsdAddPrinterHistory(pclass);
- cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED | CUPSD_EVENT_PRINTER_CONFIG,
+ cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED,
pclass, NULL, "New class \"%s\" added by \"%s\".",
pclass->name, get_username(con));
@@ -1350,7 +1350,6 @@ add_job(cupsd_client_t *con, /* I - Client connection */
int kbytes; /* Size of print file */
int i; /* Looping var */
int lowerpagerange; /* Page range bound */
- const char *ppd; /* PPD keyword for media selection */
int exact; /* Did we have an exact match? */
ipp_attribute_t *media_col, /* media-col attribute */
*media_margin; /* media-*-margin attribute */
@@ -1524,22 +1523,10 @@ add_job(cupsd_client_t *con, /* I - Client connection */
* Do media selection as needed...
*/
- if (!ippFindAttribute(con->request, "InputSlot", IPP_TAG_ZERO) &&
- (ppd = _pwgGetInputSlot(printer->pwg, con->request, NULL)) != NULL)
- ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "InputSlot", NULL,
- ppd);
-
- if (!ippFindAttribute(con->request, "MediaType", IPP_TAG_ZERO) &&
- (ppd = _pwgGetMediaType(printer->pwg, con->request, NULL)) != NULL)
- ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "MediaType", NULL,
- ppd);
-
- if (!ippFindAttribute(con->request, "PageSize", IPP_TAG_ZERO) &&
- (ppd = _pwgGetPageSize(printer->pwg, con->request, NULL, &exact)) != NULL)
+ if (!ippFindAttribute(con->request, "PageRegion", IPP_TAG_ZERO) &&
+ !ippFindAttribute(con->request, "PageSize", IPP_TAG_ZERO) &&
+ _pwgGetPageSize(printer->pwg, con->request, NULL, &exact))
{
- ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "PageSize", NULL,
- ppd);
-
if (!exact &&
(media_col = ippFindAttribute(con->request, "media-col",
IPP_TAG_BEGIN_COLLECTION)) != NULL)
@@ -2936,19 +2923,21 @@ add_printer(cupsd_client_t *con, /* I - Client connection */
{
/*
* If we changed the PPD/interface script, then remove the printer's cache
- * file...
+ * file and clear the printer-state-reasons...
*/
char cache_name[1024]; /* Cache filename for printer attrs */
- snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp", CacheDir,
+ snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp4", CacheDir,
printer->name);
unlink(cache_name);
- snprintf(cache_name, sizeof(cache_name), "%s/%s.pwg", CacheDir,
+ snprintf(cache_name, sizeof(cache_name), "%s/%s.pwg3", CacheDir,
printer->name);
unlink(cache_name);
+ cupsdSetPrinterReasons(printer, "none");
+
#ifdef __APPLE__
/*
* (Re)register color profiles...
@@ -3025,7 +3014,7 @@ add_printer(cupsd_client_t *con, /* I - Client connection */
if (modify)
{
- cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED | CUPSD_EVENT_PRINTER_CONFIG,
+ cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED,
printer, NULL, "Printer \"%s\" modified by \"%s\".",
printer->name, get_username(con));
@@ -3036,7 +3025,7 @@ add_printer(cupsd_client_t *con, /* I - Client connection */
{
cupsdAddPrinterHistory(printer);
- cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED | CUPSD_EVENT_PRINTER_CONFIG,
+ cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED,
printer, NULL, "New printer \"%s\" added by \"%s\".",
printer->name, get_username(con));
@@ -4295,7 +4284,8 @@ check_rss_recipient(
* 'check_quotas()' - Check quotas for a printer and user.
*/
-static int /* O - 1 if OK, 0 if not */
+static int /* O - 1 if OK, 0 if forbidden,
+ -1 if limit reached */
check_quotas(cupsd_client_t *con, /* I - Client connection */
cupsd_printer_t *p) /* I - Printer or class */
{
@@ -4345,7 +4335,7 @@ check_quotas(cupsd_client_t *con, /* I - Client connection */
{
cupsdLogMessage(CUPSD_LOG_INFO, "Too many jobs for printer \"%s\"...",
p->name);
- return (0);
+ return (-1);
}
}
@@ -4359,7 +4349,7 @@ check_quotas(cupsd_client_t *con, /* I - Client connection */
{
cupsdLogMessage(CUPSD_LOG_INFO, "Too many jobs for user \"%s\"...",
username);
- return (0);
+ return (-1);
}
}
@@ -5507,6 +5497,8 @@ copy_printer_attrs(
{
char printer_uri[HTTP_MAX_URI];
/* Printer URI */
+ char printer_icons[HTTP_MAX_URI];
+ /* Printer icons */
time_t curtime; /* Current time */
int i; /* Looping var */
ipp_attribute_t *history; /* History collection */
@@ -5614,6 +5606,16 @@ copy_printer_attrs(
sizeof(errors) / sizeof(errors[0]), NULL, errors);
}
+ if (!ra || cupsArrayFind(ra, "printer-icons"))
+ {
+ httpAssembleURIf(HTTP_URI_CODING_ALL, printer_icons, sizeof(printer_icons),
+ "http", NULL, con->servername, con->serverport,
+ "/icons/%s.png", printer->name);
+ ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_URI, "printer-icons",
+ NULL, printer_icons);
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "printer-icons=\"%s\"", printer_icons);
+ }
+
if (!ra || cupsArrayFind(ra, "printer-is-accepting-jobs"))
ippAddBoolean(con->response, IPP_TAG_PRINTER, "printer-is-accepting-jobs",
printer->accepting);
@@ -6507,10 +6509,13 @@ delete_printer(cupsd_client_t *con, /* I - Client connection */
printer->name);
unlink(filename);
- snprintf(filename, sizeof(filename), "%s/%s.ipp", CacheDir, printer->name);
+ snprintf(filename, sizeof(filename), "%s/%s.ipp4", CacheDir, printer->name);
+ unlink(filename);
+
+ snprintf(filename, sizeof(filename), "%s/%s.png", CacheDir, printer->name);
unlink(filename);
- snprintf(filename, sizeof(filename), "%s/%s.pwg", CacheDir, printer->name);
+ snprintf(filename, sizeof(filename), "%s/%s.pwg3", CacheDir, printer->name);
unlink(filename);
#ifdef __APPLE__
@@ -11411,6 +11416,7 @@ static void
validate_job(cupsd_client_t *con, /* I - Client connection */
ipp_attribute_t *uri) /* I - Printer URI */
{
+ int i; /* Temporary variable */
http_status_t status; /* Policy status */
ipp_attribute_t *attr; /* Current attribute */
ipp_attribute_t *format; /* Document-format attribute */
@@ -11497,6 +11503,21 @@ validate_job(cupsd_client_t *con, /* I - Client connection */
}
/*
+ * Check quotas...
+ */
+
+ if ((i = check_quotas(con, printer)) < 0)
+ {
+ send_ipp_status(con, IPP_NOT_POSSIBLE, _("Quota limit reached."));
+ return;
+ }
+ else if (i == 0)
+ {
+ send_ipp_status(con, IPP_NOT_AUTHORIZED, _("Not allowed to print."));
+ return;
+ }
+
+ /*
* Everything was ok, so return OK status...
*/
@@ -11575,5 +11596,5 @@ validate_user(cupsd_job_t *job, /* I - Job */
/*
- * End of "$Id: ipp.c 9120 2010-04-23 18:56:34Z mike $".
+ * End of "$Id: ipp.c 9329 2010-10-06 20:07:44Z mike $".
*/
diff --git a/scheduler/job.c b/scheduler/job.c
index 0d2ddebf..a41c0ba0 100644
--- a/scheduler/job.c
+++ b/scheduler/job.c
@@ -1,9 +1,9 @@
/*
- * "$Id: job.c 9061 2010-03-30 22:07:33Z mike $"
+ * "$Id: job.c 9337 2010-10-17 04:13:56Z mike $"
*
- * Job management routines for the Common UNIX Printing System (CUPS).
+ * Job management routines for the CUPS scheduler.
*
- * Copyright 2007-2009 by Apple Inc.
+ * Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -173,7 +173,7 @@ static void free_job_history(cupsd_job_t *job);
static char *get_options(cupsd_job_t *job, int banner_page, char *copies,
size_t copies_size, char *title,
size_t title_size);
-static int ipp_length(ipp_t *ipp);
+static size_t ipp_length(ipp_t *ipp);
static void load_job_cache(const char *filename);
static void load_next_job_id(const char *filename);
static void load_request_root(void);
@@ -348,7 +348,7 @@ cupsdCheckJobs(void)
*/
if (job->state_value == IPP_JOB_PENDING && !NeedReload && !Sleeping &&
- !job->printer)
+ !DoingShutdown && !job->printer)
{
printer = cupsdFindDest(job->dest);
pclass = NULL;
@@ -2857,7 +2857,7 @@ finalize_job(cupsd_job_t *job, /* I - Job */
job->tries ++;
- if (job->tries >= JobRetryLimit)
+ if (job->tries > JobRetryLimit && JobRetryLimit > 0)
{
/*
* Too many tries...
@@ -3021,39 +3021,183 @@ get_options(cupsd_job_t *job, /* I - Job */
size_t title_size) /* I - Size of title buffer */
{
int i; /* Looping var */
+ size_t newlength; /* New option buffer length */
char *optptr, /* Pointer to options */
*valptr; /* Pointer in value string */
ipp_attribute_t *attr; /* Current attribute */
+ _pwg_t *pwg; /* PWG->PPD mapping data */
+ int num_pwgppds; /* Number of PWG->PPD options */
+ cups_option_t *pwgppds, /* PWG->PPD options */
+ *pwgppd, /* Current PWG->PPD option */
+ *preset; /* Current preset option */
+ int output_mode, /* Output mode (if any) */
+ print_quality; /* Print quality (if any) */
+ const char *ppd; /* PPD option choice */
+ int exact; /* Did we get an exact match? */
static char *options = NULL;/* Full list of options */
- static int optlength = 0; /* Length of option buffer */
+ static size_t optlength = 0; /* Length of option buffer */
/*
- * Building the options string is harder than it needs to be, but
- * for the moment we need to pass strings for command-line args and
- * not IPP attribute pointers... :)
+ * Building the options string is harder than it needs to be, but for the
+ * moment we need to pass strings for command-line args and not IPP attribute
+ * pointers... :)
*
- * First allocate/reallocate the option buffer as needed...
+ * First build an options array for any PWG->PPD mapped option/choice pairs.
*/
- i = ipp_length(job->attrs);
+ pwg = job->printer->pwg;
+ num_pwgppds = 0;
+ pwgppds = NULL;
- if (i > optlength || !options)
+ if (pwg &&
+ !ippFindAttribute(job->attrs,
+ "com.apple.print.DocumentTicket.PMSpoolFormat",
+ IPP_TAG_ZERO) &&
+ (ippFindAttribute(job->attrs, "output-mode", IPP_TAG_ZERO) ||
+ ippFindAttribute(job->attrs, "print-quality", IPP_TAG_ZERO)))
+ {
+ /*
+ * Map output-mode and print-quality to a preset...
+ */
+
+ if ((attr = ippFindAttribute(job->attrs, "output-mode",
+ IPP_TAG_KEYWORD)) != NULL &&
+ !strcmp(attr->values[0].string.text, "monochrome"))
+ output_mode = _PWG_OUTPUT_MODE_MONOCHROME;
+ else
+ output_mode = _PWG_OUTPUT_MODE_COLOR;
+
+ if ((attr = ippFindAttribute(job->attrs, "print-quality",
+ IPP_TAG_ENUM)) != NULL &&
+ attr->values[0].integer >= IPP_QUALITY_DRAFT &&
+ attr->values[0].integer <= IPP_QUALITY_HIGH)
+ print_quality = attr->values[0].integer - IPP_QUALITY_DRAFT;
+ else
+ print_quality = _PWG_PRINT_QUALITY_NORMAL;
+
+ if (pwg->num_presets[output_mode][print_quality] == 0)
+ {
+ /*
+ * Try to find a preset that works so that we maximize the chances of us
+ * getting a good print using IPP attributes.
+ */
+
+ if (pwg->num_presets[output_mode][_PWG_PRINT_QUALITY_NORMAL] > 0)
+ print_quality = _PWG_PRINT_QUALITY_NORMAL;
+ else if (pwg->num_presets[_PWG_OUTPUT_MODE_COLOR][print_quality] > 0)
+ output_mode = _PWG_OUTPUT_MODE_COLOR;
+ else
+ {
+ print_quality = _PWG_PRINT_QUALITY_NORMAL;
+ output_mode = _PWG_OUTPUT_MODE_COLOR;
+ }
+ }
+
+ if (pwg->num_presets[output_mode][print_quality] > 0)
+ {
+ /*
+ * Copy the preset options as long as the corresponding names are not
+ * already defined in the IPP request...
+ */
+
+ for (i = pwg->num_presets[output_mode][print_quality],
+ preset = pwg->presets[output_mode][print_quality];
+ i > 0;
+ i --, preset ++)
+ {
+ if (!ippFindAttribute(job->attrs, preset->name, IPP_TAG_ZERO))
+ num_pwgppds = cupsAddOption(preset->name, preset->value, num_pwgppds,
+ &pwgppds);
+ }
+ }
+ }
+
+ if (pwg)
+ {
+ if (pwg->sides_option &&
+ !ippFindAttribute(job->attrs, pwg->sides_option, IPP_TAG_ZERO) &&
+ (attr = ippFindAttribute(job->attrs, "sides", IPP_TAG_KEYWORD)) != NULL)
+ {
+ /*
+ * Add a duplex option...
+ */
+
+ if (!strcmp(attr->values[0].string.text, "one-sided"))
+ num_pwgppds = cupsAddOption(pwg->sides_option, pwg->sides_1sided,
+ num_pwgppds, &pwgppds);
+ else if (!strcmp(attr->values[0].string.text, "two-sided-long-edge"))
+ num_pwgppds = cupsAddOption(pwg->sides_option, pwg->sides_2sided_long,
+ num_pwgppds, &pwgppds);
+ else if (!strcmp(attr->values[0].string.text, "two-sided-short-edge"))
+ num_pwgppds = cupsAddOption(pwg->sides_option, pwg->sides_2sided_short,
+ num_pwgppds, &pwgppds);
+ }
+
+ if (!ippFindAttribute(job->attrs, "InputSlot", IPP_TAG_ZERO) &&
+ !ippFindAttribute(job->attrs, "HPPaperSource", IPP_TAG_ZERO))
+ {
+ if ((ppd = _pwgGetInputSlot(pwg, job->attrs, NULL)) != NULL)
+ num_pwgppds = cupsAddOption(pwg->source_option, ppd, num_pwgppds,
+ &pwgppds);
+ else if (!ippFindAttribute(job->attrs, "AP_D_InputSlot", IPP_TAG_ZERO))
+ num_pwgppds = cupsAddOption("AP_D_InputSlot", "", num_pwgppds,
+ &pwgppds);
+ }
+
+ if (!ippFindAttribute(job->attrs, "MediaType", IPP_TAG_ZERO) &&
+ (ppd = _pwgGetMediaType(pwg, job->attrs, NULL)) != NULL)
+ num_pwgppds = cupsAddOption("MediaType", ppd, num_pwgppds, &pwgppds);
+
+ if (!ippFindAttribute(job->attrs, "PageRegion", IPP_TAG_ZERO) &&
+ !ippFindAttribute(job->attrs, "PageSize", IPP_TAG_ZERO) &&
+ (ppd = _pwgGetPageSize(pwg, job->attrs, NULL, &exact)) != NULL)
+ {
+ num_pwgppds = cupsAddOption("PageSize", ppd, num_pwgppds, &pwgppds);
+
+ if (!ippFindAttribute(job->attrs, "media", IPP_TAG_ZERO))
+ num_pwgppds = cupsAddOption("media", ppd, num_pwgppds, &pwgppds);
+ }
+
+ if (!ippFindAttribute(job->attrs, "OutputBin", IPP_TAG_ZERO) &&
+ (attr = ippFindAttribute(job->attrs, "output-bin",
+ IPP_TAG_ZERO)) != NULL &&
+ (attr->value_tag == IPP_TAG_KEYWORD ||
+ attr->value_tag == IPP_TAG_NAME) &&
+ (ppd = _pwgGetOutputBin(pwg, attr->values[0].string.text)) != NULL)
+ num_pwgppds = cupsAddOption("OutputBin", ppd, num_pwgppds, &pwgppds);
+ }
+
+ /*
+ * Figure out how much room we need...
+ */
+
+ newlength = ipp_length(job->attrs);
+
+ for (i = num_pwgppds, pwgppd = pwgppds; i > 0; i --, pwgppd ++)
+ newlength += 1 + strlen(pwgppd->name) + 1 + strlen(pwgppd->value);
+
+ /*
+ * Then allocate/reallocate the option buffer as needed...
+ */
+
+ if (newlength > optlength || !options)
{
if (!options)
- optptr = malloc(i);
+ optptr = malloc(newlength);
else
- optptr = realloc(options, i);
+ optptr = realloc(options, newlength);
if (!optptr)
{
cupsdLogJob(job, CUPSD_LOG_CRIT,
- "Unable to allocate %d bytes for option buffer!", i);
+ "Unable to allocate " CUPS_LLFMT " bytes for option buffer!",
+ CUPS_LLCAST newlength);
return (NULL);
}
options = optptr;
- optlength = i;
+ optlength = newlength;
}
/*
@@ -3089,7 +3233,8 @@ get_options(cupsd_job_t *job, /* I - Job */
* Filter out other unwanted attributes...
*/
- if (attr->value_tag == IPP_TAG_MIMETYPE ||
+ if (attr->value_tag == IPP_TAG_NOVALUE ||
+ attr->value_tag == IPP_TAG_MIMETYPE ||
attr->value_tag == IPP_TAG_NAMELANG ||
attr->value_tag == IPP_TAG_TEXTLANG ||
(attr->value_tag == IPP_TAG_URI && strcmp(attr->name, "job-uuid")) ||
@@ -3097,8 +3242,7 @@ get_options(cupsd_job_t *job, /* I - Job */
attr->value_tag == IPP_TAG_BEGIN_COLLECTION) /* Not yet supported */
continue;
- if (!strncmp(attr->name, "time-", 5) ||
- !strcmp(attr->name, "job-hold-until"))
+ if (!strcmp(attr->name, "job-hold-until"))
continue;
if (!strncmp(attr->name, "job-", 4) &&
@@ -3156,7 +3300,6 @@ get_options(cupsd_job_t *job, /* I - Job */
if (!attr->values[i].boolean)
strlcat(optptr, "no", optlength - (optptr - options));
- case IPP_TAG_NOVALUE :
strlcat(optptr, attr->name,
optlength - (optptr - options));
break;
@@ -3205,6 +3348,25 @@ get_options(cupsd_job_t *job, /* I - Job */
}
}
+ /*
+ * Finally loop through the PWG->PPD mapped options and add them...
+ */
+
+ for (i = num_pwgppds, pwgppd = pwgppds; i > 0; i --, pwgppd ++)
+ {
+ *optptr++ = ' ';
+ strcpy(optptr, pwgppd->name);
+ optptr += strlen(optptr);
+ *optptr++ = '=';
+ strcpy(optptr, pwgppd->value);
+ optptr += strlen(optptr);
+ }
+
+ cupsFreeOptions(num_pwgppds, pwgppds);
+
+ /*
+ * Return the options string...
+ */
return (options);
}
@@ -3215,10 +3377,10 @@ get_options(cupsd_job_t *job, /* I - Job */
* the textual IPP attributes.
*/
-static int /* O - Size of attribute buffer */
+static size_t /* O - Size of attribute buffer */
ipp_length(ipp_t *ipp) /* I - IPP request */
{
- int bytes; /* Number of bytes */
+ size_t bytes; /* Number of bytes */
int i; /* Looping var */
ipp_attribute_t *attr; /* Current attribute */
@@ -3235,16 +3397,14 @@ ipp_length(ipp_t *ipp) /* I - IPP request */
* Skip attributes that won't be sent to filters...
*/
- if (attr->value_tag == IPP_TAG_MIMETYPE ||
+ if (attr->value_tag == IPP_TAG_NOVALUE ||
+ attr->value_tag == IPP_TAG_MIMETYPE ||
attr->value_tag == IPP_TAG_NAMELANG ||
attr->value_tag == IPP_TAG_TEXTLANG ||
attr->value_tag == IPP_TAG_URI ||
attr->value_tag == IPP_TAG_URISCHEME)
continue;
- if (strncmp(attr->name, "time-", 5) == 0)
- continue;
-
/*
* Add space for a leading space and commas between each value.
* For the first attribute, the leading space isn't used, so the
@@ -4286,7 +4446,8 @@ update_job(cupsd_job_t *job) /* I - Job to check */
{
cupsdLogJob(job, loglevel, "%s", message);
- if (loglevel < CUPSD_LOG_DEBUG)
+ if (loglevel < CUPSD_LOG_DEBUG &&
+ strcmp(job->printer->state_message, ptr))
{
strlcpy(job->printer->state_message, message,
sizeof(job->printer->state_message));
@@ -4321,7 +4482,7 @@ update_job(cupsd_job_t *job) /* I - Job to check */
if (event & CUPSD_EVENT_JOB_PROGRESS)
cupsdAddEvent(CUPSD_EVENT_JOB_PROGRESS, job->printer, job,
"%s", job->printer->state_message);
- else if (event & CUPSD_EVENT_PRINTER_STATE)
+ if (event & CUPSD_EVENT_PRINTER_STATE)
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, job->printer, NULL,
(job->printer->type & CUPS_PRINTER_CLASS) ?
"Class \"%s\" state changed." :
@@ -4476,5 +4637,5 @@ update_job_attrs(cupsd_job_t *job, /* I - Job to update */
/*
- * End of "$Id: job.c 9061 2010-03-30 22:07:33Z mike $".
+ * End of "$Id: job.c 9337 2010-10-17 04:13:56Z mike $".
*/
diff --git a/scheduler/main.c b/scheduler/main.c
index 61fc93bf..6e2b8265 100644
--- a/scheduler/main.c
+++ b/scheduler/main.c
@@ -1,5 +1,5 @@
/*
- * "$Id: main.c 9120 2010-04-23 18:56:34Z mike $"
+ * "$Id: main.c 9310 2010-09-21 22:34:57Z mike $"
*
* Main loop for the CUPS scheduler.
*
@@ -728,6 +728,8 @@ main(int argc, /* I - Number of command-line args */
* Shutdown the server...
*/
+ DoingShutdown = 1;
+
cupsdStopServer();
/*
@@ -758,6 +760,8 @@ main(int argc, /* I - Number of command-line args */
* Startup the server...
*/
+ DoingShutdown = 0;
+
cupsdStartServer();
/*
@@ -792,8 +796,7 @@ main(int argc, /* I - Number of command-line args */
!cupsArrayCount(ActiveJobs) &&
(!Browsing ||
(!BrowseRemoteProtocols &&
- (!NumBrowsers || !BrowseLocalProtocols ||
- cupsArrayCount(Printers) == 0))))
+ (!BrowseLocalProtocols || !cupsArrayCount(Printers)))))
{
timeout = LaunchdTimeout;
launchd_idle_exit = 1;
@@ -1134,6 +1137,8 @@ main(int argc, /* I - Number of command-line args */
* Close all network clients...
*/
+ DoingShutdown = 1;
+
cupsdStopServer();
#ifdef HAVE_LAUNCHD
@@ -1656,10 +1661,10 @@ launchd_checkout(void)
* shared printers to advertise...
*/
- if ((cupsArrayCount(ActiveJobs) || NumPolled ||
- (Browsing &&
- (BrowseRemoteProtocols ||
- (BrowseLocalProtocols && NumBrowsers && cupsArrayCount(Printers))))))
+ if (cupsArrayCount(ActiveJobs) || NumPolled ||
+ (Browsing &&
+ (BrowseRemoteProtocols ||
+ (BrowseLocalProtocols && cupsArrayCount(Printers)))))
{
cupsdLogMessage(CUPSD_LOG_DEBUG,
"Creating launchd keepalive file \"" CUPS_KEEPALIVE
@@ -2197,5 +2202,5 @@ usage(int status) /* O - Exit status */
/*
- * End of "$Id: main.c 9120 2010-04-23 18:56:34Z mike $".
+ * End of "$Id: main.c 9310 2010-09-21 22:34:57Z mike $".
*/
diff --git a/scheduler/printers.c b/scheduler/printers.c
index 7bcdb53d..9774853c 100644
--- a/scheduler/printers.c
+++ b/scheduler/printers.c
@@ -1,7 +1,7 @@
/*
- * "$Id: printers.c 9124 2010-04-23 20:53:38Z mike $"
+ * "$Id: printers.c 9313 2010-09-22 18:35:07Z mike $"
*
- * Printer routines for the Common UNIX Printing System (CUPS).
+ * Printer routines for the CUPS scheduler.
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
@@ -65,6 +65,21 @@
#include "cupsd.h"
#include <cups/dir.h>
+#ifdef HAVE_APPLICATIONSERVICES_H
+# include <ApplicationServices/ApplicationServices.h>
+#endif /* HAVE_APPLICATIONSERVICES_H */
+#ifdef HAVE_SYS_MOUNT_H
+# include <sys/mount.h>
+#endif /* HAVE_SYS_MOUNT_H */
+#ifdef HAVE_SYS_STATFS_H
+# include <sys/statfs.h>
+#endif /* HAVE_SYS_STATFS_H */
+#ifdef HAVE_SYS_STATVFS_H
+# include <sys/statvfs.h>
+#endif /* HAVE_SYS_STATVFS_H */
+#ifdef HAVE_SYS_VFS_H
+# include <sys/vfs.h>
+#endif /* HAVE_SYS_VFS_H */
/*
@@ -97,6 +112,7 @@ cupsd_printer_t * /* O - New printer */
cupsdAddPrinter(const char *name) /* I - Name of printer */
{
cupsd_printer_t *p; /* New printer */
+ char uri[1024]; /* Printer URI */
/*
@@ -120,8 +136,9 @@ cupsdAddPrinter(const char *name) /* I - Name of printer */
cupsdSetString(&p->info, name);
cupsdSetString(&p->hostname, ServerName);
- cupsdSetStringf(&p->uri, "ipp://%s:%d/printers/%s", ServerName, RemotePort,
- name);
+ httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
+ ServerName, RemotePort, "/printers/%s", name);
+ cupsdSetString(&p->uri, uri);
cupsdSetDeviceURI(p, "file:///dev/null");
p->state = IPP_PRINTER_STOPPED;
@@ -275,6 +292,14 @@ cupsdCreateCommonData(void)
char filename[1024], /* Filename */
*notifier; /* Current notifier */
cupsd_policy_t *p; /* Current policy */
+ int k_supported; /* Maximum file size supported */
+#ifdef HAVE_STATFS
+ struct statfs spoolinfo; /* FS info for spool directory */
+ double spoolsize; /* FS size */
+#elif defined(HAVE_STATVFS)
+ struct statvfs spoolinfo; /* FS info for spool directory */
+ double spoolsize; /* FS size */
+#endif /* HAVE_STATFS */
static const int nups[] = /* number-up-supported values */
{ 1, 2, 4, 6, 9, 16 };
static const int orients[4] =/* orientation-requested-supported values */
@@ -420,6 +445,7 @@ cupsdCreateCommonData(void)
"multiple-document-handling",
"number-up",
"output-bin",
+ "output-mode",
"orientation-requested",
"page-ranges",
"print-quality",
@@ -438,6 +464,7 @@ cupsdCreateCommonData(void)
"multiple-document-handling",
"number-up",
"output-bin",
+ "output-mode",
"orientation-requested",
"page-ranges",
"print-quality",
@@ -457,6 +484,34 @@ cupsdCreateCommonData(void)
CommonData = ippNew();
/*
+ * Get the maximum spool size based on the size of the filesystem used for
+ * the RequestRoot directory. If the host OS doesn't support the statfs call
+ * or the filesystem is larger than 2TiB, always report INT_MAX.
+ */
+
+#ifdef HAVE_STATFS
+ if (statfs(RequestRoot, &spoolinfo))
+ k_supported = INT_MAX;
+ else if ((spoolsize = (double)spoolinfo.f_bsize * spoolinfo.f_blocks / 1024) >
+ INT_MAX)
+ k_supported = INT_MAX;
+ else
+ k_supported = (int)spoolsize;
+
+#elif defined(HAVE_STATVFS)
+ if (statvfs(RequestRoot, &spoolinfo))
+ k_supported = INT_MAX;
+ else if ((spoolsize = (double)spoolinfo.f_frsize * spoolinfo.f_blocks / 1024) >
+ INT_MAX)
+ k_supported = INT_MAX;
+ else
+ k_supported = (int)spoolsize;
+
+#else
+ k_supported = INT_MAX;
+#endif /* HAVE_STATFS */
+
+ /*
* This list of attributes is sorted to improve performance when the
* client provides a requested-attributes attribute...
*/
@@ -649,9 +704,9 @@ cupsdCreateCommonData(void)
/* page-ranges-supported */
ippAddBoolean(CommonData, IPP_TAG_PRINTER, "page-ranges-supported", 1);
- /* pdf-override-supported */
+ /* pdl-override-supported */
ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
- "pdl-override-supported", NULL, "not-attempted");
+ "pdl-override-supported", NULL, "attempted");
/* printer-op-policy-supported */
attr = ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_NAME | IPP_TAG_COPY,
@@ -1550,7 +1605,7 @@ cupsdSaveAllPrinters(void)
*/
fchown(cupsFileNumber(fp), getuid(), Group);
- fchmod(cupsFileNumber(fp), 0600);
+ fchmod(cupsFileNumber(fp), ConfigFilePerm & 0600);
/*
* Write a small header to the file...
@@ -2670,8 +2725,8 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
int /* O - 1 if something changed, 0 otherwise */
cupsdSetPrinterReasons(
- cupsd_printer_t *p, /* I - Printer */
- const char *s) /* I - Reasons strings */
+ cupsd_printer_t *p, /* I - Printer */
+ const char *s) /* I - Reasons strings */
{
int i, /* Looping var */
changed = 0; /* Did something change? */
@@ -3988,11 +4043,11 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
* Check to see if the cache is up-to-date...
*/
- snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp2", CacheDir, p->name);
+ snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp4", CacheDir, p->name);
if (stat(cache_name, &cache_info))
cache_info.st_mtime = 0;
- snprintf(pwg_name, sizeof(pwg_name), "%s/%s.pwg", CacheDir, p->name);
+ snprintf(pwg_name, sizeof(pwg_name), "%s/%s.pwg3", CacheDir, p->name);
if (stat(pwg_name, &pwg_info))
pwg_info.st_mtime = 0;
@@ -4473,10 +4528,18 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
"output-bin-default", NULL, p->pwg->bins[0].pwg);
}
- else if ((ppd_attr = ppdFindAttr(ppd, "DefaultOutputOrder",
+ else if (((ppd_attr = ppdFindAttr(ppd, "DefaultOutputOrder",
NULL)) != NULL &&
- !strcasecmp(ppd_attr->value, "Reverse"))
+ !strcasecmp(ppd_attr->value, "Reverse")) ||
+ (!ppd_attr && ppd->manufacturer && /* "Compatibility heuristic" */
+ (!strcasecmp(ppd->manufacturer, "epson") ||
+ !strcasecmp(ppd->manufacturer, "lexmark"))))
{
+ /*
+ * Report that this printer has a single output bin that leaves pages face
+ * up.
+ */
+
ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
"output-bin-supported", NULL, "face-up");
ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
@@ -4491,6 +4554,31 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
}
/*
+ * output-mode...
+ */
+
+ if (ppd->color_device)
+ {
+ static const char * const output_modes[] =
+ {
+ "monochrome",
+ "color"
+ };
+
+ ippAddStrings(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "output-mode-supported", 2, NULL, output_modes);
+ ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "output-mode-default", NULL, "color");
+ }
+ else
+ {
+ ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "output-mode-supported", NULL, "monochrome");
+ ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
+ "output-mode-default", NULL, "monochrome");
+ }
+
+ /*
* Printer resolutions...
*/
@@ -4523,7 +4611,7 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
cupsdLogMessage(CUPSD_LOG_WARN,
"Bad resolution \"%s\" for printer %s.",
choice->choice, p->name);
- xdpi = ydpi = 72;
+ xdpi = ydpi = 300;
}
attr->values[i].resolution.xres = xdpi;
@@ -4557,7 +4645,7 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
cupsdLogMessage(CUPSD_LOG_WARN,
"Bad default resolution \"%s\" for printer %s.",
ppd_attr->value, p->name);
- xdpi = ydpi = 72;
+ xdpi = ydpi = 300;
}
ippAddResolution(p->ppd_attrs, IPP_TAG_PRINTER,
@@ -4575,16 +4663,18 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
ippAddResolution(p->ppd_attrs, IPP_TAG_PRINTER,
"printer-resolution-default", IPP_RES_PER_INCH,
- 72, 72);
+ 300, 300);
ippAddResolution(p->ppd_attrs, IPP_TAG_PRINTER,
"printer-resolution-supported", IPP_RES_PER_INCH,
- 72, 72);
+ 300, 300);
}
/*
* Duplexing, etc...
*/
+ ppdMarkDefaults(ppd);
+
if ((duplex = ppdFindOption(ppd, "Duplex")) == NULL)
if ((duplex = ppdFindOption(ppd, "EFDuplex")) == NULL)
if ((duplex = ppdFindOption(ppd, "EFDuplexing")) == NULL)
@@ -4846,6 +4936,129 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
if (ppdFindAttr(ppd, "APRemoteQueueID", NULL))
p->type |= CUPS_PRINTER_REMOTE;
+#ifdef HAVE_APPLICATIONSERVICES_H
+ /*
+ * Convert the file referenced in APPrinterIconPath to a 128x128 PNG
+ * and save it as cacheDir/printername.png
+ */
+
+ if ((ppd_attr = ppdFindAttr(ppd, "APPrinterIconPath", NULL)) != NULL &&
+ ppd_attr->value)
+ {
+ CGImageRef imageRef = NULL;/* Current icon image */
+ CGImageRef biggestIconRef = NULL;
+ /* Biggest icon image */
+ CGImageRef closestTo128IconRef = NULL;
+ /* Icon image closest to and >= 128 */
+ CGImageSourceRef sourceRef; /* The file's image source */
+ char outPath[HTTP_MAX_URI];
+ /* The path to the PNG file */
+ CFURLRef outUrl; /* The URL made from the outPath */
+ CFURLRef icnsFileUrl; /* The URL of the original ICNS icon file */
+ CGImageDestinationRef destRef; /* The image destination to write */
+ size_t bytesPerRow; /* The bytes per row used for resizing */
+ CGContextRef context; /* The CG context used for resizing */
+
+ snprintf(outPath, sizeof(outPath), "%s/%s.png", CacheDir, p->name);
+ outUrl = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
+ (UInt8 *)outPath,
+ strlen(outPath),
+ FALSE);
+ icnsFileUrl = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
+ (UInt8 *)ppd_attr->value,
+ strlen(ppd_attr->value),
+ FALSE);
+ if (outUrl && icnsFileUrl)
+ {
+ sourceRef = CGImageSourceCreateWithURL(icnsFileUrl, NULL);
+ if (sourceRef)
+ {
+ for (i = 0; i < CGImageSourceGetCount(sourceRef); i ++)
+ {
+ imageRef = CGImageSourceCreateImageAtIndex(sourceRef, i, NULL);
+ if (imageRef &&
+ CGImageGetWidth(imageRef) == CGImageGetHeight(imageRef))
+ {
+ /*
+ * Loop through remembering the icon closest to 128 but >= 128
+ * and then remember the largest icon.
+ */
+
+ if (CGImageGetWidth(imageRef) >= 128 &&
+ (!closestTo128IconRef ||
+ CGImageGetWidth(imageRef) <
+ CGImageGetWidth(closestTo128IconRef)))
+ {
+ CGImageRelease(closestTo128IconRef);
+ CGImageRetain(imageRef);
+ closestTo128IconRef = imageRef;
+ }
+
+ if (!biggestIconRef ||
+ CGImageGetWidth(imageRef) > CGImageGetWidth(biggestIconRef))
+ {
+ CGImageRelease(biggestIconRef);
+ CGImageRetain(imageRef);
+ biggestIconRef = imageRef;
+ }
+
+ CGImageRelease(imageRef);
+ }
+ }
+
+ if (biggestIconRef)
+ {
+ /*
+ * If biggestIconRef is NULL, we found no icons. Otherwise we first
+ * want the closest to 128, but if none are larger than 128, we want
+ * the largest icon available.
+ */
+
+ imageRef = closestTo128IconRef ? closestTo128IconRef :
+ biggestIconRef;
+ CGImageRetain(imageRef);
+ CGImageRelease(biggestIconRef);
+ CGImageRelease(closestTo128IconRef);
+ destRef = CGImageDestinationCreateWithURL(outUrl, kUTTypePNG, 1,
+ NULL);
+ if (destRef)
+ {
+ if (CGImageGetWidth(imageRef) != 128)
+ {
+ bytesPerRow = CGImageGetBytesPerRow(imageRef) /
+ CGImageGetWidth(imageRef) * 128;
+ context = CGBitmapContextCreate(NULL, 128, 128,
+ CGImageGetBitsPerComponent(imageRef),
+ bytesPerRow,
+ CGImageGetColorSpace(imageRef),
+ kCGImageAlphaPremultipliedFirst);
+ if (context)
+ {
+ CGContextDrawImage(context, CGRectMake(0, 0, 128, 128),
+ imageRef);
+ CGImageRelease(imageRef);
+ imageRef = CGBitmapContextCreateImage(context);
+ CGContextRelease(context);
+ }
+ }
+
+ CGImageDestinationAddImage(destRef, imageRef, NULL);
+ CGImageDestinationFinalize(destRef);
+ CFRelease(destRef);
+ }
+
+ CGImageRelease(imageRef);
+ }
+
+ CFRelease(sourceRef);
+ CFRelease(icnsFileUrl);
+ }
+
+ CFRelease(outUrl);
+ }
+ }
+#endif /* HAVE_APPLICATIONSERVICES_H */
+
/*
* Close the PPD and set the type...
*/
@@ -5342,5 +5555,5 @@ write_xml_string(cups_file_t *fp, /* I - File to write to */
/*
- * End of "$Id: printers.c 9124 2010-04-23 20:53:38Z mike $".
+ * End of "$Id: printers.c 9313 2010-09-22 18:35:07Z mike $".
*/
diff --git a/systemv/cupsaddsmb.c b/systemv/cupsaddsmb.c
index 18b1a2f6..378f7999 100644
--- a/systemv/cupsaddsmb.c
+++ b/systemv/cupsaddsmb.c
@@ -1,5 +1,5 @@
/*
- * "$Id: cupsaddsmb.c 7033 2007-10-19 02:11:28Z mike $"
+ * "$Id: cupsaddsmb.c 9258 2010-08-13 01:34:04Z mike $"
*
* "cupsaddsmb" command for the Common UNIX Printing System (CUPS).
*
@@ -224,6 +224,7 @@ export_dest(http_t *http, /* I - Connection to server */
int status; /* Status of export */
char ppdfile[1024], /* PPD file for printer drivers */
prompt[1024]; /* Password prompt */
+ int tries; /* Number of tries */
/*
@@ -243,7 +244,7 @@ export_dest(http_t *http, /* I - Connection to server */
* Try to export it...
*/
- for (status = 0; !status;)
+ for (status = 0, tries = 0; !status && tries < 3; tries ++)
{
/*
* Get the password, as needed...
@@ -298,5 +299,5 @@ usage(void)
/*
- * End of "$Id: cupsaddsmb.c 7033 2007-10-19 02:11:28Z mike $".
+ * End of "$Id: cupsaddsmb.c 9258 2010-08-13 01:34:04Z mike $".
*/
diff --git a/systemv/lpadmin.c b/systemv/lpadmin.c
index d4011e13..2829fbcc 100644
--- a/systemv/lpadmin.c
+++ b/systemv/lpadmin.c
@@ -1,9 +1,9 @@
/*
- * "$Id: lpadmin.c 8359 2009-02-16 23:57:08Z mike $"
+ * "$Id: lpadmin.c 9258 2010-08-13 01:34:04Z mike $"
*
- * "lpadmin" command for the Common UNIX Printing System (CUPS).
+ * "lpadmin" command for CUPS.
*
- * Copyright 2007-2009 by Apple Inc.
+ * Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -17,17 +17,12 @@
* main() - Parse options and configure the scheduler.
* add_printer_to_class() - Add a printer to a class.
* default_printer() - Set the default printing destination.
- * delete_printer() - Delete a printer from the system...
+ * delete_printer() - Delete a printer from the system.
* delete_printer_from_class() - Delete a printer from a class.
- * enable_printer() - Enable a printer...
- * set_printer_device() - Set the device-uri attribute.
- * set_printer_file() - Set the interface script or PPD file.
- * set_printer_info() - Set the printer description string.
- * set_printer_location() - Set the printer location string.
- * set_printer_model() - Set the driver model file.
- * set_printer_options() - Set the printer options.
+ * enable_printer() - Enable a printer.
+ * set_printer_options() - Set the printer options and/or file.
* validate_name() - Make sure the printer name only contains
- * valid chars...
+ * valid chars.
*/
/*
@@ -42,28 +37,22 @@
#include <cups/cups.h>
#include <cups/i18n.h>
#include <cups/debug.h>
-#ifdef HAVE_LIBZ
-# include <zlib.h>
-#endif /* HAVE_LIBZ */
/*
* Local functions...
*/
-static int add_printer_to_class(http_t *, char *, char *);
-static int default_printer(http_t *, char *);
-static int delete_printer(http_t *, char *);
-static int delete_printer_from_class(http_t *, char *, char *);
-static int enable_printer(http_t *, char *);
-static char *get_line(char *, int, FILE *fp);
-static int set_printer_device(http_t *, char *, char *);
-static int set_printer_file(http_t *, char *, char *);
-static int set_printer_info(http_t *, char *, char *);
-static int set_printer_location(http_t *, char *, char *);
-static int set_printer_model(http_t *, char *, char *);
-static int set_printer_options(http_t *, char *, int, cups_option_t *);
-static int validate_name(const char *);
+static int add_printer_to_class(http_t *http, char *printer, char *pclass);
+static int default_printer(http_t *http, char *printer);
+static int delete_printer(http_t *http, char *printer);
+static int delete_printer_from_class(http_t *http, char *printer,
+ char *pclass);
+static int enable_printer(http_t *http, char *printer);
+static int set_printer_options(http_t *http, char *printer,
+ int num_options, cups_option_t *options,
+ char *file);
+static int validate_name(const char *name);
/*
@@ -81,6 +70,7 @@ main(int argc, /* I - Number of command-line arguments */
*val; /* Pointer to allow/deny value */
int num_options; /* Number of options */
cups_option_t *options; /* Options */
+ char *file; /* New PPD file/interface script */
_cupsSetLocale(argv);
@@ -89,6 +79,7 @@ main(int argc, /* I - Number of command-line arguments */
printer = NULL;
num_options = 0;
options = NULL;
+ file = NULL;
for (i = 1; i < argc; i ++)
if (argv[i][0] == '-')
@@ -219,34 +210,8 @@ main(int argc, /* I - Number of command-line arguments */
break;
case 'i' : /* Use the specified interface script */
- if (!http)
- {
- http = httpConnectEncrypt(cupsServer(), ippPort(),
- cupsEncryption());
-
- if (http == NULL)
- {
- _cupsLangPrintf(stderr,
- _("lpadmin: Unable to connect to server: %s\n"),
- strerror(errno));
- return (1);
- }
- }
-
- if (printer == NULL)
- {
- _cupsLangPuts(stderr,
- _("lpadmin: Unable to set the interface script:\n"
- " You must specify a printer name "
- "first!\n"));
- return (1);
- }
-
if (argv[i][2])
- {
- if (set_printer_file(http, printer, argv[i] + 2))
- return (1);
- }
+ file = argv[i] + 2;
else
{
i ++;
@@ -259,8 +224,7 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
- if (set_printer_file(http, printer, argv[i]))
- return (1);
+ file = argv[i];
}
break;
@@ -299,35 +263,9 @@ main(int argc, /* I - Number of command-line arguments */
break;
case 'm' : /* Use the specified standard script/PPD file */
- if (!http)
- {
- http = httpConnectEncrypt(cupsServer(), ippPort(),
- cupsEncryption());
-
- if (http == NULL)
- {
- _cupsLangPrintf(stderr,
- _("lpadmin: Unable to connect to server: %s\n"),
- strerror(errno));
- return (1);
- }
- }
-
- if (printer == NULL)
- {
- _cupsLangPuts(stderr,
- _("lpadmin: Unable to set the interface script or "
- "PPD file:\n"
- " You must specify a printer name "
- "first!\n"));
- return (1);
- }
-
if (argv[i][2])
- {
- if (set_printer_model(http, printer, argv[i] + 2))
- return (1);
- }
+ num_options = cupsAddOption("ppd-name", argv[i] + 2, num_options,
+ &options);
else
{
i ++;
@@ -340,8 +278,8 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
- if (set_printer_model(http, printer, argv[i]))
- return (1);
+ num_options = cupsAddOption("ppd-name", argv[i], num_options,
+ &options);
}
break;
@@ -365,20 +303,6 @@ main(int argc, /* I - Number of command-line arguments */
break;
case 'p' : /* Add/modify a printer */
- if (!http)
- {
- http = httpConnectEncrypt(cupsServer(), ippPort(),
- cupsEncryption());
-
- if (http == NULL)
- {
- _cupsLangPrintf(stderr,
- _("lpadmin: Unable to connect to server: %s\n"),
- strerror(errno));
- return (1);
- }
- }
-
if (argv[i][2])
printer = argv[i] + 2;
else
@@ -512,34 +436,9 @@ main(int argc, /* I - Number of command-line arguments */
break;
case 'v' : /* Set the device-uri attribute */
- if (!http)
- {
- http = httpConnectEncrypt(cupsServer(), ippPort(),
- cupsEncryption());
-
- if (http == NULL)
- {
- _cupsLangPrintf(stderr,
- _("lpadmin: Unable to connect to server: %s\n"),
- strerror(errno));
- return (1);
- }
- }
-
- if (printer == NULL)
- {
- _cupsLangPuts(stderr,
- _("lpadmin: Unable to set the device URI:\n"
- " You must specify a printer name "
- "first!\n"));
- return (1);
- }
-
if (argv[i][2])
- {
- if (set_printer_device(http, printer, argv[i] + 2))
- return (1);
- }
+ num_options = cupsAddOption("device-uri", argv[i] + 2,
+ num_options, &options);
else
{
i ++;
@@ -552,8 +451,8 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
- if (set_printer_device(http, printer, argv[i]))
- return (1);
+ num_options = cupsAddOption("device-uri", argv[i],
+ num_options, &options);
}
break;
@@ -604,35 +503,9 @@ main(int argc, /* I - Number of command-line arguments */
break;
case 'D' : /* Set the printer-info attribute */
- if (!http)
- {
- http = httpConnectEncrypt(cupsServer(), ippPort(),
- cupsEncryption());
-
- if (http == NULL)
- {
- _cupsLangPrintf(stderr,
- _("lpadmin: Unable to connect to server: %s\n"),
- strerror(errno));
- return (1);
- }
- }
-
- if (printer == NULL)
- {
- _cupsLangPuts(stderr,
- _("lpadmin: Unable to set the printer "
- "description:\n"
- " You must specify a printer name "
- "first!\n"));
- return (1);
- }
-
if (argv[i][2])
- {
- if (set_printer_info(http, printer, argv[i] + 2))
- return (1);
- }
+ num_options = cupsAddOption("printer-info", argv[i] + 2,
+ num_options, &options);
else
{
i ++;
@@ -645,8 +518,8 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
- if (set_printer_info(http, printer, argv[i]))
- return (1);
+ num_options = cupsAddOption("printer-info", argv[i],
+ num_options, &options);
}
break;
@@ -666,34 +539,9 @@ main(int argc, /* I - Number of command-line arguments */
break;
case 'L' : /* Set the printer-location attribute */
- if (!http)
- {
- http = httpConnectEncrypt(cupsServer(), ippPort(),
- cupsEncryption());
-
- if (http == NULL)
- {
- _cupsLangPrintf(stderr,
- _("lpadmin: Unable to connect to server: %s\n"),
- strerror(errno));
- return (1);
- }
- }
-
- if (printer == NULL)
- {
- _cupsLangPuts(stderr,
- _("lpadmin: Unable to set the printer location:\n"
- " You must specify a printer name "
- "first!\n"));
- return (1);
- }
-
if (argv[i][2])
- {
- if (set_printer_location(http, printer, argv[i] + 2))
- return (1);
- }
+ num_options = cupsAddOption("printer-location", argv[i] + 2,
+ num_options, &options);
else
{
i ++;
@@ -706,40 +554,14 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
- if (set_printer_location(http, printer, argv[i]))
- return (1);
+ num_options = cupsAddOption("printer-location", argv[i],
+ num_options, &options);
}
break;
case 'P' : /* Use the specified PPD file */
- if (!http)
- {
- http = httpConnectEncrypt(cupsServer(), ippPort(),
- cupsEncryption());
-
- if (http == NULL)
- {
- _cupsLangPrintf(stderr,
- _("lpadmin: Unable to connect to server: %s\n"),
- strerror(errno));
- return (1);
- }
- }
-
- if (printer == NULL)
- {
- _cupsLangPuts(stderr,
- _("lpadmin: Unable to set the PPD file:\n"
- " You must specify a printer name "
- "first!\n"));
- return (1);
- }
-
if (argv[i][2])
- {
- if (set_printer_file(http, printer, argv[i] + 2))
- return (1);
- }
+ file = argv[i] + 2;
else
{
i ++;
@@ -751,8 +573,7 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
- if (set_printer_file(http, printer, argv[i]))
- return (1);
+ file = argv[i];
}
break;
@@ -772,7 +593,7 @@ main(int argc, /* I - Number of command-line arguments */
* Set options as needed...
*/
- if (num_options)
+ if (num_options || file)
{
if (!http)
{
@@ -795,7 +616,7 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
- if (set_printer_options(http, printer, num_options, options))
+ if (set_printer_options(http, printer, num_options, options, file))
return (1);
}
@@ -1289,429 +1110,6 @@ enable_printer(http_t *http, /* I - Server connection */
/*
- * 'get_line()' - Get a line that is terminated by a LF, CR, or CR LF.
- */
-
-static char * /* O - Pointer to buf or NULL on EOF */
-get_line(char *buf, /* I - Line buffer */
- int length, /* I - Length of buffer */
- FILE *fp) /* I - File to read from */
-{
- char *bufptr; /* Pointer into buffer */
- int ch; /* Character from file */
-
-
- length --;
- bufptr = buf;
-
- while ((ch = getc(fp)) != EOF)
- {
- if (ch == '\n')
- break;
- else if (ch == '\r')
- {
- /*
- * Look for LF...
- */
-
- ch = getc(fp);
- if (ch != '\n' && ch != EOF)
- ungetc(ch, fp);
-
- break;
- }
-
- *bufptr++ = ch;
- length --;
- if (length == 0)
- break;
- }
-
- *bufptr = '\0';
-
- if (ch == EOF)
- return (NULL);
- else
- return (buf);
-}
-
-
-/*
- * 'set_printer_device()' - Set the device-uri attribute.
- */
-
-static int /* O - 0 on success, 1 on fail */
-set_printer_device(http_t *http, /* I - Server connection */
- char *printer, /* I - Printer */
- char *device) /* I - New device URI */
-{
- ipp_t *request, /* IPP Request */
- *response; /* IPP Response */
- char uri[HTTP_MAX_URI]; /* URI for printer/class */
-
-
- DEBUG_printf(("set_printer_device(%p, \"%s\", \"%s\")\n", http, printer,
- device));
-
- /*
- * Build a CUPS_ADD_PRINTER request, which requires the following
- * attributes:
- *
- * attributes-charset
- * attributes-natural-language
- * printer-uri
- */
-
- request = ippNewRequest(CUPS_ADD_PRINTER);
-
- httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
- "localhost", 0, "/printers/%s", printer);
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
- "printer-uri", NULL, uri);
-
- /*
- * Add the device URI...
- */
-
- if (device[0] == '/')
- {
- /*
- * Convert filename to URI...
- */
-
- snprintf(uri, sizeof(uri), "file://%s", device);
- ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL,
- uri);
- }
- else
- ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL,
- device);
-
- /*
- * Do the request and get back a response...
- */
-
- if ((response = cupsDoRequest(http, request, "/admin/")) == NULL)
- {
- _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
-
- return (1);
- }
- else if (response->request.status.status_code > IPP_OK_CONFLICT)
- {
- _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
-
- ippDelete(response);
-
- return (1);
- }
- else
- {
- ippDelete(response);
-
- return (0);
- }
-}
-
-
-/*
- * 'set_printer_file()' - Set the interface script or PPD file.
- */
-
-static int /* O - 0 on success, 1 on fail */
-set_printer_file(http_t *http, /* I - Server connection */
- char *printer, /* I - Printer */
- char *file) /* I - PPD file or interface script */
-{
- ipp_t *request, /* IPP Request */
- *response; /* IPP Response */
- char uri[HTTP_MAX_URI]; /* URI for printer/class */
-#ifdef HAVE_LIBZ
- char tempfile[1024]; /* Temporary filename */
- int fd; /* Temporary file */
- gzFile *gz; /* GZIP'd file */
- char buffer[8192]; /* Copy buffer */
- int bytes; /* Bytes in buffer */
-
-
- DEBUG_printf(("set_printer_file(%p, \"%s\", \"%s\")\n", http, printer,
- file));
-
- /*
- * See if the file is gzip'd; if so, unzip it to a temporary file and
- * send the uncompressed file.
- */
-
- if (!strcmp(file + strlen(file) - 3, ".gz"))
- {
- /*
- * Yes, the file is compressed; uncompress to a temp file...
- */
-
- if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
- {
- _cupsLangPrintError(_("ERROR: Unable to create temporary file"));
- return (1);
- }
-
- if ((gz = gzopen(file, "rb")) == NULL)
- {
- _cupsLangPrintf(stderr,
- _("lpadmin: Unable to open file \"%s\": %s\n"),
- file, strerror(errno));
- close(fd);
- unlink(tempfile);
- return (1);
- }
-
- while ((bytes = gzread(gz, buffer, sizeof(buffer))) > 0)
- write(fd, buffer, bytes);
-
- close(fd);
- gzclose(gz);
-
- file = tempfile;
- }
-#endif /* HAVE_LIBZ */
-
- /*
- * Build a CUPS_ADD_PRINTER request, which requires the following
- * attributes:
- *
- * attributes-charset
- * attributes-natural-language
- * printer-uri
- */
-
- request = ippNewRequest(CUPS_ADD_PRINTER);
-
- httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
- "localhost", 0, "/printers/%s", printer);
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
- "printer-uri", NULL, uri);
-
- /*
- * Do the request and get back a response...
- */
-
- response = cupsDoFileRequest(http, request, "/admin/", file);
- ippDelete(response);
-
-#ifdef HAVE_LIBZ
- /*
- * Remove the temporary file as needed...
- */
-
- if (file == tempfile)
- unlink(tempfile);
-#endif /* HAVE_LIBZ */
-
- if (cupsLastError() > IPP_OK_CONFLICT)
- {
- _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
-
- return (1);
- }
- else
- return (0);
-}
-
-
-/*
- * 'set_printer_info()' - Set the printer description string.
- */
-
-static int /* O - 0 on success, 1 on fail */
-set_printer_info(http_t *http, /* I - Server connection */
- char *printer, /* I - Printer */
- char *info) /* I - New description string */
-{
- ipp_t *request, /* IPP Request */
- *response; /* IPP Response */
- char uri[HTTP_MAX_URI]; /* URI for printer/class */
-
-
- DEBUG_printf(("set_printer_info(%p, \"%s\", \"%s\")\n", http, printer,
- info));
-
- /*
- * Build a CUPS_ADD_PRINTER request, which requires the following
- * attributes:
- *
- * attributes-charset
- * attributes-natural-language
- * printer-uri
- */
-
- request = ippNewRequest(CUPS_ADD_PRINTER);
-
- httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
- "localhost", 0, "/printers/%s", printer);
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
- "printer-uri", NULL, uri);
-
- /*
- * Add the info string...
- */
-
- ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-info", NULL,
- info);
-
- /*
- * Do the request and get back a response...
- */
-
- if ((response = cupsDoRequest(http, request, "/admin/")) == NULL)
- {
- _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
- return (1);
- }
- else if (response->request.status.status_code > IPP_OK_CONFLICT)
- {
- _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
-
- ippDelete(response);
-
- return (1);
- }
- else
- {
- ippDelete(response);
-
- return (0);
- }
-}
-
-
-/*
- * 'set_printer_location()' - Set the printer location string.
- */
-
-static int /* O - 0 on success, 1 on fail */
-set_printer_location(http_t *http, /* I - Server connection */
- char *printer, /* I - Printer */
- char *location) /* I - New location string */
-{
- ipp_t *request, /* IPP Request */
- *response; /* IPP Response */
- char uri[HTTP_MAX_URI]; /* URI for printer/class */
-
-
- DEBUG_printf(("set_printer_location(%p, \"%s\", \"%s\")\n", http, printer,
- location));
-
- /*
- * Build a CUPS_ADD_PRINTER request, which requires the following
- * attributes:
- *
- * attributes-charset
- * attributes-natural-language
- * printer-uri
- */
-
- request = ippNewRequest(CUPS_ADD_PRINTER);
-
- httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
- "localhost", 0, "/printers/%s", printer);
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
- "printer-uri", NULL, uri);
-
- /*
- * Add the location string...
- */
-
- ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-location", NULL,
- location);
-
- /*
- * Do the request and get back a response...
- */
-
- if ((response = cupsDoRequest(http, request, "/admin/")) == NULL)
- {
- _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
-
- return (1);
- }
- else if (response->request.status.status_code > IPP_OK_CONFLICT)
- {
- _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
-
- ippDelete(response);
-
- return (1);
- }
- else
- {
- ippDelete(response);
-
- return (0);
- }
-}
-
-
-/*
- * 'set_printer_model()' - Set the driver model file.
- */
-
-static int /* O - 0 on success, 1 on fail */
-set_printer_model(http_t *http, /* I - Server connection */
- char *printer, /* I - Printer */
- char *model) /* I - Driver model file */
-{
- ipp_t *request, /* IPP Request */
- *response; /* IPP Response */
- char uri[HTTP_MAX_URI]; /* URI for printer/class */
-
-
- /*
- * Build a CUPS_ADD_PRINTER request, which requires the following
- * attributes:
- *
- * attributes-charset
- * attributes-natural-language
- * printer-uri
- * ppd-name
- */
-
- request = ippNewRequest(CUPS_ADD_PRINTER);
-
- httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
- "localhost", 0, "/printers/%s", printer);
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
- "printer-uri", NULL, uri);
-
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
- "ppd-name", NULL, model);
-
- /*
- * Do the request and get back a response...
- */
-
- if ((response = cupsDoRequest(http, request, "/admin/")) == NULL)
- {
- _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
-
- return (1);
- }
- else if (response->request.status.status_code > IPP_OK_CONFLICT)
- {
- _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString());
-
- ippDelete(response);
-
- return (1);
- }
- else
- {
- ippDelete(response);
-
- return (0);
- }
-}
-
-
-/*
* 'set_printer_options()' - Set the printer options.
*/
@@ -1720,7 +1118,8 @@ set_printer_options(
http_t *http, /* I - Server connection */
char *printer, /* I - Printer */
int num_options, /* I - Number of options */
- cups_option_t *options) /* I - Options */
+ cups_option_t *options, /* I - Options */
+ char *file) /* I - PPD file/interface script */
{
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
@@ -1735,14 +1134,15 @@ set_printer_options(
keyword[1024], /* Keyword from Default line */
*keyptr, /* Pointer into keyword... */
tempfile[1024]; /* Temporary filename */
- FILE *in, /* PPD file */
+ cups_file_t *in, /* PPD file */
*out; /* Temporary file */
- int outfd; /* Temporary file descriptor */
- const char *protocol; /* Old protocol option */
+ const char *protocol, /* Old protocol option */
+ *customval; /* Custom option value */
- DEBUG_printf(("set_printer_options(%p, \"%s\", %d, %p)\n", http, printer,
- num_options, options));
+ DEBUG_printf(("set_printer_options(http=%p, printer=\"%s\", num_options=%d, "
+ "options=%p, file=\"%s\")\n", http, printer, num_options,
+ options, file));
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/printers/%s", printer);
@@ -1761,7 +1161,6 @@ set_printer_options(
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
-
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "printer-type");
@@ -1769,7 +1168,7 @@ set_printer_options(
* Do the request...
*/
- op = CUPS_ADD_PRINTER;
+ op = CUPS_ADD_MODIFY_PRINTER;
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
@@ -1782,7 +1181,7 @@ set_printer_options(
{
if (attr->values[0].integer & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT))
{
- op = CUPS_ADD_CLASS;
+ op = CUPS_ADD_MODIFY_CLASS;
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/classes/%s", printer);
}
@@ -1792,8 +1191,8 @@ set_printer_options(
}
/*
- * Build a CUPS_ADD_PRINTER or CUPS_ADD_CLASS request, which requires
- * the following attributes:
+ * Build a CUPS_ADD_MODIFY_PRINTER or CUPS_ADD_MODIFY_CLASS request, which
+ * requires the following attributes:
*
* attributes-charset
* attributes-natural-language
@@ -1805,6 +1204,8 @@ set_printer_options(
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());
/*
* Add the options...
@@ -1822,7 +1223,9 @@ set_printer_options(
NULL, "tbcp");
}
- if (op == CUPS_ADD_PRINTER)
+ if (file)
+ ppdfile = file;
+ else if (op == CUPS_ADD_MODIFY_PRINTER)
ppdfile = cupsGetPPD(printer);
else
ppdfile = NULL;
@@ -1837,33 +1240,34 @@ set_printer_options(
ppdMarkDefaults(ppd);
cupsMarkOptions(ppd, num_options, options);
- if ((outfd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
+ if ((out = cupsTempFile2(tempfile, sizeof(tempfile))) < 0)
{
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
ippDelete(request);
- unlink(ppdfile);
+ if (ppdfile != file)
+ unlink(ppdfile);
return (1);
}
- if ((in = fopen(ppdfile, "rb")) == NULL)
+ if ((in = cupsFileOpen(ppdfile, "r")) == NULL)
{
_cupsLangPrintf(stderr,
_("lpadmin: Unable to open PPD file \"%s\" - %s\n"),
ppdfile, strerror(errno));
ippDelete(request);
- unlink(ppdfile);
- close(outfd);
+ if (ppdfile != file)
+ unlink(ppdfile);
+ cupsFileClose(out);
unlink(tempfile);
return (1);
}
- out = fdopen(outfd, "wb");
ppdchanged = 0;
- while (get_line(line, sizeof(line), in) != NULL)
+ while (cupsFileGets(in, line, sizeof(line)))
{
if (strncmp(line, "*Default", 8))
- fprintf(out, "%s\n", line);
+ cupsFilePrintf(out, "%s\n", line);
else
{
/*
@@ -1893,17 +1297,27 @@ set_printer_options(
if (choice && strcmp(choice->choice, keyptr))
{
- fprintf(out, "*Default%s: %s\n", keyword, choice->choice);
- ppdchanged = 1;
+ if (strcmp(choice->choice, "Custom"))
+ {
+ cupsFilePrintf(out, "*Default%s: %s\n", keyword, choice->choice);
+ ppdchanged = 1;
+ }
+ else if ((customval = cupsGetOption(keyword, num_options,
+ options)) != NULL)
+ {
+ cupsFilePrintf(out, "*Default%s: %s\n", keyword, customval);
+ ppdchanged = 1;
+ }
+ else
+ cupsFilePrintf(out, "%s\n", line);
}
else
- fprintf(out, "%s\n", line);
+ cupsFilePrintf(out, "%s\n", line);
}
}
- fclose(in);
- fclose(out);
- close(outfd);
+ cupsFileClose(in);
+ cupsFileClose(out);
ppdClose(ppd);
/*
@@ -1911,14 +1325,15 @@ set_printer_options(
*/
ippDelete(cupsDoFileRequest(http, request, "/admin/",
- ppdchanged ? tempfile : NULL));
+ ppdchanged ? tempfile : file));
/*
* Clean up temp files... (TODO: catch signals in case we CTRL-C during
* lpadmin)
*/
- unlink(ppdfile);
+ if (ppdfile != file)
+ unlink(ppdfile);
unlink(tempfile);
}
else
@@ -1975,5 +1390,5 @@ validate_name(const char *name) /* I - Name to check */
/*
- * End of "$Id: lpadmin.c 8359 2009-02-16 23:57:08Z mike $".
+ * End of "$Id: lpadmin.c 9258 2010-08-13 01:34:04Z mike $".
*/
diff --git a/systemv/lppasswd.c b/systemv/lppasswd.c
index 3f70d306..22b87c9f 100644
--- a/systemv/lppasswd.c
+++ b/systemv/lppasswd.c
@@ -1,9 +1,9 @@
/*
- * "$Id: lppasswd.c 9061 2010-03-30 22:07:33Z mike $"
+ * "$Id: lppasswd.c 9287 2010-08-31 18:40:17Z mike $"
*
- * MD5 password program for the Common UNIX Printing System (CUPS).
+ * MD5 password program for CUPS.
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -497,5 +497,5 @@ usage(FILE *fp) /* I - File to send usage to */
/*
- * End of "$Id: lppasswd.c 9061 2010-03-30 22:07:33Z mike $".
+ * End of "$Id: lppasswd.c 9287 2010-08-31 18:40:17Z mike $".
*/
diff --git a/systemv/lpstat.c b/systemv/lpstat.c
index c79ce8d6..ed764f59 100644
--- a/systemv/lpstat.c
+++ b/systemv/lpstat.c
@@ -1,9 +1,9 @@
/*
- * "$Id: lpstat.c 9135 2010-05-05 15:58:39Z mike $"
+ * "$Id: lpstat.c 9259 2010-08-13 04:11:46Z mike $"
*
- * "lpstat" command for the Common UNIX Printing System (CUPS).
+ * "lpstat" command for CUPS.
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -34,10 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
-#include <cups/http-private.h>
-#include <cups/string.h>
-#include <cups/cups.h>
-#include <cups/i18n.h>
+#include <cups/globals.h>
#include <cups/debug.h>
@@ -1518,7 +1515,7 @@ show_printers(const char *printers, /* I - Destinations */
char printer_uri[HTTP_MAX_URI],
/* Printer URI */
printer_state_time[255];/* Printer state time */
- const char *root; /* Server root directory... */
+ _cups_globals_t *cg = _cupsGlobals(); /* Global data */
static const char *pattrs[] = /* Attributes we need for printers... */
{
"printer-name",
@@ -1536,16 +1533,14 @@ show_printers(const char *printers, /* I - Destinations */
};
static const char *jattrs[] = /* Attributes we need for jobs... */
{
- "job-id"
+ "job-id",
+ "job-state"
};
DEBUG_printf(("show_printers(printers=\"%s\", num_dests=%d, dests=%p, "
"long_status=%d)\n", printers, num_dests, dests, long_status));
- if ((root = getenv("CUPS_SERVERROOT")) == NULL)
- root = CUPS_SERVERROOT;
-
if (printers != NULL && !strcmp(printers, "all"))
printers = NULL;
@@ -1820,10 +1815,11 @@ show_printers(const char *printers, /* I - Destinations */
if (make_model && strstr(make_model, "System V Printer"))
_cupsLangPrintf(stdout,
_("\tInterface: %s/interfaces/%s\n"),
- root, printer);
+ cg->cups_serverroot, printer);
else if (make_model && !strstr(make_model, "Raw Printer"))
_cupsLangPrintf(stdout,
- _("\tInterface: %s/ppd/%s.ppd\n"), root, printer);
+ _("\tInterface: %s/ppd/%s.ppd\n"),
+ cg->cups_serverroot, printer);
}
_cupsLangPuts(stdout, _("\tOn fault: no alert\n"));
_cupsLangPuts(stdout, _("\tAfter fault: continue\n"));
@@ -1933,10 +1929,11 @@ show_printers(const char *printers, /* I - Destinations */
if (make_model && strstr(make_model, "System V Printer"))
_cupsLangPrintf(stdout,
_("\tInterface: %s/interfaces/%s\n"),
- root, printer);
+ cg->cups_serverroot, printer);
else if (make_model && !strstr(make_model, "Raw Printer"))
_cupsLangPrintf(stdout,
- _("\tInterface: %s/ppd/%s.ppd\n"), root, printer);
+ _("\tInterface: %s/ppd/%s.ppd\n"),
+ cg->cups_serverroot, printer);
}
_cupsLangPuts(stdout, _("\tOn fault: no alert\n"));
_cupsLangPuts(stdout, _("\tAfter fault: continue\n"));
@@ -2010,5 +2007,5 @@ show_scheduler(void)
/*
- * End of "$Id: lpstat.c 9135 2010-05-05 15:58:39Z mike $".
+ * End of "$Id: lpstat.c 9259 2010-08-13 04:11:46Z mike $".
*/
diff --git a/templates/de/add-class.tmpl b/templates/de/add-class.tmpl
index 264a019b..2753bb91 100644
--- a/templates/de/add-class.tmpl
+++ b/templates/de/add-class.tmpl
@@ -1,6 +1,6 @@
<DIV CLASS="indent">
-<H2 CLASS="title">>Klasse hinzuf&uuml;gen</H2>
+<H2 CLASS="title">Klasse hinzuf&uuml;gen</H2>
<FORM METHOD="POST" ACTION="/admin">
<INPUT TYPE="HIDDEN" NAME="org.cups.sid" VALUE="{$org.cups.sid}">
diff --git a/templates/de/add-rss-subscription.tmpl b/templates/de/add-rss-subscription.tmpl
index cef109ca..86b08b2f 100644
--- a/templates/de/add-rss-subscription.tmpl
+++ b/templates/de/add-rss-subscription.tmpl
@@ -2,7 +2,7 @@
<INPUT TYPE="HIDDEN" NAME="org.cups.sid" VALUE="{$org.cups.sid}">
<INPUT TYPE="HIDDEN" NAME="OP" VALUE="add-rss-subscription">
-<H2 CLASS="title">>RSS Subskription hinzuf&uuml;gen</H2>
+<H2 CLASS="title">RSS Subskription hinzuf&uuml;gen</H2>
<TABLE SUMMARY="Forumlar zum Hinzufügen einer RSS Subskription">
<TR>
diff --git a/templates/de/search.tmpl b/templates/de/search.tmpl
index fd1d5d95..a462ae0b 100644
--- a/templates/de/search.tmpl
+++ b/templates/de/search.tmpl
@@ -1,4 +1,4 @@
-<FORM ACTION="{THIS_URL}" METHOD="GET">
+<FORM ACTION="/{SECTION}/{?SEARCH_DEST}" METHOD="GET">
{WHICH_JOBS?<INPUT TYPE="HIDDEN" NAME="WHICH_JOBS" VALUE="{WHICH_JOBS}">:}
{ORDER?<INPUT TYPE="HIDDEN" NAME="ORDER" VALUE="{ORDER}">:}
diff --git a/templates/it/jobs-header.tmpl b/templates/it/jobs-header.tmpl
index bdfe0d63..38538d12 100644
--- a/templates/it/jobs-header.tmpl
+++ b/templates/it/jobs-header.tmpl
@@ -1,5 +1,5 @@
<DIV CLASS="indent">{?which_jobs=?:<FORM ACTION="{?printer_name=?/jobs:{printer_uri_supported}}" METHOD="GET"><INPUT TYPE="SUBMIT" VALUE="Mostra stampe attive"></FORM>}
-{?which_jobs=completed?:<FORM ACTION="{?printer_name=?/jobs:{printer_uri_supported}}" METHOD="GET"><INPUT TYPE="HIDDEN" NAME="which_jobs" VALUE="completate"><INPUT TYPE="SUBMIT" VALUE="Mostra stampe completate"></FORM>}
-{?which_jobs=all?:<FORM ACTION="{?printer_name=?/jobs:{printer_uri_supported}}" METHOD="GET"><INPUT TYPE="HIDDEN" NAME="which_jobs" VALUE="tutte"><INPUT TYPE="SUBMIT" VALUE="Mostra tutte le stampe"></FORM>}</DIV>
+{?which_jobs=completed?:<FORM ACTION="{?printer_name=?/jobs:{printer_uri_supported}}" METHOD="GET"><INPUT TYPE="HIDDEN" NAME="which_jobs" VALUE="completed"><INPUT TYPE="SUBMIT" VALUE="Mostra stampe completate"></FORM>}
+{?which_jobs=all?:<FORM ACTION="{?printer_name=?/jobs:{printer_uri_supported}}" METHOD="GET"><INPUT TYPE="HIDDEN" NAME="which_jobs" VALUE="all"><INPUT TYPE="SUBMIT" VALUE="Mostra tutte le stampe"></FORM>}</DIV>
<P ALIGN="CENTER">{total=0?Nessuna stampa:Mostrat{total=1?a:e} {#job_id} di {total} stamp{total=1?a:e} {?which_jobs=?attiva:{which_jobs=all?:completata}} }.</P>
diff --git a/templates/ja/option-pickone.tmpl b/templates/ja/option-pickone.tmpl
index e927e7ca..58b267a9 100644
--- a/templates/ja/option-pickone.tmpl
+++ b/templates/ja/option-pickone.tmpl
@@ -6,7 +6,7 @@
{iscustom=1?<TABLE NAME="paramtable" id="{keyword}-params">{[params]
<TR><TH CLASS="sublabel">{paramtext}:</TH>
<TD>{params=Units?<SELECT NAME="{keyword}.{params}">
-<OPTION VALUE="pt"{paramvalue=pt? SELECTED:}>ポイント/OPTION>
+<OPTION VALUE="pt"{paramvalue=pt? SELECTED:}>ポイント</OPTION>
<OPTION VALUE="mm"{paramvalue=mm? SELECTED:}>ミリメートル</OPTION>
<OPTION VALUE="cm"{paramvalue=cm? SELECTED:}>センチメートル</OPTION>
<OPTION VALUE="in"{paramvalue=in? SELECTED:}>インチ</OPTION>
diff --git a/templates/pl/set-printer-options-header.tmpl b/templates/pl/set-printer-options-header.tmpl
index d128d7d5..58e5b85d 100644
--- a/templates/pl/set-printer-options-header.tmpl
+++ b/templates/pl/set-printer-options-header.tmpl
@@ -6,7 +6,7 @@
<INPUT TYPE="HIDDEN" NAME="org.cups.sid" VALUE="{$org.cups.sid}">
<INPUT TYPE="HIDDEN" NAME="PRINTER_NAME" VALUE="{printer_name}">
<INPUT TYPE="HIDDEN" NAME="OP" VALUE="{op}">
-{HAVE_AUTOCONFIGURE?<INPUT TYPE="SUBMIT" NAME="AUTOCONFIGURE" VALUE="Zakolejkuj drukarkę do domyślnych opcji">:}
+{HAVE_AUTOCONFIGURE?<INPUT TYPE="SUBMIT" NAME="AUTOCONFIGURE" VALUE="Pobierz domyślne ustawienia drukarki">:}
<SCRIPT TYPE="text/javascript"><!--
function update_paramtable(option)
diff --git a/test/run-stp-tests.sh b/test/run-stp-tests.sh
index 5f5147a9..d18eac30 100755
--- a/test/run-stp-tests.sh
+++ b/test/run-stp-tests.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# "$Id: run-stp-tests.sh 9165 2010-06-17 18:20:39Z mike $"
+# "$Id: run-stp-tests.sh 9258 2010-08-13 01:34:04Z mike $"
#
# Perform the complete set of IPP compliance tests specified in the
# CUPS Software Test Plan.
@@ -651,7 +651,7 @@ fi
# Requests logged
count=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'`
-expected=`expr 39 + 18 + $pjobs \* 8 + $pprinters \* $pjobs \* 4`
+expected=`expr 37 + 18 + $pjobs \* 8 + $pprinters \* $pjobs \* 4`
if test $count != $expected; then
echo "FAIL: $count requests logged, expected $expected."
echo "<P>FAIL: $count requests logged, expected $expected.</P>" >>$strfile
@@ -852,5 +852,5 @@ if test $fail != 0; then
fi
#
-# End of "$Id: run-stp-tests.sh 9165 2010-06-17 18:20:39Z mike $"
+# End of "$Id: run-stp-tests.sh 9258 2010-08-13 01:34:04Z mike $"
#
diff --git a/vcnet/config.h b/vcnet/config.h
index 5c480fc9..018e8ef2 100644
--- a/vcnet/config.h
+++ b/vcnet/config.h
@@ -1,5 +1,5 @@
/*
- * "$Id: config.h 9120 2010-04-23 18:56:34Z mike $"
+ * "$Id: config.h 9233 2010-08-10 06:15:55Z mike $"
*
* Configuration file for CUPS.
*
@@ -24,7 +24,6 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
-#include <ctype.h>
#include <io.h>
@@ -702,5 +701,5 @@
#endif /* !_CUPS_CONFIG_H_ */
/*
- * End of "$Id: config.h 9120 2010-04-23 18:56:34Z mike $".
+ * End of "$Id: config.h 9233 2010-08-10 06:15:55Z mike $".
*/