/*
- * "$Id$"
+ * "$Id: lpoptions.c 6202 2007-01-22 21:37:45Z mike $"
*
* Printer option program for the Common UNIX Printing System (CUPS).
*
*option; /* Current option */
+ _cupsSetLocale(argv);
+
/*
* Loop through the 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
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
}
for (j = 0; j < num_options; j ++)
- if (strcasecmp(options[j].name, option) == 0)
+ if (!strcasecmp(options[j].name, option))
{
/*
* Remove this option...
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;
}
/*
- * End of "$Id$".
+ * End of "$Id: lpoptions.c 6202 2007-01-22 21:37:45Z mike $".
*/