]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Support printer instances in LPDEST and PRINTER.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 21 Mar 2001 17:58:12 +0000 (17:58 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 21 Mar 2001 17:58:12 +0000 (17:58 +0000)
Return a value from ppdEmitJCL().

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

CHANGES.txt
cups/dest.c
cups/emit.c

index 8e56c6ffd5abbad11a8e4a27caceea6ee5df4eec..282156107803731e38559dad4ebf9900ab0c0aed 100644 (file)
@@ -1,4 +1,4 @@
-CHANGES.txt - 03/14/2001
+CHANGES.txt - 03/21/2001
 ------------------------
 
 CHANGES IN CUPS V1.1.7
@@ -109,6 +109,8 @@ CHANGES IN CUPS V1.1.7
          encryption.
        - Fixed a recursion bug in the scheduler that could
          cause cupsd to crash when a printer was removed.
+       - The LPDEST and PRINTER environment variables didn't
+         support instances.
 
 
 CHANGES IN CUPS V1.1.6-3
index a5b3ce824e14af169e09ca3a189b0e306952c28e..66c9454526165a296b8c741acc160ae4e6b58ac9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: dest.c,v 1.16 2001/01/22 15:03:24 mike Exp $"
+ * "$Id: dest.c,v 1.17 2001/03/21 17:58:11 mike Exp $"
  *
  *   User-defined destination (and option) support for the Common UNIX
  *   Printing System (CUPS).
@@ -210,6 +210,9 @@ cupsGetDests(cups_dest_t **dests)   /* O - Destinations */
   cups_dest_t  *dest;                  /* Destination pointer */
   const char   *home;                  /* HOME environment variable */
   char         filename[1024];         /* Local ~/.lpoptions file */
+  const char   *defprinter;            /* Default printer */
+  char         name[1024],             /* Copy of printer name */
+               *instance;              /* Pointer to instance name */
 
 
  /*
@@ -253,8 +256,25 @@ cupsGetDests(cups_dest_t **dests)  /* O - Destinations */
   * Grab the default destination...
   */
 
-  if ((dest = cupsGetDest(cupsGetDefault(), NULL, num_dests, *dests)) != NULL)
-    dest->is_default = 1;
+  if ((defprinter = cupsGetDefault()) != NULL)
+  {
+   /*
+    * Grab printer and instance name...
+    */
+
+    strncpy(name, defprinter, sizeof(name) - 1);
+    name[sizeof(name) - 1] = '\0';
+
+    if ((instance = strchr(name, '/')) != NULL)
+      *instance++ = '\0';
+
+   /*
+    * Lookup the printer and instance and make it the default...
+    */
+
+    if ((dest = cupsGetDest(name, instance, num_dests, *dests)) != NULL)
+      dest->is_default = 1;
+  }
 
  /*
   * Load the /etc/cups/lpoptions and ~/.lpoptions files...
@@ -517,5 +537,5 @@ cups_get_dests(const char  *filename,       /* I - File to read from */
 
 
 /*
- * End of "$Id: dest.c,v 1.16 2001/01/22 15:03:24 mike Exp $".
+ * End of "$Id: dest.c,v 1.17 2001/03/21 17:58:11 mike Exp $".
  */
index 480fe67fda399d50266db475777fc4af8149e553..1c80f560da1868d499785007f82ebc363a7c1a6b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: emit.c,v 1.22 2001/03/02 13:42:19 mike Exp $"
+ * "$Id: emit.c,v 1.23 2001/03/21 17:58:12 mike Exp $"
  *
  *   PPD code emission routines for the Common UNIX Printing System (CUPS).
  *
@@ -383,6 +383,8 @@ ppdEmitJCL(ppd_file_t *ppd,         /* I - PPD file record */
 
   ppdEmit(ppd, stdout, PPD_ORDER_JCL);
   fputs(ppd->jcl_ps, stdout);
+
+  return (0);
 }
 
 
@@ -404,5 +406,5 @@ ppd_sort(ppd_choice_t **c1, /* I - First choice */
 
 
 /*
- * End of "$Id: emit.c,v 1.22 2001/03/02 13:42:19 mike Exp $".
+ * End of "$Id: emit.c,v 1.23 2001/03/21 17:58:12 mike Exp $".
  */