Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet 5e2f263b42 Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.4.4@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
86 arquivos alterados com 1450 adições e 2778 exclusões
+1 -68
Ver Arquivo
@@ -1,73 +1,6 @@
CHANGES.txt - 2010-11-11
CHANGES.txt - 2010-06-17
------------------------
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)
+5 -4
Ver Arquivo
@@ -1,13 +1,14 @@
INSTALL - CUPS v1.4.5 - 2010-11-11
INSTALL - CUPS v1.4.4 - 2010-06-17
----------------------------------
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
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
README - CUPS v1.4.4 - 2010-11-11
README - CUPS v1.4.4 - 2010-06-17
---------------------------------
Looking for compile instructions? Read the file "INSTALL.txt"
+2 -4
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Common run loop APIs for CUPS.
* Common run loop APIs for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 2007-2008 by Apple Inc.
* Copyright 2006-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -299,8 +299,6 @@ backendRunLoop(
strerror(errno));
use_bc = 0;
}
else if (bc_bytes == 0)
use_bc = 0;
}
/*
+1 -1
Ver Arquivo
@@ -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)
if (print_fd != 0)
{
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGTERM, SIG_IGN);
+8 -136
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* "$Id$"
*
* Copyright 2005-2010 Apple Inc. All rights reserved.
* Copyright 2005-2009 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,12 +112,6 @@ 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)
@@ -247,11 +241,6 @@ 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;
@@ -292,8 +281,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 */
#endif /* __i386__ || __x86_64__ */
static void sigterm_handler(int sig); /* SIGTERM handler */
#endif /* __i386__ || __x86_64__ */
#ifdef PARSE_PS_ERRORS
static const char *next_line (const char *buffer);
@@ -344,7 +333,6 @@ 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 */
/*
@@ -488,12 +476,6 @@ 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"));
@@ -750,104 +732,6 @@ 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...
*/
@@ -1056,12 +940,7 @@ sidechannel_thread(void *reference)
break;
}
}
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);
while (1);
return NULL;
}
@@ -1397,10 +1276,7 @@ static kern_return_t load_classdriver(CFStringRef driverPath,
{
fprintf(stderr, "DEBUG: Unable to load class driver \"%s\": %s\n",
bundlestr, strerror(errno));
if (errno == ENOENT)
return (load_classdriver(NULL, intf, printerDriver));
else
return (kr);
return (kr);
}
else if (bundleinfo.st_mode & S_IWOTH)
{
@@ -2052,8 +1928,6 @@ static void run_legacy_backend(int argc,
exit(exitstatus);
}
#endif /* __i386__ || __x86_64__ */
/*
* 'sigterm_handler()' - SIGTERM handler.
@@ -2062,11 +1936,8 @@ static void run_legacy_backend(int argc,
static void
sigterm_handler(int sig) /* I - Signal */
{
#if defined(__i386__) || defined(__x86_64__)
/*
* If we started a child process pass the signal on to it...
*/
/* If we started a child process pass the signal on to it...
*/
if (child_pid)
{
/*
@@ -2088,9 +1959,10 @@ sigterm_handler(int sig) /* I - Signal */
exit(CUPS_BACKEND_STOP);
}
}
#endif /* __i386__ || __x86_64__ */
}
#endif /* __i386__ || __x86_64__ */
#ifdef PARSE_PS_ERRORS
/*
+4 -5
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Libusb interface code for CUPS.
* Libusb interface code for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 2007-2009 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, 3600000) < 0)
bytes, 45000) < 0)
{
_cupsLangPrintf(stderr,
_("ERROR: Unable to write %d bytes to printer!\n"),
@@ -518,8 +518,7 @@ 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 &&
printer->device->descriptor.iSerialNumber)
if ((sern = cupsGetOption("SN", num_values, values)) == NULL)
{
/*
* Try getting the serial number from the device itself...
+4 -2
Ver Arquivo
@@ -951,6 +951,8 @@ 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);
@@ -1216,8 +1218,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("PPD_MAKE")) == NULL)
var = cgiGetVariable("CURRENT_MAKE");
if ((var = cgiGetVariable("CURRENT_MAKE")) == NULL)
var = cgiGetVariable("PPD_MAKE");
if (var && !cgiGetVariable("SELECT_MAKE"))
{
const char *make_model; /* Make and model */
+2 -6
Ver Arquivo
@@ -285,14 +285,10 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
/*
* Make sure we have a username...
* See who is logged in...
*/
if ((user = getenv("REMOTE_USER")) == NULL)
{
puts("Status: 401\n");
exit(0);
}
user = getenv("REMOTE_USER");
/*
* See if the user has already selected a new destination...
+1 -5
Ver Arquivo
@@ -46,10 +46,6 @@ 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
@@ -83,7 +79,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 Validate-Job>
<Limit Create-Job Print-Job Print-URI>
AuthType Default
Order deny,allow
</Limit>
+3 -11
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-common.m4 9259 2010-08-13 04:11:46Z mike $"
dnl "$Id: cups-common.m4 9160 2010-06-16 20:25:12Z 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.5"
CUPS_VERSION="1.4.4"
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,13 +133,6 @@ 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
@@ -307,7 +300,6 @@ 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))
@@ -370,5 +362,5 @@ AC_SUBST(FONTS)
AC_SUBST(LEGACY_BACKENDS)
dnl
dnl End of "$Id: cups-common.m4 9259 2010-08-13 04:11:46Z mike $".
dnl End of "$Id: cups-common.m4 9160 2010-06-16 20:25:12Z mike $".
dnl
+2 -13
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-ssl.m4 9203 2010-07-14 23:58:04Z mike $"
dnl "$Id: cups-ssl.m4 9165 2010-06-17 18:20:39Z mike $"
dnl
dnl OpenSSL/GNUTLS stuff for CUPS.
dnl
@@ -38,8 +38,6 @@ 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,
@@ -56,15 +54,6 @@ 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
@@ -154,5 +143,5 @@ AC_SUBST(EXPORT_SSLLIBS)
dnl
dnl End of "$Id: cups-ssl.m4 9203 2010-07-14 23:58:04Z mike $".
dnl End of "$Id: cups-ssl.m4 9165 2010-06-17 18:20:39Z mike $".
dnl
-27
Ver Arquivo
@@ -289,7 +289,6 @@
*/
#undef HAVE_AUTHORIZATION_H
#undef HAVE_SECITEMPRIV_H
#undef HAVE_SECPOLICY_H
#undef HAVE_SECPOLICYPRIV_H
#undef HAVE_SECBASEPRIV_H
@@ -303,13 +302,6 @@
#undef HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY
/*
* Do we have the SecPolicyCreateSSL function?
*/
#undef HAVE_SECPOLICYCREATESSL
/*
* Do we have the SLP library?
*/
@@ -496,13 +488,6 @@
#undef HAVE_CFBUNDLEPRIV_H
/*
* Do we have ApplicationServices public headers?
*/
#undef HAVE_APPLICATIONSERVICES_H
/*
* Do we have the SCDynamicStoreCopyComputerName function?
*/
@@ -654,18 +639,6 @@
#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_ */
/*
+1 -1
Ver Arquivo
@@ -70,7 +70,7 @@ 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/lpoptions.man
man/cupsd.conf.man man/drv.man man/lpoptions.man
templates/header.tmpl
$LANGFILES)
+55 -58
Ver Arquivo
@@ -243,7 +243,7 @@ cupsAdminCreateWindowsPPD(
}
else if (jcloption && !strncmp(line, "*OrderDependency:", 17))
{
for (ptr = line + 17; _cups_isspace(*ptr); ptr ++);
for (ptr = line + 17; *ptr && isspace(*ptr & 255); ptr ++);
ptr = strchr(ptr, ' ');
@@ -1069,7 +1069,7 @@ cupsAdminGetServerSettings(
while (*value)
{
for (valptr = value; *valptr && !_cups_isspace(*valptr); valptr ++);
for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
if (*valptr)
*valptr++ = '\0';
@@ -1080,7 +1080,7 @@ cupsAdminGetServerSettings(
break;
}
for (value = valptr; _cups_isspace(*value); value ++);
for (value = valptr; isspace(*value & 255); 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,86 +1707,83 @@ cupsAdminSetServerSettings(
cupsFilePuts(temp, "</Location>\n");
}
else if (!strcasecmp(line, "<Limit"))
else if (!strcasecmp(line, "<Limit") && in_default_policy)
{
if (in_default_policy)
{
/*
* See if the policy limit is for the Cancel-Job operation...
*/
char *valptr; /* Pointer into value */
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)
{
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 ++);
}
cupsFilePuts(temp, ">\n");
}
}
else
cupsFilePrintf(temp, "%*s%s %s>\n", indent, "", line, value);
/*
* 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)
{
/*
* Don't write anything for this limit section...
*/
in_cancel_job = 2;
}
else
{
cupsFilePrintf(temp, " %s", line);
while (*value)
{
for (valptr = value; !isspace(*valptr & 255) && *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; isspace(*value & 255); value ++);
}
cupsFilePuts(temp, ">\n");
}
}
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_any >= 0)) ||
remote_admin >= 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)
+2 -2
Ver Arquivo
@@ -1,5 +1,5 @@
<!--
"$Id: api-filter.header 9272 2010-08-27 16:51:43Z mike $"
"$Id: api-filter.header 8673 2009-05-22 17:34:15Z 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.html' target='_top'>CUPS Design Description</a></td>
Specifications: <a href='spec-design' target='_top'>CUPS Design Description</a></td>
</tr>
</tbody>
</table></div>
+9 -11
Ver Arquivo
@@ -4,7 +4,7 @@
* PPD model-specific attribute routines for the Common UNIX Printing System
* (CUPS).
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -15,10 +15,8 @@
*
* Contents:
*
* 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.
* ppdFindAttr() - Find the first matching attribute.
* ppdFindNextAttr() - Find the next matching attribute.
*/
/*
@@ -180,7 +178,7 @@ _ppdGet1284Values(
num_values = 0;
while (*device_id)
{
while (_cups_isspace(*device_id))
while (isspace(*device_id & 255))
device_id ++;
if (!*device_id)
@@ -193,13 +191,13 @@ _ppdGet1284Values(
if (!*device_id)
break;
while (ptr > key && _cups_isspace(ptr[-1]))
while (ptr > key && isspace(ptr[-1] & 255))
ptr --;
*ptr = '\0';
device_id ++;
while (_cups_isspace(*device_id))
while (isspace(*device_id & 255))
device_id ++;
if (!*device_id)
@@ -212,7 +210,7 @@ _ppdGet1284Values(
if (!*device_id)
break;
while (ptr > value && _cups_isspace(ptr[-1]))
while (ptr > value && isspace(ptr[-1] & 255))
ptr --;
*ptr = '\0';
@@ -253,7 +251,7 @@ _ppdNormalizeMakeAndModel(
* Skip leading whitespace...
*/
while (_cups_isspace(*make_and_model))
while (isspace(*make_and_model & 255))
make_and_model ++;
/*
@@ -408,7 +406,7 @@ _ppdNormalizeMakeAndModel(
*/
for (bufptr = buffer + strlen(buffer) - 1;
bufptr >= buffer && _cups_isspace(*bufptr);
bufptr >= buffer && isspace(*bufptr & 255);
bufptr --);
bufptr[1] = '\0';
+1 -1
Ver Arquivo
@@ -251,7 +251,7 @@ cupsDoAuthentication(
authorization = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
authorization += 9;
while (*authorization && _cups_isspace(*authorization))
while (*authorization && isspace(*authorization & 255))
authorization ++;
if (*authorization)
+7 -7
Ver Arquivo
@@ -290,25 +290,25 @@ cupsResolveConflicts(
for (resval = resolver->value; *resval && !changed;)
{
while (_cups_isspace(*resval))
while (isspace(*resval & 255))
resval ++;
if (*resval != '*')
break;
for (resval ++, resptr = resoption;
*resval && !_cups_isspace(*resval);
*resval && !isspace(*resval & 255);
resval ++)
if (resptr < (resoption + sizeof(resoption) - 1))
*resptr++ = *resval;
*resptr = '\0';
while (_cups_isspace(*resval))
while (isspace(*resval & 255))
resval ++;
for (resptr = reschoice;
*resval && !_cups_isspace(*resval);
*resval && !isspace(*resval & 255);
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 && !_cups_isspace(*vptr); vptr ++)
for (vptr ++, ptr = option; *vptr && !isspace(*vptr & 255); vptr ++)
if (ptr < (option + sizeof(option) - 1))
*ptr++ = *vptr;
*ptr = '\0';
while (_cups_isspace(*vptr))
while (isspace(*vptr & 255))
vptr ++;
if (*vptr == '*')
choice[0] = '\0';
else
{
for (ptr = choice; *vptr && !_cups_isspace(*vptr); vptr ++)
for (ptr = choice; *vptr && !isspace(*vptr & 255); vptr ++)
if (ptr < (choice + sizeof(choice) - 1))
*ptr++ = *vptr;
+2 -2
Ver Arquivo
@@ -61,10 +61,10 @@ extern "C" {
* Constants...
*/
# define CUPS_VERSION 1.0405
# define CUPS_VERSION 1.0404
# define CUPS_VERSION_MAJOR 1
# define CUPS_VERSION_MINOR 4
# define CUPS_VERSION_PATCH 5
# define CUPS_VERSION_PATCH 4
# define CUPS_BC_FD 3 /* Back-channel file descriptor for select/poll */
# define CUPS_DATE_ANY (time_t)-1
+2 -15
Ver Arquivo
@@ -509,19 +509,7 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
set_as_default = 1;
name = _cupsUserDefault(defname, sizeof(defname));
if (name)
{
char *ptr; /* Temporary pointer... */
if ((ptr = strchr(defname, '/')) != NULL)
{
*ptr++ = '\0';
instance = ptr;
}
else
instance = NULL;
}
else if (home)
if (!name && home)
{
/*
* No default in the environment, try the user's lpoptions files...
@@ -1246,8 +1234,7 @@ appleSetDefault(const char *name) /* I - Default printer/class name */
CFArrayRemoveValueAtIndex(newlocations, locindex);
}
else
newlocations = CFArrayCreateMutable(kCFAllocatorDefault, 0,
&kCFTypeArrayCallBacks);
newlocations = CFArrayCreateMutable(kCFAllocatorDefault, 0, NULL);
newlocation = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
&kCFTypeDictionaryKeyCallBacks,
+14 -26
Ver Arquivo
@@ -484,8 +484,7 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
*/
for (title += 7; *title && isdigit(*title & 255); title ++);
while (_cups_isspace(*title))
title ++;
for (; *title && isspace(*title & 255); title ++);
if ((ptr = strstr(title, " - ")) != NULL)
{
@@ -684,8 +683,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
case PPD_CUSTOM_PASSCODE :
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
if (cparam->current.custom_string)
bufsize += strlen(cparam->current.custom_string);
bufsize += strlen(cparam->current.custom_string);
break;
}
}
@@ -730,9 +728,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
case PPD_CUSTOM_PASSCODE :
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
bufsize += 3;
if (cparam->current.custom_string)
bufsize += 4 * strlen(cparam->current.custom_string);
bufsize += 3 + 4 * strlen(cparam->current.custom_string);
break;
}
}
@@ -801,8 +797,8 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
*/
pnum = *cptr++ - '0';
while (isdigit(*cptr & 255))
pnum = pnum * 10 + *cptr++ - '0';
while (isalnum(*cptr & 255))
pnum = pnum * 10 + *cptr - '0';
for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
cparam;
@@ -832,12 +828,9 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
case PPD_CUSTOM_PASSCODE :
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
if (cparam->current.custom_string)
{
strlcpy(bufptr, cparam->current.custom_string,
bufend - bufptr);
bufptr += strlen(bufptr);
}
strlcpy(bufptr, cparam->current.custom_string,
bufend - bufptr);
bufptr += strlen(bufptr);
break;
}
}
@@ -1040,19 +1033,14 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
case PPD_CUSTOM_STRING :
*bufptr++ = '(';
if (cparam->current.custom_string)
{
for (s = cparam->current.custom_string; *s; s ++)
for (s = cparam->current.custom_string; *s; s ++)
if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
{
if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
{
snprintf(bufptr, bufend - bufptr + 1, "\\%03o", *s & 255);
bufptr += strlen(bufptr);
}
else
*bufptr++ = *s;
snprintf(bufptr, bufend - bufptr + 1, "\\%03o", *s & 255);
bufptr += strlen(bufptr);
}
}
else
*bufptr++ = *s;
*bufptr++ = ')';
*bufptr++ = '\n';
-1
Ver Arquivo
@@ -125,7 +125,6 @@ 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 },
+5 -5
Ver Arquivo
@@ -494,7 +494,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
// Strip the comment and any trailing whitespace...
while (ptr > buf)
{
if (!_cups_isspace(ptr[-1]))
if (!isspace(ptr[-1] & 255))
break;
ptr --;
@@ -508,7 +508,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
* Strip leading whitespace...
*/
for (ptr = buf; _cups_isspace(*ptr); ptr ++);
for (ptr = buf; isspace(*ptr & 255); 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 (_cups_isspace(*ptr))
if (isspace(*ptr & 255))
break;
if (*ptr)
@@ -533,7 +533,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
* Have a value, skip any other spaces...
*/
while (_cups_isspace(*ptr))
while (isspace(*ptr & 255))
*ptr++ = '\0';
if (*ptr)
@@ -557,7 +557,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
return (buf);
}
while (ptr > *value && _cups_isspace(*ptr))
while (ptr > *value && isspace(*ptr & 255))
*ptr-- = '\0';
}
-1
Ver Arquivo
@@ -26,7 +26,6 @@
# include "http-private.h"
# include "cups.h"
# include "i18n.h"
# include "ppd-private.h"
# include "pwg-private.h"
# ifdef HAVE_PTHREAD_H
+3 -17
Ver Arquivo
@@ -917,9 +917,7 @@ httpSeparateURI(
for (ptr = scheme, end = scheme + schemelen - 1;
*uri && *uri != ':' && ptr < end;)
if (strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789-+.", *uri) != NULL)
if (isalnum(*uri & 255) || *uri == '-' || *uri == '+' || *uri == '.')
*ptr++ = *uri++;
else
break;
@@ -1355,8 +1353,7 @@ _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? */
offline = 0; /* offline-report state set? */
int domainsent = 0; /* Send the domain resolve? */
char *regtype, /* Pointer to type in hostname */
*domain; /* Pointer to domain in hostname */
_http_uribuf_t uribuf; /* URI buffer */
@@ -1470,17 +1467,6 @@ _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
{
@@ -1508,7 +1494,7 @@ _httpResolveURI(
else
fputs("DEBUG: Unable to resolve URI!\n", stderr);
fputs("STATE: -connecting-to-device,offline-report\n", stderr);
fputs("STATE: -connecting-to-device\n", stderr);
}
#else
+7 -7
Ver Arquivo
@@ -910,7 +910,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
* Skip leading whitespace...
*/
while (_cups_isspace(*fptr))
while (isspace(*fptr & 255))
fptr ++;
if (*fptr == ',')
@@ -924,7 +924,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
*/
for (ptr = temp;
*fptr && *fptr != '=' && !_cups_isspace(*fptr) &&
*fptr && *fptr != '=' && !isspace(*fptr & 255) &&
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 (_cups_isspace(*fptr))
while (isspace(*fptr & 255))
fptr ++;
if (!*fptr)
@@ -951,7 +951,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
fptr ++;
while (_cups_isspace(*fptr))
while (isspace(*fptr & 255))
fptr ++;
if (*fptr == '\"')
@@ -979,12 +979,12 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
*/
for (ptr = value;
*fptr && !_cups_isspace(*fptr) && *fptr != ',' && ptr < end;
*fptr && !isspace(*fptr & 255) && *fptr != ',' && ptr < end;
*ptr++ = *fptr++);
*ptr = '\0';
while (*fptr && !_cups_isspace(*fptr) && *fptr != ',')
while (*fptr && !isspace(*fptr & 255) && *fptr != ',')
fptr ++;
}
@@ -2129,7 +2129,7 @@ httpUpdate(http_t *http) /* I - Connection to server */
*/
*value++ = '\0';
while (_cups_isspace(*value))
while (isspace(*value & 255))
value ++;
/*
+3 -7
Ver Arquivo
@@ -1275,9 +1275,7 @@ ippReadIO(void *src, /* I - Data source */
attr->value_tag = tag;
}
else if (value_tag == IPP_TAG_TEXTLANG ||
value_tag == IPP_TAG_NAMELANG ||
(value_tag >= IPP_TAG_TEXT &&
else if ((value_tag >= IPP_TAG_TEXTLANG &&
value_tag <= IPP_TAG_MIMETYPE))
{
/*
@@ -1285,9 +1283,8 @@ ippReadIO(void *src, /* I - Data source */
* forms; accept sets of differing values...
*/
if (tag != IPP_TAG_TEXTLANG && tag != IPP_TAG_NAMELANG &&
(tag < IPP_TAG_TEXT || tag > IPP_TAG_MIMETYPE) &&
tag != IPP_TAG_NOVALUE)
if ((tag < IPP_TAG_TEXTLANG || tag > IPP_TAG_MIMETYPE) &&
tag != IPP_TAG_NOVALUE)
{
DEBUG_printf(("1ippReadIO: 1setOf value tag %x(%s) != %x(%s)",
value_tag, ippTagString(value_tag), tag,
@@ -2769,7 +2766,6 @@ _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 :
+1 -2
Ver Arquivo
@@ -93,8 +93,7 @@ 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_RESERVED_STRING, /* Reserved for future string value @private@ */
IPP_TAG_KEYWORD, /* Keyword value */
IPP_TAG_KEYWORD = 0x44, /* Keyword value */
IPP_TAG_URI, /* URI value */
IPP_TAG_URISCHEME, /* URI scheme value */
IPP_TAG_CHARSET, /* Character set value */
+3 -11
Ver Arquivo
@@ -267,17 +267,9 @@ _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]);
}
}
@@ -505,7 +497,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
*/
for (ptr = charset, csptr ++; *csptr; csptr ++)
if (ptr < (charset + sizeof(charset) - 1) && _cups_isalnum(*csptr))
if (ptr < (charset + sizeof(charset) - 1) && isalnum(*csptr & 255))
*ptr++ = *csptr;
*ptr = '\0';
@@ -565,7 +557,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
*/
for (ptr = charset; *csptr; csptr ++)
if (_cups_isalnum(*csptr) && ptr < (charset + sizeof(charset) - 1))
if (isalnum(*csptr & 255) && ptr < (charset + sizeof(charset) - 1))
*ptr++ = *csptr;
*ptr = '\0';
@@ -632,7 +624,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
*/
for (language ++, ptr = charset; *language; language ++)
if (_cups_isalnum(*language) && ptr < (charset + sizeof(charset) - 1))
if (isalnum(*language & 255) && ptr < (charset + sizeof(charset) - 1))
*ptr++ = toupper(*language & 255);
*ptr = '\0';
+9 -11
Ver Arquivo
@@ -58,26 +58,24 @@ __ppdLocalizedAttr
__ppdNormalizeMakeAndModel
__ppdParseOptions
__pwgCreateWithFile
__pwgCreateWithPPD
__pwgDestroy
__pwgWriteFile
__pwgGenerateSize
__pwgGetBin
__pwgGetInputSlot
__pwgGetMediaType
__pwgGetOutputBin
__pwgGetPageSize
__pwgGetSize
__pwgGetSource
__pwgGetType
__pwgInitSize
__pwgInputSlotForSource
__pwgMediaForLegacy
__pwgMediaForPPD
__pwgMediaForPWG
__pwgMediaForSize
__pwgCreateWithPPD
__pwgGetInputSlot
__pwgGetMediaType
__pwgGetPageSize
__pwgGetSize
__pwgGetSource
__pwgGetType
__pwgInputSlotForSource
__pwgMediaTypeForType
__pwgPageSizeForMedia
__pwgWriteFile
_cupsAddDest
_cupsAddOption
_cupsAdminCreateWindowsPPD
+8 -8
Ver Arquivo
@@ -389,7 +389,7 @@ ppdLocalizeIPPReason(
valptr += 5;
while (*valptr && !_cups_isspace(*valptr) && bufptr < bufend)
while (*valptr && !isspace(*valptr & 255) && bufptr < bufend)
{
if (*valptr == '%' && isxdigit(valptr[1] & 255) &&
isxdigit(valptr[2] & 255))
@@ -427,7 +427,7 @@ ppdLocalizeIPPReason(
* Skip this URI...
*/
while (*valptr && !_cups_isspace(*valptr))
while (*valptr && !isspace(*valptr & 255))
valptr++;
}
@@ -435,7 +435,7 @@ ppdLocalizeIPPReason(
* Skip whitespace...
*/
while (_cups_isspace(*valptr))
while (isspace(*valptr & 255))
valptr ++;
}
@@ -463,7 +463,7 @@ ppdLocalizeIPPReason(
* Copy URI...
*/
while (*valptr && !_cups_isspace(*valptr) && bufptr < bufend)
while (*valptr && !isspace(*valptr & 255) && bufptr < bufend)
*bufptr++ = *valptr++;
*bufptr = '\0';
@@ -476,7 +476,7 @@ ppdLocalizeIPPReason(
* Skip this URI...
*/
while (*valptr && !_cups_isspace(*valptr))
while (*valptr && !isspace(*valptr & 255))
valptr++;
}
@@ -484,7 +484,7 @@ ppdLocalizeIPPReason(
* Skip whitespace...
*/
while (_cups_isspace(*valptr))
while (isspace(*valptr & 255))
valptr ++;
}
@@ -598,7 +598,7 @@ _ppdGetLanguages(ppd_file_t *ppd) /* I - PPD file */
* Skip leading whitespace...
*/
while (_cups_isspace(*ptr))
while (isspace(*ptr & 255))
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 && !_cups_isspace(*ptr); ptr ++);
for (start = ptr; *ptr && !isspace(*ptr & 255); ptr ++);
if (*ptr)
*ptr++ = '\0';
+142 -30
Ver Arquivo
@@ -43,7 +43,6 @@
#include "cups.h"
#include "string.h"
#include "debug.h"
#include "ppd-private.h"
#include "pwg-private.h"
@@ -76,7 +75,7 @@ cupsMarkOptions(
int num_options, /* I - Number of options */
cups_option_t *options) /* I - Options */
{
int i, j; /* Looping vars */
int i, j, k; /* Looping vars */
char *ptr, /* Pointer into string */
s[255]; /* Temporary string */
const char *val, /* Pointer into value */
@@ -84,7 +83,33 @@ 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 */
};
/*
@@ -163,11 +188,98 @@ cupsMarkOptions(
*/
for (i = num_options, optptr = options; i > 0; i --, optptr ++)
if (!strcasecmp(optptr->name, "media") ||
!strcasecmp(optptr->name, "output-bin") ||
!strcasecmp(optptr->name, "output-mode") ||
!strcasecmp(optptr->name, "sides"))
if (!strcasecmp(optptr->name, "media"))
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"))
{
@@ -179,6 +291,13 @@ 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) &&
@@ -465,10 +584,7 @@ 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...
@@ -555,7 +671,6 @@ 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.
*/
@@ -564,11 +679,10 @@ 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 */
_ppd_parse_t which) /* I - What to parse */
cups_option_t **options) /* IO - Options */
{
char option[PPD_MAX_NAME * 2 + 1], /* Current option/property */
choice[PPD_MAX_NAME], /* Current choice/value */
char option[PPD_MAX_NAME], /* Current option */
choice[PPD_MAX_NAME], /* Current choice */
*ptr; /* Pointer into option or choice */
@@ -576,8 +690,8 @@ _ppdParseOptions(
return (num_options);
/*
* Read all of the "*Option Choice" and "property value" pairs from the
* string, add them to an options array as we go...
* Read all of the "*Option Choice" pairs from the string, marking PPD
* options as we go...
*/
while (*s)
@@ -586,18 +700,22 @@ _ppdParseOptions(
* Skip leading whitespace...
*/
while (_cups_isspace(*s))
while (isspace(*s & 255))
s ++;
if (*s != '*')
break;
/*
* Get the option/property name...
* Get the option name...
*/
s ++;
ptr = option;
while (*s && !_cups_isspace(*s) && ptr < (option + sizeof(option) - 1))
while (*s && !isspace(*s & 255) && ptr < (option + sizeof(option) - 1))
*ptr++ = *s++;
if (ptr == s || !_cups_isspace(*s))
if (ptr == s)
break;
*ptr = '\0';
@@ -606,29 +724,23 @@ _ppdParseOptions(
* Get the choice...
*/
while (_cups_isspace(*s))
while (isspace(*s & 255))
s ++;
if (!*s)
break;
ptr = choice;
while (*s && !_cups_isspace(*s) && ptr < (choice + sizeof(choice) - 1))
while (*s && !isspace(*s & 255) && ptr < (choice + sizeof(choice) - 1))
*ptr++ = *s++;
if (*s && !_cups_isspace(*s))
break;
*ptr = '\0';
/*
* Add it to the options array...
*/
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);
num_options = cupsAddOption(option, choice, num_options, options);
}
return (num_options);
@@ -697,7 +809,7 @@ ppd_mark_choices(ppd_file_t *ppd, /* I - PPD file */
return;
options = NULL;
num_options = _ppdParseOptions(s, 0, &options, 0);
num_options = _ppdParseOptions(s, 0, &options);
for (i = num_options, option = options; i > 0; i --, option ++)
ppd_mark_option(ppd, option->name, option->value);
+6 -6
Ver Arquivo
@@ -282,7 +282,7 @@ cupsParseOptions(
* Skip leading spaces...
*/
while (_cups_isspace(*ptr))
while (isspace(*ptr & 255))
ptr ++;
/*
@@ -296,7 +296,7 @@ cupsParseOptions(
*/
name = ptr;
while (!strchr("\f\n\r\t\v =", *ptr) && *ptr)
while (!isspace(*ptr & 255) && *ptr != '=' && *ptr)
ptr ++;
/*
@@ -310,7 +310,7 @@ cupsParseOptions(
* Skip trailing spaces...
*/
while (_cups_isspace(*ptr))
while (isspace(*ptr & 255))
*ptr++ = '\0';
if ((sep = *ptr) == '=')
@@ -339,7 +339,7 @@ cupsParseOptions(
value = ptr;
while (*ptr && !_cups_isspace(*ptr))
while (*ptr && !isspace(*ptr & 255))
{
if (*ptr == ',')
ptr ++;
@@ -394,7 +394,7 @@ cupsParseOptions(
* Normal space-delimited string...
*/
while (*ptr && !_cups_isspace(*ptr))
while (!isspace(*ptr & 255) && *ptr)
{
if (*ptr == '\\' && ptr[1])
_cups_strcpy(ptr, ptr + 1);
@@ -413,7 +413,7 @@ cupsParseOptions(
* Skip trailing whitespace...
*/
while (_cups_isspace(*ptr))
while (isspace(*ptr & 255))
ptr ++;
/*
+2 -10
Ver Arquivo
@@ -44,16 +44,9 @@ extern "C" {
/*
* Types and structures...
* 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 */
@@ -86,8 +79,7 @@ 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,
_ppd_parse_t which);
cups_option_t **options);
/*
+14 -16
Ver Arquivo
@@ -666,8 +666,6 @@ 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
@@ -1260,7 +1258,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 && _cups_isspace(name[i]); i --)
for (i = (int)strlen(name) - 1; i > 0 && isspace(name[i] & 255); i --)
name[i] = '\0'; /* Eliminate trailing spaces */
DEBUG_printf(("2ppdOpen2: OpenUI of %s in group %s...", name,
@@ -2360,7 +2358,7 @@ ppd_decode(char *string) /* I - String to decode */
inptr ++;
while (isxdigit(*inptr & 255))
{
if (_cups_isalpha(*inptr))
if (isalpha(*inptr))
*outptr = (tolower(*inptr) - 'a' + 10) << 4;
else
*outptr = (*inptr - '0') << 4;
@@ -2370,7 +2368,7 @@ ppd_decode(char *string) /* I - String to decode */
if (!isxdigit(*inptr & 255))
break;
if (_cups_isalpha(*inptr))
if (isalpha(*inptr))
*outptr |= tolower(*inptr) - 'a' + 10;
else
*outptr |= *inptr - '0';
@@ -3001,7 +2999,7 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
*/
for (lineptr = line->buffer; *lineptr; lineptr ++)
if (*lineptr && !_cups_isspace(*lineptr))
if (!isspace(*lineptr & 255))
break;
if (*lineptr)
@@ -3021,7 +3019,7 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
keyptr = keyword;
while (*lineptr && *lineptr != ':' && !_cups_isspace(*lineptr))
while (*lineptr != '\0' && *lineptr != ':' && !isspace(*lineptr & 255))
{
if (*lineptr <= ' ' || *lineptr > 126 || *lineptr == '/' ||
(keyptr - keyword) >= (PPD_MAX_NAME - 1))
@@ -3040,18 +3038,18 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
mask |= PPD_KEYWORD;
if (_cups_isspace(*lineptr))
if (isspace(*lineptr & 255))
{
/*
* Get an option name...
*/
while (_cups_isspace(*lineptr))
while (isspace(*lineptr & 255))
lineptr ++;
optptr = option;
while (*lineptr && !_cups_isspace(*lineptr) && *lineptr != ':' &&
while (*lineptr != '\0' && !isspace(*lineptr & 255) && *lineptr != ':' &&
*lineptr != '/')
{
if (*lineptr <= ' ' || *lineptr > 126 ||
@@ -3066,13 +3064,13 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
*optptr = '\0';
if (_cups_isspace(*lineptr) && cg->ppd_conform == PPD_CONFORM_STRICT)
if (isspace(*lineptr & 255) && cg->ppd_conform == PPD_CONFORM_STRICT)
{
cg->ppd_status = PPD_ILLEGAL_WHITESPACE;
return (0);
}
while (_cups_isspace(*lineptr))
while (isspace(*lineptr & 255))
lineptr ++;
mask |= PPD_OPTION;
@@ -3112,13 +3110,13 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
}
}
if (_cups_isspace(*lineptr) && cg->ppd_conform == PPD_CONFORM_STRICT)
if (isspace(*lineptr & 255) && cg->ppd_conform == PPD_CONFORM_STRICT)
{
cg->ppd_status = PPD_ILLEGAL_WHITESPACE;
return (0);
}
while (_cups_isspace(*lineptr))
while (isspace(*lineptr & 255))
lineptr ++;
if (*lineptr == ':')
@@ -3128,11 +3126,11 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
*/
lineptr ++;
while (_cups_isspace(*lineptr))
while (isspace(*lineptr & 255))
lineptr ++;
strptr = lineptr + strlen(lineptr) - 1;
while (strptr >= lineptr && _cups_isspace(*strptr))
while (strptr >= lineptr && isspace(*strptr & 255))
*strptr-- = '\0';
if (*strptr == '\"')
+2 -80
Ver Arquivo
@@ -47,14 +47,11 @@ _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[2048], /* Current line */
char line[512], /* 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));
@@ -239,10 +236,6 @@ _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)
@@ -339,38 +332,6 @@ _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,
@@ -466,9 +427,6 @@ _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 ++)
@@ -509,11 +467,10 @@ 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, j, k; /* Looping vars */
int i; /* Looping var */
cups_file_t *fp; /* Output file */
_pwg_size_t *size; /* Current size */
_pwg_map_t *map; /* Current map */
cups_option_t *option; /* Current option */
/*
@@ -573,9 +530,6 @@ _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);
@@ -594,38 +548,6 @@ _pwgWriteFile(_pwg_t *pwg, /* I - PWG mapping data */
cupsFilePrintf(fp, "Type %s %s\n", map->pwg, map->ppd);
}
/*
* 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...
*/
+26 -189
Ver Arquivo
@@ -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, "3x5", 3, 5),
_PWG_MEDIA_IN("na_index-3x5_3x5in", NULL, NULL, 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, "4x6", 4, 6),
_PWG_MEDIA_IN("na_index-4x6_4x6in", NULL, NULL, 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, "5x7", 5, 7),
_PWG_MEDIA_IN("na_index-5x8_5x8in", NULL, "5x8", 5, 8),
_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_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", "6x9", 6, 9),
_PWG_MEDIA_IN("na_c5_6.5x9.5in", NULL, "6.5x9.5", 6.5, 9.5),
_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_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, "8x13", 8, 13),
_PWG_MEDIA_IN("na_govt-legal_8x13in", NULL, NULL, 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", "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_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_fanfold-us_11x14.875in", NULL, NULL, 11, 14.875),
_PWG_MEDIA_IN("na_11x15_11x15in", NULL, "11x15", 11, 15),
_PWG_MEDIA_IN("na_11x15_11x15in", NULL, NULL, 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, "12x19", 12, 19),
_PWG_MEDIA_IN("na_12x19_12x19in", NULL, NULL, 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, "AnsiF", 44, 68),
_PWG_MEDIA_IN("na_f_44x68in", NULL, NULL, 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,42 +418,12 @@ _pwgInitSize(_pwg_size_t *size, /* I - Size to initialize */
else
{
if ((media = ippFindAttribute(job, "media", IPP_TAG_NAME)) == NULL)
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);
media = ippFindAttribute(job, "media", IPP_TAG_KEYWORD);
if (media)
{
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 = _pwgMediaForPWG(media->values[0].string.text)) == NULL)
pwg = _pwgMediaForLegacy(media->values[0].string.text);
if (pwg)
{
@@ -532,8 +502,7 @@ _pwgMediaForLegacy(
_pwg_media_t * /* O - Matching size or NULL */
_pwgMediaForPPD(const char *ppd) /* I - PPD size name */
{
_pwg_media_t key, /* Search key */
*size; /* Matching size */
_pwg_media_t key; /* Search key */
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
@@ -550,7 +519,8 @@ _pwgMediaForPPD(const char *ppd) /* I - PPD size name */
if (!cg->ppd_size_lut)
{
int i; /* Looping var */
int i; /* Looping var */
_pwg_media_t *size; /* Current size */
cg->ppd_size_lut = cupsArrayNew((cups_array_func_t)pwg_compare_ppd, NULL);
@@ -567,96 +537,7 @@ _pwgMediaForPPD(const char *ppd) /* I - PPD size name */
*/
key.ppd = ppd;
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);
return ((_pwg_media_t *)cupsArrayFind(cg->ppd_size_lut, &key));
}
@@ -667,9 +548,7 @@ _pwgMediaForPPD(const char *ppd) /* I - PPD size name */
_pwg_media_t * /* O - Matching size or NULL */
_pwgMediaForPWG(const char *pwg) /* I - PWG size name */
{
char *ptr; /* Pointer into name */
_pwg_media_t key, /* Search key */
*size; /* Matching size */
_pwg_media_t key; /* Search key */
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
@@ -686,7 +565,8 @@ _pwgMediaForPWG(const char *pwg) /* I - PWG size name */
if (!cg->pwg_size_lut)
{
int i; /* Looping var */
int i; /* Looping var */
_pwg_media_t *size; /* Current size */
cg->pwg_size_lut = cupsArrayNew((cups_array_func_t)pwg_compare_pwg, NULL);
@@ -702,50 +582,7 @@ _pwgMediaForPWG(const char *pwg) /* I - PWG size name */
*/
key.pwg = pwg;
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);
return ((_pwg_media_t *)cupsArrayFind(cg->pwg_size_lut, &key));
}
+34 -449
Ver Arquivo
@@ -48,13 +48,6 @@
#include <math.h>
/*
* Macro to test for two almost-equal PWG measurements.
*/
#define _PWG_EQUIVALENT(x, y) (abs((x)-(y)) < 2)
/*
* Local functions...
*/
@@ -70,44 +63,20 @@ 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, 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],
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],
/* PWG keyword string */
ppd_name[PPD_MAX_NAME];
/* Normalized PPD name */
const char *pwg_name; /* Standard PWG media name */
_pwg_media_t *pwg_media; /* PWG media data */
_pwg_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 */
ppd_name[PPD_MAX_NAME]; /* Normalized PPD name */
const char *pwg_name; /* Standard PWG media name */
_pwg_media_t *pwg_media; /* PWG media data */
DEBUG_printf(("_pwgCreateWithPPD(ppd=%p)", ppd));
@@ -156,7 +125,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.
*/
@@ -181,8 +150,7 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
* Standard name and no conflicts, use it!
*/
pwg_name = pwg_media->pwg;
new_known_pwg = 1;
pwg_name = pwg_media->pwg;
}
else
{
@@ -192,8 +160,7 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
* pp_lowerppd_WIDTHxHEIGHTuu
*/
pwg_name = pwg_keyword;
new_known_pwg = 0;
pwg_name = pwg_keyword;
pwg_unppdize_name(ppd_size->name, ppd_name, sizeof(ppd_name));
_pwgGenerateSize(pwg_keyword, sizeof(pwg_keyword), NULL, ppd_name,
@@ -202,75 +169,20 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
}
/*
* 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.
* Save this 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;
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);
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;
}
pwg->num_sizes ++;
pwg_size ++;
}
if (ppd->variable_sizes)
@@ -303,13 +215,8 @@ _pwgCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
* Copy and convert InputSlot data...
*/
if ((input_slot = ppdFindOption(ppd, "InputSlot")) == NULL)
input_slot = ppdFindOption(ppd, "HPPaperSource");
if (input_slot)
if ((input_slot = ppdFindOption(ppd, "InputSlot")) != NULL)
{
pwg->source_option = _cupsStrAlloc(input_slot->keyword);
if ((pwg->sources = calloc(input_slot->num_choices,
sizeof(_pwg_map_t))) == NULL)
{
@@ -330,10 +237,6 @@ _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"))
@@ -459,238 +362,6 @@ _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);
/*
@@ -763,30 +434,13 @@ _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)
@@ -911,12 +565,8 @@ _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...
*/
@@ -927,58 +577,6 @@ _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)
{
/*
@@ -1000,8 +598,7 @@ _pwgGetPageSize(_pwg_t *pwg, /* I - PWG mapping data */
if ((media = _pwgMediaForPWG(keyword)) == NULL)
if ((media = _pwgMediaForLegacy(keyword)) == NULL)
if ((media = _pwgMediaForPPD(keyword)) == NULL)
return (NULL);
return (NULL);
jobsize.width = media->width;
jobsize.length = media->length;
@@ -1062,18 +659,11 @@ _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...
@@ -1105,9 +695,6 @@ _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);
}
@@ -1115,8 +702,6 @@ _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);
}
@@ -1439,7 +1024,7 @@ pwg_ppdize_name(const char *ipp, /* I - IPP keyword */
for (ptr = name + 1, end = name + namesize - 1; *ipp && ptr < end;)
{
if (*ipp == '-' && _cups_isalpha(ipp[1]))
if (*ipp == '-' && isalpha(ipp[1] & 255))
{
ipp ++;
*ptr++ = toupper(*ipp++ & 255);
@@ -1467,13 +1052,13 @@ pwg_unppdize_name(const char *ppd, /* I - PPD keyword */
for (ptr = name, end = name + namesize - 1; *ppd && ptr < end; ppd ++)
{
if (_cups_isalnum(*ppd) || *ppd == '-')
if (isalnum(*ppd & 255) || *ppd == '-' || *ppd == '.')
*ptr++ = tolower(*ppd & 255);
else if (*ppd == '_' || *ppd == '.')
else if (*ppd == '_')
*ptr++ = '-';
if (!_cups_isupper(*ppd) && _cups_isalnum(*ppd) &&
_cups_isupper(ppd[1]) && ptr < end)
if (!isupper(*ppd & 255) && isalnum(*ppd & 255) &&
isupper(ppd[1] & 255) && ptr < end)
*ptr++ = '-';
}
-24
Ver Arquivo
@@ -48,21 +48,6 @@ 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 */
@@ -103,19 +88,10 @@ 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;
+20 -38
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Raster file definitions for CUPS.
* Raster file definitions for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* This file is part of the CUPS Imaging library.
@@ -84,28 +84,26 @@ typedef enum cups_bool_e /**** Boolean type ****/
typedef enum cups_cspace_e /**** cupsColorSpace attribute values ****/
{
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_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_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 (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_RGBW = 17, /* Red, green, blue, white @since CUPS 1.2/Mac OS X 10.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@ */
@@ -121,23 +119,7 @@ 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_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_ICCF = 46 /* ICC-based, 15 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
} cups_cspace_t;
typedef enum cups_cut_e /**** CutMedia attribute values ****/
+2 -2
Ver Arquivo
@@ -884,10 +884,10 @@ _cupsSetHTTPError(http_status_t status) /* I - HTTP status code */
break;
case HTTP_UNAUTHORIZED :
_cupsSetError(IPP_NOT_AUTHENTICATED, httpStatus(status), 0);
case HTTP_AUTHORIZATION_CANCELED :
_cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status), 0);
break;
case HTTP_AUTHORIZATION_CANCELED :
case HTTP_FORBIDDEN :
_cupsSetError(IPP_FORBIDDEN, httpStatus(status), 0);
break;
+1 -2
Ver Arquivo
@@ -41,7 +41,6 @@
#include <limits.h>
#include "array.h"
#include "debug.h"
#define _CUPS_STRING_C_
#include "string.h"
#ifdef HAVE_PTHREAD_H
# include <pthread.h>
@@ -429,7 +428,7 @@ _cupsStrScand(const char *buf, /* I - Pointer to number */
* Skip leading whitespace...
*/
while (_cups_isspace(*buf))
while (isspace(*buf & 255))
buf ++;
/*
-56
Ver Arquivo
@@ -79,62 +79,6 @@ typedef struct _cups_sp_item_s /**** String Pool Item ****/
} _cups_sp_item_t;
/*
* 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...
*/
-8
Ver Arquivo
@@ -65,9 +65,6 @@
*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: ""
@@ -84,7 +81,6 @@
*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"
@@ -92,28 +88,24 @@
*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"
+10 -231
Ver Arquivo
@@ -15,26 +15,22 @@
*
* Contents:
*
* main() - Main entry.
* test_pagesize() - Test the PWG mapping functions.
* test_pwg() - Test the PWG mapping functions.
* main() - Main entry.
* test_pwg() - Test the PWG mapping functions.
*/
/*
* Include necessary headers...
*/
#include "ppd-private.h"
#include "file-private.h"
#include "pwg-private.h"
/*
* Local functions...
*/
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);
static int test_pwg(_pwg_t *pwg);
/*
@@ -54,13 +50,13 @@ main(int argc, /* I - Number of command-line args */
status = 0;
if (argc < 2 || argc > 3)
if (argc != 2)
{
puts("Usage: ./testpwg filename.ppd [jobfile]");
puts("Usage: ./testpwg filename.ppd");
return (1);
}
ppdfile = argv[1];
else
ppdfile = argv[1];
printf("ppdOpenFile(%s): ", ppdfile);
if ((ppd = ppdOpenFile(ppdfile)) == NULL)
@@ -87,59 +83,7 @@ main(int argc, /* I - Number of command-line args */
else
{
puts("PASS");
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;
}
}
status += test_pwg(pwg);
/*
* _pwgDestroy should never fail...
@@ -150,101 +94,6 @@ 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)
{
@@ -263,71 +112,12 @@ 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 */
ppd_file_t *ppd) /* I - PPD file */
test_pwg(_pwg_t *pwg) /* I - PWG mapping data */
{
int i, /* Looping var */
status = 0; /* Return status */
@@ -473,19 +263,8 @@ 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);
}
+1 -1
Ver Arquivo
@@ -28,7 +28,6 @@ WEBIMAGES = \
images/color-wheel.png \
images/cups.png \
images/cups-icon.png \
images/generic.png \
images/left.gif \
images/right.gif \
images/sel.gif \
@@ -70,6 +69,7 @@ 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 \
+3 -3
Ver Arquivo
@@ -338,7 +338,7 @@ div.contents ul.subcontents li {
<body>
<div class='body'>
<!--
"$Id: api-filter.html 9283 2010-08-31 18:07:49Z mike $"
"$Id: api-filter.html 9121 2010-04-23 18:57:00Z 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.html' target='_top'>CUPS Design Description</a></td>
Specifications: <a href='spec-design' 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 9283 2010-08-31 18:07:49Z mike $"
"$Id: api-filter.html 9121 2010-04-23 18:57:00Z mike $"
Filter and backend programming introduction for the Common UNIX Printing
System (CUPS).
+3 -3
Ver Arquivo
@@ -338,7 +338,7 @@ div.contents ul.subcontents li {
<body>
<div class='body'>
<!--
"$Id: api-httpipp.html 9283 2010-08-31 18:07:49Z mike $"
"$Id: api-httpipp.html 9121 2010-04-23 18:57:00Z 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 9283 2010-08-31 18:07:49Z mike $"
"$Id: api-httpipp.html 9121 2010-04-23 18:57:00Z 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 canceled authorization</dd>
<dd class="description">User cancelled authorization</dd>
<dt>HTTP_BAD_GATEWAY </dt>
<dd class="description">Bad gateway</dd>
<dt>HTTP_BAD_REQUEST </dt>
+28 -63
Ver Arquivo
@@ -338,7 +338,7 @@ div.contents ul.subcontents li {
<body>
<div class='body'>
<!--
"$Id: api-raster.html 9283 2010-08-31 18:07:49Z mike $"
"$Id: api-raster.html 8653 2009-05-16 23:53:28Z 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 9283 2010-08-31 18:07:49Z mike $"
"$Id: api-raster.html 8653 2009-05-16 23:53:28Z mike $"
Raster API introduction for the Common UNIX Printing System (CUPS).
@@ -1186,52 +1186,20 @@ 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 (DeviceCMY)</dd>
<dd class="description">Cyan, magenta, yellow</dd>
<dt>CUPS_CSPACE_CMYK </dt>
<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>
<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>
<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>
@@ -1263,31 +1231,28 @@ 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 (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>
<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>
<dt>CUPS_CSPACE_RGB </dt>
<dd class="description">Red, green, blue (DeviceRGB, sRGB by default)</dd>
<dd class="description">Red, green, blue</dd>
<dt>CUPS_CSPACE_RGBA </dt>
<dd class="description">Red, green, blue, alpha (DeviceRGB, sRGB by default)</dd>
<dd class="description">Red, green, blue, alpha</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 (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>
<dd class="description">Red, green, blue, white </dd>
<dt>CUPS_CSPACE_SILVER </dt>
<dd class="description">Silver foil</dd>
<dt>CUPS_CSPACE_W </dt>
<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>
<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>
</dl>
<h3 class="enumeration"><a name="cups_cut_e">cups_cut_e</a></h3>
<p class="description">CutMedia attribute values</p>
+6 -6
Ver Arquivo
@@ -2931,23 +2931,23 @@ SetEnv MY_ENV_VAR foo
variable that should be passed to child processes.</P>
<H2 CLASS="title"><A NAME="SSLListen">SSLListen</A></H2>
<H2 CLASS="title"><A NAME="SSLOptions">SSLOptions</A></H2>
<H3>Examples</H3>
<PRE CLASS="command">
SSLListen 127.0.0.1:443
SSLListen 192.0.2.1:443
SSLOptions 127.0.0.1:443
SSLOptions 192.0.2.1:443
</PRE>
<H3>Description</H3>
<P>The <CODE>SSLListen</CODE> directive specifies a network
<P>The <CODE>SSLOptions</CODE> directive specifies a network
address and port to listen for secure connections. Multiple
<CODE>SSLListen</CODE> directives can be provided to listen on
<CODE>SSLOptions</CODE> directives can be provided to listen on
multiple addresses.</P>
<P>The <CODE>SSLListen</CODE> directive is similar to the <A
<P>The <CODE>SSLOptions</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>
+21 -69
Ver Arquivo
@@ -8,11 +8,11 @@
</head>
<body>
<!--
"$Id: spec-ppd.html 9170 2010-06-22 03:06:13Z mike $"
"$Id: spec-ppd.html 9143 2010-05-21 15:36:30Z mike $"
CUPS PPD extensions specification for CUPS.
CUPS PPD extensions specification for the Common UNIX Printing System (CUPS).
Copyright 2007-2010 by Apple Inc.
Copyright 2007-2009 by Apple Inc.
Copyright 1997-2007 by Easy Software Products.
These coded instructions, statements, and computer programs are the
@@ -1566,31 +1566,6 @@ 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>
@@ -1800,51 +1775,39 @@ 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 standard preset names are currently defined:</p>
the application. The following preset names are currently defined:</p>
<ul>
<li><code>General_with_Paper_Auto-Detect</code>; Normal quality general printing with auto-detected media.</li>
<li><code>Photo_with_Paper_Auto-Detect</code>; Photo printing
with paper auto-detect</li>
<li><code>General_with_Paper_Auto-Detect_-_Draft</code>; Draft quality general printing with auto-detected media.</li>
<li><code>Photo_with_Paper_Auto-Detect_-_Fine</code>; Photo printing
with paper auto-detect - fine</li>
<li><code>General_on_Plain_Paper</code>; Normal quality general printing on plain paper.</li>
<li><code>Photo_on_Plain_Paper</code>; Photo printing on plain paper</li>
<li><code>General_on_Plain_Paper_-_Draft</code>; Draft quality general printing on plain paper.</li>
<li><code>Photo_on_Plain_Paper_-_Fine</code>; Photo printing on plain
paper - fine</li>
<li><code>Photo_with_Paper_Auto-Detect</code>; Normal quality photo printing with auto-detected media.</li>
<li><code>Photo_on_Photo_Paper</code>; Photo printing on photo paper</li>
<li><code>Photo_with_Paper_Auto-Detect_-_Fine</code>; High quality photo printing with auto-detected media.</li>
<li><code>Photo_on_Photo_Paper_-_Fine</code>; Photo printing on photo
paper - fine</li>
<li><code>Photo_on_Plain_Paper</code>; Normal quality photo printing on plain paper.</li>
<li><code>Photo_on_Matte_Paper</code>; Photo printing on matte paper</li>
<li><code>Photo_on_Plain_Paper_-_Fine</code>; High quality photo printing on plain paper.</li>
<li><code>Photo_on_Photo_Paper</code>; Normal quality photo printing on glossy photo 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</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>
<li><code>Photo_on_Matte_Paper_-_Fine</code>; Photo printing on matte
paper - fine</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). 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>
(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>
<p>Presets, like options, can also be localized in multiple languages.</p>
@@ -1908,17 +1871,6 @@ 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>
Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 16 KiB

+1 -39
Ver Arquivo
@@ -481,7 +481,6 @@ 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;
@@ -494,11 +493,10 @@ 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;
@@ -542,42 +540,6 @@ 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;
}
+8 -29
Ver Arquivo
@@ -2393,7 +2393,6 @@ 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,18 +2419,6 @@ set_pstops_options(
doc->new_bounding_box[2] = INT_MIN;
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.
*/
@@ -2462,6 +2449,7 @@ set_pstops_options(
if ((choice = ppdFindMarkedChoice(ppd, "PageSize")) != NULL)
doc->page_size = choice->choice;
/*
* brightness
*/
@@ -2521,24 +2509,15 @@ set_pstops_options(
doc->emit_jcl = 1;
/*
* fitplot/fit-to-page/ipp-attribute-fidelity
*
* (Only for original PostScript content)
* fitplot/fit-to-page
*/
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;
}
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;
/*
* gamma
+2 -24
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Raster file routines for CUPS.
* Raster file routines for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* This file is part of the CUPS Imaging library.
@@ -920,7 +920,6 @@ 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;
@@ -929,8 +928,6 @@ 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 :
@@ -965,25 +962,6 @@ 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;
}
}
+4 -4
Ver Arquivo
@@ -116,10 +116,6 @@
type='service'
version='1'>
<restarter>
<service_fmri value='svc:/network/inetd:default' />
</restarter>
<dependency
name='filesystem_minimal'
grouping='require_all'
@@ -159,6 +155,10 @@
timeout_seconds='60' />
<instance name='default' enabled='false' >
<restarter>
<service_fmri value='svc:/network/inetd:default' />
</restarter>
<dependency
name='cupsd'
grouping='require_all'
+1
Ver Arquivo
@@ -47,6 +47,7 @@ MAN5 = classes.conf.$(MAN5EXT) \
printers.conf.$(MAN5EXT) \
subscriptions.conf.$(MAN5EXT)
MAN7 = backend.$(MAN7EXT) \
drv.$(MAN7EXT) \
filter.$(MAN7EXT) \
notifier.$(MAN7EXT)
MAN8 = cupsaccept.$(MAN8EXT) \
+40
Ver Arquivo
@@ -0,0 +1,40 @@
.\"
.\" "$Id$"
.\"
.\" 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$".
.\"
+6 -5
Ver Arquivo
@@ -1,9 +1,9 @@
.\"
.\" "$Id: lp.man 9282 2010-08-31 15:56:40Z mike $"
.\" "$Id: lp.man 8421 2009-03-09 21:59:55Z mike $"
.\"
.\" lp man page for the Common UNIX Printing System (CUPS).
.\"
.\" Copyright 2007-2010 by Apple Inc.
.\" Copyright 2007-2009 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" "31 August 2010" "Apple Inc."
.TH lp 1 "CUPS" "17 November 2008" "Apple Inc."
.SH NAME
lp - print files
.SH SYNOPSIS
@@ -157,6 +157,7 @@ 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
@@ -257,7 +258,7 @@ is highest priority).
.br
http://localhost:631/help
.SH COPYRIGHT
Copyright 2007-2010 by Apple Inc.
Copyright 2007-2009 by Apple Inc.
.\"
.\" End of "$Id: lp.man 9282 2010-08-31 15:56:40Z mike $".
.\" End of "$Id: lp.man 8421 2009-03-09 21:59:55Z mike $".
.\"
+26 -27
Ver Arquivo
@@ -1,9 +1,9 @@
.\"
.\" "$Id: lpadmin.man 9291 2010-09-01 15:51:59Z mike $"
.\" "$Id: lpadmin.man 8421 2009-03-09 21:59:55Z mike $"
.\"
.\" lpadmin man page for the Common UNIX Printing System (CUPS).
.\"
.\" Copyright 2007-2010 by Apple Inc.
.\" Copyright 2007-2009 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" "1 September 2010" "Apple Inc."
.TH lpadmin 8 "CUPS" "3 November 2008" "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 destination option(s)
.I printer 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 or class. The additional options are described below.
printer. 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,9 +78,8 @@ 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 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.
Sets a standard System V interface script or PPD file from the
\fImodel\fR directory.
.TP 5
-o job-k-limit=value
.br
@@ -106,12 +105,13 @@ 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 destination. Any print-time
Sets a default server-side option for the printer. 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,21 +125,20 @@ 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", "retry-current-job", or "stop-printer". The default
error policy is "stop-printer" for printers and "retry-current-job" for
classes.
"abort-job", "retry-job" or "stop-printer". The default error
policy is "stop-printer".
.TP 5
-o printer-is-shared=true/false
.br
Sets the destination to shared/published or unshared/unpublished.
Shared/published destinations are publically announced by the server
Sets the printer to shared/published or unshared/unpublished.
Shared/published printers are publically announced by the server
on the LAN based on the browsing configuration in
\fBcupsd.conf\fR, while unshared/unpublished destinations are not
\fBcupsd.conf\fR, while unshared/unpublished printers are not
announced. The default value is "true".
.TP 5
-o printer-op-policy=name
.br
Sets the IPP operation policy associated with the destination. The
Sets the IPP operation policy associated with the printer. The
name must be defined in the \fBcupsd.conf\fR in a Policy section.
The default operation policy is "default".
.TP 5
@@ -156,7 +155,7 @@ resulting class becomes empty it is removed.
.TP 5
-u deny:none
.br
Sets user-level access control on a destination. Names starting with
Sets user-level access control on a printer. Names starting with
"@" are interpreted as UNIX groups. The latter two forms turn
user-level access control off.
.TP 5
@@ -164,21 +163,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 \fI-v\fR option with the
\fIlpinfo(8)\fR command to get a list of supported device URIs and schemes.
the form \fIfile:///file/name\fR. Use the \fIlpinfo(8)\fR command
to get a list of supported device URIs and schemes.
.TP 5
-D "info"
.br
Provides a textual description of the destination.
Provides a textual description of the printer.
.TP 5
-E
.br
Enables the destination and accepts jobs; this is the same as running the
\fIcupsaccept(8)\fR and \fIcupsenable(8)\fR programs on the destination.
Enables the printer and accepts jobs; this is the same as running the
\fIcupsaccept(8)\fR and \fIcupsenable(8)\fR programs on the printer.
.TP 5
-L "location"
.br
Provides a textual location of the destination.
Provides a textual location of the printer.
.TP 5
-P ppd-file
.br
@@ -202,7 +201,7 @@ System V or Solaris printing system configuration options.
.br
http://localhost:631/help
.SH COPYRIGHT
Copyright 2007-2010 by Apple Inc.
Copyright 2007-2009 by Apple Inc.
.\"
.\" End of "$Id: lpadmin.man 9291 2010-09-01 15:51:59Z mike $".
.\" End of "$Id: lpadmin.man 8421 2009-03-09 21:59:55Z mike $".
.\"
+2 -4
Ver Arquivo
@@ -369,10 +369,8 @@ email_message(const char *to, /* I - Recipient of message */
fputs("DEBUG: QUIT\n", stderr);
if (!cupsFileGets(fp, response, sizeof(response)) || atoi(response) >= 500)
fprintf(stderr, "ERROR: Got \"%s\" trying to QUIT connection.\n",
response);
else
fprintf(stderr, "DEBUG: <<< %s\n", response);
goto smtp_error;
fprintf(stderr, "DEBUG: <<< %s\n", response);
cupsFileClose(fp);
+2
Ver Arquivo
@@ -707,6 +707,8 @@ 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
+2
Ver Arquivo
@@ -285,6 +285,8 @@ 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
+8 -8
Ver Arquivo
@@ -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(*newv & 255) || *newv == '-' || *newv == '+')
if (isdigit(*v & 255) || *v == '-' || *v == '+')
{
// 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)
{
strlcpy(bufptr, var->value->value, bufend - bufptr + 1);
bufptr += strlen(bufptr);
strncpy(bufptr, var->value->value, bufend - bufptr);
bufptr += strlen(var->value->value);
}
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(bufptr);
bufptr += strlen(name) + 1;
}
}
}
+5 -5
Ver Arquivo
@@ -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);
+3 -6
Ver Arquivo
@@ -41,7 +41,6 @@ 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 */
/*
@@ -56,10 +55,8 @@ cupsdAddClass(const char *name) /* I - Name of class */
c->type = CUPS_PRINTER_CLASS;
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
ServerName, RemotePort, "/classes/%s", name);
cupsdSetString(&c->uri, uri);
cupsdSetStringf(&c->uri, "ipp://%s:%d/classes/%s", ServerName, RemotePort,
name);
cupsdSetString(&c->error_policy, "retry-current-job");
}
@@ -725,7 +722,7 @@ cupsdSaveAllClasses(void)
*/
fchown(cupsFileNumber(fp), RunUser, Group);
fchmod(cupsFileNumber(fp), ConfigFilePerm);
fchmod(cupsFileNumber(fp), 0600);
/*
* Write a small header to the file...
+75 -240
Ver Arquivo
@@ -54,25 +54,19 @@
#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
@@ -1382,35 +1376,6 @@ 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) &&
@@ -3388,125 +3353,49 @@ get_cdsa_certificate(
cupsd_client_t *con) /* I - Client connection */
{
OSStatus err; /* Error info */
SecKeychainRef keychain = NULL;/* Keychain reference */
SecIdentitySearchRef search = NULL; /* Search reference */
SecIdentityRef identity = NULL;/* Identity */
SecKeychainRef keychain; /* Keychain reference */
SecIdentitySearchRef search; /* Search reference */
SecIdentityRef identity; /* 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);
goto cleanup;
return (NULL);
}
# 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;
}
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)
# if HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY
/*
* Use a policy to search for valid certificates who's common name matches the
* servername...
*/
if (SecPolicySearchCreate(CSSM_CERT_X_509v3, &CSSMOID_APPLE_TP_SSL,
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,
NULL, &policy_search))
{
cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create a policy search reference");
goto cleanup;
CFRelease(keychain);
return (NULL);
}
if (SecPolicySearchCopyNext(policy_search, &policy))
{
cupsdLogMessage(CUPSD_LOG_ERROR,
"Cannot find a policy to use for searching");
goto cleanup;
CFRelease(keychain);
CFRelease(policy_search);
return (NULL);
}
memset(&ssl_options, 0, sizeof(ssl_options));
@@ -3514,6 +3403,10 @@ 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);
@@ -3521,20 +3414,13 @@ get_cdsa_certificate(
{
cupsdLogMessage(CUPSD_LOG_ERROR,
"Cannot set policy value to use for searching");
goto cleanup;
CFRelease(keychain);
CFRelease(policy_search);
return (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);
err = SecIdentitySearchCreateWithPolicy(policy, NULL, CSSM_KEYUSE_SIGN,
keychain, FALSE, &search);
if (err && DNSSDHostName)
{
/*
@@ -3555,30 +3441,13 @@ get_cdsa_certificate(
{
cupsdLogMessage(CUPSD_LOG_ERROR,
"Cannot set policy value to use for searching");
goto cleanup;
CFRelease(keychain);
CFRelease(policy_search);
return (NULL);
}
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;
err = SecIdentitySearchCreateWithPolicy(policy, NULL, CSSM_KEYUSE_SIGN,
keychain, FALSE, &search);
}
# else
@@ -3586,56 +3455,43 @@ get_cdsa_certificate(
* Assume there is exactly one SecIdentity in the keychain...
*/
if ((err = SecIdentitySearchCreate(keychain, CSSM_KEYUSE_SIGN, &search)))
{
err = SecIdentitySearchCreate(keychain, CSSM_KEYUSE_SIGN, &search);
# endif /* HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY */
if (err)
cupsdLogMessage(CUPSD_LOG_DEBUG,
"Cannot create identity search reference (%d)", (int)err);
goto cleanup;
}
if ((err = SecIdentitySearchCopyNext(search, &identity)))
"Cannot create keychain search reference: %s (%d)",
cssmErrorString(err), (int)err);
else
{
cupsdLogMessage(CUPSD_LOG_DEBUG,
"Cannot find signing key in keychain \"%s\": %s (%d)",
ServerCertificate, cssmErrorString(err), (int)err);
goto cleanup;
}
# endif /* HAVE_SECPOLICYCREATESSL */
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");
}
if (CFGetTypeID(identity) != SecIdentityGetTypeID())
{
cupsdLogMessage(CUPSD_LOG_ERROR, "SecIdentity CFTypeID failure!");
goto cleanup;
}
CFRelease(identity);
}
if ((certificates = CFArrayCreate(NULL, (const void **)&identity,
1, &kCFTypeArrayCallBacks)) == NULL)
{
cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot create certificate array");
goto cleanup;
}
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 */
# if HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY
CFRelease(policy);
CFRelease(policy_search);
# endif /* HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY */
return (certificates);
}
@@ -3666,12 +3522,6 @@ 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))
@@ -3704,7 +3554,6 @@ 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))
@@ -4534,20 +4383,11 @@ 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 */
localname[1024], /* Local hostname */
*servername; /* Name of server in cert */
infofile[1024]; /* Type-in information for 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...
*/
@@ -4575,7 +4415,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",
servername, servername, ServerAdmin);
con->servername, con->servername, ServerAdmin);
cupsFileClose(fp);
cupsdLogMessage(CUPSD_LOG_INFO,
@@ -4664,7 +4504,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], /* AUTH_TYPE environment variable */
char auth_type[256], /* CUPSD_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 */
@@ -4710,12 +4550,7 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */
argv[0] = command;
if (options)
{
commptr = options;
if (*commptr == ' ')
commptr ++;
strlcpy(argbuf, commptr, sizeof(argbuf));
}
strlcpy(argbuf, options, sizeof(argbuf));
else
argbuf[0] = '\0';
@@ -4814,7 +4649,7 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */
if (con->username[0])
{
snprintf(auth_type, sizeof(auth_type), "AUTH_TYPE=%s",
snprintf(auth_type, sizeof(auth_type), "CUPSD_AUTH_TYPE=%s",
httpGetField(HTTP(con), HTTP_FIELD_AUTHORIZATION));
if ((uriptr = strchr(auth_type + 10, ' ')) != NULL)
+2 -35
Ver Arquivo
@@ -1173,19 +1173,6 @@ cupsdReadConfiguration(void)
DefaultPolicyPtr = p = cupsdAddPolicy("default");
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 "
@@ -3698,30 +3685,10 @@ read_policy(cups_file_t *fp, /* I - Configuration file */
linenum);
/*
* Verify that we have an explicit policy for Validate-Job and
* CUPS-Get-Document, which ensures that upgrades do not introduce new
* security issues...
* Verify that we have an explicit policy for CUPS-Get-Document
* (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)
{
+1 -3
Ver Arquivo
@@ -161,10 +161,8 @@ 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 */
+28 -49
Ver Arquivo
@@ -1245,7 +1245,7 @@ add_class(cupsd_client_t *con, /* I - Client connection */
if (modify)
{
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED,
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED | CUPSD_EVENT_PRINTER_CONFIG,
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,
cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED | CUPSD_EVENT_PRINTER_CONFIG,
pclass, NULL, "New class \"%s\" added by \"%s\".",
pclass->name, get_username(con));
@@ -1350,6 +1350,7 @@ 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 */
@@ -1523,10 +1524,22 @@ add_job(cupsd_client_t *con, /* I - Client connection */
* Do media selection as needed...
*/
if (!ippFindAttribute(con->request, "PageRegion", IPP_TAG_ZERO) &&
!ippFindAttribute(con->request, "PageSize", IPP_TAG_ZERO) &&
_pwgGetPageSize(printer->pwg, con->request, NULL, &exact))
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)
{
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)
@@ -2923,21 +2936,19 @@ add_printer(cupsd_client_t *con, /* I - Client connection */
{
/*
* If we changed the PPD/interface script, then remove the printer's cache
* file and clear the printer-state-reasons...
* file...
*/
char cache_name[1024]; /* Cache filename for printer attrs */
snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp4", CacheDir,
snprintf(cache_name, sizeof(cache_name), "%s/%s.ipp", CacheDir,
printer->name);
unlink(cache_name);
snprintf(cache_name, sizeof(cache_name), "%s/%s.pwg3", CacheDir,
snprintf(cache_name, sizeof(cache_name), "%s/%s.pwg", CacheDir,
printer->name);
unlink(cache_name);
cupsdSetPrinterReasons(printer, "none");
#ifdef __APPLE__
/*
* (Re)register color profiles...
@@ -3014,7 +3025,7 @@ add_printer(cupsd_client_t *con, /* I - Client connection */
if (modify)
{
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED,
cupsdAddEvent(CUPSD_EVENT_PRINTER_MODIFIED | CUPSD_EVENT_PRINTER_CONFIG,
printer, NULL, "Printer \"%s\" modified by \"%s\".",
printer->name, get_username(con));
@@ -3025,7 +3036,7 @@ add_printer(cupsd_client_t *con, /* I - Client connection */
{
cupsdAddPrinterHistory(printer);
cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED,
cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED | CUPSD_EVENT_PRINTER_CONFIG,
printer, NULL, "New printer \"%s\" added by \"%s\".",
printer->name, get_username(con));
@@ -4284,8 +4295,7 @@ check_rss_recipient(
* 'check_quotas()' - Check quotas for a printer and user.
*/
static int /* O - 1 if OK, 0 if forbidden,
-1 if limit reached */
static int /* O - 1 if OK, 0 if not */
check_quotas(cupsd_client_t *con, /* I - Client connection */
cupsd_printer_t *p) /* I - Printer or class */
{
@@ -4335,7 +4345,7 @@ check_quotas(cupsd_client_t *con, /* I - Client connection */
{
cupsdLogMessage(CUPSD_LOG_INFO, "Too many jobs for printer \"%s\"...",
p->name);
return (-1);
return (0);
}
}
@@ -4349,7 +4359,7 @@ check_quotas(cupsd_client_t *con, /* I - Client connection */
{
cupsdLogMessage(CUPSD_LOG_INFO, "Too many jobs for user \"%s\"...",
username);
return (-1);
return (0);
}
}
@@ -5497,8 +5507,6 @@ 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 */
@@ -5606,16 +5614,6 @@ 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);
@@ -6509,13 +6507,10 @@ delete_printer(cupsd_client_t *con, /* I - Client connection */
printer->name);
unlink(filename);
snprintf(filename, sizeof(filename), "%s/%s.ipp4", CacheDir, printer->name);
snprintf(filename, sizeof(filename), "%s/%s.ipp", CacheDir, printer->name);
unlink(filename);
snprintf(filename, sizeof(filename), "%s/%s.png", CacheDir, printer->name);
unlink(filename);
snprintf(filename, sizeof(filename), "%s/%s.pwg3", CacheDir, printer->name);
snprintf(filename, sizeof(filename), "%s/%s.pwg", CacheDir, printer->name);
unlink(filename);
#ifdef __APPLE__
@@ -11416,7 +11411,6 @@ 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 */
@@ -11502,21 +11496,6 @@ validate_job(cupsd_client_t *con, /* I - Client connection */
return;
}
/*
* 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...
*/
+28 -189
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* Job management routines for the CUPS scheduler.
* Job management routines for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 2007-2009 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 size_t ipp_length(ipp_t *ipp);
static int 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 &&
!DoingShutdown && !job->printer)
!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 && JobRetryLimit > 0)
if (job->tries >= JobRetryLimit)
{
/*
* Too many tries...
@@ -3021,183 +3021,39 @@ 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 size_t optlength = 0; /* Length of option buffer */
static int 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 build an options array for any PWG->PPD mapped option/choice pairs.
* First allocate/reallocate the option buffer as needed...
*/
pwg = job->printer->pwg;
num_pwgppds = 0;
pwgppds = NULL;
i = ipp_length(job->attrs);
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 (i > optlength || !options)
{
if (!options)
optptr = malloc(newlength);
optptr = malloc(i);
else
optptr = realloc(options, newlength);
optptr = realloc(options, i);
if (!optptr)
{
cupsdLogJob(job, CUPSD_LOG_CRIT,
"Unable to allocate " CUPS_LLFMT " bytes for option buffer!",
CUPS_LLCAST newlength);
"Unable to allocate %d bytes for option buffer!", i);
return (NULL);
}
options = optptr;
optlength = newlength;
optlength = i;
}
/*
@@ -3233,8 +3089,7 @@ get_options(cupsd_job_t *job, /* I - Job */
* Filter out other unwanted attributes...
*/
if (attr->value_tag == IPP_TAG_NOVALUE ||
attr->value_tag == IPP_TAG_MIMETYPE ||
if (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")) ||
@@ -3242,7 +3097,8 @@ get_options(cupsd_job_t *job, /* I - Job */
attr->value_tag == IPP_TAG_BEGIN_COLLECTION) /* Not yet supported */
continue;
if (!strcmp(attr->name, "job-hold-until"))
if (!strncmp(attr->name, "time-", 5) ||
!strcmp(attr->name, "job-hold-until"))
continue;
if (!strncmp(attr->name, "job-", 4) &&
@@ -3300,6 +3156,7 @@ 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;
@@ -3348,25 +3205,6 @@ 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);
}
@@ -3377,10 +3215,10 @@ get_options(cupsd_job_t *job, /* I - Job */
* the textual IPP attributes.
*/
static size_t /* O - Size of attribute buffer */
static int /* O - Size of attribute buffer */
ipp_length(ipp_t *ipp) /* I - IPP request */
{
size_t bytes; /* Number of bytes */
int bytes; /* Number of bytes */
int i; /* Looping var */
ipp_attribute_t *attr; /* Current attribute */
@@ -3397,14 +3235,16 @@ ipp_length(ipp_t *ipp) /* I - IPP request */
* Skip attributes that won't be sent to filters...
*/
if (attr->value_tag == IPP_TAG_NOVALUE ||
attr->value_tag == IPP_TAG_MIMETYPE ||
if (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
@@ -4446,8 +4286,7 @@ update_job(cupsd_job_t *job) /* I - Job to check */
{
cupsdLogJob(job, loglevel, "%s", message);
if (loglevel < CUPSD_LOG_DEBUG &&
strcmp(job->printer->state_message, ptr))
if (loglevel < CUPSD_LOG_DEBUG)
{
strlcpy(job->printer->state_message, message,
sizeof(job->printer->state_message));
@@ -4482,7 +4321,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);
if (event & CUPSD_EVENT_PRINTER_STATE)
else if (event & CUPSD_EVENT_PRINTER_STATE)
cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, job->printer, NULL,
(job->printer->type & CUPS_PRINTER_CLASS) ?
"Class \"%s\" state changed." :
+6 -11
Ver Arquivo
@@ -728,8 +728,6 @@ main(int argc, /* I - Number of command-line args */
* Shutdown the server...
*/
DoingShutdown = 1;
cupsdStopServer();
/*
@@ -760,8 +758,6 @@ main(int argc, /* I - Number of command-line args */
* Startup the server...
*/
DoingShutdown = 0;
cupsdStartServer();
/*
@@ -796,7 +792,8 @@ main(int argc, /* I - Number of command-line args */
!cupsArrayCount(ActiveJobs) &&
(!Browsing ||
(!BrowseRemoteProtocols &&
(!BrowseLocalProtocols || !cupsArrayCount(Printers)))))
(!NumBrowsers || !BrowseLocalProtocols ||
cupsArrayCount(Printers) == 0))))
{
timeout = LaunchdTimeout;
launchd_idle_exit = 1;
@@ -1137,8 +1134,6 @@ main(int argc, /* I - Number of command-line args */
* Close all network clients...
*/
DoingShutdown = 1;
cupsdStopServer();
#ifdef HAVE_LAUNCHD
@@ -1661,10 +1656,10 @@ launchd_checkout(void)
* shared printers to advertise...
*/
if (cupsArrayCount(ActiveJobs) || NumPolled ||
(Browsing &&
(BrowseRemoteProtocols ||
(BrowseLocalProtocols && cupsArrayCount(Printers)))))
if ((cupsArrayCount(ActiveJobs) || NumPolled ||
(Browsing &&
(BrowseRemoteProtocols ||
(BrowseLocalProtocols && NumBrowsers && cupsArrayCount(Printers))))))
{
cupsdLogMessage(CUPSD_LOG_DEBUG,
"Creating launchd keepalive file \"" CUPS_KEEPALIVE
+16 -229
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* "$Id$"
*
* Printer routines for the CUPS scheduler.
* Printer routines for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
@@ -65,21 +65,6 @@
#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 */
/*
@@ -112,7 +97,6 @@ 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 */
/*
@@ -136,9 +120,8 @@ cupsdAddPrinter(const char *name) /* I - Name of printer */
cupsdSetString(&p->info, name);
cupsdSetString(&p->hostname, ServerName);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
ServerName, RemotePort, "/printers/%s", name);
cupsdSetString(&p->uri, uri);
cupsdSetStringf(&p->uri, "ipp://%s:%d/printers/%s", ServerName, RemotePort,
name);
cupsdSetDeviceURI(p, "file:///dev/null");
p->state = IPP_PRINTER_STOPPED;
@@ -292,14 +275,6 @@ 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 */
@@ -445,7 +420,6 @@ cupsdCreateCommonData(void)
"multiple-document-handling",
"number-up",
"output-bin",
"output-mode",
"orientation-requested",
"page-ranges",
"print-quality",
@@ -464,7 +438,6 @@ cupsdCreateCommonData(void)
"multiple-document-handling",
"number-up",
"output-bin",
"output-mode",
"orientation-requested",
"page-ranges",
"print-quality",
@@ -483,34 +456,6 @@ 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...
@@ -704,9 +649,9 @@ cupsdCreateCommonData(void)
/* page-ranges-supported */
ippAddBoolean(CommonData, IPP_TAG_PRINTER, "page-ranges-supported", 1);
/* pdl-override-supported */
/* pdf-override-supported */
ippAddString(CommonData, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
"pdl-override-supported", NULL, "attempted");
"pdl-override-supported", NULL, "not-attempted");
/* printer-op-policy-supported */
attr = ippAddStrings(CommonData, IPP_TAG_PRINTER, IPP_TAG_NAME | IPP_TAG_COPY,
@@ -1605,7 +1550,7 @@ cupsdSaveAllPrinters(void)
*/
fchown(cupsFileNumber(fp), getuid(), Group);
fchmod(cupsFileNumber(fp), ConfigFilePerm & 0600);
fchmod(cupsFileNumber(fp), 0600);
/*
* Write a small header to the file...
@@ -2725,8 +2670,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? */
@@ -4043,11 +3988,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.ipp4", 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;
snprintf(pwg_name, sizeof(pwg_name), "%s/%s.pwg3", CacheDir, p->name);
snprintf(pwg_name, sizeof(pwg_name), "%s/%s.pwg", CacheDir, p->name);
if (stat(pwg_name, &pwg_info))
pwg_info.st_mtime = 0;
@@ -4528,18 +4473,10 @@ 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")) ||
(!ppd_attr && ppd->manufacturer && /* "Compatibility heuristic" */
(!strcasecmp(ppd->manufacturer, "epson") ||
!strcasecmp(ppd->manufacturer, "lexmark"))))
!strcasecmp(ppd_attr->value, "Reverse"))
{
/*
* 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,
@@ -4553,31 +4490,6 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
"output-bin-default", NULL, "face-down");
}
/*
* 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...
*/
@@ -4611,7 +4523,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 = 300;
xdpi = ydpi = 72;
}
attr->values[i].resolution.xres = xdpi;
@@ -4645,7 +4557,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 = 300;
xdpi = ydpi = 72;
}
ippAddResolution(p->ppd_attrs, IPP_TAG_PRINTER,
@@ -4663,18 +4575,16 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
ippAddResolution(p->ppd_attrs, IPP_TAG_PRINTER,
"printer-resolution-default", IPP_RES_PER_INCH,
300, 300);
72, 72);
ippAddResolution(p->ppd_attrs, IPP_TAG_PRINTER,
"printer-resolution-supported", IPP_RES_PER_INCH,
300, 300);
72, 72);
}
/*
* Duplexing, etc...
*/
ppdMarkDefaults(ppd);
if ((duplex = ppdFindOption(ppd, "Duplex")) == NULL)
if ((duplex = ppdFindOption(ppd, "EFDuplex")) == NULL)
if ((duplex = ppdFindOption(ppd, "EFDuplexing")) == NULL)
@@ -4936,129 +4846,6 @@ 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...
*/
+1 -2
Ver Arquivo
@@ -224,7 +224,6 @@ 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 */
/*
@@ -244,7 +243,7 @@ export_dest(http_t *http, /* I - Connection to server */
* Try to export it...
*/
for (status = 0, tries = 0; !status && tries < 3; tries ++)
for (status = 0; !status;)
{
/*
* Get the password, as needed...
+670 -85
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* "lpadmin" command for CUPS.
* "lpadmin" command for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -17,12 +17,17 @@
* 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_options() - Set the printer options and/or file.
* 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.
* validate_name() - Make sure the printer name only contains
* valid chars.
* valid chars...
*/
/*
@@ -37,22 +42,28 @@
#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 *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);
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 *);
/*
@@ -70,7 +81,6 @@ 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);
@@ -79,7 +89,6 @@ 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] == '-')
@@ -210,8 +219,34 @@ 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])
file = argv[i] + 2;
{
if (set_printer_file(http, printer, argv[i] + 2))
return (1);
}
else
{
i ++;
@@ -224,7 +259,8 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
file = argv[i];
if (set_printer_file(http, printer, argv[i]))
return (1);
}
break;
@@ -263,9 +299,35 @@ 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])
num_options = cupsAddOption("ppd-name", argv[i] + 2, num_options,
&options);
{
if (set_printer_model(http, printer, argv[i] + 2))
return (1);
}
else
{
i ++;
@@ -278,8 +340,8 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
num_options = cupsAddOption("ppd-name", argv[i], num_options,
&options);
if (set_printer_model(http, printer, argv[i]))
return (1);
}
break;
@@ -303,6 +365,20 @@ 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
@@ -436,9 +512,34 @@ 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])
num_options = cupsAddOption("device-uri", argv[i] + 2,
num_options, &options);
{
if (set_printer_device(http, printer, argv[i] + 2))
return (1);
}
else
{
i ++;
@@ -451,8 +552,8 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
num_options = cupsAddOption("device-uri", argv[i],
num_options, &options);
if (set_printer_device(http, printer, argv[i]))
return (1);
}
break;
@@ -503,9 +604,35 @@ 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])
num_options = cupsAddOption("printer-info", argv[i] + 2,
num_options, &options);
{
if (set_printer_info(http, printer, argv[i] + 2))
return (1);
}
else
{
i ++;
@@ -518,8 +645,8 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
num_options = cupsAddOption("printer-info", argv[i],
num_options, &options);
if (set_printer_info(http, printer, argv[i]))
return (1);
}
break;
@@ -539,9 +666,34 @@ 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])
num_options = cupsAddOption("printer-location", argv[i] + 2,
num_options, &options);
{
if (set_printer_location(http, printer, argv[i] + 2))
return (1);
}
else
{
i ++;
@@ -554,14 +706,40 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
num_options = cupsAddOption("printer-location", argv[i],
num_options, &options);
if (set_printer_location(http, printer, argv[i]))
return (1);
}
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])
file = argv[i] + 2;
{
if (set_printer_file(http, printer, argv[i] + 2))
return (1);
}
else
{
i ++;
@@ -573,7 +751,8 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
file = argv[i];
if (set_printer_file(http, printer, argv[i]))
return (1);
}
break;
@@ -593,7 +772,7 @@ main(int argc, /* I - Number of command-line arguments */
* Set options as needed...
*/
if (num_options || file)
if (num_options)
{
if (!http)
{
@@ -616,7 +795,7 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
if (set_printer_options(http, printer, num_options, options, file))
if (set_printer_options(http, printer, num_options, options))
return (1);
}
@@ -1109,6 +1288,429 @@ 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.
*/
@@ -1118,8 +1720,7 @@ 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 */
char *file) /* I - PPD file/interface script */
cups_option_t *options) /* I - Options */
{
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
@@ -1134,15 +1735,14 @@ set_printer_options(
keyword[1024], /* Keyword from Default line */
*keyptr, /* Pointer into keyword... */
tempfile[1024]; /* Temporary filename */
cups_file_t *in, /* PPD file */
FILE *in, /* PPD file */
*out; /* Temporary file */
const char *protocol, /* Old protocol option */
*customval; /* Custom option value */
int outfd; /* Temporary file descriptor */
const char *protocol; /* Old protocol option */
DEBUG_printf(("set_printer_options(http=%p, printer=\"%s\", num_options=%d, "
"options=%p, file=\"%s\")\n", http, printer, num_options,
options, file));
DEBUG_printf(("set_printer_options(%p, \"%s\", %d, %p)\n", http, printer,
num_options, options));
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/printers/%s", printer);
@@ -1161,6 +1761,7 @@ 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");
@@ -1168,7 +1769,7 @@ set_printer_options(
* Do the request...
*/
op = CUPS_ADD_MODIFY_PRINTER;
op = CUPS_ADD_PRINTER;
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
@@ -1181,7 +1782,7 @@ set_printer_options(
{
if (attr->values[0].integer & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT))
{
op = CUPS_ADD_MODIFY_CLASS;
op = CUPS_ADD_CLASS;
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/classes/%s", printer);
}
@@ -1191,8 +1792,8 @@ set_printer_options(
}
/*
* Build a CUPS_ADD_MODIFY_PRINTER or CUPS_ADD_MODIFY_CLASS request, which
* requires the following attributes:
* Build a CUPS_ADD_PRINTER or CUPS_ADD_CLASS request, which requires
* the following attributes:
*
* attributes-charset
* attributes-natural-language
@@ -1204,8 +1805,6 @@ 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...
@@ -1223,9 +1822,7 @@ set_printer_options(
NULL, "tbcp");
}
if (file)
ppdfile = file;
else if (op == CUPS_ADD_MODIFY_PRINTER)
if (op == CUPS_ADD_PRINTER)
ppdfile = cupsGetPPD(printer);
else
ppdfile = NULL;
@@ -1240,34 +1837,33 @@ set_printer_options(
ppdMarkDefaults(ppd);
cupsMarkOptions(ppd, num_options, options);
if ((out = cupsTempFile2(tempfile, sizeof(tempfile))) < 0)
if ((outfd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
_cupsLangPrintError(_("ERROR: Unable to create temporary file"));
ippDelete(request);
if (ppdfile != file)
unlink(ppdfile);
unlink(ppdfile);
return (1);
}
if ((in = cupsFileOpen(ppdfile, "r")) == NULL)
if ((in = fopen(ppdfile, "rb")) == NULL)
{
_cupsLangPrintf(stderr,
_("lpadmin: Unable to open PPD file \"%s\" - %s\n"),
ppdfile, strerror(errno));
ippDelete(request);
if (ppdfile != file)
unlink(ppdfile);
cupsFileClose(out);
unlink(ppdfile);
close(outfd);
unlink(tempfile);
return (1);
}
out = fdopen(outfd, "wb");
ppdchanged = 0;
while (cupsFileGets(in, line, sizeof(line)))
while (get_line(line, sizeof(line), in) != NULL)
{
if (strncmp(line, "*Default", 8))
cupsFilePrintf(out, "%s\n", line);
fprintf(out, "%s\n", line);
else
{
/*
@@ -1297,27 +1893,17 @@ set_printer_options(
if (choice && strcmp(choice->choice, keyptr))
{
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);
fprintf(out, "*Default%s: %s\n", keyword, choice->choice);
ppdchanged = 1;
}
else
cupsFilePrintf(out, "%s\n", line);
fprintf(out, "%s\n", line);
}
}
cupsFileClose(in);
cupsFileClose(out);
fclose(in);
fclose(out);
close(outfd);
ppdClose(ppd);
/*
@@ -1325,15 +1911,14 @@ set_printer_options(
*/
ippDelete(cupsDoFileRequest(http, request, "/admin/",
ppdchanged ? tempfile : file));
ppdchanged ? tempfile : NULL));
/*
* Clean up temp files... (TODO: catch signals in case we CTRL-C during
* lpadmin)
*/
if (ppdfile != file)
unlink(ppdfile);
unlink(ppdfile);
unlink(tempfile);
}
else
+2 -2
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* MD5 password program for CUPS.
* MD5 password program for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 2007 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
+15 -12
Ver Arquivo
@@ -1,9 +1,9 @@
/*
* "$Id$"
*
* "lpstat" command for CUPS.
* "lpstat" command for the Common UNIX Printing System (CUPS).
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -34,7 +34,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <cups/globals.h>
#include <cups/http-private.h>
#include <cups/string.h>
#include <cups/cups.h>
#include <cups/i18n.h>
#include <cups/debug.h>
@@ -1515,7 +1518,7 @@ show_printers(const char *printers, /* I - Destinations */
char printer_uri[HTTP_MAX_URI],
/* Printer URI */
printer_state_time[255];/* Printer state time */
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
const char *root; /* Server root directory... */
static const char *pattrs[] = /* Attributes we need for printers... */
{
"printer-name",
@@ -1533,14 +1536,16 @@ show_printers(const char *printers, /* I - Destinations */
};
static const char *jattrs[] = /* Attributes we need for jobs... */
{
"job-id",
"job-state"
"job-id"
};
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;
@@ -1815,11 +1820,10 @@ show_printers(const char *printers, /* I - Destinations */
if (make_model && strstr(make_model, "System V Printer"))
_cupsLangPrintf(stdout,
_("\tInterface: %s/interfaces/%s\n"),
cg->cups_serverroot, printer);
root, printer);
else if (make_model && !strstr(make_model, "Raw Printer"))
_cupsLangPrintf(stdout,
_("\tInterface: %s/ppd/%s.ppd\n"),
cg->cups_serverroot, printer);
_("\tInterface: %s/ppd/%s.ppd\n"), root, printer);
}
_cupsLangPuts(stdout, _("\tOn fault: no alert\n"));
_cupsLangPuts(stdout, _("\tAfter fault: continue\n"));
@@ -1929,11 +1933,10 @@ show_printers(const char *printers, /* I - Destinations */
if (make_model && strstr(make_model, "System V Printer"))
_cupsLangPrintf(stdout,
_("\tInterface: %s/interfaces/%s\n"),
cg->cups_serverroot, printer);
root, printer);
else if (make_model && !strstr(make_model, "Raw Printer"))
_cupsLangPrintf(stdout,
_("\tInterface: %s/ppd/%s.ppd\n"),
cg->cups_serverroot, printer);
_("\tInterface: %s/ppd/%s.ppd\n"), root, printer);
}
_cupsLangPuts(stdout, _("\tOn fault: no alert\n"));
_cupsLangPuts(stdout, _("\tAfter fault: continue\n"));
+1 -1
Ver Arquivo
@@ -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}">
+1 -1
Ver Arquivo
@@ -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>
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
<FORM ACTION="/{SECTION}/{?SEARCH_DEST}" METHOD="GET">
<FORM ACTION="{THIS_URL}" METHOD="GET">
{WHICH_JOBS?<INPUT TYPE="HIDDEN" NAME="WHICH_JOBS" VALUE="{WHICH_JOBS}">:}
{ORDER?<INPUT TYPE="HIDDEN" NAME="ORDER" VALUE="{ORDER}">:}
+2 -2
Ver Arquivo
@@ -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="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>
{?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>
<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>
+1 -1
Ver Arquivo
@@ -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>
+1 -1
Ver Arquivo
@@ -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="Pobierz domyślne ustawienia drukarki">:}
{HAVE_AUTOCONFIGURE?<INPUT TYPE="SUBMIT" NAME="AUTOCONFIGURE" VALUE="Zakolejkuj drukarkę do domyślnych opcji">:}
<SCRIPT TYPE="text/javascript"><!--
function update_paramtable(option)
+1 -1
Ver Arquivo
@@ -651,7 +651,7 @@ fi
# Requests logged
count=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'`
expected=`expr 37 + 18 + $pjobs \* 8 + $pprinters \* $pjobs \* 4`
expected=`expr 39 + 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
+1
Ver Arquivo
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
#include <io.h>