]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/subscriptions.c
Update ipp documentation to reflect the behavior of configuring WiFi on IPP USB printers.
[thirdparty/cups.git] / scheduler / subscriptions.c
index c30762eb4b7d3a1b5c377826c5f1919f03848f1c..2dbb28f85b146d35abcaf98c0c2c9ddde21bd2ab 100644 (file)
@@ -1,37 +1,11 @@
 /*
- * "$Id: subscriptions.c 7824 2008-08-01 21:11:55Z mike $"
+ * Subscription routines for the CUPS scheduler.
  *
- *   Subscription routines for the CUPS scheduler.
+ * Copyright © 2007-2019 by Apple Inc.
+ * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
  *
- *   Copyright 2007-2011 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
- *
- *   These coded instructions, statements, and computer programs are the
- *   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:
- *
- *   cupsdAddEvent()               - Add an event to the global event cache.
- *   cupsdAddSubscription()        - Add a new subscription object.
- *   cupsdDeleteAllSubscriptions() - Delete all subscriptions.
- *   cupsdDeleteSubscription()     - Delete a subscription object.
- *   cupsdEventName()              - Return a single event name.
- *   cupsdEventValue()             - Return the event mask value for a name.
- *   cupsdExpireSubscriptions()    - Expire old subscription objects.
- *   cupsdFindSubscription()       - Find a subscription by ID.
- *   cupsdLoadAllSubscriptions()   - Load all subscriptions from the .conf file.
- *   cupsdSaveAllSubscriptions()   - Save all subscriptions to the .conf file.
- *   cupsdStopAllNotifiers()       - Stop all notifier processes.
- *   cupsd_compare_subscriptions() - Compare two subscriptions.
- *   cupsd_delete_event()          - Delete a single event...
- *   cupsd_send_dbus()             - Send a DBUS notification...
- *   cupsd_send_notification()     - Send a notification for the specified
- *                                   event.
- *   cupsd_start_notifier()        - Start a notifier subprocess...
- *   cupsd_update_notifier()       - Read messages from notifiers.
+ * Licensed under Apache License v2.0. See the file "LICENSE" for more
+ * information.
  */
 
 /*
  */
 
 static int     cupsd_compare_subscriptions(cupsd_subscription_t *first,
-                                           cupsd_subscription_t *second,
-                                           void *unused);
+                                           cupsd_subscription_t *second,
+                                           void *unused);
 static void    cupsd_delete_event(cupsd_event_t *event);
 #ifdef HAVE_DBUS
 static void    cupsd_send_dbus(cupsd_eventmask_t event, cupsd_printer_t *dest,
-                               cupsd_job_t *job);
+                               cupsd_job_t *job);
 #endif /* HAVE_DBUS */
 static void    cupsd_send_notification(cupsd_subscription_t *sub,
-                                       cupsd_event_t *event);
+                                       cupsd_event_t *event);
 static void    cupsd_start_notifier(cupsd_subscription_t *sub);
 static void    cupsd_update_notifier(void);
 
@@ -75,8 +49,8 @@ void
 cupsdAddEvent(
     cupsd_eventmask_t event,           /* I - Event */
     cupsd_printer_t   *dest,           /* I - Printer associated with event */
-    cupsd_job_t       *job,            /* I - Job associated with event */
-    const char        *text,           /* I - Notification text */
+    cupsd_job_t              *job,             /* I - Job associated with event */
+    const char       *text,            /* I - Notification text */
     ...)                               /* I - Additional arguments as needed */
 {
   va_list              ap;             /* Pointer to additional arguments */
@@ -87,7 +61,7 @@ cupsdAddEvent(
 
 
   cupsdLogMessage(CUPSD_LOG_DEBUG2,
-                  "cupsdAddEvent(event=%s, dest=%p(%s), job=%p(%d), text=\"%s\", ...)",
+                 "cupsdAddEvent(event=%s, dest=%p(%s), job=%p(%d), text=\"%s\", ...)",
                  cupsdEventName(event), dest, dest ? dest->name : "",
                  job, job ? job->id : 0, text);
 
@@ -108,8 +82,8 @@ cupsdAddEvent(
   if (MaxEvents <= 0)
   {
     cupsdLogMessage(CUPSD_LOG_WARN,
-                    "cupsdAddEvent: Discarding %s event since MaxEvents is %d!",
-                    cupsdEventName(event), MaxEvents);
+                   "cupsdAddEvent: Discarding %s event since MaxEvents is %d!",
+                   cupsdEventName(event), MaxEvents);
     return;
   }
 
@@ -126,9 +100,7 @@ cupsdAddEvent(
     * Check if this subscription requires this event...
     */
 
-    if ((sub->mask & event) != 0 &&
-        (sub->dest == dest || !sub->dest) &&
-       (sub->job == job || !sub->job))
+    if ((sub->mask & event) != 0 && (sub->dest == dest || !sub->dest || sub->job == job))
     {
      /*
       * Need this event, so create a new event record...
@@ -137,50 +109,54 @@ cupsdAddEvent(
       if ((temp = (cupsd_event_t *)calloc(1, sizeof(cupsd_event_t))) == NULL)
       {
        cupsdLogMessage(CUPSD_LOG_CRIT,
-                       "Unable to allocate memory for event - %s",
-                       strerror(errno));
+                       "Unable to allocate memory for event - %s",
+                       strerror(errno));
        return;
       }
 
       temp->event = event;
       temp->time  = time(NULL);
       temp->attrs = ippNew();
-      temp->job   = job;
-      temp->dest  = dest;
+      temp->job          = job;
+
+      if (dest)
+       temp->dest = dest;
+      else if (job)
+       temp->dest = dest = cupsdFindPrinter(job->dest);
 
      /*
       * Add common event notification attributes...
       */
 
       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_CHARSET,
-                   "notify-charset", NULL, "utf-8");
+                  "notify-charset", NULL, "utf-8");
 
       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_LANGUAGE,
-                   "notify-natural-language", NULL, "en-US");
+                  "notify-natural-language", NULL, "en-US");
 
       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
