[1849] in Moira Commits

home help back first fref pref prev next nref lref last post

/svn/moira r3995 - trunk/moira/gen

daemon@ATHENA.MIT.EDU (Garry Zacheiss)
Fri Mar 26 14:08:05 2010

Date: Fri, 26 Mar 2010 14:07:56 -0400
From: Garry Zacheiss <zacheiss@MIT.EDU>
Message-Id: <201003261807.o2QI7u8h023226@drugstore.mit.edu>
To: moira-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: zacheiss
Date: 2010-03-26 14:07:56 -0400 (Fri, 26 Mar 2010)
New Revision: 3995

Modified:
   trunk/moira/gen/cups-cluster.pc
   trunk/moira/gen/cups-print.pc
Log:
Add support for duplexdefault and holddefault columns.

Modified: trunk/moira/gen/cups-cluster.pc
===================================================================
--- trunk/moira/gen/cups-cluster.pc	2010-03-24 04:20:51 UTC (rev 3994)
+++ trunk/moira/gen/cups-cluster.pc	2010-03-26 18:07:56 UTC (rev 3995)
@@ -129,7 +129,7 @@
   char service[SERVERHOSTS_SERVICE_SIZE];
   char *spoolhost = host, *unixtime_fmt = UNIXTIME_FMT, *p;
   char *lhost;
-  int ka, pc, ac, lpc_acl, top_lpc_acl, banner, rm;
+  int ka, pc, ac, lpc_acl, top_lpc_acl, banner, rm, duplexdefault, holddefault;
   EXEC SQL END DECLARE SECTION;
   TARFILE *tf;
   FILE *out;
@@ -153,16 +153,17 @@
   EXEC SQL DECLARE csr_printers CURSOR FOR
     SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
     m.name, pr.banner, pr.location, pr.contact, pr.ka,
-    pr.ac, pr.lpc_acl
+    pr.ac, pr.lpc_acl, pr.duplexdefault, pr.holddefault
     FROM printers pr, machine m
     WHERE pr.rm = :rm AND m.mach_id = pr.mach_id
