]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/statbuf.c
Merge changes from CUPS 1.4svn-r7874.
[thirdparty/cups.git] / scheduler / statbuf.c
index ef944c6790fdaa847bf24264ada5d0055f87a0a3..c4959cfbefe4ce386cfb3a38f945f6fae7bb81f4 100644 (file)
@@ -1,31 +1,22 @@
 /*
- * "$Id: statbuf.c 177 2006-06-21 00:20:03Z jlovell $"
+ * "$Id: statbuf.c 7674 2008-06-18 23:18:32Z mike $"
  *
  *   Status buffer routines for the Common UNIX Printing System (CUPS)
  *   scheduler.
  *
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
- *   property of Easy Software Products and are protected by Federal
- *   copyright law.  Distribution and use rights are outlined in the file
- *   "LICENSE.txt" which should have been included with this file.  If this
- *   file is missing or damaged please contact Easy Software Products
- *   at:
- *
- *       Attn: CUPS Licensing Information
- *       Easy Software Products
- *       44141 Airport View Drive, Suite 204
- *       Hollywood, Maryland 20636 USA
- *
- *       Voice: (301) 373-9600
- *       EMail: cups-info@cups.org
- *         WWW: http://www.cups.org
+ *   property of Apple Inc. and are protected by Federal copyright
+ *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ *   which should have been included with this file.  If this file is
+ *   file is missing or damaged, see the license at "http://www.cups.org/".
  *
  * Contents:
  *
- *   cupsdStatBufNew()    - Create a new status buffer.
  *   cupsdStatBufDelete() - Destroy a status buffer.
+ *   cupsdStatBufNew()    - Create a new status buffer.
  *   cupsdStatBufUpdate() - Update the status buffer.
  */
 
 #include <stdarg.h>
 
 
+/*
+ * 'cupsdStatBufDelete()' - Destroy a status buffer.
+ */
+
+void
+cupsdStatBufDelete(cupsd_statbuf_t *sb)        /* I - Status buffer */
+{
+ /*
+  * Range check input...
+  */
+
+  if (!sb)
+    return;
+
+ /*
+  * Close the status pipe and free memory used...
+  */
+
+  close(sb->fd);
+
+  free(sb);
+}
+
+
 /*
  * 'cupsdStatBufNew()' - Create a new status buffer.
  */
@@ -98,30 +113,6 @@ cupsdStatBufNew(int fd,                     /* I - File descriptor of pipe */
 }
 
 
-/*
- * 'cupsdStatBufDelete()' - Destroy a status buffer.
- */
-
-void
-cupsdStatBufDelete(cupsd_statbuf_t *sb)        /* I - Status buffer */
-{
- /*
-  * Range check input...
-  */
-
-  if (!sb)
-    return;
-
- /*
-  * Close the status pipe and free memory used...
-  */
-
-  close(sb->fd);
-
-  free(sb);
-}
-
-
 /*
  * 'cupsdStatBufUpdate()' - Update the status buffer.
  */
@@ -193,7 +184,7 @@ cupsdStatBufUpdate(cupsd_statbuf_t *sb,     /* I - Status buffer */
       lineptr = NULL;
   }
 
-  if (lineptr == NULL)
+  if (!lineptr)
   {
    /*
     * End of file...
@@ -275,6 +266,11 @@ cupsdStatBufUpdate(cupsd_statbuf_t *sb,    /* I - Status buffer */
     *loglevel = CUPSD_LOG_ATTR;
     message   = sb->buffer + 5;
   }
+  else if (!strncmp(sb->buffer, "PPD:", 4))
+  {
+    *loglevel = CUPSD_LOG_PPD;
+    message   = sb->buffer + 4;
+  }
   else
   {
     *loglevel = CUPSD_LOG_DEBUG;
@@ -292,20 +288,23 @@ cupsdStatBufUpdate(cupsd_statbuf_t *sb,   /* I - Status buffer */
   * Send it to the log file as needed...
   */
 
-  if (*loglevel > CUPSD_LOG_NONE &&
-      (*loglevel != CUPSD_LOG_INFO || LogLevel == CUPSD_LOG_DEBUG2))
+  if (sb->prefix[0])
   {
-   /*
-    * General status message; send it to the error_log file...
-    */
+    if (*loglevel > CUPSD_LOG_NONE &&
+       (*loglevel != CUPSD_LOG_INFO || LogLevel == CUPSD_LOG_DEBUG2))
+    {
+     /*
+      * General status message; send it to the error_log file...
+      */
 
-    if (message[0] == '[')
-      cupsdLogMessage(*loglevel, "%s", message);
-    else
-      cupsdLogMessage(*loglevel, "%s %s", sb->prefix, message);
+      if (message[0] == '[')
+       cupsdLogMessage(*loglevel, "%s", message);
+      else
+       cupsdLogMessage(*loglevel, "%s %s", sb->prefix, message);
+    }
+    else if (*loglevel < CUPSD_LOG_NONE && LogLevel == CUPSD_LOG_DEBUG2)
+      cupsdLogMessage(CUPSD_LOG_DEBUG2, "%s %s", sb->prefix, sb->buffer);
   }
-  else if (*loglevel < CUPSD_LOG_NONE && LogLevel == CUPSD_LOG_DEBUG2)
-    cupsdLogMessage(CUPSD_LOG_DEBUG2, "%s %s", sb->prefix, sb->buffer);
 
  /*
   * Copy the message to the line buffer...
@@ -330,5 +329,5 @@ cupsdStatBufUpdate(cupsd_statbuf_t *sb,     /* I - Status buffer */
 
 
 /*
- * End of "$Id: statbuf.c 177 2006-06-21 00:20:03Z jlovell $".
+ * End of "$Id: statbuf.c 7674 2008-06-18 23:18:32Z mike $".
  */