X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fcups.git;a=blobdiff_plain;f=cups%2Fmark.c;h=a7d8fd7bd4dcf7178de2f5bd3bd8ea90997b15b5;hp=5cbac1b76cbf786acf9f9ee124d89c1494cece72;hb=f301802fc285c5ec9effadfbf13de653822dddd8;hpb=757d2cad8f3f75c420ad2e462b787cd9cf8a7a62 diff --git a/cups/mark.c b/cups/mark.c index 5cbac1b76..a7d8fd7bd 100644 --- a/cups/mark.c +++ b/cups/mark.c @@ -1,5 +1,5 @@ /* - * "$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). * @@ -241,9 +241,6 @@ ppd_option_t * /* O - Pointer to option or NULL */ 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... */ @@ -251,13 +248,39 @@ ppdFindOption(ppd_file_t *ppd, /* I - PPD file data */ 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); + } } @@ -656,5 +679,5 @@ ppd_defaults(ppd_file_t *ppd, /* I - PPD file */ /* - * 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 $". */