]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Save and restore printer-state-reasons.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 19 Sep 2008 20:52:46 +0000 (20:52 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 19 Sep 2008 20:52:46 +0000 (20:52 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@7967 7a7537e8-13f0-0310-91df-b6672ffda945

scheduler/dirsvc.c
scheduler/printers.c

index 3b6c4ba5d7e74ca20d84bff7fe12534670f9d174..3939448929459058bc7481cdffc9416001633984 100644 (file)
@@ -494,6 +494,18 @@ cupsdLoadRemoteCache(void)
                                       &(p->options));
       }
     }
+    else if (!strcasecmp(line, "Reason"))
+    {
+      if (value &&
+          p->num_reasons < (int)(sizeof(p->reasons) / sizeof(p->reasons[0])))
+      {
+        p->reasons[p->num_reasons] = _cupsStrAlloc(value);
+       p->num_reasons ++;
+      }
+      else
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of remote.cache.", linenum);
+    }
     else if (!strcasecmp(line, "State"))
     {
      /*
@@ -776,6 +788,9 @@ cupsdSaveRemoteCache(void)
     else
       cupsFilePuts(fp, "State Idle\n");
 
+    for (i = 0; i < printer->num_reasons; i ++)
+      cupsFilePrintf(fp, "Reason %s\n", printer->reasons[i]);
+
     if (printer->accepting)
       cupsFilePuts(fp, "Accepting Yes\n");
     else
index ea2531ca6d71eba8e0e5a295814f85e5b4abf36e..a3459a7386abbbba289fe240ccd5193274f67834 100644 (file)
@@ -1023,6 +1023,18 @@ cupsdLoadAllPrinters(void)
        cupsdLogMessage(CUPSD_LOG_ERROR,
                        "Syntax error on line %d of printers.conf.", linenum);
     }
+    else if (!strcasecmp(line, "Reason"))
+    {
+      if (value &&
+          p->num_reasons < (int)(sizeof(p->reasons) / sizeof(p->reasons[0])))
+      {
+        p->reasons[p->num_reasons] = _cupsStrAlloc(value);
+       p->num_reasons ++;
+      }
+      else
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
+    }
     else if (!strcasecmp(line, "State"))
     {
      /*
@@ -1452,6 +1464,9 @@ cupsdSaveAllPrinters(void)
 
     cupsFilePrintf(fp, "StateTime %d\n", (int)printer->state_time);
 
+    for (i = 0; i < printer->num_reasons; i ++)
+      cupsFilePrintf(fp, "Reason %s\n", printer->reasons[i]);
+
     if (printer->accepting)
       cupsFilePuts(fp, "Accepting Yes\n");
     else