-                   "notify-subscription-id", sub->id);
+                   "notify-subscription-id", sub->id);
 
       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
-                   "notify-sequence-number", sub->next_event_id);
+                   "notify-sequence-number", sub->next_event_id);
 
       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD,
-                  "notify-subscribed-event", NULL, cupsdEventName(event));
+                  "notify-subscribed-event", NULL, cupsdEventName(event));
 
       if (sub->user_data_len > 0)
-        ippAddOctetString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                         "notify-user-data", sub->user_data,
+       ippAddOctetString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
+                         "notify-user-data", sub->user_data,
                          sub->user_data_len);
 
       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
-                   "printer-up-time", time(NULL));
+                   "printer-up-time", time(NULL));
 
       va_start(ap, text);
       vsnprintf(ftext, sizeof(ftext), text, ap);
       va_end(ap);
 
       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_TEXT,
-                  "notify-text", NULL, ftext);
+                  "notify-text", NULL, ftext);
 
       if (dest)
       {
@@ -188,27 +164,18 @@ cupsdAddEvent(
        * Add printer attributes...
        */
 
-       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_URI,
-                    "notify-printer-uri", NULL, dest->uri);
+       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_URI, "notify-printer-uri", NULL, dest->uri);
 
-       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME,
-                    "printer-name", NULL, dest->name);
+       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME, "printer-name", NULL, dest->name);
 
-       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM,
-                     "printer-state", dest->state);
+       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM, "printer-state", (int)dest->state);
 
        if (dest->num_reasons == 0)
-         ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                      IPP_TAG_KEYWORD, "printer-state-reasons", NULL,
-                      dest->state == IPP_PRINTER_STOPPED ? "paused" : "none");
+         ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "printer-state-reasons", NULL, dest->state == IPP_PRINTER_STOPPED ? "paused" : "none");
        else
-         ippAddStrings(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                       IPP_TAG_KEYWORD, "printer-state-reasons",
-                       dest->num_reasons, NULL,
-                       (const char * const *)dest->reasons);
+         ippAddStrings(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "printer-state-reasons", dest->num_reasons, NULL, (const char * const *)dest->reasons);
 
-       ippAddBoolean(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                     "printer-is-accepting-jobs", dest->accepting);
+       ippAddBoolean(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, "printer-is-accepting-jobs", (char)dest->accepting);
       }
 
       if (job)
@@ -217,75 +184,51 @@ cupsdAddEvent(
        * Add job attributes...
        */
 
-       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
-                     "notify-job-id", job->id);
-       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM,
-                     "job-state", job->state_value);
+       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER, "notify-job-id", job->id);
+       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM, "job-state", (int)job->state_value);
 
-        if ((attr = ippFindAttribute(job->attrs, "job-name",
-                                    IPP_TAG_NAME)) != NULL)
-         ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME,
-                      "job-name", NULL, attr->values[0].string.text);
+       if ((attr = ippFindAttribute(job->attrs, "job-name", IPP_TAG_NAME)) != NULL)
+         ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME, "job-name", NULL, attr->values[0].string.text);
 
        switch (job->state_value)
        {
          case IPP_JOB_PENDING :
-              if (dest && dest->state == IPP_PRINTER_STOPPED)
-               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                            IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                            "printer-stopped");
-              else
-               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                            IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                            "none");
-              break;
+             if (dest && dest->state == IPP_PRINTER_STOPPED)
+               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "printer-stopped");
+             else
+               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "none");
+             break;
 
          case IPP_JOB_HELD :
-              if (ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_KEYWORD) != NULL ||
+             if (ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_KEYWORD) != NULL ||
                  ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_NAME) != NULL)
-               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                            IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                            "job-hold-until-specified");
-              else
-               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                            IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                            "job-incoming");
-              break;
+               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "job-hold-until-specified");
+             else
+               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "job-incoming");
+             break;
 
          case IPP_JOB_PROCESSING :
-              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                          "job-printing");
-              break;
+             ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "job-printing");
+             break;
 
          case IPP_JOB_STOPPED :
-              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                          "job-stopped");
-              break;
+             ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "job-stopped");
+             break;
 
          case IPP_JOB_CANCELED :
-              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                          "job-canceled-by-user");
-              break;
+             ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "job-canceled-by-user");
+             break;
 
          case IPP_JOB_ABORTED :
-              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                          "aborted-by-system");
-              break;
+             ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "aborted-by-system");
+             break;
 
          case IPP_JOB_COMPLETED :
-              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                          "job-completed-successfully");
-              break;
+             ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "job-completed-successfully");
+             break;
        }
 
-       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
-                     "job-impressions-completed",
-                     job->sheets ? job->sheets->values[0].integer : 0);
+       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER, "job-impressions-completed", job->sheets ? job->sheets->values[0].integer : 0);
       }
 
      /*
@@ -299,8 +242,7 @@ cupsdAddEvent(
   if (temp)
     cupsdMarkDirty(CUPSD_DIRTY_SUBSCRIPTIONS);
   else
-    cupsdLogMessage(CUPSD_LOG_DEBUG, "Discarding unused %s event...",
-                    cupsdEventName(event));
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "Discarding unused %s event...", cupsdEventName(event));
 }
 
 
@@ -310,30 +252,30 @@ cupsdAddEvent(
 
 cupsd_subscription_t *                 /* O - New subscription object */
 cupsdAddSubscription(
-    unsigned        mask,              /* I - Event mask */
+    unsigned       mask,               /* I - Event mask */
     cupsd_printer_t *dest,             /* I - Printer, if any */
-    cupsd_job_t     *job,              /* I - Job, if any */
-    const char      *uri,              /* I - notify-recipient-uri, if any */
-    int             sub_id)            /* I - notify-subscription-id or 0 */
+    cupsd_job_t            *job,               /* I - Job, if any */
+    const char     *uri,               /* I - notify-recipient-uri, if any */
+    int                    sub_id)             /* I - notify-subscription-id or 0 */
 {
   cupsd_subscription_t *temp;          /* New subscription object */
 
 
   cupsdLogMessage(CUPSD_LOG_DEBUG,
-                  "cupsdAddSubscription(mask=%x, dest=%p(%s), job=%p(%d), "
+                 "cupsdAddSubscription(mask=%x, dest=%p(%s), job=%p(%d), "
                  "uri=\"%s\")",
-                  mask, dest, dest ? dest->name : "", job, job ? job->id : 0,
+                 mask, dest, dest ? dest->name : "", job, job ? job->id : 0,
                  uri ? uri : "(null)");
 
   if (!Subscriptions)
     Subscriptions = cupsArrayNew((cups_array_func_t)cupsd_compare_subscriptions,
-                                 NULL);
+                                NULL);
 
   if (!Subscriptions)
   {
     cupsdLogMessage(CUPSD_LOG_CRIT,
-                    "Unable to allocate memory for subscriptions - %s",
-                   strerror(errno));
+                   "Unable to allocate memory for subscriptions - %s",
+                   strerror(errno));
     return (NULL);
   }
 
@@ -344,7 +286,7 @@ cupsdAddSubscription(
   if (MaxSubscriptions > 0 && cupsArrayCount(Subscriptions) >= MaxSubscriptions)
   {
     cupsdLogMessage(CUPSD_LOG_DEBUG,
-                    "cupsdAddSubscription: Reached MaxSubscriptions %d "
+                   "cupsdAddSubscription: Reached MaxSubscriptions %d "
                    "(count=%d)", MaxSubscriptions,
                    cupsArrayCount(Subscriptions));
     return (NULL);
@@ -352,14 +294,14 @@ cupsdAddSubscription(
 
   if (MaxSubscriptionsPerJob > 0 && job)
   {
-    int        count;                          /* Number of job subscriptions */
+    int count;                         /* Number of job subscriptions */
 
     for (temp = (cupsd_subscription_t *)cupsArrayFirst(Subscriptions),
-             count = 0;
-         temp;
+            count = 0;
+        temp;
         temp = (cupsd_subscription_t *)cupsArrayNext(Subscriptions))
       if (temp->job == job)
-        count ++;
+       count ++;
 
     if (count >= MaxSubscriptionsPerJob)
     {
@@ -373,14 +315,14 @@ cupsdAddSubscription(
 
   if (MaxSubscriptionsPerPrinter > 0 && dest)
   {
-    int        count;                          /* Number of printer subscriptions */
+    int count;                         /* Number of printer subscriptions */
 
     for (temp = (cupsd_subscription_t *)cupsArrayFirst(Subscriptions),
-             count = 0;
-         temp;
+            count = 0;
+        temp;
         temp = (cupsd_subscription_t *)cupsArrayNext(Subscriptions))
       if (temp->dest == dest)
-        count ++;
+       count ++;
 
     if (count >= MaxSubscriptionsPerPrinter)
     {
@@ -399,8 +341,8 @@ cupsdAddSubscription(
   if ((temp = calloc(1, sizeof(cupsd_subscription_t))) == NULL)
   {
     cupsdLogMessage(CUPSD_LOG_CRIT,
-                    "Unable to allocate memory for subscription object - %s",
-                    strerror(errno));
+                   "Unable to allocate memory for subscription object - %s",
+                   strerror(errno));
     return (NULL);
   }
 
@@ -422,10 +364,10 @@ cupsdAddSubscription(
     NextSubscriptionId ++;
   }
 
-  temp->mask           = mask;
-  temp->dest           = dest;
-  temp->job            = job;
-  temp->pipe           = -1;
+  temp->mask          = mask;
+  temp->dest          = dest;
+  temp->job           = job;
+  temp->pipe          = -1;
   temp->first_event_id = 1;
   temp->next_event_id  = 1;
 
@@ -478,7 +420,7 @@ cupsdDeleteAllSubscriptions(void)
 void
 cupsdDeleteSubscription(
     cupsd_subscription_t *sub,         /* I - Subscription object */
-    int                  update)       /* I - 1 = update subscriptions.conf */
+    int                         update)        /* I - 1 = update subscriptions.conf */
 {
  /*
   * Close the pipe to the notifier as needed...
@@ -524,79 +466,79 @@ cupsdEventName(
   switch (event)
   {
     default :
-        return (NULL);
+       return (NULL);
 
     case CUPSD_EVENT_PRINTER_RESTARTED :
-        return ("printer-restarted");
+       return ("printer-restarted");
 
     case CUPSD_EVENT_PRINTER_SHUTDOWN :
-        return ("printer-shutdown");
+       return ("printer-shutdown");
 
     case CUPSD_EVENT_PRINTER_STOPPED :
-        return ("printer-stopped");
+       return ("printer-stopped");
 
     case CUPSD_EVENT_PRINTER_FINISHINGS_CHANGED :
-        return ("printer-finishings-changed");
+       return ("printer-finishings-changed");
 
     case CUPSD_EVENT_PRINTER_MEDIA_CHANGED :
-        return ("printer-media-changed");
+       return ("printer-media-changed");
 
     case CUPSD_EVENT_PRINTER_ADDED :
-        return ("printer-added");
+       return ("printer-added");
 
     case CUPSD_EVENT_PRINTER_DELETED :
-        return ("printer-deleted");
+       return ("printer-deleted");
 
     case CUPSD_EVENT_PRINTER_MODIFIED :
-        return ("printer-modified");
+       return ("printer-modified");
 
     case CUPSD_EVENT_PRINTER_QUEUE_ORDER_CHANGED :
-        return ("printer-queue-order-changed");
+       return ("printer-queue-order-changed");
 
     case CUPSD_EVENT_PRINTER_STATE :
     case CUPSD_EVENT_PRINTER_STATE_CHANGED :
-        return ("printer-state-changed");
+       return ("printer-state-changed");
 
     case CUPSD_EVENT_PRINTER_CONFIG :
     case CUPSD_EVENT_PRINTER_CONFIG_CHANGED :
-        return ("printer-config-changed");
+       return ("printer-config-changed");
 
     case CUPSD_EVENT_PRINTER_CHANGED :
-        return ("printer-changed");
+       return ("printer-changed");
 
     case CUPSD_EVENT_JOB_CREATED :
-        return ("job-created");
+       return ("job-created");
 
     case CUPSD_EVENT_JOB_COMPLETED :
-        return ("job-completed");
+       return ("job-completed");
 
     case CUPSD_EVENT_JOB_STOPPED :
-        return ("job-stopped");
+       return ("job-stopped");
 
     case CUPSD_EVENT_JOB_CONFIG_CHANGED :
-        return ("job-config-changed");
+       return ("job-config-changed");
 
     case CUPSD_EVENT_JOB_PROGRESS :
-        return ("job-progress");
+       return ("job-progress");
 
     case CUPSD_EVENT_JOB_STATE :
     case CUPSD_EVENT_JOB_STATE_CHANGED :
-        return ("job-state-changed");
+       return ("job-state-changed");
 
     case CUPSD_EVENT_SERVER_RESTARTED :
-        return ("server-restarted");
+       return ("server-restarted");
 
     case CUPSD_EVENT_SERVER_STARTED :
-        return ("server-started");
+       return ("server-started");
 
     case CUPSD_EVENT_SERVER_STOPPED :
-        return ("server-stopped");
+       return ("server-stopped");
 
     case CUPSD_EVENT_SERVER_AUDIT :
-        return ("server-audit");
+       return ("server-audit");
 
     case CUPSD_EVENT_ALL :
-        return ("all");
+       return ("all");
   }
 }
 
@@ -666,25 +608,30 @@ cupsdEventValue(const char *name) /* I - Name of event */
 void
 cupsdExpireSubscriptions(
     cupsd_printer_t *dest,             /* I - Printer, if any */
-    cupsd_job_t     *job)              /* I - Job, if any */
+    cupsd_job_t            *job)               /* I - Job, if any */
 {
   cupsd_subscription_t *sub;           /* Current subscription */
   int                  update;         /* Update subscriptions.conf? */
   time_t               curtime;        /* Current time */
 
 
+  if (cupsArrayCount(Subscriptions) == 0)
+    return;
+
   curtime = time(NULL);
   update  = 0;
 
+  cupsdLogMessage(CUPSD_LOG_INFO, "Expiring subscriptions...");
+
   for (sub = (cupsd_subscription_t *)cupsArrayFirst(Subscriptions);
        sub;
        sub = (cupsd_subscription_t *)cupsArrayNext(Subscriptions))
     if ((!sub->job && !dest && sub->expire && sub->expire <= curtime) ||
-        (dest && sub->dest == dest) ||
+       (dest && sub->dest == dest) ||
        (job && sub->job == job))
     {
       cupsdLogMessage(CUPSD_LOG_INFO, "Subscription %d has expired...",
-                      sub->id);
+                     sub->id);
 
       cupsdDeleteSubscription(sub, 0);
 
@@ -735,26 +682,20 @@ cupsdLoadAllSubscriptions(void)
   */
 
   snprintf(line, sizeof(line), "%s/subscriptions.conf", ServerRoot);
-  if ((fp = cupsFileOpen(line, "r")) == NULL)
-  {
-    if (errno != ENOENT)
-      cupsdLogMessage(CUPSD_LOG_ERROR,
-                     "LoadAllSubscriptions: Unable to open %s - %s", line,
-                     strerror(errno));
+  if ((fp = cupsdOpenConfFile(line)) == NULL)
     return;
-  }
 
  /*
   * Read all of the lines from the file...
   */
 
   linenum    = 0;
-  sub        = NULL;
+  sub       = NULL;
   delete_sub = 0;
 
   while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum))
   {
-    if (!strcasecmp(line, "NextSubscriptionId") && value)
+    if (!_cups_strcasecmp(line, "NextSubscriptionId") && value)
     {
      /*
       * NextSubscriptionId NNN
@@ -762,9 +703,9 @@ cupsdLoadAllSubscriptions(void)
 
       i = atoi(value);
       if (i >= NextSubscriptionId && i > 0)
-        NextSubscriptionId = i;
+       NextSubscriptionId = i;
     }
-    else if (!strcasecmp(line, "<Subscription"))
+    else if (!_cups_strcasecmp(line, "<Subscription"))
     {
      /*
       * <Subscription #>
@@ -772,40 +713,40 @@ cupsdLoadAllSubscriptions(void)
 
       if (!sub && value && isdigit(value[0] & 255))
       {
-        sub = cupsdAddSubscription(CUPSD_EVENT_NONE, NULL, NULL, NULL,
-                                  atoi(value));
+       sub = cupsdAddSubscription(CUPSD_EVENT_NONE, NULL, NULL, NULL,
+                                  atoi(value));
       }
       else
       {
-        cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Syntax error on line %d of subscriptions.conf.",
-                       linenum);
-        break;
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
+       break;
       }
     }
-    else if (!strcasecmp(line, "</Subscription>"))
+    else if (!_cups_strcasecmp(line, "</Subscription>"))
     {
       if (!sub)
       {
-        cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Syntax error on line %d of subscriptions.conf.",
-                       linenum);
-        break;
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
+       break;
       }
 
       if (delete_sub)
-        cupsdDeleteSubscription(sub, 0);
+       cupsdDeleteSubscription(sub, 0);
 
-      sub        = NULL;
+      sub       = NULL;
       delete_sub = 0;
     }
     else if (!sub)
     {
       cupsdLogMessage(CUPSD_LOG_ERROR,
-                      "Syntax error on line %d of subscriptions.conf.",
-                     linenum);
+                     "Syntax error on line %d of subscriptions.conf.",
+                     linenum);
     }
-    else if (!strcasecmp(line, "Events"))
+    else if (!_cups_strcasecmp(line, "Events"))
     {
      /*
       * Events name
@@ -815,38 +756,38 @@ cupsdLoadAllSubscriptions(void)
       if (!value)
       {
        cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Syntax error on line %d of subscriptions.conf.",
-                       linenum);
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        break;
       }
 
       while (*value)
       {
        /*
-        * Separate event names...
+       * Separate event names...
        */
 
-        for (valueptr = value; !isspace(*valueptr) && *valueptr; valueptr ++);
+       for (valueptr = value; !isspace(*valueptr) && *valueptr; valueptr ++);
 
        while (isspace(*valueptr & 255))
          *valueptr++ = '\0';
 
        /*
-        * See if the name exists...
+       * See if the name exists...
        */
 
-        if ((sub->mask |= cupsdEventValue(value)) == CUPSD_EVENT_NONE)
+       if ((sub->mask |= cupsdEventValue(value)) == CUPSD_EVENT_NONE)
        {
          cupsdLogMessage(CUPSD_LOG_ERROR,
-                         "Unknown event name \'%s\' on line %d of subscriptions.conf.",
-                         value, linenum);
+                         "Unknown event name \'%s\' on line %d of subscriptions.conf.",
+                         value, linenum);
          break;
        }
 
        value = valueptr;
       }
     }
-    else if (!strcasecmp(line, "Owner"))
+    else if (!_cups_strcasecmp(line, "Owner"))
     {
      /*
       * Owner
@@ -857,12 +798,12 @@ cupsdLoadAllSubscriptions(void)
       else
       {
        cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Syntax error on line %d of subscriptions.conf.",
-                       linenum);
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        break;
       }
     }
-    else if (!strcasecmp(line, "Recipient"))
+    else if (!_cups_strcasecmp(line, "Recipient"))
     {
      /*
       * Recipient uri
@@ -873,12 +814,12 @@ cupsdLoadAllSubscriptions(void)
       else
       {
        cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Syntax error on line %d of subscriptions.conf.",
-                       linenum);
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        break;
       }
     }
-    else if (!strcasecmp(line, "JobId"))
+    else if (!_cups_strcasecmp(line, "JobId"))
     {
      /*
       * JobId #
@@ -886,23 +827,23 @@ cupsdLoadAllSubscriptions(void)
 
       if (value && isdigit(*value & 255))
       {
-        if ((sub->job = cupsdFindJob(atoi(value))) == NULL)
+       if ((sub->job = cupsdFindJob(atoi(value))) == NULL)
        {
          cupsdLogMessage(CUPSD_LOG_ERROR,
-                         "Job %s not found on line %d of subscriptions.conf.",
-                         value, linenum);
+                         "Job %s not found on line %d of subscriptions.conf.",
+                         value, linenum);
          delete_sub = 1;
        }
       }
       else
       {
        cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Syntax error on line %d of subscriptions.conf.",
-                       linenum);
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        break;
       }
     }
-    else if (!strcasecmp(line, "PrinterName"))
+    else if (!_cups_strcasecmp(line, "PrinterName"))
     {
      /*
       * PrinterName name
@@ -910,23 +851,23 @@ cupsdLoadAllSubscriptions(void)
 
       if (value)
       {
-        if ((sub->dest = cupsdFindDest(value)) == NULL)
+       if ((sub->dest = cupsdFindDest(value)) == NULL)
        {
          cupsdLogMessage(CUPSD_LOG_ERROR,
-                         "Printer \'%s\' not found on line %d of subscriptions.conf.",
-                         value, linenum);
+                         "Printer \'%s\' not found on line %d of subscriptions.conf.",
+                         value, linenum);
          delete_sub = 1;
        }
       }
       else
       {
        cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Syntax error on line %d of subscriptions.conf.",
-                       linenum);
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        break;
       }
     }
-    else if (!strcasecmp(line, "UserData"))
+    else if (!_cups_strcasecmp(line, "UserData"))
     {
      /*
       * UserData encoded-string
@@ -934,7 +875,7 @@ cupsdLoadAllSubscriptions(void)
 
       if (value)
       {
-        for (i = 0, valueptr = value, hex = 0; i < 63 && *valueptr; i ++)
+       for (i = 0, valueptr = value, hex = 0; i < 63 && *valueptr; i ++)
        {
          if (*valueptr == '<' && !hex)
          {
@@ -947,20 +888,20 @@ cupsdLoadAllSubscriptions(void)
            if (isxdigit(valueptr[0]) && isxdigit(valueptr[1]))
            {
              if (isdigit(valueptr[0]))
-               sub->user_data[i] = (valueptr[0] - '0') << 4;
+               sub->user_data[i] = (unsigned char)((valueptr[0] - '0') << 4);
              else
-               sub->user_data[i] = (tolower(valueptr[0]) - 'a' + 10) << 4;
+               sub->user_data[i] = (unsigned char)((tolower(valueptr[0]) - 'a' + 10) << 4);
 
              if (isdigit(valueptr[1]))
-               sub->user_data[i] |= valueptr[1] - '0';
+               sub->user_data[i] |= valueptr[1] - '0';
              else
-               sub->user_data[i] |= tolower(valueptr[1]) - 'a' + 10;
+               sub->user_data[i] |= tolower(valueptr[1]) - 'a' + 10;
 
-              valueptr += 2;
+             valueptr += 2;
 
              if (*valueptr == '>')
              {
-               hex = 0;
+               hex = 0;
                valueptr ++;
              }
            }
@@ -968,14 +909,14 @@ cupsdLoadAllSubscriptions(void)
              break;
          }
          else
-           sub->user_data[i] = *valueptr++;
+           sub->user_data[i] = (unsigned char)*valueptr++;
        }
 
        if (*valueptr)
        {
          cupsdLogMessage(CUPSD_LOG_ERROR,
-                         "Bad UserData \'%s\' on line %d of subscriptions.conf.",
-                         value, linenum);
+                         "Bad UserData \'%s\' on line %d of subscriptions.conf.",
+                         value, linenum);
        }
        else
          sub->user_data_len = i;
@@ -983,12 +924,12 @@ cupsdLoadAllSubscriptions(void)
       else
       {
        cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Syntax error on line %d of subscriptions.conf.",
-                       linenum);
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        break;
       }
     }
-    else if (!strcasecmp(line, "LeaseDuration"))
+    else if (!_cups_strcasecmp(line, "LeaseDuration"))
     {
      /*
       * LeaseDuration #
@@ -996,62 +937,62 @@ cupsdLoadAllSubscriptions(void)
 
       if (value && isdigit(*value & 255))
       {
-        sub->lease  = atoi(value);
-        sub->expire = sub->lease ? time(NULL) + sub->lease : 0;
+       sub->lease  = atoi(value);
+       sub->expire = sub->lease ? time(NULL) + sub->lease : 0;
       }
       else
       {
        cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Syntax error on line %d of subscriptions.conf.",
-                       linenum);
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        break;
       }
     }
-    else if (!strcasecmp(line, "Interval"))
+    else if (!_cups_strcasecmp(line, "Interval"))
     {
      /*
       * Interval #
       */
 
       if (value && isdigit(*value & 255))
-        sub->interval = atoi(value);
+       sub->interval = atoi(value);
       else
       {
        cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Syntax error on line %d of subscriptions.conf.",
-                       linenum);
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        break;
       }
     }
-    else if (!strcasecmp(line, "ExpirationTime"))
+    else if (!_cups_strcasecmp(line, "ExpirationTime"))
     {
      /*
       * ExpirationTime #
       */
 
       if (value && isdigit(*value & 255))
-        sub->expire = atoi(value);
+       sub->expire = atoi(value);
       else
       {
        cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Syntax error on line %d of subscriptions.conf.",
-                       linenum);
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        break;
       }
     }
-    else if (!strcasecmp(line, "NextEventId"))
+    else if (!_cups_strcasecmp(line, "NextEventId"))
     {
      /*
       * NextEventId #
       */
 
       if (value && isdigit(*value & 255))
-        sub->next_event_id = sub->first_event_id = atoi(value);
+       sub->next_event_id = sub->first_event_id = atoi(value);
       else
       {
        cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Syntax error on line %d of subscriptions.conf.",
-                       linenum);
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        break;
       }
     }
@@ -1062,8 +1003,8 @@ cupsdLoadAllSubscriptions(void)
       */
 
       cupsdLogMessage(CUPSD_LOG_ERROR,
-                      "Unknown configuration directive %s on line %d of subscriptions.conf.",
-                     line, linenum);
+                     "Unknown configuration directive %s on line %d of subscriptions.conf.",
+                     line, linenum);
     }
   }
 
