Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| b7d698516c |
+227
-1
@@ -1,6 +1,232 @@
|
||||
CHANGES.txt - 2010-03-30
|
||||
CHANGES.txt - 2011-07-25
|
||||
------------------------
|
||||
|
||||
CHANGES IN CUPS V1.4.8
|
||||
|
||||
- The scheduler would delete job data files when restarted (STR #3880)
|
||||
- The network backends could crash if a printer returned a value of 0
|
||||
for the maximum capacity for a supply (STR #3875)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.4.7
|
||||
|
||||
- Documentation changes (STR #3710, STR #3720, STR #3745, STR #3750,
|
||||
STR #3757, STR #3758, STR #3782, STR #3826, STR #3829, STR #3837)
|
||||
- Web interface fixes (STR #3412, STR #3345, STR #3455, STR #3707,
|
||||
STR #3755, STR #3769, STR #3783)
|
||||
- Configure script fixes (STR #3659, STR #3691)
|
||||
- Compilation fixes (STR #3718, STR #3771, STR #3774)
|
||||
- The imageto* filters could crash with bad GIF files (STR #3867)
|
||||
- The scheduler might leave old job data files in the spool directory
|
||||
(STR #3795)
|
||||
- CUPS did not work with locales using the ASCII character set
|
||||
(STR #3832)
|
||||
- httpAddrString() did not return a URI-style IPv6 numeric address
|
||||
(STR #3814)
|
||||
- Fixed an issue when reading compressed CUPS raster streams (STR #3812)
|
||||
- Fixed an issue with PostScript printer auto-configuration (STR #3443)
|
||||
- Fixed some compatibility issues with the libusb-based USB backend
|
||||
(STR #3799)
|
||||
- The network backends no longer try to collect SNMP supply and status
|
||||
information for raw queues (STR #3809)
|
||||
- The DBUS notifier did not report job state changes (STR #3805)
|
||||
- The scheduler did not always report that the "normal" print-quality
|
||||
value was supported (STR #3803)
|
||||
- The gziptoany filter did not report the correct error if it was unable
|
||||
to write the uncompressed document to the next filter or backend in
|
||||
the chain (STR #3797)
|
||||
- The Epson and Oki 9-pin drivers had a bad resolution option
|
||||
(STR #3798)
|
||||
- The scheduler did not always register the correct default ICC profile
|
||||
on Mac OS X.
|
||||
- The scheduler did not use the job owner when authorizing access for
|
||||
the CUPS-Get-Document operation, preventing non-admins from accessing
|
||||
their own jobs.
|
||||
- CUPS did not work with some printers that incorrectly implemented the
|
||||
HTTP/1.1 standard (STR #3778, STR #3791)
|
||||
- The scheduler did not retry fax jobs properly.
|
||||
- The scheduler now recognizes an empty cupsCommands PPD keyword as
|
||||
meaning that CUPS commands are not supported for a printer (STR #3773)
|
||||
- Fixed a crash bug in the scheduler when the application/octet-stream
|
||||
MIME type was not defined (STR #3690)
|
||||
- Polled printers were advertised more slowly than necessary (STR #3574)
|
||||
- cupsResolveConflicts() did not handle resolving multiple UIConstraints
|
||||
issues (STR #3705)
|
||||
- The SetEnv and PassEnv directives had no effect (STR #3664)
|
||||
- The web interface no longer tries to use multi-part delivery when
|
||||
adding printers (STR #3455)
|
||||
- The libusb-based USB backend printed slowly to the LaserJet 1300 and
|
||||
other printers (STR #3405)
|
||||
- "lp" and "lpr" failed to print with Kerberos enabled (STR #3768)
|
||||
- The cupsctl program now displays an error if you try to directly set
|
||||
the Port or Listen directives (STR #3749)
|
||||
- PPD files with "*JobPatchFile: bla" no longer fail to load in relaxed
|
||||
conformance mode (STR #3747)
|
||||
- The scheduler generated a bad notify-text string for printer state
|
||||
change notifications (STR #3739)
|
||||
- The scheduler incorrectly updated printers.conf when it really needed
|
||||
to update classes.conf or remote.cache (STR #3726)
|
||||
- Hardwired remote printers with options did not work (STR #3717)
|
||||
- Accessing the CUPS web interface using a CNAME-based hostname would
|
||||
sometimes fail due to redirection to the actual hostname (STR #3701)
|
||||
- Subscription events had a misspelled attribute (STR #3693)
|
||||
- "make check" failed if LC_MESSAGES was set (STR #3765)
|
||||
- Fixed the configure script to always look for the pkg-config script
|
||||
(STR #3761)
|
||||
- The scheduler now only looks up interface hostnames if HostNameLookups
|
||||
are enabled (STR #3737)
|
||||
- Fixed a compilation problem on DragonFly BSD (STR #3738)
|
||||
- The default PageLogFormat value had the username and job ID swapped
|
||||
from CUPS 1.3.x (STR #3727)
|
||||
- The scheduler could crash if a browsed printer times out while a job
|
||||
is printing (STR #3754)
|
||||
- The scheduler incorrectly mapped custom page sizes to standard sizes
|
||||
(STR #3764)
|
||||
- cupsfilter and pstops did not map IPP attributes to PPD options due to
|
||||
a change in cupsMarkOptions (STR #3756)
|
||||
- The scheduler did not always show the most recent status message from
|
||||
the print filters (STR #3731)
|
||||
- The PostScript filter did not apply the mirror and number-up options
|
||||
properly, leading to offset and clipped output (STR #3732)
|
||||
- The network backends always reported "low toner" or "out of toner"
|
||||
states, even for inkjet printers (STR #3733)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.4.6
|
||||
|
||||
- Fixed a "make check" issue on Solaris (STR #3729)
|
||||
- Regression: The pstops filter did not support landscape printing of
|
||||
PostScript files (STR #3722)
|
||||
- The scheduler killed retried (fax) jobs after restarting them
|
||||
(STR #3697)
|
||||
- The cupsAdminSetServerSettings() function disabled sharing when
|
||||
debug logging was enabled (STR #3712)
|
||||
|
||||
|
||||
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)
|
||||
- Security: The texttops filter did not check the results of allocations
|
||||
(STR #3516)
|
||||
- Security: The fix for CVE-2009-3553 was incomplete (STR #3490)
|
||||
- Security: The web admin interface could disclose the contents of
|
||||
memory (STR #3577)
|
||||
- Security: CUPS could overwrite files as root in directories owned or
|
||||
writable by non-root users (STR #3510)
|
||||
- The cups-config utility did not return the correct linker options on
|
||||
AIX (STR #3587)
|
||||
- Fixed some IPP conformance issues with the scheduler's
|
||||
ippget-event-life, operations-supported, output-bin, and sides
|
||||
attributes (STR #3554)
|
||||
- The OpenSSL interfaces have been made thread-safe and the GNU TLS
|
||||
interface is explicitly forbidden when threading is enabled
|
||||
(STR #3461)
|
||||
- Fixed an IPP conformance issue with the scheduler's Send-Document
|
||||
implementation (STR #3514)
|
||||
- Added additional validation checks for the 1284 device ID (STR #3534)
|
||||
- Fixed a problem with the RPM spec file (STR #3544)
|
||||
- The lpstat command did not limit the job list to the specified
|
||||
printers (STR #3541)
|
||||
- The cupsfilter command did not set the RIP_MAX_CACHE environment
|
||||
variable (STR #3531)
|
||||
- Fixed support for media-col and page size variants (STR #3394)
|
||||
- The PostScript filter did not support all media selection options for
|
||||
the first page (STR #3525)
|
||||
- The scheduler did not always remove job control files (STR #3425)
|
||||
- The scheduler could crash on restart if classes were defined
|
||||
(STR #3524)
|
||||
- The scheduler no longer looks up network interface hostnames by
|
||||
default on Mac OS X (STR #3523)
|
||||
- ippWriteIO did not write collection (member) attributes properly in
|
||||
all cases (STR #3521)
|
||||
- The "cupsctl --remote-any" and corresponding web interface check box
|
||||
(allow printing from the Internet) did not work reliably (STR #3520)
|
||||
- The lpq and lpr commands would sometimes choose different default
|
||||
printers (STR #3503)
|
||||
- cupsDo*Request did not flush error text, leading to multiple issues
|
||||
(STR #3325, STR #3519)
|
||||
- cupsDoAuthentication did not cancel password authentication after 3
|
||||
failures (STR #3518)
|
||||
- Fixed several LDAP browsing bugs (STR #3392)
|
||||
- The Dymo driver did not support copies (STR #3457)
|
||||
- The scheduler did not update the classes.conf file when deleting a
|
||||
printer belonging to a class (STR #3505)
|
||||
- The lppasswd command did not use localized password prompts
|
||||
(STR #3492)
|
||||
- The socket backend no longer waits for back-channel data on platforms
|
||||
other than Mac OS X (STR #3495)
|
||||
- The scheduler didn't send events when a printer started accepting or
|
||||
rejecting jobs (STR #3480)
|
||||
- The web interface now includes additional CSRF protection (STR #3498)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.4.3
|
||||
|
||||
- SECURITY: The scheduler could try responding on a closed client
|
||||
|
||||
+4
-5
@@ -1,14 +1,13 @@
|
||||
INSTALL - CUPS v1.4.3 - 2009-12-15
|
||||
INSTALL - CUPS v1.4.8 - 2011-07-25
|
||||
----------------------------------
|
||||
|
||||
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
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Common makefile definitions for the Common UNIX Printing System (CUPS).
|
||||
# Common makefile definitions for CUPS.
|
||||
#
|
||||
# Copyright 2007-2009 by Apple Inc.
|
||||
# Copyright 2007-2010 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -263,7 +263,7 @@ DBUSDIR = @DBUSDIR@
|
||||
|
||||
.c.o:
|
||||
echo Compiling $<...
|
||||
$(CC) $(ARCHFLAGS) $(OPTIM) $(ALL_CFLAGS) -c $<
|
||||
$(CC) $(ARCHFLAGS) $(OPTIM) $(ALL_CFLAGS) -c -o $@ $<
|
||||
|
||||
.c.32.o:
|
||||
echo Compiling 32-bit $<...
|
||||
@@ -275,7 +275,7 @@ DBUSDIR = @DBUSDIR@
|
||||
|
||||
.cxx.o:
|
||||
echo Compiling $<...
|
||||
$(CXX) $(ARCHFLAGS) $(OPTIM) $(ALL_CXXFLAGS) -c $<
|
||||
$(CXX) $(ARCHFLAGS) $(OPTIM) $(ALL_CXXFLAGS) -c -o $@ $<
|
||||
|
||||
.man.1 .man.1m .man.3 .man.5 .man.7 .man.8:
|
||||
echo Linking $<...
|
||||
|
||||
+9
-9
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Top-level Makefile for the Common UNIX Printing System (CUPS).
|
||||
# Top-level Makefile for CUPS.
|
||||
#
|
||||
# Copyright 2007-2010 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
@@ -16,13 +16,6 @@
|
||||
include Makedefs
|
||||
|
||||
|
||||
#
|
||||
# Don't run top-level build targets in parallel...
|
||||
#
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
|
||||
#
|
||||
# Directories to make...
|
||||
#
|
||||
@@ -402,7 +395,7 @@ docset: apihelp
|
||||
|
||||
|
||||
#
|
||||
# Make software distributions using EPM (http://www.easysw.com/epm/)...
|
||||
# Make software distributions using EPM (http://www.epmhome.org/)...
|
||||
#
|
||||
|
||||
EPMFLAGS = -v --output-dir dist $(EPMARCH)
|
||||
@@ -432,6 +425,13 @@ dist: all
|
||||
esac
|
||||
|
||||
|
||||
#
|
||||
# Don't run top-level build targets in parallel...
|
||||
#
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
#
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
README - CUPS v1.4.3 - 2009-12-15
|
||||
README - CUPS v1.4.8 - 2011-07-25
|
||||
---------------------------------
|
||||
|
||||
Looking for compile instructions? Read the file "INSTALL.txt"
|
||||
@@ -150,7 +150,7 @@ PRINTING FILES
|
||||
|
||||
LEGAL STUFF
|
||||
|
||||
CUPS is Copyright 2007-2009 by Apple Inc. CUPS and the CUPS logo are
|
||||
CUPS is Copyright 2007-2011 by Apple Inc. CUPS and the CUPS logo are
|
||||
trademarks of Apple Inc.
|
||||
|
||||
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
|
||||
|
||||
+32
-9
@@ -185,18 +185,34 @@ backendGetDeviceID(
|
||||
|
||||
/*
|
||||
* The length field counts the number of bytes in the string
|
||||
* including the length field itself (2 bytes).
|
||||
* including the length field itself (2 bytes). The minimum
|
||||
* length for a valid/usable device ID is 14 bytes:
|
||||
*
|
||||
* <LENGTH> MFG: <MFG> ;MDL: <MDL> ;
|
||||
* 2 + 4 + 1 + 5 + 1 + 1
|
||||
*/
|
||||
|
||||
length -= 2;
|
||||
if (length < 14)
|
||||
{
|
||||
/*
|
||||
* Can't use this device ID, so don't try to copy it...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copy the device ID text to the beginning of the buffer and
|
||||
* nul-terminate.
|
||||
*/
|
||||
device_id[0] = '\0';
|
||||
got_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Copy the device ID text to the beginning of the buffer and
|
||||
* nul-terminate.
|
||||
*/
|
||||
|
||||
memmove(device_id, device_id + 2, length);
|
||||
device_id[length] = '\0';
|
||||
length -= 2;
|
||||
|
||||
memmove(device_id, device_id + 2, length);
|
||||
device_id[length] = '\0';
|
||||
}
|
||||
}
|
||||
# ifdef DEBUG
|
||||
else
|
||||
@@ -293,6 +309,9 @@ backendGetDeviceID(
|
||||
mfg = temp;
|
||||
}
|
||||
|
||||
if (!mdl)
|
||||
mdl = "";
|
||||
|
||||
if (!strncasecmp(mdl, mfg, strlen(mfg)))
|
||||
{
|
||||
mdl += strlen(mfg);
|
||||
@@ -384,7 +403,11 @@ backendGetMakeModel(
|
||||
|
||||
char temp[1024]; /* Temporary make and model */
|
||||
|
||||
snprintf(temp, sizeof(temp), "%s %s", mfg, mdl);
|
||||
if (mfg)
|
||||
snprintf(temp, sizeof(temp), "%s %s", mfg, mdl);
|
||||
else
|
||||
snprintf(temp, sizeof(temp), "%s", mdl);
|
||||
|
||||
_ppdNormalizeMakeAndModel(temp, make_model, make_model_size);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Common run loop APIs for the Common UNIX Printing System (CUPS).
|
||||
* Common run loop APIs for CUPS.
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 2006-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -299,6 +299,8 @@ backendRunLoop(
|
||||
strerror(errno));
|
||||
use_bc = 0;
|
||||
}
|
||||
else if (bc_bytes == 0)
|
||||
use_bc = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -502,7 +502,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* stdin (otherwise you can't cancel raw jobs...)
|
||||
*/
|
||||
|
||||
if (print_fd != 0)
|
||||
if (!print_fd)
|
||||
{
|
||||
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
|
||||
sigset(SIGTERM, SIG_IGN);
|
||||
|
||||
+115
-11
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* SNMP supplies functions for the Common UNIX Printing System (CUPS).
|
||||
* SNMP supplies functions for CUPS.
|
||||
*
|
||||
* Copyright 2008-2009 by Apple Inc.
|
||||
* Copyright 2008-2011 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -36,6 +36,17 @@
|
||||
#define CUPS_MAX_SUPPLIES 32 /* Maximum number of supplies for a printer */
|
||||
#define CUPS_SUPPLY_TIMEOUT 2.0 /* Timeout for SNMP lookups */
|
||||
|
||||
#define CUPS_DEVELOPER_LOW 1
|
||||
#define CUPS_DEVELOPER_EMPTY 2
|
||||
#define CUPS_MARKER_SUPPLY_LOW 4
|
||||
#define CUPS_MARKER_SUPPLY_EMPTY 8
|
||||
#define CUPS_MARKER_WASTE_ALMOST_FULL 16
|
||||
#define CUPS_MARKER_WASTE_FULL 32
|
||||
#define CUPS_OPC_NEAR_EOL 64
|
||||
#define CUPS_OPC_LIFE_OVER 128
|
||||
#define CUPS_TONER_LOW 256
|
||||
#define CUPS_TONER_EMPTY 512
|
||||
|
||||
|
||||
/*
|
||||
* Local structures...
|
||||
@@ -70,6 +81,8 @@ static int num_supplies = 0;
|
||||
/* Number of supplies found */
|
||||
static backend_supplies_t supplies[CUPS_MAX_SUPPLIES];
|
||||
/* Supply information */
|
||||
static int supply_state = -1;
|
||||
/* Supply state info */
|
||||
|
||||
static const int hrDeviceDescr[] =
|
||||
{ CUPS_OID_hrDeviceDescr, 1, -1 };
|
||||
@@ -140,8 +153,8 @@ static const backend_state_t const printer_states[] =
|
||||
{
|
||||
{ CUPS_TC_lowPaper, "media-low-report" },
|
||||
{ CUPS_TC_noPaper | CUPS_TC_inputTrayEmpty, "media-empty-warning" },
|
||||
{ CUPS_TC_lowToner, "toner-low-report" },
|
||||
{ CUPS_TC_noToner, "toner-empty-warning" },
|
||||
/* { CUPS_TC_lowToner, "toner-low-report" }, */ /* now use prtMarkerSupplies */
|
||||
/* { CUPS_TC_noToner, "toner-empty-warning" }, */ /* now use prtMarkerSupplies */
|
||||
{ CUPS_TC_doorOpen, "door-open-report" },
|
||||
{ CUPS_TC_jammed, "media-jam-warning" },
|
||||
/* { CUPS_TC_offline, "offline-report" }, */ /* unreliable */
|
||||
@@ -153,6 +166,20 @@ static const backend_state_t const printer_states[] =
|
||||
{ CUPS_TC_outputFull, "output-area-full-warning" }
|
||||
};
|
||||
|
||||
static const backend_state_t const supply_states[] =
|
||||
{
|
||||
{ CUPS_DEVELOPER_LOW, "developer-low-report" },
|
||||
{ CUPS_DEVELOPER_EMPTY, "developer-empty-warning" },
|
||||
{ CUPS_MARKER_SUPPLY_LOW, "marker-supply-low-report" },
|
||||
{ CUPS_MARKER_SUPPLY_EMPTY, "marker-supply-empty-warning" },
|
||||
{ CUPS_MARKER_WASTE_ALMOST_FULL, "marker-waste-almost-full-report" },
|
||||
{ CUPS_MARKER_WASTE_FULL, "marker-waste-full-warning" },
|
||||
{ CUPS_OPC_NEAR_EOL, "opc-near-eol-report" },
|
||||
{ CUPS_OPC_LIFE_OVER, "opc-life-over-warning" },
|
||||
{ CUPS_TONER_LOW, "toner-low-report" },
|
||||
{ CUPS_TONER_EMPTY, "toner-empty-warning" }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
@@ -191,13 +218,14 @@ backendSNMPSupplies(
|
||||
if (num_supplies > 0)
|
||||
{
|
||||
int i, /* Looping var */
|
||||
percent, /* Percent full */
|
||||
new_state, /* New state value */
|
||||
change_state; /* State change */
|
||||
change_state, /* State change */
|
||||
new_supply_state = 0; /* Supply state */
|
||||
char value[CUPS_MAX_SUPPLIES * 4],
|
||||
/* marker-levels value string */
|
||||
*ptr; /* Pointer into value string */
|
||||
cups_snmp_t packet; /* SNMP response packet */
|
||||
|
||||
|
||||
/*
|
||||
* Generate the marker-levels value string...
|
||||
@@ -205,17 +233,88 @@ backendSNMPSupplies(
|
||||
|
||||
for (i = 0, ptr = value; i < num_supplies; i ++, ptr += strlen(ptr))
|
||||
{
|
||||
if (supplies[i].max_capacity > 0)
|
||||
percent = 100 * supplies[i].level / supplies[i].max_capacity;
|
||||
else
|
||||
percent = 50;
|
||||
|
||||
if (percent <= 10)
|
||||
{
|
||||
switch (supplies[i].type)
|
||||
{
|
||||
case CUPS_TC_toner :
|
||||
case CUPS_TC_tonerCartridge :
|
||||
if (percent <= 1)
|
||||
new_supply_state |= CUPS_TONER_EMPTY;
|
||||
else
|
||||
new_supply_state |= CUPS_TONER_LOW;
|
||||
break;
|
||||
case CUPS_TC_wasteToner :
|
||||
case CUPS_TC_wasteInk :
|
||||
if (percent <= 1)
|
||||
new_supply_state |= CUPS_MARKER_WASTE_FULL;
|
||||
else
|
||||
new_supply_state |= CUPS_MARKER_WASTE_ALMOST_FULL;
|
||||
break;
|
||||
case CUPS_TC_ink :
|
||||
case CUPS_TC_inkCartridge :
|
||||
case CUPS_TC_inkRibbon :
|
||||
case CUPS_TC_solidWax :
|
||||
case CUPS_TC_ribbonWax :
|
||||
if (percent <= 1)
|
||||
new_supply_state |= CUPS_MARKER_SUPPLY_EMPTY;
|
||||
else
|
||||
new_supply_state |= CUPS_MARKER_SUPPLY_LOW;
|
||||
break;
|
||||
case CUPS_TC_developer :
|
||||
if (percent <= 1)
|
||||
new_supply_state |= CUPS_DEVELOPER_EMPTY;
|
||||
else
|
||||
new_supply_state |= CUPS_DEVELOPER_LOW;
|
||||
break;
|
||||
case CUPS_TC_coronaWire :
|
||||
case CUPS_TC_fuser :
|
||||
case CUPS_TC_opc :
|
||||
case CUPS_TC_transferUnit :
|
||||
if (percent <= 1)
|
||||
new_supply_state |= CUPS_OPC_LIFE_OVER;
|
||||
else
|
||||
new_supply_state |= CUPS_OPC_NEAR_EOL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i)
|
||||
*ptr++ = ',';
|
||||
|
||||
if (supplies[i].max_capacity > 0)
|
||||
sprintf(ptr, "%d", 100 * supplies[i].level / supplies[i].max_capacity);
|
||||
sprintf(ptr, "%d", percent);
|
||||
else
|
||||
strcpy(ptr, "-1");
|
||||
}
|
||||
|
||||
fprintf(stderr, "ATTR: marker-levels=%s\n", value);
|
||||
|
||||
if (supply_state < 0)
|
||||
change_state = 0xffff;
|
||||
else
|
||||
change_state = supply_state ^ new_supply_state;
|
||||
|
||||
fprintf(stderr, "DEBUG: new_supply_state=%x, change_state=%x\n",
|
||||
new_supply_state, change_state);
|
||||
|
||||
for (i = 0;
|
||||
i < (int)(sizeof(supply_states) / sizeof(supply_states[0]));
|
||||
i ++)
|
||||
if (change_state & supply_states[i].bit)
|
||||
{
|
||||
fprintf(stderr, "STATE: %c%s\n",
|
||||
(new_supply_state & supply_states[i].bit) ? '+' : '-',
|
||||
supply_states[i].keyword);
|
||||
}
|
||||
|
||||
supply_state = new_supply_state;
|
||||
|
||||
/*
|
||||
* Get the current printer status bits...
|
||||
*/
|
||||
@@ -242,13 +341,18 @@ backendSNMPSupplies(
|
||||
else
|
||||
change_state = current_state ^ new_state;
|
||||
|
||||
fprintf(stderr, "DEBUG: new_state=%x, change_state=%x\n", new_state,
|
||||
change_state);
|
||||
|
||||
for (i = 0;
|
||||
i < (int)(sizeof(printer_states) / sizeof(printer_states[0]));
|
||||
i ++)
|
||||
if (change_state & printer_states[i].bit)
|
||||
{
|
||||
fprintf(stderr, "STATE: %c%s\n",
|
||||
(new_state & printer_states[i].bit) ? '+' : '-',
|
||||
(new_state & printer_states[i].bit) ? '+' : '-',
|
||||
printer_states[i].keyword);
|
||||
}
|
||||
|
||||
current_state = new_state;
|
||||
|
||||
@@ -373,9 +477,9 @@ backend_init_supplies(
|
||||
* See if we should be getting supply levels via SNMP...
|
||||
*/
|
||||
|
||||
if ((ppd = ppdOpenFile(getenv("PPD"))) != NULL &&
|
||||
(ppdattr = ppdFindAttr(ppd, "cupsSNMPSupplies", NULL)) != NULL &&
|
||||
ppdattr->value && strcasecmp(ppdattr->value, "true"))
|
||||
if ((ppd = ppdOpenFile(getenv("PPD"))) == NULL ||
|
||||
((ppdattr = ppdFindAttr(ppd, "cupsSNMPSupplies", NULL)) != NULL &&
|
||||
ppdattr->value && strcasecmp(ppdattr->value, "true")))
|
||||
{
|
||||
ppdClose(ppd);
|
||||
return;
|
||||
|
||||
+7
-3
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* AppSocket backend for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -72,9 +72,11 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
sep; /* Option separator */
|
||||
int print_fd; /* Print file */
|
||||
int copies; /* Number of copies to print */
|
||||
time_t start_time, /* Time of first connect */
|
||||
current_time, /* Current time */
|
||||
time_t start_time; /* Time of first connect */
|
||||
#ifdef __APPLE__
|
||||
time_t current_time, /* Current time */
|
||||
wait_time; /* Time to wait before shutting down socket */
|
||||
#endif /* __APPLE__ */
|
||||
int recoverable; /* Recoverable error shown? */
|
||||
int contimeout; /* Connection timeout */
|
||||
int waiteof; /* Wait for end-of-file? */
|
||||
@@ -406,6 +408,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
CUPS_LLCAST tbytes);
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*
|
||||
* Wait up to 5 seconds to get any pending back-channel data...
|
||||
*/
|
||||
@@ -414,6 +417,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
while (wait_time >= time(¤t_time))
|
||||
if (wait_bc(device_fd, wait_time - current_time) <= 0)
|
||||
break;
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
if (waiteof)
|
||||
{
|
||||
|
||||
+32
-7
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Copyright 2005-2009 Apple Inc. All rights reserved.
|
||||
* Copyright 2005-2010 Apple Inc. All rights reserved.
|
||||
*
|
||||
* IMPORTANT: This Apple software is supplied to you by Apple Computer,
|
||||
* Inc. ("Apple") in consideration of your agreement to the following
|
||||
@@ -292,8 +292,8 @@ static void status_timer_cb(CFRunLoopTimerRef timer, void *info);
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
static pid_t child_pid; /* Child PID */
|
||||
static void run_legacy_backend(int argc, char *argv[], int fd); /* Starts child backend process running as a ppc executable */
|
||||
static void sigterm_handler(int sig); /* SIGTERM handler */
|
||||
#endif /* __i386__ || __x86_64__ */
|
||||
static void sigterm_handler(int sig); /* SIGTERM handler */
|
||||
|
||||
#ifdef PARSE_PS_ERRORS
|
||||
static const char *next_line (const char *buffer);
|
||||
@@ -750,6 +750,22 @@ 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...
|
||||
*/
|
||||
@@ -780,6 +796,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
* Force the side-channel thread to exit...
|
||||
*/
|
||||
|
||||
fputs("DEBUG: Force the side-channel thread to exit...\n", stderr);
|
||||
pthread_kill(sidechannel_thread_id, SIGTERM);
|
||||
}
|
||||
}
|
||||
@@ -820,6 +837,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
*/
|
||||
|
||||
g.wait_eof = 0;
|
||||
fputs("DEBUG: Force the read thread to exit...\n", stderr);
|
||||
pthread_kill(read_thread_id, SIGTERM);
|
||||
}
|
||||
}
|
||||
@@ -1379,7 +1397,10 @@ static kern_return_t load_classdriver(CFStringRef driverPath,
|
||||
{
|
||||
fprintf(stderr, "DEBUG: Unable to load class driver \"%s\": %s\n",
|
||||
bundlestr, strerror(errno));
|
||||
return (kr);
|
||||
if (errno == ENOENT)
|
||||
return (load_classdriver(NULL, intf, printerDriver));
|
||||
else
|
||||
return (kr);
|
||||
}
|
||||
else if (bundleinfo.st_mode & S_IWOTH)
|
||||
{
|
||||
@@ -2031,6 +2052,8 @@ static void run_legacy_backend(int argc,
|
||||
|
||||
exit(exitstatus);
|
||||
}
|
||||
#endif /* __i386__ || __x86_64__ */
|
||||
|
||||
|
||||
/*
|
||||
* 'sigterm_handler()' - SIGTERM handler.
|
||||
@@ -2039,8 +2062,11 @@ static void run_legacy_backend(int argc,
|
||||
static void
|
||||
sigterm_handler(int sig) /* I - Signal */
|
||||
{
|
||||
/* If we started a child process pass the signal on to it...
|
||||
*/
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
/*
|
||||
* If we started a child process pass the signal on to it...
|
||||
*/
|
||||
|
||||
if (child_pid)
|
||||
{
|
||||
/*
|
||||
@@ -2062,9 +2088,8 @@ sigterm_handler(int sig) /* I - Signal */
|
||||
exit(CUPS_BACKEND_STOP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* __i386__ || __x86_64__ */
|
||||
}
|
||||
|
||||
|
||||
#ifdef PARSE_PS_ERRORS
|
||||
|
||||
+10
-7
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Libusb interface code for the Common UNIX Printing System (CUPS).
|
||||
* Libusb interface code for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -100,7 +100,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
usb_printer_t *printer; /* Printer */
|
||||
ssize_t bytes, /* Bytes read/written */
|
||||
tbytes; /* Total bytes written */
|
||||
char buffer[8192]; /* Print data buffer */
|
||||
char buffer[512]; /* Print data buffer */
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
struct pollfd pfds[2]; /* Poll descriptors */
|
||||
|
||||
@@ -172,7 +172,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
if ((bytes = read(print_fd, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
if (usb_bulk_write(printer->handle, printer->write_endp, buffer,
|
||||
bytes, 45000) < 0)
|
||||
bytes, 3600000) < 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to write %d bytes to printer!\n"),
|
||||
@@ -411,7 +411,7 @@ get_device_id(usb_printer_t *printer, /* I - Printer */
|
||||
|
||||
if (usb_control_msg(printer->handle,
|
||||
USB_TYPE_CLASS | USB_ENDPOINT_IN | USB_RECIP_INTERFACE,
|
||||
0, printer->conf, printer->iface,
|
||||
0, printer->conf, (printer->iface << 8) | printer->altset,
|
||||
buffer, bufsize, 5000) < 0)
|
||||
{
|
||||
*buffer = '\0';
|
||||
@@ -518,7 +518,8 @@ make_device_uri(
|
||||
|
||||
if ((sern = cupsGetOption("SERIALNUMBER", num_values, values)) == NULL)
|
||||
if ((sern = cupsGetOption("SERN", num_values, values)) == NULL)
|
||||
if ((sern = cupsGetOption("SN", num_values, values)) == NULL)
|
||||
if ((sern = cupsGetOption("SN", num_values, values)) == NULL &&
|
||||
printer->device->descriptor.iSerialNumber)
|
||||
{
|
||||
/*
|
||||
* Try getting the serial number from the device itself...
|
||||
@@ -674,6 +675,7 @@ open_device(usb_printer_t *printer, /* I - Printer */
|
||||
goto error;
|
||||
}
|
||||
|
||||
#if 0 /* STR #3801: Claiming interface 0 causes problems with some printers */
|
||||
if (number != 0)
|
||||
while (usb_claim_interface(printer->handle, 0) < 0)
|
||||
{
|
||||
@@ -684,6 +686,7 @@ open_device(usb_printer_t *printer, /* I - Printer */
|
||||
|
||||
goto error;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
/*
|
||||
* Set alternate setting...
|
||||
@@ -747,7 +750,7 @@ side_cb(usb_printer_t *printer, /* I - Printer */
|
||||
{
|
||||
ssize_t bytes, /* Bytes read/written */
|
||||
tbytes; /* Total bytes written */
|
||||
char buffer[8192]; /* Print data buffer */
|
||||
char buffer[512]; /* Print data buffer */
|
||||
struct pollfd pfd; /* Poll descriptor */
|
||||
cups_sc_command_t command; /* Request command */
|
||||
cups_sc_status_t status; /* Request/response status */
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# CGI makefile for the Common UNIX Printing System (CUPS).
|
||||
# CGI makefile for CUPS.
|
||||
#
|
||||
# Copyright 2007-2009 by Apple Inc.
|
||||
# Copyright 2007-2010 by Apple Inc.
|
||||
# Copyright 1997-2006 by Easy Software Products.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -118,7 +118,7 @@ install-exec:
|
||||
done
|
||||
if test "x$(SYMROOT)" != "x"; then \
|
||||
$(INSTALL_DIR) $(SYMROOT); \
|
||||
for file in $(TARGETS); do \
|
||||
for file in $(CGIS); do \
|
||||
cp $$file $(SYMROOT); \
|
||||
done \
|
||||
fi
|
||||
|
||||
+37
-14
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Administration CGI for the Common UNIX Printing System (CUPS).
|
||||
* Administration CGI for CUPS.
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -145,7 +145,30 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
fprintf(stderr, "DEBUG: op=\"%s\"...\n", op);
|
||||
|
||||
if (!strcmp(op, "set-allowed-users"))
|
||||
if (!*op)
|
||||
{
|
||||
const char *printer = getenv("PRINTER_NAME"),
|
||||
/* Printer or class name */
|
||||
*server_port = getenv("SERVER_PORT");
|
||||
/* Port number string */
|
||||
int port = atoi(server_port ? server_port : "0");
|
||||
/* Port number */
|
||||
char uri[1024]; /* URL */
|
||||
|
||||
if (printer)
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri),
|
||||
getenv("HTTPS") ? "https" : "http", NULL,
|
||||
getenv("SERVER_NAME"), port, "/%s/%s",
|
||||
cgiGetVariable("IS_CLASS") ? "classes" : "printers",
|
||||
printer);
|
||||
else
|
||||
httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri),
|
||||
getenv("HTTPS") ? "https" : "http", NULL,
|
||||
getenv("SERVER_NAME"), port, "/admin");
|
||||
|
||||
printf("Location: %s\n\n", uri);
|
||||
}
|
||||
else if (!strcmp(op, "set-allowed-users"))
|
||||
do_set_allowed_users(http);
|
||||
else if (!strcmp(op, "set-as-default"))
|
||||
do_set_default(http);
|
||||
@@ -771,7 +794,7 @@ do_am_class(http_t *http, /* I - HTTP connection */
|
||||
attr = ippAddStrings(request, IPP_TAG_PRINTER, IPP_TAG_URI, "member-uris",
|
||||
num_printers, NULL, NULL);
|
||||
for (i = 0; i < num_printers; i ++)
|
||||
attr->values[i].string.text = strdup(cgiGetArray("MEMBER_URIS", i));
|
||||
attr->values[i].string.text = _cupsStrAlloc(cgiGetArray("MEMBER_URIS", i));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -951,8 +974,6 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
if (!cgiGetVariable("CURRENT_MAKE"))
|
||||
cgiSetVariable("CURRENT_MAKE", make);
|
||||
|
||||
cgiSetVariable("PPD_MAKE", make);
|
||||
|
||||
if (!cgiGetVariable("CURRENT_MAKE_AND_MODEL"))
|
||||
cgiSetVariable("CURRENT_MAKE_AND_MODEL", uriptr);
|
||||
|
||||
@@ -1005,7 +1026,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
fputs("DEBUG: Getting list of devices...\n", stderr);
|
||||
|
||||
current_device = 0;
|
||||
if (cupsGetDevices(http, 30, CUPS_INCLUDE_ALL, CUPS_EXCLUDE_NONE,
|
||||
if (cupsGetDevices(http, 5, CUPS_INCLUDE_ALL, CUPS_EXCLUDE_NONE,
|
||||
(cups_device_cb_t)choose_device_cb,
|
||||
(void *)title) == IPP_OK)
|
||||
{
|
||||
@@ -1042,7 +1063,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strchr(var, '/') == NULL)
|
||||
else if (!strchr(var, '/') ||
|
||||
(!strncmp(var, "lpd://", 6) && !strchr(var + 6, '/')))
|
||||
{
|
||||
if ((attr = ippFindAttribute(oldinfo, "device-uri", IPP_TAG_URI)) != NULL)
|
||||
{
|
||||
@@ -1218,8 +1240,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, "ipp://localhost/printers/");
|
||||
|
||||
if ((var = cgiGetVariable("CURRENT_MAKE")) == NULL)
|
||||
var = cgiGetVariable("PPD_MAKE");
|
||||
if ((var = cgiGetVariable("PPD_MAKE")) == NULL)
|
||||
var = cgiGetVariable("CURRENT_MAKE");
|
||||
if (var && !cgiGetVariable("SELECT_MAKE"))
|
||||
{
|
||||
const char *make_model; /* Make and model */
|
||||
@@ -2481,7 +2503,7 @@ do_list_printers(http_t *http) /* I - HTTP connection */
|
||||
attr;
|
||||
attr = ippFindNextAttribute(response, "device-uri", IPP_TAG_URI))
|
||||
{
|
||||
cupsArrayAdd(printer_devices, strdup(attr->values[0].string.text));
|
||||
cupsArrayAdd(printer_devices, _cupsStrAlloc(attr->values[0].string.text));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2585,7 +2607,8 @@ do_list_printers(http_t *http) /* I - HTTP connection */
|
||||
if (isalnum(*ptr & 255) || *ptr == '_' || *ptr == '-' ||
|
||||
*ptr == '.')
|
||||
*option_ptr++ = *ptr;
|
||||
else if ((*ptr == ' ' || *ptr == '/') && option_ptr[-1] != '_')
|
||||
else if ((*ptr == ' ' || *ptr == '/') && option_ptr > option &&
|
||||
option_ptr[-1] != '_')
|
||||
*option_ptr++ = '_';
|
||||
else if (*ptr == '?' || *ptr == '(')
|
||||
break;
|
||||
@@ -2618,7 +2641,7 @@ do_list_printers(http_t *http) /* I - HTTP connection */
|
||||
for (printer_device = (char *)cupsArrayFirst(printer_devices);
|
||||
printer_device;
|
||||
printer_device = (char *)cupsArrayNext(printer_devices))
|
||||
free(printer_device);
|
||||
_cupsStrFree(printer_device);
|
||||
|
||||
cupsArrayDelete(printer_devices);
|
||||
}
|
||||
@@ -3059,7 +3082,7 @@ do_set_allowed_users(http_t *http) /* I - HTTP connection */
|
||||
* Add the name...
|
||||
*/
|
||||
|
||||
attr->values[i].string.text = strdup(ptr);
|
||||
attr->values[i].string.text = _cupsStrAlloc(ptr);
|
||||
|
||||
/*
|
||||
* Advance to the next name...
|
||||
|
||||
+5
-4
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* CGI support library definitions.
|
||||
* CGI support library definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -69,11 +69,12 @@ extern void cgiCopyTemplateLang(const char *tmpl);
|
||||
extern int cgiDoSearch(void *search, const char *text);
|
||||
extern void cgiEndHTML(void);
|
||||
extern void cgiEndMultipart(void);
|
||||
extern char *cgiFormEncode(char *dst, const char *src, size_t dstsize);
|
||||
extern char *cgiFormEncode(char *dst, const char *src,
|
||||
size_t dstsize);
|
||||
extern void cgiFreeSearch(void *search);
|
||||
extern const char *cgiGetArray(const char *name, int element);
|
||||
extern void cgiGetAttributes(ipp_t *request, const char *tmpl);
|
||||
extern char *cgiGetCookie(const char *name, char *buf, int buflen);
|
||||
extern const char *cgiGetCookie(const char *name);
|
||||
extern const cgi_file_t *cgiGetFile(void);
|
||||
extern cups_array_t *cgiGetIPPObjects(ipp_t *response, void *search);
|
||||
extern int cgiGetSize(const char *name);
|
||||
|
||||
+17
-3
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Class status CGI for the Common UNIX Printing System (CUPS).
|
||||
* Class status CGI for CUPS.
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -147,7 +147,21 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
else if (pclass)
|
||||
{
|
||||
if (!strcmp(op, "start-class"))
|
||||
if (!*op)
|
||||
{
|
||||
const char *server_port = getenv("SERVER_PORT");
|
||||
/* Port number string */
|
||||
int port = atoi(server_port ? server_port : "0");
|
||||
/* Port number */
|
||||
char uri[1024]; /* URL */
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri),
|
||||
getenv("HTTPS") ? "https" : "http", NULL,
|
||||
getenv("SERVER_NAME"), port, "/classes/%s", pclass);
|
||||
|
||||
printf("Location: %s\n\n", uri);
|
||||
}
|
||||
else if (!strcmp(op, "start-class"))
|
||||
do_class_op(http, pclass, IPP_RESUME_PRINTER, cgiText(_("Resume Class")));
|
||||
else if (!strcmp(op, "stop-class"))
|
||||
do_class_op(http, pclass, IPP_PAUSE_PRINTER, cgiText(_("Pause Class")));
|
||||
|
||||
+8
-26
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* HTML support functions for the Common UNIX Printing System (CUPS).
|
||||
* HTML support functions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -208,31 +208,13 @@ cgiStartMultipart(void)
|
||||
int /* O - 1 if multi-part supported, 0 otherwise */
|
||||
cgiSupportsMultipart(void)
|
||||
{
|
||||
const char *user_agent; /* User-Agent string */
|
||||
static int supports_multipart = -1;/* Cached value */
|
||||
/*
|
||||
* Too many bug reports for browsers that don't support it, and too much pain
|
||||
* to whitelist known-good browsers, so for now we just punt on multi-part
|
||||
* support... :(
|
||||
*/
|
||||
|
||||
|
||||
if (supports_multipart < 0)
|
||||
{
|
||||
/*
|
||||
* CUPS STR #3049: Apparently some browsers don't support multi-part
|
||||
* documents, which makes them useless for many web sites. Rather than
|
||||
* abandoning those users, we'll offer a degraded single-part mode...
|
||||
*
|
||||
* Currently we know that anything based on Gecko, MSIE, and Safari all
|
||||
* work. We'll add more as they are reported/tested.
|
||||
*/
|
||||
|
||||
if ((user_agent = getenv("HTTP_USER_AGENT")) != NULL &&
|
||||
(strstr(user_agent, " Gecko/") != NULL ||
|
||||
strstr(user_agent, " MSIE ") != NULL ||
|
||||
strstr(user_agent, " Safari/") != NULL))
|
||||
supports_multipart = 1;
|
||||
else
|
||||
supports_multipart = 0;
|
||||
}
|
||||
|
||||
return (supports_multipart);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+6
-2
@@ -285,10 +285,14 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */
|
||||
|
||||
|
||||
/*
|
||||
* See who is logged in...
|
||||
* Make sure we have a username...
|
||||
*/
|
||||
|
||||
user = getenv("REMOTE_USER");
|
||||
if ((user = getenv("REMOTE_USER")) == NULL)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if the user has already selected a new destination...
|
||||
|
||||
@@ -10,6 +10,7 @@ _cgiFormEncode
|
||||
_cgiFreeSearch
|
||||
_cgiGetArray
|
||||
_cgiGetAttributes
|
||||
_cgiGetCookie
|
||||
_cgiGetFile
|
||||
_cgiGetIPPObjects
|
||||
_cgiGetSize
|
||||
@@ -24,6 +25,7 @@ _cgiRewriteURL
|
||||
_cgiSetArray
|
||||
_cgiSetIPPObjectVars
|
||||
_cgiSetIPPVars
|
||||
_cgiSetCookie
|
||||
_cgiSetServerVersion
|
||||
_cgiSetSize
|
||||
_cgiSetVariable
|
||||
|
||||
+17
-3
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Printer status CGI for the Common UNIX Printing System (CUPS).
|
||||
* Printer status CGI for CUPS.
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -148,7 +148,21 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
else if (printer)
|
||||
{
|
||||
if (!strcmp(op, "start-printer"))
|
||||
if (!*op)
|
||||
{
|
||||
const char *server_port = getenv("SERVER_PORT");
|
||||
/* Port number string */
|
||||
int port = atoi(server_port ? server_port : "0");
|
||||
/* Port number */
|
||||
char uri[1024]; /* URL */
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri),
|
||||
getenv("HTTPS") ? "https" : "http", NULL,
|
||||
getenv("SERVER_NAME"), port, "/printers/%s", printer);
|
||||
|
||||
printf("Location: %s\n\n", uri);
|
||||
}
|
||||
else if (!strcmp(op, "start-printer"))
|
||||
do_printer_op(http, printer, IPP_RESUME_PRINTER,
|
||||
cgiText(_("Resume Printer")));
|
||||
else if (!strcmp(op, "stop-printer"))
|
||||
|
||||
@@ -369,6 +369,20 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
|
||||
continue;
|
||||
}
|
||||
else if (name[0] == '$')
|
||||
{
|
||||
/*
|
||||
* Insert cookie value or nothing if not defined.
|
||||
*/
|
||||
|
||||
if ((value = cgiGetCookie(name + 1)) != NULL)
|
||||
outptr = value;
|
||||
else
|
||||
{
|
||||
outval[0] = '\0';
|
||||
outptr = outval;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
|
||||
+252
-24
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* CGI form variable and array functions.
|
||||
* CGI form variable and array functions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -14,25 +14,34 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cgiCheckVariables() - Check for the presence of "required" variables.
|
||||
* cgiCheckVariables() - Check for the presence of "required"
|
||||
* variables.
|
||||
* cgiClearVariables() - Clear all form variables.
|
||||
* cgiGetArray() - Get an element from a form array...
|
||||
* cgiGetFile() - Get the file (if any) that was submitted in the form.
|
||||
* cgiGetArray() - Get an element from a form array.
|
||||
* cgiGetCookie() - Get a cookie value.
|
||||
* cgiGetFile() - Get the file (if any) that was submitted in
|
||||
* the form.
|
||||
* cgiGetSize() - Get the size of a form array value.
|
||||
* cgiGetVariable() - Get a CGI variable from the database...
|
||||
* cgiInitialize() - Initialize the CGI variable "database"...
|
||||
* cgiGetVariable() - Get a CGI variable from the database.
|
||||
* cgiInitialize() - Initialize the CGI variable "database".
|
||||
* cgiIsPOST() - Determine whether this page was POSTed.
|
||||
* cgiSetArray() - Set array element N to the specified string.
|
||||
* cgiSetCookie() - Set a cookie value.
|
||||
* cgiSetSize() - Set the array size.
|
||||
* cgiSetVariable() - Set a CGI variable in the database...
|
||||
* cgiSetVariable() - Set a CGI variable in the database.
|
||||
* cgi_add_variable() - Add a form variable.
|
||||
* cgi_compare_variables() - Compare two variables.
|
||||
* cgi_find_variable() - Find a variable...
|
||||
* cgi_initialize_get() - Initialize form variables using the GET method.
|
||||
* cgi_initialize_multipart() - Initialize variables and file using the POST method.
|
||||
* cgi_find_variable() - Find a variable.
|
||||
* cgi_initialize_cookies() - Initialize cookies.
|
||||
* cgi_initialize_get() - Initialize form variables using the GET
|
||||
* method.
|
||||
* cgi_initialize_multipart() - Initialize variables and file using the POST
|
||||
* method.
|
||||
* cgi_initialize_post() - Initialize variables using the POST method.
|
||||
* cgi_initialize_string() - Initialize form variables from a string.
|
||||
* cgi_passwd() - Catch authentication requests and notify the server.
|
||||
* cgi_passwd() - Catch authentication requests and notify the
|
||||
* server.
|
||||
* cgi_set_sid() - Set the CUPS session ID.
|
||||
* cgi_sort_variables() - Sort all form variables for faster lookup.
|
||||
* cgi_unlink_file() - Remove the uploaded form.
|
||||
*/
|
||||
@@ -40,6 +49,15 @@
|
||||
/*#define DEBUG*/
|
||||
#include "cgi-private.h"
|
||||
#include <errno.h>
|
||||
#include <cups/http.h>
|
||||
#include <cups/md5.h>
|
||||
|
||||
|
||||
/*
|
||||
* Session ID name
|
||||
*/
|
||||
|
||||
#define CUPS_SID "org.cups.sid"
|
||||
|
||||
|
||||
/*
|
||||
@@ -59,6 +77,8 @@ typedef struct /**** Form variable structure ****/
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
static int num_cookies = 0;/* Number of cookies */
|
||||
static cups_option_t *cookies = NULL;/* Cookies */
|
||||
static int form_count = 0, /* Form variable count */
|
||||
form_alloc = 0; /* Number of variables allocated */
|
||||
static _cgi_var_t *form_vars = NULL;
|
||||
@@ -76,11 +96,13 @@ static void cgi_add_variable(const char *name, int element,
|
||||
static int cgi_compare_variables(const _cgi_var_t *v1,
|
||||
const _cgi_var_t *v2);
|
||||
static _cgi_var_t *cgi_find_variable(const char *name);
|
||||
static void cgi_initialize_cookies(void);
|
||||
static int cgi_initialize_get(void);
|
||||
static int cgi_initialize_multipart(const char *boundary);
|
||||
static int cgi_initialize_post(void);
|
||||
static int cgi_initialize_string(const char *data);
|
||||
static const char *cgi_passwd(const char *prompt);
|
||||
static const char *cgi_set_sid(void);
|
||||
static void cgi_sort_variables(void);
|
||||
static void cgi_unlink_file(void);
|
||||
|
||||
@@ -161,7 +183,7 @@ cgiClearVariables(void)
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiGetArray()' - Get an element from a form array...
|
||||
* 'cgiGetArray()' - Get an element from a form array.
|
||||
*/
|
||||
|
||||
const char * /* O - Element value or NULL */
|
||||
@@ -181,6 +203,17 @@ cgiGetArray(const char *name, /* I - Name of array variable */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiGetCookie()' - Get a cookie value.
|
||||
*/
|
||||
|
||||
const char * /* O - Value or NULL */
|
||||
cgiGetCookie(const char *name) /* I - Name of cookie */
|
||||
{
|
||||
return (cupsGetOption(name, num_cookies, cookies));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiGetFile()' - Get the file (if any) that was submitted in the form.
|
||||
*/
|
||||
@@ -210,10 +243,10 @@ cgiGetSize(const char *name) /* I - Name of variable */
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiGetVariable()' - Get a CGI variable from the database...
|
||||
* 'cgiGetVariable()' - Get a CGI variable from the database.
|
||||
*
|
||||
* Returns NULL if the variable doesn't exist. If the variable is an
|
||||
* array of values, returns the last element...
|
||||
* array of values, returns the last element.
|
||||
*/
|
||||
|
||||
const char * /* O - Value of variable */
|
||||
@@ -237,14 +270,16 @@ cgiGetVariable(const char *name) /* I - Name of variable */
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiInitialize()' - Initialize the CGI variable "database"...
|
||||
* 'cgiInitialize()' - Initialize the CGI variable "database".
|
||||
*/
|
||||
|
||||
int /* O - Non-zero if there was form data */
|
||||
cgiInitialize(void)
|
||||
{
|
||||
const char *method; /* Form posting method */
|
||||
const char *content_type; /* Content-Type of post data */
|
||||
const char *method, /* Form posting method */
|
||||
*content_type, /* Content-Type of post data */
|
||||
*cups_sid_cookie, /* SID cookie */
|
||||
*cups_sid_form; /* SID form variable */
|
||||
|
||||
|
||||
/*
|
||||
@@ -267,6 +302,20 @@ cgiInitialize(void)
|
||||
setbuf(stdout, NULL);
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* Get cookies...
|
||||
*/
|
||||
|
||||
cgi_initialize_cookies();
|
||||
|
||||
if ((cups_sid_cookie = cgiGetCookie(CUPS_SID)) == NULL)
|
||||
{
|
||||
fputs("DEBUG: " CUPS_SID " cookie not found, initializing!\n", stderr);
|
||||
cups_sid_cookie = cgi_set_sid();
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: " CUPS_SID " cookie is \"%s\"\n", cups_sid_cookie);
|
||||
|
||||
/*
|
||||
* Get the request method (GET or POST)...
|
||||
*/
|
||||
@@ -290,9 +339,27 @@ cgiInitialize(void)
|
||||
boundary += 9;
|
||||
|
||||
if (content_type && !strncmp(content_type, "multipart/form-data; ", 21))
|
||||
return (cgi_initialize_multipart(boundary));
|
||||
{
|
||||
if (!cgi_initialize_multipart(boundary))
|
||||
return (0);
|
||||
}
|
||||
else if (!cgi_initialize_post())
|
||||
return (0);
|
||||
|
||||
if ((cups_sid_form = cgiGetVariable(CUPS_SID)) == NULL ||
|
||||
strcmp(cups_sid_cookie, cups_sid_form))
|
||||
{
|
||||
if (cups_sid_form)
|
||||
fprintf(stderr, "DEBUG: " CUPS_SID " form variable is \"%s\"\n",
|
||||
cups_sid_form);
|
||||
else
|
||||
fputs("DEBUG: " CUPS_SID " form variable is not present.\n", stderr);
|
||||
|
||||
cgiClearVariables();
|
||||
return (0);
|
||||
}
|
||||
else
|
||||
return (cgi_initialize_post());
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
return (0);
|
||||
@@ -370,6 +437,38 @@ cgiSetArray(const char *name, /* I - Name of variable */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiSetCookie()' - Set a cookie value.
|
||||
*/
|
||||
|
||||
void
|
||||
cgiSetCookie(const char *name, /* I - Name */
|
||||
const char *value, /* I - Value */
|
||||
const char *path, /* I - Path (typically "/") */
|
||||
const char *domain, /* I - Domain name */
|
||||
time_t expires, /* I - Expiration date (0 for session) */
|
||||
int secure) /* I - Require SSL */
|
||||
{
|
||||
num_cookies = cupsAddOption(name, value, num_cookies, &cookies);
|
||||
|
||||
printf("Set-Cookie: %s=%s;", name, value);
|
||||
if (path)
|
||||
printf("; path=%s", path);
|
||||
if (domain)
|
||||
printf("; domain=%s", domain);
|
||||
if (expires)
|
||||
{
|
||||
char date[256]; /* Date string */
|
||||
|
||||
printf("; expires=%s", httpGetDateString2(expires, date, sizeof(date)));
|
||||
}
|
||||
if (secure)
|
||||
puts("; secure;");
|
||||
else
|
||||
puts(";");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiSetSize()' - Set the array size.
|
||||
*/
|
||||
@@ -418,7 +517,7 @@ cgiSetSize(const char *name, /* I - Name of variable */
|
||||
|
||||
|
||||
/*
|
||||
* 'cgiSetVariable()' - Set a CGI variable in the database...
|
||||
* 'cgiSetVariable()' - Set a CGI variable in the database.
|
||||
*
|
||||
* If the variable is an array, this truncates the array to a single element.
|
||||
*/
|
||||
@@ -514,7 +613,7 @@ cgi_compare_variables(
|
||||
|
||||
|
||||
/*
|
||||
* 'cgi_find_variable()' - Find a variable...
|
||||
* 'cgi_find_variable()' - Find a variable.
|
||||
*/
|
||||
|
||||
static _cgi_var_t * /* O - Variable pointer or NULL */
|
||||
@@ -533,6 +632,91 @@ cgi_find_variable(const char *name) /* I - Name of variable */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgi_initialize_cookies()' - Initialize cookies.
|
||||
*/
|
||||
|
||||
static void
|
||||
cgi_initialize_cookies(void)
|
||||
{
|
||||
const char *cookie; /* HTTP_COOKIE environment variable */
|
||||
char name[128], /* Name string */
|
||||
value[512], /* Value string */
|
||||
*ptr; /* Pointer into name/value */
|
||||
|
||||
|
||||
if ((cookie = getenv("HTTP_COOKIE")) == NULL)
|
||||
return;
|
||||
|
||||
while (*cookie)
|
||||
{
|
||||
/*
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*cookie & 255))
|
||||
cookie ++;
|
||||
if (!*cookie)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Copy the name...
|
||||
*/
|
||||
|
||||
for (ptr = name; *cookie && *cookie != '=';)
|
||||
if (ptr < (name + sizeof(name) - 1))
|
||||
*ptr++ = *cookie++;
|
||||
else
|
||||
break;
|
||||
|
||||
if (*cookie != '=')
|
||||
break;
|
||||
|
||||
*ptr = '\0';
|
||||
cookie ++;
|
||||
|
||||
/*
|
||||
* Then the value...
|
||||
*/
|
||||
|
||||
if (*cookie == '\"')
|
||||
{
|
||||
for (cookie ++, ptr = value; *cookie && *cookie != '\"';)
|
||||
if (ptr < (value + sizeof(value) - 1))
|
||||
*ptr++ = *cookie++;
|
||||
else
|
||||
break;
|
||||
|
||||
if (*cookie == '\"')
|
||||
cookie ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ptr = value; *cookie && *cookie != ';';)
|
||||
if (ptr < (value + sizeof(value) - 1))
|
||||
*ptr++ = *cookie++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (*cookie == ';')
|
||||
cookie ++;
|
||||
else if (*cookie)
|
||||
break;
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
/*
|
||||
* Then add the cookie to an array as long as the name doesn't start with
|
||||
* "$"...
|
||||
*/
|
||||
|
||||
if (name[0] != '$')
|
||||
num_cookies = cupsAddOption(name, value, num_cookies, &cookies);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgi_initialize_get()' - Initialize form variables using the GET method.
|
||||
*/
|
||||
@@ -562,7 +746,8 @@ cgi_initialize_get(void)
|
||||
|
||||
|
||||
/*
|
||||
* 'cgi_initialize_multipart()' - Initialize variables and file using the POST method.
|
||||
* 'cgi_initialize_multipart()' - Initialize variables and file using the POST
|
||||
* method.
|
||||
*
|
||||
* TODO: Update to support files > 2GB.
|
||||
*/
|
||||
@@ -874,7 +1059,7 @@ cgi_initialize_string(const char *data) /* I - Form data string */
|
||||
char *s, /* Pointer to current form string */
|
||||
ch, /* Temporary character */
|
||||
name[255], /* Name of form variable */
|
||||
value[65536]; /* Variable value... */
|
||||
value[65536]; /* Variable value */
|
||||
|
||||
|
||||
/*
|
||||
@@ -927,6 +1112,9 @@ cgi_initialize_string(const char *data) /* I - Form data string */
|
||||
* Read the hex code...
|
||||
*/
|
||||
|
||||
if (!isxdigit(data[1] & 255) || !isxdigit(data[2] & 255))
|
||||
return (0);
|
||||
|
||||
if (s < (value + sizeof(value) - 1))
|
||||
{
|
||||
data ++;
|
||||
@@ -1014,6 +1202,46 @@ cgi_passwd(const char *prompt) /* I - Prompt (not used) */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgi_set_sid()' - Set the CUPS session ID.
|
||||
*/
|
||||
|
||||
static const char * /* O - New session ID */
|
||||
cgi_set_sid(void)
|
||||
{
|
||||
char buffer[512], /* SID data */
|
||||
sid[33]; /* SID string */
|
||||
_cups_md5_state_t md5; /* MD5 state */
|
||||
unsigned char sum[16]; /* MD5 sum */
|
||||
const char *remote_addr, /* REMOTE_ADDR */
|
||||
*server_name, /* SERVER_NAME */
|
||||
*server_port; /* SERVER_PORT */
|
||||
|
||||
|
||||
if ((remote_addr = getenv("REMOTE_ADDR")) == NULL)
|
||||
remote_addr = "REMOTE_ADDR";
|
||||
if ((server_name = getenv("SERVER_NAME")) == NULL)
|
||||
server_name = "SERVER_NAME";
|
||||
if ((server_port = getenv("SERVER_PORT")) == NULL)
|
||||
server_port = "SERVER_PORT";
|
||||
|
||||
CUPS_SRAND(time(NULL));
|
||||
snprintf(buffer, sizeof(buffer), "%s:%s:%s:%02X%02X%02X%02X%02X%02X%02X%02X",
|
||||
remote_addr, server_name, server_port,
|
||||
(unsigned)CUPS_RAND() & 255, (unsigned)CUPS_RAND() & 255,
|
||||
(unsigned)CUPS_RAND() & 255, (unsigned)CUPS_RAND() & 255,
|
||||
(unsigned)CUPS_RAND() & 255, (unsigned)CUPS_RAND() & 255,
|
||||
(unsigned)CUPS_RAND() & 255, (unsigned)CUPS_RAND() & 255);
|
||||
_cupsMD5Init(&md5);
|
||||
_cupsMD5Append(&md5, (unsigned char *)buffer, (int)strlen(buffer));
|
||||
_cupsMD5Finish(&md5, sum);
|
||||
|
||||
cgiSetCookie(CUPS_SID, httpMD5String(sum, sid), "/", NULL, 0, 0);
|
||||
|
||||
return (cupsGetOption(CUPS_SID, num_cookies, cookies));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cgi_sort_variables()' - Sort all form variables for faster lookup.
|
||||
*/
|
||||
|
||||
@@ -46,6 +46,10 @@ DefaultAuthType Basic
|
||||
# Set the default printer/job policies...
|
||||
<Policy default>
|
||||
# Job-related operations must be done by the owner or an administrator...
|
||||
<Limit Create-Job Print-Job Print-URI Validate-Job>
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job CUPS-Get-Document>
|
||||
Require user @OWNER @SYSTEM
|
||||
Order deny,allow
|
||||
@@ -79,7 +83,7 @@ DefaultAuthType Basic
|
||||
# Set the authenticated printer/job policies...
|
||||
<Policy authenticated>
|
||||
# Job-related operations must be done by the owner or an administrator...
|
||||
<Limit Create-Job Print-Job Print-URI>
|
||||
<Limit Create-Job Print-Job Print-URI Validate-Job>
|
||||
AuthType Default
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Sample SNMP configuration file for CUPS. See "man cups-smnp.conf" for a
|
||||
# Sample SNMP configuration file for CUPS. See "man cups-snmp.conf" for a
|
||||
# complete description of this file.
|
||||
#
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-common.m4 8938 2009-12-18 23:52:01Z mike $"
|
||||
dnl "$Id: cups-common.m4 9853 2011-07-06 20:27:31Z mike $"
|
||||
dnl
|
||||
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl Common configuration stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007-2011 by Apple Inc.
|
||||
dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -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.3"
|
||||
CUPS_VERSION="1.4.8"
|
||||
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'`"
|
||||
@@ -88,6 +88,9 @@ fi
|
||||
|
||||
AC_SUBST(INSTALLSTATIC)
|
||||
|
||||
dnl Check for pkg-config, which is used for some other tests later on...
|
||||
AC_PATH_PROG(PKGCONFIG, pkg-config)
|
||||
|
||||
dnl Check for libraries...
|
||||
AC_SEARCH_LIBS(crypt, crypt)
|
||||
AC_SEARCH_LIBS(getspent, sec gen)
|
||||
@@ -133,6 +136,13 @@ AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
|
||||
AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
|
||||
AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
|
||||
|
||||
dnl Checks for statfs and its many headers...
|
||||
AC_CHECK_HEADER(sys/mount.h,AC_DEFINE(HAVE_SYS_MOUNT_H))
|
||||
AC_CHECK_HEADER(sys/statfs.h,AC_DEFINE(HAVE_SYS_STATFS_H))
|
||||
AC_CHECK_HEADER(sys/statvfs.h,AC_DEFINE(HAVE_SYS_STATVFS_H))
|
||||
AC_CHECK_HEADER(sys/vfs.h,AC_DEFINE(HAVE_SYS_VFS_H))
|
||||
AC_CHECK_FUNCS(statfs statvfs)
|
||||
|
||||
dnl Checks for string functions.
|
||||
AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
|
||||
if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
|
||||
@@ -174,6 +184,14 @@ AC_TRY_COMPILE([#include <time.h>],[struct tm t;
|
||||
AC_DEFINE(HAVE_TM_GMTOFF),
|
||||
AC_MSG_RESULT(no))
|
||||
|
||||
dnl See if the stat structure has the st_gen member...
|
||||
AC_MSG_CHECKING(for st_gen member in stat structure)
|
||||
AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat t;
|
||||
int o = t.st_gen;],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_ST_GEN),
|
||||
AC_MSG_RESULT(no))
|
||||
|
||||
dnl See if we have the removefile(3) function for securely removing files
|
||||
AC_CHECK_FUNCS(removefile)
|
||||
|
||||
@@ -192,7 +210,7 @@ else
|
||||
fi
|
||||
|
||||
if test $check_libusb = yes; then
|
||||
AC_CHECK_LIB(usb, usb_init,[
|
||||
AC_CHECK_LIB(usb, usb_get_string_simple,[
|
||||
AC_CHECK_HEADER(usb.h,
|
||||
AC_DEFINE(HAVE_USB_H)
|
||||
LIBUSB="-lusb")])
|
||||
@@ -253,24 +271,22 @@ AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory
|
||||
DBUS_NOTIFIER=""
|
||||
DBUS_NOTIFIERLIBS=""
|
||||
|
||||
if test "x$enable_dbus" != xno; then
|
||||
AC_PATH_PROG(PKGCONFIG, pkg-config)
|
||||
if test "x$PKGCONFIG" != x; then
|
||||
AC_MSG_CHECKING(for DBUS)
|
||||
if $PKGCONFIG --exists dbus-1; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_DBUS)
|
||||
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
|
||||
CUPSDLIBS="$CUPSDLIBS `$PKGCONFIG --libs dbus-1`"
|
||||
DBUS_NOTIFIER="dbus"
|
||||
DBUS_NOTIFIERLIBS="`$PKGCONFIG --libs dbus-1`"
|
||||
AC_CHECK_LIB(dbus-1,
|
||||
dbus_message_iter_init_append,
|
||||
AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND),,
|
||||
`$PKGCONFIG --libs dbus-1`)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
if test "x$enable_dbus" != xno -a "x$PKGCONFIG" != x; then
|
||||
AC_MSG_CHECKING(for DBUS)
|
||||
if $PKGCONFIG --exists dbus-1; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_DBUS)
|
||||
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
|
||||
CUPSDLIBS="$CUPSDLIBS `$PKGCONFIG --libs dbus-1`"
|
||||
DBUS_NOTIFIER="dbus"
|
||||
DBUS_NOTIFIERLIBS="`$PKGCONFIG --libs dbus-1`"
|
||||
SAVELIBS="$LIBS"
|
||||
LIBS="$LIBS $DBUS_NOTIFIERLIBS"
|
||||
AC_CHECK_FUNC(dbus_message_iter_init_append,
|
||||
AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
|
||||
LIBS="$SAVELIBS"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -289,13 +305,17 @@ case $uname in
|
||||
LEGACY_BACKENDS=""
|
||||
BACKLIBS="$BACKLIBS -framework IOKit"
|
||||
CUPSDLIBS="$CUPSDLIBS -sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration -weak_framework ApplicationServices"
|
||||
LIBS="-framework SystemConfiguration -framework CoreFoundation $LIBS"
|
||||
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))
|
||||
|
||||
dnl Check for dynamic store function...
|
||||
AC_CHECK_FUNCS(SCDynamicStoreCopyComputerName)
|
||||
|
||||
dnl Check for the new membership functions in MacOSX 10.4...
|
||||
AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
|
||||
AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
|
||||
@@ -318,7 +338,7 @@ case $uname in
|
||||
AC_ARG_WITH(operkey, [ --with-operkey set the default operator @AUTHKEY value],
|
||||
default_operkey="$withval",
|
||||
default_operkey="default")
|
||||
|
||||
|
||||
AC_CHECK_HEADER(Security/Authorization.h, [
|
||||
AC_DEFINE(HAVE_AUTHORIZATION_H)
|
||||
|
||||
@@ -351,5 +371,5 @@ AC_SUBST(FONTS)
|
||||
AC_SUBST(LEGACY_BACKENDS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-common.m4 8938 2009-12-18 23:52:01Z mike $".
|
||||
dnl End of "$Id: cups-common.m4 9853 2011-07-06 20:27:31Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-compiler.m4 8655 2009-05-17 00:13:47Z mike $"
|
||||
dnl "$Id: cups-compiler.m4 9822 2011-06-10 22:59:36Z mike $"
|
||||
dnl
|
||||
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -146,15 +146,22 @@ if test -n "$GCC"; then
|
||||
AC_MSG_RESULT(no))
|
||||
CFLAGS="$OLDCFLAGS"
|
||||
|
||||
# The -pie option is available with some versions of GCC and adds
|
||||
# The -fPIE option is available with some versions of GCC and adds
|
||||
# randomization of addresses, which avoids another class of exploits
|
||||
# that depend on a fixed address for common functions.
|
||||
AC_MSG_CHECKING(if GCC supports -pie)
|
||||
AC_MSG_CHECKING(if GCC supports -fPIE)
|
||||
OLDCFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -pie -fPIE"
|
||||
CFLAGS="$CFLAGS -fPIE"
|
||||
AC_TRY_COMPILE(,,
|
||||
PIEFLAGS="-pie -fPIE"
|
||||
AC_MSG_RESULT(yes),
|
||||
[case "$CC" in
|
||||
*clang)
|
||||
PIEFLAGS="-fPIE -Wl,-pie"
|
||||
;;
|
||||
*)
|
||||
PIEFLAGS="-fPIE -pie"
|
||||
;;
|
||||
esac
|
||||
AC_MSG_RESULT(yes)],
|
||||
AC_MSG_RESULT(no))
|
||||
CFLAGS="$OLDCFLAGS"
|
||||
|
||||
@@ -175,7 +182,7 @@ if test -n "$GCC"; then
|
||||
# checking, basically wrapping all string functions
|
||||
# with buffer-limited ones. Not strictly needed for
|
||||
# CUPS since we already use buffer-limited calls, but
|
||||
# this will catch any additions that are broken.
|
||||
# this will catch any additions that are broken.
|
||||
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
|
||||
|
||||
if test x$enable_pie = xyes; then
|
||||
@@ -563,5 +570,5 @@ case $uname in
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-compiler.m4 8655 2009-05-17 00:13:47Z mike $".
|
||||
dnl End of "$Id: cups-compiler.m4 9822 2011-06-10 22:59:36Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-launchd.m4 8344 2009-02-10 17:05:35Z mike $"
|
||||
dnl "$Id: cups-launchd.m4 9120 2010-04-23 18:56:34Z mike $"
|
||||
dnl
|
||||
dnl launchd stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl launchd stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007-2010 by Apple Inc.
|
||||
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -35,10 +35,9 @@ if test x$enable_launchd != xno; then
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LAUNCHD_CONF, "$DEFAULT_LAUNCHD_CONF")
|
||||
AC_SUBST(DEFAULT_LAUNCHD_CONF)
|
||||
AC_SUBST(LAUNCHDLIBS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-launchd.m4 8344 2009-02-10 17:05:35Z mike $".
|
||||
dnl End of "$Id: cups-launchd.m4 9120 2010-04-23 18:56:34Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-sharedlibs.m4 8344 2009-02-10 17:05:35Z mike $"
|
||||
dnl "$Id: cups-sharedlibs.m4 9154 2010-06-16 00:49:01Z mike $"
|
||||
dnl
|
||||
dnl Shared library support for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -158,16 +158,31 @@ AC_SUBST(LIBCUPSPPDC)
|
||||
if test x$enable_shared = xno; then
|
||||
LINKCUPS="../cups/libcups.a"
|
||||
LINKCUPSIMAGE="../filter/libcupsimage.a"
|
||||
|
||||
EXTLINKCUPS="-lcups"
|
||||
EXTLINKCUPSDRIVER="-lcupsdriver"
|
||||
EXTLINKCUPSIMAGE="-lcupsimage"
|
||||
else
|
||||
if test $uname = AIX; then
|
||||
LINKCUPS="-lcups_s"
|
||||
LINKCUPSIMAGE="-lcupsimage_s"
|
||||
|
||||
EXTLINKCUPS="-lcups_s"
|
||||
EXTLINKCUPSDRIVER="-lcupsdriver_s"
|
||||
EXTLINKCUPSIMAGE="-lcupsimage_s"
|
||||
else
|
||||
LINKCUPS="-lcups"
|
||||
LINKCUPSIMAGE="-lcupsimage"
|
||||
|
||||
EXTLINKCUPS="-lcups"
|
||||
EXTLINKCUPSDRIVER="-lcupsdriver"
|
||||
EXTLINKCUPSIMAGE="-lcupsimage"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(EXTLINKCUPS)
|
||||
AC_SUBST(EXTLINKCUPSDRIVER)
|
||||
AC_SUBST(EXTLINKCUPSIMAGE)
|
||||
AC_SUBST(LINKCUPS)
|
||||
AC_SUBST(LINKCUPSIMAGE)
|
||||
|
||||
@@ -244,5 +259,5 @@ AC_SUBST(IMGLIBS)
|
||||
AC_SUBST(EXPORT_LDFLAGS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-sharedlibs.m4 8344 2009-02-10 17:05:35Z mike $".
|
||||
dnl End of "$Id: cups-sharedlibs.m4 9154 2010-06-16 00:49:01Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dnl
|
||||
dnl "$Id: cups-ssl.m4 8591 2009-05-04 23:40:10Z mike $"
|
||||
dnl "$Id: cups-ssl.m4 9470 2011-01-11 07:05:58Z mike $"
|
||||
dnl
|
||||
dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl OpenSSL/GNUTLS stuff for CUPS.
|
||||
dnl
|
||||
dnl Copyright 2007-2009 by Apple Inc.
|
||||
dnl Copyright 2007-2011 by Apple Inc.
|
||||
dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
dnl
|
||||
dnl These coded instructions, statements, and computer programs are the
|
||||
@@ -26,17 +26,22 @@ AC_ARG_WITH(openssl-includes, [ --with-openssl-includes set directory for OpenS
|
||||
|
||||
SSLFLAGS=""
|
||||
SSLLIBS=""
|
||||
have_ssl=0
|
||||
|
||||
if test x$enable_ssl != xno; then
|
||||
dnl Look for CDSA...
|
||||
if test "x${SSLLIBS}" = "x" -a "x${enable_cdsassl}" != "xno"; then
|
||||
if test $have_ssl = 0 -a "x$enable_cdsassl" != "xno"; then
|
||||
if test $uname = Darwin; then
|
||||
AC_CHECK_HEADER(Security/SecureTransport.h, [
|
||||
SSLLIBS="-framework CoreFoundation -framework Security"
|
||||
have_ssl=1
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_CDSASSL)
|
||||
|
||||
dnl Check for the various security headers...
|
||||
AC_CHECK_HEADER(Security/SecItem.h,
|
||||
AC_DEFINE(HAVE_SECITEM_H))
|
||||
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,
|
||||
@@ -53,23 +58,58 @@ 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
|
||||
|
||||
dnl Then look for GNU TLS...
|
||||
if test "x${SSLLIBS}" = "x" -a "x${enable_gnutls}" != "xno" -a "x$PKGCONFIG" != x; then
|
||||
if test $have_ssl = 0 -a "x$enable_gnutls" != "xno" -a "x$PKGCONFIG" != x; then
|
||||
AC_PATH_PROG(LIBGNUTLSCONFIG,libgnutls-config)
|
||||
AC_PATH_PROG(LIBGCRYPTCONFIG,libgcrypt-config)
|
||||
if $PKGCONFIG --exists gnutls; then
|
||||
SSLLIBS=`$PKGCONFIG --libs gnutls`
|
||||
SSLFLAGS=`$PKGCONFIG --cflags gnutls`
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_GNUTLS)
|
||||
if test "x$have_pthread" = xyes; then
|
||||
AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.])
|
||||
else
|
||||
have_ssl=1
|
||||
SSLLIBS=`$PKGCONFIG --libs gnutls`
|
||||
SSLFLAGS=`$PKGCONFIG --cflags gnutls`
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_GNUTLS)
|
||||
fi
|
||||
elif test "x$LIBGNUTLSCONFIG" != x; then
|
||||
if test "x$have_pthread" = xyes; then
|
||||
AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.])
|
||||
else
|
||||
have_ssl=1
|
||||
SSLLIBS=`$LIBGNUTLSCONFIG --libs`
|
||||
SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_GNUTLS)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $have_ssl = 1; then
|
||||
if $PKGCONFIG --exists gcrypt; then
|
||||
SSLLIBS="$SSLLIBS `$PKGCONFIG --libs gcrypt`"
|
||||
SSLFLAGS="$SSLFLAGS `$PKGCONFIG --cflags gcrypt`"
|
||||
elif test "x$LIBGCRYPTCONFIG" != x; then
|
||||
SSLLIBS="$SSLLIBS `$LIBGCRYPTCONFIG --libs`"
|
||||
SSLFLAGS="$SSLFLAGS `$LIBGCRYPTCONFIG --cflags`"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Check for the OpenSSL library last...
|
||||
if test "x${SSLLIBS}" = "x" -a "x${enable_openssl}" != "xno"; then
|
||||
if test $have_ssl = 0 -a "x$enable_openssl" != "xno"; then
|
||||
AC_CHECK_HEADER(openssl/ssl.h,
|
||||
dnl Save the current libraries so the crypto stuff isn't always
|
||||
dnl included...
|
||||
@@ -87,7 +127,8 @@ if test x$enable_ssl != xno; then
|
||||
"-lcrypto -lRSAglue -lrsaref"
|
||||
do
|
||||
AC_CHECK_LIB(ssl,SSL_new,
|
||||
[SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
|
||||
[have_ssl=1
|
||||
SSLFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT"
|
||||
SSLLIBS="-lssl $libcrypto"
|
||||
AC_DEFINE(HAVE_SSL)
|
||||
AC_DEFINE(HAVE_LIBSSL)],,
|
||||
@@ -102,9 +143,11 @@ if test x$enable_ssl != xno; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$SSLLIBS" != x; then
|
||||
if test $have_ssl = 1; then
|
||||
AC_MSG_RESULT([ Using SSLLIBS="$SSLLIBS"])
|
||||
AC_MSG_RESULT([ Using SSLFLAGS="$SSLFLAGS"])
|
||||
elif test x$enable_cdsa = xyes -o x$enable_gnutls = xyes -o x$enable_openssl = xyes; then
|
||||
AC_MSG_ERROR([Unable to enable SSL support.])
|
||||
fi
|
||||
|
||||
AC_SUBST(SSLFLAGS)
|
||||
@@ -115,5 +158,5 @@ AC_SUBST(EXPORT_SSLLIBS)
|
||||
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-ssl.m4 8591 2009-05-04 23:40:10Z mike $".
|
||||
dnl End of "$Id: cups-ssl.m4 9470 2011-01-11 07:05:58Z mike $".
|
||||
dnl
|
||||
|
||||
+46
-5
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Configuration file for the Common UNIX Printing System (CUPS).
|
||||
* Configuration file for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -289,6 +289,8 @@
|
||||
*/
|
||||
|
||||
#undef HAVE_AUTHORIZATION_H
|
||||
#undef HAVE_SECITEM_H
|
||||
#undef HAVE_SECITEMPRIV_H
|
||||
#undef HAVE_SECPOLICY_H
|
||||
#undef HAVE_SECPOLICYPRIV_H
|
||||
#undef HAVE_SECBASEPRIV_H
|
||||
@@ -302,6 +304,13 @@
|
||||
#undef HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SecPolicyCreateSSL function?
|
||||
*/
|
||||
|
||||
#undef HAVE_SECPOLICYCREATESSL
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SLP library?
|
||||
*/
|
||||
@@ -342,6 +351,13 @@
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
|
||||
/*
|
||||
* Does the "stat" structure contain the "st_gen" member?
|
||||
*/
|
||||
|
||||
#undef HAVE_ST_GEN
|
||||
|
||||
|
||||
/*
|
||||
* Does the "tm" structure contain the "tm_gmtoff" member?
|
||||
*/
|
||||
@@ -432,7 +448,6 @@
|
||||
|
||||
#undef HAVE_LAUNCH_H
|
||||
#undef HAVE_LAUNCHD
|
||||
#define CUPS_DEFAULT_LAUNCHD_CONF ""
|
||||
|
||||
|
||||
/*
|
||||
@@ -483,7 +498,21 @@
|
||||
|
||||
|
||||
/*
|
||||
* Do we have MacOSX 10.4's mbr_XXX functions()?
|
||||
* Do we have ApplicationServices public headers?
|
||||
*/
|
||||
|
||||
#undef HAVE_APPLICATIONSERVICES_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SCDynamicStoreCopyComputerName function?
|
||||
*/
|
||||
|
||||
#undef HAVE_SCDYNAMICSTORECOPYCOMPUTERNAME
|
||||
|
||||
|
||||
/*
|
||||
* Do we have MacOSX 10.4's mbr_XXX functions?
|
||||
*/
|
||||
|
||||
#undef HAVE_MEMBERSHIP_H
|
||||
@@ -492,7 +521,7 @@
|
||||
|
||||
|
||||
/*
|
||||
* Do we have Darwin's notify_post() header and function?
|
||||
* Do we have Darwin's notify_post header and function?
|
||||
*/
|
||||
|
||||
#undef HAVE_NOTIFY_H
|
||||
@@ -626,6 +655,18 @@
|
||||
#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_ */
|
||||
|
||||
/*
|
||||
|
||||
+2
-2
@@ -31,9 +31,9 @@ sinclude(config-scripts/cups-poll.m4)
|
||||
sinclude(config-scripts/cups-slp.m4)
|
||||
sinclude(config-scripts/cups-gssapi.m4)
|
||||
sinclude(config-scripts/cups-ldap.m4)
|
||||
sinclude(config-scripts/cups-threads.m4)
|
||||
sinclude(config-scripts/cups-ssl.m4)
|
||||
sinclude(config-scripts/cups-pam.m4)
|
||||
sinclude(config-scripts/cups-threads.m4)
|
||||
sinclude(config-scripts/cups-largefile.m4)
|
||||
sinclude(config-scripts/cups-dnssd.m4)
|
||||
sinclude(config-scripts/cups-launchd.m4)
|
||||
@@ -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/drv.man man/lpoptions.man
|
||||
man/cupsd.conf.man man/lpoptions.man
|
||||
templates/header.tmpl
|
||||
$LANGFILES)
|
||||
|
||||
|
||||
+4
-4
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# CUPS configuration utility.
|
||||
#
|
||||
# Copyright 2007-2008 by Apple Inc.
|
||||
# Copyright 2007-2010 by Apple Inc.
|
||||
# Copyright 2001-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -113,12 +113,12 @@ while test $# -gt 0; do
|
||||
;;
|
||||
--libs)
|
||||
if test $static = no; then
|
||||
libs="-lcups $LIBS";
|
||||
libs="@EXTLINKCUPS@ $LIBS";
|
||||
if test $image = yes; then
|
||||
libs="-lcupsimage $libs"
|
||||
libs="@EXTLINKCUPSIMAGE@ $libs"
|
||||
fi
|
||||
if test $driver = yes; then
|
||||
libs="-lcupsdriver $libs"
|
||||
libs="@EXTLINKCUPSDRIVER@ $libs"
|
||||
fi
|
||||
else
|
||||
libs="$libdir/libcups.a $LIBS";
|
||||
|
||||
+159
-102
@@ -2,112 +2,131 @@
|
||||
|
||||
adminutil.o: adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
|
||||
adminutil.o: file.h language.h globals.h string.h ../config.h http-private.h
|
||||
adminutil.o: md5.h ipp-private.h i18n.h transcode.h debug.h
|
||||
adminutil.o: md5.h ipp-private.h i18n.h transcode.h pwg-private.h
|
||||
adminutil.o: ../cups/cups.h debug.h
|
||||
array.o: array.h versioning.h string.h ../config.h debug.h
|
||||
attr.o: ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
attr.o: language.h debug.h string.h ../config.h
|
||||
auth.o: globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
auth.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
auth.o: i18n.h transcode.h debug.h
|
||||
auth.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
backchannel.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
backchannel.o: language.h
|
||||
backend.o: backend.h versioning.h globals.h string.h ../config.h
|
||||
backend.o: http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h
|
||||
backend.o: array.h file.h language.h i18n.h transcode.h
|
||||
backend.o: array.h file.h language.h i18n.h transcode.h pwg-private.h
|
||||
backend.o: ../cups/cups.h
|
||||
conflicts.o: ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h
|
||||
conflicts.o: file.h language.h string.h ../config.h debug.h
|
||||
custom.o: globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
custom.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
custom.o: i18n.h transcode.h debug.h
|
||||
custom.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
debug.o: globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
debug.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
debug.o: i18n.h transcode.h debug.h
|
||||
debug.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
dest.o: debug.h globals.h string.h ../config.h http-private.h http.h
|
||||
dest.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
|
||||
dest.o: language.h i18n.h transcode.h pwgmedia.h
|
||||
dest.o: language.h i18n.h transcode.h pwg-private.h ../cups/cups.h
|
||||
dir.o: dir.h versioning.h string.h ../config.h debug.h
|
||||
emit.o: ppd.h array.h versioning.h file.h string.h ../config.h debug.h
|
||||
encode.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
encode.o: ipp-private.h string.h ../config.h debug.h
|
||||
file.o: file-private.h http-private.h ../config.h http.h versioning.h md5.h
|
||||
file.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h
|
||||
file.o: language.h i18n.h transcode.h debug.h
|
||||
file.o: language.h i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
getdevices.o: globals.h string.h ../config.h http-private.h http.h
|
||||
getdevices.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
getdevices.o: file.h language.h i18n.h transcode.h debug.h
|
||||
getdevices.o: file.h language.h i18n.h transcode.h pwg-private.h
|
||||
getdevices.o: ../cups/cups.h debug.h
|
||||
getifaddrs.o: http-private.h ../config.h http.h versioning.h md5.h
|
||||
getifaddrs.o: ipp-private.h ipp.h
|
||||
getputfile.o: globals.h string.h ../config.h http-private.h http.h
|
||||
getputfile.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
getputfile.o: file.h language.h i18n.h transcode.h debug.h
|
||||
getputfile.o: file.h language.h i18n.h transcode.h pwg-private.h
|
||||
getputfile.o: ../cups/cups.h debug.h
|
||||
globals.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
globals.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
|
||||
globals.o: i18n.h transcode.h
|
||||
globals.o: i18n.h transcode.h pwg-private.h ../cups/cups.h
|
||||
http.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
http.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
|
||||
http.o: i18n.h transcode.h debug.h
|
||||
http.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
http-addr.o: http-private.h ../config.h http.h versioning.h md5.h
|
||||
http-addr.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
|
||||
http-addr.o: file.h language.h i18n.h transcode.h debug.h
|
||||
http-addr.o: file.h language.h i18n.h transcode.h pwg-private.h
|
||||
http-addr.o: ../cups/cups.h debug.h
|
||||
http-addrlist.o: http-private.h ../config.h http.h versioning.h md5.h
|
||||
http-addrlist.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
|
||||
http-addrlist.o: file.h language.h i18n.h transcode.h debug.h
|
||||
http-addrlist.o: file.h language.h i18n.h transcode.h pwg-private.h
|
||||
http-addrlist.o: ../cups/cups.h debug.h
|
||||
http-support.o: debug.h globals.h string.h ../config.h http-private.h http.h
|
||||
http-support.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
http-support.o: file.h language.h i18n.h transcode.h
|
||||
http-support.o: file.h language.h i18n.h transcode.h pwg-private.h
|
||||
http-support.o: ../cups/cups.h
|
||||
ipp.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
ipp.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
|
||||
ipp.o: transcode.h debug.h
|
||||
ipp.o: transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
ipp-support.o: globals.h string.h ../config.h http-private.h http.h
|
||||
ipp-support.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
ipp-support.o: file.h language.h i18n.h transcode.h debug.h
|
||||
ipp-support.o: file.h language.h i18n.h transcode.h pwg-private.h
|
||||
ipp-support.o: ../cups/cups.h debug.h
|
||||
langprintf.o: globals.h string.h ../config.h http-private.h http.h
|
||||
langprintf.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
langprintf.o: file.h language.h i18n.h transcode.h
|
||||
langprintf.o: file.h language.h i18n.h transcode.h pwg-private.h
|
||||
langprintf.o: ../cups/cups.h
|
||||
language.o: globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
language.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
language.o: i18n.h transcode.h debug.h
|
||||
language.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
localize.o: globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
localize.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
localize.o: i18n.h transcode.h ppd-private.h debug.h
|
||||
localize.o: i18n.h transcode.h pwg-private.h ../cups/cups.h ppd-private.h
|
||||
localize.o: debug.h
|
||||
mark.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
mark.o: string.h ../config.h debug.h pwgmedia.h
|
||||
mark.o: string.h ../config.h debug.h pwg-private.h ../cups/cups.h
|
||||
md5.o: md5.h string.h ../config.h
|
||||
md5passwd.o: http-private.h ../config.h http.h versioning.h md5.h
|
||||
md5passwd.o: ipp-private.h ipp.h string.h
|
||||
notify.o: globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
notify.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
notify.o: i18n.h transcode.h
|
||||
notify.o: i18n.h transcode.h pwg-private.h ../cups/cups.h
|
||||
options.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
options.o: string.h ../config.h debug.h
|
||||
page.o: ppd.h array.h versioning.h file.h string.h ../config.h debug.h
|
||||
ppd.o: ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
ppd.o: language.h globals.h string.h ../config.h http-private.h md5.h
|
||||
ppd.o: ipp-private.h i18n.h transcode.h debug.h
|
||||
pwgmedia.o: pwgmedia.h globals.h string.h ../config.h http-private.h http.h
|
||||
pwgmedia.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
pwgmedia.o: file.h language.h i18n.h transcode.h debug.h
|
||||
ppd.o: language.h pwg-private.h ../cups/cups.h globals.h string.h ../config.h
|
||||
ppd.o: http-private.h md5.h ipp-private.h i18n.h transcode.h debug.h
|
||||
pwg-file.o: pwg-private.h ../cups/cups.h globals.h string.h ../config.h
|
||||
pwg-file.o: http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
|
||||
pwg-file.o: cups.h ppd.h array.h file.h language.h i18n.h transcode.h debug.h
|
||||
pwg-media.o: pwg-private.h ../cups/cups.h globals.h string.h ../config.h
|
||||
pwg-media.o: http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
|
||||
pwg-media.o: cups.h ppd.h array.h file.h language.h i18n.h transcode.h
|
||||
pwg-media.o: debug.h
|
||||
pwg-ppd.o: pwg-private.h ../cups/cups.h globals.h string.h ../config.h
|
||||
pwg-ppd.o: http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
|
||||
pwg-ppd.o: cups.h ppd.h array.h file.h language.h i18n.h transcode.h debug.h
|
||||
request.o: globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
request.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
request.o: i18n.h transcode.h debug.h
|
||||
request.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
sidechannel.o: sidechannel.h versioning.h string.h ../config.h debug.h
|
||||
snmp.o: globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
snmp.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
snmp.o: i18n.h transcode.h debug.h snmp-private.h
|
||||
snmp.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
snmp.o: snmp-private.h
|
||||
snprintf.o: string.h ../config.h
|
||||
string.o: array.h versioning.h debug.h string.h ../config.h
|
||||
tempfile.o: globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
tempfile.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
tempfile.o: i18n.h transcode.h debug.h
|
||||
tempfile.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
transcode.o: globals.h string.h ../config.h http-private.h http.h
|
||||
transcode.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
transcode.o: file.h language.h i18n.h transcode.h debug.h
|
||||
transcode.o: file.h language.h i18n.h transcode.h pwg-private.h
|
||||
transcode.o: ../cups/cups.h debug.h
|
||||
usersys.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
usersys.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
|
||||
usersys.o: i18n.h transcode.h debug.h
|
||||
usersys.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
util.o: globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
util.o: md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
util.o: i18n.h transcode.h debug.h
|
||||
util.o: i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
testadmin.o: adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
|
||||
testadmin.o: file.h language.h string.h ../config.h
|
||||
testarray.o: ../cups/string.h ../config.h string.h array.h versioning.h dir.h
|
||||
@@ -127,119 +146,138 @@ testoptions.o: string.h ../config.h cups.h ipp.h http.h versioning.h ppd.h
|
||||
testoptions.o: array.h file.h language.h
|
||||
testlang.o: i18n.h transcode.h language.h array.h versioning.h string.h
|
||||
testlang.o: ../config.h
|
||||
testppd.o: ../cups/string.h ../config.h string.h cups.h ipp.h http.h
|
||||
testppd.o: versioning.h ppd.h array.h file.h language.h pwgmedia.h
|
||||
testppd.o: ../cups/cups.h ../cups/string.h ../config.h string.h
|
||||
testpwg.o: pwg-private.h ../cups/cups.h
|
||||
testsnmp.o: string.h ../config.h snmp-private.h http.h versioning.h
|
||||
# DO NOT DELETE
|
||||
|
||||
adminutil.32.o: adminutil.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
|
||||
adminutil.32.o: adminutil.c file.h language.h globals.h string.h ../config.h http-private.h
|
||||
adminutil.32.o: adminutil.c md5.h ipp-private.h i18n.h transcode.h debug.h
|
||||
adminutil.32.o: adminutil.c md5.h ipp-private.h i18n.h transcode.h pwg-private.h
|
||||
adminutil.32.o: adminutil.c ../cups/cups.h debug.h
|
||||
array.32.o: array.c array.h versioning.h string.h ../config.h debug.h
|
||||
attr.32.o: attr.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
attr.32.o: attr.c language.h debug.h string.h ../config.h
|
||||
auth.32.o: auth.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
auth.32.o: auth.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
auth.32.o: auth.c i18n.h transcode.h debug.h
|
||||
auth.32.o: auth.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
backchannel.32.o: backchannel.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
backchannel.32.o: backchannel.c language.h
|
||||
backend.32.o: backend.c backend.h versioning.h globals.h string.h ../config.h
|
||||
backend.32.o: backend.c http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h
|
||||
backend.32.o: backend.c array.h file.h language.h i18n.h transcode.h
|
||||
backend.32.o: backend.c array.h file.h language.h i18n.h transcode.h pwg-private.h
|
||||
backend.32.o: backend.c ../cups/cups.h
|
||||
conflicts.32.o: conflicts.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h
|
||||
conflicts.32.o: conflicts.c file.h language.h string.h ../config.h debug.h
|
||||
custom.32.o: custom.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
custom.32.o: custom.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
custom.32.o: custom.c i18n.h transcode.h debug.h
|
||||
custom.32.o: custom.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
debug.32.o: debug.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
debug.32.o: debug.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
debug.32.o: debug.c i18n.h transcode.h debug.h
|
||||
debug.32.o: debug.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
dest.32.o: dest.c debug.h globals.h string.h ../config.h http-private.h http.h
|
||||
dest.32.o: dest.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
|
||||
dest.32.o: dest.c language.h i18n.h transcode.h pwgmedia.h
|
||||
dest.32.o: dest.c language.h i18n.h transcode.h pwg-private.h ../cups/cups.h
|
||||
dir.32.o: dir.c dir.h versioning.h string.h ../config.h debug.h
|
||||
emit.32.o: emit.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
|
||||
encode.32.o: encode.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
encode.32.o: encode.c ipp-private.h string.h ../config.h debug.h
|
||||
file.32.o: file.c file-private.h http-private.h ../config.h http.h versioning.h md5.h
|
||||
file.32.o: file.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h
|
||||
file.32.o: file.c language.h i18n.h transcode.h debug.h
|
||||
file.32.o: file.c language.h i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
getdevices.32.o: getdevices.c globals.h string.h ../config.h http-private.h http.h
|
||||
getdevices.32.o: getdevices.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
getdevices.32.o: getdevices.c file.h language.h i18n.h transcode.h debug.h
|
||||
getdevices.32.o: getdevices.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
getdevices.32.o: getdevices.c ../cups/cups.h debug.h
|
||||
getifaddrs.32.o: getifaddrs.c http-private.h ../config.h http.h versioning.h md5.h
|
||||
getifaddrs.32.o: getifaddrs.c ipp-private.h ipp.h
|
||||
getputfile.32.o: getputfile.c globals.h string.h ../config.h http-private.h http.h
|
||||
getputfile.32.o: getputfile.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
getputfile.32.o: getputfile.c file.h language.h i18n.h transcode.h debug.h
|
||||
getputfile.32.o: getputfile.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
getputfile.32.o: getputfile.c ../cups/cups.h debug.h
|
||||
globals.32.o: globals.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
globals.32.o: globals.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
|
||||
globals.32.o: globals.c i18n.h transcode.h
|
||||
globals.32.o: globals.c i18n.h transcode.h pwg-private.h ../cups/cups.h
|
||||
http.32.o: http.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
http.32.o: http.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
|
||||
http.32.o: http.c i18n.h transcode.h debug.h
|
||||
http.32.o: http.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
http-addr.32.o: http-addr.c http-private.h ../config.h http.h versioning.h md5.h
|
||||
http-addr.32.o: http-addr.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
|
||||
http-addr.32.o: http-addr.c file.h language.h i18n.h transcode.h debug.h
|
||||
http-addr.32.o: http-addr.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
http-addr.32.o: http-addr.c ../cups/cups.h debug.h
|
||||
http-addrlist.32.o: http-addrlist.c http-private.h ../config.h http.h versioning.h md5.h
|
||||
http-addrlist.32.o: http-addrlist.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
|
||||
http-addrlist.32.o: http-addrlist.c file.h language.h i18n.h transcode.h debug.h
|
||||
http-addrlist.32.o: http-addrlist.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
http-addrlist.32.o: http-addrlist.c ../cups/cups.h debug.h
|
||||
http-support.32.o: http-support.c debug.h globals.h string.h ../config.h http-private.h http.h
|
||||
http-support.32.o: http-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
http-support.32.o: http-support.c file.h language.h i18n.h transcode.h
|
||||
http-support.32.o: http-support.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
http-support.32.o: http-support.c ../cups/cups.h
|
||||
ipp.32.o: ipp.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
ipp.32.o: ipp.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
|
||||
ipp.32.o: ipp.c transcode.h debug.h
|
||||
ipp.32.o: ipp.c transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
ipp-support.32.o: ipp-support.c globals.h string.h ../config.h http-private.h http.h
|
||||
ipp-support.32.o: ipp-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
ipp-support.32.o: ipp-support.c file.h language.h i18n.h transcode.h debug.h
|
||||
ipp-support.32.o: ipp-support.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
ipp-support.32.o: ipp-support.c ../cups/cups.h debug.h
|
||||
langprintf.32.o: langprintf.c globals.h string.h ../config.h http-private.h http.h
|
||||
langprintf.32.o: langprintf.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
langprintf.32.o: langprintf.c file.h language.h i18n.h transcode.h
|
||||
langprintf.32.o: langprintf.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
langprintf.32.o: langprintf.c ../cups/cups.h
|
||||
language.32.o: language.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
language.32.o: language.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
language.32.o: language.c i18n.h transcode.h debug.h
|
||||
language.32.o: language.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
localize.32.o: localize.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
localize.32.o: localize.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
localize.32.o: localize.c i18n.h transcode.h ppd-private.h debug.h
|
||||
localize.32.o: localize.c i18n.h transcode.h pwg-private.h ../cups/cups.h ppd-private.h
|
||||
localize.32.o: localize.c debug.h
|
||||
mark.32.o: mark.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
mark.32.o: mark.c string.h ../config.h debug.h pwgmedia.h
|
||||
mark.32.o: mark.c string.h ../config.h debug.h pwg-private.h ../cups/cups.h
|
||||
md5.32.o: md5.c md5.h string.h ../config.h
|
||||
md5passwd.32.o: md5passwd.c http-private.h ../config.h http.h versioning.h md5.h
|
||||
md5passwd.32.o: md5passwd.c ipp-private.h ipp.h string.h
|
||||
notify.32.o: notify.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
notify.32.o: notify.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
notify.32.o: notify.c i18n.h transcode.h
|
||||
notify.32.o: notify.c i18n.h transcode.h pwg-private.h ../cups/cups.h
|
||||
options.32.o: options.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
options.32.o: options.c string.h ../config.h debug.h
|
||||
page.32.o: page.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
|
||||
ppd.32.o: ppd.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
ppd.32.o: ppd.c language.h globals.h string.h ../config.h http-private.h md5.h
|
||||
ppd.32.o: ppd.c ipp-private.h i18n.h transcode.h debug.h
|
||||
pwgmedia.32.o: pwgmedia.c pwgmedia.h globals.h string.h ../config.h http-private.h http.h
|
||||
pwgmedia.32.o: pwgmedia.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
pwgmedia.32.o: pwgmedia.c file.h language.h i18n.h transcode.h debug.h
|
||||
ppd.32.o: ppd.c language.h pwg-private.h ../cups/cups.h globals.h string.h ../config.h
|
||||
ppd.32.o: ppd.c http-private.h md5.h ipp-private.h i18n.h transcode.h debug.h
|
||||
pwg-file.32.o: pwg-file.c pwg-private.h ../cups/cups.h globals.h string.h ../config.h
|
||||
pwg-file.32.o: pwg-file.c http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
|
||||
pwg-file.32.o: pwg-file.c cups.h ppd.h array.h file.h language.h i18n.h transcode.h debug.h
|
||||
pwg-media.32.o: pwg-media.c pwg-private.h ../cups/cups.h globals.h string.h ../config.h
|
||||
pwg-media.32.o: pwg-media.c http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
|
||||
pwg-media.32.o: pwg-media.c cups.h ppd.h array.h file.h language.h i18n.h transcode.h
|
||||
pwg-media.32.o: pwg-media.c debug.h
|
||||
pwg-ppd.32.o: pwg-ppd.c pwg-private.h ../cups/cups.h globals.h string.h ../config.h
|
||||
pwg-ppd.32.o: pwg-ppd.c http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
|
||||
pwg-ppd.32.o: pwg-ppd.c cups.h ppd.h array.h file.h language.h i18n.h transcode.h debug.h
|
||||
request.32.o: request.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
request.32.o: request.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
request.32.o: request.c i18n.h transcode.h debug.h
|
||||
request.32.o: request.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
sidechannel.32.o: sidechannel.c sidechannel.h versioning.h string.h ../config.h debug.h
|
||||
snmp.32.o: snmp.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
snmp.32.o: snmp.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
snmp.32.o: snmp.c i18n.h transcode.h debug.h snmp-private.h
|
||||
snmp.32.o: snmp.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
snmp.32.o: snmp.c snmp-private.h
|
||||
snprintf.32.o: snprintf.c string.h ../config.h
|
||||
string.32.o: string.c array.h versioning.h debug.h string.h ../config.h
|
||||
tempfile.32.o: tempfile.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
tempfile.32.o: tempfile.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
tempfile.32.o: tempfile.c i18n.h transcode.h debug.h
|
||||
tempfile.32.o: tempfile.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
transcode.32.o: transcode.c globals.h string.h ../config.h http-private.h http.h
|
||||
transcode.32.o: transcode.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
transcode.32.o: transcode.c file.h language.h i18n.h transcode.h debug.h
|
||||
transcode.32.o: transcode.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
transcode.32.o: transcode.c ../cups/cups.h debug.h
|
||||
usersys.32.o: usersys.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
usersys.32.o: usersys.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
|
||||
usersys.32.o: usersys.c i18n.h transcode.h debug.h
|
||||
usersys.32.o: usersys.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
util.32.o: util.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
util.32.o: util.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
util.32.o: util.c i18n.h transcode.h debug.h
|
||||
util.32.o: util.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
testadmin.32.o: testadmin.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
|
||||
testadmin.32.o: testadmin.c file.h language.h string.h ../config.h
|
||||
testarray.32.o: testarray.c ../cups/string.h ../config.h string.h array.h versioning.h dir.h
|
||||
@@ -259,119 +297,138 @@ testoptions.32.o: testoptions.c string.h ../config.h cups.h ipp.h http.h versio
|
||||
testoptions.32.o: testoptions.c array.h file.h language.h
|
||||
testlang.32.o: testlang.c i18n.h transcode.h language.h array.h versioning.h string.h
|
||||
testlang.32.o: testlang.c ../config.h
|
||||
testppd.32.o: testppd.c ../cups/string.h ../config.h string.h cups.h ipp.h http.h
|
||||
testppd.32.o: testppd.c versioning.h ppd.h array.h file.h language.h pwgmedia.h
|
||||
testppd.32.o: testppd.c ../cups/cups.h ../cups/string.h ../config.h string.h
|
||||
testpwg.32.o: testpwg.c pwg-private.h ../cups/cups.h
|
||||
testsnmp.32.o: testsnmp.c string.h ../config.h snmp-private.h http.h versioning.h
|
||||
# DO NOT DELETE
|
||||
|
||||
adminutil.64.o: adminutil.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
|
||||
adminutil.64.o: adminutil.c file.h language.h globals.h string.h ../config.h http-private.h
|
||||
adminutil.64.o: adminutil.c md5.h ipp-private.h i18n.h transcode.h debug.h
|
||||
adminutil.64.o: adminutil.c md5.h ipp-private.h i18n.h transcode.h pwg-private.h
|
||||
adminutil.64.o: adminutil.c ../cups/cups.h debug.h
|
||||
array.64.o: array.c array.h versioning.h string.h ../config.h debug.h
|
||||
attr.64.o: attr.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
attr.64.o: attr.c language.h debug.h string.h ../config.h
|
||||
auth.64.o: auth.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
auth.64.o: auth.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
auth.64.o: auth.c i18n.h transcode.h debug.h
|
||||
auth.64.o: auth.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
backchannel.64.o: backchannel.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
backchannel.64.o: backchannel.c language.h
|
||||
backend.64.o: backend.c backend.h versioning.h globals.h string.h ../config.h
|
||||
backend.64.o: backend.c http-private.h http.h md5.h ipp-private.h ipp.h cups.h ppd.h
|
||||
backend.64.o: backend.c array.h file.h language.h i18n.h transcode.h
|
||||
backend.64.o: backend.c array.h file.h language.h i18n.h transcode.h pwg-private.h
|
||||
backend.64.o: backend.c ../cups/cups.h
|
||||
conflicts.64.o: conflicts.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h
|
||||
conflicts.64.o: conflicts.c file.h language.h string.h ../config.h debug.h
|
||||
custom.64.o: custom.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
custom.64.o: custom.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
custom.64.o: custom.c i18n.h transcode.h debug.h
|
||||
custom.64.o: custom.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
debug.64.o: debug.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
debug.64.o: debug.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
debug.64.o: debug.c i18n.h transcode.h debug.h
|
||||
debug.64.o: debug.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
dest.64.o: dest.c debug.h globals.h string.h ../config.h http-private.h http.h
|
||||
dest.64.o: dest.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h
|
||||
dest.64.o: dest.c language.h i18n.h transcode.h pwgmedia.h
|
||||
dest.64.o: dest.c language.h i18n.h transcode.h pwg-private.h ../cups/cups.h
|
||||
dir.64.o: dir.c dir.h versioning.h string.h ../config.h debug.h
|
||||
emit.64.o: emit.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
|
||||
encode.64.o: encode.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
encode.64.o: encode.c ipp-private.h string.h ../config.h debug.h
|
||||
file.64.o: file.c file-private.h http-private.h ../config.h http.h versioning.h md5.h
|
||||
file.64.o: file.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h file.h
|
||||
file.64.o: file.c language.h i18n.h transcode.h debug.h
|
||||
file.64.o: file.c language.h i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
getdevices.64.o: getdevices.c globals.h string.h ../config.h http-private.h http.h
|
||||
getdevices.64.o: getdevices.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
getdevices.64.o: getdevices.c file.h language.h i18n.h transcode.h debug.h
|
||||
getdevices.64.o: getdevices.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
getdevices.64.o: getdevices.c ../cups/cups.h debug.h
|
||||
getifaddrs.64.o: getifaddrs.c http-private.h ../config.h http.h versioning.h md5.h
|
||||
getifaddrs.64.o: getifaddrs.c ipp-private.h ipp.h
|
||||
getputfile.64.o: getputfile.c globals.h string.h ../config.h http-private.h http.h
|
||||
getputfile.64.o: getputfile.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
getputfile.64.o: getputfile.c file.h language.h i18n.h transcode.h debug.h
|
||||
getputfile.64.o: getputfile.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
getputfile.64.o: getputfile.c ../cups/cups.h debug.h
|
||||
globals.64.o: globals.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
globals.64.o: globals.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
|
||||
globals.64.o: globals.c i18n.h transcode.h
|
||||
globals.64.o: globals.c i18n.h transcode.h pwg-private.h ../cups/cups.h
|
||||
http.64.o: http.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
http.64.o: http.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
|
||||
http.64.o: http.c i18n.h transcode.h debug.h
|
||||
http.64.o: http.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
http-addr.64.o: http-addr.c http-private.h ../config.h http.h versioning.h md5.h
|
||||
http-addr.64.o: http-addr.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
|
||||
http-addr.64.o: http-addr.c file.h language.h i18n.h transcode.h debug.h
|
||||
http-addr.64.o: http-addr.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
http-addr.64.o: http-addr.c ../cups/cups.h debug.h
|
||||
http-addrlist.64.o: http-addrlist.c http-private.h ../config.h http.h versioning.h md5.h
|
||||
http-addrlist.64.o: http-addrlist.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
|
||||
http-addrlist.64.o: http-addrlist.c file.h language.h i18n.h transcode.h debug.h
|
||||
http-addrlist.64.o: http-addrlist.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
http-addrlist.64.o: http-addrlist.c ../cups/cups.h debug.h
|
||||
http-support.64.o: http-support.c debug.h globals.h string.h ../config.h http-private.h http.h
|
||||
http-support.64.o: http-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
http-support.64.o: http-support.c file.h language.h i18n.h transcode.h
|
||||
http-support.64.o: http-support.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
http-support.64.o: http-support.c ../cups/cups.h
|
||||
ipp.64.o: ipp.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
ipp.64.o: ipp.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h i18n.h
|
||||
ipp.64.o: ipp.c transcode.h debug.h
|
||||
ipp.64.o: ipp.c transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
ipp-support.64.o: ipp-support.c globals.h string.h ../config.h http-private.h http.h
|
||||
ipp-support.64.o: ipp-support.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
ipp-support.64.o: ipp-support.c file.h language.h i18n.h transcode.h debug.h
|
||||
ipp-support.64.o: ipp-support.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
ipp-support.64.o: ipp-support.c ../cups/cups.h debug.h
|
||||
langprintf.64.o: langprintf.c globals.h string.h ../config.h http-private.h http.h
|
||||
langprintf.64.o: langprintf.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
langprintf.64.o: langprintf.c file.h language.h i18n.h transcode.h
|
||||
langprintf.64.o: langprintf.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
langprintf.64.o: langprintf.c ../cups/cups.h
|
||||
language.64.o: language.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
language.64.o: language.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
language.64.o: language.c i18n.h transcode.h debug.h
|
||||
language.64.o: language.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
localize.64.o: localize.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
localize.64.o: localize.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
localize.64.o: localize.c i18n.h transcode.h ppd-private.h debug.h
|
||||
localize.64.o: localize.c i18n.h transcode.h pwg-private.h ../cups/cups.h ppd-private.h
|
||||
localize.64.o: localize.c debug.h
|
||||
mark.64.o: mark.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
mark.64.o: mark.c string.h ../config.h debug.h pwgmedia.h
|
||||
mark.64.o: mark.c string.h ../config.h debug.h pwg-private.h ../cups/cups.h
|
||||
md5.64.o: md5.c md5.h string.h ../config.h
|
||||
md5passwd.64.o: md5passwd.c http-private.h ../config.h http.h versioning.h md5.h
|
||||
md5passwd.64.o: md5passwd.c ipp-private.h ipp.h string.h
|
||||
notify.64.o: notify.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
notify.64.o: notify.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
notify.64.o: notify.c i18n.h transcode.h
|
||||
notify.64.o: notify.c i18n.h transcode.h pwg-private.h ../cups/cups.h
|
||||
options.64.o: options.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
|
||||
options.64.o: options.c string.h ../config.h debug.h
|
||||
page.64.o: page.c ppd.h array.h versioning.h file.h string.h ../config.h debug.h
|
||||
ppd.64.o: ppd.c ppd-private.h cups.h ipp.h http.h versioning.h ppd.h array.h file.h
|
||||
ppd.64.o: ppd.c language.h globals.h string.h ../config.h http-private.h md5.h
|
||||
ppd.64.o: ppd.c ipp-private.h i18n.h transcode.h debug.h
|
||||
pwgmedia.64.o: pwgmedia.c pwgmedia.h globals.h string.h ../config.h http-private.h http.h
|
||||
pwgmedia.64.o: pwgmedia.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
pwgmedia.64.o: pwgmedia.c file.h language.h i18n.h transcode.h debug.h
|
||||
ppd.64.o: ppd.c language.h pwg-private.h ../cups/cups.h globals.h string.h ../config.h
|
||||
ppd.64.o: ppd.c http-private.h md5.h ipp-private.h i18n.h transcode.h debug.h
|
||||
pwg-file.64.o: pwg-file.c pwg-private.h ../cups/cups.h globals.h string.h ../config.h
|
||||
pwg-file.64.o: pwg-file.c http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
|
||||
pwg-file.64.o: pwg-file.c cups.h ppd.h array.h file.h language.h i18n.h transcode.h debug.h
|
||||
pwg-media.64.o: pwg-media.c pwg-private.h ../cups/cups.h globals.h string.h ../config.h
|
||||
pwg-media.64.o: pwg-media.c http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
|
||||
pwg-media.64.o: pwg-media.c cups.h ppd.h array.h file.h language.h i18n.h transcode.h
|
||||
pwg-media.64.o: pwg-media.c debug.h
|
||||
pwg-ppd.64.o: pwg-ppd.c pwg-private.h ../cups/cups.h globals.h string.h ../config.h
|
||||
pwg-ppd.64.o: pwg-ppd.c http-private.h http.h versioning.h md5.h ipp-private.h ipp.h
|
||||
pwg-ppd.64.o: pwg-ppd.c cups.h ppd.h array.h file.h language.h i18n.h transcode.h debug.h
|
||||
request.64.o: request.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
request.64.o: request.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
request.64.o: request.c i18n.h transcode.h debug.h
|
||||
request.64.o: request.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
sidechannel.64.o: sidechannel.c sidechannel.h versioning.h string.h ../config.h debug.h
|
||||
snmp.64.o: snmp.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
snmp.64.o: snmp.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
snmp.64.o: snmp.c i18n.h transcode.h debug.h snmp-private.h
|
||||
snmp.64.o: snmp.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
snmp.64.o: snmp.c snmp-private.h
|
||||
snprintf.64.o: snprintf.c string.h ../config.h
|
||||
string.64.o: string.c array.h versioning.h debug.h string.h ../config.h
|
||||
tempfile.64.o: tempfile.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
tempfile.64.o: tempfile.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
tempfile.64.o: tempfile.c i18n.h transcode.h debug.h
|
||||
tempfile.64.o: tempfile.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
transcode.64.o: transcode.c globals.h string.h ../config.h http-private.h http.h
|
||||
transcode.64.o: transcode.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
|
||||
transcode.64.o: transcode.c file.h language.h i18n.h transcode.h debug.h
|
||||
transcode.64.o: transcode.c file.h language.h i18n.h transcode.h pwg-private.h
|
||||
transcode.64.o: transcode.c ../cups/cups.h debug.h
|
||||
usersys.64.o: usersys.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
|
||||
usersys.64.o: usersys.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
|
||||
usersys.64.o: usersys.c i18n.h transcode.h debug.h
|
||||
usersys.64.o: usersys.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
util.64.o: util.c globals.h string.h ../config.h http-private.h http.h versioning.h
|
||||
util.64.o: util.c md5.h ipp-private.h ipp.h cups.h ppd.h array.h file.h language.h
|
||||
util.64.o: util.c i18n.h transcode.h debug.h
|
||||
util.64.o: util.c i18n.h transcode.h pwg-private.h ../cups/cups.h debug.h
|
||||
testadmin.64.o: testadmin.c adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
|
||||
testadmin.64.o: testadmin.c file.h language.h string.h ../config.h
|
||||
testarray.64.o: testarray.c ../cups/string.h ../config.h string.h array.h versioning.h dir.h
|
||||
@@ -391,6 +448,6 @@ testoptions.64.o: testoptions.c string.h ../config.h cups.h ipp.h http.h versio
|
||||
testoptions.64.o: testoptions.c array.h file.h language.h
|
||||
testlang.64.o: testlang.c i18n.h transcode.h language.h array.h versioning.h string.h
|
||||
testlang.64.o: testlang.c ../config.h
|
||||
testppd.64.o: testppd.c ../cups/string.h ../config.h string.h cups.h ipp.h http.h
|
||||
testppd.64.o: testppd.c versioning.h ppd.h array.h file.h language.h pwgmedia.h
|
||||
testppd.64.o: testppd.c ../cups/cups.h ../cups/string.h ../config.h string.h
|
||||
testpwg.64.o: testpwg.c pwg-private.h ../cups/cups.h
|
||||
testsnmp.64.o: testsnmp.c string.h ../config.h snmp-private.h http.h versioning.h
|
||||
|
||||
+20
-29
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# API library Makefile for the Common UNIX Printing System (CUPS).
|
||||
# API library Makefile for CUPS.
|
||||
#
|
||||
# Copyright 2007-2009 by Apple Inc.
|
||||
# Copyright 2007-2010 by Apple Inc.
|
||||
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -56,7 +56,9 @@ LIBOBJS = \
|
||||
options.o \
|
||||
page.o \
|
||||
ppd.o \
|
||||
pwgmedia.o \
|
||||
pwg-file.o \
|
||||
pwg-media.o \
|
||||
pwg-ppd.o \
|
||||
request.o \
|
||||
sidechannel.o \
|
||||
snmp.o \
|
||||
@@ -83,8 +85,8 @@ OBJS = \
|
||||
testoptions.o \
|
||||
testlang.o \
|
||||
testppd.o \
|
||||
testsnmp.o \
|
||||
php_cups_wrap.o
|
||||
testpwg.o \
|
||||
testsnmp.o
|
||||
|
||||
|
||||
#
|
||||
@@ -130,6 +132,7 @@ UNITTARGETS = \
|
||||
testlang \
|
||||
testoptions \
|
||||
testppd \
|
||||
testpwg \
|
||||
testsnmp
|
||||
|
||||
TARGETS = \
|
||||
@@ -375,30 +378,6 @@ libcups.a: $(LIBOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
|
||||
#
|
||||
# CUPS language bindings for various scripting languages...
|
||||
#
|
||||
# NOTE: Not currently used or functional - see the scripting/php directory
|
||||
# for the hand-written bindings...
|
||||
#
|
||||
|
||||
phpcups.so: $(LIBCUPS) php_cups_wrap.o
|
||||
echo Linking $@...
|
||||
if test `uname` = Darwin; then \
|
||||
DSOFLAGS="-bundle -flat_namespace -undefined suppress"; \
|
||||
else \
|
||||
DSOFLAGS="$(DSOFLAGS)"; \
|
||||
fi; \
|
||||
$(DSO) $$DSOFLAGS -o $@ php_cups_wrap.o $(LIBS) `php-config --ldflags --libs`
|
||||
|
||||
php_cups_wrap.o: php_cups_wrap.c
|
||||
echo Compiling $<...
|
||||
$(CC) $(CFLAGS) `php-config --includes` -c $<
|
||||
php_cups_wrap.c: cups.h
|
||||
echo Creating $< using SWIG...
|
||||
swig -php -o $@ -module cups cups.h
|
||||
|
||||
|
||||
#
|
||||
# testadmin (dependency on static CUPS library is intentional)
|
||||
#
|
||||
@@ -525,6 +504,18 @@ testppd: testppd.o libcups.a test.ppd test2.ppd
|
||||
./testppd
|
||||
|
||||
|
||||
#
|
||||
# testpwg (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testpwg: testpwg.o libcups.a test.ppd
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testpwg.o libcups.a \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
echo Running PWG API tests...
|
||||
./testpwg test.ppd
|
||||
|
||||
|
||||
#
|
||||
# testsnmp (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
+121
-116
@@ -4,7 +4,7 @@
|
||||
* Administration utility API definitions for the Common UNIX Printing
|
||||
* System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2001-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -17,16 +17,14 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsAdminCreateWindowsPPD() - Create the Windows PPD file for a printer.
|
||||
* cupsAdminExportSamba() - Export a printer to Samba.
|
||||
* cupsAdminGetServerSettings() - Get settings from the server.
|
||||
* _cupsAdminGetServerSettings() - Get settings from the server (private).
|
||||
* cupsAdminSetServerSettings() - Set settings on the server.
|
||||
* _cupsAdminSetServerSettings() - Set settings on the server (private).
|
||||
* do_samba_command() - Do a SAMBA command.
|
||||
* get_cupsd_conf() - Get the current cupsd.conf file.
|
||||
* invalidate_cupsd_cache() - Invalidate the cached cupsd.conf settings.
|
||||
* write_option() - Write a CUPS option to a PPD file.
|
||||
* cupsAdminCreateWindowsPPD() - Create the Windows PPD file for a printer.
|
||||
* cupsAdminExportSamba() - Export a printer to Samba.
|
||||
* cupsAdminGetServerSettings() - Get settings from the server.
|
||||
* cupsAdminSetServerSettings() - Set settings on the server.
|
||||
* do_samba_command() - Do a SAMBA command.
|
||||
* get_cupsd_conf() - Get the current cupsd.conf file.
|
||||
* invalidate_cupsd_cache() - Invalidate the cached cupsd.conf settings.
|
||||
* write_option() - Write a CUPS option to a PPD file.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -50,12 +48,6 @@
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
extern int _cupsAdminGetServerSettings(http_t *http,
|
||||
int *num_settings,
|
||||
cups_option_t **settings);
|
||||
extern int _cupsAdminSetServerSettings(http_t *http,
|
||||
int num_settings,
|
||||
cups_option_t *settings);
|
||||
static int do_samba_command(const char *command,
|
||||
const char *address,
|
||||
const char *subcommand,
|
||||
@@ -243,7 +235,7 @@ cupsAdminCreateWindowsPPD(
|
||||
}
|
||||
else if (jcloption && !strncmp(line, "*OrderDependency:", 17))
|
||||
{
|
||||
for (ptr = line + 17; *ptr && isspace(*ptr & 255); ptr ++);
|
||||
for (ptr = line + 17; _cups_isspace(*ptr); ptr ++);
|
||||
|
||||
ptr = strchr(ptr, ' ');
|
||||
|
||||
@@ -862,25 +854,6 @@ cupsAdminGetServerSettings(
|
||||
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
|
||||
int *num_settings, /* O - Number of settings */
|
||||
cups_option_t **settings) /* O - Settings */
|
||||
{
|
||||
return (_cupsAdminGetServerSettings(http, num_settings, settings));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsAdminGetServerSettings()' - Get settings from the server.
|
||||
*
|
||||
* The returned settings should be freed with cupsFreeOptions() when
|
||||
* you are done with them.
|
||||
*
|
||||
* @since CUPS 1.2@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
_cupsAdminGetServerSettings(
|
||||
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
|
||||
int *num_settings, /* O - Number of settings */
|
||||
cups_option_t **settings) /* O - Settings */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
cups_file_t *cupsd; /* cupsd.conf file */
|
||||
@@ -1043,7 +1016,7 @@ _cupsAdminGetServerSettings(
|
||||
&& *value != '/'
|
||||
#endif /* AF_LOCAL */
|
||||
#ifdef AF_INET6
|
||||
&& strcmp(value, "::1")
|
||||
&& strcmp(value, "[::1]")
|
||||
#endif /* AF_INET6 */
|
||||
)
|
||||
remote_access = 1;
|
||||
@@ -1088,7 +1061,7 @@ _cupsAdminGetServerSettings(
|
||||
|
||||
while (*value)
|
||||
{
|
||||
for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
|
||||
for (valptr = value; *valptr && !_cups_isspace(*valptr); valptr ++);
|
||||
|
||||
if (*valptr)
|
||||
*valptr++ = '\0';
|
||||
@@ -1099,7 +1072,7 @@ _cupsAdminGetServerSettings(
|
||||
break;
|
||||
}
|
||||
|
||||
for (value = valptr; isspace(*value & 255); value ++);
|
||||
for (value = valptr; _cups_isspace(*value); value ++);
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(line, "</Limit>"))
|
||||
@@ -1213,22 +1186,6 @@ cupsAdminSetServerSettings(
|
||||
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
|
||||
int num_settings, /* I - Number of settings */
|
||||
cups_option_t *settings) /* I - Settings */
|
||||
{
|
||||
return (_cupsAdminSetServerSettings(http, num_settings, settings));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsAdminSetServerSettings()' - Set settings on the server.
|
||||
*
|
||||
* @since CUPS 1.2@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
_cupsAdminSetServerSettings(
|
||||
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
|
||||
int num_settings, /* I - Number of settings */
|
||||
cups_option_t *settings) /* I - Settings */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
http_status_t status; /* GET/PUT status */
|
||||
@@ -1309,8 +1266,8 @@ _cupsAdminSetServerSettings(
|
||||
* Get current settings...
|
||||
*/
|
||||
|
||||
if (!_cupsAdminGetServerSettings(http, &cupsd_num_settings,
|
||||
&cupsd_settings))
|
||||
if (!cupsAdminGetServerSettings(http, &cupsd_num_settings,
|
||||
&cupsd_settings))
|
||||
return (0);
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_DEBUG_LOGGING, cupsd_num_settings,
|
||||
@@ -1319,36 +1276,54 @@ _cupsAdminSetServerSettings(
|
||||
else
|
||||
old_debug_logging = 0;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: old debug_logging=%d",
|
||||
old_debug_logging));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ADMIN, cupsd_num_settings,
|
||||
cupsd_settings)) != NULL)
|
||||
old_remote_admin = atoi(val);
|
||||
else
|
||||
old_remote_admin = 0;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: old remote_admin=%d",
|
||||
old_remote_admin));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ANY, cupsd_num_settings,
|
||||
cupsd_settings)) != NULL)
|
||||
remote_any = atoi(val);
|
||||
else
|
||||
remote_any = 0;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: old remote_any=%d",
|
||||
remote_any));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_PRINTERS, cupsd_num_settings,
|
||||
cupsd_settings)) != NULL)
|
||||
old_remote_printers = atoi(val);
|
||||
else
|
||||
old_remote_printers = 1;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: old remote_printers=%d",
|
||||
old_remote_printers));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_SHARE_PRINTERS, cupsd_num_settings,
|
||||
cupsd_settings)) != NULL)
|
||||
old_share_printers = atoi(val);
|
||||
else
|
||||
old_share_printers = 0;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: old share_printers=%d",
|
||||
old_share_printers));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY, cupsd_num_settings,
|
||||
cupsd_settings)) != NULL)
|
||||
old_user_cancel_any = atoi(val);
|
||||
else
|
||||
old_user_cancel_any = 0;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: old user_cancel_any=%d",
|
||||
old_user_cancel_any));
|
||||
|
||||
cupsFreeOptions(cupsd_num_settings, cupsd_settings);
|
||||
|
||||
/*
|
||||
@@ -1372,16 +1347,22 @@ _cupsAdminSetServerSettings(
|
||||
else
|
||||
debug_logging = -1;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: debug_logging=%d",
|
||||
debug_logging));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ANY, num_settings,
|
||||
settings)) != NULL)
|
||||
remote_any = atoi(val);
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: remote_any=%d",
|
||||
remote_any));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ADMIN, num_settings,
|
||||
settings)) != NULL)
|
||||
{
|
||||
remote_admin = atoi(val);
|
||||
|
||||
if (remote_admin == old_remote_admin && remote_any < 0)
|
||||
if (remote_admin == old_remote_admin)
|
||||
{
|
||||
/*
|
||||
* No change to this setting...
|
||||
@@ -1393,6 +1374,9 @@ _cupsAdminSetServerSettings(
|
||||
else
|
||||
remote_admin = -1;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: remote_admin=%d",
|
||||
remote_admin));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_PRINTERS, num_settings,
|
||||
settings)) != NULL)
|
||||
{
|
||||
@@ -1410,12 +1394,15 @@ _cupsAdminSetServerSettings(
|
||||
else
|
||||
remote_printers = -1;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: remote_printers=%d",
|
||||
remote_printers));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_SHARE_PRINTERS, num_settings,
|
||||
settings)) != NULL)
|
||||
{
|
||||
share_printers = atoi(val);
|
||||
|
||||
if (share_printers == old_share_printers && remote_any < 0)
|
||||
if (share_printers == old_share_printers)
|
||||
{
|
||||
/*
|
||||
* No change to this setting...
|
||||
@@ -1427,6 +1414,9 @@ _cupsAdminSetServerSettings(
|
||||
else
|
||||
share_printers = -1;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: share_printers=%d",
|
||||
share_printers));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_USER_CANCEL_ANY, num_settings,
|
||||
settings)) != NULL)
|
||||
{
|
||||
@@ -1444,6 +1434,9 @@ _cupsAdminSetServerSettings(
|
||||
else
|
||||
user_cancel_any = -1;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: user_cancel_any=%d",
|
||||
user_cancel_any));
|
||||
|
||||
/*
|
||||
* Create a temporary file for the new cupsd.conf file...
|
||||
*/
|
||||
@@ -1495,13 +1488,13 @@ _cupsAdminSetServerSettings(
|
||||
while (cupsFileGetConf(cupsd, line, sizeof(line), &value, &linenum))
|
||||
{
|
||||
if ((!strcasecmp(line, "Port") || !strcasecmp(line, "Listen")) &&
|
||||
(share_printers >= 0 || remote_admin >= 0))
|
||||
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
|
||||
{
|
||||
if (!wrote_port_listen)
|
||||
{
|
||||
wrote_port_listen = 1;
|
||||
|
||||
if (share_printers > 0 || remote_admin > 0)
|
||||
if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
|
||||
{
|
||||
cupsFilePuts(temp, "# Allow remote access\n");
|
||||
cupsFilePrintf(temp, "Port %d\n", server_port);
|
||||
@@ -1709,7 +1702,8 @@ _cupsAdminSetServerSettings(
|
||||
cupsFilePrintf(temp, " Allow %s\n",
|
||||
remote_any > 0 ? "all" : "@LOCAL");
|
||||
}
|
||||
else if (in_root_location && (remote_admin >= 0 || share_printers >= 0))
|
||||
else if (in_root_location &&
|
||||
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
|
||||
{
|
||||
wrote_root_location = 1;
|
||||
|
||||
@@ -1720,12 +1714,14 @@ _cupsAdminSetServerSettings(
|
||||
cupsFilePuts(temp, " # Allow remote administration...\n");
|
||||
else if (share_printers > 0)
|
||||
cupsFilePuts(temp, " # Allow shared printing...\n");
|
||||
else if (remote_any > 0)
|
||||
cupsFilePuts(temp, " # Allow remote access...\n");
|
||||
else
|
||||
cupsFilePuts(temp, " # Restrict access to the server...\n");
|
||||
|
||||
cupsFilePuts(temp, " Order allow,deny\n");
|
||||
|
||||
if (remote_admin > 0 || share_printers > 0)
|
||||
if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
|
||||
cupsFilePrintf(temp, " Allow %s\n",
|
||||
remote_any > 0 ? "all" : "@LOCAL");
|
||||
}
|
||||
@@ -1736,83 +1732,86 @@ _cupsAdminSetServerSettings(
|
||||
|
||||
cupsFilePuts(temp, "</Location>\n");
|
||||
}
|
||||
else if (!strcasecmp(line, "<Limit") && in_default_policy)
|
||||
else if (!strcasecmp(line, "<Limit"))
|
||||
{
|
||||
/*
|
||||
* See if the policy limit is for the Cancel-Job operation...
|
||||
*/
|
||||
|
||||
char *valptr; /* Pointer into value */
|
||||
|
||||
|
||||
indent += 2;
|
||||
|
||||
if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0)
|
||||
if (in_default_policy)
|
||||
{
|
||||
/*
|
||||
* Don't write anything for this limit section...
|
||||
* See if the policy limit is for the Cancel-Job operation...
|
||||
*/
|
||||
|
||||
in_cancel_job = 2;
|
||||
|
||||
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", line);
|
||||
cupsFilePrintf(temp, "%*s%s %s>\n", indent, "", line, value);
|
||||
|
||||
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");
|
||||
}
|
||||
indent += 2;
|
||||
}
|
||||
else if (!strcasecmp(line, "</Limit>") && in_cancel_job)
|
||||
{
|
||||
indent -= 2;
|
||||
|
||||
if (in_cancel_job == 1)
|
||||
cupsFilePuts(temp, " </Limit>\n");
|
||||
cupsFilePuts(temp, " </Limit>\n");
|
||||
|
||||
wrote_policy = 1;
|
||||
|
||||
if (!user_cancel_any)
|
||||
cupsFilePuts(temp, " # Only the owner or an administrator can cancel "
|
||||
"a job...\n"
|
||||
" <Limit Cancel-Job>\n"
|
||||
" Order deny,allow\n"
|
||||
" Require user @OWNER "
|
||||
"a job...\n"
|
||||
" <Limit Cancel-Job>\n"
|
||||
" Order deny,allow\n"
|
||||
" Require user @OWNER "
|
||||
CUPS_DEFAULT_PRINTOPERATOR_AUTH "\n"
|
||||
" </Limit>\n");
|
||||
|
||||
in_cancel_job = 0;
|
||||
}
|
||||
else if ((((in_admin_location || in_conf_location || in_root_location) &&
|
||||
remote_admin >= 0) ||
|
||||
(remote_admin >= 0 || remote_any > 0)) ||
|
||||
(in_root_location && share_printers >= 0)) &&
|
||||
(!strcasecmp(line, "Allow") || !strcasecmp(line, "Deny") ||
|
||||
!strcasecmp(line, "Order")))
|
||||
continue;
|
||||
else if (in_cancel_job == 2)
|
||||
continue;
|
||||
else if (!strcasecmp(line, "<Limit") && value)
|
||||
cupsFilePrintf(temp, " %s %s>\n", line, value);
|
||||
else if (line[0] == '<')
|
||||
{
|
||||
if (value)
|
||||
@@ -1852,7 +1851,7 @@ _cupsAdminSetServerSettings(
|
||||
/*
|
||||
* Record the non-policy, non-location directives that we find
|
||||
* in the server settings, since we cache this info and record it
|
||||
* in _cupsAdminGetServerSettings()...
|
||||
* in cupsAdminGetServerSettings()...
|
||||
*/
|
||||
|
||||
cupsd_num_settings = cupsAddOption(line, value, cupsd_num_settings,
|
||||
@@ -1910,9 +1909,10 @@ _cupsAdminSetServerSettings(
|
||||
}
|
||||
}
|
||||
|
||||
if (!wrote_port_listen && (share_printers >= 0 || remote_admin >= 0))
|
||||
if (!wrote_port_listen &&
|
||||
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
|
||||
{
|
||||
if (share_printers > 0 || remote_admin > 0)
|
||||
if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
|
||||
{
|
||||
cupsFilePuts(temp, "# Allow remote access\n");
|
||||
cupsFilePrintf(temp, "Port %d\n", ippPort());
|
||||
@@ -1930,7 +1930,8 @@ _cupsAdminSetServerSettings(
|
||||
#endif /* CUPS_DEFAULT_DOMAINSOCKET */
|
||||
}
|
||||
|
||||
if (!wrote_root_location && (remote_admin >= 0 || share_printers >= 0))
|
||||
if (!wrote_root_location &&
|
||||
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
|
||||
{
|
||||
if (remote_admin > 0 && share_printers > 0)
|
||||
cupsFilePuts(temp,
|
||||
@@ -1939,13 +1940,15 @@ _cupsAdminSetServerSettings(
|
||||
cupsFilePuts(temp, "# Allow remote administration...\n");
|
||||
else if (share_printers > 0)
|
||||
cupsFilePuts(temp, "# Allow shared printing...\n");
|
||||
else if (remote_any > 0)
|
||||
cupsFilePuts(temp, "# Allow remote access...\n");
|
||||
else
|
||||
cupsFilePuts(temp, "# Restrict access to the server...\n");
|
||||
|
||||
cupsFilePuts(temp, "<Location />\n"
|
||||
" Order allow,deny\n");
|
||||
|
||||
if (remote_admin > 0 || share_printers > 0)
|
||||
if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
|
||||
cupsFilePrintf(temp, " Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
|
||||
|
||||
cupsFilePuts(temp, "</Location>\n");
|
||||
@@ -2034,6 +2037,8 @@ _cupsAdminSetServerSettings(
|
||||
|
||||
for (i = num_settings, setting = settings; i > 0; i --, setting ++)
|
||||
if (setting->name[0] != '_' &&
|
||||
strcasecmp(setting->name, "Listen") &&
|
||||
strcasecmp(setting->name, "Port") &&
|
||||
!cupsGetOption(setting->name, cupsd_num_settings, cupsd_settings))
|
||||
{
|
||||
/*
|
||||
|
||||
+2
-6
@@ -1,13 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Administration utility API definitions for the Common UNIX Printing
|
||||
* System (CUPS).
|
||||
* Administration utility API definitions for CUPS.
|
||||
*
|
||||
* MANY OF THE FUNCTIONS IN THIS HEADER ARE PRIVATE AND SUBJECT TO
|
||||
* CHANGE AT ANY TIME. USE AT YOUR OWN RISK.
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 2001-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-array.shtml 7616 2008-05-28 00:34:13Z mike $"
|
||||
"$Id: api-array.shtml 9728 2011-04-28 21:21:24Z mike $"
|
||||
|
||||
Array API introduction for the Common UNIX Printing System (CUPS).
|
||||
Array API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2008 by Apple Inc.
|
||||
Copyright 2007-2011 by Apple Inc.
|
||||
Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-cups.shtml 7337 2008-02-22 04:44:04Z mike $"
|
||||
"$Id: api-cups.shtml 9728 2011-04-28 21:21:24Z mike $"
|
||||
|
||||
CUPS API introduction for the Common UNIX Printing System (CUPS).
|
||||
API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2008 by Apple Inc.
|
||||
Copyright 2007-2011 by Apple Inc.
|
||||
Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
@@ -50,7 +50,7 @@ specific destination for printing:</p>
|
||||
int num_dests = <a href='#cupsGetDests'>cupsGetDests</a>(&dests);
|
||||
<a href='#cups_dest_t'>cups_dest_t</a> *dest = <a href='#cupsGetDest'>cupsGetDest</a>("name", NULL, num_dests, dests);
|
||||
|
||||
/* do something wiith dest */
|
||||
/* do something with dest */
|
||||
|
||||
<a href='#cupsFreeDests'>cupsFreeDests</a>(num_dests, dests);
|
||||
</pre>
|
||||
@@ -82,12 +82,13 @@ instance will return the default instance for that destination.</p>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"printer-is-accepting-jobs"</td>
|
||||
<td>"1" if the destination is accepting new jobs, "0" if not.</td>
|
||||
<td>"true" if the destination is accepting new jobs, "false" if
|
||||
not.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"printer-is-shared"</td>
|
||||
<td>"1" if the destination is being shared with other computers, "0" if
|
||||
not.</td>
|
||||
<td>"true" if the destination is being shared with other computers,
|
||||
"false" if not.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"printer-location"</td>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-filedir.shtml 7279 2008-01-31 01:50:44Z mike $"
|
||||
"$Id: api-filedir.shtml 9728 2011-04-28 21:21:24Z mike $"
|
||||
|
||||
File and directory API introduction for the Common UNIX Printing System (CUPS).
|
||||
File and directory API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2008 by Apple Inc.
|
||||
Copyright 2007-2011 by Apple Inc.
|
||||
Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
"$Id: api-filter.header 8673 2009-05-22 17:34:15Z mike $"
|
||||
"$Id: api-filter.header 9272 2010-08-27 16:51:43Z mike $"
|
||||
|
||||
Filter and backend programming header for the Common UNIX Printing System
|
||||
(CUPS).
|
||||
@@ -36,7 +36,7 @@
|
||||
Programming: <a href='api-raster.html' target='_top'>Raster API</a><br>
|
||||
Programming: <a href='postscript-driver.html' target='_top'>Developing PostScript Printer Drivers</a><br>
|
||||
Programming: <a href='raster-driver.html' target='_top'>Developing Raster Printer Drivers</a><br>
|
||||
Specifications: <a href='spec-design' target='_top'>CUPS Design Description</a></td>
|
||||
Specifications: <a href='spec-design.html' target='_top'>CUPS Design Description</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
|
||||
+10
-10
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
"$Id: api-filter.shtml 8718 2009-06-18 17:41:03Z mike $"
|
||||
"$Id: api-filter.shtml 9728 2011-04-28 21:21:24Z mike $"
|
||||
|
||||
Filter and backend programming introduction for the Common UNIX Printing
|
||||
System (CUPS).
|
||||
@@ -58,7 +58,7 @@ more detail.</p>
|
||||
<h3><a name="SECURITY">Security Considerations</a></h3>
|
||||
|
||||
<p>It is always important to use security programming practices. Filters and
|
||||
most backends are run as a non-priviledged user, so the major security
|
||||
most backends are run as a non-privileged user, so the major security
|
||||
consideration is resource utilization - filters should not depend on unlimited
|
||||
amounts of CPU, memory, or disk space, and should protect against conditions
|
||||
that could lead to excess usage of any resource like infinite loops and
|
||||
@@ -67,7 +67,7 @@ specify an arbitrary file path to a separator page, template, or other file
|
||||
used by the filter since that can lead to an unauthorized disclosure of
|
||||
information. <em>Always</em> treat input as suspect and validate it!</p>
|
||||
|
||||
<p>If you are developing a backend that runs as root , make sure to check for
|
||||
<p>If you are developing a backend that runs as root, make sure to check for
|
||||
potential buffer overflows, integer under/overflow conditions, and file
|
||||
accesses since these can lead to privilege escalations. When writing files,
|
||||
always validate the file path and <em>never</em> allow a user to determine
|
||||
@@ -88,15 +88,15 @@ Mac OS X, for example, no backend may write to a user's home directory.</p>
|
||||
<h3><a name="PERMISSIONS">File Permissions</a></h3>
|
||||
|
||||
<p>For security reasons, CUPS will only run filters and backends that are owned
|
||||
by root and do not have world write permissions. The recommended permissions for
|
||||
filters and backends are 0555 - read and execute but no write. Backends that
|
||||
must run as root should use permissions of 0500 - read and execute by root, no
|
||||
access for other users. Write permissions can be enabled for the root user
|
||||
only.</p>
|
||||
by root and do not have world or group write permissions. The recommended
|
||||
permissions for filters and backends are 0555 - read and execute but no write.
|
||||
Backends that must run as root should use permissions of 0500 - read and execute
|
||||
by root, no access for other users. Write permissions can be enabled for the
|
||||
root user only.</p>
|
||||
|
||||
<p>To avoid a warning message, the directory containing your filter(s) must also
|
||||
be owned by root and have world write disabled - permissions of 0755 or 0555 are
|
||||
strongly encouraged.</p>
|
||||
be owned by root and have world and group write disabled - permissions of 0755
|
||||
or 0555 are strongly encouraged.</p>
|
||||
|
||||
<h3><a name="TEMPFILES">Temporary Files</a></h3>
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-httpipp.shtml 7684 2008-06-23 16:47:38Z mike $"
|
||||
"$Id: api-httpipp.shtml 9728 2011-04-28 21:21:24Z mike $"
|
||||
|
||||
HTTP and IPP API introduction for the Common UNIX Printing System (CUPS).
|
||||
HTTP and IPP API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2008 by Apple Inc.
|
||||
Copyright 2007-2011 by Apple Inc.
|
||||
Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-cups.header 7279 2008-01-31 01:50:44Z mike $"
|
||||
|
||||
Introduction to CUPS programming content for the Common UNIX Printing System
|
||||
(CUPS).
|
||||
Introduction to CUPS programming content for CUPS.
|
||||
|
||||
Copyright 2008 by Apple Inc.
|
||||
Copyright 2008-2011 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
"$Id: api-ppd.shtml 7616 2008-05-28 00:34:13Z mike $"
|
||||
"$Id: api-ppd.shtml 9728 2011-04-28 21:21:24Z mike $"
|
||||
|
||||
PPD API introduction for the Common UNIX Printing System (CUPS).
|
||||
PPD API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2008 by Apple Inc.
|
||||
Copyright 2007-2011 by Apple Inc.
|
||||
Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
|
||||
+11
-9
@@ -4,7 +4,7 @@
|
||||
* PPD model-specific attribute routines for the Common UNIX Printing System
|
||||
* (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -15,8 +15,10 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* ppdFindAttr() - Find the first matching attribute.
|
||||
* ppdFindNextAttr() - Find the next matching attribute.
|
||||
* ppdFindAttr() - Find the first matching attribute.
|
||||
* ppdFindNextAttr() - Find the next matching attribute.
|
||||
* _ppdGet1284Values() - Get 1284 device ID keys and values.
|
||||
* _ppdNormalizeMakeAndModel() - Normalize a product/make-and-model string.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -178,7 +180,7 @@ _ppdGet1284Values(
|
||||
num_values = 0;
|
||||
while (*device_id)
|
||||
{
|
||||
while (isspace(*device_id & 255))
|
||||
while (_cups_isspace(*device_id))
|
||||
device_id ++;
|
||||
|
||||
if (!*device_id)
|
||||
@@ -191,13 +193,13 @@ _ppdGet1284Values(
|
||||
if (!*device_id)
|
||||
break;
|
||||
|
||||
while (ptr > key && isspace(ptr[-1] & 255))
|
||||
while (ptr > key && _cups_isspace(ptr[-1]))
|
||||
ptr --;
|
||||
|
||||
*ptr = '\0';
|
||||
device_id ++;
|
||||
|
||||
while (isspace(*device_id & 255))
|
||||
while (_cups_isspace(*device_id))
|
||||
device_id ++;
|
||||
|
||||
if (!*device_id)
|
||||
@@ -210,7 +212,7 @@ _ppdGet1284Values(
|
||||
if (!*device_id)
|
||||
break;
|
||||
|
||||
while (ptr > value && isspace(ptr[-1] & 255))
|
||||
while (ptr > value && _cups_isspace(ptr[-1]))
|
||||
ptr --;
|
||||
|
||||
*ptr = '\0';
|
||||
@@ -251,7 +253,7 @@ _ppdNormalizeMakeAndModel(
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*make_and_model & 255))
|
||||
while (_cups_isspace(*make_and_model))
|
||||
make_and_model ++;
|
||||
|
||||
/*
|
||||
@@ -406,7 +408,7 @@ _ppdNormalizeMakeAndModel(
|
||||
*/
|
||||
|
||||
for (bufptr = buffer + strlen(buffer) - 1;
|
||||
bufptr >= buffer && isspace(*bufptr & 255);
|
||||
bufptr >= buffer && _cups_isspace(*bufptr);
|
||||
bufptr --);
|
||||
|
||||
bufptr[1] = '\0';
|
||||
|
||||
+16
-15
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Authentication functions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* This file contains Kerberos support code, copyright 2006 by
|
||||
@@ -98,10 +98,6 @@ cupsDoAuthentication(
|
||||
|
||||
DEBUG_printf(("cupsDoAuthentication(http=%p, method=\"%s\", resource=\"%s\")",
|
||||
http, method, resource));
|
||||
DEBUG_printf(("2cupsDoAuthentication: digest_tries=%d, userpass=\"%s\"",
|
||||
http->digest_tries, http->userpass));
|
||||
DEBUG_printf(("2cupsDoAuthentication: WWW-Authenticate=\"%s\"",
|
||||
httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE)));
|
||||
|
||||
if (!http)
|
||||
http = _cupsConnect();
|
||||
@@ -109,6 +105,11 @@ cupsDoAuthentication(
|
||||
if (!http || !method || !resource)
|
||||
return (-1);
|
||||
|
||||
DEBUG_printf(("2cupsDoAuthentication: digest_tries=%d, userpass=\"%s\"",
|
||||
http->digest_tries, http->userpass));
|
||||
DEBUG_printf(("2cupsDoAuthentication: WWW-Authenticate=\"%s\"",
|
||||
httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE)));
|
||||
|
||||
/*
|
||||
* Clear the current authentication string...
|
||||
*/
|
||||
@@ -181,6 +182,15 @@ cupsDoAuthentication(
|
||||
else if (http->status == HTTP_UNAUTHORIZED)
|
||||
http->digest_tries ++;
|
||||
|
||||
if (http->status == HTTP_UNAUTHORIZED && http->digest_tries >= 3)
|
||||
{
|
||||
DEBUG_printf(("1cupsDoAuthentication: Too many authentication tries (%d)",
|
||||
http->digest_tries));
|
||||
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Got a password; encode it for the server...
|
||||
*/
|
||||
@@ -222,15 +232,6 @@ cupsDoAuthentication(
|
||||
}
|
||||
# endif /* __APPLE__ */
|
||||
|
||||
if (http->status == HTTP_UNAUTHORIZED && http->digest_tries >= 3)
|
||||
{
|
||||
DEBUG_printf(("1cupsDoAuthentication: too many Negotiate tries (%d)",
|
||||
http->digest_tries));
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (http->gssname == GSS_C_NO_NAME)
|
||||
{
|
||||
if ((gss_service_name = getenv("CUPS_GSSSERVICENAME")) == NULL)
|
||||
@@ -250,7 +251,7 @@ cupsDoAuthentication(
|
||||
authorization = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
|
||||
|
||||
authorization += 9;
|
||||
while (*authorization && isspace(*authorization & 255))
|
||||
while (*authorization && _cups_isspace(*authorization))
|
||||
authorization ++;
|
||||
|
||||
if (*authorization)
|
||||
|
||||
+15
-15
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Option marking routines for the Common UNIX Printing System (CUPS).
|
||||
* Option marking routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -290,25 +290,25 @@ cupsResolveConflicts(
|
||||
|
||||
for (resval = resolver->value; *resval && !changed;)
|
||||
{
|
||||
while (isspace(*resval & 255))
|
||||
while (_cups_isspace(*resval))
|
||||
resval ++;
|
||||
|
||||
if (*resval != '*')
|
||||
break;
|
||||
|
||||
for (resval ++, resptr = resoption;
|
||||
*resval && !isspace(*resval & 255);
|
||||
*resval && !_cups_isspace(*resval);
|
||||
resval ++)
|
||||
if (resptr < (resoption + sizeof(resoption) - 1))
|
||||
*resptr++ = *resval;
|
||||
|
||||
*resptr = '\0';
|
||||
|
||||
while (isspace(*resval & 255))
|
||||
while (_cups_isspace(*resval))
|
||||
resval ++;
|
||||
|
||||
for (resptr = reschoice;
|
||||
*resval && !isspace(*resval & 255);
|
||||
*resval && !_cups_isspace(*resval);
|
||||
resval ++)
|
||||
if (resptr < (reschoice + sizeof(reschoice) - 1))
|
||||
*resptr++ = *resval;
|
||||
@@ -483,13 +483,13 @@ cupsResolveConflicts(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!changed)
|
||||
{
|
||||
DEBUG_puts("1ppdResolveConflicts: Unable to automatically resolve "
|
||||
"constraint!");
|
||||
goto error;
|
||||
}
|
||||
if (!changed)
|
||||
{
|
||||
DEBUG_puts("1ppdResolveConflicts: Unable to automatically resolve "
|
||||
"constraint!");
|
||||
goto error;
|
||||
}
|
||||
|
||||
cupsArrayClear(pass);
|
||||
@@ -887,20 +887,20 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
|
||||
* Extract "*Option Choice" or just "*Option"...
|
||||
*/
|
||||
|
||||
for (vptr ++, ptr = option; *vptr && !isspace(*vptr & 255); vptr ++)
|
||||
for (vptr ++, ptr = option; *vptr && !_cups_isspace(*vptr); vptr ++)
|
||||
if (ptr < (option + sizeof(option) - 1))
|
||||
*ptr++ = *vptr;
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
while (isspace(*vptr & 255))
|
||||
while (_cups_isspace(*vptr))
|
||||
vptr ++;
|
||||
|
||||
if (*vptr == '*')
|
||||
choice[0] = '\0';
|
||||
else
|
||||
{
|
||||
for (ptr = choice; *vptr && !isspace(*vptr & 255); vptr ++)
|
||||
for (ptr = choice; *vptr && !_cups_isspace(*vptr); vptr ++)
|
||||
if (ptr < (choice + sizeof(choice) - 1))
|
||||
*ptr++ = *vptr;
|
||||
|
||||
|
||||
+6
-4
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* API definitions for the Common UNIX Printing System (CUPS).
|
||||
* API definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -25,10 +25,12 @@
|
||||
# include <sys/types.h>
|
||||
# if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED)
|
||||
# define __CUPS_SSIZE_T_DEFINED
|
||||
# include <stddef.h>
|
||||
/* Windows does not support the ssize_t type, so map it to off_t... */
|
||||
typedef off_t ssize_t; /* @private@ */
|
||||
# endif /* WIN32 && !__CUPS_SSIZE_T_DEFINED */
|
||||
|
||||
# include "file.h"
|
||||
# include "ipp.h"
|
||||
# include "ppd.h"
|
||||
# include "language.h"
|
||||
@@ -59,10 +61,10 @@ extern "C" {
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define CUPS_VERSION 1.0403
|
||||
# define CUPS_VERSION 1.0408
|
||||
# define CUPS_VERSION_MAJOR 1
|
||||
# define CUPS_VERSION_MINOR 4
|
||||
# define CUPS_VERSION_PATCH 3
|
||||
# define CUPS_VERSION_PATCH 8
|
||||
|
||||
# define CUPS_BC_FD 3 /* Back-channel file descriptor for select/poll */
|
||||
# define CUPS_DATE_ANY (time_t)-1
|
||||
|
||||
+10
-5
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* PPD custom option routines for the Common UNIX Printing System (CUPS).
|
||||
* PPD custom option routines for CUPS.
|
||||
*
|
||||
* Copyright 2007 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -70,14 +70,19 @@ ppd_cparam_t * /* O - Custom parameter or NULL */
|
||||
ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */
|
||||
const char *name) /* I - Parameter name */
|
||||
{
|
||||
ppd_cparam_t key; /* Custom parameter search key */
|
||||
ppd_cparam_t *param; /* Current custom parameter */
|
||||
|
||||
|
||||
if (!opt)
|
||||
return (NULL);
|
||||
|
||||
strlcpy(key.name, name, sizeof(key.name));
|
||||
return ((ppd_cparam_t *)cupsArrayFind(opt->params, &key));
|
||||
for (param = (ppd_cparam_t *)cupsArrayFirst(opt->params);
|
||||
param;
|
||||
param = (ppd_cparam_t *)cupsArrayNext(opt->params))
|
||||
if (!strcasecmp(param->name, name))
|
||||
break;
|
||||
|
||||
return (param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+20
-7
@@ -53,7 +53,7 @@
|
||||
|
||||
#include "debug.h"
|
||||
#include "globals.h"
|
||||
#include "pwgmedia.h"
|
||||
#include "pwg-private.h"
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -509,7 +509,19 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
|
||||
set_as_default = 1;
|
||||
name = _cupsUserDefault(defname, sizeof(defname));
|
||||
|
||||
if (!name && home)
|
||||
if (name)
|
||||
{
|
||||
char *ptr; /* Temporary pointer... */
|
||||
|
||||
if ((ptr = strchr(defname, '/')) != NULL)
|
||||
{
|
||||
*ptr++ = '\0';
|
||||
instance = ptr;
|
||||
}
|
||||
else
|
||||
instance = NULL;
|
||||
}
|
||||
else if (home)
|
||||
{
|
||||
/*
|
||||
* No default in the environment, try the user's lpoptions files...
|
||||
@@ -553,7 +565,7 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
|
||||
|
||||
if (!cups_get_sdests(http, op, name, 0, &dest))
|
||||
{
|
||||
if (op == CUPS_GET_DEFAULT || name)
|
||||
if (op == CUPS_GET_DEFAULT || (name && !set_as_default))
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
@@ -1113,8 +1125,8 @@ static char * /* O - Default paper size */
|
||||
appleGetPaperSize(char *name, /* I - Paper size name buffer */
|
||||
int namesize) /* I - Size of buffer */
|
||||
{
|
||||
CFStringRef defaultPaperID; /* Default paper ID */
|
||||
_cups_pwg_media_t *pwgmedia; /* PWG media size */
|
||||
CFStringRef defaultPaperID; /* Default paper ID */
|
||||
_pwg_media_t *pwgmedia; /* PWG media size */
|
||||
|
||||
|
||||
defaultPaperID = CFPreferencesCopyAppValue(kDefaultPaperIDKey,
|
||||
@@ -1124,7 +1136,7 @@ appleGetPaperSize(char *name, /* I - Paper size name buffer */
|
||||
!CFStringGetCString(defaultPaperID, name, namesize,
|
||||
kCFStringEncodingUTF8))
|
||||
name[0] = '\0';
|
||||
else if ((pwgmedia = _cupsPWGMediaByLegacy(name)) != NULL)
|
||||
else if ((pwgmedia = _pwgMediaForLegacy(name)) != NULL)
|
||||
strlcpy(name, pwgmedia->pwg, namesize);
|
||||
|
||||
if (defaultPaperID)
|
||||
@@ -1234,7 +1246,8 @@ appleSetDefault(const char *name) /* I - Default printer/class name */
|
||||
CFArrayRemoveValueAtIndex(newlocations, locindex);
|
||||
}
|
||||
else
|
||||
newlocations = CFArrayCreateMutable(kCFAllocatorDefault, 0, NULL);
|
||||
newlocations = CFArrayCreateMutable(kCFAllocatorDefault, 0,
|
||||
&kCFTypeArrayCallBacks);
|
||||
|
||||
newlocation = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
|
||||
&kCFTypeDictionaryKeyCallBacks,
|
||||
|
||||
+26
-14
@@ -484,7 +484,8 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
|
||||
*/
|
||||
|
||||
for (title += 7; *title && isdigit(*title & 255); title ++);
|
||||
for (; *title && isspace(*title & 255); title ++);
|
||||
while (_cups_isspace(*title))
|
||||
title ++;
|
||||
|
||||
if ((ptr = strstr(title, " - ")) != NULL)
|
||||
{
|
||||
@@ -683,7 +684,8 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
case PPD_CUSTOM_PASSCODE :
|
||||
case PPD_CUSTOM_PASSWORD :
|
||||
case PPD_CUSTOM_STRING :
|
||||
bufsize += strlen(cparam->current.custom_string);
|
||||
if (cparam->current.custom_string)
|
||||
bufsize += strlen(cparam->current.custom_string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -728,7 +730,9 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
case PPD_CUSTOM_PASSCODE :
|
||||
case PPD_CUSTOM_PASSWORD :
|
||||
case PPD_CUSTOM_STRING :
|
||||
bufsize += 3 + 4 * strlen(cparam->current.custom_string);
|
||||
bufsize += 3;
|
||||
if (cparam->current.custom_string)
|
||||
bufsize += 4 * strlen(cparam->current.custom_string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -797,8 +801,8 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
*/
|
||||
|
||||
pnum = *cptr++ - '0';
|
||||
while (isalnum(*cptr & 255))
|
||||
pnum = pnum * 10 + *cptr - '0';
|
||||
while (isdigit(*cptr & 255))
|
||||
pnum = pnum * 10 + *cptr++ - '0';
|
||||
|
||||
for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
|
||||
cparam;
|
||||
@@ -828,9 +832,12 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
case PPD_CUSTOM_PASSCODE :
|
||||
case PPD_CUSTOM_PASSWORD :
|
||||
case PPD_CUSTOM_STRING :
|
||||
strlcpy(bufptr, cparam->current.custom_string,
|
||||
bufend - bufptr);
|
||||
bufptr += strlen(bufptr);
|
||||
if (cparam->current.custom_string)
|
||||
{
|
||||
strlcpy(bufptr, cparam->current.custom_string,
|
||||
bufend - bufptr);
|
||||
bufptr += strlen(bufptr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1033,14 +1040,19 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
|
||||
case PPD_CUSTOM_STRING :
|
||||
*bufptr++ = '(';
|
||||
|
||||
for (s = cparam->current.custom_string; *s; s ++)
|
||||
if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
|
||||
if (cparam->current.custom_string)
|
||||
{
|
||||
for (s = cparam->current.custom_string; *s; s ++)
|
||||
{
|
||||
snprintf(bufptr, bufend - bufptr + 1, "\\%03o", *s & 255);
|
||||
bufptr += strlen(bufptr);
|
||||
if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127)
|
||||
{
|
||||
snprintf(bufptr, bufend - bufptr + 1, "\\%03o", *s & 255);
|
||||
bufptr += strlen(bufptr);
|
||||
}
|
||||
else
|
||||
*bufptr++ = *s;
|
||||
}
|
||||
else
|
||||
*bufptr++ = *s;
|
||||
}
|
||||
|
||||
*bufptr++ = ')';
|
||||
*bufptr++ = '\n';
|
||||
|
||||
@@ -125,6 +125,7 @@ static const _ipp_option_t ipp_options[] =
|
||||
{ 0, "penwidth", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "penwidth-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "port-monitor", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "ppd-name", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "ppi", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "ppi-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
|
||||
+114
-8
@@ -8,7 +8,7 @@
|
||||
* our own file functions allows us to provide transparent support of
|
||||
* gzip'd print files, PPD files, etc.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -59,6 +59,8 @@
|
||||
*/
|
||||
|
||||
#include "file-private.h"
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
/*
|
||||
@@ -69,6 +71,7 @@
|
||||
static ssize_t cups_compress(cups_file_t *fp, const char *buf, size_t bytes);
|
||||
#endif /* HAVE_LIBZ */
|
||||
static ssize_t cups_fill(cups_file_t *fp);
|
||||
static int cups_open(const char *filename, int mode);
|
||||
static ssize_t cups_read(cups_file_t *fp, char *buf, size_t bytes);
|
||||
static ssize_t cups_write(cups_file_t *fp, const char *buf, size_t bytes);
|
||||
|
||||
@@ -491,7 +494,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
|
||||
// Strip the comment and any trailing whitespace...
|
||||
while (ptr > buf)
|
||||
{
|
||||
if (!isspace(ptr[-1] & 255))
|
||||
if (!_cups_isspace(ptr[-1]))
|
||||
break;
|
||||
|
||||
ptr --;
|
||||
@@ -505,7 +508,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
|
||||
* Strip leading whitespace...
|
||||
*/
|
||||
|
||||
for (ptr = buf; isspace(*ptr & 255); ptr ++);
|
||||
for (ptr = buf; _cups_isspace(*ptr); ptr ++);
|
||||
|
||||
if (ptr > buf)
|
||||
_cups_strcpy(buf, ptr);
|
||||
@@ -521,7 +524,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
|
||||
*/
|
||||
|
||||
for (ptr = buf; *ptr; ptr ++)
|
||||
if (isspace(*ptr & 255))
|
||||
if (_cups_isspace(*ptr))
|
||||
break;
|
||||
|
||||
if (*ptr)
|
||||
@@ -530,7 +533,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
|
||||
* Have a value, skip any other spaces...
|
||||
*/
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
while (_cups_isspace(*ptr))
|
||||
*ptr++ = '\0';
|
||||
|
||||
if (*ptr)
|
||||
@@ -554,7 +557,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
|
||||
return (buf);
|
||||
}
|
||||
|
||||
while (ptr > *value && isspace(*ptr & 255))
|
||||
while (ptr > *value && _cups_isspace(*ptr))
|
||||
*ptr-- = '\0';
|
||||
}
|
||||
|
||||
@@ -827,7 +830,8 @@ cupsFileOpen(const char *filename, /* I - Name of file */
|
||||
switch (*mode)
|
||||
{
|
||||
case 'a' : /* Append file */
|
||||
fd = open(filename, O_RDWR | O_CREAT | O_APPEND | O_LARGEFILE | O_BINARY, 0666);
|
||||
fd = cups_open(filename,
|
||||
O_RDWR | O_CREAT | O_APPEND | O_LARGEFILE | O_BINARY);
|
||||
break;
|
||||
|
||||
case 'r' : /* Read file */
|
||||
@@ -835,7 +839,21 @@ cupsFileOpen(const char *filename, /* I - Name of file */
|
||||
break;
|
||||
|
||||
case 'w' : /* Write file */
|
||||
fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT | O_LARGEFILE | O_BINARY, 0666);
|
||||
fd = cups_open(filename, O_WRONLY | O_LARGEFILE | O_BINARY);
|
||||
if (fd < 0 && errno == ENOENT)
|
||||
{
|
||||
fd = cups_open(filename,
|
||||
O_WRONLY | O_CREAT | O_EXCL | O_LARGEFILE | O_BINARY);
|
||||
if (fd < 0 && errno == EEXIST)
|
||||
fd = cups_open(filename, O_WRONLY | O_LARGEFILE | O_BINARY);
|
||||
}
|
||||
|
||||
if (fd >= 0)
|
||||
#ifdef WIN32
|
||||
_chsize(fd, 0);
|
||||
#else
|
||||
ftruncate(fd, 0);
|
||||
#endif /* WIN32 */
|
||||
break;
|
||||
|
||||
case 's' : /* Read/write socket */
|
||||
@@ -2208,6 +2226,94 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_open()' - Safely open a file for writing.
|
||||
*
|
||||
* We don't allow appending to directories or files that are hard-linked or
|
||||
* symlinked.
|
||||
*/
|
||||
|
||||
static int /* O - File descriptor or -1 otherwise */
|
||||
cups_open(const char *filename, /* I - Filename */
|
||||
int mode) /* I - Open mode */
|
||||
{
|
||||
int fd; /* File descriptor */
|
||||
struct stat fileinfo; /* File information */
|
||||
#ifndef WIN32
|
||||
struct stat linkinfo; /* Link information */
|
||||
#endif /* !WIN32 */
|
||||
|
||||
|
||||
/*
|
||||
* Open the file...
|
||||
*/
|
||||
|
||||
if ((fd = open(filename, mode, 0666)) < 0)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Then verify that the file descriptor doesn't point to a directory or hard-
|
||||
* linked file.
|
||||
*/
|
||||
|
||||
if (fstat(fd, &fileinfo))
|
||||
{
|
||||
close(fd);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (fileinfo.st_nlink != 1)
|
||||
{
|
||||
close(fd);
|
||||
errno = EPERM;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
if (fileinfo.st_mode & _S_IFDIR)
|
||||
#else
|
||||
if (S_ISDIR(fileinfo.st_mode))
|
||||
#endif /* WIN32 */
|
||||
{
|
||||
close(fd);
|
||||
errno = EISDIR;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
/*
|
||||
* Then use lstat to determine whether the filename is a symlink...
|
||||
*/
|
||||
|
||||
if (lstat(filename, &linkinfo))
|
||||
{
|
||||
close(fd);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (S_ISLNK(linkinfo.st_mode) ||
|
||||
fileinfo.st_dev != linkinfo.st_dev ||
|
||||
fileinfo.st_ino != linkinfo.st_ino ||
|
||||
#ifdef HAVE_ST_GEN
|
||||
fileinfo.st_gen != linkinfo.st_gen ||
|
||||
#endif /* HAVE_ST_GEN */
|
||||
fileinfo.st_nlink != linkinfo.st_nlink ||
|
||||
fileinfo.st_mode != linkinfo.st_mode)
|
||||
{
|
||||
/*
|
||||
* Yes, don't allow!
|
||||
*/
|
||||
|
||||
close(fd);
|
||||
errno = EPERM;
|
||||
return (-1);
|
||||
}
|
||||
#endif /* !WIN32 */
|
||||
|
||||
return (fd);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_read()' - Read from a file descriptor.
|
||||
*/
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
*/
|
||||
|
||||
# include "versioning.h"
|
||||
# include <stddef.h>
|
||||
# include <sys/types.h>
|
||||
# if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED)
|
||||
# define __CUPS_SSIZE_T_DEFINED
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* cupsGetDevices implementation for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2008-2009 by Apple Inc.
|
||||
* Copyright 2008-2010 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -258,7 +258,7 @@ cupsGetDevices(
|
||||
httpBlocking(http, blocking);
|
||||
httpFlush(http);
|
||||
|
||||
if (status == IPP_ERROR)
|
||||
if (status == HTTP_ERROR)
|
||||
_cupsSetError(IPP_ERROR, NULL, 0);
|
||||
else
|
||||
{
|
||||
|
||||
+9
-4
@@ -38,11 +38,12 @@
|
||||
static void
|
||||
cups_env_init(_cups_globals_t *g) /* I - Global data */
|
||||
{
|
||||
#ifdef HAVE_GETEUID
|
||||
#ifndef WIN32
|
||||
# ifdef HAVE_GETEUID
|
||||
if ((geteuid() != getuid() && getuid()) || getegid() != getgid())
|
||||
#else
|
||||
# else
|
||||
if (!getuid())
|
||||
#endif /* HAVE_GETEUID */
|
||||
# endif /* HAVE_GETEUID */
|
||||
{
|
||||
/*
|
||||
* When running setuid/setgid, don't allow environment variables to override
|
||||
@@ -56,6 +57,7 @@ cups_env_init(_cups_globals_t *g) /* I - Global data */
|
||||
g->localedir = CUPS_LOCALEDIR;
|
||||
}
|
||||
else
|
||||
#endif /* !WIN32 */
|
||||
{
|
||||
/*
|
||||
* Allow directories to be overridden by environment variables.
|
||||
@@ -183,7 +185,9 @@ globals_destructor(void *value) /* I - Data to free */
|
||||
if (cg->last_status_message)
|
||||
_cupsStrFree(cg->last_status_message);
|
||||
|
||||
# ifndef CUPS_LITE
|
||||
cupsFreeOptions(cg->cupsd_num_settings, cg->cupsd_settings);
|
||||
# endif /* !CUPS_LITE */
|
||||
|
||||
for (buffer = cg->ipp_buffers; buffer; buffer = next)
|
||||
{
|
||||
@@ -191,8 +195,9 @@ globals_destructor(void *value) /* I - Data to free */
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
cupsArrayDelete(cg->pwg_size_lut);
|
||||
cupsArrayDelete(cg->leg_size_lut);
|
||||
cupsArrayDelete(cg->ppd_size_lut);
|
||||
cupsArrayDelete(cg->pwg_size_lut);
|
||||
|
||||
free(value);
|
||||
}
|
||||
|
||||
+8
-3
@@ -26,6 +26,8 @@
|
||||
# include "http-private.h"
|
||||
# include "cups.h"
|
||||
# include "i18n.h"
|
||||
# include "ppd-private.h"
|
||||
# include "pwg-private.h"
|
||||
|
||||
# ifdef HAVE_PTHREAD_H
|
||||
# include <pthread.h>
|
||||
@@ -103,9 +105,12 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
int ppd_line; /* Current line number */
|
||||
ppd_conform_t ppd_conform; /* Level of conformance required */
|
||||
|
||||
/* pwgmedia.c */
|
||||
cups_array_t *pwg_size_lut, /* Lookup table for PWG names */
|
||||
*leg_size_lut; /* Lookup table for legacy names */
|
||||
/* pwg-media.c */
|
||||
cups_array_t *leg_size_lut, /* Lookup table for legacy names */
|
||||
*ppd_size_lut, /* Lookup table for PPD names */
|
||||
*pwg_size_lut; /* Lookup table for PWG names */
|
||||
_pwg_media_t pwg_media; /* PWG media data for custom size */
|
||||
char pwg_name[65]; /* PWG media name for custom size */
|
||||
|
||||
/* snmp.c */
|
||||
char snmp_community[255];
|
||||
|
||||
+34
-22
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* HTTP address routines for the Common UNIX Printing System (CUPS).
|
||||
* HTTP address routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -358,8 +358,11 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
#ifdef AF_INET6
|
||||
else if (addr->addr.sa_family == AF_INET6)
|
||||
{
|
||||
char *sptr, /* Pointer into string */
|
||||
temps[64]; /* Temporary string for address */
|
||||
|
||||
# ifdef HAVE_GETNAMEINFO
|
||||
if (getnameinfo(&addr->addr, httpAddrLength(addr), s, slen,
|
||||
if (getnameinfo(&addr->addr, httpAddrLength(addr), temps, sizeof(temps),
|
||||
NULL, 0, NI_NUMERICHOST))
|
||||
{
|
||||
/*
|
||||
@@ -371,29 +374,36 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
else if ((sptr = strchr(temps, '%')) != NULL)
|
||||
{
|
||||
/*
|
||||
* Convert "%zone" to "+zone" to match URI form...
|
||||
*/
|
||||
|
||||
*sptr = '+';
|
||||
}
|
||||
|
||||
# else
|
||||
char *sptr; /* Pointer into string */
|
||||
int i; /* Looping var */
|
||||
unsigned temp; /* Current value */
|
||||
const char *prefix; /* Prefix for address */
|
||||
|
||||
|
||||
prefix = "";
|
||||
for (sptr = s, i = 0; i < 4 && addr->ipv6.sin6_addr.s6_addr32[i]; i ++)
|
||||
for (sptr = temps, i = 0; i < 4 && addr->ipv6.sin6_addr.s6_addr32[i]; i ++)
|
||||
{
|
||||
temp = ntohl(addr->ipv6.sin6_addr.s6_addr32[i]);
|
||||
|
||||
snprintf(sptr, slen, "%s%x", prefix, (temp >> 16) & 0xffff);
|
||||
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix,
|
||||
(temp >> 16) & 0xffff);
|
||||
prefix = ":";
|
||||
slen -= strlen(sptr);
|
||||
sptr += strlen(sptr);
|
||||
|
||||
temp &= 0xffff;
|
||||
|
||||
if (temp || i == 3 || addr->ipv6.sin6_addr.s6_addr32[i + 1])
|
||||
{
|
||||
snprintf(sptr, slen, "%s%x", prefix, temp);
|
||||
slen -= strlen(sptr);
|
||||
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix, temp);
|
||||
sptr += strlen(sptr);
|
||||
}
|
||||
}
|
||||
@@ -405,24 +415,24 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
|
||||
if (i < 4)
|
||||
{
|
||||
snprintf(sptr, slen, "%s:", prefix);
|
||||
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s:", prefix);
|
||||
prefix = ":";
|
||||
slen -= strlen(sptr);
|
||||
sptr += strlen(sptr);
|
||||
|
||||
for (; i < 4; i ++)
|
||||
{
|
||||
temp = ntohl(addr->ipv6.sin6_addr.s6_addr32[i]);
|
||||
|
||||
if ((temp & 0xffff0000) || addr->ipv6.sin6_addr.s6_addr32[i - 1])
|
||||
if ((temp & 0xffff0000) ||
|
||||
(i > 0 && addr->ipv6.sin6_addr.s6_addr32[i - 1]))
|
||||
{
|
||||
snprintf(sptr, slen, "%s%x", prefix, (temp >> 16) & 0xffff);
|
||||
slen -= strlen(sptr);
|
||||
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix,
|
||||
(temp >> 16) & 0xffff);
|
||||
sptr += strlen(sptr);
|
||||
}
|
||||
|
||||
snprintf(sptr, slen, "%s%x", prefix, temp & 0xffff);
|
||||
slen -= strlen(sptr);
|
||||
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix,
|
||||
temp & 0xffff);
|
||||
sptr += strlen(sptr);
|
||||
}
|
||||
}
|
||||
@@ -432,9 +442,7 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
* Empty address...
|
||||
*/
|
||||
|
||||
strlcpy(s, "::", slen);
|
||||
sptr = s + 2;
|
||||
slen -= 2;
|
||||
strlcpy(temps, "::", sizeof(temps));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -442,12 +450,16 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
* Empty at end...
|
||||
*/
|
||||
|
||||
strlcpy(sptr, "::", slen);
|
||||
sptr += 2;
|
||||
slen -= 2;
|
||||
strlcpy(sptr, "::", sizeof(temps) - (sptr - temps));
|
||||
}
|
||||
}
|
||||
# endif /* HAVE_GETNAMEINFO */
|
||||
|
||||
/*
|
||||
* Add "[v1." and "]" around IPv6 address to convert to URI form.
|
||||
*/
|
||||
|
||||
snprintf(s, slen, "[v1.%s]", temps);
|
||||
}
|
||||
#endif /* AF_INET6 */
|
||||
else
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* HTTP address list routines for the Common UNIX Printing System (CUPS).
|
||||
* HTTP address list routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -271,7 +271,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
struct addrinfo hints, /* Address lookup hints */
|
||||
*results, /* Address lookup results */
|
||||
*current; /* Current result */
|
||||
char ipv6[1024], /* IPv6 address */
|
||||
char ipv6[64], /* IPv6 address */
|
||||
*ipv6zone; /* Pointer to zone separator */
|
||||
int ipv6len; /* Length of IPv6 address */
|
||||
int error; /* getaddrinfo() error */
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Private HTTP definitions for the Common UNIX Printing System (CUPS).
|
||||
* Private HTTP definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -98,6 +98,7 @@ extern BIO_METHOD *_httpBIOMethods(void);
|
||||
* The GNU TLS library is more of a "bare metal" SSL/TLS library...
|
||||
*/
|
||||
# include <gnutls/gnutls.h>
|
||||
# include <gcrypt.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -268,6 +269,7 @@ extern char *_httpEncodeURI(char *dst, const char *src,
|
||||
size_t dstsize);
|
||||
extern const char *_httpResolveURI(const char *uri, char *resolved_uri,
|
||||
size_t resolved_size, int log);
|
||||
extern int _httpUpdate(http_t *http, http_status_t *status);
|
||||
extern int _httpWait(http_t *http, int msec, int usessl);
|
||||
#endif /* !_CUPS_HTTP_PRIVATE_H_ */
|
||||
|
||||
|
||||
+17
-3
@@ -917,7 +917,9 @@ httpSeparateURI(
|
||||
|
||||
for (ptr = scheme, end = scheme + schemelen - 1;
|
||||
*uri && *uri != ':' && ptr < end;)
|
||||
if (isalnum(*uri & 255) || *uri == '-' || *uri == '+' || *uri == '.')
|
||||
if (strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"0123456789-+.", *uri) != NULL)
|
||||
*ptr++ = *uri++;
|
||||
else
|
||||
break;
|
||||
@@ -1353,7 +1355,8 @@ _httpResolveURI(
|
||||
DNSServiceRef ref, /* DNS-SD master service reference */
|
||||
domainref, /* DNS-SD service reference for domain */
|
||||
localref; /* DNS-SD service reference for .local */
|
||||
int domainsent = 0; /* Send the domain resolve? */
|
||||
int domainsent = 0, /* Send the domain resolve? */
|
||||
offline = 0; /* offline-report state set? */
|
||||
char *regtype, /* Pointer to type in hostname */
|
||||
*domain; /* Pointer to domain in hostname */
|
||||
_http_uribuf_t uribuf; /* URI buffer */
|
||||
@@ -1467,6 +1470,17 @@ _httpResolveURI(
|
||||
&uribuf) == kDNSServiceErr_NoError)
|
||||
domainsent = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* If it hasn't resolved within 5 seconds set the offline-report
|
||||
* printer-state-reason...
|
||||
*/
|
||||
|
||||
if (logit && offline == 0 && time(NULL) > (start_time + 5))
|
||||
{
|
||||
fputs("STATE: +offline-report\n", stderr);
|
||||
offline = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1494,7 +1508,7 @@ _httpResolveURI(
|
||||
else
|
||||
fputs("DEBUG: Unable to resolve URI!\n", stderr);
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
fputs("STATE: -connecting-to-device,offline-report\n", stderr);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
+279
-166
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* HTTP routines for the Common UNIX Printing System (CUPS).
|
||||
* HTTP routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* This file contains Kerberos support code, copyright 2006 by
|
||||
@@ -25,7 +25,8 @@
|
||||
* server.
|
||||
* httpClearCookie() - Clear the cookie value(s).
|
||||
* httpClearFields() - Clear HTTP request fields.
|
||||
* httpClose() - Close an HTTP connection...
|
||||
* httpClose() - Close an HTTP connection.
|
||||
* httpConnect() - Connect to a HTTP server.
|
||||
* httpConnectEncrypt() - Connect to a HTTP server using encryption.
|
||||
* _httpCreate() - Create an unconnected HTTP connection.
|
||||
* httpDelete() - Send a DELETE request to the server.
|
||||
@@ -61,11 +62,12 @@
|
||||
* _httpReadGNUTLS() - Read function for the GNU TLS library.
|
||||
* httpReconnect() - Reconnect to a HTTP server.
|
||||
* httpSetAuthString() - Set the current authorization string.
|
||||
* httpSetCookie() - Set the cookie value(s)...
|
||||
* httpSetCookie() - Set the cookie value(s).
|
||||
* httpSetExpect() - Set the Expect: header in a request.
|
||||
* httpSetField() - Set the value of an HTTP header.
|
||||
* httpSetLength() - Set the content-length and content-encoding.
|
||||
* httpTrace() - Send an TRACE request to the server.
|
||||
* _httpUpdate() - Update the current HTTP status for incoming data.
|
||||
* httpUpdate() - Update the current HTTP state for incoming data.
|
||||
* _httpWait() - Wait for data available on a connection (no flush).
|
||||
* httpWait() - Wait for data available on a connection.
|
||||
@@ -82,10 +84,12 @@
|
||||
* http_debug_hex() - Do a hex dump of a buffer.
|
||||
* http_field() - Return the field index for a field name.
|
||||
* http_read_ssl() - Read from a SSL/TLS connection.
|
||||
* http_locking_cb() - Lock/unlock a thread's mutex.
|
||||
* http_send() - Send a request with all fields and the trailing
|
||||
* blank line.
|
||||
* http_setup_ssl() - Set up SSL/TLS support on a connection.
|
||||
* http_shutdown_ssl() - Shut down SSL/TLS on a connection.
|
||||
* http_threadid_cb() - Return the current thread ID.
|
||||
* http_upgrade() - Force upgrade to TLS encryption.
|
||||
* http_write() - Write a buffer to a HTTP connection.
|
||||
* http_write_chunk() - Write a chunked buffer.
|
||||
@@ -143,6 +147,19 @@ static int http_setup_ssl(http_t *http);
|
||||
static void http_shutdown_ssl(http_t *http);
|
||||
static int http_upgrade(http_t *http);
|
||||
static int http_write_ssl(http_t *http, const char *buf, int len);
|
||||
|
||||
# ifdef HAVE_GNUTLS
|
||||
# ifdef HAVE_PTHREAD_H
|
||||
GCRY_THREAD_OPTION_PTHREAD_IMPL;
|
||||
# endif /* HAVE_PTHREAD_H */
|
||||
|
||||
# elif defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H)
|
||||
static pthread_mutex_t *http_locks; /* OpenSSL lock mutexes */
|
||||
|
||||
static void http_locking_cb(int mode, int type, const char *file,
|
||||
int line);
|
||||
static unsigned long http_threadid_cb(void);
|
||||
# endif /* HAVE_GNUTLS */
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
|
||||
@@ -311,7 +328,7 @@ httpClearFields(http_t *http) /* I - Connection to server */
|
||||
|
||||
|
||||
/*
|
||||
* 'httpClose()' - Close an HTTP connection...
|
||||
* 'httpClose()' - Close an HTTP connection.
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -559,8 +576,9 @@ httpError(http_t *http) /* I - Connection to server */
|
||||
void
|
||||
httpFlush(http_t *http) /* I - Connection to server */
|
||||
{
|
||||
char buffer[8192]; /* Junk buffer */
|
||||
int blocking; /* To block or not to block */
|
||||
char buffer[8192]; /* Junk buffer */
|
||||
int blocking; /* To block or not to block */
|
||||
http_state_t oldstate; /* Old state */
|
||||
|
||||
|
||||
DEBUG_printf(("httpFlush(http=%p), state=%s", http,
|
||||
@@ -577,6 +595,7 @@ httpFlush(http_t *http) /* I - Connection to server */
|
||||
* Read any data we can...
|
||||
*/
|
||||
|
||||
oldstate = http->state;
|
||||
while (httpRead2(http, buffer, sizeof(buffer)) > 0);
|
||||
|
||||
/*
|
||||
@@ -586,7 +605,7 @@ httpFlush(http_t *http) /* I - Connection to server */
|
||||
|
||||
http->blocking = blocking;
|
||||
|
||||
if (http->state != HTTP_WAITING && http->fd >= 0)
|
||||
if (http->state == oldstate && http->state != HTTP_WAITING && http->fd >= 0)
|
||||
{
|
||||
/*
|
||||
* Didn't get the data back, so close the current connection.
|
||||
@@ -892,7 +911,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*fptr & 255))
|
||||
while (_cups_isspace(*fptr))
|
||||
fptr ++;
|
||||
|
||||
if (*fptr == ',')
|
||||
@@ -906,7 +925,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
|
||||
*/
|
||||
|
||||
for (ptr = temp;
|
||||
*fptr && *fptr != '=' && !isspace(*fptr & 255) &&
|
||||
*fptr && *fptr != '=' && !_cups_isspace(*fptr) &&
|
||||
ptr < (temp + sizeof(temp) - 1);
|
||||
*ptr++ = *fptr++);
|
||||
|
||||
@@ -918,7 +937,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
|
||||
* Skip trailing chars up to the '='...
|
||||
*/
|
||||
|
||||
while (isspace(*fptr & 255))
|
||||
while (_cups_isspace(*fptr))
|
||||
fptr ++;
|
||||
|
||||
if (!*fptr)
|
||||
@@ -933,7 +952,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
|
||||
|
||||
fptr ++;
|
||||
|
||||
while (isspace(*fptr & 255))
|
||||
while (_cups_isspace(*fptr))
|
||||
fptr ++;
|
||||
|
||||
if (*fptr == '\"')
|
||||
@@ -961,12 +980,12 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
|
||||
*/
|
||||
|
||||
for (ptr = value;
|
||||
*fptr && !isspace(*fptr & 255) && *fptr != ',' && ptr < end;
|
||||
*fptr && !_cups_isspace(*fptr) && *fptr != ',' && ptr < end;
|
||||
*ptr++ = *fptr++);
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
while (*fptr && !isspace(*fptr & 255) && *fptr != ',')
|
||||
while (*fptr && !_cups_isspace(*fptr) && *fptr != ',')
|
||||
fptr ++;
|
||||
}
|
||||
|
||||
@@ -1170,21 +1189,22 @@ httpHead(http_t *http, /* I - Connection to server */
|
||||
void
|
||||
httpInitialize(void)
|
||||
{
|
||||
#ifdef HAVE_LIBSSL
|
||||
# ifndef WIN32
|
||||
struct timeval curtime; /* Current time in microseconds */
|
||||
# endif /* !WIN32 */
|
||||
int i; /* Looping var */
|
||||
unsigned char data[1024]; /* Seed data */
|
||||
#endif /* HAVE_LIBSSL */
|
||||
|
||||
static int initialized = 0; /* Have we been called before? */
|
||||
#ifdef WIN32
|
||||
WSADATA winsockdata; /* WinSock data */
|
||||
static int initialized = 0; /* Has WinSock been initialized? */
|
||||
#endif /* WIN32 */
|
||||
#ifdef HAVE_LIBSSL
|
||||
int i; /* Looping var */
|
||||
unsigned char data[1024]; /* Seed data */
|
||||
#endif /* HAVE_LIBSSL */
|
||||
|
||||
|
||||
if (!initialized)
|
||||
WSAStartup(MAKEWORD(1,1), &winsockdata);
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
#ifdef WIN32
|
||||
WSAStartup(MAKEWORD(2,2), &winsockdata);
|
||||
|
||||
#elif !defined(SO_NOSIGPIPE)
|
||||
/*
|
||||
* Ignore SIGPIPE signals...
|
||||
@@ -1192,6 +1212,7 @@ httpInitialize(void)
|
||||
|
||||
# ifdef HAVE_SIGSET
|
||||
sigset(SIGPIPE, SIG_IGN);
|
||||
|
||||
# elif defined(HAVE_SIGACTION)
|
||||
struct sigaction action; /* POSIX sigaction data */
|
||||
|
||||
@@ -1199,35 +1220,63 @@ httpInitialize(void)
|
||||
memset(&action, 0, sizeof(action));
|
||||
action.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &action, NULL);
|
||||
|
||||
# else
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
# endif /* !SO_NOSIGPIPE */
|
||||
#endif /* WIN32 */
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
gnutls_global_init();
|
||||
#endif /* HAVE_GNUTLS */
|
||||
/*
|
||||
* Make sure we handle threading properly...
|
||||
*/
|
||||
|
||||
# ifdef HAVE_PTHREAD_H
|
||||
gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
|
||||
# endif /* HAVE_PTHREAD_H */
|
||||
|
||||
/*
|
||||
* Initialize GNU TLS...
|
||||
*/
|
||||
|
||||
gnutls_global_init();
|
||||
|
||||
#elif defined(HAVE_LIBSSL)
|
||||
/*
|
||||
* Initialize OpenSSL...
|
||||
*/
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
SSL_load_error_strings();
|
||||
SSL_library_init();
|
||||
|
||||
/*
|
||||
* Set the threading callbacks...
|
||||
*/
|
||||
|
||||
# ifdef HAVE_PTHREAD_H
|
||||
http_locks = calloc(CRYPTO_num_locks(), sizeof(pthread_mutex_t));
|
||||
|
||||
for (i = 0; i < CRYPTO_num_locks(); i ++)
|
||||
pthread_mutex_init(http_locks + i, NULL);
|
||||
|
||||
CRYPTO_set_id_callback(http_threadid_cb);
|
||||
CRYPTO_set_locking_callback(http_locking_cb);
|
||||
# endif /* HAVE_PTHREAD_H */
|
||||
|
||||
/*
|
||||
* Using the current time is a dubious random seed, but on some systems
|
||||
* it is the best we can do (on others, this seed isn't even used...)
|
||||
*/
|
||||
|
||||
# ifdef WIN32
|
||||
# else
|
||||
gettimeofday(&curtime, NULL);
|
||||
srand(curtime.tv_sec + curtime.tv_usec);
|
||||
# endif /* WIN32 */
|
||||
CUPS_SRAND(time(NULL));
|
||||
|
||||
for (i = 0; i < sizeof(data); i ++)
|
||||
data[i] = rand();
|
||||
data[i] = CUPS_RAND();
|
||||
|
||||
RAND_seed(data, sizeof(data));
|
||||
#endif /* HAVE_LIBSSL */
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1815,7 +1864,7 @@ httpSetAuthString(http_t *http, /* I - Connection to server */
|
||||
|
||||
|
||||
/*
|
||||
* 'httpSetCookie()' - Set the cookie value(s)...
|
||||
* 'httpSetCookie()' - Set the cookie value(s).
|
||||
*
|
||||
* @since CUPS 1.1.19/Mac OS X 10.3@
|
||||
*/
|
||||
@@ -1963,6 +2012,164 @@ httpTrace(http_t *http, /* I - Connection to server */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_httpUpdate()' - Update the current HTTP status for incoming data.
|
||||
*
|
||||
* Note: Unlike httpUpdate(), this function does not flush pending write data
|
||||
* and only retrieves a single status line from the HTTP connection.
|
||||
*/
|
||||
|
||||
int /* O - 1 to continue, 0 to stop */
|
||||
_httpUpdate(http_t *http, /* I - Connection to server */
|
||||
http_status_t *status) /* O - Current HTTP status */
|
||||
{
|
||||
char line[32768], /* Line from connection... */
|
||||
*value; /* Pointer to value on line */
|
||||
http_field_t field; /* Field index */
|
||||
int major, minor; /* HTTP version numbers */
|
||||
|
||||
|
||||
DEBUG_printf(("_httpUpdate(http=%p, status=%p), state=%s", http, status,
|
||||
http_states[http->state]));
|
||||
|
||||
/*
|
||||
* Grab a single line from the connection...
|
||||
*/
|
||||
|
||||
if (!httpGets(line, sizeof(line), http))
|
||||
{
|
||||
*status = HTTP_ERROR;
|
||||
return (0);
|
||||
}
|
||||
|
||||
DEBUG_printf(("2_httpUpdate: Got \"%s\"", line));
|
||||
|
||||
if (line[0] == '\0')
|
||||
{
|
||||
/*
|
||||
* Blank line means the start of the data section (if any). Return
|
||||
* the result code, too...
|
||||
*
|
||||
* If we get status 100 (HTTP_CONTINUE), then we *don't* change states.
|
||||
* Instead, we just return HTTP_CONTINUE to the caller and keep on
|
||||
* tryin'...
|
||||
*/
|
||||
|
||||
if (http->status == HTTP_CONTINUE)
|
||||
{
|
||||
*status = http->status;
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (http->status < HTTP_BAD_REQUEST)
|
||||
http->digest_tries = 0;
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
if (http->status == HTTP_SWITCHING_PROTOCOLS && !http->tls)
|
||||
{
|
||||
if (http_setup_ssl(http) != 0)
|
||||
{
|
||||
# ifdef WIN32
|
||||
closesocket(http->fd);
|
||||
# else
|
||||
close(http->fd);
|
||||
# endif /* WIN32 */
|
||||
|
||||
*status = http->status = HTTP_ERROR;
|
||||
return (0);
|
||||
}
|
||||
|
||||
*status = HTTP_CONTINUE;
|
||||
return (0);
|
||||
}
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
httpGetLength2(http);
|
||||
|
||||
switch (http->state)
|
||||
{
|
||||
case HTTP_GET :
|
||||
case HTTP_POST :
|
||||
case HTTP_POST_RECV :
|
||||
case HTTP_PUT :
|
||||
http->state ++;
|
||||
case HTTP_POST_SEND :
|
||||
case HTTP_HEAD :
|
||||
break;
|
||||
|
||||
default :
|
||||
http->state = HTTP_WAITING;
|
||||
break;
|
||||
}
|
||||
|
||||
*status = http->status;
|
||||
return (0);
|
||||
}
|
||||
else if (!strncmp(line, "HTTP/", 5))
|
||||
{
|
||||
/*
|
||||
* Got the beginning of a response...
|
||||
*/
|
||||
|
||||
int intstatus; /* Status value as an integer */
|
||||
|
||||
if (sscanf(line, "HTTP/%d.%d%d", &major, &minor, &intstatus) != 3)
|
||||
{
|
||||
*status = http->status = HTTP_ERROR;
|
||||
return (0);
|
||||
}
|
||||
|
||||
http->version = (http_version_t)(major * 100 + minor);
|
||||
*status = http->status = (http_status_t)intstatus;
|
||||
}
|
||||
else if ((value = strchr(line, ':')) != NULL)
|
||||
{
|
||||
/*
|
||||
* Got a value...
|
||||
*/
|
||||
|
||||
*value++ = '\0';
|
||||
while (_cups_isspace(*value))
|
||||
value ++;
|
||||
|
||||
/*
|
||||
* Be tolerants of servers that send unknown attribute fields...
|
||||
*/
|
||||
|
||||
if (!strcasecmp(line, "expect"))
|
||||
{
|
||||
/*
|
||||
* "Expect: 100-continue" or similar...
|
||||
*/
|
||||
|
||||
http->expect = (http_status_t)atoi(value);
|
||||
}
|
||||
else if (!strcasecmp(line, "cookie"))
|
||||
{
|
||||
/*
|
||||
* "Cookie: name=value[; name=value ...]" - replaces previous cookies...
|
||||
*/
|
||||
|
||||
httpSetCookie(http, value);
|
||||
}
|
||||
else if ((field = http_field(line)) != HTTP_FIELD_UNKNOWN)
|
||||
httpSetField(http, field, value);
|
||||
#ifdef DEBUG
|
||||
else
|
||||
DEBUG_printf(("1_httpUpdate: unknown field %s seen!", line));
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_printf(("1_httpUpdate: Bad response line \"%s\"!", line));
|
||||
*status = http->status = HTTP_ERROR;
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpUpdate()' - Update the current HTTP state for incoming data.
|
||||
*/
|
||||
@@ -1970,11 +2177,7 @@ httpTrace(http_t *http, /* I - Connection to server */
|
||||
http_status_t /* O - HTTP status */
|
||||
httpUpdate(http_t *http) /* I - Connection to server */
|
||||
{
|
||||
char line[32768], /* Line from connection... */
|
||||
*value; /* Pointer to value on line */
|
||||
http_field_t field; /* Field index */
|
||||
int major, minor, /* HTTP version numbers */
|
||||
status; /* Request status */
|
||||
http_status_t status; /* Request status */
|
||||
|
||||
|
||||
DEBUG_printf(("httpUpdate(http=%p), state=%s", http,
|
||||
@@ -2003,122 +2206,7 @@ httpUpdate(http_t *http) /* I - Connection to server */
|
||||
* Grab all of the lines we can from the connection...
|
||||
*/
|
||||
|
||||
while (httpGets(line, sizeof(line), http) != NULL)
|
||||
{
|
||||
DEBUG_printf(("2httpUpdate: Got \"%s\"", line));
|
||||
|
||||
if (line[0] == '\0')
|
||||
{
|
||||
/*
|
||||
* Blank line means the start of the data section (if any). Return
|
||||
* the result code, too...
|
||||
*
|
||||
* If we get status 100 (HTTP_CONTINUE), then we *don't* change states.
|
||||
* Instead, we just return HTTP_CONTINUE to the caller and keep on
|
||||
* tryin'...
|
||||
*/
|
||||
|
||||
if (http->status == HTTP_CONTINUE)
|
||||
return (http->status);
|
||||
|
||||
if (http->status < HTTP_BAD_REQUEST)
|
||||
http->digest_tries = 0;
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
if (http->status == HTTP_SWITCHING_PROTOCOLS && !http->tls)
|
||||
{
|
||||
if (http_setup_ssl(http) != 0)
|
||||
{
|
||||
# ifdef WIN32
|
||||
closesocket(http->fd);
|
||||
# else
|
||||
close(http->fd);
|
||||
# endif /* WIN32 */
|
||||
|
||||
return (HTTP_ERROR);
|
||||
}
|
||||
|
||||
return (HTTP_CONTINUE);
|
||||
}
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
httpGetLength2(http);
|
||||
|
||||
switch (http->state)
|
||||
{
|
||||
case HTTP_GET :
|
||||
case HTTP_POST :
|
||||
case HTTP_POST_RECV :
|
||||
case HTTP_PUT :
|
||||
http->state ++;
|
||||
case HTTP_POST_SEND :
|
||||
case HTTP_HEAD :
|
||||
break;
|
||||
|
||||
default :
|
||||
http->state = HTTP_WAITING;
|
||||
break;
|
||||
}
|
||||
|
||||
return (http->status);
|
||||
}
|
||||
else if (!strncmp(line, "HTTP/", 5))
|
||||
{
|
||||
/*
|
||||
* Got the beginning of a response...
|
||||
*/
|
||||
|
||||
if (sscanf(line, "HTTP/%d.%d%d", &major, &minor, &status) != 3)
|
||||
return (HTTP_ERROR);
|
||||
|
||||
http->version = (http_version_t)(major * 100 + minor);
|
||||
http->status = (http_status_t)status;
|
||||
}
|
||||
else if ((value = strchr(line, ':')) != NULL)
|
||||
{
|
||||
/*
|
||||
* Got a value...
|
||||
*/
|
||||
|
||||
*value++ = '\0';
|
||||
while (isspace(*value & 255))
|
||||
value ++;
|
||||
|
||||
/*
|
||||
* Be tolerants of servers that send unknown attribute fields...
|
||||
*/
|
||||
|
||||
if (!strcasecmp(line, "expect"))
|
||||
{
|
||||
/*
|
||||
* "Expect: 100-continue" or similar...
|
||||
*/
|
||||
|
||||
http->expect = (http_status_t)atoi(value);
|
||||
}
|
||||
else if (!strcasecmp(line, "cookie"))
|
||||
{
|
||||
/*
|
||||
* "Cookie: name=value[; name=value ...]" - replaces previous cookies...
|
||||
*/
|
||||
|
||||
httpSetCookie(http, value);
|
||||
}
|
||||
else if ((field = http_field(line)) == HTTP_FIELD_UNKNOWN)
|
||||
{
|
||||
DEBUG_printf(("1httpUpdate: unknown field %s seen!", line));
|
||||
continue;
|
||||
}
|
||||
else
|
||||
httpSetField(http, field, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_printf(("1httpUpdate: Bad response line \"%s\"!", line));
|
||||
http->status = HTTP_ERROR;
|
||||
return (HTTP_ERROR);
|
||||
}
|
||||
}
|
||||
while (_httpUpdate(http, &status));
|
||||
|
||||
/*
|
||||
* See if there was an error...
|
||||
@@ -2139,10 +2227,10 @@ httpUpdate(http_t *http) /* I - Connection to server */
|
||||
}
|
||||
|
||||
/*
|
||||
* If we haven't already returned, then there is nothing new...
|
||||
* Return the current status...
|
||||
*/
|
||||
|
||||
return (HTTP_CONTINUE);
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
@@ -2406,13 +2494,6 @@ httpWrite2(http_t *http, /* I - Connection to server */
|
||||
http->data_encoding = HTTP_ENCODE_LENGTH;
|
||||
http->data_remaining = 0;
|
||||
}
|
||||
|
||||
if (http->state == HTTP_POST_RECV)
|
||||
http->state ++;
|
||||
else if (http->state == HTTP_PUT_RECV)
|
||||
http->state = HTTP_STATUS;
|
||||
else
|
||||
http->state = HTTP_WAITING;
|
||||
}
|
||||
|
||||
return (bytes);
|
||||
@@ -2786,6 +2867,25 @@ http_read_ssl(http_t *http, /* I - Connection to server */
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
|
||||
#if defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H)
|
||||
/*
|
||||
* 'http_locking_cb()' - Lock/unlock a thread's mutex.
|
||||
*/
|
||||
|
||||
static void
|
||||
http_locking_cb(int mode, /* I - Lock mode */
|
||||
int type, /* I - Lock type */
|
||||
const char *file, /* I - Source file */
|
||||
int line) /* I - Line number */
|
||||
{
|
||||
if (mode & CRYPTO_LOCK)
|
||||
pthread_mutex_lock(http_locks + type);
|
||||
else
|
||||
pthread_mutex_unlock(http_locks + type);
|
||||
}
|
||||
#endif /* HAVE_LIBSSL && HAVE_PTHREAD_H */
|
||||
|
||||
|
||||
/*
|
||||
* 'http_send()' - Send a request with all fields and the trailing blank line.
|
||||
*/
|
||||
@@ -3157,6 +3257,19 @@ http_shutdown_ssl(http_t *http) /* I - Connection to server */
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
|
||||
#if defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H)
|
||||
/*
|
||||
* 'http_threadid_cb()' - Return the current thread ID.
|
||||
*/
|
||||
|
||||
static unsigned long /* O - Thread ID */
|
||||
http_threadid_cb(void)
|
||||
{
|
||||
return ((unsigned long)pthread_self());
|
||||
}
|
||||
#endif /* HAVE_LIBSSL && HAVE_PTHREAD_H */
|
||||
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
/*
|
||||
* 'http_upgrade()' - Force upgrade to TLS encryption.
|
||||
|
||||
+4
-5
@@ -1,10 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Hyper-Text Transport Protocol definitions for the Common UNIX Printing
|
||||
* System (CUPS).
|
||||
* Hyper-Text Transport Protocol definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -88,7 +87,7 @@ extern "C" {
|
||||
#if defined(AF_INET6) && !defined(s6_addr32)
|
||||
# if defined(__sun)
|
||||
# define s6_addr32 _S6_un._S6_u32
|
||||
# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
|
||||
# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)|| defined(__DragonFly__)
|
||||
# define s6_addr32 __u6_addr.__u6_addr32
|
||||
# elif defined(__osf__)
|
||||
# define s6_addr32 s6_un.sa6_laddr
|
||||
@@ -250,7 +249,7 @@ typedef enum http_status_e /**** HTTP status codes ****/
|
||||
HTTP_GATEWAY_TIMEOUT, /* Gateway connection timed out */
|
||||
HTTP_NOT_SUPPORTED, /* HTTP version not supported */
|
||||
|
||||
HTTP_AUTHORIZATION_CANCELED = 1000 /* User cancelled authorization */
|
||||
HTTP_AUTHORIZATION_CANCELED = 1000 /* User canceled authorization */
|
||||
|
||||
} http_status_t;
|
||||
|
||||
|
||||
+88
-38
@@ -1,10 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Internet Printing Protocol support functions for the Common UNIX
|
||||
* Printing System (CUPS).
|
||||
* Internet Printing Protocol functions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -186,6 +185,8 @@ ippAddCollection(ipp_t *ipp, /* I - IPP message */
|
||||
attr->value_tag = IPP_TAG_BEGIN_COLLECTION;
|
||||
attr->values[0].collection = value;
|
||||
|
||||
value->use ++;
|
||||
|
||||
return (attr);
|
||||
}
|
||||
|
||||
@@ -224,10 +225,15 @@ ippAddCollections(
|
||||
attr->value_tag = IPP_TAG_BEGIN_COLLECTION;
|
||||
|
||||
if (values != NULL)
|
||||
{
|
||||
for (i = 0, value = attr->values;
|
||||
i < num_values;
|
||||
i ++, value ++)
|
||||
{
|
||||
value->collection = (ipp_t *)values[i];
|
||||
value->collection->use ++;
|
||||
}
|
||||
}
|
||||
|
||||
return (attr);
|
||||
}
|
||||
@@ -425,7 +431,8 @@ ippAddString(ipp_t *ipp, /* I - IPP message */
|
||||
value = "en";
|
||||
|
||||
/*
|
||||
* Convert language values to lowercase and change _ to - as needed...
|
||||
* Convert language and charset values to lowercase and change _ to - as
|
||||
* needed...
|
||||
*/
|
||||
|
||||
if ((type == IPP_TAG_LANGUAGE || type == IPP_TAG_CHARSET) && value)
|
||||
@@ -473,6 +480,8 @@ ippAddStrings(
|
||||
int i; /* Looping var */
|
||||
ipp_attribute_t *attr; /* New attribute */
|
||||
ipp_value_t *value; /* Current value */
|
||||
char buffer[1024], /* Language/charset value buffer */
|
||||
*bufptr; /* Pointer into buffer */
|
||||
|
||||
|
||||
DEBUG_printf(("ippAddStrings(ipp=%p, group=%02x(%s), type=%02x(%s), "
|
||||
@@ -506,16 +515,36 @@ ippAddStrings(
|
||||
|
||||
if (values != NULL)
|
||||
{
|
||||
/*
|
||||
* Force language to be English for the POSIX locale...
|
||||
*/
|
||||
if ((int)type & IPP_TAG_COPY)
|
||||
value->string.text = (char *)values[i];
|
||||
else if (type == IPP_TAG_LANGUAGE && !strcasecmp(values[i], "C"))
|
||||
{
|
||||
/*
|
||||
* Force language to be English for the POSIX locale...
|
||||
*/
|
||||
|
||||
if (type == IPP_TAG_LANGUAGE && !strcasecmp(values[i], "C"))
|
||||
value->string.text = ((int)type & IPP_TAG_COPY) ? "en" :
|
||||
_cupsStrAlloc("en");
|
||||
}
|
||||
else if (type == IPP_TAG_LANGUAGE || type == IPP_TAG_CHARSET)
|
||||
{
|
||||
/*
|
||||
* Convert language values to lowercase and change _ to - as needed...
|
||||
*/
|
||||
|
||||
strlcpy(buffer, values[i], sizeof(buffer));
|
||||
|
||||
for (bufptr = buffer; *bufptr; bufptr ++)
|
||||
if (*bufptr == '_')
|
||||
*bufptr = '-';
|
||||
else
|
||||
*bufptr = tolower(*bufptr & 255);
|
||||
|
||||
value->string.text = _cupsStrAlloc(buffer);
|
||||
}
|
||||
else
|
||||
value->string.text = ((int)type & IPP_TAG_COPY) ? (char *)values[i] :
|
||||
_cupsStrAlloc(values[i]);
|
||||
value->string.text = _cupsStrAlloc(values[i]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -776,6 +805,10 @@ ippDelete(ipp_t *ipp) /* I - IPP message */
|
||||
if (!ipp)
|
||||
return;
|
||||
|
||||
ipp->use --;
|
||||
if (ipp->use > 0)
|
||||
return;
|
||||
|
||||
for (attr = ipp->attrs; attr != NULL; attr = next)
|
||||
{
|
||||
next = attr->next;
|
||||
@@ -950,6 +983,7 @@ ippNew(void)
|
||||
|
||||
temp->request.any.version[0] = 1;
|
||||
temp->request.any.version[1] = 1;
|
||||
temp->use = 1;
|
||||
}
|
||||
|
||||
DEBUG_printf(("1ippNew: Returning %p", temp));
|
||||
@@ -1241,7 +1275,9 @@ ippReadIO(void *src, /* I - Data source */
|
||||
|
||||
attr->value_tag = tag;
|
||||
}
|
||||
else if ((value_tag >= IPP_TAG_TEXTLANG &&
|
||||
else if (value_tag == IPP_TAG_TEXTLANG ||
|
||||
value_tag == IPP_TAG_NAMELANG ||
|
||||
(value_tag >= IPP_TAG_TEXT &&
|
||||
value_tag <= IPP_TAG_MIMETYPE))
|
||||
{
|
||||
/*
|
||||
@@ -1249,8 +1285,9 @@ ippReadIO(void *src, /* I - Data source */
|
||||
* forms; accept sets of differing values...
|
||||
*/
|
||||
|
||||
if ((tag < IPP_TAG_TEXTLANG || tag > IPP_TAG_MIMETYPE) &&
|
||||
tag != IPP_TAG_NOVALUE)
|
||||
if (tag != IPP_TAG_TEXTLANG && tag != IPP_TAG_NAMELANG &&
|
||||
(tag < IPP_TAG_TEXT || tag > IPP_TAG_MIMETYPE) &&
|
||||
tag != IPP_TAG_NOVALUE)
|
||||
{
|
||||
DEBUG_printf(("1ippReadIO: 1setOf value tag %x(%s) != %x(%s)",
|
||||
value_tag, ippTagString(value_tag), tag,
|
||||
@@ -1871,6 +1908,12 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
*bufptr++ = ipp->request.any.request_id >> 8;
|
||||
*bufptr++ = ipp->request.any.request_id;
|
||||
|
||||
DEBUG_printf(("2ippWriteIO: version=%d.%d", buffer[0], buffer[1]));
|
||||
DEBUG_printf(("2ippWriteIO: op_status=%04x",
|
||||
ipp->request.any.op_status));
|
||||
DEBUG_printf(("2ippWriteIO: request_id=%d",
|
||||
ipp->request.any.request_id));
|
||||
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("1ippWriteIO: Could not write IPP header...");
|
||||
@@ -1888,11 +1931,7 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
ipp->current = ipp->attrs;
|
||||
ipp->curtag = IPP_TAG_ZERO;
|
||||
|
||||
DEBUG_printf(("2ippWriteIO: version=%d.%d", buffer[0], buffer[1]));
|
||||
DEBUG_printf(("2ippWriteIO: op_status=%04x",
|
||||
ipp->request.any.op_status));
|
||||
DEBUG_printf(("2ippWriteIO: request_id=%d",
|
||||
ipp->request.any.request_id));
|
||||
DEBUG_printf(("1ippWriteIO: ipp->current=%p", ipp->current));
|
||||
|
||||
/*
|
||||
* If blocking is disabled, stop here...
|
||||
@@ -1913,23 +1952,30 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
|
||||
ipp->current = ipp->current->next;
|
||||
|
||||
if (ipp->curtag != attr->group_tag && parent == NULL)
|
||||
if (!parent)
|
||||
{
|
||||
/*
|
||||
* Send a group tag byte...
|
||||
*/
|
||||
if (ipp->curtag != attr->group_tag)
|
||||
{
|
||||
/*
|
||||
* Send a group tag byte...
|
||||
*/
|
||||
|
||||
ipp->curtag = attr->group_tag;
|
||||
ipp->curtag = attr->group_tag;
|
||||
|
||||
if (attr->group_tag == IPP_TAG_ZERO)
|
||||
if (attr->group_tag == IPP_TAG_ZERO)
|
||||
continue;
|
||||
|
||||
DEBUG_printf(("2ippWriteIO: wrote group tag=%x(%s)",
|
||||
attr->group_tag, ippTagString(attr->group_tag)));
|
||||
*bufptr++ = attr->group_tag;
|
||||
}
|
||||
else if (attr->group_tag == IPP_TAG_ZERO)
|
||||
continue;
|
||||
|
||||
DEBUG_printf(("2ippWriteIO: wrote group tag=%x(%s)",
|
||||
attr->group_tag, ippTagString(attr->group_tag)));
|
||||
*bufptr++ = attr->group_tag;
|
||||
}
|
||||
else if (attr->group_tag == IPP_TAG_ZERO)
|
||||
continue;
|
||||
|
||||
DEBUG_printf(("1ippWriteIO: %s (%s%s)", attr->name,
|
||||
attr->num_values > 1 ? "1setOf " : "",
|
||||
ippTagString(attr->value_tag)));
|
||||
|
||||
/*
|
||||
* Write the attribute tag and name. The current implementation
|
||||
@@ -2602,15 +2648,18 @@ ippWriteIO(void *dst, /* I - Destination */
|
||||
* Write the data out...
|
||||
*/
|
||||
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
if (bufptr > buffer)
|
||||
{
|
||||
DEBUG_puts("1ippWriteIO: Could not write IPP attribute...");
|
||||
ipp_buffer_release(buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
|
||||
{
|
||||
DEBUG_puts("1ippWriteIO: Could not write IPP attribute...");
|
||||
ipp_buffer_release(buffer);
|
||||
return (IPP_ERROR);
|
||||
}
|
||||
|
||||
DEBUG_printf(("2ippWriteIO: wrote %d bytes",
|
||||
(int)(bufptr - buffer)));
|
||||
DEBUG_printf(("2ippWriteIO: wrote %d bytes",
|
||||
(int)(bufptr - buffer)));
|
||||
}
|
||||
|
||||
/*
|
||||
* If blocking is disabled, stop here...
|
||||
@@ -2720,6 +2769,7 @@ _ippFreeAttr(ipp_attribute_t *attr) /* I - Attribute to free */
|
||||
{
|
||||
case IPP_TAG_TEXT :
|
||||
case IPP_TAG_NAME :
|
||||
case IPP_TAG_RESERVED_STRING :
|
||||
case IPP_TAG_KEYWORD :
|
||||
case IPP_TAG_URI :
|
||||
case IPP_TAG_URISCHEME :
|
||||
@@ -2979,7 +3029,7 @@ ipp_read_http(http_t *http, /* I - Client connection */
|
||||
int tbytes, /* Total bytes read */
|
||||
bytes; /* Bytes read this pass */
|
||||
char len[32]; /* Length string */
|
||||
|
||||
|
||||
|
||||
DEBUG_printf(("7ipp_read_http(http=%p, buffer=%p, length=%d)",
|
||||
http, buffer, (int)length));
|
||||
|
||||
+17
-14
@@ -1,10 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Internet Printing Protocol definitions for the Common UNIX Printing
|
||||
* System (CUPS).
|
||||
* Internet Printing Protocol definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -64,7 +63,7 @@ extern "C" {
|
||||
* Types and structures...
|
||||
*/
|
||||
|
||||
typedef enum ipp_tag_e /**** Format tags for attributes... ****/
|
||||
typedef enum ipp_tag_e /**** Format tags for attributes ****/
|
||||
{
|
||||
IPP_TAG_ZERO = 0x00, /* Zero tag - used for separators */
|
||||
IPP_TAG_OPERATION, /* Operation group */
|
||||
@@ -94,7 +93,8 @@ typedef enum ipp_tag_e /**** Format tags for attributes... ****/
|
||||
IPP_TAG_END_COLLECTION, /* End of collection value */
|
||||
IPP_TAG_TEXT = 0x41, /* Text value */
|
||||
IPP_TAG_NAME, /* Name value */
|
||||
IPP_TAG_KEYWORD = 0x44, /* Keyword value */
|
||||
IPP_TAG_RESERVED_STRING, /* Reserved for future string value @private@ */
|
||||
IPP_TAG_KEYWORD, /* Keyword value */
|
||||
IPP_TAG_URI, /* URI value */
|
||||
IPP_TAG_URISCHEME, /* URI scheme value */
|
||||
IPP_TAG_CHARSET, /* Character set value */
|
||||
@@ -105,13 +105,13 @@ typedef enum ipp_tag_e /**** Format tags for attributes... ****/
|
||||
IPP_TAG_COPY = -0x7fffffff-1 /* Bitflag for copied attribute values */
|
||||
} ipp_tag_t;
|
||||
|
||||
typedef enum ipp_res_e /**** Resolution units... ****/
|
||||
typedef enum ipp_res_e /**** Resolution units ****/
|
||||
{
|
||||
IPP_RES_PER_INCH = 3, /* Pixels per inch */
|
||||
IPP_RES_PER_CM /* Pixels per centimeter */
|
||||
} ipp_res_t;
|
||||
|
||||
typedef enum ipp_finish_e /**** Finishings... ****/
|
||||
typedef enum ipp_finish_e /**** Finishings ****/
|
||||
{
|
||||
IPP_FINISHINGS_NONE = 3, /* No finishing */
|
||||
IPP_FINISHINGS_STAPLE, /* Staple (any location) */
|
||||
@@ -143,7 +143,7 @@ typedef enum ipp_finish_e /**** Finishings... ****/
|
||||
IPP_FINISHINGS_BIND_BOTTOM /* Bind on bottom */
|
||||
} ipp_finish_t;
|
||||
|
||||
typedef enum ipp_orient_e /**** Orientation... ****/
|
||||
typedef enum ipp_orient_e /**** Orientation values ****/
|
||||
{
|
||||
IPP_PORTRAIT = 3, /* No rotation */
|
||||
IPP_LANDSCAPE, /* 90 degrees counter-clockwise */
|
||||
@@ -151,14 +151,14 @@ typedef enum ipp_orient_e /**** Orientation... ****/
|
||||
IPP_REVERSE_PORTRAIT /* 180 degrees */
|
||||
} ipp_orient_t;
|
||||
|
||||
typedef enum ipp_quality_e /**** Qualities... ****/
|
||||
typedef enum ipp_quality_e /**** Qualities ****/
|
||||
{
|
||||
IPP_QUALITY_DRAFT = 3, /* Draft quality */
|
||||
IPP_QUALITY_NORMAL, /* Normal quality */
|
||||
IPP_QUALITY_HIGH /* High quality */
|
||||
} ipp_quality_t;
|
||||
|
||||
typedef enum ipp_jstate_e /**** Job States.... */
|
||||
typedef enum ipp_jstate_e /**** Job states ****/
|
||||
{
|
||||
IPP_JOB_PENDING = 3, /* Job is waiting to be printed */
|
||||
IPP_JOB_HELD, /* Job is held for printing */
|
||||
@@ -170,14 +170,14 @@ typedef enum ipp_jstate_e /**** Job States.... */
|
||||
} ipp_jstate_t;
|
||||
#define IPP_JOB_CANCELLED IPP_JOB_CANCELED
|
||||
|
||||
typedef enum ipp_pstate_e /**** Printer States.... */
|
||||
typedef enum ipp_pstate_e /**** Printer states ****/
|
||||
{
|
||||
IPP_PRINTER_IDLE = 3, /* Printer is idle */
|
||||
IPP_PRINTER_PROCESSING, /* Printer is working */
|
||||
IPP_PRINTER_STOPPED /* Printer is stopped */
|
||||
} ipp_pstate_t;
|
||||
|
||||
typedef enum ipp_state_e /**** IPP states... ****/
|
||||
typedef enum ipp_state_e /**** IPP states ****/
|
||||
{
|
||||
IPP_ERROR = -1, /* An error occurred */
|
||||
IPP_IDLE, /* Nothing is happening/request completed */
|
||||
@@ -186,7 +186,7 @@ typedef enum ipp_state_e /**** IPP states... ****/
|
||||
IPP_DATA /* IPP request data needs to be sent/received */
|
||||
} ipp_state_t;
|
||||
|
||||
typedef enum ipp_op_e /**** IPP operations... ****/
|
||||
typedef enum ipp_op_e /**** IPP operations ****/
|
||||
{
|
||||
IPP_PRINT_JOB = 0x0002, /* Print a single file */
|
||||
IPP_PRINT_URI, /* Print a single URL @private@ */
|
||||
@@ -255,7 +255,7 @@ typedef enum ipp_op_e /**** IPP operations... ****/
|
||||
#define CUPS_ADD_PRINTER CUPS_ADD_MODIFY_PRINTER
|
||||
#define CUPS_ADD_CLASS CUPS_ADD_MODIFY_CLASS
|
||||
|
||||
typedef enum ipp_status_e /**** IPP status codes... ****/
|
||||
typedef enum ipp_status_e /**** IPP status codes ****/
|
||||
{
|
||||
IPP_OK = 0x0000, /* successful-ok */
|
||||
IPP_OK_SUBST, /* successful-ok-ignored-or-substituted-attributes */
|
||||
@@ -405,6 +405,9 @@ struct ipp_s /**** IPP Request/Response/Notification ****/
|
||||
|
||||
/**** New in CUPS 1.2 ****/
|
||||
ipp_attribute_t *prev; /* Previous attribute (for read) @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
|
||||
/**** New in CUPS 1.5 ****/
|
||||
int use; /* Use count */
|
||||
};
|
||||
|
||||
|
||||
|
||||
+11
-3
@@ -267,9 +267,17 @@ _cupsEncodingName(
|
||||
{
|
||||
if (encoding < 0 ||
|
||||
encoding >= (sizeof(lang_encodings) / sizeof(const char *)))
|
||||
{
|
||||
DEBUG_printf(("1_cupsEncodingName(encoding=%d) = out of range (\"%s\")",
|
||||
encoding, lang_encodings[0]));
|
||||
return (lang_encodings[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_printf(("1_cupsEncodingName(encoding=%d) = \"%s\"",
|
||||
encoding, lang_encodings[encoding]));
|
||||
return (lang_encodings[encoding]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -497,7 +505,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
*/
|
||||
|
||||
for (ptr = charset, csptr ++; *csptr; csptr ++)
|
||||
if (ptr < (charset + sizeof(charset) - 1) && isalnum(*csptr & 255))
|
||||
if (ptr < (charset + sizeof(charset) - 1) && _cups_isalnum(*csptr))
|
||||
*ptr++ = *csptr;
|
||||
|
||||
*ptr = '\0';
|
||||
@@ -557,7 +565,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
*/
|
||||
|
||||
for (ptr = charset; *csptr; csptr ++)
|
||||
if (isalnum(*csptr & 255) && ptr < (charset + sizeof(charset) - 1))
|
||||
if (_cups_isalnum(*csptr) && ptr < (charset + sizeof(charset) - 1))
|
||||
*ptr++ = *csptr;
|
||||
|
||||
*ptr = '\0';
|
||||
@@ -624,7 +632,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
*/
|
||||
|
||||
for (language ++, ptr = charset; *language; language ++)
|
||||
if (isalnum(*language & 255) && ptr < (charset + sizeof(charset) - 1))
|
||||
if (_cups_isalnum(*language) && ptr < (charset + sizeof(charset) - 1))
|
||||
*ptr++ = toupper(*language & 255);
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
+21
-5
@@ -2,8 +2,6 @@ __cups_debug_fd
|
||||
__cups_debug_printf
|
||||
__cups_debug_puts
|
||||
__cups_strcpy
|
||||
__cupsAdminGetServerSettings
|
||||
__cupsAdminSetServerSettings
|
||||
__cupsAppleLanguage
|
||||
__cupsCharmapFlush
|
||||
__cupsCharmapFree
|
||||
@@ -21,9 +19,6 @@ __cupsMD5Init
|
||||
__cupsMessageFree
|
||||
__cupsMessageLoad
|
||||
__cupsMessageLookup
|
||||
__cupsPWGMediaByName
|
||||
__cupsPWGMediaByLegacy
|
||||
__cupsPWGMediaBySize
|
||||
__cupsSetError
|
||||
__cupsSetLocale
|
||||
__cupsSNMPClose
|
||||
@@ -62,6 +57,27 @@ __ppdHashName
|
||||
__ppdLocalizedAttr
|
||||
__ppdNormalizeMakeAndModel
|
||||
__ppdParseOptions
|
||||
__pwgCreateWithFile
|
||||
__pwgCreateWithPPD
|
||||
__pwgDestroy
|
||||
__pwgGenerateSize
|
||||
__pwgGetBin
|
||||
__pwgGetInputSlot
|
||||
__pwgGetMediaType
|
||||
__pwgGetOutputBin
|
||||
__pwgGetPageSize
|
||||
__pwgGetSize
|
||||
__pwgGetSource
|
||||
__pwgGetType
|
||||
__pwgInitSize
|
||||
__pwgInputSlotForSource
|
||||
__pwgMediaForLegacy
|
||||
__pwgMediaForPPD
|
||||
__pwgMediaForPWG
|
||||
__pwgMediaForSize
|
||||
__pwgMediaTypeForType
|
||||
__pwgPageSizeForMedia
|
||||
__pwgWriteFile
|
||||
_cupsAddDest
|
||||
_cupsAddOption
|
||||
_cupsAdminCreateWindowsPPD
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
LIBRARY libcups2
|
||||
VERSION 2.7
|
||||
EXPORTS
|
||||
_cupsAdminGetServerSettings
|
||||
_cupsAdminSetServerSettings
|
||||
_cupsCharmapFlush
|
||||
_cupsCharmapFree
|
||||
_cupsCharmapGet
|
||||
|
||||
+24
-6
@@ -1,12 +1,11 @@
|
||||
_cups_debug_fd
|
||||
_cupsAdminGetServerSettings
|
||||
_cupsAdminSetServerSettings
|
||||
_cupsCharmapFlush
|
||||
_cupsCharmapFree
|
||||
_cupsCharmapGet
|
||||
_cupsEncodingName
|
||||
_cupsGetPassword
|
||||
_cupsGlobals
|
||||
_cupsLangPrintError
|
||||
_cupsLangPrintf
|
||||
_cupsLangPuts
|
||||
_cupsLangString
|
||||
@@ -16,9 +15,6 @@ _cupsMD5Init
|
||||
_cupsMessageFree
|
||||
_cupsMessageLoad
|
||||
_cupsMessageLookup
|
||||
_cupsPWGMediaByName
|
||||
_cupsPWGMediaByLegacy
|
||||
_cupsPWGMediaBySize
|
||||
_cupsSetError
|
||||
_cupsSetLocale
|
||||
_cupsSNMPClose
|
||||
@@ -50,6 +46,7 @@ _httpBIOMethods
|
||||
_httpCreate
|
||||
_httpEncodeURI
|
||||
_httpResolveURI
|
||||
_httpWait
|
||||
_ippAddAttr
|
||||
_ippFreeAttr
|
||||
_ppdFreeLanguages
|
||||
@@ -59,4 +56,25 @@ _ppdGetLanguages
|
||||
_ppdHashName
|
||||
_ppdLocalizedAttr
|
||||
_ppdNormalizeMakeAndModel
|
||||
_ppdParseOptions
|
||||
_ppdParseOptions
|
||||
_pwgCreateWithFile
|
||||
_pwgDestroy
|
||||
_pwgWriteFile
|
||||
_pwgGenerateSize
|
||||
_pwgInitSize
|
||||
_pwgMediaForLegacy
|
||||
_pwgMediaForPPD
|
||||
_pwgMediaForPWG
|
||||
_pwgMediaForSize
|
||||
_pwgCreateWithPPD
|
||||
_pwgGetBin
|
||||
_pwgGetInputSlot
|
||||
_pwgGetMediaType
|
||||
_pwgGetOutputBin
|
||||
_pwgGetPageSize
|
||||
_pwgGetSize
|
||||
_pwgGetSource
|
||||
_pwgGetType
|
||||
_pwgInputSlotForSource
|
||||
_pwgMediaTypeForType
|
||||
_pwgPageSizeForMedia
|
||||
|
||||
+8
-8
@@ -389,7 +389,7 @@ ppdLocalizeIPPReason(
|
||||
|
||||
valptr += 5;
|
||||
|
||||
while (*valptr && !isspace(*valptr & 255) && bufptr < bufend)
|
||||
while (*valptr && !_cups_isspace(*valptr) && bufptr < bufend)
|
||||
{
|
||||
if (*valptr == '%' && isxdigit(valptr[1] & 255) &&
|
||||
isxdigit(valptr[2] & 255))
|
||||
@@ -427,7 +427,7 @@ ppdLocalizeIPPReason(
|
||||
* Skip this URI...
|
||||
*/
|
||||
|
||||
while (*valptr && !isspace(*valptr & 255))
|
||||
while (*valptr && !_cups_isspace(*valptr))
|
||||
valptr++;
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ ppdLocalizeIPPReason(
|
||||
* Skip whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*valptr & 255))
|
||||
while (_cups_isspace(*valptr))
|
||||
valptr ++;
|
||||
}
|
||||
|
||||
@@ -463,7 +463,7 @@ ppdLocalizeIPPReason(
|
||||
* Copy URI...
|
||||
*/
|
||||
|
||||
while (*valptr && !isspace(*valptr & 255) && bufptr < bufend)
|
||||
while (*valptr && !_cups_isspace(*valptr) && bufptr < bufend)
|
||||
*bufptr++ = *valptr++;
|
||||
|
||||
*bufptr = '\0';
|
||||
@@ -476,7 +476,7 @@ ppdLocalizeIPPReason(
|
||||
* Skip this URI...
|
||||
*/
|
||||
|
||||
while (*valptr && !isspace(*valptr & 255))
|
||||
while (*valptr && !_cups_isspace(*valptr))
|
||||
valptr++;
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@ ppdLocalizeIPPReason(
|
||||
* Skip whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*valptr & 255))
|
||||
while (_cups_isspace(*valptr))
|
||||
valptr ++;
|
||||
}
|
||||
|
||||
@@ -598,7 +598,7 @@ _ppdGetLanguages(ppd_file_t *ppd) /* I - PPD file */
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
while (_cups_isspace(*ptr))
|
||||
ptr ++;
|
||||
|
||||
if (!*ptr)
|
||||
@@ -608,7 +608,7 @@ _ppdGetLanguages(ppd_file_t *ppd) /* I - PPD file */
|
||||
* Find the end of this language name...
|
||||
*/
|
||||
|
||||
for (start = ptr; *ptr && !isspace(*ptr & 255); ptr ++);
|
||||
for (start = ptr; *ptr && !_cups_isspace(*ptr); ptr ++);
|
||||
|
||||
if (*ptr)
|
||||
*ptr++ = '\0';
|
||||
|
||||
+170
-325
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Option marking routines for the Common UNIX Printing System (CUPS).
|
||||
* Option marking routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -29,13 +29,11 @@
|
||||
* ppdFirstOption() - Return the first option in the PPD file.
|
||||
* ppdNextOption() - Return the next option in the PPD file.
|
||||
* _ppdParseOptions() - Parse options from a PPD file.
|
||||
* debug_marked() - Output the marked array to stdout...
|
||||
* ppd_debug_marked() - Output the marked array to stdout...
|
||||
* ppd_defaults() - Set the defaults for this group and all sub-groups.
|
||||
* ppd_mark_choices() - Mark one or more option choices from a string.
|
||||
* ppd_mark_option() - Quickly mark an option without checking for
|
||||
* conflicts.
|
||||
* ppd_mark_size() - Quickly mark a page size without checking for
|
||||
* conflicts.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -45,7 +43,8 @@
|
||||
#include "cups.h"
|
||||
#include "string.h"
|
||||
#include "debug.h"
|
||||
#include "pwgmedia.h"
|
||||
#include "ppd-private.h"
|
||||
#include "pwg-private.h"
|
||||
|
||||
|
||||
/*
|
||||
@@ -53,15 +52,14 @@
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static void debug_marked(ppd_file_t *ppd, const char *title);
|
||||
static void ppd_debug_marked(ppd_file_t *ppd, const char *title);
|
||||
#else
|
||||
# define debug_marked(ppd,title)
|
||||
# define ppd_debug_marked(ppd,title)
|
||||
#endif /* DEBUG */
|
||||
static void ppd_defaults(ppd_file_t *ppd, ppd_group_t *g);
|
||||
static void ppd_mark_choices(ppd_file_t *ppd, const char *s);
|
||||
static void ppd_mark_option(ppd_file_t *ppd, const char *option,
|
||||
const char *choice);
|
||||
static void ppd_mark_size(ppd_file_t *ppd, const char *size);
|
||||
|
||||
|
||||
/*
|
||||
@@ -78,41 +76,20 @@ cupsMarkOptions(
|
||||
int num_options, /* I - Number of options */
|
||||
cups_option_t *options) /* I - Options */
|
||||
{
|
||||
int i, j, k; /* Looping vars */
|
||||
int i, j; /* Looping vars */
|
||||
char *ptr, /* Pointer into string */
|
||||
s[255]; /* Temporary string */
|
||||
const char *val, /* Pointer into value */
|
||||
*media, /* media option */
|
||||
*media_col, /* media-col option */
|
||||
*page_size; /* PageSize option */
|
||||
*output_bin, /* output-bin option */
|
||||
*output_mode, /* output-mode option */
|
||||
*page_size, /* PageSize option */
|
||||
*ppd_keyword, /* PPD keyword */
|
||||
*print_quality, /* print-quality option */
|
||||
*sides; /* sides option */
|
||||
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 */
|
||||
};
|
||||
_pwg_t *pwg; /* PWG mapping data */
|
||||
|
||||
|
||||
/*
|
||||
@@ -122,79 +99,42 @@ cupsMarkOptions(
|
||||
if (!ppd || num_options <= 0 || !options)
|
||||
return (0);
|
||||
|
||||
debug_marked(ppd, "Before...");
|
||||
ppd_debug_marked(ppd, "Before...");
|
||||
|
||||
/*
|
||||
* Do special handling for media, media-col, and PageSize...
|
||||
* Do special handling for finishings, media, output-bin, output-mode,
|
||||
* print-color-mode, print-quality, and PageSize...
|
||||
*/
|
||||
|
||||
media = cupsGetOption("media", num_options, options);
|
||||
media_col = cupsGetOption("media-col", num_options, options);
|
||||
page_size = cupsGetOption("PageSize", num_options, options);
|
||||
media = cupsGetOption("media", num_options, options);
|
||||
output_bin = cupsGetOption("output-bin", num_options, options);
|
||||
output_mode = cupsGetOption("output-mode", num_options, options);
|
||||
page_size = cupsGetOption("PageSize", num_options, options);
|
||||
print_quality = cupsGetOption("print-quality", num_options, options);
|
||||
sides = cupsGetOption("sides", num_options, options);
|
||||
|
||||
if (media_col && (!page_size || !page_size[0]))
|
||||
if ((media || output_bin || output_mode || print_quality || sides) &&
|
||||
!ppd->pwg)
|
||||
{
|
||||
/*
|
||||
* Pull out the corresponding media size from the media-col value...
|
||||
* Load PWG mapping data as needed...
|
||||
*/
|
||||
|
||||
int num_media_cols, /* Number of media-col values */
|
||||
num_media_sizes;/* Number of media-size values */
|
||||
cups_option_t *media_cols, /* media-col values */
|
||||
*media_sizes; /* media-size values */
|
||||
|
||||
|
||||
num_media_cols = cupsParseOptions(media_col, 0, &media_cols);
|
||||
|
||||
if ((val = cupsGetOption("media-key", num_media_cols, media_cols)) != NULL)
|
||||
media = val;
|
||||
else if ((val = cupsGetOption("media-size", num_media_cols,
|
||||
media_cols)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Lookup by dimensions...
|
||||
*/
|
||||
|
||||
double width, /* Width in points */
|
||||
length; /* Length in points */
|
||||
struct lconv *loc; /* Locale data */
|
||||
_cups_pwg_media_t *pwgmedia; /* PWG media name */
|
||||
|
||||
|
||||
num_media_sizes = cupsParseOptions(val, 0, &media_sizes);
|
||||
loc = localeconv();
|
||||
|
||||
if ((val = cupsGetOption("x-dimension", num_media_sizes,
|
||||
media_sizes)) != NULL)
|
||||
width = _cupsStrScand(val, NULL, loc) * 2540.0 / 72.0;
|
||||
else
|
||||
width = 0.0;
|
||||
|
||||
if ((val = cupsGetOption("y-dimension", num_media_sizes,
|
||||
media_sizes)) != NULL)
|
||||
length = _cupsStrScand(val, NULL, loc) * 2540.0 / 72.0;
|
||||
else
|
||||
length = 0.0;
|
||||
|
||||
if ((pwgmedia = _cupsPWGMediaBySize(width, length)) != NULL)
|
||||
media = pwgmedia->pwg;
|
||||
|
||||
cupsFreeOptions(num_media_sizes, media_sizes);
|
||||
}
|
||||
|
||||
cupsFreeOptions(num_media_cols, media_cols);
|
||||
ppd->pwg = _pwgCreateWithPPD(ppd);
|
||||
}
|
||||
|
||||
pwg = (_pwg_t *)ppd->pwg;
|
||||
|
||||
if (media)
|
||||
{
|
||||
/*
|
||||
* Loop through the option string, separating it at commas and
|
||||
* marking each individual option as long as the corresponding
|
||||
* PPD option (PageSize, InputSlot, etc.) is not also set.
|
||||
* Loop through the option string, separating it at commas and marking each
|
||||
* individual option as long as the corresponding PPD option (PageSize,
|
||||
* InputSlot, etc.) is not also set.
|
||||
*
|
||||
* For PageSize, we also check for an empty option value since
|
||||
* some versions of MacOS X use it to specify auto-selection
|
||||
* of the media based solely on the size.
|
||||
* For PageSize, we also check for an empty option value since some versions
|
||||
* of MacOS X use it to specify auto-selection of the media based solely on
|
||||
* the size.
|
||||
*/
|
||||
|
||||
for (val = media; *val;)
|
||||
@@ -215,23 +155,114 @@ cupsMarkOptions(
|
||||
*/
|
||||
|
||||
if (!page_size || !page_size[0])
|
||||
ppd_mark_size(ppd, s);
|
||||
{
|
||||
if (!strncasecmp(s, "Custom.", 7) || ppdPageSize(ppd, s))
|
||||
ppd_mark_option(ppd, "PageSize", s);
|
||||
else if ((ppd_keyword = _pwgGetPageSize(pwg, NULL, s, NULL)) != NULL)
|
||||
ppd_mark_option(ppd, "PageSize", ppd_keyword);
|
||||
}
|
||||
|
||||
if (cupsGetOption("InputSlot", num_options, options) == NULL)
|
||||
ppd_mark_option(ppd, "InputSlot", s);
|
||||
if (pwg && pwg->source_option &&
|
||||
!cupsGetOption(pwg->source_option, num_options, options) &&
|
||||
(ppd_keyword = _pwgGetInputSlot(pwg, NULL, s)) != NULL)
|
||||
ppd_mark_option(ppd, pwg->source_option, ppd_keyword);
|
||||
|
||||
if (cupsGetOption("MediaType", num_options, options) == NULL)
|
||||
ppd_mark_option(ppd, "MediaType", s);
|
||||
if (!cupsGetOption("MediaType", num_options, options) &&
|
||||
(ppd_keyword = _pwgGetMediaType(pwg, NULL, s)) != NULL)
|
||||
ppd_mark_option(ppd, "MediaType", ppd_keyword);
|
||||
}
|
||||
}
|
||||
|
||||
if (cupsGetOption("EFMediaType", num_options, options) == NULL)
|
||||
ppd_mark_option(ppd, "EFMediaType", s); /* EFI */
|
||||
if (pwg)
|
||||
{
|
||||
if (!cupsGetOption("com.apple.print.DocumentTicket.PMSpoolFormat",
|
||||
num_options, options) &&
|
||||
!cupsGetOption("APPrinterPreset", num_options, options) &&
|
||||
(output_mode || print_quality))
|
||||
{
|
||||
/*
|
||||
* Map output-mode and print-quality to a preset...
|
||||
*/
|
||||
|
||||
if (cupsGetOption("EFMediaQualityMode", num_options, options) == NULL)
|
||||
ppd_mark_option(ppd, "EFMediaQualityMode", s); /* EFI */
|
||||
_pwg_output_mode_t pwg_om; /* output-mode index */
|
||||
_pwg_print_quality_t pwg_pq; /* print-quality index */
|
||||
cups_option_t *preset;/* Current preset option */
|
||||
|
||||
if (!strcasecmp(s, "manual") &&
|
||||
!cupsGetOption("ManualFeed", num_options, options))
|
||||
ppd_mark_option(ppd, "ManualFeed", "True");
|
||||
if (output_mode && !strcmp(output_mode, "monochrome"))
|
||||
pwg_om = _PWG_OUTPUT_MODE_MONOCHROME;
|
||||
else
|
||||
pwg_om = _PWG_OUTPUT_MODE_COLOR;
|
||||
|
||||
if (print_quality)
|
||||
{
|
||||
pwg_pq = atoi(print_quality) - IPP_QUALITY_DRAFT;
|
||||
if (pwg_pq < _PWG_PRINT_QUALITY_DRAFT)
|
||||
pwg_pq = _PWG_PRINT_QUALITY_DRAFT;
|
||||
else if (pwg_pq > _PWG_PRINT_QUALITY_HIGH)
|
||||
pwg_pq = _PWG_PRINT_QUALITY_HIGH;
|
||||
}
|
||||
else
|
||||
pwg_pq = _PWG_PRINT_QUALITY_NORMAL;
|
||||
|
||||
if (pwg->num_presets[pwg_om][pwg_pq] == 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[pwg_om][_PWG_PRINT_QUALITY_NORMAL] > 0)
|
||||
pwg_pq = _PWG_PRINT_QUALITY_NORMAL;
|
||||
else if (pwg->num_presets[_PWG_OUTPUT_MODE_COLOR][pwg_pq] > 0)
|
||||
pwg_om = _PWG_OUTPUT_MODE_COLOR;
|
||||
else
|
||||
{
|
||||
pwg_pq = _PWG_PRINT_QUALITY_NORMAL;
|
||||
pwg_om = _PWG_OUTPUT_MODE_COLOR;
|
||||
}
|
||||
}
|
||||
|
||||
if (pwg->num_presets[pwg_om][pwg_pq] > 0)
|
||||
{
|
||||
/*
|
||||
* Copy the preset options as long as the corresponding names are not
|
||||
* already defined in the IPP request...
|
||||
*/
|
||||
|
||||
for (i = pwg->num_presets[pwg_om][pwg_pq],
|
||||
preset = pwg->presets[pwg_om][pwg_pq];
|
||||
i > 0;
|
||||
i --, preset ++)
|
||||
{
|
||||
if (!cupsGetOption(preset->name, num_options, options))
|
||||
ppd_mark_option(ppd, preset->name, preset->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (output_bin && !cupsGetOption("OutputBin", num_options, options) &&
|
||||
(ppd_keyword = _pwgGetOutputBin(pwg, output_bin)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Map output-bin to OutputBin...
|
||||
*/
|
||||
|
||||
ppd_mark_option(ppd, "OutputBin", ppd_keyword);
|
||||
}
|
||||
|
||||
if (sides && pwg->sides_option &&
|
||||
!cupsGetOption(pwg->sides_option, num_options, options))
|
||||
{
|
||||
/*
|
||||
* Map sides to duplex option...
|
||||
*/
|
||||
|
||||
if (!strcmp(sides, "one-sided"))
|
||||
ppd_mark_option(ppd, pwg->sides_option, pwg->sides_1sided);
|
||||
else if (!strcmp(sides, "two-sided-long-edge"))
|
||||
ppd_mark_option(ppd, pwg->sides_option, pwg->sides_2sided_long);
|
||||
else if (!strcmp(sides, "two-sided-short-edge"))
|
||||
ppd_mark_option(ppd, pwg->sides_option, pwg->sides_2sided_short);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,98 +272,11 @@ cupsMarkOptions(
|
||||
|
||||
for (i = num_options, optptr = options; i > 0; i --, optptr ++)
|
||||
if (!strcasecmp(optptr->name, "media") ||
|
||||
!strcasecmp(optptr->name, "media-col"))
|
||||
!strcasecmp(optptr->name, "output-bin") ||
|
||||
!strcasecmp(optptr->name, "output-mode") ||
|
||||
!strcasecmp(optptr->name, "print-quality") ||
|
||||
!strcasecmp(optptr->name, "sides"))
|
||||
continue;
|
||||
else if (!strcasecmp(optptr->name, "sides"))
|
||||
{
|
||||
for (j = 0;
|
||||
j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
|
||||
j ++)
|
||||
if (cupsGetOption(duplex_options[j], num_options, options))
|
||||
break;
|
||||
|
||||
if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
|
||||
{
|
||||
/*
|
||||
* Don't override the PPD option with the IPP attribute...
|
||||
*/
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcasecmp(optptr->value, "one-sided"))
|
||||
{
|
||||
/*
|
||||
* Mark the appropriate duplex option for one-sided output...
|
||||
*/
|
||||
|
||||
for (j = 0;
|
||||
j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
|
||||
j ++)
|
||||
if ((option = ppdFindOption(ppd, duplex_options[j])) != NULL)
|
||||
break;
|
||||
|
||||
if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
|
||||
{
|
||||
for (k = 0;
|
||||
k < (int)(sizeof(duplex_one) / sizeof(duplex_one[0]));
|
||||
k ++)
|
||||
if (ppdFindChoice(option, duplex_one[k]))
|
||||
{
|
||||
ppd_mark_option(ppd, duplex_options[j], duplex_one[k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(optptr->value, "two-sided-long-edge"))
|
||||
{
|
||||
/*
|
||||
* Mark the appropriate duplex option for two-sided-long-edge output...
|
||||
*/
|
||||
|
||||
for (j = 0;
|
||||
j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
|
||||
j ++)
|
||||
if ((option = ppdFindOption(ppd, duplex_options[j])) != NULL)
|
||||
break;
|
||||
|
||||
if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
|
||||
{
|
||||
for (k = 0;
|
||||
k < (int)(sizeof(duplex_two_long) / sizeof(duplex_two_long[0]));
|
||||
k ++)
|
||||
if (ppdFindChoice(option, duplex_two_long[k]))
|
||||
{
|
||||
ppd_mark_option(ppd, duplex_options[j], duplex_two_long[k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(optptr->value, "two-sided-short-edge"))
|
||||
{
|
||||
/*
|
||||
* Mark the appropriate duplex option for two-sided-short-edge output...
|
||||
*/
|
||||
|
||||
for (j = 0;
|
||||
j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0]));
|
||||
j ++)
|
||||
if ((option = ppdFindOption(ppd, duplex_options[j])) != NULL)
|
||||
break;
|
||||
|
||||
if (j < (int)(sizeof(duplex_options) / sizeof(duplex_options[0])))
|
||||
{
|
||||
for (k = 0;
|
||||
k < (int)(sizeof(duplex_two_short) / sizeof(duplex_two_short[0]));
|
||||
k ++)
|
||||
if (ppdFindChoice(option, duplex_two_short[k]))
|
||||
{
|
||||
ppd_mark_option(ppd, duplex_options[j], duplex_two_short[k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(optptr->name, "resolution") ||
|
||||
!strcasecmp(optptr->name, "printer-resolution"))
|
||||
{
|
||||
@@ -344,11 +288,6 @@ cupsMarkOptions(
|
||||
ppd_mark_option(ppd, "CNRes_PGP", optptr->value);
|
||||
/* Canon */
|
||||
}
|
||||
else if (!strcasecmp(optptr->name, "output-bin"))
|
||||
{
|
||||
if (!cupsGetOption("OutputBin", num_options, options))
|
||||
ppd_mark_option(ppd, "OutputBin", optptr->value);
|
||||
}
|
||||
else if (!strcasecmp(optptr->name, "multiple-document-handling"))
|
||||
{
|
||||
if (!cupsGetOption("Collate", num_options, options) &&
|
||||
@@ -421,7 +360,7 @@ cupsMarkOptions(
|
||||
else
|
||||
ppd_mark_option(ppd, optptr->name, optptr->value);
|
||||
|
||||
debug_marked(ppd, "After...");
|
||||
ppd_debug_marked(ppd, "After...");
|
||||
|
||||
return (ppdConflicts(ppd) > 0);
|
||||
}
|
||||
@@ -581,7 +520,10 @@ ppdMarkDefaults(ppd_file_t *ppd) /* I - PPD file record */
|
||||
for (c = (ppd_choice_t *)cupsArrayFirst(ppd->marked);
|
||||
c;
|
||||
c = (ppd_choice_t *)cupsArrayNext(ppd->marked))
|
||||
{
|
||||
cupsArrayRemove(ppd->marked, c);
|
||||
c->marked = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Then repopulate it with the defaults...
|
||||
@@ -668,6 +610,7 @@ ppdNextOption(ppd_file_t *ppd) /* I - PPD file */
|
||||
* This function looks for strings of the form:
|
||||
*
|
||||
* *option choice ... *optionN choiceN
|
||||
* property value ... propertyN valueN
|
||||
*
|
||||
* It stops when it finds a string that doesn't match this format.
|
||||
*/
|
||||
@@ -676,10 +619,11 @@ int /* O - Number of options */
|
||||
_ppdParseOptions(
|
||||
const char *s, /* I - String to parse */
|
||||
int num_options, /* I - Number of options */
|
||||
cups_option_t **options) /* IO - Options */
|
||||
cups_option_t **options, /* IO - Options */
|
||||
_ppd_parse_t which) /* I - What to parse */
|
||||
{
|
||||
char option[PPD_MAX_NAME], /* Current option */
|
||||
choice[PPD_MAX_NAME], /* Current choice */
|
||||
char option[PPD_MAX_NAME * 2 + 1], /* Current option/property */
|
||||
choice[PPD_MAX_NAME], /* Current choice/value */
|
||||
*ptr; /* Pointer into option or choice */
|
||||
|
||||
|
||||
@@ -687,8 +631,8 @@ _ppdParseOptions(
|
||||
return (num_options);
|
||||
|
||||
/*
|
||||
* Read all of the "*Option Choice" pairs from the string, marking PPD
|
||||
* options as we go...
|
||||
* Read all of the "*Option Choice" and "property value" pairs from the
|
||||
* string, add them to an options array as we go...
|
||||
*/
|
||||
|
||||
while (*s)
|
||||
@@ -697,22 +641,18 @@ _ppdParseOptions(
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*s & 255))
|
||||
while (_cups_isspace(*s))
|
||||
s ++;
|
||||
|
||||
if (*s != '*')
|
||||
break;
|
||||
|
||||
/*
|
||||
* Get the option name...
|
||||
* Get the option/property name...
|
||||
*/
|
||||
|
||||
s ++;
|
||||
ptr = option;
|
||||
while (*s && !isspace(*s & 255) && ptr < (option + sizeof(option) - 1))
|
||||
while (*s && !_cups_isspace(*s) && ptr < (option + sizeof(option) - 1))
|
||||
*ptr++ = *s++;
|
||||
|
||||
if (ptr == s)
|
||||
if (ptr == s || !_cups_isspace(*s))
|
||||
break;
|
||||
|
||||
*ptr = '\0';
|
||||
@@ -721,23 +661,29 @@ _ppdParseOptions(
|
||||
* Get the choice...
|
||||
*/
|
||||
|
||||
while (isspace(*s & 255))
|
||||
while (_cups_isspace(*s))
|
||||
s ++;
|
||||
|
||||
if (!*s)
|
||||
break;
|
||||
|
||||
ptr = choice;
|
||||
while (*s && !isspace(*s & 255) && ptr < (choice + sizeof(choice) - 1))
|
||||
while (*s && !_cups_isspace(*s) && ptr < (choice + sizeof(choice) - 1))
|
||||
*ptr++ = *s++;
|
||||
|
||||
if (*s && !_cups_isspace(*s))
|
||||
break;
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
/*
|
||||
* Add it to the options array...
|
||||
*/
|
||||
|
||||
num_options = cupsAddOption(option, choice, num_options, options);
|
||||
if (option[0] == '*' && which != _PPD_PARSE_PROPERTIES)
|
||||
num_options = cupsAddOption(option + 1, choice, num_options, options);
|
||||
else if (option[0] != '*' && which != _PPD_PARSE_OPTIONS)
|
||||
num_options = cupsAddOption(option, choice, num_options, options);
|
||||
}
|
||||
|
||||
return (num_options);
|
||||
@@ -746,11 +692,11 @@ _ppdParseOptions(
|
||||
|
||||
#ifdef DEBUG
|
||||
/*
|
||||
* 'debug_marked()' - Output the marked array to stdout...
|
||||
* 'ppd_debug_marked()' - Output the marked array to stdout...
|
||||
*/
|
||||
|
||||
static void
|
||||
debug_marked(ppd_file_t *ppd, /* I - PPD file data */
|
||||
ppd_debug_marked(ppd_file_t *ppd, /* I - PPD file data */
|
||||
const char *title) /* I - Title for list */
|
||||
{
|
||||
ppd_choice_t *c; /* Current choice */
|
||||
@@ -806,7 +752,7 @@ ppd_mark_choices(ppd_file_t *ppd, /* I - PPD file */
|
||||
return;
|
||||
|
||||
options = NULL;
|
||||
num_options = _ppdParseOptions(s, 0, &options);
|
||||
num_options = _ppdParseOptions(s, 0, &options, 0);
|
||||
|
||||
for (i = num_options, option = options; i > 0; i --, option ++)
|
||||
ppd_mark_option(ppd, option->name, option->value);
|
||||
@@ -1148,107 +1094,6 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppd_mark_size()' - Quickly mark a page size without checking for conflicts.
|
||||
*
|
||||
* This function is also responsible for mapping PWG/ISO/IPP size names to the
|
||||
* PPD file...
|
||||
*/
|
||||
|
||||
static void
|
||||
ppd_mark_size(ppd_file_t *ppd, /* I - PPD file */
|
||||
const char *size) /* I - Size name */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
_cups_pwg_media_t *pwgmedia; /* PWG media information */
|
||||
ppd_size_t *ppdsize; /* Current PPD size */
|
||||
double dw, dl; /* Difference in width and height */
|
||||
double width, /* Width to find */
|
||||
length; /* Length to find */
|
||||
char width_str[256], /* Width in size name */
|
||||
length_str[256],/* Length in size name */
|
||||
units[256], /* Units in size name */
|
||||
custom[256]; /* Custom size */
|
||||
struct lconv *loc; /* Localization data */
|
||||
|
||||
|
||||
/*
|
||||
* See if this is a PPD size...
|
||||
*/
|
||||
|
||||
if (!strncasecmp(size, "Custom.", 7) || ppdPageSize(ppd, size))
|
||||
{
|
||||
ppd_mark_option(ppd, "PageSize", size);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Nope, try looking up the PWG or legacy (IPP/ISO) size name...
|
||||
*/
|
||||
|
||||
if ((pwgmedia = _cupsPWGMediaByName(size)) == NULL)
|
||||
pwgmedia = _cupsPWGMediaByLegacy(size);
|
||||
|
||||
if (pwgmedia)
|
||||
{
|
||||
width = pwgmedia->width;
|
||||
length = pwgmedia->length;
|
||||
}
|
||||
else if (sscanf(size, "%*[^_]_%*[^_]_%255[0-9.]x%255[0-9.]%s", width_str,
|
||||
length_str, units) == 3)
|
||||
{
|
||||
/*
|
||||
* Got a "self-describing" name that isn't in our table...
|
||||
*/
|
||||
|
||||
loc = localeconv();
|
||||
width = _cupsStrScand(width_str, NULL, loc);
|
||||
length = _cupsStrScand(length_str, NULL, loc);
|
||||
|
||||
if (!strcmp(units, "in"))
|
||||
{
|
||||
width *= 72.0;
|
||||
length *= 72.0;
|
||||
}
|
||||
else if (!strcmp(units, "mm"))
|
||||
{
|
||||
width *= 25.4 / 72.0;
|
||||
length *= 25.4 / 72.0;
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
/*
|
||||
* Search the PPD file for a matching size...
|
||||
*/
|
||||
|
||||
for (i = ppd->num_sizes, ppdsize = ppd->sizes; i > 0; i --, ppdsize ++)
|
||||
{
|
||||
dw = ppdsize->width - width;
|
||||
dl = ppdsize->length - length;
|
||||
|
||||
if (dw > -5.0 && dw < 5.0 && dl > -5.0 && dl < 5.0)
|
||||
{
|
||||
ppd_mark_option(ppd, "PageSize", ppdsize->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* No match found; if custom sizes are supported, set a custom size...
|
||||
*/
|
||||
|
||||
if (ppd->variable_sizes)
|
||||
{
|
||||
snprintf(custom, sizeof(custom), "Custom.%dx%d", (int)width, (int)length);
|
||||
ppd_mark_option(ppd, "PageSize", custom);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
|
||||
+6
-6
@@ -282,7 +282,7 @@ cupsParseOptions(
|
||||
* Skip leading spaces...
|
||||
*/
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
while (_cups_isspace(*ptr))
|
||||
ptr ++;
|
||||
|
||||
/*
|
||||
@@ -296,7 +296,7 @@ cupsParseOptions(
|
||||
*/
|
||||
|
||||
name = ptr;
|
||||
while (!isspace(*ptr & 255) && *ptr != '=' && *ptr)
|
||||
while (!strchr("\f\n\r\t\v =", *ptr) && *ptr)
|
||||
ptr ++;
|
||||
|
||||
/*
|
||||
@@ -310,7 +310,7 @@ cupsParseOptions(
|
||||
* Skip trailing spaces...
|
||||
*/
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
while (_cups_isspace(*ptr))
|
||||
*ptr++ = '\0';
|
||||
|
||||
if ((sep = *ptr) == '=')
|
||||
@@ -339,7 +339,7 @@ cupsParseOptions(
|
||||
|
||||
value = ptr;
|
||||
|
||||
while (*ptr && !isspace(*ptr & 255))
|
||||
while (*ptr && !_cups_isspace(*ptr))
|
||||
{
|
||||
if (*ptr == ',')
|
||||
ptr ++;
|
||||
@@ -394,7 +394,7 @@ cupsParseOptions(
|
||||
* Normal space-delimited string...
|
||||
*/
|
||||
|
||||
while (!isspace(*ptr & 255) && *ptr)
|
||||
while (*ptr && !_cups_isspace(*ptr))
|
||||
{
|
||||
if (*ptr == '\\' && ptr[1])
|
||||
_cups_strcpy(ptr, ptr + 1);
|
||||
@@ -413,7 +413,7 @@ cupsParseOptions(
|
||||
* Skip trailing whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*ptr & 255))
|
||||
while (_cups_isspace(*ptr))
|
||||
ptr ++;
|
||||
|
||||
/*
|
||||
|
||||
+19
-17
@@ -44,7 +44,7 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
ppd_size_t *size; /* Current page size */
|
||||
float w, l; /* Width and length of page */
|
||||
double w, l; /* Width and length of page */
|
||||
char *nameptr; /* Pointer into name */
|
||||
struct lconv *loc; /* Locale data */
|
||||
ppd_coption_t *coption; /* Custom option for page size */
|
||||
@@ -81,52 +81,54 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
|
||||
* Variable size; size name can be one of the following:
|
||||
*
|
||||
* Custom.WIDTHxLENGTHin - Size in inches
|
||||
* Custom.WIDTHxLENGTHft - Size in feet
|
||||
* Custom.WIDTHxLENGTHcm - Size in centimeters
|
||||
* Custom.WIDTHxLENGTHmm - Size in millimeters
|
||||
* Custom.WIDTHxLENGTHm - Size in meters
|
||||
* Custom.WIDTHxLENGTH[pt] - Size in points
|
||||
*/
|
||||
|
||||
loc = localeconv();
|
||||
w = (float)_cupsStrScand(name + 7, &nameptr, loc);
|
||||
w = _cupsStrScand(name + 7, &nameptr, loc);
|
||||
if (!nameptr || *nameptr != 'x')
|
||||
return (NULL);
|
||||
|
||||
l = (float)_cupsStrScand(nameptr + 1, &nameptr, loc);
|
||||
l = _cupsStrScand(nameptr + 1, &nameptr, loc);
|
||||
if (!nameptr)
|
||||
return (NULL);
|
||||
|
||||
if (!strcasecmp(nameptr, "in"))
|
||||
{
|
||||
w *= 72.0f;
|
||||
l *= 72.0f;
|
||||
w *= 72.0;
|
||||
l *= 72.0;
|
||||
}
|
||||
else if (!strcasecmp(nameptr, "ft"))
|
||||
{
|
||||
w *= 12.0f * 72.0f;
|
||||
l *= 12.0f * 72.0f;
|
||||
w *= 12.0 * 72.0;
|
||||
l *= 12.0 * 72.0;
|
||||
}
|
||||
else if (!strcasecmp(nameptr, "mm"))
|
||||
{
|
||||
w *= 72.0f / 25.4f;
|
||||
l *= 72.0f / 25.4f;
|
||||
w *= 72.0 / 25.4;
|
||||
l *= 72.0 / 25.4;
|
||||
}
|
||||
else if (!strcasecmp(nameptr, "cm"))
|
||||
{
|
||||
w *= 72.0f / 2.54f;
|
||||
l *= 72.0f / 2.54f;
|
||||
w *= 72.0 / 2.54;
|
||||
l *= 72.0 / 2.54;
|
||||
}
|
||||
else if (!strcasecmp(nameptr, "m"))
|
||||
{
|
||||
w *= 72.0f / 0.0254f;
|
||||
l *= 72.0f / 0.0254f;
|
||||
w *= 72.0 / 0.0254;
|
||||
l *= 72.0 / 0.0254;
|
||||
}
|
||||
|
||||
size->width = w;
|
||||
size->length = l;
|
||||
size->width = (float)w;
|
||||
size->length = (float)l;
|
||||
size->left = ppd->custom_margins[0];
|
||||
size->bottom = ppd->custom_margins[1];
|
||||
size->right = w - ppd->custom_margins[2];
|
||||
size->top = l - ppd->custom_margins[3];
|
||||
size->right = (float)(w - ppd->custom_margins[2]);
|
||||
size->top = (float)(l - ppd->custom_margins[3]);
|
||||
|
||||
/*
|
||||
* Update the custom option records for the page size, too...
|
||||
|
||||
+10
-2
@@ -44,9 +44,16 @@ extern "C" {
|
||||
|
||||
|
||||
/*
|
||||
* Structures...
|
||||
* Types and structures...
|
||||
*/
|
||||
|
||||
typedef enum _ppd_parse_e /**** Selector for _ppdParseOptions ****/
|
||||
{
|
||||
_PPD_PARSE_OPTIONS, /* Parse only the options */
|
||||
_PPD_PARSE_PROPERTIES, /* Parse only the properties */
|
||||
_PPD_PARSE_ALL /* Parse everything */
|
||||
} _ppd_parse_t;
|
||||
|
||||
typedef struct _ppd_cups_uiconst_s /**** Constraint from cupsUIConstraints ****/
|
||||
{
|
||||
ppd_option_t *option; /* Constrained option */
|
||||
@@ -79,7 +86,8 @@ extern char *_ppdNormalizeMakeAndModel(const char *make_and_model,
|
||||
char *buffer,
|
||||
size_t bufsize);
|
||||
extern int _ppdParseOptions(const char *s, int num_options,
|
||||
cups_option_t **options);
|
||||
cups_option_t **options,
|
||||
_ppd_parse_t which);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+27
-31
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* PPD file routines for the Common UNIX Printing System (CUPS).
|
||||
* PPD file routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -41,7 +41,6 @@
|
||||
* ppd_compare_attrs() - Compare two attributes.
|
||||
* ppd_compare_choices() - Compare two choices...
|
||||
* ppd_compare_coptions() - Compare two custom options.
|
||||
* ppd_compare_cparams() - Compare two custom parameters.
|
||||
* ppd_compare_options() - Compare two options.
|
||||
* ppd_decode() - Decode a string value...
|
||||
* ppd_free_group() - Free a single UI group.
|
||||
@@ -60,6 +59,7 @@
|
||||
*/
|
||||
|
||||
#include "ppd-private.h"
|
||||
#include "pwg-private.h"
|
||||
#include "globals.h"
|
||||
#include "debug.h"
|
||||
#include <stdlib.h>
|
||||
@@ -111,7 +111,6 @@ static int ppd_compare_attrs(ppd_attr_t *a, ppd_attr_t *b);
|
||||
static int ppd_compare_choices(ppd_choice_t *a, ppd_choice_t *b);
|
||||
static int ppd_compare_coptions(ppd_coption_t *a,
|
||||
ppd_coption_t *b);
|
||||
static int ppd_compare_cparams(ppd_cparam_t *a, ppd_cparam_t *b);
|
||||
static int ppd_compare_options(ppd_option_t *a, ppd_option_t *b);
|
||||
static int ppd_decode(char *string);
|
||||
static void ppd_free_group(ppd_group_t *group);
|
||||
@@ -313,6 +312,13 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */
|
||||
cupsArrayDelete(ppd->cups_uiconstraints);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free any PWG mapping data...
|
||||
*/
|
||||
|
||||
if (ppd->pwg)
|
||||
_pwgDestroy((_pwg_t *)ppd->pwg);
|
||||
|
||||
/*
|
||||
* Free the whole record...
|
||||
*/
|
||||
@@ -658,6 +664,8 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
|
||||
goto error;
|
||||
}
|
||||
else if (!string)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Certain main keywords (as defined by the PPD spec) may be used
|
||||
@@ -1250,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 && isspace(name[i] & 255); i --)
|
||||
for (i = (int)strlen(name) - 1; i > 0 && _cups_isspace(name[i]); i --)
|
||||
name[i] = '\0'; /* Eliminate trailing spaces */
|
||||
|
||||
DEBUG_printf(("2ppdOpen2: OpenUI of %s in group %s...", name,
|
||||
@@ -2302,18 +2310,6 @@ ppd_compare_coptions(ppd_coption_t *a, /* I - First option */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppd_compare_cparams()' - Compare two custom parameters.
|
||||
*/
|
||||
|
||||
static int /* O - Result of comparison */
|
||||
ppd_compare_cparams(ppd_cparam_t *a, /* I - First parameter */
|
||||
ppd_cparam_t *b) /* I - Second parameter */
|
||||
{
|
||||
return (strcasecmp(a->name, b->name));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppd_compare_options()' - Compare two options.
|
||||
*/
|
||||
@@ -2350,7 +2346,7 @@ ppd_decode(char *string) /* I - String to decode */
|
||||
inptr ++;
|
||||
while (isxdigit(*inptr & 255))
|
||||
{
|
||||
if (isalpha(*inptr))
|
||||
if (_cups_isalpha(*inptr))
|
||||
*outptr = (tolower(*inptr) - 'a' + 10) << 4;
|
||||
else
|
||||
*outptr = (*inptr - '0') << 4;
|
||||
@@ -2360,7 +2356,7 @@ ppd_decode(char *string) /* I - String to decode */
|
||||
if (!isxdigit(*inptr & 255))
|
||||
break;
|
||||
|
||||
if (isalpha(*inptr))
|
||||
if (_cups_isalpha(*inptr))
|
||||
*outptr |= tolower(*inptr) - 'a' + 10;
|
||||
else
|
||||
*outptr |= *inptr - '0';
|
||||
@@ -2469,7 +2465,7 @@ ppd_get_coption(ppd_file_t *ppd, /* I - PPD file */
|
||||
|
||||
strlcpy(copt->keyword, name, sizeof(copt->keyword));
|
||||
|
||||
copt->params = cupsArrayNew((cups_array_func_t)ppd_compare_cparams, NULL);
|
||||
copt->params = cupsArrayNew((cups_array_func_t)NULL, NULL);
|
||||
|
||||
cupsArrayAdd(ppd->coptions, copt);
|
||||
|
||||
@@ -2991,7 +2987,7 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
|
||||
*/
|
||||
|
||||
for (lineptr = line->buffer; *lineptr; lineptr ++)
|
||||
if (!isspace(*lineptr & 255))
|
||||
if (*lineptr && !_cups_isspace(*lineptr))
|
||||
break;
|
||||
|
||||
if (*lineptr)
|
||||
@@ -3011,7 +3007,7 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
|
||||
|
||||
keyptr = keyword;
|
||||
|
||||
while (*lineptr != '\0' && *lineptr != ':' && !isspace(*lineptr & 255))
|
||||
while (*lineptr && *lineptr != ':' && !_cups_isspace(*lineptr))
|
||||
{
|
||||
if (*lineptr <= ' ' || *lineptr > 126 || *lineptr == '/' ||
|
||||
(keyptr - keyword) >= (PPD_MAX_NAME - 1))
|
||||
@@ -3030,18 +3026,18 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
|
||||
|
||||
mask |= PPD_KEYWORD;
|
||||
|
||||
if (isspace(*lineptr & 255))
|
||||
if (_cups_isspace(*lineptr))
|
||||
{
|
||||
/*
|
||||
* Get an option name...
|
||||
*/
|
||||
|
||||
while (isspace(*lineptr & 255))
|
||||
while (_cups_isspace(*lineptr))
|
||||
lineptr ++;
|
||||
|
||||
optptr = option;
|
||||
|
||||
while (*lineptr != '\0' && !isspace(*lineptr & 255) && *lineptr != ':' &&
|
||||
while (*lineptr && !_cups_isspace(*lineptr) && *lineptr != ':' &&
|
||||
*lineptr != '/')
|
||||
{
|
||||
if (*lineptr <= ' ' || *lineptr > 126 ||
|
||||
@@ -3056,13 +3052,13 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
|
||||
|
||||
*optptr = '\0';
|
||||
|
||||
if (isspace(*lineptr & 255) && cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
if (_cups_isspace(*lineptr) && cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
{
|
||||
cg->ppd_status = PPD_ILLEGAL_WHITESPACE;
|
||||
return (0);
|
||||
}
|
||||
|
||||
while (isspace(*lineptr & 255))
|
||||
while (_cups_isspace(*lineptr))
|
||||
lineptr ++;
|
||||
|
||||
mask |= PPD_OPTION;
|
||||
@@ -3102,13 +3098,13 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
|
||||
}
|
||||
}
|
||||
|
||||
if (isspace(*lineptr & 255) && cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
if (_cups_isspace(*lineptr) && cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
{
|
||||
cg->ppd_status = PPD_ILLEGAL_WHITESPACE;
|
||||
return (0);
|
||||
}
|
||||
|
||||
while (isspace(*lineptr & 255))
|
||||
while (_cups_isspace(*lineptr))
|
||||
lineptr ++;
|
||||
|
||||
if (*lineptr == ':')
|
||||
@@ -3118,11 +3114,11 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
|
||||
*/
|
||||
|
||||
lineptr ++;
|
||||
while (isspace(*lineptr & 255))
|
||||
while (_cups_isspace(*lineptr))
|
||||
lineptr ++;
|
||||
|
||||
strptr = lineptr + strlen(lineptr) - 1;
|
||||
while (strptr >= lineptr && isspace(*strptr & 255))
|
||||
while (strptr >= lineptr && _cups_isspace(*strptr))
|
||||
*strptr-- = '\0';
|
||||
|
||||
if (*strptr == '\"')
|
||||
|
||||
+10
-7
@@ -1,10 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* PostScript Printer Description definitions for the Common UNIX Printing
|
||||
* System (CUPS).
|
||||
* PostScript Printer Description definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -334,6 +333,9 @@ typedef struct ppd_file_s /**** PPD File ****/
|
||||
|
||||
/**** New in CUPS 1.4/Mac OS X 10.6 ****/
|
||||
cups_array_t *cups_uiconstraints; /* cupsUIConstraints @since CUPS 1.4/Mac OS X 10.6@ @private@ */
|
||||
|
||||
/**** New in CUPS 1.5 ****/
|
||||
void *pwg; /* PWG to/from PPD mappings */
|
||||
} ppd_file_t;
|
||||
|
||||
|
||||
@@ -397,19 +399,20 @@ extern ppd_option_t *ppdNextOption(ppd_file_t *ppd) _CUPS_API_1_2;
|
||||
extern int ppdLocalize(ppd_file_t *ppd) _CUPS_API_1_2;
|
||||
extern ppd_file_t *ppdOpen2(cups_file_t *fp) _CUPS_API_1_2;
|
||||
|
||||
/**** New in CUPS 1.3 ****/
|
||||
/**** New in CUPS 1.3/Mac OS X 10.5 ****/
|
||||
extern const char *ppdLocalizeIPPReason(ppd_file_t *ppd,
|
||||
const char *reason,
|
||||
const char *scheme,
|
||||
char *buffer,
|
||||
size_t bufsize) _CUPS_API_1_3;
|
||||
|
||||
/**** New in CUPS 1.4 ****/
|
||||
/**** New in CUPS 1.4/Mac OS X 10.6 ****/
|
||||
extern int ppdInstallableConflict(ppd_file_t *ppd,
|
||||
const char *option,
|
||||
const char *choice);
|
||||
const char *choice)
|
||||
_CUPS_API_1_4;
|
||||
extern ppd_attr_t *ppdLocalizeAttr(ppd_file_t *ppd, const char *keyword,
|
||||
const char *spec);
|
||||
const char *spec) _CUPS_API_1_4;
|
||||
extern const char *ppdLocalizeMarkerName(ppd_file_t *ppd,
|
||||
const char *name) _CUPS_API_1_4;
|
||||
extern int ppdPageSizeLimits(ppd_file_t *ppd,
|
||||
|
||||
@@ -0,0 +1,639 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* PWG load/save API implementation for CUPS.
|
||||
*
|
||||
* Copyright 2010 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* _pwgCreateWithFile() - Create PWG mapping data from a written file.
|
||||
* _pwgDestroy() - Free all memory used for PWG mapping data.
|
||||
* _pwgWriteFile() - Write PWG mapping data to a file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "globals.h"
|
||||
#include "debug.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
/*
|
||||
* '_pwgCreateWithFile()' - Create PWG mapping data from a written file.
|
||||
*
|
||||
* Use the @link _pwgWriteFile@ function to write PWG mapping data to a file.
|
||||
*/
|
||||
|
||||
_pwg_t * /* O - PWG mapping data */
|
||||
_pwgCreateWithFile(const char *filename)/* I - File to read */
|
||||
{
|
||||
cups_file_t *fp; /* File */
|
||||
_pwg_t *pwg; /* PWG mapping data */
|
||||
_pwg_size_t *size; /* Current size */
|
||||
_pwg_map_t *map; /* Current map */
|
||||
int linenum, /* Current line number */
|
||||
num_bins, /* Number of bins in file */
|
||||
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 */
|
||||
*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));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!filename)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Open the file...
|
||||
*/
|
||||
|
||||
if ((fp = cupsFileOpen(filename, "r")) == NULL)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate the mapping data structure...
|
||||
*/
|
||||
|
||||
if ((pwg = calloc(1, sizeof(_pwg_t))) == NULL)
|
||||
{
|
||||
DEBUG_puts("_pwgCreateWithFile: Unable to allocate pwg_t.");
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the file...
|
||||
*/
|
||||
|
||||
linenum = 0;
|
||||
num_bins = 0;
|
||||
num_sizes = 0;
|
||||
num_sources = 0;
|
||||
num_types = 0;
|
||||
|
||||
while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum))
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: line=\"%s\", value=\"%s\", linenum=%d",
|
||||
line, value, linenum));
|
||||
|
||||
if (!value)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Missing value on line %d.", linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
else if (!strcasecmp(line, "NumBins"))
|
||||
{
|
||||
if (num_bins > 0)
|
||||
{
|
||||
DEBUG_puts("_pwgCreateWithFile: NumBins listed multiple times.");
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if ((num_bins = atoi(value)) <= 0 || num_bins > 65536)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Bad NumBins value %d on line %d.",
|
||||
num_sizes, linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if ((pwg->bins = calloc(num_bins, sizeof(_pwg_map_t))) == NULL)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Unable to allocate %d bins.",
|
||||
num_sizes));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
goto create_error;
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(line, "Bin"))
|
||||
{
|
||||
if (sscanf(value, "%127s%40s", pwg_keyword, ppd_keyword) != 2)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Bad Bin on line %d.", linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if (pwg->num_bins >= num_bins)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Too many Bin's on line %d.",
|
||||
linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
map = pwg->bins + pwg->num_bins;
|
||||
map->pwg = _cupsStrAlloc(pwg_keyword);
|
||||
map->ppd = _cupsStrAlloc(ppd_keyword);
|
||||
|
||||
pwg->num_bins ++;
|
||||
}
|
||||
else if (!strcasecmp(line, "NumSizes"))
|
||||
{
|
||||
if (num_sizes > 0)
|
||||
{
|
||||
DEBUG_puts("_pwgCreateWithFile: NumSizes listed multiple times.");
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if ((num_sizes = atoi(value)) <= 0 || num_sizes > 65536)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Bad NumSizes value %d on line %d.",
|
||||
num_sizes, linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if ((pwg->sizes = calloc(num_sizes, sizeof(_pwg_size_t))) == NULL)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Unable to allocate %d sizes.",
|
||||
num_sizes));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
goto create_error;
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(line, "Size"))
|
||||
{
|
||||
if (pwg->num_sizes >= num_sizes)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Too many Size's on line %d.",
|
||||
linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
size = pwg->sizes + pwg->num_sizes;
|
||||
|
||||
if (sscanf(value, "%127s%40s%d%d%d%d%d%d", pwg_keyword, ppd_keyword,
|
||||
&(size->width), &(size->length), &(size->left),
|
||||
&(size->bottom), &(size->right), &(size->top)) != 8)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Bad Size on line %d.", linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
size->map.pwg = _cupsStrAlloc(pwg_keyword);
|
||||
size->map.ppd = _cupsStrAlloc(ppd_keyword);
|
||||
|
||||
pwg->num_sizes ++;
|
||||
}
|
||||
else if (!strcasecmp(line, "CustomSize"))
|
||||
{
|
||||
if (pwg->custom_max_width > 0)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Too many CustomSize's on line %d.",
|
||||
linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if (sscanf(value, "%d%d%d%d%d%d%d%d", &(pwg->custom_max_width),
|
||||
&(pwg->custom_max_length), &(pwg->custom_min_width),
|
||||
&(pwg->custom_min_length), &(pwg->custom_size.left),
|
||||
&(pwg->custom_size.bottom), &(pwg->custom_size.right),
|
||||
&(pwg->custom_size.top)) != 8)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Bad CustomSize on line %d.", linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
_pwgGenerateSize(pwg_keyword, sizeof(pwg_keyword), "custom", "max",
|
||||
pwg->custom_max_width, pwg->custom_max_length);
|
||||
pwg->custom_max_keyword = _cupsStrAlloc(pwg_keyword);
|
||||
|
||||
_pwgGenerateSize(pwg_keyword, sizeof(pwg_keyword), "custom", "min",
|
||||
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)
|
||||
{
|
||||
DEBUG_puts("_pwgCreateWithFile: NumSources listed multiple times.");
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if ((num_sources = atoi(value)) <= 0 || num_sources > 65536)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Bad NumSources value %d on line %d.",
|
||||
num_sources, linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if ((pwg->sources = calloc(num_sources, sizeof(_pwg_map_t))) == NULL)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Unable to allocate %d sources.",
|
||||
num_sources));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
goto create_error;
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(line, "Source"))
|
||||
{
|
||||
if (sscanf(value, "%127s%40s", pwg_keyword, ppd_keyword) != 2)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Bad Source on line %d.", linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if (pwg->num_sources >= num_sources)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Too many Source's on line %d.",
|
||||
linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
map = pwg->sources + pwg->num_sources;
|
||||
map->pwg = _cupsStrAlloc(pwg_keyword);
|
||||
map->ppd = _cupsStrAlloc(ppd_keyword);
|
||||
|
||||
pwg->num_sources ++;
|
||||
}
|
||||
else if (!strcasecmp(line, "NumTypes"))
|
||||
{
|
||||
if (num_types > 0)
|
||||
{
|
||||
DEBUG_puts("_pwgCreateWithFile: NumTypes listed multiple times.");
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if ((num_types = atoi(value)) <= 0 || num_types > 65536)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Bad NumTypes value %d on line %d.",
|
||||
num_types, linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if ((pwg->types = calloc(num_types, sizeof(_pwg_map_t))) == NULL)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Unable to allocate %d types.",
|
||||
num_types));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
goto create_error;
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(line, "Type"))
|
||||
{
|
||||
if (sscanf(value, "%127s%40s", pwg_keyword, ppd_keyword) != 2)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Bad Type on line %d.", linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if (pwg->num_types >= num_types)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Too many Type's on line %d.",
|
||||
linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
map = pwg->types + pwg->num_types;
|
||||
map->pwg = _cupsStrAlloc(pwg_keyword);
|
||||
map->ppd = _cupsStrAlloc(ppd_keyword);
|
||||
|
||||
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,
|
||||
linenum));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
}
|
||||
|
||||
if (pwg->num_sizes < num_sizes)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Not enough sizes (%d < %d).",
|
||||
pwg->num_sizes, num_sizes));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if (pwg->num_sources < num_sources)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Not enough sources (%d < %d).",
|
||||
pwg->num_sources, num_sources));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
if (pwg->num_types < num_types)
|
||||
{
|
||||
DEBUG_printf(("_pwgCreateWithFile: Not enough types (%d < %d).",
|
||||
pwg->num_types, num_types));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Bad PWG mapping file."), 1);
|
||||
goto create_error;
|
||||
}
|
||||
|
||||
cupsFileClose(fp);
|
||||
|
||||
return (pwg);
|
||||
|
||||
/*
|
||||
* If we get here the file was bad - free any data and return...
|
||||
*/
|
||||
|
||||
create_error:
|
||||
|
||||
cupsFileClose(fp);
|
||||
_pwgDestroy(pwg);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_pwgDestroy()' - Free all memory used for PWG mapping data.
|
||||
*/
|
||||
|
||||
void
|
||||
_pwgDestroy(_pwg_t *pwg) /* I - PWG mapping data */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
_pwg_map_t *map; /* Current map */
|
||||
_pwg_size_t *size; /* Current size */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!pwg)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Free memory as needed...
|
||||
*/
|
||||
|
||||
if (pwg->bins)
|
||||
{
|
||||
for (i = pwg->num_bins, map = pwg->bins; i > 0; i --, map ++)
|
||||
{
|
||||
_cupsStrFree(map->pwg);
|
||||
_cupsStrFree(map->ppd);
|
||||
}
|
||||
|
||||
free(pwg->bins);
|
||||
}
|
||||
|
||||
if (pwg->sizes)
|
||||
{
|
||||
for (i = pwg->num_sizes, size = pwg->sizes; i > 0; i --, size ++)
|
||||
{
|
||||
_cupsStrFree(size->map.pwg);
|
||||
_cupsStrFree(size->map.ppd);
|
||||
}
|
||||
|
||||
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 ++)
|
||||
{
|
||||
_cupsStrFree(map->pwg);
|
||||
_cupsStrFree(map->ppd);
|
||||
}
|
||||
|
||||
free(pwg->sources);
|
||||
}
|
||||
|
||||
if (pwg->types)
|
||||
{
|
||||
for (i = pwg->num_types, map = pwg->types; i > 0; i --, map ++)
|
||||
{
|
||||
_cupsStrFree(map->pwg);
|
||||
_cupsStrFree(map->ppd);
|
||||
}
|
||||
|
||||
free(pwg->types);
|
||||
}
|
||||
|
||||
if (pwg->custom_max_keyword)
|
||||
_cupsStrFree(pwg->custom_max_keyword);
|
||||
|
||||
if (pwg->custom_min_keyword)
|
||||
_cupsStrFree(pwg->custom_min_keyword);
|
||||
|
||||
free(pwg);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_pwgWriteFile()' - Write PWG mapping data to a file.
|
||||
*/
|
||||
|
||||
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 */
|
||||
cups_file_t *fp; /* Output file */
|
||||
_pwg_size_t *size; /* Current size */
|
||||
_pwg_map_t *map; /* Current map */
|
||||
cups_option_t *option; /* Current option */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!pwg || !filename)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Open the file and write with compression...
|
||||
*/
|
||||
|
||||
if ((fp = cupsFileOpen(filename, "w9")) == NULL)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Standard header...
|
||||
*/
|
||||
|
||||
cupsFilePuts(fp, "#CUPS-PWGPPD\n");
|
||||
|
||||
/*
|
||||
* Output bins...
|
||||
*/
|
||||
|
||||
if (pwg->num_bins > 0)
|
||||
{
|
||||
cupsFilePrintf(fp, "NumBins %d\n", pwg->num_bins);
|
||||
for (i = pwg->num_bins, map = pwg->bins; i > 0; i --, map ++)
|
||||
cupsFilePrintf(fp, "Bin %s %s\n", map->pwg, map->ppd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Media sizes...
|
||||
*/
|
||||
|
||||
cupsFilePrintf(fp, "NumSizes %d\n", pwg->num_sizes);
|
||||
for (i = pwg->num_sizes, size = pwg->sizes; i > 0; i --, size ++)
|
||||
cupsFilePrintf(fp, "Size %s %s %d %d %d %d %d %d\n", size->map.pwg,
|
||||
size->map.ppd, size->width, size->length, size->left,
|
||||
size->bottom, size->right, size->top);
|
||||
if (pwg->custom_max_width > 0)
|
||||
cupsFilePrintf(fp, "CustomSize %d %d %d %d %d %d %d %d\n",
|
||||
pwg->custom_max_width, pwg->custom_max_length,
|
||||
pwg->custom_min_width, pwg->custom_min_length,
|
||||
pwg->custom_size.left, pwg->custom_size.bottom,
|
||||
pwg->custom_size.right, pwg->custom_size.top);
|
||||
|
||||
/*
|
||||
* 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);
|
||||
for (i = pwg->num_sources, map = pwg->sources; i > 0; i --, map ++)
|
||||
cupsFilePrintf(fp, "Source %s %s\n", map->pwg, map->ppd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Media types...
|
||||
*/
|
||||
|
||||
if (pwg->num_types > 0)
|
||||
{
|
||||
cupsFilePrintf(fp, "NumTypes %d\n", pwg->num_types);
|
||||
for (i = pwg->num_types, map = pwg->types; i > 0; i --, map ++)
|
||||
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...
|
||||
*/
|
||||
|
||||
return (!cupsFileClose(fp));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -0,0 +1,849 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* PWG media name API implementation for CUPS.
|
||||
*
|
||||
* Copyright 2009-2010 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* _pwgGenerateSize() - Generate a PWG size keyword.
|
||||
* _pwgInitSize() - Initialize a PWG size using IPP job template
|
||||
* attributes.
|
||||
* _pwgMediaForLegacy() - Find a PWG media size by ISO/IPP legacy name.
|
||||
* _pwgMediaForPPD() - Find a PWG media size by Adobe PPD name.
|
||||
* _pwgMediaForPWG() - Find a PWG media size by 5101.1 self-describing
|
||||
* name.
|
||||
* _pwgMediaForSize() - Get the PWG media name for a given size.
|
||||
* pwg_compare_legacy() - Compare two sizes using the legacy names.
|
||||
* pwg_compare_ppd() - Compare two sizes using the PPD names.
|
||||
* pwg_compare_pwg() - Compare two sizes using the PWG names.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "globals.h"
|
||||
#include "debug.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local macros...
|
||||
*/
|
||||
|
||||
#define _PWG_MEDIA_IN(p,l,a,x,y) {p, l, a, (int)(x * 2540), (int)(y * 2540)}
|
||||
#define _PWG_MEDIA_MM(p,l,a,x,y) {p, l, a, (int)(x * 100), (int)(y * 100)}
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int pwg_compare_legacy(_pwg_media_t *a, _pwg_media_t *b);
|
||||
static int pwg_compare_pwg(_pwg_media_t *a, _pwg_media_t *b);
|
||||
static int pwg_compare_ppd(_pwg_media_t *a, _pwg_media_t *b);
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
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_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_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_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_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_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),
|
||||
_PWG_MEDIA_IN("na_letter-plus_8.5x12.69in", NULL, "LetterPlus", 8.5, 12.69),
|
||||
_PWG_MEDIA_IN("na_foolscap_8.5x13in", NULL, "FanFoldGermanLegal", 8.5, 13),
|
||||
_PWG_MEDIA_IN("na_legal_8.5x14in", "na-legal", "Legal", 8.5, 14),
|
||||
_PWG_MEDIA_IN("na_super-a_8.94x14in", NULL, "SuperA", 8.94, 14),
|
||||
_PWG_MEDIA_IN("na_9x11_9x11in", "na-9x11-envelope", "9x11", 9, 11),
|
||||
_PWG_MEDIA_IN("na_arch-a_9x12in", "arch-a", "ARCHA", 9, 12),
|
||||
_PWG_MEDIA_IN("na_letter-extra_9.5x12in", NULL, "LetterExtra", 9.5, 12),
|
||||
_PWG_MEDIA_IN("na_legal-extra_9.5x15in", NULL, "LegalExtra", 9.5, 15),
|
||||
_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_fanfold-us_11x14.875in", NULL, NULL, 11, 14.875),
|
||||
_PWG_MEDIA_IN("na_11x15_11x15in", NULL, "11x15", 11, 15),
|
||||
_PWG_MEDIA_IN("na_ledger_11x17in", "tabloid", "Tabloid", 11, 17),
|
||||
_PWG_MEDIA_IN("na_eur-edp_12x14in", NULL, NULL, 12, 14),
|
||||
_PWG_MEDIA_IN("na_arch-b_12x18in", "arch-b", "ARCHB", 12, 18),
|
||||
_PWG_MEDIA_IN("na_12x19_12x19in", NULL, "12x19", 12, 19),
|
||||
_PWG_MEDIA_IN("na_b-plus_12x19.17in", NULL, "SuperB", 12, 19.17),
|
||||
_PWG_MEDIA_IN("na_super-b_13x19in", "super-b", NULL, 13, 19),
|
||||
_PWG_MEDIA_IN("na_c_17x22in", "c", "AnsiC", 17, 22),
|
||||
_PWG_MEDIA_IN("na_arch-c_18x24in", "arch-c", "ARCHC", 18, 24),
|
||||
_PWG_MEDIA_IN("na_d_22x34in", "d", "AnsiD", 22, 34),
|
||||
_PWG_MEDIA_IN("na_arch-d_24x36in", "arch-d", "ARCHD", 24, 36),
|
||||
_PWG_MEDIA_IN("asme_f_28x40in", "f", NULL, 28, 40),
|
||||
_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),
|
||||
|
||||
/* Chinese Standard Sheet Media Inch Sizes */
|
||||
_PWG_MEDIA_IN("roc_16k_7.75x10.75in", NULL, NULL, 7.75, 10.75),
|
||||
_PWG_MEDIA_IN("roc_8k_10.75x15.5in", NULL, NULL, 10.75, 15.5),
|
||||
|
||||
/* ISO Standard Sheet Media Sizes */
|
||||
_PWG_MEDIA_MM("iso_a10_26x37mm", "iso-a10", "A10", 26, 37),
|
||||
_PWG_MEDIA_MM("iso_a9_37x52mm", "iso-a9", "A9", 37, 52),
|
||||
_PWG_MEDIA_MM("iso_a8_52x74mm", "iso-a8", "A8", 52, 74),
|
||||
_PWG_MEDIA_MM("iso_a7_74x105mm", "iso-a7", "A7", 74, 105),
|
||||
_PWG_MEDIA_MM("iso_a6_105x148mm", "iso-a6", "A6", 105, 148),
|
||||
_PWG_MEDIA_MM("iso_a5_148x210mm", "iso-a5", "A5", 148, 210),
|
||||
_PWG_MEDIA_MM("iso_a5-extra_174x235mm", NULL, "A5Extra", 174, 235),
|
||||
_PWG_MEDIA_MM("iso_a4_210x297mm", "iso-a4", "A4", 210, 297),
|
||||
_PWG_MEDIA_MM("iso_a4-tab_225x297mm", NULL, NULL, 225, 297),
|
||||
_PWG_MEDIA_MM("iso_a4-extra_235.5x322.3mm", NULL, "A4Extra", 235.5, 322.3),
|
||||
_PWG_MEDIA_MM("iso_a3_297x420mm", "iso-a3", "A3", 297, 420),
|
||||
_PWG_MEDIA_MM("iso_a4x3_297x630mm", "iso-a4x3", NULL, 297, 630),
|
||||
_PWG_MEDIA_MM("iso_a4x4_297x841mm", "iso-a4x4", NULL, 297, 841),
|
||||
_PWG_MEDIA_MM("iso_a4x5_297x1051mm", "iso-a4x5", NULL, 297, 1051),
|
||||
_PWG_MEDIA_MM("iso_a4x6_297x1261mm", "iso-a4x6", NULL, 297, 1261),
|
||||
_PWG_MEDIA_MM("iso_a4x7_297x1471mm", "iso-a4x7", NULL, 297, 1471),
|
||||
_PWG_MEDIA_MM("iso_a4x8_297x1682mm", "iso-a4x8", NULL, 297, 1682),
|
||||
_PWG_MEDIA_MM("iso_a4x9_297x1892mm", "iso-a4x9", NULL, 297, 1892),
|
||||
_PWG_MEDIA_MM("iso_a3-extra_322x445mm", "iso-a3-extra", "A3Extra", 322, 445),
|
||||
_PWG_MEDIA_MM("iso_a2_420x594mm", "iso-a2", "A2", 420, 594),
|
||||
_PWG_MEDIA_MM("iso_a3x3_420x891mm", "iso-a3x3", NULL, 420, 891),
|
||||
_PWG_MEDIA_MM("iso_a3x4_420x1189mm", "iso-a3x4", NULL, 420, 1189),
|
||||
_PWG_MEDIA_MM("iso_a3x5_420x1486mm", "iso-a3x5", NULL, 420, 1486),
|
||||
_PWG_MEDIA_MM("iso_a3x6_420x1783mm", "iso-a3x6", NULL, 420, 1783),
|
||||
_PWG_MEDIA_MM("iso_a3x7_420x2080mm", "iso-a3x7", NULL, 420, 2080),
|
||||
_PWG_MEDIA_MM("iso_a1_594x841mm", "iso-a1", "A1", 594, 841),
|
||||
_PWG_MEDIA_MM("iso_a2x3_594x1261mm", "iso-a2x3", NULL, 594, 1261),
|
||||
_PWG_MEDIA_MM("iso_a2x4_594x1682mm", "iso-a2x4", NULL, 594, 1682),
|
||||
_PWG_MEDIA_MM("iso_a2x5_594x2102mm", "iso-a2x5", NULL, 594, 2102),
|
||||
_PWG_MEDIA_MM("iso_a0_841x1189mm", "iso-a0", "A0", 841, 1189),
|
||||
_PWG_MEDIA_MM("iso_a1x3_841x1783mm", "iso-a1x3", NULL, 841, 1783),
|
||||
_PWG_MEDIA_MM("iso_a1x4_841x2378mm", "iso-a1x4", NULL, 841, 2378),
|
||||
_PWG_MEDIA_MM("iso_2a0_1189x1682mm", NULL, NULL, 1189, 1682),
|
||||
_PWG_MEDIA_MM("iso_a0x3_1189x2523mm", NULL, NULL, 1189, 2523),
|
||||
_PWG_MEDIA_MM("iso_b10_31x44mm", "iso-b10", "ISOB10", 31, 44),
|
||||
_PWG_MEDIA_MM("iso_b9_44x62mm", "iso-b9", "ISOB9", 44, 62),
|
||||
_PWG_MEDIA_MM("iso_b8_62x88mm", "iso-b8", "ISOB8", 62, 88),
|
||||
_PWG_MEDIA_MM("iso_b7_88x125mm", "iso-b7", "ISOB7", 88, 125),
|
||||
_PWG_MEDIA_MM("iso_b6_125x176mm", "iso-b6", "ISOB6", 125, 176),
|
||||
_PWG_MEDIA_MM("iso_b6c4_125x324mm", NULL, NULL, 125, 324),
|
||||
_PWG_MEDIA_MM("iso_b5_176x250mm", "iso-b5", "ISOB5", 176, 250),
|
||||
_PWG_MEDIA_MM("iso_b5-extra_201x276mm", NULL, "ISOB5Extra", 201, 276),
|
||||
_PWG_MEDIA_MM("iso_b4_250x353mm", "iso-b4", "ISOB4", 250, 353),
|
||||
_PWG_MEDIA_MM("iso_b3_353x500mm", "iso-b3", "ISOB3", 353, 500),
|
||||
_PWG_MEDIA_MM("iso_b2_500x707mm", "iso-b2", "ISOB2", 500, 707),
|
||||
_PWG_MEDIA_MM("iso_b1_707x1000mm", "iso-b1", "ISOB1", 707, 1000),
|
||||
_PWG_MEDIA_MM("iso_b0_1000x1414mm", "iso-b0", "ISOB0", 1000, 1414),
|
||||
_PWG_MEDIA_MM("iso_c10_28x40mm", "iso-c10", NULL, 28, 40),
|
||||
_PWG_MEDIA_MM("iso_c9_40x57mm", "iso-c9", NULL, 40, 57),
|
||||
_PWG_MEDIA_MM("iso_c8_57x81mm", "iso-c8", NULL, 57, 81),
|
||||
_PWG_MEDIA_MM("iso_c7_81x114mm", "iso-c7", "EnvC7", 81, 114),
|
||||
_PWG_MEDIA_MM("iso_c7c6_81x162mm", NULL, NULL, 81, 162),
|
||||
_PWG_MEDIA_MM("iso_c6_114x162mm", "iso-c6", "EnvC6", 114, 162),
|
||||
_PWG_MEDIA_MM("iso_c6c5_114x229mm", NULL, "EnvC65", 114, 229),
|
||||
_PWG_MEDIA_MM("iso_c5_162x229mm", "iso-c5", "EnvC5", 162, 229),
|
||||
_PWG_MEDIA_MM("iso_c4_229x324mm", "iso-c4", "EnvC4", 229, 324),
|
||||
_PWG_MEDIA_MM("iso_c3_324x458mm", "iso-c3", "EnvC3", 324, 458),
|
||||
_PWG_MEDIA_MM("iso_c2_458x648mm", "iso-c2", "EnvC2", 458, 648),
|
||||
_PWG_MEDIA_MM("iso_c1_648x917mm", "iso-c1", "EnvC1", 648, 917),
|
||||
_PWG_MEDIA_MM("iso_c0_917x1297mm", "iso-c0", "EnvC0", 917, 1297),
|
||||
_PWG_MEDIA_MM("iso_dl_110x220mm", "iso-designated", "EnvDL", 110, 220),
|
||||
_PWG_MEDIA_MM("iso_ra2_430x610mm", "iso-ra2", NULL, 430, 610),
|
||||
_PWG_MEDIA_MM("iso_sra2_450x640mm", "iso-sra2", NULL, 450, 640),
|
||||
_PWG_MEDIA_MM("iso_ra1_610x860mm", "iso-ra1", NULL, 610, 860),
|
||||
_PWG_MEDIA_MM("iso_sra1_640x900mm", "iso-sra1", NULL, 640, 900),
|
||||
_PWG_MEDIA_MM("iso_ra0_860x1220mm", "iso-ra0", NULL, 860, 1220),
|
||||
_PWG_MEDIA_MM("iso_sra0_900x1280mm", "iso-sra0", NULL, 900, 1280),
|
||||
|
||||
/* Japanese Standard Sheet Media Sizes */
|
||||
_PWG_MEDIA_MM("jis_b10_32x45mm", "jis-b10", "B10", 32, 45),
|
||||
_PWG_MEDIA_MM("jis_b9_45x64mm", "jis-b9", "B9", 45, 64),
|
||||
_PWG_MEDIA_MM("jis_b8_64x91mm", "jis-b8", "B8", 64, 91),
|
||||
_PWG_MEDIA_MM("jis_b7_91x128mm", "jis-b7", "B7", 91, 128),
|
||||
_PWG_MEDIA_MM("jis_b6_128x182mm", "jis-b6", "B6", 128, 182),
|
||||
_PWG_MEDIA_MM("jis_b5_182x257mm", "jis-b5", "B5", 182, 257),
|
||||
_PWG_MEDIA_MM("jis_b4_257x364mm", "jis-b4", "B4", 257, 364),
|
||||
_PWG_MEDIA_MM("jis_b3_364x515mm", "jis-b3", "B3", 364, 515),
|
||||
_PWG_MEDIA_MM("jis_b2_515x728mm", "jis-b2", "B2", 515, 728),
|
||||
_PWG_MEDIA_MM("jis_b1_728x1030mm", "jis-b1", "B1", 728, 1030),
|
||||
_PWG_MEDIA_MM("jis_b0_1030x1456mm", "jis-b0", "B0", 1030, 1456),
|
||||
_PWG_MEDIA_MM("jis_exec_216x330mm", NULL, NULL, 216, 330),
|
||||
_PWG_MEDIA_MM("jpn_chou4_90x205mm", NULL, "EnvChou4", 90, 205),
|
||||
_PWG_MEDIA_MM("jpn_hagaki_100x148mm", NULL, "Postcard", 100, 148),
|
||||
_PWG_MEDIA_MM("jpn_you4_105x235mm", NULL, "EnvYou4", 105, 235),
|
||||
_PWG_MEDIA_MM("jpn_chou2_111.1x146mm", NULL, NULL, 111.1, 146),
|
||||
_PWG_MEDIA_MM("jpn_chou3_120x235mm", NULL, "EnvChou3", 120, 235),
|
||||
_PWG_MEDIA_MM("jpn_oufuku_148x200mm", NULL, "DoublePostcardRotated", 148, 200),
|
||||
_PWG_MEDIA_MM("jpn_kahu_240x322.1mm", NULL, NULL, 240, 322.1),
|
||||
_PWG_MEDIA_MM("jpn_kaku2_240x332mm", NULL, "EnvKaku2", 240, 332),
|
||||
|
||||
/* Chinese Standard Sheet Media Sizes */
|
||||
_PWG_MEDIA_MM("prc_32k_97x151mm", NULL, "PRC32K", 97, 151),
|
||||
_PWG_MEDIA_MM("prc_1_102x165mm", NULL, "EnvPRC1", 102, 165),
|
||||
_PWG_MEDIA_MM("prc_2_102x176mm", NULL, "EnvPRC2", 102, 176),
|
||||
_PWG_MEDIA_MM("prc_4_110x208mm", NULL, "EnvPRC4", 110, 208),
|
||||
_PWG_MEDIA_MM("prc_5_110x220mm", NULL, "EnvPRC5", 110, 220),
|
||||
_PWG_MEDIA_MM("prc_8_120x309mm", NULL, "EnvPRC8", 120, 309),
|
||||
_PWG_MEDIA_MM("prc_6_120x320mm", NULL, NULL, 120, 320),
|
||||
_PWG_MEDIA_MM("prc_3_125x176mm", NULL, "EnvPRC3", 125, 176),
|
||||
_PWG_MEDIA_MM("prc_16k_146x215mm", NULL, "PRC16K", 146, 215),
|
||||
_PWG_MEDIA_MM("prc_7_160x230mm", NULL, "EnvPRC7", 160, 230),
|
||||
_PWG_MEDIA_MM("om_juuro-ku-kai_198x275mm", NULL, NULL, 198, 275),
|
||||
_PWG_MEDIA_MM("om_pa-kai_267x389mm", NULL, NULL, 267, 389),
|
||||
_PWG_MEDIA_MM("om_dai-pa-kai_275x395mm", NULL, NULL, 275, 395),
|
||||
_PWG_MEDIA_MM("prc_10_324x458mm", NULL, "EnvPRC10", 324, 458),
|
||||
|
||||
/* Other Metric Standard Sheet Media Sizes */
|
||||
_PWG_MEDIA_MM("om_small-photo_100x150mm", NULL, NULL, 100, 150),
|
||||
_PWG_MEDIA_MM("om_italian_110x230mm", NULL, "EnvItalian", 110, 230),
|
||||
_PWG_MEDIA_MM("om_postfix_114x229mm", NULL, NULL, 114, 229),
|
||||
_PWG_MEDIA_MM("om_large-photo_200x300", NULL, NULL, 200, 300),
|
||||
_PWG_MEDIA_MM("om_folio_210x330mm", "folio", "Folio", 210, 330),
|
||||
_PWG_MEDIA_MM("om_folio-sp_215x315mm", NULL, NULL, 215, 315),
|
||||
_PWG_MEDIA_MM("om_invite_220x220mm", NULL, "EnvInvite", 220, 220)
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* '_pwgGenerateSize()' - Generate a PWG size keyword.
|
||||
*/
|
||||
|
||||
void
|
||||
_pwgGenerateSize(char *keyword, /* I - Keyword buffer */
|
||||
size_t keysize, /* I - Size of keyword buffer */
|
||||
const char *prefix, /* I - Prefix for PWG size or NULL */
|
||||
const char *name, /* I - Size name or NULL */
|
||||
int width, /* I - Width of page in 2540ths */
|
||||
int length) /* I - Length of page in 2540ths */
|
||||
{
|
||||
struct lconv *loc; /* Locale conversion data */
|
||||
double uwidth, /* Width in inches or millimeters */
|
||||
ulength; /* Height in inches or millimeters */
|
||||
const char *units; /* Units to report */
|
||||
char usize[12 + 1 + 12 + 3], /* Unit size: NNNNNNNNNNNNxNNNNNNNNNNNNuu */
|
||||
*uptr; /* Pointer into unit size */
|
||||
|
||||
|
||||
loc = localeconv();
|
||||
|
||||
if ((width % 635) == 0 && (length % 635) == 0)
|
||||
{
|
||||
/*
|
||||
* Use inches since the size is a multiple of 1/4 inch.
|
||||
*/
|
||||
|
||||
uwidth = width / 2540.0;
|
||||
ulength = length / 2540.0;
|
||||
units = "in";
|
||||
|
||||
if (!prefix)
|
||||
prefix = "oe";
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Use millimeters since the size is not a multiple of 1/4 inch.
|
||||
*/
|
||||
|
||||
uwidth = width * 0.01;
|
||||
ulength = length * 0.01;
|
||||
units = "mm";
|
||||
|
||||
if (!prefix)
|
||||
prefix = "om";
|
||||
}
|
||||
|
||||
uptr = usize;
|
||||
_cupsStrFormatd(uptr, uptr + 12, uwidth, loc);
|
||||
uptr += strlen(uptr);
|
||||
*uptr++ = 'x';
|
||||
_cupsStrFormatd(uptr, uptr + 12, ulength, loc);
|
||||
uptr += strlen(uptr);
|
||||
|
||||
/*
|
||||
* Safe because usize can hold up to 12 + 1 + 12 + 4 bytes.
|
||||
*/
|
||||
|
||||
strcpy(uptr, units);
|
||||
|
||||
if (!name)
|
||||
name = usize;
|
||||
|
||||
/*
|
||||
* Format the name...
|
||||
*/
|
||||
|
||||
snprintf(keyword, keysize, "%s_%s_%s", prefix, name, usize);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_pwgInitSize()' - Initialize a PWG size using IPP job template attributes.
|
||||
*/
|
||||
|
||||
int /* O - 1 if size was initialize, 0 otherwise */
|
||||
_pwgInitSize(_pwg_size_t *size, /* I - Size to initialize */
|
||||
ipp_t *job, /* I - Job template attributes */
|
||||
int *margins_set) /* O - 1 if margins were set, 0 otherwise */
|
||||
{
|
||||
ipp_attribute_t *media, /* media attribute */
|
||||
*media_bottom_margin, /* media-bottom-margin member attribute */
|
||||
*media_col, /* media-col attribute */
|
||||
*media_left_margin, /* media-left-margin member attribute */
|
||||
*media_right_margin, /* media-right-margin member attribute */
|
||||
*media_size, /* media-size member attribute */
|
||||
*media_top_margin, /* media-top-margin member attribute */
|
||||
*x_dimension, /* x-dimension member attribute */
|
||||
*y_dimension; /* y-dimension member attribute */
|
||||
_pwg_media_t *pwg; /* PWG media value */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!size || !job || !margins_set)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Look for media-col and then media...
|
||||
*/
|
||||
|
||||
memset(size, 0, sizeof(_pwg_size_t));
|
||||
*margins_set = 0;
|
||||
|
||||
if ((media_col = ippFindAttribute(job, "media-col",
|
||||
IPP_TAG_BEGIN_COLLECTION)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Got media-col, look for media-size member attribute...
|
||||
*/
|
||||
|
||||
if ((media_size = ippFindAttribute(media_col->values[0].collection,
|
||||
"media-size",
|
||||
IPP_TAG_BEGIN_COLLECTION)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Got media-size, look for x-dimension and y-dimension member
|
||||
* attributes...
|
||||
*/
|
||||
|
||||
x_dimension = ippFindAttribute(media_size->values[0].collection,
|
||||
"x-dimension", IPP_TAG_INTEGER);
|
||||
y_dimension = ippFindAttribute(media_size->values[0].collection,
|
||||
"y-dimension", IPP_TAG_INTEGER);
|
||||
|
||||
if (x_dimension && y_dimension)
|
||||
{
|
||||
size->width = x_dimension->values[0].integer;
|
||||
size->length = y_dimension->values[0].integer;
|
||||
}
|
||||
else if (!x_dimension)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR,
|
||||
_("Missing x-dimension in media-size."), 1);
|
||||
return (0);
|
||||
}
|
||||
else if (!y_dimension)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR,
|
||||
_("Missing y-dimension in media-size."), 1);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Missing media-size in media-col."),
|
||||
1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* media-*-margin */
|
||||
media_bottom_margin = ippFindAttribute(media_col->values[0].collection,
|
||||
"media-bottom-margin",
|
||||
IPP_TAG_INTEGER);
|
||||
media_left_margin = ippFindAttribute(media_col->values[0].collection,
|
||||
"media-left-margin",
|
||||
IPP_TAG_INTEGER);
|
||||
media_right_margin = ippFindAttribute(media_col->values[0].collection,
|
||||
"media-right-margin",
|
||||
IPP_TAG_INTEGER);
|
||||
media_top_margin = ippFindAttribute(media_col->values[0].collection,
|
||||
"media-top-margin",
|
||||
IPP_TAG_INTEGER);
|
||||
if (media_bottom_margin && media_left_margin && media_right_margin &&
|
||||
media_top_margin)
|
||||
{
|
||||
*margins_set = 1;
|
||||
size->bottom = media_bottom_margin->values[0].integer;
|
||||
size->left = media_left_margin->values[0].integer;
|
||||
size->right = media_right_margin->values[0].integer;
|
||||
size->top = media_top_margin->values[0].integer;
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
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)
|
||||
{
|
||||
size->width = pwg->width;
|
||||
size->length = pwg->length;
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Unsupported media value."), 1);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Missing media or media-col."), 1);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_pwgMediaForLegacy()' - Find a PWG media size by ISO/IPP legacy name.
|
||||
*/
|
||||
|
||||
_pwg_media_t * /* O - Matching size or NULL */
|
||||
_pwgMediaForLegacy(
|
||||
const char *legacy) /* I - Legacy size name */
|
||||
{
|
||||
_pwg_media_t key; /* Search key */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!legacy)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Build the lookup table for PWG names as needed...
|
||||
*/
|
||||
|
||||
if (!cg->leg_size_lut)
|
||||
{
|
||||
int i; /* Looping var */
|
||||
_pwg_media_t *size; /* Current size */
|
||||
|
||||
cg->leg_size_lut = cupsArrayNew((cups_array_func_t)pwg_compare_legacy,
|
||||
NULL);
|
||||
|
||||
for (i = (int)(sizeof(cups_pwg_media) / sizeof(cups_pwg_media[0])),
|
||||
size = (_pwg_media_t *)cups_pwg_media;
|
||||
i > 0;
|
||||
i --, size ++)
|
||||
if (size->legacy)
|
||||
cupsArrayAdd(cg->leg_size_lut, size);
|
||||
}
|
||||
|
||||
/*
|
||||
* Lookup the name...
|
||||
*/
|
||||
|
||||
key.legacy = legacy;
|
||||
return ((_pwg_media_t *)cupsArrayFind(cg->leg_size_lut, &key));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_pwgMediaForPPD()' - Find a PWG media size by Adobe PPD name.
|
||||
*/
|
||||
|
||||
_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 */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!ppd)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Build the lookup table for PWG names as needed...
|
||||
*/
|
||||
|
||||
if (!cg->ppd_size_lut)
|
||||
{
|
||||
int i; /* Looping var */
|
||||
|
||||
cg->ppd_size_lut = cupsArrayNew((cups_array_func_t)pwg_compare_ppd, NULL);
|
||||
|
||||
for (i = (int)(sizeof(cups_pwg_media) / sizeof(cups_pwg_media[0])),
|
||||
size = (_pwg_media_t *)cups_pwg_media;
|
||||
i > 0;
|
||||
i --, size ++)
|
||||
if (size->ppd)
|
||||
cupsArrayAdd(cg->ppd_size_lut, size);
|
||||
}
|
||||
|
||||
/*
|
||||
* Lookup the 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);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_pwgMediaForPWG()' - Find a PWG media size by 5101.1 self-describing 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 */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!pwg)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Build the lookup table for PWG names as needed...
|
||||
*/
|
||||
|
||||
if (!cg->pwg_size_lut)
|
||||
{
|
||||
int i; /* Looping var */
|
||||
|
||||
cg->pwg_size_lut = cupsArrayNew((cups_array_func_t)pwg_compare_pwg, NULL);
|
||||
|
||||
for (i = (int)(sizeof(cups_pwg_media) / sizeof(cups_pwg_media[0])),
|
||||
size = (_pwg_media_t *)cups_pwg_media;
|
||||
i > 0;
|
||||
i --, size ++)
|
||||
cupsArrayAdd(cg->pwg_size_lut, size);
|
||||
}
|
||||
|
||||
/*
|
||||
* Lookup the 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);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_pwgMediaForSize()' - Get the PWG media name for a given size.
|
||||
*/
|
||||
|
||||
_pwg_media_t * /* O - PWG media name */
|
||||
_pwgMediaForSize(int width, /* I - Width in 2540ths */
|
||||
int length) /* I - Length in 2540ths */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
_pwg_media_t *media; /* Current media */
|
||||
int dw, dl; /* Difference in width and length */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (width <= 0 || length <= 0)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Look for a standard size...
|
||||
*/
|
||||
|
||||
for (i = (int)(sizeof(cups_pwg_media) / sizeof(cups_pwg_media[0])),
|
||||
media = (_pwg_media_t *)cups_pwg_media;
|
||||
i > 0;
|
||||
i --, media ++)
|
||||
{
|
||||
/*
|
||||
* Adobe uses a size matching algorithm with an epsilon of 5 points, which
|
||||
* is just about 176/2540ths...
|
||||
*/
|
||||
|
||||
dw = media->width - width;
|
||||
dl = media->length - length;
|
||||
|
||||
if (dw > -176 && dw < 176 && dl > -176 && dl < 176)
|
||||
return (media);
|
||||
}
|
||||
|
||||
/*
|
||||
* Not a standard size; convert it to a PWG custom name of the form:
|
||||
*
|
||||
* custom_WIDTHxHEIGHTuu_WIDTHxHEIGHTuu
|
||||
*/
|
||||
|
||||
_pwgGenerateSize(cg->pwg_name, sizeof(cg->pwg_name), "custom", NULL, width,
|
||||
length);
|
||||
|
||||
cg->pwg_media.pwg = cg->pwg_name;
|
||||
cg->pwg_media.width = width;
|
||||
cg->pwg_media.length = length;
|
||||
|
||||
return (&(cg->pwg_media));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'pwg_compare_legacy()' - Compare two sizes using the legacy names.
|
||||
*/
|
||||
|
||||
static int /* O - Result of comparison */
|
||||
pwg_compare_legacy(_pwg_media_t *a, /* I - First size */
|
||||
_pwg_media_t *b) /* I - Second size */
|
||||
{
|
||||
return (strcmp(a->legacy, b->legacy));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'pwg_compare_ppd()' - Compare two sizes using the PPD names.
|
||||
*/
|
||||
|
||||
static int /* O - Result of comparison */
|
||||
pwg_compare_ppd(_pwg_media_t *a, /* I - First size */
|
||||
_pwg_media_t *b) /* I - Second size */
|
||||
{
|
||||
return (strcmp(a->ppd, b->ppd));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'pwg_compare_pwg()' - Compare two sizes using the PWG names.
|
||||
*/
|
||||
|
||||
static int /* O - Result of comparison */
|
||||
pwg_compare_pwg(_pwg_media_t *a, /* I - First size */
|
||||
_pwg_media_t *b) /* I - Second size */
|
||||
{
|
||||
return (strcmp(a->pwg, b->pwg));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
+1491
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Private PWG media API definitions for CUPS.
|
||||
*
|
||||
* Copyright 2009-2010 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_PWG_PRIVATE_H_
|
||||
# define _CUPS_PWG_PRIVATE_H_
|
||||
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
# include <cups/cups.h>
|
||||
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* Macros...
|
||||
*/
|
||||
|
||||
/* Convert from points to 2540ths */
|
||||
# define _PWG_FROMPTS(n) (int)((n) * 2540 / 72)
|
||||
/* Convert from 2540ths to points */
|
||||
# define _PWG_TOPTS(n) ((n) * 72.0 / 2540.0)
|
||||
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
*legacy, /* IPP/ISO legacy name */
|
||||
*ppd; /* Standard Adobe PPD name */
|
||||
int width, /* Width in 2540ths */
|
||||
length; /* Length in 2540ths */
|
||||
} _pwg_media_t;
|
||||
|
||||
typedef struct _pwg_map_s /**** Map element - PPD to/from PWG */
|
||||
{
|
||||
char *pwg, /* PWG media keyword */
|
||||
*ppd; /* PPD option keyword */
|
||||
} _pwg_map_t;
|
||||
|
||||
typedef struct _pwg_size_s /**** Size element - PPD to/from PWG */
|
||||
{
|
||||
_pwg_map_t map; /* Map element */
|
||||
int width, /* Width in 2540ths */
|
||||
length, /* Length in 2540ths */
|
||||
left, /* Left margin in 2540ths */
|
||||
bottom, /* Bottom margin in 2540ths */
|
||||
right, /* Right margin in 2540ths */
|
||||
top; /* Top margin in 2540ths */
|
||||
} _pwg_size_t;
|
||||
|
||||
typedef struct _pwg_s /**** PWG-PPD conversion data ****/
|
||||
{
|
||||
int num_bins; /* Number of output bins */
|
||||
_pwg_map_t *bins; /* Output bins */
|
||||
int num_sizes; /* Number of media sizes */
|
||||
_pwg_size_t *sizes; /* Media sizes */
|
||||
int custom_max_width, /* Maximum custom width in 2540ths */
|
||||
custom_max_length, /* Maximum custom length in 2540ths */
|
||||
custom_min_width, /* Minimum custom width in 2540ths */
|
||||
custom_min_length; /* Minimum custom length in 2540ths */
|
||||
char *custom_max_keyword, /* Maximum custom size PWG keyword */
|
||||
*custom_min_keyword, /* Minimum custom size PWG keyword */
|
||||
custom_ppd_size[41]; /* Custom PPD size name */
|
||||
_pwg_size_t custom_size; /* Custom size record */
|
||||
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;
|
||||
|
||||
|
||||
/*
|
||||
* Functions...
|
||||
*/
|
||||
|
||||
extern _pwg_t *_pwgCreateWithFile(const char *filename);
|
||||
extern _pwg_t *_pwgCreateWithPPD(ppd_file_t *ppd);
|
||||
extern void _pwgDestroy(_pwg_t *pwg);
|
||||
extern void _pwgGenerateSize(char *keyword, size_t keysize,
|
||||
const char *prefix,
|
||||
const char *ppdname,
|
||||
int width, int length);
|
||||
extern const char *_pwgGetBin(_pwg_t *pwg, const char *output_bin);
|
||||
extern const char *_pwgGetInputSlot(_pwg_t *pwg, ipp_t *job,
|
||||
const char *keyword);
|
||||
extern const char *_pwgGetMediaType(_pwg_t *pwg, ipp_t *job,
|
||||
const char *keyword);
|
||||
extern const char *_pwgGetOutputBin(_pwg_t *pwg, const char *keyword);
|
||||
extern const char *_pwgGetPageSize(_pwg_t *pwg, ipp_t *job,
|
||||
const char *keyword, int *exact);
|
||||
extern _pwg_size_t *_pwgGetSize(_pwg_t *pwg, const char *page_size);
|
||||
extern const char *_pwgGetSource(_pwg_t *pwg, const char *input_slot);
|
||||
extern const char *_pwgGetType(_pwg_t *pwg, const char *media_type);
|
||||
extern int _pwgInitSize(_pwg_size_t *size, ipp_t *job,
|
||||
int *margins_set);
|
||||
extern const char *_pwgInputSlotForSource(const char *media_source,
|
||||
char *name, size_t namesize);
|
||||
extern _pwg_media_t *_pwgMediaForLegacy(const char *legacy);
|
||||
extern _pwg_media_t *_pwgMediaForPPD(const char *ppd);
|
||||
extern _pwg_media_t *_pwgMediaForPWG(const char *pwg);
|
||||
extern _pwg_media_t *_pwgMediaForSize(int width, int length);
|
||||
extern const char *_pwgMediaTypeForType(const char *media_source,
|
||||
char *name, size_t namesize);
|
||||
extern const char *_pwgPageSizeForMedia(_pwg_media_t *media,
|
||||
char *name, size_t namesize);
|
||||
extern int _pwgWriteFile(_pwg_t *pwg, const char *filename);
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_PWG_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,376 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* PWG media name API implementation for the Common UNIX Printing System
|
||||
* (CUPS).
|
||||
*
|
||||
* Copyright 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/".
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* _cupsPWGMediaByLegacy() - Find a PWG media size by ISO/IPP legacy name.
|
||||
* _cupsPWGMediaByName() - Find a PWG media size by 5101.1 self-describing
|
||||
* name.
|
||||
* _cupsPWGMediaBySize() - Find a PWG media size by size in points.
|
||||
* compare_legacy() - Compare two sizes using the legacy names.
|
||||
* compare_pwg() - Compare two sizes using the PWG names.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "pwgmedia.h"
|
||||
#include "globals.h"
|
||||
#include "string.h"
|
||||
#include "debug.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local macros...
|
||||
*/
|
||||
|
||||
#define _CUPS_SIZE_IN(p,l,x,y) {p, l, x * 72.0, y * 72.0}
|
||||
#define _CUPS_SIZE_MM(p,l,x,y) {p, l, x / 25.4 * 72.0, y / 25.4 * 72.0}
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int compare_legacy(_cups_pwg_media_t *a, _cups_pwg_media_t *b);
|
||||
static int compare_pwg(_cups_pwg_media_t *a, _cups_pwg_media_t *b);
|
||||
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
static _cups_pwg_media_t const cups_pwg_media[] =
|
||||
{ /* Media size lookup table */
|
||||
/* North American Standard Sheet Media Sizes */
|
||||
_CUPS_SIZE_IN("na_index-3x5_3x5in", NULL, 3, 5),
|
||||
_CUPS_SIZE_IN("na_personal_3.625x6.5in", NULL, 3.625, 6.5),
|
||||
_CUPS_SIZE_IN("na_monarch_3.875x7.5in", "monarch-envelope", 3.875, 7.5),
|
||||
_CUPS_SIZE_IN("na_number-9_3.875x8.875in", "na-number-9-envelope", 3.875, 8.875),
|
||||
_CUPS_SIZE_IN("na_index-4x6_4x6in", NULL, 4, 6),
|
||||
_CUPS_SIZE_IN("na_number-10_4.125x9.5in", "na-number-10-envelope", 4.125, 9.5),
|
||||
_CUPS_SIZE_IN("na_a2_4.375x5.75in", NULL, 4.375, 5.75),
|
||||
_CUPS_SIZE_IN("na_number-11_4.5x10.375in", NULL, 4.5, 10.375),
|
||||
_CUPS_SIZE_IN("na_number-12_4.75x11in", NULL, 4.75, 11),
|
||||
_CUPS_SIZE_IN("na_5x7_5x7in", NULL, 5, 7),
|
||||
_CUPS_SIZE_IN("na_index-5x8_5x8in", NULL, 5, 8),
|
||||
_CUPS_SIZE_IN("na_number-14_5x11.5in", NULL, 5, 11.5),
|
||||
_CUPS_SIZE_IN("na_invoice_5.5x8.5in", "invoice", 5.5, 8.5),
|
||||
_CUPS_SIZE_IN("na_index-4x6-ext_6x8in", NULL, 6, 8),
|
||||
_CUPS_SIZE_IN("na_6x9_6x9in", "na-6x9-envelope", 6, 9),
|
||||
_CUPS_SIZE_IN("na_c5_6.5x9.5in", NULL, 6.5, 9.5),
|
||||
_CUPS_SIZE_IN("na_7x9_7x9in", "na-7x9-envelope", 7, 9),
|
||||
_CUPS_SIZE_IN("na_executive_7.25x10.5in", "executive", 7.25, 10.5),
|
||||
_CUPS_SIZE_IN("na_govt-letter_8x10in", "na-8x10", 8, 10),
|
||||
_CUPS_SIZE_IN("na_govt-legal_8x13in", NULL, 8, 13),
|
||||
_CUPS_SIZE_IN("na_quarto_8.5x10.83in", "quarto", 8.5, 10.83),
|
||||
_CUPS_SIZE_IN("na_letter_8.5x11in", "na-letter", 8.5, 11),
|
||||
_CUPS_SIZE_IN("na_fanfold-eur_8.5x12in", NULL, 8.5, 12),
|
||||
_CUPS_SIZE_IN("na_letter-plus_8.5x12.69in", NULL, 8.5, 12.69),
|
||||
_CUPS_SIZE_IN("na_foolscap_8.5x13in", NULL, 8.5, 13),
|
||||
_CUPS_SIZE_IN("na_legal_8.5x14in", "na-legal", 8.5, 14),
|
||||
_CUPS_SIZE_IN("na_super-a_8.94x14in", NULL, 8.94, 14),
|
||||
_CUPS_SIZE_IN("na_9x11_9x11in", "na-9x11-envelope", 9, 11),
|
||||
_CUPS_SIZE_IN("na_arch-a_9x12in", "arch-a", 9, 12),
|
||||
_CUPS_SIZE_IN("na_letter-extra_9.5x12in", NULL, 9.5, 12),
|
||||
_CUPS_SIZE_IN("na_legal-extra_9.5x15in", NULL, 9.5, 15),
|
||||
_CUPS_SIZE_IN("na_10x11_10x11in", NULL, 10, 11),
|
||||
_CUPS_SIZE_IN("na_10x13_10x13in", "na-10x13-envelope", 10, 13),
|
||||
_CUPS_SIZE_IN("na_10x14_10x14in", "na-10x14-envelope", 10, 14),
|
||||
_CUPS_SIZE_IN("na_10x15_10x15in", "na-10x15-envelope", 10, 15),
|
||||
_CUPS_SIZE_IN("na_11x12_11x12in", NULL, 11, 12),
|
||||
_CUPS_SIZE_IN("na_edp_11x14in", NULL, 11, 14),
|
||||
_CUPS_SIZE_IN("na_fanfold-us_11x14.875in", NULL, 11, 14.875),
|
||||
_CUPS_SIZE_IN("na_11x15_11x15in", NULL, 11, 15),
|
||||
_CUPS_SIZE_IN("na_ledger_11x17in", "tabloid", 11, 17),
|
||||
_CUPS_SIZE_IN("na_eur-edp_12x14in", NULL, 12, 14),
|
||||
_CUPS_SIZE_IN("na_arch-b_12x18in", "arch-b", 12, 18),
|
||||
_CUPS_SIZE_IN("na_12x19_12x19in", NULL, 12, 19),
|
||||
_CUPS_SIZE_IN("na_b-plus_12x19.17in", NULL, 12, 19.17),
|
||||
_CUPS_SIZE_IN("na_super-b_13x19in", NULL, 13, 19),
|
||||
_CUPS_SIZE_IN("na_c_17x22in", "c", 17, 22),
|
||||
_CUPS_SIZE_IN("na_arch-c_18x24in", "arch-c", 18, 24),
|
||||
_CUPS_SIZE_IN("na_d_22x34in", "d", 22, 34),
|
||||
_CUPS_SIZE_IN("na_arch-d_24x36in", "arch-d", 24, 36),
|
||||
_CUPS_SIZE_IN("asme_f_28x40in", "f", 28, 40),
|
||||
_CUPS_SIZE_IN("na_wide-format_30x42in", NULL, 30, 42),
|
||||
_CUPS_SIZE_IN("na_e_34x44in", "e", 34, 44),
|
||||
_CUPS_SIZE_IN("na_arch-e_36x48in", "arch-e", 36, 48),
|
||||
_CUPS_SIZE_IN("na_f_44x68in", NULL, 44, 68),
|
||||
|
||||
/* Chinese Standard Sheet Media Inch Sizes */
|
||||
_CUPS_SIZE_IN("roc_16k_7.75x10.75in", NULL, 7.75, 10.75),
|
||||
_CUPS_SIZE_IN("roc_8k_10.75x15.5in", NULL, 10.75, 15.5),
|
||||
|
||||
/* ISO Standard Sheet Media Sizes */
|
||||
_CUPS_SIZE_MM("iso_a10_26x37mm", "iso-a10", 26, 37),
|
||||
_CUPS_SIZE_MM("iso_a9_37x52mm", "iso-a9", 37, 52),
|
||||
_CUPS_SIZE_MM("iso_a8_52x74mm", "iso-a8", 52, 74),
|
||||
_CUPS_SIZE_MM("iso_a7_74x105mm", "iso-a7", 74, 105),
|
||||
_CUPS_SIZE_MM("iso_a6_105x148mm", "iso-a6", 105, 148),
|
||||
_CUPS_SIZE_MM("iso_a5_148x210mm", "iso-a5", 148, 210),
|
||||
_CUPS_SIZE_MM("iso_a5-extra_174x235mm", NULL, 174, 235),
|
||||
_CUPS_SIZE_MM("iso_a4_210x297mm", "iso-a4", 210, 297),
|
||||
_CUPS_SIZE_MM("iso_a4-tab_225x297mm", NULL, 225, 297),
|
||||
_CUPS_SIZE_MM("iso_a4-extra_235.5x322.3mm", NULL, 235.5, 322.3),
|
||||
_CUPS_SIZE_MM("iso_a3_297x420mm", "iso-a3", 297, 420),
|
||||
_CUPS_SIZE_MM("iso_a4x3_297x630mm", "iso-a4x3", 297, 630),
|
||||
_CUPS_SIZE_MM("iso_a4x4_297x841mm", "iso-a4x4", 297, 841),
|
||||
_CUPS_SIZE_MM("iso_a4x5_297x1051mm", "iso-a4x5", 297, 1051),
|
||||
_CUPS_SIZE_MM("iso_a4x6_297x1261mm", "iso-a4x6", 297, 1261),
|
||||
_CUPS_SIZE_MM("iso_a4x7_297x1471mm", "iso-a4x7", 297, 1471),
|
||||
_CUPS_SIZE_MM("iso_a4x8_297x1682mm", "iso-a4x8", 297, 1682),
|
||||
_CUPS_SIZE_MM("iso_a4x9_297x1892mm", "iso-a4x9", 297, 1892),
|
||||
_CUPS_SIZE_MM("iso_a3-extra_322x445mm", "iso-a3-extra", 322, 445),
|
||||
_CUPS_SIZE_MM("iso_a2_420x594mm", "iso-a2", 420, 594),
|
||||
_CUPS_SIZE_MM("iso_a3x3_420x891mm", "iso-a3x3", 420, 891),
|
||||
_CUPS_SIZE_MM("iso_a3x4_420x1189mm", "iso-a3x4", 420, 1189),
|
||||
_CUPS_SIZE_MM("iso_a3x5_420x1486mm", "iso-a3x5", 420, 1486),
|
||||
_CUPS_SIZE_MM("iso_a3x6_420x1783mm", "iso-a3x6", 420, 1783),
|
||||
_CUPS_SIZE_MM("iso_a3x7_420x2080mm", "iso-a3x7", 420, 2080),
|
||||
_CUPS_SIZE_MM("iso_a1_594x841mm", "iso-a1", 594, 841),
|
||||
_CUPS_SIZE_MM("iso_a2x3_594x1261mm", "iso-a2x3", 594, 1261),
|
||||
_CUPS_SIZE_MM("iso_a2x4_594x1682mm", "iso-a2x4", 594, 1682),
|
||||
_CUPS_SIZE_MM("iso_a2x5_594x2102mm", "iso-a2x5", 594, 2102),
|
||||
_CUPS_SIZE_MM("iso_a0_841x1189mm", "iso-a0", 841, 1189),
|
||||
_CUPS_SIZE_MM("iso_a1x3_841x1783mm", "iso-a1x3", 841, 1783),
|
||||
_CUPS_SIZE_MM("iso_a1x4_841x2378mm", "iso-a1x4", 841, 2378),
|
||||
_CUPS_SIZE_MM("iso_2a0_1189x1682mm", NULL, 1189, 1682),
|
||||
_CUPS_SIZE_MM("iso_a0x3_1189x2523mm", NULL, 1189, 2523),
|
||||
_CUPS_SIZE_MM("iso_b10_31x44mm", "iso-b10", 31, 44),
|
||||
_CUPS_SIZE_MM("iso_b9_44x62mm", "iso-b9", 44, 62),
|
||||
_CUPS_SIZE_MM("iso_b8_62x88mm", "iso-b8", 62, 88),
|
||||
_CUPS_SIZE_MM("iso_b7_88x125mm", "iso-b7", 88, 125),
|
||||
_CUPS_SIZE_MM("iso_b6_125x176mm", "iso-b6", 125, 176),
|
||||
_CUPS_SIZE_MM("iso_b6c4_125x324mm", NULL, 125, 324),
|
||||
_CUPS_SIZE_MM("iso_b5_176x250mm", "iso-b5", 176, 250),
|
||||
_CUPS_SIZE_MM("iso_b5-extra_201x276mm", NULL, 201, 276),
|
||||
_CUPS_SIZE_MM("iso_b4_250x353mm", "iso-b4", 250, 353),
|
||||
_CUPS_SIZE_MM("iso_b3_353x500mm", "iso-b3", 353, 500),
|
||||
_CUPS_SIZE_MM("iso_b2_500x707mm", "iso-b2", 500, 707),
|
||||
_CUPS_SIZE_MM("iso_b1_707x1000mm", "iso-b1", 707, 1000),
|
||||
_CUPS_SIZE_MM("iso_b0_1000x1414mm", "iso-b0", 1000, 1414),
|
||||
_CUPS_SIZE_MM("iso_c10_28x40mm", "iso-c10", 28, 40),
|
||||
_CUPS_SIZE_MM("iso_c9_40x57mm", "iso-c9", 40, 57),
|
||||
_CUPS_SIZE_MM("iso_c8_57x81mm", "iso-c8", 57, 81),
|
||||
_CUPS_SIZE_MM("iso_c7_81x114mm", "iso-c7", 81, 114),
|
||||
_CUPS_SIZE_MM("iso_c7c6_81x162mm", NULL, 81, 162),
|
||||
_CUPS_SIZE_MM("iso_c6_114x162mm", "iso-c6", 114, 162),
|
||||
_CUPS_SIZE_MM("iso_c6c5_114x229mm", NULL, 114, 229),
|
||||
_CUPS_SIZE_MM("iso_c5_162x229mm", "iso-c5", 162, 229),
|
||||
_CUPS_SIZE_MM("iso_c4_229x324mm", "iso-c4", 229, 324),
|
||||
_CUPS_SIZE_MM("iso_c3_324x458mm", "iso-c3", 324, 458),
|
||||
_CUPS_SIZE_MM("iso_c2_458x648mm", "iso-c2", 458, 648),
|
||||
_CUPS_SIZE_MM("iso_c1_648x917mm", "iso-c1", 648, 917),
|
||||
_CUPS_SIZE_MM("iso_c0_917x1297mm", "iso-c0", 917, 1297),
|
||||
_CUPS_SIZE_MM("iso_dl_110x220mm", "iso-designated", 110, 220),
|
||||
_CUPS_SIZE_MM("iso_ra2_430x610mm", "iso-ra2", 430, 610),
|
||||
_CUPS_SIZE_MM("iso_sra2_450x640mm", "iso-sra2", 450, 640),
|
||||
_CUPS_SIZE_MM("iso_ra1_610x860mm", "iso-ra1", 610, 860),
|
||||
_CUPS_SIZE_MM("iso_sra1_640x900mm", "iso-sra1", 640, 900),
|
||||
_CUPS_SIZE_MM("iso_ra0_860x1220mm", "iso-ra0", 860, 1220),
|
||||
_CUPS_SIZE_MM("iso_sra0_900x1280mm", "iso-sra0", 900, 1280),
|
||||
|
||||
/* Japanese Standard Sheet Media Sizes */
|
||||
_CUPS_SIZE_MM("jis_b10_32x45mm", "jis-b10", 32, 45),
|
||||
_CUPS_SIZE_MM("jis_b9_45x64mm", "jis-b9", 45, 64),
|
||||
_CUPS_SIZE_MM("jis_b8_64x91mm", "jis-b8", 64, 91),
|
||||
_CUPS_SIZE_MM("jis_b7_91x128mm", "jis-b7", 91, 128),
|
||||
_CUPS_SIZE_MM("jis_b6_128x182mm", "jis-b6", 128, 182),
|
||||
_CUPS_SIZE_MM("jis_b5_182x257mm", "jis-b5", 182, 257),
|
||||
_CUPS_SIZE_MM("jis_b4_257x364mm", "jis-b4", 257, 364),
|
||||
_CUPS_SIZE_MM("jis_b3_364x515mm", "jis-b3", 364, 515),
|
||||
_CUPS_SIZE_MM("jis_b2_515x728mm", "jis-b2", 515, 728),
|
||||
_CUPS_SIZE_MM("jis_b1_728x1030mm", "jis-b1", 728, 1030),
|
||||
_CUPS_SIZE_MM("jis_b0_1030x1456mm", "jis-b0", 1030, 1456),
|
||||
_CUPS_SIZE_MM("jis_exec_216x330mm", NULL, 216, 330),
|
||||
_CUPS_SIZE_MM("jpn_chou4_90x205mm", NULL, 90, 205),
|
||||
_CUPS_SIZE_MM("jpn_hagaki_100x148mm", NULL, 100, 148),
|
||||
_CUPS_SIZE_MM("jpn_you4_105x235mm", NULL, 105, 235),
|
||||
_CUPS_SIZE_MM("jpn_chou2_111.1x146mm", NULL, 111.1, 146),
|
||||
_CUPS_SIZE_MM("jpn_chou3_120x235mm", NULL, 120, 235),
|
||||
_CUPS_SIZE_MM("jpn_oufuku_148x200mm", NULL, 148, 200),
|
||||
_CUPS_SIZE_MM("jpn_kahu_240x322.1mm", NULL, 240, 322.1),
|
||||
_CUPS_SIZE_MM("jpn_kaku2_240x332mm", NULL, 240, 332),
|
||||
|
||||
/* Chinese Standard Sheet Media Sizes */
|
||||
_CUPS_SIZE_MM("prc_32k_97x151mm", NULL, 97, 151),
|
||||
_CUPS_SIZE_MM("prc_1_102x165mm", NULL, 102, 165),
|
||||
_CUPS_SIZE_MM("prc_2_102x176mm", NULL, 102, 176),
|
||||
_CUPS_SIZE_MM("prc_4_110x208mm", NULL, 110, 208),
|
||||
_CUPS_SIZE_MM("prc_5_110x220mm", NULL, 110, 220),
|
||||
_CUPS_SIZE_MM("prc_8_120x309mm", NULL, 120, 309),
|
||||
_CUPS_SIZE_MM("prc_6_120x320mm", NULL, 120, 320),
|
||||
_CUPS_SIZE_MM("prc_3_125x176mm", NULL, 125, 176),
|
||||
_CUPS_SIZE_MM("prc_16k_146x215mm", NULL, 146, 215),
|
||||
_CUPS_SIZE_MM("prc_7_160x230mm", NULL, 160, 230),
|
||||
_CUPS_SIZE_MM("om_juuro-ku-kai_198x275mm", NULL, 198, 275),
|
||||
_CUPS_SIZE_MM("om_pa-kai_267x389mm", NULL, 267, 389),
|
||||
_CUPS_SIZE_MM("om_dai-pa-kai_275x395mm", NULL, 275, 395),
|
||||
_CUPS_SIZE_MM("prc_10_324x458mm", NULL, 324, 458),
|
||||
|
||||
/* Other Metric Standard Sheet Media Sizes */
|
||||
_CUPS_SIZE_MM("om_small-photo_100x150mm", NULL, 100, 150),
|
||||
_CUPS_SIZE_MM("om_italian_110x230mm", NULL, 110, 230),
|
||||
_CUPS_SIZE_MM("om_postfix_114x229mm", NULL, 114, 229),
|
||||
_CUPS_SIZE_MM("om_large-photo_200x300", NULL, 200, 300),
|
||||
_CUPS_SIZE_MM("om_folio_210x330mm", "folio", 210, 330),
|
||||
_CUPS_SIZE_MM("om_folio-sp_215x315mm", NULL, 215, 315),
|
||||
_CUPS_SIZE_MM("om_invite_220x220mm", NULL, 220, 220)
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsPWGMediaByLegacy()' - Find a PWG media size by ISO/IPP legacy name.
|
||||
*/
|
||||
|
||||
_cups_pwg_media_t * /* O - Matching size or NULL */
|
||||
_cupsPWGMediaByLegacy(
|
||||
const char *legacy) /* I - Legacy size name */
|
||||
{
|
||||
_cups_pwg_media_t key; /* Search key */
|
||||
_cups_globals_t *cg = _cupsGlobals();
|
||||
/* Global data */
|
||||
|
||||
|
||||
/*
|
||||
* Build the lookup table for PWG names as needed...
|
||||
*/
|
||||
|
||||
if (!cg->leg_size_lut)
|
||||
{
|
||||
int i; /* Looping var */
|
||||
_cups_pwg_media_t *size; /* Current size */
|
||||
|
||||
cg->leg_size_lut = cupsArrayNew((cups_array_func_t)compare_legacy, NULL);
|
||||
|
||||
for (i = (int)(sizeof(cups_pwg_media) / sizeof(cups_pwg_media[0])),
|
||||
size = (_cups_pwg_media_t *)cups_pwg_media;
|
||||
i > 0;
|
||||
i --, size ++)
|
||||
if (size->legacy)
|
||||
cupsArrayAdd(cg->leg_size_lut, size);
|
||||
}
|
||||
|
||||
/*
|
||||
* Lookup the name...
|
||||
*/
|
||||
|
||||
key.legacy = legacy;
|
||||
return ((_cups_pwg_media_t *)cupsArrayFind(cg->leg_size_lut, &key));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsPWGMediaByName()' - Find a PWG media size by 5101.1 self-describing
|
||||
* name.
|
||||
*/
|
||||
|
||||
_cups_pwg_media_t * /* O - Matching size or NULL */
|
||||
_cupsPWGMediaByName(const char *pwg) /* I - PWG size name */
|
||||
{
|
||||
_cups_pwg_media_t key; /* Search key */
|
||||
_cups_globals_t *cg = _cupsGlobals();
|
||||
/* Global data */
|
||||
|
||||
|
||||
/*
|
||||
* Build the lookup table for PWG names as needed...
|
||||
*/
|
||||
|
||||
if (!cg->pwg_size_lut)
|
||||
{
|
||||
int i; /* Looping var */
|
||||
_cups_pwg_media_t *size; /* Current size */
|
||||
|
||||
cg->pwg_size_lut = cupsArrayNew((cups_array_func_t)compare_pwg, NULL);
|
||||
|
||||
for (i = (int)(sizeof(cups_pwg_media) / sizeof(cups_pwg_media[0])),
|
||||
size = (_cups_pwg_media_t *)cups_pwg_media;
|
||||
i > 0;
|
||||
i --, size ++)
|
||||
cupsArrayAdd(cg->pwg_size_lut, size);
|
||||
}
|
||||
|
||||
/*
|
||||
* Lookup the name...
|
||||
*/
|
||||
|
||||
key.pwg = pwg;
|
||||
return ((_cups_pwg_media_t *)cupsArrayFind(cg->pwg_size_lut, &key));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsPWGMediaBySize()' - Find a PWG media size by size in points.
|
||||
*/
|
||||
|
||||
_cups_pwg_media_t * /* O - Matching size or NULL */
|
||||
_cupsPWGMediaBySize(double width, /* I - Width in points */
|
||||
double length) /* I - Length in points */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
_cups_pwg_media_t *size; /* Current size */
|
||||
double dw, dl; /* Difference in width and length */
|
||||
|
||||
|
||||
for (i = (int)(sizeof(cups_pwg_media) / sizeof(cups_pwg_media[0])),
|
||||
size = (_cups_pwg_media_t *)cups_pwg_media;
|
||||
i > 0;
|
||||
i --, size ++)
|
||||
{
|
||||
/*
|
||||
* Adobe uses a size matching algorithm with an epsilon of 5 points...
|
||||
*/
|
||||
|
||||
dw = size->width - width;
|
||||
dl = size->length - length;
|
||||
|
||||
if (dw > -5.0 && dw < 5.0 && dl > -5.0 && dl < 5.0)
|
||||
return (size);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'compare_legacy()' - Compare two sizes using the legacy names.
|
||||
*/
|
||||
|
||||
static int /* O - Result of comparison */
|
||||
compare_legacy(_cups_pwg_media_t *a, /* I - First size */
|
||||
_cups_pwg_media_t *b) /* I - Second size */
|
||||
{
|
||||
return (strcmp(a->legacy, b->legacy));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'compare_pwg()' - Compare two sizes using the PWG names.
|
||||
*/
|
||||
|
||||
static int /* O - Result of comparison */
|
||||
compare_pwg(_cups_pwg_media_t *a, /* I - First size */
|
||||
_cups_pwg_media_t *b) /* I - Second size */
|
||||
{
|
||||
return (strcmp(a->pwg, b->pwg));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* PWG media name API definitions for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 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/".
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_PWGMEDIA_H_
|
||||
# define _CUPS_PWGMEDIA_H_
|
||||
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* Types and structures...
|
||||
*/
|
||||
|
||||
typedef struct _cups_pwg_media_s /**** Common media size data ****/
|
||||
{
|
||||
const char *pwg, /* PWG 5101.1 "self describing" name */
|
||||
*legacy; /* IPP/ISO legacy name */
|
||||
double width, /* Width in points */
|
||||
length; /* Length in points */
|
||||
} _cups_pwg_media_t;
|
||||
|
||||
|
||||
/*
|
||||
* Functions...
|
||||
*/
|
||||
|
||||
extern _cups_pwg_media_t *_cupsPWGMediaByLegacy(const char *legacy);
|
||||
extern _cups_pwg_media_t *_cupsPWGMediaByName(const char *pwg);
|
||||
extern _cups_pwg_media_t *_cupsPWGMediaBySize(double width,
|
||||
double length);
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_PWGMEDIA_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
+38
-20
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Raster file definitions for the Common UNIX Printing System (CUPS).
|
||||
* Raster file definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* This file is part of the CUPS Imaging library.
|
||||
@@ -84,26 +84,28 @@ typedef enum cups_bool_e /**** Boolean type ****/
|
||||
|
||||
typedef enum cups_cspace_e /**** cupsColorSpace attribute values ****/
|
||||
{
|
||||
CUPS_CSPACE_W = 0, /* Luminance */
|
||||
CUPS_CSPACE_RGB = 1, /* Red, green, blue */
|
||||
CUPS_CSPACE_RGBA = 2, /* Red, green, blue, alpha */
|
||||
CUPS_CSPACE_K = 3, /* Black */
|
||||
CUPS_CSPACE_CMY = 4, /* Cyan, magenta, yellow */
|
||||
CUPS_CSPACE_YMC = 5, /* Yellow, magenta, cyan */
|
||||
CUPS_CSPACE_CMYK = 6, /* Cyan, magenta, yellow, black */
|
||||
CUPS_CSPACE_YMCK = 7, /* Yellow, magenta, cyan, black */
|
||||
CUPS_CSPACE_KCMY = 8, /* Black, cyan, magenta, yellow */
|
||||
CUPS_CSPACE_KCMYcm = 9, /* Black, cyan, magenta, yellow, *
|
||||
* light-cyan, light-magenta */
|
||||
CUPS_CSPACE_GMCK = 10, /* Gold, magenta, yellow, black */
|
||||
CUPS_CSPACE_GMCS = 11, /* Gold, magenta, yellow, silver */
|
||||
CUPS_CSPACE_WHITE = 12, /* White ink (as black) */
|
||||
CUPS_CSPACE_GOLD = 13, /* Gold foil */
|
||||
CUPS_CSPACE_SILVER = 14, /* Silver foil */
|
||||
CUPS_CSPACE_W = 0, /* Luminance (DeviceGray, gamma 2.2 by default) */
|
||||
CUPS_CSPACE_RGB = 1, /* Red, green, blue (DeviceRGB, sRGB by default) */
|
||||
CUPS_CSPACE_RGBA = 2, /* Red, green, blue, alpha (DeviceRGB, sRGB by default) */
|
||||
CUPS_CSPACE_K = 3, /* Black (DeviceK) */
|
||||
CUPS_CSPACE_CMY = 4, /* Cyan, magenta, yellow (DeviceCMY) */
|
||||
CUPS_CSPACE_YMC = 5, /* Yellow, magenta, cyan @deprecated@ */
|
||||
CUPS_CSPACE_CMYK = 6, /* Cyan, magenta, yellow, black (DeviceCMYK) */
|
||||
CUPS_CSPACE_YMCK = 7, /* Yellow, magenta, cyan, black @deprecated@ */
|
||||
CUPS_CSPACE_KCMY = 8, /* Black, cyan, magenta, yellow @deprecated@ */
|
||||
CUPS_CSPACE_KCMYcm = 9, /* Black, cyan, magenta, yellow, light-cyan, light-magenta @deprecated@ */
|
||||
CUPS_CSPACE_GMCK = 10, /* Gold, magenta, yellow, black @deprecated@ */
|
||||
CUPS_CSPACE_GMCS = 11, /* Gold, magenta, yellow, silver @deprecated@ */
|
||||
CUPS_CSPACE_WHITE = 12, /* White ink (as black) @deprecated@ */
|
||||
CUPS_CSPACE_GOLD = 13, /* Gold foil @deprecated@ */
|
||||
CUPS_CSPACE_SILVER = 14, /* Silver foil @deprecated@ */
|
||||
|
||||
CUPS_CSPACE_CIEXYZ = 15, /* CIE XYZ @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
CUPS_CSPACE_CIELab = 16, /* CIE Lab @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
CUPS_CSPACE_RGBW = 17, /* Red, green, blue, white @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
CUPS_CSPACE_RGBW = 17, /* Red, green, blue, white (DeviceRGB, sRGB by default) @since CUPS 1.2/Mac OS X 10.5@ */
|
||||
CUPS_CSPACE_SW = 18, /* Luminance (gamma 2.2) @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_SRGB = 19, /* Red, green, blue (sRGB) @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_ADOBERGB = 20, /* Red, green, blue (Adobe RGB) @since CUPS 1.4.5@ */
|
||||
|
||||
CUPS_CSPACE_ICC1 = 32, /* ICC-based, 1 color @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
CUPS_CSPACE_ICC2 = 33, /* ICC-based, 2 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
@@ -119,7 +121,23 @@ typedef enum cups_cspace_e /**** cupsColorSpace attribute values ****/
|
||||
CUPS_CSPACE_ICCC = 43, /* ICC-based, 12 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
CUPS_CSPACE_ICCD = 44, /* ICC-based, 13 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
CUPS_CSPACE_ICCE = 45, /* ICC-based, 14 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
CUPS_CSPACE_ICCF = 46 /* ICC-based, 15 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
CUPS_CSPACE_ICCF = 46, /* ICC-based, 15 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
|
||||
|
||||
CUPS_CSPACE_DEVICE1 = 48, /* DeviceN, 1 color @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE2 = 49, /* DeviceN, 2 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE3 = 50, /* DeviceN, 3 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE4 = 51, /* DeviceN, 4 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE5 = 52, /* DeviceN, 5 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE6 = 53, /* DeviceN, 6 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE7 = 54, /* DeviceN, 7 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE8 = 55, /* DeviceN, 8 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICE9 = 56, /* DeviceN, 9 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICEA = 57, /* DeviceN, 10 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICEB = 58, /* DeviceN, 11 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICEC = 59, /* DeviceN, 12 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICED = 60, /* DeviceN, 13 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICEE = 61, /* DeviceN, 14 colors @since CUPS 1.4.5@ */
|
||||
CUPS_CSPACE_DEVICEF = 62 /* DeviceN, 15 colors @since CUPS 1.4.5@ */
|
||||
} cups_cspace_t;
|
||||
|
||||
typedef enum cups_cut_e /**** CutMedia attribute values ****/
|
||||
|
||||
+75
-36
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* IPP utilities for the Common UNIX Printing System (CUPS).
|
||||
* IPP utilities for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -153,7 +153,11 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
|
||||
if (!http)
|
||||
if ((http = _cupsConnect()) == NULL)
|
||||
{
|
||||
ippDelete(request);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we have a file to send...
|
||||
@@ -245,7 +249,9 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
{
|
||||
if (httpCheck(http))
|
||||
{
|
||||
if ((status = httpUpdate(http)) != HTTP_CONTINUE)
|
||||
_httpUpdate(http, &status);
|
||||
|
||||
if (status >= HTTP_MULTIPLE_CHOICES)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -263,14 +269,15 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
response = cupsGetResponse(http, resource);
|
||||
status = http->status;
|
||||
}
|
||||
else
|
||||
httpFlush(http);
|
||||
|
||||
DEBUG_printf(("2cupsDoIORequest: status=%d", status));
|
||||
|
||||
if (status >= HTTP_BAD_REQUEST &&
|
||||
status != HTTP_UNAUTHORIZED &&
|
||||
status != HTTP_UPGRADE_REQUIRED)
|
||||
if (status == HTTP_ERROR ||
|
||||
(status >= HTTP_BAD_REQUEST && status != HTTP_UNAUTHORIZED &&
|
||||
status != HTTP_UPGRADE_REQUIRED))
|
||||
{
|
||||
httpFlush(http);
|
||||
_cupsSetHTTPError(status);
|
||||
break;
|
||||
}
|
||||
@@ -384,9 +391,11 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
DEBUG_printf(("2cupsGetResponse: Update loop, http->status=%d...",
|
||||
http->status));
|
||||
|
||||
status = http->status;
|
||||
while (status == HTTP_CONTINUE)
|
||||
do
|
||||
{
|
||||
status = httpUpdate(http);
|
||||
}
|
||||
while (http->state == HTTP_POST_RECV);
|
||||
|
||||
DEBUG_printf(("2cupsGetResponse: status=%d", status));
|
||||
|
||||
@@ -613,10 +622,25 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
*/
|
||||
|
||||
httpClearFields(http);
|
||||
httpSetLength(http, length);
|
||||
httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
|
||||
httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
|
||||
httpSetExpect(http, expect);
|
||||
httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
|
||||
httpSetLength(http, length);
|
||||
|
||||
#ifdef HAVE_GSSAPI
|
||||
if (http->authstring && !strncmp(http->authstring, "Negotiate", 9))
|
||||
{
|
||||
/*
|
||||
* Do not use cached Kerberos credentials since they will look like a
|
||||
* "replay" attack...
|
||||
*/
|
||||
|
||||
httpSetField(http, HTTP_FIELD_WWW_AUTHENTICATE, "Negotiate");
|
||||
cupsDoAuthentication(http, "POST", resource);
|
||||
httpSetField(http, HTTP_FIELD_WWW_AUTHENTICATE, "");
|
||||
}
|
||||
#endif /* HAVE_GSSAPI */
|
||||
|
||||
httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
|
||||
|
||||
DEBUG_printf(("2cupsSendRequest: authstring=\"%s\"", http->authstring));
|
||||
|
||||
@@ -654,7 +678,8 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
{
|
||||
got_status = 1;
|
||||
|
||||
if ((status = httpUpdate(http)) != HTTP_CONTINUE)
|
||||
_httpUpdate(http, &status);
|
||||
if (status >= HTTP_MULTIPLE_CHOICES)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -662,15 +687,18 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
* Wait up to 1 second to get the 100-continue response as needed...
|
||||
*/
|
||||
|
||||
if (!got_status && expect == HTTP_CONTINUE)
|
||||
if (!got_status)
|
||||
{
|
||||
DEBUG_puts("2cupsSendRequest: Waiting for 100-continue...");
|
||||
if (expect == HTTP_CONTINUE)
|
||||
{
|
||||
DEBUG_puts("2cupsSendRequest: Waiting for 100-continue...");
|
||||
|
||||
if (httpWait(http, 1000))
|
||||
status = httpUpdate(http);
|
||||
if (httpWait(http, 1000))
|
||||
_httpUpdate(http, &status);
|
||||
}
|
||||
else if (httpCheck(http))
|
||||
_httpUpdate(http, &status);
|
||||
}
|
||||
else if (httpCheck(http))
|
||||
status = httpUpdate(http);
|
||||
|
||||
DEBUG_printf(("2cupsSendRequest: status=%d", status));
|
||||
|
||||
@@ -678,6 +706,9 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
* Process the current HTTP status...
|
||||
*/
|
||||
|
||||
if (status >= HTTP_MULTIPLE_CHOICES)
|
||||
httpFlush(http);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case HTTP_ERROR :
|
||||
@@ -686,18 +717,15 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
return (status);
|
||||
|
||||
case HTTP_UNAUTHORIZED :
|
||||
if (!cupsDoAuthentication(http, "POST", resource))
|
||||
{
|
||||
if (httpReconnect(http))
|
||||
{
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
|
||||
return (HTTP_SERVICE_UNAVAILABLE);
|
||||
}
|
||||
}
|
||||
else
|
||||
status = HTTP_AUTHORIZATION_CANCELED;
|
||||
if (cupsDoAuthentication(http, "POST", resource))
|
||||
return (HTTP_AUTHORIZATION_CANCELED);
|
||||
|
||||
return (status);
|
||||
if (httpReconnect(http))
|
||||
{
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
|
||||
return (HTTP_SERVICE_UNAVAILABLE);
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
case HTTP_UPGRADE_REQUIRED :
|
||||
@@ -712,9 +740,12 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
return (HTTP_SERVICE_UNAVAILABLE);
|
||||
}
|
||||
|
||||
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
|
||||
|
||||
return (status);
|
||||
if (httpEncryption(http, HTTP_ENCRYPT_REQUIRED))
|
||||
{
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
|
||||
return (HTTP_SERVICE_UNAVAILABLE);
|
||||
}
|
||||
break;
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
case HTTP_EXPECTATION_FAILED :
|
||||
@@ -801,7 +832,15 @@ cupsWriteRequestData(
|
||||
*/
|
||||
|
||||
if (_httpWait(http, 0, 1))
|
||||
return (httpUpdate(http));
|
||||
{
|
||||
http_status_t status; /* Status from _httpUpdate */
|
||||
|
||||
_httpUpdate(http, &status);
|
||||
if (status >= HTTP_MULTIPLE_CHOICES)
|
||||
httpFlush(http);
|
||||
|
||||
return (status);
|
||||
}
|
||||
}
|
||||
|
||||
return (HTTP_CONTINUE);
|
||||
@@ -873,10 +912,10 @@ _cupsSetHTTPError(http_status_t status) /* I - HTTP status code */
|
||||
break;
|
||||
|
||||
case HTTP_UNAUTHORIZED :
|
||||
case HTTP_AUTHORIZATION_CANCELED :
|
||||
_cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status), 0);
|
||||
_cupsSetError(IPP_NOT_AUTHENTICATED, httpStatus(status), 0);
|
||||
break;
|
||||
|
||||
case HTTP_AUTHORIZATION_CANCELED :
|
||||
case HTTP_FORBIDDEN :
|
||||
_cupsSetError(IPP_FORBIDDEN, httpStatus(status), 0);
|
||||
break;
|
||||
|
||||
+2
-1
@@ -41,6 +41,7 @@
|
||||
#include <limits.h>
|
||||
#include "array.h"
|
||||
#include "debug.h"
|
||||
#define _CUPS_STRING_C_
|
||||
#include "string.h"
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
# include <pthread.h>
|
||||
@@ -428,7 +429,7 @@ _cupsStrScand(const char *buf, /* I - Pointer to number */
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*buf & 255))
|
||||
while (_cups_isspace(*buf))
|
||||
buf ++;
|
||||
|
||||
/*
|
||||
|
||||
+59
-2
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* String definitions for the Common UNIX Printing System (CUPS).
|
||||
* String definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -27,6 +27,7 @@
|
||||
# include <stdarg.h>
|
||||
# include <ctype.h>
|
||||
# include <locale.h>
|
||||
# include <errno.h>
|
||||
|
||||
# include <config.h>
|
||||
|
||||
@@ -78,6 +79,62 @@ 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...
|
||||
*/
|
||||
|
||||
+27
-2
@@ -2,7 +2,7 @@
|
||||
*%
|
||||
*% "$Id$"
|
||||
*%
|
||||
*% Test PPD file for the Common UNIX Printing System (CUPS).
|
||||
*% Test PPD file for CUPS.
|
||||
*%
|
||||
*% This file is used to test the CUPS PPD API functions and cannot be
|
||||
*% used with any known printers. Look on the CUPS web site for working PPD
|
||||
@@ -12,7 +12,7 @@
|
||||
*% to create your PPD files - not only will it save you time, it produces
|
||||
*% consistently high-quality files.
|
||||
*%
|
||||
*% Copyright 2007-2009 by Apple Inc.
|
||||
*% Copyright 2007-2010 by Apple Inc.
|
||||
*% Copyright 2002-2006 by Easy Software Products.
|
||||
*%
|
||||
*% These coded instructions, statements, and computer programs are the
|
||||
@@ -65,6 +65,12 @@
|
||||
*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: ""
|
||||
*PageSize A4/A4: "PageSize=A4"
|
||||
*fr.PageSize A4/French A4: ""
|
||||
*fr_CA.PageSize A4/French Canadian A4: ""
|
||||
@@ -78,27 +84,37 @@
|
||||
*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"
|
||||
*CloseUI: *PageRegion
|
||||
|
||||
*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"
|
||||
|
||||
@@ -120,6 +136,15 @@
|
||||
*InputSlot Envelope/Envelope Feed: "InputSlot=Envelope"
|
||||
*CloseUI: *InputSlot
|
||||
|
||||
*OpenUI *MediaType/Media Type: PickOne
|
||||
*OrderDependency: 25 AnySetup *MediaType
|
||||
*DefaultMediaType: Plain
|
||||
*MediaType Plain/Plain Paper: "MediaType=Plain"
|
||||
*MediaType Matte/Matte Photo: "MediaType=Matte"
|
||||
*MediaType Glossy/Glossy Photo: "MediaType=Glossy"
|
||||
*MediaType Transparency/Transparency Film: "MediaType=Transparency"
|
||||
*CloseUI: *MediaType
|
||||
|
||||
*OpenUI *Duplex/2-Sided Printing: PickOne
|
||||
*OrderDependency: 10 DocumentSetup *Duplex
|
||||
*DefaultDuplex: None
|
||||
|
||||
+239
-15
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* IPP test program for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -16,7 +16,11 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Main entry.
|
||||
* main() - Main entry.
|
||||
* hex_dump() - Produce a hex dump of a buffer.
|
||||
* print_attributes() - Print the attributes in a request...
|
||||
* read_cb() - Read data from a buffer.
|
||||
* write_cb() - Write data into a buffer.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -25,6 +29,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cups/file.h>
|
||||
#include <cups/string.h>
|
||||
#include <errno.h>
|
||||
#include "ipp-private.h"
|
||||
@@ -80,6 +85,32 @@ ipp_uchar_t collection[] = /* Collection buffer */
|
||||
0x00, 0x09, /* Name length + name */
|
||||
'm', 'e', 'd', 'i', 'a', '-', 'c', 'o', 'l',
|
||||
0x00, 0x00, /* No value */
|
||||
IPP_TAG_MEMBERNAME, /* memberAttrName tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x0a, /* Value length + value */
|
||||
'm', 'e', 'd', 'i', 'a', '-', 's', 'i', 'z', 'e',
|
||||
IPP_TAG_BEGIN_COLLECTION, /* begCollection tag */
|
||||
0x00, 0x00, /* Name length + name */
|
||||
0x00, 0x00, /* No value */
|
||||
IPP_TAG_MEMBERNAME, /* memberAttrName tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x0b, /* Value length + value */
|
||||
'x', '-', 'd', 'i', 'm', 'e', 'n', 's', 'i', 'o', 'n',
|
||||
IPP_TAG_INTEGER, /* integer tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x04, /* Value length + value */
|
||||
0x00, 0x00, 0x54, 0x56,
|
||||
IPP_TAG_MEMBERNAME, /* memberAttrName tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x0b, /* Value length + value */
|
||||
'y', '-', 'd', 'i', 'm', 'e', 'n', 's', 'i', 'o', 'n',
|
||||
IPP_TAG_INTEGER, /* integer tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x04, /* Value length + value */
|
||||
0x00, 0x00, 0x6d, 0x24,
|
||||
IPP_TAG_END_COLLECTION, /* endCollection tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x00, /* No value */
|
||||
IPP_TAG_MEMBERNAME, /* memberAttrName tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x0b, /* Value length + value */
|
||||
@@ -104,6 +135,32 @@ ipp_uchar_t collection[] = /* Collection buffer */
|
||||
IPP_TAG_BEGIN_COLLECTION, /* begCollection tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x00, /* No value */
|
||||
IPP_TAG_MEMBERNAME, /* memberAttrName tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x0a, /* Value length + value */
|
||||
'm', 'e', 'd', 'i', 'a', '-', 's', 'i', 'z', 'e',
|
||||
IPP_TAG_BEGIN_COLLECTION, /* begCollection tag */
|
||||
0x00, 0x00, /* Name length + name */
|
||||
0x00, 0x00, /* No value */
|
||||
IPP_TAG_MEMBERNAME, /* memberAttrName tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x0b, /* Value length + value */
|
||||
'x', '-', 'd', 'i', 'm', 'e', 'n', 's', 'i', 'o', 'n',
|
||||
IPP_TAG_INTEGER, /* integer tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x04, /* Value length + value */
|
||||
0x00, 0x00, 0x52, 0x08,
|
||||
IPP_TAG_MEMBERNAME, /* memberAttrName tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x0b, /* Value length + value */
|
||||
'y', '-', 'd', 'i', 'm', 'e', 'n', 's', 'i', 'o', 'n',
|
||||
IPP_TAG_INTEGER, /* integer tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x04, /* Value length + value */
|
||||
0x00, 0x00, 0x74, 0x04,
|
||||
IPP_TAG_END_COLLECTION, /* endCollection tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x00, /* No value */
|
||||
IPP_TAG_MEMBERNAME, /* memberAttrName tag */
|
||||
0x00, 0x00, /* No name */
|
||||
0x00, 0x0b, /* Value length + value */
|
||||
@@ -147,11 +204,15 @@ int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
ipp_t *cols[2]; /* Collections */
|
||||
ipp_t *cols[2], /* Collections */
|
||||
*size; /* media-size collection */
|
||||
ipp_t *request; /* Request */
|
||||
ipp_attribute_t *media_col, /* media-col attribute */
|
||||
*media_size, /* media-size attribute */
|
||||
*attr; /* Other attribute */
|
||||
ipp_state_t state; /* State */
|
||||
int length; /* Length of data */
|
||||
int fd; /* File descriptor */
|
||||
cups_file_t *fp; /* File pointer */
|
||||
int i; /* Looping var */
|
||||
int status; /* Status of tests (0 = success, 1 = fail) */
|
||||
|
||||
@@ -180,14 +241,31 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
"printer-uri", NULL, "ipp://localhost/printers/foo");
|
||||
|
||||
cols[0] = ippNew();
|
||||
ippAddString(cols[0], IPP_TAG_JOB, IPP_TAG_KEYWORD, "media-color", NULL, "blue");
|
||||
ippAddString(cols[0], IPP_TAG_JOB, IPP_TAG_KEYWORD, "media-type", NULL, "plain");
|
||||
size = ippNew();
|
||||
ippAddInteger(size, IPP_TAG_ZERO, IPP_TAG_INTEGER, "x-dimension", 21590);
|
||||
ippAddInteger(size, IPP_TAG_ZERO, IPP_TAG_INTEGER, "y-dimension", 27940);
|
||||
ippAddCollection(cols[0], IPP_TAG_JOB, "media-size", size);
|
||||
ippDelete(size);
|
||||
ippAddString(cols[0], IPP_TAG_JOB, IPP_TAG_KEYWORD, "media-color", NULL,
|
||||
"blue");
|
||||
ippAddString(cols[0], IPP_TAG_JOB, IPP_TAG_KEYWORD, "media-type", NULL,
|
||||
"plain");
|
||||
|
||||
cols[1] = ippNew();
|
||||
ippAddString(cols[1], IPP_TAG_JOB, IPP_TAG_KEYWORD, "media-color", NULL, "plaid");
|
||||
ippAddString(cols[1], IPP_TAG_JOB, IPP_TAG_KEYWORD, "media-type", NULL, "glossy");
|
||||
size = ippNew();
|
||||
ippAddInteger(size, IPP_TAG_ZERO, IPP_TAG_INTEGER, "x-dimension", 21000);
|
||||
ippAddInteger(size, IPP_TAG_ZERO, IPP_TAG_INTEGER, "y-dimension", 29700);
|
||||
ippAddCollection(cols[1], IPP_TAG_JOB, "media-size", size);
|
||||
ippDelete(size);
|
||||
ippAddString(cols[1], IPP_TAG_JOB, IPP_TAG_KEYWORD, "media-color", NULL,
|
||||
"plaid");
|
||||
ippAddString(cols[1], IPP_TAG_JOB, IPP_TAG_KEYWORD, "media-type", NULL,
|
||||
"glossy");
|
||||
|
||||
ippAddCollections(request, IPP_TAG_JOB, "media-col", 2, (const ipp_t **)cols);
|
||||
ippAddCollections(request, IPP_TAG_JOB, "media-col", 2,
|
||||
(const ipp_t **)cols);
|
||||
ippDelete(cols[0]);
|
||||
ippDelete(cols[1]);
|
||||
|
||||
length = ippLength(request);
|
||||
if (length != sizeof(collection))
|
||||
@@ -206,7 +284,8 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
printf("Write Sample to Memory: ");
|
||||
|
||||
wused = 0;
|
||||
while ((state = ippWriteIO(wbuffer, write_cb, 1, NULL, request)) != IPP_DATA)
|
||||
while ((state = ippWriteIO(wbuffer, write_cb, 1, NULL,
|
||||
request)) != IPP_DATA)
|
||||
if (state == IPP_ERROR)
|
||||
break;
|
||||
|
||||
@@ -225,7 +304,11 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
else if (memcmp(wbuffer, collection, wused))
|
||||
{
|
||||
puts("FAIL - output does not match baseline!");
|
||||
for (i = 0; i < wused; i ++)
|
||||
if (wbuffer[i] != collection[i])
|
||||
break;
|
||||
|
||||
printf("FAIL - output does not match baseline at 0x%04x!\n", i);
|
||||
hex_dump("Bytes Written", wbuffer, wused);
|
||||
hex_dump("Baseline", collection, sizeof(collection));
|
||||
status = 1;
|
||||
@@ -271,13 +354,153 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
fputs("ippFindAttribute(media-col): ", stdout);
|
||||
if ((media_col = ippFindAttribute(request, "media-col",
|
||||
IPP_TAG_BEGIN_COLLECTION)) == NULL)
|
||||
{
|
||||
if ((media_col = ippFindAttribute(request, "media-col",
|
||||
IPP_TAG_ZERO)) == NULL)
|
||||
puts("FAIL (not found)");
|
||||
else
|
||||
printf("FAIL (wrong type - %s)\n", ippTagString(media_col->value_tag));
|
||||
|
||||
status = 1;
|
||||
}
|
||||
else if (media_col->num_values != 2)
|
||||
{
|
||||
printf("FAIL (wrong count - %d)\n", media_col->num_values);
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
if (media_col)
|
||||
{
|
||||
fputs("ippFindAttribute(media-size 1): ", stdout);
|
||||
if ((media_size = ippFindAttribute(media_col->values[0].collection,
|
||||
"media-size",
|
||||
IPP_TAG_BEGIN_COLLECTION)) == NULL)
|
||||
{
|
||||
if ((media_size = ippFindAttribute(media_col->values[0].collection,
|
||||
"media-col",
|
||||
IPP_TAG_ZERO)) == NULL)
|
||||
puts("FAIL (not found)");
|
||||
else
|
||||
printf("FAIL (wrong type - %s)\n",
|
||||
ippTagString(media_size->value_tag));
|
||||
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((attr = ippFindAttribute(media_size->values[0].collection,
|
||||
"x-dimension", IPP_TAG_INTEGER)) == NULL)
|
||||
{
|
||||
if ((attr = ippFindAttribute(media_size->values[0].collection,
|
||||
"x-dimension", IPP_TAG_ZERO)) == NULL)
|
||||
puts("FAIL (missing x-dimension)");
|
||||
else
|
||||
printf("FAIL (wrong type for x-dimension - %s)\n",
|
||||
ippTagString(attr->value_tag));
|
||||
|
||||
status = 1;
|
||||
}
|
||||
else if (attr->values[0].integer != 21590)
|
||||
{
|
||||
printf("FAIL (wrong value for x-dimension - %d)\n",
|
||||
attr->values[0].integer);
|
||||
status = 1;
|
||||
}
|
||||
else if ((attr = ippFindAttribute(media_size->values[0].collection,
|
||||
"y-dimension",
|
||||
IPP_TAG_INTEGER)) == NULL)
|
||||
{
|
||||
if ((attr = ippFindAttribute(media_size->values[0].collection,
|
||||
"y-dimension", IPP_TAG_ZERO)) == NULL)
|
||||
puts("FAIL (missing y-dimension)");
|
||||
else
|
||||
printf("FAIL (wrong type for y-dimension - %s)\n",
|
||||
ippTagString(attr->value_tag));
|
||||
|
||||
status = 1;
|
||||
}
|
||||
else if (attr->values[0].integer != 27940)
|
||||
{
|
||||
printf("FAIL (wrong value for y-dimension - %d)\n",
|
||||
attr->values[0].integer);
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
}
|
||||
|
||||
fputs("ippFindAttribute(media-size 2): ", stdout);
|
||||
if ((media_size = ippFindAttribute(media_col->values[1].collection,
|
||||
"media-size",
|
||||
IPP_TAG_BEGIN_COLLECTION)) == NULL)
|
||||
{
|
||||
if ((media_size = ippFindAttribute(media_col->values[1].collection,
|
||||
"media-col",
|
||||
IPP_TAG_ZERO)) == NULL)
|
||||
puts("FAIL (not found)");
|
||||
else
|
||||
printf("FAIL (wrong type - %s)\n",
|
||||
ippTagString(media_size->value_tag));
|
||||
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((attr = ippFindAttribute(media_size->values[0].collection,
|
||||
"x-dimension",
|
||||
IPP_TAG_INTEGER)) == NULL)
|
||||
{
|
||||
if ((attr = ippFindAttribute(media_size->values[0].collection,
|
||||
"x-dimension", IPP_TAG_ZERO)) == NULL)
|
||||
puts("FAIL (missing x-dimension)");
|
||||
else
|
||||
printf("FAIL (wrong type for x-dimension - %s)\n",
|
||||
ippTagString(attr->value_tag));
|
||||
|
||||
status = 1;
|
||||
}
|
||||
else if (attr->values[0].integer != 21000)
|
||||
{
|
||||
printf("FAIL (wrong value for x-dimension - %d)\n",
|
||||
attr->values[0].integer);
|
||||
status = 1;
|
||||
}
|
||||
else if ((attr = ippFindAttribute(media_size->values[0].collection,
|
||||
"y-dimension",
|
||||
IPP_TAG_INTEGER)) == NULL)
|
||||
{
|
||||
if ((attr = ippFindAttribute(media_size->values[0].collection,
|
||||
"y-dimension", IPP_TAG_ZERO)) == NULL)
|
||||
puts("FAIL (missing y-dimension)");
|
||||
else
|
||||
printf("FAIL (wrong type for y-dimension - %s)\n",
|
||||
ippTagString(attr->value_tag));
|
||||
|
||||
status = 1;
|
||||
}
|
||||
else if (attr->values[0].integer != 29700)
|
||||
{
|
||||
printf("FAIL (wrong value for y-dimension - %d)\n",
|
||||
attr->values[0].integer);
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
}
|
||||
}
|
||||
|
||||
ippDelete(request);
|
||||
|
||||
/*
|
||||
* Test _ippFindOption() private API...
|
||||
*/
|
||||
|
||||
fputs("_ippFindOption(\"printer-type\"): ", stdout);
|
||||
fputs("_ippFindOption(printer-type): ", stdout);
|
||||
if (_ippFindOption("printer-type"))
|
||||
puts("PASS");
|
||||
else
|
||||
@@ -305,7 +528,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
{
|
||||
if ((fd = open(argv[i], O_RDONLY)) < 0)
|
||||
if ((fp = cupsFileOpen(argv[i], "r")) == NULL)
|
||||
{
|
||||
printf("Unable to open \"%s\" - %s\n", argv[i], strerror(errno));
|
||||
status = 1;
|
||||
@@ -313,7 +536,8 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
|
||||
request = ippNew();
|
||||
while ((state = ippReadFile(fd, request)) == IPP_ATTRIBUTE);
|
||||
while ((state = ippReadIO(fp, (ipp_iocb_t)cupsFileRead, 1, NULL,
|
||||
request)) == IPP_ATTRIBUTE);
|
||||
|
||||
if (state != IPP_DATA)
|
||||
{
|
||||
@@ -327,7 +551,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
|
||||
ippDelete(request);
|
||||
close(fd);
|
||||
cupsFileClose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+50
-14
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* PPD test program for the Common UNIX Printing System (CUPS).
|
||||
* PPD test program for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -23,13 +23,12 @@
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <cups/cups.h>
|
||||
#include <cups/string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cups/string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include "cups.h"
|
||||
#include "pwgmedia.h"
|
||||
#ifdef WIN32
|
||||
# include <io.h>
|
||||
#else
|
||||
@@ -58,6 +57,11 @@ static const char *default_code =
|
||||
"%%EndFeature\n"
|
||||
"} stopped cleartomark\n"
|
||||
"[{\n"
|
||||
"%%BeginFeature: *MediaType Plain\n"
|
||||
"MediaType=Plain\n"
|
||||
"%%EndFeature\n"
|
||||
"} stopped cleartomark\n"
|
||||
"[{\n"
|
||||
"%%BeginFeature: *IntOption None\n"
|
||||
"%%EndFeature\n"
|
||||
"} stopped cleartomark\n"
|
||||
@@ -77,6 +81,11 @@ static const char *custom_code =
|
||||
"%%EndFeature\n"
|
||||
"} stopped cleartomark\n"
|
||||
"[{\n"
|
||||
"%%BeginFeature: *MediaType Plain\n"
|
||||
"MediaType=Plain\n"
|
||||
"%%EndFeature\n"
|
||||
"} stopped cleartomark\n"
|
||||
"[{\n"
|
||||
"%%BeginFeature: *IntOption None\n"
|
||||
"%%EndFeature\n"
|
||||
"} stopped cleartomark\n"
|
||||
@@ -145,7 +154,6 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
maxsize, /* Maximum size */
|
||||
*size; /* Current size */
|
||||
ppd_attr_t *attr; /* Current attribute */
|
||||
_cups_pwg_media_t *pwgmedia; /* PWG media size */
|
||||
|
||||
|
||||
status = 0;
|
||||
@@ -437,15 +445,30 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
fputs("_cupsPWGMediaBySize(842, 1191): ", stdout);
|
||||
if ((pwgmedia = _cupsPWGMediaBySize(842, 1191)) == NULL)
|
||||
fputs("cupsMarkOptions(media=oe_letter-fullbleed_8.5x11in): ", stdout);
|
||||
num_options = cupsAddOption("media", "oe_letter-fullbleed_8.5x11in", 0,
|
||||
&options);
|
||||
cupsMarkOptions(ppd, num_options, options);
|
||||
cupsFreeOptions(num_options, options);
|
||||
|
||||
size = ppdPageSize(ppd, NULL);
|
||||
if (!size || strcmp(size->name, "Letter.Fullbleed"))
|
||||
{
|
||||
puts("FAIL (not found)");
|
||||
printf("FAIL (%s)\n", size ? size->name : "unknown");
|
||||
status ++;
|
||||
}
|
||||
else if (strcmp(pwgmedia->pwg, "iso_a3_297x420mm"))
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
fputs("cupsMarkOptions(media=A4): ", stdout);
|
||||
num_options = cupsAddOption("media", "A4", 0, &options);
|
||||
cupsMarkOptions(ppd, num_options, options);
|
||||
cupsFreeOptions(num_options, options);
|
||||
|
||||
size = ppdPageSize(ppd, NULL);
|
||||
if (!size || strcmp(size->name, "A4"))
|
||||
{
|
||||
printf("FAIL (%s)\n", pwgmedia->pwg);
|
||||
printf("FAIL (%s)\n", size ? size->name : "unknown");
|
||||
status ++;
|
||||
}
|
||||
else
|
||||
@@ -706,7 +729,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
}
|
||||
else
|
||||
puts("FAIL (No conflicts!)");
|
||||
|
||||
|
||||
fputs("ppdInstallableConflict(): ", stdout);
|
||||
if (ppdInstallableConflict(ppd, "Duplex", "DuplexNoTumble") &&
|
||||
!ppdInstallableConflict(ppd, "Duplex", "None"))
|
||||
@@ -822,10 +845,23 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
if (!strncmp(argv[1], "-d", 2))
|
||||
{
|
||||
filename = cupsGetPPD(argv[1] + 2);
|
||||
const char *printer; /* Printer name */
|
||||
|
||||
if (argv[1][2])
|
||||
printer = argv[1] + 2;
|
||||
else if (argv[2])
|
||||
printer = argv[2];
|
||||
else
|
||||
{
|
||||
puts("Usage: ./testppd -d printer");
|
||||
return (1);
|
||||
}
|
||||
|
||||
filename = cupsGetPPD(printer);
|
||||
|
||||
if (!filename)
|
||||
{
|
||||
printf("%s: %s\n", argv[1], cupsLastErrorString());
|
||||
printf("%s: %s\n", printer, cupsLastErrorString());
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,495 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* PWG test program for CUPS.
|
||||
*
|
||||
* Copyright 2009-2010 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Main entry.
|
||||
* test_pagesize() - Test the PWG mapping functions.
|
||||
* test_pwg() - Test the PWG mapping functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "ppd-private.h"
|
||||
#include "file-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);
|
||||
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line args */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int status; /* Status of tests (0 = success, 1 = fail) */
|
||||
const char *ppdfile; /* PPD filename */
|
||||
ppd_file_t *ppd; /* PPD file */
|
||||
_pwg_t *pwg; /* PWG mapping data */
|
||||
_pwg_media_t *pwgmedia; /* PWG media size */
|
||||
|
||||
|
||||
status = 0;
|
||||
|
||||
if (argc < 2 || argc > 3)
|
||||
{
|
||||
puts("Usage: ./testpwg filename.ppd [jobfile]");
|
||||
return (1);
|
||||
}
|
||||
|
||||
ppdfile = argv[1];
|
||||
|
||||
printf("ppdOpenFile(%s): ", ppdfile);
|
||||
if ((ppd = ppdOpenFile(ppdfile)) == NULL)
|
||||
{
|
||||
ppd_status_t err; /* Last error in file */
|
||||
int line; /* Line number in file */
|
||||
|
||||
|
||||
err = ppdLastError(&line);
|
||||
|
||||
printf("FAIL (%s on line %d)\n", ppdErrorString(err), line);
|
||||
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
fputs("_pwgCreateWithPPD(ppd): ", stdout);
|
||||
if ((pwg = _pwgCreateWithPPD(ppd)) == NULL)
|
||||
{
|
||||
puts("FAIL");
|
||||
status ++;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* _pwgDestroy should never fail...
|
||||
*/
|
||||
|
||||
fputs("_pwgDestroy(pwg): ", stdout);
|
||||
_pwgDestroy(pwg);
|
||||
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)
|
||||
{
|
||||
puts("FAIL (not found)");
|
||||
status ++;
|
||||
}
|
||||
else if (strcmp(pwgmedia->pwg, "iso_a3_297x420mm"))
|
||||
{
|
||||
printf("FAIL (%s)\n", pwgmedia->pwg);
|
||||
status ++;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '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 */
|
||||
{
|
||||
int i, /* Looping var */
|
||||
status = 0; /* Return status */
|
||||
_pwg_t *pwg2; /* Loaded data */
|
||||
_pwg_size_t *size, /* Size from original */
|
||||
*size2; /* Size from saved */
|
||||
_pwg_map_t *map, /* Map from original */
|
||||
*map2; /* Map from saved */
|
||||
|
||||
|
||||
/*
|
||||
* Verify that we can write and read back the same data...
|
||||
*/
|
||||
|
||||
fputs("_pwgWriteFile(test.pwg): ", stdout);
|
||||
if (!_pwgWriteFile(pwg, "test.pwg"))
|
||||
{
|
||||
puts("FAIL");
|
||||
status ++;
|
||||
}
|
||||
else
|
||||
puts("PASS");
|
||||
|
||||
fputs("_pwgCreateWithFile(test.pwg): ", stdout);
|
||||
if ((pwg2 = _pwgCreateWithFile("test.pwg")) == NULL)
|
||||
{
|
||||
puts("FAIL");
|
||||
status ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pwg2->num_sizes != pwg->num_sizes)
|
||||
{
|
||||
if (!status)
|
||||
puts("FAIL");
|
||||
|
||||
printf(" SAVED num_sizes=%d, ORIG num_sizes=%d\n", pwg2->num_sizes,
|
||||
pwg->num_sizes);
|
||||
|
||||
status ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = pwg->num_sizes, size = pwg->sizes, size2 = pwg2->sizes;
|
||||
i > 0;
|
||||
i --, size ++, size2 ++)
|
||||
{
|
||||
if (strcmp(size2->map.pwg, size->map.pwg) ||
|
||||
strcmp(size2->map.ppd, size->map.ppd) ||
|
||||
size2->width != size->width ||
|
||||
size2->length != size->length ||
|
||||
size2->left != size->left ||
|
||||
size2->bottom != size->bottom ||
|
||||
size2->right != size->right ||
|
||||
size2->top != size->top)
|
||||
{
|
||||
if (!status)
|
||||
puts("FAIL");
|
||||
|
||||
if (strcmp(size->map.pwg, size2->map.pwg))
|
||||
printf(" SAVED size->map.pwg=\"%s\", ORIG "
|
||||
"size->map.pwg=\"%s\"\n", size2->map.pwg, size->map.pwg);
|
||||
|
||||
if (strcmp(size2->map.ppd, size->map.ppd))
|
||||
printf(" SAVED size->map.ppd=\"%s\", ORIG "
|
||||
"size->map.ppd=\"%s\"\n", size2->map.ppd, size->map.ppd);
|
||||
|
||||
if (size2->width != size->width)
|
||||
printf(" SAVED size->width=%d, ORIG size->width=%d\n",
|
||||
size2->width, size->width);
|
||||
|
||||
if (size2->length != size->length)
|
||||
printf(" SAVED size->length=%d, ORIG size->length=%d\n",
|
||||
size2->length, size->length);
|
||||
|
||||
if (size2->left != size->left)
|
||||
printf(" SAVED size->left=%d, ORIG size->left=%d\n",
|
||||
size2->left, size->left);
|
||||
|
||||
if (size2->bottom != size->bottom)
|
||||
printf(" SAVED size->bottom=%d, ORIG size->bottom=%d\n",
|
||||
size2->bottom, size->bottom);
|
||||
|
||||
if (size2->right != size->right)
|
||||
printf(" SAVED size->right=%d, ORIG size->right=%d\n",
|
||||
size2->right, size->right);
|
||||
|
||||
if (size2->top != size->top)
|
||||
printf(" SAVED size->top=%d, ORIG size->top=%d\n",
|
||||
size2->top, size->top);
|
||||
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = pwg->num_sources, map = pwg->sources, map2 = pwg2->sources;
|
||||
i > 0;
|
||||
i --, map ++, map2 ++)
|
||||
{
|
||||
if (strcmp(map2->pwg, map->pwg) ||
|
||||
strcmp(map2->ppd, map->ppd))
|
||||
{
|
||||
if (!status)
|
||||
puts("FAIL");
|
||||
|
||||
if (strcmp(map->pwg, map2->pwg))
|
||||
printf(" SAVED source->pwg=\"%s\", ORIG source->pwg=\"%s\"\n",
|
||||
map2->pwg, map->pwg);
|
||||
|
||||
if (strcmp(map2->ppd, map->ppd))
|
||||
printf(" SAVED source->ppd=\"%s\", ORIG source->ppd=\"%s\"\n",
|
||||
map2->ppd, map->ppd);
|
||||
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = pwg->num_types, map = pwg->types, map2 = pwg2->types;
|
||||
i > 0;
|
||||
i --, map ++, map2 ++)
|
||||
{
|
||||
if (strcmp(map2->pwg, map->pwg) ||
|
||||
strcmp(map2->ppd, map->ppd))
|
||||
{
|
||||
if (!status)
|
||||
puts("FAIL");
|
||||
|
||||
if (strcmp(map->pwg, map2->pwg))
|
||||
printf(" SAVED type->pwg=\"%s\", ORIG type->pwg=\"%s\"\n",
|
||||
map2->pwg, map->pwg);
|
||||
|
||||
if (strcmp(map2->ppd, map->ppd))
|
||||
printf(" SAVED type->ppd=\"%s\", ORIG type->ppd=\"%s\"\n",
|
||||
map2->ppd, map->ppd);
|
||||
|
||||
status ++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!status)
|
||||
puts("PASS");
|
||||
|
||||
_pwgDestroy(pwg2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test PageSize mapping code...
|
||||
*/
|
||||
|
||||
status += test_pagesize(pwg, ppd, "Letter");
|
||||
status += test_pagesize(pwg, ppd, "na-letter");
|
||||
status += test_pagesize(pwg, ppd, "A4");
|
||||
status += test_pagesize(pwg, ppd, "iso-a4");
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
+8
-7
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Transcoding support for the Common UNIX Printing System (CUPS).
|
||||
* Transcoding support for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -279,7 +279,7 @@ cupsCharsetToUTF8(
|
||||
* Handle identity conversions...
|
||||
*/
|
||||
|
||||
if (encoding == CUPS_UTF8 ||
|
||||
if (encoding == CUPS_UTF8 || encoding <= CUPS_US_ASCII ||
|
||||
encoding < 0 || encoding >= CUPS_ENCODING_VBCS_END)
|
||||
{
|
||||
strlcpy((char *)dest, src, maxout);
|
||||
@@ -385,13 +385,14 @@ cupsUTF8ToCharset(
|
||||
* Handle UTF-8 to ISO-8859-1 directly...
|
||||
*/
|
||||
|
||||
if (encoding == CUPS_ISO8859_1)
|
||||
if (encoding == CUPS_ISO8859_1 || encoding == CUPS_US_ASCII)
|
||||
{
|
||||
int ch; /* Character from string */
|
||||
int ch, /* Character from string */
|
||||
maxch; /* Maximum character for charset */
|
||||
char *destptr, /* Pointer into ISO-8859-1 buffer */
|
||||
*destend; /* End of ISO-8859-1 buffer */
|
||||
|
||||
|
||||
maxch = encoding == CUPS_ISO8859_1 ? 256 : 128;
|
||||
destptr = dest;
|
||||
destend = dest + maxout - 1;
|
||||
|
||||
@@ -403,7 +404,7 @@ cupsUTF8ToCharset(
|
||||
{
|
||||
ch = ((ch & 0x1f) << 6) | (*src++ & 0x3f);
|
||||
|
||||
if (ch < 256)
|
||||
if (ch < maxch)
|
||||
*destptr++ = ch;
|
||||
else
|
||||
*destptr++ = '?';
|
||||
|
||||
+116
-84
@@ -1,10 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* User, system, and password routines for the Common UNIX Printing
|
||||
* System (CUPS).
|
||||
* User, system, and password routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -17,14 +16,16 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsEncryption() - Get the default encryption settings.
|
||||
* cupsEncryption() - Get the current encryption settings.
|
||||
* cupsGetPassword() - Get a password from the user.
|
||||
* cupsServer() - Return the hostname/address of the default
|
||||
* cupsGetPassword2() - Get a password from the user using the advanced
|
||||
* password callback.
|
||||
* cupsServer() - Return the hostname/address of the current
|
||||
* server.
|
||||
* cupsSetEncryption() - Set the encryption preference.
|
||||
* cupsSetPasswordCB() - Set the password callback for CUPS.
|
||||
* cupsSetPasswordCB2() - Set the advanced password callback for CUPS.
|
||||
* cupsSetServer() - Set the default server name.
|
||||
* cupsSetServer() - Set the default server name and port.
|
||||
* cupsSetUser() - Set the default user name.
|
||||
* cupsUser() - Return the current user's name.
|
||||
* _cupsGetPassword() - Get a password from the user.
|
||||
@@ -42,6 +43,8 @@
|
||||
#include <sys/stat.h>
|
||||
#ifdef WIN32
|
||||
# include <windows.h>
|
||||
#else
|
||||
# include <pwd.h>
|
||||
#endif /* WIN32 */
|
||||
#include "debug.h"
|
||||
|
||||
@@ -57,12 +60,17 @@ static void cups_read_client_conf(cups_file_t *fp,
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsEncryption()' - Get the default encryption settings.
|
||||
* 'cupsEncryption()' - Get the current encryption settings.
|
||||
*
|
||||
* The default encryption setting comes from the CUPS_ENCRYPTION
|
||||
* environment variable, then the ~/.cups/client.conf file, and finally the
|
||||
* /etc/cups/client.conf file. If not set, the default is
|
||||
* @code HTTP_ENCRYPT_IF_REQUESTED@.
|
||||
*
|
||||
* Note: The current encryption setting is tracked separately for each thread
|
||||
* in a program. Multi-threaded programs that override the setting via the
|
||||
* @link cupsSetEncryption@ function need to do so in each thread for the same
|
||||
* setting to be used.
|
||||
*/
|
||||
|
||||
http_encryption_t /* O - Encryption settings */
|
||||
@@ -83,6 +91,11 @@ cupsEncryption(void)
|
||||
*
|
||||
* Uses the current password callback function. Returns @code NULL@ if the
|
||||
* user does not provide a password.
|
||||
*
|
||||
* Note: The current password callback function is tracked separately for each
|
||||
* thread in a program. Multi-threaded programs that override the setting via
|
||||
* the @link cupsSetPasswordCB@ or @link cupsSetPasswordCB2@ functions need to
|
||||
* do so in each thread for the same function to be used.
|
||||
*/
|
||||
|
||||
const char * /* O - Password */
|
||||
@@ -97,11 +110,16 @@ cupsGetPassword(const char *prompt) /* I - Prompt string */
|
||||
|
||||
/*
|
||||
* 'cupsGetPassword2()' - Get a password from the user using the advanced
|
||||
* callback.
|
||||
* password callback.
|
||||
*
|
||||
* Uses the current password callback function. Returns @code NULL@ if the
|
||||
* user does not provide a password.
|
||||
*
|
||||
* Note: The current password callback function is tracked separately for each
|
||||
* thread in a program. Multi-threaded programs that override the setting via
|
||||
* the @link cupsSetPasswordCB@ or @link cupsSetPasswordCB2@ functions need to
|
||||
* do so in each thread for the same function to be used.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
*/
|
||||
|
||||
@@ -122,10 +140,20 @@ cupsGetPassword2(const char *prompt, /* I - Prompt string */
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsServer()' - Return the hostname/address of the default server.
|
||||
* 'cupsServer()' - Return the hostname/address of the current server.
|
||||
*
|
||||
* The returned value can be a fully-qualified hostname, a numeric
|
||||
* IPv4 or IPv6 address, or a domain socket pathname.
|
||||
* The default server comes from the CUPS_SERVER environment variable, then the
|
||||
* ~/.cups/client.conf file, and finally the /etc/cups/client.conf file. If not
|
||||
* set, the default is the local system - either "localhost" or a domain socket
|
||||
* path.
|
||||
*
|
||||
* The returned value can be a fully-qualified hostname, a numeric IPv4 or IPv6
|
||||
* address, or a domain socket pathname.
|
||||
*
|
||||
* Note: The current server is tracked separately for each thread in a program.
|
||||
* Multi-threaded programs that override the server via the
|
||||
* @link cupsSetServer@ function need to do so in each thread for the same
|
||||
* server to be used.
|
||||
*/
|
||||
|
||||
const char * /* O - Server name */
|
||||
@@ -143,6 +171,15 @@ cupsServer(void)
|
||||
|
||||
/*
|
||||
* 'cupsSetEncryption()' - Set the encryption preference.
|
||||
*
|
||||
* The default encryption setting comes from the CUPS_ENCRYPTION
|
||||
* environment variable, then the ~/.cups/client.conf file, and finally the
|
||||
* /etc/cups/client.conf file. If not set, the default is
|
||||
* @code HTTP_ENCRYPT_IF_REQUESTED@.
|
||||
*
|
||||
* Note: The current encryption setting is tracked separately for each thread
|
||||
* in a program. Multi-threaded programs that override the setting need to do
|
||||
* so in each thread for the same setting to be used.
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -161,7 +198,14 @@ cupsSetEncryption(http_encryption_t e) /* I - New encryption preference */
|
||||
/*
|
||||
* 'cupsSetPasswordCB()' - Set the password callback for CUPS.
|
||||
*
|
||||
* Pass @code NULL@ to restore the default (console) password callback.
|
||||
* Pass @code NULL@ to restore the default (console) password callback, which
|
||||
* reads the password from the console. Programs should call either this
|
||||
* function or @link cupsSetPasswordCB2@, as only one callback can be registered
|
||||
* by a program per thread.
|
||||
*
|
||||
* Note: The current password callback is tracked separately for each thread
|
||||
* in a program. Multi-threaded programs that override the callback need to do
|
||||
* so in each thread for the same callback to be used.
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -182,7 +226,14 @@ cupsSetPasswordCB(cups_password_cb_t cb)/* I - Callback function */
|
||||
/*
|
||||
* 'cupsSetPasswordCB2()' - Set the advanced password callback for CUPS.
|
||||
*
|
||||
* Pass @code NULL@ to restore the default (console) password callback.
|
||||
* Pass @code NULL@ to restore the default (console) password callback, which
|
||||
* reads the password from the console. Programs should call either this
|
||||
* function or @link cupsSetPasswordCB2@, as only one callback can be registered
|
||||
* by a program per thread.
|
||||
*
|
||||
* Note: The current password callback is tracked separately for each thread
|
||||
* in a program. Multi-threaded programs that override the callback need to do
|
||||
* so in each thread for the same callback to be used.
|
||||
*
|
||||
* @since CUPS 1.4/Mac OS X 10.6@
|
||||
*/
|
||||
@@ -205,11 +256,17 @@ cupsSetPasswordCB2(
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsSetServer()' - Set the default server name.
|
||||
* 'cupsSetServer()' - Set the default server name and port.
|
||||
*
|
||||
* The "server" string can be a fully-qualified hostname, a numeric
|
||||
* IPv4 or IPv6 address, or a domain socket pathname. Pass @code NULL@ to
|
||||
* restore the default server name.
|
||||
* IPv4 or IPv6 address, or a domain socket pathname. Hostnames and numeric IP
|
||||
* addresses can be optionally followed by a colon and port number to override
|
||||
* the default port 631, e.g. "hostname:8631". Pass @code NULL@ to restore the
|
||||
* default server name and port.
|
||||
*
|
||||
* Note: The current server is tracked separately for each thread in a program.
|
||||
* Multi-threaded programs that override the server need to do so in each
|
||||
* thread for the same server to be used.
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -254,6 +311,10 @@ cupsSetServer(const char *server) /* I - Server name */
|
||||
* 'cupsSetUser()' - Set the default user name.
|
||||
*
|
||||
* Pass @code NULL@ to restore the default user name.
|
||||
*
|
||||
* Note: The current user name is tracked separately for each thread in a
|
||||
* program. Multi-threaded programs that override the user name need to do so
|
||||
* in each thread for the same user name to be used.
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -269,13 +330,13 @@ cupsSetUser(const char *user) /* I - User name */
|
||||
}
|
||||
|
||||
|
||||
#if defined(WIN32)
|
||||
/*
|
||||
* WIN32 username and password stuff.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 'cupsUser()' - Return the current user's name.
|
||||
*
|
||||
* Note: The current user name is tracked separately for each thread in a
|
||||
* program. Multi-threaded programs that override the user name with the
|
||||
* @link cupsSetUser@ function need to do so in each thread for the same user
|
||||
* name to be used.
|
||||
*/
|
||||
|
||||
const char * /* O - User name */
|
||||
@@ -286,16 +347,38 @@ cupsUser(void)
|
||||
|
||||
if (!cg->user[0])
|
||||
{
|
||||
DWORD size; /* Size of string */
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* Get the current user name from the OS...
|
||||
*/
|
||||
|
||||
DWORD size; /* Size of string */
|
||||
|
||||
size = sizeof(cg->user);
|
||||
if (!GetUserName(cg->user, &size))
|
||||
#else
|
||||
/*
|
||||
* Get the user name corresponding to the current UID...
|
||||
*/
|
||||
|
||||
struct passwd *pwd; /* User/password entry */
|
||||
|
||||
setpwent();
|
||||
if ((pwd = getpwuid(getuid())) != NULL)
|
||||
{
|
||||
/*
|
||||
* Use the default username...
|
||||
* Found a match!
|
||||
*/
|
||||
|
||||
strlcpy(cg->user, pwd->pw_name, sizeof(cg->user));
|
||||
}
|
||||
else
|
||||
#endif /* WIN32 */
|
||||
{
|
||||
/*
|
||||
* Use the default "unknown" user name...
|
||||
*/
|
||||
|
||||
strcpy(cg->user, "unknown");
|
||||
}
|
||||
}
|
||||
@@ -311,72 +394,21 @@ cupsUser(void)
|
||||
const char * /* O - Password */
|
||||
_cupsGetPassword(const char *prompt) /* I - Prompt string */
|
||||
{
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* Currently no console password support is provided on Windows.
|
||||
*/
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#else
|
||||
/*
|
||||
* UNIX username and password stuff...
|
||||
*/
|
||||
/*
|
||||
* Use the standard getpass function to get a password from the console.
|
||||
*/
|
||||
|
||||
# include <pwd.h>
|
||||
|
||||
/*
|
||||
* 'cupsUser()' - Return the current user's name.
|
||||
*/
|
||||
|
||||
const char * /* O - User name */
|
||||
cupsUser(void)
|
||||
{
|
||||
struct passwd *pwd; /* User/password entry */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
|
||||
|
||||
|
||||
if (!cg->user[0])
|
||||
{
|
||||
/*
|
||||
* Rewind the password file...
|
||||
*/
|
||||
|
||||
setpwent();
|
||||
|
||||
/*
|
||||
* Lookup the password entry for the current user.
|
||||
*/
|
||||
|
||||
if ((pwd = getpwuid(getuid())) == NULL)
|
||||
strcpy(cg->user, "unknown"); /* Unknown user! */
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Copy the username...
|
||||
*/
|
||||
|
||||
setpwent();
|
||||
|
||||
strlcpy(cg->user, pwd->pw_name, sizeof(cg->user));
|
||||
}
|
||||
|
||||
/*
|
||||
* Rewind the password file again...
|
||||
*/
|
||||
|
||||
setpwent();
|
||||
}
|
||||
|
||||
return (cg->user);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsGetPassword()' - Get a password from the user.
|
||||
*/
|
||||
|
||||
const char * /* O - Password */
|
||||
_cupsGetPassword(const char *prompt) /* I - Prompt string */
|
||||
{
|
||||
return (getpass(prompt));
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+8
-32
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Printing utilities for the Common UNIX Printing System (CUPS).
|
||||
* Printing utilities for CUPS.
|
||||
*
|
||||
* Copyright 2007-2009 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* cupsCancelJob() - Cancel a print job on the default server.
|
||||
* cupsCancelJob2() - Cancel or purge a print job.
|
||||
* cupsCreateJob() - Create an empty job.
|
||||
* cupsCreateJob() - Create an empty job for streaming.
|
||||
* cupsFinishDocument() - Finish sending a document.
|
||||
* cupsFreeJobs() - Free memory used by job data.
|
||||
* cupsGetClasses() - Get a list of printer classes from the default
|
||||
@@ -1514,36 +1514,12 @@ cupsPrintFiles2(
|
||||
goto cancel_job;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
cupsFileRewind(fp);
|
||||
status = cupsStartDocument(http, name, job_id, docname, format,
|
||||
i == (num_files - 1));
|
||||
|
||||
status = cupsStartDocument(http, name, job_id, docname, format,
|
||||
i == (num_files - 1));
|
||||
|
||||
while (status == HTTP_CONTINUE &&
|
||||
(bytes = cupsFileRead(fp, buffer, sizeof(buffer))) > 0)
|
||||
status = cupsWriteRequestData(http, buffer, bytes);
|
||||
|
||||
if (status == HTTP_UNAUTHORIZED)
|
||||
{
|
||||
char resource[1024]; /* Printer resource */
|
||||
|
||||
snprintf(resource, sizeof(resource), "/printers/%s", name);
|
||||
|
||||
if (!cupsDoAuthentication(http, "POST", resource))
|
||||
{
|
||||
if (httpReconnect(http))
|
||||
{
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
else
|
||||
status = HTTP_AUTHORIZATION_CANCELED;
|
||||
}
|
||||
}
|
||||
while (status == HTTP_UNAUTHORIZED);
|
||||
while (status == HTTP_CONTINUE &&
|
||||
(bytes = cupsFileRead(fp, buffer, sizeof(buffer))) > 0)
|
||||
status = cupsWriteRequestData(http, buffer, bytes);
|
||||
|
||||
cupsFileClose(fp);
|
||||
|
||||
|
||||
+6
-2
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* API versioning definitions for the Common UNIX Printing System (CUPS).
|
||||
* API versioning definitions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2008 by Apple Inc.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
@@ -69,6 +69,10 @@
|
||||
# define _CUPS_DEPRECATED
|
||||
# endif /* __GNUC__ && __GNUC__ > 2 */
|
||||
|
||||
# ifndef __GNUC__
|
||||
# define __attribute__(x)
|
||||
# endif /* !__GNUC__ */
|
||||
|
||||
#endif /* !_CUPS_VERSIONING_H_ */
|
||||
|
||||
/*
|
||||
|
||||
+5
-3
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# "$Id$"
|
||||
#
|
||||
# Documentation makefile for the Common UNIX Printing System (CUPS).
|
||||
# Documentation makefile for CUPS.
|
||||
#
|
||||
# Copyright 2007-2009 by Apple Inc.
|
||||
# Copyright 2007-2011 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
@@ -28,6 +28,7 @@ WEBIMAGES = \
|
||||
images/color-wheel.png \
|
||||
images/cups.png \
|
||||
images/cups-icon.png \
|
||||
images/generic.png \
|
||||
images/left.gif \
|
||||
images/right.gif \
|
||||
images/sel.gif \
|
||||
@@ -39,6 +40,8 @@ HELPIMAGES = \
|
||||
images/cups-postscript-chain.png \
|
||||
images/cups-raster-chain.png \
|
||||
images/raster.png \
|
||||
images/raster-organization.png \
|
||||
images/sample-image.png \
|
||||
images/smiley.jpg
|
||||
HELPFILES = \
|
||||
help/accounting.html \
|
||||
@@ -69,7 +72,6 @@ HELPFILES = \
|
||||
help/man-cupsenable.html \
|
||||
help/man-cupstestdsc.html \
|
||||
help/man-cupstestppd.html \
|
||||
help/man-drv.html \
|
||||
help/man-filter.html \
|
||||
help/man-lp.html \
|
||||
help/man-lpadmin.html \
|
||||
|
||||
@@ -114,7 +114,9 @@ TD.unsel {
|
||||
TD.sel A, TD.sel A:hover, TD.unsel A:link:hover, TD.unsel A:visited:hover,
|
||||
TD.unsel A:active, TD.unsel A, TD.unsel A:visited {
|
||||
color: #666666;
|
||||
display: block;
|
||||
font-weight: normal;
|
||||
padding: 8px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -16,7 +16,7 @@ SRC="/images/left.gif" WIDTH="64" HEIGHT="36" BORDER="0" ALT=""></A></TD>
|
||||
<TD CLASS="sel"><A HREF="/"> Startseite </A></TD>
|
||||
<TD CLASS="unsel"><A HREF="/admin"> Verwaltung </A></TD>
|
||||
<TD CLASS="unsel"><A HREF="/classes/"> Klassen </A></TD>
|
||||
<TD CLASS="unsel"><A HREF="/help/"> Online Hilfe </A></TD>
|
||||
<TD CLASS="unsel"><A HREF="/help/"> Online- Hilfe </A></TD>
|
||||
<TD CLASS="unsel"><A HREF="/jobs/"> Aufträge </A></TD>
|
||||
<TD CLASS="unsel"><A HREF="/printers/"> Drucker </A></TD>
|
||||
<TD CLASS="unsel" WIDTH="100%"><FORM ACTION="/help/" METHOD="GET"><INPUT
|
||||
@@ -31,7 +31,7 @@ AUTOSAVE="org.cups.help" RESULTS="20"></FORM></TD>
|
||||
|
||||
<H1>Common UNIX Printing System @CUPS_VERSION@</H1>
|
||||
|
||||
<P>CUPS ist das auf Standards basierte, Open-Source Drucker System, welches von
|
||||
<P>CUPS ist das auf Standards basierte, Opensource-Drucksystem, welches von
|
||||
<A HREF="http://www.apple.com/">Apple Inc.</A> für Mac OS<SUP>®</SUP> X und
|
||||
andere UNIX<SUP>®</SUP>-ähnliche Betriebssysteme entwickelt wird.</P>
|
||||
|
||||
@@ -46,13 +46,13 @@ HEIGHT="128" ALT="CUPS"></A></TD>
|
||||
|
||||
<H2>CUPS für Benutzer</H2>
|
||||
|
||||
<P><A HREF="help/overview.html">CUPS Übersicht</A></P>
|
||||
<P><A HREF="help/overview.html">CUPS.Übersicht</A></P>
|
||||
|
||||
<P><A HREF="help/options.html">Kommandozeilendruck und Einstellungen</A></P>
|
||||
|
||||
<P><A HREF="help/whatsnew.html">Neues in CUPS 1.4</A></P>
|
||||
|
||||
<P><A HREF="http://www.cups.org/newsgroups.php?gcups.general">Benutzer Forum</A></P>
|
||||
<P><A HREF="http://www.cups.org/newsgroups.php?gcups.general">Benutzerforum</A></P>
|
||||
|
||||
</TD><TD VALIGN="top" STYLE="border-right: dotted thin #cccccc; padding-left: 20px; padding-right: 20px;">
|
||||
|
||||
@@ -66,7 +66,7 @@ HEIGHT="128" ALT="CUPS"></A></TD>
|
||||
|
||||
<P><A HREF="help/security.html">Sicherheit des Servers</A></P>
|
||||
|
||||
<P><A HREF="help/kerberos.html">Benutzen der Kerberos Authentifizierung</A></P>
|
||||
<P><A HREF="help/kerberos.html">Verwenden der Kerberos Authentifizierung</A></P>
|
||||
|
||||
<P><A HREF="help/network.html">Benutzen von Netzwerkdruckern</A></P>
|
||||
|
||||
@@ -78,21 +78,21 @@ HEIGHT="128" ALT="CUPS"></A></TD>
|
||||
|
||||
<H2>CUPS für Entwickler</H2>
|
||||
|
||||
<P><A HREF="help/api-overview.html">Einführung in die CUPS Programmierung</A></P>
|
||||
<P><A HREF="help/api-overview.html">Einführung in die CUPS-Programmierung</A></P>
|
||||
|
||||
<P><A HREF="help/api-cups.html">CUPS API</A></P>
|
||||
<P><A HREF="help/api-cups.html">CUPS-API</A></P>
|
||||
|
||||
<P><A HREF="help/api-filter.html">Filter und Backend Programmierung</A></P>
|
||||
<P><A HREF="help/api-filter.html">Filter- und Backend-Programmierung</A></P>
|
||||
|
||||
<P><A HREF="help/api-httpipp.html">HTTP und IPP APIs</A></P>
|
||||
<P><A HREF="help/api-httpipp.html">HTTP- und IPP-APIs</A></P>
|
||||
|
||||
<P><A HREF="help/api-ppd.html">PPD API</A></P>
|
||||
<P><A HREF="help/api-ppd.html">PPD-API</A></P>
|
||||
|
||||
<P><A HREF="help/api-raster.html">Raster API</A></P>
|
||||
<P><A HREF="help/api-raster.html">Raster-API</A></P>
|
||||
|
||||
<P><A HREF="help/ref-ppdcfile.html">PPD Compiler Driver Information File Reference</A></P>
|
||||
|
||||
<P><A HREF="http://www.cups.org/newsgroups.php?gcups.development">Entwickler Forum</A></P>
|
||||
<P><A HREF="http://www.cups.org/newsgroups.php?gcups.development">Entwicklerforum</A></P>
|
||||
|
||||
</TD></TR>
|
||||
</TABLE>
|
||||
@@ -101,7 +101,7 @@ HEIGHT="128" ALT="CUPS"></A></TD>
|
||||
<TR><TD> </TD></TR>
|
||||
<TR><TD CLASS="trailer">CUPS und das CUPS Logo sind
|
||||
eingetragene Warenzeichen der <A HREF="http://www.apple.com">Apple Inc.</A>
|
||||
CUPS ist urheberrechtlich geschützt 2007-2009 von Apple Inc, alle Rechte vorbehalten.</TD></TR>
|
||||
CUPS ist urheberrechtlich geschützt 2007-2011 von Apple Inc, alle Rechte vorbehalten.</TD></TR>
|
||||
</TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
@@ -101,7 +101,7 @@ HEIGHT="128" ALT="CUPS"></A></TD>
|
||||
<TR><TD> </TD></TR>
|
||||
<TR><TD CLASS="trailer">CUPS y el logo de CUPS son
|
||||
marcas registradas de <A HREF="http://www.apple.com">Apple Inc.</A> Los derechos
|
||||
de copia de CUPS 2007-2009 son de Apple Inc. Todos los derechos reservados.</TD></TR>
|
||||
de copia de CUPS 2007-2011 son de Apple Inc. Todos los derechos reservados.</TD></TR>
|
||||
</TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
@@ -99,8 +99,8 @@ HEIGHT="128" ALT="CUPS"></A></TD>
|
||||
|
||||
</TD></TR>
|
||||
<TR><TD> </TD></TR>
|
||||
<TR><TD CLASS="trailer">CUPS eta CUPSen logotipoa <A HREF="http://www.apple.com">Apple Inc.</A>en marka erregistratuaj dira.
|
||||
CUPSen copyright-a 2007-2009 Apple Inc. Eskubide guztiak gordeta.</TD></TR>
|
||||
<TR><TD CLASS="trailer">CUPS eta CUPSen logotipoa <A HREF="http://www.apple.com">Apple Inc.</A> en marka erregistratuak dira.
|
||||
CUPSen copyright-a 2007-2011 Apple Inc. Eskubide guztiak gordeta.</TD></TR>
|
||||
</TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
@@ -18,15 +18,15 @@ support, there are several third-party solutions that can be found on
|
||||
|
||||
<P>CUPS supports page and size-based quotas for each printer.
|
||||
The quotas are tracked individually for each user, but a single set of
|
||||
limits applies to all users for a partiuclar printer. For example, you
|
||||
limits applies to all users for a particular printer. For example, you
|
||||
can limit every user to 5 pages per day on an expensive printer, but
|
||||
you cannot limit every user except Johnny.</P>
|
||||
|
||||
<P>The <CODE>job-k-limit</CODE>, <CODE>job-page-limit</CODE>, and <CODE>job-quota-peiod</CODE>
|
||||
<P>The <CODE>job-k-limit</CODE>, <CODE>job-page-limit</CODE>, and <CODE>job-quota-period</CODE>
|
||||
options determine whether and how quotas are enforced for a printer.
|
||||
The <CODE>job-quota-period</CODE> option determines the time interval for
|
||||
quota tracking. The interval is expressed in seconds, so a day is
|
||||
86,400, a week is 604,800 and a month is 2,592,000 seconds. The
|
||||
86,400, a week is 604,800, and a month is 2,592,000 seconds. The
|
||||
<CODE>job-k-limit</CODE> option specifies the job size limit in killobytes. The
|
||||
<CODE>job-page-limit</CODE> option specifies the number of pages limit.</P>
|
||||
|
||||
|
||||
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário