CHANGES IN CUPS V1.1.21rc3
+ - The lp, lpq, lpr, and lpstat commands now report when
+ an environment variable is pointing to a non-existent
+ printer instead of just saying "no default
+ destination" (STR #879)
- Queue names with 2 periods (e.g. "printer..2") were
not supported (STR #866)
/*
- * "$Id: lpq.c,v 1.17.2.15 2004/06/29 13:15:08 mike Exp $"
+ * "$Id: lpq.c,v 1.17.2.16 2004/09/08 19:02:07 mike Exp $"
*
* "lpq" command for the Common UNIX Printing System (CUPS).
*
int i; /* Looping var */
http_t *http; /* Connection to server */
const char *dest, /* Desired printer */
- *user; /* Desired user */
+ *user, /* Desired user */
+ *val; /* Environment variable name */
char *instance; /* Printer instance */
int id, /* Desired job ID */
all, /* All printers */
if (dest == NULL)
{
- fputs("lpq: error - no default destination available.\n", stderr);
+ val = NULL;
+
+ if ((dest = getenv("LPDEST")) == NULL)
+ {
+ if ((dest = getenv("PRINTER")) != NULL)
+ {
+ if (!strcmp(dest, "lp"))
+ dest = NULL;
+ else
+ val = "PRINTER";
+ }
+ }
+ else
+ val = "LPDEST";
+
+ if (dest && !cupsGetDest(dest, NULL, num_dests, dests))
+ fprintf(stderr, "lp: error - %s environment variable names non-existent destination \"%s\"!\n",
+ val, dest);
+ else
+ fputs("lpq: error - no default destination available.\n", stderr);
httpClose(http);
cupsFreeDests(num_dests, dests);
return (1);
/*
- * End of "$Id: lpq.c,v 1.17.2.15 2004/06/29 13:15:08 mike Exp $".
+ * End of "$Id: lpq.c,v 1.17.2.16 2004/09/08 19:02:07 mike Exp $".
*/
/*
- * "$Id: lpr.c,v 1.20.2.13 2004/07/17 02:44:49 mike Exp $"
+ * "$Id: lpr.c,v 1.20.2.14 2004/09/08 19:02:07 mike Exp $"
*
* "lpr" command for the Common UNIX Printing System (CUPS).
*
char ch; /* Option character */
char *printer, /* Destination printer or class */
*instance; /* Instance */
- const char *title; /* Job title */
+ const char *title, /* Job title */
+ *val; /* Environment variable name */
int num_copies; /* Number of copies per file */
int num_files; /* Number of files to print */
const char *files[1000]; /* Files to print */
if (printer == NULL)
{
- if (cupsLastError() == IPP_NOT_FOUND)
+ val = NULL;
+
+ if ((printer = getenv("LPDEST")) == NULL)
+ {
+ if ((printer = getenv("PRINTER")) != NULL)
+ {
+ if (!strcmp(printer, "lp"))
+ printer = NULL;
+ else
+ val = "PRINTER";
+ }
+ }
+ else
+ val = "LPDEST";
+
+ if (printer && !cupsGetDest(printer, NULL, num_dests, dests))
+ fprintf(stderr, "lpr: error - %s environment variable names non-existent destination \"%s\"!\n",
+ val, printer);
+ else if (cupsLastError() == IPP_NOT_FOUND)
fputs("lpr: error - no default destination available.\n", stderr);
else
fputs("lpr: error - scheduler not responding!\n", stderr);
/*
- * End of "$Id: lpr.c,v 1.20.2.13 2004/07/17 02:44:49 mike Exp $".
+ * End of "$Id: lpr.c,v 1.20.2.14 2004/09/08 19:02:07 mike Exp $".
*/
/*
- * "$Id: lp.c,v 1.29.2.19 2004/07/17 02:44:49 mike Exp $"
+ * "$Id: lp.c,v 1.29.2.20 2004/09/08 19:02:07 mike Exp $"
*
* "lp" command for the Common UNIX Printing System (CUPS).
*
if (printer == NULL)
{
- if (cupsLastError() == IPP_NOT_FOUND)
+ val = NULL;
+
+ if ((printer = getenv("LPDEST")) == NULL)
+ {
+ if ((printer = getenv("PRINTER")) != NULL)
+ {
+ if (!strcmp(printer, "lp"))
+ printer = NULL;
+ else
+ val = "PRINTER";
+ }
+ }
+ else
+ val = "LPDEST";
+
+ if (printer && !cupsGetDest(printer, NULL, num_dests, dests))
+ fprintf(stderr, "lp: error - %s environment variable names non-existent destination \"%s\"!\n",
+ val, printer);
+ else if (cupsLastError() == IPP_NOT_FOUND)
fputs("lp: error - no default destination available.\n", stderr);
else
fputs("lp: error - scheduler not responding!\n", stderr);
/*
- * End of "$Id: lp.c,v 1.29.2.19 2004/07/17 02:44:49 mike Exp $".
+ * End of "$Id: lp.c,v 1.29.2.20 2004/09/08 19:02:07 mike Exp $".
*/
/*
- * "$Id: lpstat.c,v 1.37.2.21 2004/06/29 13:15:11 mike Exp $"
+ * "$Id: lpstat.c,v 1.37.2.22 2004/09/08 19:02:07 mike Exp $"
*
* "lpstat" command for the Common UNIX Printing System (CUPS).
*
cups_dest_t *dests) /* I - User-defined destinations */
{
cups_dest_t *dest; /* Destination */
-
+ const char *printer, /* Printer name */
+ *val; /* Environment variable name */
if ((dest = cupsGetDest(NULL, NULL, num_dests, dests)) != NULL)
{
printf("system default destination: %s\n", dest->name);
}
else
- puts("no system default destination");
+ {
+ val = NULL;
+
+ if ((printer = getenv("LPDEST")) == NULL)
+ {
+ if ((printer = getenv("PRINTER")) != NULL)
+ {
+ if (!strcmp(printer, "lp"))
+ printer = NULL;
+ else
+ val = "PRINTER";
+ }
+ }
+ else
+ val = "LPDEST";
+
+ if (printer && !cupsGetDest(printer, NULL, num_dests, dests))
+ printf("lpstat: error - %s environment variable names non-existent destination \"%s\"!\n",
+ val, printer);
+ else
+ puts("no system default destination");
+ }
}
/*
- * End of "$Id: lpstat.c,v 1.37.2.21 2004/06/29 13:15:11 mike Exp $".
+ * End of "$Id: lpstat.c,v 1.37.2.22 2004/09/08 19:02:07 mike Exp $".
*/