]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Only treat UI keywords as options when they contain all of the necessary
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 20 Feb 2003 14:49:50 +0000 (14:49 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 20 Feb 2003 14:49:50 +0000 (14:49 +0000)
information.

Allow DefaultFoo keywords after and outside an option definition.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@3395 7a7537e8-13f0-0310-91df-b6672ffda945

cups/ppd.c

index a42ba7ce3a1f8f7a20126cf805eea3ef2ae1ad26..5a9ad174b6d4b349a1d4c57ee63ea33457439f1f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ppd.c,v 1.96 2003/02/20 03:49:49 mike Exp $"
+ * "$Id: ppd.c,v 1.97 2003/02/20 14:49:50 mike Exp $"
  *
  *   PPD file routines for the Common UNIX Printing System (CUPS).
  *
@@ -563,7 +563,9 @@ ppdOpen(FILE *fp)                   /* I - File to read from */
       ui_keyword = 0;
     }
 
-    if (option == NULL)
+    if (option == NULL &&
+        (mask & (PPD_KEYWORD | PPD_OPTION | PPD_STRING)) ==
+           (PPD_KEYWORD | PPD_OPTION | PPD_STRING))
     {
       for (i = 0; i < (int)(sizeof(ui_keywords) / sizeof(ui_keywords[0])); i ++)
         if (!strcmp(keyword, ui_keywords[i]))
@@ -1650,42 +1652,15 @@ ppdOpen(FILE *fp)                       /* I - File to read from */
 
       if (option == NULL)
       {
-        ppd_group_t    *temp;
-
-
-       /*
-        * Only valid for Non-UI options...
-       */
-
-        for (i = ppd->num_groups, temp = ppd->groups; i > 0; i --, temp ++)
-          if (temp->text[0] == '\0')
-           break;
-
-        if (i > 0)
+        if ((option = ppdFindOption(ppd, keyword + 7)) != NULL)
        {
-          for (i = 0; i < temp->num_options; i ++)
-           if (strcmp(keyword + 7, temp->options[i].keyword) == 0)
-           {
-             strlcpy(temp->options[i].defchoice, string,
-                      sizeof(temp->options[i].defchoice));
-             break;
-           }
-
-          if (i >= temp->num_options)
-         {
-          /*
-           * Option not found; add this as an attribute...
-           */
-
-            ppd_add_attr(ppd, keyword, "", string);
-
-            string = NULL;             /* Don't free this string below */
-         }
+         strlcpy(option->defchoice, string, sizeof(option->defchoice));
+         option = NULL;
        }
        else
        {
         /*
-         * Default group not found; add this as an attribute...
+         * Option not found; add this as an attribute...
          */
 
           ppd_add_attr(ppd, keyword, "", string);
@@ -2986,5 +2961,5 @@ ppd_read(FILE *fp,                        /* I - File to read from */
 
 
 /*
- * End of "$Id: ppd.c,v 1.96 2003/02/20 03:49:49 mike Exp $".
+ * End of "$Id: ppd.c,v 1.97 2003/02/20 14:49:50 mike Exp $".
  */