/*
- * "$Id: mark.c 5238 2006-03-07 04:41:42Z mike $"
+ * "$Id: mark.c 5528 2006-05-15 20:03:12Z mike $"
*
* Option marking routines for the Common UNIX Printing System (CUPS).
*
ppdFindOption(ppd_file_t *ppd, /* I - PPD file data */
const char *option) /* I - Option/Keyword name */
{
- ppd_option_t key; /* Option search key */
-
-
/*
* Range check input...
*/
if (!ppd || !option)
return (NULL);
- /*
- * Search...
- */
+ if (ppd->options)
+ {
+ /*
+ * Search in the array...
+ */
+
+ ppd_option_t key; /* Option search key */
+
+
+ strlcpy(key.keyword, option, sizeof(key.keyword));
- strlcpy(key.keyword, option, sizeof(key.keyword));
+ return ((ppd_option_t *)cupsArrayFind(ppd->options, &key));
+ }
+ else
+ {
+ /*
+ * Search in each group...
+ */
- return ((ppd_option_t *)cupsArrayFind(ppd->options, &key));
+ int i, j; /* Looping vars */
+ ppd_group_t *group; /* Current group */
+ ppd_option_t *optptr; /* Current option */
+
+
+ for (i = ppd->num_groups, group = ppd->groups; i > 0; i --, group ++)
+ for (j = group->num_options, optptr = group->options;
+ j > 0;
+ j --, optptr ++)
+ if (!strcasecmp(optptr->keyword, option))
+ return (optptr);
+
+ return (NULL);
+ }
}
/*
- * End of "$Id: mark.c 5238 2006-03-07 04:41:42Z mike $".
+ * End of "$Id: mark.c 5528 2006-05-15 20:03:12Z mike $".
*/