@@ -1080,11 +1021,8 @@ cupsdSaveAllSubscriptions(void)
 {
   int                  i;              /* Looping var */
   cups_file_t          *fp;            /* subscriptions.conf file */
-  char                 temp[1024];     /* Temporary string */
-  char                 backup[1024];   /* subscriptions.conf.O file */
+  char                 filename[1024]; /* subscriptions.conf filename */
   cupsd_subscription_t *sub;           /* Current subscription */
-  time_t               curtime;        /* Current time */
-  struct tm            *curdate;       /* Current date */
   unsigned             mask;           /* Current event mask */
   const char           *name;          /* Current event name */
   int                  hex;            /* Non-zero if we are writing hex data */
@@ -1094,47 +1032,19 @@ cupsdSaveAllSubscriptions(void)
   * Create the subscriptions.conf file...
   */
 
-  snprintf(temp, sizeof(temp), "%s/subscriptions.conf", ServerRoot);
-  snprintf(backup, sizeof(backup), "%s/subscriptions.conf.O", ServerRoot);
-
-  if (rename(temp, backup))
-  {
-    if (errno != ENOENT)
-      cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to backup subscriptions.conf - %s",
-                      strerror(errno));
-  }
-
-  if ((fp = cupsFileOpen(temp, "w")) == NULL)
-  {
-    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to save subscriptions.conf - %s",
-                    strerror(errno));
+  snprintf(filename, sizeof(filename), "%s/subscriptions.conf", ServerRoot);
 
