-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)
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
-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
-IPPTOOL.txt - 2011-05-11
+IPPTOOL.txt - 2011-05-20
------------------------
-README - CUPS v1.5b1 - 2011-05-11
+README - CUPS v1.5b1 - 2011-05-20
---------------------------------
Looking for compile instructions? Read the file "INSTALL.txt"
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);
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));
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.
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;
else
continue;
- if (!strncasecmp(key, "usb_", 4))
+ if (!_cups_strncasecmp(key, "usb_", 4))
{
/*
* Add USB device ID information...
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] == '(')
{
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!
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)
{
*
* 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
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
if (!mdl)
mdl = "";
- if (!strncasecmp(mdl, mfg, strlen(mfg)))
+ if (!_cups_strncasecmp(mdl, mfg, strlen(mfg)))
{
mdl += strlen(mfg);
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...
};
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 */
* 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
{
value);
}
}
- else if (!strcasecmp(name, "version"))
+ else if (!_cups_strcasecmp(name, "version"))
{
if (!strcmp(value, "1.0"))
version = 10;
}
}
#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...
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);
}
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)
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;
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";
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
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);
}
(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");
}
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";
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;
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 */
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);
* 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...
_("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...
if (atoi(value) > 0)
timeout = atoi(value);
}
- else if (!strcasecmp(name, "contimeout"))
+ else if (!_cups_strcasecmp(name, "contimeout"))
{
/*
* Set the connection timeout...
* Process the option...
*/
- if (!strcasecmp(name, "baud"))
+ if (!_cups_strcasecmp(name, "baud"))
{
/*
* Set the baud rate...
}
#endif /* B19200 == 19200 */
}
- else if (!strcasecmp(name, "bits"))
+ else if (!_cups_strcasecmp(name, "bits"))
{
/*
* Set number of data bits...
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...
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
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;
dtrdsr = 1;
}
}
- else if (!strcasecmp(name, "stop"))
+ else if (!_cups_strcasecmp(name, "stop"))
{
switch (atoi(value))
{
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;
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));
}
* 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
while (isspace(*mmptr & 255))
mmptr ++;
- if (!strncasecmp(mmptr, "hp", 2))
+ if (!_cups_strncasecmp(mmptr, "hp", 2))
{
mmptr += 2;
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
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,
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",
* 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...
* 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);
}
}
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";
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
* 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)
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
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...
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...
{
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");
*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");
{
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));
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)
{
* 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);
}
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" : "");
*/
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, ':'))
{
/*
* 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;
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 */
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");
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");
}
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;
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;
return (NULL);
}
- else if (strcasecmp(val, "Custom") ||
+ else if (_cups_strcasecmp(val, "Custom") ||
(coption = ppdFindCustomOption(ppd, name)) == NULL)
{
/*
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
{
cgiSetVariable("TOTAL", val);
if ((var = cgiGetVariable("ORDER")) != NULL)
- ascending = !strcasecmp(var, "asc");
+ ascending = !_cups_strcasecmp(var, "asc");
else
ascending = 1;
* Look for "<TITLE>", "<A NAME", or "<!-- SECTION:" prefix...
*/
- if (!strncasecmp(line, "<!-- SECTION:", 13))
+ if (!_cups_strncasecmp(line, "<!-- SECTION:", 13))
{
/*
* Got section line, copy it!
{
ptr ++;
- if (!strncasecmp(ptr, "TITLE>", 6))
+ if (!_cups_strncasecmp(ptr, "TITLE>", 6))
{
/*
* Found the title...
anchor = NULL;
ptr += 6;
}
- else if (!strncasecmp(ptr, "A NAME=", 7))
+ else if (!_cups_strncasecmp(ptr, "A NAME=", 7))
{
/*
* Found an anchor...
sizeof(help_common_words[0])),
sizeof(help_common_words[0]),
(int (*)(const void *, const void *))
- strcasecmp))
+ _cups_strcasecmp))
help_add_word(node, temp);
}
}
(diff = strcmp(n1->section, n2->section)) != 0)
return (diff);
- return (strcasecmp(n1->text, n2->text));
+ return (_cups_strcasecmp(n1->text, n2->text));
}
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));
}
{
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;
}
* 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);
* 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...
(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)
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");
*
* 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
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));
}
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));
}
if (ret)
return (ret);
else
- return (strcasecmp(a->name, b->name));
+ return (_cups_strcasecmp(a->name, b->name));
}
cupsFilePuts(fp, "<Subnodes>\n");
subnodes = 1;
}
-
+
cupsFilePrintf(fp, "<Node id=\"%d\">\n"
"<Path>Documentation/%s</Path>\n"
"<Anchor>%s</Anchor>\n"
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
{
cgiSetVariable("TOTAL", val);
if ((var = cgiGetVariable("ORDER")) != NULL)
- ascending = !strcasecmp(var, "asc");
+ ascending = !_cups_strcasecmp(var, "asc");
else
ascending = 1;
* 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...
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...
*
* 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
{
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);
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);
* 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;
fputs("\">", out);
}
- else if (!strncasecmp(s, "</A>", 4))
+ else if (!_cups_strncasecmp(s, "</A>", 4))
{
fputs("</A>", out);
s += 3;
*
* 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
* 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=");
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));
}
/*
* Copy file data to the temp file...
*/
-
+
ptr = line;
while ((ch = getchar()) != EOF)
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)
{
*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 ++);
_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));
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
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)
*/
#undef HAVE_STRDUP
-#undef HAVE_STRCASECMP
-#undef HAVE_STRNCASECMP
#undef HAVE_STRLCAT
#undef HAVE_STRLCPY
#undef HAVE_GETEUID
+/*
+ * Do we have the setpgid() function?
+ */
+
+#undef HAVE_SETPGID
+
+
/*
* Do we have the vsyslog() function?
*/
return (0);
}
-
+
/*
* Do the rpcclient command needed for the CUPS drivers...
*/
return (0);
}
-
+
/*
* Do the rpcclient command needed for the CUPS drivers...
*/
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 */
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 */
)
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...
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;
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 */
{
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));
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)
)
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)
}
}
}
- else if (!strcasecmp(line, "LogLevel") && debug_logging >= 0)
+ else if (!_cups_strcasecmp(line, "LogLevel") && debug_logging >= 0)
{
wrote_loglevel = 1;
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)
cupsFilePuts(temp, "</Policy>\n");
}
- else if (!strcasecmp(line, "<Location"))
+ else if (!_cups_strcasecmp(line, "<Location"))
{
in_location = 1;
indent += 2;
cupsFilePrintf(temp, "%s %s>\n", line, value);
}
- else if (!strcasecmp(line, "</Location>"))
+ else if (!_cups_strcasecmp(line, "</Location>"))
{
in_location = 0;
indent -= 2;
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");
}
}
indent += 2;
}
- else if (!strcasecmp(line, "</Limit>") && in_cancel_job)
+ else if (!_cups_strcasecmp(line, "</Limit>") && in_cancel_job)
{
indent -= 2;
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;
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))
{
/*
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...
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>>
<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
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
<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>
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
*
* 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
* 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;
}
}
* 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...
return (NULL);
}
- if (!spec || !strcasecmp(attr->spec, spec))
+ if (!spec || !_cups_strcasecmp(attr->spec, spec))
break;
}
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...
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...
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...
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...
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...
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...
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...
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...
* Clean up the make...
*/
- if (!strncasecmp(buffer, "agfa", 4))
+ if (!_cups_strncasecmp(buffer, "agfa", 4))
{
/*
* Replace with AGFA (all uppercase)...
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...
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...
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"...
_cups_strcpy(buffer + 8, buffer + 21);
}
- else if (!strncasecmp(buffer, "herk", 4))
+ else if (!_cups_strncasecmp(buffer, "herk", 4))
{
/*
* Replace with LHAG...
buffer[2] = 'A';
buffer[3] = 'G';
}
- else if (!strncasecmp(buffer, "linotype", 8))
+ else if (!_cups_strncasecmp(buffer, "linotype", 8))
{
/*
* Replace with LHAG...
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';
*/
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);
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,
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);
/*
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 &&
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;
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;
/*
*/
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;
/*
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)
}
}
- if (!strncasecmp(value, "Custom.", 7))
+ if (!_cups_strncasecmp(value, "Custom.", 7))
value = "Custom";
/*
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,
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,
* 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);
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);
}
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)
*/
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;
/*
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");
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");
*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");
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;
}
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
*/
if (option && choice &&
- (!strcasecmp(option, "PageSize") ||
- !strcasecmp(option, "PageRegion")))
+ (!_cups_strcasecmp(option, "PageSize") ||
+ !_cups_strcasecmp(option, "PageRegion")))
{
value = choice;
}
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;
}
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;
* 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;
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)
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;
else if ((firstvalue = cupsGetOption(firstpage, num_options,
options)) != NULL)
{
- if (!strncasecmp(firstvalue, "Custom.", 7))
+ if (!_cups_strncasecmp(firstvalue, "Custom.", 7))
firstvalue = "Custom";
}
else
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;
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;
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;
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);
return (NULL);
}
-
+
DEBUG_printf(("1_cupsAppleCopyDefaultPrinter: Got locations, %d entries.",
(int)CFArrayGetCount(locations)));
/*
* '_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);
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);
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,
*/
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)));
}
if (temp &&
(val = cupsGetOption(option->name, temp->num_options,
temp->options)) != NULL &&
- !strcasecmp(val, option->value))
+ !_cups_strcasecmp(val, option->value))
continue;
/*
fprintf(fp, "/%s", dest->instance);
wrote = 1;
}
-
+
if (option->value[0])
{
if (strchr(option->value, ' ') ||
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)
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));
}
char line[8192], /* Line from file */
*value, /* Value for line */
*nameptr; /* Pointer into name */
- int linenum; /* Current line */
+ int linenum; /* Current line */
*namebuf = '\0';
while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum))
{
- if (!strcasecmp(line, "default") && value)
+ if (!_cups_strcasecmp(line, "default") && value)
{
strlcpy(namebuf, value, namesize);
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;
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;
* 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...");
* Close the file and return...
*/
- cupsFileClose(fp);
+ cupsFileClose(fp);
return (num_dests);
}
*
* 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
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;
}
{
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)
{
{
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)
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))
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)
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
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)
{
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))
{
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...
*
* 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
* 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;
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;
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...
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;
_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 ****/
_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?
*/
_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);
break;
case _CUPS_FILE_CHECK_PERMISSIONS :
+ case _CUPS_FILE_CHECK_RELATIVE_PATH :
prefix = "ERROR";
fputs("STATE: +cups-insecure-filter-warning\n", stderr);
break;
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
}
else
#endif /* AF_LOCAL */
- if (!hostname || strcasecmp(hostname, "localhost"))
+ if (!hostname || _cups_strcasecmp(hostname, "localhost"))
{
#ifdef HAVE_GETADDRINFO
struct addrinfo hints, /* Address lookup hints */
* 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 */
return (NULL);
}
- if (hostname && !strcasecmp(hostname, "localhost"))
+ if (hostname && !_cups_strcasecmp(hostname, "localhost"))
{
/*
* Unfortunately, some users ignore all of the warnings in the
*/
for (i = 0; i < 12; i ++)
- if (!strcasecmp(mon, http_months[i]))
+ if (!_cups_strcasecmp(mon, http_months[i]))
break;
if (i >= 12)
*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;
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)
* 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,
*/
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 */
*/
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 */
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
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;
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!");
* Be tolerants of servers that send unknown attribute fields...
*/
- if (!strcasecmp(line, "expect"))
+ if (!_cups_strcasecmp(line, "expect"))
{
/*
* "Expect: 100-continue" or similar...
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...
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);
*
* 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
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);
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);
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);
*
* 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
* 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";
/*
{
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...
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)))
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;
* 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;
}
}
*
* 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
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);
}
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...
*/
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);
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...
ppd_mark_choices(ppd, attr->value);
}
}
- else if (!strcasecmp(optptr->name, "APPrinterPreset"))
+ else if (!_cups_strcasecmp(optptr->name, "APPrinterPreset"))
{
/*
* Lookup APPrinterPreset value...
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);
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);
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);
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 ++)
* it clears the regular InputSlot choices...
*/
- if (!strcasecmp(option, "AP_D_InputSlot"))
+ if (!_cups_strcasecmp(option, "AP_D_InputSlot"))
{
cupsArraySave(ppd->options);
loc = localeconv();
- if (!strncasecmp(choice, "Custom.", 7))
+ if (!_cups_strncasecmp(choice, "Custom.", 7))
{
/*
* Handle a custom option...
if ((c = ppdFindChoice(o, "Custom")) == NULL)
return;
- if (!strcasecmp(option, "PageSize"))
+ if (!_cups_strcasecmp(option, "PageSize"))
{
/*
* Handle custom page sizes...
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;
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;
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)
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);
/*
cupsArraySave(ppd->options);
- if (!strcasecmp(option, "PageSize"))
+ if (!_cups_strcasecmp(option, "PageSize"))
{
if ((o = ppdFindOption(ppd, "PageRegion")) != NULL)
{
cupsArrayRestore(ppd->options);
}
- else if (!strcasecmp(option, "InputSlot"))
+ else if (!_cups_strcasecmp(option, "InputSlot"))
{
/*
* Unmark ManualFeed option...
cupsArrayRestore(ppd->options);
}
- else if (!strcasecmp(option, "ManualFeed") &&
- !strcasecmp(choice, "True"))
+ else if (!_cups_strcasecmp(option, "ManualFeed") &&
+ !_cups_strcasecmp(choice, "True"))
{
/*
* Unmark InputSlot option...
*
* 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
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));
* Boolean option...
*/
- if (!strncasecmp(name, "no", 2))
+ if (!_cups_strncasecmp(name, "no", 2))
num_options = cupsAddOption(name + 2, "false", num_options,
options);
else
*/
for (i = num_options, option = *options; i > 0; i --, option ++)
- if (!strcasecmp(name, option->name))
+ if (!_cups_strcasecmp(name, option->name))
break;
if (i)
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));
}
*
* 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
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;
*/
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));
_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,
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,
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);
goto create_error;
}
}
- else if (!strcasecmp(line, "NumBins"))
+ else if (!_cups_strcasecmp(line, "NumBins"))
{
if (num_bins > 0)
{
goto create_error;
}
}
- else if (!strcasecmp(line, "Bin"))
+ else if (!_cups_strcasecmp(line, "Bin"))
{
if (sscanf(value, "%127s%40s", pwg_keyword, ppd_keyword) != 2)
{
pc->num_bins ++;
}
- else if (!strcasecmp(line, "NumSizes"))
+ else if (!_cups_strcasecmp(line, "NumSizes"))
{
if (num_sizes > 0)
{
goto create_error;
}
}
- else if (!strcasecmp(line, "Size"))
+ else if (!_cups_strcasecmp(line, "Size"))
{
if (pc->num_sizes >= num_sizes)
{
pc->num_sizes ++;
}
- else if (!strcasecmp(line, "CustomSize"))
+ else if (!_cups_strcasecmp(line, "CustomSize"))
{
if (pc->custom_max_width > 0)
{
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)
{
goto create_error;
}
}
- else if (!strcasecmp(line, "Source"))
+ else if (!_cups_strcasecmp(line, "Source"))
{
if (sscanf(value, "%127s%40s", pwg_keyword, ppd_keyword) != 2)
{
pc->num_sources ++;
}
- else if (!strcasecmp(line, "NumTypes"))
+ else if (!_cups_strcasecmp(line, "NumTypes"))
{
if (num_types > 0)
{
goto create_error;
}
}
- else if (!strcasecmp(line, "Type"))
+ else if (!_cups_strcasecmp(line, "Type"))
{
if (sscanf(value, "%127s%40s", pwg_keyword, ppd_keyword) != 2)
{
pc->num_types ++;
}
- else if (!strcasecmp(line, "Preset"))
+ else if (!_cups_strcasecmp(line, "Preset"))
{
/*
* Preset output-mode print-quality name=value ...
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
{
* Don't copy over custom size...
*/
- if (!strcasecmp(ppd_size->name, "Custom"))
+ if (!_cups_strcasecmp(ppd_size->name, "Custom"))
continue;
/*
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
{
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
{
}
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;
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);
}
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.
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;
}
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...
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);
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);
}
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);
}
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);
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;
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 ++)
{
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:
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;
*/
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);
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);
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);
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);
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);
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);
goto error;
}
-
+
ppd->fonts = tempfonts;
ppd->fonts[ppd->num_fonts] = _cupsStrAlloc(name);
ppd->num_fonts ++;
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);
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");
* attribute...
*/
- if (!strcasecmp(name, "PageRegion"))
+ if (!_cups_strcasecmp(name, "PageRegion"))
strcpy(custom_name, "CustomPageSize");
else
snprintf(custom_name, sizeof(custom_name), "Custom%s", name);
constraint->choice1[0] = '\0';
constraint->choice2[0] = '\0';
break;
-
+
case 3 : /* Two options, one choice... */
/*
* Check for broken constraints like "* Option"...
constraint->choice2[0] = '\0';
}
break;
-
+
case 4 : /* Two options, two choices... */
/*
* Check for broken constraints like "* Option"...
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));
}
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));
}
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));
}
return (NULL);
}
-
+
if (ppd->num_groups == 0)
group = malloc(sizeof(ppd_group_t));
else
*/
lineptr ++;
-
+
textptr = text;
while (*lineptr != '\0' && *lineptr != '\n' && *lineptr != ':')
cg->ppd_status = PPD_ILLEGAL_TRANSLATION;
return (0);
}
-
+
mask |= PPD_TEXT;
}
}
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.
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;
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;
/*
* 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);
*
* 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
{
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;
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 ++)
}
}
}
-
+
/*
* 'asn1_decode_snmp()' - Decode a SNMP packet.
*
* 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
# 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...
*/
/*
* 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.
{
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 */
# 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);
*
* 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
void
_cups_strcpy(char *dst, /* I - Destination string */
- const char *src) /* I - Source string */
+ const char *src) /* I - Source string */
{
while (*src)
*dst++ = *src++;
* '_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 ++;
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 */
{
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 ++;
else
return (-1);
}
-#endif /* !HAVE_STRNCASECMP */
#ifndef HAVE_STRLCAT
*
* 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
{
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');
*
* 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
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);
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)");
*
* 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
*/
unlink("testfile.dat");
-
+
/*
* Return the test status...
*/
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;
*/
unlink(compression ? "testfile.dat.gz" : "testfile.dat");
-
+
/*
* Return the test status...
*/
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;
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 ++)
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)
{
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)
{
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);
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;
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;
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));
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;
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
#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");
}
{
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)
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 */
DEBUG_printf(("2cupsGetPPD3: Local hostname=\"%s\"", localhost));
- if (!strcasecmp(localhost, hostname))
+ if (!_cups_strcasecmp(localhost, hostname))
strcpy(hostname, "localhost");
/*
* 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)
{
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)
* 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)
<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>
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>>
<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
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
<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>
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
ServerAlias althost
ServerAlias foo.example.com
ServerAlias bar.example.com
+ServerAlias one.example.com two.example.com
ServerAlias *
</PRE>
<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>
<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>
*
* 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
* Parse the command...
*/
- if (strncasecmp(lineptr, "Clean", 5) == 0)
+ if (_cups_strncasecmp(lineptr, "Clean", 5) == 0)
{
/*
* Clean heads...
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...
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...
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...
cupsWritePrintData("IQ\001\000\001", 5);
}
- else if (strncasecmp(lineptr, "SetAlignment", 12) == 0)
+ else if (_cups_strncasecmp(lineptr, "SetAlignment", 12) == 0)
{
/*
* Set head alignment...
*
* 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
* Parse the command...
*/
- if (strncasecmp(lineptr, "Clean", 5) == 0 &&
+ if (_cups_strncasecmp(lineptr, "Clean", 5) == 0 &&
(ppd->model_number & PCL_INKJET))
{
/*
*
* 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
* 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",
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",
else
banner->header = strdup(ptr);
}
- else if (!strcasecmp(line, "Image"))
+ else if (!_cups_strcasecmp(line, "Image"))
{
char imagefile[1024]; /* Image filename */
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 */
/*
* 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
{
{
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 ++;
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))
{
* 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);
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;
*
* 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
* 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)
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)
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;
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;
*/
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 */
*
* 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
* 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)
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)
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;
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 ((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 */
case CUPS_CSPACE_WHITE :
case CUPS_CSPACE_GOLD :
case CUPS_CSPACE_SILVER :
+ case CUPS_CSPACE_SW :
h->cupsNumColors = 1;
h->cupsBitsPerPixel = h->cupsBitsPerColor;
break;
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;
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;
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,
* 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);
}
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 */
pageinfo->num_options,
&(pageinfo->options));
}
- else if (strncmp(line, "%%Include", 9))
+ else if (!strncmp(line, "%%BeginPageSetup", 16))
+ {
+ has_page_setup = 1;
+ break;
+ }
+ else
break;
}
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? */
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");
* 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;
/*
*/
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;
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;
}
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;
/*
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
{
if ((val = cupsGetOption("OutputOrder", num_options, options)) != NULL)
{
- if (!strcasecmp(val, "Reverse"))
+ if (!_cups_strcasecmp(val, "Reverse"))
doc->output_order = 1;
}
else if (ppd)
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");
}
/*
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
{
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
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;
*
* 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
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;
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]);
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)
{
}
column ++;
- break;
+ break;
}
/*
.\" 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
.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.
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
{
// 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
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();
//
// 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
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);
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;
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),
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),
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),
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);
}
}
- if (strcasecmp(g->name->value, "General"))
+ if (_cups_strcasecmp(g->name->value, "General"))
cupsFilePrintf(fp, "*CloseGroup: %s%s", g->name->value, lf);
}
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,
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,
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,
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);
//
// 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
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);
//
// 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
// 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);
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...
driver->add_size(csize);
- if (!strcasecmp(size_option->defchoice, size->name))
+ if (!_cups_strcasecmp(size_option->defchoice, size->name))
driver->set_default_size(csize);
}
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);
}
}
//
// 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
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);
//
// 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
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);
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);
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);
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);
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
{
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);
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);
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)
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");
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"));
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();
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"));
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
{
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);
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
{
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
{
bytes += cupsFilePrintf(fp, tformat, va_arg(ap, int));
break;
-
+
case 'p' : // Pointer value
if ((format - bufformat + 1) > (int)sizeof(tformat))
break;
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)
{
cond_state |= PPDC_COND_SKIP;
}
}
- else if (!strcasecmp(temp, "#elif"))
+ else if (!_cups_strcasecmp(temp, "#elif"))
{
if (cond_current == cond_stack)
{
else
cond_temp --;
}
- else if (!strcasecmp(temp, "#else"))
+ else if (!_cups_strcasecmp(temp, "#else"))
{
if (cond_current == cond_stack)
{
else
cond_temp --;
}
- else if (!strcasecmp(temp, "#endif"))
+ else if (!_cups_strcasecmp(temp, "#endif"))
{
if (cond_current == cond_stack)
{
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
break;
}
}
- else if (!strcasecmp(temp, "#media"))
+ else if (!_cups_strcasecmp(temp, "#media"))
{
ppdcMediaSize *m; // Media size
sizes->add(m);
}
}
- else if (!strcasecmp(temp, "#po"))
+ else if (!_cups_strcasecmp(temp, "#po"))
{
ppdcCatalog *cat; // Message catalog
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)
d->add_attr(a);
}
}
- else if (!strcasecmp(temp, "Choice"))
+ else if (!_cups_strcasecmp(temp, "Choice"))
{
// Get a choice...
c = get_choice(fp);
if (isdefault)
o->set_defchoice(c);
}
- else if (!strcasecmp(temp, "ColorDevice"))
+ else if (!_cups_strcasecmp(temp, "ColorDevice"))
{
// ColorDevice boolean
if (cond_state)
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);
o = NULL;
}
- else if (!strcasecmp(temp, "ColorProfile"))
+ else if (!_cups_strcasecmp(temp, "ColorProfile"))
{
ppdcProfile *p; // Color profile
d->profiles->add(p);
}
}
- else if (!strcasecmp(temp, "Copyright"))
+ else if (!_cups_strcasecmp(temp, "Copyright"))
{
// Copyright string
char copytemp[8192], // Copyright string
d->copyright->add(new ppdcString(copyptr));
}
}
- else if (!strcasecmp(temp, "CustomMedia"))
+ else if (!_cups_strcasecmp(temp, "CustomMedia"))
{
ppdcMediaSize *m; // Media size
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?
o = NULL;
}
- else if (!strcasecmp(temp, "Darkness"))
+ else if (!_cups_strcasecmp(temp, "Darkness"))
{
// Get the darkness choice...
c = get_generic(fp, "Darkness", NULL, "cupsCompression");
o = NULL;
}
- else if (!strcasecmp(temp, "DriverType"))
+ else if (!_cups_strcasecmp(temp, "DriverType"))
{
int i; // Looping var
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
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);
o = NULL;
}
- else if (!strcasecmp(temp, "Font") ||
- !strcasecmp(temp, "#font"))
+ else if (!_cups_strcasecmp(temp, "Font") ||
+ !_cups_strcasecmp(temp, "#font"))
{
ppdcFont *f; // Font
f->release();
else
{
- if (!strcasecmp(temp, "#font"))
+ if (!_cups_strcasecmp(temp, "#font"))
base_fonts->add(f);
else
d->add_font(f);
}
}
}
- else if (!strcasecmp(temp, "Group"))
+ else if (!_cups_strcasecmp(temp, "Group"))
{
// Get a group...
ppdcGroup *tempg = get_group(fp, d);
g = tempg;
}
}
- else if (!strcasecmp(temp, "HWMargins"))
+ else if (!_cups_strcasecmp(temp, "HWMargins"))
{
// HWMargins left bottom right top
d->left_margin = get_measurement(fp);
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");
}
// Add the choice to the InputSlot option...
-
+
if ((o = d->find_option_group("InputSlot", &mg)) == NULL)
{
// Create the InputSlot option...
o = NULL;
}
- else if (!strcasecmp(temp, "Installable"))
+ else if (!_cups_strcasecmp(temp, "Installable"))
{
// Get the installable option...
o = get_installable(fp);
o = NULL;
}
}
- else if (!strcasecmp(temp, "ManualCopies"))
+ else if (!_cups_strcasecmp(temp, "ManualCopies"))
{
// ManualCopies boolean
if (cond_state)
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
if (!cond_state)
d->set_manufacturer(name);
}
- else if (!strcasecmp(temp, "MaxSize"))
+ else if (!_cups_strcasecmp(temp, "MaxSize"))
{
// MaxSize width length
if (cond_state)
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
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");
o = NULL;
}
- else if (!strcasecmp(temp, "MinSize"))
+ else if (!_cups_strcasecmp(temp, "MinSize"))
{
// MinSize width length
if (cond_state)
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
if (!cond_state)
d->set_model_name(name);
}
- else if (!strcasecmp(temp, "ModelNumber"))
+ else if (!_cups_strcasecmp(temp, "ModelNumber"))
{
// ModelNumber number
if (cond_state)
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);
o = tempo;
}
}
- else if (!strcasecmp(temp, "FileName"))
+ else if (!_cups_strcasecmp(temp, "FileName"))
{
// FileName name
char name[256]; // Filename string
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
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);
o = NULL;
}
- else if (!strcasecmp(temp, "SimpleColorProfile"))
+ else if (!_cups_strcasecmp(temp, "SimpleColorProfile"))
{
ppdcProfile *p; // Color profile
d->profiles->add(p);
}
}
- else if (!strcasecmp(temp, "Throughput"))
+ else if (!_cups_strcasecmp(temp, "Throughput"))
{
// Throughput number
if (cond_state)
else
d->throughput = get_integer(fp);
}
- else if (!strcasecmp(temp, "UIConstraints"))
+ else if (!_cups_strcasecmp(temp, "UIConstraints"))
{
ppdcConstraint *con; // Constraint
d->constraints->add(con);
}
}
- else if (!strcasecmp(temp, "VariablePaperSize"))
+ else if (!_cups_strcasecmp(temp, "VariablePaperSize"))
{
// VariablePaperSize boolean
if (cond_state)
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
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] == '-')
case 'v' : // Be verbose...
verbose ++;
break;
-
+
case 'z' : // Compress files...
comp = 1;
break;
opt += strlen(opt) - 1;
break;
}
-
+
default : // Unknown
usage();
break;
// 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...
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 ++;
cupsFileClose(infile);
return (1);
}
-
+
// Figure out the locale...
if ((locale = ppd_locale(ppd)) == NULL)
{
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,
argv[i]);
ppdClose(ppd);
}
-
+
// Close and move on...
cupsFileClose(infile);
}
{
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] == '_')
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();
"cupsdAddNameMask(masks=%p(%p), name=\"%s\")",
masks, *masks, name);
- if (!strcasecmp(name, "@LOCAL"))
+ if (!_cups_strcasecmp(name, "@LOCAL"))
{
/*
* Deny *interface*...
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*...
}
#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 */
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.");
}
#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...
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...
* Check for exact name match...
*/
- if (!strcasecmp(name, mask->mask.name.name))
+ if (!_cups_strcasecmp(name, mask->mask.name.name))
return (1);
/*
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;
*/
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);
}
*/
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)
{
*/
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)))
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);
}
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]))
if (cupsdCheckGroup(username, pw, name + 1))
return (HTTP_OK);
}
- else if (!strcasecmp(username, name))
+ else if (!_cups_strcasecmp(username, name))
return (HTTP_OK);
}
"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]))
*
* 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
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));
}
*
* 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
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);
*
* 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
* Decode the directive...
*/
- if (!strcasecmp(line, "<Class") ||
- !strcasecmp(line, "<DefaultClass"))
+ if (!_cups_strcasecmp(line, "<Class") ||
+ !_cups_strcasecmp(line, "<DefaultClass"))
{
/*
* <Class name> or <DefaultClass name>
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)
{
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);
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
&(p->options));
}
}
- else if (!strcasecmp(line, "Printer"))
+ else if (!_cups_strcasecmp(line, "Printer"))
{
if (!value)
{
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;
"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...
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...
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...
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)
{
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)
{
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);
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);
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);
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)
{
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)
{
*/
if (strcmp(scheme, "file") &&
- strcasecmp(hostname, ServerName) &&
- strcasecmp(hostname, "localhost") &&
+ _cups_strcasecmp(hostname, ServerName) &&
+ _cups_strcasecmp(hostname, "localhost") &&
!isdigit(hostname[0]) && hostname[0] != '[')
{
/*
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] &&
}
}
- 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
}
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
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;
#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
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 */
}
else
#endif /* HAVE_AUTHORIZATION_H */
- if (!strcasecmp(name, "@SYSTEM"))
+ if (!_cups_strcasecmp(name, "@SYSTEM"))
{
#ifdef HAVE_AUTHORIZATION_H
if (SystemGroupAuthKey)
* 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))
{
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);
}
}
- if (strncasecmp(con->header, "Status:", 7))
+ if (_cups_strncasecmp(con->header, "Status:", 7))
httpPrintf(HTTP(con), "%s\r\n", con->header);
/*
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);
* 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, "
return (0);
}
- if (!strcasecmp(type->type, "x-httpd-cgi") &&
+ if (!_cups_strcasecmp(type->type, "x-httpd-cgi") &&
(filestats->st_mode & 0111))
{
/*
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.
}
#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.
}
#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.
}
#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.
* 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) ||
*/
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 */
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 ":", ".",
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 ":", ".",
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 ":", ".",
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);
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",
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...
* Update classification setting as needed...
*/
- if (Classification && !strcasecmp(Classification, "none"))
+ if (Classification && !_cups_strcasecmp(Classification, "none"))
cupsdClearString(&Classification);
if (Classification)
if (*value == '[')
{
/*
- * Parse hexadecimal IPv6 address...
+ * Parse hexadecimal IPv6/IPv4 address...
*/
family = AF_INET6;
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);
}
else
return (0);
-
- while (*ptr == ':')
- ptr ++;
}
if (*ptr != ']')
* Parse dotted-decimal IPv4 address...
*/
- unsigned val[4]; /* IPv4 address values */
+ unsigned val[4] = { 0, 0, 0, 0 }; /* IPv4 address values */
family = AF_INET;
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]...
*/
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;
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 "
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
{
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
{
return (0);
}
}
- else if (!strcasecmp(line, "Allow") || !strcasecmp(line, "Deny"))
+ else if (!_cups_strcasecmp(line, "Allow") || !_cups_strcasecmp(line, "Deny"))
{
/*
* Allow [From] host/ip...
while (*value)
{
- if (!strncasecmp(value, "from", 4))
+ if (!_cups_strncasecmp(value, "from", 4))
{
/*
* Strip leading "from"...
value += 4;
- while (isspace(*value & 255))
+ while (_cups_isspace(*value))
value ++;
if (!*value)
* 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';
/*
* 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);
if (value[0] == '*')
value ++;
- if (!strcasecmp(line, "Allow"))
+ if (!_cups_strcasecmp(line, "Allow"))
cupsdAddNameMask(&(loc->allow), value);
else
cupsdAddNameMask(&(loc->deny), value);
return (0);
}
- if (!strcasecmp(line, "Allow"))
+ if (!_cups_strcasecmp(line, "Allow"))
cupsdAddIPMask(&(loc->allow), ip, mask);
else
cupsdAddIPMask(&(loc->deny), ip, mask);
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;
loc->level = CUPSD_AUTH_USER;
}
#ifdef HAVE_GSSAPI
- else if (!strcasecmp(value, "negotiate"))
+ else if (!_cups_strcasecmp(value, "negotiate"))
{
loc->type = CUPSD_AUTH_NEGOTIATE;
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;
"it from line %d.",
value, linenum);
}
- else if (!strcasecmp(value, "user"))
+ else if (!_cups_strcasecmp(value, "user"))
{
loc->level = CUPSD_AUTH_USER;
"\"Require valid-user\" on line %d.",
value, linenum);
}
- else if (!strcasecmp(value, "group"))
+ else if (!_cups_strcasecmp(value, "group"))
{
loc->level = CUPSD_AUTH_GROUP;
"\"Require user @groupname\" on line %d.",
value, linenum);
}
- else if (!strcasecmp(value, "system"))
+ else if (!_cups_strcasecmp(value, "system"))
{
loc->level = CUPSD_AUTH_GROUP;
return (0);
}
}
- else if (!strcasecmp(line, "AuthGroupName"))
+ else if (!_cups_strcasecmp(line, "AuthGroupName"))
{
cupsdAddName(loc, value);
"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...
* 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
{
for (value = valptr; *value;)
{
- while (isspace(*value & 255))
+ while (_cups_isspace(*value))
value ++;
#ifdef HAVE_AUTHORIZATION_H
* Grab literal name.
*/
- for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
+ for (valptr = value; !_cups_isspace(*valptr) && *valptr; valptr ++);
}
if (*valptr)
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
{
*/
for (valend = valstart; *valend; valend ++)
- if (isspace(*valend & 255) || *valend == ',')
+ if (_cups_isspace(*valend) || *valend == ',')
break;
if (*valend)
* 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;
}
*/
for (valend = valstart; *valend; valend ++)
- if (isspace(*valend) || *valend == ',')
+ if (_cups_isspace(*valend) || *valend == ',')
break;
}
valstart = valend;
- while (*valstart == ',' || isspace(*valstart))
+ while (*valstart == ',' || _cups_isspace(*valstart))
valstart ++;
}
*/
for (valend = valstart; *valend; valend ++)
- if (isspace(*valend & 255) || *valend == ',')
+ if (_cups_isspace(*valend) || *valend == ',')
break;
if (*valend)
* 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;
}
* Decode the directive...
*/
- if (!strcasecmp(line, "Include") && value)
+ if (!_cups_strcasecmp(line, "Include") && value)
{
/*
* Include filename
cupsFileClose(incfile);
}
}
- else if (!strcasecmp(line, "<Location") && value)
+ else if (!_cups_strcasecmp(line, "<Location") && value)
{
/*
* <Location path>
if (linenum == 0)
return (0);
}
- else if (!strcasecmp(line, "<Policy") && value)
+ else if (!_cups_strcasecmp(line, "<Policy") && value)
{
/*
* <Policy name>
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 */
)
{
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 */
httpAddrFreeList(addrlist);
}
- else if (!strcasecmp(line, "BrowseAddress") && value)
+ else if (!_cups_strcasecmp(line, "BrowseAddress") && value)
{
/*
* Add a browse address to the list...
memset(dira, 0, sizeof(cupsd_dirsvc_addr_t));
- if (!strcasecmp(value, "@LOCAL"))
+ if (!_cups_strcasecmp(value, "@LOCAL"))
{
/*
* Send browse data to all local interfaces...
strcpy(dira->iface, "*");
NumBrowsers ++;
}
- else if (!strncasecmp(value, "@IF(", 4))
+ else if (!_cups_strncasecmp(value, "@IF(", 4))
{
/*
* Send browse data to the named interface...
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"...
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]"
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...
"Unable to initialize browse access control list.");
else
{
- if (!strncasecmp(value, "from", 4))
+ if (!_cups_strncasecmp(value, "from", 4))
{
/*
* Skip leading "from"...
* Skip leading whitespace...
*/
- while (isspace(*value & 255))
+ while (_cups_isspace(*value))
value ++;
if (!*value)
*/
for (valueptr = value;
- *valueptr && !isspace(*valueptr & 255);
+ *valueptr && !_cups_isspace(*valueptr);
valueptr ++);
- while (isspace(*valueptr & 255))
+ while (_cups_isspace(*valueptr))
*valueptr++ = '\0';
/*
* 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);
* Host or domain name...
*/
- if (!strcasecmp(line, "BrowseAllow"))
+ if (!_cups_strcasecmp(line, "BrowseAllow"))
cupsdAddNameMask(&(location->allow), value);
else
cupsdAddNameMask(&(location->deny), value);
break;
}
- if (!strcasecmp(line, "BrowseAllow"))
+ if (!_cups_strcasecmp(line, "BrowseAllow"))
cupsdAddIPMask(&(location->allow), ip, mask);
else
cupsdAddIPMask(&(location->deny), ip, mask);
}
}
}
- else if (!strcasecmp(line, "BrowseRelay") && value)
+ else if (!_cups_strcasecmp(line, "BrowseRelay") && value)
{
/*
* BrowseRelay [from] source [to] destination
memset(relay, 0, sizeof(cupsd_dirsvc_relay_t));
- if (!strncasecmp(value, "from ", 5))
+ if (!_cups_strncasecmp(value, "from ", 5))
{
/*
* Skip leading "from"...
* Skip leading whitespace...
*/
- while (isspace(*value))
+ while (_cups_isspace(*value))
value ++;
}
*/
for (valueptr = value;
- *valueptr && !isspace(*valueptr & 255);
+ *valueptr && !_cups_isspace(*valueptr);
valueptr ++);
- while (isspace(*valueptr & 255))
+ while (_cups_isspace(*valueptr))
*valueptr++ = '\0';
/*
* Get "to" address and port...
*/
- if (!strncasecmp(valueptr, "to ", 3))
+ if (!_cups_strncasecmp(valueptr, "to ", 3))
{
/*
* Strip leading "to"...
valueptr += 3;
- while (isspace(*valueptr))
+ while (_cups_isspace(*valueptr))
valueptr ++;
}
valueptr, linenum);
}
}
- else if (!strcasecmp(line, "BrowsePoll") && value)
+ else if (!_cups_strcasecmp(line, "BrowsePoll") && value)
{
/*
* BrowsePoll address[:port]
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
}
}
#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
{
}
}
#endif /* HAVE_SSL */
- else if (!strcasecmp(line, "User") && value)
+ else if (!_cups_strcasecmp(line, "User") && value)
{
/*
* User ID to run as...
value, linenum);
}
}
- else if (!strcasecmp(line, "Group") && value)
+ else if (!_cups_strcasecmp(line, "Group") && value)
{
/*
* Group ID to run as...
value, linenum);
}
}
- else if (!strcasecmp(line, "SystemGroup") && value)
+ else if (!_cups_strcasecmp(line, "SystemGroup") && value)
{
/*
* SystemGroup (admin) group(s)...
"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...
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]
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])
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
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,
*/
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)
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,
* 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)
{
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))
{
* Decode the directive...
*/
- if (!strcasecmp(line, "</Policy>"))
+ if (!_cups_strcasecmp(line, "</Policy>"))
{
if (op)
cupsdLogMessage(CUPSD_LOG_WARN,
return (linenum);
}
- else if (!strcasecmp(line, "<Limit") && !op)
+ else if (!_cups_strcasecmp(line, "<Limit") && !op)
{
if (!value)
{
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,
op = cupsdAddPolicyOp(pol, NULL, ops[0]);
}
- else if (!strcasecmp(line, "</Limit>") && op)
+ else if (!_cups_strcasecmp(line, "</Limit>") && op)
{
/*
* Finish the current operation limit...
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)
{
* 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");
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");
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");
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");
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));
}
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 ****/
{
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")
* 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)
}
}
- if (make && !strcasecmp(ppd->record.make, make))
+ if (make && !_cups_strcasecmp(ppd->record.make, make))
ppd->matches ++;
if (make_and_model_re &&
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;
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;
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);
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,
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;
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;
}
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);
{
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)
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);
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");
/*
}
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])))
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)
{
*
* 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
}
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!
* 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;
/*
* the loop - we're done!
*/
- if (!strcasecmp(value, name))
+ if (!_cups_strcasecmp(value, name))
{
num_options = cupsParseOptions(optptr, num_options, options);
break;
#include <sys/wait.h>
#if defined(__APPLE__)
# include <libgen.h>
-#endif /* __APPLE__ */
+#endif /* __APPLE__ */
/*
}
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)
{
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)
{
/*
- * 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...
*/
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);
}
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);
};
#endif /* HAVE_LDAP */
-#ifdef HAVE_LIBSLP
+#ifdef HAVE_LIBSLP
/*
* SLP definitions...
*/
# define SLP_CUPS_SRVLEN 15
-/*
+/*
* Printer service URL structure
*/
/*
- * 'cupsdDeregisterPrinter()' - Stop sending broadcast information for a
+ * 'cupsdDeregisterPrinter()' - Stop sending broadcast information for a
* local printer and remove any pending
* references to remote printers.
*/
* Decode the directive...
*/
- if (!strcasecmp(line, "<Printer") ||
- !strcasecmp(line, "<DefaultPrinter"))
+ if (!_cups_strcasecmp(line, "<Printer") ||
+ !_cups_strcasecmp(line, "<DefaultPrinter"))
{
/*
* <Printer name> or <DefaultPrinter name>
* Set the default printer as needed...
*/
- if (!strcasecmp(line, "<DefaultPrinter"))
+ if (!_cups_strcasecmp(line, "<DefaultPrinter"))
DefaultPrinter = p;
}
else
break;
}
}
- else if (!strcasecmp(line, "<Class") ||
- !strcasecmp(line, "<DefaultClass"))
+ else if (!_cups_strcasecmp(line, "<Class") ||
+ !_cups_strcasecmp(line, "<DefaultClass"))
{
/*
* <Class name> or <DefaultClass name>
* Set the default printer as needed...
*/
- if (!strcasecmp(line, "<DefaultClass"))
+ if (!_cups_strcasecmp(line, "<DefaultClass"))
DefaultPrinter = p;
}
else
break;
}
}
- else if (!strcasecmp(line, "</Printer>") ||
- !strcasecmp(line, "</Class>"))
+ else if (!_cups_strcasecmp(line, "</Printer>") ||
+ !_cups_strcasecmp(line, "</Class>"))
{
if (p != NULL)
{
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);
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)
{
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
&(p->options));
}
}
- else if (!strcasecmp(line, "Reason"))
+ else if (!_cups_strcasecmp(line, "Reason"))
{
if (value)
{
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");
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...
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);
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)
{
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...
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)
{
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)
{
* 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 */
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
#ifdef HAVE_LIBSLP
if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP)
{
- /*
+ /*
* Open SLP handle...
*/
if (((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP) &&
BrowseSLPHandle)
{
- /*
+ /*
* Close SLP handle...
*/
* and temporary disable LDAP updates...
*/
- if (rc != LDAP_SUCCESS)
+ if (rc != LDAP_SUCCESS)
{
if (BrowseLDAPUpdate && ((rc == LDAP_SERVER_DOWN) || (rc == LDAP_CONNECT_ERROR)))
{
#endif /* HAVE_LDAP */
-#ifdef HAVE_LIBSLP
+#ifdef HAVE_LIBSLP
/*
* 'cupsdUpdateSLPBrowse()' - Get browsing information via SLP.
*/
BrowseSLPRefresh = time(NULL) + BrowseInterval;
- /*
+ /*
* Poll for remote printers using SLP...
*/
next = s->next;
- /*
+ /*
* Load a cupsd_printer_t structure with the SLP service attributes...
*/
cupsdClearString(&p.make_model);
free(s);
- }
+ }
}
#endif /* HAVE_LIBSLP */
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";
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));
}
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);
/*
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);
* or update the broadcast contents.
*/
-static void
+static void
dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
{
DNSServiceErrorType se; /* dnssd errors */
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);
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);
*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;
}
* Check for local server addresses...
*/
- if (!strcasecmp(host, ServerName) && port == LocalPort)
+ if (!_cups_strcasecmp(host, ServerName) && port == LocalPort)
return (1);
cupsdNetIFUpdate();
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);
/*
while (hptr != NULL)
{
- if (!strcasecmp(hptr, sptr))
+ if (!_cups_strcasecmp(hptr, sptr))
{
*hptr = '\0';
break;
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
is_class ? "Class" : "Printer", p->name);
cupsdExpireSubscriptions(p, NULL);
-
+
cupsdDeletePrinter(p, 1);
cupsdUpdateImplicitClasses();
cupsdMarkDirty(CUPSD_DIRTY_PRINTCAP | CUPSD_DIRTY_REMOTE);
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] == '@'))
{
/*
* 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);
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";
}
}
}
- else
+ else
{
/*
* No LDAP entry exists for the printer. Printer has never been registered,
p->name);
/*
- * Make the SLP service URL that conforms to the IANA
+ * Make the SLP service URL that conforms to the IANA
* 'printer:' template.
*/
/*
- * 'slp_attr_callback()' - SLP attribute callback
+ * 'slp_attr_callback()' - SLP attribute callback
*/
static SLPBoolean /* O - SLP_TRUE for success */
* '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 */
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.
*/
strlcpy(s->url, srvurl, sizeof(s->url));
- /*
+ /*
* Link the SLP service URL into the head of the list
*/
*/
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)
{
/*
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...
"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...
*/
if (!strcmp(username->values[0].string.text, "root") &&
- strcasecmp(con->http.hostname, "localhost") &&
+ _cups_strcasecmp(con->http.hostname, "localhost") &&
strcmp(con->username, "root"))
{
/*
*/
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."));
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;
}
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)
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)
break;
}
#else
- else if (!strcasecmp(username, name))
+ else if (!_cups_strcasecmp(username, name))
break;
#endif /* HAVE_MBR_UID_TO_UUID */
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;
}
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...
* 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")) &&
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")) &&
"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);
}
continue;
}
- if (username[0] && strcasecmp(username, job->username))
+ if (username[0] && _cups_strcasecmp(username, job->username))
continue;
if (count > 0)
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
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);
* completed...
*/
- if (strcasecmp(job->dest, src) ||
+ if (_cups_strcasecmp(job->dest, src) ||
job->state_value > IPP_JOB_STOPPED)
continue;
* 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);
/*
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);
}
}
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...
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
if (cupsdCheckGroup(username, pw, name))
break;
}
- else if (!strcasecmp(username, name))
+ else if (!_cups_strcasecmp(username, name))
break;
}
#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__ */
/*
* 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);
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
}
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;
cupsdDeleteJob(cupsd_job_t *job, /* I - Job */
cupsd_jobaction_t action)/* I - Action */
{
+ int i; /* Looping var */
char filename[1024]; /* Job filename */
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)
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);
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);
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 */
{
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 ++)
{
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))
"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);
/*
!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;
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)
{
"Missing <Job #> directive on line %d!", linenum);
continue;
}
- else if (!strcasecmp(line, "</Job>"))
+ else if (!_cups_strcasecmp(line, "</Job>"))
{
cupsArrayAdd(Jobs, job);
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);
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);
}
}
}
- else if (!strcasecmp(line, "File"))
+ else if (!_cups_strcasecmp(line, "File"))
{
int number, /* File number */
compression; /* Compression value */
while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum))
{
- if (!strcasecmp(line, "NextJobId"))
+ if (!_cups_strcasecmp(line, "NextJobId"))
{
if (value)
{
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,"
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...
*/
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...
*
* 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
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 */
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));
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)
*
* 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
*/
if ((name = (char *)cupsArrayFirst(attrs_ptr)) != NULL &&
- !strcasecmp(name, "none"))
+ !_cups_strcasecmp(name, "none"))
{
#ifdef DEBUG
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdGetPrivateAttrs: Returning NULL.");
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 */
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,
return (NULL);
}
- else if (!strcasecmp(name, "@SYSTEM"))
+ else if (!_cups_strcasecmp(name, "@SYSTEM"))
{
int i; /* Looping var */
return (NULL);
}
}
- else if (!strcasecmp(username, name))
+ else if (!_cups_strcasecmp(username, name))
{
#ifdef DEBUG
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdGetPrivateAttrs: Returning NULL.");
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));
}
* Decode the directive...
*/
- if (!strcasecmp(line, "<Printer") ||
- !strcasecmp(line, "<DefaultPrinter"))
+ if (!_cups_strcasecmp(line, "<Printer") ||
+ !_cups_strcasecmp(line, "<DefaultPrinter"))
{
/*
* <Printer name> or <DefaultPrinter name>
* 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)
{
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);
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);
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
&(p->options));
}
}
- else if (!strcasecmp(line, "PortMonitor"))
+ else if (!_cups_strcasecmp(line, "PortMonitor"))
{
if (value && strcmp(value, "none"))
cupsdSetString(&p->port_monitor, value);
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") &&
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;
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...
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...
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);
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...
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)
{
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)
{
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);
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);
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);
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)
{
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);
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 ++);
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);
}
}
* 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...
while (lptr != NULL)
{
- if (!strcasecmp(lptr, sptr))
+ if (!_cups_strcasecmp(lptr, sptr))
{
*lptr = '\0';
break;
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;
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);
}
/*
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)
{
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);
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));
}
}
{
(void)data;
- return (strcasecmp(((cupsd_printer_t *)first)->name,
+ return (_cups_strcasecmp(((cupsd_printer_t *)first)->name,
((cupsd_printer_t *)second)->name));
}
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",
}
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
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
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;
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;
request[1024], /* Quoted RequestRoot */
root[1024], /* Quoted ServerRoot */
temp[1024]; /* Quoted TempDir */
+ const char *nodebug; /* " (with no-log)" for no debug */
if (!UseProfiles)
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"
" #\"^/Library/\""
" #\"^/System$\""
" #\"^/System/\""
- "))\n",
- root, root);
+ ")%s)\n",
+ root, root, nodebug);
/* Specifically allow applications to stat RequestRoot */
cupsFilePrintf(fp,
"(allow file-read-metadata\n"
" #\"^/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)
{
/*
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));
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)
}
}
- 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);
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...
else
execv(exec_path, argv);
- perror(command);
-
- exit(1);
+ exit(errno + 100);
}
else if (*pid < 0)
{
*
* 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
* 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;
/*
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));
}
while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum))
{
- if (!strcasecmp(line, "NextSubscriptionId") && value)
+ if (!_cups_strcasecmp(line, "NextSubscriptionId") && value)
{
/*
* NextSubscriptionId NNN
if (i >= NextSubscriptionId && i > 0)
NextSubscriptionId = i;
}
- else if (!strcasecmp(line, "<Subscription"))
+ else if (!_cups_strcasecmp(line, "<Subscription"))
{
/*
* <Subscription #>
break;
}
}
- else if (!strcasecmp(line, "</Subscription>"))
+ else if (!_cups_strcasecmp(line, "</Subscription>"))
{
if (!sub)
{
"Syntax error on line %d of subscriptions.conf.",
linenum);
}
- else if (!strcasecmp(line, "Events"))
+ else if (!_cups_strcasecmp(line, "Events"))
{
/*
* Events name
value = valueptr;
}
}
- else if (!strcasecmp(line, "Owner"))
+ else if (!_cups_strcasecmp(line, "Owner"))
{
/*
* Owner
break;
}
}
- else if (!strcasecmp(line, "Recipient"))
+ else if (!_cups_strcasecmp(line, "Recipient"))
{
/*
* Recipient uri
break;
}
}
- else if (!strcasecmp(line, "JobId"))
+ else if (!_cups_strcasecmp(line, "JobId"))
{
/*
* JobId #
break;
}
}
- else if (!strcasecmp(line, "PrinterName"))
+ else if (!_cups_strcasecmp(line, "PrinterName"))
{
/*
* PrinterName name
break;
}
}
- else if (!strcasecmp(line, "UserData"))
+ else if (!_cups_strcasecmp(line, "UserData"))
{
/*
* UserData encoded-string
break;
}
}
- else if (!strcasecmp(line, "LeaseDuration"))
+ else if (!_cups_strcasecmp(line, "LeaseDuration"))
{
/*
* LeaseDuration #
break;
}
}
- else if (!strcasecmp(line, "Interval"))
+ else if (!_cups_strcasecmp(line, "Interval"))
{
/*
* Interval #
break;
}
}
- else if (!strcasecmp(line, "ExpirationTime"))
+ else if (!_cups_strcasecmp(line, "ExpirationTime"))
{
/*
* ExpirationTime #
break;
}
}
- else if (!strcasecmp(line, "NextEventId"))
+ else if (!_cups_strcasecmp(line, "NextEventId"))
{
/*
* NextEventId #
#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;
}
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
sysevent.powerNotificationID);
}
}
+#endif /* kIOPMAssertionTypeDenySystemSleep */
}
if (sysevent.event & SYSEVENT_WOKE)
*
* 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
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)
{
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);
}
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;
#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".
*/
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;
*
* 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
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);
}
put_line(outfile, line);
- intoc = !strcasecmp(line, "Table of Contents");
+ intoc = !_cups_strcasecmp(line, "Table of Contents");
toclevel = 0;
}
}
cupsSetUser(argv[i]);
}
break;
-
+
case 'a' : /* Cancel all jobs */
purge = 1;
op = IPP_PURGE_JOBS;
* 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/");
ptr = attr->value;
if (*ptr == '4' && ptr[1] == '.')
{
-
+
for (ptr += 2; *ptr; ptr ++)
if (!isdigit(*ptr & 255))
break;
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)
{
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)
{
errors ++;
}
-
+
/*
* Loop through all options and choices...
*/
!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 "
"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"
/*
* Then list the options, if "-v" was provided...
- */
+ */
if (verbose > 1)
{
else if (eol != EOL_CR)
mixed = 1;
}
-
+
if (col > 0 && whitespace)
_cupsLangPrintf(stdout,
_(" WARN Line %d only contains whitespace."),
*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");
_(" %s Missing option %s in "
"cupsUIConstraints %s: \"%s\""),
prefix, option, constattr->spec, constattr->value);
-
+
if (!warn)
errors ++;
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);
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");
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");
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"));
{
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"));
i --;
break;
}
- else if (!strcasecmp(choicea->choice, choiceb->choice))
+ else if (!_cups_strcasecmp(choicea->choice, choiceb->choice))
{
if (!errors && !verbose)
_cupsLangPuts(stdout, _(" FAIL"));
* 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"))
if (!warn)
errors ++;
}
-
+
snprintf(pathprog, sizeof(pathprog), "%s%s", root,
attr->value ? attr->value : "(null)");
{
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)
{
{
snprintf(buf, sizeof(buf), "%s.Transverse", pwg_media->ppd);
if (strcmp(size->name, buf))
- is_ok = 0;
+ is_ok = 0;
}
}
}
else
is_ok = 0;
}
-
+
if (!is_ok)
_cupsLangPrintf(stdout,
_(" %s Size \"%s\" should be the Adobe "
* 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)
{
errors ++;
}
- if (strcasecmp(option->keyword, "PageSize"))
+ if (_cups_strcasecmp(option->keyword, "PageSize"))
{
for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
cparam;
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;
}
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;
}
cupsSetUser(argv[i]);
}
break;
-
+
case 'u' : /* Allow/deny users */
if (argv[i][2])
val = argv[i] + 2;
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
_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,
(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 "
}
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)
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");
}
{
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,
{
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);
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 &&
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);
*
* 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
cups_dest_t *dests; /* Destinations */
cups_dest_t *dest; /* Current destination */
char *printer, /* Printer name */
- *instance, /* Instance name */
+ *instance, /* Instance name */
*option; /* Current option */
}
for (j = 0; j < num_options; j ++)
- if (!strcasecmp(options[j].name, option))
+ if (!_cups_strcasecmp(options[j].name, option))
{
/*
* Remove this option...
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);
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 */
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
*
* "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
cupsSetUser(argv[i]);
}
break;
-
+
case 'W' : /* Show which jobs? */
if (argv[i][2])
which = argv[i] + 2;
* Scan the name string for printer/class name(s)...
*/
- for (dptr = name; *dptr;)
+ for (dptr = name; *dptr;)
{
/*
* Skip leading whitespace and commas...
}
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"),
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());
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,
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"),
}
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)
{
*ptr++ = '\0';
formats[num_formats++] = ptr;
- if (!strcasecmp(ptr, "application/octet-stream"))
+ if (!_cups_strcasecmp(ptr, "application/octet-stream"))
defformat = ptr;
}
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]);
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);
(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)
* 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
* 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);
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...
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)
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));
}
*/
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
{
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, "}"))
*/
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
{
continue;
}
- else if (!strcasecmp(token, "NAME"))
+ else if (!_cups_strcasecmp(token, "NAME"))
{
/*
* Name of test...
{
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
{
*/
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
{
goto test_exit;
}
}
- else if (!strcasecmp(token, "VERSION"))
+ else if (!_cups_strcasecmp(token, "VERSION"))
{
if (get_token(fp, temp, sizeof(temp), &linenum))
{
goto test_exit;
}
}
- else if (!strcasecmp(token, "RESOURCE"))
+ else if (!_cups_strcasecmp(token, "RESOURCE"))
{
/*
* Resource name...
goto test_exit;
}
}
- else if (!strcasecmp(token, "OPERATION"))
+ else if (!_cups_strcasecmp(token, "OPERATION"))
{
/*
* Operation...
goto test_exit;
}
}
- else if (!strcasecmp(token, "GROUP"))
+ else if (!_cups_strcasecmp(token, "GROUP"))
{
/*
* Attribute group...
group = value;
}
- else if (!strcasecmp(token, "DELAY"))
+ else if (!_cups_strcasecmp(token, "DELAY"))
{
/*
* Delay before operation...
usleep((int)(1000000.0 * delay));
}
}
- else if (!strcasecmp(token, "ATTR"))
+ else if (!_cups_strcasecmp(token, "ATTR"))
{
/*
* Attribute...
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));
}
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);
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
break;
}
}
- else if (!strcasecmp(token, "FILE"))
+ else if (!_cups_strcasecmp(token, "FILE"))
{
/*
* File...
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...
last_status->if_defined = NULL;
last_status->if_not_defined = NULL;
}
- else if (!strcasecmp(token, "EXPECT"))
+ else if (!_cups_strcasecmp(token, "EXPECT"))
{
/*
* Expected attributes...
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))
{
goto test_exit;
}
}
- else if (!strcasecmp(token, "DEFINE-MATCH"))
+ else if (!_cups_strcasecmp(token, "DEFINE-MATCH"))
{
if (!get_token(fp, token, sizeof(token), &linenum))
{
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))
{
goto test_exit;
}
}
- else if (!strcasecmp(token, "DEFINE-VALUE"))
+ else if (!_cups_strcasecmp(token, "DEFINE-VALUE"))
{
if (!get_token(fp, token, sizeof(token), &linenum))
{
goto test_exit;
}
}
- else if (!strcasecmp(token, "OF-TYPE"))
+ else if (!_cups_strcasecmp(token, "OF-TYPE"))
{
if (!get_token(fp, token, sizeof(token), &linenum))
{
goto test_exit;
}
}
- else if (!strcasecmp(token, "IN-GROUP"))
+ else if (!_cups_strcasecmp(token, "IN-GROUP"))
{
ipp_tag_t in_group; /* IN-GROUP value */
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))
{
goto test_exit;
}
}
- else if (!strcasecmp(token, "IF-DEFINED"))
+ else if (!_cups_strcasecmp(token, "IF-DEFINED"))
{
if (!get_token(fp, token, sizeof(token), &linenum))
{
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))
{
goto test_exit;
}
}
- else if (!strcasecmp(token, "WITH-VALUE"))
+ else if (!_cups_strcasecmp(token, "WITH-VALUE"))
{
if (!get_token(fp, temp, sizeof(temp), &linenum))
{
goto test_exit;
}
}
- else if (!strcasecmp(token, "DISPLAY"))
+ else if (!_cups_strcasecmp(token, "DISPLAY"))
{
/*
* Display attributes...
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)
else
goto col_error;
}
- else if (!strcasecmp(token, "MEMBER"))
+ else if (!_cups_strcasecmp(token, "MEMBER"))
{
/*
* Attribute...
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));
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
* 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"
/*
*/
#define HAVE_STRDUP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
/* #undef HAVE_STRLCAT */
/* #undef HAVE_STRLCPY */
/* #undef HAVE_GETEUID */
+/*
+ * Do we have the setpgid() function?
+ */
+
+/* #undef HAVE_SETPGID */
+
+
/*
* Do we have the vsyslog() function?
*/
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 */,
* 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"
/*
*/
#define HAVE_STRDUP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
#define HAVE_STRLCAT 1
#define HAVE_STRLCPY 1
#define HAVE_GETEUID 1
+/*
+ * Do we have the setpgid() function?
+ */
+
+#define HAVE_SETPGID 1
+
+
/*
* Do we have the vsyslog() function?
*/