From 88f9aafc49f9c4feb55d1d10daa0e494c22946fc Mon Sep 17 00:00:00 2001 From: msweet Date: Fri, 20 May 2011 07:26:13 +0000 Subject: [PATCH] Merge changes from CUPS 1.5b1-r9798. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@3275 a1ca3aef-8c08-0410-bb20-df032aa958be --- CHANGES.txt | 16 +- INSTALL.txt | 2 +- IPPTOOL.txt | 2 +- README.txt | 2 +- backend/dnssd.c | 36 +- backend/ieee1284.c | 10 +- backend/ipp.c | 83 ++--- backend/lpd.c | 46 +-- backend/serial.c | 30 +- backend/snmp-supplies.c | 2 +- backend/snmp.c | 32 +- backend/socket.c | 8 +- backend/usb-darwin.c | 22 +- backend/usb-libusb.c | 4 +- backend/usb-unix.c | 8 +- cgi-bin/admin.c | 82 ++--- cgi-bin/classes.c | 6 +- cgi-bin/help-index.c | 12 +- cgi-bin/help.c | 4 +- cgi-bin/ipp-var.c | 20 +- cgi-bin/makedocset.c | 10 +- cgi-bin/printers.c | 10 +- cgi-bin/search.c | 4 +- cgi-bin/template.c | 16 +- cgi-bin/var.c | 16 +- config-scripts/cups-common.m4 | 5 +- config.h.in | 9 +- cups/adminutil.c | 130 +++---- cups/api-filter.shtml | 221 ++++++++++-- cups/attr.c | 42 +-- cups/auth.c | 4 +- cups/conflicts.c | 142 ++++---- cups/custom.c | 2 +- cups/dest.c | 40 +-- cups/emit.c | 32 +- cups/encode.c | 18 +- cups/file-private.h | 3 +- cups/file.c | 26 ++ cups/http-addrlist.c | 10 +- cups/http-support.c | 20 +- cups/http.c | 8 +- cups/ipp-support.c | 50 +-- cups/ipp.c | 8 +- cups/language.c | 12 +- cups/localize.c | 2 +- cups/mark.c | 76 ++-- cups/options.c | 10 +- cups/page.c | 14 +- cups/ppd-cache.c | 210 +++++------ cups/ppd.c | 36 +- cups/pwg-media.c | 42 +-- cups/request.c | 2 +- cups/snmp.c | 8 +- cups/string-private.h | 29 +- cups/string.c | 18 +- cups/testconflicts.c | 4 +- cups/testcups.c | 10 +- cups/testfile.c | 8 +- cups/testi18n.c | 2 +- cups/testppd.c | 12 +- cups/testpwg.c | 6 +- cups/usersys.c | 45 ++- cups/util.c | 12 +- doc/help/api-filter.html | 223 ++++++++++-- doc/help/ref-cupsd-conf.html.in | 1 + doc/help/whatsnew.html | 65 +--- driver/commandtoescpx.c | 12 +- driver/commandtopclx.c | 4 +- filter/bannertops.c | 100 +++--- filter/commandtops.c | 6 +- filter/common.c | 4 +- filter/imagetops.c | 38 +- filter/imagetoraster.c | 34 +- filter/interpret.c | 24 ++ filter/pdftops.c | 8 +- filter/pstops.c | 116 ++---- filter/textcommon.c | 20 +- man/cupsd.conf.man.in | 6 +- notifier/mailto.c | 10 +- ppdc/genstrings.cxx | 4 +- ppdc/ppdc-driver.cxx | 24 +- ppdc/ppdc-group.cxx | 4 +- ppdc/ppdc-import.cxx | 10 +- ppdc/ppdc-option.cxx | 4 +- ppdc/ppdc-source.cxx | 260 +++++++------- ppdc/ppdc.cxx | 8 +- ppdc/ppdmerge.cxx | 24 +- ppdc/ppdpo.cxx | 2 +- scheduler/auth.c | 36 +- scheduler/banners.c | 4 +- scheduler/cert.c | 4 +- scheduler/classes.c | 76 ++-- scheduler/client.c | 62 ++-- scheduler/conf.c | 508 +++++++++++++++------------ scheduler/cups-deviced.c | 4 +- scheduler/cups-driverd.cxx | 52 +-- scheduler/cups-lpd.c | 8 +- scheduler/cupsfilter.c | 22 +- scheduler/dirsvc.c | 144 ++++---- scheduler/ipp.c | 105 ++++-- scheduler/job.c | 113 +++--- scheduler/job.h | 11 +- scheduler/log.c | 3 +- scheduler/main.c | 16 +- scheduler/policy.c | 18 +- scheduler/printers.c | 157 ++++----- scheduler/process.c | 138 ++++---- scheduler/quotas.c | 8 +- scheduler/subscriptions.c | 26 +- scheduler/sysman.c | 14 + scheduler/testmime.c | 8 +- scheduler/type.c | 6 +- scheduler/util.c | 6 +- standards/rfctohtml.c | 6 +- systemv/cancel.c | 4 +- systemv/cupstestppd.c | 72 ++-- systemv/lpadmin.c | 40 +-- systemv/lpoptions.c | 14 +- systemv/lpstat.c | 16 +- test/ippserver.c | 34 +- test/ipptool.c | 106 +++--- vcnet/config.h | 13 +- xcode/CUPS.xcodeproj/project.pbxproj | 2 +- xcode/config.h | 13 +- 124 files changed, 2560 insertions(+), 2131 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index f7d609ecf..d79c046c2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,8 +1,20 @@ -CHANGES.txt - 2011-05-11 +CHANGES.txt - 2011-05-20 ------------------------ CHANGES IN CUPS V1.5b1 + - Updated the PostScript filter to support IncludeFeature in more + circumstances (STR #3417) + - The schedule did not correctly parse some IPv6 addresses and masks in + the cupsd.conf file (STR #3533) + - Fixed a case-insensitive string comparison issue for locales that do + not treat "I" and "i" as equivalent (STR #3800) + - The scheduler reported an incorrect job-printer-uri value when sharing + was not enabled (STR #3639) + - The scheduler now allows the ServerAlias directive to contain multiple + hostnames separated by spaces or commas (STR #3813) + - The scheduler now sets the process group for child processes and + manages the group (STR #2829) - Fixed some minor issues discovered by a Coverity scan (STR #3838) - The scheduler now more carefully creates and removes configuration, cache, and state files (STR #3715) @@ -22,7 +34,7 @@ CHANGES IN CUPS V1.5b1 sizes in PDF files when the user has not selected a particular media size (STR #3689) - Added new PWG Raster filter for IPP Everywhere printer support. - - Added printer-uuid attribute. + - Added job-uuid, printer-uuid, and subscription-uuid attributes. - Added support for the cupsSingleFile PPD keyword. - Dropped support for the printer-state-history attribute (STR #3654) - Added support for a new cupsIPPSupplies keyword in PPD files to allow diff --git a/INSTALL.txt b/INSTALL.txt index 85757f0b7..782737edc 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -1,4 +1,4 @@ -INSTALL - CUPS v1.5b1 - 2011-05-11 +INSTALL - CUPS v1.5b1 - 2011-05-20 ---------------------------------- This file describes how to compile and install CUPS from source code. For more diff --git a/IPPTOOL.txt b/IPPTOOL.txt index f4e218a87..52094ea3d 100644 --- a/IPPTOOL.txt +++ b/IPPTOOL.txt @@ -1,4 +1,4 @@ -IPPTOOL.txt - 2011-05-11 +IPPTOOL.txt - 2011-05-20 ------------------------ diff --git a/README.txt b/README.txt index 38875d9d1..33a4861d6 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -README - CUPS v1.5b1 - 2011-05-11 +README - CUPS v1.5b1 - 2011-05-20 --------------------------------- Looking for compile instructions? Read the file "INSTALL.txt" diff --git a/backend/dnssd.c b/backend/dnssd.c index c78558ec9..ac547ab54 100644 --- a/backend/dnssd.c +++ b/backend/dnssd.c @@ -235,7 +235,7 @@ main(int argc, /* I - Number of command-line args */ kDNSServiceInterfaceIndexLocalOnly, "_printer._tcp", NULL, browse_local_callback, devices); - pdl_datastream_ref = main_ref; + pdl_datastream_ref = main_ref; DNSServiceBrowse(&pdl_datastream_ref, kDNSServiceFlagsShareConnection, 0, "_pdl-datastream._tcp", NULL, browse_callback, devices); @@ -325,8 +325,8 @@ main(int argc, /* I - Number of command-line args */ if (!best) best = device; - else if (strcasecmp(best->name, device->name) || - strcasecmp(best->domain, device->domain)) + else if (_cups_strcasecmp(best->name, device->name) || + _cups_strcasecmp(best->domain, device->domain)) { unquote(uriName, best->fullName, sizeof(uriName)); @@ -573,12 +573,12 @@ get_device(cups_array_t *devices, /* I - Device array */ for (device = cupsArrayFind(devices, &key); device; device = cupsArrayNext(devices)) - if (strcasecmp(device->name, key.name)) + if (_cups_strcasecmp(device->name, key.name)) break; else if (device->type == key.type) { - if (!strcasecmp(device->domain, "local.") && - strcasecmp(device->domain, replyDomain)) + if (!_cups_strcasecmp(device->domain, "local.") && + _cups_strcasecmp(device->domain, replyDomain)) { /* * Update the .local listing to use the "global" domain name instead. @@ -696,8 +696,8 @@ query_callback( device; device = cupsArrayNext(devices)) { - if (strcasecmp(device->name, dkey.name) || - strcasecmp(device->domain, dkey.domain)) + if (_cups_strcasecmp(device->name, dkey.name) || + _cups_strcasecmp(device->domain, dkey.domain)) { device = NULL; break; @@ -758,7 +758,7 @@ query_callback( else continue; - if (!strncasecmp(key, "usb_", 4)) + if (!_cups_strncasecmp(key, "usb_", 4)) { /* * Add USB device ID information... @@ -769,12 +769,12 @@ query_callback( key + 4, value); } - if (!strcasecmp(key, "usb_MFG") || !strcasecmp(key, "usb_MANU") || - !strcasecmp(key, "usb_MANUFACTURER")) + if (!_cups_strcasecmp(key, "usb_MFG") || !_cups_strcasecmp(key, "usb_MANU") || + !_cups_strcasecmp(key, "usb_MANUFACTURER")) strcpy(make_and_model, value); - else if (!strcasecmp(key, "usb_MDL") || !strcasecmp(key, "usb_MODEL")) + else if (!_cups_strcasecmp(key, "usb_MDL") || !_cups_strcasecmp(key, "usb_MODEL")) strcpy(model, value); - else if (!strcasecmp(key, "product") && !strstr(value, "Ghostscript")) + else if (!_cups_strcasecmp(key, "product") && !strstr(value, "Ghostscript")) { if (value[0] == '(') { @@ -790,18 +790,18 @@ query_callback( else strcpy(model, value); } - else if (!strcasecmp(key, "ty")) + else if (!_cups_strcasecmp(key, "ty")) { strcpy(model, value); if ((ptr = strchr(model, ',')) != NULL) *ptr = '\0'; } - else if (!strcasecmp(key, "priority")) + else if (!_cups_strcasecmp(key, "priority")) device->priority = atoi(value); else if ((device->type == CUPS_DEVICE_IPP || device->type == CUPS_DEVICE_PRINTER) && - !strcasecmp(key, "printer-type")) + !_cups_strcasecmp(key, "printer-type")) { /* * This is a CUPS printer! @@ -822,9 +822,9 @@ query_callback( if (make_and_model[0]) snprintf(device_id, sizeof(device_id), "MFG:%s;MDL:%s;", make_and_model, model); - else if (!strncasecmp(model, "designjet ", 10)) + else if (!_cups_strncasecmp(model, "designjet ", 10)) snprintf(device_id, sizeof(device_id), "MFG:HP;MDL:%s", model + 10); - else if (!strncasecmp(model, "stylus ", 7)) + else if (!_cups_strncasecmp(model, "stylus ", 7)) snprintf(device_id, sizeof(device_id), "MFG:EPSON;MDL:%s", model + 7); else if ((ptr = strchr(model, ' ')) != NULL) { diff --git a/backend/ieee1284.c b/backend/ieee1284.c index 13fb5cbeb..a9346d7a5 100644 --- a/backend/ieee1284.c +++ b/backend/ieee1284.c @@ -3,7 +3,7 @@ * * IEEE-1284 support functions for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -304,9 +304,9 @@ backendGetDeviceID( if (mfg) { - if (!strcasecmp(mfg, "Hewlett-Packard")) + if (!_cups_strcasecmp(mfg, "Hewlett-Packard")) mfg = "HP"; - else if (!strcasecmp(mfg, "Lexmark International")) + else if (!_cups_strcasecmp(mfg, "Lexmark International")) mfg = "Lexmark"; } else @@ -322,7 +322,7 @@ backendGetDeviceID( if (!mdl) mdl = ""; - if (!strncasecmp(mdl, mfg, strlen(mfg))) + if (!_cups_strncasecmp(mdl, mfg, strlen(mfg))) { mdl += strlen(mfg); @@ -397,7 +397,7 @@ backendGetMakeModel( if ((mfg = cupsGetOption("MANUFACTURER", num_values, values)) == NULL) mfg = cupsGetOption("MFG", num_values, values); - if (!mfg || !strncasecmp(mdl, mfg, strlen(mfg))) + if (!mfg || !_cups_strncasecmp(mdl, mfg, strlen(mfg))) { /* * Just copy the model string, since it has the manufacturer... diff --git a/backend/ipp.c b/backend/ipp.c index 2c13360bc..d19ce3778 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -114,13 +114,13 @@ static const char * const pattrs[] = /* Printer attributes we want */ }; static const char * const remote_job_states[] = { /* Remote job state keywords */ - "cups-remote-pending", - "cups-remote-pending-held", - "cups-remote-processing", - "cups-remote-stopped", - "cups-remote-canceled", - "cups-remote-aborted", - "cups-remote-completed" + "+cups-remote-pending", + "+cups-remote-pending-held", + "+cups-remote-processing", + "+cups-remote-stopped", + "+cups-remote-canceled", + "+cups-remote-aborted", + "+cups-remote-completed" }; static _cups_mutex_t report_mutex = _CUPS_MUTEX_INITIALIZER; /* Mutex to control access */ @@ -452,39 +452,39 @@ main(int argc, /* I - Number of command-line args */ * Process the option... */ - if (!strcasecmp(name, "waitjob")) + if (!_cups_strcasecmp(name, "waitjob")) { /* * Wait for job completion? */ - waitjob = !strcasecmp(value, "on") || - !strcasecmp(value, "yes") || - !strcasecmp(value, "true"); + waitjob = !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "yes") || + !_cups_strcasecmp(value, "true"); } - else if (!strcasecmp(name, "waitprinter")) + else if (!_cups_strcasecmp(name, "waitprinter")) { /* * Wait for printer idle? */ - waitprinter = !strcasecmp(value, "on") || - !strcasecmp(value, "yes") || - !strcasecmp(value, "true"); + waitprinter = !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "yes") || + !_cups_strcasecmp(value, "true"); } - else if (!strcasecmp(name, "encryption")) + else if (!_cups_strcasecmp(name, "encryption")) { /* * Enable/disable encryption? */ - if (!strcasecmp(value, "always")) + if (!_cups_strcasecmp(value, "always")) cupsSetEncryption(HTTP_ENCRYPT_ALWAYS); - else if (!strcasecmp(value, "required")) + else if (!_cups_strcasecmp(value, "required")) cupsSetEncryption(HTTP_ENCRYPT_REQUIRED); - else if (!strcasecmp(value, "never")) + else if (!_cups_strcasecmp(value, "never")) cupsSetEncryption(HTTP_ENCRYPT_NEVER); - else if (!strcasecmp(value, "ifrequested")) + else if (!_cups_strcasecmp(value, "ifrequested")) cupsSetEncryption(HTTP_ENCRYPT_IF_REQUESTED); else { @@ -493,7 +493,7 @@ main(int argc, /* I - Number of command-line args */ value); } } - else if (!strcasecmp(name, "version")) + else if (!_cups_strcasecmp(name, "version")) { if (!strcmp(value, "1.0")) version = 10; @@ -513,14 +513,14 @@ main(int argc, /* I - Number of command-line args */ } } #ifdef HAVE_LIBZ - else if (!strcasecmp(name, "compression")) + else if (!_cups_strcasecmp(name, "compression")) { - if (!strcasecmp(value, "true") || !strcasecmp(value, "yes") || - !strcasecmp(value, "on") || !strcasecmp(value, "gzip")) + if (!_cups_strcasecmp(value, "true") || !_cups_strcasecmp(value, "yes") || + !_cups_strcasecmp(value, "on") || !_cups_strcasecmp(value, "gzip")) compression = "gzip"; } #endif /* HAVE_LIBZ */ - else if (!strcasecmp(name, "contimeout")) + else if (!_cups_strcasecmp(name, "contimeout")) { /* * Set the connection timeout... @@ -551,9 +551,9 @@ main(int argc, /* I - Number of command-line args */ if (argc == 6) { num_files = 0; - send_options = !strcasecmp(final_content_type, "application/pdf") || - !strcasecmp(final_content_type, "application/vnd.cups-pdf") || - !strncasecmp(final_content_type, "image/", 6); + send_options = !_cups_strcasecmp(final_content_type, "application/pdf") || + !_cups_strcasecmp(final_content_type, "application/vnd.cups-pdf") || + !_cups_strncasecmp(final_content_type, "image/", 6); fputs("DEBUG: Sending stdin for job...\n", stderr); } @@ -925,7 +925,7 @@ main(int argc, /* I - Number of command-line args */ else if (!printer_accepting) update_reasons(NULL, "+cups-ipp-conformance-failure-report," "cups-ipp-missing-printer-is-accepting-jobs"); - + if ((printer_state = ippFindAttribute(supported, "printer-state-reasons", IPP_TAG_KEYWORD)) != NULL && !busy) @@ -1149,7 +1149,7 @@ main(int argc, /* I - Number of command-line args */ if (format_sup != NULL) { for (i = 0; i < format_sup->num_values; i ++) - if (!strcasecmp(final_content_type, format_sup->values[i].string.text)) + if (!_cups_strcasecmp(final_content_type, format_sup->values[i].string.text)) { document_format = final_content_type; break; @@ -1158,7 +1158,7 @@ main(int argc, /* I - Number of command-line args */ if (!document_format) { for (i = 0; i < format_sup->num_values; i ++) - if (!strcasecmp("application/octet-stream", + if (!_cups_strcasecmp("application/octet-stream", format_sup->values[i].string.text)) { document_format = "application/octet-stream"; @@ -2225,7 +2225,7 @@ new_request( else if ((keyword = cupsGetOption("ColorModel", num_options, options)) != NULL) { - if (!strcasecmp(keyword, "Gray")) + if (!_cups_strcasecmp(keyword, "Gray")) ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "output-mode", NULL, "monochrome"); else @@ -2240,13 +2240,13 @@ new_request( else if ((keyword = cupsGetOption("cupsPrintQuality", num_options, options)) != NULL) { - if (!strcasecmp(keyword, "draft")) + if (!_cups_strcasecmp(keyword, "draft")) ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_ENUM, "print-quality", IPP_QUALITY_DRAFT); - else if (!strcasecmp(keyword, "normal")) + else if (!_cups_strcasecmp(keyword, "normal")) ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_ENUM, "print-quality", IPP_QUALITY_NORMAL); - else if (!strcasecmp(keyword, "high")) + else if (!_cups_strcasecmp(keyword, "high")) ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_ENUM, "print-quality", IPP_QUALITY_HIGH); } @@ -2258,13 +2258,13 @@ new_request( (keyword = cupsGetOption(pc->sides_option, num_options, options)) != NULL) { - if (!strcasecmp(keyword, pc->sides_1sided)) + if (!_cups_strcasecmp(keyword, pc->sides_1sided)) ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "sides", NULL, "one-sided"); - else if (!strcasecmp(keyword, pc->sides_2sided_long)) + else if (!_cups_strcasecmp(keyword, pc->sides_2sided_long)) ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "sides", NULL, "two-sided-long-edge"); - if (!strcasecmp(keyword, pc->sides_2sided_short)) + if (!_cups_strcasecmp(keyword, pc->sides_2sided_short)) ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "sides", NULL, "two-sided-short-edge"); } @@ -2272,7 +2272,7 @@ new_request( if (doc_handling_sup && (keyword = cupsGetOption("collate", num_options, options)) != NULL) { - if (!strcasecmp(keyword, "true")) + if (!_cups_strcasecmp(keyword, "true")) collate_str = "separate-documents-collated-copies"; else collate_str = "separate-documents-uncollated-copies"; @@ -2496,7 +2496,7 @@ report_printer_state(ipp_t *ipp) /* I - IPP response */ if ((ppd = ppdOpenFile(getenv("PPD"))) != NULL && (ppdattr = ppdFindAttr(ppd, "cupsIPPSupplies", NULL)) != NULL && - ppdattr->value && strcasecmp(ppdattr->value, "true")) + ppdattr->value && _cups_strcasecmp(ppdattr->value, "true")) ipp_supplies = 0; else ipp_supplies = 1; @@ -2545,6 +2545,7 @@ run_as_user(int argc, /* I - Number of command-line args */ const char *device_uri, /* I - Device URI */ int fd) /* I - File to print */ { + const char *auth_negotiate;/* AUTH_NEGOTIATE env var */ xpc_connection_t conn; /* Connection to XPC service */ xpc_object_t request; /* Request message dictionary */ __block xpc_object_t response; /* Response message dictionary */ @@ -2605,6 +2606,8 @@ run_as_user(int argc, /* I - Number of command-line args */ xpc_dictionary_set_string(request, "options", argv[5]); xpc_dictionary_set_string(request, "auth-info-required", getenv("AUTH_INFO_REQUIRED")); + if ((auth_negotiate = getenv("AUTH_NEGOTIATE")) != NULL) + xpc_dictionary_set_string(request, "auth-negotiate", auth_negotiate); xpc_dictionary_set_fd(request, "stdin", fd); xpc_dictionary_set_fd(request, "stderr", 2); xpc_dictionary_set_fd(request, "side-channel", CUPS_SC_FD); diff --git a/backend/lpd.c b/backend/lpd.c index 90446addf..626683f14 100644 --- a/backend/lpd.c +++ b/backend/lpd.c @@ -297,16 +297,16 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * Process the option... */ - if (!strcasecmp(name, "banner")) + if (!_cups_strcasecmp(name, "banner")) { /* * Set the banner... */ - banner = !value[0] || !strcasecmp(value, "on") || - !strcasecmp(value, "yes") || !strcasecmp(value, "true"); + banner = !value[0] || !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "yes") || !_cups_strcasecmp(value, "true"); } - else if (!strcasecmp(name, "format") && value[0]) + else if (!_cups_strcasecmp(name, "format") && value[0]) { /* * Set output format... @@ -319,68 +319,68 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ _("Unknown format character: \"%c\"."), value[0]); } - else if (!strcasecmp(name, "mode") && value[0]) + else if (!_cups_strcasecmp(name, "mode") && value[0]) { /* * Set control/data order... */ - if (!strcasecmp(value, "standard")) + if (!_cups_strcasecmp(value, "standard")) mode = MODE_STANDARD; - else if (!strcasecmp(value, "stream")) + else if (!_cups_strcasecmp(value, "stream")) mode = MODE_STREAM; else _cupsLangPrintFilter(stderr, "ERROR", _("Unknown print mode: \"%s\"."), value); } - else if (!strcasecmp(name, "order") && value[0]) + else if (!_cups_strcasecmp(name, "order") && value[0]) { /* * Set control/data order... */ - if (!strcasecmp(value, "control,data")) + if (!_cups_strcasecmp(value, "control,data")) order = ORDER_CONTROL_DATA; - else if (!strcasecmp(value, "data,control")) + else if (!_cups_strcasecmp(value, "data,control")) order = ORDER_DATA_CONTROL; else _cupsLangPrintFilter(stderr, "ERROR", _("Unknown file order: \"%s\"."), value); } - else if (!strcasecmp(name, "reserve")) + else if (!_cups_strcasecmp(name, "reserve")) { /* * Set port reservation mode... */ - if (!value[0] || !strcasecmp(value, "on") || - !strcasecmp(value, "yes") || !strcasecmp(value, "true") || - !strcasecmp(value, "rfc1179")) + if (!value[0] || !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "yes") || !_cups_strcasecmp(value, "true") || + !_cups_strcasecmp(value, "rfc1179")) reserve = RESERVE_RFC1179; - else if (!strcasecmp(value, "any")) + else if (!_cups_strcasecmp(value, "any")) reserve = RESERVE_ANY; else reserve = RESERVE_NONE; } - else if (!strcasecmp(name, "manual_copies")) + else if (!_cups_strcasecmp(name, "manual_copies")) { /* * Set manual copies... */ - manual_copies = !value[0] || !strcasecmp(value, "on") || - !strcasecmp(value, "yes") || !strcasecmp(value, "true"); + manual_copies = !value[0] || !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "yes") || !_cups_strcasecmp(value, "true"); } - else if (!strcasecmp(name, "sanitize_title")) + else if (!_cups_strcasecmp(name, "sanitize_title")) { /* * Set sanitize title... */ - sanitize_title = !value[0] || !strcasecmp(value, "on") || - !strcasecmp(value, "yes") || !strcasecmp(value, "true"); + sanitize_title = !value[0] || !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "yes") || !_cups_strcasecmp(value, "true"); } - else if (!strcasecmp(name, "timeout")) + else if (!_cups_strcasecmp(name, "timeout")) { /* * Set the timeout... @@ -389,7 +389,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ if (atoi(value) > 0) timeout = atoi(value); } - else if (!strcasecmp(name, "contimeout")) + else if (!_cups_strcasecmp(name, "contimeout")) { /* * Set the connection timeout... diff --git a/backend/serial.c b/backend/serial.c index 79a980d4b..def68cb85 100644 --- a/backend/serial.c +++ b/backend/serial.c @@ -318,7 +318,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * Process the option... */ - if (!strcasecmp(name, "baud")) + if (!_cups_strcasecmp(name, "baud")) { /* * Set the baud rate... @@ -381,7 +381,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ } #endif /* B19200 == 19200 */ } - else if (!strcasecmp(name, "bits")) + else if (!_cups_strcasecmp(name, "bits")) { /* * Set number of data bits... @@ -402,25 +402,25 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ break; } } - else if (!strcasecmp(name, "parity")) + else if (!_cups_strcasecmp(name, "parity")) { /* * Set parity checking... */ - if (!strcasecmp(value, "even")) + if (!_cups_strcasecmp(value, "even")) { opts.c_cflag |= PARENB; opts.c_cflag &= ~PARODD; } - else if (!strcasecmp(value, "odd")) + else if (!_cups_strcasecmp(value, "odd")) { opts.c_cflag |= PARENB; opts.c_cflag |= PARODD; } - else if (!strcasecmp(value, "none")) + else if (!_cups_strcasecmp(value, "none")) opts.c_cflag &= ~PARENB; - else if (!strcasecmp(value, "space")) + else if (!_cups_strcasecmp(value, "space")) { /* * Note: we only support space parity with 7 bits per character... @@ -430,7 +430,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ opts.c_cflag |= CS8; opts.c_cflag &= ~PARENB; } - else if (!strcasecmp(value, "mark")) + else if (!_cups_strcasecmp(value, "mark")) { /* * Note: we only support mark parity with 7 bits per character @@ -443,29 +443,29 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ opts.c_cflag |= CSTOPB; } } - else if (!strcasecmp(name, "flow")) + else if (!_cups_strcasecmp(name, "flow")) { /* * Set flow control... */ - if (!strcasecmp(value, "none")) + if (!_cups_strcasecmp(value, "none")) { opts.c_iflag &= ~(IXON | IXOFF); opts.c_cflag &= ~CRTSCTS; } - else if (!strcasecmp(value, "soft")) + else if (!_cups_strcasecmp(value, "soft")) { opts.c_iflag |= IXON | IXOFF; opts.c_cflag &= ~CRTSCTS; } - else if (!strcasecmp(value, "hard") || - !strcasecmp(value, "rtscts")) + else if (!_cups_strcasecmp(value, "hard") || + !_cups_strcasecmp(value, "rtscts")) { opts.c_iflag &= ~(IXON | IXOFF); opts.c_cflag |= CRTSCTS; } - else if (!strcasecmp(value, "dtrdsr")) + else if (!_cups_strcasecmp(value, "dtrdsr")) { opts.c_iflag &= ~(IXON | IXOFF); opts.c_cflag &= ~CRTSCTS; @@ -473,7 +473,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ dtrdsr = 1; } } - else if (!strcasecmp(name, "stop")) + else if (!_cups_strcasecmp(name, "stop")) { switch (atoi(value)) { diff --git a/backend/snmp-supplies.c b/backend/snmp-supplies.c index 1d550e6e6..1bd8b7fa5 100644 --- a/backend/snmp-supplies.c +++ b/backend/snmp-supplies.c @@ -471,7 +471,7 @@ backend_init_supplies( if ((ppd = ppdOpenFile(getenv("PPD"))) == NULL || ((ppdattr = ppdFindAttr(ppd, "cupsSNMPSupplies", NULL)) != NULL && - ppdattr->value && strcasecmp(ppdattr->value, "true"))) + ppdattr->value && _cups_strcasecmp(ppdattr->value, "true"))) { ppdClose(ppd); return; diff --git a/backend/snmp.c b/backend/snmp.c index 34494d0e7..c53bf1616 100644 --- a/backend/snmp.c +++ b/backend/snmp.c @@ -467,7 +467,7 @@ static int /* O - Result of comparison */ compare_cache(snmp_cache_t *a, /* I - First cache entry */ snmp_cache_t *b) /* I - Second cache entry */ { - return (strcasecmp(a->addrname, b->addrname)); + return (_cups_strcasecmp(a->addrname, b->addrname)); } @@ -509,7 +509,7 @@ fix_make_model( * that printer driver detection works better... */ - if (!strncasecmp(old_make_model, "Hewlett-Packard", 15)) + if (!_cups_strncasecmp(old_make_model, "Hewlett-Packard", 15)) { /* * Strip leading Hewlett-Packard and hp prefixes and replace @@ -521,7 +521,7 @@ fix_make_model( while (isspace(*mmptr & 255)) mmptr ++; - if (!strncasecmp(mmptr, "hp", 2)) + if (!_cups_strncasecmp(mmptr, "hp", 2)) { mmptr += 2; @@ -534,11 +534,11 @@ fix_make_model( make_model[2] = ' '; strlcpy(make_model + 3, mmptr, make_model_size - 3); } - else if (!strncasecmp(old_make_model, "deskjet", 7)) + else if (!_cups_strncasecmp(old_make_model, "deskjet", 7)) snprintf(make_model, make_model_size, "HP DeskJet%s", old_make_model + 7); - else if (!strncasecmp(old_make_model, "officejet", 9)) + else if (!_cups_strncasecmp(old_make_model, "officejet", 9)) snprintf(make_model, make_model_size, "HP OfficeJet%s", old_make_model + 9); - else if (!strncasecmp(old_make_model, "stylus_pro_", 11)) + else if (!_cups_strncasecmp(old_make_model, "stylus_pro_", 11)) snprintf(make_model, make_model_size, "EPSON Stylus Pro %s", old_make_model + 11); else @@ -844,16 +844,16 @@ read_snmp_conf(const char *address) /* I - Single address to probe */ if (!value) fprintf(stderr, "ERROR: Missing value on line %d of %s!\n", linenum, filename); - else if (!strcasecmp(line, "Address")) + else if (!_cups_strcasecmp(line, "Address")) { if (!address) add_array(Addresses, value); } - else if (!strcasecmp(line, "Community")) + else if (!_cups_strcasecmp(line, "Community")) add_array(Communities, value); - else if (!strcasecmp(line, "DebugLevel")) + else if (!_cups_strcasecmp(line, "DebugLevel")) DebugLevel = atoi(value); - else if (!strcasecmp(line, "DeviceURI")) + else if (!_cups_strcasecmp(line, "DeviceURI")) { if (*value != '\"') fprintf(stderr, @@ -862,12 +862,12 @@ read_snmp_conf(const char *address) /* I - Single address to probe */ else add_device_uri(value); } - else if (!strcasecmp(line, "HostNameLookups")) - HostNameLookups = !strcasecmp(value, "on") || - !strcasecmp(value, "yes") || - !strcasecmp(value, "true") || - !strcasecmp(value, "double"); - else if (!strcasecmp(line, "MaxRunTime")) + else if (!_cups_strcasecmp(line, "HostNameLookups")) + HostNameLookups = !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "yes") || + !_cups_strcasecmp(value, "true") || + !_cups_strcasecmp(value, "double"); + else if (!_cups_strcasecmp(line, "MaxRunTime")) MaxRunTime = atoi(value); else fprintf(stderr, "ERROR: Unknown directive %s on line %d of %s!\n", diff --git a/backend/socket.c b/backend/socket.c index f6fc150ea..366a655e5 100644 --- a/backend/socket.c +++ b/backend/socket.c @@ -237,16 +237,16 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * Process the option... */ - if (!strcasecmp(name, "waiteof")) + if (!_cups_strcasecmp(name, "waiteof")) { /* * Set the wait-for-eof value... */ - waiteof = !value[0] || !strcasecmp(value, "on") || - !strcasecmp(value, "yes") || !strcasecmp(value, "true"); + waiteof = !value[0] || !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "yes") || !_cups_strcasecmp(value, "true"); } - else if (!strcasecmp(name, "contimeout")) + else if (!_cups_strcasecmp(name, "contimeout")) { /* * Set the connection timeout... diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c index 7f634328d..2576ac64c 100644 --- a/backend/usb-darwin.c +++ b/backend/usb-darwin.c @@ -1859,24 +1859,24 @@ static void parse_options(char *options, * Process the option... */ - if (!strcasecmp(name, "waiteof")) + if (!_cups_strcasecmp(name, "waiteof")) { - if (!strcasecmp(value, "on") || - !strcasecmp(value, "yes") || - !strcasecmp(value, "true")) + if (!_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "yes") || + !_cups_strcasecmp(value, "true")) *wait_eof = true; - else if (!strcasecmp(value, "off") || - !strcasecmp(value, "no") || - !strcasecmp(value, "false")) + else if (!_cups_strcasecmp(value, "off") || + !_cups_strcasecmp(value, "no") || + !_cups_strcasecmp(value, "false")) *wait_eof = false; else _cupsLangPrintFilter(stderr, "WARNING", _("Boolean expected for waiteof option \"%s\"."), value); } - else if (!strcasecmp(name, "serial")) + else if (!_cups_strcasecmp(name, "serial")) strlcpy(serial, value, serial_size); - else if (!strcasecmp(name, "location") && location) + else if (!_cups_strcasecmp(name, "location") && location) *location = strtol(value, NULL, 16); } } @@ -2175,9 +2175,9 @@ static void parse_pserror(char *sockBuffer, pCommentEnd += 3; /* Skip past "]%%" */ *pCommentEnd = '\0'; /* There's always room for the nul */ - if (strncasecmp(pCommentBegin, "%%[ Error:", 10) == 0) + if (_cups_strncasecmp(pCommentBegin, "%%[ Error:", 10) == 0) logLevel = "DEBUG"; - else if (strncasecmp(pCommentBegin, "%%[ Flushing", 12) == 0) + else if (_cups_strncasecmp(pCommentBegin, "%%[ Flushing", 12) == 0) logLevel = "DEBUG"; else logLevel = "INFO"; diff --git a/backend/usb-libusb.c b/backend/usb-libusb.c index 08af5997a..7f8c74a08 100644 --- a/backend/usb-libusb.c +++ b/backend/usb-libusb.c @@ -558,9 +558,9 @@ make_device_uri( if (mfg) { - if (!strcasecmp(mfg, "Hewlett-Packard")) + if (!_cups_strcasecmp(mfg, "Hewlett-Packard")) mfg = "HP"; - else if (!strcasecmp(mfg, "Lexmark International")) + else if (!_cups_strcasecmp(mfg, "Lexmark International")) mfg = "Lexmark"; } else diff --git a/backend/usb-unix.c b/backend/usb-unix.c index 4c410174b..92d63bfd2 100644 --- a/backend/usb-unix.c +++ b/backend/usb-unix.c @@ -96,10 +96,10 @@ print_device(const char *uri, /* I - Device URI */ * a read request... */ - use_bc = strcasecmp(hostname, "Brother") && - strcasecmp(hostname, "Canon") && - strncasecmp(hostname, "Konica", 6) && - strncasecmp(hostname, "Minolta", 7); + use_bc = _cups_strcasecmp(hostname, "Brother") && + _cups_strcasecmp(hostname, "Canon") && + _cups_strncasecmp(hostname, "Konica", 6) && + _cups_strncasecmp(hostname, "Minolta", 7); #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */ if ((device_fd = open_device(uri, &use_bc)) == -1) diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c index fdd1c47ac..b9963452b 100644 --- a/cgi-bin/admin.c +++ b/cgi-bin/admin.c @@ -496,7 +496,7 @@ do_add_rss_subscription(http_t *http) /* I - HTTP connection */ request = ippNewRequest(IPP_CREATE_PRINTER_SUBSCRIPTION); - if (!strcasecmp(printer_uri, "#ALL#")) + if (!_cups_strcasecmp(printer_uri, "#ALL#")) ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, "ipp://localhost/"); else @@ -611,7 +611,7 @@ do_am_class(http_t *http, /* I - HTTP connection */ if (attr->name && !strcmp(attr->name, "printer-uri-supported")) { if ((ptr = strrchr(attr->values[0].string.text, '/')) != NULL && - (!name || strcasecmp(name, ptr + 1))) + (!name || _cups_strcasecmp(name, ptr + 1))) { /* * Don't show the current class... @@ -627,7 +627,7 @@ do_am_class(http_t *http, /* I - HTTP connection */ attr = attr->next) if (attr->name && !strcmp(attr->name, "printer-name")) { - if (!name || strcasecmp(name, attr->values[0].string.text)) + if (!name || _cups_strcasecmp(name, attr->values[0].string.text)) { /* * Don't show the current class... @@ -688,7 +688,7 @@ do_am_class(http_t *http, /* I - HTTP connection */ { for (j = 0; j < num_printers; j ++) { - if (!strcasecmp(attr->values[i].string.text, + if (!_cups_strcasecmp(attr->values[i].string.text, cgiGetArray("MEMBER_NAMES", j))) { cgiSetArray("MEMBER_SELECTED", j, "SELECTED"); @@ -960,13 +960,13 @@ do_am_printer(http_t *http, /* I - HTTP connection */ *makeptr = '\0'; else if ((makeptr = strchr(make, '-')) != NULL) *makeptr = '\0'; - else if (!strncasecmp(make, "laserjet", 8) || - !strncasecmp(make, "deskjet", 7) || - !strncasecmp(make, "designjet", 9)) + else if (!_cups_strncasecmp(make, "laserjet", 8) || + !_cups_strncasecmp(make, "deskjet", 7) || + !_cups_strncasecmp(make, "designjet", 9)) strcpy(make, "HP"); - else if (!strncasecmp(make, "phaser", 6)) + else if (!_cups_strncasecmp(make, "phaser", 6)) strcpy(make, "Xerox"); - else if (!strncasecmp(make, "stylus", 6)) + else if (!_cups_strncasecmp(make, "stylus", 6)) strcpy(make, "Epson"); else strcpy(make, "Generic"); @@ -1725,7 +1725,7 @@ do_config_server(http_t *http) /* I - HTTP connection */ { val = cupsGetOption("DefaultAuthType", num_settings, settings); - if (!val || !strcasecmp(val, "Negotiate")) + if (!val || !_cups_strcasecmp(val, "Negotiate")) strlcpy(default_auth_type, "Basic", sizeof(default_auth_type)); else strlcpy(default_auth_type, val, sizeof(default_auth_type)); @@ -1793,14 +1793,14 @@ do_config_server(http_t *http) /* I - HTTP connection */ num_settings, settings)); if (advanced && !changed) - changed = strcasecmp(local_protocols, current_local_protocols) || - strcasecmp(remote_protocols, current_remote_protocols) || - strcasecmp(browse_web_if, current_browse_web_if) || - strcasecmp(preserve_job_history, current_preserve_job_history) || - strcasecmp(preserve_job_files, current_preserve_job_files) || - strcasecmp(max_clients, current_max_clients) || - strcasecmp(max_jobs, current_max_jobs) || - strcasecmp(max_log_size, current_max_log_size); + changed = _cups_strcasecmp(local_protocols, current_local_protocols) || + _cups_strcasecmp(remote_protocols, current_remote_protocols) || + _cups_strcasecmp(browse_web_if, current_browse_web_if) || + _cups_strcasecmp(preserve_job_history, current_preserve_job_history) || + _cups_strcasecmp(preserve_job_files, current_preserve_job_files) || + _cups_strcasecmp(max_clients, current_max_clients) || + _cups_strcasecmp(max_jobs, current_max_jobs) || + _cups_strcasecmp(max_log_size, current_max_log_size); if (changed) { @@ -1834,29 +1834,29 @@ do_config_server(http_t *http) /* I - HTTP connection */ * Add advanced settings... */ - if (strcasecmp(local_protocols, current_local_protocols)) + if (_cups_strcasecmp(local_protocols, current_local_protocols)) num_settings = cupsAddOption("BrowseLocalProtocols", local_protocols, num_settings, &settings); - if (strcasecmp(remote_protocols, current_remote_protocols)) + if (_cups_strcasecmp(remote_protocols, current_remote_protocols)) num_settings = cupsAddOption("BrowseRemoteProtocols", remote_protocols, num_settings, &settings); - if (strcasecmp(browse_web_if, current_browse_web_if)) + if (_cups_strcasecmp(browse_web_if, current_browse_web_if)) num_settings = cupsAddOption("BrowseWebIF", browse_web_if, num_settings, &settings); - if (strcasecmp(preserve_job_history, current_preserve_job_history)) + if (_cups_strcasecmp(preserve_job_history, current_preserve_job_history)) num_settings = cupsAddOption("PreserveJobHistory", preserve_job_history, num_settings, &settings); - if (strcasecmp(preserve_job_files, current_preserve_job_files)) + if (_cups_strcasecmp(preserve_job_files, current_preserve_job_files)) num_settings = cupsAddOption("PreserveJobFiles", preserve_job_files, num_settings, &settings); - if (strcasecmp(max_clients, current_max_clients)) + if (_cups_strcasecmp(max_clients, current_max_clients)) num_settings = cupsAddOption("MaxClients", max_clients, num_settings, &settings); - if (strcasecmp(max_jobs, current_max_jobs)) + if (_cups_strcasecmp(max_jobs, current_max_jobs)) num_settings = cupsAddOption("MaxJobs", max_jobs, num_settings, &settings); - if (strcasecmp(max_log_size, current_max_log_size)) + if (_cups_strcasecmp(max_log_size, current_max_log_size)) num_settings = cupsAddOption("MaxLogSize", max_log_size, num_settings, &settings); } @@ -2379,7 +2379,7 @@ do_export(http_t *http) /* I - HTTP connection */ dest = cgiGetArray("PRINTER_NAME", i); for (j = 0; j < export_count; j ++) - if (!strcasecmp(dest, cgiGetArray("EXPORT_NAME", j))) + if (!_cups_strcasecmp(dest, cgiGetArray("EXPORT_NAME", j))) break; cgiSetArray("PRINTER_EXPORT", i, j < export_count ? "Y" : ""); @@ -2567,7 +2567,7 @@ do_list_printers(http_t *http) /* I - HTTP connection */ */ if (device_info && device_make_and_model && device_uri && - strcasecmp(device_make_and_model, "unknown") && + _cups_strcasecmp(device_make_and_model, "unknown") && strchr(device_uri, ':')) { /* @@ -2594,7 +2594,7 @@ do_list_printers(http_t *http) /* I - HTTP connection */ * suitable name. */ - if (strncasecmp(device_info, "unknown", 7)) + if (_cups_strncasecmp(device_info, "unknown", 7)) ptr = device_info; else if ((ptr = strstr(device_uri, "://")) != NULL) ptr += 3; @@ -2712,7 +2712,7 @@ do_menu(http_t *http) /* I - HTTP connection */ cgiSetVariable("HAVE_GSSAPI", "1"); if ((val = cupsGetOption("DefaultAuthType", num_settings, - settings)) != NULL && !strcasecmp(val, "Negotiate")) + settings)) != NULL && !_cups_strcasecmp(val, "Negotiate")) cgiSetVariable("KERBEROS", "CHECKED"); else #endif /* HAVE_GSSAPI */ @@ -2769,16 +2769,16 @@ do_menu(http_t *http) /* I - HTTP connection */ settings)) == NULL) val = "No"; - if (!strcasecmp(val, "yes") || !strcasecmp(val, "on") || - !strcasecmp(val, "true")) + if (!_cups_strcasecmp(val, "yes") || !_cups_strcasecmp(val, "on") || + !_cups_strcasecmp(val, "true")) cgiSetVariable("BROWSE_WEB_IF", "CHECKED"); if ((val = cupsGetOption("PreserveJobHistory", num_settings, settings)) == NULL) val = "Yes"; - if (!strcasecmp(val, "yes") || !strcasecmp(val, "on") || - !strcasecmp(val, "true")) + if (!_cups_strcasecmp(val, "yes") || !_cups_strcasecmp(val, "on") || + !_cups_strcasecmp(val, "true")) { cgiSetVariable("PRESERVE_JOB_HISTORY", "CHECKED"); @@ -2786,8 +2786,8 @@ do_menu(http_t *http) /* I - HTTP connection */ settings)) == NULL) val = "No"; - if (!strcasecmp(val, "yes") || !strcasecmp(val, "on") || - !strcasecmp(val, "true")) + if (!_cups_strcasecmp(val, "yes") || !_cups_strcasecmp(val, "on") || + !_cups_strcasecmp(val, "true")) cgiSetVariable("PRESERVE_JOB_FILES", "CHECKED"); } @@ -3530,9 +3530,9 @@ do_set_options(http_t *http, /* I - HTTP connection */ cparam; cparam = ppdNextCustomParam(coption), m ++) { - if (!strcasecmp(option->keyword, "PageSize") && - strcasecmp(cparam->name, "Width") && - strcasecmp(cparam->name, "Height")) + if (!_cups_strcasecmp(option->keyword, "PageSize") && + _cups_strcasecmp(cparam->name, "Width") && + _cups_strcasecmp(cparam->name, "Height")) { m --; continue; @@ -3545,7 +3545,7 @@ do_set_options(http_t *http, /* I - HTTP connection */ switch (cparam->type) { case PPD_CUSTOM_POINTS : - if (!strncasecmp(option->defchoice, "Custom.", 7)) + if (!_cups_strncasecmp(option->defchoice, "Custom.", 7)) { units = option->defchoice + strlen(option->defchoice) - 2; @@ -4085,7 +4085,7 @@ get_option_value( return (NULL); } - else if (strcasecmp(val, "Custom") || + else if (_cups_strcasecmp(val, "Custom") || (coption = ppdFindCustomOption(ppd, name)) == NULL) { /* diff --git a/cgi-bin/classes.c b/cgi-bin/classes.c index d0f4b0a20..4b1d02f53 100644 --- a/cgi-bin/classes.c +++ b/cgi-bin/classes.c @@ -171,9 +171,9 @@ main(int argc, /* I - Number of command-line arguments */ do_class_op(http, pclass, CUPS_REJECT_JOBS, cgiText(_("Reject Jobs"))); else if (!strcmp(op, "purge-jobs")) do_class_op(http, pclass, IPP_PURGE_JOBS, cgiText(_("Purge Jobs"))); - else if (!strcasecmp(op, "print-test-page")) + else if (!_cups_strcasecmp(op, "print-test-page")) cgiPrintTestPage(http, pclass); - else if (!strcasecmp(op, "move-jobs")) + else if (!_cups_strcasecmp(op, "move-jobs")) cgiMoveJobs(http, pclass, 0); else { @@ -381,7 +381,7 @@ show_all_classes(http_t *http, /* I - Connection to server */ cgiSetVariable("TOTAL", val); if ((var = cgiGetVariable("ORDER")) != NULL) - ascending = !strcasecmp(var, "asc"); + ascending = !_cups_strcasecmp(var, "asc"); else ascending = 1; diff --git a/cgi-bin/help-index.c b/cgi-bin/help-index.c index a88a6eb1c..5cfbefb2e 100644 --- a/cgi-bin/help-index.c +++ b/cgi-bin/help-index.c @@ -919,7 +919,7 @@ help_load_file( * Look for "", "<A NAME", or "<!-- SECTION:" prefix... */ - if (!strncasecmp(line, "<!-- SECTION:", 13)) + if (!_cups_strncasecmp(line, "<!-- SECTION:", 13)) { /* * Got section line, copy it! @@ -946,7 +946,7 @@ help_load_file( { ptr ++; - if (!strncasecmp(ptr, "TITLE>", 6)) + if (!_cups_strncasecmp(ptr, "TITLE>", 6)) { /* * Found the title... @@ -955,7 +955,7 @@ help_load_file( anchor = NULL; ptr += 6; } - else if (!strncasecmp(ptr, "A NAME=", 7)) + else if (!_cups_strncasecmp(ptr, "A NAME=", 7)) { /* * Found an anchor... @@ -1192,7 +1192,7 @@ help_load_file( sizeof(help_common_words[0])), sizeof(help_common_words[0]), (int (*)(const void *, const void *)) - strcasecmp)) + _cups_strcasecmp)) help_add_word(node, temp); } } @@ -1307,7 +1307,7 @@ help_sort_by_score(help_node_t *n1, /* I - First node */ (diff = strcmp(n1->section, n2->section)) != 0) return (diff); - return (strcasecmp(n1->text, n2->text)); + return (_cups_strcasecmp(n1->text, n2->text)); } @@ -1322,7 +1322,7 @@ help_sort_words(help_word_t *w1, /* I - Second word */ DEBUG_printf(("help_sort_words(w1=%p(\"%s\"), w2=%p(\"%s\"))\n", w1, w1->text, w2, w2->text)); - return (strcasecmp(w1->text, w2->text)); + return (_cups_strcasecmp(w1->text, w2->text)); } diff --git a/cgi-bin/help.c b/cgi-bin/help.c index 6cc7b61ce..32b6db693 100644 --- a/cgi-bin/help.c +++ b/cgi-bin/help.c @@ -342,12 +342,12 @@ main(int argc, /* I - Number of command-line arguments */ { if (inbody) { - if (!strncasecmp(line, "</BODY>", 7)) + if (!_cups_strncasecmp(line, "</BODY>", 7)) break; printf("%s\n", line); } - else if (!strncasecmp(line, "<BODY", 5)) + else if (!_cups_strncasecmp(line, "<BODY", 5)) inbody = 1; } diff --git a/cgi-bin/ipp-var.c b/cgi-bin/ipp-var.c index 777e57b1b..31d34d7fd 100644 --- a/cgi-bin/ipp-var.c +++ b/cgi-bin/ipp-var.c @@ -404,7 +404,7 @@ cgiMoveJobs(http_t *http, /* I - Connection to server */ * If the name is not the same as the current destination, add it! */ - if (strcasecmp(name, dest)) + if (_cups_strcasecmp(name, dest)) { cgiSetArray("JOB_PRINTER_URI", i, attr->values[0].string.text); cgiSetArray("JOB_PRINTER_NAME", i, name); @@ -906,12 +906,12 @@ cgiRewriteURL(const char *uri, /* I - Current URI */ * Map local access to a local URI... */ - if (!strcasecmp(hostname, "127.0.0.1") || - !strcasecmp(hostname, "[::1]") || - !strcasecmp(hostname, "localhost") || - !strncasecmp(hostname, "localhost.", 10) || - !strcasecmp(hostname, server) || - !strcasecmp(hostname, servername)) + if (!_cups_strcasecmp(hostname, "127.0.0.1") || + !_cups_strcasecmp(hostname, "[::1]") || + !_cups_strcasecmp(hostname, "localhost") || + !_cups_strncasecmp(hostname, "localhost.", 10) || + !_cups_strcasecmp(hostname, server) || + !_cups_strcasecmp(hostname, servername)) { /* * Make URI relative to the current server... @@ -1347,7 +1347,7 @@ cgiSetIPPVars(ipp_t *response, /* I - Response data to be copied... */ (filter->value_tag >= IPP_TAG_TEXTLANG && filter->value_tag <= IPP_TAG_MIMETYPE)) && filter->values[0].string.text != NULL && - !strcasecmp(filter->values[0].string.text, filter_value)) + !_cups_strcasecmp(filter->values[0].string.text, filter_value)) break; if (!filter) @@ -1481,9 +1481,9 @@ cgiShowJobs(http_t *http, /* I - Connection to server */ first = 0; if ((var = cgiGetVariable("ORDER")) != NULL) - ascending = !strcasecmp(var, "asc"); + ascending = !_cups_strcasecmp(var, "asc"); else - ascending = !which_jobs || !strcasecmp(which_jobs, "not-completed"); + ascending = !which_jobs || !_cups_strcasecmp(which_jobs, "not-completed"); section = cgiGetVariable("SECTION"); diff --git a/cgi-bin/makedocset.c b/cgi-bin/makedocset.c index 7d90c8073..577282889 100644 --- a/cgi-bin/makedocset.c +++ b/cgi-bin/makedocset.c @@ -3,7 +3,7 @@ * * Xcode documentation set generator. * - * Copyright 2007-2009 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -171,7 +171,7 @@ static int /* O - Result of comparison */ compare_html(_cups_html_t *a, /* I - First file */ _cups_html_t *b) /* I - Second file */ { - return (strcasecmp(a->title, b->title)); + return (_cups_strcasecmp(a->title, b->title)); } @@ -183,7 +183,7 @@ static int /* O - Result of comparison */ compare_sections(_cups_section_t *a, /* I - First section */ _cups_section_t *b) /* I - Second section */ { - return (strcasecmp(a->name, b->name)); + return (_cups_strcasecmp(a->name, b->name)); } @@ -201,7 +201,7 @@ compare_sections_files( if (ret) return (ret); else - return (strcasecmp(a->name, b->name)); + return (_cups_strcasecmp(a->name, b->name)); } @@ -442,7 +442,7 @@ write_nodes(const char *path, /* I - File to write */ cupsFilePuts(fp, "<Subnodes>\n"); subnodes = 1; } - + cupsFilePrintf(fp, "<Node id=\"%d\">\n" "<Path>Documentation/%s</Path>\n" "<Anchor>%s</Anchor>\n" diff --git a/cgi-bin/printers.c b/cgi-bin/printers.c index 8b613f3b7..ff379ff99 100644 --- a/cgi-bin/printers.c +++ b/cgi-bin/printers.c @@ -174,15 +174,15 @@ main(int argc, /* I - Number of command-line arguments */ do_printer_op(http, printer, CUPS_REJECT_JOBS, cgiText(_("Reject Jobs"))); else if (!strcmp(op, "purge-jobs")) do_printer_op(http, printer, IPP_PURGE_JOBS, cgiText(_("Purge Jobs"))); - else if (!strcasecmp(op, "print-self-test-page")) + else if (!_cups_strcasecmp(op, "print-self-test-page")) cgiPrintCommand(http, printer, "PrintSelfTestPage", cgiText(_("Print Self-Test Page"))); - else if (!strcasecmp(op, "clean-print-heads")) + else if (!_cups_strcasecmp(op, "clean-print-heads")) cgiPrintCommand(http, printer, "Clean all", cgiText(_("Clean Print Heads"))); - else if (!strcasecmp(op, "print-test-page")) + else if (!_cups_strcasecmp(op, "print-test-page")) cgiPrintTestPage(http, printer); - else if (!strcasecmp(op, "move-jobs")) + else if (!_cups_strcasecmp(op, "move-jobs")) cgiMoveJobs(http, printer, 0); else { @@ -398,7 +398,7 @@ show_all_printers(http_t *http, /* I - Connection to server */ cgiSetVariable("TOTAL", val); if ((var = cgiGetVariable("ORDER")) != NULL) - ascending = !strcasecmp(var, "asc"); + ascending = !_cups_strcasecmp(var, "asc"); else ascending = 1; diff --git a/cgi-bin/search.c b/cgi-bin/search.c index 708cc5b0b..f8d6c797f 100644 --- a/cgi-bin/search.c +++ b/cgi-bin/search.c @@ -145,7 +145,7 @@ cgiCompileSearch(const char *query) /* I - Query string */ * Look for logic words: AND, OR */ - if (wlen == 3 && !strncasecmp(qptr, "AND", 3)) + if (wlen == 3 && !_cups_strncasecmp(qptr, "AND", 3)) { /* * Logical AND with the following text... @@ -156,7 +156,7 @@ cgiCompileSearch(const char *query) /* I - Query string */ qptr = qend; } - else if (wlen == 2 && !strncasecmp(qptr, "OR", 2)) + else if (wlen == 2 && !_cups_strncasecmp(qptr, "OR", 2)) { /* * Logical OR with the following text... diff --git a/cgi-bin/template.c b/cgi-bin/template.c index 8ec653878..77bfbe3a8 100644 --- a/cgi-bin/template.c +++ b/cgi-bin/template.c @@ -3,7 +3,7 @@ * * CGI template function. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -423,7 +423,7 @@ cgi_copy(FILE *out, /* I - Output file */ { if (uriencode) cgi_puturi(outptr, out); - else if (!strcasecmp(name, "?cupsdconf_default")) + else if (!_cups_strcasecmp(name, "?cupsdconf_default")) fputs(outptr, stdout); else cgi_puts(outptr, out); @@ -536,16 +536,16 @@ cgi_copy(FILE *out, /* I - Output file */ switch (op) { case '<' : - result = strcasecmp(outptr, compare) < 0; + result = _cups_strcasecmp(outptr, compare) < 0; break; case '>' : - result = strcasecmp(outptr, compare) > 0; + result = _cups_strcasecmp(outptr, compare) > 0; break; case '=' : - result = strcasecmp(outptr, compare) == 0; + result = _cups_strcasecmp(outptr, compare) == 0; break; case '!' : - result = strcasecmp(outptr, compare) != 0; + result = _cups_strcasecmp(outptr, compare) != 0; break; case '~' : fprintf(stderr, "DEBUG: Regular expression \"%s\"\n", compare); @@ -664,7 +664,7 @@ cgi_puts(const char *s, /* I - String to output */ * Pass <A HREF="url"> and </A>, otherwise quote it... */ - if (!strncasecmp(s, "<A HREF=\"", 9)) + if (!_cups_strncasecmp(s, "<A HREF=\"", 9)) { fputs("<A HREF=\"", out); s += 9; @@ -684,7 +684,7 @@ cgi_puts(const char *s, /* I - String to output */ fputs("\">", out); } - else if (!strncasecmp(s, "</A>", 4)) + else if (!_cups_strncasecmp(s, "</A>", 4)) { fputs("</A>", out); s += 3; diff --git a/cgi-bin/var.c b/cgi-bin/var.c index 9a37b35e7..f199c4cc8 100644 --- a/cgi-bin/var.c +++ b/cgi-bin/var.c @@ -3,7 +3,7 @@ * * CGI form variable and array functions for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2005 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -328,9 +328,9 @@ cgiInitialize(void) * Grab form data from the corresponding location... */ - if (!strcasecmp(method, "GET")) + if (!_cups_strcasecmp(method, "GET")) return (cgi_initialize_get()); - else if (!strcasecmp(method, "POST") && content_type) + else if (!_cups_strcasecmp(method, "POST") && content_type) { const char *boundary = strstr(content_type, "boundary="); @@ -607,7 +607,7 @@ cgi_compare_variables( const _cgi_var_t *v1, /* I - First variable */ const _cgi_var_t *v2) /* I - Second variable */ { - return (strcasecmp(v1->name, v2->name)); + return (_cups_strcasecmp(v1->name, v2->name)); } @@ -824,7 +824,7 @@ cgi_initialize_multipart( /* * Copy file data to the temp file... */ - + ptr = line; while ((ch = getchar()) != EOF) @@ -928,7 +928,7 @@ cgi_initialize_multipart( filename[0] = '\0'; mimetype[0] = '\0'; } - else if (!strncasecmp(line, "Content-Disposition:", 20)) + else if (!_cups_strncasecmp(line, "Content-Disposition:", 20)) { if ((ptr = strstr(line + 20, " name=\"")) != NULL) { @@ -946,7 +946,7 @@ cgi_initialize_multipart( *ptr = '\0'; } } - else if (!strncasecmp(line, "Content-Type:", 13)) + else if (!_cups_strncasecmp(line, "Content-Type:", 13)) { for (ptr = line + 13; isspace(*ptr & 255); ptr ++); @@ -1234,7 +1234,7 @@ cgi_set_sid(void) _cupsMD5Init(&md5); _cupsMD5Append(&md5, (unsigned char *)buffer, (int)strlen(buffer)); _cupsMD5Finish(&md5, sum); - + cgiSetCookie(CUPS_SID, httpMD5String(sum, sid), "/", NULL, 0, 0); return (cupsGetOption(CUPS_SID, num_cookies, cookies)); diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4 index b1a7337d5..06d19428e 100644 --- a/config-scripts/cups-common.m4 +++ b/config-scripts/cups-common.m4 @@ -153,7 +153,7 @@ AC_CHECK_HEADER(sys/vfs.h,AC_DEFINE(HAVE_SYS_VFS_H)) AC_CHECK_FUNCS(statfs statvfs) dnl Checks for string functions. -AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy) +AC_CHECK_FUNCS(strdup strlcat strlcpy) if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then echo Forcing snprintf emulation for HP-UX. else @@ -166,6 +166,9 @@ AC_CHECK_FUNCS(random lrand48 arc4random) dnl Check for geteuid function. AC_CHECK_FUNCS(geteuid) +dnl Check for setpgid function. +AC_CHECK_FUNCS(setpgid) + dnl Check for vsyslog function. AC_CHECK_FUNCS(vsyslog) diff --git a/config.h.in b/config.h.in index 5517c4407..ee79d8832 100644 --- a/config.h.in +++ b/config.h.in @@ -218,8 +218,6 @@ */ #undef HAVE_STRDUP -#undef HAVE_STRCASECMP -#undef HAVE_STRNCASECMP #undef HAVE_STRLCAT #undef HAVE_STRLCPY @@ -231,6 +229,13 @@ #undef HAVE_GETEUID +/* + * Do we have the setpgid() function? + */ + +#undef HAVE_SETPGID + + /* * Do we have the vsyslog() function? */ diff --git a/cups/adminutil.c b/cups/adminutil.c index 99f8476c3..04b8e8fd2 100644 --- a/cups/adminutil.c +++ b/cups/adminutil.c @@ -531,7 +531,7 @@ cupsAdminExportSamba( return (0); } - + /* * Do the rpcclient command needed for the CUPS drivers... */ @@ -735,7 +735,7 @@ cupsAdminExportSamba( return (0); } - + /* * Do the rpcclient command needed for the CUPS drivers... */ @@ -991,7 +991,7 @@ cupsAdminGetServerSettings( if (!value && strncmp(line, "</", 2)) value = line + strlen(line); - if ((!strcasecmp(line, "Port") || !strcasecmp(line, "Listen")) && value) + if ((!_cups_strcasecmp(line, "Port") || !_cups_strcasecmp(line, "Listen")) && value) { char *port; /* Pointer to port number, if any */ @@ -1008,7 +1008,7 @@ cupsAdminGetServerSettings( continue; } - if (strcasecmp(value, "localhost") && strcmp(value, "127.0.0.1") + if (_cups_strcasecmp(value, "localhost") && strcmp(value, "127.0.0.1") #ifdef AF_LOCAL && *value != '/' #endif /* AF_LOCAL */ @@ -1018,36 +1018,36 @@ cupsAdminGetServerSettings( ) remote_access = 1; } - else if (!strcasecmp(line, "Browsing")) + else if (!_cups_strcasecmp(line, "Browsing")) { - browsing = !strcasecmp(value, "yes") || !strcasecmp(value, "on") || - !strcasecmp(value, "true"); + browsing = !_cups_strcasecmp(value, "yes") || !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "true"); } - else if (!strcasecmp(line, "BrowseAddress")) + else if (!_cups_strcasecmp(line, "BrowseAddress")) { browse_address = 1; } - else if (!strcasecmp(line, "BrowseAllow")) + else if (!_cups_strcasecmp(line, "BrowseAllow")) { browse_allow = 1; } - else if (!strcasecmp(line, "BrowseOrder")) + else if (!_cups_strcasecmp(line, "BrowseOrder")) { - browse_allow = !strncasecmp(value, "deny,", 5); + browse_allow = !_cups_strncasecmp(value, "deny,", 5); } - else if (!strcasecmp(line, "LogLevel")) + else if (!_cups_strcasecmp(line, "LogLevel")) { - debug_logging = !strncasecmp(value, "debug", 5); + debug_logging = !_cups_strncasecmp(value, "debug", 5); } - else if (!strcasecmp(line, "<Policy") && !strcasecmp(value, "default")) + else if (!_cups_strcasecmp(line, "<Policy") && !_cups_strcasecmp(value, "default")) { in_policy = 1; } - else if (!strcasecmp(line, "</Policy>")) + else if (!_cups_strcasecmp(line, "</Policy>")) { in_policy = 0; } - else if (!strcasecmp(line, "<Limit") && in_policy && value) + else if (!_cups_strcasecmp(line, "<Limit") && in_policy && value) { /* * See if the policy limit is for the Cancel-Job operation... @@ -1063,7 +1063,7 @@ cupsAdminGetServerSettings( if (*valptr) *valptr++ = '\0'; - if (!strcasecmp(value, "cancel-job") || !strcasecmp(value, "all")) + if (!_cups_strcasecmp(value, "cancel-job") || !_cups_strcasecmp(value, "all")) { in_cancel_job = 1; break; @@ -1072,26 +1072,26 @@ cupsAdminGetServerSettings( for (value = valptr; _cups_isspace(*value); value ++); } } - else if (!strcasecmp(line, "</Limit>")) + else if (!_cups_strcasecmp(line, "</Limit>")) { in_cancel_job = 0; } - else if (!strcasecmp(line, "Require") && in_cancel_job) + else if (!_cups_strcasecmp(line, "Require") && in_cancel_job) { cancel_policy = 0; } - else if (!strcasecmp(line, "<Location") && value) + else if (!_cups_strcasecmp(line, "<Location") && value) { - in_admin_location = !strcasecmp(value, "/admin"); + in_admin_location = !_cups_strcasecmp(value, "/admin"); in_location = 1; } - else if (!strcasecmp(line, "</Location>")) + else if (!_cups_strcasecmp(line, "</Location>")) { in_admin_location = 0; in_location = 0; } - else if (!strcasecmp(line, "Allow") && value && - strcasecmp(value, "localhost") && strcasecmp(value, "127.0.0.1") + else if (!_cups_strcasecmp(line, "Allow") && value && + _cups_strcasecmp(value, "localhost") && _cups_strcasecmp(value, "127.0.0.1") #ifdef AF_LOCAL && *value != '/' #endif /* AF_LOCAL */ @@ -1102,16 +1102,16 @@ cupsAdminGetServerSettings( { if (in_admin_location) remote_admin = 1; - else if (!strcasecmp(value, "all")) + else if (!_cups_strcasecmp(value, "all")) remote_any = 1; } else if (line[0] != '<' && !in_location && !in_policy && - strcasecmp(line, "Allow") && - strcasecmp(line, "AuthType") && - strcasecmp(line, "Deny") && - strcasecmp(line, "Order") && - strcasecmp(line, "Require") && - strcasecmp(line, "Satisfy")) + _cups_strcasecmp(line, "Allow") && + _cups_strcasecmp(line, "AuthType") && + _cups_strcasecmp(line, "Deny") && + _cups_strcasecmp(line, "Order") && + _cups_strcasecmp(line, "Require") && + _cups_strcasecmp(line, "Satisfy")) cg->cupsd_num_settings = cupsAddOption(line, value, cg->cupsd_num_settings, &(cg->cupsd_settings)); @@ -1484,7 +1484,7 @@ cupsAdminSetServerSettings( while (cupsFileGetConf(cupsd, line, sizeof(line), &value, &linenum)) { - if ((!strcasecmp(line, "Port") || !strcasecmp(line, "Listen")) && + if ((!_cups_strcasecmp(line, "Port") || !_cups_strcasecmp(line, "Listen")) && (remote_admin >= 0 || remote_any > 0 || share_printers >= 0)) { if (!wrote_port_listen) @@ -1516,13 +1516,13 @@ cupsAdminSetServerSettings( ) cupsFilePrintf(temp, "Listen %s\n", value); } - else if ((!strcasecmp(line, "Browsing") || - !strcasecmp(line, "BrowseAddress") || - !strcasecmp(line, "BrowseAllow") || - !strcasecmp(line, "BrowseDeny") || - !strcasecmp(line, "BrowseLocalProtocols") || - !strcasecmp(line, "BrowseRemoteProtocols") || - !strcasecmp(line, "BrowseOrder")) && + else if ((!_cups_strcasecmp(line, "Browsing") || + !_cups_strcasecmp(line, "BrowseAddress") || + !_cups_strcasecmp(line, "BrowseAllow") || + !_cups_strcasecmp(line, "BrowseDeny") || + !_cups_strcasecmp(line, "BrowseLocalProtocols") || + !_cups_strcasecmp(line, "BrowseRemoteProtocols") || + !_cups_strcasecmp(line, "BrowseOrder")) && (remote_printers >= 0 || share_printers >= 0)) { if (!wrote_browsing) @@ -1604,7 +1604,7 @@ cupsAdminSetServerSettings( } } } - else if (!strcasecmp(line, "LogLevel") && debug_logging >= 0) + else if (!_cups_strcasecmp(line, "LogLevel") && debug_logging >= 0) { wrote_loglevel = 1; @@ -1620,15 +1620,15 @@ cupsAdminSetServerSettings( cupsFilePuts(temp, "LogLevel " CUPS_DEFAULT_LOG_LEVEL "\n"); } } - else if (!strcasecmp(line, "<Policy")) + else if (!_cups_strcasecmp(line, "<Policy")) { - in_default_policy = !strcasecmp(value, "default"); + in_default_policy = !_cups_strcasecmp(value, "default"); in_policy = 1; cupsFilePrintf(temp, "%s %s>\n", line, value); indent += 2; } - else if (!strcasecmp(line, "</Policy>")) + else if (!_cups_strcasecmp(line, "</Policy>")) { indent -= 2; if (!wrote_policy && in_default_policy) @@ -1650,7 +1650,7 @@ cupsAdminSetServerSettings( cupsFilePuts(temp, "</Policy>\n"); } - else if (!strcasecmp(line, "<Location")) + else if (!_cups_strcasecmp(line, "<Location")) { in_location = 1; indent += 2; @@ -1663,7 +1663,7 @@ cupsAdminSetServerSettings( cupsFilePrintf(temp, "%s %s>\n", line, value); } - else if (!strcasecmp(line, "</Location>")) + else if (!_cups_strcasecmp(line, "</Location>")) { in_location = 0; indent -= 2; @@ -1729,50 +1729,50 @@ cupsAdminSetServerSettings( cupsFilePuts(temp, "</Location>\n"); } - else if (!strcasecmp(line, "<Limit")) + else if (!_cups_strcasecmp(line, "<Limit")) { if (in_default_policy) { /* * See if the policy limit is for the Cancel-Job operation... */ - + char *valptr; /* Pointer into value */ - - - if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0) + + + if (!_cups_strcasecmp(value, "cancel-job") && user_cancel_any >= 0) { /* * Don't write anything for this limit section... */ - + in_cancel_job = 2; } else { cupsFilePrintf(temp, "%*s%s", indent, "", line); - + while (*value) { for (valptr = value; *valptr && !_cups_isspace(*valptr); valptr ++); - + if (*valptr) *valptr++ = '\0'; - - if (!strcasecmp(value, "cancel-job") && user_cancel_any >= 0) + + if (!_cups_strcasecmp(value, "cancel-job") && user_cancel_any >= 0) { /* * Write everything except for this definition... */ - + in_cancel_job = 1; } else cupsFilePrintf(temp, " %s", value); - + for (value = valptr; _cups_isspace(*value); value ++); } - + cupsFilePuts(temp, ">\n"); } } @@ -1781,7 +1781,7 @@ cupsAdminSetServerSettings( indent += 2; } - else if (!strcasecmp(line, "</Limit>") && in_cancel_job) + else if (!_cups_strcasecmp(line, "</Limit>") && in_cancel_job) { indent -= 2; @@ -1804,8 +1804,8 @@ cupsAdminSetServerSettings( else if ((((in_admin_location || in_conf_location || in_root_location) && (remote_admin >= 0 || remote_any > 0)) || (in_root_location && share_printers >= 0)) && - (!strcasecmp(line, "Allow") || !strcasecmp(line, "Deny") || - !strcasecmp(line, "Order"))) + (!_cups_strcasecmp(line, "Allow") || !_cups_strcasecmp(line, "Deny") || + !_cups_strcasecmp(line, "Order"))) continue; else if (in_cancel_job == 2) continue; @@ -2034,8 +2034,8 @@ cupsAdminSetServerSettings( for (i = num_settings, setting = settings; i > 0; i --, setting ++) if (setting->name[0] != '_' && - strcasecmp(setting->name, "Listen") && - strcasecmp(setting->name, "Port") && + _cups_strcasecmp(setting->name, "Listen") && + _cups_strcasecmp(setting->name, "Port") && !cupsGetOption(setting->name, cupsd_num_settings, cupsd_settings)) { /* @@ -2254,14 +2254,14 @@ get_cupsd_conf( httpGetHostname(http, host, sizeof(host)); - if (strcasecmp(cg->cupsd_hostname, host)) + if (_cups_strcasecmp(cg->cupsd_hostname, host)) invalidate_cupsd_cache(cg); snprintf(name, namesize, "%s/cupsd.conf", cg->cups_serverroot); *remote = 0; #ifndef WIN32 - if (!strcasecmp(host, "localhost") && !access(name, R_OK)) + if (!_cups_strcasecmp(host, "localhost") && !access(name, R_OK)) { /* * Read the local file rather than using HTTP... diff --git a/cups/api-filter.shtml b/cups/api-filter.shtml index 2e149f11f..ef4b5c007 100644 --- a/cups/api-filter.shtml +++ b/cups/api-filter.shtml @@ -84,15 +84,16 @@ that further limit file system access, even for backends running as root. On Mac OS X, for example, no backend may write to a user's home directory.</p> </blockquote> -<h3><a name="SIGNALS">Signal Handling</a><h3> +<h3><a name="SIGNALS">Canceled Jobs and Signal Handling</a><h3> <p>The scheduler sends <code>SIGTERM</code> when a printing job is canceled or held. Filters, backends, and port monitors <em>must</em> catch <code>SIGTERM</code> and perform any cleanup necessary to produce a valid output file or return the printer to a known good state. The recommended behavior is to -end the output on the current page.</p> +end the output on the current page, preferably on the current line or object +being printed.</p> -<p>Filters and backends may also receive <code>SIGPIPE</code> when an upstream or downstream filter/backend exits with a non-zero status. Developers should generally <code>ignore SIGPIPE</code> at the beginning of <code>main()</code> with the following function call:</p> +<p>Filters and backends may also receive <code>SIGPIPE</code> when an upstream or downstream filter/backend exits with a non-zero status. Developers should generally ignore <code>SIGPIPE</code> at the beginning of <code>main()</code> with the following function call:</p> <pre class="example"> #include <signal.h>> @@ -230,7 +231,8 @@ prefix strings:</p> <dt>ATTR: attribute=value [attribute=value]</dt> <dd>Sets the named printer or job attribute(s). Typically this is used - to set the <code>marker-colors</code>, <code>marker-levels</code>, + to set the <code>marker-colors</code>, <code>marker-high-levels</code>, + <code>marker-levels</code>, <code>marker-low-levels</code>, <code>marker-message</code>, <code>marker-names</code>, <code>marker-types</code>, <code>printer-alert</code>, and <code>printer-alert-description</code> printer attributes. Standard @@ -280,23 +282,15 @@ prefix strings:</p> this is used to update installable options or default media settings based on the printer configuration.</dd> - <dt>STATE: printer-state-reason [printer-state-reason ...]</dt> <dt>STATE: + printer-state-reason [printer-state-reason ...]</dt> <dt>STATE: - printer-state-reason [printer-state-reason ...]</dt> - <dd>Sets, adds, or removes printer-state-reason keywords to the - current queue. Typically this is used to indicate persistent media, - ink, toner, and configuration conditions or errors on a printer. + <dd>Sets or clears printer-state-reason keywords for the current queue. + Typically this is used to indicate persistent media, ink, toner, and + configuration conditions or errors on a printer. <a href='#TABLE2'>Table 2</a> lists the standard state keywords - - use vendor-prefixed ("com.acme.foo") keywords for custom states. - - <blockquote><b>Note:</b> - - <p>"STATE:" messages often provide visible alerts to the user. For example, on - Mac OS X setting a printer-state-reason value with an "-error" or "-warning" - suffix will cause the printer's dock item to bounce if the corresponding reason - is localized with a cupsIPPReason keyword in the printer's PPD file.</p> - - </blockquote></dd> + use vendor-prefixed ("com.example.foo") keywords for custom states. See + <a href="#MANAGING_STATE">Managing Printer State in a Filter</a> for more + information. <dt>WARNING: message</dt> <dd>Sets the printer-state-message attribute and adds the specified @@ -385,59 +379,190 @@ the "DEBUG:" prefix string.</p> <tbody> <tr> <td>connecting-to-device</td> - <td>Connecting to printer but not printing yet</td> + <td>Connecting to printer but not printing yet.</td> </tr> <tr> <td>cover-open</td> - <td>A cover is open on the printer</td> + <td>The printer's cover is open.</td> </tr> <tr> <td>input-tray-missing</td> - <td>An input tray is missing from the printer</td> + <td>The paper tray is missing.</td> </tr> <tr> <td>marker-supply-empty</td> - <td>Out of ink</td> + <td>The printer is out of ink.</td> </tr> <tr> <td>marker-supply-low</td> - <td>Low on ink</td> + <td>The printer is almost out of ink.</td> </tr> <tr> <td>marker-waste-almost-full</td> - <td>Waste tank almost full</td> + <td>The printer's waste bin is almost full.</td> </tr> <tr> <td>marker-waste-full</td> - <td>Waste tank full</td> + <td>The printer's waste bin is full.</td> </tr> <tr> <td>media-empty</td> - <td>Out of media</td> + <td>The paper tray (any paper tray) is empty.</td> </tr> <tr> <td>media-jam</td> - <td>Media is jammed in the printer</td> + <td>There is a paper jam.</td> </tr> <tr> <td>media-low</td> - <td>Low on media</td> + <td>The paper tray (any paper tray) is almost empty.</td> +</tr> +<tr> + <td>media-needed</td> + <td>The paper tray needs to be filled (for a job that is printing).</td> </tr> <tr> <td>paused</td> - <td>Stop the printer</td> + <td>Stop the printer.</td> </tr> <tr> <td>timed-out</td> - <td>Unable to connect to printer</td> + <td>Unable to connect to printer.</td> </tr> <tr> <td>toner-empty</td> - <td>Out of toner</td> + <td>The printer is out of toner.</td> </tr> <tr> <td>toner-low</td> - <td>Low on toner</td> + <td>The printer is low on toner.</td> +</tr> +</tbody> +</table></div> + +<h4><a name="MANAGING_STATE">Managing Printer State in a Filter</a></h4> + +<p>Filters are responsible for managing the state keywords they set using +"STATE:" messages. Typically you will update <em>all</em> of the keywords that +are used by the filter at startup, for example:</p> + +<pre class="example"> +if (foo_condition != 0) + fputs("STATE: +com.example.foo\n", stderr); +else + fputs("STATE: -com.example.foo\n", stderr); + +if (bar_condition != 0) + fputs("STATE: +com.example.bar\n", stderr); +else + fputs("STATE: -com.example.bar\n", stderr); +</pre> + +<p>Then as conditions change, your filter sends "STATE: +keyword" or "STATE: +-keyword" messages as necessary to set or clear the corresponding keyword, +respectively.</p> + +<p>State keywords are often used to notify the user of issues that span across +jobs, for example "media-empty-warning" that indicates one or more paper trays +are empty. These keywords should not be cleared unless the corresponding issue +no longer exists.</p> + +<p>Filters should clear job-related keywords on startup and exit so that they +do not remain set between jobs. For example, "connecting-to-device" is a job +sub-state and not an issue that applies when a job is not printing.</p> + +<blockquote><b>Note:</b> + +<p>"STATE:" messages often provide visible alerts to the user. For example, +on Mac OS X setting a printer-state-reason value with an "-error" or +"-warning" suffix will cause the printer's dock item to bounce if the +corresponding reason is localized with a cupsIPPReason keyword in the +printer's PPD file.</p> + +<p>When providing a vendor-prefixed keyword, <em>always</em> provide the +corresponding standard keyword (if any) to allow clients to respond to the +condition correctly. For example, if you provide a vendor-prefixed keyword +for a low cyan ink condition ("com.example.cyan-ink-low") you must also set the +"marker-supply-low-warning" keyword. In such cases you should also refrain +from localizing the vendor-prefixed keyword in the PPD file - otherwise both +the generic and vendor-specific keyword will be shown in the user +interface.</p> + +</blockquote></dd> + +<h4><a name="REPORTING_SUPPLIES">Reporting Supply Levels</a></h4> + +<p>CUPS tracks several "marker-*" attributes for ink/toner supply level +reporting. These attributes allow applications to display the current supply +levels for a printer without printer-specific software. <a href="#TABLE3">Table 3</a> lists the marker attributes and what they represent.</p> + +<p>Filters set marker attributes by sending "ATTR:" messages to stderr. For +example, a filter supporting an inkjet printer with black and tri-color ink +cartridges would use the following to initialize the supply attributes:</p> + +<pre class="example"> +fputs("ATTR: marker-colors=#000000,#00FFFF#FF00FF#FFFF00\n", stderr); +fputs("ATTR: marker-low-levels=5,10\n", stderr); +fputs("ATTR: marker-names=Black,Tri-Color\n", stderr); +fputs("ATTR: marker-types=ink,ink\n", stderr); +</pre> + +<p>Then periodically the filter queries the printer for its current supply +levels and updates them with a separate "ATTR:" message:</p> + +<pre class="example"> +int black_level, tri_level; +... +fprintf(stderr, "ATTR: marker-levels=%d,%d\n", black_level, tri_level); +</pre> + +<div class='table'><table width='80%' summary='Table 3: Supply Level Attributes'> +<caption>Table 3: <a name='TABLE3'>Supply Level Attributes</a></caption> +<thead> +<tr> + <th>Attribute</th> + <th>Description</th> +</tr> +</thead> +<tbody> +<tr> + <td>marker-colors</td> + <td>A list of comma-separated colors; each color is either "none" or one or + more hex-encoded sRGB colors of the form "#RRGGBB".</td> +</tr> +<tr> + <td>marker-high-levels</td> + <td>A list of comma-separated "almost full" level values from 0 to 100; a + value of 100 should be used for supplies that are consumed/emptied like ink + cartridges.</td> +</tr> +<tr> + <td>marker-levels</td> + <td>A list of comma-separated level values for each supply. A value of -1 + indicates the level is unavailable, -2 indicates unknown, and -3 indicates + the level is unknown but has not yet reached capacity. Values from 0 to 100 + indicate the corresponding percentage.</td> +</tr> +<tr> + <td>marker-low-levels</td> + <td>A list of comma-separated "almost empty" level values from 0 to 100; a + value of 0 should be used for supplies that are filled like waste ink + tanks.</td> +</tr> +<tr> + <td>marker-message</td> + <td>A human-readable supply status message for the user like "12 pages of + ink remaining."</td> +</tr> +<tr> + <td>marker-names</td> + <td>A list of comma-separated supply names like "Cyan Ink", "Fuser", + etc.</td> +</tr> +<tr> + <td>marker-types</td> + <td>A list of comma-separated supply types; the types are listed in + <a href="#TABLE1">Table 1</a>.</td> </tr> </tbody> </table></div> @@ -494,6 +619,38 @@ else data[0] = '\0'; </pre> +<h4><a name="DRAIN_OUTPUT">Forcing All Output to a Printer</a></h4> + +<p>The +<a href="#cupsSideChannelDoRequest"><code>cupsSideChannelDoRequest</code></a> +function allows you to tell the backend to send all pending data to the printer. +This is most often needed when sending query commands to the printer. For example:</p> + +<pre class="example"> +#include <cups/cups.h> +#include <cups/sidechannel.h> + +char data[1024]; +int datalen = sizeof(data); +<a href="#cups_sc_status_t">cups_sc_status_t</a> status; + +/* Flush pending output to stdout */ +fflush(stdout); + +/* Drain output to backend, waiting for up to 30 seconds */ +status = <a href="#cupsSideChannelDoRequest">cupsSideChannelDoRequest</a>(CUPS_SC_CMD_DRAIN_OUTPUT, data, &datalen, 30.0); + +/* Read the response if the output was sent */ +if (status == CUPS_SC_STATUS_OK) +{ + ssize_t bytes; + + /* Wait up to 10.0 seconds for back-channel data */ + bytes = cupsBackChannelRead(data, sizeof(data), 10.0); + /* do something with the data from the printer */ +} +</pre> + <h3><a name="COMMUNICATING_FILTER">Communicating with Filters</a></h3> <p>Backends communicate with filters using the reciprocal functions diff --git a/cups/attr.c b/cups/attr.c index 4e6fab68d..19c27d582 100644 --- a/cups/attr.c +++ b/cups/attr.c @@ -3,7 +3,7 @@ * * PPD model-specific attribute routines for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -71,10 +71,10 @@ ppdFindAttr(ppd_file_t *ppd, /* I - PPD file data */ * Loop until we find the first matching attribute for "spec"... */ - while (attr && strcasecmp(spec, attr->spec)) + while (attr && _cups_strcasecmp(spec, attr->spec)) { if ((attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs)) != NULL && - strcasecmp(attr->name, name)) + _cups_strcasecmp(attr->name, name)) attr = NULL; } } @@ -115,7 +115,7 @@ ppdFindNextAttr(ppd_file_t *ppd, /* I - PPD file data */ * Check the next attribute to see if it is a match... */ - if (strcasecmp(attr->name, name)) + if (_cups_strcasecmp(attr->name, name)) { /* * Nope, reset the current pointer to the end of the array... @@ -126,7 +126,7 @@ ppdFindNextAttr(ppd_file_t *ppd, /* I - PPD file data */ return (NULL); } - if (!spec || !strcasecmp(attr->spec, spec)) + if (!spec || !_cups_strcasecmp(attr->spec, spec)) break; } @@ -180,7 +180,7 @@ _ppdNormalizeMakeAndModel( if ((bufptr = strrchr(buffer, ')')) != NULL) *bufptr = '\0'; } - else if (!strncasecmp(make_and_model, "XPrint", 6)) + else if (!_cups_strncasecmp(make_and_model, "XPrint", 6)) { /* * Xerox XPrint... @@ -188,7 +188,7 @@ _ppdNormalizeMakeAndModel( snprintf(buffer, bufsize, "Xerox %s", make_and_model); } - else if (!strncasecmp(make_and_model, "Eastman", 7)) + else if (!_cups_strncasecmp(make_and_model, "Eastman", 7)) { /* * Kodak... @@ -196,7 +196,7 @@ _ppdNormalizeMakeAndModel( snprintf(buffer, bufsize, "Kodak %s", make_and_model + 7); } - else if (!strncasecmp(make_and_model, "laserwriter", 11)) + else if (!_cups_strncasecmp(make_and_model, "laserwriter", 11)) { /* * Apple LaserWriter... @@ -204,7 +204,7 @@ _ppdNormalizeMakeAndModel( snprintf(buffer, bufsize, "Apple LaserWriter%s", make_and_model + 11); } - else if (!strncasecmp(make_and_model, "colorpoint", 10)) + else if (!_cups_strncasecmp(make_and_model, "colorpoint", 10)) { /* * Seiko... @@ -212,7 +212,7 @@ _ppdNormalizeMakeAndModel( snprintf(buffer, bufsize, "Seiko %s", make_and_model); } - else if (!strncasecmp(make_and_model, "fiery", 5)) + else if (!_cups_strncasecmp(make_and_model, "fiery", 5)) { /* * EFI... @@ -220,8 +220,8 @@ _ppdNormalizeMakeAndModel( snprintf(buffer, bufsize, "EFI %s", make_and_model); } - else if (!strncasecmp(make_and_model, "ps ", 3) || - !strncasecmp(make_and_model, "colorpass", 9)) + else if (!_cups_strncasecmp(make_and_model, "ps ", 3) || + !_cups_strncasecmp(make_and_model, "colorpass", 9)) { /* * Canon... @@ -229,7 +229,7 @@ _ppdNormalizeMakeAndModel( snprintf(buffer, bufsize, "Canon %s", make_and_model); } - else if (!strncasecmp(make_and_model, "primera", 7)) + else if (!_cups_strncasecmp(make_and_model, "primera", 7)) { /* * Fargo... @@ -237,8 +237,8 @@ _ppdNormalizeMakeAndModel( snprintf(buffer, bufsize, "Fargo %s", make_and_model); } - else if (!strncasecmp(make_and_model, "designjet", 9) || - !strncasecmp(make_and_model, "deskjet", 7)) + else if (!_cups_strncasecmp(make_and_model, "designjet", 9) || + !_cups_strncasecmp(make_and_model, "deskjet", 7)) { /* * HP... @@ -253,7 +253,7 @@ _ppdNormalizeMakeAndModel( * Clean up the make... */ - if (!strncasecmp(buffer, "agfa", 4)) + if (!_cups_strncasecmp(buffer, "agfa", 4)) { /* * Replace with AGFA (all uppercase)... @@ -264,7 +264,7 @@ _ppdNormalizeMakeAndModel( buffer[2] = 'F'; buffer[3] = 'A'; } - else if (!strncasecmp(buffer, "Hewlett-Packard hp ", 19)) + else if (!_cups_strncasecmp(buffer, "Hewlett-Packard hp ", 19)) { /* * Just put "HP" on the front... @@ -274,7 +274,7 @@ _ppdNormalizeMakeAndModel( buffer[1] = 'P'; _cups_strcpy(buffer + 2, buffer + 18); } - else if (!strncasecmp(buffer, "Hewlett-Packard ", 16)) + else if (!_cups_strncasecmp(buffer, "Hewlett-Packard ", 16)) { /* * Just put "HP" on the front... @@ -284,7 +284,7 @@ _ppdNormalizeMakeAndModel( buffer[1] = 'P'; _cups_strcpy(buffer + 2, buffer + 15); } - else if (!strncasecmp(buffer, "Lexmark International", 21)) + else if (!_cups_strncasecmp(buffer, "Lexmark International", 21)) { /* * Strip "International"... @@ -292,7 +292,7 @@ _ppdNormalizeMakeAndModel( _cups_strcpy(buffer + 8, buffer + 21); } - else if (!strncasecmp(buffer, "herk", 4)) + else if (!_cups_strncasecmp(buffer, "herk", 4)) { /* * Replace with LHAG... @@ -303,7 +303,7 @@ _ppdNormalizeMakeAndModel( buffer[2] = 'A'; buffer[3] = 'G'; } - else if (!strncasecmp(buffer, "linotype", 8)) + else if (!_cups_strncasecmp(buffer, "linotype", 8)) { /* * Replace with LHAG... diff --git a/cups/auth.c b/cups/auth.c index d62ac08ff..3cdb9b643 100644 --- a/cups/auth.c +++ b/cups/auth.c @@ -195,7 +195,7 @@ cupsDoAuthentication( cupsUser(), http->hostname[0] == '/' ? "localhost" : http->hostname); - http->digest_tries = strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], + http->digest_tries = _cups_strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Digest", 5) != 0; http->userpass[0] = '\0'; @@ -679,7 +679,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */ */ if (!httpAddrLocalhost(http->hostaddr) && - strcasecmp(http->hostname, "localhost") != 0) + _cups_strcasecmp(http->hostname, "localhost") != 0) { DEBUG_puts("8cups_local_auth: Not a local connection!"); return (1); diff --git a/cups/conflicts.c b/cups/conflicts.c index 543b6aece..dd1bf3deb 100644 --- a/cups/conflicts.c +++ b/cups/conflicts.c @@ -125,7 +125,7 @@ cupsGetConflicts( for (i = c->num_constraints, cptr = c->constraints; i > 0; i --, cptr ++) - if (strcasecmp(cptr->option->keyword, option)) + if (_cups_strcasecmp(cptr->option->keyword, option)) { if (cptr->choice) num_options = cupsAddOption(cptr->option->keyword, @@ -229,7 +229,7 @@ cupsResolveConflicts( for (i = 0; i < *num_options; i ++) num_newopts = cupsAddOption((*options)[i].name, (*options)[i].value, num_newopts, &newopts); - if (option && strcasecmp(option, "Collate")) + if (option && _cups_strcasecmp(option, "Collate")) num_newopts = cupsAddOption(option, choice, num_newopts, &newopts); /* @@ -239,7 +239,7 @@ cupsResolveConflicts( cupsArraySave(ppd->sorted_attrs); resolvers = NULL; - pass = cupsArrayNew((cups_array_func_t)strcasecmp, NULL); + pass = cupsArrayNew((cups_array_func_t)_cups_strcasecmp, NULL); tries = 0; while (tries < 100 && @@ -249,7 +249,7 @@ cupsResolveConflicts( tries ++; if (!resolvers) - resolvers = cupsArrayNew((cups_array_func_t)strcasecmp, NULL); + resolvers = cupsArrayNew((cups_array_func_t)_cups_strcasecmp, NULL); for (consts = (_ppd_cups_uiconsts_t *)cupsArrayFirst(active), changed = 0; consts; @@ -334,20 +334,20 @@ cupsResolveConflicts( snprintf(firstpage, sizeof(firstpage), "AP_FIRSTPAGE_%s", resoption); if (option && - (!strcasecmp(resoption, option) || - !strcasecmp(firstpage, option) || - (!strcasecmp(option, "PageSize") && - !strcasecmp(resoption, "PageRegion")) || - (!strcasecmp(option, "AP_FIRSTPAGE_PageSize") && - !strcasecmp(resoption, "PageSize")) || - (!strcasecmp(option, "AP_FIRSTPAGE_PageSize") && - !strcasecmp(resoption, "PageRegion")) || - (!strcasecmp(option, "PageRegion") && - !strcasecmp(resoption, "PageSize")) || - (!strcasecmp(option, "AP_FIRSTPAGE_PageRegion") && - !strcasecmp(resoption, "PageSize")) || - (!strcasecmp(option, "AP_FIRSTPAGE_PageRegion") && - !strcasecmp(resoption, "PageRegion")))) + (!_cups_strcasecmp(resoption, option) || + !_cups_strcasecmp(firstpage, option) || + (!_cups_strcasecmp(option, "PageSize") && + !_cups_strcasecmp(resoption, "PageRegion")) || + (!_cups_strcasecmp(option, "AP_FIRSTPAGE_PageSize") && + !_cups_strcasecmp(resoption, "PageSize")) || + (!_cups_strcasecmp(option, "AP_FIRSTPAGE_PageSize") && + !_cups_strcasecmp(resoption, "PageRegion")) || + (!_cups_strcasecmp(option, "PageRegion") && + !_cups_strcasecmp(resoption, "PageSize")) || + (!_cups_strcasecmp(option, "AP_FIRSTPAGE_PageRegion") && + !_cups_strcasecmp(resoption, "PageSize")) || + (!_cups_strcasecmp(option, "AP_FIRSTPAGE_PageRegion") && + !_cups_strcasecmp(resoption, "PageRegion")))) continue; /* @@ -405,11 +405,11 @@ cupsResolveConflicts( */ if (option && - (!strcasecmp(constptr->option->keyword, option) || - (!strcasecmp(option, "PageSize") && - !strcasecmp(constptr->option->keyword, "PageRegion")) || - (!strcasecmp(option, "PageRegion") && - !strcasecmp(constptr->option->keyword, "PageSize")))) + (!_cups_strcasecmp(constptr->option->keyword, option) || + (!_cups_strcasecmp(option, "PageSize") && + !_cups_strcasecmp(constptr->option->keyword, "PageRegion")) || + (!_cups_strcasecmp(option, "PageRegion") && + !_cups_strcasecmp(constptr->option->keyword, "PageSize")))) continue; /* @@ -419,8 +419,8 @@ cupsResolveConflicts( if ((value = cupsGetOption(constptr->option->keyword, num_newopts, newopts)) == NULL) { - if (!strcasecmp(constptr->option->keyword, "PageSize") || - !strcasecmp(constptr->option->keyword, "PageRegion")) + if (!_cups_strcasecmp(constptr->option->keyword, "PageSize") || + !_cups_strcasecmp(constptr->option->keyword, "PageRegion")) { if ((value = cupsGetOption("PageSize", num_newopts, newopts)) == NULL) @@ -441,7 +441,7 @@ cupsResolveConflicts( } } - if (!strncasecmp(value, "Custom.", 7)) + if (!_cups_strncasecmp(value, "Custom.", 7)) value = "Custom"; /* @@ -450,7 +450,7 @@ cupsResolveConflicts( test = NULL; - if (strcasecmp(value, constptr->option->defchoice) && + if (_cups_strcasecmp(value, constptr->option->defchoice) && (test = ppd_test_constraints(ppd, constptr->option->keyword, constptr->option->defchoice, num_newopts, newopts, @@ -479,9 +479,9 @@ cupsResolveConflicts( cupsArrayDelete(test); test = NULL; - if (strcasecmp(value, cptr->choice) && - strcasecmp(constptr->option->defchoice, cptr->choice) && - strcasecmp("Custom", cptr->choice) && + if (_cups_strcasecmp(value, cptr->choice) && + _cups_strcasecmp(constptr->option->defchoice, cptr->choice) && + _cups_strcasecmp("Custom", cptr->choice) && (test = ppd_test_constraints(ppd, constptr->option->keyword, cptr->choice, num_newopts, newopts, @@ -532,7 +532,7 @@ cupsResolveConflicts( * handle manual collation... */ - if (option && !strcasecmp(option, "Collate")) + if (option && !_cups_strcasecmp(option, "Collate")) num_newopts = cupsAddOption(option, choice, num_newopts, &newopts); else num_newopts = cupsRemoveOption("Collate", num_newopts, &newopts); @@ -704,7 +704,7 @@ ppd_is_installable( for (i = installable->num_options, option = installable->options; i > 0; i --, option ++) - if (!strcasecmp(option->keyword, name)) + if (!_cups_strcasecmp(option->keyword, name)) return (1); } @@ -746,7 +746,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */ for (i = ppd->num_groups, installable = ppd->groups; i > 0; i --, installable ++) - if (!strcasecmp(installable->name, "InstallableOptions")) + if (!_cups_strcasecmp(installable->name, "InstallableOptions")) break; if (i <= 0) @@ -764,10 +764,10 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */ */ if (i > 1 && - !strcasecmp(oldconst[0].option1, oldconst[1].option2) && - !strcasecmp(oldconst[0].choice1, oldconst[1].choice2) && - !strcasecmp(oldconst[0].option2, oldconst[1].option1) && - !strcasecmp(oldconst[0].choice2, oldconst[1].choice1)) + !_cups_strcasecmp(oldconst[0].option1, oldconst[1].option2) && + !_cups_strcasecmp(oldconst[0].choice1, oldconst[1].choice2) && + !_cups_strcasecmp(oldconst[0].option2, oldconst[1].option1) && + !_cups_strcasecmp(oldconst[0].choice2, oldconst[1].choice1)) continue; /* @@ -796,8 +796,8 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */ consts->num_constraints = 2; consts->constraints = constptr; - if (!strncasecmp(oldconst->option1, "Custom", 6) && - !strcasecmp(oldconst->choice1, "True")) + if (!_cups_strncasecmp(oldconst->option1, "Custom", 6) && + !_cups_strcasecmp(oldconst->choice1, "True")) { constptr[0].option = ppdFindOption(ppd, oldconst->option1 + 6); constptr[0].choice = ppdFindChoice(constptr[0].option, "Custom"); @@ -821,8 +821,8 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */ continue; } - if (!strncasecmp(oldconst->option2, "Custom", 6) && - !strcasecmp(oldconst->choice2, "True")) + if (!_cups_strncasecmp(oldconst->option2, "Custom", 6) && + !_cups_strcasecmp(oldconst->choice2, "True")) { constptr[1].option = ppdFindOption(ppd, oldconst->option2 + 6); constptr[1].choice = ppdFindChoice(constptr[1].option, "Custom"); @@ -927,7 +927,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */ *ptr = '\0'; } - if (!strncasecmp(option, "Custom", 6) && !strcasecmp(choice, "True")) + if (!_cups_strncasecmp(option, "Custom", 6) && !_cups_strcasecmp(choice, "True")) { _cups_strcpy(option, option + 6); strcpy(choice, "Custom"); @@ -1024,11 +1024,11 @@ ppd_test_constraints( i > 0; i --, constptr ++) { - if (!strcasecmp(constptr->option->keyword, option)) + if (!_cups_strcasecmp(constptr->option->keyword, option)) break; - if (!strncasecmp(option, "AP_FIRSTPAGE_", 13) && - !strcasecmp(constptr->option->keyword, option + 13)) + if (!_cups_strncasecmp(option, "AP_FIRSTPAGE_", 13) && + !_cups_strcasecmp(constptr->option->keyword, option + 13)) break; } @@ -1046,8 +1046,8 @@ ppd_test_constraints( constptr->choice ? constptr->choice->choice : "")); if (constptr->choice && - (!strcasecmp(constptr->option->keyword, "PageSize") || - !strcasecmp(constptr->option->keyword, "PageRegion"))) + (!_cups_strcasecmp(constptr->option->keyword, "PageSize") || + !_cups_strcasecmp(constptr->option->keyword, "PageRegion"))) { /* * PageSize and PageRegion are used depending on the selected input slot @@ -1056,8 +1056,8 @@ ppd_test_constraints( */ if (option && choice && - (!strcasecmp(option, "PageSize") || - !strcasecmp(option, "PageRegion"))) + (!_cups_strcasecmp(option, "PageSize") || + !_cups_strcasecmp(option, "PageRegion"))) { value = choice; } @@ -1073,12 +1073,12 @@ ppd_test_constraints( value = size->name; } - if (value && !strncasecmp(value, "Custom.", 7)) + if (value && !_cups_strncasecmp(value, "Custom.", 7)) value = "Custom"; if (option && choice && - (!strcasecmp(option, "AP_FIRSTPAGE_PageSize") || - !strcasecmp(option, "AP_FIRSTPAGE_PageRegion"))) + (!_cups_strcasecmp(option, "AP_FIRSTPAGE_PageSize") || + !_cups_strcasecmp(option, "AP_FIRSTPAGE_PageRegion"))) { firstvalue = choice; } @@ -1087,11 +1087,11 @@ ppd_test_constraints( firstvalue = cupsGetOption("AP_FIRSTPAGE_PageRegion", num_options, options); - if (firstvalue && !strncasecmp(firstvalue, "Custom.", 7)) + if (firstvalue && !_cups_strncasecmp(firstvalue, "Custom.", 7)) firstvalue = "Custom"; - if ((!value || strcasecmp(value, constptr->choice->choice)) && - (!firstvalue || strcasecmp(firstvalue, constptr->choice->choice))) + if ((!value || _cups_strcasecmp(value, constptr->choice->choice)) && + (!firstvalue || _cups_strcasecmp(firstvalue, constptr->choice->choice))) { DEBUG_puts("9ppd_test_constraints: NO"); break; @@ -1103,9 +1103,9 @@ ppd_test_constraints( * Compare against the constrained choice... */ - if (option && choice && !strcasecmp(option, constptr->option->keyword)) + if (option && choice && !_cups_strcasecmp(option, constptr->option->keyword)) { - if (!strncasecmp(choice, "Custom.", 7)) + if (!_cups_strncasecmp(choice, "Custom.", 7)) value = "Custom"; else value = choice; @@ -1113,7 +1113,7 @@ ppd_test_constraints( else if ((value = cupsGetOption(constptr->option->keyword, num_options, options)) != NULL) { - if (!strncasecmp(value, "Custom.", 7)) + if (!_cups_strncasecmp(value, "Custom.", 7)) value = "Custom"; } else if (constptr->choice->marked) @@ -1128,9 +1128,9 @@ ppd_test_constraints( snprintf(firstpage, sizeof(firstpage), "AP_FIRSTPAGE_%s", constptr->option->keyword); - if (option && choice && !strcasecmp(option, firstpage)) + if (option && choice && !_cups_strcasecmp(option, firstpage)) { - if (!strncasecmp(choice, "Custom.", 7)) + if (!_cups_strncasecmp(choice, "Custom.", 7)) firstvalue = "Custom"; else firstvalue = choice; @@ -1138,7 +1138,7 @@ ppd_test_constraints( else if ((firstvalue = cupsGetOption(firstpage, num_options, options)) != NULL) { - if (!strncasecmp(firstvalue, "Custom.", 7)) + if (!_cups_strncasecmp(firstvalue, "Custom.", 7)) firstvalue = "Custom"; } else @@ -1147,18 +1147,18 @@ ppd_test_constraints( DEBUG_printf(("9ppd_test_constraints: value=%s, firstvalue=%s", value, firstvalue)); - if ((!value || strcasecmp(value, constptr->choice->choice)) && - (!firstvalue || strcasecmp(firstvalue, constptr->choice->choice))) + if ((!value || _cups_strcasecmp(value, constptr->choice->choice)) && + (!firstvalue || _cups_strcasecmp(firstvalue, constptr->choice->choice))) { DEBUG_puts("9ppd_test_constraints: NO"); break; } } else if (option && choice && - !strcasecmp(option, constptr->option->keyword)) + !_cups_strcasecmp(option, constptr->option->keyword)) { - if (!strcasecmp(choice, "None") || !strcasecmp(choice, "Off") || - !strcasecmp(choice, "False")) + if (!_cups_strcasecmp(choice, "None") || !_cups_strcasecmp(choice, "Off") || + !_cups_strcasecmp(choice, "False")) { DEBUG_puts("9ppd_test_constraints: NO"); break; @@ -1167,8 +1167,8 @@ ppd_test_constraints( else if ((value = cupsGetOption(constptr->option->keyword, num_options, options)) != NULL) { - if (!strcasecmp(value, "None") || !strcasecmp(value, "Off") || - !strcasecmp(value, "False")) + if (!_cups_strcasecmp(value, "None") || !_cups_strcasecmp(value, "Off") || + !_cups_strcasecmp(value, "False")) { DEBUG_puts("9ppd_test_constraints: NO"); break; @@ -1180,9 +1180,9 @@ ppd_test_constraints( if ((marked = (ppd_choice_t *)cupsArrayFind(ppd->marked, &key)) == NULL || - (!strcasecmp(marked->choice, "None") || - !strcasecmp(marked->choice, "Off") || - !strcasecmp(marked->choice, "False"))) + (!_cups_strcasecmp(marked->choice, "None") || + !_cups_strcasecmp(marked->choice, "Off") || + !_cups_strcasecmp(marked->choice, "False"))) { DEBUG_puts("9ppd_test_constraints: NO"); break; diff --git a/cups/custom.c b/cups/custom.c index d4b959256..471361cc4 100644 --- a/cups/custom.c +++ b/cups/custom.c @@ -78,7 +78,7 @@ ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */ for (param = (ppd_cparam_t *)cupsArrayFirst(opt->params); param; param = (ppd_cparam_t *)cupsArrayNext(opt->params)) - if (!strcasecmp(param->name, name)) + if (!_cups_strcasecmp(param->name, name)) break; return (param); diff --git a/cups/dest.c b/cups/dest.c index bd738bf00..7ef630663 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -248,7 +248,7 @@ _cupsAppleCopyDefaultPrinter(void) return (NULL); } - + DEBUG_printf(("1_cupsAppleCopyDefaultPrinter: Got locations, %d entries.", (int)CFArrayGetCount(locations))); @@ -404,12 +404,12 @@ _cupsAppleSetDefaultPrinter( /* * '_cupsAppleSetUseLastPrinter()' - Set whether to use the last used printer. */ - -void + +void _cupsAppleSetUseLastPrinter( int uselast) /* O - 1 to use last printer, 0 otherwise */ { - CFPreferencesSetAppValue(kUseLastPrinter, + CFPreferencesSetAppValue(kUseLastPrinter, uselast ? kCFBooleanTrue : kCFBooleanFalse, kCUPSPrintingPrefs); CFPreferencesAppSynchronize(kCUPSPrintingPrefs); @@ -688,7 +688,7 @@ _cupsGetDests(http_t *http, /* I - Connection to server or CUPS_HTTP_DEFAUL int i; /* Looping var */ for (i = 0; i < attr->num_values; i ++) - if (!strcasecmp(media_default, attr->values[i].string.text)) + if (!_cups_strcasecmp(media_default, attr->values[i].string.text)) { num_options = cupsAddOption("media", media_default, num_options, &options); @@ -715,7 +715,7 @@ _cupsGetDests(http_t *http, /* I - Connection to server or CUPS_HTTP_DEFAUL strlcpy(optname, attr->name, sizeof(optname)); optname[ptr - attr->name] = '\0'; - if (strcasecmp(optname, "media") || + if (_cups_strcasecmp(optname, "media") || !cupsGetOption("media", num_options, options)) num_options = cupsAddOption(optname, cups_make_string(attr, value, @@ -1178,10 +1178,10 @@ cupsSetDefaultDest( */ for (i = num_dests, dest = dests; i > 0; i --, dest ++) - dest->is_default = !strcasecmp(name, dest->name) && + dest->is_default = !_cups_strcasecmp(name, dest->name) && ((!instance && !dest->instance) || (instance && dest->instance && - !strcasecmp(instance, dest->instance))); + !_cups_strcasecmp(instance, dest->instance))); } @@ -1346,7 +1346,7 @@ cupsSetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_ if (temp && (val = cupsGetOption(option->name, temp->num_options, temp->options)) != NULL && - !strcasecmp(val, option->value)) + !_cups_strcasecmp(val, option->value)) continue; /* @@ -1360,7 +1360,7 @@ cupsSetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_ fprintf(fp, "/%s", dest->instance); wrote = 1; } - + if (option->value[0]) { if (strchr(option->value, ' ') || @@ -1537,7 +1537,7 @@ appleCopyNetwork(void) CFStringRef key; /* Current network configuration key */ CFDictionaryRef ip_dict; /* Network configuration data */ CFStringRef network = NULL; /* Current network ID */ - + if ((dynamicStore = SCDynamicStoreCreate(NULL, CFSTR("libcups"), NULL, NULL)) != NULL) @@ -1742,10 +1742,10 @@ cups_compare_dests(cups_dest_t *a, /* I - First destination */ int diff; /* Difference */ - if ((diff = strcasecmp(a->name, b->name)) != 0) + if ((diff = _cups_strcasecmp(a->name, b->name)) != 0) return (diff); else if (a->instance && b->instance) - return (strcasecmp(a->instance, b->instance)); + return (_cups_strcasecmp(a->instance, b->instance)); else return ((a->instance && !b->instance) - (!a->instance && b->instance)); } @@ -1868,7 +1868,7 @@ cups_get_default(const char *filename, /* I - File to read */ char line[8192], /* Line from file */ *value, /* Value for line */ *nameptr; /* Pointer into name */ - int linenum; /* Current line */ + int linenum; /* Current line */ *namebuf = '\0'; @@ -1879,7 +1879,7 @@ cups_get_default(const char *filename, /* I - File to read */ while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum)) { - if (!strcasecmp(line, "default") && value) + if (!_cups_strcasecmp(line, "default") && value) { strlcpy(namebuf, value, namesize); @@ -1956,7 +1956,7 @@ cups_get_dests( DEBUG_printf(("9cups_get_dests: linenum=%d line=\"%s\" lineptr=\"%s\"", linenum, line, lineptr)); - if ((strcasecmp(line, "dest") && strcasecmp(line, "default")) || !lineptr) + if ((_cups_strcasecmp(line, "dest") && _cups_strcasecmp(line, "default")) || !lineptr) { DEBUG_puts("9cups_get_dests: Not a dest or default line..."); continue; @@ -2003,10 +2003,10 @@ cups_get_dests( if (match_name) { - if (strcasecmp(name, match_name) || + if (_cups_strcasecmp(name, match_name) || (!instance && match_inst) || (instance && !match_inst) || - (instance && strcasecmp(instance, match_inst))) + (instance && _cups_strcasecmp(instance, match_inst))) continue; dest = *dests; @@ -2053,7 +2053,7 @@ cups_get_dests( * Set this as default if needed... */ - if (!user_default_set && !strcasecmp(line, "default")) + if (!user_default_set && !_cups_strcasecmp(line, "default")) { DEBUG_puts("9cups_get_dests: Setting as default..."); @@ -2068,7 +2068,7 @@ cups_get_dests( * Close the file and return... */ - cupsFileClose(fp); + cupsFileClose(fp); return (num_dests); } diff --git a/cups/emit.c b/cups/emit.c index 7e2520c7d..d224bf208 100644 --- a/cups/emit.c +++ b/cups/emit.c @@ -3,7 +3,7 @@ * * PPD code emission routines for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -417,7 +417,7 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */ if ((charset = ppdFindAttr(ppd, "cupsPJLCharset", NULL)) != NULL) { - if (!charset->value || strcasecmp(charset->value, "UTF-8")) + if (!charset->value || _cups_strcasecmp(charset->value, "UTF-8")) charset = NULL; } @@ -654,7 +654,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */ { if (section == PPD_ORDER_JCL) { - if (!strcasecmp(choices[i]->choice, "Custom") && + if (!_cups_strcasecmp(choices[i]->choice, "Custom") && (coption = ppdFindCustomOption(ppd, choices[i]->option->keyword)) != NULL) { @@ -690,16 +690,16 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */ { bufsize += 3; /* [{\n */ - if ((!strcasecmp(choices[i]->option->keyword, "PageSize") || - !strcasecmp(choices[i]->option->keyword, "PageRegion")) && - !strcasecmp(choices[i]->choice, "Custom")) + if ((!_cups_strcasecmp(choices[i]->option->keyword, "PageSize") || + !_cups_strcasecmp(choices[i]->option->keyword, "PageRegion")) && + !_cups_strcasecmp(choices[i]->choice, "Custom")) { DEBUG_puts("2ppdEmitString: Custom size set!"); bufsize += 37; /* %%BeginFeature: *CustomPageSize True\n */ bufsize += 50; /* Five 9-digit numbers + newline */ } - else if (!strcasecmp(choices[i]->choice, "Custom") && + else if (!_cups_strcasecmp(choices[i]->choice, "Custom") && (coption = ppdFindCustomOption(ppd, choices[i]->option->keyword)) != NULL) @@ -707,7 +707,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */ bufsize += 23 + strlen(choices[i]->option->keyword) + 6; /* %%BeginFeature: *Customkeyword True\n */ - + for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params); cparam; cparam = (ppd_cparam_t *)cupsArrayNext(coption->params)) @@ -770,7 +770,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */ for (i = 0, bufptr = buffer; i < count; i ++, bufptr += strlen(bufptr)) if (section == PPD_ORDER_JCL) { - if (!strcasecmp(choices[i]->choice, "Custom") && + if (!_cups_strcasecmp(choices[i]->choice, "Custom") && choices[i]->code && (coption = ppdFindCustomOption(ppd, choices[i]->option->keyword)) != NULL) @@ -871,9 +871,9 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */ DEBUG_printf(("2ppdEmitString: Adding code for %s=%s...", choices[i]->option->keyword, choices[i]->choice)); - if ((!strcasecmp(choices[i]->option->keyword, "PageSize") || - !strcasecmp(choices[i]->option->keyword, "PageRegion")) && - !strcasecmp(choices[i]->choice, "Custom")) + if ((!_cups_strcasecmp(choices[i]->option->keyword, "PageSize") || + !_cups_strcasecmp(choices[i]->option->keyword, "PageRegion")) && + !_cups_strcasecmp(choices[i]->choice, "Custom")) { /* * Variable size; write out standard size options, using the @@ -986,7 +986,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */ bufptr += strlen(bufptr); } } - else if (!strcasecmp(choices[i]->choice, "Custom") && + else if (!_cups_strcasecmp(choices[i]->choice, "Custom") && (coption = ppdFindCustomOption(ppd, choices[i]->option->keyword)) != NULL) { @@ -1161,9 +1161,9 @@ ppd_handle_media(ppd_file_t *ppd) /* I - PPD file */ if (!rpr) rpr = ppdFindAttr(ppd, "RequiresPageRegion", "All"); - if (!strcasecmp(size->name, "Custom") || + if (!_cups_strcasecmp(size->name, "Custom") || (!manual_feed && !input_slot) || - (manual_feed && !strcasecmp(manual_feed->choice, "False") && + (manual_feed && !_cups_strcasecmp(manual_feed->choice, "False") && (!input_slot || (input_slot->code && !input_slot->code[0]))) || (!rpr && ppd->num_filters > 0)) { @@ -1173,7 +1173,7 @@ ppd_handle_media(ppd_file_t *ppd) /* I - PPD file */ ppdMarkOption(ppd, "PageSize", size->name); } - else if (rpr && rpr->value && !strcasecmp(rpr->value, "True")) + else if (rpr && rpr->value && !_cups_strcasecmp(rpr->value, "True")) { /* * Use PageRegion code... diff --git a/cups/encode.c b/cups/encode.c index 392f57295..0f2dd38cf 100644 --- a/cups/encode.c +++ b/cups/encode.c @@ -3,7 +3,7 @@ * * Option encoding routines for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -271,8 +271,8 @@ cupsEncodeOptions2( * Skip document format options that are handled above... */ - if (!strcasecmp(option->name, "raw") || - !strcasecmp(option->name, "document-format") || + if (!_cups_strcasecmp(option->name, "raw") || + !_cups_strcasecmp(option->name, "document-format") || !option->name[0]) continue; @@ -302,8 +302,8 @@ cupsEncodeOptions2( else if (group_tag != IPP_TAG_PRINTER) continue; - if (!strcasecmp(option->value, "true") || - !strcasecmp(option->value, "false")) + if (!_cups_strcasecmp(option->value, "true") || + !_cups_strcasecmp(option->value, "false")) value_tag = IPP_TAG_BOOLEAN; else value_tag = IPP_TAG_NAME; @@ -460,9 +460,9 @@ cupsEncodeOptions2( break; case IPP_TAG_BOOLEAN : - if (!strcasecmp(val, "true") || - !strcasecmp(val, "on") || - !strcasecmp(val, "yes")) + if (!_cups_strcasecmp(val, "true") || + !_cups_strcasecmp(val, "on") || + !_cups_strcasecmp(val, "yes")) { /* * Boolean value - true... @@ -524,7 +524,7 @@ cupsEncodeOptions2( else attr->values[j].resolution.yres = attr->values[j].resolution.xres; - if (!strcasecmp(s, "dpc")) + if (!_cups_strcasecmp(s, "dpc")) attr->values[j].resolution.units = IPP_RES_PER_CM; else attr->values[j].resolution.units = IPP_RES_PER_INCH; diff --git a/cups/file-private.h b/cups/file-private.h index 42e4bfab7..60a250148 100644 --- a/cups/file-private.h +++ b/cups/file-private.h @@ -73,7 +73,8 @@ typedef enum /**** _cupsFileCheck return values ****/ _CUPS_FILE_CHECK_OK = 0, /* Everything OK */ _CUPS_FILE_CHECK_MISSING = 1, /* File is missing */ _CUPS_FILE_CHECK_PERMISSIONS = 2, /* File (or parent dir) has bad perms */ - _CUPS_FILE_CHECK_WRONG_TYPE = 3 /* File has wrong type */ + _CUPS_FILE_CHECK_WRONG_TYPE = 3, /* File has wrong type */ + _CUPS_FILE_CHECK_RELATIVE_PATH = 4 /* File contains a relative path */ } _cups_fc_result_t; typedef enum /**** _cupsFileCheck file type values ****/ diff --git a/cups/file.c b/cups/file.c index d69c8a8da..ab72a19f6 100644 --- a/cups/file.c +++ b/cups/file.c @@ -98,6 +98,20 @@ _cupsFileCheck( _cups_fc_result_t result; /* Check result */ + /* + * Does the filename contain a relative path ("../")? + */ + + if (strstr(filename, "../")) + { + /* + * Yes, fail it! + */ + + result = _CUPS_FILE_CHECK_RELATIVE_PATH; + goto finishup; + } + /* * Does the program even exist and is it accessible? */ @@ -284,6 +298,17 @@ _cupsFileCheck( _cupsLangString(lang, _("File \"%s\" is a directory.")), filename); break; + + case _CUPS_FILE_CHECK_RELATIVE_PATH : + if (filetype == _CUPS_FILE_CHECK_DIRECTORY) + snprintf(message, sizeof(message), + _cupsLangString(lang, _("Directory \"%s\" contains a " + "relative path.")), filename); + else + snprintf(message, sizeof(message), + _cupsLangString(lang, _("File \"%s\" contains a relative " + "path.")), filename); + break; } (*cb)(context, result, message); @@ -321,6 +346,7 @@ _cupsFileCheckFilter( break; case _CUPS_FILE_CHECK_PERMISSIONS : + case _CUPS_FILE_CHECK_RELATIVE_PATH : prefix = "ERROR"; fputs("STATE: +cups-insecure-filter-warning\n", stderr); break; diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c index 4c82a966c..3478f05b4 100644 --- a/cups/http-addrlist.c +++ b/cups/http-addrlist.c @@ -124,9 +124,9 @@ httpAddrConnect( val = 1; #ifdef WIN32 setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&val, - sizeof(val)); + sizeof(val)); #else - setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)); + setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)); #endif /* WIN32 */ #ifdef FD_CLOEXEC @@ -278,7 +278,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p } else #endif /* AF_LOCAL */ - if (!hostname || strcasecmp(hostname, "localhost")) + if (!hostname || _cups_strcasecmp(hostname, "localhost")) { #ifdef HAVE_GETADDRINFO struct addrinfo hints, /* Address lookup hints */ @@ -515,7 +515,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p * Detect some common errors and handle them sanely... */ - if (!addr && (!hostname || !strcasecmp(hostname, "localhost"))) + if (!addr && (!hostname || !_cups_strcasecmp(hostname, "localhost"))) { struct servent *port; /* Port number for service */ int portnum; /* Port number */ @@ -547,7 +547,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p return (NULL); } - if (hostname && !strcasecmp(hostname, "localhost")) + if (hostname && !_cups_strcasecmp(hostname, "localhost")) { /* * Unfortunately, some users ignore all of the warnings in the diff --git a/cups/http-support.c b/cups/http-support.c index e532b48f3..677dbfd56 100644 --- a/cups/http-support.c +++ b/cups/http-support.c @@ -801,7 +801,7 @@ httpGetDateTime(const char *s) /* I - Date/time string */ */ for (i = 0; i < 12; i ++) - if (!strcasecmp(mon, http_months[i])) + if (!_cups_strcasecmp(mon, http_months[i])) break; if (i >= 12) @@ -1001,7 +1001,7 @@ httpSeparateURI( *port = 443; else if (!strcmp(scheme, "ipp") || !strcmp(scheme, "ipps")) *port = 631; - else if (!strcasecmp(scheme, "lpd")) + else if (!_cups_strcasecmp(scheme, "lpd")) *port = 515; else if (!strcmp(scheme, "socket")) /* Not yet registered with IANA... */ *port = 9100; @@ -1543,8 +1543,8 @@ _httpResolveURI( stimeout.tv_sec = ((int)timeout) / 1000; stimeout.tv_usec = ((int)(timeout) * 1000) % 1000000; - fds = select(DNSServiceRefSockFD(ref)+1, &input_set, NULL, NULL, - timeout < 0.0 ? NULL : &stimeout); + fds = select(DNSServiceRefSockFD(ref)+1, &input_set, NULL, NULL, + timeout < 0.0 ? NULL : &stimeout); #endif /* HAVE_POLL */ if (fds < 0) @@ -1562,14 +1562,14 @@ _httpResolveURI( * comes in, do an additional domain resolution... */ - if (domainsent == 0 && (domain && strcasecmp(domain, "local."))) + if (domainsent == 0 && (domain && _cups_strcasecmp(domain, "local."))) { if (options & _HTTP_RESOLVE_STDERR) fprintf(stderr, "DEBUG: Resolving \"%s\", regtype=\"%s\", " "domain=\"%s\"...\n", hostname, regtype, domain ? domain : ""); - + domainref = ref; if (DNSServiceResolve(&domainref, kDNSServiceFlagsShareConnection, 0, hostname, regtype, domain, @@ -1651,7 +1651,7 @@ _httpResolveURI( */ static const char * /* O - New source pointer or NULL on error */ -http_copy_decode(char *dst, /* O - Destination buffer */ +http_copy_decode(char *dst, /* O - Destination buffer */ const char *src, /* I - Source pointer */ int dstsize, /* I - Destination size */ const char *term, /* I - Terminating characters */ @@ -1719,7 +1719,7 @@ http_copy_decode(char *dst, /* O - Destination buffer */ */ static char * /* O - End of current URI */ -http_copy_encode(char *dst, /* O - Destination buffer */ +http_copy_encode(char *dst, /* O - Destination buffer */ const char *src, /* I - Source pointer */ char *dstend, /* I - End of destination buffer */ const char *reserved, /* I - Extra reserved characters */ @@ -1841,7 +1841,7 @@ http_resolve_cb( if ((uribuf->options & _HTTP_RESOLVE_FQDN) && (hostptr = hostTarget + strlen(hostTarget) - 7) > hostTarget && - !strcasecmp(hostptr, ".local.")) + !_cups_strcasecmp(hostptr, ".local.")) { /* * OK, we got a .local name but the caller needs a real domain. Start by @@ -1867,7 +1867,7 @@ http_resolve_cb( DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn)); if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn || - strcasecmp(hostptr, ".local")) + _cups_strcasecmp(hostptr, ".local")) { hostTarget = fqdn; break; diff --git a/cups/http.c b/cups/http.c index 0a628911b..53b1f1d66 100644 --- a/cups/http.c +++ b/cups/http.c @@ -1056,7 +1056,7 @@ httpGetLength2(http_t *http) /* I - Connection to server */ if (!http) return (-1); - if (!strcasecmp(http->fields[HTTP_FIELD_TRANSFER_ENCODING], "chunked")) + if (!_cups_strcasecmp(http->fields[HTTP_FIELD_TRANSFER_ENCODING], "chunked")) { DEBUG_puts("4httpGetLength2: chunked request!"); @@ -2699,7 +2699,7 @@ _httpUpdate(http_t *http, /* I - Connection to server */ * Be tolerants of servers that send unknown attribute fields... */ - if (!strcasecmp(line, "expect")) + if (!_cups_strcasecmp(line, "expect")) { /* * "Expect: 100-continue" or similar... @@ -2707,7 +2707,7 @@ _httpUpdate(http_t *http, /* I - Connection to server */ http->expect = (http_status_t)atoi(value); } - else if (!strcasecmp(line, "cookie")) + else if (!_cups_strcasecmp(line, "cookie")) { /* * "Cookie: name=value[; name=value ...]" - replaces previous cookies... @@ -3364,7 +3364,7 @@ http_field(const char *name) /* I - String name */ for (i = 0; i < HTTP_FIELD_MAX; i ++) - if (strcasecmp(name, http_fields[i]) == 0) + if (_cups_strcasecmp(name, http_fields[i]) == 0) return ((http_field_t)i); return (HTTP_FIELD_UNKNOWN); diff --git a/cups/ipp-support.c b/cups/ipp-support.c index 42b4d47a4..607c2764c 100644 --- a/cups/ipp-support.c +++ b/cups/ipp-support.c @@ -3,7 +3,7 @@ * * Internet Printing Protocol support functions for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -566,25 +566,25 @@ ippErrorValue(const char *name) /* I - Name */ for (i = 0; i < (sizeof(ipp_status_oks) / sizeof(ipp_status_oks[0])); i ++) - if (!strcasecmp(name, ipp_status_oks[i])) + if (!_cups_strcasecmp(name, ipp_status_oks[i])) return ((ipp_status_t)i); - if (!strcasecmp(name, "redirection-other-site")) + if (!_cups_strcasecmp(name, "redirection-other-site")) return (IPP_REDIRECTION_OTHER_SITE); - if (!strcasecmp(name, "cups-see-other")) + if (!_cups_strcasecmp(name, "cups-see-other")) return (CUPS_SEE_OTHER); for (i = 0; i < (sizeof(ipp_status_400s) / sizeof(ipp_status_400s[0])); i ++) - if (!strcasecmp(name, ipp_status_400s[i])) + if (!_cups_strcasecmp(name, ipp_status_400s[i])) return ((ipp_status_t)(i + 0x400)); for (i = 0; i < (sizeof(ipp_status_500s) / sizeof(ipp_status_500s[0])); i ++) - if (!strcasecmp(name, ipp_status_500s[i])) + if (!_cups_strcasecmp(name, ipp_status_500s[i])) return ((ipp_status_t)(i + 0x500)); for (i = 0; i < (sizeof(ipp_status_1000s) / sizeof(ipp_status_1000s[0])); i ++) - if (!strcasecmp(name, ipp_status_1000s[i])) + if (!_cups_strcasecmp(name, ipp_status_1000s[i])) return ((ipp_status_t)(i + 0x1000)); return ((ipp_status_t)-1); @@ -639,24 +639,24 @@ ippOpValue(const char *name) /* I - Textual name */ for (i = 0; i < (sizeof(ipp_std_ops) / sizeof(ipp_std_ops[0])); i ++) - if (!strcasecmp(name, ipp_std_ops[i])) + if (!_cups_strcasecmp(name, ipp_std_ops[i])) return ((ipp_op_t)i); - if (!strcasecmp(name, "windows-ext")) + if (!_cups_strcasecmp(name, "windows-ext")) return (IPP_PRIVATE); for (i = 0; i < (sizeof(ipp_cups_ops) / sizeof(ipp_cups_ops[0])); i ++) - if (!strcasecmp(name, ipp_cups_ops[i])) + if (!_cups_strcasecmp(name, ipp_cups_ops[i])) return ((ipp_op_t)(i + 0x4001)); for (i = 0; i < (sizeof(ipp_cups_ops2) / sizeof(ipp_cups_ops2[0])); i ++) - if (!strcasecmp(name, ipp_cups_ops2[i])) + if (!_cups_strcasecmp(name, ipp_cups_ops2[i])) return ((ipp_op_t)(i + 0x4027)); - if (!strcasecmp(name, "CUPS-Add-Class")) + if (!_cups_strcasecmp(name, "CUPS-Add-Class")) return (CUPS_ADD_MODIFY_CLASS); - if (!strcasecmp(name, "CUPS-Add-Printer")) + if (!_cups_strcasecmp(name, "CUPS-Add-Printer")) return (CUPS_ADD_MODIFY_PRINTER); return ((ipp_op_t)-1); @@ -732,30 +732,30 @@ ippTagValue(const char *name) /* I - Tag name */ for (i = 0; i < (sizeof(ipp_tag_names) / sizeof(ipp_tag_names[0])); i ++) - if (!strcasecmp(name, ipp_tag_names[i])) + if (!_cups_strcasecmp(name, ipp_tag_names[i])) return ((ipp_tag_t)i); - if (!strcasecmp(name, "operation")) + if (!_cups_strcasecmp(name, "operation")) return (IPP_TAG_OPERATION); - else if (!strcasecmp(name, "job")) + else if (!_cups_strcasecmp(name, "job")) return (IPP_TAG_JOB); - else if (!strcasecmp(name, "printer")) + else if (!_cups_strcasecmp(name, "printer")) return (IPP_TAG_PRINTER); - else if (!strcasecmp(name, "unsupported")) + else if (!_cups_strcasecmp(name, "unsupported")) return (IPP_TAG_UNSUPPORTED_GROUP); - else if (!strcasecmp(name, "subscription")) + else if (!_cups_strcasecmp(name, "subscription")) return (IPP_TAG_SUBSCRIPTION); - else if (!strcasecmp(name, "event")) + else if (!_cups_strcasecmp(name, "event")) return (IPP_TAG_EVENT_NOTIFICATION); - else if (!strcasecmp(name, "language")) + else if (!_cups_strcasecmp(name, "language")) return (IPP_TAG_LANGUAGE); - else if (!strcasecmp(name, "mimetype")) + else if (!_cups_strcasecmp(name, "mimetype")) return (IPP_TAG_MIMETYPE); - else if (!strcasecmp(name, "name")) + else if (!_cups_strcasecmp(name, "name")) return (IPP_TAG_NAME); - else if (!strcasecmp(name, "text")) + else if (!_cups_strcasecmp(name, "text")) return (IPP_TAG_TEXT); - else if (!strcasecmp(name, "begCollection")) + else if (!_cups_strcasecmp(name, "begCollection")) return (IPP_TAG_BEGIN_COLLECTION); else return (IPP_TAG_ZERO); diff --git a/cups/ipp.c b/cups/ipp.c index 8f4360599..a04fb30a5 100644 --- a/cups/ipp.c +++ b/cups/ipp.c @@ -3,7 +3,7 @@ * * Internet Printing Protocol functions for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -423,7 +423,7 @@ ippAddString(ipp_t *ipp, /* I - IPP message */ * Force value to be English for the POSIX locale... */ - if (type == IPP_TAG_LANGUAGE && !strcasecmp(value, "C")) + if (type == IPP_TAG_LANGUAGE && !_cups_strcasecmp(value, "C")) value = "en"; /* @@ -513,7 +513,7 @@ ippAddStrings( { if ((int)type & IPP_TAG_COPY) value->string.text = (char *)values[i]; - else if (type == IPP_TAG_LANGUAGE && !strcasecmp(values[i], "C")) + else if (type == IPP_TAG_LANGUAGE && !_cups_strcasecmp(values[i], "C")) { /* * Force language to be English for the POSIX locale... @@ -930,7 +930,7 @@ ippFindNextAttribute(ipp_t *ipp, /* I - IPP message */ value_tag = (ipp_tag_t)(attr->value_tag & IPP_TAG_MASK); - if (attr->name != NULL && strcasecmp(attr->name, name) == 0 && + if (attr->name != NULL && _cups_strcasecmp(attr->name, name) == 0 && (value_tag == type || type == IPP_TAG_ZERO || (value_tag == IPP_TAG_TEXTLANG && type == IPP_TAG_TEXT) || (value_tag == IPP_TAG_NAMELANG && type == IPP_TAG_NAME))) diff --git a/cups/language.c b/cups/language.c index 65840cc04..46808ed92 100644 --- a/cups/language.c +++ b/cups/language.c @@ -668,7 +668,7 @@ cupsLangGet(const char *language) /* I - Language or locale */ for (i = 0; i < (int)(sizeof(locale_encodings) / sizeof(locale_encodings[0])); i ++) - if (!strcasecmp(charset, locale_encodings[i])) + if (!_cups_strcasecmp(charset, locale_encodings[i])) { encoding = (cups_encoding_t)i; break; @@ -680,14 +680,14 @@ cupsLangGet(const char *language) /* I - Language or locale */ * Map alternate names for various character sets... */ - if (!strcasecmp(charset, "iso-2022-jp") || - !strcasecmp(charset, "sjis")) + if (!_cups_strcasecmp(charset, "iso-2022-jp") || + !_cups_strcasecmp(charset, "sjis")) encoding = CUPS_WINDOWS_932; - else if (!strcasecmp(charset, "iso-2022-cn")) + else if (!_cups_strcasecmp(charset, "iso-2022-cn")) encoding = CUPS_WINDOWS_936; - else if (!strcasecmp(charset, "iso-2022-kr")) + else if (!_cups_strcasecmp(charset, "iso-2022-kr")) encoding = CUPS_WINDOWS_949; - else if (!strcasecmp(charset, "big5")) + else if (!_cups_strcasecmp(charset, "big5")) encoding = CUPS_WINDOWS_950; } } diff --git a/cups/localize.c b/cups/localize.c index 52518339a..74c4c3c01 100644 --- a/cups/localize.c +++ b/cups/localize.c @@ -3,7 +3,7 @@ * * PPD localization routines for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the diff --git a/cups/mark.c b/cups/mark.c index 763b5310d..113220071 100644 --- a/cups/mark.c +++ b/cups/mark.c @@ -156,7 +156,7 @@ cupsMarkOptions( if (!page_size || !page_size[0]) { - if (!strncasecmp(s, "Custom.", 7) || ppdPageSize(ppd, s)) + if (!_cups_strncasecmp(s, "Custom.", 7) || ppdPageSize(ppd, s)) ppd_mark_option(ppd, "PageSize", s); else if ((ppd_keyword = _ppdCacheGetPageSize(cache, NULL, s, NULL)) != NULL) ppd_mark_option(ppd, "PageSize", ppd_keyword); @@ -241,7 +241,7 @@ cupsMarkOptions( } if (output_bin && !cupsGetOption("OutputBin", num_options, options) && - (ppd_keyword = _ppdCacheGetOutputBin(cache, output_bin)) != NULL) + (ppd_keyword = _ppdCacheGetOutputBin(cache, output_bin)) != NULL) { /* * Map output-bin to OutputBin... @@ -271,14 +271,14 @@ cupsMarkOptions( */ for (i = num_options, optptr = options; i > 0; i --, optptr ++) - if (!strcasecmp(optptr->name, "media") || - !strcasecmp(optptr->name, "output-bin") || - !strcasecmp(optptr->name, "output-mode") || - !strcasecmp(optptr->name, "print-quality") || - !strcasecmp(optptr->name, "sides")) + if (!_cups_strcasecmp(optptr->name, "media") || + !_cups_strcasecmp(optptr->name, "output-bin") || + !_cups_strcasecmp(optptr->name, "output-mode") || + !_cups_strcasecmp(optptr->name, "print-quality") || + !_cups_strcasecmp(optptr->name, "sides")) continue; - else if (!strcasecmp(optptr->name, "resolution") || - !strcasecmp(optptr->name, "printer-resolution")) + else if (!_cups_strcasecmp(optptr->name, "resolution") || + !_cups_strcasecmp(optptr->name, "printer-resolution")) { ppd_mark_option(ppd, "Resolution", optptr->value); ppd_mark_option(ppd, "SetResolution", optptr->value); @@ -288,18 +288,18 @@ cupsMarkOptions( ppd_mark_option(ppd, "CNRes_PGP", optptr->value); /* Canon */ } - else if (!strcasecmp(optptr->name, "multiple-document-handling")) + else if (!_cups_strcasecmp(optptr->name, "multiple-document-handling")) { if (!cupsGetOption("Collate", num_options, options) && ppdFindOption(ppd, "Collate")) { - if (strcasecmp(optptr->value, "separate-documents-uncollated-copies")) + if (_cups_strcasecmp(optptr->value, "separate-documents-uncollated-copies")) ppd_mark_option(ppd, "Collate", "True"); else ppd_mark_option(ppd, "Collate", "False"); } } - else if (!strcasecmp(optptr->name, "finishings")) + else if (!_cups_strcasecmp(optptr->name, "finishings")) { /* * Lookup cupsIPPFinishings attributes for each value... @@ -340,7 +340,7 @@ cupsMarkOptions( ppd_mark_choices(ppd, attr->value); } } - else if (!strcasecmp(optptr->name, "APPrinterPreset")) + else if (!_cups_strcasecmp(optptr->name, "APPrinterPreset")) { /* * Lookup APPrinterPreset value... @@ -355,7 +355,7 @@ cupsMarkOptions( ppd_mark_choices(ppd, attr->value); } } - else if (!strcasecmp(optptr->name, "mirror")) + else if (!_cups_strcasecmp(optptr->name, "mirror")) ppd_mark_option(ppd, "MirrorPrint", optptr->value); else ppd_mark_option(ppd, optptr->name, optptr->value); @@ -381,11 +381,11 @@ ppdFindChoice(ppd_option_t *o, /* I - Pointer to option */ if (!o || !choice) return (NULL); - if (choice[0] == '{' || !strncasecmp(choice, "Custom.", 7)) + if (choice[0] == '{' || !_cups_strncasecmp(choice, "Custom.", 7)) choice = "Custom"; for (i = o->num_choices, c = o->choices; i > 0; i --, c ++) - if (!strcasecmp(c->choice, choice)) + if (!_cups_strcasecmp(c->choice, choice)) return (c); return (NULL); @@ -464,7 +464,7 @@ ppdFindOption(ppd_file_t *ppd, /* I - PPD file data */ for (j = group->num_options, optptr = group->options; j > 0; j --, optptr ++) - if (!strcasecmp(optptr->keyword, option)) + if (!_cups_strcasecmp(optptr->keyword, option)) return (optptr); return (NULL); @@ -726,7 +726,7 @@ ppd_defaults(ppd_file_t *ppd, /* I - PPD file */ for (i = g->num_options, o = g->options; i > 0; i --, o ++) - if (strcasecmp(o->keyword, "PageRegion") != 0) + if (_cups_strcasecmp(o->keyword, "PageRegion") != 0) ppdMarkOption(ppd, o->keyword, o->defchoice); for (i = g->num_subgroups, sg = g->subgroups; i > 0; i --, sg ++) @@ -786,7 +786,7 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */ * it clears the regular InputSlot choices... */ - if (!strcasecmp(option, "AP_D_InputSlot")) + if (!_cups_strcasecmp(option, "AP_D_InputSlot")) { cupsArraySave(ppd->options); @@ -818,7 +818,7 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */ loc = localeconv(); - if (!strncasecmp(choice, "Custom.", 7)) + if (!_cups_strncasecmp(choice, "Custom.", 7)) { /* * Handle a custom option... @@ -827,7 +827,7 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */ if ((c = ppdFindChoice(o, "Custom")) == NULL) return; - if (!strcasecmp(option, "PageSize")) + if (!_cups_strcasecmp(option, "PageSize")) { /* * Handle custom page sizes... @@ -867,15 +867,15 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */ if (units) { - if (!strcasecmp(units, "cm")) + if (!_cups_strcasecmp(units, "cm")) cparam->current.custom_points *= 72.0f / 2.54f; - else if (!strcasecmp(units, "mm")) + else if (!_cups_strcasecmp(units, "mm")) cparam->current.custom_points *= 72.0f / 25.4f; - else if (!strcasecmp(units, "m")) + else if (!_cups_strcasecmp(units, "m")) cparam->current.custom_points *= 72.0f / 0.0254f; - else if (!strcasecmp(units, "in")) + else if (!_cups_strcasecmp(units, "in")) cparam->current.custom_points *= 72.0f; - else if (!strcasecmp(units, "ft")) + else if (!_cups_strcasecmp(units, "ft")) cparam->current.custom_points *= 12.0f * 72.0f; } break; @@ -944,15 +944,15 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */ if (units) { - if (!strcasecmp(units, "cm")) + if (!_cups_strcasecmp(units, "cm")) cparam->current.custom_points *= 72.0f / 2.54f; - else if (!strcasecmp(units, "mm")) + else if (!_cups_strcasecmp(units, "mm")) cparam->current.custom_points *= 72.0f / 25.4f; - else if (!strcasecmp(units, "m")) + else if (!_cups_strcasecmp(units, "m")) cparam->current.custom_points *= 72.0f / 0.0254f; - else if (!strcasecmp(units, "in")) + else if (!_cups_strcasecmp(units, "in")) cparam->current.custom_points *= 72.0f; - else if (!strcasecmp(units, "ft")) + else if (!_cups_strcasecmp(units, "ft")) cparam->current.custom_points *= 12.0f * 72.0f; } break; @@ -978,7 +978,7 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */ else { for (i = o->num_choices, c = o->choices; i > 0; i --, c ++) - if (!strcasecmp(c->choice, choice)) + if (!_cups_strcasecmp(c->choice, choice)) break; if (!i) @@ -1001,14 +1001,14 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */ cupsArrayRemove(ppd->marked, oldc); } - if (!strcasecmp(option, "PageSize") || !strcasecmp(option, "PageRegion")) + if (!_cups_strcasecmp(option, "PageSize") || !_cups_strcasecmp(option, "PageRegion")) { /* * Mark current page size... */ for (j = 0; j < ppd->num_sizes; j ++) - ppd->sizes[j].marked = !strcasecmp(ppd->sizes[j].name, + ppd->sizes[j].marked = !_cups_strcasecmp(ppd->sizes[j].name, choice); /* @@ -1018,7 +1018,7 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */ cupsArraySave(ppd->options); - if (!strcasecmp(option, "PageSize")) + if (!_cups_strcasecmp(option, "PageSize")) { if ((o = ppdFindOption(ppd, "PageRegion")) != NULL) { @@ -1045,7 +1045,7 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */ cupsArrayRestore(ppd->options); } - else if (!strcasecmp(option, "InputSlot")) + else if (!_cups_strcasecmp(option, "InputSlot")) { /* * Unmark ManualFeed option... @@ -1065,8 +1065,8 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */ cupsArrayRestore(ppd->options); } - else if (!strcasecmp(option, "ManualFeed") && - !strcasecmp(choice, "True")) + else if (!_cups_strcasecmp(option, "ManualFeed") && + !_cups_strcasecmp(choice, "True")) { /* * Unmark InputSlot option... diff --git a/cups/options.c b/cups/options.c index 01845c75f..e2b0c397d 100644 --- a/cups/options.c +++ b/cups/options.c @@ -3,7 +3,7 @@ * * Option routines for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -62,7 +62,7 @@ cupsAddOption(const char *name, /* I - Name of option */ DEBUG_printf(("2cupsAddOption(name=\"%s\", value=\"%s\", num_options=%d, " "options=%p)", name, value, num_options, options)); - + if (!name || !name[0] || !value || !options || num_options < 0) { DEBUG_printf(("3cupsAddOption: Returning %d", num_options)); @@ -323,7 +323,7 @@ cupsParseOptions( * Boolean option... */ - if (!strncasecmp(name, "no", 2)) + if (!_cups_strncasecmp(name, "no", 2)) num_options = cupsAddOption(name + 2, "false", num_options, options); else @@ -469,7 +469,7 @@ cupsRemoveOption( */ for (i = num_options, option = *options; i > 0; i --, option ++) - if (!strcasecmp(name, option->name)) + if (!_cups_strcasecmp(name, option->name)) break; if (i) @@ -590,7 +590,7 @@ static int /* O - Result of comparison */ cups_compare_options(cups_option_t *a, /* I - First option */ cups_option_t *b) /* I - Second option */ { - return (strcasecmp(a->name, b->name)); + return (_cups_strcasecmp(a->name, b->name)); } diff --git a/cups/page.c b/cups/page.c index e82146616..8e79889ab 100644 --- a/cups/page.c +++ b/cups/page.c @@ -3,7 +3,7 @@ * * Page size functions for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -96,27 +96,27 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */ if (!nameptr) return (NULL); - if (!strcasecmp(nameptr, "in")) + if (!_cups_strcasecmp(nameptr, "in")) { w *= 72.0; l *= 72.0; } - else if (!strcasecmp(nameptr, "ft")) + else if (!_cups_strcasecmp(nameptr, "ft")) { w *= 12.0 * 72.0; l *= 12.0 * 72.0; } - else if (!strcasecmp(nameptr, "mm")) + else if (!_cups_strcasecmp(nameptr, "mm")) { w *= 72.0 / 25.4; l *= 72.0 / 25.4; } - else if (!strcasecmp(nameptr, "cm")) + else if (!_cups_strcasecmp(nameptr, "cm")) { w *= 72.0 / 2.54; l *= 72.0 / 2.54; } - else if (!strcasecmp(nameptr, "m")) + else if (!_cups_strcasecmp(nameptr, "m")) { w *= 72.0 / 0.0254; l *= 72.0 / 0.0254; @@ -158,7 +158,7 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */ */ for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++) - if (!strcasecmp(name, size->name)) + if (!_cups_strcasecmp(name, size->name)) { DEBUG_printf(("3ppdPageSize: Returning %p (\"%s\", %gx%g)", size, size->name, size->width, size->length)); diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c index 90b83b758..b19610981 100644 --- a/cups/ppd-cache.c +++ b/cups/ppd-cache.c @@ -189,7 +189,7 @@ _ppdCacheCreateWithFile( _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1); goto create_error; } - else if (!strcasecmp(line, "Filter")) + else if (!_cups_strcasecmp(line, "Filter")) { if (!pc->filters) pc->filters = cupsArrayNew3(NULL, NULL, NULL, 0, @@ -198,7 +198,7 @@ _ppdCacheCreateWithFile( cupsArrayAdd(pc->filters, value); } - else if (!strcasecmp(line, "PreFilter")) + else if (!_cups_strcasecmp(line, "PreFilter")) { if (!pc->prefilters) pc->prefilters = cupsArrayNew3(NULL, NULL, NULL, 0, @@ -207,15 +207,15 @@ _ppdCacheCreateWithFile( cupsArrayAdd(pc->prefilters, value); } - else if (!strcasecmp(line, "Product")) + else if (!_cups_strcasecmp(line, "Product")) { pc->product = _cupsStrAlloc(value); } - else if (!strcasecmp(line, "SingleFile")) + else if (!_cups_strcasecmp(line, "SingleFile")) { - pc->single_file = !strcasecmp(value, "true"); + pc->single_file = !_cups_strcasecmp(value, "true"); } - else if (!strcasecmp(line, "IPP")) + else if (!_cups_strcasecmp(line, "IPP")) { off_t pos = cupsFileTell(fp), /* Position in file */ length = strtol(value, NULL, 10); @@ -266,7 +266,7 @@ _ppdCacheCreateWithFile( goto create_error; } } - else if (!strcasecmp(line, "NumBins")) + else if (!_cups_strcasecmp(line, "NumBins")) { if (num_bins > 0) { @@ -291,7 +291,7 @@ _ppdCacheCreateWithFile( goto create_error; } } - else if (!strcasecmp(line, "Bin")) + else if (!_cups_strcasecmp(line, "Bin")) { if (sscanf(value, "%127s%40s", pwg_keyword, ppd_keyword) != 2) { @@ -314,7 +314,7 @@ _ppdCacheCreateWithFile( pc->num_bins ++; } - else if (!strcasecmp(line, "NumSizes")) + else if (!_cups_strcasecmp(line, "NumSizes")) { if (num_sizes > 0) { @@ -339,7 +339,7 @@ _ppdCacheCreateWithFile( goto create_error; } } - else if (!strcasecmp(line, "Size")) + else if (!_cups_strcasecmp(line, "Size")) { if (pc->num_sizes >= num_sizes) { @@ -366,7 +366,7 @@ _ppdCacheCreateWithFile( pc->num_sizes ++; } - else if (!strcasecmp(line, "CustomSize")) + else if (!_cups_strcasecmp(line, "CustomSize")) { if (pc->custom_max_width > 0) { @@ -396,11 +396,11 @@ _ppdCacheCreateWithFile( pc->custom_min_width, pc->custom_min_length); pc->custom_min_keyword = _cupsStrAlloc(pwg_keyword); } - else if (!strcasecmp(line, "SourceOption")) + else if (!_cups_strcasecmp(line, "SourceOption")) { pc->source_option = _cupsStrAlloc(value); } - else if (!strcasecmp(line, "NumSources")) + else if (!_cups_strcasecmp(line, "NumSources")) { if (num_sources > 0) { @@ -426,7 +426,7 @@ _ppdCacheCreateWithFile( goto create_error; } } - else if (!strcasecmp(line, "Source")) + else if (!_cups_strcasecmp(line, "Source")) { if (sscanf(value, "%127s%40s", pwg_keyword, ppd_keyword) != 2) { @@ -450,7 +450,7 @@ _ppdCacheCreateWithFile( pc->num_sources ++; } - else if (!strcasecmp(line, "NumTypes")) + else if (!_cups_strcasecmp(line, "NumTypes")) { if (num_types > 0) { @@ -475,7 +475,7 @@ _ppdCacheCreateWithFile( goto create_error; } } - else if (!strcasecmp(line, "Type")) + else if (!_cups_strcasecmp(line, "Type")) { if (sscanf(value, "%127s%40s", pwg_keyword, ppd_keyword) != 2) { @@ -499,7 +499,7 @@ _ppdCacheCreateWithFile( pc->num_types ++; } - else if (!strcasecmp(line, "Preset")) + else if (!_cups_strcasecmp(line, "Preset")) { /* * Preset output-mode print-quality name=value ... @@ -524,13 +524,13 @@ _ppdCacheCreateWithFile( cupsParseOptions(valueptr, 0, pc->presets[print_color_mode] + print_quality); } - else if (!strcasecmp(line, "SidesOption")) + else if (!_cups_strcasecmp(line, "SidesOption")) pc->sides_option = _cupsStrAlloc(value); - else if (!strcasecmp(line, "Sides1Sided")) + else if (!_cups_strcasecmp(line, "Sides1Sided")) pc->sides_1sided = _cupsStrAlloc(value); - else if (!strcasecmp(line, "Sides2SidedLong")) + else if (!_cups_strcasecmp(line, "Sides2SidedLong")) pc->sides_2sided_long = _cupsStrAlloc(value); - else if (!strcasecmp(line, "Sides2SidedShort")) + else if (!_cups_strcasecmp(line, "Sides2SidedShort")) pc->sides_2sided_short = _cupsStrAlloc(value); else { @@ -679,7 +679,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */ * Don't copy over custom size... */ - if (!strcasecmp(ppd_size->name, "Custom")) + if (!_cups_strcasecmp(ppd_size->name, "Custom")) continue; /* @@ -850,33 +850,33 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */ i > 0; i --, choice ++, map ++) { - if (!strncasecmp(choice->choice, "Auto", 4) || - !strcasecmp(choice->choice, "Default")) + if (!_cups_strncasecmp(choice->choice, "Auto", 4) || + !_cups_strcasecmp(choice->choice, "Default")) pwg_name = "auto"; - else if (!strcasecmp(choice->choice, "Cassette")) + else if (!_cups_strcasecmp(choice->choice, "Cassette")) pwg_name = "main"; - else if (!strcasecmp(choice->choice, "PhotoTray")) + else if (!_cups_strcasecmp(choice->choice, "PhotoTray")) pwg_name = "photo"; - else if (!strcasecmp(choice->choice, "CDTray")) + else if (!_cups_strcasecmp(choice->choice, "CDTray")) pwg_name = "disc"; - else if (!strncasecmp(choice->choice, "Multipurpose", 12) || - !strcasecmp(choice->choice, "MP") || - !strcasecmp(choice->choice, "MPTray")) + else if (!_cups_strncasecmp(choice->choice, "Multipurpose", 12) || + !_cups_strcasecmp(choice->choice, "MP") || + !_cups_strcasecmp(choice->choice, "MPTray")) pwg_name = "alternate"; - else if (!strcasecmp(choice->choice, "LargeCapacity")) + else if (!_cups_strcasecmp(choice->choice, "LargeCapacity")) pwg_name = "large-capacity"; - else if (!strncasecmp(choice->choice, "Lower", 5)) + else if (!_cups_strncasecmp(choice->choice, "Lower", 5)) pwg_name = "bottom"; - else if (!strncasecmp(choice->choice, "Middle", 6)) + else if (!_cups_strncasecmp(choice->choice, "Middle", 6)) pwg_name = "middle"; - else if (!strncasecmp(choice->choice, "Upper", 5)) + else if (!_cups_strncasecmp(choice->choice, "Upper", 5)) pwg_name = "top"; - else if (!strncasecmp(choice->choice, "Side", 4)) + else if (!_cups_strncasecmp(choice->choice, "Side", 4)) pwg_name = "side"; - else if (!strcasecmp(choice->choice, "Roll") || - !strcasecmp(choice->choice, "Roll1")) + else if (!_cups_strcasecmp(choice->choice, "Roll") || + !_cups_strcasecmp(choice->choice, "Roll1")) pwg_name = "main-roll"; - else if (!strcasecmp(choice->choice, "Roll2")) + else if (!_cups_strcasecmp(choice->choice, "Roll2")) pwg_name = "alternate-roll"; else { @@ -914,31 +914,31 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */ i > 0; i --, choice ++, map ++) { - if (!strncasecmp(choice->choice, "Auto", 4) || - !strcasecmp(choice->choice, "Any") || - !strcasecmp(choice->choice, "Default")) + if (!_cups_strncasecmp(choice->choice, "Auto", 4) || + !_cups_strcasecmp(choice->choice, "Any") || + !_cups_strcasecmp(choice->choice, "Default")) pwg_name = "auto"; - else if (!strncasecmp(choice->choice, "Card", 4)) + else if (!_cups_strncasecmp(choice->choice, "Card", 4)) pwg_name = "cardstock"; - else if (!strncasecmp(choice->choice, "Env", 3)) + else if (!_cups_strncasecmp(choice->choice, "Env", 3)) pwg_name = "envelope"; - else if (!strncasecmp(choice->choice, "Gloss", 5)) + else if (!_cups_strncasecmp(choice->choice, "Gloss", 5)) pwg_name = "photographic-glossy"; - else if (!strcasecmp(choice->choice, "HighGloss")) + else if (!_cups_strcasecmp(choice->choice, "HighGloss")) pwg_name = "photographic-high-gloss"; - else if (!strcasecmp(choice->choice, "Matte")) + else if (!_cups_strcasecmp(choice->choice, "Matte")) pwg_name = "photographic-matte"; - else if (!strncasecmp(choice->choice, "Plain", 5)) + else if (!_cups_strncasecmp(choice->choice, "Plain", 5)) pwg_name = "stationery"; - else if (!strncasecmp(choice->choice, "Coated", 6)) + else if (!_cups_strncasecmp(choice->choice, "Coated", 6)) pwg_name = "stationery-coated"; - else if (!strcasecmp(choice->choice, "Inkjet")) + else if (!_cups_strcasecmp(choice->choice, "Inkjet")) pwg_name = "stationery-inkjet"; - else if (!strcasecmp(choice->choice, "Letterhead")) + else if (!_cups_strcasecmp(choice->choice, "Letterhead")) pwg_name = "stationery-letterhead"; - else if (!strncasecmp(choice->choice, "Preprint", 8)) + else if (!_cups_strncasecmp(choice->choice, "Preprint", 8)) pwg_name = "stationery-preprinted"; - else if (!strncasecmp(choice->choice, "Transparen", 10)) + else if (!_cups_strncasecmp(choice->choice, "Transparen", 10)) pwg_name = "transparency"; else { @@ -1057,7 +1057,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */ } else if (color_model_val) { - if (!strcasecmp(color_model_val, "Gray")) + if (!_cups_strcasecmp(color_model_val, "Gray")) pwg_print_color_mode = _PWG_PRINT_COLOR_MODE_MONOCHROME; else pwg_print_color_mode = _PWG_PRINT_COLOR_MODE_COLOR; @@ -1200,16 +1200,16 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */ i > 0; i --, choice ++) { - if ((!strcasecmp(choice->choice, "None") || - !strcasecmp(choice->choice, "False")) && !pc->sides_1sided) + if ((!_cups_strcasecmp(choice->choice, "None") || + !_cups_strcasecmp(choice->choice, "False")) && !pc->sides_1sided) pc->sides_1sided = _cupsStrAlloc(choice->choice); - else if ((!strcasecmp(choice->choice, "DuplexNoTumble") || - !strcasecmp(choice->choice, "LongEdge") || - !strcasecmp(choice->choice, "Top")) && !pc->sides_2sided_long) + else if ((!_cups_strcasecmp(choice->choice, "DuplexNoTumble") || + !_cups_strcasecmp(choice->choice, "LongEdge") || + !_cups_strcasecmp(choice->choice, "Top")) && !pc->sides_2sided_long) pc->sides_2sided_long = _cupsStrAlloc(choice->choice); - else if ((!strcasecmp(choice->choice, "DuplexTumble") || - !strcasecmp(choice->choice, "ShortEdge") || - !strcasecmp(choice->choice, "Bottom")) && + else if ((!_cups_strcasecmp(choice->choice, "DuplexTumble") || + !_cups_strcasecmp(choice->choice, "ShortEdge") || + !_cups_strcasecmp(choice->choice, "Bottom")) && !pc->sides_2sided_short) pc->sides_2sided_short = _cupsStrAlloc(choice->choice); } @@ -1249,13 +1249,13 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */ for (filter = (const char *)cupsArrayFirst(pc->filters); filter; filter = (const char *)cupsArrayNext(pc->filters)) - if (!strncasecmp(filter, "application/vnd.cups-command", 28) && + if (!_cups_strncasecmp(filter, "application/vnd.cups-command", 28) && _cups_isspace(filter[28])) break; if (!filter && ((ppd_attr = ppdFindAttr(ppd, "cupsCommands", NULL)) == NULL || - strcasecmp(ppd_attr->value, "none"))) + _cups_strcasecmp(ppd_attr->value, "none"))) { /* * No command filter and no cupsCommands keyword telling us not to use one. @@ -1266,7 +1266,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */ for (filter = (const char *)cupsArrayFirst(pc->filters); filter; filter = (const char *)cupsArrayNext(pc->filters)) - if (!strncasecmp(filter, "application/vnd.cups-postscript", 31) && + if (!_cups_strncasecmp(filter, "application/vnd.cups-postscript", 31) && _cups_isspace(filter[31])) break; @@ -1289,7 +1289,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */ } if ((ppd_attr = ppdFindAttr(ppd, "cupsSingleFile", NULL)) != NULL) - pc->single_file = !strcasecmp(ppd_attr->value, "true"); + pc->single_file = !_cups_strcasecmp(ppd_attr->value, "true"); /* * Copy the product string, if any... @@ -1427,7 +1427,7 @@ _ppdCacheGetBin( for (i = 0; i < pc->num_bins; i ++) - if (!strcasecmp(output_bin, pc->bins[i].ppd)) + if (!_cups_strcasecmp(output_bin, pc->bins[i].ppd)) return (pc->bins[i].pwg); return (NULL); @@ -1491,7 +1491,7 @@ _ppdCacheGetInputSlot( int i; /* Looping var */ for (i = 0; i < pc->num_sources; i ++) - if (!strcasecmp(keyword, pc->sources[i].pwg)) + if (!_cups_strcasecmp(keyword, pc->sources[i].pwg)) return (pc->sources[i].ppd); } @@ -1545,7 +1545,7 @@ _ppdCacheGetMediaType( int i; /* Looping var */ for (i = 0; i < pc->num_types; i ++) - if (!strcasecmp(keyword, pc->types[i].pwg)) + if (!_cups_strcasecmp(keyword, pc->types[i].pwg)) return (pc->types[i].ppd); } @@ -1579,7 +1579,7 @@ _ppdCacheGetOutputBin( for (i = 0; i < pc->num_bins; i ++) - if (!strcasecmp(output_bin, pc->bins[i].pwg)) + if (!_cups_strcasecmp(output_bin, pc->bins[i].pwg)) return (pc->bins[i].ppd); return (NULL); @@ -1667,8 +1667,8 @@ _ppdCacheGetPageSize( DEBUG_printf(("2_ppdCacheGetPageSize: size[%d]=[\"%s\" \"%s\"]", (int)(size - pc->sizes), size->map.pwg, size->map.ppd)); - if (!strcasecmp(ppd_name, size->map.ppd) || - !strcasecmp(ppd_name, size->map.pwg)) + if (!_cups_strcasecmp(ppd_name, size->map.ppd) || + !_cups_strcasecmp(ppd_name, size->map.pwg)) { if (exact) *exact = 1; @@ -1717,8 +1717,8 @@ _ppdCacheGetPageSize( closest = NULL; dclosest = 999999999; - if (!ppd_name || strncasecmp(ppd_name, "Custom.", 7) || - strncasecmp(ppd_name, "custom_", 7)) + if (!ppd_name || _cups_strncasecmp(ppd_name, "Custom.", 7) || + _cups_strncasecmp(ppd_name, "custom_", 7)) { for (i = pc->num_sizes, size = pc->sizes; i > 0; i --, size ++) { @@ -1846,7 +1846,7 @@ _ppdCacheGetSize( if (!pc || !page_size) return (NULL); - if (!strncasecmp(page_size, "Custom.", 7)) + if (!_cups_strncasecmp(page_size, "Custom.", 7)) { /* * Custom size; size name can be one of the following: @@ -1872,27 +1872,27 @@ _ppdCacheGetSize( if (!ptr) return (NULL); - if (!strcasecmp(ptr, "in")) + if (!_cups_strcasecmp(ptr, "in")) { w *= 2540.0; l *= 2540.0; } - else if (!strcasecmp(ptr, "ft")) + else if (!_cups_strcasecmp(ptr, "ft")) { w *= 12.0 * 2540.0; l *= 12.0 * 2540.0; } - else if (!strcasecmp(ptr, "mm")) + else if (!_cups_strcasecmp(ptr, "mm")) { w *= 100.0; l *= 100.0; } - else if (!strcasecmp(ptr, "cm")) + else if (!_cups_strcasecmp(ptr, "cm")) { w *= 1000.0; l *= 1000.0; } - else if (!strcasecmp(ptr, "m")) + else if (!_cups_strcasecmp(ptr, "m")) { w *= 100000.0; l *= 100000.0; @@ -1914,7 +1914,7 @@ _ppdCacheGetSize( */ for (i = pc->num_sizes, size = pc->sizes; i > 0; i --, size ++) - if (!strcasecmp(page_size, size->map.ppd)) + if (!_cups_strcasecmp(page_size, size->map.ppd)) return (size); return (NULL); @@ -1943,7 +1943,7 @@ _ppdCacheGetSource( return (NULL); for (i = pc->num_sources, source = pc->sources; i > 0; i --, source ++) - if (!strcasecmp(input_slot, source->ppd)) + if (!_cups_strcasecmp(input_slot, source->ppd)) return (source->pwg); return (NULL); @@ -1972,7 +1972,7 @@ _ppdCacheGetType( return (NULL); for (i = pc->num_types, type = pc->types; i > 0; i --, type ++) - if (!strcasecmp(media_type, type->ppd)) + if (!_cups_strcasecmp(media_type, type->ppd)) return (type->pwg); return (NULL); @@ -2173,27 +2173,27 @@ _pwgInputSlotForSource( if (!media_source || !name || namesize < PPD_MAX_NAME) return (NULL); - if (strcasecmp(media_source, "main")) + if (_cups_strcasecmp(media_source, "main")) strlcpy(name, "Cassette", namesize); - else if (strcasecmp(media_source, "alternate")) + else if (_cups_strcasecmp(media_source, "alternate")) strlcpy(name, "Multipurpose", namesize); - else if (strcasecmp(media_source, "large-capacity")) + else if (_cups_strcasecmp(media_source, "large-capacity")) strlcpy(name, "LargeCapacity", namesize); - else if (strcasecmp(media_source, "bottom")) + else if (_cups_strcasecmp(media_source, "bottom")) strlcpy(name, "Lower", namesize); - else if (strcasecmp(media_source, "middle")) + else if (_cups_strcasecmp(media_source, "middle")) strlcpy(name, "Middle", namesize); - else if (strcasecmp(media_source, "top")) + else if (_cups_strcasecmp(media_source, "top")) strlcpy(name, "Upper", namesize); - else if (strcasecmp(media_source, "rear")) + else if (_cups_strcasecmp(media_source, "rear")) strlcpy(name, "Rear", namesize); - else if (strcasecmp(media_source, "side")) + else if (_cups_strcasecmp(media_source, "side")) strlcpy(name, "Side", namesize); - else if (strcasecmp(media_source, "envelope")) + else if (_cups_strcasecmp(media_source, "envelope")) strlcpy(name, "Envelope", namesize); - else if (strcasecmp(media_source, "main-roll")) + else if (_cups_strcasecmp(media_source, "main-roll")) strlcpy(name, "Roll", namesize); - else if (strcasecmp(media_source, "alternate-roll")) + else if (_cups_strcasecmp(media_source, "alternate-roll")) strlcpy(name, "Roll2", namesize); else pwg_ppdize_name(media_source, name, namesize); @@ -2220,29 +2220,29 @@ _pwgMediaTypeForType( if (!media_type || !name || namesize < PPD_MAX_NAME) return (NULL); - if (strcasecmp(media_type, "auto")) + if (_cups_strcasecmp(media_type, "auto")) strlcpy(name, "Auto", namesize); - else if (strcasecmp(media_type, "cardstock")) + else if (_cups_strcasecmp(media_type, "cardstock")) strlcpy(name, "Cardstock", namesize); - else if (strcasecmp(media_type, "envelope")) + else if (_cups_strcasecmp(media_type, "envelope")) strlcpy(name, "Envelope", namesize); - else if (strcasecmp(media_type, "photographic-glossy")) + else if (_cups_strcasecmp(media_type, "photographic-glossy")) strlcpy(name, "Glossy", namesize); - else if (strcasecmp(media_type, "photographic-high-gloss")) + else if (_cups_strcasecmp(media_type, "photographic-high-gloss")) strlcpy(name, "HighGloss", namesize); - else if (strcasecmp(media_type, "photographic-matte")) + else if (_cups_strcasecmp(media_type, "photographic-matte")) strlcpy(name, "Matte", namesize); - else if (strcasecmp(media_type, "stationery")) + else if (_cups_strcasecmp(media_type, "stationery")) strlcpy(name, "Plain", namesize); - else if (strcasecmp(media_type, "stationery-coated")) + else if (_cups_strcasecmp(media_type, "stationery-coated")) strlcpy(name, "Coated", namesize); - else if (strcasecmp(media_type, "stationery-inkjet")) + else if (_cups_strcasecmp(media_type, "stationery-inkjet")) strlcpy(name, "Inkjet", namesize); - else if (strcasecmp(media_type, "stationery-letterhead")) + else if (_cups_strcasecmp(media_type, "stationery-letterhead")) strlcpy(name, "Letterhead", namesize); - else if (strcasecmp(media_type, "stationery-preprinted")) + else if (_cups_strcasecmp(media_type, "stationery-preprinted")) strlcpy(name, "Preprinted", namesize); - else if (strcasecmp(media_type, "transparency")) + else if (_cups_strcasecmp(media_type, "transparency")) strlcpy(name, "Transparency", namesize); else pwg_ppdize_name(media_type, name, namesize); diff --git a/cups/ppd.c b/cups/ppd.c index 351043c38..53e9fbf5a 100644 --- a/cups/ppd.c +++ b/cups/ppd.c @@ -377,17 +377,17 @@ ppdErrorString(ppd_status_t status) /* I - PPD status */ cups_encoding_t /* O - CUPS encoding value */ _ppdGetEncoding(const char *name) /* I - LanguageEncoding string */ { - if (!strcasecmp(name, "ISOLatin1")) + if (!_cups_strcasecmp(name, "ISOLatin1")) return (CUPS_ISO8859_1); - else if (!strcasecmp(name, "ISOLatin2")) + else if (!_cups_strcasecmp(name, "ISOLatin2")) return (CUPS_ISO8859_2); - else if (!strcasecmp(name, "ISOLatin5")) + else if (!_cups_strcasecmp(name, "ISOLatin5")) return (CUPS_ISO8859_5); - else if (!strcasecmp(name, "JIS83-RKSJ")) + else if (!_cups_strcasecmp(name, "JIS83-RKSJ")) return (CUPS_JIS_X0213); - else if (!strcasecmp(name, "MacStandard")) + else if (!_cups_strcasecmp(name, "MacStandard")) return (CUPS_MAC_ROMAN); - else if (!strcasecmp(name, "WindowsANSI")) + else if (!_cups_strcasecmp(name, "WindowsANSI")) return (CUPS_WINDOWS_1252); else return (CUPS_UTF8); @@ -906,7 +906,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ goto error; } - + ppd->fonts = tempfonts; ppd->fonts[ppd->num_fonts] = _cupsStrAlloc(name); ppd->num_fonts ++; @@ -1049,7 +1049,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ goto error; } - if (option && !strcasecmp(option->keyword, keyword + 6)) + if (option && !_cups_strcasecmp(option->keyword, keyword + 6)) custom_option = option; else custom_option = ppdFindOption(ppd, keyword + 6); @@ -1093,7 +1093,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ ppd_add_size(ppd, "Custom"); - if (option && !strcasecmp(option->keyword, "PageRegion")) + if (option && !_cups_strcasecmp(option->keyword, "PageRegion")) custom_option = option; else custom_option = ppdFindOption(ppd, "PageRegion"); @@ -1337,7 +1337,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ * attribute... */ - if (!strcasecmp(name, "PageRegion")) + if (!_cups_strcasecmp(name, "PageRegion")) strcpy(custom_name, "CustomPageSize"); else snprintf(custom_name, sizeof(custom_name), "Custom%s", name); @@ -1717,7 +1717,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ constraint->choice1[0] = '\0'; constraint->choice2[0] = '\0'; break; - + case 3 : /* Two options, one choice... */ /* * Check for broken constraints like "* Option"... @@ -1771,7 +1771,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ constraint->choice2[0] = '\0'; } break; - + case 4 : /* Two options, two choices... */ /* * Check for broken constraints like "* Option"... @@ -2279,7 +2279,7 @@ static int /* O - Result of comparison */ ppd_compare_attrs(ppd_attr_t *a, /* I - First attribute */ ppd_attr_t *b) /* I - Second attribute */ { - return (strcasecmp(a->name, b->name)); + return (_cups_strcasecmp(a->name, b->name)); } @@ -2303,7 +2303,7 @@ static int /* O - Result of comparison */ ppd_compare_coptions(ppd_coption_t *a, /* I - First option */ ppd_coption_t *b) /* I - Second option */ { - return (strcasecmp(a->keyword, b->keyword)); + return (_cups_strcasecmp(a->keyword, b->keyword)); } @@ -2315,7 +2315,7 @@ static int /* O - Result of comparison */ ppd_compare_options(ppd_option_t *a, /* I - First option */ ppd_option_t *b) /* I - Second option */ { - return (strcasecmp(a->keyword, b->keyword)); + return (_cups_strcasecmp(a->keyword, b->keyword)); } @@ -2549,7 +2549,7 @@ ppd_get_group(ppd_file_t *ppd, /* I - PPD file */ return (NULL); } - + if (ppd->num_groups == 0) group = malloc(sizeof(ppd_group_t)); else @@ -3067,7 +3067,7 @@ ppd_read(cups_file_t *fp, /* I - File to read from */ */ lineptr ++; - + textptr = text; while (*lineptr != '\0' && *lineptr != '\n' && *lineptr != ':') @@ -3090,7 +3090,7 @@ ppd_read(cups_file_t *fp, /* I - File to read from */ cg->ppd_status = PPD_ILLEGAL_TRANSLATION; return (0); } - + mask |= PPD_TEXT; } } diff --git a/cups/pwg-media.c b/cups/pwg-media.c index 9a752e69c..267e718a7 100644 --- a/cups/pwg-media.c +++ b/cups/pwg-media.c @@ -443,7 +443,7 @@ _pwgInitSize(_pwg_size_t *size, /* I - Size to initialize */ pwg = _pwgMediaForPPD(name); if (pwg && (suffix = name + strlen(name) - 10 /* .FullBleed */) > name && - !strcasecmp(suffix, ".FullBleed")) + !_cups_strcasecmp(suffix, ".FullBleed")) { /* * Indicate that margins are set with the default values of 0. @@ -586,7 +586,7 @@ _pwgMediaForPPD(const char *ppd) /* I - PPD size name */ struct lconv *loc; /* Locale data */ int custom; /* Custom page size? */ - if (!strncasecmp(ppd, "Custom.", 7)) + if (!_cups_strncasecmp(ppd, "Custom.", 7)) { custom = 1; factor = 2540.0 / 72.0; @@ -608,34 +608,34 @@ _pwgMediaForPPD(const char *ppd) /* I - PPD size name */ if (ptr && (!*ptr || - !strcasecmp(ptr, "FullBleed") || - !strcasecmp(ptr, ".FullBleed") || - !strcasecmp(ptr, "cm") || - !strcasecmp(ptr, "cm.FullBleed") || - !strcasecmp(ptr, "ft") || - !strcasecmp(ptr, "ft.FullBleed") || - !strcasecmp(ptr, "in") || - !strcasecmp(ptr, "in.FullBleed") || - !strcasecmp(ptr, "m") || - !strcasecmp(ptr, "m.FullBleed") || - !strcasecmp(ptr, "mm") || - !strcasecmp(ptr, "mm.FullBleed") || - !strcasecmp(ptr, "pt") || - !strcasecmp(ptr, "pt.FullBleed"))) + !_cups_strcasecmp(ptr, "FullBleed") || + !_cups_strcasecmp(ptr, ".FullBleed") || + !_cups_strcasecmp(ptr, "cm") || + !_cups_strcasecmp(ptr, "cm.FullBleed") || + !_cups_strcasecmp(ptr, "ft") || + !_cups_strcasecmp(ptr, "ft.FullBleed") || + !_cups_strcasecmp(ptr, "in") || + !_cups_strcasecmp(ptr, "in.FullBleed") || + !_cups_strcasecmp(ptr, "m") || + !_cups_strcasecmp(ptr, "m.FullBleed") || + !_cups_strcasecmp(ptr, "mm") || + !_cups_strcasecmp(ptr, "mm.FullBleed") || + !_cups_strcasecmp(ptr, "pt") || + !_cups_strcasecmp(ptr, "pt.FullBleed"))) { size = &(cg->pwg_media); - if (!strncasecmp(ptr, "cm", 2)) + if (!_cups_strncasecmp(ptr, "cm", 2)) factor = 1000.0; - else if (!strncasecmp(ptr, "ft", 2)) + else if (!_cups_strncasecmp(ptr, "ft", 2)) factor = 2540.0 * 12.0; - else if (!strncasecmp(ptr, "in", 2)) + else if (!_cups_strncasecmp(ptr, "in", 2)) factor = 2540.0; - else if (!strncasecmp(ptr, "mm", 2)) + else if (!_cups_strncasecmp(ptr, "mm", 2)) factor = 100.0; else if (*ptr == 'm' || *ptr == 'M') factor = 100000.0; - else if (!strncasecmp(ptr, "pt", 2)) + else if (!_cups_strncasecmp(ptr, "pt", 2)) factor = 2540.0 / 72.0; /* diff --git a/cups/request.c b/cups/request.c index cc1038b50..7d724b6ab 100644 --- a/cups/request.c +++ b/cups/request.c @@ -657,7 +657,7 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP * Reconnect if the last response had a "Connection: close"... */ - if (!strcasecmp(http->fields[HTTP_FIELD_CONNECTION], "close")) + if (!_cups_strcasecmp(http->fields[HTTP_FIELD_CONNECTION], "close")) if (httpReconnect(http)) { _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0); diff --git a/cups/snmp.c b/cups/snmp.c index 2b43bf343..69858b17d 100644 --- a/cups/snmp.c +++ b/cups/snmp.c @@ -3,7 +3,7 @@ * * SNMP functions for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 2006-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -178,7 +178,7 @@ _cupsSNMPDefaultCommunity(void) { linenum = 0; while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum)) - if (!strcasecmp(line, "Community") && value) + if (!_cups_strcasecmp(line, "Community") && value) { strlcpy(cg->snmp_community, value, sizeof(cg->snmp_community)); break; @@ -728,7 +728,7 @@ _cupsSNMPWrite( packet.request_type = request_type; packet.request_id = request_id; packet.object_type = CUPS_ASN1_NULL_VALUE; - + strlcpy(packet.community, community, sizeof(packet.community)); for (i = 0; oid[i] >= 0 && i < (CUPS_SNMP_MAX_OID - 1); i ++) @@ -963,7 +963,7 @@ asn1_debug(const char *prefix, /* I - Prefix string */ } } } - + /* * 'asn1_decode_snmp()' - Decode a SNMP packet. diff --git a/cups/string-private.h b/cups/string-private.h index 9c3acd324..e16d63b84 100644 --- a/cups/string-private.h +++ b/cups/string-private.h @@ -3,7 +3,7 @@ * * Private string definitions for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -44,16 +44,6 @@ # endif /* HAVE_BSTRING_H */ -/* - * Stuff for WIN32 and OS/2... - */ - -# if defined(WIN32) || defined(__EMX__) -# define strcasecmp _stricmp -# define strncasecmp _strnicmp -# endif /* WIN32 || __EMX__ */ - - /* * C++ magic... */ @@ -82,10 +72,6 @@ typedef struct _cups_sp_item_s /**** String Pool Item ****/ /* * Replacements for the ctype macros that are not affected by locale, since we * really only care about testing for ASCII characters when parsing files, etc. - * These are used only within libcups since the rest of CUPS doesn't call - * setlocale() for LC_CTYPE and doesn't have to worry about third-party - * libraries doing so (and if they do that is a bug: NetSNMP, I'm looking at - * you!) * * The _CUPS_INLINE definition controls whether we get an inline function body, * and external function body, or an external definition. @@ -127,11 +113,18 @@ _cups_isupper(int ch) /* I - Character to test */ { return (ch >= 'A' && ch <= 'Z'); } + +_CUPS_INLINE int /* O - Converted character */ +_cups_tolower(int ch) /* I - Character to convert */ +{ + return (_cups_isupper(ch) ? ch - 'A' + 'a' : ch); +} # else extern int _cups_isalnum(int ch); extern int _cups_isalpha(int ch); extern int _cups_isspace(int ch); extern int _cups_isupper(int ch); +extern int _cups_tolower(int ch); # endif /* _CUPS_INLINE */ @@ -146,15 +139,9 @@ extern char *_cups_strdup(const char *); # define strdup _cups_strdup # endif /* !HAVE_STRDUP */ -# ifndef HAVE_STRCASECMP extern int _cups_strcasecmp(const char *, const char *); -# define strcasecmp _cups_strcasecmp -# endif /* !HAVE_STRCASECMP */ -# ifndef HAVE_STRNCASECMP extern int _cups_strncasecmp(const char *, const char *, size_t n); -# define strncasecmp _cups_strncasecmp -# endif /* !HAVE_STRNCASECMP */ # ifndef HAVE_STRLCAT extern size_t _cups_strlcat(char *, const char *, size_t); diff --git a/cups/string.c b/cups/string.c index f40f5f5fb..538a26386 100644 --- a/cups/string.c +++ b/cups/string.c @@ -3,7 +3,7 @@ * * String functions for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -571,7 +571,7 @@ _cupsStrStatistics(size_t *alloc_bytes, /* O - Allocated bytes */ void _cups_strcpy(char *dst, /* I - Destination string */ - const char *src) /* I - Source string */ + const char *src) /* I - Source string */ { while (*src) *dst++ = *src++; @@ -606,16 +606,15 @@ _cups_strdup(const char *s) /* I - String to duplicate */ * '_cups_strcasecmp()' - Do a case-insensitive comparison. */ -#ifndef HAVE_STRCASECMP int /* O - Result of comparison (-1, 0, or 1) */ _cups_strcasecmp(const char *s, /* I - First string */ - const char *t) /* I - Second string */ + const char *t) /* I - Second string */ { while (*s != '\0' && *t != '\0') { - if (tolower(*s & 255) < tolower(*t & 255)) + if (_cups_tolower(*s) < _cups_tolower(*t)) return (-1); - else if (tolower(*s & 255) > tolower(*t & 255)) + else if (_cups_tolower(*s) > _cups_tolower(*t)) return (1); s ++; @@ -629,13 +628,11 @@ _cups_strcasecmp(const char *s, /* I - First string */ else return (-1); } -#endif /* !HAVE_STRCASECMP */ /* * '_cups_strncasecmp()' - Do a case-insensitive comparison on up to N chars. */ -#ifndef HAVE_STRNCASECMP int /* O - Result of comparison (-1, 0, or 1) */ _cups_strncasecmp(const char *s, /* I - First string */ const char *t, /* I - Second string */ @@ -643,9 +640,9 @@ _cups_strncasecmp(const char *s, /* I - First string */ { while (*s != '\0' && *t != '\0' && n > 0) { - if (tolower(*s & 255) < tolower(*t & 255)) + if (_cups_tolower(*s) < _cups_tolower(*t)) return (-1); - else if (tolower(*s & 255) > tolower(*t & 255)) + else if (_cups_tolower(*s) > _cups_tolower(*t)) return (1); s ++; @@ -662,7 +659,6 @@ _cups_strncasecmp(const char *s, /* I - First string */ else return (-1); } -#endif /* !HAVE_STRNCASECMP */ #ifndef HAVE_STRLCAT diff --git a/cups/testconflicts.c b/cups/testconflicts.c index 7bfe420bf..6f55f0ff4 100644 --- a/cups/testconflicts.c +++ b/cups/testconflicts.c @@ -3,7 +3,7 @@ * * PPD constraint test program for CUPS. * - * Copyright 2008-2010 by Apple Inc. + * Copyright 2008-2011 by Apple Inc. * * These coded instructions, statements, and computer programs are the * property of Apple Inc. and are protected by Federal copyright @@ -81,7 +81,7 @@ main(int argc, /* I - Number of command-line arguments */ { fputs("Resolved conflicts with the following options:\n ", stdout); for (i = 0; i < num_options; i ++) - if (!option || strcasecmp(option, options[i].name)) + if (!option || _cups_strcasecmp(option, options[i].name)) printf(" %s=%s", options[i].name, options[i].value); putchar('\n'); diff --git a/cups/testcups.c b/cups/testcups.c index f595568f6..74241666a 100644 --- a/cups/testcups.c +++ b/cups/testcups.c @@ -3,7 +3,7 @@ * * CUPS API test program for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -352,10 +352,10 @@ dests_equal(cups_dest_t *a, /* I - First destination */ if (!a || !b) return (0); - if (strcasecmp(a->name, b->name) || + if (_cups_strcasecmp(a->name, b->name) || (a->instance && !b->instance) || (!a->instance && b->instance) || - (a->instance && strcasecmp(a->instance, b->instance)) || + (a->instance && _cups_strcasecmp(a->instance, b->instance)) || a->num_options != b->num_options) return (0); @@ -388,12 +388,12 @@ show_diffs(cups_dest_t *a, /* I - First destination */ puts(" Item cupsGetDest cupsGetNamedDest"); puts(" -------------------- -------------------- --------------------"); - if (strcasecmp(a->name, b->name)) + if (_cups_strcasecmp(a->name, b->name)) printf(" name %-20.20s %-20.20s\n", a->name, b->name); if ((a->instance && !b->instance) || (!a->instance && b->instance) || - (a->instance && strcasecmp(a->instance, b->instance))) + (a->instance && _cups_strcasecmp(a->instance, b->instance))) printf(" instance %-20.20s %-20.20s\n", a->instance ? a->instance : "(null)", b->instance ? b->instance : "(null)"); diff --git a/cups/testfile.c b/cups/testfile.c index fd0858dea..ed3d86af6 100644 --- a/cups/testfile.c +++ b/cups/testfile.c @@ -3,7 +3,7 @@ * * File test program for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -429,7 +429,7 @@ random_tests(void) */ unlink("testfile.dat"); - + /* * Return the test status... */ @@ -676,7 +676,7 @@ read_write_tests(int compression) /* I - Use compression? */ for (i = 0; i < 1000; i ++) if (!cupsFileGetConf(fp, line, sizeof(line), &value, &linenum)) break; - else if (strcasecmp(line, "TestLine") || !value || atoi(value) != i || + else if (_cups_strcasecmp(line, "TestLine") || !value || atoi(value) != i || linenum != (i + 2)) break; @@ -807,7 +807,7 @@ read_write_tests(int compression) /* I - Use compression? */ */ unlink(compression ? "testfile.dat.gz" : "testfile.dat"); - + /* * Return the test status... */ diff --git a/cups/testi18n.c b/cups/testi18n.c index 3188c78f9..725c01b2b 100644 --- a/cups/testi18n.c +++ b/cups/testi18n.c @@ -171,7 +171,7 @@ main(int argc, /* I - Argument Count */ for (i = 0, encoding = CUPS_AUTO_ENCODING; i < (int)(sizeof(lang_encodings) / sizeof(lang_encodings[0])); i ++) - if (!strcasecmp(lang_encodings[i], argv[2])) + if (!_cups_strcasecmp(lang_encodings[i], argv[2])) { encoding = (cups_encoding_t)i; break; diff --git a/cups/testppd.c b/cups/testppd.c index d788f9ace..0389eb285 100644 --- a/cups/testppd.c +++ b/cups/testppd.c @@ -301,9 +301,9 @@ main(int argc, /* I - Number of command-line arguments */ num_options = cupsGetConflicts(ppd, "InputSlot", "Envelope", &options); if (num_options != 2 || (val = cupsGetOption("PageRegion", num_options, options)) == NULL || - strcasecmp(val, "Letter") || + _cups_strcasecmp(val, "Letter") || (val = cupsGetOption("PageSize", num_options, options)) == NULL || - strcasecmp(val, "Letter")) + _cups_strcasecmp(val, "Letter")) { printf("FAIL (%d options:", num_options); for (i = 0; i < num_options; i ++) @@ -352,8 +352,8 @@ main(int argc, /* I - Number of command-line arguments */ num_options = 0; options = NULL; if (cupsResolveConflicts(ppd, NULL, NULL, &num_options, &options) && - num_options == 1 && !strcasecmp(options[0].name, "InputSlot") && - !strcasecmp(options[0].value, "Tray")) + num_options == 1 && !_cups_strcasecmp(options[0].name, "InputSlot") && + !_cups_strcasecmp(options[0].value, "Tray")) puts("PASS (Resolved by changing InputSlot)"); else if (num_options > 0) { @@ -690,8 +690,8 @@ main(int argc, /* I - Number of command-line arguments */ num_options = 0; options = NULL; if (cupsResolveConflicts(ppd, NULL, NULL, &num_options, &options) && - num_options == 1 && !strcasecmp(options->name, "Quality") && - !strcasecmp(options->value, "Normal")) + num_options == 1 && !_cups_strcasecmp(options->name, "Quality") && + !_cups_strcasecmp(options->value, "Normal")) puts("PASS"); else if (num_options > 0) { diff --git a/cups/testpwg.c b/cups/testpwg.c index 9cf2faadc..756baf0d8 100644 --- a/cups/testpwg.c +++ b/cups/testpwg.c @@ -124,7 +124,7 @@ main(int argc, /* I - Number of command-line args */ puts("FAIL (Not Found)"); status = 1; } - else if (media && strcasecmp(pagesize, media->values[0].string.text)) + else if (media && _cups_strcasecmp(pagesize, media->values[0].string.text)) { printf("FAIL (Got \"%s\", Expected \"%s\")\n", pagesize, media->values[0].string.text); @@ -288,7 +288,7 @@ test_pagesize(_ppd_cache_t *pc, /* I - PWG mapping data */ puts("FAIL (Not Found)"); status = 1; } - else if (strcasecmp(pagesize, ppdsize)) + else if (_cups_strcasecmp(pagesize, ppdsize)) { printf("FAIL (Got \"%s\", Expected \"%s\")\n", pagesize, ppdsize); status = 1; @@ -307,7 +307,7 @@ test_pagesize(_ppd_cache_t *pc, /* I - PWG mapping data */ puts("FAIL (Not Found)"); status = 1; } - else if (strcasecmp(pagesize, ppdsize)) + else if (_cups_strcasecmp(pagesize, ppdsize)) { printf("FAIL (Got \"%s\", Expected \"%s\")\n", pagesize, ppdsize); status = 1; diff --git a/cups/usersys.c b/cups/usersys.c index 16166b017..879b31539 100644 --- a/cups/usersys.c +++ b/cups/usersys.c @@ -653,36 +653,36 @@ cups_read_client_conf( while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum)) { if (!cups_encryption && cg->encryption == (http_encryption_t)-1 && - !strcasecmp(line, "Encryption") && value) + !_cups_strcasecmp(line, "Encryption") && value) { strlcpy(encryption, value, sizeof(encryption)); cups_encryption = encryption; } else if (!cups_server && (!cg->server[0] || !cg->ipp_port) && - !strcasecmp(line, "ServerName") && value) + !_cups_strcasecmp(line, "ServerName") && value) { strlcpy(server_name, value, sizeof(server_name)); cups_server = server_name; } - else if (!cups_anyroot && !strcasecmp(line, "AllowAnyRoot") && value) + else if (!cups_anyroot && !_cups_strcasecmp(line, "AllowAnyRoot") && value) { strlcpy(any_root, value, sizeof(any_root)); cups_anyroot = any_root; } - else if (!cups_expiredroot && !strcasecmp(line, "AllowExpiredRoot") && + else if (!cups_expiredroot && !_cups_strcasecmp(line, "AllowExpiredRoot") && value) { strlcpy(expired_root, value, sizeof(expired_root)); cups_expiredroot = expired_root; } - else if (!cups_expiredcerts && !strcasecmp(line, "AllowExpiredCerts") && + else if (!cups_expiredcerts && !_cups_strcasecmp(line, "AllowExpiredCerts") && value) { strlcpy(expired_certs, value, sizeof(expired_certs)); cups_expiredcerts = expired_certs; } #ifdef HAVE_GSSAPI - else if (!cups_gssservicename && !strcasecmp(line, "GSSServiceName") && + else if (!cups_gssservicename && !_cups_strcasecmp(line, "GSSServiceName") && value) { strlcpy(gss_service_name, value, sizeof(gss_service_name)); @@ -697,11 +697,11 @@ cups_read_client_conf( if (cg->encryption == (http_encryption_t)-1 && cups_encryption) { - if (!strcasecmp(cups_encryption, "never")) + if (!_cups_strcasecmp(cups_encryption, "never")) cg->encryption = HTTP_ENCRYPT_NEVER; - else if (!strcasecmp(cups_encryption, "always")) + else if (!_cups_strcasecmp(cups_encryption, "always")) cg->encryption = HTTP_ENCRYPT_ALWAYS; - else if (!strcasecmp(cups_encryption, "required")) + else if (!_cups_strcasecmp(cups_encryption, "required")) cg->encryption = HTTP_ENCRYPT_REQUIRED; else cg->encryption = HTTP_ENCRYPT_IF_REQUESTED; @@ -761,20 +761,15 @@ cups_read_client_conf( if (!cg->ipp_port) { - const char *ipp_port; /* IPP_PORT environment variable */ - struct servent *service; /* Port number info */ - + const char *ipp_port; /* IPP_PORT environment variable */ if ((ipp_port = getenv("IPP_PORT")) != NULL) { if ((cg->ipp_port = atoi(ipp_port)) <= 0) cg->ipp_port = CUPS_DEFAULT_IPP_PORT; } - else if ((service = getservbyname("ipp", NULL)) == NULL || - service->s_port <= 0) - cg->ipp_port = CUPS_DEFAULT_IPP_PORT; else - cg->ipp_port = ntohs(service->s_port); + cg->ipp_port = CUPS_DEFAULT_IPP_PORT; } #ifdef HAVE_GSSAPI @@ -786,19 +781,19 @@ cups_read_client_conf( #endif /* HAVE_GSSAPI */ if (cups_anyroot) - cg->any_root = !strcasecmp(cups_anyroot, "yes") || - !strcasecmp(cups_anyroot, "on") || - !strcasecmp(cups_anyroot, "true"); + cg->any_root = !_cups_strcasecmp(cups_anyroot, "yes") || + !_cups_strcasecmp(cups_anyroot, "on") || + !_cups_strcasecmp(cups_anyroot, "true"); if (cups_expiredroot) - cg->expired_root = !strcasecmp(cups_expiredroot, "yes") || - !strcasecmp(cups_expiredroot, "on") || - !strcasecmp(cups_expiredroot, "true"); + cg->expired_root = !_cups_strcasecmp(cups_expiredroot, "yes") || + !_cups_strcasecmp(cups_expiredroot, "on") || + !_cups_strcasecmp(cups_expiredroot, "true"); if (cups_expiredcerts) - cg->expired_certs = !strcasecmp(cups_expiredcerts, "yes") || - !strcasecmp(cups_expiredcerts, "on") || - !strcasecmp(cups_expiredcerts, "true"); + cg->expired_certs = !_cups_strcasecmp(cups_expiredcerts, "yes") || + !_cups_strcasecmp(cups_expiredcerts, "on") || + !_cups_strcasecmp(cups_expiredcerts, "true"); } diff --git a/cups/util.c b/cups/util.c index fb565937b..ab334b16c 100644 --- a/cups/util.c +++ b/cups/util.c @@ -374,7 +374,7 @@ cupsGetClasses(char ***classes) /* O - Classes */ { for (attr = response->attrs; attr != NULL; attr = attr->next) if (attr->name != NULL && - strcasecmp(attr->name, "printer-name") == 0 && + _cups_strcasecmp(attr->name, "printer-name") == 0 && attr->value_tag == IPP_TAG_NAME) { if (n == 0) @@ -936,7 +936,7 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAUL if (!cg->servername[0]) cupsServer(); - if (!strcasecmp(cg->servername, "localhost")) + if (!_cups_strcasecmp(cg->servername, "localhost")) { char ppdname[1024]; /* PPD filename */ struct stat ppdinfo; /* PPD file information */ @@ -1056,7 +1056,7 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAUL DEBUG_printf(("2cupsGetPPD3: Local hostname=\"%s\"", localhost)); - if (!strcasecmp(localhost, hostname)) + if (!_cups_strcasecmp(localhost, hostname)) strcpy(hostname, "localhost"); /* @@ -1073,7 +1073,7 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAUL * Reconnect to the correct server as needed... */ - if (!strcasecmp(http_hostname, hostname) && port == http_port) + if (!_cups_strcasecmp(http_hostname, hostname) && port == http_port) http2 = http; else if ((http2 = httpConnectEncrypt(hostname, port, cupsEncryption())) == NULL) @@ -1215,7 +1215,7 @@ cupsGetPrinters(char ***printers) /* O - Printers */ { for (attr = response->attrs; attr != NULL; attr = attr->next) if (attr->name != NULL && - strcasecmp(attr->name, "printer-name") == 0 && + _cups_strcasecmp(attr->name, "printer-name") == 0 && attr->value_tag == IPP_TAG_NAME) { if (n == 0) @@ -1725,7 +1725,7 @@ cups_get_printer_uri( * Found a class! Connect to the right server... */ - if (!strcasecmp(http_hostname, host) && *port == http_port) + if (!_cups_strcasecmp(http_hostname, host) && *port == http_port) http2 = http; else if ((http2 = httpConnectEncrypt(host, *port, cupsEncryption())) == NULL) diff --git a/doc/help/api-filter.html b/doc/help/api-filter.html index 1746ff664..c8fa766c4 100644 --- a/doc/help/api-filter.html +++ b/doc/help/api-filter.html @@ -385,7 +385,7 @@ div.contents ul.subcontents li { <ul class="contents"> <li><a href="#OVERVIEW">Overview</a><ul class="subcontents"> <li><a href="#SECURITY">Security Considerations</a></li> - <li><a href="#SIGNALS">Signal Handling</a></li> + <li><a href="#SIGNALS">Canceled Jobs and Signal Handling</a></li> <li><a href="#TEMPFILES">Temporary Files</a></li> <li><a href="#COPIES">Copy Generation</a></li> <li><a href="#EXITCODES">Exit Codes</a></li> @@ -510,15 +510,16 @@ that further limit file system access, even for backends running as root. On Mac OS X, for example, no backend may write to a user's home directory.</p> </blockquote> -<h3><a name="SIGNALS">Signal Handling</a><h3> +<h3><a name="SIGNALS">Canceled Jobs and Signal Handling</a><h3> <p>The scheduler sends <code>SIGTERM</code> when a printing job is canceled or held. Filters, backends, and port monitors <em>must</em> catch <code>SIGTERM</code> and perform any cleanup necessary to produce a valid output file or return the printer to a known good state. The recommended behavior is to -end the output on the current page.</p> +end the output on the current page, preferably on the current line or object +being printed.</p> -<p>Filters and backends may also receive <code>SIGPIPE</code> when an upstream or downstream filter/backend exits with a non-zero status. Developers should generally <code>ignore SIGPIPE</code> at the beginning of <code>main()</code> with the following function call:</p> +<p>Filters and backends may also receive <code>SIGPIPE</code> when an upstream or downstream filter/backend exits with a non-zero status. Developers should generally ignore <code>SIGPIPE</code> at the beginning of <code>main()</code> with the following function call:</p> <pre class="example"> #include <signal.h>> @@ -656,7 +657,8 @@ prefix strings:</p> <dt>ATTR: attribute=value [attribute=value]</dt> <dd>Sets the named printer or job attribute(s). Typically this is used - to set the <code>marker-colors</code>, <code>marker-levels</code>, + to set the <code>marker-colors</code>, <code>marker-high-levels</code>, + <code>marker-levels</code>, <code>marker-low-levels</code>, <code>marker-message</code>, <code>marker-names</code>, <code>marker-types</code>, <code>printer-alert</code>, and <code>printer-alert-description</code> printer attributes. Standard @@ -706,23 +708,15 @@ prefix strings:</p> this is used to update installable options or default media settings based on the printer configuration.</dd> - <dt>STATE: printer-state-reason [printer-state-reason ...]</dt> <dt>STATE: + printer-state-reason [printer-state-reason ...]</dt> <dt>STATE: - printer-state-reason [printer-state-reason ...]</dt> - <dd>Sets, adds, or removes printer-state-reason keywords to the - current queue. Typically this is used to indicate persistent media, - ink, toner, and configuration conditions or errors on a printer. + <dd>Sets or clears printer-state-reason keywords for the current queue. + Typically this is used to indicate persistent media, ink, toner, and + configuration conditions or errors on a printer. <a href='#TABLE2'>Table 2</a> lists the standard state keywords - - use vendor-prefixed ("com.acme.foo") keywords for custom states. - - <blockquote><b>Note:</b> - - <p>"STATE:" messages often provide visible alerts to the user. For example, on - Mac OS X setting a printer-state-reason value with an "-error" or "-warning" - suffix will cause the printer's dock item to bounce if the corresponding reason - is localized with a cupsIPPReason keyword in the printer's PPD file.</p> - - </blockquote></dd> + use vendor-prefixed ("com.example.foo") keywords for custom states. See + <a href="#MANAGING_STATE">Managing Printer State in a Filter</a> for more + information. <dt>WARNING: message</dt> <dd>Sets the printer-state-message attribute and adds the specified @@ -811,59 +805,190 @@ the "DEBUG:" prefix string.</p> <tbody> <tr> <td>connecting-to-device</td> - <td>Connecting to printer but not printing yet</td> + <td>Connecting to printer but not printing yet.</td> </tr> <tr> <td>cover-open</td> - <td>A cover is open on the printer</td> + <td>The printer's cover is open.</td> </tr> <tr> <td>input-tray-missing</td> - <td>An input tray is missing from the printer</td> + <td>The paper tray is missing.</td> </tr> <tr> <td>marker-supply-empty</td> - <td>Out of ink</td> + <td>The printer is out of ink.</td> </tr> <tr> <td>marker-supply-low</td> - <td>Low on ink</td> + <td>The printer is almost out of ink.</td> </tr> <tr> <td>marker-waste-almost-full</td> - <td>Waste tank almost full</td> + <td>The printer's waste bin is almost full.</td> </tr> <tr> <td>marker-waste-full</td> - <td>Waste tank full</td> + <td>The printer's waste bin is full.</td> </tr> <tr> <td>media-empty</td> - <td>Out of media</td> + <td>The paper tray (any paper tray) is empty.</td> </tr> <tr> <td>media-jam</td> - <td>Media is jammed in the printer</td> + <td>There is a paper jam.</td> </tr> <tr> <td>media-low</td> - <td>Low on media</td> + <td>The paper tray (any paper tray) is almost empty.</td> +</tr> +<tr> + <td>media-needed</td> + <td>The paper tray needs to be filled (for a job that is printing).</td> </tr> <tr> <td>paused</td> - <td>Stop the printer</td> + <td>Stop the printer.</td> </tr> <tr> <td>timed-out</td> - <td>Unable to connect to printer</td> + <td>Unable to connect to printer.</td> </tr> <tr> <td>toner-empty</td> - <td>Out of toner</td> + <td>The printer is out of toner.</td> </tr> <tr> <td>toner-low</td> - <td>Low on toner</td> + <td>The printer is low on toner.</td> +</tr> +</tbody> +</table></div> + +<h4><a name="MANAGING_STATE">Managing Printer State in a Filter</a></h4> + +<p>Filters are responsible for managing the state keywords they set using +"STATE:" messages. Typically you will update <em>all</em> of the keywords that +are used by the filter at startup, for example:</p> + +<pre class="example"> +if (foo_condition != 0) + fputs("STATE: +com.example.foo\n", stderr); +else + fputs("STATE: -com.example.foo\n", stderr); + +if (bar_condition != 0) + fputs("STATE: +com.example.bar\n", stderr); +else + fputs("STATE: -com.example.bar\n", stderr); +</pre> + +<p>Then as conditions change, your filter sends "STATE: +keyword" or "STATE: +-keyword" messages as necessary to set or clear the corresponding keyword, +respectively.</p> + +<p>State keywords are often used to notify the user of issues that span across +jobs, for example "media-empty-warning" that indicates one or more paper trays +are empty. These keywords should not be cleared unless the corresponding issue +no longer exists.</p> + +<p>Filters should clear job-related keywords on startup and exit so that they +do not remain set between jobs. For example, "connecting-to-device" is a job +sub-state and not an issue that applies when a job is not printing.</p> + +<blockquote><b>Note:</b> + +<p>"STATE:" messages often provide visible alerts to the user. For example, +on Mac OS X setting a printer-state-reason value with an "-error" or +"-warning" suffix will cause the printer's dock item to bounce if the +corresponding reason is localized with a cupsIPPReason keyword in the +printer's PPD file.</p> + +<p>When providing a vendor-prefixed keyword, <em>always</em> provide the +corresponding standard keyword (if any) to allow clients to respond to the +condition correctly. For example, if you provide a vendor-prefixed keyword +for a low cyan ink condition ("com.example.cyan-ink-low") you must also set the +"marker-supply-low-warning" keyword. In such cases you should also refrain +from localizing the vendor-prefixed keyword in the PPD file - otherwise both +the generic and vendor-specific keyword will be shown in the user +interface.</p> + +</blockquote></dd> + +<h4><a name="REPORTING_SUPPLIES">Reporting Supply Levels</a></h4> + +<p>CUPS tracks several "marker-*" attributes for ink/toner supply level +reporting. These attributes allow applications to display the current supply +levels for a printer without printer-specific software. <a href="#TABLE3">Table 3</a> lists the marker attributes and what they represent.</p> + +<p>Filters set marker attributes by sending "ATTR:" messages to stderr. For +example, a filter supporting an inkjet printer with black and tri-color ink +cartridges would use the following to initialize the supply attributes:</p> + +<pre class="example"> +fputs("ATTR: marker-colors=#000000,#00FFFF#FF00FF#FFFF00\n", stderr); +fputs("ATTR: marker-low-levels=5,10\n", stderr); +fputs("ATTR: marker-names=Black,Tri-Color\n", stderr); +fputs("ATTR: marker-types=ink,ink\n", stderr); +</pre> + +<p>Then periodically the filter queries the printer for its current supply +levels and updates them with a separate "ATTR:" message:</p> + +<pre class="example"> +int black_level, tri_level; +... +fprintf(stderr, "ATTR: marker-levels=%d,%d\n", black_level, tri_level); +</pre> + +<div class='table'><table width='80%' summary='Table 3: Supply Level Attributes'> +<caption>Table 3: <a name='TABLE3'>Supply Level Attributes</a></caption> +<thead> +<tr> + <th>Attribute</th> + <th>Description</th> +</tr> +</thead> +<tbody> +<tr> + <td>marker-colors</td> + <td>A list of comma-separated colors; each color is either "none" or one or + more hex-encoded sRGB colors of the form "#RRGGBB".</td> +</tr> +<tr> + <td>marker-high-levels</td> + <td>A list of comma-separated "almost full" level values from 0 to 100; a + value of 100 should be used for supplies that are consumed/emptied like ink + cartridges.</td> +</tr> +<tr> + <td>marker-levels</td> + <td>A list of comma-separated level values for each supply. A value of -1 + indicates the level is unavailable, -2 indicates unknown, and -3 indicates + the level is unknown but has not yet reached capacity. Values from 0 to 100 + indicate the corresponding percentage.</td> +</tr> +<tr> + <td>marker-low-levels</td> + <td>A list of comma-separated "almost empty" level values from 0 to 100; a + value of 0 should be used for supplies that are filled like waste ink + tanks.</td> +</tr> +<tr> + <td>marker-message</td> + <td>A human-readable supply status message for the user like "12 pages of + ink remaining."</td> +</tr> +<tr> + <td>marker-names</td> + <td>A list of comma-separated supply names like "Cyan Ink", "Fuser", + etc.</td> +</tr> +<tr> + <td>marker-types</td> + <td>A list of comma-separated supply types; the types are listed in + <a href="#TABLE1">Table 1</a>.</td> </tr> </tbody> </table></div> @@ -920,6 +1045,38 @@ else data[0] = '\0'; </pre> +<h4><a name="DRAIN_OUTPUT">Forcing All Output to a Printer</a></h4> + +<p>The +<a href="#cupsSideChannelDoRequest"><code>cupsSideChannelDoRequest</code></a> +function allows you to tell the backend to send all pending data to the printer. +This is most often needed when sending query commands to the printer. For example:</p> + +<pre class="example"> +#include <cups/cups.h> +#include <cups/sidechannel.h> + +char data[1024]; +int datalen = sizeof(data); +<a href="#cups_sc_status_t">cups_sc_status_t</a> status; + +/* Flush pending output to stdout */ +fflush(stdout); + +/* Drain output to backend, waiting for up to 30 seconds */ +status = <a href="#cupsSideChannelDoRequest">cupsSideChannelDoRequest</a>(CUPS_SC_CMD_DRAIN_OUTPUT, data, &datalen, 30.0); + +/* Read the response if the output was sent */ +if (status == CUPS_SC_STATUS_OK) +{ + ssize_t bytes; + + /* Wait up to 10.0 seconds for back-channel data */ + bytes = cupsBackChannelRead(data, sizeof(data), 10.0); + /* do something with the data from the printer */ +} +</pre> + <h3><a name="COMMUNICATING_FILTER">Communicating with Filters</a></h3> <p>Backends communicate with filters using the reciprocal functions diff --git a/doc/help/ref-cupsd-conf.html.in b/doc/help/ref-cupsd-conf.html.in index ac83de413..736a0b3b5 100644 --- a/doc/help/ref-cupsd-conf.html.in +++ b/doc/help/ref-cupsd-conf.html.in @@ -2782,6 +2782,7 @@ HREF="#ServerName"><CODE>ServerName</CODE></A>.</P> ServerAlias althost ServerAlias foo.example.com ServerAlias bar.example.com +ServerAlias one.example.com two.example.com ServerAlias * </PRE> diff --git a/doc/help/whatsnew.html b/doc/help/whatsnew.html index 56dcb6cb0..ea5898c0c 100644 --- a/doc/help/whatsnew.html +++ b/doc/help/whatsnew.html @@ -14,76 +14,33 @@ <OL START="1"> - <LI><EM>User defaults;</EM> Starting in CUPS 1.2, user defaults were - stored in the ~/.cups directory, and the old ~/.cupsrc and ~/.lpoptions - files were deprecated. Support for ~/.cupsrc and ~/.lpoptions have been - removed in CUPS 1.5.</LI> + <LI><EM>User defaults;</EM> Starting in CUPS 1.2, user defaults were stored in the ~/.cups directory, and the old ~/.cupsrc and ~/.lpoptions files were deprecated. Support for ~/.cupsrc and ~/.lpoptions have been removed in CUPS 1.5.</LI> - <LI><EM>IPP test tool;</EM> The ipptest is now a first-class user - program.</LI> + <LI><EM>IPP test tool;</EM> The <code>ipptool</code> IPP test tool is now a first-class user program.</LI> + <LI><EM>lpadmin;</EM> The <code>lpadmin</code> command now supports setting the cupsIPPSupplies and cupsSNMPSupplies keywords in PPDs and deleting options.</LI> </OL> - -<!-- -<H2 CLASS="title"><A NAME="WEBIF">Web Interface</A></H2> - -<OL START="10"> - - <LI><EM>;</EM><LI> - -</OL> - - -<H2 CLASS="title"><A NAME="NETWORKING">Networking</A></H2> - -<OL START="17"> - - <LI><EM>;</EM><LI> - -</OL> - - -<H2 CLASS="title"><A NAME="IPP">IPP Support</A></H2> - -<OL START="23"> - - <LI><EM>;</EM><LI> - -</OL> ---> - - <H2 CLASS="title"><A NAME="SCHEDULER">Scheduler</A></H2> <OL START="3"> - <LI><EM>Filter security;</EM> Filters and backends must now have group - write permissions disabled.</LI> - -</OL> - - -<!-- -<H2 CLASS="title"><A NAME="DRIVERS">Printer Drivers</A></H2> - -<OL START="50"> - - <LI><EM>;</EM><LI> + <LI><EM>Filter security;</EM> Filters and backends must now have group write permissions disabled.</LI> </OL> ---> <H2 CLASS="title"><A NAME="FILTERS">Print Filters</A></H2> <OL START="4"> - <LI><EM>HP-GL/2 filter;</EM> The HP-GL/2 filter is no longer provided - with CUPS.</LI> + <LI><EM>HP-GL/2 filter;</EM> The HP-GL/2 filter is no longer provided with CUPS.</LI> - <LI><EM>SCSI backend;</EM> The SCSI backend is no longer provided with - CUPS.</LI> + <LI><EM>PDF filter;</EM> The PDF filter now supports new Poppler and Ghostscript options.</LI> + + <LI><EM>PWG Raster driver;</EM> Added a new PWG Raster printer driver filter.</LI> + + <LI><EM>SCSI backend;</EM> The SCSI backend is no longer provided with CUPS.</LI> </OL> @@ -94,6 +51,8 @@ <LI><EM>CUPS headers;</EM> Changes to the main CUPS header may require code changes to applications and toolkits. Users of PPD functions must now include the <cups/ppd.h> header file explicitly since the <cups/cups.h> header no longer does so.</LI> + <LI><EM>Raster support;</EM> The CUPS raster functions now support the creation of PWG Raster files and streams, and a new callback-based context function allows reading and writing from objects other than file descriptors.</LI> + </OL> diff --git a/driver/commandtoescpx.c b/driver/commandtoescpx.c index 641da8a67..d11bd9bd4 100644 --- a/driver/commandtoescpx.c +++ b/driver/commandtoescpx.c @@ -3,7 +3,7 @@ * * Advanced EPSON ESC/P command filter for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1993-2005 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -136,7 +136,7 @@ main(int argc, /* I - Number of command-line arguments */ * Parse the command... */ - if (strncasecmp(lineptr, "Clean", 5) == 0) + if (_cups_strncasecmp(lineptr, "Clean", 5) == 0) { /* * Clean heads... @@ -144,7 +144,7 @@ main(int argc, /* I - Number of command-line arguments */ cupsWritePrintData("CH\002\000\000\000", 6); } - else if (strncasecmp(lineptr, "PrintAlignmentPage", 18) == 0) + else if (_cups_strncasecmp(lineptr, "PrintAlignmentPage", 18) == 0) { /* * Print alignment page... @@ -159,7 +159,7 @@ main(int argc, /* I - Number of command-line arguments */ putchar(phase >> 8); feedpage = 1; } - else if (strncasecmp(lineptr, "PrintSelfTestPage", 17) == 0) + else if (_cups_strncasecmp(lineptr, "PrintSelfTestPage", 17) == 0) { /* * Print version info and nozzle check... @@ -169,7 +169,7 @@ main(int argc, /* I - Number of command-line arguments */ cupsWritePrintData("NC\002\000\000\000", 6); feedpage = 1; } - else if (strncasecmp(lineptr, "ReportLevels", 12) == 0) + else if (_cups_strncasecmp(lineptr, "ReportLevels", 12) == 0) { /* * Report ink levels... @@ -177,7 +177,7 @@ main(int argc, /* I - Number of command-line arguments */ cupsWritePrintData("IQ\001\000\001", 5); } - else if (strncasecmp(lineptr, "SetAlignment", 12) == 0) + else if (_cups_strncasecmp(lineptr, "SetAlignment", 12) == 0) { /* * Set head alignment... diff --git a/driver/commandtopclx.c b/driver/commandtopclx.c index 7a55bce88..1ef53aab4 100644 --- a/driver/commandtopclx.c +++ b/driver/commandtopclx.c @@ -3,7 +3,7 @@ * * Advanced PCL command filter for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1993-2005 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -123,7 +123,7 @@ main(int argc, /* I - Number of command-line arguments */ * Parse the command... */ - if (strncasecmp(lineptr, "Clean", 5) == 0 && + if (_cups_strncasecmp(lineptr, "Clean", 5) == 0 && (ppd->model_number & PCL_INKJET)) { /* diff --git a/filter/bannertops.c b/filter/bannertops.c index 2a1352265..467980e99 100644 --- a/filter/bannertops.c +++ b/filter/bannertops.c @@ -3,7 +3,7 @@ * * Banner to PostScript filter for CUPS. * - * Copyright 2008-2010 by Apple Inc. + * Copyright 2008-2011 by Apple Inc. * * These coded instructions, statements, and computer programs are the * property of Apple Inc. and are protected by Federal copyright @@ -228,7 +228,7 @@ load_banner(const char *filename) /* I - Filename or NULL for stdin */ * Save keyword values in the appropriate places... */ - if (!strcasecmp(line, "Footer")) + if (!_cups_strcasecmp(line, "Footer")) { if (banner->footer) fprintf(stderr, "DEBUG: Extra \"Footer\" on line %d of banner file\n", @@ -236,7 +236,7 @@ load_banner(const char *filename) /* I - Filename or NULL for stdin */ else banner->footer = strdup(ptr); } - else if (!strcasecmp(line, "Header")) + else if (!_cups_strcasecmp(line, "Header")) { if (banner->header) fprintf(stderr, "DEBUG: Extra \"Header\" on line %d of banner file\n", @@ -244,7 +244,7 @@ load_banner(const char *filename) /* I - Filename or NULL for stdin */ else banner->header = strdup(ptr); } - else if (!strcasecmp(line, "Image")) + else if (!_cups_strcasecmp(line, "Image")) { char imagefile[1024]; /* Image filename */ @@ -267,14 +267,14 @@ load_banner(const char *filename) /* I - Filename or NULL for stdin */ cupsArrayAdd(banner->images, strdup(imagefile)); } } - else if (!strcasecmp(line, "Notice")) + else if (!_cups_strcasecmp(line, "Notice")) { if (!banner->notices) banner->notices = cupsArrayNew(NULL, NULL); cupsArrayAdd(banner->notices, strdup(ptr)); } - else if (!strcasecmp(line, "Show")) + else if (!_cups_strcasecmp(line, "Show")) { char *value; /* Current value */ @@ -294,41 +294,41 @@ load_banner(const char *filename) /* I - Filename or NULL for stdin */ /* * Add the value to the show flags... */ - if (!strcasecmp(value, "imageable-area")) + if (!_cups_strcasecmp(value, "imageable-area")) banner->show |= SHOW_IMAGEABLE_AREA; - else if (!strcasecmp(value, "job-billing")) + else if (!_cups_strcasecmp(value, "job-billing")) banner->show |= SHOW_JOB_BILLING; - else if (!strcasecmp(value, "job-id")) + else if (!_cups_strcasecmp(value, "job-id")) banner->show |= SHOW_JOB_ID; - else if (!strcasecmp(value, "job-name")) + else if (!_cups_strcasecmp(value, "job-name")) banner->show |= SHOW_JOB_NAME; - else if (!strcasecmp(value, "job-originating-host-name")) + else if (!_cups_strcasecmp(value, "job-originating-host-name")) banner->show |= SHOW_JOB_ORIGINATING_HOST_NAME; - else if (!strcasecmp(value, "job-originating-user-name")) + else if (!_cups_strcasecmp(value, "job-originating-user-name")) banner->show |= SHOW_JOB_ORIGINATING_USER_NAME; - else if (!strcasecmp(value, "job-uuid")) + else if (!_cups_strcasecmp(value, "job-uuid")) banner->show |= SHOW_JOB_UUID; - else if (!strcasecmp(value, "options")) + else if (!_cups_strcasecmp(value, "options")) banner->show |= SHOW_OPTIONS; - else if (!strcasecmp(value, "paper-name")) + else if (!_cups_strcasecmp(value, "paper-name")) banner->show |= SHOW_PAPER_NAME; - else if (!strcasecmp(value, "paper-size")) + else if (!_cups_strcasecmp(value, "paper-size")) banner->show |= SHOW_PAPER_SIZE; - else if (!strcasecmp(value, "printer-driver-name")) + else if (!_cups_strcasecmp(value, "printer-driver-name")) banner->show |= SHOW_PRINTER_DRIVER_NAME; - else if (!strcasecmp(value, "printer-driver-version")) + else if (!_cups_strcasecmp(value, "printer-driver-version")) banner->show |= SHOW_PRINTER_DRIVER_VERSION; - else if (!strcasecmp(value, "printer-info")) + else if (!_cups_strcasecmp(value, "printer-info")) banner->show |= SHOW_PRINTER_INFO; - else if (!strcasecmp(value, "printer-location")) + else if (!_cups_strcasecmp(value, "printer-location")) banner->show |= SHOW_PRINTER_LOCATION; - else if (!strcasecmp(value, "printer-make-and-model")) + else if (!_cups_strcasecmp(value, "printer-make-and-model")) banner->show |= SHOW_PRINTER_MAKE_AND_MODEL; - else if (!strcasecmp(value, "printer-name")) + else if (!_cups_strcasecmp(value, "printer-name")) banner->show |= SHOW_PRINTER_NAME; - else if (!strcasecmp(value, "time-at-creation")) + else if (!_cups_strcasecmp(value, "time-at-creation")) banner->show |= SHOW_TIME_AT_CREATION; - else if (!strcasecmp(value, "time-at-processing")) + else if (!_cups_strcasecmp(value, "time-at-processing")) banner->show |= SHOW_TIME_AT_PROCESSING; else { @@ -486,18 +486,18 @@ write_banner(banner_file_t *banner, /* I - Banner file */ { for (j = 0; j < num_options; j ++) { - if (strcasecmp("media", options[j].name) && - strcasecmp("PageSize", options[j].name) && - strcasecmp("PageRegion", options[j].name) && - strcasecmp("InputSlot", options[j].name) && - strcasecmp("MediaType", options[j].name) && - strcasecmp("finishings", options[j].name) && - strcasecmp("sides", options[j].name) && - strcasecmp("Duplex", options[j].name) && - strcasecmp("orientation-requested", options[j].name) && - strcasecmp("landscape", options[j].name) && - strcasecmp("number-up", options[j].name) && - strcasecmp("OutputOrder", options[j].name)) + if (_cups_strcasecmp("media", options[j].name) && + _cups_strcasecmp("PageSize", options[j].name) && + _cups_strcasecmp("PageRegion", options[j].name) && + _cups_strcasecmp("InputSlot", options[j].name) && + _cups_strcasecmp("MediaType", options[j].name) && + _cups_strcasecmp("finishings", options[j].name) && + _cups_strcasecmp("sides", options[j].name) && + _cups_strcasecmp("Duplex", options[j].name) && + _cups_strcasecmp("orientation-requested", options[j].name) && + _cups_strcasecmp("landscape", options[j].name) && + _cups_strcasecmp("number-up", options[j].name) && + _cups_strcasecmp("OutputOrder", options[j].name)) continue; showlines ++; @@ -675,23 +675,23 @@ write_banner(banner_file_t *banner, /* I - Banner file */ for (j = 0; j < num_options; j ++) { - if (strcasecmp("media", options[j].name) && - strcasecmp("PageSize", options[j].name) && - strcasecmp("PageRegion", options[j].name) && - strcasecmp("InputSlot", options[j].name) && - strcasecmp("MediaType", options[j].name) && - strcasecmp("finishings", options[j].name) && - strcasecmp("sides", options[j].name) && - strcasecmp("Duplex", options[j].name) && - strcasecmp("orientation-requested", options[j].name) && - strcasecmp("landscape", options[j].name) && - strcasecmp("number-up", options[j].name) && - strcasecmp("OutputOrder", options[j].name)) + if (_cups_strcasecmp("media", options[j].name) && + _cups_strcasecmp("PageSize", options[j].name) && + _cups_strcasecmp("PageRegion", options[j].name) && + _cups_strcasecmp("InputSlot", options[j].name) && + _cups_strcasecmp("MediaType", options[j].name) && + _cups_strcasecmp("finishings", options[j].name) && + _cups_strcasecmp("sides", options[j].name) && + _cups_strcasecmp("Duplex", options[j].name) && + _cups_strcasecmp("orientation-requested", options[j].name) && + _cups_strcasecmp("landscape", options[j].name) && + _cups_strcasecmp("number-up", options[j].name) && + _cups_strcasecmp("OutputOrder", options[j].name)) continue; - if (!strcasecmp("landscape", options[j].name)) + if (!_cups_strcasecmp("landscape", options[j].name)) strlcpy(text, "orientation-requested=landscape", sizeof(text)); - else if (!strcasecmp("orientation-requested", options[j].name)) + else if (!_cups_strcasecmp("orientation-requested", options[j].name)) { switch (atoi(options[j].value)) { diff --git a/filter/commandtops.c b/filter/commandtops.c index f858610a3..467d3d092 100644 --- a/filter/commandtops.c +++ b/filter/commandtops.c @@ -112,11 +112,11 @@ main(int argc, /* I - Number of command-line arguments */ * Parse the command... */ - if (!strcasecmp(line, "AutoConfigure")) + if (!_cups_strcasecmp(line, "AutoConfigure")) auto_configure(ppd, argv[2]); - else if (!strcasecmp(line, "PrintSelfTestPage")) + else if (!_cups_strcasecmp(line, "PrintSelfTestPage")) print_self_test_page(ppd, argv[2]); - else if (!strcasecmp(line, "ReportLevels")) + else if (!_cups_strcasecmp(line, "ReportLevels")) report_levels(ppd, argv[2]); else fprintf(stderr, "ERROR: Invalid printer command \"%s\"!\n", line); diff --git a/filter/common.c b/filter/common.c index 56ba6852e..689253cce 100644 --- a/filter/common.c +++ b/filter/common.c @@ -95,8 +95,8 @@ SetCommonOptions( if ((val = cupsGetOption("landscape", num_options, options)) != NULL) { - if (strcasecmp(val, "no") != 0 && strcasecmp(val, "off") != 0 && - strcasecmp(val, "false") != 0) + if (_cups_strcasecmp(val, "no") != 0 && _cups_strcasecmp(val, "off") != 0 && + _cups_strcasecmp(val, "false") != 0) { if (ppd && ppd->landscape > 0) Orientation = 1; diff --git a/filter/imagetops.c b/filter/imagetops.c index 6649753b1..d8638b25a 100644 --- a/filter/imagetops.c +++ b/filter/imagetops.c @@ -3,7 +3,7 @@ * * Image file to PostScript filter for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1993-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -183,11 +183,11 @@ main(int argc, /* I - Number of command-line arguments */ * separate-documents-uncollated-copies allows for uncollated copies. */ - Collate = strcasecmp(val, "separate-documents-uncollated-copies") != 0; + Collate = _cups_strcasecmp(val, "separate-documents-uncollated-copies") != 0; } if ((val = cupsGetOption("Collate", num_options, options)) != NULL && - strcasecmp(val, "True") == 0) + _cups_strcasecmp(val, "True") == 0) Collate = 1; if ((val = cupsGetOption("gamma", num_options, options)) != NULL) @@ -221,10 +221,10 @@ main(int argc, /* I - Number of command-line arguments */ if ((val = cupsGetOption("scaling", num_options, options)) != NULL) zoom = atoi(val) * 0.01; else if ((val = cupsGetOption("fitplot", num_options, options)) != NULL && - !strcasecmp(val, "true")) + !_cups_strcasecmp(val, "true")) zoom = 1.0; else if ((val = cupsGetOption("fit-to-page", num_options, options)) != NULL && - !strcasecmp(val, "true")) + !_cups_strcasecmp(val, "true")) zoom = 1.0; if ((val = cupsGetOption("ppi", num_options, options)) != NULL) @@ -233,47 +233,47 @@ main(int argc, /* I - Number of command-line arguments */ if ((val = cupsGetOption("position", num_options, options)) != NULL) { - if (strcasecmp(val, "center") == 0) + if (_cups_strcasecmp(val, "center") == 0) { XPosition = 0; YPosition = 0; } - else if (strcasecmp(val, "top") == 0) + else if (_cups_strcasecmp(val, "top") == 0) { XPosition = 0; YPosition = 1; } - else if (strcasecmp(val, "left") == 0) + else if (_cups_strcasecmp(val, "left") == 0) { XPosition = -1; YPosition = 0; } - else if (strcasecmp(val, "right") == 0) + else if (_cups_strcasecmp(val, "right") == 0) { XPosition = 1; YPosition = 0; } - else if (strcasecmp(val, "top-left") == 0) + else if (_cups_strcasecmp(val, "top-left") == 0) { XPosition = -1; YPosition = 1; } - else if (strcasecmp(val, "top-right") == 0) + else if (_cups_strcasecmp(val, "top-right") == 0) { XPosition = 1; YPosition = 1; } - else if (strcasecmp(val, "bottom") == 0) + else if (_cups_strcasecmp(val, "bottom") == 0) { XPosition = 0; YPosition = -1; } - else if (strcasecmp(val, "bottom-left") == 0) + else if (_cups_strcasecmp(val, "bottom-left") == 0) { XPosition = -1; YPosition = -1; } - else if (strcasecmp(val, "bottom-right") == 0) + else if (_cups_strcasecmp(val, "bottom-right") == 0) { XPosition = 1; YPosition = -1; @@ -294,13 +294,13 @@ main(int argc, /* I - Number of command-line arguments */ else val = cupsGetOption("mirror", num_options, options); - if (val && (!strcasecmp(val, "true") || !strcasecmp(val, "on") || - !strcasecmp(val, "yes"))) + if (val && (!_cups_strcasecmp(val, "true") || !_cups_strcasecmp(val, "on") || + !_cups_strcasecmp(val, "yes"))) Flip = 1; if ((val = cupsGetOption("emit-jcl", num_options, options)) != NULL && - (!strcasecmp(val, "false") || !strcasecmp(val, "off") || - !strcasecmp(val, "no") || !strcmp(val, "0"))) + (!_cups_strcasecmp(val, "false") || !_cups_strcasecmp(val, "off") || + !_cups_strcasecmp(val, "no") || !strcmp(val, "0"))) emit_jcl = 0; else emit_jcl = 1; @@ -512,7 +512,7 @@ main(int argc, /* I - Number of command-line arguments */ */ if ((choice = ppdFindMarkedChoice(ppd, "PageSize")) != NULL && - strcasecmp(choice->choice, "Custom") == 0) + _cups_strcasecmp(choice->choice, "Custom") == 0) { float width, /* New width in points */ length; /* New length in points */ diff --git a/filter/imagetoraster.c b/filter/imagetoraster.c index 69e552def..3508a3752 100644 --- a/filter/imagetoraster.c +++ b/filter/imagetoraster.c @@ -3,7 +3,7 @@ * * Image file to raster filter for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1993-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -341,11 +341,11 @@ main(int argc, /* I - Number of command-line arguments */ * separate-documents-collated-copies allows for uncollated copies. */ - Collate = strcasecmp(val, "separate-documents-collated-copies") != 0; + Collate = _cups_strcasecmp(val, "separate-documents-collated-copies") != 0; } if ((val = cupsGetOption("Collate", num_options, options)) != NULL && - strcasecmp(val, "True") == 0) + _cups_strcasecmp(val, "True") == 0) Collate = 1; if ((val = cupsGetOption("gamma", num_options, options)) != NULL) @@ -379,10 +379,10 @@ main(int argc, /* I - Number of command-line arguments */ if ((val = cupsGetOption("scaling", num_options, options)) != NULL) zoom = atoi(val) * 0.01; else if ((val = cupsGetOption("fitplot", num_options, options)) != NULL && - !strcasecmp(val, "true")) + !_cups_strcasecmp(val, "true")) zoom = 1.0; else if ((val = cupsGetOption("fit-to-page", num_options, options)) != NULL && - !strcasecmp(val, "true")) + !_cups_strcasecmp(val, "true")) zoom = 1.0; if ((val = cupsGetOption("ppi", num_options, options)) != NULL) @@ -391,47 +391,47 @@ main(int argc, /* I - Number of command-line arguments */ if ((val = cupsGetOption("position", num_options, options)) != NULL) { - if (strcasecmp(val, "center") == 0) + if (_cups_strcasecmp(val, "center") == 0) { XPosition = 0; YPosition = 0; } - else if (strcasecmp(val, "top") == 0) + else if (_cups_strcasecmp(val, "top") == 0) { XPosition = 0; YPosition = 1; } - else if (strcasecmp(val, "left") == 0) + else if (_cups_strcasecmp(val, "left") == 0) { XPosition = -1; YPosition = 0; } - else if (strcasecmp(val, "right") == 0) + else if (_cups_strcasecmp(val, "right") == 0) { XPosition = 1; YPosition = 0; } - else if (strcasecmp(val, "top-left") == 0) + else if (_cups_strcasecmp(val, "top-left") == 0) { XPosition = -1; YPosition = 1; } - else if (strcasecmp(val, "top-right") == 0) + else if (_cups_strcasecmp(val, "top-right") == 0) { XPosition = 1; YPosition = 1; } - else if (strcasecmp(val, "bottom") == 0) + else if (_cups_strcasecmp(val, "bottom") == 0) { XPosition = 0; YPosition = -1; } - else if (strcasecmp(val, "bottom-left") == 0) + else if (_cups_strcasecmp(val, "bottom-left") == 0) { XPosition = -1; YPosition = -1; } - else if (strcasecmp(val, "bottom-right") == 0) + else if (_cups_strcasecmp(val, "bottom-right") == 0) { XPosition = 1; YPosition = -1; @@ -452,8 +452,8 @@ main(int argc, /* I - Number of command-line arguments */ else val = cupsGetOption("mirror", num_options, options); - if (val && (!strcasecmp(val, "true") || !strcasecmp(val, "on") || - !strcasecmp(val, "yes"))) + if (val && (!_cups_strcasecmp(val, "true") || !_cups_strcasecmp(val, "on") || + !_cups_strcasecmp(val, "yes"))) Flip = 1; /* @@ -870,7 +870,7 @@ main(int argc, /* I - Number of command-line arguments */ */ if ((choice = ppdFindMarkedChoice(ppd, "PageSize")) != NULL && - strcasecmp(choice->choice, "Custom") == 0) + _cups_strcasecmp(choice->choice, "Custom") == 0) { float width, /* New width in points */ length; /* New length in points */ diff --git a/filter/interpret.c b/filter/interpret.c index 7d0cb570a..017e578dc 100644 --- a/filter/interpret.c +++ b/filter/interpret.c @@ -364,6 +364,7 @@ cupsRasterInterpretPPD( case CUPS_CSPACE_WHITE : case CUPS_CSPACE_GOLD : case CUPS_CSPACE_SILVER : + case CUPS_CSPACE_SW : h->cupsNumColors = 1; h->cupsBitsPerPixel = h->cupsBitsPerColor; break; @@ -425,6 +426,29 @@ cupsRasterInterpretPPD( h->cupsNumColors = 4; break; + + case CUPS_CSPACE_DEVICE1 : + case CUPS_CSPACE_DEVICE2 : + case CUPS_CSPACE_DEVICE3 : + case CUPS_CSPACE_DEVICE4 : + case CUPS_CSPACE_DEVICE5 : + case CUPS_CSPACE_DEVICE6 : + case CUPS_CSPACE_DEVICE7 : + case CUPS_CSPACE_DEVICE8 : + case CUPS_CSPACE_DEVICE9 : + case CUPS_CSPACE_DEVICEA : + case CUPS_CSPACE_DEVICEB : + case CUPS_CSPACE_DEVICEC : + case CUPS_CSPACE_DEVICED : + case CUPS_CSPACE_DEVICEE : + case CUPS_CSPACE_DEVICEF : + h->cupsNumColors = h->cupsColorSpace - CUPS_CSPACE_DEVICE1 + 1; + + if (h->cupsColorOrder == CUPS_ORDER_CHUNKED) + h->cupsBitsPerPixel = h->cupsBitsPerColor * h->cupsNumColors; + else + h->cupsBitsPerPixel = h->cupsBitsPerColor; + break; } h->cupsBytesPerLine = (h->cupsBitsPerPixel * h->cupsWidth + 7) / 8; diff --git a/filter/pdftops.c b/filter/pdftops.c index 391c8d145..76da65dba 100644 --- a/filter/pdftops.c +++ b/filter/pdftops.c @@ -320,8 +320,8 @@ main(int argc, /* I - Number of command-line args */ if ((val = cupsGetOption("fitplot", num_options, options)) == NULL) val = cupsGetOption("fit-to-page", num_options, options); - if (val && strcasecmp(val, "no") && strcasecmp(val, "off") && - strcasecmp(val, "false")) + if (val && _cups_strcasecmp(val, "no") && _cups_strcasecmp(val, "off") && + _cups_strcasecmp(val, "false")) fit = 1; else fit = 0; @@ -341,8 +341,8 @@ main(int argc, /* I - Number of command-line args */ if ((val = cupsGetOption("landscape", num_options, options)) != NULL) { - if (strcasecmp(val, "no") != 0 && strcasecmp(val, "off") != 0 && - strcasecmp(val, "false") != 0) + if (_cups_strcasecmp(val, "no") != 0 && _cups_strcasecmp(val, "off") != 0 && + _cups_strcasecmp(val, "false") != 0) orientation = 1; } else if ((val = cupsGetOption("orientation-requested", num_options, diff --git a/filter/pstops.c b/filter/pstops.c index 7a05c8f6f..f7dff2a47 100644 --- a/filter/pstops.c +++ b/filter/pstops.c @@ -500,10 +500,10 @@ check_range(pstops_doc_t *doc, /* I - Document information */ * See if we only print even or odd pages... */ - if (!strcasecmp(doc->page_set, "even") && (page & 1)) + if (!_cups_strcasecmp(doc->page_set, "even") && (page & 1)) return (0); - if (!strcasecmp(doc->page_set, "odd") && !(page & 1)) + if (!_cups_strcasecmp(doc->page_set, "odd") && !(page & 1)) return (0); } @@ -1271,7 +1271,7 @@ copy_page(cups_file_t *fp, /* I - File to read from */ int level; /* Embedded document level */ pstops_page_t *pageinfo; /* Page information */ int first_page; /* First page on N-up output? */ - int has_page_setup; /* Does the page have %%Begin/EndPageSetup? */ + int has_page_setup = 0; /* Does the page have %%Begin/EndPageSetup? */ int bounding_box[4]; /* PageBoundingBox */ @@ -1490,7 +1490,12 @@ copy_page(cups_file_t *fp, /* I - File to read from */ pageinfo->num_options, &(pageinfo->options)); } - else if (strncmp(line, "%%Include", 9)) + else if (!strncmp(line, "%%BeginPageSetup", 16)) + { + has_page_setup = 1; + break; + } + else break; } @@ -1545,7 +1550,7 @@ copy_page(cups_file_t *fp, /* I - File to read from */ if (first_page) doc_puts(doc, "%%BeginPageSetup\n"); - if ((has_page_setup = !strncmp(line, "%%BeginPageSetup", 16)) != 0) + if (has_page_setup) { int feature = 0; /* In a Begin/EndFeature block? */ @@ -1622,49 +1627,6 @@ copy_page(cups_file_t *fp, /* I - File to read from */ start_nup(doc, number, 1, bounding_box); - /* - * Finish the PageSetup section as needed... - */ - - if (has_page_setup) - { - int feature = 0; /* In a Begin/EndFeature block? */ - - doc_write(doc, line, linelen); - - while ((linelen = cupsFileGetLine(fp, line, linesize)) > 0) - { - if (!strncmp(line, "%%EndPageSetup", 14)) - break; - else if (!strncmp(line, "%%BeginFeature:", 15)) - { - feature = 1; - - if (doc->number_up > 1 || doc->fitplot) - continue; - } - else if (!strncmp(line, "%%EndFeature", 12)) - { - feature = 0; - - if (doc->number_up > 1 || doc->fitplot) - continue; - } - else if (!strncmp(line, "%%Include", 9)) - continue; - - if (!feature || (doc->number_up == 1 && !doc->fitplot)) - doc_write(doc, line, linelen); - } - - /* - * Skip %%EndPageSetup... - */ - - if (linelen > 0 && !strncmp(line, "%%EndPageSetup", 14)) - linelen = cupsFileGetLine(fp, line, linesize); - } - if (first_page) doc_puts(doc, "%%EndPageSetup\n"); @@ -2482,12 +2444,12 @@ set_pstops_options( * separate-documents-uncollated-copies allows for uncollated copies. */ - doc->collate = strcasecmp(val, "separate-documents-uncollated-copies") != 0; + doc->collate = _cups_strcasecmp(val, "separate-documents-uncollated-copies") != 0; } if ((val = cupsGetOption("Collate", num_options, options)) != NULL && - (!strcasecmp(val, "true") ||!strcasecmp(val, "on") || - !strcasecmp(val, "yes"))) + (!_cups_strcasecmp(val, "true") ||!_cups_strcasecmp(val, "on") || + !_cups_strcasecmp(val, "yes"))) doc->collate = 1; /* @@ -2495,8 +2457,8 @@ set_pstops_options( */ if ((val = cupsGetOption("emit-jcl", num_options, options)) != NULL && - (!strcasecmp(val, "false") || !strcasecmp(val, "off") || - !strcasecmp(val, "no") || !strcmp(val, "0"))) + (!_cups_strcasecmp(val, "false") || !_cups_strcasecmp(val, "off") || + !_cups_strcasecmp(val, "no") || !strcmp(val, "0"))) doc->emit_jcl = 0; else doc->emit_jcl = 1; @@ -2510,17 +2472,17 @@ set_pstops_options( if ((content_type = getenv("CONTENT_TYPE")) == NULL) content_type = "application/postscript"; - if (!strcasecmp(content_type, "application/postscript")) + if (!_cups_strcasecmp(content_type, "application/postscript")) { if ((val = cupsGetOption("fitplot", num_options, options)) != NULL && - !strcasecmp(val, "true")) + !_cups_strcasecmp(val, "true")) doc->fitplot = 1; else if ((val = cupsGetOption("fit-to-page", num_options, options)) != NULL && - !strcasecmp(val, "true")) + !_cups_strcasecmp(val, "true")) doc->fitplot = 1; else if ((val = cupsGetOption("ipp-attribute-fidelity", num_options, options)) != NULL && - !strcasecmp(val, "true")) + !_cups_strcasecmp(val, "true")) doc->fitplot = 1; } @@ -2561,8 +2523,8 @@ set_pstops_options( else val = cupsGetOption("mirror", num_options, options); - if (val && (!strcasecmp(val, "true") || !strcasecmp(val, "on") || - !strcasecmp(val, "yes"))) + if (val && (!_cups_strcasecmp(val, "true") || !_cups_strcasecmp(val, "on") || + !_cups_strcasecmp(val, "yes"))) doc->mirror = 1; /* @@ -2598,21 +2560,21 @@ set_pstops_options( if ((val = cupsGetOption("number-up-layout", num_options, options)) != NULL) { - if (!strcasecmp(val, "lrtb")) + if (!_cups_strcasecmp(val, "lrtb")) doc->number_up_layout = PSTOPS_LAYOUT_LRTB; - else if (!strcasecmp(val, "lrbt")) + else if (!_cups_strcasecmp(val, "lrbt")) doc->number_up_layout = PSTOPS_LAYOUT_LRBT; - else if (!strcasecmp(val, "rltb")) + else if (!_cups_strcasecmp(val, "rltb")) doc->number_up_layout = PSTOPS_LAYOUT_RLTB; - else if (!strcasecmp(val, "rlbt")) + else if (!_cups_strcasecmp(val, "rlbt")) doc->number_up_layout = PSTOPS_LAYOUT_RLBT; - else if (!strcasecmp(val, "tblr")) + else if (!_cups_strcasecmp(val, "tblr")) doc->number_up_layout = PSTOPS_LAYOUT_TBLR; - else if (!strcasecmp(val, "tbrl")) + else if (!_cups_strcasecmp(val, "tbrl")) doc->number_up_layout = PSTOPS_LAYOUT_TBRL; - else if (!strcasecmp(val, "btlr")) + else if (!_cups_strcasecmp(val, "btlr")) doc->number_up_layout = PSTOPS_LAYOUT_BTLR; - else if (!strcasecmp(val, "btrl")) + else if (!_cups_strcasecmp(val, "btrl")) doc->number_up_layout = PSTOPS_LAYOUT_BTRL; else { @@ -2631,7 +2593,7 @@ set_pstops_options( if ((val = cupsGetOption("OutputOrder", num_options, options)) != NULL) { - if (!strcasecmp(val, "Reverse")) + if (!_cups_strcasecmp(val, "Reverse")) doc->output_order = 1; } else if (ppd) @@ -2643,10 +2605,10 @@ set_pstops_options( if ((choice = ppdFindMarkedChoice(ppd, "OutputBin")) != NULL && (attr = ppdFindAttr(ppd, "PageStackOrder", choice->choice)) != NULL && attr->value) - doc->output_order = !strcasecmp(attr->value, "Reverse"); + doc->output_order = !_cups_strcasecmp(attr->value, "Reverse"); else if ((attr = ppdFindAttr(ppd, "DefaultOutputOrder", NULL)) != NULL && attr->value) - doc->output_order = !strcasecmp(attr->value, "Reverse"); + doc->output_order = !_cups_strcasecmp(attr->value, "Reverse"); } /* @@ -2655,15 +2617,15 @@ set_pstops_options( if ((val = cupsGetOption("page-border", num_options, options)) != NULL) { - if (!strcasecmp(val, "none")) + if (!_cups_strcasecmp(val, "none")) doc->page_border = PSTOPS_BORDERNONE; - else if (!strcasecmp(val, "single")) + else if (!_cups_strcasecmp(val, "single")) doc->page_border = PSTOPS_BORDERSINGLE; - else if (!strcasecmp(val, "single-thick")) + else if (!_cups_strcasecmp(val, "single-thick")) doc->page_border = PSTOPS_BORDERSINGLE2; - else if (!strcasecmp(val, "double")) + else if (!_cups_strcasecmp(val, "double")) doc->page_border = PSTOPS_BORDERDOUBLE; - else if (!strcasecmp(val, "double-thick")) + else if (!_cups_strcasecmp(val, "double-thick")) doc->page_border = PSTOPS_BORDERDOUBLE2; else { @@ -2723,7 +2685,7 @@ set_pstops_options( doc->slow_collate = 1; if ((choice = ppdFindMarkedChoice(ppd, "Collate")) != NULL && - !strcasecmp(choice->choice, "True")) + !_cups_strcasecmp(choice->choice, "True")) { /* * Hardware collate option is selected, see if the option is @@ -2749,7 +2711,7 @@ set_pstops_options( if (Duplex && (doc->slow_collate || doc->slow_order || ((attr = ppdFindAttr(ppd, "cupsEvenDuplex", NULL)) != NULL && - attr->value && !strcasecmp(attr->value, "true")))) + attr->value && !_cups_strcasecmp(attr->value, "true")))) doc->slow_duplex = 1; else doc->slow_duplex = 0; diff --git a/filter/textcommon.c b/filter/textcommon.c index 9c66e63f4..8101cafba 100644 --- a/filter/textcommon.c +++ b/filter/textcommon.c @@ -3,7 +3,7 @@ * * Common text filter routines for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -548,8 +548,8 @@ TextMain(const char *name, /* I - Name of filter */ num_options = cupsParseOptions(argv[5], 0, &options); if ((val = cupsGetOption("prettyprint", num_options, options)) != NULL && - strcasecmp(val, "no") && strcasecmp(val, "off") && - strcasecmp(val, "false")) + _cups_strcasecmp(val, "no") && _cups_strcasecmp(val, "off") && + _cups_strcasecmp(val, "false")) { PageLeft = 72.0f; PageRight = PageWidth - 36.0f; @@ -564,25 +564,25 @@ TextMain(const char *name, /* I - Name of filter */ NumKeywords = 0; Keywords = NULL; } - else if (strcasecmp(val, "application/x-cshell") == 0) + else if (_cups_strcasecmp(val, "application/x-cshell") == 0) { PrettyPrint = PRETTY_SHELL; NumKeywords = sizeof(csh_keywords) / sizeof(csh_keywords[0]); Keywords = csh_keywords; } - else if (strcasecmp(val, "application/x-csource") == 0) + else if (_cups_strcasecmp(val, "application/x-csource") == 0) { PrettyPrint = PRETTY_CODE; NumKeywords = sizeof(code_keywords) / sizeof(code_keywords[0]); Keywords = code_keywords; } - else if (strcasecmp(val, "application/x-perl") == 0) + else if (_cups_strcasecmp(val, "application/x-perl") == 0) { PrettyPrint = PRETTY_PERL; NumKeywords = sizeof(perl_keywords) / sizeof(perl_keywords[0]); Keywords = perl_keywords; } - else if (strcasecmp(val, "application/x-shell") == 0) + else if (_cups_strcasecmp(val, "application/x-shell") == 0) { PrettyPrint = PRETTY_SHELL; NumKeywords = sizeof(sh_keywords) / sizeof(sh_keywords[0]); @@ -601,8 +601,8 @@ TextMain(const char *name, /* I - Name of filter */ if ((val = cupsGetOption("wrap", num_options, options)) == NULL) WrapLines = 1; else - WrapLines = !strcasecmp(val, "true") || !strcasecmp(val, "on") || - !strcasecmp(val, "yes"); + WrapLines = !_cups_strcasecmp(val, "true") || !_cups_strcasecmp(val, "on") || + !_cups_strcasecmp(val, "yes"); if ((val = cupsGetOption("columns", num_options, options)) != NULL) { @@ -1092,7 +1092,7 @@ TextMain(const char *name, /* I - Name of filter */ } column ++; - break; + break; } /* diff --git a/man/cupsd.conf.man.in b/man/cupsd.conf.man.in index a026cf637..c941c02db 100644 --- a/man/cupsd.conf.man.in +++ b/man/cupsd.conf.man.in @@ -12,7 +12,7 @@ .\" which should have been included with this file. If this file is .\" file is missing or damaged, see the license at "http://www.cups.org/". .\" -.TH cupsd.conf 5 "CUPS" "5 November 2010" "Apple Inc." +.TH cupsd.conf 5 "CUPS" "18 May 2011" "Apple Inc." .SH NAME cupsd.conf \- server configuration file for cups .SH DESCRIPTION @@ -645,7 +645,9 @@ ServerAdmin user@domain.com .br Specifies the email address of the server administrator. .TP 5 -ServerAlias hostname +ServerAlias hostname [... hostname] +.TP 5 +ServerAlias * .br Specifies an alternate name that the server is known by. The special name "*" allows any name to be used. diff --git a/notifier/mailto.c b/notifier/mailto.c index 606800af0..7ee15519d 100644 --- a/notifier/mailto.c +++ b/notifier/mailto.c @@ -453,21 +453,21 @@ load_configuration(void) return (0); } - if (!strcasecmp(line, "Cc")) + if (!_cups_strcasecmp(line, "Cc")) strlcpy(mailtoCc, value, sizeof(mailtoCc)); - else if (!strcasecmp(line, "From")) + else if (!_cups_strcasecmp(line, "From")) strlcpy(mailtoFrom, value, sizeof(mailtoFrom)); - else if (!strcasecmp(line, "Sendmail")) + else if (!_cups_strcasecmp(line, "Sendmail")) { strlcpy(mailtoSendmail, value, sizeof(mailtoSendmail)); mailtoSMTPServer[0] = '\0'; } - else if (!strcasecmp(line, "SMTPServer")) + else if (!_cups_strcasecmp(line, "SMTPServer")) { mailtoSendmail[0] = '\0'; strlcpy(mailtoSMTPServer, value, sizeof(mailtoSMTPServer)); } - else if (!strcasecmp(line, "Subject")) + else if (!_cups_strcasecmp(line, "Subject")) strlcpy(mailtoSubject, value, sizeof(mailtoSubject)); else { diff --git a/ppdc/genstrings.cxx b/ppdc/genstrings.cxx index 76b3e3f82..d08416d32 100644 --- a/ppdc/genstrings.cxx +++ b/ppdc/genstrings.cxx @@ -7,7 +7,7 @@ // the standard media and sample driver strings. The results are picked up // by GNU gettext and placed in the CUPS message catalog. // -// Copyright 2008-2010 by Apple Inc. +// Copyright 2008-2011 by Apple Inc. // // These coded instructions, statements, and computer programs are the // property of Apple Inc. and are protected by Federal copyright @@ -126,7 +126,7 @@ add_ui_strings(ppdcDriver *d, // I - Driver data if (!g->options->count) continue; - if (strcasecmp(g->name->value, "General")) + if (_cups_strcasecmp(g->name->value, "General")) catalog->add_message(g->text->value); for (o = (ppdcOption *)g->options->first(); diff --git a/ppdc/ppdc-driver.cxx b/ppdc/ppdc-driver.cxx index 98545c6e1..c9a7a1c96 100644 --- a/ppdc/ppdc-driver.cxx +++ b/ppdc/ppdc-driver.cxx @@ -3,7 +3,7 @@ // // PPD file compiler definitions for the CUPS PPD Compiler. // -// Copyright 2007-2010 by Apple Inc. +// Copyright 2007-2011 by Apple Inc. // Copyright 2002-2006 by Easy Software Products. // // These coded instructions, statements, and computer programs are the @@ -208,7 +208,7 @@ ppdcDriver::find_group(const char *n) // I - Group name for (g = (ppdcGroup *)groups->first(); g; g = (ppdcGroup *)groups->next()) - if (!strcasecmp(n, g->name->value)) + if (!_cups_strcasecmp(n, g->name->value)) return (g); return (0); @@ -241,7 +241,7 @@ ppdcDriver::find_option_group( for (g = (ppdcGroup *)groups->first(); g; g = (ppdcGroup *)groups->next()) for (o = (ppdcOption *)g->options->first(); o; o = (ppdcOption *)g->options->next()) - if (!strcasecmp(n, o->name->value)) + if (!_cups_strcasecmp(n, o->name->value)) { if (mg) *mg = g; @@ -475,7 +475,7 @@ ppdcDriver::write_ppd_file( if ((a = find_attr("ModelName", NULL)) != NULL) cupsFilePrintf(fp, "*ModelName: \"%s\"%s", catalog->find_message(a->value->value), lf); - else if (strncasecmp(model_name->value, manufacturer->value, + else if (_cups_strncasecmp(model_name->value, manufacturer->value, strlen(manufacturer->value))) cupsFilePrintf(fp, "*ModelName: \"%s %s\"%s", catalog->find_message(manufacturer->value), @@ -487,7 +487,7 @@ ppdcDriver::write_ppd_file( if ((a = find_attr("ShortNickName", NULL)) != NULL) cupsFilePrintf(fp, "*ShortNickName: \"%s\"%s", catalog->find_message(a->value->value), lf); - else if (strncasecmp(model_name->value, manufacturer->value, + else if (_cups_strncasecmp(model_name->value, manufacturer->value, strlen(manufacturer->value))) cupsFilePrintf(fp, "*ShortNickName: \"%s %s\"%s", catalog->find_message(manufacturer->value), @@ -499,7 +499,7 @@ ppdcDriver::write_ppd_file( if ((a = find_attr("NickName", NULL)) != NULL) cupsFilePrintf(fp, "*NickName: \"%s\"%s", catalog->find_message(a->value->value), lf); - else if (strncasecmp(model_name->value, manufacturer->value, + else if (_cups_strncasecmp(model_name->value, manufacturer->value, strlen(manufacturer->value))) cupsFilePrintf(fp, "*NickName: \"%s %s, %s\"%s", catalog->find_message(manufacturer->value), @@ -1014,7 +1014,7 @@ ppdcDriver::write_ppd_file( if (!g->options->count) continue; - if (strcasecmp(g->name->value, "General")) + if (_cups_strcasecmp(g->name->value, "General")) cupsFilePrintf(fp, "*OpenGroup: %s/%s%s", g->name->value, catalog->find_message(g->text->value), lf); @@ -1148,7 +1148,7 @@ ppdcDriver::write_ppd_file( } } - if (strcasecmp(g->name->value, "General")) + if (_cups_strcasecmp(g->name->value, "General")) cupsFilePrintf(fp, "*CloseGroup: %s%s", g->name->value, lf); } @@ -1181,7 +1181,7 @@ ppdcDriver::write_ppd_file( cupsFilePrintf(fp, "*%s.Translation ModelName/%s: \"\"%s", locale->value, locatalog->find_message(a->value->value), lf); - else if (strncasecmp(model_name->value, manufacturer->value, + else if (_cups_strncasecmp(model_name->value, manufacturer->value, strlen(manufacturer->value))) cupsFilePrintf(fp, "*%s.Translation ModelName/%s %s: \"\"%s", locale->value, @@ -1196,7 +1196,7 @@ ppdcDriver::write_ppd_file( cupsFilePrintf(fp, "*%s.Translation ShortNickName/%s: \"\"%s", locale->value, locatalog->find_message(a->value->value), lf); - else if (strncasecmp(model_name->value, manufacturer->value, + else if (_cups_strncasecmp(model_name->value, manufacturer->value, strlen(manufacturer->value))) cupsFilePrintf(fp, "*%s.Translation ShortNickName/%s %s: \"\"%s", locale->value, @@ -1211,7 +1211,7 @@ ppdcDriver::write_ppd_file( cupsFilePrintf(fp, "*%s.Translation NickName/%s: \"\"%s", locale->value, locatalog->find_message(a->value->value), lf); - else if (strncasecmp(model_name->value, manufacturer->value, + else if (_cups_strncasecmp(model_name->value, manufacturer->value, strlen(manufacturer->value))) cupsFilePrintf(fp, "*%s.Translation NickName/%s %s, %s: \"\"%s", locale->value, @@ -1243,7 +1243,7 @@ ppdcDriver::write_ppd_file( if (!g->options->count) continue; - if (strcasecmp(g->name->value, "General")) + if (_cups_strcasecmp(g->name->value, "General")) cupsFilePrintf(fp, "*%s.Translation %s/%s: \"\"%s", locale->value, g->name->value, locatalog->find_message(g->text->value), lf); diff --git a/ppdc/ppdc-group.cxx b/ppdc/ppdc-group.cxx index 413a8f28a..cc0ab280a 100644 --- a/ppdc/ppdc-group.cxx +++ b/ppdc/ppdc-group.cxx @@ -3,7 +3,7 @@ // // Group class for the CUPS PPD Compiler. // -// Copyright 2007-2009 by Apple Inc. +// Copyright 2007-2011 by Apple Inc. // Copyright 2002-2005 by Easy Software Products. // // These coded instructions, statements, and computer programs are the @@ -91,7 +91,7 @@ ppdcGroup::find_option(const char *n) // I - Name of option for (o = (ppdcOption *)options->first(); o; o = (ppdcOption *)options->next()) - if (!strcasecmp(n, o->name->value)) + if (!_cups_strcasecmp(n, o->name->value)) return (o); return (0); diff --git a/ppdc/ppdc-import.cxx b/ppdc/ppdc-import.cxx index e4604600d..4794e7715 100644 --- a/ppdc/ppdc-import.cxx +++ b/ppdc/ppdc-import.cxx @@ -3,7 +3,7 @@ // // PPD file import methods for the CUPS PPD Compiler. // -// Copyright 2007-2010 by Apple Inc. +// Copyright 2007-2011 by Apple Inc. // Copyright 2002-2006 by Easy Software Products. // // These coded instructions, statements, and computer programs are the @@ -101,7 +101,7 @@ ppdcSource::import_ppd(const char *f) // I - Filename // Then add the stuff from the PPD file... if (ppd->modelname && ppd->manufacturer && - !strncasecmp(ppd->modelname, ppd->manufacturer, + !_cups_strncasecmp(ppd->modelname, ppd->manufacturer, strlen(ppd->manufacturer))) { ptr = ppd->modelname + strlen(ppd->manufacturer); @@ -171,7 +171,7 @@ ppdcSource::import_ppd(const char *f) // I - Filename for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++) { // Don't do custom size here... - if (!strcasecmp(size->name, "Custom")) + if (!_cups_strcasecmp(size->name, "Custom")) continue; // Get the code for the PageSize and PageRegion options... @@ -187,7 +187,7 @@ ppdcSource::import_ppd(const char *f) // I - Filename driver->add_size(csize); - if (!strcasecmp(size_option->defchoice, size->name)) + if (!_cups_strcasecmp(size_option->defchoice, size->name)) driver->set_default_size(csize); } @@ -215,7 +215,7 @@ ppdcSource::import_ppd(const char *f) // I - Filename cchoice = new ppdcChoice(choice->choice, choice->text, choice->code); coption->add_choice(cchoice); - if (!strcasecmp(option->defchoice, choice->choice)) + if (!_cups_strcasecmp(option->defchoice, choice->choice)) coption->set_defchoice(cchoice); } } diff --git a/ppdc/ppdc-option.cxx b/ppdc/ppdc-option.cxx index c495264ba..e80df3c87 100644 --- a/ppdc/ppdc-option.cxx +++ b/ppdc/ppdc-option.cxx @@ -3,7 +3,7 @@ // // Option class for the CUPS PPD Compiler. // -// Copyright 2007-2009 by Apple Inc. +// Copyright 2007-2011 by Apple Inc. // Copyright 2002-2005 by Easy Software Products. // // These coded instructions, statements, and computer programs are the @@ -100,7 +100,7 @@ ppdcOption::find_choice(const char *n) // I - Name of choice for (c = (ppdcChoice *)choices->first(); c; c = (ppdcChoice *)choices->next()) - if (!strcasecmp(n, c->name->value)) + if (!_cups_strcasecmp(n, c->name->value)) return (c); return (0); diff --git a/ppdc/ppdc-source.cxx b/ppdc/ppdc-source.cxx index 3fa7c2e2b..43084498b 100644 --- a/ppdc/ppdc-source.cxx +++ b/ppdc/ppdc-source.cxx @@ -3,7 +3,7 @@ // // Source class for the CUPS PPD Compiler. // -// Copyright 2007-2010 by Apple Inc. +// Copyright 2007-2011 by Apple Inc. // Copyright 2002-2007 by Easy Software Products. // // These coded instructions, statements, and computer programs are the @@ -189,7 +189,7 @@ ppdcSource::find_driver(const char *f) // I - Driver file name for (d = (ppdcDriver *)drivers->first(); d; d = (ppdcDriver *)drivers->next()) - if (!strcasecmp(f, d->pc_file_name->value)) + if (!_cups_strcasecmp(f, d->pc_file_name->value)) return (d); return (NULL); @@ -289,7 +289,7 @@ ppdcSource::find_po(const char *l) // I - Locale name for (cat = (ppdcCatalog *)po_files->first(); cat; cat = (ppdcCatalog *)po_files->next()) - if (!strcasecmp(l, cat->locale->value)) + if (!_cups_strcasecmp(l, cat->locale->value)) return (cat); return (NULL); @@ -307,7 +307,7 @@ ppdcSource::find_size(const char *s) // I - Size name for (m = (ppdcMediaSize *)sizes->first(); m; m = (ppdcMediaSize *)sizes->next()) - if (!strcasecmp(s, m->name->value)) + if (!_cups_strcasecmp(s, m->name->value)) return (m); return (NULL); @@ -325,7 +325,7 @@ ppdcSource::find_variable(const char *n)// I - Variable name for (v = (ppdcVariable *)vars->first(); v; v = (ppdcVariable *)vars->next()) - if (!strcasecmp(n, v->name->value)) + if (!_cups_strcasecmp(n, v->name->value)) return (v); return (NULL); @@ -398,13 +398,13 @@ ppdcSource::get_boolean(ppdcFile *fp) // I - File to read return (-1); } - if (!strcasecmp(buffer, "on") || - !strcasecmp(buffer, "yes") || - !strcasecmp(buffer, "true")) + if (!_cups_strcasecmp(buffer, "on") || + !_cups_strcasecmp(buffer, "yes") || + !_cups_strcasecmp(buffer, "true")) return (1); - else if (!strcasecmp(buffer, "off") || - !strcasecmp(buffer, "no") || - !strcasecmp(buffer, "false")) + else if (!_cups_strcasecmp(buffer, "off") || + !_cups_strcasecmp(buffer, "no") || + !_cups_strcasecmp(buffer, "false")) return (0); else { @@ -537,12 +537,12 @@ int // O - Color order value ppdcSource::get_color_order( const char *co) // I - Color order string { - if (!strcasecmp(co, "chunked") || - !strcasecmp(co, "chunky")) + if (!_cups_strcasecmp(co, "chunked") || + !_cups_strcasecmp(co, "chunky")) return (CUPS_ORDER_CHUNKED); - else if (!strcasecmp(co, "banded")) + else if (!_cups_strcasecmp(co, "banded")) return (CUPS_ORDER_BANDED); - else if (!strcasecmp(co, "planar")) + else if (!_cups_strcasecmp(co, "planar")) return (CUPS_ORDER_PLANAR); else return (-1); @@ -599,71 +599,71 @@ int // O - Colorspace value ppdcSource::get_color_space( const char *cs) // I - Colorspace string { - if (!strcasecmp(cs, "w")) + if (!_cups_strcasecmp(cs, "w")) return (CUPS_CSPACE_W); - else if (!strcasecmp(cs, "rgb")) + else if (!_cups_strcasecmp(cs, "rgb")) return (CUPS_CSPACE_RGB); - else if (!strcasecmp(cs, "rgba")) + else if (!_cups_strcasecmp(cs, "rgba")) return (CUPS_CSPACE_RGBA); - else if (!strcasecmp(cs, "k")) + else if (!_cups_strcasecmp(cs, "k")) return (CUPS_CSPACE_K); - else if (!strcasecmp(cs, "cmy")) + else if (!_cups_strcasecmp(cs, "cmy")) return (CUPS_CSPACE_CMY); - else if (!strcasecmp(cs, "ymc")) + else if (!_cups_strcasecmp(cs, "ymc")) return (CUPS_CSPACE_YMC); - else if (!strcasecmp(cs, "cmyk")) + else if (!_cups_strcasecmp(cs, "cmyk")) return (CUPS_CSPACE_CMYK); - else if (!strcasecmp(cs, "ymck")) + else if (!_cups_strcasecmp(cs, "ymck")) return (CUPS_CSPACE_YMCK); - else if (!strcasecmp(cs, "kcmy")) + else if (!_cups_strcasecmp(cs, "kcmy")) return (CUPS_CSPACE_KCMY); - else if (!strcasecmp(cs, "kcmycm")) + else if (!_cups_strcasecmp(cs, "kcmycm")) return (CUPS_CSPACE_KCMYcm); - else if (!strcasecmp(cs, "gmck")) + else if (!_cups_strcasecmp(cs, "gmck")) return (CUPS_CSPACE_GMCK); - else if (!strcasecmp(cs, "gmcs")) + else if (!_cups_strcasecmp(cs, "gmcs")) return (CUPS_CSPACE_GMCS); - else if (!strcasecmp(cs, "white")) + else if (!_cups_strcasecmp(cs, "white")) return (CUPS_CSPACE_WHITE); - else if (!strcasecmp(cs, "gold")) + else if (!_cups_strcasecmp(cs, "gold")) return (CUPS_CSPACE_GOLD); - else if (!strcasecmp(cs, "silver")) + else if (!_cups_strcasecmp(cs, "silver")) return (CUPS_CSPACE_SILVER); - else if (!strcasecmp(cs, "CIEXYZ")) + else if (!_cups_strcasecmp(cs, "CIEXYZ")) return (CUPS_CSPACE_CIEXYZ); - else if (!strcasecmp(cs, "CIELab")) + else if (!_cups_strcasecmp(cs, "CIELab")) return (CUPS_CSPACE_CIELab); - else if (!strcasecmp(cs, "RGBW")) + else if (!_cups_strcasecmp(cs, "RGBW")) return (CUPS_CSPACE_RGBW); - else if (!strcasecmp(cs, "ICC1")) + else if (!_cups_strcasecmp(cs, "ICC1")) return (CUPS_CSPACE_ICC1); - else if (!strcasecmp(cs, "ICC2")) + else if (!_cups_strcasecmp(cs, "ICC2")) return (CUPS_CSPACE_ICC2); - else if (!strcasecmp(cs, "ICC3")) + else if (!_cups_strcasecmp(cs, "ICC3")) return (CUPS_CSPACE_ICC3); - else if (!strcasecmp(cs, "ICC4")) + else if (!_cups_strcasecmp(cs, "ICC4")) return (CUPS_CSPACE_ICC4); - else if (!strcasecmp(cs, "ICC5")) + else if (!_cups_strcasecmp(cs, "ICC5")) return (CUPS_CSPACE_ICC5); - else if (!strcasecmp(cs, "ICC6")) + else if (!_cups_strcasecmp(cs, "ICC6")) return (CUPS_CSPACE_ICC6); - else if (!strcasecmp(cs, "ICC7")) + else if (!_cups_strcasecmp(cs, "ICC7")) return (CUPS_CSPACE_ICC7); - else if (!strcasecmp(cs, "ICC8")) + else if (!_cups_strcasecmp(cs, "ICC8")) return (CUPS_CSPACE_ICC8); - else if (!strcasecmp(cs, "ICC9")) + else if (!_cups_strcasecmp(cs, "ICC9")) return (CUPS_CSPACE_ICC9); - else if (!strcasecmp(cs, "ICCA")) + else if (!_cups_strcasecmp(cs, "ICCA")) return (CUPS_CSPACE_ICCA); - else if (!strcasecmp(cs, "ICCB")) + else if (!_cups_strcasecmp(cs, "ICCB")) return (CUPS_CSPACE_ICCB); - else if (!strcasecmp(cs, "ICCC")) + else if (!_cups_strcasecmp(cs, "ICCC")) return (CUPS_CSPACE_ICCC); - else if (!strcasecmp(cs, "ICCD")) + else if (!_cups_strcasecmp(cs, "ICCD")) return (CUPS_CSPACE_ICCD); - else if (!strcasecmp(cs, "ICCE")) + else if (!_cups_strcasecmp(cs, "ICCE")) return (CUPS_CSPACE_ICCE); - else if (!strcasecmp(cs, "ICCF")) + else if (!_cups_strcasecmp(cs, "ICCF")) return (CUPS_CSPACE_ICCF); else return (-1); @@ -833,8 +833,8 @@ ppdcSource::get_duplex(ppdcFile *fp, // I - File to read from if (cond_state) return; - if (!strcasecmp(temp, "none") || !strcasecmp(temp, "false") || - !strcasecmp(temp, "no") || !strcasecmp(temp, "off")) + if (!_cups_strcasecmp(temp, "none") || !_cups_strcasecmp(temp, "false") || + !_cups_strcasecmp(temp, "no") || !_cups_strcasecmp(temp, "off")) { g = d->find_group("General"); if ((o = g->find_option("Duplex")) != NULL) @@ -849,10 +849,10 @@ ppdcSource::get_duplex(ppdcFile *fp, // I - File to read from break; } } - else if (!strcasecmp(temp, "normal") || !strcasecmp(temp, "true") || - !strcasecmp(temp, "yes") || !strcasecmp(temp, "on") || - !strcasecmp(temp, "flip") || !strcasecmp(temp, "rotated") || - !strcasecmp(temp, "manualtumble")) + else if (!_cups_strcasecmp(temp, "normal") || !_cups_strcasecmp(temp, "true") || + !_cups_strcasecmp(temp, "yes") || !_cups_strcasecmp(temp, "on") || + !_cups_strcasecmp(temp, "flip") || !_cups_strcasecmp(temp, "rotated") || + !_cups_strcasecmp(temp, "manualtumble")) { g = d->find_group("General"); o = g->find_option("Duplex"); @@ -860,7 +860,7 @@ ppdcSource::get_duplex(ppdcFile *fp, // I - File to read from if (!o) { o = new ppdcOption(PPDC_PICKONE, "Duplex", "2-Sided Printing", - !strcasecmp(temp, "flip") ? PPDC_SECTION_PAGE : + !_cups_strcasecmp(temp, "flip") ? PPDC_SECTION_PAGE : PPDC_SECTION_ANY, 10.0f); o->add_choice(new ppdcChoice("None", "Off (1-Sided)", "<</Duplex false>>setpagedevice")); @@ -877,12 +877,12 @@ ppdcSource::get_duplex(ppdcFile *fp, // I - File to read from attr = (ppdcAttr *)d->attrs->next()) if (!strcmp(attr->name->value, "cupsFlipDuplex")) { - if (strcasecmp(temp, "flip")) + if (_cups_strcasecmp(temp, "flip")) d->attrs->remove(attr); break; } - if (!strcasecmp(temp, "flip") && !attr) + if (!_cups_strcasecmp(temp, "flip") && !attr) d->add_attr(new ppdcAttr("cupsFlipDuplex", NULL, NULL, "true")); for (attr = (ppdcAttr *)d->attrs->first(); @@ -894,11 +894,11 @@ ppdcSource::get_duplex(ppdcFile *fp, // I - File to read from break; } - if (!strcasecmp(temp, "flip")) + if (!_cups_strcasecmp(temp, "flip")) d->add_attr(new ppdcAttr("cupsBackSide", NULL, NULL, "Flipped")); - else if (!strcasecmp(temp, "rotated")) + else if (!_cups_strcasecmp(temp, "rotated")) d->add_attr(new ppdcAttr("cupsBackSide", NULL, NULL, "Rotated")); - else if (!strcasecmp(temp, "manualtumble")) + else if (!_cups_strcasecmp(temp, "manualtumble")) d->add_attr(new ppdcAttr("cupsBackSide", NULL, NULL, "ManualTumble")); else d->add_attr(new ppdcAttr("cupsBackSide", NULL, NULL, "Normal")); @@ -1105,9 +1105,9 @@ ppdcSource::get_font(ppdcFile *fp) // I - File to read return (0); } - if (!strcasecmp(temp, "ROM")) + if (!_cups_strcasecmp(temp, "ROM")) status = PPDC_FONT_ROM; - else if (!strcasecmp(temp, "Disk")) + else if (!_cups_strcasecmp(temp, "Disk")) status = PPDC_FONT_DISK; else { @@ -1530,17 +1530,17 @@ ppdcSource::get_measurement(ppdcFile *fp) val = (float)strtod(buffer, &ptr); // Check for a trailing unit specifier... - if (!strcasecmp(ptr, "mm")) + if (!_cups_strcasecmp(ptr, "mm")) val *= 72.0f / 25.4f; - else if (!strcasecmp(ptr, "cm")) + else if (!_cups_strcasecmp(ptr, "cm")) val *= 72.0f / 2.54f; - else if (!strcasecmp(ptr, "m")) + else if (!_cups_strcasecmp(ptr, "m")) val *= 72.0f / 0.0254f; - else if (!strcasecmp(ptr, "in")) + else if (!_cups_strcasecmp(ptr, "in")) val *= 72.0f; - else if (!strcasecmp(ptr, "ft")) + else if (!_cups_strcasecmp(ptr, "ft")) val *= 72.0f * 12.0f; - else if (strcasecmp(ptr, "pt") && *ptr) + else if (_cups_strcasecmp(ptr, "pt") && *ptr) return (-1.0f); return (val); @@ -1589,11 +1589,11 @@ ppdcSource::get_option(ppdcFile *fp, // I - File to read return (NULL); } - if (!strcasecmp(type, "boolean")) + if (!_cups_strcasecmp(type, "boolean")) ot = PPDC_BOOLEAN; - else if (!strcasecmp(type, "pickone")) + else if (!_cups_strcasecmp(type, "pickone")) ot = PPDC_PICKONE; - else if (!strcasecmp(type, "pickmany")) + else if (!_cups_strcasecmp(type, "pickmany")) ot = PPDC_PICKMANY; else { @@ -1611,17 +1611,17 @@ ppdcSource::get_option(ppdcFile *fp, // I - File to read return (NULL); } - if (!strcasecmp(type, "AnySetup")) + if (!_cups_strcasecmp(type, "AnySetup")) section = PPDC_SECTION_ANY; - else if (!strcasecmp(type, "DocumentSetup")) + else if (!_cups_strcasecmp(type, "DocumentSetup")) section = PPDC_SECTION_DOCUMENT; - else if (!strcasecmp(type, "ExitServer")) + else if (!_cups_strcasecmp(type, "ExitServer")) section = PPDC_SECTION_EXIT; - else if (!strcasecmp(type, "JCLSetup")) + else if (!_cups_strcasecmp(type, "JCLSetup")) section = PPDC_SECTION_JCL; - else if (!strcasecmp(type, "PageSetup")) + else if (!_cups_strcasecmp(type, "PageSetup")) section = PPDC_SECTION_PAGE; - else if (!strcasecmp(type, "Prolog")) + else if (!_cups_strcasecmp(type, "Prolog")) section = PPDC_SECTION_PROLOG; else { @@ -2313,7 +2313,7 @@ ppdcSource::quotef(cups_file_t *fp, // I - File to write to bytes += cupsFilePrintf(fp, tformat, va_arg(ap, int)); break; - + case 'p' : // Pointer value if ((format - bufformat + 1) > (int)sizeof(tformat)) break; @@ -2468,17 +2468,17 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read isdefault = 0; } - if (!strcasecmp(temp, "}")) + if (!_cups_strcasecmp(temp, "}")) { // Close this one out... break; } - else if (!strcasecmp(temp, "{")) + else if (!_cups_strcasecmp(temp, "{")) { // Open a new child... scan_file(fp, d); } - else if (!strcasecmp(temp, "#if")) + else if (!_cups_strcasecmp(temp, "#if")) { if ((cond_current - cond_stack) >= 100) { @@ -2497,7 +2497,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read cond_state |= PPDC_COND_SKIP; } } - else if (!strcasecmp(temp, "#elif")) + else if (!_cups_strcasecmp(temp, "#elif")) { if (cond_current == cond_stack) { @@ -2532,7 +2532,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read else cond_temp --; } - else if (!strcasecmp(temp, "#else")) + else if (!_cups_strcasecmp(temp, "#else")) { if (cond_current == cond_stack) { @@ -2562,7 +2562,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read else cond_temp --; } - else if (!strcasecmp(temp, "#endif")) + else if (!_cups_strcasecmp(temp, "#endif")) { if (cond_current == cond_stack) { @@ -2586,12 +2586,12 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read else cond_temp --; } - else if (!strcasecmp(temp, "#define")) + else if (!_cups_strcasecmp(temp, "#define")) { // Get the variable... get_variable(fp); } - else if (!strcasecmp(temp, "#include")) + else if (!_cups_strcasecmp(temp, "#include")) { // #include filename char basedir[1024], // Base directory @@ -2644,7 +2644,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read break; } } - else if (!strcasecmp(temp, "#media")) + else if (!_cups_strcasecmp(temp, "#media")) { ppdcMediaSize *m; // Media size @@ -2659,7 +2659,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read sizes->add(m); } } - else if (!strcasecmp(temp, "#po")) + else if (!_cups_strcasecmp(temp, "#po")) { ppdcCatalog *cat; // Message catalog @@ -2674,14 +2674,14 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read po_files->add(cat); } } - else if (!strcasecmp(temp, "Attribute") || - !strcasecmp(temp, "LocAttribute")) + else if (!_cups_strcasecmp(temp, "Attribute") || + !_cups_strcasecmp(temp, "LocAttribute")) { ppdcAttr *a; // Attribute // Get an attribute... - a = get_attr(fp, !strcasecmp(temp, "LocAttribute")); + a = get_attr(fp, !_cups_strcasecmp(temp, "LocAttribute")); if (a) { if (cond_state) @@ -2690,7 +2690,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read d->add_attr(a); } } - else if (!strcasecmp(temp, "Choice")) + else if (!_cups_strcasecmp(temp, "Choice")) { // Get a choice... c = get_choice(fp); @@ -2717,7 +2717,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (isdefault) o->set_defchoice(c); } - else if (!strcasecmp(temp, "ColorDevice")) + else if (!_cups_strcasecmp(temp, "ColorDevice")) { // ColorDevice boolean if (cond_state) @@ -2725,7 +2725,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read else d->color_device = get_boolean(fp); } - else if (!strcasecmp(temp, "ColorModel")) + else if (!_cups_strcasecmp(temp, "ColorModel")) { // Get the color model c = get_color_model(fp); @@ -2754,7 +2754,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read o = NULL; } - else if (!strcasecmp(temp, "ColorProfile")) + else if (!_cups_strcasecmp(temp, "ColorProfile")) { ppdcProfile *p; // Color profile @@ -2770,7 +2770,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read d->profiles->add(p); } } - else if (!strcasecmp(temp, "Copyright")) + else if (!_cups_strcasecmp(temp, "Copyright")) { // Copyright string char copytemp[8192], // Copyright string @@ -2799,7 +2799,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read d->copyright->add(new ppdcString(copyptr)); } } - else if (!strcasecmp(temp, "CustomMedia")) + else if (!_cups_strcasecmp(temp, "CustomMedia")) { ppdcMediaSize *m; // Media size @@ -2819,7 +2819,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (isdefault) d->set_default_size(m); } - else if (!strcasecmp(temp, "Cutter")) + else if (!_cups_strcasecmp(temp, "Cutter")) { // Cutter boolean int have_cutter; // Have a paper cutter? @@ -2846,7 +2846,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read o = NULL; } - else if (!strcasecmp(temp, "Darkness")) + else if (!_cups_strcasecmp(temp, "Darkness")) { // Get the darkness choice... c = get_generic(fp, "Darkness", NULL, "cupsCompression"); @@ -2884,7 +2884,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read o = NULL; } - else if (!strcasecmp(temp, "DriverType")) + else if (!_cups_strcasecmp(temp, "DriverType")) { int i; // Looping var @@ -2903,21 +2903,21 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read continue; for (i = 0; i < (int)(sizeof(driver_types) / sizeof(driver_types[0])); i ++) - if (!strcasecmp(temp, driver_types[i])) + if (!_cups_strcasecmp(temp, driver_types[i])) break; if (i < (int)(sizeof(driver_types) / sizeof(driver_types[0]))) d->type = (ppdcDrvType)i; - else if (!strcasecmp(temp, "dymo")) + else if (!_cups_strcasecmp(temp, "dymo")) d->type = PPDC_DRIVER_LABEL; else _cupsLangPrintf(stderr, _("ppdc: Unknown driver type %s on line %d of %s."), temp, fp->line, fp->filename); } - else if (!strcasecmp(temp, "Duplex")) + else if (!_cups_strcasecmp(temp, "Duplex")) get_duplex(fp, d); - else if (!strcasecmp(temp, "Filter")) + else if (!_cups_strcasecmp(temp, "Filter")) { ppdcFilter *f; // Filter @@ -2932,7 +2932,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read d->filters->add(f); } } - else if (!strcasecmp(temp, "Finishing")) + else if (!_cups_strcasecmp(temp, "Finishing")) { // Get the finishing choice... c = get_generic(fp, "Finishing", "OutputType", NULL); @@ -2970,8 +2970,8 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read o = NULL; } - else if (!strcasecmp(temp, "Font") || - !strcasecmp(temp, "#font")) + else if (!_cups_strcasecmp(temp, "Font") || + !_cups_strcasecmp(temp, "#font")) { ppdcFont *f; // Font @@ -2984,7 +2984,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read f->release(); else { - if (!strcasecmp(temp, "#font")) + if (!_cups_strcasecmp(temp, "#font")) base_fonts->add(f); else d->add_font(f); @@ -2994,7 +2994,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read } } } - else if (!strcasecmp(temp, "Group")) + else if (!_cups_strcasecmp(temp, "Group")) { // Get a group... ppdcGroup *tempg = get_group(fp, d); @@ -3015,7 +3015,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read g = tempg; } } - else if (!strcasecmp(temp, "HWMargins")) + else if (!_cups_strcasecmp(temp, "HWMargins")) { // HWMargins left bottom right top d->left_margin = get_measurement(fp); @@ -3023,7 +3023,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read d->right_margin = get_measurement(fp); d->top_margin = get_measurement(fp); } - else if (!strcasecmp(temp, "InputSlot")) + else if (!_cups_strcasecmp(temp, "InputSlot")) { // Get the input slot choice... c = get_generic(fp, "InputSlot", NULL, "MediaPosition"); @@ -3037,7 +3037,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read } // Add the choice to the InputSlot option... - + if ((o = d->find_option_group("InputSlot", &mg)) == NULL) { // Create the InputSlot option... @@ -3063,7 +3063,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read o = NULL; } - else if (!strcasecmp(temp, "Installable")) + else if (!_cups_strcasecmp(temp, "Installable")) { // Get the installable option... o = get_installable(fp); @@ -3079,7 +3079,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read o = NULL; } } - else if (!strcasecmp(temp, "ManualCopies")) + else if (!_cups_strcasecmp(temp, "ManualCopies")) { // ManualCopies boolean if (cond_state) @@ -3087,7 +3087,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read else d->manual_copies = get_boolean(fp); } - else if (!strcasecmp(temp, "Manufacturer")) + else if (!_cups_strcasecmp(temp, "Manufacturer")) { // Manufacturer name char name[256]; // Model name string @@ -3104,7 +3104,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (!cond_state) d->set_manufacturer(name); } - else if (!strcasecmp(temp, "MaxSize")) + else if (!_cups_strcasecmp(temp, "MaxSize")) { // MaxSize width length if (cond_state) @@ -3118,7 +3118,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read d->max_length = get_measurement(fp); } } - else if (!strcasecmp(temp, "MediaSize")) + else if (!_cups_strcasecmp(temp, "MediaSize")) { // MediaSize keyword char name[41]; // Media size name @@ -3157,7 +3157,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (isdefault) d->set_default_size(dm); } - else if (!strcasecmp(temp, "MediaType")) + else if (!_cups_strcasecmp(temp, "MediaType")) { // Get the media type choice... c = get_generic(fp, "MediaType", "MediaType", "cupsMediaType"); @@ -3196,7 +3196,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read o = NULL; } - else if (!strcasecmp(temp, "MinSize")) + else if (!_cups_strcasecmp(temp, "MinSize")) { // MinSize width length if (cond_state) @@ -3210,7 +3210,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read d->min_length = get_measurement(fp); } } - else if (!strcasecmp(temp, "ModelName")) + else if (!_cups_strcasecmp(temp, "ModelName")) { // ModelName name char name[256]; // Model name string @@ -3227,7 +3227,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (!cond_state) d->set_model_name(name); } - else if (!strcasecmp(temp, "ModelNumber")) + else if (!_cups_strcasecmp(temp, "ModelNumber")) { // ModelNumber number if (cond_state) @@ -3235,7 +3235,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read else d->model_number = get_integer(fp); } - else if (!strcasecmp(temp, "Option")) + else if (!_cups_strcasecmp(temp, "Option")) { // Get an option... ppdcOption *tempo = get_option(fp, d, g); @@ -3256,7 +3256,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read o = tempo; } } - else if (!strcasecmp(temp, "FileName")) + else if (!_cups_strcasecmp(temp, "FileName")) { // FileName name char name[256]; // Filename string @@ -3273,7 +3273,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (!cond_state) d->set_file_name(name); } - else if (!strcasecmp(temp, "PCFileName")) + else if (!_cups_strcasecmp(temp, "PCFileName")) { // PCFileName name char name[256]; // PC filename string @@ -3290,7 +3290,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read if (!cond_state) d->set_pc_file_name(name); } - else if (!strcasecmp(temp, "Resolution")) + else if (!_cups_strcasecmp(temp, "Resolution")) { // Get the resolution choice... c = get_resolution(fp); @@ -3329,7 +3329,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read o = NULL; } - else if (!strcasecmp(temp, "SimpleColorProfile")) + else if (!_cups_strcasecmp(temp, "SimpleColorProfile")) { ppdcProfile *p; // Color profile @@ -3345,7 +3345,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read d->profiles->add(p); } } - else if (!strcasecmp(temp, "Throughput")) + else if (!_cups_strcasecmp(temp, "Throughput")) { // Throughput number if (cond_state) @@ -3353,7 +3353,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read else d->throughput = get_integer(fp); } - else if (!strcasecmp(temp, "UIConstraints")) + else if (!_cups_strcasecmp(temp, "UIConstraints")) { ppdcConstraint *con; // Constraint @@ -3368,7 +3368,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read d->constraints->add(con); } } - else if (!strcasecmp(temp, "VariablePaperSize")) + else if (!_cups_strcasecmp(temp, "VariablePaperSize")) { // VariablePaperSize boolean if (cond_state) @@ -3376,7 +3376,7 @@ ppdcSource::scan_file(ppdcFile *fp, // I - File to read else d->variable_paper_size = get_boolean(fp); } - else if (!strcasecmp(temp, "Version")) + else if (!_cups_strcasecmp(temp, "Version")) { // Version string char name[256]; // Model name string diff --git a/ppdc/ppdc.cxx b/ppdc/ppdc.cxx index 52b88dfa8..d8d128db8 100644 --- a/ppdc/ppdc.cxx +++ b/ppdc/ppdc.cxx @@ -80,7 +80,7 @@ main(int argc, // I - Number of command-line arguments src = new ppdcSource(); use_model_name = 0; verbose = 0; - filenames = cupsArrayNew((cups_array_func_t)strcasecmp, NULL); + filenames = cupsArrayNew((cups_array_func_t)_cups_strcasecmp, NULL); for (i = 1; i < argc; i ++) if (argv[i][0] == '-') @@ -213,7 +213,7 @@ main(int argc, // I - Number of command-line arguments case 'v' : // Be verbose... verbose ++; break; - + case 'z' : // Compress files... comp = 1; break; @@ -237,7 +237,7 @@ main(int argc, // I - Number of command-line arguments opt += strlen(opt) - 1; break; } - + default : // Unknown usage(); break; @@ -319,7 +319,7 @@ main(int argc, // I - Number of command-line arguments // Write the PPD file for this driver... if (use_model_name) { - if (!strncasecmp(d->model_name->value, d->manufacturer->value, + if (!_cups_strncasecmp(d->model_name->value, d->manufacturer->value, strlen(d->manufacturer->value))) { // Model name already starts with the manufacturer... diff --git a/ppdc/ppdmerge.cxx b/ppdc/ppdmerge.cxx index 923355c09..68f291673 100644 --- a/ppdc/ppdmerge.cxx +++ b/ppdc/ppdmerge.cxx @@ -104,18 +104,18 @@ main(int argc, // I - Number of command-line arguments ppd_status_t status; // PPD open status int curline, // Current line linenum; // Line number - - + + status = ppdLastError(&linenum); - + _cupsLangPrintf(stderr, _("%s: Unable to open PPD file: %s on line %d."), "ppdmerge", ppdErrorString(status), linenum); cupsFileRewind(infile); - + line[0] = '\0'; curline = 0; - + while (cupsFileGets(infile, line, sizeof(line))) { curline ++; @@ -128,7 +128,7 @@ main(int argc, // I - Number of command-line arguments cupsFileClose(infile); return (1); } - + // Figure out the locale... if ((locale = ppd_locale(ppd)) == NULL) { @@ -147,13 +147,13 @@ main(int argc, // I - Number of command-line arguments languages = _ppdGetLanguages(ppd); if (outname && !strcmp(inname, outname)) - { + { // Rename input filename so that we don't overwrite it... char bckname[1024]; // Backup filename - - + + snprintf(bckname, sizeof(bckname), "%s.bck", inname); - + if (rename(inname, bckname)) { _cupsLangPrintf(stderr, @@ -177,7 +177,7 @@ main(int argc, // I - Number of command-line arguments argv[i]); ppdClose(ppd); } - + // Close and move on... cupsFileClose(infile); } @@ -341,7 +341,7 @@ ppd_locale(ppd_file_t *ppd) // I - PPD file { vlen = strlen(languages[i].version); - if (!strncasecmp(ppd->lang_version, languages[i].version, vlen)) + if (!_cups_strncasecmp(ppd->lang_version, languages[i].version, vlen)) { if (ppd->lang_version[vlen] == '-' || ppd->lang_version[vlen] == '_') diff --git a/ppdc/ppdpo.cxx b/ppdc/ppdpo.cxx index 3ab2111e0..bdf0f7c05 100644 --- a/ppdc/ppdpo.cxx +++ b/ppdc/ppdpo.cxx @@ -190,7 +190,7 @@ add_ui_strings(ppdcDriver *d, // I - Driver data if (!g->options->count) continue; - if (strcasecmp(g->name->value, "General")) + if (_cups_strcasecmp(g->name->value, "General")) catalog->add_message(g->text->value); for (o = (ppdcOption *)g->options->first(); diff --git a/scheduler/auth.c b/scheduler/auth.c index d44357a08..83f90e5e7 100644 --- a/scheduler/auth.c +++ b/scheduler/auth.c @@ -252,7 +252,7 @@ cupsdAddNameMask(cups_array_t **masks, /* IO - Masks array (created as needed) * "cupsdAddNameMask(masks=%p(%p), name=\"%s\")", masks, *masks, name); - if (!strcasecmp(name, "@LOCAL")) + if (!_cups_strcasecmp(name, "@LOCAL")) { /* * Deny *interface*... @@ -261,7 +261,7 @@ cupsdAddNameMask(cups_array_t **masks, /* IO - Masks array (created as needed) * temp.type = CUPSD_AUTH_INTERFACE; temp.mask.name.name = (char *)"*"; } - else if (!strncasecmp(name, "@IF(", 4)) + else if (!_cups_strncasecmp(name, "@IF(", 4)) { /* * Deny *interface*... @@ -405,7 +405,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ } #ifdef HAVE_AUTHORIZATION_H else if (!strncmp(authorization, "AuthRef ", 8) && - !strcasecmp(con->http.hostname, "localhost")) + !_cups_strcasecmp(con->http.hostname, "localhost")) { OSStatus status; /* Status */ int authlen; /* Auth string length */ @@ -510,7 +510,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ for (name = (char *)cupsArrayFirst(con->best->names); name; name = (char *)cupsArrayNext(con->best->names)) - if (!strncasecmp(name, "@AUTHKEY(", 9) || !strcasecmp(name, "@SYSTEM")) + if (!_cups_strncasecmp(name, "@AUTHKEY(", 9) || !_cups_strcasecmp(name, "@SYSTEM")) { cupsdLogMessage(CUPSD_LOG_ERROR, "PeerCred authentication not allowed for resource."); @@ -571,7 +571,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */ } #endif /* SO_PEERCRED && AF_LOCAL */ else if (!strncmp(authorization, "Local", 5) && - !strcasecmp(con->http.hostname, "localhost")) + !_cups_strcasecmp(con->http.hostname, "localhost")) { /* * Get Local certificate authentication data... @@ -1193,7 +1193,7 @@ cupsdCheckAccess( int allow; /* 1 if allowed, 0 otherwise */ - if (!strcasecmp(name, "localhost")) + if (!_cups_strcasecmp(name, "localhost")) { /* * Access from localhost (127.0.0.1 or ::1) is always allowed... @@ -1386,7 +1386,7 @@ cupsdCheckAuth(unsigned ip[4], /* I - Client address */ * Check for exact name match... */ - if (!strcasecmp(name, mask->mask.name.name)) + if (!_cups_strcasecmp(name, mask->mask.name.name)) return (1); /* @@ -1395,7 +1395,7 @@ cupsdCheckAuth(unsigned ip[4], /* I - Client address */ if (name_len >= mask->mask.name.length && mask->mask.name.name[0] == '.' && - !strcasecmp(name + name_len - mask->mask.name.length, + !_cups_strcasecmp(name + name_len - mask->mask.name.length, mask->mask.name.name)) return (1); break; @@ -1465,7 +1465,7 @@ cupsdCheckGroup( */ for (i = 0; group->gr_mem[i]; i ++) - if (!strcasecmp(username, group->gr_mem[i])) + if (!_cups_strcasecmp(username, group->gr_mem[i])) return (1); } @@ -1714,7 +1714,7 @@ cupsdFindBest(const char *path, /* I - Resource path */ */ if (loc->length > bestlen && loc->location && - !strncasecmp(uri, loc->location, loc->length) && + !_cups_strncasecmp(uri, loc->location, loc->length) && loc->location[0] == '/' && (limit & loc->limit) != 0) { @@ -1904,7 +1904,7 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */ */ if ((best->encryption >= HTTP_ENCRYPT_REQUIRED && !con->http.tls && - strcasecmp(con->http.hostname, "localhost") && + _cups_strcasecmp(con->http.hostname, "localhost") && best->satisfy == CUPSD_AUTH_SATISFY_ALL) && !(type == CUPSD_AUTH_NEGOTIATE || (type == CUPSD_AUTH_NONE && DefaultAuthType == CUPSD_AUTH_NEGOTIATE))) @@ -2045,9 +2045,9 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */ name; name = (char *)cupsArrayNext(best->names)) { - if (!strncasecmp(name, "@AUTHKEY(", 9) && check_authref(con, name + 9)) + if (!_cups_strncasecmp(name, "@AUTHKEY(", 9) && check_authref(con, name + 9)) return (HTTP_OK); - else if (!strcasecmp(name, "@SYSTEM") && SystemGroupAuthKey && + else if (!_cups_strcasecmp(name, "@SYSTEM") && SystemGroupAuthKey && check_authref(con, SystemGroupAuthKey)) return (HTTP_OK); } @@ -2060,10 +2060,10 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */ name; name = (char *)cupsArrayNext(best->names)) { - if (!strcasecmp(name, "@OWNER") && owner && - !strcasecmp(username, ownername)) + if (!_cups_strcasecmp(name, "@OWNER") && owner && + !_cups_strcasecmp(username, ownername)) return (HTTP_OK); - else if (!strcasecmp(name, "@SYSTEM")) + else if (!_cups_strcasecmp(name, "@SYSTEM")) { for (i = 0; i < NumSystemGroups; i ++) if (cupsdCheckGroup(username, pw, SystemGroups[i])) @@ -2074,7 +2074,7 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */ if (cupsdCheckGroup(username, pw, name + 1)) return (HTTP_OK); } - else if (!strcasecmp(username, name)) + else if (!_cups_strcasecmp(username, name)) return (HTTP_OK); } @@ -2100,7 +2100,7 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */ "cupsdIsAuthorized: Checking group \"%s\" membership...", name); - if (!strcasecmp(name, "@SYSTEM")) + if (!_cups_strcasecmp(name, "@SYSTEM")) { for (i = 0; i < NumSystemGroups; i ++) if (cupsdCheckGroup(username, pw, SystemGroups[i])) diff --git a/scheduler/banners.c b/scheduler/banners.c index 968de4911..a4597964b 100644 --- a/scheduler/banners.c +++ b/scheduler/banners.c @@ -3,7 +3,7 @@ * * Banner routines for the CUPS scheduler. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -192,7 +192,7 @@ compare_banners( const cupsd_banner_t *b0, /* I - First banner */ const cupsd_banner_t *b1) /* I - Second banner */ { - return (strcasecmp(b0->name, b1->name)); + return (_cups_strcasecmp(b0->name, b1->name)); } diff --git a/scheduler/cert.c b/scheduler/cert.c index 0e791f8c4..7de29e707 100644 --- a/scheduler/cert.c +++ b/scheduler/cert.c @@ -3,7 +3,7 @@ * * Authentication certificate routines for the CUPS scheduler. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -368,7 +368,7 @@ cupsdFindCert(const char *certificate) /* I - Certificate */ cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindCert(certificate=%s)", certificate); for (cert = Certs; cert != NULL; cert = cert->next) - if (!strcasecmp(certificate, cert->certificate)) + if (!_cups_strcasecmp(certificate, cert->certificate)) { cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindCert: Returning %s...", cert->username); diff --git a/scheduler/classes.c b/scheduler/classes.c index 56a49eaf9..e1da0aa6a 100644 --- a/scheduler/classes.c +++ b/scheduler/classes.c @@ -3,7 +3,7 @@ * * Printer class routines for the CUPS scheduler. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -325,8 +325,8 @@ cupsdLoadAllClasses(void) * Decode the directive... */ - if (!strcasecmp(line, "<Class") || - !strcasecmp(line, "<DefaultClass")) + if (!_cups_strcasecmp(line, "<Class") || + !_cups_strcasecmp(line, "<DefaultClass")) { /* * <Class name> or <DefaultClass name> @@ -354,14 +354,14 @@ cupsdLoadAllClasses(void) p->accepting = 1; p->state = IPP_PRINTER_IDLE; - if (!strcasecmp(line, "<DefaultClass")) + if (!_cups_strcasecmp(line, "<DefaultClass")) DefaultPrinter = p; } else cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of classes.conf.", linenum); } - else if (!strcasecmp(line, "</Class>")) + else if (!_cups_strcasecmp(line, "</Class>")) { if (p != NULL) { @@ -377,7 +377,7 @@ cupsdLoadAllClasses(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of classes.conf.", linenum); } - else if (!strcasecmp(line, "UUID")) + else if (!_cups_strcasecmp(line, "UUID")) { if (value && !strncmp(value, "urn:uuid:", 9)) cupsdSetString(&(p->uuid), value); @@ -385,24 +385,24 @@ cupsdLoadAllClasses(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Bad UUID on line %d of classes.conf.", linenum); } - else if (!strcasecmp(line, "AuthInfoRequired")) + else if (!_cups_strcasecmp(line, "AuthInfoRequired")) { if (!cupsdSetAuthInfoRequired(p, value, NULL)) cupsdLogMessage(CUPSD_LOG_ERROR, "Bad AuthInfoRequired on line %d of classes.conf.", linenum); } - else if (!strcasecmp(line, "Info")) + else if (!_cups_strcasecmp(line, "Info")) { if (value) cupsdSetString(&p->info, value); } - else if (!strcasecmp(line, "Location")) + else if (!_cups_strcasecmp(line, "Location")) { if (value) cupsdSetString(&p->location, value); } - else if (!strcasecmp(line, "Option") && value) + else if (!_cups_strcasecmp(line, "Option") && value) { /* * Option name value @@ -421,7 +421,7 @@ cupsdLoadAllClasses(void) &(p->options)); } } - else if (!strcasecmp(line, "Printer")) + else if (!_cups_strcasecmp(line, "Printer")) { if (!value) { @@ -458,15 +458,15 @@ cupsdLoadAllClasses(void) if (temp) cupsdAddPrinterToClass(p, temp); } - else if (!strcasecmp(line, "State")) + else if (!_cups_strcasecmp(line, "State")) { /* * Set the initial queue state... */ - if (!strcasecmp(value, "idle")) + if (!_cups_strcasecmp(value, "idle")) p->state = IPP_PRINTER_IDLE; - else if (!strcasecmp(value, "stopped")) + else if (!_cups_strcasecmp(value, "stopped")) { p->state = IPP_PRINTER_STOPPED; @@ -486,7 +486,7 @@ cupsdLoadAllClasses(void) "Syntax error on line %d of classes.conf.", linenum); } - else if (!strcasecmp(line, "StateMessage")) + else if (!_cups_strcasecmp(line, "StateMessage")) { /* * Set the initial queue state message... @@ -495,7 +495,7 @@ cupsdLoadAllClasses(void) if (value) strlcpy(p->state_message, value, sizeof(p->state_message)); } - else if (!strcasecmp(line, "StateTime")) + else if (!_cups_strcasecmp(line, "StateTime")) { /* * Set the state time... @@ -504,49 +504,49 @@ cupsdLoadAllClasses(void) if (value) p->state_time = atoi(value); } - else if (!strcasecmp(line, "Accepting")) + else if (!_cups_strcasecmp(line, "Accepting")) { /* * Set the initial accepting state... */ if (value && - (!strcasecmp(value, "yes") || - !strcasecmp(value, "on") || - !strcasecmp(value, "true"))) + (!_cups_strcasecmp(value, "yes") || + !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "true"))) p->accepting = 1; else if (value && - (!strcasecmp(value, "no") || - !strcasecmp(value, "off") || - !strcasecmp(value, "false"))) + (!_cups_strcasecmp(value, "no") || + !_cups_strcasecmp(value, "off") || + !_cups_strcasecmp(value, "false"))) p->accepting = 0; else cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of classes.conf.", linenum); } - else if (!strcasecmp(line, "Shared")) + else if (!_cups_strcasecmp(line, "Shared")) { /* * Set the initial shared state... */ if (value && - (!strcasecmp(value, "yes") || - !strcasecmp(value, "on") || - !strcasecmp(value, "true"))) + (!_cups_strcasecmp(value, "yes") || + !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "true"))) p->shared = 1; else if (value && - (!strcasecmp(value, "no") || - !strcasecmp(value, "off") || - !strcasecmp(value, "false"))) + (!_cups_strcasecmp(value, "no") || + !_cups_strcasecmp(value, "off") || + !_cups_strcasecmp(value, "false"))) p->shared = 0; else cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of classes.conf.", linenum); } - else if (!strcasecmp(line, "JobSheets")) + else if (!_cups_strcasecmp(line, "JobSheets")) { /* * Set the initial job sheets... @@ -582,7 +582,7 @@ cupsdLoadAllClasses(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of classes.conf.", linenum); } - else if (!strcasecmp(line, "AllowUser")) + else if (!_cups_strcasecmp(line, "AllowUser")) { if (value) { @@ -593,7 +593,7 @@ cupsdLoadAllClasses(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of classes.conf.", linenum); } - else if (!strcasecmp(line, "DenyUser")) + else if (!_cups_strcasecmp(line, "DenyUser")) { if (value) { @@ -604,7 +604,7 @@ cupsdLoadAllClasses(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of classes.conf.", linenum); } - else if (!strcasecmp(line, "QuotaPeriod")) + else if (!_cups_strcasecmp(line, "QuotaPeriod")) { if (value) p->quota_period = atoi(value); @@ -612,7 +612,7 @@ cupsdLoadAllClasses(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of classes.conf.", linenum); } - else if (!strcasecmp(line, "PageLimit")) + else if (!_cups_strcasecmp(line, "PageLimit")) { if (value) p->page_limit = atoi(value); @@ -620,7 +620,7 @@ cupsdLoadAllClasses(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of classes.conf.", linenum); } - else if (!strcasecmp(line, "KLimit")) + else if (!_cups_strcasecmp(line, "KLimit")) { if (value) p->k_limit = atoi(value); @@ -628,7 +628,7 @@ cupsdLoadAllClasses(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of classes.conf.", linenum); } - else if (!strcasecmp(line, "OpPolicy")) + else if (!_cups_strcasecmp(line, "OpPolicy")) { if (value) { @@ -649,7 +649,7 @@ cupsdLoadAllClasses(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of classes.conf.", linenum); } - else if (!strcasecmp(line, "ErrorPolicy")) + else if (!_cups_strcasecmp(line, "ErrorPolicy")) { if (value) { diff --git a/scheduler/client.c b/scheduler/client.c index b4f118370..8e8395fae 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -918,8 +918,8 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ */ if (strcmp(scheme, "file") && - strcasecmp(hostname, ServerName) && - strcasecmp(hostname, "localhost") && + _cups_strcasecmp(hostname, ServerName) && + _cups_strcasecmp(hostname, "localhost") && !isdigit(hostname[0]) && hostname[0] != '[') { /* @@ -1076,10 +1076,10 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ cupsdAuthorize(con); - if (!strncasecmp(con->http.fields[HTTP_FIELD_CONNECTION], "Keep-Alive", + if (!_cups_strncasecmp(con->http.fields[HTTP_FIELD_CONNECTION], "Keep-Alive", 10) && KeepAlive) con->http.keep_alive = HTTP_KEEPALIVE_ON; - else if (!strncasecmp(con->http.fields[HTTP_FIELD_CONNECTION], "close", 5)) + else if (!_cups_strncasecmp(con->http.fields[HTTP_FIELD_CONNECTION], "close", 5)) con->http.keep_alive = HTTP_KEEPALIVE_OFF; if (!con->http.fields[HTTP_FIELD_HOST][0] && @@ -1128,7 +1128,7 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ } } - if (!strcasecmp(con->http.fields[HTTP_FIELD_CONNECTION], "Upgrade") && + if (!_cups_strcasecmp(con->http.fields[HTTP_FIELD_CONNECTION], "Upgrade") && con->http.tls == NULL) { #ifdef HAVE_SSL @@ -1200,7 +1200,7 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ } else { - if (!strcasecmp(con->http.fields[HTTP_FIELD_CONNECTION], "Upgrade") && + if (!_cups_strcasecmp(con->http.fields[HTTP_FIELD_CONNECTION], "Upgrade") && con->http.tls == NULL) { #ifdef HAVE_SSL @@ -2372,7 +2372,7 @@ cupsdSendError(cupsd_client_t *con, /* I - Connection */ if (code == HTTP_UNAUTHORIZED && DefaultEncryption == HTTP_ENCRYPT_REQUIRED && - strcasecmp(con->http.hostname, "localhost") && + _cups_strcasecmp(con->http.hostname, "localhost") && !con->http.tls) { code = HTTP_UPGRADE_REQUIRED; @@ -2600,7 +2600,7 @@ cupsdSendHeader( #endif /* HAVE_GSSAPI */ if (con->best && auth_type != CUPSD_AUTH_NEGOTIATE && - !strcasecmp(con->http.hostname, "localhost")) + !_cups_strcasecmp(con->http.hostname, "localhost")) { /* * Add a "trc" (try root certification) parameter for local non-Kerberos @@ -2623,7 +2623,7 @@ cupsdSendHeader( name = (char *)cupsArrayNext(con->best->names)) { #ifdef HAVE_AUTHORIZATION_H - if (!strncasecmp(name, "@AUTHKEY(", 9)) + if (!_cups_strncasecmp(name, "@AUTHKEY(", 9)) { snprintf(auth_key, auth_size, ", authkey=\"%s\"", name + 9); /* end parenthesis is stripped in conf.c */ @@ -2631,7 +2631,7 @@ cupsdSendHeader( } else #endif /* HAVE_AUTHORIZATION_H */ - if (!strcasecmp(name, "@SYSTEM")) + if (!_cups_strcasecmp(name, "@SYSTEM")) { #ifdef HAVE_AUTHORIZATION_H if (SystemGroupAuthKey) @@ -2813,7 +2813,7 @@ cupsdWriteClient(cupsd_client_t *con) /* I - Client connection */ * Handle redirection and CGI status codes... */ - if (!strncasecmp(con->header, "Location:", 9)) + if (!_cups_strncasecmp(con->header, "Location:", 9)) { if (!cupsdSendHeader(con, HTTP_SEE_OTHER, NULL, CUPSD_AUTH_NONE)) { @@ -2826,7 +2826,7 @@ cupsdWriteClient(cupsd_client_t *con) /* I - Client connection */ if (httpPrintf(HTTP(con), "Content-Length: 0\r\n") < 0) return; } - else if (!strncasecmp(con->header, "Status:", 7)) + else if (!_cups_strncasecmp(con->header, "Status:", 7)) { cupsdSendError(con, (http_status_t)atoi(con->header + 7), CUPSD_AUTH_NONE); @@ -2850,7 +2850,7 @@ cupsdWriteClient(cupsd_client_t *con) /* I - Client connection */ } } - if (strncasecmp(con->header, "Status:", 7)) + if (_cups_strncasecmp(con->header, "Status:", 7)) httpPrintf(HTTP(con), "%s\r\n", con->header); /* @@ -3035,7 +3035,7 @@ check_if_modified( while (isspace(*ptr) || *ptr == ';') ptr ++; - if (strncasecmp(ptr, "length=", 7) == 0) + if (_cups_strncasecmp(ptr, "length=", 7) == 0) { ptr += 7; size = strtoll(ptr, NULL, 10); @@ -3937,7 +3937,7 @@ is_cgi(cupsd_client_t *con, /* I - Client connection */ * Check for known types... */ - if (!type || strcasecmp(type->super, "application")) + if (!type || _cups_strcasecmp(type->super, "application")) { cupsdLogMessage(CUPSD_LOG_DEBUG2, "is_cgi(con=%p(%d), filename=\"%s\", filestats=%p, " @@ -3947,7 +3947,7 @@ is_cgi(cupsd_client_t *con, /* I - Client connection */ return (0); } - if (!strcasecmp(type->type, "x-httpd-cgi") && + if (!_cups_strcasecmp(type->type, "x-httpd-cgi") && (filestats->st_mode & 0111)) { /* @@ -3966,7 +3966,7 @@ is_cgi(cupsd_client_t *con, /* I - Client connection */ return (1); } #ifdef HAVE_JAVA - else if (!strcasecmp(type->type, "x-httpd-java")) + else if (!_cups_strcasecmp(type->type, "x-httpd-java")) { /* * "application/x-httpd-java" is a Java servlet. @@ -3987,7 +3987,7 @@ is_cgi(cupsd_client_t *con, /* I - Client connection */ } #endif /* HAVE_JAVA */ #ifdef HAVE_PERL - else if (!strcasecmp(type->type, "x-httpd-perl")) + else if (!_cups_strcasecmp(type->type, "x-httpd-perl")) { /* * "application/x-httpd-perl" is a Perl page. @@ -4008,7 +4008,7 @@ is_cgi(cupsd_client_t *con, /* I - Client connection */ } #endif /* HAVE_PERL */ #ifdef HAVE_PHP - else if (!strcasecmp(type->type, "x-httpd-php")) + else if (!_cups_strcasecmp(type->type, "x-httpd-php")) { /* * "application/x-httpd-php" is a PHP page. @@ -4029,7 +4029,7 @@ is_cgi(cupsd_client_t *con, /* I - Client connection */ } #endif /* HAVE_PHP */ #ifdef HAVE_PYTHON - else if (!strcasecmp(type->type, "x-httpd-python")) + else if (!_cups_strcasecmp(type->type, "x-httpd-python")) { /* * "application/x-httpd-python" is a Python page. @@ -4973,13 +4973,13 @@ valid_host(cupsd_client_t *con) /* I - Client connection */ * addresses when accessing CUPS via the loopback interface... */ - return (!strcasecmp(host, "localhost") || - !strncasecmp(host, "localhost:", 10) || - !strcasecmp(host, "localhost.") || - !strncasecmp(host, "localhost.:", 11) || + return (!_cups_strcasecmp(host, "localhost") || + !_cups_strncasecmp(host, "localhost:", 10) || + !_cups_strcasecmp(host, "localhost.") || + !_cups_strncasecmp(host, "localhost.:", 11) || #ifdef __linux - !strcasecmp(host, "localhost.localdomain") || - !strncasecmp(host, "localhost.localdomain:", 22) || + !_cups_strcasecmp(host, "localhost.localdomain") || + !_cups_strncasecmp(host, "localhost.localdomain:", 22) || #endif /* __linux */ !strcmp(host, "127.0.0.1") || !strncmp(host, "127.0.0.1:", 10) || @@ -4993,8 +4993,8 @@ valid_host(cupsd_client_t *con) /* I - Client connection */ */ if ((end = strrchr(host, '.')) != NULL && - (!strcasecmp(end, ".local") || !strncasecmp(end, ".local:", 7) || - !strcasecmp(end, ".local.") || !strncasecmp(end, ".local.:", 8))) + (!_cups_strcasecmp(end, ".local") || !_cups_strncasecmp(end, ".local:", 7) || + !_cups_strcasecmp(end, ".local.") || !_cups_strncasecmp(end, ".local.:", 8))) return (1); #endif /* HAVE_DNSSD */ @@ -5043,7 +5043,7 @@ valid_host(cupsd_client_t *con) /* I - Client connection */ if (!strcmp(a->name, "*")) return (1); - if (!strncasecmp(host, a->name, a->namelen)) + if (!_cups_strncasecmp(host, a->name, a->namelen)) { /* * Prefix matches; check the character at the end - it must be ":", ".", @@ -5069,7 +5069,7 @@ valid_host(cupsd_client_t *con) /* I - Client connection */ if (!strcmp(a->name, "*")) return (1); - if (!strncasecmp(host, a->name, a->namelen)) + if (!_cups_strncasecmp(host, a->name, a->namelen)) { /* * Prefix matches; check the character at the end - it must be ":", ".", @@ -5092,7 +5092,7 @@ valid_host(cupsd_client_t *con) /* I - Client connection */ netif; netif = (cupsd_netif_t *)cupsArrayNext(NetIFList)) { - if (!strncasecmp(host, netif->hostname, netif->hostlen)) + if (!_cups_strncasecmp(host, netif->hostname, netif->hostlen)) { /* * Prefix matches; check the character at the end - it must be ":", ".", diff --git a/scheduler/conf.c b/scheduler/conf.c index b11d337e8..b2f3719d8 100644 --- a/scheduler/conf.c +++ b/scheduler/conf.c @@ -759,7 +759,7 @@ cupsdReadConfiguration(void) if ((host = gethostbyname(temp)) != NULL) { - if (strcasecmp(temp, host->h_name)) + if (_cups_strcasecmp(temp, host->h_name)) { cupsdSetString(&ServerName, host->h_name); cupsdAddAlias(ServerAlias, host->h_name); @@ -770,7 +770,7 @@ cupsdReadConfiguration(void) if (host->h_aliases) { for (i = 0; host->h_aliases[i]; i ++) - if (strcasecmp(temp, host->h_aliases[i])) + if (_cups_strcasecmp(temp, host->h_aliases[i])) { cupsdAddAlias(ServerAlias, host->h_aliases[i]); cupsdLogMessage(CUPSD_LOG_DEBUG, "Added auto ServerAlias %s", @@ -1078,13 +1078,13 @@ cupsdReadConfiguration(void) else #endif /* HAVE_LIBPAPER */ if (!DefaultLanguage || - !strcasecmp(DefaultLanguage, "C") || - !strcasecmp(DefaultLanguage, "POSIX") || - !strcasecmp(DefaultLanguage, "en") || - !strncasecmp(DefaultLanguage, "en.", 3) || - !strncasecmp(DefaultLanguage, "en_US", 5) || - !strncasecmp(DefaultLanguage, "en_CA", 5) || - !strncasecmp(DefaultLanguage, "fr_CA", 5)) + !_cups_strcasecmp(DefaultLanguage, "C") || + !_cups_strcasecmp(DefaultLanguage, "POSIX") || + !_cups_strcasecmp(DefaultLanguage, "en") || + !_cups_strncasecmp(DefaultLanguage, "en.", 3) || + !_cups_strncasecmp(DefaultLanguage, "en_US", 5) || + !_cups_strncasecmp(DefaultLanguage, "en_CA", 5) || + !_cups_strncasecmp(DefaultLanguage, "fr_CA", 5)) { /* * These are the only locales that will default to "letter" size... @@ -1100,7 +1100,7 @@ cupsdReadConfiguration(void) * Update classification setting as needed... */ - if (Classification && !strcasecmp(Classification, "none")) + if (Classification && !_cups_strcasecmp(Classification, "none")) cupsdClearString(&Classification); if (Classification) @@ -1639,7 +1639,7 @@ get_addr_and_mask(const char *value, /* I - String from config file */ if (*value == '[') { /* - * Parse hexadecimal IPv6 address... + * Parse hexadecimal IPv6/IPv4 address... */ family = AF_INET6; @@ -1654,13 +1654,56 @@ get_addr_and_mask(const char *value, /* I - String from config file */ ptr2; ptr2 = strchr(ptr2 + 1, ':'), j ++); - i = 7 - j; - ptr ++; + i = 6 - j; + ptr += 2; + } + else if (isdigit(*ptr & 255) && strchr(ptr + 1, '.') && i >= 6) + { + /* + * Read IPv4 dotted quad... + */ + + unsigned val[4] = { 0, 0, 0, 0 }; + /* IPv4 address values */ + + ipcount = sscanf(ptr, "%u.%u.%u.%u", val + 0, val + 1, val + 2, + val + 3); + + /* + * Range check the IP numbers... + */ + + for (i = 0; i < ipcount; i ++) + if (val[i] > 255) + return (0); + + /* + * Merge everything into a 32-bit IPv4 address in ip[3]... + */ + + ip[3] = (((((val[0] << 8) | val[1]) << 8) | val[2]) << 8) | val[3]; + + if (ipcount < 4) + mask[3] = (0xffffffff << (32 - 8 * ipcount)) & 0xffffffff; + + /* + * If the leading words are all 0's then this is an IPv4 address... + */ + + if (!val[0] && !val[1] && !val[2]) + family = AF_INET; + + while (isdigit(*ptr & 255) || *ptr == '.') + ptr ++; + break; } else if (isxdigit(*ptr & 255)) { ipval = strtoul(ptr, (char **)&ptr, 16); + if (*ptr == ':' && ptr[1] != ':') + ptr ++; + if (ipval > 0xffff) return (0); @@ -1671,9 +1714,6 @@ get_addr_and_mask(const char *value, /* I - String from config file */ } else return (0); - - while (*ptr == ':') - ptr ++; } if (*ptr != ']') @@ -1691,7 +1731,7 @@ get_addr_and_mask(const char *value, /* I - String from config file */ * Parse dotted-decimal IPv4 address... */ - unsigned val[4]; /* IPv4 address values */ + unsigned val[4] = { 0, 0, 0, 0 }; /* IPv4 address values */ family = AF_INET; @@ -1705,14 +1745,6 @@ get_addr_and_mask(const char *value, /* I - String from config file */ if (val[i] > 255) return (0); - /* - * Make sure the trailing values are zeroed, as some C libraries like - * glibc apparently like to fill the unused arguments with garbage... - */ - - for (i = ipcount; i < 4; i ++) - val[i] = 0; - /* * Merge everything into a 32-bit IPv4 address in ip[3]... */ @@ -1740,7 +1772,8 @@ get_addr_and_mask(const char *value, /* I - String from config file */ if (family != AF_INET) return (0); - if (sscanf(maskval, "%u.%u.%u.%u", mask + 0, mask + 1, mask + 2, mask + 3) != 4) + if (sscanf(maskval, "%u.%u.%u.%u", mask + 0, mask + 1, mask + 2, + mask + 3) != 4) return (0); mask[3] |= ((((mask[0] << 8) | mask[1]) << 8) | mask[2]) << 8; @@ -1855,15 +1888,15 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ mask[4]; /* IP netmask components */ - if (!strcasecmp(line, "Encryption")) + if (!_cups_strcasecmp(line, "Encryption")) { /* * "Encryption xxx" - set required encryption level... */ - if (!strcasecmp(value, "never")) + if (!_cups_strcasecmp(value, "never")) loc->encryption = HTTP_ENCRYPT_NEVER; - else if (!strcasecmp(value, "always")) + else if (!_cups_strcasecmp(value, "always")) { cupsdLogMessage(CUPSD_LOG_ERROR, "Encryption value \"%s\" on line %d is invalid in this " @@ -1871,9 +1904,9 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ loc->encryption = HTTP_ENCRYPT_REQUIRED; } - else if (!strcasecmp(value, "required")) + else if (!_cups_strcasecmp(value, "required")) loc->encryption = HTTP_ENCRYPT_REQUIRED; - else if (!strcasecmp(value, "ifrequested")) + else if (!_cups_strcasecmp(value, "ifrequested")) loc->encryption = HTTP_ENCRYPT_IF_REQUESTED; else { @@ -1882,15 +1915,15 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ return (0); } } - else if (!strcasecmp(line, "Order")) + else if (!_cups_strcasecmp(line, "Order")) { /* * "Order Deny,Allow" or "Order Allow,Deny"... */ - if (!strncasecmp(value, "deny", 4)) + if (!_cups_strncasecmp(value, "deny", 4)) loc->order_type = CUPSD_AUTH_ALLOW; - else if (!strncasecmp(value, "allow", 5)) + else if (!_cups_strncasecmp(value, "allow", 5)) loc->order_type = CUPSD_AUTH_DENY; else { @@ -1899,7 +1932,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ return (0); } } - else if (!strcasecmp(line, "Allow") || !strcasecmp(line, "Deny")) + else if (!_cups_strcasecmp(line, "Allow") || !_cups_strcasecmp(line, "Deny")) { /* * Allow [From] host/ip... @@ -1908,7 +1941,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ while (*value) { - if (!strncasecmp(value, "from", 4)) + if (!_cups_strncasecmp(value, "from", 4)) { /* * Strip leading "from"... @@ -1916,7 +1949,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ value += 4; - while (isspace(*value & 255)) + while (_cups_isspace(*value)) value ++; if (!*value) @@ -1927,9 +1960,9 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ * Find the end of the value... */ - for (valptr = value; *valptr && !isspace(*valptr & 255); valptr ++); + for (valptr = value; *valptr && !_cups_isspace(*valptr); valptr ++); - while (isspace(*valptr & 255)) + while (_cups_isspace(*valptr)) *valptr++ = '\0'; /* @@ -1948,24 +1981,24 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ * nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm */ - if (!strcasecmp(value, "all")) + if (!_cups_strcasecmp(value, "all")) { /* * All hosts... */ - if (!strcasecmp(line, "Allow")) + if (!_cups_strcasecmp(line, "Allow")) cupsdAddIPMask(&(loc->allow), zeros, zeros); else cupsdAddIPMask(&(loc->deny), zeros, zeros); } - else if (!strcasecmp(value, "none")) + else if (!_cups_strcasecmp(value, "none")) { /* * No hosts... */ - if (!strcasecmp(line, "Allow")) + if (!_cups_strcasecmp(line, "Allow")) cupsdAddIPMask(&(loc->allow), ones, zeros); else cupsdAddIPMask(&(loc->deny), ones, zeros); @@ -1984,7 +2017,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ if (value[0] == '*') value ++; - if (!strcasecmp(line, "Allow")) + if (!_cups_strcasecmp(line, "Allow")) cupsdAddNameMask(&(loc->allow), value); else cupsdAddNameMask(&(loc->deny), value); @@ -2002,7 +2035,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ return (0); } - if (!strcasecmp(line, "Allow")) + if (!_cups_strcasecmp(line, "Allow")) cupsdAddIPMask(&(loc->allow), ip, mask); else cupsdAddIPMask(&(loc->deny), ip, mask); @@ -2015,39 +2048,39 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ value = valptr; } } - else if (!strcasecmp(line, "AuthType")) + else if (!_cups_strcasecmp(line, "AuthType")) { /* * AuthType {none,basic,digest,basicdigest,negotiate,default} */ - if (!strcasecmp(value, "none")) + if (!_cups_strcasecmp(value, "none")) { loc->type = CUPSD_AUTH_NONE; loc->level = CUPSD_AUTH_ANON; } - else if (!strcasecmp(value, "basic")) + else if (!_cups_strcasecmp(value, "basic")) { loc->type = CUPSD_AUTH_BASIC; if (loc->level == CUPSD_AUTH_ANON) loc->level = CUPSD_AUTH_USER; } - else if (!strcasecmp(value, "digest")) + else if (!_cups_strcasecmp(value, "digest")) { loc->type = CUPSD_AUTH_DIGEST; if (loc->level == CUPSD_AUTH_ANON) loc->level = CUPSD_AUTH_USER; } - else if (!strcasecmp(value, "basicdigest")) + else if (!_cups_strcasecmp(value, "basicdigest")) { loc->type = CUPSD_AUTH_BASICDIGEST; if (loc->level == CUPSD_AUTH_ANON) loc->level = CUPSD_AUTH_USER; } - else if (!strcasecmp(value, "default")) + else if (!_cups_strcasecmp(value, "default")) { loc->type = CUPSD_AUTH_DEFAULT; @@ -2055,7 +2088,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ loc->level = CUPSD_AUTH_USER; } #ifdef HAVE_GSSAPI - else if (!strcasecmp(value, "negotiate")) + else if (!_cups_strcasecmp(value, "negotiate")) { loc->type = CUPSD_AUTH_NEGOTIATE; @@ -2071,13 +2104,13 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ return (0); } } - else if (!strcasecmp(line, "AuthClass")) + else if (!_cups_strcasecmp(line, "AuthClass")) { /* * AuthClass anonymous, user, system, group */ - if (!strcasecmp(value, "anonymous")) + if (!_cups_strcasecmp(value, "anonymous")) { loc->type = CUPSD_AUTH_NONE; loc->level = CUPSD_AUTH_ANON; @@ -2087,7 +2120,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ "it from line %d.", value, linenum); } - else if (!strcasecmp(value, "user")) + else if (!_cups_strcasecmp(value, "user")) { loc->level = CUPSD_AUTH_USER; @@ -2096,7 +2129,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ "\"Require valid-user\" on line %d.", value, linenum); } - else if (!strcasecmp(value, "group")) + else if (!_cups_strcasecmp(value, "group")) { loc->level = CUPSD_AUTH_GROUP; @@ -2105,7 +2138,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ "\"Require user @groupname\" on line %d.", value, linenum); } - else if (!strcasecmp(value, "system")) + else if (!_cups_strcasecmp(value, "system")) { loc->level = CUPSD_AUTH_GROUP; @@ -2124,7 +2157,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ return (0); } } - else if (!strcasecmp(line, "AuthGroupName")) + else if (!_cups_strcasecmp(line, "AuthGroupName")) { cupsdAddName(loc, value); @@ -2133,7 +2166,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ "using \"Require user @%s\" on line %d.", value, value, linenum); } - else if (!strcasecmp(line, "Require")) + else if (!_cups_strcasecmp(line, "Require")) { /* * Apache synonym for AuthClass and AuthGroupName... @@ -2145,15 +2178,15 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ * Require user names */ - for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++); + for (valptr = value; !_cups_isspace(*valptr) && *valptr; valptr ++); if (*valptr) *valptr++ = '\0'; - if (!strcasecmp(value, "valid-user") || - !strcasecmp(value, "user")) + if (!_cups_strcasecmp(value, "valid-user") || + !_cups_strcasecmp(value, "user")) loc->level = CUPSD_AUTH_USER; - else if (!strcasecmp(value, "group")) + else if (!_cups_strcasecmp(value, "group")) loc->level = CUPSD_AUTH_GROUP; else { @@ -2168,7 +2201,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ for (value = valptr; *value;) { - while (isspace(*value & 255)) + while (_cups_isspace(*value)) value ++; #ifdef HAVE_AUTHORIZATION_H @@ -2201,7 +2234,7 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ * Grab literal name. */ - for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++); + for (valptr = value; !_cups_isspace(*valptr) && *valptr; valptr ++); } if (*valptr) @@ -2209,14 +2242,14 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */ cupsdAddName(loc, value); - for (value = valptr; isspace(*value & 255); value ++); + for (value = valptr; _cups_isspace(*value); value ++); } } - else if (!strcasecmp(line, "Satisfy")) + else if (!_cups_strcasecmp(line, "Satisfy")) { - if (!strcasecmp(value, "all")) + if (!_cups_strcasecmp(value, "all")) loc->satisfy = CUPSD_AUTH_SATISFY_ALL; - else if (!strcasecmp(value, "any")) + else if (!_cups_strcasecmp(value, "any")) loc->satisfy = CUPSD_AUTH_SATISFY_ANY; else { @@ -2267,7 +2300,7 @@ parse_fatal_errors(const char *s) /* I - FatalErrors string */ */ for (valend = valstart; *valend; valend ++) - if (isspace(*valend & 255) || *valend == ',') + if (_cups_isspace(*valend) || *valend == ',') break; if (*valend) @@ -2277,34 +2310,34 @@ parse_fatal_errors(const char *s) /* I - FatalErrors string */ * Add the error to the bitmask... */ - if (!strcasecmp(valstart, "all")) + if (!_cups_strcasecmp(valstart, "all")) fatal = CUPSD_FATAL_ALL; - else if (!strcasecmp(valstart, "browse")) + else if (!_cups_strcasecmp(valstart, "browse")) fatal |= CUPSD_FATAL_BROWSE; - else if (!strcasecmp(valstart, "-browse")) + else if (!_cups_strcasecmp(valstart, "-browse")) fatal &= ~CUPSD_FATAL_BROWSE; - else if (!strcasecmp(valstart, "config")) + else if (!_cups_strcasecmp(valstart, "config")) fatal |= CUPSD_FATAL_CONFIG; - else if (!strcasecmp(valstart, "-config")) + else if (!_cups_strcasecmp(valstart, "-config")) fatal &= ~CUPSD_FATAL_CONFIG; - else if (!strcasecmp(valstart, "listen")) + else if (!_cups_strcasecmp(valstart, "listen")) fatal |= CUPSD_FATAL_LISTEN; - else if (!strcasecmp(valstart, "-listen")) + else if (!_cups_strcasecmp(valstart, "-listen")) fatal &= ~CUPSD_FATAL_LISTEN; - else if (!strcasecmp(valstart, "log")) + else if (!_cups_strcasecmp(valstart, "log")) fatal |= CUPSD_FATAL_LOG; - else if (!strcasecmp(valstart, "-log")) + else if (!_cups_strcasecmp(valstart, "-log")) fatal &= ~CUPSD_FATAL_LOG; - else if (!strcasecmp(valstart, "permissions")) + else if (!_cups_strcasecmp(valstart, "permissions")) fatal |= CUPSD_FATAL_PERMISSIONS; - else if (!strcasecmp(valstart, "-permissions")) + else if (!_cups_strcasecmp(valstart, "-permissions")) fatal &= ~CUPSD_FATAL_PERMISSIONS; - else if (strcasecmp(valstart, "none")) + else if (_cups_strcasecmp(valstart, "none")) cupsdLogMessage(CUPSD_LOG_ERROR, "Unknown FatalErrors kind \"%s\" ignored.", valstart); for (valstart = valend; *valstart; valstart ++) - if (!isspace(*valstart & 255) || *valstart != ',') + if (!_cups_isspace(*valstart) || *valstart != ',') break; } @@ -2357,7 +2390,7 @@ parse_groups(const char *s) /* I - Space-delimited groups */ */ for (valend = valstart; *valend; valend ++) - if (isspace(*valend) || *valend == ',') + if (_cups_isspace(*valend) || *valend == ',') break; } @@ -2379,7 +2412,7 @@ parse_groups(const char *s) /* I - Space-delimited groups */ valstart = valend; - while (*valstart == ',' || isspace(*valstart)) + while (*valstart == ',' || _cups_isspace(*valstart)) valstart ++; } @@ -2422,7 +2455,7 @@ parse_protocols(const char *s) /* I - Space-delimited protocols */ */ for (valend = valstart; *valend; valend ++) - if (isspace(*valend & 255) || *valend == ',') + if (_cups_isspace(*valend) || *valend == ',') break; if (*valend) @@ -2432,28 +2465,28 @@ parse_protocols(const char *s) /* I - Space-delimited protocols */ * Add the protocol to the bitmask... */ - if (!strcasecmp(valstart, "cups")) + if (!_cups_strcasecmp(valstart, "cups")) protocols |= BROWSE_CUPS; - else if (!strcasecmp(valstart, "slp")) + else if (!_cups_strcasecmp(valstart, "slp")) protocols |= BROWSE_SLP; - else if (!strcasecmp(valstart, "ldap")) + else if (!_cups_strcasecmp(valstart, "ldap")) protocols |= BROWSE_LDAP; - else if (!strcasecmp(valstart, "dnssd") || - !strcasecmp(valstart, "dns-sd") || - !strcasecmp(valstart, "bonjour")) + else if (!_cups_strcasecmp(valstart, "dnssd") || + !_cups_strcasecmp(valstart, "dns-sd") || + !_cups_strcasecmp(valstart, "bonjour")) protocols |= BROWSE_DNSSD; - else if (!strcasecmp(valstart, "lpd")) + else if (!_cups_strcasecmp(valstart, "lpd")) protocols |= BROWSE_LPD; - else if (!strcasecmp(valstart, "smb")) + else if (!_cups_strcasecmp(valstart, "smb")) protocols |= BROWSE_SMB; - else if (!strcasecmp(valstart, "all")) + else if (!_cups_strcasecmp(valstart, "all")) protocols |= BROWSE_ALL; - else if (strcasecmp(valstart, "none")) + else if (_cups_strcasecmp(valstart, "none")) cupsdLogMessage(CUPSD_LOG_ERROR, "Unknown browse protocol \"%s\" ignored.", valstart); for (valstart = valend; *valstart; valstart ++) - if (!isspace(*valstart & 255) || *valstart != ',') + if (!_cups_isspace(*valstart) || *valstart != ',') break; } @@ -2503,7 +2536,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ * Decode the directive... */ - if (!strcasecmp(line, "Include") && value) + if (!_cups_strcasecmp(line, "Include") && value) { /* * Include filename @@ -2524,7 +2557,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ cupsFileClose(incfile); } } - else if (!strcasecmp(line, "<Location") && value) + else if (!_cups_strcasecmp(line, "<Location") && value) { /* * <Location path> @@ -2534,7 +2567,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ if (linenum == 0) return (0); } - else if (!strcasecmp(line, "<Policy") && value) + else if (!_cups_strcasecmp(line, "<Policy") && value) { /* * <Policy name> @@ -2544,25 +2577,25 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ if (linenum == 0) return (0); } - else if (!strcasecmp(line, "FatalErrors")) + else if (!_cups_strcasecmp(line, "FatalErrors")) FatalErrors = parse_fatal_errors(value); - else if (!strcasecmp(line, "FaxRetryInterval") && value) + else if (!_cups_strcasecmp(line, "FaxRetryInterval") && value) { JobRetryInterval = atoi(value); cupsdLogMessage(CUPSD_LOG_WARN, "FaxRetryInterval is deprecated; use " "JobRetryInterval on line %d.", linenum); } - else if (!strcasecmp(line, "FaxRetryLimit") && value) + else if (!_cups_strcasecmp(line, "FaxRetryLimit") && value) { JobRetryLimit = atoi(value); cupsdLogMessage(CUPSD_LOG_WARN, "FaxRetryLimit is deprecated; use " "JobRetryLimit on line %d.", linenum); } - else if (!strcasecmp(line, "Port") || !strcasecmp(line, "Listen") + else if (!_cups_strcasecmp(line, "Port") || !_cups_strcasecmp(line, "Listen") #ifdef HAVE_SSL - || !strcasecmp(line, "SSLPort") || !strcasecmp(line, "SSLListen") + || !_cups_strcasecmp(line, "SSLPort") || !_cups_strcasecmp(line, "SSLListen") #endif /* HAVE_SSL */ ) { @@ -2644,7 +2677,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ lis->fd = -1; #ifdef HAVE_SSL - if (!strcasecmp(line, "SSLPort") || !strcasecmp(line, "SSLListen")) + if (!_cups_strcasecmp(line, "SSLPort") || !_cups_strcasecmp(line, "SSLListen")) lis->encryption = HTTP_ENCRYPT_ALWAYS; #endif /* HAVE_SSL */ @@ -2669,7 +2702,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ httpAddrFreeList(addrlist); } - else if (!strcasecmp(line, "BrowseAddress") && value) + else if (!_cups_strcasecmp(line, "BrowseAddress") && value) { /* * Add a browse address to the list... @@ -2696,7 +2729,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ memset(dira, 0, sizeof(cupsd_dirsvc_addr_t)); - if (!strcasecmp(value, "@LOCAL")) + if (!_cups_strcasecmp(value, "@LOCAL")) { /* * Send browse data to all local interfaces... @@ -2705,7 +2738,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ strcpy(dira->iface, "*"); NumBrowsers ++; } - else if (!strncasecmp(value, "@IF(", 4)) + else if (!_cups_strncasecmp(value, "@IF(", 4)) { /* * Send browse data to the named interface... @@ -2750,7 +2783,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ cupsdLogMessage(CUPSD_LOG_ERROR, "Bad BrowseAddress %s at line %d.", value, linenum); } - else if (!strcasecmp(line, "BrowseOrder") && value) + else if (!_cups_strcasecmp(line, "BrowseOrder") && value) { /* * "BrowseOrder Deny,Allow" or "BrowseOrder Allow,Deny"... @@ -2763,18 +2796,18 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ if (location == NULL) cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to initialize browse access control list."); - else if (!strncasecmp(value, "deny", 4)) + else if (!_cups_strncasecmp(value, "deny", 4)) location->order_type = CUPSD_AUTH_ALLOW; - else if (!strncasecmp(value, "allow", 5)) + else if (!_cups_strncasecmp(value, "allow", 5)) location->order_type = CUPSD_AUTH_DENY; else cupsdLogMessage(CUPSD_LOG_ERROR, "Unknown BrowseOrder value %s on line %d.", value, linenum); } - else if (!strcasecmp(line, "BrowseProtocols") || - !strcasecmp(line, "BrowseLocalProtocols") || - !strcasecmp(line, "BrowseRemoteProtocols")) + else if (!_cups_strcasecmp(line, "BrowseProtocols") || + !_cups_strcasecmp(line, "BrowseLocalProtocols") || + !_cups_strcasecmp(line, "BrowseRemoteProtocols")) { /* * "BrowseProtocols name [... name]" @@ -2792,13 +2825,13 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ break; } - if (strcasecmp(line, "BrowseLocalProtocols")) + if (_cups_strcasecmp(line, "BrowseLocalProtocols")) BrowseRemoteProtocols = protocols; - if (strcasecmp(line, "BrowseRemoteProtocols")) + if (_cups_strcasecmp(line, "BrowseRemoteProtocols")) BrowseLocalProtocols = protocols; } - else if ((!strcasecmp(line, "BrowseAllow") || - !strcasecmp(line, "BrowseDeny")) && value) + else if ((!_cups_strcasecmp(line, "BrowseAllow") || + !_cups_strcasecmp(line, "BrowseDeny")) && value) { /* * BrowseAllow [From] host/ip... @@ -2815,7 +2848,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ "Unable to initialize browse access control list."); else { - if (!strncasecmp(value, "from", 4)) + if (!_cups_strncasecmp(value, "from", 4)) { /* * Skip leading "from"... @@ -2830,7 +2863,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ * Skip leading whitespace... */ - while (isspace(*value & 255)) + while (_cups_isspace(*value)) value ++; if (!*value) @@ -2841,10 +2874,10 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ */ for (valueptr = value; - *valueptr && !isspace(*valueptr & 255); + *valueptr && !_cups_isspace(*valueptr); valueptr ++); - while (isspace(*valueptr & 255)) + while (_cups_isspace(*valueptr)) *valueptr++ = '\0'; /* @@ -2863,24 +2896,24 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ * nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm */ - if (!strcasecmp(value, "all")) + if (!_cups_strcasecmp(value, "all")) { /* * All hosts... */ - if (!strcasecmp(line, "BrowseAllow")) + if (!_cups_strcasecmp(line, "BrowseAllow")) cupsdAddIPMask(&(location->allow), zeros, zeros); else cupsdAddIPMask(&(location->deny), zeros, zeros); } - else if (!strcasecmp(value, "none")) + else if (!_cups_strcasecmp(value, "none")) { /* * No hosts... */ - if (!strcasecmp(line, "BrowseAllow")) + if (!_cups_strcasecmp(line, "BrowseAllow")) cupsdAddIPMask(&(location->allow), ones, zeros); else cupsdAddIPMask(&(location->deny), ones, zeros); @@ -2897,7 +2930,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ * Host or domain name... */ - if (!strcasecmp(line, "BrowseAllow")) + if (!_cups_strcasecmp(line, "BrowseAllow")) cupsdAddNameMask(&(location->allow), value); else cupsdAddNameMask(&(location->deny), value); @@ -2915,7 +2948,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ break; } - if (!strcasecmp(line, "BrowseAllow")) + if (!_cups_strcasecmp(line, "BrowseAllow")) cupsdAddIPMask(&(location->allow), ip, mask); else cupsdAddIPMask(&(location->deny), ip, mask); @@ -2929,7 +2962,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ } } } - else if (!strcasecmp(line, "BrowseRelay") && value) + else if (!_cups_strcasecmp(line, "BrowseRelay") && value) { /* * BrowseRelay [from] source [to] destination @@ -2953,7 +2986,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ memset(relay, 0, sizeof(cupsd_dirsvc_relay_t)); - if (!strncasecmp(value, "from ", 5)) + if (!_cups_strncasecmp(value, "from ", 5)) { /* * Skip leading "from"... @@ -2965,7 +2998,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ * Skip leading whitespace... */ - while (isspace(*value)) + while (_cups_isspace(*value)) value ++; } @@ -2974,10 +3007,10 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ */ for (valueptr = value; - *valueptr && !isspace(*valueptr & 255); + *valueptr && !_cups_isspace(*valueptr); valueptr ++); - while (isspace(*valueptr & 255)) + while (_cups_isspace(*valueptr)) *valueptr++ = '\0'; /* @@ -3039,7 +3072,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ * Get "to" address and port... */ - if (!strncasecmp(valueptr, "to ", 3)) + if (!_cups_strncasecmp(valueptr, "to ", 3)) { /* * Strip leading "to"... @@ -3047,7 +3080,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ valueptr += 3; - while (isspace(*valueptr)) + while (_cups_isspace(*valueptr)) valueptr ++; } @@ -3092,7 +3125,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ valueptr, linenum); } } - else if (!strcasecmp(line, "BrowsePoll") && value) + else if (!_cups_strcasecmp(line, "BrowsePoll") && value) { /* * BrowsePoll address[:port] @@ -3154,22 +3187,22 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ cupsdLogMessage(CUPSD_LOG_INFO, "Polling %s:%d", pollp->hostname, pollp->port); } - else if (!strcasecmp(line, "DefaultAuthType") && value) + else if (!_cups_strcasecmp(line, "DefaultAuthType") && value) { /* * DefaultAuthType {basic,digest,basicdigest,negotiate} */ - if (!strcasecmp(value, "none")) + if (!_cups_strcasecmp(value, "none")) DefaultAuthType = CUPSD_AUTH_NONE; - else if (!strcasecmp(value, "basic")) + else if (!_cups_strcasecmp(value, "basic")) DefaultAuthType = CUPSD_AUTH_BASIC; - else if (!strcasecmp(value, "digest")) + else if (!_cups_strcasecmp(value, "digest")) DefaultAuthType = CUPSD_AUTH_DIGEST; - else if (!strcasecmp(value, "basicdigest")) + else if (!_cups_strcasecmp(value, "basicdigest")) DefaultAuthType = CUPSD_AUTH_BASICDIGEST; #ifdef HAVE_GSSAPI - else if (!strcasecmp(value, "negotiate")) + else if (!_cups_strcasecmp(value, "negotiate")) DefaultAuthType = CUPSD_AUTH_NEGOTIATE; #endif /* HAVE_GSSAPI */ else @@ -3182,17 +3215,17 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ } } #ifdef HAVE_SSL - else if (!strcasecmp(line, "DefaultEncryption")) + else if (!_cups_strcasecmp(line, "DefaultEncryption")) { /* * DefaultEncryption {Never,IfRequested,Required} */ - if (!value || !strcasecmp(value, "never")) + if (!value || !_cups_strcasecmp(value, "never")) DefaultEncryption = HTTP_ENCRYPT_NEVER; - else if (!strcasecmp(value, "required")) + else if (!_cups_strcasecmp(value, "required")) DefaultEncryption = HTTP_ENCRYPT_REQUIRED; - else if (!strcasecmp(value, "ifrequested")) + else if (!_cups_strcasecmp(value, "ifrequested")) DefaultEncryption = HTTP_ENCRYPT_IF_REQUESTED; else { @@ -3204,7 +3237,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ } } #endif /* HAVE_SSL */ - else if (!strcasecmp(line, "User") && value) + else if (!_cups_strcasecmp(line, "User") && value) { /* * User ID to run as... @@ -3247,7 +3280,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ value, linenum); } } - else if (!strcasecmp(line, "Group") && value) + else if (!_cups_strcasecmp(line, "Group") && value) { /* * Group ID to run as... @@ -3268,7 +3301,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ value, linenum); } } - else if (!strcasecmp(line, "SystemGroup") && value) + else if (!_cups_strcasecmp(line, "SystemGroup") && value) { /* * SystemGroup (admin) group(s)... @@ -3279,101 +3312,101 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ "Unknown SystemGroup \"%s\" on line %d, ignoring.", value, linenum); } - else if (!strcasecmp(line, "HostNameLookups") && value) + else if (!_cups_strcasecmp(line, "HostNameLookups") && value) { /* * Do hostname lookups? */ - if (!strcasecmp(value, "off") || !strcasecmp(value, "no") || - !strcasecmp(value, "false")) + if (!_cups_strcasecmp(value, "off") || !_cups_strcasecmp(value, "no") || + !_cups_strcasecmp(value, "false")) HostNameLookups = 0; - else if (!strcasecmp(value, "on") || !strcasecmp(value, "yes") || - !strcasecmp(value, "true")) + else if (!_cups_strcasecmp(value, "on") || !_cups_strcasecmp(value, "yes") || + !_cups_strcasecmp(value, "true")) HostNameLookups = 1; - else if (!strcasecmp(value, "double")) + else if (!_cups_strcasecmp(value, "double")) HostNameLookups = 2; else cupsdLogMessage(CUPSD_LOG_WARN, "Unknown HostNameLookups %s on line %d.", value, linenum); } - else if (!strcasecmp(line, "AccessLogLevel") && value) + else if (!_cups_strcasecmp(line, "AccessLogLevel") && value) { /* * Amount of logging to do to access log... */ - if (!strcasecmp(value, "all")) + if (!_cups_strcasecmp(value, "all")) AccessLogLevel = CUPSD_ACCESSLOG_ALL; - else if (!strcasecmp(value, "actions")) + else if (!_cups_strcasecmp(value, "actions")) AccessLogLevel = CUPSD_ACCESSLOG_ACTIONS; - else if (!strcasecmp(value, "config")) + else if (!_cups_strcasecmp(value, "config")) AccessLogLevel = CUPSD_ACCESSLOG_CONFIG; else cupsdLogMessage(CUPSD_LOG_WARN, "Unknown AccessLogLevel %s on line %d.", value, linenum); } - else if (!strcasecmp(line, "LogLevel") && value) + else if (!_cups_strcasecmp(line, "LogLevel") && value) { /* * Amount of logging to do to error log... */ - if (!strcasecmp(value, "debug2")) + if (!_cups_strcasecmp(value, "debug2")) LogLevel = CUPSD_LOG_DEBUG2; - else if (!strcasecmp(value, "debug")) + else if (!_cups_strcasecmp(value, "debug")) LogLevel = CUPSD_LOG_DEBUG; - else if (!strcasecmp(value, "info")) + else if (!_cups_strcasecmp(value, "info")) LogLevel = CUPSD_LOG_INFO; - else if (!strcasecmp(value, "notice")) + else if (!_cups_strcasecmp(value, "notice")) LogLevel = CUPSD_LOG_NOTICE; - else if (!strcasecmp(value, "warn")) + else if (!_cups_strcasecmp(value, "warn")) LogLevel = CUPSD_LOG_WARN; - else if (!strcasecmp(value, "error")) + else if (!_cups_strcasecmp(value, "error")) LogLevel = CUPSD_LOG_ERROR; - else if (!strcasecmp(value, "crit")) + else if (!_cups_strcasecmp(value, "crit")) LogLevel = CUPSD_LOG_CRIT; - else if (!strcasecmp(value, "alert")) + else if (!_cups_strcasecmp(value, "alert")) LogLevel = CUPSD_LOG_ALERT; - else if (!strcasecmp(value, "emerg")) + else if (!_cups_strcasecmp(value, "emerg")) LogLevel = CUPSD_LOG_EMERG; - else if (!strcasecmp(value, "none")) + else if (!_cups_strcasecmp(value, "none")) LogLevel = CUPSD_LOG_NONE; else cupsdLogMessage(CUPSD_LOG_WARN, "Unknown LogLevel %s on line %d.", value, linenum); } - else if (!strcasecmp(line, "LogTimeFormat") && value) + else if (!_cups_strcasecmp(line, "LogTimeFormat") && value) { /* * Amount of logging to do to error log... */ - if (!strcasecmp(value, "standard")) + if (!_cups_strcasecmp(value, "standard")) LogTimeFormat = CUPSD_TIME_STANDARD; - else if (!strcasecmp(value, "usecs")) + else if (!_cups_strcasecmp(value, "usecs")) LogTimeFormat = CUPSD_TIME_USECS; else cupsdLogMessage(CUPSD_LOG_WARN, "Unknown LogTimeFormat %s on line %d.", value, linenum); } - else if (!strcasecmp(line, "PrintcapFormat") && value) + else if (!_cups_strcasecmp(line, "PrintcapFormat") && value) { /* * Format of printcap file? */ - if (!strcasecmp(value, "bsd")) + if (!_cups_strcasecmp(value, "bsd")) PrintcapFormat = PRINTCAP_BSD; - else if (!strcasecmp(value, "plist")) + else if (!_cups_strcasecmp(value, "plist")) PrintcapFormat = PRINTCAP_PLIST; - else if (!strcasecmp(value, "solaris")) + else if (!_cups_strcasecmp(value, "solaris")) PrintcapFormat = PRINTCAP_SOLARIS; else cupsdLogMessage(CUPSD_LOG_WARN, "Unknown PrintcapFormat %s on line %d.", value, linenum); } - else if (!strcasecmp(line, "ServerTokens") && value) + else if (!_cups_strcasecmp(line, "ServerTokens") && value) { /* * Set the string used for the Server header... @@ -3384,26 +3417,26 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ uname(&plat); - if (!strcasecmp(value, "ProductOnly")) + if (!_cups_strcasecmp(value, "ProductOnly")) cupsdSetString(&ServerHeader, "CUPS"); - else if (!strcasecmp(value, "Major")) + else if (!_cups_strcasecmp(value, "Major")) cupsdSetString(&ServerHeader, "CUPS/1"); - else if (!strcasecmp(value, "Minor")) + else if (!_cups_strcasecmp(value, "Minor")) cupsdSetString(&ServerHeader, "CUPS/1.4"); - else if (!strcasecmp(value, "Minimal")) + else if (!_cups_strcasecmp(value, "Minimal")) cupsdSetString(&ServerHeader, CUPS_MINIMAL); - else if (!strcasecmp(value, "OS")) + else if (!_cups_strcasecmp(value, "OS")) cupsdSetStringf(&ServerHeader, CUPS_MINIMAL " (%s)", plat.sysname); - else if (!strcasecmp(value, "Full")) + else if (!_cups_strcasecmp(value, "Full")) cupsdSetStringf(&ServerHeader, CUPS_MINIMAL " (%s) IPP/1.1", plat.sysname); - else if (!strcasecmp(value, "None")) + else if (!_cups_strcasecmp(value, "None")) cupsdClearString(&ServerHeader); else cupsdLogMessage(CUPSD_LOG_WARN, "Unknown ServerTokens %s on line %d.", value, linenum); } - else if (!strcasecmp(line, "PassEnv") && value) + else if (!_cups_strcasecmp(line, "PassEnv") && value) { /* * PassEnv variable [... variable] @@ -3412,7 +3445,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ for (; *value;) { for (valuelen = 0; value[valuelen]; valuelen ++) - if (isspace(value[valuelen]) || value[valuelen] == ',') + if (_cups_isspace(value[valuelen]) || value[valuelen] == ',') break; if (value[valuelen]) @@ -3424,18 +3457,39 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ cupsdSetEnv(value, NULL); for (value += valuelen; *value; value ++) - if (!isspace(*value) || *value != ',') + if (!_cups_isspace(*value) || *value != ',') break; } } - else if (!strcasecmp(line, "ServerAlias") && value) + else if (!_cups_strcasecmp(line, "ServerAlias") && value) { + /* + * ServerAlias name [... name] + */ + if (!ServerAlias) ServerAlias = cupsArrayNew(NULL, NULL); - cupsdAddAlias(ServerAlias, value); + for (; *value;) + { + for (valuelen = 0; value[valuelen]; valuelen ++) + if (_cups_isspace(value[valuelen]) || value[valuelen] == ',') + break; + + if (value[valuelen]) + { + value[valuelen] = '\0'; + valuelen ++; + } + + cupsdAddAlias(ServerAlias, value); + + for (value += valuelen; *value; value ++) + if (!_cups_isspace(*value) || *value != ',') + break; + } } - else if (!strcasecmp(line, "SetEnv") && value) + else if (!_cups_strcasecmp(line, "SetEnv") && value) { /* * SetEnv variable value @@ -3460,15 +3514,15 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ linenum); } #ifdef HAVE_SSL - else if (!strcasecmp(line, "SSLOptions")) + else if (!_cups_strcasecmp(line, "SSLOptions")) { /* * SSLOptions options */ - if (!value || !strcasecmp(value, "none")) + if (!value || !_cups_strcasecmp(value, "none")) SSLOptions = CUPSD_SSL_NONE; - else if (!strcasecmp(value, "noemptyfragments")) + else if (!_cups_strcasecmp(value, "noemptyfragments")) SSLOptions = CUPSD_SSL_NOEMPTY; else cupsdLogMessage(CUPSD_LOG_ERROR, @@ -3483,7 +3537,7 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ */ for (i = NUM_VARS, var = variables; i > 0; i --, var ++) - if (!strcasecmp(line, var->name)) + if (!_cups_strcasecmp(line, var->name)) break; if (i == 0) @@ -3542,17 +3596,17 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ cupsdLogMessage(CUPSD_LOG_ERROR, "Missing boolean value for %s on line %d.", line, linenum); - else if (!strcasecmp(value, "true") || - !strcasecmp(value, "on") || - !strcasecmp(value, "enabled") || - !strcasecmp(value, "yes") || + else if (!_cups_strcasecmp(value, "true") || + !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "enabled") || + !_cups_strcasecmp(value, "yes") || atoi(value) != 0) *((int *)var->ptr) = TRUE; - else if (!strcasecmp(value, "false") || - !strcasecmp(value, "off") || - !strcasecmp(value, "disabled") || - !strcasecmp(value, "no") || - !strcasecmp(value, "0")) + else if (!_cups_strcasecmp(value, "false") || + !_cups_strcasecmp(value, "off") || + !_cups_strcasecmp(value, "disabled") || + !_cups_strcasecmp(value, "no") || + !_cups_strcasecmp(value, "0")) *((int *)var->ptr) = FALSE; else cupsdLogMessage(CUPSD_LOG_ERROR, @@ -3630,10 +3684,10 @@ read_location(cups_file_t *fp, /* I - Configuration file */ * Decode the directive... */ - if (!strcasecmp(line, "</Location>")) + if (!_cups_strcasecmp(line, "</Location>")) return (linenum); - else if (!strcasecmp(line, "<Limit") || - !strcasecmp(line, "<LimitExcept")) + else if (!_cups_strcasecmp(line, "<Limit") || + !_cups_strcasecmp(line, "<LimitExcept")) { if (!value) { @@ -3678,13 +3732,13 @@ read_location(cups_file_t *fp, /* I - Configuration file */ for (value = valptr; isspace(*value & 255); value ++); } - if (!strcasecmp(line, "<LimitExcept")) + if (!_cups_strcasecmp(line, "<LimitExcept")) loc->limit = CUPSD_AUTH_LIMIT_ALL ^ loc->limit; parent->limit &= ~loc->limit; } - else if (!strcasecmp(line, "</Limit>") || - !strcasecmp(line, "</LimitExcept>")) + else if (!_cups_strcasecmp(line, "</Limit>") || + !_cups_strcasecmp(line, "</LimitExcept>")) loc = parent; else if (!parse_aaa(loc, line, value, linenum)) { @@ -3747,7 +3801,7 @@ read_policy(cups_file_t *fp, /* I - Configuration file */ * Decode the directive... */ - if (!strcasecmp(line, "</Policy>")) + if (!_cups_strcasecmp(line, "</Policy>")) { if (op) cupsdLogMessage(CUPSD_LOG_WARN, @@ -3758,7 +3812,7 @@ read_policy(cups_file_t *fp, /* I - Configuration file */ return (linenum); } - else if (!strcasecmp(line, "<Limit") && !op) + else if (!_cups_strcasecmp(line, "<Limit") && !op) { if (!value) { @@ -3784,7 +3838,7 @@ read_policy(cups_file_t *fp, /* I - Configuration file */ if (num_ops < (int)(sizeof(ops) / sizeof(ops[0]))) { - if (!strcasecmp(value, "All")) + if (!_cups_strcasecmp(value, "All")) ops[num_ops] = IPP_ANY_OPERATION; else if ((ops[num_ops] = ippOpValue(value)) == IPP_BAD_OPERATION) cupsdLogMessage(CUPSD_LOG_ERROR, @@ -3817,7 +3871,7 @@ read_policy(cups_file_t *fp, /* I - Configuration file */ op = cupsdAddPolicyOp(pol, NULL, ops[0]); } - else if (!strcasecmp(line, "</Limit>") && op) + else if (!_cups_strcasecmp(line, "</Limit>") && op) { /* * Finish the current operation limit... @@ -3835,10 +3889,10 @@ read_policy(cups_file_t *fp, /* I - Configuration file */ op = NULL; } - else if (!strcasecmp(line, "JobPrivateAccess") || - !strcasecmp(line, "JobPrivateValues") || - !strcasecmp(line, "SubscriptionPrivateAccess") || - !strcasecmp(line, "SubscriptionPrivateValues")) + else if (!_cups_strcasecmp(line, "JobPrivateAccess") || + !_cups_strcasecmp(line, "JobPrivateValues") || + !_cups_strcasecmp(line, "SubscriptionPrivateAccess") || + !_cups_strcasecmp(line, "SubscriptionPrivateValues")) { if (op) { @@ -3869,13 +3923,13 @@ read_policy(cups_file_t *fp, /* I - Configuration file */ * Save it appropriately... */ - if (!strcasecmp(line, "JobPrivateAccess")) + if (!_cups_strcasecmp(line, "JobPrivateAccess")) { /* * JobPrivateAccess {all|default|user/group list|@@ACL} */ - if (!strcasecmp(value, "default")) + if (!_cups_strcasecmp(value, "default")) { cupsdAddString(&(pol->job_access), "@OWNER"); cupsdAddString(&(pol->job_access), "@SYSTEM"); @@ -3883,13 +3937,13 @@ read_policy(cups_file_t *fp, /* I - Configuration file */ else cupsdAddString(&(pol->job_access), value); } - else if (!strcasecmp(line, "JobPrivateValues")) + else if (!_cups_strcasecmp(line, "JobPrivateValues")) { /* * JobPrivateValues {all|none|default|attribute list} */ - if (!strcasecmp(value, "default")) + if (!_cups_strcasecmp(value, "default")) { cupsdAddString(&(pol->job_attrs), "job-name"); cupsdAddString(&(pol->job_attrs), "job-originating-host-name"); @@ -3898,13 +3952,13 @@ read_policy(cups_file_t *fp, /* I - Configuration file */ else cupsdAddString(&(pol->job_attrs), value); } - else if (!strcasecmp(line, "SubscriptionPrivateAccess")) + else if (!_cups_strcasecmp(line, "SubscriptionPrivateAccess")) { /* * SubscriptionPrivateAccess {all|default|user/group list|@@ACL} */ - if (!strcasecmp(value, "default")) + if (!_cups_strcasecmp(value, "default")) { cupsdAddString(&(pol->sub_access), "@OWNER"); cupsdAddString(&(pol->sub_access), "@SYSTEM"); @@ -3912,13 +3966,13 @@ read_policy(cups_file_t *fp, /* I - Configuration file */ else cupsdAddString(&(pol->sub_access), value); } - else /* if (!strcasecmp(line, "SubscriptionPrivateValues")) */ + else /* if (!_cups_strcasecmp(line, "SubscriptionPrivateValues")) */ { /* * SubscriptionPrivateValues {all|none|default|attribute list} */ - if (!strcasecmp(value, "default")) + if (!_cups_strcasecmp(value, "default")) { cupsdAddString(&(pol->sub_attrs), "notify-events"); cupsdAddString(&(pol->sub_attrs), "notify-pull-method"); diff --git a/scheduler/cups-deviced.c b/scheduler/cups-deviced.c index 4e3df703a..1a1dbb264 100644 --- a/scheduler/cups-deviced.c +++ b/scheduler/cups-deviced.c @@ -457,10 +457,10 @@ compare_devices(cupsd_device_t *d0, /* I - First device */ if ((diff = cupsdCompareNames(d0->device_info, d1->device_info)) != 0) return (diff); - else if ((diff = strcasecmp(d0->device_class, d1->device_class)) != 0) + else if ((diff = _cups_strcasecmp(d0->device_class, d1->device_class)) != 0) return (diff); else - return (strcasecmp(d0->device_uri, d1->device_uri)); + return (_cups_strcasecmp(d0->device_uri, d1->device_uri)); } diff --git a/scheduler/cups-driverd.cxx b/scheduler/cups-driverd.cxx index 11b431fb0..9e0e02005 100644 --- a/scheduler/cups-driverd.cxx +++ b/scheduler/cups-driverd.cxx @@ -101,7 +101,7 @@ typedef struct /**** PPD record ****/ make_and_model[128], /* NickName/ModelName */ device_id[256], /* IEEE 1284 Device ID */ scheme[128]; /* PPD scheme */ -} ppd_rec_t; +} ppd_rec_t; typedef struct /**** In-memory record ****/ { @@ -284,7 +284,7 @@ cat_drv(const char *name, /* I - PPD name */ const char *datadir; // CUPS_DATADIR env var ppdcSource *src; // PPD source file data ppdcDriver *d; // Current driver - cups_file_t *out; // Stdout via CUPS file API + cups_file_t *out; // Stdout via CUPS file API char message[2048], // status-message filename[1024], // Full path to .drv file(s) scheme[32], // URI scheme ("drv") @@ -745,7 +745,7 @@ compare_ppds(const ppd_info_t *p0, /* I - First PPD file */ * First compare manufacturers... */ - if ((diff = strcasecmp(p0->record.make, p1->record.make)) != 0) + if ((diff = _cups_strcasecmp(p0->record.make, p1->record.make)) != 0) return (diff); else if ((diff = cupsdCompareNames(p0->record.make_and_model, p1->record.make_and_model)) != 0) @@ -1160,7 +1160,7 @@ list_ppds(int request_id, /* I - Request ID */ } } - if (make && !strcasecmp(ppd->record.make, make)) + if (make && !_cups_strcasecmp(ppd->record.make, make)) ppd->matches ++; if (make_and_model_re && @@ -1188,7 +1188,7 @@ list_ppds(int request_id, /* I - Request ID */ for (i = 0; i < PPD_MAX_PROD; i ++) if (!ppd->record.products[i][0]) break; - else if (!strcasecmp(ppd->record.products[i], product)) + else if (!_cups_strcasecmp(ppd->record.products[i], product)) { ppd->matches += 3; break; @@ -1200,7 +1200,7 @@ list_ppds(int request_id, /* I - Request ID */ for (i = 0; i < PPD_MAX_VERS; i ++) if (!ppd->record.psversions[i][0]) break; - else if (!strcasecmp(ppd->record.psversions[i], psversion)) + else if (!_cups_strcasecmp(ppd->record.psversions[i], psversion)) { ppd->matches ++; break; @@ -1342,7 +1342,7 @@ list_ppds(int request_id, /* I - Request ID */ ppd = (ppd_info_t *)cupsArrayNext(matches); ppd; ppd = (ppd_info_t *)cupsArrayNext(matches)) - if (strcasecmp(this_make, ppd->record.make)) + if (_cups_strcasecmp(this_make, ppd->record.make)) break; cupsArrayPrev(matches); @@ -1431,7 +1431,7 @@ load_drv(const char *filename, /* I - Actual filename */ if (nick_name) strlcpy(make_model, nick_name->value->value, sizeof(make_model)); - else if (strncasecmp(d->model_name->value, d->manufacturer->value, + else if (_cups_strncasecmp(d->model_name->value, d->manufacturer->value, strlen(d->manufacturer->value))) snprintf(make_model, sizeof(make_model), "%s %s, %s", d->manufacturer->value, d->model_name->value, @@ -1441,7 +1441,7 @@ load_drv(const char *filename, /* I - Actual filename */ d->version->value); if ((cups_fax = d->find_attr("cupsFax", NULL)) != NULL && - !strcasecmp(cups_fax->value->value, "true")) + !_cups_strcasecmp(cups_fax->value->value, "true")) type = PPD_TYPE_FAX; else if (d->type == PPDC_DRIVER_PS) type = PPD_TYPE_POSTSCRIPT; @@ -1453,9 +1453,9 @@ load_drv(const char *filename, /* I - Actual filename */ type = PPD_TYPE_POSTSCRIPT; filter; filter = (ppdcFilter *)d->filters->next()) - if (strcasecmp(filter->mime_type->value, "application/vnd.cups-raster")) + if (_cups_strcasecmp(filter->mime_type->value, "application/vnd.cups-raster")) type = PPD_TYPE_RASTER; - else if (strcasecmp(filter->mime_type->value, + else if (_cups_strcasecmp(filter->mime_type->value, "application/vnd.cups-pdf")) type = PPD_TYPE_PDF; } @@ -2003,7 +2003,7 @@ load_ppds(const char *d, /* I - Actual directory */ sscanf(line, "%*[^:]:%63s", lang_version); else if (!strncmp(line, "*NickName:", 10)) sscanf(line, "%*[^\"]\"%255[^\"]", nick_name); - else if (!strncasecmp(line, "*1284DeviceID:", 14)) + else if (!_cups_strncasecmp(line, "*1284DeviceID:", 14)) { sscanf(line, "%*[^\"]\"%255[^\"]", device_id); @@ -2071,7 +2071,7 @@ load_ppds(const char *d, /* I - Actual directory */ { for (ptr = line + 9; isspace(*ptr & 255); ptr ++); - if (!strncasecmp(ptr, "true", 4)) + if (!_cups_strncasecmp(ptr, "true", 4)) type = PPD_TYPE_FAX; } else if (!strncmp(line, "*cupsFilter:", 12) && type == PPD_TYPE_POSTSCRIPT) @@ -2149,7 +2149,7 @@ load_ppds(const char *d, /* I - Actual directory */ while (isspace(manufacturer[0] & 255)) _cups_strcpy(manufacturer, manufacturer + 1); - if (!strncasecmp(make_model, manufacturer, strlen(manufacturer))) + if (!_cups_strncasecmp(make_model, manufacturer, strlen(manufacturer))) strlcpy(temp, make_model, sizeof(temp)); else snprintf(temp, sizeof(temp), "%s %s", manufacturer, make_model); @@ -2182,10 +2182,10 @@ load_ppds(const char *d, /* I - Actual directory */ else strcpy(manufacturer, "Other"); } - else if (!strncasecmp(manufacturer, "LHAG", 4) || - !strncasecmp(manufacturer, "linotype", 8)) + else if (!_cups_strncasecmp(manufacturer, "LHAG", 4) || + !_cups_strncasecmp(manufacturer, "linotype", 8)) strcpy(manufacturer, "LHAG"); - else if (!strncasecmp(manufacturer, "Hewlett", 7)) + else if (!_cups_strncasecmp(manufacturer, "Hewlett", 7)) strcpy(manufacturer, "HP"); /* @@ -2216,7 +2216,7 @@ load_ppds(const char *d, /* I - Actual directory */ } for (i = 0; i < (int)(sizeof(languages) / sizeof(languages[0])); i ++) - if (!strcasecmp(languages[i].version, lang_version)) + if (!_cups_strcasecmp(languages[i].version, lang_version)) break; if (i < (int)(sizeof(languages) / sizeof(languages[0]))) @@ -2434,14 +2434,14 @@ regex_device_id(const char *device_id) /* I - IEEE-1284 device ID */ while (*device_id && ptr < (res + sizeof(res) - 6)) { - cmd = !strncasecmp(device_id, "COMMAND SET:", 12) || - !strncasecmp(device_id, "CMD:", 4); - - if (cmd || !strncasecmp(device_id, "MANUFACTURER:", 13) || - !strncasecmp(device_id, "MFG:", 4) || - !strncasecmp(device_id, "MFR:", 4) || - !strncasecmp(device_id, "MODEL:", 6) || - !strncasecmp(device_id, "MDL:", 4)) + cmd = !_cups_strncasecmp(device_id, "COMMAND SET:", 12) || + !_cups_strncasecmp(device_id, "CMD:", 4); + + if (cmd || !_cups_strncasecmp(device_id, "MANUFACTURER:", 13) || + !_cups_strncasecmp(device_id, "MFG:", 4) || + !_cups_strncasecmp(device_id, "MFR:", 4) || + !_cups_strncasecmp(device_id, "MODEL:", 6) || + !_cups_strncasecmp(device_id, "MDL:", 4)) { if (ptr > res) { diff --git a/scheduler/cups-lpd.c b/scheduler/cups-lpd.c index d1b03e1b8..a4cc377af 100644 --- a/scheduler/cups-lpd.c +++ b/scheduler/cups-lpd.c @@ -3,7 +3,7 @@ * * Line Printer Daemon interface for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2006 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -574,7 +574,7 @@ get_printer(http_t *http, /* I - HTTP connection */ } if (info_attr && name_attr && - !strcasecmp(name, info_attr->values[0].string.text)) + !_cups_strcasecmp(name, info_attr->values[0].string.text)) { /* * Found a match, use this one! @@ -669,7 +669,7 @@ get_printer(http_t *http, /* I - HTTP connection */ * Make sure we have "Dest name options" or "Default name options"... */ - if ((strcasecmp(line, "Dest") && strcasecmp(line, "Default")) || !value) + if ((_cups_strcasecmp(line, "Dest") && _cups_strcasecmp(line, "Default")) || !value) continue; /* @@ -686,7 +686,7 @@ get_printer(http_t *http, /* I - HTTP connection */ * the loop - we're done! */ - if (!strcasecmp(value, name)) + if (!_cups_strcasecmp(value, name)) { num_options = cupsParseOptions(optptr, num_options, options); break; diff --git a/scheduler/cupsfilter.c b/scheduler/cupsfilter.c index e813163d1..0eb9ea00f 100644 --- a/scheduler/cupsfilter.c +++ b/scheduler/cupsfilter.c @@ -46,7 +46,7 @@ #include <sys/wait.h> #if defined(__APPLE__) # include <libgen.h> -#endif /* __APPLE__ */ +#endif /* __APPLE__ */ /* @@ -435,7 +435,7 @@ main(int argc, /* I - Number of command-line args */ } sscanf(dsttype, "%15[^/]/%255s", super, type); - if (!strcasecmp(super, "printer")) + if (!_cups_strcasecmp(super, "printer")) dst = printer_type; else if ((dst = mimeType(mime, super, type)) == NULL) { @@ -623,9 +623,9 @@ add_printer_filter( for (temptype = mimeFirstType(mime); temptype; temptype = mimeNextType(mime)) - if (((super[0] == '*' && strcasecmp(temptype->super, "printer")) || - !strcasecmp(temptype->super, super)) && - (type[0] == '*' || !strcasecmp(temptype->type, type))) + if (((super[0] == '*' && _cups_strcasecmp(temptype->super, "printer")) || + !_cups_strcasecmp(temptype->super, super)) && + (type[0] == '*' || !_cups_strcasecmp(temptype->type, type))) { if (desttype != filtertype) { @@ -818,7 +818,7 @@ exec_filter(const char *filter, /* I - Filter to execute */ /* - * Add special voodoo magic for MacOS X - this allows MacOS X + * Add special voodoo magic for MacOS X - this allows MacOS X * programs to access their bundle resources properly... */ @@ -1362,15 +1362,15 @@ read_cupsd_conf(const char *filename) /* I - File to read */ while (cupsFileGetConf(fp, line, sizeof(line), &ptr, &linenum)) { - if (!strcasecmp(line, "DataDir")) + if (!_cups_strcasecmp(line, "DataDir")) set_string(&DataDir, ptr); - else if (!strcasecmp(line, "FontPath")) + else if (!_cups_strcasecmp(line, "FontPath")) set_string(&FontPath, ptr); - else if (!strcasecmp(line, "RIPCache")) + else if (!_cups_strcasecmp(line, "RIPCache")) set_string(&RIPCache, ptr); - else if (!strcasecmp(line, "ServerBin")) + else if (!_cups_strcasecmp(line, "ServerBin")) set_string(&ServerBin, ptr); - else if (!strcasecmp(line, "ServerRoot")) + else if (!_cups_strcasecmp(line, "ServerRoot")) set_string(&ServerRoot, ptr); } diff --git a/scheduler/dirsvc.c b/scheduler/dirsvc.c index d143efabd..eb8fd2264 100644 --- a/scheduler/dirsvc.c +++ b/scheduler/dirsvc.c @@ -171,7 +171,7 @@ static void dnssdDeregisterPrinter(cupsd_printer_t *p); static char *dnssdPackTxtRecord(int *txt_len, char *keyvalue[][2], int count); static void dnssdRegisterCallback(DNSServiceRef sdRef, - DNSServiceFlags flags, + DNSServiceFlags flags, DNSServiceErrorType errorCode, const char *name, const char *regtype, const char *domain, void *context); @@ -192,7 +192,7 @@ static const char * const ldap_attrs[] =/* CUPS LDAP attributes */ }; #endif /* HAVE_LDAP */ -#ifdef HAVE_LIBSLP +#ifdef HAVE_LIBSLP /* * SLP definitions... */ @@ -205,7 +205,7 @@ static const char * const ldap_attrs[] =/* CUPS LDAP attributes */ # define SLP_CUPS_SRVLEN 15 -/* +/* * Printer service URL structure */ @@ -235,7 +235,7 @@ static SLPBoolean slp_url_callback(SLPHandle hslp, const char *srvurl, /* - * 'cupsdDeregisterPrinter()' - Stop sending broadcast information for a + * 'cupsdDeregisterPrinter()' - Stop sending broadcast information for a * local printer and remove any pending * references to remote printers. */ @@ -347,8 +347,8 @@ cupsdLoadRemoteCache(void) * Decode the directive... */ - if (!strcasecmp(line, "<Printer") || - !strcasecmp(line, "<DefaultPrinter")) + if (!_cups_strcasecmp(line, "<Printer") || + !_cups_strcasecmp(line, "<DefaultPrinter")) { /* * <Printer name> or <DefaultPrinter name> @@ -388,7 +388,7 @@ cupsdLoadRemoteCache(void) * Set the default printer as needed... */ - if (!strcasecmp(line, "<DefaultPrinter")) + if (!_cups_strcasecmp(line, "<DefaultPrinter")) DefaultPrinter = p; } else @@ -398,8 +398,8 @@ cupsdLoadRemoteCache(void) break; } } - else if (!strcasecmp(line, "<Class") || - !strcasecmp(line, "<DefaultClass")) + else if (!_cups_strcasecmp(line, "<Class") || + !_cups_strcasecmp(line, "<DefaultClass")) { /* * <Class name> or <DefaultClass name> @@ -429,7 +429,7 @@ cupsdLoadRemoteCache(void) * Set the default printer as needed... */ - if (!strcasecmp(line, "<DefaultClass")) + if (!_cups_strcasecmp(line, "<DefaultClass")) DefaultPrinter = p; } else @@ -439,8 +439,8 @@ cupsdLoadRemoteCache(void) break; } } - else if (!strcasecmp(line, "</Printer>") || - !strcasecmp(line, "</Class>")) + else if (!_cups_strcasecmp(line, "</Printer>") || + !_cups_strcasecmp(line, "</Class>")) { if (p != NULL) { @@ -461,7 +461,7 @@ cupsdLoadRemoteCache(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of remote.cache.", linenum); } - else if (!strcasecmp(line, "UUID")) + else if (!_cups_strcasecmp(line, "UUID")) { if (value && !strncmp(value, "urn:uuid:", 9)) cupsdSetString(&(p->uuid), value); @@ -469,22 +469,22 @@ cupsdLoadRemoteCache(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Bad UUID on line %d of remote.cache.", linenum); } - else if (!strcasecmp(line, "Info")) + else if (!_cups_strcasecmp(line, "Info")) { if (value) cupsdSetString(&p->info, value); } - else if (!strcasecmp(line, "MakeModel")) + else if (!_cups_strcasecmp(line, "MakeModel")) { if (value) cupsdSetString(&p->make_model, value); } - else if (!strcasecmp(line, "Location")) + else if (!_cups_strcasecmp(line, "Location")) { if (value) cupsdSetString(&p->location, value); } - else if (!strcasecmp(line, "DeviceURI")) + else if (!_cups_strcasecmp(line, "DeviceURI")) { if (value) { @@ -500,7 +500,7 @@ cupsdLoadRemoteCache(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of remote.cache.", linenum); } - else if (!strcasecmp(line, "Option") && value) + else if (!_cups_strcasecmp(line, "Option") && value) { /* * Option name value @@ -519,7 +519,7 @@ cupsdLoadRemoteCache(void) &(p->options)); } } - else if (!strcasecmp(line, "Reason")) + else if (!_cups_strcasecmp(line, "Reason")) { if (value) { @@ -538,15 +538,15 @@ cupsdLoadRemoteCache(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of remote.cache.", linenum); } - else if (!strcasecmp(line, "State")) + else if (!_cups_strcasecmp(line, "State")) { /* * Set the initial queue state... */ - if (value && !strcasecmp(value, "idle")) + if (value && !_cups_strcasecmp(value, "idle")) p->state = IPP_PRINTER_IDLE; - else if (value && !strcasecmp(value, "stopped")) + else if (value && !_cups_strcasecmp(value, "stopped")) { p->state = IPP_PRINTER_STOPPED; cupsdSetPrinterReasons(p, "+paused"); @@ -555,7 +555,7 @@ cupsdLoadRemoteCache(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of remote.cache.", linenum); } - else if (!strcasecmp(line, "StateMessage")) + else if (!_cups_strcasecmp(line, "StateMessage")) { /* * Set the initial queue state message... @@ -564,27 +564,27 @@ cupsdLoadRemoteCache(void) if (value) strlcpy(p->state_message, value, sizeof(p->state_message)); } - else if (!strcasecmp(line, "Accepting")) + else if (!_cups_strcasecmp(line, "Accepting")) { /* * Set the initial accepting state... */ if (value && - (!strcasecmp(value, "yes") || - !strcasecmp(value, "on") || - !strcasecmp(value, "true"))) + (!_cups_strcasecmp(value, "yes") || + !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "true"))) p->accepting = 1; else if (value && - (!strcasecmp(value, "no") || - !strcasecmp(value, "off") || - !strcasecmp(value, "false"))) + (!_cups_strcasecmp(value, "no") || + !_cups_strcasecmp(value, "off") || + !_cups_strcasecmp(value, "false"))) p->accepting = 0; else cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of remote.cache.", linenum); } - else if (!strcasecmp(line, "Type")) + else if (!_cups_strcasecmp(line, "Type")) { if (value) p->type = atoi(value); @@ -592,7 +592,7 @@ cupsdLoadRemoteCache(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of remote.cache.", linenum); } - else if (!strcasecmp(line, "BrowseTime")) + else if (!_cups_strcasecmp(line, "BrowseTime")) { if (value) { @@ -605,7 +605,7 @@ cupsdLoadRemoteCache(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of remote.cache.", linenum); } - else if (!strcasecmp(line, "JobSheets")) + else if (!_cups_strcasecmp(line, "JobSheets")) { /* * Set the initial job sheets... @@ -637,7 +637,7 @@ cupsdLoadRemoteCache(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of remote.cache.", linenum); } - else if (!strcasecmp(line, "AllowUser")) + else if (!_cups_strcasecmp(line, "AllowUser")) { if (value) { @@ -648,7 +648,7 @@ cupsdLoadRemoteCache(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of remote.cache.", linenum); } - else if (!strcasecmp(line, "DenyUser")) + else if (!_cups_strcasecmp(line, "DenyUser")) { if (value) { @@ -1142,9 +1142,9 @@ ldap_connect(void) * LDAP stuff currently only supports ldapi EXTERNAL SASL binds... */ - if (!BrowseLDAPServer || !strcasecmp(BrowseLDAPServer, "localhost")) + if (!BrowseLDAPServer || !_cups_strcasecmp(BrowseLDAPServer, "localhost")) rc = ldap_initialize(&TempBrowseLDAPHandle, "ldapi:///"); - else + else rc = ldap_initialize(&TempBrowseLDAPHandle, BrowseLDAPServer); # else /* HAVE_OPENLDAP */ @@ -1323,7 +1323,7 @@ ldap_connect(void) bval.bv_val = BrowseLDAPPassword; bval.bv_len = (BrowseLDAPPassword == NULL) ? 0 : strlen(BrowseLDAPPassword); - if (!BrowseLDAPServer || !strcasecmp(BrowseLDAPServer, "localhost")) + if (!BrowseLDAPServer || !_cups_strcasecmp(BrowseLDAPServer, "localhost")) rc = ldap_sasl_bind_s(TempBrowseLDAPHandle, NULL, "EXTERNAL", &bv, NULL, NULL, NULL); else @@ -1613,7 +1613,7 @@ cupsdStartBrowsing(void) #ifdef HAVE_LIBSLP if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP) { - /* + /* * Open SLP handle... */ @@ -1843,7 +1843,7 @@ cupsdStopBrowsing(void) if (((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP) && BrowseSLPHandle) { - /* + /* * Close SLP handle... */ @@ -2106,7 +2106,7 @@ cupsdUpdateLDAPBrowse(void) * and temporary disable LDAP updates... */ - if (rc != LDAP_SUCCESS) + if (rc != LDAP_SUCCESS) { if (BrowseLDAPUpdate && ((rc == LDAP_SERVER_DOWN) || (rc == LDAP_CONNECT_ERROR))) { @@ -2189,7 +2189,7 @@ cupsdUpdateLDAPBrowse(void) #endif /* HAVE_LDAP */ -#ifdef HAVE_LIBSLP +#ifdef HAVE_LIBSLP /* * 'cupsdUpdateSLPBrowse()' - Get browsing information via SLP. */ @@ -2211,7 +2211,7 @@ cupsdUpdateSLPBrowse(void) BrowseSLPRefresh = time(NULL) + BrowseInterval; - /* + /* * Poll for remote printers using SLP... */ @@ -2232,7 +2232,7 @@ cupsdUpdateSLPBrowse(void) next = s->next; - /* + /* * Load a cupsd_printer_t structure with the SLP service attributes... */ @@ -2264,7 +2264,7 @@ cupsdUpdateSLPBrowse(void) cupsdClearString(&p.make_model); free(s); - } + } } #endif /* HAVE_LIBSLP */ @@ -2373,7 +2373,7 @@ dnssdBuildTxtRecord( if (for_lpd) strlcpy(rp_str, p->name, sizeof(rp_str)); else - snprintf(rp_str, sizeof(rp_str), "%s/%s", + snprintf(rp_str, sizeof(rp_str), "%s/%s", (p->type & CUPS_PRINTER_CLASS) ? "classes" : "printers", p->name); keyvalue[i ][0] = "ty"; @@ -2474,7 +2474,7 @@ static int /* O - Result of comparison */ dnssdComparePrinters(cupsd_printer_t *a,/* I - First printer */ cupsd_printer_t *b)/* I - Second printer */ { - return (strcasecmp(a->reg_name, b->reg_name)); + return (_cups_strcasecmp(a->reg_name, b->reg_name)); } @@ -2560,7 +2560,7 @@ dnssdPackTxtRecord(int *txt_len, /* O - TXT record length */ return (NULL); for (length = i = 0; i < count; i++) - length += 1 + strlen(keyvalue[i][0]) + + length += 1 + strlen(keyvalue[i][0]) + (keyvalue[i][1] ? 1 + strlen(keyvalue[i][1]) : 0); /* @@ -2628,11 +2628,11 @@ dnssdRegisterCallback( if (errorCode) { - cupsdLogMessage(CUPSD_LOG_ERROR, + cupsdLogMessage(CUPSD_LOG_ERROR, "DNSServiceRegister failed with error %d", (int)errorCode); return; } - else if (p && (!p->reg_name || strcasecmp(name, p->reg_name))) + else if (p && (!p->reg_name || _cups_strcasecmp(name, p->reg_name))) { cupsdLogMessage(CUPSD_LOG_INFO, "Using service name \"%s\" for \"%s\"", name, p->name); @@ -2651,7 +2651,7 @@ dnssdRegisterCallback( * or update the broadcast contents. */ -static void +static void dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */ { DNSServiceErrorType se; /* dnssd errors */ @@ -2756,7 +2756,7 @@ dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */ regtype = (p->type & CUPS_PRINTER_FAX) ? "_fax-ipp._tcp" : DNSSDRegType; - cupsdLogMessage(CUPSD_LOG_DEBUG, + cupsdLogMessage(CUPSD_LOG_DEBUG, "Registering DNS-SD printer %s with name \"%s\" and " "type \"%s\"", p->name, name, regtype); @@ -2853,14 +2853,14 @@ dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */ p->printer_ref = NULL; } } - + if (!p->printer_ref) { /* * Initial registration... */ - cupsdLogMessage(CUPSD_LOG_DEBUG, + cupsdLogMessage(CUPSD_LOG_DEBUG, "Registering DNS-SD printer %s with name \"%s\" and " "type \"_printer._tcp\"", p->name, name); @@ -3066,13 +3066,13 @@ get_hostconfig(const char *name) /* I - Name of service */ *ptr++ = '\0'; - if (!strcasecmp(line, name)) + if (!_cups_strcasecmp(line, name)) { /* * Found the service, see if it is set to "-NO-"... */ - if (!strncasecmp(ptr, "-NO-", 4)) + if (!_cups_strncasecmp(ptr, "-NO-", 4)) state = 0; break; } @@ -3118,7 +3118,7 @@ is_local_queue(const char *uri, /* I - Printer URI */ * Check for local server addresses... */ - if (!strcasecmp(host, ServerName) && port == LocalPort) + if (!_cups_strcasecmp(host, ServerName) && port == LocalPort) return (1); cupsdNetIFUpdate(); @@ -3126,7 +3126,7 @@ is_local_queue(const char *uri, /* I - Printer URI */ for (iface = (cupsd_netif_t *)cupsArrayFirst(NetIFList); iface; iface = (cupsd_netif_t *)cupsArrayNext(NetIFList)) - if (!strcasecmp(host, iface->hostname) && port == iface->port) + if (!_cups_strcasecmp(host, iface->hostname) && port == iface->port) return (1); /* @@ -3266,7 +3266,7 @@ process_browse_data( while (hptr != NULL) { - if (!strcasecmp(hptr, sptr)) + if (!_cups_strcasecmp(hptr, sptr)) { *hptr = '\0'; break; @@ -3337,7 +3337,7 @@ process_browse_data( if (p->type & CUPS_PRINTER_IMPLICIT) p = NULL; /* Don't replace implicit classes */ - else if (p->hostname && strcasecmp(p->hostname, host)) + else if (p->hostname && _cups_strcasecmp(p->hostname, host)) { /* * Short name exists but is for a different host. If this is a remote @@ -3548,7 +3548,7 @@ process_browse_data( is_class ? "Class" : "Printer", p->name); cupsdExpireSubscriptions(p, NULL); - + cupsdDeletePrinter(p, 1); cupsdUpdateImplicitClasses(); cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP | CUPSD_DIRTY_REMOTE); @@ -3637,7 +3637,7 @@ process_implicit_classes(void) cupsArraySave(Printers); if (len > 0 && - !strncasecmp(p->name, name + offset, len) && + !_cups_strncasecmp(p->name, name + offset, len) && (p->name[len] == '\0' || p->name[len] == '@')) { /* @@ -3645,7 +3645,7 @@ process_implicit_classes(void) * we have a class, and if this printer is a member... */ - if (pclass && strcasecmp(pclass->name, name)) + if (pclass && _cups_strcasecmp(pclass->name, name)) { if (update) cupsdSetPrinterAttrs(pclass); @@ -4203,7 +4203,7 @@ send_ldap_ou(char *ou, /* I - Servername/ou to register */ ou_value[1] = NULL; desc[0] = descstring; desc[1] = NULL; - + mods[0].mod_type = "ou"; mods[0].mod_values = ou_value; mods[1].mod_type = "description"; @@ -4541,7 +4541,7 @@ send_ldap_browse(cupsd_printer_t *p) /* I - Printer to register */ } } } - else + else { /* * No LDAP entry exists for the printer. Printer has never been registered, @@ -4741,7 +4741,7 @@ send_slp_browse(cupsd_printer_t *p) /* I - Printer to register */ p->name); /* - * Make the SLP service URL that conforms to the IANA + * Make the SLP service URL that conforms to the IANA * 'printer:' template. */ @@ -4896,7 +4896,7 @@ send_slp_browse(cupsd_printer_t *p) /* I - Printer to register */ /* - * 'slp_attr_callback()' - SLP attribute callback + * 'slp_attr_callback()' - SLP attribute callback */ static SLPBoolean /* O - SLP_TRUE for success */ @@ -4947,7 +4947,7 @@ slp_attr_callback( * 'slp_dereg_printer()' - SLPDereg() the specified printer */ -static void +static void slp_dereg_printer(cupsd_printer_t *p) /* I - Printer */ { char srvurl[HTTP_MAX_URI]; /* Printer service URI */ @@ -4958,7 +4958,7 @@ slp_dereg_printer(cupsd_printer_t *p) /* I - Printer */ if (!(p->type & CUPS_PRINTER_REMOTE)) { /* - * Make the SLP service URL that conforms to the IANA + * Make the SLP service URL that conforms to the IANA * 'printer:' template. */ @@ -5083,7 +5083,7 @@ slp_url_callback( strlcpy(s->url, srvurl, sizeof(s->url)); - /* + /* * Link the SLP service URL into the head of the list */ @@ -5131,7 +5131,7 @@ update_cups_browse(void) */ srclen = sizeof(srcaddr); - if ((bytes = recvfrom(BrowseSocket, packet, sizeof(packet) - 1, 0, + if ((bytes = recvfrom(BrowseSocket, packet, sizeof(packet) - 1, 0, (struct sockaddr *)&srcaddr, &srclen)) < 0) { /* @@ -5205,7 +5205,7 @@ update_cups_browse(void) if (BrowseACL) { - if (httpAddrLocalhost(&srcaddr) || !strcasecmp(srcname, "localhost")) + if (httpAddrLocalhost(&srcaddr) || !_cups_strcasecmp(srcname, "localhost")) { /* * Access from localhost (127.0.0.1) is always allowed... diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 8d601b8bd..a066d5a00 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -412,8 +412,8 @@ cupsdProcessIPPRequest( "attributes-natural-language", NULL, DefaultLanguage); if (charset && - strcasecmp(charset->values[0].string.text, "us-ascii") && - strcasecmp(charset->values[0].string.text, "utf-8")) + _cups_strcasecmp(charset->values[0].string.text, "us-ascii") && + _cups_strcasecmp(charset->values[0].string.text, "utf-8")) { /* * Bad character set... @@ -502,7 +502,7 @@ cupsdProcessIPPRequest( */ if (!strcmp(username->values[0].string.text, "root") && - strcasecmp(con->http.hostname, "localhost") && + _cups_strcasecmp(con->http.hostname, "localhost") && strcmp(con->username, "root")) { /* @@ -1377,8 +1377,8 @@ add_job(cupsd_client_t *con, /* I - Client connection */ */ if (!printer->shared && - strcasecmp(con->http.hostname, "localhost") && - strcasecmp(con->http.hostname, ServerName)) + _cups_strcasecmp(con->http.hostname, "localhost") && + _cups_strcasecmp(con->http.hostname, ServerName)) { send_ipp_status(con, IPP_NOT_AUTHORIZED, _("The printer or class is not shared.")); @@ -4353,7 +4353,7 @@ cancel_all_jobs(cupsd_client_t *con, /* I - Client connection */ for (i = 0; i < job_ids->num_values; i ++) { if ((job = cupsdFindJob(job_ids->values[i].integer)) == NULL || - strcasecmp(job->dest, printer->name)) + _cups_strcasecmp(job->dest, printer->name)) break; } @@ -4463,7 +4463,7 @@ cancel_job(cupsd_client_t *con, /* I - Client connection */ job; job = (cupsd_job_t *)cupsArrayNext(ActiveJobs)) if (job->state_value <= IPP_JOB_PROCESSING && - !strcasecmp(job->dest, printer->name)) + !_cups_strcasecmp(job->dest, printer->name)) break; if (job) @@ -4478,7 +4478,7 @@ cancel_job(cupsd_client_t *con, /* I - Client connection */ job; job = (cupsd_job_t *)cupsArrayNext(ActiveJobs)) if (job->state_value == IPP_JOB_STOPPED && - !strcasecmp(job->dest, printer->name)) + !_cups_strcasecmp(job->dest, printer->name)) break; if (job) @@ -4884,7 +4884,7 @@ check_quotas(cupsd_client_t *con, /* I - Client connection */ break; } #else - else if (!strcasecmp(username, name)) + else if (!_cups_strcasecmp(username, name)) break; #endif /* HAVE_MBR_UID_TO_UUID */ @@ -5267,20 +5267,24 @@ copy_attrs(ipp_t *to, /* I - Destination request */ fromattr->group_tag != IPP_TAG_ZERO) || !fromattr->name) continue; + if (!strcmp(fromattr->name, "job-printer-uri")) + continue; + if (exclude && (cupsArrayFind(exclude, fromattr->name) || cupsArrayFind(exclude, "all"))) { /* * We need to exclude this attribute for security reasons; we require the - * job-id and job-printer-uri attributes regardless of the security - * settings for IPP conformance. + * job-id attribute regardless of the security settings for IPP + * conformance. + * + * The job-printer-uri attribute is handled by copy_job_attrs(). * * Subscription attribute security is handled by copy_subscription_attrs(). */ - if (strcmp(fromattr->name, "job-id") && - strcmp(fromattr->name, "job-printer-uri")) + if (strcmp(fromattr->name, "job-id")) continue; } @@ -5529,7 +5533,7 @@ copy_banner(cupsd_client_t *con, /* I - Client connection */ case IPP_TAG_KEYWORD : case IPP_TAG_CHARSET : case IPP_TAG_LANGUAGE : - if (!strcasecmp(banner->filetype->type, "postscript")) + if (!_cups_strcasecmp(banner->filetype->type, "postscript")) { /* * Need to quote strings for PS banners... @@ -5942,10 +5946,6 @@ copy_job_attrs(cupsd_client_t *con, /* I - Client connection */ * Send the requested attributes for each job... */ - httpAssembleURIf(HTTP_URI_CODING_ALL, job_uri, sizeof(job_uri), "ipp", NULL, - con->servername, con->serverport, "/jobs/%d", - job->id); - if (!cupsArrayFind(exclude, "all")) { if ((!exclude || !cupsArrayFind(exclude, "document-count")) && @@ -5960,8 +5960,13 @@ copy_job_attrs(cupsd_client_t *con, /* I - Client connection */ if ((!exclude || !cupsArrayFind(exclude, "job-more-info")) && (!ra || cupsArrayFind(ra, "job-more-info"))) + { + httpAssembleURIf(HTTP_URI_CODING_ALL, job_uri, sizeof(job_uri), "http", + NULL, con->servername, con->serverport, "/jobs/%d", + job->id); ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI, "job-more-info", NULL, job_uri); + } if (job->state_value > IPP_JOB_PROCESSING && (!exclude || !cupsArrayFind(exclude, "job-preserved")) && @@ -5975,12 +5980,28 @@ copy_job_attrs(cupsd_client_t *con, /* I - Client connection */ "job-printer-up-time", time(NULL)); } + if (!ra || cupsArrayFind(ra, "job-printer-uri")) + { + httpAssembleURIf(HTTP_URI_CODING_ALL, job_uri, sizeof(job_uri), "ipp", NULL, + con->servername, con->serverport, + job->dtype & (CUPS_PRINTER_IMPLICIT | CUPS_PRINTER_CLASS) ? + "/classes/%s" : "/printers/%s", + job->dest); + ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI, + "job-printer-uri", NULL, job_uri); + } + if (!ra || cupsArrayFind(ra, "job-state-reasons")) add_job_state_reasons(con, job); if (!ra || cupsArrayFind(ra, "job-uri")) + { + httpAssembleURIf(HTTP_URI_CODING_ALL, job_uri, sizeof(job_uri), "ipp", NULL, + con->servername, con->serverport, "/jobs/%d", + job->id); ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI, "job-uri", NULL, job_uri); + } copy_attrs(con->response, job->attrs, ra, IPP_TAG_JOB, 0, exclude); } @@ -7777,7 +7798,7 @@ get_jobs(cupsd_client_t *con, /* I - Client connection */ continue; } - if (username[0] && strcasecmp(username, job->username)) + if (username[0] && _cups_strcasecmp(username, job->username)) continue; if (count > 0) @@ -8485,7 +8506,7 @@ get_printers(cupsd_client_t *con, /* I - Client connection */ if ((!type || (printer->type & CUPS_PRINTER_CLASS) == type) && (printer->type & printer_mask) == printer_type && (!location || - (printer->location && !strcasecmp(printer->location, location)))) + (printer->location && !_cups_strcasecmp(printer->location, location)))) { /* * If HideImplicitMembers is enabled, see if this printer or class @@ -8725,7 +8746,7 @@ get_subscriptions(cupsd_client_t *con, /* I - Client connection */ sub; sub = (cupsd_subscription_t *)cupsArrayNext(Subscriptions)) if ((!printer || sub->dest == printer) && (!job || sub->job == job) && - (!username[0] || !strcasecmp(username, sub->owner))) + (!username[0] || !_cups_strcasecmp(username, sub->owner))) { ippAddSeparator(con->response); @@ -9177,7 +9198,7 @@ move_job(cupsd_client_t *con, /* I - Client connection */ * completed... */ - if (strcasecmp(job->dest, src) || + if (_cups_strcasecmp(job->dest, src) || job->state_value > IPP_JOB_STOPPED) continue; @@ -9476,9 +9497,9 @@ print_job(cupsd_client_t *con, /* I - Client connection */ * Read any embedded job ticket info from PS files... */ - if (!strcasecmp(filetype->super, "application") && - (!strcasecmp(filetype->type, "postscript") || - !strcasecmp(filetype->type, "pdf"))) + if (!_cups_strcasecmp(filetype->super, "application") && + (!_cups_strcasecmp(filetype->type, "postscript") || + !_cups_strcasecmp(filetype->type, "pdf"))) read_job_ticket(con); /* @@ -10320,30 +10341,41 @@ save_auth_info( fchown(cupsFileNumber(fp), 0, 0); fchmod(cupsFileNumber(fp), 0400); + for (i = 0; + i < (int)(sizeof(job->auth_env) / sizeof(job->auth_env[0])); + i ++) + cupsdClearString(job->auth_env + i); + if (auth_info && auth_info->num_values == dest->num_auth_info_required) { /* * Write 1 to 3 auth values... */ - cupsdClearString(&job->auth_username); - cupsdClearString(&job->auth_domain); - cupsdClearString(&job->auth_password); - - for (i = 0; i < auth_info->num_values; i ++) + for (i = 0; + i < auth_info->num_values && + i < (int)(sizeof(job->auth_env) / sizeof(job->auth_env[0])); + i ++) { httpEncode64_2(line, sizeof(line), auth_info->values[i].string.text, strlen(auth_info->values[i].string.text)); cupsFilePrintf(fp, "%s\n", line); if (!strcmp(dest->auth_info_required[i], "username")) - cupsdSetStringf(&job->auth_username, "AUTH_USERNAME=%s", + cupsdSetStringf(job->auth_env + i, "AUTH_USERNAME=%s", auth_info->values[i].string.text); else if (!strcmp(dest->auth_info_required[i], "domain")) - cupsdSetStringf(&job->auth_domain, "AUTH_DOMAIN=%s", + cupsdSetStringf(job->auth_env + i, "AUTH_DOMAIN=%s", auth_info->values[i].string.text); else if (!strcmp(dest->auth_info_required[i], "password")) - cupsdSetStringf(&job->auth_password, "AUTH_PASSWORD=%s", + cupsdSetStringf(job->auth_env + i, "AUTH_PASSWORD=%s", + auth_info->values[i].string.text); + else if (!strcmp(dest->auth_info_required[i], "negotiate")) + cupsdSetStringf(job->auth_env + i, "AUTH_NEGOTIATE=%s", + auth_info->values[i].string.text); + else + cupsdSetStringf(job->auth_env + i, "AUTH_%s=%s", + dest->auth_info_required[i], auth_info->values[i].string.text); } } @@ -10356,8 +10388,7 @@ save_auth_info( httpEncode64_2(line, sizeof(line), con->username, strlen(con->username)); cupsFilePrintf(fp, "%s\n", line); - cupsdSetStringf(&job->auth_username, "AUTH_USERNAME=%s", con->username); - cupsdClearString(&job->auth_domain); + cupsdSetStringf(job->auth_env + 0, "AUTH_USERNAME=%s", con->username); /* * Write the authenticated password... @@ -10366,7 +10397,7 @@ save_auth_info( httpEncode64_2(line, sizeof(line), con->password, strlen(con->password)); cupsFilePrintf(fp, "%s\n", line); - cupsdSetStringf(&job->auth_password, "AUTH_PASSWORD=%s", con->password); + cupsdSetStringf(job->auth_env + 1, "AUTH_PASSWORD=%s", con->password); } #ifdef HAVE_GSSAPI @@ -12013,7 +12044,7 @@ user_allowed(cupsd_printer_t *p, /* I - Printer or class */ if (cupsdCheckGroup(username, pw, name)) break; } - else if (!strcasecmp(username, name)) + else if (!_cups_strcasecmp(username, name)) break; } diff --git a/scheduler/job.c b/scheduler/job.c index 4cff9177c..595656edc 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -72,6 +72,12 @@ #include <grp.h> #include <cups/backend.h> #include <cups/dir.h> +#ifdef __APPLE__ +# include <IOKit/pwr_mgt/IOPMLib.h> +# ifdef HAVE_IOKIT_PWR_MGT_IOPMLIBPRIVATE_H +# include <IOKit/pwr_mgt/IOPMLibPrivate.h> +# endif /* HAVE_IOKIT_PWR_MGT_IOPMLIBPRIVATE_H */ +#endif /* __APPLE__ */ /* @@ -347,7 +353,10 @@ cupsdCheckJobs(void) * Start pending jobs if the destination is available... */ - if (job->state_value == IPP_JOB_PENDING && !NeedReload && !Sleeping && + if (job->state_value == IPP_JOB_PENDING && !NeedReload && +#ifndef kIOPMAssertionTypeDenySystemSleep + !Sleeping && +#endif /* !kIOPMAssertionTypeDenySystemSleep */ !DoingShutdown && !job->printer) { printer = cupsdFindDest(job->dest); @@ -736,11 +745,11 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */ banner_page = 0; else if (job->job_sheets == NULL) banner_page = 0; - else if (strcasecmp(job->job_sheets->values[0].string.text, "none") != 0 && + else if (_cups_strcasecmp(job->job_sheets->values[0].string.text, "none") != 0 && job->current_file == 0) banner_page = 1; else if (job->job_sheets->num_values > 1 && - strcasecmp(job->job_sheets->values[1].string.text, "none") != 0 && + _cups_strcasecmp(job->job_sheets->values[1].string.text, "none") != 0 && job->current_file == (job->num_files - 1)) banner_page = 1; else @@ -997,12 +1006,15 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */ } envp[envc ++] = auth_info_required; - if (job->auth_username) - envp[envc ++] = job->auth_username; - if (job->auth_domain) - envp[envc ++] = job->auth_domain; - if (job->auth_password) - envp[envc ++] = job->auth_password; + + for (i = 0; + i < (int)(sizeof(job->auth_env) / sizeof(job->auth_env[0])); + i ++) + if (job->auth_env[i]) + envp[envc ++] = job->auth_env[i]; + else + break; + if (job->auth_uid) envp[envc ++] = job->auth_uid; @@ -1297,6 +1309,7 @@ void cupsdDeleteJob(cupsd_job_t *job, /* I - Job */ cupsd_jobaction_t action)/* I - Action */ { + int i; /* Looping var */ char filename[1024]; /* Job filename */ @@ -1319,9 +1332,10 @@ cupsdDeleteJob(cupsd_job_t *job, /* I - Job */ cupsdClearString(&job->username); cupsdClearString(&job->dest); - cupsdClearString(&job->auth_username); - cupsdClearString(&job->auth_domain); - cupsdClearString(&job->auth_password); + for (i = 0; + i < (int)(sizeof(job->auth_env) / sizeof(job->auth_env[0])); + i ++) + cupsdClearString(job->auth_env + i); cupsdClearString(&job->auth_uid); if (job->num_files > 0) @@ -1414,7 +1428,7 @@ cupsdGetPrinterJobCount( for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs), count = 0; job; job = (cupsd_job_t *)cupsArrayNext(ActiveJobs)) - if (job->dest && !strcasecmp(job->dest, dest)) + if (job->dest && !_cups_strcasecmp(job->dest, dest)) count ++; return (count); @@ -1437,7 +1451,7 @@ cupsdGetUserJobCount( for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs), count = 0; job; job = (cupsd_job_t *)cupsArrayNext(ActiveJobs)) - if (!strcasecmp(job->username, username)) + if (!_cups_strcasecmp(job->username, username)) count ++; return (count); @@ -1525,6 +1539,7 @@ cupsdLoadAllJobs(void) int /* O - 1 on success, 0 on failure */ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ { + int i; /* Looping var */ char jobfile[1024]; /* Job filename */ cups_file_t *fp; /* Job file */ int fileid; /* Current file ID */ @@ -1780,21 +1795,22 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ { snprintf(jobfile, sizeof(jobfile), "%s/a%05d", RequestRoot, job->id); - cupsdClearString(&job->auth_username); - cupsdClearString(&job->auth_domain); - cupsdClearString(&job->auth_password); + for (i = 0; + i < (int)(sizeof(job->auth_env) / sizeof(job->auth_env[0])); + i ++) + cupsdClearString(job->auth_env + i); cupsdClearString(&job->auth_uid); if ((fp = cupsFileOpen(jobfile, "r")) != NULL) { - int i, /* Looping var */ - bytes; /* Size of auth data */ + int bytes; /* Size of auth data */ char line[255], /* Line from file */ data[255]; /* Decoded data */ for (i = 0; i < destptr->num_auth_info_required && + i < (int)(sizeof(job->auth_env) / sizeof(job->auth_env[0])) && cupsFileGets(fp, line, sizeof(line)); i ++) { @@ -1802,14 +1818,13 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ httpDecode64_2(data, &bytes, line); if (!strcmp(destptr->auth_info_required[i], "username")) - cupsdSetStringf(&job->auth_username, "AUTH_USERNAME=%s", data); + cupsdSetStringf(job->auth_env + i, "AUTH_USERNAME=%s", data); else if (!strcmp(destptr->auth_info_required[i], "domain")) - cupsdSetStringf(&job->auth_domain, "AUTH_DOMAIN=%s", data); + cupsdSetStringf(job->auth_env + i, "AUTH_DOMAIN=%s", data); else if (!strcmp(destptr->auth_info_required[i], "password")) - cupsdSetStringf(&job->auth_password, "AUTH_PASSWORD=%s", data); - else if (!strcmp(destptr->auth_info_required[i], "negotiate") && - isdigit(line[0] & 255)) - cupsdSetStringf(&job->auth_uid, "AUTH_UID=%s", line); + cupsdSetStringf(job->auth_env + i, "AUTH_PASSWORD=%s", data); + else if (!strcmp(destptr->auth_info_required[i], "negotiate")) + cupsdSetStringf(job->auth_env + i, "AUTH_NEGOTIATE=%s", line); } if (cupsFileGets(fp, line, sizeof(line)) && isdigit(line[0] & 255)) @@ -2477,9 +2492,11 @@ cupsdSetJobState( "Unable to remove authentication cache: %s", strerror(errno)); - cupsdClearString(&job->auth_username); - cupsdClearString(&job->auth_domain); - cupsdClearString(&job->auth_password); + for (i = 0; + i < (int)(sizeof(job->auth_env) / sizeof(job->auth_env[0])); + i ++) + cupsdClearString(job->auth_env + i); + cupsdClearString(&job->auth_uid); /* @@ -3419,11 +3436,11 @@ get_options(cupsd_job_t *job, /* I - Job */ !strncmp(attr->name, "number-up", 9) || !strcmp(attr->name, "page-ranges") || !strcmp(attr->name, "page-set") || - !strcasecmp(attr->name, "AP_FIRSTPAGE_InputSlot") || - !strcasecmp(attr->name, "AP_FIRSTPAGE_ManualFeed") || - !strcasecmp(attr->name, "com.apple.print.PrintSettings." + !_cups_strcasecmp(attr->name, "AP_FIRSTPAGE_InputSlot") || + !_cups_strcasecmp(attr->name, "AP_FIRSTPAGE_ManualFeed") || + !_cups_strcasecmp(attr->name, "com.apple.print.PrintSettings." "PMTotalSidesImaged..n.") || - !strcasecmp(attr->name, "com.apple.print.PrintSettings." + !_cups_strcasecmp(attr->name, "com.apple.print.PrintSettings." "PMTotalBeginPages..n.")) && banner_page) continue; @@ -3691,12 +3708,12 @@ load_job_cache(const char *filename) /* I - job.cache filename */ while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum)) { - if (!strcasecmp(line, "NextJobId")) + if (!_cups_strcasecmp(line, "NextJobId")) { if (value) NextJobId = atoi(value); } - else if (!strcasecmp(line, "<Job")) + else if (!_cups_strcasecmp(line, "<Job")) { if (job) { @@ -3759,7 +3776,7 @@ load_job_cache(const char *filename) /* I - job.cache filename */ "Missing <Job #> directive on line %d!", linenum); continue; } - else if (!strcasecmp(line, "</Job>")) + else if (!_cups_strcasecmp(line, "</Job>")) { cupsArrayAdd(Jobs, job); @@ -3773,7 +3790,7 @@ load_job_cache(const char *filename) /* I - job.cache filename */ cupsdLogMessage(CUPSD_LOG_ERROR, "Missing value on line %d!", linenum); continue; } - else if (!strcasecmp(line, "State")) + else if (!_cups_strcasecmp(line, "State")) { job->state_value = (ipp_jstate_t)atoi(value); @@ -3782,27 +3799,27 @@ load_job_cache(const char *filename) /* I - job.cache filename */ else if (job->state_value > IPP_JOB_COMPLETED) job->state_value = IPP_JOB_COMPLETED; } - else if (!strcasecmp(line, "HoldUntil")) + else if (!_cups_strcasecmp(line, "HoldUntil")) { job->hold_until = atoi(value); } - else if (!strcasecmp(line, "Priority")) + else if (!_cups_strcasecmp(line, "Priority")) { job->priority = atoi(value); } - else if (!strcasecmp(line, "Username")) + else if (!_cups_strcasecmp(line, "Username")) { cupsdSetString(&job->username, value); } - else if (!strcasecmp(line, "Destination")) + else if (!_cups_strcasecmp(line, "Destination")) { cupsdSetString(&job->dest, value); } - else if (!strcasecmp(line, "DestType")) + else if (!_cups_strcasecmp(line, "DestType")) { job->dtype = (cups_ptype_t)atoi(value); } - else if (!strcasecmp(line, "NumFiles")) + else if (!_cups_strcasecmp(line, "NumFiles")) { job->num_files = atoi(value); @@ -3838,7 +3855,7 @@ load_job_cache(const char *filename) /* I - job.cache filename */ } } } - else if (!strcasecmp(line, "File")) + else if (!_cups_strcasecmp(line, "File")) { int number, /* File number */ compression; /* Compression value */ @@ -3934,7 +3951,7 @@ load_next_job_id(const char *filename) /* I - job.cache filename */ while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum)) { - if (!strcasecmp(line, "NextJobId")) + if (!_cups_strcasecmp(line, "NextJobId")) { if (value) { @@ -4083,6 +4100,9 @@ start_job(cupsd_job_t *job, /* I - Job ID */ if (!cupsdLoadJob(job)) return; + if (job->printer_message) + cupsdSetString(&(job->printer_message->values[0].string.text), ""); + cupsdSetJobState(job, IPP_JOB_PROCESSING, CUPSD_JOB_DEFAULT, NULL); cupsdSetPrinterState(printer, IPP_PRINTER_PROCESSING, 0); cupsdSetPrinterReasons(printer, "-cups-remote-pending," @@ -4127,9 +4147,6 @@ start_job(cupsd_job_t *job, /* I - Job ID */ job->status_buffer = cupsdStatBufNew(job->status_pipes[0], NULL); job->status_level = CUPSD_LOG_INFO; - if (job->printer_message) - cupsdSetString(&(job->printer_message->values[0].string.text), ""); - /* * Create the backchannel pipes and make them non-blocking... */ @@ -4325,7 +4342,7 @@ update_job(cupsd_job_t *job) /* I - Job to check */ if (job->sheets) { - if (!strncasecmp(message, "total ", 6)) + if (!_cups_strncasecmp(message, "total ", 6)) { /* * Got a total count of pages from a backend or filter... diff --git a/scheduler/job.h b/scheduler/job.h index 03a8dff87..3764478fd 100644 --- a/scheduler/job.h +++ b/scheduler/job.h @@ -3,7 +3,7 @@ * * Print job definitions for the CUPS scheduler. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -70,14 +70,9 @@ struct cupsd_job_s /**** Job request ****/ int backend; /* Backend process ID */ int status; /* Status code from filters */ int tries; /* Number of tries for this job */ - char *auth_username, /* AUTH_USERNAME environment variable, + char *auth_env[3], /* AUTH_xxx environment variables, * if any */ - *auth_domain, /* AUTH_DOMAIN environment variable, - * if any */ - *auth_password, /* AUTH_PASSWORD environment variable, - * if any */ - *auth_uid; /* AUTH_UID environment variable, - * if any */ + *auth_uid; /* AUTH_UID environment variable */ void *profile; /* Security profile */ cups_array_t *history; /* Debug log history */ int progress; /* Printing progress */ diff --git a/scheduler/log.c b/scheduler/log.c index aaea97ee9..1e363d031 100644 --- a/scheduler/log.c +++ b/scheduler/log.c @@ -344,7 +344,8 @@ cupsdLogFCMessage( if (cupsdSetPrinterReasons(p, "+cups-missing-filter-warning")) cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, p, NULL, "%s", message); } - else if (result == _CUPS_FILE_CHECK_PERMISSIONS) + else if (result == _CUPS_FILE_CHECK_PERMISSIONS || + result == _CUPS_FILE_CHECK_RELATIVE_PATH) { strlcpy(p->state_message, message, sizeof(p->state_message)); diff --git a/scheduler/main.c b/scheduler/main.c index 9b0615013..ec05b5b9a 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -1727,10 +1727,20 @@ process_children(void) else if (status) { if (WIFEXITED(status)) - cupsdLogMessage(CUPSD_LOG_DEBUG, "PID %d (%s) stopped with status %d!", - pid, name, WEXITSTATUS(status)); + { + int code = WEXITSTATUS(status); /* Exit code */ + + if (code > 100) + cupsdLogMessage(CUPSD_LOG_DEBUG, + "PID %d (%s) stopped with status %d (%s)", pid, name, + code, strerror(code - 100)); + else + cupsdLogMessage(CUPSD_LOG_DEBUG, + "PID %d (%s) stopped with status %d.", pid, name, + code); + } else - cupsdLogMessage(CUPSD_LOG_ERROR, "PID %d (%s) crashed on signal %d!", + cupsdLogMessage(CUPSD_LOG_ERROR, "PID %d (%s) crashed on signal %d.", pid, name, WTERMSIG(status)); if (LogLevel < CUPSD_LOG_DEBUG) diff --git a/scheduler/policy.c b/scheduler/policy.c index bdca28728..1e6e45e24 100644 --- a/scheduler/policy.c +++ b/scheduler/policy.c @@ -3,7 +3,7 @@ * * Policy routines for the CUPS scheduler. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2006 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -325,7 +325,7 @@ cupsdGetPrivateAttrs( */ if ((name = (char *)cupsArrayFirst(attrs_ptr)) != NULL && - !strcasecmp(name, "none")) + !_cups_strcasecmp(name, "none")) { #ifdef DEBUG cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdGetPrivateAttrs: Returning NULL."); @@ -371,7 +371,7 @@ cupsdGetPrivateAttrs( cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdGetPrivateAttrs: name=%s", name); #endif /* DEBUG */ - if (printer && !strcasecmp(name, "@ACL")) + if (printer && !_cups_strcasecmp(name, "@ACL")) { char *acl; /* Current ACL user/group */ @@ -397,12 +397,12 @@ cupsdGetPrivateAttrs( if (cupsdCheckGroup(username, pw, acl)) break; } - else if (!strcasecmp(username, acl)) + else if (!_cups_strcasecmp(username, acl)) break; } } - else if (owner && !strcasecmp(name, "@OWNER") && - !strcasecmp(username, owner)) + else if (owner && !_cups_strcasecmp(name, "@OWNER") && + !_cups_strcasecmp(username, owner)) { #ifdef DEBUG cupsdLogMessage(CUPSD_LOG_DEBUG2, @@ -411,7 +411,7 @@ cupsdGetPrivateAttrs( return (NULL); } - else if (!strcasecmp(name, "@SYSTEM")) + else if (!_cups_strcasecmp(name, "@SYSTEM")) { int i; /* Looping var */ @@ -438,7 +438,7 @@ cupsdGetPrivateAttrs( return (NULL); } } - else if (!strcasecmp(username, name)) + else if (!_cups_strcasecmp(username, name)) { #ifdef DEBUG cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdGetPrivateAttrs: Returning NULL."); @@ -480,7 +480,7 @@ static int /* O - Result of comparison */ compare_policies(cupsd_policy_t *a, /* I - First policy */ cupsd_policy_t *b) /* I - Second policy */ { - return (strcasecmp(a->name, b->name)); + return (_cups_strcasecmp(a->name, b->name)); } diff --git a/scheduler/printers.c b/scheduler/printers.c index 7f55b7ea1..b187c2bff 100644 --- a/scheduler/printers.c +++ b/scheduler/printers.c @@ -971,8 +971,8 @@ cupsdLoadAllPrinters(void) * Decode the directive... */ - if (!strcasecmp(line, "<Printer") || - !strcasecmp(line, "<DefaultPrinter")) + if (!_cups_strcasecmp(line, "<Printer") || + !_cups_strcasecmp(line, "<DefaultPrinter")) { /* * <Printer name> or <DefaultPrinter name> @@ -994,14 +994,14 @@ cupsdLoadAllPrinters(void) * Set the default printer as needed... */ - if (!strcasecmp(line, "<DefaultPrinter")) + if (!_cups_strcasecmp(line, "<DefaultPrinter")) DefaultPrinter = p; } else cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "</Printer>")) + else if (!_cups_strcasecmp(line, "</Printer>")) { if (p != NULL) { @@ -1047,7 +1047,7 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "UUID")) + else if (!_cups_strcasecmp(line, "UUID")) { if (value && !strncmp(value, "urn:uuid:", 9)) cupsdSetString(&(p->uuid), value); @@ -1055,29 +1055,29 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Bad UUID on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "AuthInfoRequired")) + else if (!_cups_strcasecmp(line, "AuthInfoRequired")) { if (!cupsdSetAuthInfoRequired(p, value, NULL)) cupsdLogMessage(CUPSD_LOG_ERROR, "Bad AuthInfoRequired on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "Info")) + else if (!_cups_strcasecmp(line, "Info")) { if (value) cupsdSetString(&p->info, value); } - else if (!strcasecmp(line, "MakeModel")) + else if (!_cups_strcasecmp(line, "MakeModel")) { if (value) cupsdSetString(&p->make_model, value); } - else if (!strcasecmp(line, "Location")) + else if (!_cups_strcasecmp(line, "Location")) { if (value) cupsdSetString(&p->location, value); } - else if (!strcasecmp(line, "DeviceURI")) + else if (!_cups_strcasecmp(line, "DeviceURI")) { if (value) cupsdSetDeviceURI(p, value); @@ -1085,7 +1085,7 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "Option") && value) + else if (!_cups_strcasecmp(line, "Option") && value) { /* * Option name value @@ -1104,7 +1104,7 @@ cupsdLoadAllPrinters(void) &(p->options)); } } - else if (!strcasecmp(line, "PortMonitor")) + else if (!_cups_strcasecmp(line, "PortMonitor")) { if (value && strcmp(value, "none")) cupsdSetString(&p->port_monitor, value); @@ -1114,7 +1114,7 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "Reason")) + else if (!_cups_strcasecmp(line, "Reason")) { if (value && strcmp(value, "connecting-to-device") && @@ -1136,15 +1136,15 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "State")) + else if (!_cups_strcasecmp(line, "State")) { /* * Set the initial queue state... */ - if (value && !strcasecmp(value, "idle")) + if (value && !_cups_strcasecmp(value, "idle")) p->state = IPP_PRINTER_IDLE; - else if (value && !strcasecmp(value, "stopped")) + else if (value && !_cups_strcasecmp(value, "stopped")) { p->state = IPP_PRINTER_STOPPED; @@ -1163,7 +1163,7 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "StateMessage")) + else if (!_cups_strcasecmp(line, "StateMessage")) { /* * Set the initial queue state message... @@ -1172,7 +1172,7 @@ cupsdLoadAllPrinters(void) if (value) strlcpy(p->state_message, value, sizeof(p->state_message)); } - else if (!strcasecmp(line, "StateTime")) + else if (!_cups_strcasecmp(line, "StateTime")) { /* * Set the state time... @@ -1181,27 +1181,27 @@ cupsdLoadAllPrinters(void) if (value) p->state_time = atoi(value); } - else if (!strcasecmp(line, "Accepting")) + else if (!_cups_strcasecmp(line, "Accepting")) { /* * Set the initial accepting state... */ if (value && - (!strcasecmp(value, "yes") || - !strcasecmp(value, "on") || - !strcasecmp(value, "true"))) + (!_cups_strcasecmp(value, "yes") || + !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "true"))) p->accepting = 1; else if (value && - (!strcasecmp(value, "no") || - !strcasecmp(value, "off") || - !strcasecmp(value, "false"))) + (!_cups_strcasecmp(value, "no") || + !_cups_strcasecmp(value, "off") || + !_cups_strcasecmp(value, "false"))) p->accepting = 0; else cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "Type")) + else if (!_cups_strcasecmp(line, "Type")) { if (value) p->type = atoi(value); @@ -1209,27 +1209,27 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "Shared")) + else if (!_cups_strcasecmp(line, "Shared")) { /* * Set the initial shared state... */ if (value && - (!strcasecmp(value, "yes") || - !strcasecmp(value, "on") || - !strcasecmp(value, "true"))) + (!_cups_strcasecmp(value, "yes") || + !_cups_strcasecmp(value, "on") || + !_cups_strcasecmp(value, "true"))) p->shared = 1; else if (value && - (!strcasecmp(value, "no") || - !strcasecmp(value, "off") || - !strcasecmp(value, "false"))) + (!_cups_strcasecmp(value, "no") || + !_cups_strcasecmp(value, "off") || + !_cups_strcasecmp(value, "false"))) p->shared = 0; else cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "JobSheets")) + else if (!_cups_strcasecmp(line, "JobSheets")) { /* * Set the initial job sheets... @@ -1261,7 +1261,7 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "AllowUser")) + else if (!_cups_strcasecmp(line, "AllowUser")) { if (value) { @@ -1272,7 +1272,7 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "DenyUser")) + else if (!_cups_strcasecmp(line, "DenyUser")) { if (value) { @@ -1283,7 +1283,7 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "QuotaPeriod")) + else if (!_cups_strcasecmp(line, "QuotaPeriod")) { if (value) p->quota_period = atoi(value); @@ -1291,7 +1291,7 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "PageLimit")) + else if (!_cups_strcasecmp(line, "PageLimit")) { if (value) p->page_limit = atoi(value); @@ -1299,7 +1299,7 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "KLimit")) + else if (!_cups_strcasecmp(line, "KLimit")) { if (value) p->k_limit = atoi(value); @@ -1307,7 +1307,7 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "OpPolicy")) + else if (!_cups_strcasecmp(line, "OpPolicy")) { if (value) { @@ -1328,7 +1328,7 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "ErrorPolicy")) + else if (!_cups_strcasecmp(line, "ErrorPolicy")) { if (value) cupsdSetString(&p->error_policy, value); @@ -1336,7 +1336,7 @@ cupsdLoadAllPrinters(void) cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d of printers.conf.", linenum); } - else if (!strcasecmp(line, "Attribute") && value) + else if (!_cups_strcasecmp(line, "Attribute") && value) { for (valueptr = value; *valueptr && !isspace(*valueptr & 255); valueptr ++); @@ -1356,15 +1356,18 @@ cupsdLoadAllPrinters(void) cupsdSetPrinterAttr(p, value, valueptr); } } - else + else if (_cups_strcasecmp(line, "Filter") && + _cups_strcasecmp(line, "Prefilter") && + _cups_strcasecmp(line, "Product")) { /* - * Something else we don't understand... + * Something else we don't understand (and that wasn't used in a prior + * release of CUPS... */ cupsdLogMessage(CUPSD_LOG_ERROR, - "Unknown configuration directive %s on line %d of printers.conf.", - line, linenum); + "Unknown configuration directive %s on line %d of " + "printers.conf.", line, linenum); } } @@ -3165,12 +3168,12 @@ cupsdValidateDest( * Change localhost to the server name... */ - if (!strcasecmp(hostname, "localhost")) + if (!_cups_strcasecmp(hostname, "localhost")) strlcpy(hostname, ServerName, sizeof(hostname)); strlcpy(localname, hostname, sizeof(localname)); - if (!strcasecmp(hostname, ServerName)) + if (!_cups_strcasecmp(hostname, ServerName)) { /* * Localize the hostname... @@ -3187,7 +3190,7 @@ cupsdValidateDest( while (lptr != NULL) { - if (!strcasecmp(lptr, sptr)) + if (!_cups_strcasecmp(lptr, sptr)) { *lptr = '\0'; break; @@ -3207,8 +3210,8 @@ cupsdValidateDest( for (p = (cupsd_printer_t *)cupsArrayFirst(Printers); p; p = (cupsd_printer_t *)cupsArrayNext(Printers)) - if (!strcasecmp(p->hostname, localname) && - !strcasecmp(p->name, rptr)) + if (!_cups_strcasecmp(p->hostname, localname) && + !_cups_strcasecmp(p->name, rptr)) { if (printer) *printer = p; @@ -3613,19 +3616,13 @@ add_printer_filter( if (strcmp(program, "-")) { - _cups_fc_result_t result; /* Result of file check */ - if (program[0] == '/') strlcpy(filename, program, sizeof(filename)); else snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin, program); - result = _cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !RunUser, - cupsdLogFCMessage, p); - - if (result == _CUPS_FILE_CHECK_MISSING || - result == _CUPS_FILE_CHECK_WRONG_TYPE) - return; + _cupsFileCheck(filename, _CUPS_FILE_CHECK_PROGRAM, !RunUser, + cupsdLogFCMessage, p); } /* @@ -3635,9 +3632,9 @@ add_printer_filter( for (temptype = mimeFirstType(MimeDatabase); temptype; temptype = mimeNextType(MimeDatabase)) - if (((super[0] == '*' && strcasecmp(temptype->super, "printer")) || - !strcasecmp(temptype->super, super)) && - (type[0] == '*' || !strcasecmp(temptype->type, type))) + if (((super[0] == '*' && _cups_strcasecmp(temptype->super, "printer")) || + !_cups_strcasecmp(temptype->super, super)) && + (type[0] == '*' || !_cups_strcasecmp(temptype->type, type))) { if (desttype != filtertype) { @@ -3720,7 +3717,7 @@ add_printer_formats(cupsd_printer_t *p) /* I - Printer */ type; type = mimeNextType(MimeDatabase)) { - if (!strcasecmp(type->super, "printer")) + if (!_cups_strcasecmp(type->super, "printer")) continue; snprintf(mimetype, sizeof(mimetype), "%s/%s", type->super, type->type); @@ -3803,20 +3800,20 @@ add_printer_formats(cupsd_printer_t *p) /* I - Printer */ type; type = (mime_type_t *)cupsArrayNext(p->filetypes)) { - if (!strcasecmp(type->super, "application")) + if (!_cups_strcasecmp(type->super, "application")) { - if (!strcasecmp(type->type, "pdf")) + if (!_cups_strcasecmp(type->type, "pdf")) strlcat(pdl, "application/pdf,", sizeof(pdl)); - else if (!strcasecmp(type->type, "postscript")) + else if (!_cups_strcasecmp(type->type, "postscript")) strlcat(pdl, "application/postscript,", sizeof(pdl)); } - else if (!strcasecmp(type->super, "image")) + else if (!_cups_strcasecmp(type->super, "image")) { - if (!strcasecmp(type->type, "jpeg")) + if (!_cups_strcasecmp(type->type, "jpeg")) strlcat(pdl, "image/jpeg,", sizeof(pdl)); - else if (!strcasecmp(type->type, "png")) + else if (!_cups_strcasecmp(type->type, "png")) strlcat(pdl, "image/png,", sizeof(pdl)); - else if (!strcasecmp(type->type, "pwg-raster")) + else if (!_cups_strcasecmp(type->type, "pwg-raster")) strlcat(pdl, "image/pwg-raster,", sizeof(pdl)); } } @@ -3841,7 +3838,7 @@ compare_printers(void *first, /* I - First printer */ { (void)data; - return (strcasecmp(((cupsd_printer_t *)first)->name, + return (_cups_strcasecmp(((cupsd_printer_t *)first)->name, ((cupsd_printer_t *)second)->name)); } @@ -4034,7 +4031,7 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */ if (!ppd->manual_copies) p->type |= CUPS_PRINTER_COPIES; if ((ppd_attr = ppdFindAttr(ppd, "cupsFax", NULL)) != NULL) - if (ppd_attr->value && !strcasecmp(ppd_attr->value, "true")) + if (ppd_attr->value && !_cups_strcasecmp(ppd_attr->value, "true")) p->type |= CUPS_PRINTER_FAX; ippAddBoolean(p->ppd_attrs, IPP_TAG_PRINTER, "color-supported", @@ -4455,10 +4452,10 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */ } else if (((ppd_attr = ppdFindAttr(ppd, "DefaultOutputOrder", NULL)) != NULL && - !strcasecmp(ppd_attr->value, "Reverse")) || + !_cups_strcasecmp(ppd_attr->value, "Reverse")) || (!ppd_attr && ppd->manufacturer && /* "Compatibility heuristic" */ - (!strcasecmp(ppd->manufacturer, "epson") || - !strcasecmp(ppd->manufacturer, "lexmark")))) + (!_cups_strcasecmp(ppd->manufacturer, "epson") || + !_cups_strcasecmp(ppd->manufacturer, "lexmark")))) { /* * Report that this printer has a single output bin that leaves pages face @@ -4624,10 +4621,10 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */ ippAddStrings(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "sides-supported", 3, NULL, sides); - if (!strcasecmp(duplex->defchoice, "DuplexTumble")) + if (!_cups_strcasecmp(duplex->defchoice, "DuplexTumble")) ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "sides-default", NULL, "two-sided-short-edge"); - else if (!strcasecmp(duplex->defchoice, "DuplexNoTumble")) + else if (!_cups_strcasecmp(duplex->defchoice, "DuplexNoTumble")) ippAddString(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "sides-default", NULL, "two-sided-long-edge"); else @@ -4666,10 +4663,10 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */ p->type |= CUPS_PRINTER_SMALL; if ((ppd_attr = ppdFindAttr(ppd, "APICADriver", NULL)) != NULL && - ppd_attr->value && !strcasecmp(ppd_attr->value, "true")) + ppd_attr->value && !_cups_strcasecmp(ppd_attr->value, "true")) { if ((ppd_attr = ppdFindAttr(ppd, "APScannerOnly", NULL)) != NULL && - ppd_attr->value && !strcasecmp(ppd_attr->value, "true")) + ppd_attr->value && !_cups_strcasecmp(ppd_attr->value, "true")) p->type |= CUPS_PRINTER_SCANNER; else p->type |= CUPS_PRINTER_MFP; @@ -4685,7 +4682,7 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */ filter; filter = (const char *)cupsArrayNext(p->pc->filters)) { - if (!strncasecmp(filter, "application/vnd.cups-command", 28) && + if (!_cups_strncasecmp(filter, "application/vnd.cups-command", 28) && _cups_isspace(filter[28])) { p->type |= CUPS_PRINTER_COMMANDS; diff --git a/scheduler/process.c b/scheduler/process.c index 8b3e3f23b..de6fed678 100644 --- a/scheduler/process.c +++ b/scheduler/process.c @@ -77,6 +77,7 @@ cupsdCreateProfile(int job_id) /* I - Job ID or 0 for none */ request[1024], /* Quoted RequestRoot */ root[1024], /* Quoted ServerRoot */ temp[1024]; /* Quoted TempDir */ + const char *nodebug; /* " (with no-log)" for no debug */ if (!UseProfiles) @@ -108,24 +109,24 @@ cupsdCreateProfile(int job_id) /* I - Job ID or 0 for none */ cupsd_requote(root, ServerRoot, sizeof(root)); cupsd_requote(temp, TempDir, sizeof(temp)); + nodebug = LogLevel < CUPSD_LOG_DEBUG ? " (with no-log)" : ""; + cupsFilePuts(fp, "(version 1)\n"); - if (LogLevel >= CUPSD_LOG_DEBUG) - cupsFilePuts(fp, "(debug deny)\n"); cupsFilePuts(fp, "(allow default)\n"); cupsFilePrintf(fp, "(deny file-write* file-read-data file-read-metadata\n" " (regex" " #\"^%s$\"" /* RequestRoot */ " #\"^%s/\"" /* RequestRoot/... */ - "))\n", - request, request); + ")%s)\n", + request, request, nodebug); if (!RunUser) - cupsFilePuts(fp, - "(deny file-write* file-read-data file-read-metadata\n" - " (regex" - " #\"^/Users$\"" - " #\"^/Users/\"" - "))\n"); + cupsFilePrintf(fp, + "(deny file-write* file-read-data file-read-metadata\n" + " (regex" + " #\"^/Users$\"" + " #\"^/Users/\"" + ")%s)\n", nodebug); cupsFilePrintf(fp, "(deny file-write*\n" " (regex" @@ -139,8 +140,8 @@ cupsdCreateProfile(int job_id) /* I - Job ID or 0 for none */ " #\"^/Library/\"" " #\"^/System$\"" " #\"^/System/\"" - "))\n", - root, root); + ")%s)\n", + root, root, nodebug); /* Specifically allow applications to stat RequestRoot */ cupsFilePrintf(fp, "(allow file-read-metadata\n" @@ -164,14 +165,14 @@ cupsdCreateProfile(int job_id) /* I - Job ID or 0 for none */ " #\"^/Users/Shared/\"" "))\n", temp, temp, cache, cache, request, request); - cupsFilePuts(fp, - "(deny file-write*\n" - " (regex" - " #\"^/Library/Printers/PPDs$\"" - " #\"^/Library/Printers/PPDs/\"" - " #\"^/Library/Printers/PPD Plugins$\"" - " #\"^/Library/Printers/PPD Plugins/\"" - "))\n"); + cupsFilePrintf(fp, + "(deny file-write*\n" + " (regex" + " #\"^/Library/Printers/PPDs$\"" + " #\"^/Library/Printers/PPDs/\"" + " #\"^/Library/Printers/PPD Plugins$\"" + " #\"^/Library/Printers/PPD Plugins/\"" + ")%s)\n", nodebug); if (job_id) { /* @@ -244,7 +245,18 @@ cupsdEndProcess(int pid, /* I - Process ID */ if (!pid) return (0); - else if (force) + + if (!RunUser) + { + /* + * When running as root, cupsd puts child processes in their own process + * group. Using "-pid" sends a signal to all processes in the group. + */ + + pid = -pid; + } + + if (force) return (kill(pid, SIGKILL)); else return (kill(pid, SIGTERM)); @@ -412,9 +424,36 @@ cupsdStartProcess( if ((*pid = fork()) == 0) { /* - * Child process goes here... - * - * Update stdin/stdout/stderr as needed... + * Child process goes here; update stderr as needed... + */ + + if (errfd != 2) + { + if (errfd < 0) + errfd = open("/dev/null", O_WRONLY); + + if (errfd != 2) + { + dup2(errfd, 2); + close(errfd); + } + } + + /* + * Put this process in its own process group so that we can kill any child + * processes it creates. + */ + +#ifdef HAVE_SETPGID + if (!RunUser && setpgid(0, 0)) + exit(errno + 100); +#else + if (!RunUser && setpgrp()) + exit(errno + 100); +#endif /* HAVE_SETPGID */ + + /* + * Update the remaining file descriptors as needed... */ if (infd != 0) @@ -441,18 +480,6 @@ cupsdStartProcess( } } - if (errfd != 2) - { - if (errfd < 0) - errfd = open("/dev/null", O_WRONLY); - - if (errfd != 2) - { - dup2(errfd, 2); - close(errfd); - } - } - if (backfd != 3 && backfd >= 0) { dup2(backfd, 3); @@ -476,36 +503,21 @@ cupsdStartProcess( nice(FilterNice); /* - * Change user to something "safe"... + * Reset group membership to just the main one we belong to. */ - if (!root && !RunUser) - { - /* - * Running as root, so change to non-priviledged user... - */ - - if (setgid(Group)) - exit(errno); - - if (setgroups(1, &Group)) - exit(errno); + if (!RunUser && setgid(Group)) + exit(errno + 100); - if (setuid(User)) - exit(errno); - } - else - { - /* - * Reset group membership to just the main one we belong to. - */ + if (!RunUser && setgroups(1, &Group)) + exit(errno + 100); - if (setgid(Group) && !RunUser) - exit(errno); + /* + * Change user to something "safe"... + */ - if (setgroups(1, &Group) && !RunUser) - exit(errno); - } + if (!RunUser && user && setuid(user)) + exit(errno + 100); /* * Change umask to restrict permissions on created files... @@ -548,9 +560,7 @@ cupsdStartProcess( else execv(exec_path, argv); - perror(command); - - exit(1); + exit(errno + 100); } else if (*pid < 0) { diff --git a/scheduler/quotas.c b/scheduler/quotas.c index 15f1b37b3..e41c1cc1b 100644 --- a/scheduler/quotas.c +++ b/scheduler/quotas.c @@ -3,7 +3,7 @@ * * Quota routines for the CUPS scheduler. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -146,8 +146,8 @@ cupsdUpdateQuota( * We only care about the current printer/class and user... */ - if (strcasecmp(job->dest, p->name) != 0 || - strcasecmp(job->username, q->username) != 0) + if (_cups_strcasecmp(job->dest, p->name) != 0 || + _cups_strcasecmp(job->username, q->username) != 0) continue; /* @@ -235,7 +235,7 @@ static int /* O - Result of comparison */ compare_quotas(const cupsd_quota_t *q1, /* I - First quota record */ const cupsd_quota_t *q2) /* I - Second quota record */ { - return (strcasecmp(q1->username, q2->username)); + return (_cups_strcasecmp(q1->username, q2->username)); } diff --git a/scheduler/subscriptions.c b/scheduler/subscriptions.c index b2ad51e8f..3ffb54659 100644 --- a/scheduler/subscriptions.c +++ b/scheduler/subscriptions.c @@ -748,7 +748,7 @@ cupsdLoadAllSubscriptions(void) while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum)) { - if (!strcasecmp(line, "NextSubscriptionId") && value) + if (!_cups_strcasecmp(line, "NextSubscriptionId") && value) { /* * NextSubscriptionId NNN @@ -758,7 +758,7 @@ cupsdLoadAllSubscriptions(void) if (i >= NextSubscriptionId && i > 0) NextSubscriptionId = i; } - else if (!strcasecmp(line, "<Subscription")) + else if (!_cups_strcasecmp(line, "<Subscription")) { /* * <Subscription #> @@ -777,7 +777,7 @@ cupsdLoadAllSubscriptions(void) break; } } - else if (!strcasecmp(line, "</Subscription>")) + else if (!_cups_strcasecmp(line, "</Subscription>")) { if (!sub) { @@ -799,7 +799,7 @@ cupsdLoadAllSubscriptions(void) "Syntax error on line %d of subscriptions.conf.", linenum); } - else if (!strcasecmp(line, "Events")) + else if (!_cups_strcasecmp(line, "Events")) { /* * Events name @@ -840,7 +840,7 @@ cupsdLoadAllSubscriptions(void) value = valueptr; } } - else if (!strcasecmp(line, "Owner")) + else if (!_cups_strcasecmp(line, "Owner")) { /* * Owner @@ -856,7 +856,7 @@ cupsdLoadAllSubscriptions(void) break; } } - else if (!strcasecmp(line, "Recipient")) + else if (!_cups_strcasecmp(line, "Recipient")) { /* * Recipient uri @@ -872,7 +872,7 @@ cupsdLoadAllSubscriptions(void) break; } } - else if (!strcasecmp(line, "JobId")) + else if (!_cups_strcasecmp(line, "JobId")) { /* * JobId # @@ -896,7 +896,7 @@ cupsdLoadAllSubscriptions(void) break; } } - else if (!strcasecmp(line, "PrinterName")) + else if (!_cups_strcasecmp(line, "PrinterName")) { /* * PrinterName name @@ -920,7 +920,7 @@ cupsdLoadAllSubscriptions(void) break; } } - else if (!strcasecmp(line, "UserData")) + else if (!_cups_strcasecmp(line, "UserData")) { /* * UserData encoded-string @@ -982,7 +982,7 @@ cupsdLoadAllSubscriptions(void) break; } } - else if (!strcasecmp(line, "LeaseDuration")) + else if (!_cups_strcasecmp(line, "LeaseDuration")) { /* * LeaseDuration # @@ -1001,7 +1001,7 @@ cupsdLoadAllSubscriptions(void) break; } } - else if (!strcasecmp(line, "Interval")) + else if (!_cups_strcasecmp(line, "Interval")) { /* * Interval # @@ -1017,7 +1017,7 @@ cupsdLoadAllSubscriptions(void) break; } } - else if (!strcasecmp(line, "ExpirationTime")) + else if (!_cups_strcasecmp(line, "ExpirationTime")) { /* * ExpirationTime # @@ -1033,7 +1033,7 @@ cupsdLoadAllSubscriptions(void) break; } } - else if (!strcasecmp(line, "NextEventId")) + else if (!_cups_strcasecmp(line, "NextEventId")) { /* * NextEventId # diff --git a/scheduler/sysman.c b/scheduler/sysman.c index 9c323439f..2df34921f 100644 --- a/scheduler/sysman.c +++ b/scheduler/sysman.c @@ -216,11 +216,15 @@ cupsdSetBusyState(void) #ifdef kIOPMAssertionTypeDenySystemSleep if ((busy & 2) && !dark_wake) + { + cupsdLogMessage(CUPSD_LOG_DEBUG2, "Asserting dark wake."); IOPMAssertionCreateWithName(kIOPMAssertionTypeDenySystemSleep, kIOPMAssertionLevelOn, CFSTR("org.cups.cupsd"), &dark_wake); + } else if (!(busy & 2) && dark_wake) { + cupsdLogMessage(CUPSD_LOG_DEBUG2, "Releasing dark wake assertion."); IOPMAssertionRelease(dark_wake); dark_wake = 0; } @@ -877,6 +881,15 @@ sysUpdate(void) cupsdCleanDirty(); +#ifdef kIOPMAssertionTypeDenySystemSleep + /* + * Tell the OS it is OK to sleep when we remove our assertion... + */ + + IOAllowPowerChange(sysevent.powerKernelPort, + sysevent.powerNotificationID); + +#else /* * If we have no printing jobs, allow the power change immediately. * Otherwise set the SleepJobs time to 15 seconds in the future when @@ -920,6 +933,7 @@ sysUpdate(void) sysevent.powerNotificationID); } } +#endif /* kIOPMAssertionTypeDenySystemSleep */ } if (sysevent.event & SYSEVENT_WOKE) diff --git a/scheduler/testmime.c b/scheduler/testmime.c index 1561e81b7..2a54e73ef 100644 --- a/scheduler/testmime.c +++ b/scheduler/testmime.c @@ -3,7 +3,7 @@ * * MIME test program for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2006 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -286,9 +286,9 @@ add_ppd_filter(mime_t *mime, /* I - MIME database */ for (temptype = mimeFirstType(mime); temptype; temptype = mimeNextType(mime)) - if (((super[0] == '*' && strcasecmp(temptype->super, "printer")) || - !strcasecmp(temptype->super, super)) && - (type[0] == '*' || !strcasecmp(temptype->type, type))) + if (((super[0] == '*' && _cups_strcasecmp(temptype->super, "printer")) || + !_cups_strcasecmp(temptype->super, super)) && + (type[0] == '*' || !_cups_strcasecmp(temptype->type, type))) { if (desttype != filtertype) { diff --git a/scheduler/type.c b/scheduler/type.c index 78652b529..60c858a96 100644 --- a/scheduler/type.c +++ b/scheduler/type.c @@ -715,8 +715,8 @@ mime_compare_types(mime_type_t *t0, /* I - First type */ int i; /* Result of comparison */ - if ((i = strcasecmp(t0->super, t1->super)) == 0) - i = strcasecmp(t0->type, t1->type); + if ((i = _cups_strcasecmp(t0->super, t1->super)) == 0) + i = _cups_strcasecmp(t0->type, t1->type); return (i); } @@ -917,7 +917,7 @@ mime_check_rules( if ((rules->offset + rules->length) > (fb->offset + fb->length)) result = 0; else - result = (strncasecmp((char *)fb->buffer + rules->offset - + result = (_cups_strncasecmp((char *)fb->buffer + rules->offset - fb->offset, rules->value.stringv, rules->length) == 0); break; diff --git a/scheduler/util.c b/scheduler/util.c index 25c49ef0a..95c294dd7 100644 --- a/scheduler/util.c +++ b/scheduler/util.c @@ -36,13 +36,13 @@ #ifdef __APPLE__ # include <libgen.h> extern char **environ; -#endif /* __APPLE__ */ +#endif /* __APPLE__ */ /* * 'cupsdCompareNames()' - Compare two names. * - * This function basically does a strcasecmp() of the two strings, + * This function basically does a _cups_strcasecmp() of the two strings, * but is also aware of numbers so that "a2" < "a100". */ @@ -91,7 +91,7 @@ cupsdCompareNames(const char *s, /* I - First string */ else if (!isdigit(*s & 255) && isdigit(*t & 255)) return (-1); else if (!isdigit(*s & 255) || !isdigit(*t & 255)) - continue; + continue; if (*s < *t) diff = -1; diff --git a/standards/rfctohtml.c b/standards/rfctohtml.c index 21efca536..99743cae7 100644 --- a/standards/rfctohtml.c +++ b/standards/rfctohtml.c @@ -3,7 +3,7 @@ * * RFC file to HTML conversion program. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -132,7 +132,7 @@ main(int argc, /* I - Number of command-line args */ if (!line[0]) break; - else if (!strncasecmp(line, "Request for Comments:", 21)) + else if (!_cups_strncasecmp(line, "Request for Comments:", 21)) rfc = atoi(line + 21); } @@ -385,7 +385,7 @@ main(int argc, /* I - Number of command-line args */ put_line(outfile, line); - intoc = !strcasecmp(line, "Table of Contents"); + intoc = !_cups_strcasecmp(line, "Table of Contents"); toclevel = 0; } } diff --git a/systemv/cancel.c b/systemv/cancel.c index 2b5be210f..b2881ca19 100644 --- a/systemv/cancel.c +++ b/systemv/cancel.c @@ -99,7 +99,7 @@ main(int argc, /* I - Number of command-line arguments */ cupsSetUser(argv[i]); } break; - + case 'a' : /* Cancel all jobs */ purge = 1; op = IPP_PURGE_JOBS; @@ -283,7 +283,7 @@ main(int argc, /* I - Number of command-line arguments */ * Do the request and get back a response... */ - if (op == IPP_PURGE_JOBS && (!user || strcasecmp(user, cupsUser()))) + if (op == IPP_PURGE_JOBS && (!user || _cups_strcasecmp(user, cupsUser()))) response = cupsDoRequest(http, request, "/admin/"); else response = cupsDoRequest(http, request, "/jobs/"); diff --git a/systemv/cupstestppd.c b/systemv/cupstestppd.c index b841b975b..2acc0f25f 100644 --- a/systemv/cupstestppd.c +++ b/systemv/cupstestppd.c @@ -616,7 +616,7 @@ main(int argc, /* I - Number of command-line args */ ptr = attr->value; if (*ptr == '4' && ptr[1] == '.') { - + for (ptr += 2; *ptr; ptr ++) if (!isdigit(*ptr & 255)) break; @@ -697,8 +697,8 @@ main(int argc, /* I - Number of command-line args */ if (ppd->manufacturer != NULL) { - if (!strncasecmp(ppd->manufacturer, "Hewlett-Packard", 15) || - !strncasecmp(ppd->manufacturer, "Hewlett Packard", 15)) + if (!_cups_strncasecmp(ppd->manufacturer, "Hewlett-Packard", 15) || + !_cups_strncasecmp(ppd->manufacturer, "Hewlett Packard", 15)) { if (verbose >= 0) { @@ -713,8 +713,8 @@ main(int argc, /* I - Number of command-line args */ errors ++; } - else if (!strncasecmp(ppd->manufacturer, "OkiData", 7) || - !strncasecmp(ppd->manufacturer, "Oki Data", 8)) + else if (!_cups_strncasecmp(ppd->manufacturer, "OkiData", 7) || + !_cups_strncasecmp(ppd->manufacturer, "Oki Data", 8)) { if (verbose >= 0) { @@ -1194,7 +1194,7 @@ main(int argc, /* I - Number of command-line args */ errors ++; } - + /* * Loop through all options and choices... */ @@ -1332,7 +1332,7 @@ main(int argc, /* I - Number of command-line args */ !strcmp(attr->name, "DefaultTransfer")) continue; - if (!strncmp(attr->name, "Default", 7) && + if (!strncmp(attr->name, "Default", 7) && !ppdFindOption(ppd, attr->name + 7)) _cupsLangPrintf(stdout, _(" WARN %s has no corresponding " @@ -1380,7 +1380,7 @@ main(int argc, /* I - Number of command-line args */ "5.3.")); } - if (!strcasecmp(ppd->pcfilename, "unused.ppd")) + if (!_cups_strcasecmp(ppd->pcfilename, "unused.ppd")) _cupsLangPuts(stdout, _(" WARN PCFileName should contain a " "unique filename.\n" @@ -1466,7 +1466,7 @@ main(int argc, /* I - Number of command-line args */ /* * Then list the options, if "-v" was provided... - */ + */ if (verbose > 1) { @@ -1684,7 +1684,7 @@ check_basics(const char *filename) /* I - PPD file to check */ else if (eol != EOL_CR) mixed = 1; } - + if (col > 0 && whitespace) _cupsLangPrintf(stdout, _(" WARN Line %d only contains whitespace."), @@ -1841,7 +1841,7 @@ check_constraints(ppd_file_t *ppd, /* I - PPD file */ *ptr = '\0'; } - if (!strncasecmp(option, "Custom", 6) && !strcasecmp(choice, "True")) + if (!_cups_strncasecmp(option, "Custom", 6) && !_cups_strcasecmp(choice, "True")) { _cups_strcpy(option, option + 6); strcpy(choice, "Custom"); @@ -1856,7 +1856,7 @@ check_constraints(ppd_file_t *ppd, /* I - PPD file */ _(" %s Missing option %s in " "cupsUIConstraints %s: \"%s\""), prefix, option, constattr->spec, constattr->value); - + if (!warn) errors ++; @@ -1885,9 +1885,9 @@ check_constraints(ppd_file_t *ppd, /* I - PPD file */ else { for (i = 0; i < o->num_choices; i ++) - if (strcasecmp(o->choices[i].choice, "None") && - strcasecmp(o->choices[i].choice, "Off") && - strcasecmp(o->choices[i].choice, "False")) + if (_cups_strcasecmp(o->choices[i].choice, "None") && + _cups_strcasecmp(o->choices[i].choice, "Off") && + _cups_strcasecmp(o->choices[i].choice, "False")) { num_options = cupsAddOption(option, o->choices[i].choice, num_options, &options); @@ -1942,8 +1942,8 @@ check_constraints(ppd_file_t *ppd, /* I - PPD file */ for (i = ppd->num_consts, c = ppd->consts; i > 0; i --, c ++) { - if (!strncasecmp(c->option1, "Custom", 6) && - !strcasecmp(c->choice1, "True")) + if (!_cups_strncasecmp(c->option1, "Custom", 6) && + !_cups_strcasecmp(c->choice1, "True")) { strcpy(option, c->option1 + 6); strcpy(choice, "Custom"); @@ -1983,8 +1983,8 @@ check_constraints(ppd_file_t *ppd, /* I - PPD file */ errors ++; } - if (!strncasecmp(c->option2, "Custom", 6) && - !strcasecmp(c->choice2, "True")) + if (!_cups_strncasecmp(c->option2, "Custom", 6) && + !_cups_strcasecmp(c->choice2, "True")) { strcpy(option, c->option2 + 6); strcpy(choice, "Custom"); @@ -2055,7 +2055,7 @@ check_case(ppd_file_t *ppd, /* I - PPD file */ for (i = ppd->num_groups, groupa = ppd->groups; i > 1; i --, groupa ++) for (j = i - 1, groupb = groupa + 1; j > 0; j --, groupb ++) - if (!strcasecmp(groupa->name, groupb->name)) + if (!_cups_strcasecmp(groupa->name, groupb->name)) { if (!errors && !verbose) _cupsLangPuts(stdout, _(" FAIL")); @@ -2077,7 +2077,7 @@ check_case(ppd_file_t *ppd, /* I - PPD file */ { cupsArraySave(ppd->options); for (optionb = ppdNextOption(ppd); optionb; optionb = ppdNextOption(ppd)) - if (!strcasecmp(optiona->keyword, optionb->keyword)) + if (!_cups_strcasecmp(optiona->keyword, optionb->keyword)) { if (!errors && !verbose) _cupsLangPuts(stdout, _(" FAIL")); @@ -2117,7 +2117,7 @@ check_case(ppd_file_t *ppd, /* I - PPD file */ i --; break; } - else if (!strcasecmp(choicea->choice, choiceb->choice)) + else if (!_cups_strcasecmp(choicea->choice, choiceb->choice)) { if (!errors && !verbose) _cupsLangPuts(stdout, _(" FAIL")); @@ -2478,8 +2478,8 @@ check_filters(ppd_file_t *ppd, /* I - PPD file */ * APDialogExtension */ - for (attr = ppdFindAttr(ppd, "APDialogExtension", NULL); - attr != NULL; + for (attr = ppdFindAttr(ppd, "APDialogExtension", NULL); + attr != NULL; attr = ppdFindNextAttr(ppd, "APDialogExtension", NULL)) { if (strcmp(attr->name, "APDialogExtension")) @@ -2495,7 +2495,7 @@ check_filters(ppd_file_t *ppd, /* I - PPD file */ if (!warn) errors ++; } - + snprintf(pathprog, sizeof(pathprog), "%s%s", root, attr->value ? attr->value : "(null)"); @@ -3075,7 +3075,7 @@ check_sizes(ppd_file_t *ppd, /* I - PPD file */ { snprintf(buf, sizeof(buf), "%s.Fullbleed", pwg_media->ppd); if (strcmp(size->name, buf)) - is_ok = 0; + is_ok = 0; } else if (size->width > size->length) { @@ -3092,7 +3092,7 @@ check_sizes(ppd_file_t *ppd, /* I - PPD file */ { snprintf(buf, sizeof(buf), "%s.Transverse", pwg_media->ppd); if (strcmp(size->name, buf)) - is_ok = 0; + is_ok = 0; } } } @@ -3112,7 +3112,7 @@ check_sizes(ppd_file_t *ppd, /* I - PPD file */ else is_ok = 0; } - + if (!is_ok) _cupsLangPrintf(stdout, _(" %s Size \"%s\" should be the Adobe " @@ -3288,7 +3288,7 @@ check_translations(ppd_file_t *ppd, /* I - PPD file */ * Check custom choices differently... */ - if (!strcasecmp(option->choices[j].choice, "Custom") && + if (!_cups_strcasecmp(option->choices[j].choice, "Custom") && (coption = ppdFindCustomOption(ppd, option->keyword)) != NULL) { @@ -3314,7 +3314,7 @@ check_translations(ppd_file_t *ppd, /* I - PPD file */ errors ++; } - if (strcasecmp(option->keyword, "PageSize")) + if (_cups_strcasecmp(option->keyword, "PageSize")) { for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params); cparam; @@ -3498,9 +3498,9 @@ show_conflicts(ppd_file_t *ppd, /* I - PPD to check */ break; if (j == 0 || - !strcasecmp(c1->choice, "None") || - !strcasecmp(c1->choice, "Off") || - !strcasecmp(c1->choice, "False")) + !_cups_strcasecmp(c1->choice, "None") || + !_cups_strcasecmp(c1->choice, "Off") || + !_cups_strcasecmp(c1->choice, "False")) c1 = NULL; } @@ -3531,9 +3531,9 @@ show_conflicts(ppd_file_t *ppd, /* I - PPD to check */ break; if (j == 0 || - !strcasecmp(c2->choice, "None") || - !strcasecmp(c2->choice, "Off") || - !strcasecmp(c2->choice, "False")) + !_cups_strcasecmp(c2->choice, "None") || + !_cups_strcasecmp(c2->choice, "Off") || + !_cups_strcasecmp(c2->choice, "False")) c2 = NULL; } diff --git a/systemv/lpadmin.c b/systemv/lpadmin.c index 4794240b2..64c3f84e9 100644 --- a/systemv/lpadmin.c +++ b/systemv/lpadmin.c @@ -443,7 +443,7 @@ main(int argc, /* I - Number of command-line arguments */ cupsSetUser(argv[i]); } break; - + case 'u' : /* Allow/deny users */ if (argv[i][2]) val = argv[i] + 2; @@ -462,10 +462,10 @@ main(int argc, /* I - Number of command-line arguments */ val = argv[i]; } - if (!strncasecmp(val, "allow:", 6)) + if (!_cups_strncasecmp(val, "allow:", 6)) num_options = cupsAddOption("requesting-user-name-allowed", val + 6, num_options, &options); - else if (!strncasecmp(val, "deny:", 5)) + else if (!_cups_strncasecmp(val, "deny:", 5)) num_options = cupsAddOption("requesting-user-name-denied", val + 5, num_options, &options); else @@ -579,7 +579,7 @@ main(int argc, /* I - Number of command-line arguments */ _cupsLangPuts(stderr, _("lpadmin: Warning - content type list ignored.")); break; - + case 'L' : /* Set the printer-location attribute */ if (argv[i][2]) num_options = cupsAddOption("printer-location", argv[i] + 2, @@ -756,7 +756,7 @@ add_printer_to_class(http_t *http, /* I - Server connection */ (members = ippFindAttribute(response, "member-names", IPP_TAG_NAME)) != NULL) for (i = 0; i < members->num_values; i ++) - if (strcasecmp(printer, members->values[i].string.text) == 0) + if (_cups_strcasecmp(printer, members->values[i].string.text) == 0) { _cupsLangPrintf(stderr, _("lpadmin: Printer %s is already a member of class " @@ -980,7 +980,7 @@ delete_printer_from_class( } for (i = 0; i < members->num_values; i ++) - if (!strcasecmp(printer, members->values[i].string.text)) + if (!_cups_strcasecmp(printer, members->values[i].string.text)) break; if (i >= members->num_values) @@ -1302,10 +1302,10 @@ set_printer_options( if ((protocol = cupsGetOption("protocol", num_options, options)) != NULL) { - if (!strcasecmp(protocol, "bcp")) + if (!_cups_strcasecmp(protocol, "bcp")) ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME, "port-monitor", NULL, "bcp"); - else if (!strcasecmp(protocol, "tbcp")) + else if (!_cups_strcasecmp(protocol, "tbcp")) ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME, "port-monitor", NULL, "tbcp"); } @@ -1359,9 +1359,9 @@ set_printer_options( { wrote_ipp_supplies = 1; cupsFilePrintf(out, "*cupsIPPSupplies: %s\n", - (!strcasecmp(boolval, "true") || - !strcasecmp(boolval, "yes") || - !strcasecmp(boolval, "on")) ? "True" : "False"); + (!_cups_strcasecmp(boolval, "true") || + !_cups_strcasecmp(boolval, "yes") || + !_cups_strcasecmp(boolval, "on")) ? "True" : "False"); } else if (!strncmp(line, "*cupsSNMPSupplies:", 18) && (boolval = cupsGetOption("cupsSNMPSupplies", num_options, @@ -1369,9 +1369,9 @@ set_printer_options( { wrote_snmp_supplies = 1; cupsFilePrintf(out, "*cupsSNMPSupplies: %s\n", - (!strcasecmp(boolval, "true") || - !strcasecmp(boolval, "yes") || - !strcasecmp(boolval, "on")) ? "True" : "False"); + (!_cups_strcasecmp(boolval, "true") || + !_cups_strcasecmp(boolval, "yes") || + !_cups_strcasecmp(boolval, "on")) ? "True" : "False"); } else if (strncmp(line, "*Default", 8)) cupsFilePrintf(out, "%s\n", line); @@ -1428,9 +1428,9 @@ set_printer_options( options)) != NULL) { cupsFilePrintf(out, "*cupsIPPSupplies: %s\n", - (!strcasecmp(boolval, "true") || - !strcasecmp(boolval, "yes") || - !strcasecmp(boolval, "on")) ? "True" : "False"); + (!_cups_strcasecmp(boolval, "true") || + !_cups_strcasecmp(boolval, "yes") || + !_cups_strcasecmp(boolval, "on")) ? "True" : "False"); } if (!wrote_snmp_supplies && @@ -1438,9 +1438,9 @@ set_printer_options( options)) != NULL) { cupsFilePrintf(out, "*cupsSNMPSupplies: %s\n", - (!strcasecmp(boolval, "true") || - !strcasecmp(boolval, "yes") || - !strcasecmp(boolval, "on")) ? "True" : "False"); + (!_cups_strcasecmp(boolval, "true") || + !_cups_strcasecmp(boolval, "yes") || + !_cups_strcasecmp(boolval, "on")) ? "True" : "False"); } cupsFileClose(in); diff --git a/systemv/lpoptions.c b/systemv/lpoptions.c index 1e721b840..0d81312d3 100644 --- a/systemv/lpoptions.c +++ b/systemv/lpoptions.c @@ -3,7 +3,7 @@ * * Printer option program for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -52,7 +52,7 @@ main(int argc, /* I - Number of command-line arguments */ cups_dest_t *dests; /* Destinations */ cups_dest_t *dest; /* Current destination */ char *printer, /* Printer name */ - *instance, /* Instance name */ + *instance, /* Instance name */ *option; /* Current option */ @@ -265,7 +265,7 @@ main(int argc, /* I - Number of command-line arguments */ } for (j = 0; j < num_options; j ++) - if (!strcasecmp(options[j].name, option)) + if (!_cups_strcasecmp(options[j].name, option)) { /* * Remove this option... @@ -421,7 +421,7 @@ list_group(ppd_file_t *ppd, /* I - PPD file */ for (i = group->num_options, option = group->options; i > 0; i --, option ++) { - if (!strcasecmp(option->keyword, "PageRegion")) + if (!_cups_strcasecmp(option->keyword, "PageRegion")) continue; snprintf(buffer, sizeof(buffer), "%s/%s:", option->keyword, option->text); @@ -431,7 +431,7 @@ list_group(ppd_file_t *ppd, /* I - PPD file */ j > 0 && ptr < (buffer + sizeof(buffer) - 1); j --, choice ++) { - if (!strcasecmp(choice->choice, "Custom")) + if (!_cups_strcasecmp(choice->choice, "Custom")) { ppd_coption_t *coption; /* Custom option */ ppd_cparam_t *cparam; /* Custom parameter */ @@ -452,8 +452,8 @@ list_group(ppd_file_t *ppd, /* I - PPD file */ cupsArrayCount(coption->params) == 0) snprintf(ptr, sizeof(buffer) - (ptr - buffer), " %sCustom", choice->marked ? "*" : ""); - else if (!strcasecmp(option->keyword, "PageSize") || - !strcasecmp(option->keyword, "PageRegion")) + else if (!_cups_strcasecmp(option->keyword, "PageSize") || + !_cups_strcasecmp(option->keyword, "PageRegion")) snprintf(ptr, sizeof(buffer) - (ptr - buffer), " %sCustom.WIDTHxHEIGHT", choice->marked ? "*" : ""); else diff --git a/systemv/lpstat.c b/systemv/lpstat.c index 4b96ebf8e..eae93bba0 100644 --- a/systemv/lpstat.c +++ b/systemv/lpstat.c @@ -3,7 +3,7 @@ * * "lpstat" command for CUPS. * - * Copyright 2007-2010 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -143,7 +143,7 @@ main(int argc, /* I - Number of command-line arguments */ cupsSetUser(argv[i]); } break; - + case 'W' : /* Show which jobs? */ if (argv[i][2]) which = argv[i] + 2; @@ -517,7 +517,7 @@ check_dest(const char *command, /* I - Command name */ * Scan the name string for printer/class name(s)... */ - for (dptr = name; *dptr;) + for (dptr = name; *dptr;) { /* * Skip leading whitespace and commas... @@ -756,7 +756,7 @@ show_accepting(const char *printers, /* I - Destinations */ } for (i = 0; i < num_dests; i ++) - if (!strcasecmp(dests[i].name, printer) && dests[i].instance) + if (!_cups_strcasecmp(dests[i].name, printer) && dests[i].instance) { if (accepting) _cupsLangPrintf(stdout, _("%s/%s accepting requests since %s"), @@ -911,7 +911,7 @@ show_classes(const char *dests) /* I - Destinations */ username, sizeof(username), server, sizeof(server), &port, resource, sizeof(resource)); - if (!strcasecmp(server, cupsServer())) + if (!_cups_strcasecmp(server, cupsServer())) http2 = CUPS_HTTP_DEFAULT; else http2 = httpConnectEncrypt(server, port, cupsEncryption()); @@ -1193,7 +1193,7 @@ show_devices(const char *printers, /* I - Destinations */ printer, device); for (i = 0; i < num_dests; i ++) - if (!strcasecmp(printer, dests[i].name) && dests[i].instance) + if (!_cups_strcasecmp(printer, dests[i].name) && dests[i].instance) { if (device == NULL) _cupsLangPrintf(stdout, @@ -1222,7 +1222,7 @@ show_devices(const char *printers, /* I - Destinations */ printer, device); for (i = 0; i < num_dests; i ++) - if (!strcasecmp(printer, dests[i].name) && dests[i].instance) + if (!_cups_strcasecmp(printer, dests[i].name) && dests[i].instance) { if (device == NULL) _cupsLangPrintf(stdout, _("device for %s/%s: %s"), @@ -1883,7 +1883,7 @@ show_printers(const char *printers, /* I - Destinations */ } for (i = 0; i < num_dests; i ++) - if (!strcasecmp(printer, dests[i].name) && dests[i].instance) + if (!_cups_strcasecmp(printer, dests[i].name) && dests[i].instance) { switch (pstate) { diff --git a/test/ippserver.c b/test/ippserver.c index d12225772..0a8495962 100644 --- a/test/ippserver.c +++ b/test/ippserver.c @@ -1358,7 +1358,7 @@ create_printer(const char *servername, /* I - Server hostname (NULL for default) *ptr++ = '\0'; formats[num_formats++] = ptr; - if (!strcasecmp(ptr, "application/octet-stream")) + if (!_cups_strcasecmp(ptr, "application/octet-stream")) defformat = ptr; } @@ -1367,17 +1367,17 @@ create_printer(const char *servername, /* I - Server hostname (NULL for default) prefix = "CMD:"; for (i = 0; i < num_formats; i ++) { - if (!strcasecmp(formats[i], "application/pdf")) + if (!_cups_strcasecmp(formats[i], "application/pdf")) snprintf(ptr, sizeof(device_id) - (ptr - device_id), "%sPDF", prefix); - else if (!strcasecmp(formats[i], "application/postscript")) + else if (!_cups_strcasecmp(formats[i], "application/postscript")) snprintf(ptr, sizeof(device_id) - (ptr - device_id), "%sPS", prefix); - else if (!strcasecmp(formats[i], "application/vnd.hp-PCL")) + else if (!_cups_strcasecmp(formats[i], "application/vnd.hp-PCL")) snprintf(ptr, sizeof(device_id) - (ptr - device_id), "%sPCL", prefix); - else if (!strcasecmp(formats[i], "image/jpeg")) + else if (!_cups_strcasecmp(formats[i], "image/jpeg")) snprintf(ptr, sizeof(device_id) - (ptr - device_id), "%sJPEG", prefix); - else if (!strcasecmp(formats[i], "image/png")) + else if (!_cups_strcasecmp(formats[i], "image/png")) snprintf(ptr, sizeof(device_id) - (ptr - device_id), "%sPNG", prefix); - else if (strcasecmp(formats[i], "application/octet-stream")) + else if (_cups_strcasecmp(formats[i], "application/octet-stream")) snprintf(ptr, sizeof(device_id) - (ptr - device_id), "%s%s", prefix, formats[i]); @@ -2147,7 +2147,7 @@ dnssd_callback( regtype, (int)errorCode); return; } - else if (strcasecmp(name, printer->dnssd_name)) + else if (_cups_strcasecmp(name, printer->dnssd_name)) { if (Verbosity) fprintf(stderr, "Now using DNS-SD service name \"%s\".\n", name); @@ -2723,7 +2723,7 @@ ipp_get_jobs(_ipp_client_t *client) /* I - Client */ (job_comparison == 0 && job->state != job_state) || (job_comparison > 0 && job->state < job_state) || job->id < first_job_id || - (username && job->username && strcasecmp(username, job->username))) + (username && job->username && _cups_strcasecmp(username, job->username))) continue; if (count > 0) @@ -2883,16 +2883,16 @@ ipp_print_job(_ipp_client_t *client) /* I - Client */ * Create a file for the request data... */ - if (!strcasecmp(job->format, "image/jpeg")) + if (!_cups_strcasecmp(job->format, "image/jpeg")) snprintf(filename, sizeof(filename), "%s/%d.jpg", client->printer->directory, job->id); - else if (!strcasecmp(job->format, "image/png")) + else if (!_cups_strcasecmp(job->format, "image/png")) snprintf(filename, sizeof(filename), "%s/%d.png", client->printer->directory, job->id); - else if (!strcasecmp(job->format, "application/pdf")) + else if (!_cups_strcasecmp(job->format, "application/pdf")) snprintf(filename, sizeof(filename), "%s/%d.pdf", client->printer->directory, job->id); - else if (!strcasecmp(job->format, "application/postscript")) + else if (!_cups_strcasecmp(job->format, "application/postscript")) snprintf(filename, sizeof(filename), "%s/%d.ps", client->printer->directory, job->id); else @@ -3221,7 +3221,7 @@ process_http(_ipp_client_t *client) /* I - Client connection */ * Handle HTTP Upgrade... */ - if (!strcasecmp(client->http.fields[HTTP_FIELD_CONNECTION], "Upgrade")) + if (!_cups_strcasecmp(client->http.fields[HTTP_FIELD_CONNECTION], "Upgrade")) { if (!respond_http(client, HTTP_NOT_IMPLEMENTED, NULL, 0)) return (0); @@ -3521,8 +3521,8 @@ process_ipp(_ipp_client_t *client) /* I - Client */ language ? language->values[0].string.text : "en"); if (charset && - strcasecmp(charset->values[0].string.text, "us-ascii") && - strcasecmp(charset->values[0].string.text, "utf-8")) + _cups_strcasecmp(charset->values[0].string.text, "us-ascii") && + _cups_strcasecmp(charset->values[0].string.text, "utf-8")) { /* * Bad character set... @@ -4183,7 +4183,7 @@ valid_job_attributes( IPP_TAG_MIMETYPE)) != NULL) { for (i = 0; i < supported->num_values; i ++) - if (!strcasecmp(format, supported->values[i].string.text)) + if (!_cups_strcasecmp(format, supported->values[i].string.text)) break; if (i >= supported->num_values) diff --git a/test/ipptool.c b/test/ipptool.c index d8cf66bfd..64a0658f6 100644 --- a/test/ipptool.c +++ b/test/ipptool.c @@ -588,7 +588,7 @@ static int /* O - Result of comparison */ compare_vars(_cups_var_t *a, /* I - First variable */ _cups_var_t *b) /* I - Second variable */ { - return (strcasecmp(a->name, b->name)); + return (_cups_strcasecmp(a->name, b->name)); } @@ -745,9 +745,9 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ */ if (get_token(fp, temp, sizeof(temp), &linenum) && - (!strcasecmp(temp, "yes") || !strcasecmp(temp, "no"))) + (!_cups_strcasecmp(temp, "yes") || !_cups_strcasecmp(temp, "no"))) { - IgnoreErrors = !strcasecmp(temp, "yes"); + IgnoreErrors = !_cups_strcasecmp(temp, "yes"); } else { @@ -1006,20 +1006,20 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ while (get_token(fp, token, sizeof(token), &linenum) != NULL) { - if (strcasecmp(token, "COUNT") && - strcasecmp(token, "DEFINE-MATCH") && - strcasecmp(token, "DEFINE-NO-MATCH") && - strcasecmp(token, "DEFINE-VALUE") && - strcasecmp(token, "IF-DEFINED") && - strcasecmp(token, "IF-NOT-DEFINED") && - strcasecmp(token, "IN-GROUP") && - strcasecmp(token, "OF-TYPE") && - strcasecmp(token, "SAME-COUNT-AS") && - strcasecmp(token, "WITH-VALUE")) + if (_cups_strcasecmp(token, "COUNT") && + _cups_strcasecmp(token, "DEFINE-MATCH") && + _cups_strcasecmp(token, "DEFINE-NO-MATCH") && + _cups_strcasecmp(token, "DEFINE-VALUE") && + _cups_strcasecmp(token, "IF-DEFINED") && + _cups_strcasecmp(token, "IF-NOT-DEFINED") && + _cups_strcasecmp(token, "IN-GROUP") && + _cups_strcasecmp(token, "OF-TYPE") && + _cups_strcasecmp(token, "SAME-COUNT-AS") && + _cups_strcasecmp(token, "WITH-VALUE")) last_expect = NULL; - if (strcasecmp(token, "IF-DEFINED") && - strcasecmp(token, "IF-NOT-DEFINED")) + if (_cups_strcasecmp(token, "IF-DEFINED") && + _cups_strcasecmp(token, "IF-NOT-DEFINED")) last_status = NULL; if (!strcmp(token, "}")) @@ -1102,9 +1102,9 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ */ if (get_token(fp, temp, sizeof(temp), &linenum) && - (!strcasecmp(temp, "yes") || !strcasecmp(temp, "no"))) + (!_cups_strcasecmp(temp, "yes") || !_cups_strcasecmp(temp, "no"))) { - ignore_errors = !strcasecmp(temp, "yes"); + ignore_errors = !_cups_strcasecmp(temp, "yes"); } else { @@ -1115,7 +1115,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ continue; } - else if (!strcasecmp(token, "NAME")) + else if (!_cups_strcasecmp(token, "NAME")) { /* * Name of test... @@ -1134,7 +1134,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ { if (isdigit(temp[0] & 255)) request_id = atoi(temp); - else if (!strcasecmp(temp, "random")) + else if (!_cups_strcasecmp(temp, "random")) request_id = (CUPS_RAND() % 1000) * 137 + 1; else { @@ -1197,9 +1197,9 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ */ if (get_token(fp, temp, sizeof(temp), &linenum) && - (!strcasecmp(temp, "yes") || !strcasecmp(temp, "no"))) + (!_cups_strcasecmp(temp, "yes") || !_cups_strcasecmp(temp, "no"))) { - skip_previous = !strcasecmp(temp, "yes"); + skip_previous = !_cups_strcasecmp(temp, "yes"); } else { @@ -1241,7 +1241,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } } - else if (!strcasecmp(token, "VERSION")) + else if (!_cups_strcasecmp(token, "VERSION")) { if (get_token(fp, temp, sizeof(temp), &linenum)) { @@ -1271,7 +1271,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } } - else if (!strcasecmp(token, "RESOURCE")) + else if (!_cups_strcasecmp(token, "RESOURCE")) { /* * Resource name... @@ -1284,7 +1284,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } } - else if (!strcasecmp(token, "OPERATION")) + else if (!_cups_strcasecmp(token, "OPERATION")) { /* * Operation... @@ -1306,7 +1306,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } } - else if (!strcasecmp(token, "GROUP")) + else if (!_cups_strcasecmp(token, "GROUP")) { /* * Attribute group... @@ -1331,7 +1331,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ group = value; } - else if (!strcasecmp(token, "DELAY")) + else if (!_cups_strcasecmp(token, "DELAY")) { /* * Delay before operation... @@ -1361,7 +1361,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ usleep((int)(1000000.0 * delay)); } } - else if (!strcasecmp(token, "ATTR")) + else if (!_cups_strcasecmp(token, "ATTR")) { /* * Attribute... @@ -1401,7 +1401,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ switch (value) { case IPP_TAG_BOOLEAN : - if (!strcasecmp(token, "true")) + if (!_cups_strcasecmp(token, "true")) ippAddBoolean(request, group, attr, 1); else ippAddBoolean(request, group, attr, atoi(token)); @@ -1456,8 +1456,8 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ } if (ptr <= token || xres <= 0 || yres <= 0 || !ptr || - (strcasecmp(ptr, "dpi") && strcasecmp(ptr, "dpc") && - strcasecmp(ptr, "other"))) + (_cups_strcasecmp(ptr, "dpi") && _cups_strcasecmp(ptr, "dpc") && + _cups_strcasecmp(ptr, "other"))) { print_fatal_error("Bad resolution value \"%s\" on line %d.", token, linenum); @@ -1465,10 +1465,10 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } - if (!strcasecmp(ptr, "dpi")) + if (!_cups_strcasecmp(ptr, "dpi")) ippAddResolution(request, group, attr, IPP_RES_PER_INCH, xres, yres); - else if (!strcasecmp(ptr, "dpc")) + else if (!_cups_strcasecmp(ptr, "dpc")) ippAddResolution(request, group, attr, IPP_RES_PER_CM, xres, yres); else @@ -1574,7 +1574,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ break; } } - else if (!strcasecmp(token, "FILE")) + else if (!_cups_strcasecmp(token, "FILE")) { /* * File... @@ -1590,7 +1590,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ expand_variables(vars, token, temp, sizeof(token)); get_filename(testfile, filename, token, sizeof(filename)); } - else if (!strcasecmp(token, "STATUS")) + else if (!_cups_strcasecmp(token, "STATUS")) { /* * Status... @@ -1626,7 +1626,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ last_status->if_defined = NULL; last_status->if_not_defined = NULL; } - else if (!strcasecmp(token, "EXPECT")) + else if (!_cups_strcasecmp(token, "EXPECT")) { /* * Expected attributes... @@ -1664,7 +1664,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ else last_expect->name = strdup(token); } - else if (!strcasecmp(token, "COUNT")) + else if (!_cups_strcasecmp(token, "COUNT")) { if (!get_token(fp, token, sizeof(token), &linenum)) { @@ -1690,7 +1690,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } } - else if (!strcasecmp(token, "DEFINE-MATCH")) + else if (!_cups_strcasecmp(token, "DEFINE-MATCH")) { if (!get_token(fp, token, sizeof(token), &linenum)) { @@ -1710,7 +1710,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } } - else if (!strcasecmp(token, "DEFINE-NO-MATCH")) + else if (!_cups_strcasecmp(token, "DEFINE-NO-MATCH")) { if (!get_token(fp, token, sizeof(token), &linenum)) { @@ -1730,7 +1730,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } } - else if (!strcasecmp(token, "DEFINE-VALUE")) + else if (!_cups_strcasecmp(token, "DEFINE-VALUE")) { if (!get_token(fp, token, sizeof(token), &linenum)) { @@ -1750,7 +1750,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } } - else if (!strcasecmp(token, "OF-TYPE")) + else if (!_cups_strcasecmp(token, "OF-TYPE")) { if (!get_token(fp, token, sizeof(token), &linenum)) { @@ -1770,7 +1770,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } } - else if (!strcasecmp(token, "IN-GROUP")) + else if (!_cups_strcasecmp(token, "IN-GROUP")) { ipp_tag_t in_group; /* IN-GROUP value */ @@ -1795,7 +1795,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } } - else if (!strcasecmp(token, "SAME-COUNT-AS")) + else if (!_cups_strcasecmp(token, "SAME-COUNT-AS")) { if (!get_token(fp, token, sizeof(token), &linenum)) { @@ -1814,7 +1814,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } } - else if (!strcasecmp(token, "IF-DEFINED")) + else if (!_cups_strcasecmp(token, "IF-DEFINED")) { if (!get_token(fp, token, sizeof(token), &linenum)) { @@ -1835,7 +1835,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } } - else if (!strcasecmp(token, "IF-NOT-DEFINED")) + else if (!_cups_strcasecmp(token, "IF-NOT-DEFINED")) { if (!get_token(fp, token, sizeof(token), &linenum)) { @@ -1856,7 +1856,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } } - else if (!strcasecmp(token, "WITH-VALUE")) + else if (!_cups_strcasecmp(token, "WITH-VALUE")) { if (!get_token(fp, temp, sizeof(temp), &linenum)) { @@ -1904,7 +1904,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ goto test_exit; } } - else if (!strcasecmp(token, "DISPLAY")) + else if (!_cups_strcasecmp(token, "DISPLAY")) { /* * Display attributes... @@ -2264,7 +2264,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */ else if (!prev_pass) fprintf(stderr, "%s\n", cupsLastErrorString()); - if (prev_pass && Output != _CUPS_OUTPUT_PLIST && + if (prev_pass && Output != _CUPS_OUTPUT_PLIST && Output != _CUPS_OUTPUT_QUIET && !Verbosity && num_displayed > 0) { if (Output >= _CUPS_OUTPUT_LIST) @@ -2893,7 +2893,7 @@ get_collection(_cups_vars_t *vars, /* I - Variables */ else goto col_error; } - else if (!strcasecmp(token, "MEMBER")) + else if (!_cups_strcasecmp(token, "MEMBER")) { /* * Attribute... @@ -2931,7 +2931,7 @@ get_collection(_cups_vars_t *vars, /* I - Variables */ switch (value) { case IPP_TAG_BOOLEAN : - if (!strcasecmp(token, "true")) + if (!_cups_strcasecmp(token, "true")) ippAddBoolean(col, IPP_TAG_ZERO, attr, 1); else ippAddBoolean(col, IPP_TAG_ZERO, attr, atoi(token)); @@ -2949,18 +2949,18 @@ get_collection(_cups_vars_t *vars, /* I - Variables */ char units[6]; /* Units */ if (sscanf(token, "%dx%d%5s", &xres, &yres, units) != 3 || - (strcasecmp(units, "dpi") && strcasecmp(units, "dpc") && - strcasecmp(units, "other"))) + (_cups_strcasecmp(units, "dpi") && _cups_strcasecmp(units, "dpc") && + _cups_strcasecmp(units, "other"))) { print_fatal_error("Bad resolution value \"%s\" on line %d.", token, *linenum); goto col_error; } - if (!strcasecmp(units, "dpi")) + if (!_cups_strcasecmp(units, "dpi")) ippAddResolution(col, IPP_TAG_ZERO, attr, xres, yres, IPP_RES_PER_INCH); - else if (!strcasecmp(units, "dpc")) + else if (!_cups_strcasecmp(units, "dpc")) ippAddResolution(col, IPP_TAG_ZERO, attr, xres, yres, IPP_RES_PER_CM); else diff --git a/vcnet/config.h b/vcnet/config.h index 0cb8b4fb3..61ee8865d 100644 --- a/vcnet/config.h +++ b/vcnet/config.h @@ -86,8 +86,8 @@ * Version of software... */ -#define CUPS_SVERSION "CUPS v1.5svn" -#define CUPS_MINIMAL "CUPS/1.5svn" +#define CUPS_SVERSION "CUPS v1.5.0" +#define CUPS_MINIMAL "CUPS/1.5.0" /* @@ -277,8 +277,6 @@ */ #define HAVE_STRDUP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 /* #undef HAVE_STRLCAT */ /* #undef HAVE_STRLCPY */ @@ -290,6 +288,13 @@ /* #undef HAVE_GETEUID */ +/* + * Do we have the setpgid() function? + */ + +/* #undef HAVE_SETPGID */ + + /* * Do we have the vsyslog() function? */ diff --git a/xcode/CUPS.xcodeproj/project.pbxproj b/xcode/CUPS.xcodeproj/project.pbxproj index 8f6ac23cb..5cc40ed70 100644 --- a/xcode/CUPS.xcodeproj/project.pbxproj +++ b/xcode/CUPS.xcodeproj/project.pbxproj @@ -1869,9 +1869,9 @@ 72220EB41333050100FCA411 /* libcups */ = { isa = PBXGroup; children = ( + 276683561337A8C5000D33D0 /* cups.strings */, 27D3037C134148CB00F022B1 /* libcups_s.exp */, 27D3037D134148CB00F022B1 /* libcups2.def */, - 276683561337A8C5000D33D0 /* cups.strings */, 72220EB51333052D00FCA411 /* adminutil.c */, 72220EB81333056300FCA411 /* array.c */, 72220EBA1333056300FCA411 /* attr.c */, diff --git a/xcode/config.h b/xcode/config.h index fabfac8d1..6574617cc 100644 --- a/xcode/config.h +++ b/xcode/config.h @@ -21,8 +21,8 @@ * Version of software... */ -#define CUPS_SVERSION "CUPS v1.5svn" -#define CUPS_MINIMAL "CUPS/1.5svn" +#define CUPS_SVERSION "CUPS v1.5.0" +#define CUPS_MINIMAL "CUPS/1.5.0" /* @@ -216,8 +216,6 @@ */ #define HAVE_STRDUP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 #define HAVE_STRLCAT 1 #define HAVE_STRLCPY 1 @@ -229,6 +227,13 @@ #define HAVE_GETEUID 1 +/* + * Do we have the setpgid() function? + */ + +#define HAVE_SETPGID 1 + + /* * Do we have the vsyslog() function? */ -- 2.39.2