-    AND pr.status = 1 AND m.status !=3
+    AND pr.status = 1 AND m.status != 3
     AND (pr.type = 'DORM' or pr.type = 'CLUSTER');
   EXEC SQL OPEN csr_printers;
   while (1)
     {
       EXEC SQL FETCH csr_printers INTO :rp, :name, :duplexname,
-	:hwtype, :hostname, :banner, :location, :contact, :ka, :ac, :lpc_acl;
+	:hwtype, :hostname, :banner, :location, :contact, :ka, 
+	:ac, :lpc_acl, :duplexdefault, :holddefault;
       if (sqlca.sqlcode)
 	break;
 
@@ -178,6 +179,8 @@
 	*p = tolower(*p);
       for (p = lowerhwtype; *p; p++)
 	*p = tolower(*p);
+      for (p = name; *p; p++)
+	*p = tolower(*p);
 
       fprintf(out, "<Printer %s>\n",name);
       fprintf(out, "Info %s:%s\n", name, hwtype);
@@ -187,14 +190,19 @@
 	  fprintf(out, "DeviceURI lpd://%s/%s\n", hostname, rp);
       else
 	  fprintf(out, "DeviceURI accsnmp://socket://%s\n", hostname);
-      fprintf(out, "State Idle\n");	// Always with the Idle
+      fprintf(out, "State Idle\n");	/* Always with the Idle */
       fprintf(out, "StateTime %ld\n", (long)time(NULL));
+      if (holddefault)
+          fprintf(out, "Reason hold-new-jobs\n");
       fprintf(out, "Accepting Yes\n");
       fprintf(out, "Shared Yes\n");
       fprintf(out, "QuotaPeriod 0\n");
       fprintf(out, "PageLimit 0\n");
       fprintf(out, "Klimit 0\n");
-      fprintf(out, "Option sides one-sided\n");
+      if (duplexdefault)
+        fprintf(out, "Option sides two-sided-long-edge\n");
+      else
+        fprintf(out, "Option sides one-sided\n");
       fprintf(out, "Filter application/vnd.cups-raw 0 -\n");
       fprintf(out, "Filter application/vnd.cups-postscript 100 foomatic-rip\n");
       fprintf(out, "Filter application/vnd.cups-pdf 0 foomatic-rip\n");
@@ -260,18 +268,23 @@
 	*p = tolower(*p);
       for (p = lowerhwtype; *p; p++)
 	*p = tolower(*p);
+      for (p = name; *p; p++)
+	*p = tolower(*p);
 
       fprintf(out, "<Printer %s>\n",name);
       fprintf(out, "Info %s:%s\n", name, hwtype);
       fprintf(out, "DeviceURI ipp://%s:631/printers/%s?waitprinter=false&waitjob=false\n", cupshosts, rp);
-      fprintf(out, "State Idle\n");	// Always with the Idle
+      fprintf(out, "State Idle\n");	/* Always with the Idle */
       fprintf(out, "StateTime %ld\n", (long)time(NULL));
       fprintf(out, "Accepting Yes\n");
       fprintf(out, "Shared Yes\n");
       fprintf(out, "QuotaPeriod 0\n");
       fprintf(out, "PageLimit 0\n");
       fprintf(out, "Klimit 0\n");
-      fprintf(out, "Option sides one-sided\n");
+      if (duplexdefault)
+        fprintf(out, "Option sides two-sided-long-edge\n");
+      else
+        fprintf(out, "Option sides one-sided\n");
       fprintf(out, "Filter application/vnd.cups-raw 0 -\n");
       fprintf(out, "Filter application/vnd.cups-postscript 100 foomatic-rip\n");
       fprintf(out, "Filter application/vnd.cups-pdf 0 foomatic-rip\n");
@@ -308,7 +321,7 @@
   EXEC SQL DECLARE csr_lprng_printers CURSOR FOR
     SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
     m.name, pr.banner, pr.location, pr.contact, pr.ka,
-    pr.ac, pr.lpc_acl, m.name as cupshosts
+    pr.ac, pr.lpc_acl, m.name as cupshosts, pr.duplexdefault 
     FROM printers pr, machine m, machine m2, serverhosts sh
     WHERE pr.rm = m.mach_id 
     AND pr.status = 1 and pr.mach_id = m2.mach_id AND m2.status !=3
@@ -320,7 +333,8 @@
   while (1)
     {
       EXEC SQL FETCH csr_lprng_printers INTO :rp, :name, :duplexname,
-	:hwtype, :hostname, :banner, :location, :contact, :ka, :ac, :lpc_acl, :cupshosts;
+	:hwtype, :hostname, :banner, :location, :contact, :ka, 
+	:ac, :lpc_acl, :cupshosts, :duplexdefault;
       if (sqlca.sqlcode)
 	break;
 
@@ -337,18 +351,23 @@
 	*p = tolower(*p);
       for (p = lowerhwtype; *p; p++)
 	*p = tolower(*p);
+      for (p = name; *p; p++)
+	*p = tolower(*p);
 
       fprintf(out, "<Printer %s>\n",name);
       fprintf(out, "Info %s:LPRng Queue on %s\n", name, cupshosts);
       fprintf(out, "DeviceURI lpd://%s/%s\n", cupshosts, rp);
-      fprintf(out, "State Idle\n");	// Always with the Idle
+      fprintf(out, "State Idle\n");	/* Always with the Idle */
       fprintf(out, "StateTime %ld\n", (long)time(NULL));
       fprintf(out, "Accepting Yes\n");
       fprintf(out, "Shared Yes\n");
       fprintf(out, "QuotaPeriod 0\n");
       fprintf(out, "PageLimit 0\n");
       fprintf(out, "Klimit 0\n");
-      fprintf(out, "Option sides one-sided\n");
+      if (duplexdefault)
+        fprintf(out, "Option sides two-sided-long-edge\n");
+      else
+        fprintf(out, "Option sides one-sided\n");
       fprintf(out, "Filter application/vnd.cups-raw 0 -\n");
       fprintf(out, "Filter application/vnd.cups-postscript 100 foomatic-rip\n");
       fprintf(out, "Filter application/vnd.cups-pdf 0 foomatic-rip\n");
@@ -372,18 +391,19 @@
   EXEC SQL DECLARE csr_duplexqs CURSOR FOR
     SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
     m.name, pr.banner, pr.location, pr.contact, pr.ka, 
-    pr.type as prtype, pr.ac, sh.service
+    pr.type as prtype, pr.ac, sh.service, pr.duplexdefault
     FROM printers pr, machine m, machine m2, serverhosts sh
     WHERE pr.rm = m.mach_id 
     AND pr.status = 1 and pr.mach_id = m2.mach_id AND m2.status !=3
-    AND m.mach_id = sh.mach_id AND sh.enable = 1 
+    AND m.mach_id = sh.mach_id AND sh.enable = 1
     AND (pr.type = 'DORM' or pr.type = 'CLUSTER')
     AND (sh.service = 'CUPS-PRINT' OR sh.service = 'PRINT' OR sh.service = 'CUPS-CLUSTER');
   EXEC SQL OPEN csr_duplexqs;
   while (1)
     {
       EXEC SQL FETCH csr_duplexqs INTO :rp, :name, :duplexname,
-	:hwtype, :hostname, :banner, :location, :contact, :ka, :prtype, :ac, :service;
+	:hwtype, :hostname, :banner, :location, :contact, :ka, :prtype, 
+	:ac, :service, :duplexdefault;
       if (sqlca.sqlcode)
 	break;
 
@@ -404,8 +424,11 @@
           fprintf(out, "<Class %s>\n",name);
           fprintf(out, "Info Alias Queue to %s:%s\n", name, hwtype);
           fprintf(out, "Printer %s\n", rp);
-          fprintf(out, "Option sides one-sided\n");
-          fprintf(out, "State Idle\n");     // Always with the Idle
+          if (duplexdefault)
+            fprintf(out, "Option sides two-sided-long-edge\n");
+          else
+            fprintf(out, "Option sides one-sided\n");
+          fprintf(out, "State Idle\n");     /* Always with the Idle */
           fprintf(out, "StateTime %ld\n", (long)time(NULL));
           fprintf(out, "Accepting Yes\n");
           fprintf(out, "Shared Yes\n");
@@ -434,7 +457,7 @@
        * accounting reasons.  Annoyingly, classes don't always inherit
        * their printer definitions.
       */
-      if (*duplexname)
+      if (*duplexname && !duplexdefault)
 	{
           strtrim(duplexname);
           fprintf(out, "<Class %s>\n",duplexname);
@@ -444,7 +467,7 @@
             fprintf(out, "Info Duplex Queue for %s:%s\n", name, hwtype);
 	  fprintf(out, "Option sides two-sided-long-edge\n");	// duplex
           fprintf(out, "Printer %s\n", rp);
-          fprintf(out, "State Idle\n");     // Always with the Idle
+          fprintf(out, "State Idle\n");     /* Always with the Idle */
           fprintf(out, "StateTime %ld\n", (long)time(NULL));
           fprintf(out, "Accepting Yes\n");
           fprintf(out, "Shared Yes\n");
@@ -529,61 +552,61 @@
   /* lpcaccess.top */
   EXEC SQL SELECT ps.lpc_acl INTO :top_lpc_acl
     FROM printservers ps, machine m
-    WHERE m.name = :spoolhost AND m.mach_id = ps.mach_id;
-      fprintf (out, "<Policy default>\n");
-      fprintf (out, "%s\n", alterjob);
-      fprintf (out, "AuthType Default\n");
-      fprintf (out, "Require user @OWNER @SYSTEM\n");
+    WHERE m.name = :spoolhost AND m.mach_id = ps.mach_id AND m.status != 3;
+  fprintf (out, "<Policy default>\n");
+  fprintf (out, "%s\n", alterjob);
+  fprintf (out, "AuthType Default\n");
+  fprintf (out, "Require user @OWNER @SYSTEM\n");
   printer_user_list(out, "LIST", top_lpc_acl, "Require user", 1);
   fprintf (out, "Order deny,allow\n");
   fprintf (out, "</Limit>\n");
   fprintf (out, "<Limit Send-Document CUPS-Get-Document>\n");
   fprintf (out, "AuthType None\n");
   fprintf (out, "Require user @OWNER @SYSTEM\n");
-      fprintf (out, "Order deny,allow\n");
+  fprintf (out, "Order deny,allow\n");
   fprintf (out, "Allow from all\n");
-      fprintf (out, "</Limit>\n");
-      fprintf (out, "%s\n", submitjob);
-      fprintf (out, "AuthType None\n");
-      fprintf (out, "Order deny,allow\n");
-      fprintf (out, "Allow from all\n");
-      fprintf (out, "</Limit>\n");
-      fprintf (out, "%s\n", alterpntr);
-      fprintf (out, "AuthType Default\n");
-      fprintf (out, "Require user @SYSTEM\n");
-      fprintf (out, "Order deny,allow\n");
-      fprintf (out, "</Limit>\n");
-      fprintf (out, "%s\n", lpcpntr);
-      fprintf (out, "AuthType Default\n");
-      fprintf (out, "Require user @SYSTEM\n");
+  fprintf (out, "</Limit>\n");
+  fprintf (out, "%s\n", submitjob);
+  fprintf (out, "AuthType None\n");
+  fprintf (out, "Order deny,allow\n");
+  fprintf (out, "Allow from all\n");
+  fprintf (out, "</Limit>\n");
+  fprintf (out, "%s\n", alterpntr);
+  fprintf (out, "AuthType Default\n");
+  fprintf (out, "Require user @SYSTEM\n");
+  fprintf (out, "Order deny,allow\n");
+  fprintf (out, "</Limit>\n");
+  fprintf (out, "%s\n", lpcpntr);
+  fprintf (out, "AuthType Default\n");
+  fprintf (out, "Require user @SYSTEM\n");
   printer_user_list(out, "LIST", top_lpc_acl, "Require user", 1);
-      fprintf (out, "Order deny,allow\n");
-      fprintf (out, "</Limit>\n");
-      fprintf (out, "%s\n", canceljob);
-      fprintf (out, "AuthType Default\n");
-      fprintf (out, "Require user @OWNER @SYSTEM\n");
+  fprintf (out, "Order deny,allow\n");
+  fprintf (out, "</Limit>\n");
+  fprintf (out, "%s\n", canceljob);
+  fprintf (out, "AuthType Default\n");
+  fprintf (out, "Require user @OWNER @SYSTEM\n");
   printer_user_list(out, "LIST", top_lpc_acl, "Require user", 1);
-      fprintf (out, "Order deny,allow\n");
-      fprintf (out, "Allow from all\n");
-      fprintf (out, "</Limit>\n");
-      fprintf (out, "%s\n", catchall);
-      fprintf (out, "AuthType None\n");
-      fprintf (out, "Order deny,allow\n");
-      fprintf (out, "Allow from all\n");
-      fprintf (out, "</Limit>\n");
-      fprintf (out, "</Policy>\n");
+  fprintf (out, "Order deny,allow\n");
+  fprintf (out, "Allow from all\n");
+  fprintf (out, "</Limit>\n");
+  fprintf (out, "%s\n", catchall);
+  fprintf (out, "AuthType None\n");
+  fprintf (out, "Order deny,allow\n");
+  fprintf (out, "Allow from all\n");
+  fprintf (out, "</Limit>\n");
+  fprintf (out, "</Policy>\n");
 
   /* restrict lists and lpcaccess policies.  Sadly, we have to put the
      top level for each new policy since CUPS doesn't have a way of 
      doing it otherwise (well, Unix groups, but not moira) */
   EXEC SQL DECLARE csr_lpc CURSOR FOR
     SELECT UNIQUE pr.rp, pr.ka, pr.ac, pr.lpc_acl
-    FROM printers pr, machine m
-    WHERE (pr.ac != 0 OR pr.lpc_acl != 0) 
-    AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3
-    AND pr.rm in (SELECT m.mach_id FROM machine m, serverhosts sh
-    WHERE m.mach_id = sh.mach_id AND (sh.service = 'CUPS-PRINT' or sh.service = 'CUPS-CLUSTER') 
-    AND sh.enable = 1);
+     FROM printers pr, machine m
+     WHERE (pr.ac != 0 OR pr.lpc_acl != 0) 
+     AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3
+     AND pr.rm in (SELECT m.mach_id FROM machine m, serverhosts sh
+     WHERE m.mach_id = sh.mach_id AND (sh.service = 'CUPS-PRINT' or sh.service = 'CUPS-CLUSTER')
+     AND sh.enable = 1 and m.status != 3);
   EXEC SQL OPEN csr_lpc;
   while (1)
     {

Modified: trunk/moira/gen/cups-print.pc
===================================================================
--- trunk/moira/gen/cups-print.pc	2010-03-24 04:20:51 UTC (rev 3994)
+++ trunk/moira/gen/cups-print.pc	2010-03-26 18:07:56 UTC (rev 3995)
@@ -132,7 +132,7 @@
   char service[SERVERHOSTS_SERVICE_SIZE];
   char *spoolhost = host, *unixtime_fmt = UNIXTIME_FMT, *p;
   char *lhost;
-  int ka, pc, ac, lpc_acl, top_lpc_acl, banner, rm, svrlist_id;
+  int ka, pc, ac, lpc_acl, top_lpc_acl, banner, rm, svrlist_id, duplexdefault, holddefault;
   EXEC SQL END DECLARE SECTION;
   TARFILE *tf;
   FILE *out;
@@ -156,7 +156,7 @@
   EXEC SQL DECLARE csr_printers CURSOR FOR
     SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
     m.name, pr.banner, pr.location, pr.contact, pr.ka,
-    pr.ac, pr.lpc_acl
+    pr.ac, pr.lpc_acl, pr.duplexdefault, pr.holddefault
     FROM printers pr, machine m
     WHERE pr.rm = :rm AND m.mach_id = pr.mach_id
     AND pr.status = 1 AND m.status !=3
@@ -165,7 +165,8 @@
   while (1)
     {
       EXEC SQL FETCH csr_printers INTO :rp, :name, :duplexname,
-	:hwtype, :hostname, :banner, :location, :contact, :ka, :ac, :lpc_acl;
+	:hwtype, :hostname, :banner, :location, :contact, :ka, :ac, :lpc_acl,
+  	:duplexdefault, :holddefault;
       if (sqlca.sqlcode)
 	break;
 
@@ -181,6 +182,8 @@
 	*p = tolower(*p);
       for (p = lowerhwtype; *p; p++)
 	*p = tolower(*p);
+      for (p = name; *p; p++)
+	*p = tolower(*p);
 
       fprintf(out, "<Printer %s>\n",name);
       fprintf(out, "Info %s:%s\n", name, hwtype);
@@ -190,14 +193,19 @@
 	  fprintf(out, "DeviceURI lpd://%s/%s\n", hostname, rp);
       else
 	  fprintf(out, "DeviceURI accsnmp://socket://%s\n", hostname);
-      fprintf(out, "State Idle\n");	// Always with the Idle
+      fprintf(out, "State Idle\n");	/* Always with the Idle */
       fprintf(out, "StateTime %ld\n", (long)time(NULL));
+      if (holddefault)
+      	  fprintf(out, "Reason hold-new-jobs\n");
       fprintf(out, "Accepting Yes\n");
       fprintf(out, "Shared Yes\n");
       fprintf(out, "QuotaPeriod 0\n");
       fprintf(out, "PageLimit 0\n");
       fprintf(out, "Klimit 0\n");
-      fprintf(out, "Option sides one-sided\n");
+      if (duplexdefault)
+      	  fprintf(out, "Option sides two-sided-long-edge\n");
+      else
+      	  fprintf(out, "Option sides one-sided\n");
       fprintf(out, "Filter application/vnd.cups-raw 0 -\n");
       fprintf(out, "Filter application/vnd.cups-postscript 100 foomatic-rip\n");
       fprintf(out, "Filter application/vnd.cups-pdf 0 foomatic-rip\n");
@@ -234,7 +242,7 @@
   EXEC SQL DECLARE csr_remote_printers CURSOR FOR
     SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
     m.name, pr.banner, pr.location, pr.contact, pr.ka,
-    pr.ac, pr.lpc_acl, m.name as cupshosts
+    pr.ac, pr.lpc_acl, m.name as cupshosts, pr.duplexdefault
     FROM printers pr, machine m, machine m2, serverhosts sh
     WHERE pr.rm = m.mach_id 
     AND pr.status = 1 AND pr.mach_id = m2.mach_id AND m2.status !=3
@@ -246,7 +254,8 @@
   while (1)
     {
       EXEC SQL FETCH csr_remote_printers INTO :rp, :name, :duplexname,
-	:hwtype, :hostname, :banner, :location, :contact, :ka, :ac, :lpc_acl, :cupshosts;
+	:hwtype, :hostname, :banner, :location, :contact, :ka, :ac, 
+	:lpc_acl, :cupshosts, :duplexdefault;
       if (sqlca.sqlcode)
 	break;
 
@@ -263,18 +272,23 @@
 	*p = tolower(*p);
       for (p = lowerhwtype; *p; p++)
 	*p = tolower(*p);
+      for (p = name; *p; p++)
+	*p = tolower(*p);
 
       fprintf(out, "<Printer %s>\n",name);
       fprintf(out, "Info %s:%s\n", name, hwtype);
       fprintf(out, "DeviceURI ipp://%s:631/printers/%s?waitprinter=false&waitjob=false\n", cupshosts, rp);
-      fprintf(out, "State Idle\n");	// Always with the Idle
+      fprintf(out, "State Idle\n");	/* Always with the Idle */
       fprintf(out, "StateTime %ld\n", (long)time(NULL));
       fprintf(out, "Accepting Yes\n");
       fprintf(out, "Shared Yes\n");
       fprintf(out, "QuotaPeriod 0\n");
       fprintf(out, "PageLimit 0\n");
       fprintf(out, "Klimit 0\n");
-      fprintf(out, "Option sides one-sided\n");
+      if (duplexdefault)
+      	  fprintf(out, "Option sides two-sided-long-edge\n");
+      else
+      	  fprintf(out, "Option sides one-sided\n");
       fprintf(out, "Filter application/vnd.cups-raw 0 -\n");
       fprintf(out, "Filter application/vnd.cups-postscript 100 foomatic-rip\n");
       fprintf(out, "Filter application/vnd.cups-pdf 0 foomatic-rip\n");
@@ -311,10 +325,10 @@
   EXEC SQL DECLARE csr_lprng_printers CURSOR FOR
     SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
     m.name, pr.banner, pr.location, pr.contact, pr.ka,
-    pr.ac, pr.lpc_acl, m.name as cupshosts
+    pr.ac, pr.lpc_acl, m.name, pr.duplexdefault as cupshosts
     FROM printers pr, machine m, machine m2, serverhosts sh
     WHERE pr.rm = m.mach_id 
-    AND pr.status = 1 AND pr.mach_id = m2.mach_id AND m2.status !=3
+    AND pr.status = 1 AND pr.mach_id = m2.mach_id AND m2.status != 3
     AND pr.type != 'ALIAS' AND m.name <> :spoolhost AND
     m.mach_id = sh.mach_id AND sh.service = 'PRINT' AND 
     sh.enable = 1;
@@ -323,7 +337,8 @@
   while (1)
     {
       EXEC SQL FETCH csr_lprng_printers INTO :rp, :name, :duplexname,
-	:hwtype, :hostname, :banner, :location, :contact, :ka, :ac, :lpc_acl, :cupshosts;
+	:hwtype, :hostname, :banner, :location, :contact, :ka, :ac, 
+	:lpc_acl, :cupshosts, :duplexdefault;
       if (sqlca.sqlcode)
 	break;
 
@@ -340,18 +355,23 @@
 	*p = tolower(*p);
       for (p = lowerhwtype; *p; p++)
 	*p = tolower(*p);
+      for (p = name; *p; p++)
+	*p = tolower(*p);
 
       fprintf(out, "<Printer %s>\n",name);
       fprintf(out, "Info %s:LPRng Queue on %s\n", name, cupshosts);
       fprintf(out, "DeviceURI lpd://%s/%s\n", cupshosts, rp);
-      fprintf(out, "State Idle\n");	// Always with the Idle
+      fprintf(out, "State Idle\n");	/* Always with the Idle */
       fprintf(out, "StateTime %ld\n", (long)time(NULL));
       fprintf(out, "Accepting Yes\n");
       fprintf(out, "Shared Yes\n");
       fprintf(out, "QuotaPeriod 0\n");
       fprintf(out, "PageLimit 0\n");
       fprintf(out, "Klimit 0\n");
-      fprintf(out, "Option sides one-sided\n");
+      if (duplexdefault)
+      	  fprintf(out, "Option sides two-sided-long-edge\n");
+      else
+      	  fprintf(out, "Option sides one-sided\n");
       fprintf(out, "Filter application/vnd.cups-raw 0 -\n");
       fprintf(out, "Filter application/vnd.cups-postscript 100 foomatic-rip\n");
       fprintf(out, "Filter application/vnd.cups-pdf 0 foomatic-rip\n");
@@ -375,7 +395,7 @@
   EXEC SQL DECLARE csr_duplexqs CURSOR FOR
     SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
     m.name, pr.banner, pr.location, pr.contact, pr.ka, 
-    pr.type as prtype, pr.ac, sh.service
+    pr.type as prtype, pr.ac, sh.service, pr.duplexdefault
     FROM printers pr, machine m, machine m2, serverhosts sh
     WHERE pr.rm = m.mach_id 
     AND pr.status = 1 AND pr.mach_id = m2.mach_id AND m2.status !=3
@@ -385,7 +405,8 @@
   while (1)
     {
       EXEC SQL FETCH csr_duplexqs INTO :rp, :name, :duplexname,
-	:hwtype, :hostname, :banner, :location, :contact, :ka, :prtype, :ac, :service;
+	:hwtype, :hostname, :banner, :location, :contact, :ka, 
+	:prtype, :ac, :service, :duplexdefault;
       if (sqlca.sqlcode)
 	break;
 
@@ -406,8 +427,11 @@
           fprintf(out, "<Class %s>\n",name);
           fprintf(out, "Info Alias Queue to %s:%s\n", rp, hwtype);
           fprintf(out, "Printer %s\n", rp);
-          fprintf(out, "Option sides one-sided\n");
-          fprintf(out, "State Idle\n");     // Always with the Idle
+      	  if (duplexdefault)
+      	    fprintf(out, "Option sides two-sided-long-edge\n");
+      	  else
+      	    fprintf(out, "Option sides one-sided\n");
+          fprintf(out, "State Idle\n");	/* Always with the Idle */
           fprintf(out, "StateTime %ld\n", (long)time(NULL));
           fprintf(out, "Accepting Yes\n");
           fprintf(out, "Shared Yes\n");
@@ -436,7 +460,7 @@
        * accounting reasons.  Annoyingly, classes don't always inherit
        * their printer definitions.
       */
-      if (*duplexname)
+      if (*duplexname && !duplexdefault)
 	{
           strtrim(duplexname);
           fprintf(out, "<Class %s>\n",duplexname);
@@ -446,7 +470,7 @@
             fprintf(out, "Info Duplex Queue for %s:%s\n", rp, hwtype);
 	  fprintf(out, "Option sides two-sided-long-edge\n");	// duplex
           fprintf(out, "Printer %s\n", rp);
-          fprintf(out, "State Idle\n");     // Always with the Idle
+          fprintf(out, "State Idle\n");	/* Always with the Idle */
           fprintf(out, "StateTime %ld\n", (long)time(NULL));
           fprintf(out, "Accepting Yes\n");
           fprintf(out, "Shared Yes\n");
@@ -533,48 +557,48 @@
     WHERE m.name = :spoolhost AND m.mach_id = ps.mach_id;
 
   /* first, what's our defaults? */
-      fprintf (out, "<Policy default>\n");
-      fprintf (out, "%s\n", alterjob);
-      fprintf (out, "AuthType Default\n");
-      fprintf (out, "Require user @OWNER @SYSTEM\n");
+  fprintf (out, "<Policy default>\n");
+  fprintf (out, "%s\n", alterjob);
+  fprintf (out, "AuthType Default\n");
+  fprintf (out, "Require user @OWNER @SYSTEM\n");
   printer_user_list(out, "LIST", top_lpc_acl, "Require user", 1);
   fprintf (out, "Order deny,allow\n");
   fprintf (out, "</Limit>\n");
   fprintf (out, "<Limit Send-Document CUPS-Get-Document>\n");
   fprintf (out, "AuthType None\n");
   fprintf (out, "Require user @OWNER @SYSTEM\n");
-      fprintf (out, "Order deny,allow\n");
+  fprintf (out, "Order deny,allow\n");
   fprintf (out, "Allow from all\n");
-      fprintf (out, "</Limit>\n");
-      fprintf (out, "%s\n", submitjob);
-      fprintf (out, "AuthType None\n");
-      fprintf (out, "Order deny,allow\n");
-      fprintf (out, "Allow from all\n");
-      fprintf (out, "</Limit>\n");
-      fprintf (out, "%s\n", alterpntr);
-      fprintf (out, "AuthType Default\n");
-      fprintf (out, "Require user @SYSTEM\n");
-      fprintf (out, "Order deny,allow\n");
-      fprintf (out, "</Limit>\n");
-      fprintf (out, "%s\n", lpcpntr);
-      fprintf (out, "AuthType Default\n");
-      fprintf (out, "Require user @SYSTEM\n");
+  fprintf (out, "</Limit>\n");
+  fprintf (out, "%s\n", submitjob);
+  fprintf (out, "AuthType None\n");
+  fprintf (out, "Order deny,allow\n");
+  fprintf (out, "Allow from all\n");
+  fprintf (out, "</Limit>\n");
+  fprintf (out, "%s\n", alterpntr);
+  fprintf (out, "AuthType Default\n");
+  fprintf (out, "Require user @SYSTEM\n");
+  fprintf (out, "Order deny,allow\n");
+  fprintf (out, "</Limit>\n");
+  fprintf (out, "%s\n", lpcpntr);
+  fprintf (out, "AuthType Default\n");
+  fprintf (out, "Require user @SYSTEM\n");
   printer_user_list(out, "LIST", top_lpc_acl, "Require user", 1);
-      fprintf (out, "Order deny,allow\n");
-      fprintf (out, "</Limit>\n");
-      fprintf (out, "%s\n", canceljob);
-      fprintf (out, "AuthType Default\n");
-      fprintf (out, "Require user @OWNER @SYSTEM\n");
+  fprintf (out, "Order deny,allow\n");
+  fprintf (out, "</Limit>\n");
+  fprintf (out, "%s\n", canceljob);
+  fprintf (out, "AuthType Default\n");
+  fprintf (out, "Require user @OWNER @SYSTEM\n");
   printer_user_list(out, "LIST", top_lpc_acl, "Require user", 1);
-      fprintf (out, "Order deny,allow\n");
-      fprintf (out, "Allow from all\n");
-      fprintf (out, "</Limit>\n");
-      fprintf (out, "%s\n", catchall);
-      fprintf (out, "AuthType None\n");
-      fprintf (out, "Order deny,allow\n");
-      fprintf (out, "Allow from all\n");
-      fprintf (out, "</Limit>\n");
-      fprintf (out, "</Policy>\n");
+  fprintf (out, "Order deny,allow\n");
+  fprintf (out, "Allow from all\n");
+  fprintf (out, "</Limit>\n");
+  fprintf (out, "%s\n", catchall);
+  fprintf (out, "AuthType None\n");
+  fprintf (out, "Order deny,allow\n");
+  fprintf (out, "Allow from all\n");
+  fprintf (out, "</Limit>\n");
+  fprintf (out, "</Policy>\n");
 
   /* restrict lists and lpcaccess policies.  Sadly, we have to put the
      top level for each new policy since CUPS doesn't have a way of 


home help back first fref pref prev next nref lref last post