-    if (rename(backup, temp))
-      cupsdLogMessage(CUPSD_LOG_ERROR,
-                      "Unable to restore subscriptions.conf - %s",
-                      strerror(errno));
+  if ((fp = cupsdCreateConfFile(filename, ConfigFilePerm)) == NULL)
     return;
-  }
-  else
-    cupsdLogMessage(CUPSD_LOG_INFO, "Saving subscriptions.conf...");
 
- /*
-  * Restrict access to the file...
-  */
-
-  fchown(cupsFileNumber(fp), getuid(), Group);
-  fchmod(cupsFileNumber(fp), ConfigFilePerm);
+  cupsdLogMessage(CUPSD_LOG_INFO, "Saving subscriptions.conf...");
 
  /*
   * Write a small header to the file...
   */
 
-  curtime = time(NULL);
-  curdate = localtime(&curtime);
-  strftime(temp, sizeof(temp) - 1, "%Y-%m-%d %H:%M", curdate);
-
   cupsFilePuts(fp, "# Subscription configuration file for " CUPS_SVERSION "\n");
-  cupsFilePrintf(fp, "# Written by cupsd on %s\n", temp);
+  cupsFilePrintf(fp, "# Written by cupsd\n");
 
   cupsFilePrintf(fp, "NextSubscriptionId %d\n", NextSubscriptionId);
 
