free(ppd->lang_encoding);
free(ppd->nickname);
free(ppd->patches);
+ free(ppd->emulations);
free(ppd->jcl_begin);
free(ppd->jcl_end);
free(ppd->jcl_ps);
ppd_decode(ppd->jcl_ps); /* Decode quoted string */
}
else if (!strcmp(keyword, "AccurateScreensSupport"))
- ppd->accurate_screens = !strcmp(string, "True");
+ ppd->accurate_screens = !strcasecmp(string, "True");
else if (!strcmp(keyword, "ColorDevice"))
- ppd->color_device = !strcmp(string, "True");
+ ppd->color_device = !strcasecmp(string, "True");
else if (!strcmp(keyword, "ContoneOnly"))
- ppd->contone_only = !strcmp(string, "True");
+ ppd->contone_only = !strcasecmp(string, "True");
else if (!strcmp(keyword, "cupsFlipDuplex"))
- ppd->flip_duplex = !strcmp(string, "True");
+ ppd->flip_duplex = !strcasecmp(string, "True");
else if (!strcmp(keyword, "cupsManualCopies"))
- ppd->manual_copies = !strcmp(string, "True");
+ ppd->manual_copies = !strcasecmp(string, "True");
else if (!strcmp(keyword, "cupsModelNumber"))
ppd->model_number = atoi(string);
else if (!strcmp(keyword, "cupsColorProfile"))
goto error;
}
+ if (option && (!_cups_strcasecmp(option->defchoice, "custom") || !_cups_strncasecmp(option->defchoice, "custom.", 7)))
+ {
+ /*
+ * "*DefaultOption: Custom..." may set the default to a custom value
+ * or (for a very small number of incompatible PPD files) select a
+ * standard choice for the option, which CUPS renames to "_Custom..."
+ * to avoid compatibility issues. See which this is...
+ */
+
+ char tchoice[PPD_MAX_NAME]; /* Temporary choice name */
+
+ snprintf(tchoice, sizeof(tchoice), "_%s", option->defchoice);
+
+ if (ppdFindChoice(option, tchoice))
+ {
+ strlcpy(option->defchoice, tchoice, sizeof(option->defchoice));
+
+ DEBUG_printf(("2_ppdOpen: Reset Default%s to %s...", option->keyword, tchoice));
+ }
+ }
+
option = NULL;
free(string);
goto error;
}
+ if (option && (!_cups_strcasecmp(option->defchoice, "custom") || !_cups_strncasecmp(option->defchoice, "custom.", 7)))
+ {
+ /*
+ * "*DefaultOption: Custom..." may set the default to a custom value
+ * or (for a very small number of incompatible PPD files) select a
+ * standard choice for the option, which CUPS renames to "_Custom..."
+ * to avoid compatibility issues. See which this is...
+ */
+
+ char tchoice[PPD_MAX_NAME]; /* Temporary choice name */
+
+ snprintf(tchoice, sizeof(tchoice), "_%s", option->defchoice);
+
+ if (ppdFindChoice(option, tchoice))
+ {
+ strlcpy(option->defchoice, tchoice, sizeof(option->defchoice));
+
+ DEBUG_printf(("2_ppdOpen: Reset Default%s to %s...", option->keyword, tchoice));
+ }
+ }
+
option = NULL;
free(string);
* Set the default as part of the current option...
*/
- DEBUG_printf(("2_ppdOpen: Setting %s to %s...", keyword, string));
-
- strlcpy(option->defchoice, string, sizeof(option->defchoice));
+ strlcpy(option->defchoice, string, sizeof(option->defchoice));
- DEBUG_printf(("2_ppdOpen: %s is now %s...", keyword, option->defchoice));
+ DEBUG_printf(("2_ppdOpen: Set %s to %s...", keyword, option->defchoice));
}
else
{
ppd_option_t *toption; /* Temporary option */
-
if ((toption = ppdFindOption(ppd, keyword + 7)) != NULL)
{
- DEBUG_printf(("2_ppdOpen: Setting %s to %s...", keyword, string));
- strlcpy(toption->defchoice, string, sizeof(toption->defchoice));
+ if (!_cups_strcasecmp(string, "custom") || !_cups_strncasecmp(string, "custom.", 7))
+ {
+ /*
+ * "*DefaultOption: Custom..." may set the default to a custom value
+ * or (for a very small number of incompatible PPD files) select a
+ * standard choice for the option, which CUPS renames to "_Custom..."
+ * to avoid compatibility issues. See which this is...
+ */
+
+ snprintf(toption->defchoice, sizeof(toption->defchoice), "_%s", string);
+ if (!ppdFindChoice(toption, toption->defchoice))
+ strlcpy(toption->defchoice, string, sizeof(toption->defchoice));
+ }
+ else
+ {
+ strlcpy(toption->defchoice, string, sizeof(toption->defchoice));
+ }
+
+ DEBUG_printf(("2_ppdOpen: Set %s to %s...", keyword, toption->defchoice));
}
}
}
constraint->choice1, constraint->option2,
constraint->choice2))
{
- case 0 : /* Error */
- case 1 : /* Error */
+ default : /* Error */
pg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
goto error;
* Copy data over...
*/
+ if (!_cups_strcasecmp(spec, "custom") || !_cups_strncasecmp(spec, "custom.", 7))
+ {
+ temp->spec[0] = '_';
+ strlcpy(temp->spec + 1, spec, sizeof(temp->spec) - 1);
+ }
+ else {
+ strlcpy(temp->spec, spec, sizeof(temp->spec));
+ }
+
strlcpy(temp->name, name, sizeof(temp->name));
- strlcpy(temp->spec, spec, sizeof(temp->spec));
strlcpy(temp->text, text, sizeof(temp->text));
temp->value = (char *)value;
for (hash = option->keyword[0], k = option->keyword + 1; *k;)
- hash = 33 * hash + *k++;
+ hash = (int)(33U * (unsigned)hash) + *k++;
return (hash & 511);
}