]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/mark.c
Load cups into easysw/current.
[thirdparty/cups.git] / cups / mark.c
index 5cbac1b76cbf786acf9f9ee124d89c1494cece72..a7d8fd7bd4dcf7178de2f5bd3bd8ea90997b15b5 100644 (file)
@@ -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 $".
  */