]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror 1.1.x changes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 8 Sep 2004 19:02:07 +0000 (19:02 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 8 Sep 2004 19:02:07 +0000 (19:02 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@4395 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES-1.1.txt
berkeley/lpq.c
berkeley/lpr.c
systemv/lp.c
systemv/lpstat.c

index abcc30a8857218b7efebe0bd8194b1e836366b44..e8f2b0ac57f41c8f3cccad65dcbd6137a471266a 100644 (file)
@@ -3,6 +3,10 @@ CHANGES-1.1.txt
 
 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)
 
index 29bbb62da717adf9ff40d839cb7bebcc691cda31..e5ffb35e3f93993b0b592d5771e35aefe487ac89 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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).
  *
@@ -66,7 +66,8 @@ main(int  argc,               /* I - Number of command-line arguments */
   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 */
@@ -184,7 +185,26 @@ main(int  argc,            /* I - Number of command-line arguments */
 
     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);
@@ -591,5 +611,5 @@ usage(void)
 
 
 /*
- * 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 $".
  */
index 71e64e954f15601bff499772ca34004e624c67d9..4dfac0e821f8e57612080f51cb3b70e8f52abf46 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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).
  *
@@ -72,7 +72,8 @@ main(int  argc,               /* I - Number of command-line arguments */
   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 */
@@ -321,7 +322,25 @@ main(int  argc,            /* I - Number of command-line arguments */
 
   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);
@@ -432,5 +451,5 @@ sighandler(int s)   /* I - Signal number */
 
 
 /*
- * 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 $".
  */
index d51c94a49731ccab3283f2d037e9ffade96a7b04..16d4f3bdbe5be9d2371de57f4347df0d8aa33f86 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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).
  *
@@ -520,7 +520,25 @@ main(int  argc,            /* I - Number of command-line arguments */
 
   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);
@@ -748,5 +766,5 @@ sighandler(int s)   /* I - Signal number */
 
 
 /*
- * 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 $".
  */
index bf921ea15e27bd386cb2fb1b81daa64b5dafb22f..eb0d154cf7a24cb852b3073702c0ab52f5806f3f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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).
  *
@@ -1049,7 +1049,8 @@ show_default(int         num_dests,       /* I - Number of user-defined dests */
             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)
   {
@@ -1059,7 +1060,28 @@ show_default(int         num_dests,      /* I - Number of user-defined dests */
       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");
+  }
 }
 
 
@@ -2085,5 +2107,5 @@ show_scheduler(http_t *http)      /* I - HTTP connection to server */
 
 
 /*
- * 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 $".
  */