+ snprintf(buffer, sizeof(buffer), "%s/%s:", option->keyword, option->text);
+
+ for (j = option->num_choices, choice = option->choices,
+ ptr = buffer + strlen(buffer);
+ j > 0 && ptr < (buffer + sizeof(buffer) - 1);
+ j --, choice ++)
+ {
+ if (!_cups_strcasecmp(choice->choice, "Custom"))
+ {
+ ppd_coption_t *coption; /* Custom option */
+ ppd_cparam_t *cparam; /* Custom parameter */
+ static const char * const types[] =
+ { /* Parameter types */
+ "CURVE",
+ "INTEGER",
+ "INVCURVE",
+ "PASSCODE",
+ "PASSWORD",
+ "POINTS",
+ "REAL",
+ "STRING"
+ };
+
+
+ if ((coption = ppdFindCustomOption(ppd, option->keyword)) == NULL ||
+ cupsArrayCount(coption->params) == 0)
+ snprintf(ptr, sizeof(buffer) - (ptr - buffer), " %sCustom",
+ choice->marked ? "*" : "");
+ else if (!_cups_strcasecmp(option->keyword, "PageSize") ||
+ !_cups_strcasecmp(option->keyword, "PageRegion"))
+ snprintf(ptr, sizeof(buffer) - (ptr - buffer),
+ " %sCustom.WIDTHxHEIGHT", choice->marked ? "*" : "");
+ else
+ {
+ cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
+
+ if (cupsArrayCount(coption->params) == 1)
+ snprintf(ptr, sizeof(buffer) - (ptr - buffer), " %sCustom.%s",
+ choice->marked ? "*" : "", types[cparam->type]);
+ else
+ {
+ const char *prefix; /* Prefix string */
+
+
+ if (choice->marked)
+ prefix = " *{";
+ else
+ prefix = " {";
+
+ while (cparam)
+ {
+ snprintf(ptr, sizeof(buffer) - (ptr - buffer), "%s%s=%s", prefix,
+ cparam->name, types[cparam->type]);
+ cparam = (ppd_cparam_t *)cupsArrayNext(coption->params);
+ prefix = " ";
+ ptr += strlen(ptr);
+ }
+
+ if (ptr < (buffer + sizeof(buffer) - 1))
+ strlcpy(ptr, "}", sizeof(buffer) - (ptr - buffer));
+ }
+ }
+ }
+ else if (choice->marked)
+ snprintf(ptr, sizeof(buffer) - (ptr - buffer), " *%s", choice->choice);