Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 839f33fe98 |
@@ -1,171 +1,6 @@
|
||||
CHANGES.txt - 2007-09-18
|
||||
CHANGES.txt - 2007-07-12
|
||||
------------------------
|
||||
|
||||
CHANGES IN CUPS V1.3.2
|
||||
|
||||
- The 1.3.1 release was incorrectly created from the
|
||||
1.4.x source tree (STR #2519)
|
||||
- Added support for 32/64-bit libraries on HP-UX
|
||||
(STR #2520)
|
||||
- The scheduler incorrectly used portrait as the default
|
||||
orientation (STR #2513)
|
||||
- The scheduler no longer writes the printcap file for
|
||||
every remote printer update (STR #2512)
|
||||
- Remote raw printing with multiple copies did not work
|
||||
(STR #2518)
|
||||
- Updated the configure script to require at least autoconf
|
||||
2.60 (STR #2515)
|
||||
- Some gzip'd PPD files were not read in their entirety
|
||||
(STR #2510)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.3.1
|
||||
|
||||
- Documentation updates.
|
||||
- The USB backend on Mac OS X could hang if the driver and
|
||||
printer did not match.
|
||||
- Delegated Kerberos credentials were not working.
|
||||
- "make distclean" incorrectly removed the edit-config.tmpl
|
||||
files (STR #2508)
|
||||
- Fix compile problem on HP-UX (STR #2501)
|
||||
- The cupstestppd utility now tests for resolutions greater
|
||||
than 99999 DPI to detect a missing "x" between the X and Y
|
||||
resolutions.
|
||||
- Fixed many problems in the various translations and added
|
||||
a new "checkpo" utility to validate them.
|
||||
- The cupstestppd utility now tests the custom page size code
|
||||
for CUPS raster drivers.
|
||||
- cupsLangDefault() did not attempt to return a language that
|
||||
was supported by the calling application.
|
||||
- If a remote printer stopped while a job was being sent, the
|
||||
local queue would also get stopped and the job re-queued,
|
||||
resulting in duplicate prints in some cases.
|
||||
- A few Apple-specific job options needed to be omitted when
|
||||
printing a banner page.
|
||||
- The new peer credential support did not compile on FreeBSD
|
||||
(STR #2495)
|
||||
- Direct links to help files did not set the current section
|
||||
so the table-of-contents was not shown.
|
||||
- The configure script did not support --localedir=foo (STR #2488)
|
||||
- The backends were not displaying their localized messages.
|
||||
- CUPS-Authenticate-Job did not require Kerberos authentication
|
||||
on queues protected by Kerberos.
|
||||
- The Zebra ZPL driver did not work with Brady label printers
|
||||
(STR #2487)
|
||||
- Norwegian wasn't localized on Mac OS X.
|
||||
- getnameinfo() returns an error on some systems when DNS is
|
||||
not available, leading to numerous problems (STR #2486)
|
||||
- The cupsfilter command did not work properly on Mac OS X.
|
||||
- The scheduler makefile contained a typo (STR #2483)
|
||||
- The TBCP and BCP port monitors did not handle the trailing
|
||||
CTRL-D in some PostScript output properly.
|
||||
- Fixed the localization instructions and German template for
|
||||
the "Find New Printers" button (STR #2478)
|
||||
- The web interface did not work with the Chinese localization
|
||||
(STR #2477)
|
||||
- The web interface home page did not work for languages that
|
||||
were only partially localized (STR #2472)
|
||||
- Updated the Spanish web interface localization (STR #2473)
|
||||
- ppdLocalize() did not work for country-specific localizations.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.3.0
|
||||
|
||||
- The scheduler did not handle out-of-file conditions
|
||||
gracefully when accepting new connections, leading to
|
||||
heavy CPU usage.
|
||||
- The scheduler did not detect ServerBin misconfigurations
|
||||
(STR #2470)
|
||||
- "AuthType Default" did not work as expected when the
|
||||
"DefaultAuthType foo" line appeared after it in the
|
||||
cupsd.conf file.
|
||||
- The on-line help did not describe many common printing
|
||||
options (STR #1846)
|
||||
- The IPP backend did not return the "auth required" status
|
||||
when printing to a Kerberos-protected queue.
|
||||
- The scheduler was not looking in the correct directories
|
||||
for LSB PPD files (STR #2464)
|
||||
- Changed references to ESP Ghostscript to GPL Ghostscript
|
||||
(STR #2463)
|
||||
- The PostScript filter did not cleanly terminate when
|
||||
the job was canceled or stopped.
|
||||
- Fixed generation of Kerberos credentials for remote
|
||||
printing. Note that this requires a recent version of
|
||||
MIT Kerberos with a working krb5_cc_new_unique()
|
||||
function or Heimdal Kerberos.
|
||||
- Added Portuguese and updated Italian message catalogs.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.3rc2
|
||||
|
||||
- Added more range checking to the pdftops filter.
|
||||
- The scheduler would crash if a remote IPP queue was stopped
|
||||
(STR #2460)
|
||||
- The scheduler did not allow "DefaultAuthType None".
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.3rc1
|
||||
|
||||
- Updated the German localization (STR #2443)
|
||||
- cupsAdminGetServerSettings() did not handle </Foo> properly.
|
||||
- When lprm and cancel are run with no job ID, they now will
|
||||
cancel the first stopped job if no pending or processing
|
||||
jobs are left in the queue.
|
||||
- The scheduler now logs successful print jobs, filter
|
||||
failures, and the job file types at the default log
|
||||
level (STR #2458)
|
||||
- The scheduler now logs the usernames it is using for
|
||||
authorization at LogLevel debug instead of debug2 (STR #2448)
|
||||
- Added Intellitech Intellibar and Zebra CPCL PPDs to the list
|
||||
of installed PPDs.
|
||||
- Added 6" and 8" wide label sizes for the Zebra ZPL Label
|
||||
Printer driver (STR #2442)
|
||||
- The cupsaddsmb program and web interface now support
|
||||
exporting of 64-bit Windows drivers, when available
|
||||
(STR #2439)
|
||||
- Moving a job that was printing did not stop the job on the
|
||||
original printer (STR #2262)
|
||||
- The cups-lpd mini-daemon did not work on Mac OS X server.
|
||||
- Added httpGetAuthString() and httpSetAuthString() APIs to get
|
||||
and set the current (cached) authorization string to use for
|
||||
HTTP requests.
|
||||
- Updated the default cupsd.conf policy to list the
|
||||
"administrative" operations separately from the "printer
|
||||
control" operations so that it is easier to define a
|
||||
group of users that are "printer operators".
|
||||
- The web interface now pulls the default cupsd.conf file
|
||||
from cupsd.conf.default in the CUPS config directory.
|
||||
- Added a help file for using Kerberos with CUPS.
|
||||
- The scheduler now strips the "@KDC" portion of Kerberos
|
||||
usernames since those usernames typically do not appear in
|
||||
the group membership lists used by CUPS.
|
||||
- cupsMarkOptions() could (incorrectly) leave multiple option
|
||||
choices marked.
|
||||
- Backends could (incorrectly) run as root during discovery
|
||||
(STR #2454)
|
||||
- Avahi is now supported for DNS-SD (Bonjour) printer sharing
|
||||
(STR #2455)
|
||||
- The default cupsd.conf file had typos and old operation names
|
||||
(STR #2450)
|
||||
- The scheduler now erases authentication cache files using the
|
||||
7-pass US DoD algorithm.
|
||||
- Delegated Kerberos credentials (proxy authentication) did not
|
||||
work.
|
||||
- The filter makefile did not optimize the libcupsimage.2.dylib
|
||||
with a sectorder file.
|
||||
- The IPP backend incorrectly wrote an empty printer message
|
||||
when processing the "none" state reason.
|
||||
- The USB backend could deadlock on Mac OS X while performing
|
||||
a side-channel command.
|
||||
- The scheduler did not prevent remote queues from being
|
||||
shared/published.
|
||||
- The scheduler did not remove the temporary request file on
|
||||
authentication errors.
|
||||
- ppdLocalizeIPPReason() did not handle "scheme:" schemes or
|
||||
"file" URLs.
|
||||
- ppdLocalizeIPPReason() was not exported on Mac OS X.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.3b1
|
||||
|
||||
- Copyright updates - CUPS is now owned by Apple Inc.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
CREDITS.txt - 2007-09-10
|
||||
CREDITS.txt - 2007-02-05
|
||||
------------------------
|
||||
|
||||
Few projects are completed by one person, and CUPS is no exception. We'd
|
||||
@@ -19,7 +19,6 @@ like to thank the following individuals for their contributions:
|
||||
Till Kamppeter - Bug fixes, beta testing, evangelism.
|
||||
Kenshi Muto - Japanese localization, patches, and
|
||||
testing.
|
||||
Tomohiro Kato - Japanese localization.
|
||||
Kiko - Bug fixes.
|
||||
Sergey V. Kovalyov - ESP Print Pro and CUPS beta tester.
|
||||
Marek Laane - Estonian translation.
|
||||
@@ -37,7 +36,7 @@ like to thank the following individuals for their contributions:
|
||||
Opher Shachar - Hebrew localization.
|
||||
Stuart Stevens - HP JetDirect IPP information.
|
||||
Andrea Suatoni - IRIX desktop integration and testing.
|
||||
Teppo Turlianen - Finnish localization.
|
||||
Tomohiro Kato - Japanese localization.
|
||||
Tim Waugh - Lots of patches, testing, and Linux
|
||||
integration.
|
||||
Yugami - LDAP browsing support.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
INSTALL - CUPS v1.3.2 - 2007-09-18
|
||||
INSTALL - CUPS v1.3b1 - 2007-07-12
|
||||
----------------------------------
|
||||
|
||||
This file describes how to compile and install CUPS from source
|
||||
@@ -6,10 +6,8 @@ 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, YOU WILL ALSO ****
|
||||
**** NEED TO INSTALL ESP GHOSTSCRIPT AFTER YOU INSTALL CUPS ****
|
||||
|
||||
|
||||
BEFORE YOU BEGIN
|
||||
@@ -22,7 +20,7 @@ BEFORE YOU BEGIN
|
||||
The makefiles used by the project should work with all
|
||||
versions of make. We've tested them with GNU make as well as
|
||||
the make programs shipped by Compaq, HP, SGI, and Sun.
|
||||
BSD users should use GNU make (gmake).
|
||||
FreeBSD users should use GNU make (gmake).
|
||||
|
||||
Besides these tools you'll want the JPEG, PNG, TIFF, and ZLIB
|
||||
libraries for image support, the CDSA, GNU TLS, or OpenSSL
|
||||
@@ -31,16 +29,10 @@ BEFORE YOU BEGIN
|
||||
compile and run without these, however you'll miss out on
|
||||
many of the features provided by CUPS.
|
||||
|
||||
Kerberos support requires a very recent version of the MIT
|
||||
implementation with the krb5_cc_new_unique() function or the
|
||||
Heimdal implementation, along with the corresponding GSSAPI
|
||||
pieces.
|
||||
|
||||
Also, please note that CUPS no longer includes the
|
||||
Ghostscript- based pstoraster filter. You *must* download
|
||||
GPL Ghostscript separately from the CUPS web site if you want
|
||||
to print PostScript files to non-PostScript printers on
|
||||
operating systems other than Mac OS X.
|
||||
ESP Ghostscript separately from the CUPS web site if you want
|
||||
to print PostScript files to non-PostScript printers.
|
||||
|
||||
|
||||
COMPILING FROM SUBVERSION
|
||||
|
||||
@@ -131,7 +131,6 @@ LDFLAGS = -L../cups -L../filter @LDARCHFLAGS@ \
|
||||
@LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
|
||||
LEGACY_BACKENDS = @LEGACY_BACKENDS@
|
||||
LIBCUPSORDER = @LIBCUPSORDER@
|
||||
LIBCUPSIMAGEORDER = @LIBCUPSIMAGEORDER@
|
||||
LINKCUPS = @LINKCUPS@ $(SSLLIBS)
|
||||
LINKCUPSIMAGE = @LINKCUPSIMAGE@
|
||||
LIBS = $(LINKCUPS) $(COMMONLIBS)
|
||||
|
||||
@@ -63,8 +63,9 @@ distclean: clean
|
||||
$(RM) man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man
|
||||
$(RM) man/cupsd.conf.man man/lpoptions.man
|
||||
$(RM) packaging/cups.list
|
||||
$(RM) templates/header.tmpl
|
||||
$(RM) templates/edit-config.tmpl templates/header.tmpl
|
||||
-$(RM) doc/*/index.html
|
||||
-$(RM) templates/*/edit-config.tmpl
|
||||
-$(RM) templates/*/header.tmpl
|
||||
-$(RM) -r autom4te*.cache
|
||||
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
README - CUPS v1.3.2 - 2007-09-18
|
||||
README - CUPS v1.3b1 - 2007-07-13
|
||||
---------------------------------
|
||||
|
||||
******************************************************************
|
||||
******************************************************************
|
||||
**** ****
|
||||
**** BETA SOFTWARE - USE AT YOUR OWN RISK ****
|
||||
**** ****
|
||||
******************************************************************
|
||||
******************************************************************
|
||||
|
||||
Looking for compile instructions? Read the file "INSTALL.txt"
|
||||
instead...
|
||||
|
||||
@@ -22,11 +30,12 @@ INTRODUCTION
|
||||
to support real-world printing under UNIX.
|
||||
|
||||
CUPS includes an image file RIP that supports printing of
|
||||
image files to non-PostScript printers. GPL Ghostscript now
|
||||
includes the "cups" driver to support printing of PostScript
|
||||
files within the CUPS driver framework. Sample drivers for
|
||||
Dymo, EPSON, HP, OKIDATA, and Zebra printers are included that
|
||||
use these filters.
|
||||
image files to non-PostScript printers. A customized version
|
||||
of GPL Ghostscript for CUPS called ESP Ghostscript is
|
||||
available separately to support printing of PostScript files
|
||||
within the CUPS driver framework. Sample drivers for Dymo,
|
||||
EPSON, HP, OKIDATA, and Zebra printers are included that use
|
||||
these filters.
|
||||
|
||||
CUPS is licensed under the GNU General Public License and GNU
|
||||
Library General Public License versions 2.
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
include ../Makedefs
|
||||
|
||||
RBACKENDS = ipp lpd
|
||||
UBACKENDS = $(PAP) $(LEGACY_BACKENDS) serial snmp socket usb
|
||||
RBACKENDS = lpd
|
||||
UBACKENDS = ipp $(PAP) $(LEGACY_BACKENDS) serial snmp socket usb
|
||||
TARGETS = betest test1284 libbackend.a $(RBACKENDS) $(UBACKENDS)
|
||||
LIBOBJS = ieee1284.o runloop.o
|
||||
OBJS = betest.o ipp.o lpd.o pap.o parallel.o scsi.o \
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
*/
|
||||
|
||||
static char *password = NULL; /* Password for device URI */
|
||||
static int password_tries = 0; /* Password tries */
|
||||
#ifdef __APPLE__
|
||||
static char pstmpname[1024] = ""; /* Temporary PostScript file name */
|
||||
#endif /* __APPLE__ */
|
||||
@@ -67,12 +66,12 @@ static void cancel_job(http_t *http, const char *uri, int id,
|
||||
const char *resource, const char *user, int version);
|
||||
static void check_printer_state(http_t *http, const char *uri,
|
||||
const char *resource, const char *user,
|
||||
int version, int job_id);
|
||||
int version);
|
||||
#ifdef HAVE_LIBZ
|
||||
static void compress_files(int num_files, char **files);
|
||||
#endif /* HAVE_LIBZ */
|
||||
static const char *password_cb(const char *);
|
||||
static int report_printer_state(ipp_t *ipp, int job_id);
|
||||
static int report_printer_state(ipp_t *ipp);
|
||||
|
||||
#ifdef __APPLE__
|
||||
static int run_pictwps_filter(char **argv, const char *filename);
|
||||
@@ -102,9 +101,9 @@ main(int argc, /* I - Number of command-line args */
|
||||
resource[1024], /* Resource info (printer name) */
|
||||
addrname[256], /* Address name */
|
||||
*optptr, /* Pointer to URI options */
|
||||
*name, /* Name of option */
|
||||
*value, /* Value of option */
|
||||
sep; /* Separator character */
|
||||
name[255], /* Name of option */
|
||||
value[255], /* Value of option */
|
||||
*ptr; /* Pointer into name or value */
|
||||
int num_files; /* Number of files to print */
|
||||
char **files, /* Files to print */
|
||||
*filename; /* Pointer to single filename */
|
||||
@@ -132,8 +131,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
ipp_attribute_t *printer_accepting; /* printer-is-accepting-jobs */
|
||||
int copies, /* Number of copies for job */
|
||||
copies_remaining; /* Number of copies remaining */
|
||||
const char *content_type, /* CONTENT_TYPE environment variable */
|
||||
*final_content_type; /* FINAL_CONTENT_TYPE environment var */
|
||||
const char *content_type; /* CONTENT_TYPE environment variable */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
|
||||
@@ -200,9 +198,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
}
|
||||
else if (argc < 6)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
|
||||
@@ -210,16 +207,12 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Get the (final) content type...
|
||||
*/
|
||||
|
||||
if ((content_type = getenv("CONTENT_TYPE")) == NULL)
|
||||
content_type = "application/octet-stream";
|
||||
if ((content_type = getenv("FINAL_CONTENT_TYPE")) == NULL)
|
||||
if ((content_type = getenv("CONTENT_TYPE")) == NULL)
|
||||
content_type = "application/octet-stream";
|
||||
|
||||
if ((final_content_type = getenv("FINAL_CONTENT_TYPE")) == NULL)
|
||||
{
|
||||
final_content_type = content_type;
|
||||
|
||||
if (!strncmp(final_content_type, "printer/", 8))
|
||||
final_content_type = "application/vnd.cups-raw";
|
||||
}
|
||||
if (!strncmp(content_type, "printer/", 8))
|
||||
content_type = "application/vnd.cups-raw";
|
||||
|
||||
/*
|
||||
* Extract the hostname and printer name from the URI...
|
||||
@@ -230,9 +223,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
hostname, sizeof(hostname), &port,
|
||||
resource, sizeof(resource)) < HTTP_URI_OK)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("ERROR: Missing device URI on command-line and no "
|
||||
"DEVICE_URI environment variable!\n"));
|
||||
fputs(_("ERROR: Missing device URI on command-line and no "
|
||||
"DEVICE_URI environment variable!\n"), stderr);
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
|
||||
@@ -270,30 +262,29 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Get the name...
|
||||
*/
|
||||
|
||||
name = optptr;
|
||||
for (ptr = name; *optptr && *optptr != '=';)
|
||||
if (ptr < (name + sizeof(name) - 1))
|
||||
*ptr++ = *optptr++;
|
||||
*ptr = '\0';
|
||||
|
||||
while (*optptr && *optptr != '=' && *optptr != '+' && *optptr != '&')
|
||||
optptr ++;
|
||||
|
||||
if ((sep = *optptr) != '\0')
|
||||
*optptr++ = '\0';
|
||||
|
||||
if (sep == '=')
|
||||
if (*optptr == '=')
|
||||
{
|
||||
/*
|
||||
* Get the value...
|
||||
*/
|
||||
|
||||
value = optptr;
|
||||
optptr ++;
|
||||
|
||||
while (*optptr && *optptr != '+' && *optptr != '&')
|
||||
for (ptr = value; *optptr && *optptr != '+' && *optptr != '&';)
|
||||
if (ptr < (value + sizeof(value) - 1))
|
||||
*ptr++ = *optptr++;
|
||||
*ptr = '\0';
|
||||
|
||||
if (*optptr == '+' || *optptr == '&')
|
||||
optptr ++;
|
||||
|
||||
if (*optptr)
|
||||
*optptr++ = '\0';
|
||||
}
|
||||
else
|
||||
value = (char *)"";
|
||||
value[0] = '\0';
|
||||
|
||||
/*
|
||||
* Process the option...
|
||||
@@ -335,7 +326,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
cupsSetEncryption(HTTP_ENCRYPT_IF_REQUESTED);
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
fprintf(stderr,
|
||||
_("ERROR: Unknown encryption option value \"%s\"!\n"),
|
||||
value);
|
||||
}
|
||||
@@ -348,7 +339,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
version = 1;
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
fprintf(stderr,
|
||||
_("ERROR: Unknown version option value \"%s\"!\n"),
|
||||
value);
|
||||
}
|
||||
@@ -377,9 +368,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Unknown option...
|
||||
*/
|
||||
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unknown option \"%s\" with value \"%s\"!\n"),
|
||||
name, value);
|
||||
fprintf(stderr, _("ERROR: Unknown option \"%s\" with value \"%s\"!\n"),
|
||||
name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -431,9 +421,10 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Point to the single file from stdin...
|
||||
*/
|
||||
|
||||
filename = tmpfilename;
|
||||
num_files = 1;
|
||||
files = &filename;
|
||||
filename = tmpfilename;
|
||||
files = &filename;
|
||||
num_files = 1;
|
||||
|
||||
send_options = 0;
|
||||
}
|
||||
else
|
||||
@@ -442,9 +433,10 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Point to the files on the command-line...
|
||||
*/
|
||||
|
||||
num_files = argc - 6;
|
||||
files = argv + 6;
|
||||
send_options = 1;
|
||||
num_files = argc - 6;
|
||||
files = argv + 6;
|
||||
|
||||
send_options = strncasecmp(content_type, "application/vnd.cups-", 21) != 0;
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
if (compression)
|
||||
@@ -477,9 +469,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Try loading authentication information from the environment.
|
||||
*/
|
||||
|
||||
const char *ptr = getenv("AUTH_USERNAME");
|
||||
|
||||
if (ptr)
|
||||
if ((ptr = getenv("AUTH_USERNAME")) != NULL)
|
||||
cupsSetUser(ptr);
|
||||
|
||||
password = getenv("AUTH_PASSWORD");
|
||||
@@ -497,8 +487,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
|
||||
do
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("INFO: Connecting to %s on port %d...\n"),
|
||||
hostname, port);
|
||||
fprintf(stderr, _("INFO: Connecting to %s on port %d...\n"),
|
||||
hostname, port);
|
||||
|
||||
if ((http = httpConnectEncrypt(hostname, port, cupsEncryption())) == NULL)
|
||||
{
|
||||
@@ -514,9 +504,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
* available printer in the class.
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"));
|
||||
fputs(_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"), stderr);
|
||||
|
||||
if (argc == 6 || strcmp(filename, argv[6]))
|
||||
unlink(filename);
|
||||
@@ -535,16 +524,16 @@ main(int argc, /* I - Number of command-line args */
|
||||
{
|
||||
if (contimeout && (time(NULL) - start_time) > contimeout)
|
||||
{
|
||||
_cupsLangPuts(stderr, _("ERROR: Printer not responding!\n"));
|
||||
fputs(_("ERROR: Printer not responding!\n"), stderr);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
recoverable = 1;
|
||||
|
||||
_cupsLangPrintf(stderr,
|
||||
_("WARNING: recoverable: Network host \'%s\' is busy; "
|
||||
"will retry in %d seconds...\n"),
|
||||
hostname, delay);
|
||||
fprintf(stderr,
|
||||
_("WARNING: recoverable: Network host \'%s\' is busy; will "
|
||||
"retry in %d seconds...\n"),
|
||||
hostname, delay);
|
||||
|
||||
sleep(delay);
|
||||
|
||||
@@ -553,8 +542,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
}
|
||||
else if (h_errno)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
|
||||
hostname);
|
||||
fprintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
|
||||
hostname);
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
else
|
||||
@@ -562,9 +551,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
recoverable = 1;
|
||||
|
||||
fprintf(stderr, "DEBUG: Connection error: %s\n", strerror(errno));
|
||||
_cupsLangPuts(stderr,
|
||||
_("ERROR: recoverable: Unable to connect to printer; will "
|
||||
"retry in 30 seconds...\n"));
|
||||
fputs(_("ERROR: recoverable: Unable to connect to printer; will "
|
||||
"retry in 30 seconds...\n"), stderr);
|
||||
sleep(30);
|
||||
}
|
||||
|
||||
@@ -583,7 +571,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
}
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
_cupsLangPrintf(stderr, _("INFO: Connected to %s...\n"), hostname);
|
||||
fprintf(stderr, _("INFO: Connected to %s...\n"), hostname);
|
||||
|
||||
#ifdef AF_INET6
|
||||
if (http->hostaddr->addr.sa_family == AF_INET6)
|
||||
@@ -649,18 +637,18 @@ main(int argc, /* I - Number of command-line args */
|
||||
{
|
||||
if (contimeout && (time(NULL) - start_time) > contimeout)
|
||||
{
|
||||
_cupsLangPuts(stderr, _("ERROR: Printer not responding!\n"));
|
||||
fputs(_("ERROR: Printer not responding!\n"), stderr);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
recoverable = 1;
|
||||
|
||||
_cupsLangPrintf(stderr,
|
||||
_("WARNING: recoverable: Network host \'%s\' is busy; "
|
||||
"will retry in %d seconds...\n"),
|
||||
hostname, delay);
|
||||
fprintf(stderr,
|
||||
_("WARNING: recoverable: Network host \'%s\' is busy; will "
|
||||
"retry in %d seconds...\n"),
|
||||
hostname, delay);
|
||||
|
||||
report_printer_state(supported, 0);
|
||||
report_printer_state(supported);
|
||||
|
||||
sleep(delay);
|
||||
|
||||
@@ -674,15 +662,14 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Switch to IPP/1.0...
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer does not support IPP/1.1, trying "
|
||||
"IPP/1.0...\n"));
|
||||
fputs(_("INFO: Printer does not support IPP/1.1, trying IPP/1.0...\n"),
|
||||
stderr);
|
||||
version = 0;
|
||||
httpReconnect(http);
|
||||
}
|
||||
else if (ipp_status == IPP_NOT_FOUND)
|
||||
{
|
||||
_cupsLangPuts(stderr, _("ERROR: Destination printer does not exist!\n"));
|
||||
fputs(_("ERROR: Destination printer does not exist!\n"), stderr);
|
||||
|
||||
if (supported)
|
||||
ippDelete(supported);
|
||||
@@ -691,9 +678,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to get printer status (%s)!\n"),
|
||||
cupsLastErrorString());
|
||||
fprintf(stderr, _("ERROR: Unable to get printer status (%s)!\n"),
|
||||
cupsLastErrorString());
|
||||
sleep(10);
|
||||
}
|
||||
|
||||
@@ -726,7 +712,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
format_sup->values[i].string.text);
|
||||
}
|
||||
|
||||
report_printer_state(supported, 0);
|
||||
report_printer_state(supported);
|
||||
}
|
||||
while (ipp_status > IPP_OK_CONFLICT);
|
||||
|
||||
@@ -755,9 +741,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
* available printer in the class.
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"));
|
||||
fputs(_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"), stderr);
|
||||
|
||||
ippDelete(supported);
|
||||
httpClose(http);
|
||||
@@ -862,7 +847,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
num_options = cupsParseOptions(argv[5], 0, &options);
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (!strcasecmp(content_type, "application/pictwps") && num_files == 1)
|
||||
if (content_type != NULL &&
|
||||
!strcasecmp(content_type, "application/pictwps") && num_files == 1)
|
||||
{
|
||||
if (format_sup != NULL)
|
||||
{
|
||||
@@ -888,23 +874,23 @@ main(int argc, /* I - Number of command-line args */
|
||||
* number of copies to 1...
|
||||
*/
|
||||
|
||||
final_content_type = "application/postscript";
|
||||
copies = 1;
|
||||
copies_remaining = 1;
|
||||
send_options = 0;
|
||||
content_type = "application/postscript";
|
||||
copies = 1;
|
||||
copies_remaining = 1;
|
||||
send_options = 0;
|
||||
}
|
||||
}
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
if (format_sup != NULL)
|
||||
if (content_type != NULL && format_sup != NULL)
|
||||
{
|
||||
for (i = 0; i < format_sup->num_values; i ++)
|
||||
if (!strcasecmp(final_content_type, format_sup->values[i].string.text))
|
||||
if (!strcasecmp(content_type, format_sup->values[i].string.text))
|
||||
break;
|
||||
|
||||
if (i < format_sup->num_values)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
|
||||
"document-format", NULL, final_content_type);
|
||||
"document-format", NULL, content_type);
|
||||
}
|
||||
|
||||
if (copies_sup && version > 0 && send_options)
|
||||
@@ -957,8 +943,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
if (ipp_status == IPP_SERVICE_UNAVAILABLE ||
|
||||
ipp_status == IPP_PRINTER_BUSY)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer busy; will retry in 10 seconds...\n"));
|
||||
fputs(_("INFO: Printer busy; will retry in 10 seconds...\n"), stderr);
|
||||
sleep(10);
|
||||
}
|
||||
else if ((ipp_status == IPP_BAD_REQUEST ||
|
||||
@@ -968,28 +953,25 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Switch to IPP/1.0...
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer does not support IPP/1.1, trying "
|
||||
"IPP/1.0...\n"));
|
||||
fputs(_("INFO: Printer does not support IPP/1.1, trying IPP/1.0...\n"),
|
||||
stderr);
|
||||
version = 0;
|
||||
httpReconnect(http);
|
||||
}
|
||||
else
|
||||
_cupsLangPrintf(stderr, _("ERROR: Print file was not accepted (%s)!\n"),
|
||||
cupsLastErrorString());
|
||||
fprintf(stderr, _("ERROR: Print file was not accepted (%s)!\n"),
|
||||
cupsLastErrorString());
|
||||
}
|
||||
else if ((job_id_attr = ippFindAttribute(response, "job-id",
|
||||
IPP_TAG_INTEGER)) == NULL)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("NOTICE: Print file accepted - job ID unknown.\n"));
|
||||
fputs(_("NOTICE: Print file accepted - job ID unknown.\n"), stderr);
|
||||
job_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
job_id = job_id_attr->values[0].integer;
|
||||
_cupsLangPrintf(stderr, _("NOTICE: Print file accepted - job ID %d.\n"),
|
||||
job_id);
|
||||
fprintf(stderr, _("NOTICE: Print file accepted - job ID %d.\n"), job_id);
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
@@ -1027,9 +1009,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
{
|
||||
ipp_status = cupsLastError();
|
||||
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to add file %d to job: %s\n"),
|
||||
job_id, cupsLastErrorString());
|
||||
fprintf(stderr, _("ERROR: Unable to add file %d to job: %s\n"),
|
||||
job_id, cupsLastErrorString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1053,7 +1034,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
if (!job_id || !waitjob)
|
||||
continue;
|
||||
|
||||
_cupsLangPuts(stderr, _("INFO: Waiting for job to complete...\n"));
|
||||
fputs(_("INFO: Waiting for job to complete...\n"), stderr);
|
||||
|
||||
for (; !job_cancelled;)
|
||||
{
|
||||
@@ -1107,9 +1088,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
{
|
||||
ippDelete(response);
|
||||
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to get job %d attributes (%s)!\n"),
|
||||
job_id, cupsLastErrorString());
|
||||
fprintf(stderr, _("ERROR: Unable to get job %d attributes (%s)!\n"),
|
||||
job_id, cupsLastErrorString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1143,7 +1123,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Check the printer state and report it if necessary...
|
||||
*/
|
||||
|
||||
check_printer_state(http, uri, resource, argv[2], version, job_id);
|
||||
check_printer_state(http, uri, resource, argv[2], version);
|
||||
|
||||
/*
|
||||
* Wait 10 seconds before polling again...
|
||||
@@ -1164,7 +1144,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Check the printer state and report it if necessary...
|
||||
*/
|
||||
|
||||
check_printer_state(http, uri, resource, argv[2], version, job_id);
|
||||
check_printer_state(http, uri, resource, argv[2], version);
|
||||
|
||||
/*
|
||||
* Free memory...
|
||||
@@ -1198,20 +1178,7 @@ main(int argc, /* I - Number of command-line args */
|
||||
* Return the queue status...
|
||||
*/
|
||||
|
||||
if (ipp_status == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
/*
|
||||
* Authorization failures here mean that we need Kerberos. Username +
|
||||
* password authentication is handled in the password_cb function.
|
||||
*/
|
||||
|
||||
fputs("ATTR: auth-info-required=negotiate\n", stderr);
|
||||
return (CUPS_BACKEND_AUTH_REQUIRED);
|
||||
}
|
||||
else if (ipp_status > IPP_OK_CONFLICT)
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
else
|
||||
return (CUPS_BACKEND_OK);
|
||||
return (ipp_status > IPP_OK_CONFLICT ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -1230,7 +1197,7 @@ cancel_job(http_t *http, /* I - HTTP connection */
|
||||
ipp_t *request; /* Cancel-Job request */
|
||||
|
||||
|
||||
_cupsLangPuts(stderr, _("INFO: Canceling print job...\n"));
|
||||
fputs(_("INFO: Canceling print job...\n"), stderr);
|
||||
|
||||
request = ippNewRequest(IPP_CANCEL_JOB);
|
||||
request->request.op.version[1] = version;
|
||||
@@ -1250,8 +1217,8 @@ cancel_job(http_t *http, /* I - HTTP connection */
|
||||
ippDelete(cupsDoRequest(http, request, resource));
|
||||
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to cancel job %d: %s\n"), id,
|
||||
cupsLastErrorString());
|
||||
fprintf(stderr, _("ERROR: Unable to cancel job %d: %s\n"), id,
|
||||
cupsLastErrorString());
|
||||
}
|
||||
|
||||
|
||||
@@ -1265,8 +1232,7 @@ check_printer_state(
|
||||
const char *uri, /* I - Printer URI */
|
||||
const char *resource, /* I - Resource path */
|
||||
const char *user, /* I - Username, if any */
|
||||
int version, /* I - IPP version */
|
||||
int job_id) /* I - Current job ID */
|
||||
int version) /* I - IPP version */
|
||||
{
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
@@ -1301,7 +1267,7 @@ check_printer_state(
|
||||
|
||||
if ((response = cupsDoRequest(http, request, resource)) != NULL)
|
||||
{
|
||||
report_printer_state(response, job_id);
|
||||
report_printer_state(response);
|
||||
ippDelete(response);
|
||||
}
|
||||
}
|
||||
@@ -1332,25 +1298,25 @@ compress_files(int num_files, /* I - Number of files */
|
||||
{
|
||||
if ((fd = cupsTempFd(filename, sizeof(filename))) < 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to create temporary compressed print "
|
||||
"file: %s\n"), strerror(errno));
|
||||
fprintf(stderr,
|
||||
_("ERROR: Unable to create temporary compressed print file: "
|
||||
"%s\n"),
|
||||
strerror(errno));
|
||||
exit(CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
if ((out = cupsFileOpenFd(fd, "w9")) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open temporary compressed print "
|
||||
"file: %s\n"), strerror(errno));
|
||||
fprintf(stderr,
|
||||
_("ERROR: Unable to open temporary compressed print file: %s\n"),
|
||||
strerror(errno));
|
||||
exit(CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
if ((in = cupsFileOpen(files[i], "r")) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open print file \"%s\": %s\n"),
|
||||
files[i], strerror(errno));
|
||||
fprintf(stderr, _("ERROR: Unable to open print file \"%s\": %s\n"),
|
||||
files[i], strerror(errno));
|
||||
cupsFileClose(out);
|
||||
exit(CUPS_BACKEND_FAILED);
|
||||
}
|
||||
@@ -1359,9 +1325,8 @@ compress_files(int num_files, /* I - Number of files */
|
||||
while ((bytes = cupsFileRead(in, buffer, sizeof(buffer))) > 0)
|
||||
if (cupsFileWrite(out, buffer, bytes) < bytes)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to write %d bytes to \"%s\": %s\n"),
|
||||
(int)bytes, filename, strerror(errno));
|
||||
fprintf(stderr, _("ERROR: Unable to write %d bytes to \"%s\": %s\n"),
|
||||
(int)bytes, filename, strerror(errno));
|
||||
cupsFileClose(in);
|
||||
cupsFileClose(out);
|
||||
exit(CUPS_BACKEND_FAILED);
|
||||
@@ -1394,12 +1359,8 @@ password_cb(const char *prompt) /* I - Prompt (not used) */
|
||||
{
|
||||
(void)prompt;
|
||||
|
||||
if (password && password_tries < 3)
|
||||
{
|
||||
password_tries ++;
|
||||
|
||||
if (password)
|
||||
return (password);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
@@ -1429,8 +1390,7 @@ password_cb(const char *prompt) /* I - Prompt (not used) */
|
||||
*/
|
||||
|
||||
static int /* O - Number of reasons shown */
|
||||
report_printer_state(ipp_t *ipp, /* I - IPP response */
|
||||
int job_id) /* I - Current job ID */
|
||||
report_printer_state(ipp_t *ipp) /* I - IPP response */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
int count; /* Count of reasons shown... */
|
||||
@@ -1441,7 +1401,6 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
|
||||
char unknown[1024]; /* Unknown message string */
|
||||
const char *prefix; /* Prefix for STATE: line */
|
||||
char state[1024]; /* State string */
|
||||
cups_lang_t *language; /* Current localization */
|
||||
|
||||
|
||||
if ((psm = ippFindAttribute(ipp, "printer-state-message",
|
||||
@@ -1454,20 +1413,15 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
|
||||
|
||||
state[0] = '\0';
|
||||
prefix = "STATE: ";
|
||||
language = cupsLangDefault();
|
||||
|
||||
for (i = 0, count = 0; i < reasons->num_values; i ++)
|
||||
{
|
||||
reason = reasons->values[i].string.text;
|
||||
|
||||
if (job_id == 0 || strcmp(reason, "paused"))
|
||||
{
|
||||
strlcat(state, prefix, sizeof(state));
|
||||
strlcat(state, reason, sizeof(state));
|
||||
|
||||
prefix = ",";
|
||||
}
|
||||
strlcat(state, prefix, sizeof(state));
|
||||
strlcat(state, reason, sizeof(state));
|
||||
|
||||
prefix = ",";
|
||||
message = "";
|
||||
|
||||
if (!strncmp(reason, "media-needed", 12))
|
||||
@@ -1528,15 +1482,15 @@ report_printer_state(ipp_t *ipp, /* I - IPP response */
|
||||
reason);
|
||||
}
|
||||
|
||||
if (message[0])
|
||||
if (message)
|
||||
{
|
||||
count ++;
|
||||
if (strstr(reasons->values[i].string.text, "error"))
|
||||
fprintf(stderr, "ERROR: %s\n", _cupsLangString(language, message));
|
||||
fprintf(stderr, "ERROR: %s\n", message);
|
||||
else if (strstr(reasons->values[i].string.text, "warning"))
|
||||
fprintf(stderr, "WARNING: %s\n", _cupsLangString(language, message));
|
||||
fprintf(stderr, "WARNING: %s\n", message);
|
||||
else
|
||||
fprintf(stderr, "INFO: %s\n", _cupsLangString(language, message));
|
||||
fprintf(stderr, "INFO: %s\n", message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1578,16 +1532,15 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
|
||||
printer = getenv("PRINTER");
|
||||
if (!printer)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("ERROR: PRINTER environment variable not defined!\n"));
|
||||
fputs(_("ERROR: PRINTER environment variable not defined!\n"), stderr);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if ((ppdfile = cupsGetPPD(printer)) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to get PPD file for printer \"%s\" - "
|
||||
"%s.\n"), printer, cupsLastErrorString());
|
||||
fprintf(stderr,
|
||||
_("ERROR: Unable to get PPD file for printer \"%s\" - %s.\n"),
|
||||
printer, cupsLastErrorString());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1601,8 +1554,8 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
|
||||
|
||||
if ((fd = cupsTempFd(pstmpname, sizeof(pstmpname))) < 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to create temporary file - %s.\n"),
|
||||
strerror(errno));
|
||||
fprintf(stderr, _("ERROR: Unable to create temporary file - %s.\n"),
|
||||
strerror(errno));
|
||||
if (ppdfile)
|
||||
unlink(ppdfile);
|
||||
return (-1);
|
||||
@@ -1658,8 +1611,8 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
|
||||
|
||||
execlp("pictwpstops", printer, argv[1], argv[2], argv[3], argv[4], argv[5],
|
||||
filename, NULL);
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to exec pictwpstops: %s\n"),
|
||||
strerror(errno));
|
||||
fprintf(stderr, _("ERROR: Unable to exec pictwpstops: %s\n"),
|
||||
strerror(errno));
|
||||
return (errno);
|
||||
}
|
||||
|
||||
@@ -1671,8 +1624,8 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
|
||||
* Error!
|
||||
*/
|
||||
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to fork pictwpstops: %s\n"),
|
||||
strerror(errno));
|
||||
fprintf(stderr, _("ERROR: Unable to fork pictwpstops: %s\n"),
|
||||
strerror(errno));
|
||||
unlink(filename);
|
||||
if (ppdfile)
|
||||
unlink(ppdfile);
|
||||
@@ -1685,8 +1638,8 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
|
||||
|
||||
if (wait(&status) < 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to wait for pictwpstops: %s\n"),
|
||||
strerror(errno));
|
||||
fprintf(stderr, _("ERROR: Unable to wait for pictwpstops: %s\n"),
|
||||
strerror(errno));
|
||||
close(fd);
|
||||
unlink(filename);
|
||||
if (ppdfile)
|
||||
@@ -1702,11 +1655,11 @@ run_pictwps_filter(char **argv, /* I - Command-line arguments */
|
||||
if (status)
|
||||
{
|
||||
if (status >= 256)
|
||||
_cupsLangPrintf(stderr, _("ERROR: pictwpstops exited with status %d!\n"),
|
||||
status / 256);
|
||||
fprintf(stderr, _("ERROR: pictwpstops exited with status %d!\n"),
|
||||
status / 256);
|
||||
else
|
||||
_cupsLangPrintf(stderr, _("ERROR: pictwpstops exited on signal %d!\n"),
|
||||
status);
|
||||
fprintf(stderr, _("ERROR: pictwpstops exited on signal %d!\n"),
|
||||
status);
|
||||
|
||||
unlink(filename);
|
||||
return (status);
|
||||
|
||||
@@ -125,9 +125,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
username[255], /* Username info */
|
||||
resource[1024], /* Resource info (printer name) */
|
||||
*options, /* Pointer to options */
|
||||
*name, /* Name of option */
|
||||
*value, /* Value of option */
|
||||
sep, /* Separator character */
|
||||
name[255], /* Name of option */
|
||||
value[255], /* Value of option */
|
||||
*ptr, /* Pointer into name or value */
|
||||
*filename, /* File to print */
|
||||
title[256]; /* Title string */
|
||||
int port; /* Port number */
|
||||
@@ -186,9 +186,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
}
|
||||
else if (argc < 6 || argc > 7)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
@@ -277,30 +276,29 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* Get the name...
|
||||
*/
|
||||
|
||||
name = options;
|
||||
for (ptr = name; *options && *options != '=';)
|
||||
if (ptr < (name + sizeof(name) - 1))
|
||||
*ptr++ = *options++;
|
||||
*ptr = '\0';
|
||||
|
||||
while (*options && *options != '=' && *options != '+' && *options != '&')
|
||||
options ++;
|
||||
|
||||
if ((sep = *options) != '\0')
|
||||
*options++ = '\0';
|
||||
|
||||
if (sep == '=')
|
||||
if (*options == '=')
|
||||
{
|
||||
/*
|
||||
* Get the value...
|
||||
*/
|
||||
|
||||
value = options;
|
||||
options ++;
|
||||
|
||||
while (*options && *options != '+' && *options != '&')
|
||||
for (ptr = value; *options && *options != '+' && *options != '&';)
|
||||
if (ptr < (value + sizeof(value) - 1))
|
||||
*ptr++ = *options++;
|
||||
*ptr = '\0';
|
||||
|
||||
if (*options == '+' || *options == '&')
|
||||
options ++;
|
||||
|
||||
if (*options)
|
||||
*options++ = '\0';
|
||||
}
|
||||
else
|
||||
value = (char *)"";
|
||||
value[0] = '\0';
|
||||
|
||||
/*
|
||||
* Process the option...
|
||||
@@ -324,8 +322,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
if (strchr("cdfglnoprtv", value[0]))
|
||||
format = value[0];
|
||||
else
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unknown format character \"%c\"\n"),
|
||||
value[0]);
|
||||
fprintf(stderr, _("ERROR: Unknown format character \"%c\"\n"),
|
||||
value[0]);
|
||||
}
|
||||
else if (!strcasecmp(name, "mode") && value[0])
|
||||
{
|
||||
@@ -338,8 +336,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
else if (!strcasecmp(value, "stream"))
|
||||
mode = MODE_STREAM;
|
||||
else
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unknown print mode \"%s\"\n"),
|
||||
value);
|
||||
fprintf(stderr, _("ERROR: Unknown print mode \"%s\"\n"), value);
|
||||
}
|
||||
else if (!strcasecmp(name, "order") && value[0])
|
||||
{
|
||||
@@ -352,8 +349,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
else if (!strcasecmp(value, "data,control"))
|
||||
order = ORDER_DATA_CONTROL;
|
||||
else
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unknown file order \"%s\"\n"),
|
||||
value);
|
||||
fprintf(stderr, _("ERROR: Unknown file order \"%s\"\n"), value);
|
||||
}
|
||||
else if (!strcasecmp(name, "reserve"))
|
||||
{
|
||||
@@ -461,8 +457,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to open print file %s: %s\n"),
|
||||
filename, strerror(errno));
|
||||
fprintf(stderr, _("ERROR: Unable to open print file %s: %s\n"),
|
||||
filename, strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -480,8 +476,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* the remote end...
|
||||
*/
|
||||
|
||||
char *ptr;
|
||||
|
||||
for (ptr = title; *ptr; ptr ++)
|
||||
if (!isalnum(*ptr & 255) && !isspace(*ptr & 255))
|
||||
*ptr = '_';
|
||||
@@ -591,9 +585,9 @@ lpd_command(int fd, /* I - Socket connection to LPD host */
|
||||
|
||||
if (recv(fd, &status, 1, 0) < 1)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("WARNING: Remote host did not respond with command "
|
||||
"status byte after %d seconds!\n"), timeout);
|
||||
fprintf(stderr,
|
||||
_("WARNING: Remote host did not respond with command status "
|
||||
"byte after %d seconds!\n"), timeout);
|
||||
status = errno;
|
||||
}
|
||||
|
||||
@@ -674,8 +668,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
|
||||
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
|
||||
hostname);
|
||||
fprintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"), hostname);
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
|
||||
@@ -697,9 +690,9 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
*/
|
||||
|
||||
fputs("STATE: +connecting-to-device\n", stderr);
|
||||
_cupsLangPrintf(stderr,
|
||||
_("INFO: Attempting to connect to host %s for printer %s\n"),
|
||||
hostname, printer);
|
||||
fprintf(stderr,
|
||||
_("INFO: Attempting to connect to host %s for printer %s\n"),
|
||||
hostname, printer);
|
||||
|
||||
for (lport = reserve == RESERVE_RFC1179 ? 732 : 1024, addr = addrlist,
|
||||
delay = 5;;
|
||||
@@ -798,9 +791,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
* available printer in the class.
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"));
|
||||
fputs(_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"), stderr);
|
||||
|
||||
httpAddrFreeList(addrlist);
|
||||
|
||||
@@ -818,15 +810,16 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
{
|
||||
if (contimeout && (time(NULL) - start_time) > contimeout)
|
||||
{
|
||||
_cupsLangPuts(stderr, _("ERROR: Printer not responding!\n"));
|
||||
fputs(_("ERROR: Printer not responding!\n"), stderr);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
recoverable = 1;
|
||||
|
||||
_cupsLangPrintf(stderr,
|
||||
_("WARNING: recoverable: Network host \'%s\' is busy; "
|
||||
"will retry in %d seconds...\n"), hostname, delay);
|
||||
fprintf(stderr,
|
||||
_("WARNING: recoverable: Network host \'%s\' is busy; will "
|
||||
"retry in %d seconds...\n"),
|
||||
hostname, delay);
|
||||
|
||||
sleep(delay);
|
||||
|
||||
@@ -846,9 +839,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
recoverable = 1;
|
||||
|
||||
fprintf(stderr, "DEBUG: Connection error: %s\n", strerror(errno));
|
||||
_cupsLangPuts(stderr,
|
||||
_("ERROR: recoverable: Unable to connect to printer; "
|
||||
"will retry in 30 seconds...\n"));
|
||||
fputs(_("ERROR: recoverable: Unable to connect to printer; will "
|
||||
"retry in 30 seconds...\n"), stderr);
|
||||
sleep(30);
|
||||
}
|
||||
}
|
||||
@@ -866,7 +858,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
}
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
_cupsLangPrintf(stderr, _("INFO: Connected to %s...\n"), hostname);
|
||||
fprintf(stderr, _("INFO: Connected to %s...\n"), hostname);
|
||||
|
||||
#ifdef AF_INET6
|
||||
if (addr->addr.addr.sa_family == AF_INET6)
|
||||
@@ -972,8 +964,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
_cupsLangPrintf(stderr, _("INFO: Sending control file (%u bytes)\n"),
|
||||
(unsigned)strlen(control));
|
||||
fprintf(stderr, _("INFO: Sending control file (%u bytes)\n"),
|
||||
(unsigned)strlen(control));
|
||||
|
||||
if (lpd_write(fd, control, strlen(control) + 1) < (strlen(control) + 1))
|
||||
{
|
||||
@@ -986,9 +978,9 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
|
||||
if (read(fd, &status, 1) < 1)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("WARNING: Remote host did not respond with control "
|
||||
"status byte after %d seconds!\n"), timeout);
|
||||
fprintf(stderr,
|
||||
_("WARNING: Remote host did not respond with control "
|
||||
"status byte after %d seconds!\n"), timeout);
|
||||
status = errno;
|
||||
}
|
||||
|
||||
@@ -996,11 +988,11 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
}
|
||||
|
||||
if (status != 0)
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Remote host did not accept control file "
|
||||
"(%d)\n"), status);
|
||||
fprintf(stderr,
|
||||
_("ERROR: Remote host did not accept control file (%d)\n"),
|
||||
status);
|
||||
else
|
||||
_cupsLangPuts(stderr, _("INFO: Control file sent successfully\n"));
|
||||
fputs(_("INFO: Control file sent successfully\n"), stderr);
|
||||
}
|
||||
else
|
||||
status = 0;
|
||||
@@ -1021,13 +1013,13 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
_cupsLangPrintf(stderr,
|
||||
fprintf(stderr,
|
||||
#ifdef HAVE_LONG_LONG
|
||||
_("INFO: Sending data file (%lld bytes)\n"),
|
||||
_("INFO: Sending data file (%lld bytes)\n"),
|
||||
#else
|
||||
_("INFO: Sending data file (%ld bytes)\n"),
|
||||
_("INFO: Sending data file (%ld bytes)\n"),
|
||||
#endif /* HAVE_LONG_LONG */
|
||||
CUPS_LLCAST filestats.st_size);
|
||||
CUPS_LLCAST filestats.st_size);
|
||||
|
||||
tbytes = 0;
|
||||
for (copy = 0; copy < manual_copies; copy ++)
|
||||
@@ -1036,9 +1028,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
|
||||
while ((nbytes = read(print_fd, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("INFO: Spooling LPR job, %.0f%% complete...\n"),
|
||||
100.0 * tbytes / filestats.st_size);
|
||||
fprintf(stderr, _("INFO: Spooling LPR job, %.0f%% complete...\n"),
|
||||
100.0 * tbytes / filestats.st_size);
|
||||
|
||||
if (lpd_write(fd, buffer, nbytes) < nbytes)
|
||||
{
|
||||
@@ -1072,9 +1063,9 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
|
||||
if (recv(fd, &status, 1, 0) < 1)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("WARNING: Remote host did not respond with data "
|
||||
"status byte after %d seconds!\n"), timeout);
|
||||
fprintf(stderr,
|
||||
_("WARNING: Remote host did not respond with data "
|
||||
"status byte after %d seconds!\n"), timeout);
|
||||
status = 0;
|
||||
}
|
||||
|
||||
@@ -1085,11 +1076,10 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
status = 0;
|
||||
|
||||
if (status != 0)
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Remote host did not accept data file (%d)\n"),
|
||||
status);
|
||||
fprintf(stderr, _("ERROR: Remote host did not accept data file (%d)\n"),
|
||||
status);
|
||||
else
|
||||
_cupsLangPuts(stderr, _("INFO: Data file sent successfully\n"));
|
||||
fputs(_("INFO: Data file sent successfully\n"), stderr);
|
||||
}
|
||||
|
||||
if (status == 0 && order == ORDER_DATA_CONTROL)
|
||||
@@ -1103,8 +1093,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
_cupsLangPrintf(stderr, _("INFO: Sending control file (%lu bytes)\n"),
|
||||
(unsigned long)strlen(control));
|
||||
fprintf(stderr, _("INFO: Sending control file (%lu bytes)\n"),
|
||||
(unsigned long)strlen(control));
|
||||
|
||||
if (lpd_write(fd, control, strlen(control) + 1) < (strlen(control) + 1))
|
||||
{
|
||||
@@ -1117,9 +1107,9 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
|
||||
if (read(fd, &status, 1) < 1)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("WARNING: Remote host did not respond with control "
|
||||
"status byte after %d seconds!\n"), timeout);
|
||||
fprintf(stderr,
|
||||
_("WARNING: Remote host did not respond with control "
|
||||
"status byte after %d seconds!\n"), timeout);
|
||||
status = errno;
|
||||
}
|
||||
|
||||
@@ -1127,11 +1117,11 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
}
|
||||
|
||||
if (status != 0)
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Remote host did not accept control file "
|
||||
"(%d)\n"), status);
|
||||
fprintf(stderr,
|
||||
_("ERROR: Remote host did not accept control file (%d)\n"),
|
||||
status);
|
||||
else
|
||||
_cupsLangPuts(stderr, _("INFO: Control file sent successfully\n"));
|
||||
fputs(_("INFO: Control file sent successfully\n"), stderr);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -242,9 +242,7 @@ int main (int argc, const char * argv[])
|
||||
/* Try to open the print file... */
|
||||
if ((fp = fopen(argv[6], "rb")) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open print file \"%s\": %s\n"),
|
||||
argv[6], strerror(errno));
|
||||
fprintf(stderr, "ERROR: unable to open print file \"%s\": %s\n", argv[6], strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -1365,9 +1363,9 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone)
|
||||
*resourcePtr,
|
||||
*typePtr,
|
||||
*options, /* Pointer to options */
|
||||
*optionName, /* Name of option */
|
||||
*value, /* Value of option */
|
||||
sep; /* Separator character */
|
||||
optionName[255], /* Name of option */
|
||||
value[255], /* Value of option */
|
||||
*ptr; /* Pointer into name or value */
|
||||
int port; /* Port number (not used) */
|
||||
int statusInterval; /* */
|
||||
|
||||
@@ -1395,54 +1393,53 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone)
|
||||
|
||||
while (*options != '\0')
|
||||
{
|
||||
/*
|
||||
/*
|
||||
* Get the name...
|
||||
*/
|
||||
for (ptr = optionName; *options && *options != '=' && *options != '+'; )
|
||||
*ptr++ = *options++;
|
||||
|
||||
optionName = options;
|
||||
*ptr = '\0';
|
||||
value[0] = '\0';
|
||||
|
||||
while (*options && *options != '=' && *options != '+' && *options != '&')
|
||||
options ++;
|
||||
|
||||
if ((sep = *options) != '\0')
|
||||
*options++ = '\0';
|
||||
|
||||
if (sep == '=')
|
||||
if (*options == '=')
|
||||
{
|
||||
/*
|
||||
/*
|
||||
* Get the value...
|
||||
*/
|
||||
*/
|
||||
|
||||
options ++;
|
||||
|
||||
for (ptr = value; *options && *options != '+';)
|
||||
*ptr++ = *options++;
|
||||
|
||||
value = options;
|
||||
|
||||
while (*options && *options != '+' && *options != '&')
|
||||
options ++;
|
||||
|
||||
if (*options)
|
||||
*options++ = '\0';
|
||||
*ptr = '\0';
|
||||
|
||||
if (*options == '+')
|
||||
options ++;
|
||||
}
|
||||
else if (*options == '+')
|
||||
{
|
||||
options ++;
|
||||
}
|
||||
else
|
||||
value = (char *)"";
|
||||
|
||||
/*
|
||||
/*
|
||||
* Process the option...
|
||||
*/
|
||||
|
||||
if (!strcasecmp(optionName, "waiteof"))
|
||||
if (strcasecmp(optionName, "waiteof") == 0)
|
||||
{
|
||||
/*
|
||||
* Wait for the end of the print file?
|
||||
/*
|
||||
* Set the banner...
|
||||
*/
|
||||
|
||||
if (!strcasecmp(value, "on") ||
|
||||
!strcasecmp(value, "yes") ||
|
||||
!strcasecmp(value, "true"))
|
||||
if (strcasecmp(value, "on") == 0 ||
|
||||
strcasecmp(value, "yes") == 0 ||
|
||||
strcasecmp(value, "true") == 0)
|
||||
{
|
||||
gWaitEOF = true;
|
||||
}
|
||||
else if (!strcasecmp(value, "off") ||
|
||||
!strcasecmp(value, "no") ||
|
||||
!strcasecmp(value, "false"))
|
||||
else if (strcasecmp(value, "off") == 0 ||
|
||||
strcasecmp(value, "no") == 0 ||
|
||||
strcasecmp(value, "false") == 0)
|
||||
{
|
||||
gWaitEOF = false;
|
||||
}
|
||||
@@ -1451,17 +1448,13 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone)
|
||||
fprintf(stderr, "WARNING: Boolean expected for waiteof option \"%s\"\n", value);
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(optionName, "status"))
|
||||
else if (strcasecmp(optionName, "status") == 0)
|
||||
{
|
||||
/*
|
||||
* Set status reporting interval...
|
||||
*/
|
||||
|
||||
statusInterval = atoi(value);
|
||||
if (value[0] < '0' || value[0] > '9' || statusInterval < 0)
|
||||
if (value[0] < '0' || value[0] > '9' ||
|
||||
statusInterval < 0)
|
||||
{
|
||||
fprintf(stderr, "WARNING: number expected for status option \"%s\"\n",
|
||||
value);
|
||||
fprintf(stderr, "WARNING: number expected for status option \"%s\"\n", value);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1476,24 +1469,20 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone)
|
||||
if (*resourcePtr == '/')
|
||||
resourcePtr++;
|
||||
|
||||
/* If the resource has a slash we assume the slash seperates the AppleTalk object
|
||||
* name from the AppleTalk type. If the slash is not present we assume the AppleTalk
|
||||
* type is LaserWriter.
|
||||
*/
|
||||
/* If the resource has a slash we assume the slash seperates the AppleTalk object
|
||||
* name from the AppleTalk type. If the slash is not present we assume the AppleTalk
|
||||
* type is LaserWriter.
|
||||
*/
|
||||
typePtr = strchr(resourcePtr, '/');
|
||||
if (typePtr != NULL) {
|
||||
*typePtr++ = '\0';
|
||||
} else {
|
||||
typePtr = "LaserWriter";
|
||||
}
|
||||
|
||||
typePtr = strchr(resourcePtr, '/');
|
||||
if (typePtr != NULL)
|
||||
{
|
||||
*typePtr++ = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
typePtr = "LaserWriter";
|
||||
}
|
||||
|
||||
removePercentEscapes(hostname, zone, NBP_NVE_STR_SIZE + 1);
|
||||
removePercentEscapes(resourcePtr, name, NBP_NVE_STR_SIZE + 1);
|
||||
removePercentEscapes(typePtr, type, NBP_NVE_STR_SIZE + 1);
|
||||
removePercentEscapes(hostname, zone, NBP_NVE_STR_SIZE + 1);
|
||||
removePercentEscapes(resourcePtr, name, NBP_NVE_STR_SIZE + 1);
|
||||
removePercentEscapes(typePtr, type, NBP_NVE_STR_SIZE + 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -122,9 +122,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
}
|
||||
else if (argc < 6 || argc > 7)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
@@ -214,9 +213,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* available printer in the class.
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"));
|
||||
fputs(_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"), stderr);
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
@@ -229,22 +227,19 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
|
||||
if (errno == EBUSY)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer busy; will retry in 30 seconds...\n"));
|
||||
fputs(_("INFO: Printer busy; will retry in 30 seconds...\n"), stderr);
|
||||
sleep(30);
|
||||
}
|
||||
else if (errno == ENXIO || errno == EIO || errno == ENOENT)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer not connected; will retry in 30 "
|
||||
"seconds...\n"));
|
||||
fputs(_("INFO: Printer not connected; will retry in 30 seconds...\n"),
|
||||
stderr);
|
||||
sleep(30);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open device file \"%s\": %s\n"),
|
||||
resource, strerror(errno));
|
||||
fprintf(stderr, _("ERROR: Unable to open device file \"%s\": %s\n"),
|
||||
resource, strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -284,13 +279,13 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
tbytes = backendRunLoop(print_fd, device_fd, use_bc, side_cb);
|
||||
|
||||
if (print_fd != 0 && tbytes >= 0)
|
||||
_cupsLangPrintf(stderr,
|
||||
fprintf(stderr,
|
||||
#ifdef HAVE_LONG_LONG
|
||||
_("INFO: Sent print file, %lld bytes...\n"),
|
||||
_("INFO: Sent print file, %lld bytes...\n"),
|
||||
#else
|
||||
_("INFO: Sent print file, %ld bytes...\n"),
|
||||
_("INFO: Sent print file, %ld bytes...\n"),
|
||||
#endif /* HAVE_LONG_LONG */
|
||||
CUPS_LLCAST tbytes);
|
||||
CUPS_LLCAST tbytes);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -618,7 +613,7 @@ side_cb(int print_fd, /* I - Print file */
|
||||
|
||||
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
|
||||
{
|
||||
_cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
|
||||
fputs(_("WARNING: Failed to read side-channel request!\n"), stderr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,8 +118,8 @@ backendDrainOutput(int print_fd, /* I - Print file descriptor */
|
||||
if (errno != ENOSPC && errno != ENXIO && errno != EAGAIN &&
|
||||
errno != EINTR && errno != ENOTTY)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to write print data: %s\n"),
|
||||
strerror(errno));
|
||||
fprintf(stderr, _("ERROR: Unable to write print data: %s\n"),
|
||||
strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ backendRunLoop(
|
||||
if (errno == ENXIO && offline != 1)
|
||||
{
|
||||
fputs("STATE: +offline-error\n", stderr);
|
||||
_cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n"));
|
||||
fputs(_("INFO: Printer is currently off-line.\n"), stderr);
|
||||
offline = 1;
|
||||
}
|
||||
else if (errno == EINTR && total_bytes == 0)
|
||||
@@ -321,7 +321,7 @@ backendRunLoop(
|
||||
if (paperout != 1)
|
||||
{
|
||||
fputs("STATE: +media-empty-error\n", stderr);
|
||||
_cupsLangPuts(stderr, _("ERROR: Out of paper!\n"));
|
||||
fputs(_("ERROR: Out of paper!\n"), stderr);
|
||||
paperout = 1;
|
||||
}
|
||||
}
|
||||
@@ -330,7 +330,7 @@ backendRunLoop(
|
||||
if (offline != 1)
|
||||
{
|
||||
fputs("STATE: +offline-error\n", stderr);
|
||||
_cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n"));
|
||||
fputs(_("INFO: Printer is currently off-line.\n"), stderr);
|
||||
offline = 1;
|
||||
}
|
||||
}
|
||||
@@ -352,7 +352,7 @@ backendRunLoop(
|
||||
if (offline)
|
||||
{
|
||||
fputs("STATE: -offline-error\n", stderr);
|
||||
_cupsLangPuts(stderr, _("INFO: Printer is now on-line.\n"));
|
||||
fputs(_("INFO: Printer is now on-line.\n"), stderr);
|
||||
offline = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,8 +96,7 @@ print_device(const char *resource, /* I - SCSI device */
|
||||
|
||||
if (strncmp(resource, "/dev/scsi/", 10) != 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Bad SCSI device file \"%s\"!\n"),
|
||||
resource);
|
||||
fprintf(stderr, _("ERROR: Bad SCSI device file \"%s\"!\n"), resource);
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
|
||||
@@ -120,9 +119,8 @@ print_device(const char *resource, /* I - SCSI device */
|
||||
* available printer in the class.
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"));
|
||||
fputs(_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"), stderr);
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
@@ -135,15 +133,13 @@ print_device(const char *resource, /* I - SCSI device */
|
||||
|
||||
if (errno != EAGAIN && errno != EBUSY)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open device file \"%s\": %s\n"),
|
||||
resource, strerror(errno));
|
||||
fprintf(stderr, _("ERROR: Unable to open device file \"%s\": %s\n"),
|
||||
resource, strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer busy; will retry in 30 seconds...\n"));
|
||||
fputs(_("INFO: Printer busy; will retry in 30 seconds...\n"), stderr);
|
||||
sleep(30);
|
||||
}
|
||||
}
|
||||
@@ -205,9 +201,9 @@ print_device(const char *resource, /* I - SCSI device */
|
||||
if (ioctl(scsi_fd, DS_ENTER, &scsi_req) < 0 ||
|
||||
scsi_req.ds_status != 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("WARNING: SCSI command timed out (%d); "
|
||||
"retrying...\n"), scsi_req.ds_status);
|
||||
fprintf(stderr,
|
||||
_("WARNING: SCSI command timed out (%d); retrying...\n"),
|
||||
scsi_req.ds_status);
|
||||
sleep(try + 1);
|
||||
}
|
||||
else
|
||||
@@ -215,8 +211,8 @@ print_device(const char *resource, /* I - SCSI device */
|
||||
|
||||
if (try >= 10)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to send print data (%d)\n"),
|
||||
scsi_req.ds_status);
|
||||
fprintf(stderr, _("ERROR: Unable to send print data (%d)\n"),
|
||||
scsi_req.ds_status);
|
||||
close(scsi_fd);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
@@ -110,8 +110,7 @@ print_device(const char *resource, /* I - SCSI device */
|
||||
|
||||
if (strncmp(resource, "/dev/sg", 7) != 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Bad SCSI device file \"%s\"!\n"),
|
||||
resource);
|
||||
fprintf(stderr, _("ERROR: Bad SCSI device file \"%s\"!\n"), resource);
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
|
||||
@@ -149,15 +148,13 @@ print_device(const char *resource, /* I - SCSI device */
|
||||
|
||||
if (errno != EAGAIN && errno != EBUSY)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open device file \"%s\": %s\n"),
|
||||
resource, strerror(errno));
|
||||
fprintf(stderr, _("ERROR: Unable to open device file \"%s\": %s\n"),
|
||||
resource, strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer busy; will retry in 30 seconds...\n"));
|
||||
fputs(_("INFO: Printer busy; will retry in 30 seconds...\n"), stderr);
|
||||
sleep(30);
|
||||
}
|
||||
}
|
||||
@@ -223,9 +220,9 @@ print_device(const char *resource, /* I - SCSI device */
|
||||
if (ioctl(scsi_fd, SG_IO, &scsi_req) < 0 ||
|
||||
scsi_req.status != 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("WARNING: SCSI command timed out (%d); "
|
||||
"retrying...\n"), scsi_req.status);
|
||||
fprintf(stderr,
|
||||
_("WARNING: SCSI command timed out (%d); retrying...\n"),
|
||||
scsi_req.status);
|
||||
sleep(try + 1);
|
||||
}
|
||||
else
|
||||
@@ -233,8 +230,8 @@ print_device(const char *resource, /* I - SCSI device */
|
||||
|
||||
if (try >= 10)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to send print data (%d)\n"),
|
||||
scsi_req.status);
|
||||
fprintf(stderr, _("ERROR: Unable to send print data (%d)\n"),
|
||||
scsi_req.status);
|
||||
close(scsi_fd);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
@@ -153,9 +153,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
}
|
||||
else if (argc < 6 || argc > 7)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,9 +104,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
username[255], /* Username info (not used) */
|
||||
resource[1024], /* Resource info (device and options) */
|
||||
*options, /* Pointer to options */
|
||||
*name, /* Name of option */
|
||||
*value, /* Value of option */
|
||||
sep; /* Option separator */
|
||||
name[255], /* Name of option */
|
||||
value[255], /* Value of option */
|
||||
*ptr; /* Pointer into name or value */
|
||||
int port; /* Port number (not used) */
|
||||
int copies; /* Number of copies to print */
|
||||
int print_fd, /* Print file */
|
||||
@@ -161,9 +161,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
}
|
||||
else if (argc < 6 || argc > 7)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
@@ -235,9 +234,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* available printer in the class.
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"));
|
||||
fputs(_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"), stderr);
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
@@ -250,15 +248,13 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
|
||||
if (errno == EBUSY)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer busy; will retry in 30 seconds...\n"));
|
||||
fputs(_("INFO: Printer busy; will retry in 30 seconds...\n"), stderr);
|
||||
sleep(30);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open device file \"%s\": %s\n"),
|
||||
resource, strerror(errno));
|
||||
fprintf(stderr, _("ERROR: Unable to open device file \"%s\": %s\n"),
|
||||
resource, strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -289,30 +285,29 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* Get the name...
|
||||
*/
|
||||
|
||||
name = options;
|
||||
for (ptr = name; *options && *options != '=';)
|
||||
if (ptr < (name + sizeof(name) - 1))
|
||||
*ptr++ = *options++;
|
||||
*ptr = '\0';
|
||||
|
||||
while (*options && *options != '=' && *options != '+' && *options != '&')
|
||||
options ++;
|
||||
|
||||
if ((sep = *options) != '\0')
|
||||
*options++ = '\0';
|
||||
|
||||
if (sep == '=')
|
||||
if (*options == '=')
|
||||
{
|
||||
/*
|
||||
* Get the value...
|
||||
*/
|
||||
|
||||
value = options;
|
||||
options ++;
|
||||
|
||||
while (*options && *options != '+' && *options != '&')
|
||||
for (ptr = value; *options && *options != '+' && *options != '&';)
|
||||
if (ptr < (value + sizeof(value) - 1))
|
||||
*ptr++ = *options++;
|
||||
*ptr = '\0';
|
||||
|
||||
if (*options == '+' || *options == '&')
|
||||
options ++;
|
||||
|
||||
if (*options)
|
||||
*options++ = '\0';
|
||||
}
|
||||
else
|
||||
value = (char *)"";
|
||||
value[0] = '\0';
|
||||
|
||||
/*
|
||||
* Process the option...
|
||||
@@ -375,8 +370,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
break;
|
||||
# endif /* B230400 */
|
||||
default :
|
||||
_cupsLangPrintf(stderr, _("WARNING: Unsupported baud rate %s!\n"),
|
||||
value);
|
||||
fprintf(stderr, _("WARNING: Unsupported baud rate %s!\n"),
|
||||
value);
|
||||
break;
|
||||
}
|
||||
#endif /* B19200 == 19200 */
|
||||
@@ -1252,8 +1247,7 @@ side_cb(int print_fd, /* I - Print file */
|
||||
|
||||
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("WARNING: Failed to read side-channel request!\n"));
|
||||
fputs(_("WARNING: Failed to read side-channel request!\n"), stderr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
username[255], /* Username info (not used) */
|
||||
resource[1024], /* Resource info (not used) */
|
||||
*options, /* Pointer to options */
|
||||
*name, /* Name of option */
|
||||
*value, /* Value of option */
|
||||
sep; /* Option separator */
|
||||
name[255], /* Name of option */
|
||||
value[255], /* Value of option */
|
||||
*ptr; /* Pointer into name or value */
|
||||
int print_fd; /* Print file */
|
||||
int copies; /* Number of copies to print */
|
||||
time_t start_time; /* Time of first connect */
|
||||
@@ -83,7 +83,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
int device_fd; /* AppSocket */
|
||||
int error; /* Error code (if any) */
|
||||
http_addrlist_t *addrlist, /* Address list */
|
||||
*addr; /* Connected address */
|
||||
*addr; /* Connected address */
|
||||
char addrname[256]; /* Address name */
|
||||
ssize_t tbytes; /* Total number of bytes written */
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
@@ -122,9 +122,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
}
|
||||
else if (argc < 6 || argc > 7)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
@@ -191,30 +190,29 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* Get the name...
|
||||
*/
|
||||
|
||||
name = options;
|
||||
for (ptr = name; *options && *options != '=';)
|
||||
if (ptr < (name + sizeof(name) - 1))
|
||||
*ptr++ = *options++;
|
||||
*ptr = '\0';
|
||||
|
||||
while (*options && *options != '=' && *options != '+' && *options != '&')
|
||||
options ++;
|
||||
|
||||
if ((sep = *options) != '\0')
|
||||
*options++ = '\0';
|
||||
|
||||
if (sep == '=')
|
||||
if (*options == '=')
|
||||
{
|
||||
/*
|
||||
* Get the value...
|
||||
*/
|
||||
|
||||
value = options;
|
||||
options ++;
|
||||
|
||||
while (*options && *options != '+' && *options != '&')
|
||||
for (ptr = value; *options && *options != '+' && *options != '&';)
|
||||
if (ptr < (value + sizeof(value) - 1))
|
||||
*ptr++ = *options++;
|
||||
*ptr = '\0';
|
||||
|
||||
if (*options == '+' || *options == '&')
|
||||
options ++;
|
||||
|
||||
if (*options)
|
||||
*options++ = '\0';
|
||||
}
|
||||
else
|
||||
value = (char *)"";
|
||||
value[0] = '\0';
|
||||
|
||||
/*
|
||||
* Process the option...
|
||||
@@ -252,14 +250,12 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
|
||||
if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
|
||||
hostname);
|
||||
fprintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"), hostname);
|
||||
return (CUPS_BACKEND_STOP);
|
||||
}
|
||||
|
||||
_cupsLangPrintf(stderr,
|
||||
_("INFO: Attempting to connect to host %s on port %d\n"),
|
||||
hostname, port);
|
||||
fprintf(stderr, _("INFO: Attempting to connect to host %s on port %d\n"),
|
||||
hostname, port);
|
||||
|
||||
fputs("STATE: +connecting-to-device\n", stderr);
|
||||
|
||||
@@ -279,9 +275,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* available printer in the class.
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"));
|
||||
fputs(_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"), stderr);
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
@@ -297,16 +292,16 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
{
|
||||
if (contimeout && (time(NULL) - start_time) > contimeout)
|
||||
{
|
||||
_cupsLangPuts(stderr, _("ERROR: Printer not responding!\n"));
|
||||
fputs(_("ERROR: Printer not responding!\n"), stderr);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
recoverable = 1;
|
||||
|
||||
_cupsLangPrintf(stderr,
|
||||
_("WARNING: recoverable: Network host \'%s\' is busy; "
|
||||
"will retry in %d seconds...\n"),
|
||||
hostname, delay);
|
||||
fprintf(stderr,
|
||||
_("WARNING: recoverable: Network host \'%s\' is busy; will "
|
||||
"retry in %d seconds...\n"),
|
||||
hostname, delay);
|
||||
|
||||
sleep(delay);
|
||||
|
||||
@@ -317,11 +312,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
{
|
||||
recoverable = 1;
|
||||
|
||||
_cupsLangPrintf(stderr, "DEBUG: Connection error: %s\n",
|
||||
strerror(errno));
|
||||
_cupsLangPuts(stderr,
|
||||
_("ERROR: recoverable: Unable to connect to printer; "
|
||||
"will retry in 30 seconds...\n"));
|
||||
fprintf(stderr, "DEBUG: Connection error: %s\n", strerror(errno));
|
||||
fputs(_("ERROR: recoverable: Unable to connect to printer; will "
|
||||
"retry in 30 seconds...\n"), stderr);
|
||||
sleep(30);
|
||||
}
|
||||
}
|
||||
@@ -342,7 +335,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
}
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
_cupsLangPrintf(stderr, _("INFO: Connected to %s...\n"), hostname);
|
||||
fprintf(stderr, _("INFO: Connected to %s...\n"), hostname);
|
||||
|
||||
#ifdef AF_INET6
|
||||
if (addr->addr.addr.sa_family == AF_INET6)
|
||||
@@ -375,13 +368,13 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
tbytes = backendRunLoop(print_fd, device_fd, 1, side_cb);
|
||||
|
||||
if (print_fd != 0 && tbytes >= 0)
|
||||
_cupsLangPrintf(stderr,
|
||||
fprintf(stderr,
|
||||
#ifdef HAVE_LONG_LONG
|
||||
_("INFO: Sent print file, %lld bytes...\n"),
|
||||
_("INFO: Sent print file, %lld bytes...\n"),
|
||||
#else
|
||||
_("INFO: Sent print file, %ld bytes...\n"),
|
||||
_("INFO: Sent print file, %ld bytes...\n"),
|
||||
#endif /* HAVE_LONG_LONG */
|
||||
CUPS_LLCAST tbytes);
|
||||
CUPS_LLCAST tbytes);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -396,8 +389,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
* Shutdown the socket and wait for the other end to finish...
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Print file sent, waiting for printer to finish...\n"));
|
||||
fputs(_("INFO: Print file sent, waiting for printer to finish...\n"),
|
||||
stderr);
|
||||
|
||||
shutdown(device_fd, 1);
|
||||
|
||||
@@ -420,7 +413,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
close(print_fd);
|
||||
|
||||
if (tbytes >= 0)
|
||||
_cupsLangPuts(stderr, _("INFO: Ready to print.\n"));
|
||||
fputs(_("INFO: Ready to print.\n"), stderr);
|
||||
|
||||
return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
|
||||
}
|
||||
@@ -439,14 +432,13 @@ side_cb(int print_fd, /* I - Print file */
|
||||
cups_sc_status_t status; /* Request/response status */
|
||||
char data[2048]; /* Request/response data */
|
||||
int datalen; /* Request/response data size */
|
||||
const char *device_id; /* 1284DEVICEID env var */
|
||||
|
||||
|
||||
datalen = sizeof(data);
|
||||
|
||||
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
|
||||
{
|
||||
_cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
|
||||
fputs(_("WARNING: Failed to read side-channel request!\n"), stderr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -470,14 +462,6 @@ side_cb(int print_fd, /* I - Print file */
|
||||
datalen = 1;
|
||||
break;
|
||||
|
||||
case CUPS_SC_CMD_GET_DEVICE_ID :
|
||||
if ((device_id = getenv("1284DEVICEID")) != NULL)
|
||||
{
|
||||
strlcpy(data, device_id, sizeof(data));
|
||||
datalen = (int)strlen(data);
|
||||
break;
|
||||
}
|
||||
|
||||
default :
|
||||
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
|
||||
datalen = 0;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Copyright � 2005-2007 Apple Inc. All rights reserved.
|
||||
* Copyright © 2005-2007 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
|
||||
@@ -104,7 +104,6 @@
|
||||
* the printer after we've finished sending all the data
|
||||
*/
|
||||
#define WAIT_EOF_DELAY 7
|
||||
#define WAIT_SIDE_DELAY 3
|
||||
#define DEFAULT_TIMEOUT 60L
|
||||
|
||||
#define USB_INTERFACE_KIND CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID190)
|
||||
@@ -231,11 +230,6 @@ typedef struct globals_s
|
||||
Boolean wait_eof;
|
||||
int drain_output; /* Drain all pending output */
|
||||
int bidi_flag; /* 0=unidirectional, 1=bidirectional */
|
||||
|
||||
pthread_mutex_t sidechannel_thread_mutex;
|
||||
pthread_cond_t sidechannel_thread_cond;
|
||||
int sidechannel_thread_stop;
|
||||
int sidechannel_thread_done;
|
||||
} globals_t;
|
||||
|
||||
|
||||
@@ -267,7 +261,7 @@ static void copy_devicestring(io_service_t usbInterface, CFStringRef *deviceID,
|
||||
static void device_added(void *userdata, io_iterator_t iterator);
|
||||
static void get_device_id(cups_sc_status_t *status, char *data, int *datalen);
|
||||
static void iterate_printers(iterator_callback_t callBack, void *userdata);
|
||||
static void parse_options(char *options, char *serial, int serial_size, UInt32 *location, Boolean *wait_eof);
|
||||
static void parse_options(const char *options, char *serial, UInt32 *location, Boolean *wait_eof);
|
||||
static void release_deviceinfo(CFStringRef *make, CFStringRef *model, CFStringRef *serial);
|
||||
static void setup_cfLanguage(void);
|
||||
static void soft_reset();
|
||||
@@ -304,7 +298,7 @@ int /* O - Exit status */
|
||||
print_device(const char *uri, /* I - Device URI */
|
||||
const char *hostname, /* I - Hostname/manufacturer */
|
||||
const char *resource, /* I - Resource/modelname */
|
||||
char *options, /* I - Device options/serial number */
|
||||
const char *options, /* I - Device options/serial number */
|
||||
int print_fd, /* I - File descriptor to print */
|
||||
int copies, /* I - Copies to print */
|
||||
int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
@@ -313,8 +307,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
char serial[1024]; /* Serial number buffer */
|
||||
OSStatus status; /* Function results */
|
||||
pthread_t read_thread_id, /* Read thread */
|
||||
sidechannel_thread_id;/* Side-channel thread */
|
||||
int sidechannel_started = 0;/* Was the side-channel thread started? */
|
||||
sidechannel_thread_id;/* Side channel thread */
|
||||
char print_buffer[8192], /* Print data buffer */
|
||||
*print_ptr; /* Pointer into print data buffer */
|
||||
UInt32 location; /* Unique location in bus topology */
|
||||
@@ -328,10 +321,9 @@ print_device(const char *uri, /* I - Device URI */
|
||||
stimeout; /* Timeout for select() */
|
||||
struct timespec cond_timeout; /* pthread condition timeout */
|
||||
|
||||
|
||||
setup_cfLanguage();
|
||||
|
||||
parse_options(options, serial, sizeof(serial), &location, &g.wait_eof);
|
||||
parse_options(options, serial, &location, &g.wait_eof);
|
||||
|
||||
if (resource[0] == '/')
|
||||
resource++;
|
||||
@@ -389,7 +381,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
strlcpy(print_buffer, "USB class driver", sizeof(print_buffer));
|
||||
|
||||
fputs("STATE: +apple-missing-usbclassdriver-error\n", stderr);
|
||||
_cupsLangPrintf(stderr, _("FATAL: Could not load %s\n"), print_buffer);
|
||||
fprintf(stderr, _("FATAL: Could not load %s\n"), print_buffer);
|
||||
|
||||
if (driverBundlePath)
|
||||
CFRelease(driverBundlePath);
|
||||
@@ -406,8 +398,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
countdown -= PRINTER_POLLING_INTERVAL;
|
||||
if (countdown <= 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("INFO: Printer busy (status:0x%08x)\n"),
|
||||
(int)status);
|
||||
fprintf(stderr, _("INFO: Printer busy (status:0x%08x)\n"), (int)status);
|
||||
countdown = SUBSEQUENT_LOG_INTERVAL; /* subsequent log entries, every 15 seconds */
|
||||
}
|
||||
}
|
||||
@@ -451,19 +442,11 @@ print_device(const char *uri, /* I - Device URI */
|
||||
|
||||
if ((select(CUPS_SC_FD+1, &input_set, NULL, NULL, &stimeout)) >= 0)
|
||||
{
|
||||
g.sidechannel_thread_stop = 0;
|
||||
g.sidechannel_thread_done = 0;
|
||||
|
||||
pthread_cond_init(&g.sidechannel_thread_cond, NULL);
|
||||
pthread_mutex_init(&g.sidechannel_thread_mutex, NULL);
|
||||
|
||||
if (pthread_create(&sidechannel_thread_id, NULL, sidechannel_thread, NULL))
|
||||
{
|
||||
_cupsLangPuts(stderr, _("WARNING: Couldn't create side channel\n"));
|
||||
fputs(_("WARNING: Couldn't create side channel\n"), stderr);
|
||||
return CUPS_BACKEND_STOP;
|
||||
}
|
||||
|
||||
sidechannel_started = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -478,7 +461,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
|
||||
if (pthread_create(&read_thread_id, NULL, read_thread, NULL))
|
||||
{
|
||||
_cupsLangPuts(stderr, _("WARNING: Couldn't create read channel\n"));
|
||||
fputs(_("WARNING: Couldn't create read channel\n"), stderr);
|
||||
return CUPS_BACKEND_STOP;
|
||||
}
|
||||
|
||||
@@ -493,7 +476,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
|
||||
while (status == noErr && copies-- > 0)
|
||||
{
|
||||
_cupsLangPuts(stderr, _("INFO: Sending data\n"));
|
||||
fputs(_("INFO: Sending data\n"), stderr);
|
||||
|
||||
if (print_fd != STDIN_FILENO)
|
||||
{
|
||||
@@ -561,7 +544,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
}
|
||||
else if (errno != EAGAIN)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: select() returned %d\n"), (int)errno);
|
||||
fprintf(stderr, _("ERROR: select() returned %d\n"), (int)errno);
|
||||
return CUPS_BACKEND_STOP;
|
||||
}
|
||||
}
|
||||
@@ -637,10 +620,8 @@ print_device(const char *uri, /* I - Device URI */
|
||||
*/
|
||||
|
||||
OSStatus err = (*g.classdriver)->Abort(g.classdriver);
|
||||
_cupsLangPrintf(stderr, _("ERROR: %ld: (canceled:%ld)\n"),
|
||||
(long)status, (long)err);
|
||||
status = CUPS_BACKEND_STOP;
|
||||
break;
|
||||
fprintf(stderr, _("ERROR: %ld: (canceled:%ld)\n"), (long)status, (long)err);
|
||||
return CUPS_BACKEND_STOP;
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n", (int)bytes);
|
||||
@@ -662,42 +643,13 @@ print_device(const char *uri, /* I - Device URI */
|
||||
* Wait for the side channel thread to exit...
|
||||
*/
|
||||
|
||||
if (sidechannel_started)
|
||||
{
|
||||
close(CUPS_SC_FD);
|
||||
pthread_mutex_lock(&g.readwrite_lock_mutex);
|
||||
g.readwrite_lock = 0;
|
||||
pthread_cond_signal(&g.readwrite_lock_cond);
|
||||
pthread_mutex_unlock(&g.readwrite_lock_mutex);
|
||||
close(CUPS_SC_FD);
|
||||
pthread_mutex_lock(&g.readwrite_lock_mutex);
|
||||
g.readwrite_lock = 0;
|
||||
pthread_cond_signal(&g.readwrite_lock_cond);
|
||||
pthread_mutex_unlock(&g.readwrite_lock_mutex);
|
||||
|
||||
g.sidechannel_thread_stop = 1;
|
||||
pthread_mutex_lock(&g.sidechannel_thread_mutex);
|
||||
if (!g.sidechannel_thread_done)
|
||||
{
|
||||
/*
|
||||
* Wait for the side-channel thread to exit...
|
||||
*/
|
||||
|
||||
cond_timeout.tv_sec = time(NULL) + WAIT_SIDE_DELAY;
|
||||
cond_timeout.tv_nsec = 0;
|
||||
if (pthread_cond_timedwait(&g.sidechannel_thread_cond,
|
||||
&g.sidechannel_thread_mutex,
|
||||
&cond_timeout) != 0)
|
||||
{
|
||||
/*
|
||||
* Force the side-channel thread to exit...
|
||||
*/
|
||||
|
||||
pthread_kill(sidechannel_thread_id, SIGTERM);
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&g.sidechannel_thread_mutex);
|
||||
|
||||
pthread_join(sidechannel_thread_id, NULL);
|
||||
|
||||
pthread_cond_destroy(&g.sidechannel_thread_cond);
|
||||
pthread_mutex_destroy(&g.sidechannel_thread_mutex);
|
||||
}
|
||||
pthread_join(sidechannel_thread_id, NULL);
|
||||
|
||||
pthread_cond_destroy(&g.readwrite_lock_cond);
|
||||
pthread_mutex_destroy(&g.readwrite_lock_mutex);
|
||||
@@ -710,7 +662,9 @@ print_device(const char *uri, /* I - Device URI */
|
||||
|
||||
/*
|
||||
* Give the read thread WAIT_EOF_DELAY seconds to complete all the data. If
|
||||
* we are not signaled in that time then force the thread to exit.
|
||||
* we are not signaled in that time then force the thread to exit by setting
|
||||
* the waiteof to be false. Plese note that this relies on us using the timeout
|
||||
* class driver.
|
||||
*/
|
||||
|
||||
pthread_mutex_lock(&g.read_thread_mutex);
|
||||
@@ -720,15 +674,8 @@ print_device(const char *uri, /* I - Device URI */
|
||||
cond_timeout.tv_sec = time(NULL) + WAIT_EOF_DELAY;
|
||||
cond_timeout.tv_nsec = 0;
|
||||
|
||||
if (pthread_cond_timedwait(&g.read_thread_cond, &g.read_thread_mutex,
|
||||
&cond_timeout) != 0)
|
||||
{
|
||||
/*
|
||||
* Force the read thread to exit...
|
||||
*/
|
||||
|
||||
pthread_kill(read_thread_id, SIGTERM);
|
||||
}
|
||||
if (pthread_cond_timedwait(&g.read_thread_cond, &g.read_thread_mutex, &cond_timeout) != 0)
|
||||
g.wait_eof = false;
|
||||
}
|
||||
pthread_mutex_unlock(&g.read_thread_mutex);
|
||||
|
||||
@@ -841,27 +788,18 @@ sidechannel_thread(void *reference)
|
||||
char data[2048]; /* Request/response data */
|
||||
int datalen; /* Request/response data size */
|
||||
|
||||
|
||||
do
|
||||
for (;;)
|
||||
{
|
||||
datalen = sizeof(data);
|
||||
|
||||
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
|
||||
continue;
|
||||
break;
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case CUPS_SC_CMD_SOFT_RESET: /* Do a soft reset */
|
||||
if ((*g.classdriver)->SoftReset != NULL)
|
||||
{
|
||||
soft_reset();
|
||||
cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, NULL, 0, 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
cupsSideChannelWrite(command, CUPS_SC_STATUS_NOT_IMPLEMENTED,
|
||||
NULL, 0, 1.0);
|
||||
}
|
||||
soft_reset();
|
||||
cupsSideChannelWrite(command, CUPS_SC_STATUS_OK, NULL, 0, 1.0);
|
||||
break;
|
||||
|
||||
case CUPS_SC_CMD_DRAIN_OUTPUT: /* Drain all pending output */
|
||||
@@ -890,13 +828,6 @@ sidechannel_thread(void *reference)
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (!g.sidechannel_thread_stop);
|
||||
|
||||
pthread_mutex_lock(&g.sidechannel_thread_mutex);
|
||||
g.sidechannel_thread_done = 1;
|
||||
pthread_cond_signal(&g.sidechannel_thread_cond);
|
||||
pthread_mutex_unlock(&g.sidechannel_thread_mutex);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1124,7 +1055,7 @@ static Boolean find_device_cb(void *refcon,
|
||||
if (!keepLooking && g.status_timer != NULL)
|
||||
{
|
||||
fputs("STATE: -offline-error\n", stderr);
|
||||
_cupsLangPuts(stderr, _("INFO: Printer is now on-line.\n"));
|
||||
fputs(_("INFO: Printer is now on-line.\n"), stderr);
|
||||
CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), g.status_timer, kCFRunLoopDefaultMode);
|
||||
CFRelease(g.status_timer);
|
||||
g.status_timer = NULL;
|
||||
@@ -1142,7 +1073,7 @@ static void status_timer_cb(CFRunLoopTimerRef timer,
|
||||
void *info)
|
||||
{
|
||||
fputs("STATE: +offline-error\n", stderr);
|
||||
_cupsLangPuts(stderr, _("INFO: Printer is currently off-line.\n"));
|
||||
fputs(_("INFO: Printer is currently off-line.\n"), stderr);
|
||||
}
|
||||
|
||||
|
||||
@@ -1574,19 +1505,18 @@ CFStringRef cfstr_create_trim(const char *cstr)
|
||||
|
||||
#pragma mark -
|
||||
/*
|
||||
* 'parse_options()' - Parse URI options.
|
||||
* 'parse_options()' - Parse uri options.
|
||||
*/
|
||||
|
||||
static void parse_options(char *options,
|
||||
static void parse_options(const char *options,
|
||||
char *serial,
|
||||
int serial_size,
|
||||
UInt32 *location,
|
||||
Boolean *wait_eof)
|
||||
{
|
||||
char sep, /* Separator character */
|
||||
*name, /* Name of option */
|
||||
*value; /* Value of option */
|
||||
|
||||
char *serialnumber; /* ?serial=<serial> or ?location=<location> */
|
||||
char optionName[255], /* Name of option */
|
||||
value[255], /* Value of option */
|
||||
*ptr; /* Pointer into name or value */
|
||||
|
||||
if (serial)
|
||||
*serial = '\0';
|
||||
@@ -1596,61 +1526,59 @@ static void parse_options(char *options,
|
||||
if (!options)
|
||||
return;
|
||||
|
||||
while (*options)
|
||||
serialnumber = NULL;
|
||||
|
||||
while (*options != '\0')
|
||||
{
|
||||
/*
|
||||
* Get the name...
|
||||
*/
|
||||
/* Get the name... */
|
||||
for (ptr = optionName; *options && *options != '=' && *options != '+';)
|
||||
*ptr++ = *options++;
|
||||
|
||||
name = options;
|
||||
*ptr = '\0';
|
||||
value[0] = '\0';
|
||||
|
||||
while (*options && *options != '=' && *options != '+' && *options != '&')
|
||||
if (*options == '=')
|
||||
{
|
||||
/* Get the value... */
|
||||
options ++;
|
||||
|
||||
if ((sep = *options) != '\0')
|
||||
*options++ = '\0';
|
||||
for (ptr = value; *options && *options != '+';)
|
||||
*ptr++ = *options++;
|
||||
|
||||
if (sep == '=')
|
||||
{
|
||||
/*
|
||||
* Get the value...
|
||||
*/
|
||||
*ptr = '\0';
|
||||
|
||||
value = options;
|
||||
|
||||
while (*options && *options != '+' && *options != '&')
|
||||
if (*options == '+')
|
||||
options ++;
|
||||
|
||||
if (*options)
|
||||
*options++ = '\0';
|
||||
}
|
||||
else
|
||||
value = (char *)"";
|
||||
else if (*options == '+')
|
||||
options ++;
|
||||
|
||||
/*
|
||||
* Process the option...
|
||||
*/
|
||||
|
||||
if (!strcasecmp(name, "waiteof"))
|
||||
/*
|
||||
* Process the option...
|
||||
*/
|
||||
if (strcasecmp(optionName, "waiteof") == 0)
|
||||
{
|
||||
if (!strcasecmp(value, "on") ||
|
||||
!strcasecmp(value, "yes") ||
|
||||
!strcasecmp(value, "true"))
|
||||
if (strcasecmp(value, "on") == 0 ||
|
||||
strcasecmp(value, "yes") == 0 ||
|
||||
strcasecmp(value, "true") == 0)
|
||||
*wait_eof = true;
|
||||
else if (!strcasecmp(value, "off") ||
|
||||
!strcasecmp(value, "no") ||
|
||||
!strcasecmp(value, "false"))
|
||||
else if (strcasecmp(value, "off") == 0 ||
|
||||
strcasecmp(value, "no") == 0 ||
|
||||
strcasecmp(value, "false") == 0)
|
||||
*wait_eof = false;
|
||||
else
|
||||
_cupsLangPrintf(stderr,
|
||||
_("WARNING: Boolean expected for waiteof option "
|
||||
"\"%s\"\n"), value);
|
||||
fprintf(stderr, _("WARNING: Boolean expected for waiteof option \"%s\"\n"), value);
|
||||
}
|
||||
else if (!strcasecmp(name, "serial"))
|
||||
strlcpy(serial, value, serial_size);
|
||||
else if (!strcasecmp(name, "location") && location)
|
||||
else if (strcasecmp(optionName, "serial") == 0)
|
||||
{
|
||||
strcpy(serial, value);
|
||||
serialnumber = serial;
|
||||
}
|
||||
else if (strcasecmp(optionName, "location") == 0 && location)
|
||||
*location = strtol(value, NULL, 16);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1924,7 +1852,7 @@ static void parse_pserror(char *sockBuffer,
|
||||
|
||||
|
||||
/*
|
||||
* 'soft_reset()' - Send a soft reset to the device.
|
||||
* 'soft_reset'
|
||||
*/
|
||||
|
||||
static void soft_reset()
|
||||
|
||||
@@ -48,7 +48,7 @@ int /* O - Exit status */
|
||||
print_device(const char *uri, /* I - Device URI */
|
||||
const char *hostname, /* I - Hostname/manufacturer */
|
||||
const char *resource, /* I - Resource/modelname */
|
||||
char *options, /* I - Device options/serial number */
|
||||
const char *options, /* I - Device options/serial number */
|
||||
int print_fd, /* I - File descriptor to print */
|
||||
int copies, /* I - Copies to print */
|
||||
int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
@@ -105,9 +105,8 @@ print_device(const char *uri, /* I - Device URI */
|
||||
* available printer in the class.
|
||||
*/
|
||||
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"));
|
||||
fputs(_("INFO: Unable to contact printer, queuing on next "
|
||||
"printer in class...\n"), stderr);
|
||||
|
||||
/*
|
||||
* Sleep 5 seconds to keep the job from requeuing too rapidly...
|
||||
@@ -120,23 +119,20 @@ print_device(const char *uri, /* I - Device URI */
|
||||
|
||||
if (errno == EBUSY)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer busy; will retry in 10 seconds...\n"));
|
||||
fputs(_("INFO: Printer busy; will retry in 10 seconds...\n"), stderr);
|
||||
sleep(10);
|
||||
}
|
||||
else if (errno == ENXIO || errno == EIO || errno == ENOENT ||
|
||||
errno == ENODEV)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer not connected; will retry in 30 "
|
||||
"seconds...\n"));
|
||||
fputs(_("INFO: Printer not connected; will retry in 30 seconds...\n"),
|
||||
stderr);
|
||||
sleep(30);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("ERROR: Unable to open device file \"%s\": %s\n"),
|
||||
resource, strerror(errno));
|
||||
fprintf(stderr, _("ERROR: Unable to open device file \"%s\": %s\n"),
|
||||
resource, strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -176,13 +172,13 @@ print_device(const char *uri, /* I - Device URI */
|
||||
tbytes = backendRunLoop(print_fd, device_fd, use_bc, side_cb);
|
||||
|
||||
if (print_fd != 0 && tbytes >= 0)
|
||||
_cupsLangPrintf(stderr,
|
||||
fprintf(stderr,
|
||||
#ifdef HAVE_LONG_LONG
|
||||
_("INFO: Sent print file, %lld bytes...\n"),
|
||||
_("INFO: Sent print file, %lld bytes...\n"),
|
||||
#else
|
||||
_("INFO: Sent print file, %ld bytes...\n"),
|
||||
_("INFO: Sent print file, %ld bytes...\n"),
|
||||
#endif /* HAVE_LONG_LONG */
|
||||
CUPS_LLCAST tbytes);
|
||||
CUPS_LLCAST tbytes);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -415,8 +411,8 @@ open_device(const char *uri, /* I - Device URI */
|
||||
|
||||
if (busy)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer busy; will retry in 5 seconds...\n"));
|
||||
fputs(_("INFO: Printer busy; will retry in 5 seconds...\n"),
|
||||
stderr);
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
@@ -508,8 +504,8 @@ open_device(const char *uri, /* I - Device URI */
|
||||
|
||||
if (busy)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("INFO: Printer is busy; will retry in 5 seconds...\n"));
|
||||
fputs(_("INFO: Printer is busy; will retry in 5 seconds...\n"),
|
||||
stderr);
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
@@ -566,7 +562,7 @@ side_cb(int print_fd, /* I - Print file */
|
||||
|
||||
if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0))
|
||||
{
|
||||
_cupsLangPuts(stderr, _("WARNING: Failed to read side-channel request!\n"));
|
||||
fputs(_("WARNING: Failed to read side-channel request!\n"), stderr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
void list_devices(void);
|
||||
int print_device(const char *uri, const char *hostname,
|
||||
const char *resource, char *options,
|
||||
const char *resource, const char *options,
|
||||
int print_fd, int copies, int argc, char *argv[]);
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ int /* O - Exit status */
|
||||
print_device(const char *uri, /* I - Device URI */
|
||||
const char *hostname, /* I - Hostname/manufacturer */
|
||||
const char *resource, /* I - Resource/modelname */
|
||||
char *options, /* I - Device options/serial number */
|
||||
const char *options, /* I - Device options/serial number */
|
||||
int print_fd, /* I - File descriptor to print */
|
||||
int copies, /* I - Copies to print */
|
||||
int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
@@ -184,9 +184,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
}
|
||||
else if (argc < 6 || argc > 7)
|
||||
{
|
||||
_cupsLangPrintf(stderr,
|
||||
_("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"),
|
||||
argv[0]);
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
@@ -201,9 +200,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
hostname, sizeof(hostname), &port,
|
||||
resource, sizeof(resource)) < HTTP_URI_OK)
|
||||
{
|
||||
_cupsLangPuts(stderr,
|
||||
_("ERROR: No device URI found in argv[0] or in DEVICE_URI "
|
||||
"environment variable!\n"));
|
||||
fputs(_("ERROR: No device URI found in argv[0] or in DEVICE_URI "
|
||||
"environment variable!\n"), stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -239,8 +237,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
|
||||
if ((print_fd = open(argv[6], O_RDONLY)) < 0)
|
||||
{
|
||||
_cupsLangPrintf(stderr, _("ERROR: Unable to open print file %s - %s\n"),
|
||||
argv[6], strerror(errno));
|
||||
fprintf(stderr, _("ERROR: Unable to open print file %s - %s\n"),
|
||||
argv[6], strerror(errno));
|
||||
return (CUPS_BACKEND_FAILED);
|
||||
}
|
||||
|
||||
|
||||
@@ -165,8 +165,7 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
do_printer_op(http, CUPS_SET_DEFAULT, cgiText(_("Set As Default")));
|
||||
else if (!strcmp(op, "set-sharing"))
|
||||
do_set_sharing(http);
|
||||
else if (!strcmp(op, "find-new-printers") ||
|
||||
!strcmp(op, "list-available-printers"))
|
||||
else if (!strcmp(op, "list-available-printers"))
|
||||
do_list_printers(http);
|
||||
else if (!strcmp(op, "add-class"))
|
||||
do_am_class(http, 0);
|
||||
@@ -367,12 +366,7 @@ do_add_rss_subscription(http_t *http) /* I - HTTP connection */
|
||||
|
||||
ippDelete(cupsDoRequest(http, request, "/"));
|
||||
|
||||
if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(_("Add RSS Subscription"));
|
||||
cgiShowIPPError(_("Unable to add RSS subscription:"));
|
||||
@@ -633,12 +627,7 @@ do_am_class(http_t *http, /* I - HTTP connection */
|
||||
|
||||
ippDelete(cupsDoRequest(http, request, "/admin/"));
|
||||
|
||||
if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(title);
|
||||
cgiShowIPPError(modify ? _("Unable to modify class:") :
|
||||
@@ -1190,12 +1179,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
|
||||
else
|
||||
ippDelete(cupsDoRequest(http, request, "/admin/"));
|
||||
|
||||
if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(title);
|
||||
cgiShowIPPError(modify ? _("Unable to modify printer:") :
|
||||
@@ -1287,12 +1271,7 @@ do_cancel_subscription(http_t *http)/* I - HTTP connection */
|
||||
|
||||
ippDelete(cupsDoRequest(http, request, "/"));
|
||||
|
||||
if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(_("Cancel RSS Subscription"));
|
||||
cgiShowIPPError(_("Unable to cancel RSS subscription:"));
|
||||
@@ -1420,12 +1399,6 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
|
||||
if (!cupsAdminSetServerSettings(http, num_settings, settings))
|
||||
{
|
||||
if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
cgiStartHTML(cgiText(_("Change Settings")));
|
||||
cgiSetVariable("MESSAGE",
|
||||
cgiText(_("Unable to change server settings:")));
|
||||
@@ -1528,13 +1501,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
|
||||
status = cupsPutFile(http, "/admin/conf/cupsd.conf", tempfile);
|
||||
|
||||
if (status == HTTP_UNAUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
unlink(tempfile);
|
||||
exit(0);
|
||||
}
|
||||
else if (status != HTTP_CREATED)
|
||||
if (status != HTTP_CREATED)
|
||||
{
|
||||
cgiSetVariable("MESSAGE",
|
||||
cgiText(_("Unable to upload cupsd.conf file:")));
|
||||
@@ -1559,10 +1526,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
{
|
||||
struct stat info; /* cupsd.conf information */
|
||||
cups_file_t *cupsd; /* cupsd.conf file */
|
||||
char *buffer, /* Buffer for entire file */
|
||||
*bufptr, /* Pointer into buffer */
|
||||
*bufend; /* End of buffer */
|
||||
int ch; /* Character from file */
|
||||
char *buffer; /* Buffer for entire file */
|
||||
char filename[1024]; /* Filename */
|
||||
const char *server_root; /* Location of config files */
|
||||
|
||||
@@ -1642,55 +1606,14 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
||||
cgiSetVariable("CUPSDCONF", buffer);
|
||||
free(buffer);
|
||||
|
||||
/*
|
||||
* Then get the default cupsd.conf file and put that into a string as
|
||||
* well...
|
||||
*/
|
||||
|
||||
strlcat(filename, ".default", sizeof(filename));
|
||||
|
||||
if (!stat(filename, &info) && info.st_size < (1024 * 1024) &&
|
||||
(cupsd = cupsFileOpen(filename, "r")) != NULL)
|
||||
{
|
||||
buffer = calloc(1, 2 * info.st_size + 1);
|
||||
bufend = buffer + 2 * info.st_size - 1;
|
||||
|
||||
for (bufptr = buffer;
|
||||
bufptr < bufend && (ch = cupsFileGetChar(cupsd)) != EOF;)
|
||||
{
|
||||
if (ch == '\\' || ch == '\"')
|
||||
{
|
||||
*bufptr++ = '\\';
|
||||
*bufptr++ = ch;
|
||||
}
|
||||
else if (ch == '\n')
|
||||
{
|
||||
*bufptr++ = '\\';
|
||||
*bufptr++ = 'n';
|
||||
}
|
||||
else if (ch == '\t')
|
||||
{
|
||||
*bufptr++ = '\\';
|
||||
*bufptr++ = 't';
|
||||
}
|
||||
else if (ch >= ' ')
|
||||
*bufptr++ = ch;
|
||||
}
|
||||
|
||||
*bufptr = '\0';
|
||||
|
||||
cupsFileClose(cupsd);
|
||||
|
||||
cgiSetVariable("CUPSDCONF_DEFAULT", buffer);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Show the current config file...
|
||||
*/
|
||||
|
||||
cgiStartHTML(cgiText(_("Edit Configuration File")));
|
||||
|
||||
printf("<!-- \"%s\" -->\n", filename);
|
||||
|
||||
cgiCopyTemplateLang("edit-config.tmpl");
|
||||
|
||||
cgiEndHTML();
|
||||
@@ -1758,12 +1681,7 @@ do_delete_class(http_t *http) /* I - HTTP connection */
|
||||
* Show the results...
|
||||
*/
|
||||
|
||||
if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
else if (cupsLastError() <= IPP_OK_CONFLICT)
|
||||
if (cupsLastError() <= IPP_OK_CONFLICT)
|
||||
{
|
||||
/*
|
||||
* Redirect successful updates back to the classes page...
|
||||
@@ -1843,12 +1761,7 @@ do_delete_printer(http_t *http) /* I - HTTP connection */
|
||||
* Show the results...
|
||||
*/
|
||||
|
||||
if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
else if (cupsLastError() <= IPP_OK_CONFLICT)
|
||||
if (cupsLastError() <= IPP_OK_CONFLICT)
|
||||
{
|
||||
/*
|
||||
* Redirect successful updates back to the printers page...
|
||||
@@ -2412,12 +2325,7 @@ do_printer_op(http_t *http, /* I - HTTP connection */
|
||||
|
||||
ippDelete(cupsDoRequest(http, request, "/admin/"));
|
||||
|
||||
if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(title);
|
||||
cgiShowIPPError(_("Unable to change printer:"));
|
||||
@@ -2538,12 +2446,7 @@ do_set_allowed_users(http_t *http) /* I - HTTP connection */
|
||||
|
||||
cgiStartHTML(cgiText(_("Set Allowed Users")));
|
||||
|
||||
if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
cgiShowIPPError(_("Unable to get printer attributes:"));
|
||||
else
|
||||
cgiCopyTemplateLang("users.tmpl");
|
||||
@@ -2680,12 +2583,7 @@ do_set_allowed_users(http_t *http) /* I - HTTP connection */
|
||||
|
||||
ippDelete(cupsDoRequest(http, request, "/admin/"));
|
||||
|
||||
if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Set Allowed Users")));
|
||||
cgiShowIPPError(_("Unable to change printer:"));
|
||||
@@ -3229,12 +3127,7 @@ do_set_options(http_t *http, /* I - HTTP connection */
|
||||
else
|
||||
ippDelete(cupsDoRequest(http, request, "/admin/"));
|
||||
|
||||
if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(title);
|
||||
cgiShowIPPError(_("Unable to set options:"));
|
||||
@@ -3328,12 +3221,7 @@ do_set_sharing(http_t *http) /* I - HTTP connection */
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
if (cupsLastError() == IPP_NOT_AUTHORIZED)
|
||||
{
|
||||
puts("Status: 401\n");
|
||||
exit(0);
|
||||
}
|
||||
else if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
if (cupsLastError() > IPP_OK_CONFLICT)
|
||||
{
|
||||
cgiStartHTML(cgiText(_("Set Publishing")));
|
||||
cgiShowIPPError(_("Unable to change printer-is-shared attribute:"));
|
||||
|
||||
@@ -151,7 +151,6 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
|
||||
cgiSetVariable("HELPFILE", helpfile);
|
||||
cgiSetVariable("HELPTITLE", n->text);
|
||||
cgiSetVariable("TOPIC", n->section);
|
||||
|
||||
/*
|
||||
* Send a standard page header...
|
||||
|
||||
@@ -50,7 +50,7 @@ cgiCopyTemplateFile(FILE *out, /* I - Output file */
|
||||
FILE *in; /* Input file */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG2: cgiCopyTemplateFile(out=%p, tmpl=\"%s\")\n", out,
|
||||
fprintf(stderr, "DEBUG: cgiCopyTemplateFile(out=%p, tmpl=\"%s\")\n", out,
|
||||
tmpl ? tmpl : "(null)");
|
||||
|
||||
/*
|
||||
@@ -85,34 +85,37 @@ cgiCopyTemplateFile(FILE *out, /* I - Output file */
|
||||
void
|
||||
cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
char filename[1024], /* Filename */
|
||||
locale[16], /* Locale name */
|
||||
*locptr; /* Pointer into locale name */
|
||||
locale[16]; /* Locale name */
|
||||
const char *directory, /* Directory for templates */
|
||||
*lang; /* Language */
|
||||
FILE *in; /* Input file */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG2: cgiCopyTemplateLang(tmpl=\"%s\")\n",
|
||||
fprintf(stderr, "DEBUG: cgiCopyTemplateLang(tmpl=\"%s\")\n",
|
||||
tmpl ? tmpl : "(null)");
|
||||
|
||||
/*
|
||||
* Convert the language to a locale name...
|
||||
*/
|
||||
|
||||
locale[0] = '\0';
|
||||
|
||||
if ((lang = getenv("LANG")) != NULL)
|
||||
{
|
||||
locale[0] = '/';
|
||||
strlcpy(locale + 1, lang, sizeof(locale) - 1);
|
||||
for (i = 0; lang[i] && i < 15; i ++)
|
||||
if (isalnum(lang[i] & 255) || lang[i] == '_')
|
||||
locale[i] = tolower(lang[i]);
|
||||
else if (lang[i] == '-')
|
||||
locale[i] = '_';
|
||||
else
|
||||
break;
|
||||
|
||||
if ((locptr = strchr(locale, '.')) != NULL)
|
||||
*locptr = '\0'; /* Strip charset */
|
||||
locale[i] = '\0';
|
||||
}
|
||||
else
|
||||
locale[0] = '\0';
|
||||
|
||||
fprintf(stderr, "DEBUG: lang=\"%s\", locale=\"%s\"...\n",
|
||||
lang ? lang : "(null)", locale);
|
||||
fprintf(stderr, "DEBUG: locale=\"%s\"...\n", locale);
|
||||
|
||||
/*
|
||||
* See if we have a template file for this language...
|
||||
@@ -120,26 +123,23 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
|
||||
|
||||
directory = cgiGetTemplateDir();
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s%s/%s", directory, locale, tmpl);
|
||||
if ((in = fopen(filename, "r")) == NULL)
|
||||
snprintf(filename, sizeof(filename), "%s/%s/%s", directory, locale, tmpl);
|
||||
if (access(filename, 0))
|
||||
{
|
||||
locale[3] = '\0';
|
||||
locale[2] = '\0';
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s%s/%s", directory, locale, tmpl);
|
||||
if ((in = fopen(filename, "r")) == NULL)
|
||||
{
|
||||
snprintf(filename, sizeof(filename), "%s/%s/%s", directory, locale, tmpl);
|
||||
if (access(filename, 0))
|
||||
snprintf(filename, sizeof(filename), "%s/%s", directory, tmpl);
|
||||
in = fopen(filename, "r");
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG2: Template file is \"%s\"...\n", filename);
|
||||
fprintf(stderr, "DEBUG: Template file is \"%s\"...\n", filename);
|
||||
|
||||
/*
|
||||
* Open the template file...
|
||||
*/
|
||||
|
||||
if (!in)
|
||||
if ((in = fopen(filename, "r")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Unable to open template file \"%s\" - %s\n",
|
||||
filename, strerror(errno));
|
||||
@@ -231,7 +231,7 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
int uriencode; /* Encode as URI */
|
||||
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sStarting at file position %ld...\n", indent, "",
|
||||
fprintf(stderr, "DEBUG: %*sStarting at file position %ld...\n", indent, "",
|
||||
ftell(in));
|
||||
|
||||
/*
|
||||
@@ -263,7 +263,7 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
|
||||
if (s == name && isspace(ch & 255))
|
||||
{
|
||||
fprintf(stderr, "DEBUG2: %*sLone { at %ld...\n", indent, "", ftell(in));
|
||||
fprintf(stderr, "DEBUG: %*sLone { at %ld...\n", indent, "", ftell(in));
|
||||
|
||||
if (out)
|
||||
{
|
||||
@@ -275,7 +275,7 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
}
|
||||
|
||||
if (ch == '}')
|
||||
fprintf(stderr, "DEBUG2: %*s\"{%s}\" at %ld...\n", indent, "", name,
|
||||
fprintf(stderr, "DEBUG: %*s\"{%s}\" at %ld...\n", indent, "", name,
|
||||
ftell(in));
|
||||
|
||||
/*
|
||||
@@ -339,7 +339,7 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
|
||||
pos = ftell(in);
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sLooping on \"%s\" at %ld, count=%d...\n",
|
||||
fprintf(stderr, "DEBUG: %*sLooping on \"%s\" at %ld, count=%d...\n",
|
||||
indent, "", name + 1, pos, count);
|
||||
|
||||
if (count > 0)
|
||||
@@ -355,7 +355,7 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
else
|
||||
cgi_copy(NULL, in, 0, '}', indent + 2);
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sFinished looping on \"%s\"...\n", indent,
|
||||
fprintf(stderr, "DEBUG: %*sFinished looping on \"%s\"...\n", indent,
|
||||
"", name + 1);
|
||||
|
||||
continue;
|
||||
@@ -400,8 +400,6 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
{
|
||||
if (uriencode)
|
||||
cgi_puturi(outptr, out);
|
||||
else if (!strcasecmp(name, "?cupsdconf_default"))
|
||||
fputs(outptr, stdout);
|
||||
else
|
||||
cgi_puts(outptr, out);
|
||||
}
|
||||
@@ -493,7 +491,7 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
if (ch != '?')
|
||||
{
|
||||
fprintf(stderr,
|
||||
"DEBUG2: %*sBad terminator '%c' at file position %ld...\n",
|
||||
"DEBUG: %*sBad terminator '%c' at file position %ld...\n",
|
||||
indent, "", ch, ftell(in));
|
||||
return;
|
||||
}
|
||||
@@ -523,7 +521,7 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"DEBUG2: %*sStarting \"{%s%c%s\" at %ld, result=%d...\n",
|
||||
"DEBUG: %*sStarting \"{%s%c%s\" at %ld, result=%d...\n",
|
||||
indent, "", name, op, compare, ftell(in), result);
|
||||
|
||||
if (result)
|
||||
@@ -532,10 +530,10 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
* Comparison true; output first part and ignore second...
|
||||
*/
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sOutput first part...\n", indent, "");
|
||||
fprintf(stderr, "DEBUG: %*sOutput first part...\n", indent, "");
|
||||
cgi_copy(out, in, element, ':', indent + 2);
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sSkip second part...\n", indent, "");
|
||||
fprintf(stderr, "DEBUG: %*sSkip second part...\n", indent, "");
|
||||
cgi_copy(NULL, in, element, '}', indent + 2);
|
||||
}
|
||||
else
|
||||
@@ -544,14 +542,14 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
* Comparison false; ignore first part and output second...
|
||||
*/
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sSkip first part...\n", indent, "");
|
||||
fprintf(stderr, "DEBUG: %*sSkip first part...\n", indent, "");
|
||||
cgi_copy(NULL, in, element, ':', indent + 2);
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sOutput second part...\n", indent, "");
|
||||
fprintf(stderr, "DEBUG: %*sOutput second part...\n", indent, "");
|
||||
cgi_copy(out, in, element, '}', indent + 2);
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG2: %*sFinished \"{%s%c%s\", out=%p...\n", indent, "",
|
||||
fprintf(stderr, "DEBUG: %*sFinished \"{%s%c%s\", out=%p...\n", indent, "",
|
||||
name, op, compare, out);
|
||||
}
|
||||
else if (ch == '\\') /* Quoted char */
|
||||
@@ -565,11 +563,11 @@ cgi_copy(FILE *out, /* I - Output file */
|
||||
putc(ch, out);
|
||||
|
||||
if (ch == EOF)
|
||||
fprintf(stderr, "DEBUG2: %*sReturning at file position %ld on EOF...\n",
|
||||
fprintf(stderr, "DEBUG: %*sReturning at file position %ld on EOF...\n",
|
||||
indent, "", ftell(in));
|
||||
else
|
||||
fprintf(stderr,
|
||||
"DEBUG2: %*sReturning at file position %ld on character '%c'...\n",
|
||||
"DEBUG: %*sReturning at file position %ld on character '%c'...\n",
|
||||
indent, "", ftell(in), ch);
|
||||
|
||||
if (ch == EOF && term)
|
||||
|
||||
@@ -49,29 +49,22 @@ DefaultAuthType Basic
|
||||
|
||||
# Set the default printer/job policies...
|
||||
<Policy default>
|
||||
# Job-related operations must be done by the owner or an administrator...
|
||||
# Job-related operations must be done by the owner or an adminstrator...
|
||||
<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>
|
||||
Require user @OWNER @SYSTEM
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
# All administration operations require an administrator to authenticate...
|
||||
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
|
||||
# All administration operations require an adminstrator to authenticate...
|
||||
<Limit Pause-Printer Resume-Printer Set-Printer-Attributes Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Add-Printer CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>
|
||||
AuthType Default
|
||||
Require user @SYSTEM
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
# All printer operations require a printer operator to authenticate...
|
||||
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
|
||||
AuthType Default
|
||||
Require user @CUPS_DEFAULT_PRINTADMIN_AUTH@
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
# Only the owner or an administrator can cancel or authenticate a job...
|
||||
<Limit Cancel-Job CUPS-Authenticate-Job>
|
||||
Require user @OWNER @CUPS_DEFAULT_PRINTADMIN_AUTH@
|
||||
Require user @OWNER @SYSTEM
|
||||
Order deny,allow
|
||||
</Limit>
|
||||
|
||||
|
||||
@@ -95,8 +95,8 @@ image/x-xpixmap application/vnd.cups-raster 100 imagetoraster
|
||||
#image/x-xwindowdump application/vnd.cups-raster 100 imagetoraster
|
||||
image/x-sun-raster application/vnd.cups-raster 100 imagetoraster
|
||||
|
||||
# pstoraster is part of GPL Ghostscript...
|
||||
application/vnd.cups-postscript application/vnd.cups-raster 100 pstoraster
|
||||
# pstoraster is now part of ESP Ghostscript...
|
||||
#application/vnd.cups-postscript application/vnd.cups-raster 100 pstoraster
|
||||
|
||||
########################################################################
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-common.m4 6965 2007-09-17 21:34:07Z mike $"
|
||||
dnl "$Id: cups-common.m4 6661 2007-07-13 05:53:03Z mike $"
|
||||
dnl
|
||||
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -13,14 +13,14 @@ dnl which should have been included with this file. If this file is
|
||||
dnl file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
dnl
|
||||
|
||||
dnl We need at least autoconf 2.60...
|
||||
AC_PREREQ(2.60)
|
||||
dnl We need at least autoconf 2.50...
|
||||
AC_PREREQ(2.50)
|
||||
|
||||
dnl Set the name of the config header file...
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl Versio number information...
|
||||
CUPS_VERSION="1.3.2"
|
||||
CUPS_VERSION="1.3b1"
|
||||
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'`"
|
||||
@@ -123,7 +123,6 @@ AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
|
||||
AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
|
||||
AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
|
||||
AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
|
||||
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))
|
||||
|
||||
@@ -158,7 +157,8 @@ esac
|
||||
AC_CHECK_FUNCS(sigaction)
|
||||
|
||||
dnl Checks for wait functions.
|
||||
AC_CHECK_FUNCS(waitpid wait3)
|
||||
AC_CHECK_FUNCS(waitpid)
|
||||
AC_CHECK_FUNCS(wait3)
|
||||
|
||||
dnl See if the tm structure has the tm_gmtoff member...
|
||||
AC_MSG_CHECKING(for tm_gmtoff member in tm structure)
|
||||
@@ -168,9 +168,6 @@ AC_TRY_COMPILE([#include <time.h>],[struct tm t;
|
||||
AC_DEFINE(HAVE_TM_GMTOFF),
|
||||
AC_MSG_RESULT(no))
|
||||
|
||||
dnl See if we have the removefile(3) function for securely removing files
|
||||
AC_CHECK_FUNCS(removefile)
|
||||
|
||||
dnl Flags for "ar" command...
|
||||
case $uname in
|
||||
Darwin* | *BSD*)
|
||||
@@ -187,11 +184,15 @@ dnl Extra platform-specific libraries...
|
||||
BACKLIBS=""
|
||||
CUPSDLIBS=""
|
||||
DBUSDIR=""
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@SYSTEM"
|
||||
CUPS_SYSTEM_AUTHKEY=""
|
||||
|
||||
AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto])
|
||||
|
||||
AC_ARG_WITH(libcupsorder, [ --with-libcupsorder libcups secorder file, default=libcups.order],
|
||||
LIBCUPSORDER="$withval",
|
||||
LIBCUPSORDER="libcups.order")
|
||||
AC_SUBST(LIBCUPSORDER)
|
||||
|
||||
FONTS="fonts"
|
||||
AC_SUBST(FONTS)
|
||||
LEGACY_BACKENDS="parallel scsi"
|
||||
@@ -234,7 +235,6 @@ case $uname in
|
||||
dnl Check for Authorization Services support
|
||||
AC_CHECK_HEADER(Security/Authorization.h, [
|
||||
AC_DEFINE(HAVE_AUTHORIZATION_H)
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
|
||||
CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"])
|
||||
AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
|
||||
;;
|
||||
@@ -263,8 +263,6 @@ case $uname in
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(CUPS_DEFAULT_PRINTADMIN_AUTH)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTADMIN_AUTH, "$CUPS_DEFAULT_PRINTADMIN_AUTH")
|
||||
AC_SUBST(CUPS_SYSTEM_AUTHKEY)
|
||||
|
||||
dnl See if we have POSIX ACL support...
|
||||
@@ -287,5 +285,5 @@ AC_SUBST(DEFAULT_IPP_PORT)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-common.m4 6965 2007-09-17 21:34:07Z mike $".
|
||||
dnl End of "$Id: cups-common.m4 6661 2007-07-13 05:53:03Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-compiler.m4 6976 2007-09-18 20:39:31Z mike $"
|
||||
dnl "$Id: cups-compiler.m4 6649 2007-07-11 21:46:42Z mike $"
|
||||
dnl
|
||||
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -72,21 +72,6 @@ AC_SUBST(PIEFLAGS)
|
||||
RELROFLAGS=""
|
||||
AC_SUBST(RELROFLAGS)
|
||||
|
||||
LIBCUPSORDER="libcups.order"
|
||||
AC_ARG_WITH(libcupsorder, [ --with-libcupsorder libcups secorder file, default=libcups.order],
|
||||
if test -f "$withval"; then
|
||||
LIBCUPSORDER="$withval"
|
||||
fi)
|
||||
AC_SUBST(LIBCUPSORDER)
|
||||
|
||||
LIBCUPSIMAGEORDER="libcupsimage.order"
|
||||
AC_ARG_WITH(libcupsimageorder, [ --with-libcupsimagesorder
|
||||
libcupsimage secorder file, default=libcupsimage.order],
|
||||
if test -f "$withval"; then
|
||||
LIBCUPSIMAGEORDER="$withval"
|
||||
fi)
|
||||
AC_SUBST(LIBCUPSIMAGEORDER)
|
||||
|
||||
if test -n "$GCC"; then
|
||||
# Add GCC-specific compiler options...
|
||||
if test -z "$OPTIM"; then
|
||||
@@ -301,40 +286,6 @@ else
|
||||
if test $PICFLAG = 1; then
|
||||
OPTIM="+z $OPTIM"
|
||||
fi
|
||||
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
# Build 32-bit libraries, 64-bit base...
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCH32FLAGS="+DD32"
|
||||
else
|
||||
ARCH32FLAGS="$with_arch32flags"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCHFLAGS="+DD64"
|
||||
else
|
||||
ARCHFLAGS="$with_arch64flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$enable_64bit" = xyes; then
|
||||
# Build 64-bit libraries, 32-bit base...
|
||||
if test -z "$with_arch64flags"; then
|
||||
ARCH64FLAGS="+DD64"
|
||||
else
|
||||
ARCH64FLAGS="$with_arch64flags"
|
||||
fi
|
||||
|
||||
if test -z "$with_archflags"; then
|
||||
if test -z "$with_arch32flags"; then
|
||||
ARCHFLAGS="+DD32"
|
||||
else
|
||||
ARCHFLAGS="$with_arch32flags"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
IRIX)
|
||||
if test -z "$OPTIM"; then
|
||||
@@ -498,5 +449,5 @@ case $uname in
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-compiler.m4 6976 2007-09-18 20:39:31Z mike $".
|
||||
dnl End of "$Id: cups-compiler.m4 6649 2007-07-11 21:46:42Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-defaults.m4 6754 2007-08-01 19:00:07Z mike $"
|
||||
dnl "$Id: cups-defaults.m4 6656 2007-07-12 23:56:23Z mike $"
|
||||
dnl
|
||||
dnl Default cupsd configuration settings for the Common UNIX Printing System
|
||||
dnl (CUPS).
|
||||
@@ -159,14 +159,7 @@ dnl Determine the correct username and group for this OS...
|
||||
AC_ARG_WITH(cups_user, [ --with-cups-user set default user for CUPS],
|
||||
CUPS_USER="$withval",
|
||||
AC_MSG_CHECKING(for default print user)
|
||||
if test x$uname = xDarwin; then
|
||||
if test x`id -u _lp 2>/dev/null` = x; then
|
||||
CUPS_USER="lp";
|
||||
else
|
||||
CUPS_USER="_lp";
|
||||
fi
|
||||
AC_MSG_RESULT($CUPS_USER)
|
||||
elif test -f /etc/passwd; then
|
||||
if test -f /etc/passwd; then
|
||||
CUPS_USER=""
|
||||
for user in lp lpd guest daemon nobody; do
|
||||
if test "`grep \^${user}: /etc/passwd`" != ""; then
|
||||
@@ -188,15 +181,8 @@ AC_ARG_WITH(cups_user, [ --with-cups-user set default user for CUPS],
|
||||
AC_ARG_WITH(cups_group, [ --with-cups-group set default group for CUPS],
|
||||
CUPS_GROUP="$withval",
|
||||
AC_MSG_CHECKING(for default print group)
|
||||
if test x$uname = xDarwin; then
|
||||
if test x`id -g _lp 2>/dev/null` = x; then
|
||||
CUPS_GROUP="lp";
|
||||
else
|
||||
CUPS_GROUP="_lp";
|
||||
fi
|
||||
AC_MSG_RESULT($CUPS_GROUP)
|
||||
elif test -f /etc/group; then
|
||||
GROUP_LIST="_lp lp nobody"
|
||||
if test -f /etc/group; then
|
||||
GROUP_LIST="lp nobody"
|
||||
CUPS_GROUP=""
|
||||
for group in $GROUP_LIST; do
|
||||
if test "`grep \^${group}: /etc/group`" != ""; then
|
||||
@@ -218,7 +204,7 @@ AC_ARG_WITH(cups_group, [ --with-cups-group set default group for CUPS],
|
||||
AC_ARG_WITH(system_groups, [ --with-system-groups set default system groups for CUPS],
|
||||
CUPS_SYSTEM_GROUPS="$withval",
|
||||
if test x$uname = xDarwin; then
|
||||
CUPS_SYSTEM_GROUPS="admin"
|
||||
CUPS_SYSTEM_GROUPS="lpadmin admin"
|
||||
else
|
||||
AC_MSG_CHECKING(for default system groups)
|
||||
if test -f /etc/group; then
|
||||
@@ -338,5 +324,5 @@ AC_SUBST(CUPS_SNMP_ADDRESS)
|
||||
AC_SUBST(CUPS_SNMP_COMMUNITY)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-defaults.m4 6754 2007-08-01 19:00:07Z mike $".
|
||||
dnl End of "$Id: cups-defaults.m4 6656 2007-07-12 23:56:23Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-directories.m4 6976 2007-09-18 20:39:31Z mike $"
|
||||
dnl "$Id: cups-directories.m4 6649 2007-07-11 21:46:42Z mike $"
|
||||
dnl
|
||||
dnl Directory stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -99,23 +99,17 @@ if test "$sysconfdir" = "\${prefix}/etc"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Fix "libdir" variable...
|
||||
dnl Fix "libdir" variable for IRIX 6.x...
|
||||
if test "$libdir" = "\${exec_prefix}/lib"; then
|
||||
case "$uname" in
|
||||
IRIX*)
|
||||
libdir="$exec_prefix/lib32"
|
||||
;;
|
||||
Linux*)
|
||||
if test -d /usr/lib64; then
|
||||
libdir="$exec_prefix/lib64"
|
||||
fi
|
||||
;;
|
||||
HP-UX*)
|
||||
if test -d /usr/lib/hpux32; then
|
||||
libdir="$exec_prefix/lib/hpux32"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "$uname" = "IRIX"; then
|
||||
libdir="$exec_prefix/lib32"
|
||||
else
|
||||
if test "$uname" = Linux -a -d /usr/lib64; then
|
||||
libdir="$exec_prefix/lib64"
|
||||
else
|
||||
libdir="$exec_prefix/lib"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Setup init.d locations...
|
||||
@@ -152,8 +146,8 @@ if test x$rcdir = x; then
|
||||
HP-UX*)
|
||||
INITDIR="/sbin"
|
||||
RCLEVELS="2"
|
||||
RCSTART="380"
|
||||
RCSTOP="620"
|
||||
RCSTART="620"
|
||||
RCSTOP="380"
|
||||
;;
|
||||
|
||||
IRIX*)
|
||||
@@ -297,26 +291,21 @@ fi
|
||||
AC_SUBST(CUPS_FONTPATH)
|
||||
AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$CUPS_FONTPATH")
|
||||
|
||||
# Locale data (initial assignment allows us not to require autoconf 2.60)
|
||||
localedir="${localedir:=}"
|
||||
if test "$localedir" = "\${datarootdir}/locale" -o "$localedir" = ""; then
|
||||
case "$uname" in
|
||||
Linux | GNU | *BSD* | Darwin*)
|
||||
CUPS_LOCALEDIR="$datadir/locale"
|
||||
;;
|
||||
# Locale data
|
||||
case "$uname" in
|
||||
Linux | GNU | *BSD* | Darwin*)
|
||||
CUPS_LOCALEDIR="$datadir/locale"
|
||||
;;
|
||||
|
||||
OSF1* | AIX*)
|
||||
CUPS_LOCALEDIR="$exec_prefix/lib/nls/msg"
|
||||
;;
|
||||
OSF1* | AIX*)
|
||||
CUPS_LOCALEDIR="$exec_prefix/lib/nls/msg"
|
||||
;;
|
||||
|
||||
*)
|
||||
# This is the standard System V location...
|
||||
CUPS_LOCALEDIR="$exec_prefix/lib/locale"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
CUPS_LOCALEDIR="$localedir"
|
||||
fi
|
||||
*)
|
||||
# This is the standard System V location...
|
||||
CUPS_LOCALEDIR="$exec_prefix/lib/locale"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$CUPS_LOCALEDIR")
|
||||
AC_SUBST(CUPS_LOCALEDIR)
|
||||
@@ -367,5 +356,5 @@ AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$localstatedir/run/cups")
|
||||
AC_SUBST(CUPS_STATEDIR)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-directories.m4 6976 2007-09-18 20:39:31Z mike $".
|
||||
dnl End of "$Id: cups-directories.m4 6649 2007-07-11 21:46:42Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -29,19 +29,17 @@ DNSSDLIBS=""
|
||||
|
||||
if test x$enable_dnssd != xno; then
|
||||
AC_CHECK_HEADER(dns_sd.h, [
|
||||
AC_DEFINE(HAVE_DNSSD)
|
||||
case "$uname" in
|
||||
Darwin*)
|
||||
# Darwin and MacOS X...
|
||||
DNSSDLIBS="-framework CoreFoundation -framework SystemConfiguration"
|
||||
AC_DEFINE(HAVE_DNSSD)
|
||||
AC_DEFINE(HAVE_COREFOUNDATION)
|
||||
AC_DEFINE(HAVE_SYSTEMCONFIGURATION)
|
||||
;;
|
||||
*)
|
||||
# All others...
|
||||
AC_CHECK_LIB(dns_sd,DNSServiceProcessResult,
|
||||
AC_DEFINE(HAVE_DNSSD)
|
||||
DNSSDLIBS="-ldns_sd")
|
||||
DNSSDLIBS="???"
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
@@ -60,7 +60,7 @@ if test x$enable_gssapi != xno; then
|
||||
|
||||
AC_CHECK_FUNC(gsskrb5_register_acceptor_identity,
|
||||
AC_DEFINE(HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY))
|
||||
AC_CHECK_FUNC(krb5_cc_new_unique, AC_DEFINE(HAVE_KRB5_CC_NEW_UNIQUE))
|
||||
AC_CHECK_FUNC(krb5_cc_resolve, AC_DEFINE(HAVE_KRB5_CC_RESOLVE))
|
||||
|
||||
AC_MSG_CHECKING(for GSS_C_NT_HOSTBASED_SERVICE)
|
||||
if test $ac_cv_header_gssapi_gssapi_h = yes; then
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#define CUPS_DEFAULT_USER "lp"
|
||||
#define CUPS_DEFAULT_GROUP "sys"
|
||||
#define CUPS_DEFAULT_SYSTEM_GROUPS "sys root system"
|
||||
#define CUPS_DEFAULT_PRINTADMIN_AUTH "@SYSTEM"
|
||||
|
||||
|
||||
/*
|
||||
@@ -495,7 +494,7 @@
|
||||
#undef HAVE_GSSAPI_GSSAPI_KRB5_H
|
||||
#undef HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY
|
||||
#undef HAVE_GSS_C_NT_HOSTBASED_SERVICE
|
||||
#undef HAVE_KRB5_CC_NEW_UNIQUE
|
||||
#undef HAVE_KRB5_CC_RESOLVE
|
||||
#undef HAVE_KRB5_H
|
||||
#undef HAVE_HEIMDAL
|
||||
|
||||
@@ -523,13 +522,6 @@
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have <sys/param.h>?
|
||||
*/
|
||||
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have <sys/ucred.h>?
|
||||
*/
|
||||
@@ -537,13 +529,6 @@
|
||||
#undef HAVE_SYS_UCRED_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have removefile()?
|
||||
*/
|
||||
|
||||
#undef HAVE_REMOVEFILE
|
||||
|
||||
|
||||
#endif /* !_CUPS_CONFIG_H_ */
|
||||
|
||||
/*
|
||||
|
||||
@@ -53,6 +53,10 @@ if test "x$LANGUAGES" != x; then
|
||||
LANGFILES="$LANGFILES doc/$lang/index.html"
|
||||
fi
|
||||
|
||||
if test -f templates/$lang/edit-config.tmpl.in; then
|
||||
LANGFILES="$LANGFILES templates/$lang/edit-config.tmpl"
|
||||
fi
|
||||
|
||||
if test -f templates/$lang/header.tmpl.in; then
|
||||
LANGFILES="$LANGFILES templates/$lang/header.tmpl"
|
||||
fi
|
||||
@@ -65,11 +69,10 @@ AC_SUBST(UNINSTALL_LANGUAGES)
|
||||
AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config
|
||||
conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
|
||||
doc/index.html doc/help/ref-cupsd-conf.html doc/help/standard.html
|
||||
init/org.cups.cups-lpd.plist
|
||||
man/client.conf.man man/cups-deviced.man man/cups-driverd.man
|
||||
man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man
|
||||
man/cupsd.conf.man man/lpoptions.man
|
||||
templates/header.tmpl
|
||||
templates/edit-config.tmpl templates/header.tmpl
|
||||
$LANGFILES)
|
||||
|
||||
chmod +x cups-config
|
||||
|
||||
@@ -583,10 +583,6 @@ cupsAdminExportSamba(
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we have the Win9x PS driver...
|
||||
*/
|
||||
|
||||
snprintf(file, sizeof(file), "%s/drivers/ADOBEPS4.DRV", cg->cups_datadir);
|
||||
if (!access(file, 0))
|
||||
{
|
||||
@@ -657,136 +653,6 @@ cupsAdminExportSamba(
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we have the 64-bit Windows PS driver...
|
||||
*
|
||||
* Files:
|
||||
*
|
||||
* x64/ps5ui.dll
|
||||
* x64/pscript.hlp
|
||||
* x64/pscript.ntf
|
||||
* x64/pscript5.dll
|
||||
*/
|
||||
|
||||
snprintf(file, sizeof(file), "%s/drivers/x64/pscript5.dll", cg->cups_datadir);
|
||||
if (!access(file, 0))
|
||||
{
|
||||
have_drivers |= 4;
|
||||
|
||||
/*
|
||||
* 64-bit Windows driver is installed; do the smbclient commands needed
|
||||
* to copy the Win64 drivers over...
|
||||
*/
|
||||
|
||||
snprintf(address, sizeof(address), "//%s/print$", samba_server);
|
||||
|
||||
snprintf(subcmd, sizeof(subcmd),
|
||||
"mkdir x64;"
|
||||
"put %s x64/%s.ppd;"
|
||||
"put %s/drivers/x64/ps5ui.dll x64/ps5ui.dll;"
|
||||
"put %s/drivers/x64/pscript.hlp x64/pscript.hlp;"
|
||||
"put %s/drivers/x64/pscript.ntf x64/pscript.ntf;"
|
||||
"put %s/drivers/x64/pscript5.dll x64/pscript5.dll",
|
||||
ppd, dest, cg->cups_datadir, cg->cups_datadir,
|
||||
cg->cups_datadir, cg->cups_datadir);
|
||||
|
||||
if ((status = do_samba_command("smbclient", address, subcmd,
|
||||
authfile, logfile)) != 0)
|
||||
{
|
||||
snprintf(message, sizeof(message),
|
||||
_cupsLangString(language,
|
||||
_("Unable to copy 64-bit Windows printer "
|
||||
"driver files (%d)!")), status);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, message);
|
||||
|
||||
if (logfile)
|
||||
_cupsLangPrintf(logfile, "%s\n", message);
|
||||
|
||||
unlink(authfile);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we also have the CUPS driver files; if so, use them!
|
||||
*/
|
||||
|
||||
snprintf(file, sizeof(file), "%s/drivers/x64/cupsps6.dll", cg->cups_datadir);
|
||||
if (!access(file, 0))
|
||||
{
|
||||
/*
|
||||
* Copy the CUPS driver files over...
|
||||
*/
|
||||
|
||||
snprintf(subcmd, sizeof(subcmd),
|
||||
"put %s/drivers/x64/cups6.ini x64/cups6.ini;"
|
||||
"put %s/drivers/x64/cupsps6.dll x64/cupsps6.dll;"
|
||||
"put %s/drivers/x64/cupsui6.dll x64/cupsui6.dll",
|
||||
cg->cups_datadir, cg->cups_datadir, cg->cups_datadir);
|
||||
|
||||
if ((status = do_samba_command("smbclient", address, subcmd,
|
||||
authfile, logfile)) != 0)
|
||||
{
|
||||
snprintf(message, sizeof(message),
|
||||
_cupsLangString(language,
|
||||
_("Unable to copy 64-bit CUPS printer driver "
|
||||
"files (%d)!")), status);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, message);
|
||||
|
||||
if (logfile)
|
||||
_cupsLangPrintf(logfile, "%s\n", message);
|
||||
|
||||
unlink(authfile);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Do the rpcclient command needed for the CUPS drivers...
|
||||
*/
|
||||
|
||||
snprintf(subcmd, sizeof(subcmd),
|
||||
"adddriver \"Windows x64\" \"%s:"
|
||||
"pscript5.dll:%s.ppd:ps5ui.dll:pscript.hlp:NULL:RAW:"
|
||||
"pscript5.dll,%s.ppd,ps5ui.dll,pscript.hlp,pscript.ntf,"
|
||||
"cups6.ini,cupsps6.dll,cupsui6.dll\"",
|
||||
dest, dest, dest);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Don't have the CUPS drivers, so just use the standard Windows
|
||||
* drivers...
|
||||
*/
|
||||
|
||||
snprintf(subcmd, sizeof(subcmd),
|
||||
"adddriver \"Windows x64\" \"%s:"
|
||||
"pscript5.dll:%s.ppd:ps5ui.dll:pscript.hlp:NULL:RAW:"
|
||||
"pscript5.dll,%s.ppd,ps5ui.dll,pscript.hlp,pscript.ntf\"",
|
||||
dest, dest, dest);
|
||||
}
|
||||
|
||||
if ((status = do_samba_command("rpcclient", samba_server, subcmd,
|
||||
authfile, logfile)) != 0)
|
||||
{
|
||||
snprintf(message, sizeof(message),
|
||||
_cupsLangString(language,
|
||||
_("Unable to install Windows 2000 printer "
|
||||
"driver files (%d)!")), status);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, message);
|
||||
|
||||
if (logfile)
|
||||
_cupsLangPrintf(logfile, "%s\n", message);
|
||||
|
||||
unlink(authfile);
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
if (logfile && !(have_drivers & 1))
|
||||
{
|
||||
if (!have_drivers)
|
||||
@@ -955,7 +821,7 @@ _cupsAdminGetServerSettings(
|
||||
|
||||
while (cupsFileGetConf(cupsd, line, sizeof(line), &value, &linenum))
|
||||
{
|
||||
if (!value && strncmp(line, "</", 2))
|
||||
if (!value)
|
||||
continue;
|
||||
|
||||
if (!strcasecmp(line, "Port") || !strcasecmp(line, "Listen"))
|
||||
@@ -1537,8 +1403,8 @@ _cupsAdminSetServerSettings(
|
||||
"cancel a job...\n"
|
||||
" <Limit Cancel-Job>\n"
|
||||
" Order deny,allow\n"
|
||||
" Require user @OWNER "
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH "\n"
|
||||
" Allow @SYSTEM\n"
|
||||
" Allow @OWNER\n"
|
||||
" </Limit>\n");
|
||||
}
|
||||
|
||||
@@ -1690,8 +1556,7 @@ _cupsAdminSetServerSettings(
|
||||
"a job...\n"
|
||||
" <Limit Cancel-Job>\n"
|
||||
" Order deny,allow\n"
|
||||
" Require user @OWNER "
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH "\n"
|
||||
" Require user @OWNER @SYSTEM\n"
|
||||
" </Limit>\n");
|
||||
|
||||
in_cancel_job = 0;
|
||||
@@ -1889,7 +1754,7 @@ _cupsAdminSetServerSettings(
|
||||
{
|
||||
cupsFilePuts(temp, "<Policy default>\n"
|
||||
" # Job-related operations must be done by the owner "
|
||||
"or an administrator...\n"
|
||||
"or an adminstrator...\n"
|
||||
" <Limit Send-Document Send-URI Hold-Job Release-Job "
|
||||
"Restart-Job Purge-Jobs Set-Job-Attributes "
|
||||
"Create-Job-Subscription Renew-Subscription "
|
||||
@@ -1900,7 +1765,7 @@ _cupsAdminSetServerSettings(
|
||||
" Order deny,allow\n"
|
||||
" </Limit>\n"
|
||||
" # All administration operations require an "
|
||||
"administrator to authenticate...\n"
|
||||
"adminstrator to authenticate...\n"
|
||||
" <Limit Pause-Printer Resume-Printer "
|
||||
"Set-Printer-Attributes Enable-Printer "
|
||||
"Disable-Printer Pause-Printer-After-Current-Job "
|
||||
@@ -1920,9 +1785,8 @@ _cupsAdminSetServerSettings(
|
||||
cupsFilePuts(temp, " # Only the owner or an administrator can cancel "
|
||||
"a job...\n"
|
||||
" <Limit Cancel-Job>\n"
|
||||
" Require user @OWNER @SYSTEM\n"
|
||||
" Order deny,allow\n"
|
||||
" Require user @OWNER "
|
||||
CUPS_DEFAULT_PRINTADMIN_AUTH "\n"
|
||||
" </Limit>\n");
|
||||
|
||||
cupsFilePuts(temp, " <Limit All>\n"
|
||||
|
||||
@@ -65,8 +65,6 @@ extern const char *cssmErrorString(int error);
|
||||
# ifdef DEBUG
|
||||
static void DEBUG_gss_printf(OM_uint32 major_status, OM_uint32 minor_status,
|
||||
const char *message);
|
||||
# else
|
||||
# define DEBUG_gss_printf(major, minor, message)
|
||||
# endif /* DEBUG */
|
||||
static gss_name_t cups_get_gss_creds(http_t *http, const char *service_name);
|
||||
#endif /* HAVE_GSSAPI */
|
||||
@@ -108,7 +106,12 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
* Clear the current authentication string...
|
||||
*/
|
||||
|
||||
httpSetAuthString(http, NULL, NULL);
|
||||
http->_authstring[0] = '\0';
|
||||
|
||||
if (http->authstring && http->authstring != http->_authstring)
|
||||
free(http->authstring);
|
||||
|
||||
http->authstring = http->_authstring;
|
||||
|
||||
/*
|
||||
* See if we can do local authentication...
|
||||
@@ -173,6 +176,13 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
|
||||
if (!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9))
|
||||
{
|
||||
if (http->status == HTTP_UNAUTHORIZED && http->digest_tries >= 3)
|
||||
{
|
||||
DEBUG_printf(("cupsDoAuthentication: too many Negotiate tries (%d)\n",
|
||||
http->digest_tries));
|
||||
|
||||
return (-1);
|
||||
}
|
||||
#ifdef HAVE_GSSAPI
|
||||
/*
|
||||
* Kerberos authentication...
|
||||
@@ -186,10 +196,8 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
/* Input token */
|
||||
char *gss_service_name;
|
||||
/* GSS service name */
|
||||
# ifdef USE_SPNEGO
|
||||
const char *authorization;
|
||||
/* Pointer into Authorization string */
|
||||
# endif /* USE_SPNEGO */
|
||||
|
||||
|
||||
# ifdef __APPLE__
|
||||
@@ -206,14 +214,6 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
}
|
||||
# endif /* __APPLE__ */
|
||||
|
||||
if (http->status == HTTP_UNAUTHORIZED && http->digest_tries >= 3)
|
||||
{
|
||||
DEBUG_printf(("cupsDoAuthentication: too many Negotiate tries (%d)\n",
|
||||
http->digest_tries));
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (http->gssname == GSS_C_NO_NAME)
|
||||
{
|
||||
if ((gss_service_name = getenv("CUPS_GSSSERVICENAME")) == NULL)
|
||||
@@ -224,7 +224,6 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
http->gssname = cups_get_gss_creds(http, gss_service_name);
|
||||
}
|
||||
|
||||
# ifdef USE_SPNEGO /* We don't implement SPNEGO just yet... */
|
||||
/*
|
||||
* Find the start of the Kerberos input token...
|
||||
*/
|
||||
@@ -238,36 +237,10 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
if (*authorization)
|
||||
{
|
||||
/*
|
||||
* Decode the authorization string to get the input token...
|
||||
* For SPNEGO, this is where we'll feed the server's authorization data
|
||||
* back into gss via input_token...
|
||||
*/
|
||||
|
||||
int len = strlen(authorization);
|
||||
|
||||
input_token.value = malloc(len);
|
||||
input_token.value = httpDecode64_2(input_token.value, &len,
|
||||
authorization);
|
||||
input_token.length = len;
|
||||
|
||||
# ifdef DEBUG
|
||||
{
|
||||
char *ptr = (char *)input_token.value;
|
||||
int left = len;
|
||||
|
||||
fputs("input_token=", stdout);
|
||||
while (left > 0)
|
||||
{
|
||||
if (*ptr < ' ')
|
||||
printf("\\%03o", *ptr & 255);
|
||||
else
|
||||
putchar(*ptr);
|
||||
ptr ++;
|
||||
left --;
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
# endif /* USE_SPNEGO */
|
||||
|
||||
if (http->gssctx != GSS_C_NO_CONTEXT)
|
||||
{
|
||||
@@ -279,8 +252,7 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
major_status = gss_init_sec_context(&minor_status, GSS_C_NO_CREDENTIAL,
|
||||
&http->gssctx,
|
||||
http->gssname, http->gssmech,
|
||||
GSS_C_DELEG_FLAG | GSS_C_MUTUAL_FLAG |
|
||||
GSS_C_INTEG_FLAG,
|
||||
GSS_C_DELEG_FLAG | GSS_C_MUTUAL_FLAG,
|
||||
GSS_C_INDEFINITE,
|
||||
GSS_C_NO_CHANNEL_BINDINGS,
|
||||
&input_token, &http->gssmech,
|
||||
@@ -293,22 +265,32 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
{
|
||||
# ifdef DEBUG
|
||||
DEBUG_gss_printf(major_status, minor_status,
|
||||
"Unable to initialize security context");
|
||||
"Unable to initialise security context");
|
||||
# endif /* DEBUG */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
# ifdef DEBUG
|
||||
if (major_status == GSS_S_CONTINUE_NEEDED)
|
||||
DEBUG_gss_printf(major_status, minor_status, "Continuation needed!");
|
||||
# endif /* DEBUG */
|
||||
|
||||
if (output_token.length)
|
||||
{
|
||||
httpEncode64_2(encode, sizeof(encode), output_token.value,
|
||||
output_token.length);
|
||||
httpSetAuthString(http, "Negotiate", encode);
|
||||
|
||||
http->authstring = malloc(strlen(encode) + 11);
|
||||
sprintf(http->authstring, "Negotiate %s", encode); /* Safe because allocated */
|
||||
|
||||
major_status = gss_release_buffer(&minor_status, &output_token);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy back what we can to _authstring for backwards compatibility...
|
||||
*/
|
||||
|
||||
strlcpy(http->_authstring, http->authstring, sizeof(http->_authstring));
|
||||
#endif /* HAVE_GSSAPI */
|
||||
}
|
||||
else if (strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Digest", 6))
|
||||
@@ -319,7 +301,7 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
|
||||
httpEncode64_2(encode, sizeof(encode), http->userpass,
|
||||
(int)strlen(http->userpass));
|
||||
httpSetAuthString(http, "Basic", encode);
|
||||
snprintf(http->_authstring, sizeof(http->_authstring), "Basic %s", encode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -327,18 +309,15 @@ cupsDoAuthentication(http_t *http, /* I - HTTP connection to server */
|
||||
* Digest authentication...
|
||||
*/
|
||||
|
||||
char digest[1024]; /* Digest auth data */
|
||||
|
||||
|
||||
httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "realm", realm);
|
||||
httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "nonce", nonce);
|
||||
|
||||
httpMD5(cupsUser(), realm, strchr(http->userpass, ':') + 1, encode);
|
||||
httpMD5Final(nonce, method, resource, encode);
|
||||
snprintf(digest, sizeof(digest),
|
||||
"username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", "
|
||||
"response=\"%s\"", cupsUser(), realm, nonce, resource, encode);
|
||||
httpSetAuthString(http, "Digest", digest);
|
||||
snprintf(http->_authstring, sizeof(http->_authstring),
|
||||
"Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", "
|
||||
"uri=\"%s\", response=\"%s\"", cupsUser(), realm, nonce,
|
||||
resource, encode);
|
||||
}
|
||||
|
||||
DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n", http->authstring));
|
||||
@@ -425,8 +404,6 @@ cups_get_gss_creds(
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s@%s", service_name, fqdn);
|
||||
|
||||
DEBUG_printf(("cups_get_gss_creds: Looking up %s...\n", buf));
|
||||
|
||||
token.value = buf;
|
||||
token.length = strlen(buf);
|
||||
server_name = GSS_C_NO_NAME;
|
||||
@@ -546,7 +523,11 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
httpEncode64_2(buffer, sizeof(buffer), (void *)&auth_extrn,
|
||||
sizeof(auth_extrn));
|
||||
|
||||
httpSetAuthString(http, "AuthRef", buffer);
|
||||
http->authstring = malloc(strlen(buffer) + 9);
|
||||
sprintf(http->authstring, "AuthRef %s", buffer);
|
||||
|
||||
/* Copy back to _authstring for backwards compatibility */
|
||||
strlcpy(http->_authstring, http->authstring, sizeof(http->_authstring));
|
||||
|
||||
DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
|
||||
http->authstring));
|
||||
@@ -582,7 +563,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
* check if we need Kerberos authentication...
|
||||
*/
|
||||
|
||||
if (!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9))
|
||||
if (!strcmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate"))
|
||||
{
|
||||
/*
|
||||
* Yes, don't try the root certificate...
|
||||
@@ -609,7 +590,11 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
* Set the authorization string and return...
|
||||
*/
|
||||
|
||||
httpSetAuthString(http, "Local", certificate);
|
||||
http->authstring = malloc(strlen(certificate) + 7);
|
||||
sprintf(http->authstring, "Local %s", certificate);
|
||||
|
||||
/* Copy back to _authstring for backwards compatibility */
|
||||
strlcpy(http->_authstring, http->authstring, sizeof(http->_authstring));
|
||||
|
||||
DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
|
||||
http->authstring));
|
||||
@@ -638,7 +623,11 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
|
||||
if ((pwd = getpwnam(username)) != NULL && pwd->pw_uid == getuid())
|
||||
{
|
||||
httpSetAuthString(http, "PeerCred", username);
|
||||
http->authstring = malloc(strlen(username) + 10);
|
||||
sprintf(http->authstring, "PeerCred %s", username);
|
||||
|
||||
/* Copy back to _authstring for backwards compatibility */
|
||||
strlcpy(http->_authstring, http->authstring, sizeof(http->_authstring));
|
||||
|
||||
DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
|
||||
http->authstring));
|
||||
|
||||
@@ -59,10 +59,10 @@ extern "C" {
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define CUPS_VERSION 1.0302
|
||||
# define CUPS_VERSION 1.0300
|
||||
# define CUPS_VERSION_MAJOR 1
|
||||
# define CUPS_VERSION_MINOR 3
|
||||
# define CUPS_VERSION_PATCH 2
|
||||
# define CUPS_VERSION_PATCH 0
|
||||
# define CUPS_DATE_ANY -1
|
||||
|
||||
|
||||
|
||||
@@ -1207,7 +1207,7 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
if (fp->ptr >= fp->end)
|
||||
if (cups_fill(fp) <= 0)
|
||||
{
|
||||
DEBUG_printf((" cups_fill() returned -1, total=%d\n", (int)total));
|
||||
DEBUG_printf((" cups_fill() returned -1, total=%d\n", total));
|
||||
|
||||
if (total > 0)
|
||||
return ((ssize_t)total);
|
||||
@@ -1235,7 +1235,7 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
* Return the total number of bytes read...
|
||||
*/
|
||||
|
||||
DEBUG_printf((" total=%d\n", (int)total));
|
||||
DEBUG_printf((" total=%d\n", total));
|
||||
|
||||
return ((ssize_t)total);
|
||||
}
|
||||
@@ -1703,7 +1703,6 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
|
||||
{
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
#ifdef HAVE_LIBZ
|
||||
int status; /* Decompression status */
|
||||
const unsigned char *ptr, /* Pointer into buffer */
|
||||
*end; /* End of buffer */
|
||||
#endif /* HAVE_LIBZ */
|
||||
@@ -1922,13 +1921,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
|
||||
fp->stream.next_out = (Bytef *)fp->buf;
|
||||
fp->stream.avail_out = sizeof(fp->buf);
|
||||
|
||||
status = inflate(&(fp->stream), Z_NO_FLUSH);
|
||||
|
||||
if (fp->stream.next_out > (Bytef *)fp->buf)
|
||||
fp->crc = crc32(fp->crc, (Bytef *)fp->buf,
|
||||
fp->stream.next_out - (Bytef *)fp->buf);
|
||||
|
||||
if (status == Z_STREAM_END)
|
||||
if (inflate(&(fp->stream), Z_NO_FLUSH) == Z_STREAM_END)
|
||||
{
|
||||
/*
|
||||
* Read the CRC and length...
|
||||
@@ -1957,9 +1950,6 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
|
||||
* Bad CRC, mark end-of-file...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cups_fill: tcrc=%08x, fp->crc=%08x\n",
|
||||
(unsigned int)tcrc, (unsigned int)fp->crc));
|
||||
|
||||
fp->eof = 1;
|
||||
|
||||
return (-1);
|
||||
|
||||
@@ -26,9 +26,10 @@
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "globals.h"
|
||||
#include "http-private.h"
|
||||
#include "cups.h"
|
||||
#include "language.h"
|
||||
#include "string.h"
|
||||
#include "debug.h"
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
@@ -166,10 +167,7 @@ cupsGetFd(http_t *http, /* I - HTTP connection to server */
|
||||
write(fd, buffer, bytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cupsSetHTTPError(status);
|
||||
httpFlush(http);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the request status...
|
||||
@@ -418,10 +416,7 @@ cupsPutFd(http_t *http, /* I - HTTP connection to server */
|
||||
*/
|
||||
|
||||
if (status != HTTP_CREATED)
|
||||
{
|
||||
_cupsSetHTTPError(status);
|
||||
httpFlush(http);
|
||||
}
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,6 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
extern const char *_cupsGetPassword(const char *prompt);
|
||||
extern _cups_globals_t *_cupsGlobals(void);
|
||||
extern void _cupsSetError(ipp_status_t status, const char *message);
|
||||
extern void _cupsSetHTTPError(http_status_t status);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -197,17 +197,18 @@ httpAddrLookup(
|
||||
#endif /* AF_LOCAL */
|
||||
#ifdef HAVE_GETNAMEINFO
|
||||
{
|
||||
/*
|
||||
* STR #2486: httpAddrLookup() fails when getnameinfo() returns EAI_AGAIN
|
||||
*
|
||||
* FWIW, I think this is really a bug in the implementation of
|
||||
* getnameinfo(), but falling back on httpAddrString() is easy to
|
||||
* do...
|
||||
*/
|
||||
|
||||
if (getnameinfo(&addr->addr, httpAddrLength(addr), name, namelen,
|
||||
NULL, 0, 0))
|
||||
return (httpAddrString(addr, name, namelen));
|
||||
NULL, 0, 0))
|
||||
{
|
||||
/*
|
||||
* If we get an error back, then the address type is not supported
|
||||
* and we should zero out the buffer...
|
||||
*/
|
||||
|
||||
name[0] = '\0';
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
|
||||
@@ -62,9 +62,6 @@
|
||||
# ifndef HAVE_GSS_C_NT_HOSTBASED_SERVICE
|
||||
# define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name
|
||||
# endif /* !HAVE_GSS_C_NT_HOSTBASED_SERVICE */
|
||||
# ifdef HAVE_KRB5_H
|
||||
# include <krb5.h>
|
||||
# endif /* HAVE_KRB5_H */
|
||||
# endif /* HAVE_GSSAPI */
|
||||
|
||||
# ifdef HAVE_AUTHORIZATION_H
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
* httpFlush() - Flush data from a HTTP connection.
|
||||
* httpFlushWrite() - Flush data in write buffer.
|
||||
* httpGet() - Send a GET request to the server.
|
||||
* httpGetAuthString() - Get the current authorization string.
|
||||
* httpGetBlocking() - Get the blocking/non-block state of a connection.
|
||||
* httpGetCookie() - Get any cookie data from the response.
|
||||
* httpGetFd() - Get the file descriptor associated with a
|
||||
@@ -59,7 +58,6 @@
|
||||
* _httpReadCDSA() - Read function for the CDSA library.
|
||||
* _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)...
|
||||
* httpSetExpect() - Set the Expect: header in a request.
|
||||
* httpSetField() - Set the value of an HTTP header.
|
||||
@@ -607,27 +605,6 @@ httpGet(http_t *http, /* I - HTTP connection */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpGetAuthString()' - Get the current authorization string.
|
||||
*
|
||||
* The authorization string is set by cupsDoAuthentication() and
|
||||
* httpSetAuthString(). Use httpGetAuthString() to retrieve the
|
||||
* string to use with httpSetField() for the HTTP_FIELD_AUTHORIZATION
|
||||
* value.
|
||||
*
|
||||
* @since CUPS 1.3@
|
||||
*/
|
||||
|
||||
char * /* O - Authorization string */
|
||||
httpGetAuthString(http_t *http) /* I - HTTP connection */
|
||||
{
|
||||
if (http)
|
||||
return (http->authstring);
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpGetBlocking()' - Get the blocking/non-block state of a connection.
|
||||
*
|
||||
@@ -1700,61 +1677,6 @@ httpReconnect(http_t *http) /* I - HTTP connection */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpSetAuthString()' - Set the current authorization string.
|
||||
*
|
||||
* This function just stores a copy of the current authorization string in
|
||||
* the HTTP connection object. You must still call httpSetField() to set
|
||||
* HTTP_FIELD_AUTHORIZATION prior to issuing a HTTP request using httpGet(),
|
||||
* httpHead(), httpOptions(), httpPost, or httpPut().
|
||||
*
|
||||
* @since CUPS 1.3@
|
||||
*/
|
||||
|
||||
void
|
||||
httpSetAuthString(http_t *http, /* I - HTTP connection */
|
||||
const char *scheme, /* I - Auth scheme (NULL to clear it) */
|
||||
const char *data) /* I - Auth data (NULL for none) */
|
||||
{
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!http)
|
||||
return;
|
||||
|
||||
if (http->authstring && http->authstring != http->_authstring)
|
||||
free(http->authstring);
|
||||
|
||||
http->authstring = http->_authstring;
|
||||
|
||||
if (scheme)
|
||||
{
|
||||
/*
|
||||
* Set the current authorization string...
|
||||
*/
|
||||
|
||||
int len = (int)strlen(scheme) + (data ? (int)strlen(data) + 1 : 0) + 1;
|
||||
|
||||
if (len > (int)sizeof(http->_authstring))
|
||||
http->authstring = malloc(len);
|
||||
|
||||
if (data)
|
||||
snprintf(http->authstring, len, "%s %s", scheme, data);
|
||||
else
|
||||
strlcpy(http->authstring, scheme, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Clear the current authorization string...
|
||||
*/
|
||||
|
||||
http->_authstring[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpSetCookie()' - Set the cookie value(s)...
|
||||
*
|
||||
|
||||
@@ -442,10 +442,6 @@ extern void httpSetLength(http_t *http, size_t length);
|
||||
extern ssize_t httpWrite2(http_t *http, const char *buffer,
|
||||
size_t length);
|
||||
|
||||
/**** New in CUPS 1.3 ****/
|
||||
extern char *httpGetAuthString(http_t *http);
|
||||
extern void httpSetAuthString(http_t *http, const char *scheme,
|
||||
const char *data);
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
|
||||
@@ -985,12 +985,11 @@ typedef struct
|
||||
static const _apple_name_locale_t apple_name_locale[] =
|
||||
{
|
||||
{ "en" , "en_US" },
|
||||
{ "nb" , "no" },
|
||||
{ "no" , "nb" },
|
||||
{ "zh-Hans" , "zh_CN" },
|
||||
{ "zh-Hant" , "zh_TW" }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* 'appleLangDefault()' - Get the default locale string.
|
||||
*/
|
||||
@@ -999,8 +998,6 @@ static const char * /* O - Locale string */
|
||||
appleLangDefault(void)
|
||||
{
|
||||
int i; /* Looping var */
|
||||
CFBundleRef bundle; /* Main bundle (if any) */
|
||||
CFArrayRef bundleList; /* List of localizations in bundle */
|
||||
CFPropertyListRef localizationList;
|
||||
/* List of localization data */
|
||||
CFStringRef languageName; /* Current name */
|
||||
@@ -1017,77 +1014,63 @@ appleLangDefault(void)
|
||||
if (!cg->language[0])
|
||||
{
|
||||
if ((lang = getenv("LANG")))
|
||||
{
|
||||
strlcpy(cg->language, lang, sizeof(cg->language));
|
||||
return (cg->language);
|
||||
}
|
||||
else if ((bundle = CFBundleGetMainBundle()) != NULL &&
|
||||
(bundleList = CFBundleCopyBundleLocalizations(bundle)) != NULL)
|
||||
{
|
||||
localizationList =
|
||||
CFBundleCopyPreferredLocalizationsFromArray(bundleList);
|
||||
|
||||
CFRelease(bundleList);
|
||||
}
|
||||
else
|
||||
localizationList =
|
||||
CFPreferencesCopyAppValue(CFSTR("AppleLanguages"),
|
||||
kCFPreferencesCurrentApplication);
|
||||
|
||||
if (localizationList)
|
||||
{
|
||||
if (CFGetTypeID(localizationList) == CFArrayGetTypeID() &&
|
||||
CFArrayGetCount(localizationList) > 0)
|
||||
localizationList =
|
||||
CFPreferencesCopyAppValue(CFSTR("AppleLanguages"),
|
||||
kCFPreferencesCurrentApplication);
|
||||
|
||||
if (localizationList != NULL)
|
||||
{
|
||||
languageName = CFArrayGetValueAtIndex(localizationList, 0);
|
||||
|
||||
if (languageName &&
|
||||
CFGetTypeID(languageName) == CFStringGetTypeID())
|
||||
if (CFGetTypeID(localizationList) == CFArrayGetTypeID() &&
|
||||
CFArrayGetCount(localizationList) > 0)
|
||||
{
|
||||
localeName = CFLocaleCreateCanonicalLocaleIdentifierFromString(
|
||||
kCFAllocatorDefault, languageName);
|
||||
languageName = CFArrayGetValueAtIndex(localizationList, 0);
|
||||
|
||||
if (localeName)
|
||||
{
|
||||
CFStringGetCString(localeName, cg->language, sizeof(cg->language),
|
||||
kCFStringEncodingASCII);
|
||||
CFRelease(localeName);
|
||||
if (languageName != NULL &&
|
||||
CFGetTypeID(languageName) == CFStringGetTypeID())
|
||||
{
|
||||
localeName = CFLocaleCreateCanonicalLocaleIdentifierFromString(
|
||||
kCFAllocatorDefault, languageName);
|
||||
|
||||
DEBUG_printf(("appleLangDefault: cg->language=\"%s\"\n",
|
||||
cg->language));
|
||||
|
||||
/*
|
||||
* Map new language identifiers to locales...
|
||||
*/
|
||||
|
||||
for (i = 0;
|
||||
i < sizeof(apple_name_locale) / sizeof(apple_name_locale[0]);
|
||||
i++)
|
||||
if (localeName != NULL)
|
||||
{
|
||||
if (!strcmp(cg->language, apple_name_locale[i].name))
|
||||
CFStringGetCString(localeName, cg->language, sizeof(cg->language),
|
||||
kCFStringEncodingASCII);
|
||||
CFRelease(localeName);
|
||||
|
||||
/*
|
||||
* Map new language identifiers to locales...
|
||||
*/
|
||||
|
||||
for (i = 0;
|
||||
i < sizeof(apple_name_locale) / sizeof(apple_name_locale[0]);
|
||||
i++)
|
||||
{
|
||||
DEBUG_printf(("appleLangDefault: mapping \"%s\" to \"%s\"...\n",
|
||||
cg->language, apple_name_locale[i].locale));
|
||||
strlcpy(cg->language, apple_name_locale[i].locale,
|
||||
sizeof(cg->language));
|
||||
break;
|
||||
if (!strcmp(cg->language, apple_name_locale[i].name))
|
||||
{
|
||||
strlcpy(cg->language, apple_name_locale[i].locale,
|
||||
sizeof(cg->language));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert language subtag into region subtag...
|
||||
*/
|
||||
|
||||
if (cg->language[2] == '-')
|
||||
cg->language[2] = '_';
|
||||
|
||||
if (strchr(cg->language, '.') == NULL)
|
||||
strlcat(cg->language, ".UTF-8", sizeof(cg->language));
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert language subtag into region subtag...
|
||||
*/
|
||||
|
||||
if (cg->language[2] == '-')
|
||||
cg->language[2] = '_';
|
||||
|
||||
if (!strchr(cg->language, '.'))
|
||||
strlcat(cg->language, ".UTF-8", sizeof(cg->language));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CFRelease(localizationList);
|
||||
CFRelease(localizationList);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -183,7 +183,6 @@ _httpError
|
||||
_httpFlush
|
||||
_httpFlushWrite
|
||||
_httpGet
|
||||
_httpGetAuthString
|
||||
_httpGetBlocking
|
||||
_httpGetCookie
|
||||
_httpGetDateString
|
||||
@@ -214,7 +213,6 @@ _httpReconnect
|
||||
_httpSeparate
|
||||
_httpSeparate2
|
||||
_httpSeparateURI
|
||||
_httpSetAuthString
|
||||
_httpSetCookie
|
||||
_httpSetExpect
|
||||
_httpSetField
|
||||
@@ -284,7 +282,6 @@ _ppdFirstOption
|
||||
_ppdIsMarked
|
||||
_ppdLastError
|
||||
_ppdLocalize
|
||||
_ppdLocalizeIPPReason
|
||||
_ppdMarkDefaults
|
||||
_ppdMarkOption
|
||||
_ppdNextCustomParam
|
||||
|
||||
@@ -44,8 +44,7 @@
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static void ppd_ll_CC(char *ll_CC, int ll_CC_size,
|
||||
char *ll, int ll_size);
|
||||
static void ppd_ll_CC(char *ll_CC, char *ll);
|
||||
static ppd_attr_t *ppd_localized_attr(ppd_file_t *ppd,
|
||||
const char *keyword,
|
||||
const char *spec, const char *ll_CC,
|
||||
@@ -55,10 +54,6 @@ static ppd_attr_t *ppd_localized_attr(ppd_file_t *ppd,
|
||||
/*
|
||||
* 'ppdLocalize()' - Localize the PPD file to the current locale.
|
||||
*
|
||||
* All groups, options, and choices are localized, as are ICC profile
|
||||
* descriptions, printer presets, and custom option parameters. Each
|
||||
* localized string uses the UTF-8 character encoding.
|
||||
*
|
||||
* @since CUPS 1.2@
|
||||
*/
|
||||
|
||||
@@ -91,7 +86,7 @@ ppdLocalize(ppd_file_t *ppd) /* I - PPD file */
|
||||
* Get the default language...
|
||||
*/
|
||||
|
||||
ppd_ll_CC(ll_CC, sizeof(ll_CC), ll, sizeof(ll));
|
||||
ppd_ll_CC(ll_CC, ll);
|
||||
|
||||
/*
|
||||
* Now lookup all of the groups, options, choices, etc.
|
||||
@@ -200,7 +195,7 @@ ppdLocalize(ppd_file_t *ppd) /* I - PPD file */
|
||||
*
|
||||
* This function uses the current locale to find the corresponding reason
|
||||
* text or URI from the attribute value. If "scheme" is NULL or "text",
|
||||
* the returned value contains human-readable (UTF-8) text from the translation
|
||||
* the returned value contains human-readable text from the translation
|
||||
* string or attribute value. Otherwise the corresponding URI is returned.
|
||||
*
|
||||
* If no value of the requested scheme can be found, NULL is returned.
|
||||
@@ -241,7 +236,7 @@ ppdLocalizeIPPReason(
|
||||
* Get the default language...
|
||||
*/
|
||||
|
||||
ppd_ll_CC(ll_CC, sizeof(ll_CC), ll, sizeof(ll));
|
||||
ppd_ll_CC(ll_CC, ll);
|
||||
|
||||
/*
|
||||
* Find the localized attribute...
|
||||
@@ -270,7 +265,6 @@ ppdLocalizeIPPReason(
|
||||
strlcpy(buffer, locattr->text, bufsize);
|
||||
|
||||
for (valptr = locattr->value, bufptr = buffer; *valptr && bufptr < bufend;)
|
||||
{
|
||||
if (!strncmp(valptr, "text:", 5))
|
||||
{
|
||||
/*
|
||||
@@ -313,24 +307,10 @@ ppdLocalizeIPPReason(
|
||||
else
|
||||
*bufptr++ = *valptr++;
|
||||
}
|
||||
|
||||
while (isspace(*valptr & 255))
|
||||
valptr ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Skip this URI...
|
||||
*/
|
||||
|
||||
while (*valptr && !isspace(*valptr & 255))
|
||||
valptr++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*valptr & 255))
|
||||
valptr ++;
|
||||
}
|
||||
|
||||
if (bufptr > buffer)
|
||||
*bufptr = '\0';
|
||||
@@ -344,18 +324,9 @@ ppdLocalizeIPPReason(
|
||||
*/
|
||||
|
||||
schemelen = strlen(scheme);
|
||||
if (scheme[schemelen - 1] == ':') /* Force scheme to be just the name */
|
||||
schemelen --;
|
||||
|
||||
for (valptr = locattr->value, bufptr = buffer; *valptr && bufptr < bufend;)
|
||||
{
|
||||
if ((!strncmp(valptr, scheme, schemelen) && valptr[schemelen] == ':') ||
|
||||
(*valptr == '/' && !strcmp(scheme, "file")))
|
||||
if (!strncmp(valptr, scheme, schemelen) && valptr[schemelen] == ':')
|
||||
{
|
||||
/*
|
||||
* Copy URI...
|
||||
*/
|
||||
|
||||
while (*valptr && !isspace(*valptr & 255) && bufptr < bufend)
|
||||
*bufptr++ = *valptr++;
|
||||
|
||||
@@ -363,23 +334,6 @@ ppdLocalizeIPPReason(
|
||||
|
||||
return (buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Skip this URI...
|
||||
*/
|
||||
|
||||
while (*valptr && !isspace(*valptr & 255))
|
||||
valptr++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip whitespace...
|
||||
*/
|
||||
|
||||
while (isspace(*valptr & 255))
|
||||
valptr ++;
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
@@ -392,9 +346,8 @@ ppdLocalizeIPPReason(
|
||||
|
||||
static void
|
||||
ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */
|
||||
int ll_CC_size, /* I - Size of country-specific name */
|
||||
char *ll, /* O - Generic locale name */
|
||||
int ll_size) /* I - Size of generic name */
|
||||
char *ll) /* O - Generic locale name */
|
||||
|
||||
{
|
||||
cups_lang_t *lang; /* Current language */
|
||||
|
||||
@@ -405,8 +358,8 @@ ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */
|
||||
|
||||
if ((lang = cupsLangDefault()) == NULL)
|
||||
{
|
||||
strlcpy(ll_CC, "en_US", ll_CC_size);
|
||||
strlcpy(ll, "en", ll_size);
|
||||
strcpy(ll_CC, "en_US");
|
||||
strcpy(ll, "en");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -414,10 +367,8 @@ ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */
|
||||
* Copy the locale name...
|
||||
*/
|
||||
|
||||
strlcpy(ll_CC, lang->language, ll_CC_size);
|
||||
strlcpy(ll, lang->language, ll_size);
|
||||
|
||||
DEBUG_printf(("ll_CC=\"%s\", ll=\"%s\"\n", ll_CC, ll));
|
||||
strlcpy(ll_CC, lang->language, sizeof(ll_CC));
|
||||
strlcpy(ll, lang->language, sizeof(ll));
|
||||
|
||||
if (strlen(ll_CC) == 2)
|
||||
{
|
||||
@@ -427,16 +378,16 @@ ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */
|
||||
*/
|
||||
|
||||
if (!strcmp(ll_CC, "cs"))
|
||||
strlcpy(ll_CC, "cs_CZ", ll_CC_size);
|
||||
strcpy(ll_CC, "cs_CZ");
|
||||
else if (!strcmp(ll_CC, "en"))
|
||||
strlcpy(ll_CC, "en_US", ll_CC_size);
|
||||
strcpy(ll_CC, "en_US");
|
||||
else if (!strcmp(ll_CC, "ja"))
|
||||
strlcpy(ll_CC, "ja_JP", ll_CC_size);
|
||||
strcpy(ll_CC, "ja_JP");
|
||||
else if (!strcmp(ll_CC, "sv"))
|
||||
strlcpy(ll_CC, "sv_SE", ll_CC_size);
|
||||
else if (!strcmp(ll_CC, "zh")) /* Simplified Chinese */
|
||||
strlcpy(ll_CC, "zh_CN", ll_CC_size);
|
||||
else if (ll_CC_size >= 6)
|
||||
strcpy(ll_CC, "sv_SE");
|
||||
else if (!strcmp(ll_CC, "zh"))
|
||||
strcpy(ll_CC, "zh_CN"); /* Simplified Chinese */
|
||||
else
|
||||
{
|
||||
ll_CC[2] = '_';
|
||||
ll_CC[3] = toupper(ll_CC[0] & 255);
|
||||
@@ -479,31 +430,17 @@ ppd_localized_attr(ppd_file_t *ppd, /* I - PPD file */
|
||||
snprintf(lkeyword, sizeof(lkeyword), "%s.%s", ll, keyword);
|
||||
attr = ppdFindAttr(ppd, lkeyword, spec);
|
||||
|
||||
if (!attr)
|
||||
if (!attr && !strcmp(ll, "ja"))
|
||||
{
|
||||
if (!strcmp(ll, "ja"))
|
||||
{
|
||||
/*
|
||||
* Due to a bug in the CUPS DDK 1.1.0 ppdmerge program, Japanese
|
||||
* PPD files were incorrectly assigned "jp" as the locale name
|
||||
* instead of "ja". Support both the old (incorrect) and new
|
||||
* locale names for Japanese...
|
||||
*/
|
||||
/*
|
||||
* Due to a bug in the CUPS DDK 1.1.0 ppdmerge program, Japanese
|
||||
* PPD files were incorrectly assigned "jp" as the locale name
|
||||
* instead of "ja". Support both the old (incorrect) and new
|
||||
* locale names for Japanese...
|
||||
*/
|
||||
|
||||
snprintf(lkeyword, sizeof(lkeyword), "jp.%s", keyword);
|
||||
attr = ppdFindAttr(ppd, lkeyword, spec);
|
||||
}
|
||||
else if (!strcmp(ll, "no"))
|
||||
{
|
||||
/*
|
||||
* Norway has two languages, "Bokmal" (the primary one)
|
||||
* and "Nynorsk" (new Norwegian); we map "no" to "nb" here as
|
||||
* recommended by the locale folks...
|
||||
*/
|
||||
|
||||
snprintf(lkeyword, sizeof(lkeyword), "nb.%s", keyword);
|
||||
attr = ppdFindAttr(ppd, lkeyword, spec);
|
||||
}
|
||||
snprintf(lkeyword, sizeof(lkeyword), "jp.%s", keyword);
|
||||
attr = ppdFindAttr(ppd, lkeyword, spec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,8 +73,6 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
|
||||
for (o1 = ppdFirstOption(ppd); o1; o1 = ppdNextOption(ppd))
|
||||
o1->conflicted = 0;
|
||||
|
||||
cupsArraySave(ppd->marked);
|
||||
|
||||
/*
|
||||
* Loop through all of the UI constraints and flag any options
|
||||
* that conflict...
|
||||
@@ -175,8 +173,6 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
|
||||
}
|
||||
}
|
||||
|
||||
cupsArrayRestore(ppd->marked);
|
||||
|
||||
/*
|
||||
* Return the number of conflicts found...
|
||||
*/
|
||||
@@ -621,7 +617,8 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
|
||||
else if (!strcasecmp(option, "InputSlot"))
|
||||
{
|
||||
/*
|
||||
* Unmark ManualFeed option...
|
||||
* Unmark ManualFeed True and possibly mark ManualFeed False
|
||||
* option...
|
||||
*/
|
||||
|
||||
if ((o = ppdFindOption(ppd, "ManualFeed")) != NULL)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
* cupsMarkOptions() - Mark command-line options in a PPD file.
|
||||
* cupsParseOptions() - Parse options from a command-line argument.
|
||||
* cupsRemoveOptions() - Remove an option from an option array.
|
||||
* debug_marked() - Output the marked array to stdout...
|
||||
* ppd_mark_choices() - Mark one or more option choices from a string.
|
||||
*/
|
||||
|
||||
@@ -41,11 +40,6 @@
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
static void debug_marked(ppd_file_t *ppd, const char *title);
|
||||
#else
|
||||
# define debug_marked(ppd,title)
|
||||
#endif /* DEBUG */
|
||||
static int ppd_mark_choices(ppd_file_t *ppd, const char *options);
|
||||
|
||||
|
||||
@@ -211,8 +205,6 @@ cupsMarkOptions(
|
||||
if (ppd == NULL || num_options <= 0 || options == NULL)
|
||||
return (0);
|
||||
|
||||
debug_marked(ppd, "Before...");
|
||||
|
||||
/*
|
||||
* Mark options...
|
||||
*/
|
||||
@@ -264,7 +256,7 @@ cupsMarkOptions(
|
||||
conflict = 1;
|
||||
|
||||
if (cupsGetOption("EFMediaType", num_options, options) == NULL)
|
||||
if (ppdMarkOption(ppd, "EFMediaType", s)) /* EFI */
|
||||
if (ppdMarkOption(ppd, "EFMediaType", s))
|
||||
conflict = 1;
|
||||
|
||||
if (cupsGetOption("EFMediaQualityMode", num_options, options) == NULL)
|
||||
@@ -437,16 +429,12 @@ cupsMarkOptions(
|
||||
conflict = 1;
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(optptr->name, "mirror"))
|
||||
{
|
||||
if (ppdMarkOption(ppd, "MirrorPrint", optptr->value))
|
||||
conflict = 1;
|
||||
}
|
||||
else if (!strcasecmp(optptr->name, "mirror") &&
|
||||
ppdMarkOption(ppd, "MirrorPrint", optptr->value))
|
||||
conflict = 1;
|
||||
else if (ppdMarkOption(ppd, optptr->name, optptr->value))
|
||||
conflict = 1;
|
||||
|
||||
debug_marked(ppd, "After...");
|
||||
|
||||
return (conflict);
|
||||
}
|
||||
|
||||
@@ -707,28 +695,6 @@ cupsRemoveOption(
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
/*
|
||||
* 'debug_marked()' - Output the marked array to stdout...
|
||||
*/
|
||||
|
||||
static void
|
||||
debug_marked(ppd_file_t *ppd, /* I - PPD file data */
|
||||
const char *title) /* I - Title for list */
|
||||
{
|
||||
ppd_choice_t *c; /* Current choice */
|
||||
|
||||
|
||||
printf("cupsMarkOptions: %s\n", title);
|
||||
|
||||
for (c = (ppd_choice_t *)cupsArrayFirst(ppd->marked);
|
||||
c;
|
||||
c = (ppd_choice_t *)cupsArrayNext(ppd->marked))
|
||||
printf("cupsMarkOptions: %s=%s\n", c->option->keyword, c->choice);
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/*
|
||||
* 'ppd_mark_choices()' - Mark one or more option choices from a string.
|
||||
*/
|
||||
|
||||
@@ -573,7 +573,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
ppd->language_level = 2;
|
||||
ppd->language_level = 1;
|
||||
ppd->color_device = 0;
|
||||
ppd->colorspace = PPD_CS_GRAY;
|
||||
ppd->landscape = -90;
|
||||
@@ -2248,7 +2248,7 @@ static int /* O - Result of comparison */
|
||||
ppd_compare_choices(ppd_choice_t *a, /* I - First choice */
|
||||
ppd_choice_t *b) /* I - Second choice */
|
||||
{
|
||||
return (strcmp(a->option->keyword, b->option->keyword));
|
||||
return (a->option - b->option);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* cupsDoFileRequest() - Do an IPP request with a file.
|
||||
* cupsDoRequest() - Do an IPP request.
|
||||
* _cupsSetError() - Set the last IPP status code and status-message.
|
||||
* _cupsSetHTTPError() - Set the last error using the HTTP status.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -456,7 +455,44 @@ cupsDoIORequest(http_t *http, /* I - HTTP connection to server */
|
||||
ippErrorString(response->request.status.status_code));
|
||||
}
|
||||
else if (status != HTTP_OK)
|
||||
_cupsSetHTTPError(status);
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case HTTP_NOT_FOUND :
|
||||
_cupsSetError(IPP_NOT_FOUND, httpStatus(status));
|
||||
break;
|
||||
|
||||
case HTTP_UNAUTHORIZED :
|
||||
_cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status));
|
||||
break;
|
||||
|
||||
case HTTP_FORBIDDEN :
|
||||
_cupsSetError(IPP_FORBIDDEN, httpStatus(status));
|
||||
break;
|
||||
|
||||
case HTTP_BAD_REQUEST :
|
||||
_cupsSetError(IPP_BAD_REQUEST, httpStatus(status));
|
||||
break;
|
||||
|
||||
case HTTP_REQUEST_TOO_LARGE :
|
||||
_cupsSetError(IPP_REQUEST_VALUE, httpStatus(status));
|
||||
break;
|
||||
|
||||
case HTTP_NOT_IMPLEMENTED :
|
||||
_cupsSetError(IPP_OPERATION_NOT_SUPPORTED, httpStatus(status));
|
||||
break;
|
||||
|
||||
case HTTP_NOT_SUPPORTED :
|
||||
_cupsSetError(IPP_VERSION_NOT_SUPPORTED, httpStatus(status));
|
||||
break;
|
||||
|
||||
default :
|
||||
DEBUG_printf(("HTTP error %d mapped to IPP_SERVICE_UNAVAILABLE!\n",
|
||||
status));
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE, httpStatus(status));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (response);
|
||||
}
|
||||
@@ -505,52 +541,6 @@ _cupsSetError(ipp_status_t status, /* I - IPP status code */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsSetHTTPError()' - Set the last error using the HTTP status.
|
||||
*/
|
||||
|
||||
void
|
||||
_cupsSetHTTPError(http_status_t status) /* I - HTTP status code */
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case HTTP_NOT_FOUND :
|
||||
_cupsSetError(IPP_NOT_FOUND, httpStatus(status));
|
||||
break;
|
||||
|
||||
case HTTP_UNAUTHORIZED :
|
||||
_cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status));
|
||||
break;
|
||||
|
||||
case HTTP_FORBIDDEN :
|
||||
_cupsSetError(IPP_FORBIDDEN, httpStatus(status));
|
||||
break;
|
||||
|
||||
case HTTP_BAD_REQUEST :
|
||||
_cupsSetError(IPP_BAD_REQUEST, httpStatus(status));
|
||||
break;
|
||||
|
||||
case HTTP_REQUEST_TOO_LARGE :
|
||||
_cupsSetError(IPP_REQUEST_VALUE, httpStatus(status));
|
||||
break;
|
||||
|
||||
case HTTP_NOT_IMPLEMENTED :
|
||||
_cupsSetError(IPP_OPERATION_NOT_SUPPORTED, httpStatus(status));
|
||||
break;
|
||||
|
||||
case HTTP_NOT_SUPPORTED :
|
||||
_cupsSetError(IPP_VERSION_NOT_SUPPORTED, httpStatus(status));
|
||||
break;
|
||||
|
||||
default :
|
||||
DEBUG_printf(("HTTP error %d mapped to IPP_SERVICE_UNAVAILABLE!\n",
|
||||
status));
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE, httpStatus(status));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
|
||||
@@ -2,26 +2,36 @@
|
||||
*%
|
||||
*% "$Id$"
|
||||
*%
|
||||
*% Test PPD file for the Common UNIX Printing System (CUPS).
|
||||
*% Test PPD file for the Common UNIX Printing System (CUPS).
|
||||
*%
|
||||
*% This file is used to test the CUPS PPD API functions and cannot be
|
||||
*% used with any known printers. Look at the PPD files in the "ppd"
|
||||
*% subdirectory as well as the CUPS web site for working PPD files.
|
||||
*% This file is used to test the CUPS PPD API functions and cannot be
|
||||
*% used with any known printers. Look at the PPD files in the "ppd"
|
||||
*% subdirectory as well as the CUPS web site for working PPD files.
|
||||
*%
|
||||
*% If you are a PPD file developer, consider using the CUPS DDK to
|
||||
*% create your PPD files - not only will it save you time, it produces
|
||||
*% consistently high-quality files.
|
||||
*% If you are a PPD file developer, consider using the CUPS DDK to
|
||||
*% create your PPD files - not only will it save you time, it produces
|
||||
*% consistently high-quality files.
|
||||
*%
|
||||
*% Copyright 2002-2006 by Easy Software Products.
|
||||
*%
|
||||
*% These coded instructions, statements, and computer programs are the
|
||||
*% property of Easy Software Products 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 missing or damaged please contact Easy Software Products
|
||||
*% at:
|
||||
*%
|
||||
*% Attn: CUPS Licensing Information
|
||||
*% Easy Software Products
|
||||
*% 44141 Airport View Drive, Suite 204
|
||||
*% Hollywood, Maryland 20636-3111 USA
|
||||
*%
|
||||
*% Voice: (301) 373-9603
|
||||
*% EMail: cups-info@cups.org
|
||||
*% WWW: http://www.cups.org
|
||||
*%
|
||||
*% Copyright 2007 by Apple Inc.
|
||||
*% Copyright 2002-2006 by Easy Software Products.
|
||||
*%
|
||||
*% 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/".
|
||||
*FormatVersion: "4.3"
|
||||
*FileVersion: "1.3"
|
||||
*FileVersion: "1.2"
|
||||
*LanguageVersion: English
|
||||
*LanguageEncoding: ISOLatin1
|
||||
*PCFileName: "TEST.PPD"
|
||||
@@ -33,7 +43,7 @@
|
||||
*cupsModelNumber: 1
|
||||
*ModelName: "Test"
|
||||
*ShortNickName: "Test"
|
||||
*NickName: "Test for CUPS v1.3"
|
||||
*NickName: "Test for CUPS v1.2"
|
||||
*PSVersion: "(3010.000) 81501"
|
||||
*LanguageLevel: "3"
|
||||
*ColorDevice: True
|
||||
@@ -138,30 +148,6 @@
|
||||
|
||||
*CloseGroup: Extended
|
||||
|
||||
*% IPP reasons (for ppdLocalizeIPPReason tests)
|
||||
*cupsIPPReason foo/Foo Reason: "http://foo/bar.html
|
||||
help:anchor='foo'%20bookID=Vendor%20Help
|
||||
/help/foo/bar.html"
|
||||
*End
|
||||
*fr.cupsIPPReason foo/La Foo Reason: "text:La%20Long
|
||||
text:Foo%20Reason
|
||||
http://foo/fr/bar.html
|
||||
help:anchor='foo'%20bookID=Vendor%20Help
|
||||
/help/fr/foo/bar.html"
|
||||
*End
|
||||
*zh_TW.cupsIPPReason foo/Number 1 Foo Reason: "text:Number%201
|
||||
text:Foo%20Reason
|
||||
http://foo/zh_TW/bar.html
|
||||
help:anchor='foo'%20bookID=Vendor%20Help
|
||||
/help/zh_TW/foo/bar.html"
|
||||
*End
|
||||
*zh.cupsIPPReason foo/Number 2 Foo Reason: "text:Number%202
|
||||
text:Foo%20Reason
|
||||
http://foo/zh/bar.html
|
||||
help:anchor='foo'%20bookID=Vendor%20Help
|
||||
/help/zh/foo/bar.html"
|
||||
*End
|
||||
|
||||
*DefaultFont: Courier
|
||||
*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
|
||||
*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Main entry.
|
||||
* read_write_tests() - Perform read/write tests.
|
||||
* main() - Main entry.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -150,8 +149,6 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
unsigned char readbuf[8192], /* Read buffer */
|
||||
writebuf[8192]; /* Write buffer */
|
||||
int byte; /* Byte from file */
|
||||
static const char *partial_line = "partial line";
|
||||
/* Partial line */
|
||||
|
||||
|
||||
/*
|
||||
@@ -256,25 +253,11 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
|
||||
fputs("cupsFileWrite(): ", stdout);
|
||||
|
||||
for (i = 0; i < 10000; i ++)
|
||||
for (i = 0; i < 100; i ++)
|
||||
if (cupsFileWrite(fp, (char *)writebuf, sizeof(writebuf)) < 0)
|
||||
break;
|
||||
|
||||
if (i >= 10000)
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
printf("FAIL (%s)\n", strerror(errno));
|
||||
status ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* cupsFilePuts() with partial line...
|
||||
*/
|
||||
|
||||
fputs("cupsFilePuts(\"partial line\"): ", stdout);
|
||||
|
||||
if (cupsFilePuts(fp, partial_line) > 0)
|
||||
if (i >= 100)
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
@@ -422,13 +405,13 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
|
||||
fputs("cupsFileRead(): ", stdout);
|
||||
|
||||
for (i = 0; i < 10000; i ++)
|
||||
for (i = 0; i < 100; i ++)
|
||||
if ((byte = cupsFileRead(fp, (char *)readbuf, sizeof(readbuf))) < 0)
|
||||
break;
|
||||
else if (memcmp(readbuf, writebuf, sizeof(readbuf)))
|
||||
break;
|
||||
|
||||
if (i >= 10000)
|
||||
if (i >= 100)
|
||||
puts("PASS");
|
||||
else if (byte > 0)
|
||||
{
|
||||
@@ -447,26 +430,6 @@ read_write_tests(int compression) /* I - Use compression? */
|
||||
status ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* cupsFileGetChar() with partial line...
|
||||
*/
|
||||
|
||||
fputs("cupsFileGetChar(partial line): ", stdout);
|
||||
|
||||
for (i = 0; i < strlen(partial_line); i ++)
|
||||
if ((byte = cupsFileGetChar(fp)) < 0)
|
||||
break;
|
||||
else if (byte != partial_line[i])
|
||||
break;
|
||||
|
||||
if (!partial_line[i])
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
printf("FAIL (got '%c', expected '%c')\n", byte, partial_line[i]);
|
||||
status ++;
|
||||
}
|
||||
|
||||
/*
|
||||
* cupsFileClose()
|
||||
*/
|
||||
|
||||
@@ -98,7 +98,6 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
int status; /* Status of tests (0 = success, 1 = fail) */
|
||||
int conflicts; /* Number of conflicts */
|
||||
char *s; /* String */
|
||||
char buffer[8192]; /* String buffer */
|
||||
|
||||
|
||||
status = 0;
|
||||
@@ -138,7 +137,6 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
status ++;
|
||||
printf("FAIL (%d bytes instead of %d)\n", s ? (int)strlen(s) : 0,
|
||||
(int)strlen(default_code));
|
||||
|
||||
@@ -157,7 +155,6 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
status ++;
|
||||
printf("FAIL (%d bytes instead of %d)\n", s ? (int)strlen(s) : 0,
|
||||
(int)strlen(custom_code));
|
||||
|
||||
@@ -168,74 +165,6 @@ main(int argc, /* I - Number of command-line arguments */
|
||||
if (s)
|
||||
free(s);
|
||||
|
||||
/*
|
||||
* Test localization...
|
||||
*/
|
||||
|
||||
fputs("ppdLocalizeIPPReason(text): ", stdout);
|
||||
if (ppdLocalizeIPPReason(ppd, "foo", NULL, buffer, sizeof(buffer)) &&
|
||||
!strcmp(buffer, "Foo Reason"))
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
status ++;
|
||||
printf("FAIL (\"%s\" instead of \"Foo Reason\")\n", buffer);
|
||||
}
|
||||
|
||||
fputs("ppdLocalizeIPPReason(http): ", stdout);
|
||||
if (ppdLocalizeIPPReason(ppd, "foo", "http", buffer, sizeof(buffer)) &&
|
||||
!strcmp(buffer, "http://foo/bar.html"))
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
status ++;
|
||||
printf("FAIL (\"%s\" instead of \"http://foo/bar.html\")\n", buffer);
|
||||
}
|
||||
|
||||
fputs("ppdLocalizeIPPReason(help): ", stdout);
|
||||
if (ppdLocalizeIPPReason(ppd, "foo", "help", buffer, sizeof(buffer)) &&
|
||||
!strcmp(buffer, "help:anchor='foo'%20bookID=Vendor%20Help"))
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
status ++;
|
||||
printf("FAIL (\"%s\" instead of \"help:anchor='foo'%%20bookID=Vendor%%20Help\")\n", buffer);
|
||||
}
|
||||
|
||||
fputs("ppdLocalizeIPPReason(file): ", stdout);
|
||||
if (ppdLocalizeIPPReason(ppd, "foo", "file", buffer, sizeof(buffer)) &&
|
||||
!strcmp(buffer, "/help/foo/bar.html"))
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
status ++;
|
||||
printf("FAIL (\"%s\" instead of \"/help/foo/bar.html\")\n", buffer);
|
||||
}
|
||||
|
||||
putenv("LANG=fr");
|
||||
|
||||
fputs("ppdLocalizeIPPReason(fr text): ", stdout);
|
||||
if (ppdLocalizeIPPReason(ppd, "foo", NULL, buffer, sizeof(buffer)) &&
|
||||
!strcmp(buffer, "La Long Foo Reason"))
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
status ++;
|
||||
printf("FAIL (\"%s\" instead of \"La Long Foo Reason\")\n", buffer);
|
||||
}
|
||||
|
||||
putenv("LANG=zh_TW");
|
||||
|
||||
fputs("ppdLocalizeIPPReason(zh_TW text): ", stdout);
|
||||
if (ppdLocalizeIPPReason(ppd, "foo", NULL, buffer, sizeof(buffer)) &&
|
||||
!strcmp(buffer, "Number 1 Foo Reason"))
|
||||
puts("PASS");
|
||||
else
|
||||
{
|
||||
status ++;
|
||||
printf("FAIL (\"%s\" instead of \"Number 1 Foo Reason\")\n", buffer);
|
||||
}
|
||||
|
||||
ppdClose(ppd);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -42,9 +42,9 @@ WEBBUTTONS = \
|
||||
images/button-delete-printer.gif \
|
||||
images/button-edit-configuration-file.gif \
|
||||
images/button-export-samba.gif \
|
||||
images/button-find-new-printers.gif \
|
||||
images/button-help.gif \
|
||||
images/button-hold-job.gif \
|
||||
images/button-list-available-printers.gif \
|
||||
images/button-manage-classes.gif \
|
||||
images/button-manage-jobs.gif \
|
||||
images/button-manage-printers.gif \
|
||||
@@ -92,8 +92,6 @@ WEBIMAGES = \
|
||||
images/printer-idle.gif \
|
||||
images/printer-processing.gif \
|
||||
images/printer-stopped.gif \
|
||||
images/raster.png \
|
||||
images/raster.svg \
|
||||
images/smiley.jpg \
|
||||
images/tab-left.gif \
|
||||
images/tab-right.gif \
|
||||
@@ -117,7 +115,6 @@ HELPFILES = \
|
||||
help/api-raster.html \
|
||||
help/cgi.html \
|
||||
help/glossary.html \
|
||||
help/kerberos.html \
|
||||
help/license.html \
|
||||
help/man-accept.html \
|
||||
help/man-backend.html \
|
||||
|
||||
@@ -110,13 +110,14 @@ SPAN.info {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
|
||||
H2 SPAN.info, H3 SPAN.info {
|
||||
float: right;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
H2.title, H3.title {
|
||||
border-bottom: solid 2pt #000000;
|
||||
page-break-before: always;
|
||||
}
|
||||
|
||||
DT {
|
||||
@@ -133,7 +134,7 @@ DL.category DT {
|
||||
}
|
||||
|
||||
P.summary {
|
||||
margin-left: 36pt;
|
||||
margin-left: 54pt;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ SPAN.info {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
|
||||
H2 SPAN.info, H3 SPAN.info {
|
||||
float: right;
|
||||
font-size: 100%;
|
||||
}
|
||||
@@ -196,10 +196,9 @@ DIV.sidebar {
|
||||
background: #ddddaa;
|
||||
border: solid 2px #cccc99;
|
||||
float: right;
|
||||
min-width: 25%;
|
||||
margin-left: 10pt;
|
||||
max-width: 33%;
|
||||
padding: 5pt;
|
||||
width: 25%;
|
||||
/* These are not implemented by all browsers, but that's OK */
|
||||
border-radius: 10pt;
|
||||
-moz-border-radius: 10pt;
|
||||
@@ -255,7 +254,7 @@ DL.category DT {
|
||||
}
|
||||
|
||||
P.summary {
|
||||
margin-left: 36pt;
|
||||
margin-left: 54pt;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
|
||||
|
Antes Largura: | Altura: | Tamanho: 853 B |
|
Antes Largura: | Altura: | Tamanho: 713 B |
|
Antes Largura: | Altura: | Tamanho: 671 B |
|
Antes Largura: | Altura: | Tamanho: 864 B |
|
Antes Largura: | Altura: | Tamanho: 716 B Depois Largura: | Altura: | Tamanho: 623 B |
|
Antes Largura: | Altura: | Tamanho: 561 B Depois Largura: | Altura: | Tamanho: 527 B |
|
Antes Largura: | Altura: | Tamanho: 724 B Depois Largura: | Altura: | Tamanho: 617 B |
|
Antes Largura: | Altura: | Tamanho: 948 B |
|
Antes Largura: | Altura: | Tamanho: 892 B Depois Largura: | Altura: | Tamanho: 706 B |
|
Antes Largura: | Altura: | Tamanho: 897 B Depois Largura: | Altura: | Tamanho: 769 B |
|
Antes Largura: | Altura: | Tamanho: 646 B Depois Largura: | Altura: | Tamanho: 560 B |
|
Antes Largura: | Altura: | Tamanho: 881 B |
|
Antes Largura: | Altura: | Tamanho: 871 B Depois Largura: | Altura: | Tamanho: 777 B |
|
Antes Largura: | Altura: | Tamanho: 1.0 KiB Depois Largura: | Altura: | Tamanho: 882 B |
|
Antes Largura: | Altura: | Tamanho: 396 B Depois Largura: | Altura: | Tamanho: 359 B |
|
Antes Largura: | Altura: | Tamanho: 498 B Depois Largura: | Altura: | Tamanho: 461 B |
|
Antes Largura: | Altura: | Tamanho: 543 B Depois Largura: | Altura: | Tamanho: 483 B |
|
Antes Largura: | Altura: | Tamanho: 627 B Depois Largura: | Altura: | Tamanho: 562 B |
|
Antes Largura: | Altura: | Tamanho: 910 B Depois Largura: | Altura: | Tamanho: 788 B |
|
Antes Largura: | Altura: | Tamanho: 928 B Depois Largura: | Altura: | Tamanho: 838 B |
|
Antes Largura: | Altura: | Tamanho: 977 B |
|
Antes Largura: | Altura: | Tamanho: 424 B Depois Largura: | Altura: | Tamanho: 393 B |
|
Antes Largura: | Altura: | Tamanho: 603 B Depois Largura: | Altura: | Tamanho: 567 B |
|
Antes Largura: | Altura: | Tamanho: 807 B Depois Largura: | Altura: | Tamanho: 636 B |
|
Antes Largura: | Altura: | Tamanho: 744 B Depois Largura: | Altura: | Tamanho: 658 B |
|
Antes Largura: | Altura: | Tamanho: 914 B Depois Largura: | Altura: | Tamanho: 718 B |
|
Antes Largura: | Altura: | Tamanho: 788 B Depois Largura: | Altura: | Tamanho: 672 B |
|
Antes Largura: | Altura: | Tamanho: 618 B Depois Largura: | Altura: | Tamanho: 579 B |
|
Antes Largura: | Altura: | Tamanho: 797 B Depois Largura: | Altura: | Tamanho: 659 B |
|
Antes Largura: | Altura: | Tamanho: 669 B Depois Largura: | Altura: | Tamanho: 551 B |
|
Antes Largura: | Altura: | Tamanho: 918 B Depois Largura: | Altura: | Tamanho: 744 B |
|
Antes Largura: | Altura: | Tamanho: 930 B Depois Largura: | Altura: | Tamanho: 856 B |
|
Antes Largura: | Altura: | Tamanho: 858 B Depois Largura: | Altura: | Tamanho: 783 B |
|
Antes Largura: | Altura: | Tamanho: 722 B Depois Largura: | Altura: | Tamanho: 625 B |
|
Antes Largura: | Altura: | Tamanho: 781 B Depois Largura: | Altura: | Tamanho: 642 B |
|
Antes Largura: | Altura: | Tamanho: 640 B Depois Largura: | Altura: | Tamanho: 550 B |
|
Antes Largura: | Altura: | Tamanho: 738 B Depois Largura: | Altura: | Tamanho: 615 B |
|
Antes Largura: | Altura: | Tamanho: 737 B Depois Largura: | Altura: | Tamanho: 601 B |
|
Antes Largura: | Altura: | Tamanho: 416 B Depois Largura: | Altura: | Tamanho: 389 B |
|
Antes Largura: | Altura: | Tamanho: 888 B Depois Largura: | Altura: | Tamanho: 822 B |
|
Antes Largura: | Altura: | Tamanho: 977 B Depois Largura: | Altura: | Tamanho: 794 B |
|
Antes Largura: | Altura: | Tamanho: 925 B Depois Largura: | Altura: | Tamanho: 809 B |
|
Antes Largura: | Altura: | Tamanho: 910 B Depois Largura: | Altura: | Tamanho: 726 B |
|
Antes Largura: | Altura: | Tamanho: 904 B Depois Largura: | Altura: | Tamanho: 747 B |