CHANGES IN CUPS V1.4.4
- Documentation updates (STR #3453)
+ - The PostScript filter did not support all media selection options for
+ the first page (STR #3525)
+ - The scheduler did not always remove job control files (STR #3425)
+ - The scheduler could crash on restart if classes were defined
+ (STR #3524)
+ - The scheduler no longer looks up network interface hostnames by
+ default on Mac OS X (STR #3523)
+ - ippWriteIO did not write collection (member) attributes properly in
+ all cases (STR #3521)
+ - The "cupsctl --remote-any" and corresponding web interface check box
+ (allow printing from the Internet) did not work reliably (STR #3520)
+ - The lpq and lpr commands would sometimes choose different default
+ printers (STR #3503)
- cupsDo*Request did not flush error text, leading to multiple issues
(STR #3325, STR #3519)
- cupsDoAuthentication did not cancel password authentication after 3
-CHANGES.txt - 2010-03-02
+CHANGES.txt - 2010-03-09
------------------------
CHANGES IN CUPS V1.5b1
+ - The scheduler and CUPS API now support the print-quality job template
+ attribute.
+ - The scheduler no longer supports the old Mac OS X Server quota
+ plugin.
- The scheduler now allows writing to /Users/Shared from print filters
on Mac OS X.
- CUPS no longer supports the old ~/.cupsrc or ~/.lpoptions files from
* Administration utility API definitions for the Common UNIX Printing
* System (CUPS).
*
- * Copyright 2007-2009 by Apple Inc.
+ * Copyright 2007-2010 by Apple Inc.
* Copyright 2001-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
int *num_settings, /* O - Number of settings */
cups_option_t **settings) /* O - Settings */
-{
- return (_cupsAdminGetServerSettings(http, num_settings, settings));
-}
-
-
-/*
- * '_cupsAdminGetServerSettings()' - Get settings from the server.
- *
- * The returned settings should be freed with cupsFreeOptions() when
- * you are done with them.
- *
- * @since CUPS 1.2@
- */
-
-int /* O - 1 on success, 0 on failure */
-_cupsAdminGetServerSettings(
- http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
- int *num_settings, /* O - Number of settings */
- cups_option_t **settings) /* O - Settings */
{
int i; /* Looping var */
cups_file_t *cupsd; /* cupsd.conf file */
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
int num_settings, /* I - Number of settings */
cups_option_t *settings) /* I - Settings */
-{
- return (_cupsAdminSetServerSettings(http, num_settings, settings));
-}
-
-
-/*
- * '_cupsAdminSetServerSettings()' - Set settings on the server.
- *
- * @since CUPS 1.2@
- */
-
-int /* O - 1 on success, 0 on failure */
-_cupsAdminSetServerSettings(
- http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
- int num_settings, /* I - Number of settings */
- cups_option_t *settings) /* I - Settings */
{
int i; /* Looping var */
http_status_t status; /* GET/PUT status */
* Get current settings...
*/
- if (!_cupsAdminGetServerSettings(http, &cupsd_num_settings,
- &cupsd_settings))
+ if (!cupsAdminGetServerSettings(http, &cupsd_num_settings,
+ &cupsd_settings))
return (0);
if ((val = cupsGetOption(CUPS_SERVER_DEBUG_LOGGING, cupsd_num_settings,
else
remote_any = 0;
+ DEBUG_printf(("1cupsAdminSetServerSettings: old remote_any=%d",
+ remote_any));
+
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_PRINTERS, cupsd_num_settings,
cupsd_settings)) != NULL)
old_remote_printers = atoi(val);
while (cupsFileGetConf(cupsd, line, sizeof(line), &value, &linenum))
{
if ((!strcasecmp(line, "Port") || !strcasecmp(line, "Listen")) &&
- (share_printers >= 0 || remote_admin >= 0))
+ (remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
{
if (!wrote_port_listen)
{
wrote_port_listen = 1;
- if (share_printers > 0 || remote_admin > 0)
+ if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
{
cupsFilePuts(temp, "# Allow remote access\n");
cupsFilePrintf(temp, "Port %d\n", server_port);
cupsFilePrintf(temp, " Allow %s\n",
remote_any > 0 ? "all" : "@LOCAL");
}
- else if (in_root_location && (remote_admin >= 0 || share_printers >= 0))
+ else if (in_root_location &&
+ (remote_admin >= 0 || remote_any >= 0 || share_printers >= 0))
{
wrote_root_location = 1;
cupsFilePuts(temp, " # Allow remote administration...\n");
else if (share_printers > 0)
cupsFilePuts(temp, " # Allow shared printing...\n");
+ else if (remote_any > 0)
+ cupsFilePuts(temp, " # Allow remote access...\n");
else
cupsFilePuts(temp, " # Restrict access to the server...\n");
cupsFilePuts(temp, " Order allow,deny\n");
- if (remote_admin > 0 || share_printers > 0)
+ if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
cupsFilePrintf(temp, " Allow %s\n",
remote_any > 0 ? "all" : "@LOCAL");
}
}
}
- if (!wrote_port_listen && (share_printers >= 0 || remote_admin >= 0))
+ if (!wrote_port_listen &&
+ (remote_admin >= 0 || remote_any >= 0 || share_printers >= 0))
{
- if (share_printers > 0 || remote_admin > 0)
+ if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
{
cupsFilePuts(temp, "# Allow remote access\n");
cupsFilePrintf(temp, "Port %d\n", ippPort());
#endif /* CUPS_DEFAULT_DOMAINSOCKET */
}
- if (!wrote_root_location && (remote_admin >= 0 || share_printers >= 0))
+ if (!wrote_root_location &&
+ (remote_admin >= 0 || remote_any >= 0 || share_printers >= 0))
{
if (remote_admin > 0 && share_printers > 0)
cupsFilePuts(temp,
cupsFilePuts(temp, "# Allow remote administration...\n");
else if (share_printers > 0)
cupsFilePuts(temp, "# Allow shared printing...\n");
+ else if (remote_any > 0)
+ cupsFilePuts(temp, "# Allow remote access...\n");
else
cupsFilePuts(temp, "# Restrict access to the server...\n");
cupsFilePuts(temp, "<Location />\n"
" Order allow,deny\n");
- if (remote_admin > 0 || share_printers > 0)
+ if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
cupsFilePrintf(temp, " Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
cupsFilePuts(temp, "</Location>\n");
/*
* "$Id: adminutil.h 7026 2007-10-19 00:57:45Z mike $"
*
- * Administration utility API definitions for the Common UNIX Printing
- * System (CUPS).
+ * Administration utility API definitions for CUPS.
*
- * MANY OF THE FUNCTIONS IN THIS HEADER ARE PRIVATE AND SUBJECT TO
- * CHANGE AT ANY TIME. USE AT YOUR OWN RISK.
- *
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2010 by Apple Inc.
* Copyright 2001-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
if (!cups_get_sdests(http, op, name, 0, &dest))
{
- if (op == CUPS_GET_DEFAULT || name)
+ if (op == CUPS_GET_DEFAULT || (name && !set_as_default))
return (NULL);
/*
*
* cupsGetDevices implementation for the Common UNIX Printing System (CUPS).
*
- * Copyright 2008-2009 by Apple Inc.
+ * Copyright 2008-2010 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
}
/*
- * Send the request and do any necessary authentication...
+ * Send the request...
*/
- do
- {
- DEBUG_puts("2cupsGetDevices: Sending request...");
- status = cupsSendRequest(http, request, "/", ippLength(request));
-
- DEBUG_puts("2cupsGetDevices: Waiting for response status...");
- while (status == HTTP_CONTINUE)
- status = httpUpdate(http);
-
- if (status != HTTP_OK)
- {
- httpFlush(http);
-
- if (status == HTTP_UNAUTHORIZED)
- {
- /*
- * See if we can do authentication...
- */
-
- DEBUG_puts("2cupsGetDevices: Need authorization...");
-
- if (!cupsDoAuthentication(http, "POST", "/"))
- httpReconnect(http);
- else
- {
- status = HTTP_AUTHORIZATION_CANCELED;
- break;
- }
- }
-
-#ifdef HAVE_SSL
- else if (status == HTTP_UPGRADE_REQUIRED)
- {
- /*
- * Force a reconnect with encryption...
- */
-
- DEBUG_puts("2cupsGetDevices: Need encryption...");
+ DEBUG_puts("2cupsGetDevices: Sending request...");
+ status = cupsSendRequest(http, request, "/", ippLength(request));
- if (!httpReconnect(http))
- httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
- }
-#endif /* HAVE_SSL */
- }
- }
- while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED);
+ DEBUG_puts("2cupsGetDevices: Waiting for response status...");
+ while (status == HTTP_CONTINUE)
+ status = httpUpdate(http);
DEBUG_printf(("2cupsGetDevices: status=%d", status));
httpBlocking(http, blocking);
httpFlush(http);
- if (status == IPP_ERROR)
+ if (status == HTTP_ERROR)
_cupsSetError(IPP_ERROR, NULL, 0);
else
{
/*
* "$Id: ipp.c 7847 2008-08-19 04:22:14Z mike $"
*
- * Internet Printing Protocol support functions for the Common UNIX
- * Printing System (CUPS).
+ * Internet Printing Protocol functions for CUPS.
*
- * 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
*bufptr++ = ipp->request.any.request_id >> 8;
*bufptr++ = ipp->request.any.request_id;
+ DEBUG_printf(("2ippWriteIO: version=%d.%d", buffer[0], buffer[1]));
+ DEBUG_printf(("2ippWriteIO: op_status=%04x",
+ ipp->request.any.op_status));
+ DEBUG_printf(("2ippWriteIO: request_id=%d",
+ ipp->request.any.request_id));
+
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
DEBUG_puts("1ippWriteIO: Could not write IPP header...");
ipp->current = ipp->attrs;
ipp->curtag = IPP_TAG_ZERO;
- DEBUG_printf(("2ippWriteIO: version=%d.%d", buffer[0], buffer[1]));
- DEBUG_printf(("2ippWriteIO: op_status=%04x",
- ipp->request.any.op_status));
- DEBUG_printf(("2ippWriteIO: request_id=%d",
- ipp->request.any.request_id));
+ DEBUG_printf(("1ippWriteIO: ipp->current=%p", ipp->current));
/*
* If blocking is disabled, stop here...
ipp->current = ipp->current->next;
- if (ipp->curtag != attr->group_tag && parent == NULL)
+ if (!parent)
{
- /*
- * Send a group tag byte...
- */
+ if (ipp->curtag != attr->group_tag)
+ {
+ /*
+ * Send a group tag byte...
+ */
- ipp->curtag = attr->group_tag;
+ ipp->curtag = attr->group_tag;
- if (attr->group_tag == IPP_TAG_ZERO)
- continue;
+ if (attr->group_tag == IPP_TAG_ZERO)
+ continue;
- DEBUG_printf(("2ippWriteIO: wrote group tag=%x(%s)",
- attr->group_tag, ippTagString(attr->group_tag)));
- *bufptr++ = attr->group_tag;
+ DEBUG_printf(("2ippWriteIO: wrote group tag=%x(%s)",
+ attr->group_tag, ippTagString(attr->group_tag)));
+ *bufptr++ = attr->group_tag;
+ }
+ else if (attr->group_tag == IPP_TAG_ZERO)
+ continue;
}
- else if (attr->group_tag == IPP_TAG_ZERO)
- continue;
+
+ DEBUG_printf(("1ippWriteIO: %s (%s%s)", attr->name,
+ attr->num_values > 1 ? "1setOf " : "",
+ ippTagString(attr->value_tag)));
/*
* Write the attribute tag and name. The current implementation
* Write the data out...
*/
- if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
+ if (bufptr > buffer)
{
- DEBUG_puts("1ippWriteIO: Could not write IPP attribute...");
- ipp_buffer_release(buffer);
- return (IPP_ERROR);
- }
+ if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
+ {
+ DEBUG_puts("1ippWriteIO: Could not write IPP attribute...");
+ ipp_buffer_release(buffer);
+ return (IPP_ERROR);
+ }
- DEBUG_printf(("2ippWriteIO: wrote %d bytes",
- (int)(bufptr - buffer)));
+ DEBUG_printf(("2ippWriteIO: wrote %d bytes",
+ (int)(bufptr - buffer)));
+ }
/*
* If blocking is disabled, stop here...
_cups_debug_fd
-_cupsAdminGetServerSettings
-_cupsAdminSetServerSettings
_cupsCharmapFlush
_cupsCharmapFree
_cupsCharmapGet
/*
* "$Id: mark.c 8210 2009-01-09 02:30:26Z mike $"
*
- * Option marking routines for the Common UNIX Printing System (CUPS).
+ * Option marking routines for CUPS.
*
- * 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
* ppdFirstOption() - Return the first option in the PPD file.
* ppdNextOption() - Return the next option in the PPD file.
* _ppdParseOptions() - Parse options from a PPD file.
- * debug_marked() - Output the marked array to stdout...
+ * ppd_debug_marked() - Output the marked array to stdout...
* ppd_defaults() - Set the defaults for this group and all sub-groups.
* ppd_mark_choices() - Mark one or more option choices from a string.
* ppd_mark_option() - Quickly mark an option without checking for
*/
#ifdef DEBUG
-static void debug_marked(ppd_file_t *ppd, const char *title);
+static void ppd_debug_marked(ppd_file_t *ppd, const char *title);
#else
-# define debug_marked(ppd,title)
+# define ppd_debug_marked(ppd,title)
#endif /* DEBUG */
static void ppd_defaults(ppd_file_t *ppd, ppd_group_t *g);
static void ppd_mark_choices(ppd_file_t *ppd, const char *s);
if (!ppd || num_options <= 0 || !options)
return (0);
- debug_marked(ppd, "Before...");
+ ppd_debug_marked(ppd, "Before...");
/*
* Do special handling for media, media-col, and PageSize...
num_media_cols = cupsParseOptions(media_col, 0, &media_cols);
- if ((val = cupsGetOption("media-key", num_media_cols, media_cols)) != NULL)
- media = val;
- else if ((val = cupsGetOption("media-size", num_media_cols,
- media_cols)) != NULL)
+ if ((val = cupsGetOption("media-size", num_media_cols,
+ media_cols)) != NULL)
{
/*
* Lookup by dimensions...
num_media_sizes = cupsParseOptions(val, 0, &media_sizes);
loc = localeconv();
- if ((val = cupsGetOption("x-dimension", num_media_sizes,
+ if ((val = cupsGetOption("media-x-dimension", num_media_sizes,
media_sizes)) != NULL)
- width = _cupsStrScand(val, NULL, loc) * 2540.0 / 72.0;
+ width = _cupsStrScand(val, NULL, loc) * 72.0 / 2540.0;
else
width = 0.0;
- if ((val = cupsGetOption("y-dimension", num_media_sizes,
+ if ((val = cupsGetOption("media-y-dimension", num_media_sizes,
media_sizes)) != NULL)
- length = _cupsStrScand(val, NULL, loc) * 2540.0 / 72.0;
+ length = _cupsStrScand(val, NULL, loc) * 72.0 / 2540.0;
else
length = 0.0;
if (cupsGetOption("InputSlot", num_options, options) == NULL)
ppd_mark_option(ppd, "InputSlot", s);
+ if (cupsGetOption("MediaColor", num_options, options) == NULL)
+ ppd_mark_option(ppd, "MediaColor", s);
+
if (cupsGetOption("MediaType", num_options, options) == NULL)
ppd_mark_option(ppd, "MediaType", s);
ppd_mark_choices(ppd, attr->value);
}
}
+ else if (!strcasecmp(optptr->name, "print-quality"))
+ {
+ ppd_option_t *output_mode = ppdFindOption(ppd, "OutputMode");
+ /* OutputMode option */
+
+ if (!strcmp(optptr->value, "3"))
+ {
+ /*
+ * Draft quality...
+ */
+
+ if (ppdFindChoice(output_mode, "Draft"))
+ ppd_mark_option(ppd, "OutputMode", "Draft");
+ else if (ppdFindChoice(output_mode, "Fast"))
+ ppd_mark_option(ppd, "OutputMode", "Fast");
+
+ if ((attr = ppdFindAttr(ppd, "APPrinterPreset",
+ "DraftGray_with_Paper_Auto-Detect")) != NULL)
+ ppd_mark_choices(ppd, attr->value);
+ }
+ else if (!strcmp(optptr->value, "4"))
+ {
+ /*
+ * Normal quality...
+ */
+
+ if (ppdFindChoice(output_mode, "Normal"))
+ ppd_mark_option(ppd, "OutputMode", "Normal");
+ else if (ppdFindChoice(output_mode, "Good"))
+ ppd_mark_option(ppd, "OutputMode", "Good");
+
+ if ((attr = ppdFindAttr(ppd, "APPrinterPreset",
+ "Color_with_Paper_Auto-Detect")) != NULL)
+ ppd_mark_choices(ppd, attr->value);
+ else if ((attr = ppdFindAttr(ppd, "APPrinterPreset",
+ "Gray_with_Paper_Auto-Detect")) != NULL)
+ ppd_mark_choices(ppd, attr->value);
+ }
+ else if (!strcmp(optptr->value, "5"))
+ {
+ /*
+ * High/best/photo quality...
+ */
+
+ if (ppdFindChoice(output_mode, "Best"))
+ ppd_mark_option(ppd, "OutputMode", "Best");
+ else if (ppdFindChoice(output_mode, "High"))
+ ppd_mark_option(ppd, "OutputMode", "High");
+
+ if ((attr = ppdFindAttr(ppd, "APPrinterPreset",
+ "Photo_on_Photo_Paper")) != NULL)
+ ppd_mark_choices(ppd, attr->value);
+ }
+ }
else if (!strcasecmp(optptr->name, "APPrinterPreset"))
{
/*
else
ppd_mark_option(ppd, optptr->name, optptr->value);
- debug_marked(ppd, "After...");
+ ppd_debug_marked(ppd, "After...");
return (ppdConflicts(ppd) > 0);
}
#ifdef DEBUG
/*
- * 'debug_marked()' - Output the marked array to stdout...
+ * 'ppd_debug_marked()' - Output the marked array to stdout...
*/
static void
-debug_marked(ppd_file_t *ppd, /* I - PPD file data */
+ppd_debug_marked(ppd_file_t *ppd, /* I - PPD file data */
const char *title) /* I - Title for list */
{
ppd_choice_t *c; /* Current choice */
* Process the current HTTP status...
*/
+ if (status >= HTTP_BAD_REQUEST)
+ httpFlush(http);
+
switch (status)
{
case HTTP_ERROR :
return (status);
case HTTP_UNAUTHORIZED :
- if (!cupsDoAuthentication(http, "POST", resource))
+ if (cupsDoAuthentication(http, "POST", resource))
+ return (HTTP_AUTHORIZATION_CANCELED);
+
+ if (httpReconnect(http))
{
- if (httpReconnect(http))
- {
- _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
- return (HTTP_SERVICE_UNAVAILABLE);
- }
+ _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
+ return (HTTP_SERVICE_UNAVAILABLE);
}
- else
- status = HTTP_AUTHORIZATION_CANCELED;
-
- return (status);
+ break;
#ifdef HAVE_SSL
case HTTP_UPGRADE_REQUIRED :
return (HTTP_SERVICE_UNAVAILABLE);
}
- httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
-
- return (status);
+ if (httpEncryption(http, HTTP_ENCRYPT_REQUIRED))
+ {
+ _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
+ return (HTTP_SERVICE_UNAVAILABLE);
+ }
+ break;
#endif /* HAVE_SSL */
case HTTP_EXPECTATION_FAILED :
*/
if (_httpWait(http, 0, 1))
- return (httpUpdate(http));
+ {
+ http_status_t status; /* Status from httpUpdate */
+
+ if ((status = httpUpdate(http)) >= HTTP_BAD_REQUEST)
+ httpFlush(http);
+
+ return (status);
+ }
}
return (HTTP_CONTINUE);
*
* Printing utilities 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
goto cancel_job;
}
- do
- {
- cupsFileRewind(fp);
-
- status = cupsStartDocument(http, name, job_id, docname, format,
- i == (num_files - 1));
+ status = cupsStartDocument(http, name, job_id, docname, format,
+ i == (num_files - 1));
- while (status == HTTP_CONTINUE &&
- (bytes = cupsFileRead(fp, buffer, sizeof(buffer))) > 0)
- status = cupsWriteRequestData(http, buffer, bytes);
-
- if (status == HTTP_UNAUTHORIZED)
- {
- char resource[1024]; /* Printer resource */
-
- snprintf(resource, sizeof(resource), "/printers/%s", name);
-
- if (!cupsDoAuthentication(http, "POST", resource))
- {
- if (httpReconnect(http))
- {
- _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
- return (0);
- }
- }
- else
- status = HTTP_AUTHORIZATION_CANCELED;
- }
- }
- while (status == HTTP_UNAUTHORIZED);
+ while (status == HTTP_CONTINUE &&
+ (bytes = cupsFileRead(fp, buffer, sizeof(buffer))) > 0)
+ status = cupsWriteRequestData(http, buffer, bytes);
cupsFileClose(fp);
*
* PostScript filter for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2009 by Apple Inc.
+ * Copyright 2007-2010 by Apple Inc.
* Copyright 1993-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
*title; /* Job name */
int copies; /* Number of copies */
const char *ap_input_slot, /* AP_FIRSTPAGE_InputSlot value */
- *ap_manual_feed; /* AP_FIRSTPAGE_ManualFeed value */
+ *ap_manual_feed, /* AP_FIRSTPAGE_ManualFeed value */
+ *ap_media_color, /* AP_FIRSTPAGE_MediaColor value */
+ *ap_media_type, /* AP_FIRSTPAGE_MediaType value */
+ *ap_page_region, /* AP_FIRSTPAGE_PageRegion value */
+ *ap_page_size; /* AP_FIRSTPAGE_PageSize value */
float brightness; /* brightness value */
int collate, /* Collate copies? */
emit_jcl, /* Emit JCL commands? */
fitplot; /* Fit pages to media */
float gamma; /* gamma value */
const char *input_slot, /* InputSlot value */
- *manual_feed; /* ManualFeed value */
+ *manual_feed, /* ManualFeed value */
+ *media_color, /* MediaColor value */
+ *media_type, /* MediaType value */
+ *page_region, /* PageRegion value */
+ *page_size; /* PageSize value */
int mirror, /* doc->mirror/mirror pages */
number_up, /* Number of pages on each sheet */
number_up_layout, /* doc->number_up_layout of N-up pages */
doc->ap_manual_feed,
pageinfo->num_options,
&(pageinfo->options));
+ pageinfo->num_options = cupsAddOption("MediaColor", doc->ap_media_color,
+ pageinfo->num_options,
+ &(pageinfo->options));
+ pageinfo->num_options = cupsAddOption("MediaType", doc->ap_media_type,
+ pageinfo->num_options,
+ &(pageinfo->options));
+ pageinfo->num_options = cupsAddOption("PageRegion", doc->ap_page_region,
+ pageinfo->num_options,
+ &(pageinfo->options));
+ pageinfo->num_options = cupsAddOption("PageSize", doc->ap_page_size,
+ pageinfo->num_options,
+ &(pageinfo->options));
}
else if (doc->page == (Duplex + 2))
{
doc->manual_feed,
pageinfo->num_options,
&(pageinfo->options));
+ pageinfo->num_options = cupsAddOption("MediaColor", doc->media_color,
+ pageinfo->num_options,
+ &(pageinfo->options));
+ pageinfo->num_options = cupsAddOption("MediaType", doc->media_type,
+ pageinfo->num_options,
+ &(pageinfo->options));
+ pageinfo->num_options = cupsAddOption("PageRegion", doc->page_region,
+ pageinfo->num_options,
+ &(pageinfo->options));
+ pageinfo->num_options = cupsAddOption("PageSize", doc->page_size,
+ pageinfo->num_options,
+ &(pageinfo->options));
}
}
doc->new_bounding_box[3] = INT_MIN;
/*
- * AP_FIRSTPAGE_InputSlot
- */
-
- doc->ap_input_slot = cupsGetOption("AP_FIRSTPAGE_InputSlot", num_options,
- options);
-
- /*
- * AP_FIRSTPAGE_ManualFeed
+ * AP_FIRSTPAGE_* and the corresponding non-first-page options.
*/
+ doc->ap_input_slot = cupsGetOption("AP_FIRSTPAGE_InputSlot", num_options,
+ options);
doc->ap_manual_feed = cupsGetOption("AP_FIRSTPAGE_ManualFeed", num_options,
options);
+ doc->ap_media_color = cupsGetOption("AP_FIRSTPAGE_MediaColor", num_options,
+ options);
+ doc->ap_media_type = cupsGetOption("AP_FIRSTPAGE_MediaType", num_options,
+ options);
+ doc->ap_page_region = cupsGetOption("AP_FIRSTPAGE_PageRegion", num_options,
+ options);
+ doc->ap_page_size = cupsGetOption("AP_FIRSTPAGE_PageSize", num_options,
+ options);
+
+ if ((choice = ppdFindMarkedChoice(ppd, "InputSlot")) != NULL)
+ doc->input_slot = choice->choice;
+ if ((choice = ppdFindMarkedChoice(ppd, "ManualFeed")) != NULL)
+ doc->manual_feed = choice->choice;
+ if ((choice = ppdFindMarkedChoice(ppd, "MediaColor")) != NULL)
+ doc->media_color = choice->choice;
+ if ((choice = ppdFindMarkedChoice(ppd, "MediaType")) != NULL)
+ doc->media_type = choice->choice;
+ if ((choice = ppdFindMarkedChoice(ppd, "PageRegion")) != NULL)
+ doc->page_region = choice->choice;
+ if ((choice = ppdFindMarkedChoice(ppd, "PageSize")) != NULL)
+ doc->page_size = choice->choice;
+
/*
* brightness
doc->gamma = 1.0f;
/*
- * InputSlot
- */
-
- if ((choice = ppdFindMarkedChoice(ppd, "InputSlot")) != NULL)
- doc->input_slot = choice->choice;
-
- /*
- * ManualFeed
+ * mirror/MirrorPrint
*/
- if ((choice = ppdFindMarkedChoice(ppd, "ManualFeed")) != NULL)
- doc->manual_feed = choice->choice;
-
if ((choice = ppdFindMarkedChoice(ppd, "MirrorPrint")) != NULL)
{
val = choice->choice;
.\"
.\" "$Id: cupsfilter.man 7936 2008-09-11 03:12:59Z mike $"
.\"
-.\" cupsfilter man page for the Common UNIX Printing System (CUPS).
+.\" cupsfilter man page 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
.\" 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 cupsfilter 8 "CUPS" "26 February 2009" "Apple Inc."
+.TH cupsfilter 8 "CUPS" "4 March 2010" "Apple Inc."
.SH NAME
cupsfilter \- convert a file to another format using cups filters
.SH SYNOPSIS
.B cupsfilter
[ -c
.I config-file
+] [ -d
+.I printer
] [ -e ] -j
.I job-id[,N]
[ -m
.br
Uses the named cupsd.conf configuration file.
.TP 5
+-d printer
+Uses information from the named printer.
+.TP 5
-e
.br
Use every filter from the PPD file.
.br
http://localhost:631/help
.SH COPYRIGHT
-Copyright 2007-2009 by Apple Inc.
+Copyright 2007-2010 by Apple Inc.
.\"
.\" End of "$Id: cupsfilter.man 7936 2008-09-11 03:12:59Z mike $".
.\"
static const cupsd_var_t variables[] =
{
{ "AccessLog", &AccessLog, CUPSD_VARTYPE_STRING },
-#ifdef __APPLE__
- { "AppleQuotas", &AppleQuotas, CUPSD_VARTYPE_BOOLEAN },
-#endif /* __APPLE__ */
{ "AutoPurgeJobs", &JobAutoPurge, CUPSD_VARTYPE_BOOLEAN },
{ "BrowseInterval", &BrowseInterval, CUPSD_VARTYPE_INTEGER },
#ifdef HAVE_LDAP
LaunchdTimeout = DEFAULT_TIMEOUT + 10;
#endif /* HAVE_LAUNCHD */
-#ifdef __APPLE__
- AppleQuotas = TRUE;
-#endif /* __APPLE__ */
-
/*
* Read the configuration file...
*/
*
* Configuration file definitions for CUPS.
*
- * 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
/* Time after which an idle cupsd will exit */
#endif /* HAVE_LAUNCHD */
-#ifdef __APPLE__
-VAR int AppleQuotas VALUE(TRUE);
- /* Use Apple PrintService Quotas instead of CUPS quotas */
-#endif /* __APPLE__ */
-
#ifdef HAVE_AUTHORIZATION_H
VAR char *SystemGroupAuthKey VALUE(NULL);
/* System group auth key */
*
* Main header file for the Common UNIX Printing System (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
/* Running from launchd */
#endif /* HAVE_LAUNCH_H */
-#if defined(__APPLE__) && defined(HAVE_DLFCN_H)
-typedef int (*PSQUpdateQuotaProcPtr)(const char *printer, const char *info,
- const char *user, int nPages, int options);
-VAR PSQUpdateQuotaProcPtr PSQUpdateQuotaProc
- VALUE(0);
- /* Apple PrintService quota function */
-#endif /* __APPLE__ && HAVE_DLFCN_H */
-
-
-
/*
* Prototypes...
usage(command, opt);
break;
+ case 'd' : /* Specify the real printer name */
+ i ++;
+ if (i < argc)
+ printer = argv[i];
+ else
+ usage(command, opt);
+ break;
+
case 'D' : /* Delete input file after conversion */
removeinfile = 1;
break;
"Options:\n"
"\n"
" -c cupsd.conf Set cupsd.conf file to use\n"
+ " -d printer Use the named printer\n"
" -e Use every filter from the PPD file\n"
" -j job-id[,N] Filter file N from the specified job (default is file 1)\n"
" -n copies Set number of copies\n"
"\n"
"Options:\n"
"\n"
+ " -d printer Use the named printer\n"
" -e Use every filter from the PPD file\n"
" -f filename Set file to be converted (otherwise stdin)\n"
" -o filename Set file to be generated (otherwise stdout)\n"
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.ipp2", CacheDir,
printer->name);
unlink(cache_name);
* Check quotas...
*/
-#ifdef __APPLE__
- if (AppleQuotas && (q = cupsdFindQuota(p, username)) != NULL)
- {
- /*
- * TODO: Define these special page count values as constants!
- */
-
- if (q->page_count == -4) /* special case: unlimited user */
- {
- cupsdLogMessage(CUPSD_LOG_INFO,
- "User \"%s\" request approved for printer %s (%s): "
- "unlimited quota.",
- username, p->name, p->info);
- q->page_count = 0; /* allow user to print */
- return (1);
- }
- else if (q->page_count == -3) /* quota exceeded */
- {
- cupsdLogMessage(CUPSD_LOG_INFO,
- "User \"%s\" request denied for printer %s (%s): "
- "quota limit exceeded.",
- username, p->name, p->info);
- q->page_count = 2; /* force quota exceeded failure */
- return (-1);
- }
- else if (q->page_count == -2) /* quota disabled for user */
- {
- cupsdLogMessage(CUPSD_LOG_INFO,
- "User \"%s\" request denied for printer %s (%s): "
- "printing disabled for user.",
- username, p->name, p->info);
- q->page_count = 2; /* force quota exceeded failure */
- return (-1);
- }
- else if (q->page_count == -1) /* quota access error */
- {
- cupsdLogMessage(CUPSD_LOG_INFO,
- "User \"%s\" request denied for printer %s (%s): "
- "unable to determine quota limit.",
- username, p->name, p->info);
- q->page_count = 2; /* force quota exceeded failure */
- return (-1);
- }
- else if (q->page_count < 0) /* user not found or other error */
- {
- cupsdLogMessage(CUPSD_LOG_INFO,
- "User \"%s\" request denied for printer %s (%s): "
- "user disabled / missing quota.",
- username, p->name, p->info);
- q->page_count = 2; /* force quota exceeded failure */
- return (-1);
- }
- else /* page within user limits */
- {
- q->page_count = 0; /* allow user to print */
- return (1);
- }
- }
- else
-#endif /* __APPLE__ */
if (p->k_limit || p->page_limit)
{
if ((q = cupsdUpdateQuota(p, username, 0, 0)) == NULL)
printer->name);
unlink(filename);
- snprintf(filename, sizeof(filename), "%s/%s.ipp", CacheDir, printer->name);
+ snprintf(filename, sizeof(filename), "%s/%s.ipp2", CacheDir, printer->name);
unlink(filename);
#ifdef __APPLE__
*
* Job management routines for the Common UNIX Printing System (CUPS).
*
- * 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
if (!cupsdLoadJob(job))
return;
- /*
- * Don't do anything if the state is unchanged...
- */
+ /*
+ * Don't do anything if the state is unchanged and we aren't purging the
+ * job...
+ */
- if (newstate == (oldstate = job->state_value))
- return;
+ oldstate = job->state_value;
+ if (newstate == oldstate && action != CUPSD_JOB_PURGE)
+ return;
/*
* Stop any processes that are working on the current job...
job->dirty = 1;
cupsdMarkDirty(CUPSD_DIRTY_JOBS);
}
+ else if (!job->printer)
+ {
+ /*
+ * Delete the job immediately if not actively printing...
+ */
+
+ cupsdDeleteJob(job, CUPSD_JOB_PURGE);
+ job = NULL;
+ }
break;
}
* Finalize the job immediately if we forced things...
*/
- if (action >= CUPSD_JOB_FORCE && job->printer)
+ if (action >= CUPSD_JOB_FORCE && job && job->printer)
finalize_job(job, 0);
/*
job->sheets->values[0].integer += copies;
if (job->printer->page_limit)
- {
- cupsd_quota_t *q = cupsdUpdateQuota(job->printer, job->username,
- copies, 0);
-
-#ifdef __APPLE__
- if (AppleQuotas && q->page_count == -3)
- {
- /*
- * Quota limit exceeded, cancel job in progress immediately...
- */
-
- cupsdSetJobState(job, IPP_JOB_CANCELED, CUPSD_JOB_DEFAULT,
- "Canceled job because pages exceed user %s "
- "quota limit on printer %s (%s).",
- job->username, job->printer->name,
- job->printer->info);
- return;
- }
-#else
- (void)q;
-#endif /* __APPLE__ */
- }
+ cupsdUpdateQuota(job->printer, job->username, copies, 0);
}
cupsdLogPage(job, message);
*
* Log file routines for the Common UNIX Printing System (CUPS).
*
- * 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
if (AccessLogLevel < CUPSD_ACCESSLOG_ALL)
{
/*
- * Eliminate simple GET requests...
+ * Eliminate simple GET, POST, and PUT requests...
*/
if ((con->operation == HTTP_GET &&
strncmp(con->uri, "/admin/log", 10)) ||
(con->operation == HTTP_POST && !con->request &&
strncmp(con->uri, "/admin", 6)) ||
- (con->operation != HTTP_POST && con->operation != HTTP_PUT))
+ (con->operation != HTTP_GET && con->operation != HTTP_POST &&
+ con->operation != HTTP_PUT))
return (1);
if (con->request && con->response &&
*
* Scheduler main loop for the Common UNIX Printing System (CUPS).
*
- * 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
* cupsdReleaseSignals() - Release signals for delivery.
* cupsdSetString() - Set a string value.
* cupsdSetStringf() - Set a formatted string value.
+ * cupsd_clean_files() - Clean out old files.
* launchd_checkin() - Check-in with launchd and collect the
* listening fds.
* launchd_checkout() - Check-out with launchd.
#include <syslog.h>
#include <grp.h>
#include <cups/dir.h>
+#include <fnmatch.h>
#ifdef HAVE_LAUNCH_H
# include <launch.h>
# include <libgen.h>
-# define CUPS_KEEPALIVE CUPS_CACHEDIR "/org.cups.cupsd"
+# define CUPS_KEEPALIVE CUPS_CACHEDIR "/org.cups.cupsd"
/* Name of the launchd KeepAlive file */
# ifndef LAUNCH_JOBKEY_KEEPALIVE
# define LAUNCH_JOBKEY_KEEPALIVE "KeepAlive"
# include <notify.h>
#endif /* HAVE_NOTIFY_H */
-#if defined(__APPLE__) && defined(HAVE_DLFCN_H)
-# include <dlfcn.h>
-#endif /* __APPLE__ && HAVE_DLFCN_H */
-
/*
* Local functions...
*/
+static void cupsd_clean_files(const char *path,
+ const char *pattern);
#ifdef HAVE_LAUNCHD
static void launchd_checkin(void);
static void launchd_checkout(void);
static int stop_scheduler = 0;
/* Should the scheduler stop? */
-#if defined(__APPLE__) && defined(HAVE_DLFCN_H)
-static const char *PSQLibPath = "/usr/lib/libPrintServiceQuota.dylib";
-static const char *PSQLibFuncName = "PSQUpdateQuota";
-static void *PSQLibRef; /* libPrintServiceQuota.dylib */
-#endif /* HAVE_DLFCN_H */
-
/*
* 'main()' - Main entry for the CUPS scheduler.
return (0);
}
- if (!strncmp(TempDir, RequestRoot, strlen(RequestRoot)))
- {
- /*
- * Clean out the temporary directory...
- */
-
- cups_dir_t *dir; /* Temporary directory */
- cups_dentry_t *dent; /* Directory entry */
- char tempfile[1024]; /* Temporary filename */
-
-
- if ((dir = cupsDirOpen(TempDir)) != NULL)
- {
- cupsdLogMessage(CUPSD_LOG_INFO,
- "Cleaning out old temporary files in \"%s\"...", TempDir);
-
- while ((dent = cupsDirRead(dir)) != NULL)
- {
- snprintf(tempfile, sizeof(tempfile), "%s/%s", TempDir, dent->filename);
+ /*
+ * Clean out old temp files and printer cache data.
+ */
- if (unlink(tempfile))
- cupsdLogMessage(CUPSD_LOG_ERROR,
- "Unable to remove temporary file \"%s\" - %s",
- tempfile, strerror(errno));
- else
- cupsdLogMessage(CUPSD_LOG_DEBUG, "Removed temporary file \"%s\"...",
- tempfile);
- }
+ if (!strncmp(TempDir, RequestRoot, strlen(RequestRoot)))
+ cupsd_clean_files(TempDir, NULL);
- cupsDirClose(dir);
- }
- else
- cupsdLogMessage(CUPSD_LOG_ERROR,
- "Unable to open temporary directory \"%s\" - %s",
- TempDir, strerror(errno));
- }
+ cupsd_clean_files(CacheDir, "*.ipp");
#if HAVE_LAUNCHD
if (Launchd)
}
#endif /* HAVE_LAUNCHD */
-#if defined(__APPLE__) && defined(HAVE_DLFCN_H)
- /*
- * Load Print Service quota enforcement library (X Server only)
- */
-
- PSQLibRef = dlopen(PSQLibPath, RTLD_LAZY);
-
- if (PSQLibRef)
- PSQUpdateQuotaProc = dlsym(PSQLibRef, PSQLibFuncName);
-#endif /* __APPLE__ && HAVE_DLFCN_H */
-
/*
* Startup the server...
*/
krb5_free_context(KerberosContext);
#endif /* HAVE_GSSAPI */
-#if defined(__APPLE__) && defined(HAVE_DLFCN_H)
- /*
- * Unload Print Service quota enforcement library (X Server only)
- */
-
- PSQUpdateQuotaProc = NULL;
- if (PSQLibRef)
- {
- dlclose(PSQLibRef);
- PSQLibRef = NULL;
- }
-#endif /* __APPLE__ && HAVE_DLFCN_H */
-
#ifdef __sgi
/*
* Remove the fake IRIX lpsched lock file, but only if the existing
}
+/*
+ * 'cupsd_clean_files()' - Clean out old files.
+ */
+
+static void
+cupsd_clean_files(const char *path, /* I - Directory to clean */
+ const char *pattern) /* I - Filename pattern or NULL */
+{
+ cups_dir_t *dir; /* Directory */
+ cups_dentry_t *dent; /* Directory entry */
+ char filename[1024]; /* Filename */
+ int status; /* Status from unlink/rmdir */
+
+
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "cupsd_clean_files(path=\"%s\", pattern=\"%s\")", path,
+ pattern ? pattern : "(null)");
+
+ if ((dir = cupsDirOpen(path)) == NULL)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open directory \"%s\" - %s",
+ path, strerror(errno));
+ return;
+ }
+
+ cupsdLogMessage(CUPSD_LOG_INFO, "Cleaning out old files in \"%s\"...", path);
+
+ while ((dent = cupsDirRead(dir)) != NULL)
+ {
+ if (pattern && fnmatch(pattern, dent->filename, 0))
+ continue;
+
+ snprintf(filename, sizeof(filename), "%s/%s", path, dent->filename);
+
+ if (S_ISDIR(dent->fileinfo.st_mode))
+ {
+ cupsd_clean_files(filename, pattern);
+
+ status = rmdir(filename);
+ }
+ else
+ status = unlink(filename);
+
+ if (status)
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to remove \"%s\" - %s", filename,
+ strerror(errno));
+ else
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "Removed \"%s\"...", filename);
+ }
+
+ cupsDirClose(dir);
+}
+
+
#ifdef HAVE_LAUNCHD
/*
* 'launchd_checkin()' - Check-in with launchd and collect the listening fds.
* Try looking up the hostname for the address as needed...
*/
+#ifdef __APPLE__
+ if (HostNameLookups)
+#else
if (HostNameLookups || RemotePort)
+#endif /* __APPLE__ */
httpAddrLookup((http_addr_t *)(addr->ifa_addr), hostname,
sizeof(hostname));
else
{
cupsd_policy_t *p; /* Current policy */
cupsd_location_t *po; /* Current policy op */
+ cupsd_printer_t *printer; /* Current printer */
if (!Policies)
return;
+ /*
+ * First clear the policy pointers for all printers...
+ */
+
+ for (printer = (cupsd_printer_t *)cupsArrayFirst(Printers);
+ printer;
+ printer = (cupsd_printer_t *)cupsArrayNext(Printers))
+ printer->op_policy_ptr = NULL;
+
+ /*
+ * Then free all of the policies...
+ */
+
for (p = (cupsd_policy_t *)cupsArrayFirst(Policies);
p;
p = (cupsd_policy_t *)cupsArrayNext(Policies))
ippAddInteger(p->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"number-up-default", 1);
- if (!cupsGetOption("orientation-requested", p->num_options, p->options))
- ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_NOVALUE,
- "orientation-requested-default", NULL, NULL);
-
if (!cupsGetOption("notify-lease-duration", p->num_options, p->options))
ippAddInteger(p->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"notify-lease-duration-default", DefaultLeaseDuration);
if (!cupsGetOption("notify-events", p->num_options, p->options))
ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
"notify-events-default", NULL, "job-completed");
+
+ if (!cupsGetOption("orientation-requested", p->num_options, p->options))
+ ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_NOVALUE,
+ "orientation-requested-default", NULL, NULL);
+
+ if (!cupsGetOption("print-quality", p->num_options, p->options))
+ ippAddInteger(p->attrs, IPP_TAG_PRINTER, IPP_TAG_ENUM,
+ "print-quality-default", IPP_QUALITY_NORMAL);
}
mime_filter_t *filter; /* MIME filter looping var */
- pdl[0] = '\0';
-
- if (mimeType(MimeDatabase, "application", "pdf"))
- strlcat(pdl, "application/pdf,", sizeof(pdl));
-
- if (mimeType(MimeDatabase, "application", "postscript"))
- strlcat(pdl, "application/postscript,", sizeof(pdl));
-
- if (mimeType(MimeDatabase, "application", "vnd.cups-raster"))
- strlcat(pdl, "application/vnd.cups-raster,", sizeof(pdl));
-
/*
- * Determine if this is a Tioga PrintJobMgr based queue...
+ * We only support raw printing if this is not a Tioga PrintJobMgr based
+ * queue and if application/octet-stream is a known type...
*/
for (filter = (mime_filter_t *)cupsArrayFirst(MimeDatabase->filters);
break;
}
- /*
- * We only support raw printing if this is not a Tioga PrintJobMgr based
- * queue and if application/octet-stream is a known conversion...
- */
+ pdl[0] = '\0';
if (!filter && mimeType(MimeDatabase, "application", "octet-stream"))
strlcat(pdl, "application/octet-stream,", sizeof(pdl));
- if (mimeType(MimeDatabase, "image", "png"))
- strlcat(pdl, "image/png,", sizeof(pdl));
+ /*
+ * Then list a bunch of formats that are supported by the printer...
+ */
+
+ for (type = (mime_type_t *)cupsArrayFirst(p->filetypes);
+ type;
+ type = (mime_type_t *)cupsArrayNext(p->filetypes))
+ {
+ if (!strcasecmp(type->super, "application"))
+ {
+ if (!strcasecmp(type->type, "pdf"))
+ strlcat(pdl, "application/pdf,", sizeof(pdl));
+ else if (!strcasecmp(type->type, "postscript"))
+ strlcat(pdl, "application/postscript,", sizeof(pdl));
+ }
+ else if (!strcasecmp(type->super, "image"))
+ {
+ if (!strcasecmp(type->type, "jpeg"))
+ strlcat(pdl, "image/jpeg,", sizeof(pdl));
+ else if (!strcasecmp(type->type, "png"))
+ strlcat(pdl, "image/png,", sizeof(pdl));
+ }
+ }
if (pdl[0])
pdl[strlen(pdl) - 1] = '\0'; /* Remove trailing comma */
ppd_size_t *size; /* Current size */
ppd_option_t *duplex, /* Duplex option */
*output_bin, /* OutputBin option */
+ *output_mode, /* OutputMode option */
*resolution; /* (Set|JCL|)Resolution option */
ppd_choice_t *choice; /* Current PPD choice */
ppd_attr_t *ppd_attr; /* PPD attribute */
ipp_t *media_col_default, /* media-col-default collection value */
*media_size; /* media-size collection value */
ipp_value_t *val; /* Attribute value */
- int num_finishings; /* Number of finishings */
- int finishings[5]; /* finishings-supported values */
+ int num_finishings, /* Number of finishings */
+ finishings[5]; /* finishings-supported values */
+ int num_qualities, /* Number of print-quality values */
+ qualities[3]; /* print-quality values */
static const char * const sides[3] = /* sides-supported values */
{
"one-sided",
* Check to see if the cache is up-to-date...
*/
- snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp", CacheDir, p->name);
+ snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp2", CacheDir, p->name);
if (stat(cache_name, &cache_info))
cache_info.st_mtime = 0;
ippAddBoolean(p->ppd_attrs, IPP_TAG_PRINTER, "color-supported",
ppd->color_device);
if (ppd->throughput)
+ {
ippAddInteger(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"pages-per-minute", ppd->throughput);
+ if (ppd->color_device)
+ ippAddInteger(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
+ "pages-per-minute-color", ppd->throughput);
+ }
+
+ num_qualities = 0;
+
+ if ((output_mode = ppdFindOption(ppd, "OutputMode")) != NULL)
+ {
+ if (ppdFindChoice(output_mode, "draft") ||
+ ppdFindChoice(output_mode, "fast"))
+ qualities[num_qualities ++] = IPP_QUALITY_DRAFT;
+ if (ppdFindChoice(output_mode, "normal") ||
+ ppdFindChoice(output_mode, "good"))
+ qualities[num_qualities ++] = IPP_QUALITY_NORMAL;
+ if (ppdFindChoice(output_mode, "best") ||
+ ppdFindChoice(output_mode, "high"))
+ qualities[num_qualities ++] = IPP_QUALITY_HIGH;
+ }
+ else if ((ppd_attr = ppdFindAttr(ppd, "APPrinterPreset", NULL)) != NULL)
+ {
+ do
+ {
+ if (strstr(ppd_attr->spec, "draft") ||
+ strstr(ppd_attr->spec, "Draft"))
+ {
+ qualities[num_qualities ++] = IPP_QUALITY_DRAFT;
+ break;
+ }
+ }
+ while ((ppd_attr = ppdFindNextAttr(ppd, "APPrinterPreset",
+ NULL)) != NULL);
+
+ qualities[num_qualities ++] = IPP_QUALITY_NORMAL;
+ qualities[num_qualities ++] = IPP_QUALITY_HIGH;
+ }
+
+ if (num_qualities == 0)
+ qualities[num_qualities ++] = IPP_QUALITY_NORMAL;
+
+ ippAddIntegers(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_ENUM,
+ "print-quality-supported", num_qualities, qualities);
if (ppd->nickname)
{
}
attr->values[i].resolution.xres = xdpi;
- attr->values[i].resolution.yres = xdpi;
+ attr->values[i].resolution.yres = ydpi;
attr->values[i].resolution.units = IPP_RES_PER_INCH;
if (choice->marked)
*
* Quota routines for the Common UNIX Printing System (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
"cupsdUpdateQuota: p=%s username=%s pages=%d k=%d",
p->name, username, pages, k);
-#if defined(__APPLE__) && defined(HAVE_DLFCN_H)
- /*
- * Use Apple PrintService quota enforcement if installed (X Server only)
- */
-
- if (AppleQuotas && PSQUpdateQuotaProc)
- {
- q->page_count = (*PSQUpdateQuotaProc)(p->name, p->info, username, pages, 0);
-
- return (q);
- }
-#endif /* __APPLE__ && HAVE_DLFCN_H */
-
curtime = time(NULL);
if (curtime < q->next_update)
*
* PPD test program for the Common UNIX Printing System (CUPS).
*
- * 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
#define MODE_PROGRAM 0555 /* Owner/group/other read+exec */
-/*
- * Standard Adobe media keywords (must remain sorted)...
- */
-
-static const char adobe_size_names[][PPD_MAX_NAME] =
-{
- "10x11",
- "10x13",
- "10x14",
- "12x11",
- "15x11",
- "7x9",
- "8x10",
- "9x11",
- "9x12",
- "A0",
- "A1",
- "A10",
- "A2",
- "A3",
- "A3Extra",
- "A3Rotated",
- "A4",
- "A4Extra",
- "A4Plus",
- "A4Rotated",
- "A4Small",
- "A5",
- "A5Extra",
- "A5Rotated",
- "A6",
- "A6Rotated",
- "A7",
- "A8",
- "A9",
- "ARCHA",
- "ARCHB",
- "ARCHC",
- "ARCHD",
- "ARCHE",
- "AnsiA",
- "AnsiB",
- "AnsiC",
- "AnsiD",
- "AnsiE",
- "B0",
- "B1",
- "B1",
- "B10",
- "B2",
- "B3",
- "B4",
- "B4Rotated",
- "B5",
- "B5Rotated",
- "B6",
- "B6Rotated",
- "B7",
- "B8",
- "B9",
- "C4",
- "C5",
- "C6",
- "DL",
- "DoublePostcard",
- "DoublePostcardRotated",
- "Env10",
- "Env11",
- "Env12",
- "Env14",
- "Env9",
- "EnvC0",
- "EnvC1",
- "EnvC2",
- "EnvC3",
- "EnvC4",
- "EnvC5",
- "EnvC6",
- "EnvC65",
- "EnvC7",
- "EnvChou3",
- "EnvChou3Rotated",
- "EnvChou4",
- "EnvChou4Rotated",
- "EnvDL",
- "EnvISOB4",
- "EnvISOB5",
- "EnvISOB6",
- "EnvInvite",
- "EnvItalian",
- "EnvKaku2",
- "EnvKaku2Rotated",
- "EnvKaku3",
- "EnvKaku3Rotated",
- "EnvMonarch",
- "EnvPRC1",
- "EnvPRC10",
- "EnvPRC10Rotated",
- "EnvPRC1Rotated",
- "EnvPRC2",
- "EnvPRC2Rotated",
- "EnvPRC3",
- "EnvPRC3Rotated",
- "EnvPRC4",
- "EnvPRC4Rotated",
- "EnvPRC5",
- "EnvPRC5Rotated",
- "EnvPRC6",
- "EnvPRC6Rotated",
- "EnvPRC7",
- "EnvPRC7Rotated",
- "EnvPRC8",
- "EnvPRC8Rotated",
- "EnvPRC9",
- "EnvPRC9Rotated",
- "EnvPersonal",
- "EnvYou4",
- "EnvYou4Rotated",
- "Executive",
- "FanFoldGerman",
- "FanFoldGermanLegal",
- "FanFoldUS",
- "Folio",
- "ISOB0",
- "ISOB1",
- "ISOB10",
- "ISOB2",
- "ISOB3",
- "ISOB4",
- "ISOB5",
- "ISOB5Extra",
- "ISOB6",
- "ISOB7",
- "ISOB8",
- "ISOB9",
- "Ledger",
- "Legal",
- "LegalExtra",
- "Letter",
- "LetterExtra",
- "LetterPlus",
- "LetterRotated",
- "LetterSmall",
- "Monarch",
- "Note",
- "PRC16K",
- "PRC16KRotated",
- "PRC32K",
- "PRC32KBig",
- "PRC32KBigRotated",
- "PRC32KRotated",
- "Postcard",
- "PostcardRotated",
- "Quarto",
- "Statement",
- "SuperA",
- "SuperB",
- "Tabloid",
- "TabloidExtra"
-};
-
-
/*
* Local functions...
*/
errors ++;
}
}
- else if (warn && verbose >= 0)
- {
- /*
- * Lookup the size name in the standard size table...
- */
-
- strlcpy(name, size->name, sizeof(name));
- if ((nameptr = strchr(name, '.')) != NULL)
- *nameptr = '\0';
-
- if (!bsearch(name, adobe_size_names,
- sizeof(adobe_size_names) /
- sizeof(adobe_size_names[0]),
- sizeof(adobe_size_names[0]),
- (int (*)(const void *, const void *))strcmp))
- {
- _cupsLangPrintf(stdout,
- _(" %s Non-standard size name \"%s\"\n"
- " REF: Page 187, section B.2.\n"),
- prefix, size->name);
- }
- }
/*
* Verify that the size is defined for both PageSize and PageRegion...
echo ""
echo "<H2>Summary</H2>" >>$strfile
+# Job control files
+count=`ls -1 /tmp/cups-$user/spool | wc -l`
+count=`expr $count - 1`
+if test $count != 0; then
+ echo "FAIL: $count job control files were not purged."
+ echo "<P>FAIL: $count job control files were not purged.</P>" >>$strfile
+ fail=`expr $fail + 1`
+else
+ echo "PASS: All job control files purged."
+ echo "<P>PASS: All job control files purged.</P>" >>$strfile
+fi
+
# Pages printed on Test1 (within 1 page for timing-dependent cancel issues)
count=`grep '^Test1 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
expected=`expr $pjobs \* 2 + 34`