@@ -1165,7 +1075,7 @@ cupsdSaveAllSubscriptions(void)
       cupsFilePuts(fp, "Events");
 
       for (mask = 1; mask < CUPSD_EVENT_ALL; mask <<= 1)
-        if (sub->mask & mask)
+       if (sub->mask & mask)
          cupsFilePrintf(fp, " %s", cupsdEventName((cupsd_eventmask_t)mask));
 
       cupsFilePuts(fp, "\n");
@@ -1186,7 +1096,7 @@ cupsdSaveAllSubscriptions(void)
 
       for (i = 0, hex = 0; i < sub->user_data_len; i ++)
       {
-        if (sub->user_data[i] < ' ' ||
+       if (sub->user_data[i] < ' ' ||
            sub->user_data[i] > 0x7f ||
            sub->user_data[i] == '<')
        {
@@ -1211,9 +1121,9 @@ cupsdSaveAllSubscriptions(void)
       }
 
       if (hex)
-        cupsFilePuts(fp, ">\n");
+       cupsFilePuts(fp, ">\n");
       else
-        cupsFilePutChar(fp, '\n');
+       cupsFilePutChar(fp, '\n');
     }
 
     cupsFilePrintf(fp, "LeaseDuration %d\n", sub->lease);
@@ -1224,7 +1134,7 @@ cupsdSaveAllSubscriptions(void)
     cupsFilePuts(fp, "</Subscription>\n");
   }
 
-  cupsFileClose(fp);
+  cupsdCloseCreatedConfFile(fp, filename);
 }
 
 
@@ -1288,7 +1198,7 @@ static int                                /* O - Result of comparison */
 cupsd_compare_subscriptions(
     cupsd_subscription_t *first,       /* I - First subscription object */
     cupsd_subscription_t *second,      /* I - Second subscription object */
-    void                 *unused)      /* I - Unused user data pointer */
+    void                *unused)       /* I - Unused user data pointer */
 {
   (void)unused;
 
@@ -1322,14 +1232,14 @@ cupsd_delete_event(cupsd_event_t *event)/* I - Event to delete */
 
 static void
 cupsd_send_dbus(cupsd_eventmask_t event,/* I - Event to send */
-                cupsd_printer_t   *dest,/* I - Destination, if any */
-                cupsd_job_t       *job)        /* I - Job, if any */
+               cupsd_printer_t   *dest,/* I - Destination, if any */
+               cupsd_job_t       *job) /* I - Job, if any */
 {
   DBusError            error;          /* Error, if any */
   DBusMessage          *message;       /* Message to send */
   DBusMessageIter      iter;           /* Iterator for message data */
   const char           *what;          /* What to send */
-  static DBusConnection        *con = NULL;    /* Connection to DBUS server */
+  static DBusConnection *con = NULL;   /* Connection to DBUS server */
 
 
  /*
@@ -1345,7 +1255,7 @@ cupsd_send_dbus(cupsd_eventmask_t event,/* I - Event to send */
   else if (event & CUPSD_EVENT_JOB_CREATED)
     what = "JobQueuedLocal";
   else if ((event & CUPSD_EVENT_JOB_STATE) && job &&
-           job->state_value == IPP_JOB_PROCESSING)
+          job->state_value == IPP_JOB_PROCESSING)
     what = "JobStartedLocal";
   else
     return;
