]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - systemv/lpoptions.c
Load cups into easysw/current.
[thirdparty/cups.git] / systemv / lpoptions.c
index 8c4edc59907de1b82cba375c90a344db5ccd7b83..e6778acc9d5378a3f9488e73f61758d81aea580a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id$"
+ * "$Id: lpoptions.c 6202 2007-01-22 21:37:45Z mike $"
  *
  *   Printer option program for the Common UNIX Printing System (CUPS).
  *
@@ -69,6 +69,8 @@ main(int  argc,                               /* I - Number of command-line arguments */
                *option;                /* Current option */
 
 
+  _cupsSetLocale(argv);
+
  /*
   * Loop through the command-line arguments...
   */
@@ -164,6 +166,21 @@ main(int  argc,                            /* I - Number of command-line arguments */
            break;
 
        case 'o' : /* -o option[=value] */
+            if (dest == NULL)
+           {
+             if (num_dests == 0)
+               num_dests = cupsGetDests(&dests);
+
+             if ((dest = cupsGetDest(NULL, NULL, num_dests, dests)) == NULL)
+               dest = dests;
+
+             for (j = 0; j < dest->num_options; j ++)
+               if (cupsGetOption(dest->options[j].name, num_options, options) == NULL)
+                 num_options = cupsAddOption(dest->options[j].name,
+                                             dest->options[j].value,
+                                             num_options, &options);
+           }
+
            if (argv[i][2])
              num_options = cupsParseOptions(argv[i] + 2, num_options, &options);
            else
@@ -219,6 +236,21 @@ main(int  argc,                            /* I - Number of command-line arguments */
            break;
 
        case 'r' : /* -r option (remove) */
+            if (dest == NULL)
+           {
+             if (num_dests == 0)
+               num_dests = cupsGetDests(&dests);
+
+             if ((dest = cupsGetDest(NULL, NULL, num_dests, dests)) == NULL)
+               dest = dests;
+
+             for (j = 0; j < dest->num_options; j ++)
+               if (cupsGetOption(dest->options[j].name, num_options, options) == NULL)
+                 num_options = cupsAddOption(dest->options[j].name,
+                                             dest->options[j].value,
+                                             num_options, &options);
+           }
+
            if (argv[i][2])
              option = argv[i] + 2;
            else
@@ -231,7 +263,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
            }
 
             for (j = 0; j < num_options; j ++)
-             if (strcasecmp(options[j].name, option) == 0)
+             if (!strcasecmp(options[j].name, option))
              {
               /*
                * Remove this option...
@@ -408,8 +440,8 @@ list_options(cups_dest_t *dest)     /* I - Destination to list */
   if ((filename = cupsGetPPD(dest->name)) == NULL)
   {
     _cupsLangPrintf(stderr,
-                    _("lpoptions: Destination %s has no PPD file!\n"),
-                   dest->name);
+                    _("lpoptions: Unable to get PPD file for %s: %s\n"),
+                   dest->name, cupsLastErrorString());
     return;
   }
 
@@ -452,5 +484,5 @@ usage(void)
 
 
 /*
- * End of "$Id$".
+ * End of "$Id: lpoptions.c 6202 2007-01-22 21:37:45Z mike $".
  */