@@ -1402,14 +1312,14 @@ cupsd_send_dbus(cupsd_eventmask_t event,/* I - Event to send */
 static void
 cupsd_send_notification(
     cupsd_subscription_t *sub,         /* I - Subscription object */
-    cupsd_event_t        *event)       /* I - Event to send */
+    cupsd_event_t       *event)        /* I - Event to send */
 {
   ipp_state_t  state;                  /* IPP event state */
 
 
   cupsdLogMessage(CUPSD_LOG_DEBUG2,
-                  "cupsd_send_notification(sub=%p(%d), event=%p(%s))",
-                  sub, sub->id, event, cupsdEventName(event->event));
+                 "cupsd_send_notification(sub=%p(%d), event=%p(%s))",
+                 sub, sub->id, event, cupsdEventName(event->event));
 
  /*
   * Allocate the events array as needed...
@@ -1418,15 +1328,15 @@ cupsd_send_notification(
   if (!sub->events)
   {
     sub->events = cupsArrayNew3((cups_array_func_t)NULL, NULL,
-                                (cups_ahash_func_t)NULL, 0,
+                               (cups_ahash_func_t)NULL, 0,
                                (cups_acopy_func_t)NULL,
                                (cups_afree_func_t)cupsd_delete_event);
 
     if (!sub->events)
     {
       cupsdLogMessage(CUPSD_LOG_CRIT,
-                      "Unable to allocate memory for subscription #%d!",
-                      sub->id);
+                     "Unable to allocate memory for subscription #%d!",
+                     sub->id);
       return;
     }
   }
@@ -1447,7 +1357,7 @@ cupsd_send_notification(
   }
 
  /*
-  * Add the event to the subscription.  Since the events array is
+  * Add the event to the subscription. Since the events array is
   * always MaxEvents in length, and since we will have already
   * removed an event from the subscription cache if we hit the
   * event cache limit, we don't need to check for overflow here...
@@ -1474,30 +1384,30 @@ cupsd_send_notification(
       event->attrs->state = IPP_IDLE;
 
       while ((state = ippWriteFile(sub->pipe, event->attrs)) != IPP_DATA)
-        if (state == IPP_ERROR)
+       if (state == IPP_ERROR)
          break;
 
       if (state == IPP_ERROR)
       {
-        if (errno == EPIPE)
+       if (errno == EPIPE)
        {
         /*
          * Notifier died, try restarting it...
          */
 
-          cupsdLogMessage(CUPSD_LOG_WARN,
-                         "Notifier for subscription %d (%s) went away, "
+         cupsdLogMessage(CUPSD_LOG_WARN,
+                         "Notifier for subscription %d (%s) went away, "
                          "retrying!",
                          sub->id, sub->recipient);
          cupsdEndProcess(sub->pid, 0);
 
          close(sub->pipe);
          sub->pipe = -1;
-          continue;
+         continue;
        }
 
-        cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Unable to send event for subscription %d (%s)!",
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Unable to send event for subscription %d (%s)!",
                        sub->id, sub->recipient);
       }
 
@@ -1551,7 +1461,7 @@ cupsd_start_notifier(
   */
 
   httpEncode64_2(user_data, sizeof(user_data), (char *)sub->user_data,
-                 sub->user_data_len);
+                sub->user_data_len);
 
  /*
   * Setup the argument array...
@@ -1581,7 +1491,7 @@ cupsd_start_notifier(
     if (cupsdOpenPipe(NotifierPipes))
     {
       cupsdLogMessage(CUPSD_LOG_ERROR,
-                      "Unable to create pipes for notifier status - %s",
+                     "Unable to create pipes for notifier status - %s",
                      strerror(errno));
       return;
     }
@@ -1589,13 +1499,13 @@ cupsd_start_notifier(
     NotifierStatusBuffer = cupsdStatBufNew(NotifierPipes[0], "[Notifier]");
 
     cupsdAddSelect(NotifierPipes[0], (cupsd_selfunc_t)cupsd_update_notifier,
-                   NULL, NULL);
+                  NULL, NULL);
   }
 
   if (cupsdOpenPipe(fds))
   {
     cupsdLogMessage(CUPSD_LOG_ERROR,
-                    "Unable to create pipes for notifier %s - %s",
+                   "Unable to create pipes for notifier %s - %s",
                    scheme, strerror(errno));
     return;
   }
@@ -1618,7 +1528,7 @@ cupsd_start_notifier(
     */
 
     cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to fork for notifier %s - %s",
-                    scheme, strerror(errno));
+                   scheme, strerror(errno));
 
     cupsdClosePipe(fds);
   }
@@ -1629,10 +1539,10 @@ cupsd_start_notifier(
     */
 
     cupsdLogMessage(CUPSD_LOG_DEBUG, "Notifier %s started - PID = %d",
-                    scheme, pid);
+                   scheme, pid);
 
-    sub->pid    = pid;
-    sub->pipe   = fds[1];
+    sub->pid   = pid;
+    sub->pipe  = fds[1];
     sub->status = 0;
 
     close(fds[0]);
@@ -1652,7 +1562,7 @@ cupsd_update_notifier(void)
 
 
   while (cupsdStatBufUpdate(NotifierStatusBuffer, &loglevel,
-                            message, sizeof(message)))
+                           message, sizeof(message)))
   {
     if (loglevel == CUPSD_LOG_INFO)
       cupsdLogMessage(CUPSD_LOG_INFO, "%s", message);
@@ -1661,8 +1571,3 @@ cupsd_update_notifier(void)
       break;
   }
 }
-
-
-/*
- * End of "$Id: subscriptions.c 7824 2008-08-01 21:11:55Z mike $".
- */