]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Cleanup.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 28 Sep 2005 21:12:44 +0000 (21:12 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 28 Sep 2005 21:12:44 +0000 (21:12 +0000)
cups/language.h:
    - Move new 1.2 functions so they are declared separately with a
      corresponding documentation string.

scheduler/*:
    - Cleanup function/structure renaming and code formatting/documentation.

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

39 files changed:
cups/language.h
scheduler/auth.c
scheduler/auth.h
scheduler/banners.c
scheduler/banners.h
scheduler/cert.c
scheduler/cert.h
scheduler/classes.c
scheduler/classes.h
scheduler/client.c
scheduler/client.h
scheduler/conf.c
scheduler/conf.h
scheduler/cupsd.h
scheduler/dirsvc.c
scheduler/dirsvc.h
scheduler/env.c
scheduler/ipp.c
scheduler/job.c
scheduler/job.h
scheduler/listen.c
scheduler/log.c
scheduler/main.c
scheduler/network.c
scheduler/network.h
scheduler/notify.h
scheduler/policy.c
scheduler/policy.h
scheduler/ppds.c [deleted file]
scheduler/printers.c
scheduler/printers.h
scheduler/process.c
scheduler/quotas.c
scheduler/server.c
scheduler/statbuf.c
scheduler/subscriptions.c
scheduler/subscriptions.h
scheduler/testmime.c
scheduler/util.c

index fc08e05c170e4fcab1adae5d82daa0bf14e997af..2ca10a13e42b82f150c60fd35977711287130c3c 100644 (file)
@@ -273,21 +273,23 @@ typedef struct cups_lang_str      /**** Language Cache Structure ****/
  */
 
 #  define              cupsLangDefault() cupsLangGet(NULL)
-extern const char      *cupsEncodingName(cups_encoding_t encoding);
 extern const char      *cupsLangEncoding(cups_lang_t *lang);
 extern void            cupsLangFlush(void);
 extern void            cupsLangFree(cups_lang_t *lang);
 extern cups_lang_t     *cupsLangGet(const char *language);
-extern int             cupsLangPrintf(FILE *fp, cups_lang_t *lang,
-                                      cups_msg_t msg, ...);
-extern int             cupsLangPuts(FILE *fp, cups_lang_t *lang,
-                                    cups_msg_t msg);
 #  define              cupsLangString(lang,msg) (lang)->messages[(msg)]
 
 /**** New in CUPS 1.1.20 ****/
 extern void            _cupsRestoreLocale(int category, char *oldlocale);
 extern char            *_cupsSaveLocale(int category, const char *locale);
 
+/**** New in CUPS 1.2 ****/
+extern const char      *cupsEncodingName(cups_encoding_t encoding);
+extern int             cupsLangPrintf(FILE *fp, cups_lang_t *lang,
+                                      cups_msg_t msg, ...);
+extern int             cupsLangPuts(FILE *fp, cups_lang_t *lang,
+                                    cups_msg_t msg);
+
 #  ifdef __cplusplus
 }
 #  endif /* __cplusplus */
index a83b4a93739299b0fe2f07d9d21f7fb2ed869b9c..e576b3f00e808732a8825ab1e849975871646338 100644 (file)
  *
  * Contents:
  *
- *   cupsdAddLocation()         - Add a location for authorization.
- *   cupsdAddName()             - Add a name to a location...
- *   cupsdAllowHost()           - Add a host name that is allowed to access the
- *                           location.
- *   cupsdAllowIP()             - Add an IP address or network that is allowed to
- *                           access the location.
- *   cupsdCheckAuth()           - Check authorization masks.
- *   cupsdCheckGroup()     - Check for a user's group membership.
- *   cupsdCopyLocation()        - Make a copy of a location...
- *   cupsdDeleteAllLocations()  - Free all memory used for location authorization.
- *   cupsdDeleteLocation() - Free all memory used by a location.
- *   cupsdDenyHost()            - Add a host name that is not allowed to access the
- *                           location.
- *   cupsdDenyIP()              - Add an IP address or network that is not allowed
- *                           to access the location.
- *   cupsdFindBest()            - Find the location entry that best matches the
- *                           resource.
- *   cupsdFindLocation()        - Find the named location.
- *   cupsdGetMD5Passwd()        - Get an MD5 password.
- *   cupsdIsAuthorized()   - Check to see if the user is authorized...
- *   add_allow()           - Add an allow mask to the location.
- *   add_deny()            - Add a deny mask to the location.
- *   cups_crypt()          - Encrypt the password using the DES or MD5
- *                           algorithms, as needed.
- *   pam_func()            - PAM conversation function.
- *   to64()                - Base64-encode an integer value...
+ *   cupsdAddLocation()        - Add a location for authorization.
+ *   cupsdAddName()            - Add a name to a location...
+ *   cupsdAllowHost()          - Add a host name that is allowed to access the
+ *                               location.
+ *   cupsdAllowIP()            - Add an IP address or network that is allowed to
+ *                               access the location.
+ *   cupsdCheckAuth()          - Check authorization masks.
+ *   cupsdCheckGroup()         - Check for a user's group membership.
+ *   cupsdCopyLocation()       - Make a copy of a location...
+ *   cupsdDeleteAllLocations() - Free all memory used for location authorization.
+ *   cupsdDeleteLocation()     - Free all memory used by a location.
+ *   cupsdDenyHost()           - Add a host name that is not allowed to access the
+ *                               location.
+ *   cupsdDenyIP()             - Add an IP address or network that is not allowed
+ *                               to access the location.
+ *   cupsdFindBest()           - Find the location entry that best matches the
+ *                               resource.
+ *   cupsdFindLocation()       - Find the named location.
+ *   cupsdGetMD5Passwd()       - Get an MD5 password.
+ *   cupsdIsAuthorized()       - Check to see if the user is authorized...
+ *   add_allow()               - Add an allow mask to the location.
+ *   add_deny()                - Add a deny mask to the location.
+ *   cups_crypt()              - Encrypt the password using the DES or MD5
+ *                               algorithms, as needed.
+ *   pam_func()                - PAM conversation function.
+ *   to64()                    - Base64-encode an integer value...
  */
 
 /*
@@ -97,7 +97,7 @@ static void           to64(char *s, unsigned long v, int n);
  */
 
 #if defined(__hpux) && defined(HAVE_LIBPAM)
-static cupsd_client_t          *auth_client;   /* Current client being authenticated */
+static cupsd_client_t  *auth_client;   /* Current client being authenticated */
 #endif /* __hpux && HAVE_LIBPAM */
 
 
@@ -105,10 +105,10 @@ static cupsd_client_t             *auth_client;   /* Current client being authenticated */
  * 'cupsdAddLocation()' - Add a location for authorization.
  */
 
-cupsd_location_t *                             /* O - Pointer to new location record */
+cupsd_location_t *                     /* O - Pointer to new location record */
 cupsdAddLocation(const char *location) /* I - Location path */
 {
-  cupsd_location_t     *temp;                  /* New location */
+  cupsd_location_t     *temp;          /* New location */
 
 
  /*
@@ -135,7 +135,8 @@ cupsdAddLocation(const char *location)      /* I - Location path */
   strlcpy(temp->location, location, sizeof(temp->location));
   temp->length = strlen(temp->location);
 
-  cupsdLogMessage(L_DEBUG, "cupsdAddLocation: added location \'%s\'", location);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdAddLocation: added location \'%s\'",
+                  location);
 
  /*
   * Return the new record...
@@ -151,12 +152,13 @@ cupsdAddLocation(const char *location)    /* I - Location path */
 
 void
 cupsdAddName(cupsd_location_t *loc,    /* I - Location to add to */
-        char       *name)      /* I - Name to add */
+             char             *name)   /* I - Name to add */
 {
-  char **temp;                 /* Pointer to names array */
+  char **temp;                         /* Pointer to names array */
 
 
-  cupsdLogMessage(L_DEBUG2, "cupsdAddName(loc=%p, name=\"%s\")", loc, name);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddName(loc=%p, name=\"%s\")",
+                  loc, name);
 
   if (loc->num_names == 0)
     temp = malloc(sizeof(char *));
@@ -165,8 +167,8 @@ cupsdAddName(cupsd_location_t *loc, /* I - Location to add to */
 
   if (temp == NULL)
   {
-    cupsdLogMessage(L_ERROR, "Unable to add name to location %s: %s", loc->location,
-               strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to add name to location %s: %s",
+                    loc->location, strerror(errno));
     return;
   }
 
@@ -174,8 +176,9 @@ cupsdAddName(cupsd_location_t *loc, /* I - Location to add to */
 
   if ((temp[loc->num_names] = strdup(name)) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "Unable to duplicate name for location %s: %s",
-               loc->location, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "Unable to duplicate name for location %s: %s",
+                    loc->location, strerror(errno));
     return;
   }
 
@@ -189,15 +192,15 @@ cupsdAddName(cupsd_location_t *loc,       /* I - Location to add to */
 
 void
 cupsdAllowHost(cupsd_location_t *loc,  /* I - Location to add to */
-          char       *name)    /* I - Name of host or domain to add */
+               char             *name) /* I - Name of host or domain to add */
 {
   cupsd_authmask_t     *temp;          /* New host/domain mask */
-  char         ifname[32],     /* Interface name */
-               *ifptr;         /* Pointer to end of name */
+  char                 ifname[32],     /* Interface name */
+                       *ifptr;         /* Pointer to end of name */
 
 
-  cupsdLogMessage(L_DEBUG2, "cupsdAllowHost(loc=%p(%s), name=\"%s\")", loc,
-             loc->location, name);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAllowHost(loc=%p(%s), name=\"%s\")",
+                  loc, loc->location, name);
 
   if ((temp = add_allow(loc)) == NULL)
     return;
@@ -246,22 +249,23 @@ cupsdAllowHost(cupsd_location_t *loc,     /* I - Location to add to */
 
 
 /*
- * 'cupsdAllowIP()' - Add an IP address or network that is allowed to access the
- *               location.
+ * 'cupsdAllowIP()' - Add an IP address or network that is allowed to access
+ *                    the location.
  */
 
 void
 cupsdAllowIP(cupsd_location_t *loc,    /* I - Location to add to */
-        unsigned   address[4], /* I - IP address to add */
-        unsigned   netmask[4]) /* I - Netmask of address */
+             unsigned   address[4],    /* I - IP address to add */
+             unsigned   netmask[4])    /* I - Netmask of address */
 {
   cupsd_authmask_t     *temp;          /* New host/domain mask */
 
 
-  cupsdLogMessage(L_DEBUG2, "cupsdAllowIP(loc=%p(%s), address=%x:%x:%x:%x, netmask=%x:%x:%x:%x)",
-            loc, loc->location, address[0], address[1], address[2],
-            address[3], netmask[0], netmask[1], netmask[2],
-            netmask[3]);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdAllowIP(loc=%p(%s), address=%x:%x:%x:%x, netmask=%x:%x:%x:%x)",
+                 loc, loc->location, address[0], address[1], address[2],
+                 address[3], netmask[0], netmask[1], netmask[2],
+                 netmask[3]);
 
   if ((temp = add_allow(loc)) == NULL)
     return;
@@ -276,18 +280,19 @@ cupsdAllowIP(cupsd_location_t *loc,       /* I - Location to add to */
  * 'cupsdCheckAuth()' - Check authorization masks.
  */
 
-int                            /* O - 1 if mask matches, 0 otherwise */
-cupsdCheckAuth(unsigned   ip[4],       /* I - Client address */
-          char       *name,    /* I - Client hostname */
-          int        name_len, /* I - Length of hostname */
-          int        num_masks, /* I - Number of masks */
-          cupsd_authmask_t *masks)     /* I - Masks */
+int                                    /* O - 1 if mask matches, 0 otherwise */
+cupsdCheckAuth(
+    unsigned         ip[4],            /* I - Client address */
+    char             *name,            /* I - Client hostname */
+    int              name_len,         /* I - Length of hostname */
+    int              num_masks,                /* I - Number of masks */
+    cupsd_authmask_t *masks)           /* I - Masks */
 {
-  int          i;              /* Looping var */
-  cupsd_netif_t        *iface;         /* Network interface */
-  unsigned     netip4;         /* IPv4 network address */
+  int          i;                      /* Looping var */
+  cupsd_netif_t        *iface;                 /* Network interface */
+  unsigned     netip4;                 /* IPv4 network address */
 #ifdef AF_INET6
-  unsigned     netip6[4];      /* IPv6 network address */
+  unsigned     netip6[4];              /* IPv6 network address */
 #endif /* AF_INET6 */
 
   while (num_masks > 0)
@@ -361,7 +366,7 @@ cupsdCheckAuth(unsigned   ip[4],    /* I - Client address */
            * Check the named interface...
            */
 
-            if ((iface = NetIFFind(masks->mask.name.name)) != NULL)
+            if ((iface = cupsdNetIFFind(masks->mask.name.name)) != NULL)
            {
               if (iface->address.addr.sa_family == AF_INET)
              {
@@ -400,7 +405,7 @@ cupsdCheckAuth(unsigned   ip[4],    /* I - Client address */
          * Check for exact name match...
          */
 
-          if (strcasecmp(name, masks->mask.name.name) == 0)
+          if (!strcasecmp(name, masks->mask.name.name))
            return (1);
 
          /*
@@ -420,7 +425,8 @@ cupsdCheckAuth(unsigned   ip[4],    /* I - Client address */
          */
 
           for (i = 0; i < 4; i ++)
-           if ((ip[i] & masks->mask.ip.netmask[i]) != masks->mask.ip.address[i])
+           if ((ip[i] & masks->mask.ip.netmask[i]) !=
+                   masks->mask.ip.address[i])
              break;
 
          if (i == 4)
@@ -451,8 +457,9 @@ cupsdCheckGroup(
   char                 junk[33];       /* MD5 password (not used) */
 
 
-  cupsdLogMessage(L_DEBUG2, "cupsdCheckGroup(username=\"%s\", user=%p, groupname=\"%s\")\n",
-             username, user, groupname);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdCheckGroup(username=\"%s\", user=%p, groupname=\"%s\")",
+                  username, user, groupname);
 
  /*
   * Validate input...
@@ -509,12 +516,14 @@ cupsdCheckGroup(
  */
 
 cupsd_location_t *                     /* O - New location */
-cupsdCopyLocation(cupsd_location_t **loc)      /* IO - Original location */
+cupsdCopyLocation(
+    cupsd_location_t **loc)            /* IO - Original location */
 {
-  int          i;              /* Looping var */
-  int          locindex;       /* Index into Locations array */
+  int                  i;              /* Looping var */
+  int                  locindex;       /* Index into Locations array */
   cupsd_location_t     *temp;          /* New location */
-  char         location[HTTP_MAX_URI]; /* Location of resource */
+  char                 location[HTTP_MAX_URI];
+                                       /* Location of resource */
 
 
  /*
@@ -555,8 +564,9 @@ cupsdCopyLocation(cupsd_location_t **loc)   /* IO - Original location */
 
     if ((temp->names = calloc(temp->num_names, sizeof(char *))) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "cupsdCopyLocation: Unable to allocate memory for %d names: %s",
-                 temp->num_names, strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cupsdCopyLocation: Unable to allocate memory for %d names: %s",
+                      temp->num_names, strerror(errno));
       NumLocations --;
       return (NULL);
     }
@@ -564,8 +574,9 @@ cupsdCopyLocation(cupsd_location_t **loc)   /* IO - Original location */
     for (i = 0; i < temp->num_names; i ++)
       if ((temp->names[i] = strdup((*loc)->names[i])) == NULL)
       {
-       cupsdLogMessage(L_ERROR, "cupsdCopyLocation: Unable to copy name \"%s\": %s",
-                   (*loc)->names[i], strerror(errno));
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdCopyLocation: Unable to copy name \"%s\": %s",
+                        (*loc)->names[i], strerror(errno));
 
        NumLocations --;
        return (NULL);
@@ -580,8 +591,9 @@ cupsdCopyLocation(cupsd_location_t **loc)   /* IO - Original location */
 
     if ((temp->allow = calloc(temp->num_allow, sizeof(cupsd_authmask_t))) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "cupsdCopyLocation: Unable to allocate memory for %d allow rules: %s",
-                 temp->num_allow, strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cupsdCopyLocation: Unable to allocate memory for %d allow rules: %s",
+                      temp->num_allow, strerror(errno));
       NumLocations --;
       return (NULL);
     }
@@ -595,8 +607,9 @@ cupsdCopyLocation(cupsd_location_t **loc)   /* IO - Original location */
 
             if (temp->allow[i].mask.name.name == NULL)
            {
-             cupsdLogMessage(L_ERROR, "cupsdCopyLocation: Unable to copy allow name \"%s\": %s",
-                        (*loc)->allow[i].mask.name.name, strerror(errno));
+             cupsdLogMessage(CUPSD_LOG_ERROR,
+                             "cupsdCopyLocation: Unable to copy allow name \"%s\": %s",
+                             (*loc)->allow[i].mask.name.name, strerror(errno));
              NumLocations --;
              return (NULL);
            }
@@ -616,8 +629,9 @@ cupsdCopyLocation(cupsd_location_t **loc)   /* IO - Original location */
 
     if ((temp->deny = calloc(temp->num_deny, sizeof(cupsd_authmask_t))) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "cupsdCopyLocation: Unable to allocate memory for %d deny rules: %s",
-                 temp->num_deny, strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cupsdCopyLocation: Unable to allocate memory for %d deny rules: %s",
+                      temp->num_deny, strerror(errno));
       NumLocations --;
       return (NULL);
     }
@@ -631,8 +645,9 @@ cupsdCopyLocation(cupsd_location_t **loc)   /* IO - Original location */
 
             if (temp->deny[i].mask.name.name == NULL)
            {
-             cupsdLogMessage(L_ERROR, "cupsdCopyLocation: Unable to copy deny name \"%s\": %s",
-                        (*loc)->deny[i].mask.name.name, strerror(errno));
+             cupsdLogMessage(CUPSD_LOG_ERROR,
+                             "cupsdCopyLocation: Unable to copy deny name \"%s\": %s",
+                             (*loc)->deny[i].mask.name.name, strerror(errno));
              NumLocations --;
              return (NULL);
            }
@@ -655,8 +670,8 @@ cupsdCopyLocation(cupsd_location_t **loc)   /* IO - Original location */
 void
 cupsdDeleteAllLocations(void)
 {
-  int          i;                      /* Looping var */
-  cupsd_location_t     *loc;                   /* Current location */
+  int                  i;              /* Looping var */
+  cupsd_location_t     *loc;           /* Current location */
 
 
  /*
@@ -683,10 +698,11 @@ cupsdDeleteAllLocations(void)
  */
 
 void
-cupsdDeleteLocation(cupsd_location_t *loc)     /* I - Location to delete */
+cupsdDeleteLocation(
+    cupsd_location_t *loc)             /* I - Location to delete */
 {
-  int          i;                      /* Looping var */
-  cupsd_authmask_t     *mask;                  /* Current mask */
+  int                  i;              /* Looping var */
+  cupsd_authmask_t     *mask;          /* Current mask */
 
 
   for (i = loc->num_names - 1; i >= 0; i --)
@@ -712,20 +728,21 @@ cupsdDeleteLocation(cupsd_location_t *loc)        /* I - Location to delete */
 
 
 /*
- * 'cupsdDenyHost()' - Add a host name that is not allowed to access the location.
+ * 'cupsdDenyHost()' - Add a host name that is not allowed to access the
+ *                     location.
  */
 
 void
 cupsdDenyHost(cupsd_location_t *loc,   /* I - Location to add to */
-         char       *name)     /* I - Name of host or domain to add */
+              char             *name)  /* I - Name of host or domain to add */
 {
   cupsd_authmask_t     *temp;          /* New host/domain mask */
-  char         ifname[32],     /* Interface name */
-               *ifptr;         /* Pointer to end of name */
+  char                 ifname[32],     /* Interface name */
+                       *ifptr;         /* Pointer to end of name */
 
 
-  cupsdLogMessage(L_DEBUG2, "cupsdDenyHost(loc=%p(%s), name=\"%s\")", loc,
-             loc->location, name);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdDenyHost(loc=%p(%s), name=\"%s\")",
+                  loc, loc->location, name);
 
   if ((temp = add_deny(loc)) == NULL)
     return;
@@ -774,22 +791,23 @@ cupsdDenyHost(cupsd_location_t *loc,      /* I - Location to add to */
 
 
 /*
- * 'cupsdDenyIP()' - Add an IP address or network that is not allowed to access
- *              the location.
+ * 'cupsdDenyIP()' - Add an IP address or network that is not allowed to
+ *                   access the location.
  */
 
 void
-cupsdDenyIP(cupsd_location_t *loc,             /* I - Location to add to */
-       unsigned   address[4],  /* I - IP address to add */
-       unsigned   netmask[4])  /* I - Netmask of address */
+cupsdDenyIP(cupsd_location_t *loc,     /* I - Location to add to */
+           unsigned         address[4],/* I - IP address to add */
+           unsigned         netmask[4])/* I - Netmask of address */
 {
   cupsd_authmask_t     *temp;          /* New host/domain mask */
 
 
-  cupsdLogMessage(L_DEBUG, "cupsdDenyIP(loc=%p(%s), address=%x:%x:%x:%x, netmask=%x:%x:%x:%x)",
-            loc, loc->location, address[0], address[1], address[2],
-            address[3], netmask[0], netmask[1], netmask[2],
-            netmask[3]);
+  cupsdLogMessage(CUPSD_LOG_DEBUG,
+                  "cupsdDenyIP(loc=%p(%s), address=%x:%x:%x:%x, netmask=%x:%x:%x:%x)",
+                 loc, loc->location, address[0], address[1], address[2],
+                 address[3], netmask[0], netmask[1], netmask[2],
+                 netmask[3]);
 
   if ((temp = add_deny(loc)) == NULL)
     return;
@@ -804,18 +822,19 @@ cupsdDenyIP(cupsd_location_t *loc,                /* I - Location to add to */
  * 'cupsdFindBest()' - Find the location entry that best matches the resource.
  */
 
-cupsd_location_t *                             /* O - Location that matches */
-cupsdFindBest(const char   *path,              /* I - Resource path */
-         http_state_t state)           /* I - HTTP state/request */
+cupsd_location_t *                     /* O - Location that matches */
+cupsdFindBest(const char   *path,      /* I - Resource path */
+              http_state_t state)      /* I - HTTP state/request */
 {
-  int          i;                      /* Looping var */
-  char         uri[HTTP_MAX_URI],      /* URI in request... */
-               *uriptr;                /* Pointer into URI */
-  cupsd_location_t     *loc,                   /* Current location */
-               *best;                  /* Best match for location so far */
-  int          bestlen;                /* Length of best match */
-  int          limit;                  /* Limit field */
-  static const int limits[] =          /* Map http_status_t to AUTH_LIMIT_xyz */
+  int                  i;              /* Looping var */
+  char                 uri[HTTP_MAX_URI],
+                                       /* URI in request... */
+                       *uriptr;        /* Pointer into URI */
+  cupsd_location_t     *loc,           /* Current location */
+                       *best;          /* Best match for location so far */
+  int                  bestlen;        /* Length of best match */
+  int                  limit;          /* Limit field */
+  static const int     limits[] =      /* Map http_status_t to AUTH_LIMIT_xyz */
                {
                  AUTH_LIMIT_ALL,
                  AUTH_LIMIT_OPTIONS,
@@ -855,7 +874,7 @@ cupsdFindBest(const char   *path,           /* I - Resource path */
       *uriptr = '\0';
   }
 
-  cupsdLogMessage(L_DEBUG2, "cupsdFindBest: uri = \"%s\"...", uri);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindBest: uri = \"%s\"...", uri);
 
  /*
   * Loop through the list of locations to find a match...
@@ -867,8 +886,8 @@ cupsdFindBest(const char   *path,           /* I - Resource path */
 
   for (i = NumLocations, loc = Locations; i > 0; i --, loc ++)
   {
-    cupsdLogMessage(L_DEBUG2, "cupsdFindBest: Location %s Limit %x",
-               loc->location, loc->limit);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindBest: Location %s Limit %x",
+                    loc->location, loc->limit);
 
     if (!strncmp(uri, "/printers/", 10) || !strncmp(uri, "/classes/", 9))
     {
@@ -906,7 +925,8 @@ cupsdFindBest(const char   *path,           /* I - Resource path */
   * Return the match, if any...
   */
 
-  cupsdLogMessage(L_DEBUG2, "cupsdFindBest: best = %s", best ? best->location : "NONE");
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindBest: best = %s",
+                  best ? best->location : "NONE");
 
   return (best);
 }
@@ -916,7 +936,7 @@ cupsdFindBest(const char   *path,           /* I - Resource path */
  * 'cupsdFindLocation()' - Find the named location.
  */
 
-cupsd_location_t *                             /* O - Location that matches */
+cupsd_location_t *                     /* O - Location that matches */
 cupsdFindLocation(const char *location)        /* I - Connection */
 {
   int          i;                      /* Looping var */
@@ -927,7 +947,7 @@ cupsdFindLocation(const char *location)     /* I - Connection */
   */
 
   for (i = 0; i < NumLocations; i ++)
-    if (strcasecmp(Locations[i].location, location) == 0)
+    if (!strcasecmp(Locations[i].location, location))
       return (Locations + i);
 
   return (NULL);
@@ -940,8 +960,8 @@ cupsdFindLocation(const char *location)     /* I - Connection */
 
 char *                                 /* O - MD5 password string */
 cupsdGetMD5Passwd(const char *username,        /* I - Username */
-             const char *group,                /* I - Group */
-             char       passwd[33])    /* O - MD5 password string */
+                  const char *group,   /* I - Group */
+                  char       passwd[33])/* O - MD5 password string */
 {
   cups_file_t  *fp;                    /* passwd.md5 file */
   char         filename[1024],         /* passwd.md5 filename */
@@ -950,13 +970,15 @@ cupsdGetMD5Passwd(const char *username,   /* I - Username */
                tempgroup[33];          /* Group from file */
 
 
-  cupsdLogMessage(L_DEBUG2, "cupsdGetMD5Passwd(username=\"%s\", group=\"%s\", passwd=%p)",
-             username, group ? group : "(null)", passwd);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdGetMD5Passwd(username=\"%s\", group=\"%s\", passwd=%p)",
+                  username, group ? group : "(null)", passwd);
 
   snprintf(filename, sizeof(filename), "%s/passwd.md5", ServerRoot);
   if ((fp = cupsFileOpen(filename, "r")) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "Unable to open %s - %s", filename, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open %s - %s", filename,
+                    strerror(errno));
     return (NULL);
   }
 
@@ -964,7 +986,7 @@ cupsdGetMD5Passwd(const char *username,     /* I - Username */
   {
     if (sscanf(line, "%32[^:]:%32[^:]:%32s", tempuser, tempgroup, passwd) != 3)
     {
-      cupsdLogMessage(L_ERROR, "Bad MD5 password line: %s", line);
+      cupsdLogMessage(CUPSD_LOG_ERROR, "Bad MD5 password line: %s", line);
       continue;
     }
 
@@ -975,8 +997,8 @@ cupsdGetMD5Passwd(const char *username,     /* I - Username */
       * Found the password entry!
       */
 
-      cupsdLogMessage(L_DEBUG2, "Found MD5 user %s, group %s...", username,
-                 tempgroup);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2, "Found MD5 user %s, group %s...",
+                      username, tempgroup);
 
       cupsFileClose(fp);
       return (passwd);
@@ -997,30 +1019,31 @@ cupsdGetMD5Passwd(const char *username,  /* I - Username */
  */
 
 http_status_t                          /* O - HTTP_OK if authorized or error code */
-cupsdIsAuthorized(cupsd_client_t   *con,       /* I - Connection */
-                  const char *owner)   /* I - Owner of object */
+cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */
+                  const char     *owner)/* I - Owner of object */
 {
-  int          i, j,                   /* Looping vars */
-               auth;                   /* Authorization status */
-  unsigned     address[4];             /* Authorization address */
-  cupsd_location_t     *best;                  /* Best match for location so far */
-  int          hostlen;                /* Length of hostname */
-  struct passwd        *pw;                    /* User password data */
-  char         nonce[HTTP_MAX_VALUE],  /* Nonce value from client */
-               md5[33],                /* MD5 password */
-               basicmd5[33];           /* MD5 of Basic password */
+  int                  i, j,           /* Looping vars */
+                       auth;           /* Authorization status */
+  unsigned             address[4];     /* Authorization address */
+  cupsd_location_t     *best;          /* Best match for location so far */
+  int                  hostlen;        /* Length of hostname */
+  struct passwd                *pw;            /* User password data */
+  char                 nonce[HTTP_MAX_VALUE],
+                                       /* Nonce value from client */
+                       md5[33],        /* MD5 password */
+                       basicmd5[33];   /* MD5 of Basic password */
 #if HAVE_LIBPAM
-  pam_handle_t *pamh;                  /* PAM authentication handle */
-  int          pamerr;                 /* PAM error code */
-  struct pam_conv pamdata;             /* PAM conversation data */
+  pam_handle_t         *pamh;          /* PAM authentication handle */
+  int                  pamerr;         /* PAM error code */
+  struct pam_conv      pamdata;        /* PAM conversation data */
 #elif defined(HAVE_USERSEC_H)
-  char         *authmsg;               /* Authentication message */
-  char         *loginmsg;              /* Login message */
-  int          reenter;                /* ??? */
+  char                 *authmsg;       /* Authentication message */
+  char                 *loginmsg;      /* Login message */
+  int                  reenter;        /* ??? */
 #else
-  char         *pass;                  /* Encrypted password */
+  char                 *pass;          /* Encrypted password */
 #  ifdef HAVE_SHADOW_H
-  struct spwd  *spw;                   /* Shadow password data */
+  struct spwd          *spw;           /* Shadow password data */
 #  endif /* HAVE_SHADOW_H */
 #endif /* HAVE_LIBPAM */
   static const char * const states[] = /* HTTP client states... */
@@ -1055,8 +1078,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
                };
 
 
-  cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: con->uri=\"%s\", con->best=%p(%s)",
-             con->uri, con->best, con->best ? con->best->location : "");
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdIsAuthorized: con->uri=\"%s\", con->best=%p(%s)",
+                  con->uri, con->best, con->best ? con->best->location : "");
 
  /*
   * If there is no "best" authentication rule for this request, then
@@ -1075,13 +1099,14 @@ cupsdIsAuthorized(cupsd_client_t   *con,        /* I - Connection */
 
   best = con->best;
 
-  cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: level=AUTH_%s, type=AUTH_%s, satisfy=AUTH_SATISFY_%s, num_names=%d",
-             levels[best->level], types[best->type],
-            best->satisfy ? "ANY" : "ALL", best->num_names);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdIsAuthorized: level=AUTH_%s, type=AUTH_%s, satisfy=AUTH_SATISFY_%s, num_names=%d",
+                  levels[best->level], types[best->type],
+                 best->satisfy ? "ANY" : "ALL", best->num_names);
 
   if (best->limit == AUTH_LIMIT_IPP)
-    cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: op=%x(%s)", best->op,
-               ippOpString(best->op));
+    cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: op=%x(%s)",
+                    best->op, ippOpString(best->op));
 
  /*
   * Check host/ip-based accesses...
@@ -1163,8 +1188,8 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
     }
   }
 
-  cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: auth=AUTH_%s...",
-             auth ? "DENY" : "ALLOW");
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: auth=AUTH_%s...",
+                  auth ? "DENY" : "ALLOW");
 
   if (auth == AUTH_DENY && best->satisfy == AUTH_SATISFY_ALL)
     return (HTTP_FORBIDDEN);
@@ -1176,7 +1201,8 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
 
   if (best->encryption >= HTTP_ENCRYPT_REQUIRED && !con->http.tls)
   {
-    cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: Need upgrade to TLS...");
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdIsAuthorized: Need upgrade to TLS...");
     return (HTTP_UPGRADE_REQUIRED);
   }
 #endif /* HAVE_SSL */
@@ -1201,14 +1227,16 @@ cupsdIsAuthorized(cupsd_client_t   *con,        /* I - Connection */
     attr = ippFindAttribute(con->request, "requesting-user-name", IPP_TAG_NAME);
     if (attr)
     {
-      cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: requesting-user-name=\"%s\"",
-                 attr->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdIsAuthorized: requesting-user-name=\"%s\"",
+                      attr->values[0].string.text);
       return (HTTP_OK);
     }
   }
 
-  cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: username=\"%s\" password=%d chars",
-            con->username, (int)strlen(con->password));
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdIsAuthorized: username=\"%s\" password=%d chars",
+                 con->username, (int)strlen(con->password));
   DEBUG_printf(("cupsdIsAuthorized: username=\"%s\", password=\"%s\"\n",
                con->username, con->password));
 
@@ -1224,9 +1252,10 @@ cupsdIsAuthorized(cupsd_client_t   *con, /* I - Connection */
   * Check the user's password...
   */
 
-  cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: Checking \"%s\", address = %x:%x:%x:%x, hostname = \"%s\"",
-            con->username, address[0], address[1], address[2],
-            address[3], con->http.hostname);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdIsAuthorized: Checking \"%s\", address = %x:%x:%x:%x, hostname = \"%s\"",
+                 con->username, address[0], address[1], address[2],
+                 address[3], con->http.hostname);
 
   pw = NULL;
 
@@ -1277,8 +1306,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
          pamerr = pam_start("cups", con->username, &pamdata, &pamh);
          if (pamerr != PAM_SUCCESS)
          {
-           cupsdLogMessage(L_ERROR, "cupsdIsAuthorized: pam_start() returned %d (%s)!\n",
-                      pamerr, pam_strerror(pamh, pamerr));
+           cupsdLogMessage(CUPSD_LOG_ERROR,
+                           "cupsdIsAuthorized: pam_start() returned %d (%s)!\n",
+                           pamerr, pam_strerror(pamh, pamerr));
            pam_end(pamh, 0);
            return (HTTP_UNAUTHORIZED);
          }
@@ -1286,8 +1316,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
          pamerr = pam_authenticate(pamh, PAM_SILENT);
          if (pamerr != PAM_SUCCESS)
          {
-           cupsdLogMessage(L_ERROR, "cupsdIsAuthorized: pam_authenticate() returned %d (%s)!\n",
-                      pamerr, pam_strerror(pamh, pamerr));
+           cupsdLogMessage(CUPSD_LOG_ERROR,
+                           "cupsdIsAuthorized: pam_authenticate() returned %d (%s)!\n",
+                           pamerr, pam_strerror(pamh, pamerr));
            pam_end(pamh, 0);
            return (HTTP_UNAUTHORIZED);
          }
@@ -1295,8 +1326,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
          pamerr = pam_acct_mgmt(pamh, PAM_SILENT);
          if (pamerr != PAM_SUCCESS)
          {
-           cupsdLogMessage(L_ERROR, "cupsdIsAuthorized: pam_acct_mgmt() returned %d (%s)!\n",
-                      pamerr, pam_strerror(pamh, pamerr));
+           cupsdLogMessage(CUPSD_LOG_ERROR,
+                           "cupsdIsAuthorized: pam_acct_mgmt() returned %d (%s)!\n",
+                           pamerr, pam_strerror(pamh, pamerr));
            pam_end(pamh, 0);
            return (HTTP_UNAUTHORIZED);
          }
@@ -1307,13 +1339,14 @@ cupsdIsAuthorized(cupsd_client_t   *con,        /* I - Connection */
          * Use AIX authentication interface...
          */
 
-         cupsdLogMessage(L_DEBUG, "cupsdIsAuthorized: AIX authenticate of username \"%s\"",
-                     con->username);
+         cupsdLogMessage(CUPSD_LOG_DEBUG,
+                         "cupsdIsAuthorized: AIX authenticate of username \"%s\"",
+                          con->username);
 
          reenter = 1;
          if (authenticate(con->username, con->password, &reenter, &authmsg) != 0)
          {
-           cupsdLogMessage(L_DEBUG, "cupsdIsAuthorized: Unable to authenticate username \"%s\": %s",
+           cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdIsAuthorized: Unable to authenticate username \"%s\": %s",
                       con->username, strerror(errno));
            return (HTTP_UNAUTHORIZED);
          }
@@ -1324,8 +1357,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
 
          if (pw == NULL)                       /* No such user... */
          {
-           cupsdLogMessage(L_WARN, "cupsdIsAuthorized: Unknown username \"%s\"; access denied.",
-                      con->username);
+           cupsdLogMessage(CUPSD_LOG_WARN,
+                           "cupsdIsAuthorized: Unknown username \"%s\"; access denied.",
+                           con->username);
            return (HTTP_UNAUTHORIZED);
          }
 
@@ -1335,8 +1369,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
 
          if (spw == NULL && strcmp(pw->pw_passwd, "x") == 0)
          {                                     /* Don't allow blank passwords! */
-           cupsdLogMessage(L_WARN, "cupsdIsAuthorized: Username \"%s\" has no shadow password; access denied.",
-                      con->username);
+           cupsdLogMessage(CUPSD_LOG_WARN,
+                           "cupsdIsAuthorized: Username \"%s\" has no shadow password; access denied.",
+                           con->username);
            return (HTTP_UNAUTHORIZED); /* No such user or bad shadow file */
          }
 
@@ -1352,8 +1387,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
          if (pw->pw_passwd[0] == '\0')
 #  endif /* HAVE_SHADOW_H */
          {                                     /* Don't allow blank passwords! */
-           cupsdLogMessage(L_WARN, "cupsdIsAuthorized: Username \"%s\" has no password; access denied.",
-                      con->username);
+           cupsdLogMessage(CUPSD_LOG_WARN,
+                           "cupsdIsAuthorized: Username \"%s\" has no password; access denied.",
+                           con->username);
            return (HTTP_UNAUTHORIZED);
          }
 
@@ -1363,8 +1399,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
 
          pass = cups_crypt(con->password, pw->pw_passwd);
 
-         cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: pw_passwd = %s, crypt = %s",
-                    pw->pw_passwd, pass);
+         cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                         "cupsdIsAuthorized: pw_passwd = %s, crypt = %s",
+                         pw->pw_passwd, pass);
 
          if (pass == NULL || strcmp(pw->pw_passwd, pass) != 0)
          {
@@ -1373,8 +1410,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
            {
              pass = cups_crypt(con->password, spw->sp_pwdp);
 
-             cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: sp_pwdp = %s, crypt = %s",
-                        spw->sp_pwdp, pass);
+             cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                             "cupsdIsAuthorized: sp_pwdp = %s, crypt = %s",
+                             spw->sp_pwdp, pass);
 
              if (pass == NULL || strcmp(spw->sp_pwdp, pass) != 0)
                return (HTTP_UNAUTHORIZED);
@@ -1394,24 +1432,31 @@ cupsdIsAuthorized(cupsd_client_t   *con,        /* I - Connection */
          if (!httpGetSubField(&(con->http), HTTP_FIELD_AUTHORIZATION, "nonce",
                                nonce))
          {
-            cupsdLogMessage(L_ERROR, "cupsdIsAuthorized: No nonce value for Digest authentication!");
+            cupsdLogMessage(CUPSD_LOG_ERROR,
+                           "cupsdIsAuthorized: No nonce value for Digest authentication!");
             return (HTTP_UNAUTHORIZED);
          }
 
          if (strcmp(con->http.hostname, nonce) != 0)
          {
-            cupsdLogMessage(L_ERROR, "cupsdIsAuthorized: Nonce value error!");
-            cupsdLogMessage(L_ERROR, "cupsdIsAuthorized: Expected \"%s\",",
-                      con->http.hostname);
-            cupsdLogMessage(L_ERROR, "cupsdIsAuthorized: Got \"%s\"!", nonce);
+            cupsdLogMessage(CUPSD_LOG_ERROR,
+                           "cupsdIsAuthorized: Nonce value error!");
+            cupsdLogMessage(CUPSD_LOG_ERROR,
+                           "cupsdIsAuthorized: Expected \"%s\",",
+                           con->http.hostname);
+            cupsdLogMessage(CUPSD_LOG_ERROR,
+                           "cupsdIsAuthorized: Got \"%s\"!", nonce);
             return (HTTP_UNAUTHORIZED);
          }
 
-         cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: nonce = \"%s\"", nonce);
+         cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsAuthorized: nonce = \"%s\"",
+                         nonce);
 
          if (best->num_names && best->level == AUTH_GROUP)
          {
-           cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: num_names = %d", best->num_names);
+           cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                           "cupsdIsAuthorized: num_names = %d",
+                           best->num_names);
 
             for (i = 0; i < best->num_names; i ++)
            {
@@ -1436,8 +1481,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
 
          if (!md5[0])
          {
-            cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: No matching user:group for \"%s\" in passwd.md5!",
-                      con->username);
+            cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                           "cupsdIsAuthorized: No matching user:group for \"%s\" in passwd.md5!",
+                           con->username);
             return (HTTP_UNAUTHORIZED);
          }
 
@@ -1445,8 +1491,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
 
          if (strcmp(md5, con->password) != 0)
          {
-            cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: MD5s \"%s\" and \"%s\" don't match!",
-                      md5, con->password);
+            cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                           "cupsdIsAuthorized: MD5s \"%s\" and \"%s\" don't match!",
+                           md5, con->password);
             return (HTTP_UNAUTHORIZED);
          }
           break;
@@ -1458,7 +1505,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
 
          if (best->num_names && best->level == AUTH_GROUP)
          {
-           cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: num_names = %d", best->num_names);
+           cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                           "cupsdIsAuthorized: num_names = %d",
+                           best->num_names);
 
             for (i = 0; i < best->num_names; i ++)
            {
@@ -1483,8 +1532,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
 
          if (!md5[0])
          {
-            cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: No matching user:group for \"%s\" in passwd.md5!",
-                      con->username);
+            cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                           "cupsdIsAuthorized: No matching user:group for \"%s\" in passwd.md5!",
+                           con->username);
             return (HTTP_UNAUTHORIZED);
          }
 
@@ -1492,8 +1542,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
 
          if (strcmp(md5, basicmd5) != 0)
          {
-            cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: MD5s \"%s\" and \"%s\" don't match!",
-                      md5, basicmd5);
+            cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                           "cupsdIsAuthorized: MD5s \"%s\" and \"%s\" don't match!",
+                           md5, basicmd5);
             return (HTTP_UNAUTHORIZED);
          }
          break;
@@ -1524,8 +1575,6 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
     * any valid user is OK...
     */
 
-    cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: Checking user membership...");
-
     if (best->num_names == 0)
       return (HTTP_OK);
 
@@ -1534,6 +1583,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
     * allowed...
     */
 
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdIsAuthorized: Checking user membership...");
+
     for (i = 0; i < best->num_names; i ++)
     {
       if (!strcasecmp(best->names[i], "@OWNER") && owner &&
@@ -1561,7 +1613,8 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
   * Check to see if this user is in any of the named groups...
   */
 
-  cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: Checking group membership...");
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdIsAuthorized: Checking group membership...");
 
   if (best->type == AUTH_BASIC)
   {
@@ -1571,8 +1624,9 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
 
     for (i = 0; i < best->num_names; i ++)
     {
-      cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: Checking group \"%s\" membership...",
-                 best->names[i]);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdIsAuthorized: Checking group \"%s\" membership...",
+                      best->names[i]);
 
       if (!strcasecmp(best->names[i], "@SYSTEM"))
       {
@@ -1588,7 +1642,8 @@ cupsdIsAuthorized(cupsd_client_t   *con,  /* I - Connection */
     * The user isn't part of the specified group, so deny access...
     */
 
-    cupsdLogMessage(L_DEBUG2, "cupsdIsAuthorized: User not in group(s)!");
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdIsAuthorized: User not in group(s)!");
 
     return (HTTP_UNAUTHORIZED);
   }
@@ -1648,7 +1703,7 @@ add_allow(cupsd_location_t *loc)  /* I - Location to add to */
  */
 
 static cupsd_authmask_t *              /* O - New mask record */
-add_deny(cupsd_location_t *loc)        /* I - Location to add to */
+add_deny(cupsd_location_t *loc)                /* I - Location to add to */
 {
   cupsd_authmask_t     *temp;          /* New mask record */
 
@@ -1813,15 +1868,17 @@ cups_crypt(const char *pw,              /* I - Password string */
  * 'pam_func()' - PAM conversation function.
  */
 
-static int                                     /* O - Success or failure */
-pam_func(int                      num_msg,     /* I - Number of messages */
-         const struct pam_message **msg,       /* I - Messages */
-         struct pam_response      **resp,      /* O - Responses */
-         void                     *appdata_ptr)        /* I - Pointer to connection */
+static int                             /* O - Success or failure */
+pam_func(
+    int                      num_msg,  /* I - Number of messages */
+    const struct pam_message **msg,    /* I - Messages */
+    struct pam_response      **resp,   /* O - Responses */
+    void                     *appdata_ptr)
+                                       /* I - Pointer to connection */
 {
-  int                  i;                      /* Looping var */
-  struct pam_response  *replies;               /* Replies */
-  cupsd_client_t               *client;                /* Pointer client connection */
+  int                  i;              /* Looping var */
+  struct pam_response  *replies;       /* Replies */
+  cupsd_client_t       *client;        /* Pointer client connection */
 
 
  /*
@@ -1905,9 +1962,9 @@ pam_func(int                      num_msg,        /* I - Number of messages */
  */
 
 static void
-to64(char          *s, /* O - Output string */
-     unsigned long v,  /* I - Value to encode */
-     int           n)  /* I - Number of digits */
+to64(char          *s,                 /* O - Output string */
+     unsigned long v,                  /* I - Value to encode */
+     int           n)                  /* I - Number of digits */
 {
   const char   *itoa64 = "./0123456789"
                           "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
index 29f8bd67b8471d41aac6e0171deffd935bff2803..5900b915c045810257163d2e7be28d3f4bed4902 100644 (file)
@@ -90,28 +90,29 @@ typedef struct
   int          type;                   /* Mask type */
   union
   {
-    cupsd_namemask_t   name;                   /* Host/Domain name */
-    cupsd_ipmask_t     ip;                     /* IP address/network */
+    cupsd_namemask_t   name;           /* Host/Domain name */
+    cupsd_ipmask_t     ip;             /* IP address/network */
   }            mask;                   /* Mask data */
 } cupsd_authmask_t;
 
 typedef struct
 {
-  char         location[HTTP_MAX_URI]; /* Location of resource */
-  ipp_op_t     op;                     /* IPP operation */
-  int          limit,                  /* Limit for these types of requests */
-               length,                 /* Length of location string */
-               order_type,             /* Allow or Deny */
-               type,                   /* Type of authentication */
-               level,                  /* Access level required */
-               satisfy;                /* Satisfy any or all limits? */
-  int          num_names;              /* Number of names */
-  char         **names;                /* User or group names */
-  int          num_allow;              /* Number of Allow lines */
-  cupsd_authmask_t     *allow;                 /* Allow lines */
-  int          num_deny;               /* Number of Deny lines */
-  cupsd_authmask_t     *deny;                  /* Deny lines */
-  http_encryption_t encryption;                /* To encrypt or not to encrypt... */
+  char                 location[HTTP_MAX_URI];
+                                       /* Location of resource */
+  ipp_op_t             op;             /* IPP operation */
+  int                  limit,          /* Limit for these types of requests */
+                       length,         /* Length of location string */
+                       order_type,     /* Allow or Deny */
+                       type,           /* Type of authentication */
+                       level,          /* Access level required */
+                       satisfy;        /* Satisfy any or all limits? */
+  int                  num_names;      /* Number of names */
+  char                 **names;        /* User or group names */
+  int                  num_allow;      /* Number of Allow lines */
+  cupsd_authmask_t     *allow;         /* Allow lines */
+  int                  num_deny;       /* Number of Deny lines */
+  cupsd_authmask_t     *deny;          /* Deny lines */
+  http_encryption_t    encryption;     /* To encrypt or not to encrypt... */
 } cupsd_location_t;
 
 typedef struct cupsd_client_s cupsd_client_t;
@@ -123,7 +124,7 @@ typedef struct cupsd_client_s cupsd_client_t;
 
 VAR int                        NumLocations    VALUE(0);
                                        /* Number of authorization locations */
-VAR cupsd_location_t           *Locations      VALUE(NULL);
+VAR cupsd_location_t   *Locations      VALUE(NULL);
                                        /* Authorization locations */
 VAR int                        DefaultAuthType VALUE(AUTH_BASIC);
                                        /* Default AuthType, if not specified */
@@ -137,9 +138,9 @@ extern cupsd_location_t     *cupsdAddLocation(const char *location);
 extern void            cupsdAddName(cupsd_location_t *loc, char *name);
 extern void            cupsdAllowHost(cupsd_location_t *loc, char *name);
 extern void            cupsdAllowIP(cupsd_location_t *loc, unsigned address[4],
-                               unsigned netmask[4]);
+                                    unsigned netmask[4]);
 extern int             cupsdCheckAuth(unsigned ip[4], char *name, int namelen,
-                                 int num_masks, cupsd_authmask_t *masks);
+                                      int num_masks, cupsd_authmask_t *masks);
 extern int             cupsdCheckGroup(const char *username,
                                        struct passwd *user,
                                        const char *groupname);
@@ -148,11 +149,11 @@ extern void               cupsdDeleteAllLocations(void);
 extern void            cupsdDeleteLocation(cupsd_location_t *loc);
 extern void            cupsdDenyHost(cupsd_location_t *loc, char *name);
 extern void            cupsdDenyIP(cupsd_location_t *loc, unsigned address[4],
-                              unsigned netmask[4]);
+                                   unsigned netmask[4]);
 extern cupsd_location_t        *cupsdFindBest(const char *path, http_state_t state);
 extern cupsd_location_t        *cupsdFindLocation(const char *location);
 extern char            *cupsdGetMD5Passwd(const char *username, const char *group,
-                                     char passwd[33]);
+                                          char passwd[33]);
 extern http_status_t   cupsdIsAuthorized(cupsd_client_t *con, const char *owner);
 
 
index 17a7849abc5d312bec8b21cba10836221daef912..50667ebf2637b371928bcfc0a6246926daf3af00 100644 (file)
@@ -26,7 +26,7 @@
  *   cupsdAddBanner()   - Add a banner to the array.
  *   cupsdFindBanner()  - Find a named banner.
  *   cupsdLoadBanners() - Load all available banner files...
- *   compare()     - Compare two banners.
+ *   compare()          - Compare two banners.
  */
 
 /*
@@ -50,9 +50,9 @@ static int    compare(const cupsd_banner_t *b0, const cupsd_banner_t *b1);
 
 void
 cupsdAddBanner(const char *name,       /* I - Name of banner */
-          const char *filename)        /* I - Filename for banner */
+               const char *filename)   /* I - Filename for banner */
 {
-  mime_type_t  *filetype;      /* Filetype */
+  mime_type_t          *filetype;      /* Filetype */
   cupsd_banner_t       *temp;          /* New banner data */
 
 
@@ -62,8 +62,9 @@ cupsdAddBanner(const char *name,      /* I - Name of banner */
 
   if ((filetype = mimeFileType(MimeDatabase, filename, NULL)) == NULL)
   {
-    cupsdLogMessage(L_WARN, "cupsdAddBanner: Banner \"%s\" (\"%s\") is of an unknown file type - skipping!",
-               name, filename);
+    cupsdLogMessage(CUPSD_LOG_WARN,
+                    "cupsdAddBanner: Banner \"%s\" (\"%s\") is of an unknown file type - skipping!",
+                    name, filename);
     return;
   }
 
@@ -78,7 +79,8 @@ cupsdAddBanner(const char *name,      /* I - Name of banner */
 
   if (temp == NULL)
   {
-    cupsdLogMessage(L_ERROR, "cupsdAddBanner: Ran out of memory adding a banner!");
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdAddBanner: Ran out of memory adding a banner!");
     return;
   }
 
@@ -142,7 +144,7 @@ cupsdLoadBanners(const char *d)             /* I - Directory to search */
 
   if ((dir = cupsDirOpen(d)) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "cupsdLoadBanners: Unable to open banner directory \"%s\": %s",
+    cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdLoadBanners: Unable to open banner directory \"%s\": %s",
                d, strerror(errno));
     return;
   }
@@ -195,7 +197,7 @@ cupsdLoadBanners(const char *d)             /* I - Directory to search */
  * 'compare()' - Compare two banners.
  */
 
-static int                     /* O - -1 if name0 < name1, etc. */
+static int                             /* O - -1 if name0 < name1, etc. */
 compare(const cupsd_banner_t *b0,      /* I - First banner */
         const cupsd_banner_t *b1)      /* I - Second banner */
 {
index e1a197eb54297e7c704abed5deed62fc28ed46f4..f4ae7bac4553e18fe55e26519a8b9d17faf4a0a0 100644 (file)
@@ -28,8 +28,8 @@
 
 typedef struct
 {
-  char         name[256];      /* Name of banner */
-  mime_type_t  *filetype;      /* Filetype for banner */
+  char         name[256];              /* Name of banner */
+  mime_type_t  *filetype;              /* Filetype for banner */
 } cupsd_banner_t;
 
 
@@ -37,19 +37,19 @@ typedef struct
  * Globals...
  */
 
-VAR int                NumBanners      VALUE(0);
-                               /* Number of banner files available */
+VAR int                        NumBanners      VALUE(0);
+                                       /* Number of banner files available */
 VAR cupsd_banner_t     *Banners        VALUE(NULL);
-                               /* Available banner files */
+                                       /* Available banner files */
 
 
 /*
  * Prototypes...
  */
 
-extern void    cupsdAddBanner(const char *name, const char *filename);
+extern void            cupsdAddBanner(const char *name, const char *filename);
 extern cupsd_banner_t  *cupsdFindBanner(const char *name);
-extern void    cupsdLoadBanners(const char *d);
+extern void            cupsdLoadBanners(const char *d);
 
 
 /*
index 2b4a6262ce761c9d7d937029976345ee949ee4f3..b247d382261171aa24a73a6f49b91be86ae02a45 100644 (file)
@@ -29,7 +29,7 @@
  *   cupsdDeleteAllCerts() - Delete all certificates...
  *   cupsdFindCert()       - Find a certificate.
  *   cupsdInitCerts()      - Initialize the certificate "system" and root
- *                      certificate.
+ *                           certificate.
  */
 
 /*
@@ -44,8 +44,8 @@
  */
 
 void
-cupsdAddCert(int        pid,                   /* I - Process ID */
-        const char *username)          /* I - Username */
+cupsdAddCert(int        pid,           /* I - Process ID */
+             const char *username)     /* I - Username */
 {
   int          i;                      /* Looping var */
   cupsd_cert_t *cert;                  /* Current certificate */
@@ -55,7 +55,8 @@ cupsdAddCert(int        pid,                  /* I - Process ID */
                                        /* Hex constants... */
 
 
-  cupsdLogMessage(L_DEBUG2, "cupsdAddCert: adding certificate for pid %d", pid);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdAddCert: adding certificate for pid %d", pid);
 
  /*
   * Allocate memory for the certificate...
@@ -84,8 +85,9 @@ cupsdAddCert(int        pid,                  /* I - Process ID */
 
   if ((fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0400)) < 0)
   {
-    cupsdLogMessage(L_ERROR, "cupsdAddCert: Unable to create certificate file %s - %s",
-               filename, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdAddCert: Unable to create certificate file %s - %s",
+                    filename, strerror(errno));
     free(cert);
     return;
   }
@@ -131,7 +133,7 @@ cupsdAddCert(int        pid,                        /* I - Process ID */
  */
 
 void
-cupsdDeleteCert(int pid)                       /* I - Process ID */
+cupsdDeleteCert(int pid)               /* I - Process ID */
 {
   cupsd_cert_t *cert,                  /* Current certificate */
                *prev;                  /* Previous certificate */
@@ -145,7 +147,8 @@ cupsdDeleteCert(int pid)                    /* I - Process ID */
       * Remove this certificate from the list...
       */
 
-      cupsdLogMessage(L_DEBUG2, "cupsdDeleteCert: removing certificate for pid %d", pid);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdDeleteCert: removing certificate for pid %d", pid);
 
       DEBUG_printf(("DELETE pid=%d, username=%s, cert=%s\n", cert->pid,
                     cert->username, cert->certificate));
@@ -163,7 +166,8 @@ cupsdDeleteCert(int pid)                    /* I - Process ID */
 
       snprintf(filename, sizeof(filename), "%s/certs/%d", StateDir, pid);
       if (unlink(filename))
-       cupsdLogMessage(L_ERROR, "cupsdDeleteCert: Unable to remove %s!\n", filename);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdDeleteCert: Unable to remove %s!\n", filename);
 
       return;
     }
@@ -194,7 +198,8 @@ cupsdDeleteAllCerts(void)
 
     snprintf(filename, sizeof(filename), "%s/certs/%d", StateDir, cert->pid);
     if (unlink(filename))
-      cupsdLogMessage(L_ERROR, "cupsdDeleteAllCerts: Unable to remove %s!\n", filename);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cupsdDeleteAllCerts: Unable to remove %s!\n", filename);
 
    /*
     * Free memory...
@@ -220,7 +225,7 @@ cupsdFindCert(const char *certificate)      /* I - Certificate */
 
   DEBUG_printf(("cupsdFindCert(certificate=%s)\n", certificate));
   for (cert = Certs; cert != NULL; cert = cert->next)
-    if (strcasecmp(certificate, cert->certificate) == 0)
+    if (!strcasecmp(certificate, cert->certificate))
     {
       DEBUG_printf(("    returning %s...\n", cert->username));
       return (cert->username);
@@ -233,7 +238,8 @@ cupsdFindCert(const char *certificate)      /* I - Certificate */
 
 
 /*
- * 'cupsdInitCerts()' - Initialize the certificate "system" and root certificate.
+ * 'cupsdInitCerts()' - Initialize the certificate "system" and root
+ *                      certificate.
  */
 
 void
index 8890fae6f77364d367c7533edd3cdc47d2948b68..3d9ad20442e7475a8aeffdda9766041804d2afe4 100644 (file)
@@ -30,9 +30,9 @@
 typedef struct cupsd_cert_s
 {
   struct cupsd_cert_s *next;           /* Next certificate in list */
-  int          pid;            /* Process ID (0 for root certificate) */
-  char         certificate[33];/* 32 hex characters, or 128 bits */
-  char         username[33];   /* Authenticated username */
+  int          pid;                    /* Process ID (0 for root certificate) */
+  char         certificate[33];        /* 32 hex characters, or 128 bits */
+  char         username[33];           /* Authenticated username */
 } cupsd_cert_t;
 
 
@@ -41,7 +41,7 @@ typedef struct cupsd_cert_s
  */
 
 VAR cupsd_cert_t       *Certs;         /* List of certificates */
-VAR time_t     RootCertTime;   /* Root certificate update time */
+VAR time_t             RootCertTime;   /* Root certificate update time */
 
 
 /*
index fd1a07a33cc2f54b75febfe6bba00dc77f0f28ec..8f4ca5317de8f884e3f92caf24a1b527e4de5b75 100644 (file)
@@ -33,7 +33,7 @@
  *   cupsdLoadAllClasses()           - Load classes from the classes.conf file.
  *   cupsdSaveAllClasses()           - Save classes to the classes.conf file.
  *   cupsdUpdateImplicitClasses()    - Update the accepting state of implicit
- *                                classes.
+ *                                     classes.
  */
 
 /*
@@ -48,7 +48,7 @@
  */
 
 cupsd_printer_t *                      /* O - New class */
-cupsdAddClass(const char *name)        /* I - Name of class */
+cupsdAddClass(const char *name)                /* I - Name of class */
 {
   cupsd_printer_t      *c;             /* New class */
 
@@ -65,7 +65,8 @@ cupsdAddClass(const char *name)       /* I - Name of class */
 
     c->type = CUPS_PRINTER_CLASS;
 
-    cupsdSetStringf(&c->uri, "ipp://%s:%d/classes/%s", ServerName, LocalPort, name);
+    cupsdSetStringf(&c->uri, "ipp://%s:%d/classes/%s", ServerName, LocalPort,
+                    name);
     cupsdSetString(&c->error_policy, "retry-job");
   }
 
@@ -78,10 +79,11 @@ cupsdAddClass(const char *name)     /* I - Name of class */
  */
 
 void
-cupsdAddPrinterToClass(cupsd_printer_t *c,     /* I - Class to add to */
-                  cupsd_printer_t *p)  /* I - Printer to add */
+cupsdAddPrinterToClass(
+    cupsd_printer_t *c,                        /* I - Class to add to */
+    cupsd_printer_t *p)                        /* I - Printer to add */
 {
-  int          i;              /* Looping var */
+  int                  i;              /* Looping var */
   cupsd_printer_t      **temp;         /* Pointer to printer array */
 
 
@@ -104,8 +106,8 @@ cupsdAddPrinterToClass(cupsd_printer_t *c,  /* I - Class to add to */
 
   if (temp == NULL)
   {
-    cupsdLogMessage(L_ERROR, "Unable to add printer %s to class %s!",
-               p->name, c->name);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to add printer %s to class %s!",
+                    p->name, c->name);
     return;
   }
 
@@ -126,8 +128,9 @@ cupsdAddPrinterToClass(cupsd_printer_t *c,  /* I - Class to add to */
  */
 
 void
-cupsdDeletePrinterFromClass(cupsd_printer_t *c,        /* I - Class to delete from */
-                       cupsd_printer_t *p)     /* I - Printer to delete */
+cupsdDeletePrinterFromClass(
+    cupsd_printer_t *c,                        /* I - Class to delete from */
+    cupsd_printer_t *p)                        /* I - Printer to delete */
 {
   int          i;                      /* Looping var */
   cups_ptype_t type;                   /* Class type */
@@ -187,9 +190,10 @@ cupsdDeletePrinterFromClass(cupsd_printer_t *c,    /* I - Class to delete from */
  */
 
 void
-cupsdDeletePrinterFromClasses(cupsd_printer_t *p)      /* I - Printer to delete */
+cupsdDeletePrinterFromClasses(
+    cupsd_printer_t *p)                        /* I - Printer to delete */
 {
-  cupsd_printer_t      *c;                     /* Pointer to current class */
+  cupsd_printer_t      *c;             /* Pointer to current class */
 
 
  /*
@@ -222,7 +226,7 @@ cupsdDeletePrinterFromClasses(cupsd_printer_t *p)   /* I - Printer to delete */
 void
 cupsdDeleteAllClasses(void)
 {
-  cupsd_printer_t      *c;                     /* Pointer to current printer/class */
+  cupsd_printer_t      *c;             /* Pointer to current printer/class */
 
 
   for (c = (cupsd_printer_t *)cupsArrayFirst(Printers);
@@ -237,11 +241,12 @@ cupsdDeleteAllClasses(void)
  * 'cupsdFindAvailablePrinter()' - Find an available printer in a class.
  */
 
-cupsd_printer_t *                              /* O - Available printer or NULL */
-cupsdFindAvailablePrinter(const char *name)    /* I - Class to check */
+cupsd_printer_t *                      /* O - Available printer or NULL */
+cupsdFindAvailablePrinter(
+    const char *name)                  /* I - Class to check */
 {
-  int          i;                      /* Looping var */
-  cupsd_printer_t      *c;                     /* Printer class */
+  int                  i;              /* Looping var */
+  cupsd_printer_t      *c;             /* Printer class */
 
 
  /*
@@ -250,7 +255,7 @@ cupsdFindAvailablePrinter(const char *name) /* I - Class to check */
 
   if ((c = cupsdFindClass(name)) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "Unable to find class \"%s\"!", name);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to find class \"%s\"!", name);
     return (NULL);
   }
 
@@ -308,13 +313,13 @@ cupsdFindClass(const char *name)  /* I - Name of class */
 void
 cupsdLoadAllClasses(void)
 {
-  cups_file_t  *fp;                    /* classes.conf file */
-  int          linenum;                /* Current line number */
-  char         line[1024],             /* Line from file */
-               *value,                 /* Pointer to value */
-               *valueptr;              /* Pointer into value */
-  cupsd_printer_t      *p,                     /* Current printer class */
-               *temp;                  /* Temporary pointer to printer */
+  cups_file_t          *fp;            /* classes.conf file */
+  int                  linenum;        /* Current line number */
+  char                 line[1024],     /* Line from file */
+                       *value,         /* Pointer to value */
+                       *valueptr;      /* Pointer into value */
+  cupsd_printer_t      *p,             /* Current printer class */
+                       *temp;          /* Temporary pointer to printer */
 
 
  /*
@@ -324,8 +329,9 @@ cupsdLoadAllClasses(void)
   snprintf(line, sizeof(line), "%s/classes.conf", ServerRoot);
   if ((fp = cupsFileOpen(line, "r")) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "cupsdLoadAllClasses: Unable to open %s - %s", line,
-               strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdLoadAllClasses: Unable to open %s - %s", line,
+                    strerror(errno));
     return;
   }
 
@@ -351,7 +357,8 @@ cupsdLoadAllClasses(void)
 
       if (p == NULL && value)
       {
-        cupsdLogMessage(L_DEBUG, "cupsdLoadAllClasses: Loading class %s...", value);
+        cupsdLogMessage(CUPSD_LOG_DEBUG,
+                       "cupsdLoadAllClasses: Loading class %s...", value);
 
         p = cupsdAddClass(value);
        p->accepting = 1;
@@ -362,8 +369,8 @@ cupsdLoadAllClasses(void)
       }
       else
       {
-        cupsdLogMessage(L_ERROR, "Syntax error on line %d of classes.conf.",
-                  linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of classes.conf.", linenum);
         return;
       }
     }
@@ -376,15 +383,15 @@ cupsdLoadAllClasses(void)
       }
       else
       {
-        cupsdLogMessage(L_ERROR, "Syntax error on line %d of classes.conf.",
-                  linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of classes.conf.", linenum);
         return;
       }
     }
     else if (!p)
     {
-      cupsdLogMessage(L_ERROR, "Syntax error on line %d of classes.conf.",
-                linenum);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Syntax error on line %d of classes.conf.", linenum);
       return;
     }
     else if (!strcasecmp(line, "Info"))
@@ -401,14 +408,15 @@ cupsdLoadAllClasses(void)
     {
       if (!value)
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of classes.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of classes.conf.", linenum);
        return;
       }
       else if ((temp = cupsdFindPrinter(value)) == NULL)
       {
-       cupsdLogMessage(L_WARN, "Unknown printer %s on line %d of classes.conf.",
-                  value, linenum);
+       cupsdLogMessage(CUPSD_LOG_WARN,
+                       "Unknown printer %s on line %d of classes.conf.",
+                       value, linenum);
 
        /*
        * Add the missing remote printer...
@@ -445,8 +453,9 @@ cupsdLoadAllClasses(void)
         p->state = IPP_PRINTER_STOPPED;
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of classes.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of classes.conf.",
+                       linenum);
        return;
       }
     }
@@ -477,8 +486,9 @@ cupsdLoadAllClasses(void)
         p->accepting = 0;
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of classes.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of classes.conf.",
+                       linenum);
        return;
       }
     }
@@ -500,8 +510,9 @@ cupsdLoadAllClasses(void)
         p->shared = 0;
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.",
+                       linenum);
        return;
       }
     }
@@ -513,30 +524,34 @@ cupsdLoadAllClasses(void)
 
       if (value)
       {
-       for (valueptr = value; *valueptr && !isspace(*valueptr & 255); valueptr ++);
+       for (valueptr = value;
+            *valueptr && !isspace(*valueptr & 255);
+            valueptr ++);
 
        if (*valueptr)
           *valueptr++ = '\0';
 
-       cupsdSetString(&p->cupsd_job_sheets[0], value);
+       cupsdSetString(&p->job_sheets[0], value);
 
        while (isspace(*valueptr & 255))
           valueptr ++;
 
        if (*valueptr)
        {
-          for (value = valueptr; *valueptr && !isspace(*valueptr & 255); valueptr ++);
+          for (value = valueptr;
+              *valueptr && !isspace(*valueptr & 255);
+              valueptr ++);
 
          if (*valueptr)
             *valueptr++ = '\0';
 
-         cupsdSetString(&p->cupsd_job_sheets[1], value);
+         cupsdSetString(&p->job_sheets[1], value);
        }
       }
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of classes.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of classes.conf.", linenum);
        return;
       }
     }
@@ -549,8 +564,8 @@ cupsdLoadAllClasses(void)
       }
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of classes.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of classes.conf.", linenum);
        return;
       }
     }
@@ -563,8 +578,8 @@ cupsdLoadAllClasses(void)
       }
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of classes.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of classes.conf.", linenum);
        return;
       }
     }
@@ -574,8 +589,8 @@ cupsdLoadAllClasses(void)
         p->quota_period = atoi(value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of classes.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of classes.conf.", linenum);
        return;
       }
     }
@@ -585,8 +600,8 @@ cupsdLoadAllClasses(void)
         p->page_limit = atoi(value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of classes.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of classes.conf.", linenum);
        return;
       }
     }
@@ -596,8 +611,8 @@ cupsdLoadAllClasses(void)
         p->k_limit = atoi(value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of classes.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of classes.conf.", linenum);
        return;
       }
     }
@@ -607,8 +622,8 @@ cupsdLoadAllClasses(void)
         cupsdSetString(&p->op_policy, value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of classes.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of classes.conf.", linenum);
        return;
       }
     }
@@ -618,8 +633,8 @@ cupsdLoadAllClasses(void)
         cupsdSetString(&p->error_policy, value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of classes.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of classes.conf.", linenum);
        return;
       }
     }
@@ -629,8 +644,9 @@ cupsdLoadAllClasses(void)
       * Something else we don't understand...
       */
 
-      cupsdLogMessage(L_ERROR, "Unknown configuration directive %s on line %d of classes.conf.",
-                line, linenum);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Unknown configuration directive %s on line %d of classes.conf.",
+                     line, linenum);
     }
   }
 
@@ -645,13 +661,13 @@ cupsdLoadAllClasses(void)
 void
 cupsdSaveAllClasses(void)
 {
-  cups_file_t  *fp;                    /* classes.conf file */
-  char         temp[1024];             /* Temporary string */
-  char         backup[1024];           /* classes.conf.O file */
-  cupsd_printer_t      *pclass;                /* Current printer class */
-  int          i;                      /* Looping var */
-  time_t       curtime;                /* Current time */
-  struct tm    *curdate;               /* Current date */
+  cups_file_t          *fp;            /* classes.conf file */
+  char                 temp[1024];     /* Temporary string */
+  char                 backup[1024];   /* classes.conf.O file */
+  cupsd_printer_t      *pclass;        /* Current printer class */
+  int                  i;              /* Looping var */
+  time_t               curtime;        /* Current time */
+  struct tm            *curdate;       /* Current date */
 
 
  /*
@@ -662,18 +678,21 @@ cupsdSaveAllClasses(void)
   snprintf(backup, sizeof(backup), "%s/classes.conf.O", ServerRoot);
 
   if (rename(temp, backup))
-    cupsdLogMessage(L_ERROR, "Unable to backup classes.conf - %s", strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to backup classes.conf - %s",
+                    strerror(errno));
 
   if ((fp = cupsFileOpen(temp, "w")) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "Unable to save classes.conf - %s", strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to save classes.conf - %s",
+                    strerror(errno));
 
     if (rename(backup, temp))
-      cupsdLogMessage(L_ERROR, "Unable to restore classes.conf - %s", strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to restore classes.conf - %s",
+                      strerror(errno));
     return;
   }
   else
-    cupsdLogMessage(L_INFO, "Saving classes.conf...");
+    cupsdLogMessage(CUPSD_LOG_INFO, "Saving classes.conf...");
 
  /*
   * Restrict access to the file...
@@ -743,8 +762,8 @@ cupsdSaveAllClasses(void)
     else
       cupsFilePuts(fp, "Shared No\n");
 
-    cupsFilePrintf(fp, "JobSheets %s %s\n", pclass->cupsd_job_sheets[0],
-                   pclass->cupsd_job_sheets[1]);
+    cupsFilePrintf(fp, "JobSheets %s %s\n", pclass->job_sheets[0],
+                   pclass->job_sheets[1]);
 
     for (i = 0; i < pclass->num_printers; i ++)
       cupsFilePrintf(fp, "Printer %s\n", pclass->printers[i]->name);
@@ -770,15 +789,16 @@ cupsdSaveAllClasses(void)
 
 
 /*
- * 'cupsdUpdateImplicitClasses()' - Update the accepting state of implicit classes.
+ * 'cupsdUpdateImplicitClasses()' - Update the accepting state of implicit
+ *                                  classes.
  */
 
 void
 cupsdUpdateImplicitClasses(void)
 {
-  int          i;                      /* Looping var */
-  cupsd_printer_t      *pclass;                /* Current class */
-  int          accepting;              /* printer-is-accepting-jobs value */
+  int                  i;              /* Looping var */
+  cupsd_printer_t      *pclass;        /* Current class */
+  int                  accepting;      /* printer-is-accepting-jobs value */
 
 
   for (pclass = (cupsd_printer_t *)cupsArrayFirst(Printers);
index 7cf3700af2c2c2d5e822a48ffbf2ea1ae2e9b753..7667742e7c070c8f516fbe61b05d36a27c00c13c 100644 (file)
  */
 
 extern cupsd_printer_t *cupsdAddClass(const char *name);
-extern void            cupsdAddPrinterToClass(cupsd_printer_t *c, cupsd_printer_t *p);
-extern void            cupsdDeletePrinterFromClass(cupsd_printer_t *c, cupsd_printer_t *p);
+extern void            cupsdAddPrinterToClass(cupsd_printer_t *c,
+                                              cupsd_printer_t *p);
+extern void            cupsdDeletePrinterFromClass(cupsd_printer_t *c,
+                                                   cupsd_printer_t *p);
 extern void            cupsdDeletePrinterFromClasses(cupsd_printer_t *p);
 extern void            cupsdDeleteAllClasses(void);
 extern cupsd_printer_t *cupsdFindAvailablePrinter(const char *name);
index 0bd27c6f1eb65440487197b4c767da9651e3382b..85dddc38ddd77fbd9dca329d04c7175326036370 100644 (file)
  *
  * Contents:
  *
- *   cupsdAcceptClient()        - Accept a new client.
- *   cupsdCloseAllClients()     - Close all remote clients immediately.
- *   cupsdCloseClient()         - Close a remote client.
- *   cupsdEncryptClient()       - Enable encryption for the client...
- *   cupsdIsCGI()               - Is the resource a CGI script/program?
- *   cupsdReadClient()          - Read data from a client.
- *   cupsdSendCommand()         - Send output from a command via HTTP.
- *   cupsdSendError()           - Send an error message via HTTP.
- *   cupsdSendFile()            - Send a file via HTTP.
- *   cupsdSendHeader()          - Send an HTTP request.
- *   cupsdUpdateCGI()           - Read status messages from CGI scripts and programs.
- *   cupsdWriteClient()         - Write data to a client as needed.
- *   check_if_modified()   - Decode an "If-Modified-Since" line.
- *   decode_auth()         - Decode an authorization string.
- *   get_file()            - Get a filename and state info.
- *   install_conf_file()   - Install a configuration file.
- *   is_path_absolute()    - Is a path absolute and free of relative elements.
- *   pipe_command()        - Pipe the output of a command to the remote client.
- *   CDSAReadFunc()        - Read function for CDSA decryption code.
- *   CDSAWriteFunc()       - Write function for CDSA encryption code.
+ *   cupsdAcceptClient()    - Accept a new client.
+ *   cupsdCloseAllClients() - Close all remote clients immediately.
+ *   cupsdCloseClient()     - Close a remote client.
+ *   cupsdEncryptClient()   - Enable encryption for the client...
+ *   cupsdIsCGI()           - Is the resource a CGI script/program?
+ *   cupsdReadClient()      - Read data from a client.
+ *   cupsdSendCommand()     - Send output from a command via HTTP.
+ *   cupsdSendError()       - Send an error message via HTTP.
+ *   cupsdSendFile()        - Send a file via HTTP.
+ *   cupsdSendHeader()      - Send an HTTP request.
+ *   cupsdUpdateCGI()       - Read status messages from CGI scripts and programs.
+ *   cupsdWriteClient()     - Write data to a client as needed.
+ *   check_if_modified()    - Decode an "If-Modified-Since" line.
+ *   decode_auth()          - Decode an authorization string.
+ *   get_file()             - Get a filename and state info.
+ *   install_conf_file()    - Install a configuration file.
+ *   is_path_absolute()     - Is a path absolute and free of relative elements.
+ *   pipe_command()         - Pipe the output of a command to the remote client.
+ *   CDSAReadFunc()         - Read function for CDSA decryption code.
+ *   CDSAWriteFunc()        - Write function for CDSA encryption code.
  */
 
 /*
@@ -80,21 +80,21 @@ static OSStatus             CDSAWriteFunc(SSLConnectionRef connection,
  */
 
 void
-cupsdAcceptClient(cupsd_listener_t *lis)       /* I - Listener socket */
+cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
 {
-  int                  i;      /* Looping var */
-  int                  count;  /* Count of connections on a host */
-  int                  val;    /* Parameter value */
-  cupsd_client_t               *con;   /* New client pointer */
-  const struct hostent *host;  /* Host entry for address */
-  char                 *hostname;/* Hostname for address */
-  http_addr_t          temp;   /* Temporary address variable */
-  static time_t                last_dos = 0;
-                               /* Time of last DoS attack */
+  int                  i;              /* Looping var */
+  int                  count;          /* Count of connections on a host */
+  int                  val;            /* Parameter value */
+  cupsd_client_t       *con;           /* New client pointer */
+  const struct hostent *host;          /* Host entry for address */
+  char                 *hostname;      /* Hostname for address */
+  http_addr_t          temp;           /* Temporary address variable */
+  static time_t                last_dos = 0;   /* Time of last DoS attack */
 
 
-  cupsdLogMessage(L_DEBUG2, "cupsdAcceptClient(lis=%p) %d NumClients = %d",
-             lis, lis->fd, NumClients);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdAcceptClient(lis=%p) %d NumClients = %d",
+                  lis, lis->fd, NumClients);
 
  /*
   * Make sure we don't have a full set of clients already...
@@ -122,8 +122,8 @@ cupsdAcceptClient(cupsd_listener_t *lis)    /* I - Listener socket */
   if ((con->http.fd = accept(lis->fd, (struct sockaddr *)&(con->http.hostaddr),
                              &val)) < 0)
   {
-    cupsdLogMessage(L_ERROR, "Unable to accept client connection - %s.",
-               strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to accept client connection - %s.",
+                    strerror(errno));
     return;
   }
 
@@ -132,7 +132,8 @@ cupsdAcceptClient(cupsd_listener_t *lis)    /* I - Listener socket */
     con->http.hostaddr.ipv6.sin6_port = lis->address.ipv6.sin6_port;
   else
 #endif /* AF_INET6 */
-  con->http.hostaddr.ipv4.sin_port = lis->address.ipv4.sin_port;
+  if (lis->address.addr.sa_family == AF_INET)
+    con->http.hostaddr.ipv4.sin_port = lis->address.ipv4.sin_port;
 
  /*
   * Check the number of clients on the same address...
@@ -151,8 +152,9 @@ cupsdAcceptClient(cupsd_listener_t *lis)    /* I - Listener socket */
     if ((time(NULL) - last_dos) >= 60)
     {
       last_dos = time(NULL);
-      cupsdLogMessage(L_WARN, "Possible DoS attack - more than %d clients connecting from %s!",
-                MaxClientsPerHost, Clients[i].http.hostname);
+      cupsdLogMessage(CUPSD_LOG_WARN,
+                      "Possible DoS attack - more than %d clients connecting from %s!",
+                     MaxClientsPerHost, Clients[i].http.hostname);
     }
 
 #ifdef WIN32
@@ -202,8 +204,9 @@ cupsdAcceptClient(cupsd_listener_t *lis)    /* I - Listener socket */
     * Can't have an unresolved IP address with double-lookups enabled...
     */
 
-    cupsdLogMessage(L_DEBUG2, "cupsdAcceptClient: Closing connection %d...",
-               con->http.fd);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdAcceptClient: Closing connection %d...",
+                    con->http.fd);
 
 #ifdef WIN32
     closesocket(con->http.fd);
@@ -211,8 +214,9 @@ cupsdAcceptClient(cupsd_listener_t *lis)    /* I - Listener socket */
     close(con->http.fd);
 #endif /* WIN32 */
 
-    cupsdLogMessage(L_WARN, "Name lookup failed - connection from %s closed!",
-               con->http.hostname);
+    cupsdLogMessage(CUPSD_LOG_WARN,
+                    "Name lookup failed - connection from %s closed!",
+                    con->http.hostname);
     return;
   }
 
@@ -262,8 +266,9 @@ cupsdAcceptClient(cupsd_listener_t *lis)    /* I - Listener socket */
       * with double-lookups enabled...
       */
 
-      cupsdLogMessage(L_DEBUG2, "cupsdAcceptClient: Closing connection %d...",
-                con->http.fd);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdAcceptClient: Closing connection %d...",
+                     con->http.fd);
 
 #ifdef WIN32
       closesocket(con->http.fd);
@@ -271,20 +276,29 @@ cupsdAcceptClient(cupsd_listener_t *lis)  /* I - Listener socket */
       close(con->http.fd);
 #endif /* WIN32 */
 
-      cupsdLogMessage(L_WARN, "IP lookup failed - connection from %s closed!",
-                 con->http.hostname);
+      cupsdLogMessage(CUPSD_LOG_WARN,
+                      "IP lookup failed - connection from %s closed!",
+                      con->http.hostname);
       return;
     }
   }
 
 #ifdef AF_INET6
   if (con->http.hostaddr.addr.sa_family == AF_INET6)
-    cupsdLogMessage(L_DEBUG, "cupsdAcceptClient: %d from %s:%d.", con->http.fd,
-               con->http.hostname, ntohs(con->http.hostaddr.ipv6.sin6_port));
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdAcceptClient: %d from %s:%d (IPv6)",
+                    con->http.fd, con->http.hostname,
+                   ntohs(con->http.hostaddr.ipv6.sin6_port));
   else
 #endif /* AF_INET6 */
-  cupsdLogMessage(L_DEBUG, "cupsdAcceptClient: %d from %s:%d.", con->http.fd,
-             con->http.hostname, ntohs(con->http.hostaddr.ipv4.sin_port));
+#ifdef AF_LOCAL
+  if (con->http.hostaddr.addr.sa_family == AF_LOCAL)
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdAcceptClient: %d from %s (Domain)",
+                    con->http.fd, con->http.hostname);
+  else
+#endif /* AF_LOCAL */
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdAcceptClient: %d from %s:%d (IPv4)",
+                  con->http.fd, con->http.hostname,
+                 ntohs(con->http.hostaddr.ipv4.sin_port));
 
  /*
   * Get the local address the client connected to...
@@ -293,7 +307,8 @@ cupsdAcceptClient(cupsd_listener_t *lis)    /* I - Listener socket */
   i = sizeof(temp);
   if (getsockname(con->http.fd, (struct sockaddr *)&temp, &i))
   {
-    cupsdLogMessage(L_ERROR, "Unable to get local address - %s", strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to get local address - %s",
+                    strerror(errno));
 
     strcpy(con->servername, "localhost");
     con->serverport = LocalPort;
@@ -320,8 +335,10 @@ cupsdAcceptClient(cupsd_listener_t *lis)   /* I - Listener socket */
     }
   }
 
-  cupsdLogMessage(L_DEBUG2, "cupsdAcceptClient: %d connected to server on %s:%d",
-             con->http.fd, con->servername, con->serverport);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdAcceptClient: %d connected to server on %s:%d",
+                  con->http.fd, con->servername, con->serverport);
+
  /*
   * Using TCP_NODELAY improves responsiveness, especially on systems
   * with a slow loopback interface...  Since we write large buffers
@@ -342,8 +359,9 @@ cupsdAcceptClient(cupsd_listener_t *lis)    /* I - Listener socket */
   * Add the socket to the select() input mask.
   */
 
-  cupsdLogMessage(L_DEBUG2, "cupsdAcceptClient: Adding fd %d to InputSet...",
-             con->http.fd);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdAcceptClient: Adding fd %d to InputSet...",
+                  con->http.fd);
   FD_SET(con->http.fd, InputSet);
 
   NumClients ++;
@@ -392,25 +410,25 @@ cupsdCloseAllClients(void)
  * 'cupsdCloseClient()' - Close a remote client.
  */
 
-int                            /* O - 1 if partial close, 0 if fully closed */
+int                                    /* O - 1 if partial close, 0 if fully closed */
 cupsdCloseClient(cupsd_client_t *con)  /* I - Client to close */
 {
-  int          partial;        /* Do partial close for SSL? */
+  int          partial;                /* Do partial close for SSL? */
 #if defined(HAVE_LIBSSL)
-  SSL_CTX      *context;       /* Context for encryption */
-  SSL          *conn;          /* Connection for encryption */
-  unsigned long        error;          /* Error code */
+  SSL_CTX      *context;               /* Context for encryption */
+  SSL          *conn;                  /* Connection for encryption */
+  unsigned long        error;                  /* Error code */
 #elif defined(HAVE_GNUTLS)
-  http_tls_t     *conn;                /* TLS connection information */
-  int            error;                /* Error code */
+  http_tls_t     *conn;                        /* TLS connection information */
+  int            error;                        /* Error code */
   gnutls_certificate_server_credentials *credentials;
-                               /* TLS credentials */
+                                       /* TLS credentials */
 #elif defined(HAVE_CDSASSL)
-  int          status;         /* Error status */
+  int          status;                 /* Error status */
 #endif /* HAVE_LIBSSL */
 
 
-  cupsdLogMessage(L_DEBUG, "cupsdCloseClient: %d", con->http.fd);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdCloseClient: %d", con->http.fd);
 
  /*
   * Flush pending writes before closing...
@@ -436,13 +454,16 @@ cupsdCloseClient(cupsd_client_t *con)     /* I - Client to close */
     switch (SSL_shutdown(conn))
     {
       case 1 :
-          cupsdLogMessage(L_INFO, "cupsdCloseClient: SSL shutdown successful!");
+          cupsdLogMessage(CUPSD_LOG_INFO,
+                         "cupsdCloseClient: SSL shutdown successful!");
          break;
       case -1 :
-          cupsdLogMessage(L_ERROR, "cupsdCloseClient: Fatal error during SSL shutdown!");
+          cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "cupsdCloseClient: Fatal error during SSL shutdown!");
       default :
          while ((error = ERR_get_error()) != 0)
-           cupsdLogMessage(L_ERROR, "cupsdCloseClient: %s", ERR_error_string(error, NULL));
+           cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdCloseClient: %s",
+                           ERR_error_string(error, NULL));
           break;
     }
 
@@ -457,10 +478,12 @@ cupsdCloseClient(cupsd_client_t *con)     /* I - Client to close */
     switch (error)
     {
       case GNUTLS_E_SUCCESS:
-       cupsdLogMessage(L_INFO, "cupsdCloseClient: SSL shutdown successful!");
+       cupsdLogMessage(CUPSD_LOG_INFO,
+                       "cupsdCloseClient: SSL shutdown successful!");
        break;
       default:
-       cupsdLogMessage(L_ERROR, "cupsdCloseClient: %s", gnutls_strerror(error));
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdCloseClient: %s", gnutls_strerror(error));
        break;
     }
 
@@ -484,8 +507,9 @@ cupsdCloseClient(cupsd_client_t *con)       /* I - Client to close */
     * Stop any CGI process...
     */
 
-    cupsdLogMessage(L_DEBUG2, "cupsdCloseClient: %d Killing process ID %d...",
-               con->http.fd, con->pipe_pid);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdCloseClient: %d Killing process ID %d...",
+                    con->http.fd, con->pipe_pid);
     cupsdEndProcess(con->pipe_pid, 1);
   }
 
@@ -493,13 +517,15 @@ cupsdCloseClient(cupsd_client_t *con)     /* I - Client to close */
   {
     if (FD_ISSET(con->file, InputSet))
     {
-      cupsdLogMessage(L_DEBUG2, "cupsdCloseClient: %d Removing fd %d from InputSet...",
-                con->http.fd, con->file);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdCloseClient: %d Removing fd %d from InputSet...",
+                     con->http.fd, con->file);
       FD_CLR(con->file, InputSet);
     }
 
-    cupsdLogMessage(L_DEBUG2, "cupsdCloseClient: %d Closing data file %d.",
-               con->http.fd, con->file);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdCloseClient: %d Closing data file %d.",
+                    con->http.fd, con->file);
 
     close(con->file);
     con->file = -1;
@@ -517,8 +543,9 @@ cupsdCloseClient(cupsd_client_t *con)       /* I - Client to close */
       * Only do a partial close so that the encrypted client gets everything.
       */
 
-      cupsdLogMessage(L_DEBUG2, "cupsdCloseClient: Removing fd %d from OutputSet...",
-                con->http.fd);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdCloseClient: Removing fd %d from OutputSet...",
+                     con->http.fd);
       shutdown(con->http.fd, 0);
       FD_CLR(con->http.fd, OutputSet);
     }
@@ -528,8 +555,9 @@ cupsdCloseClient(cupsd_client_t *con)       /* I - Client to close */
       * Shut the socket down fully...
       */
 
-      cupsdLogMessage(L_DEBUG2, "cupsdCloseClient: Removing fd %d from InputSet and OutputSet...",
-                con->http.fd);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdCloseClient: Removing fd %d from InputSet and OutputSet...",
+                     con->http.fd);
       close(con->http.fd);
       FD_CLR(con->http.fd, InputSet);
       FD_CLR(con->http.fd, OutputSet);
@@ -596,13 +624,13 @@ cupsdCloseClient(cupsd_client_t *con)     /* I - Client to close */
  * 'cupsdEncryptClient()' - Enable encryption for the client...
  */
 
-int                            /* O - 1 on success, 0 on error */
+int                                    /* O - 1 on success, 0 on error */
 cupsdEncryptClient(cupsd_client_t *con)        /* I - Client to encrypt */
 {
 #if defined HAVE_LIBSSL
-  SSL_CTX      *context;       /* Context for encryption */
-  SSL          *conn;          /* Connection for encryption */
-  unsigned long        error;          /* Error code */
+  SSL_CTX      *context;               /* Context for encryption */
+  SSL          *conn;                  /* Connection for encryption */
+  unsigned long        error;                  /* Error code */
 
 
  /*
@@ -620,28 +648,31 @@ cupsdEncryptClient(cupsd_client_t *con)   /* I - Client to encrypt */
   SSL_set_fd(conn, con->http.fd);
   if (SSL_accept(conn) != 1)
   {
-    cupsdLogMessage(L_ERROR, "cupsdEncryptClient: Unable to encrypt connection from %s!",
-               con->http.hostname);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdEncryptClient: Unable to encrypt connection from %s!",
+                    con->http.hostname);
 
     while ((error = ERR_get_error()) != 0)
-      cupsdLogMessage(L_ERROR, "cupsdEncryptClient: %s", ERR_error_string(error, NULL));
+      cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdEncryptClient: %s",
+                      ERR_error_string(error, NULL));
 
     SSL_CTX_free(context);
     SSL_free(conn);
     return (0);
   }
 
-  cupsdLogMessage(L_DEBUG, "cupsdEncryptClient: %d Connection from %s now encrypted.",
-             con->http.fd, con->http.hostname);
+  cupsdLogMessage(CUPSD_LOG_DEBUG,
+                  "cupsdEncryptClient: %d Connection from %s now encrypted.",
+                  con->http.fd, con->http.hostname);
 
   con->http.tls = conn;
   return (1);
   
 #elif defined(HAVE_GNUTLS)
-  http_tls_t   *conn;          /* TLS session object */
-  int          error;          /* Error code */
+  http_tls_t   *conn;                  /* TLS session object */
+  int          error;                  /* Error code */
   gnutls_certificate_server_credentials *credentials;
-                               /* TLS credentials */
+                                       /* TLS credentials */
 
  /*
   * Create the SSL object and perform the SSL handshake...
@@ -656,9 +687,10 @@ cupsdEncryptClient(cupsd_client_t *con)    /* I - Client to encrypt */
                     malloc(sizeof(gnutls_certificate_server_credentials));
   if (credentials == NULL)
   {
-    cupsdLogMessage(L_ERROR, "cupsdEncryptClient: Unable to encrypt connection from %s!",
-               con->http.hostname);
-    cupsdLogMessage(L_ERROR, "cupsdEncryptClient: %s", strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdEncryptClient: Unable to encrypt connection from %s!",
+                    con->http.hostname);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdEncryptClient: %s", strerror(errno));
 
     free(conn);
     return (0);
@@ -677,9 +709,11 @@ cupsdEncryptClient(cupsd_client_t *con)    /* I - Client to encrypt */
 
   if (error != GNUTLS_E_SUCCESS)
   {
-    cupsdLogMessage(L_ERROR, "cupsdEncryptClient: Unable to encrypt connection from %s!",
-               con->http.hostname);
-    cupsdLogMessage(L_ERROR, "cupsdEncryptClient: %s", gnutls_strerror(error));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdEncryptClient: Unable to encrypt connection from %s!",
+                    con->http.hostname);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdEncryptClient: %s",
+                    gnutls_strerror(error));
 
     gnutls_deinit(conn->session);
     gnutls_certificate_free_credentials(*credentials);
@@ -688,8 +722,9 @@ cupsdEncryptClient(cupsd_client_t *con)     /* I - Client to encrypt */
     return (0);
   }
 
-  cupsdLogMessage(L_DEBUG, "cupsdEncryptClient: %d Connection from %s now encrypted.",
-             con->http.fd, con->http.hostname);
+  cupsdLogMessage(CUPSD_LOG_DEBUG,
+                  "cupsdEncryptClient: %d Connection from %s now encrypted.",
+                  con->http.fd, con->http.hostname);
 
   conn->credentials = credentials;
   con->http.tls = conn;
@@ -749,10 +784,12 @@ cupsdEncryptClient(cupsd_client_t *con)   /* I - Client to encrypt */
 
   if (error)
   {
-    cupsdLogMessage(L_ERROR, "cupsdEncryptClient: Unable to encrypt connection from %s!",
-               con->http.hostname);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdEncryptClient: Unable to encrypt connection from %s!",
+                    con->http.hostname);
 
-    cupsdLogMessage(L_ERROR, "cupsdEncryptClient: CDSA error code is %d", error);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdEncryptClient: CDSA error code is %d", error);
 
     con->http.error  = error;
     con->http.status = HTTP_ERROR;
@@ -763,8 +800,9 @@ cupsdEncryptClient(cupsd_client_t *con)     /* I - Client to encrypt */
     return (0);
   }
 
-  cupsdLogMessage(L_DEBUG, "cupsdEncryptClient: %d Connection from %s now encrypted.",
-             con->http.fd, con->http.hostname);
+  cupsdLogMessage(CUPSD_LOG_DEBUG,
+                  "cupsdEncryptClient: %d Connection from %s now encrypted.",
+                  con->http.fd, con->http.hostname);
 
   con->http.tls = conn;
   return (1);
@@ -779,18 +817,19 @@ cupsdEncryptClient(cupsd_client_t *con)   /* I - Client to encrypt */
  * 'cupsdIsCGI()' - Is the resource a CGI script/program?
  */
 
-int                                            /* O - 1 = CGI, 0 = file */
-cupsdIsCGI(cupsd_client_t    *con,                             /* I - Client connection */
-      const char  *filename,                   /* I - Real filename */
-      struct stat *filestats,                  /* I - File information */
-      mime_type_t *type)                       /* I - MIME type */
+int                                    /* O - 1 = CGI, 0 = file */
+cupsdIsCGI(cupsd_client_t *con,                /* I - Client connection */
+          const char     *filename,    /* I - Real filename */
+          struct stat    *filestats,   /* I - File information */
+          mime_type_t    *type)        /* I - MIME type */
 {
-  const char   *options;                       /* Options on URL */
+  const char   *options;               /* Options on URL */
 
 
-  cupsdLogMessage(L_DEBUG2, "cupsdIsCGI(con=%p, filename=\"%s\", filestats=%p, type=%s/%s)\n",
-             con, filename, filestats, type ? type->super : "unknown",
-            type ? type->type : "unknown");
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdIsCGI(con=%p, filename=\"%s\", filestats=%p, type=%s/%s)\n",
+                 con, filename, filestats, type ? type->super : "unknown",
+                 type ? type->type : "unknown");
 
  /*
   * Get the options, if any...
@@ -805,7 +844,7 @@ cupsdIsCGI(cupsd_client_t    *con,                          /* I - Client connection */
 
   if (!type || strcasecmp(type->super, "application"))
   {
-    cupsdLogMessage(L_DEBUG2, "cupsdIsCGI: Returning 0...");
+    cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsCGI: Returning 0...");
     return (0);
   }
 
@@ -825,8 +864,9 @@ cupsdIsCGI(cupsd_client_t    *con,                          /* I - Client connection */
     else
       cupsdSetStringf(&con->options, "%s", filename);
 
-    cupsdLogMessage(L_DEBUG2, "cupsdIsCGI: Returning 1 with command=\"%s\" and options=\"%s\"",
-               con->command, con->options);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdIsCGI: Returning 1 with command=\"%s\" and options=\"%s\"",
+                    con->command, con->options);
 
     return (1);
   }
@@ -844,8 +884,9 @@ cupsdIsCGI(cupsd_client_t    *con,                          /* I - Client connection */
     else
       cupsdSetStringf(&con->options, "java %s", filename);
 
-    cupsdLogMessage(L_DEBUG2, "cupsdIsCGI: Returning 1 with command=\"%s\" and options=\"%s\"",
-               con->command, con->options);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdIsCGI: Returning 1 with command=\"%s\" and options=\"%s\"",
+                    con->command, con->options);
 
     return (1);
   }
@@ -864,8 +905,9 @@ cupsdIsCGI(cupsd_client_t    *con,                          /* I - Client connection */
     else
       cupsdSetStringf(&con->options, "perl %s", filename);
 
-    cupsdLogMessage(L_DEBUG2, "cupsdIsCGI: Returning 1 with command=\"%s\" and options=\"%s\"",
-               con->command, con->options);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdIsCGI: Returning 1 with command=\"%s\" and options=\"%s\"",
+                    con->command, con->options);
 
     return (1);
   }
@@ -884,8 +926,9 @@ cupsdIsCGI(cupsd_client_t    *con,                          /* I - Client connection */
     else
       cupsdSetStringf(&con->options, "php %s", filename);
 
-    cupsdLogMessage(L_DEBUG2, "cupsdIsCGI: Returning 1 with command=\"%s\" and options=\"%s\"",
-               con->command, con->options);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdIsCGI: Returning 1 with command=\"%s\" and options=\"%s\"",
+                    con->command, con->options);
 
     return (1);
   }
@@ -904,14 +947,15 @@ cupsdIsCGI(cupsd_client_t    *con,                                /* I - Client connection */
     else
       cupsdSetStringf(&con->options, "python %s", filename);
 
-    cupsdLogMessage(L_DEBUG2, "cupsdIsCGI: Returning 1 with command=\"%s\" and options=\"%s\"",
-               con->command, con->options);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdIsCGI: Returning 1 with command=\"%s\" and options=\"%s\"",
+                    con->command, con->options);
 
     return (1);
   }
 #endif /* HAVE_PYTHON */
 
-  cupsdLogMessage(L_DEBUG2, "cupsdIsCGI: Returning 0...");
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdIsCGI: Returning 0...");
 
   return (0);
 }
@@ -922,33 +966,33 @@ cupsdIsCGI(cupsd_client_t    *con,                                /* I - Client connection */
  */
 
 int                                    /* O - 1 on success, 0 on error */
-cupsdReadClient(cupsd_client_t *con)           /* I - Client to read from */
+cupsdReadClient(cupsd_client_t *con)   /* I - Client to read from */
 {
-  char         line[32768],            /* Line from client... */
-               operation[64],          /* Operation code from socket */
-               version[64],            /* HTTP version number string */
-               locale[64],             /* Locale */
-               *ptr;                   /* Pointer into strings */
-  int          major, minor;           /* HTTP version numbers */
-  http_status_t        status;                 /* Transfer status */
-  ipp_state_t   ipp_state;             /* State of IPP transfer */
-  int          bytes;                  /* Number of bytes to POST */
-  char         *filename;              /* Name of file for GET/HEAD */
-  char         buf[1024];              /* Buffer for real filename */
-  struct stat  filestats;              /* File information */
-  mime_type_t  *type;                  /* MIME type of file */
-  cupsd_printer_t      *p;                     /* Printer */
-  static unsigned request_id = 0;      /* Request ID for temp files */
+  char                 line[32768],    /* Line from client... */
+                       operation[64],  /* Operation code from socket */
+                       version[64],    /* HTTP version number string */
+                       locale[64],     /* Locale */
+                       *ptr;           /* Pointer into strings */
+  int                  major, minor;   /* HTTP version numbers */
+  http_status_t                status;         /* Transfer status */
+  ipp_state_t          ipp_state;      /* State of IPP transfer */
+  int                  bytes;          /* Number of bytes to POST */
+  char                 *filename;      /* Name of file for GET/HEAD */
+  char                 buf[1024];      /* Buffer for real filename */
+  struct stat          filestats;      /* File information */
+  mime_type_t          *type;          /* MIME type of file */
+  cupsd_printer_t      *p;             /* Printer */
+  static unsigned      request_id = 0; /* Request ID for temp files */
 
 
   status = HTTP_CONTINUE;
 
-  cupsdLogMessage(L_DEBUG2, "cupsdReadClient: %d, used=%d, file=%d", con->http.fd,
-             con->http.used, con->file);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdReadClient: %d, used=%d, file=%d",
+                  con->http.fd, con->http.used, con->file);
 
   if (con->http.error)
   {
-    cupsdLogMessage(L_DEBUG2, "cupsdReadClient: http error seen...");
+    cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdReadClient: http error seen...");
     return (cupsdCloseClient(con));
   }
 
@@ -968,8 +1012,9 @@ cupsdReadClient(cupsd_client_t *con)               /* I - Client to read from */
       * Encrypt this connection...
       */
 
-      cupsdLogMessage(L_DEBUG2, "cupsdReadClient: Saw first byte %02X, auto-negotiating SSL/TLS session...",
-                 buf[0] & 255);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdReadClient: Saw first byte %02X, auto-negotiating SSL/TLS session...",
+                      buf[0] & 255);
 
       cupsdEncryptClient(con);
       return (1);
@@ -986,7 +1031,8 @@ cupsdReadClient(cupsd_client_t *con)               /* I - Client to read from */
 
         if (httpGets(line, sizeof(line) - 1, HTTP(con)) == NULL)
        {
-         cupsdLogMessage(L_DEBUG2, "cupsdReadClient: httpGets returned EOF...");
+         cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                         "cupsdReadClient: httpGets returned EOF...");
           return (cupsdCloseClient(con));
        }
 
@@ -1033,8 +1079,9 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
         switch (sscanf(line, "%63s%1023s%63s", operation, con->uri, version))
        {
          case 1 :
-             cupsdLogMessage(L_ERROR, "Bad request line \"%s\" from %s!", line,
-                        con->http.hostname);
+             cupsdLogMessage(CUPSD_LOG_ERROR,
+                             "Bad request line \"%s\" from %s!", line,
+                             con->http.hostname);
              cupsdSendError(con, HTTP_BAD_REQUEST);
              return (cupsdCloseClient(con));
          case 2 :
@@ -1043,8 +1090,9 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
          case 3 :
              if (sscanf(version, "HTTP/%d.%d", &major, &minor) != 2)
              {
-               cupsdLogMessage(L_ERROR, "Bad request line \"%s\" from %s!", line,
-                          con->http.hostname);
+               cupsdLogMessage(CUPSD_LOG_ERROR,
+                               "Bad request line \"%s\" from %s!", line,
+                               con->http.hostname);
                cupsdSendError(con, HTTP_BAD_REQUEST);
                return (cupsdCloseClient(con));
              }
@@ -1071,11 +1119,11 @@ cupsdReadClient(cupsd_client_t *con)            /* I - Client to read from */
 
         if (con->uri[0] != '/' && strcmp(con->uri, "*"))
        {
-         char  method[HTTP_MAX_URI],           /* Method/scheme */
-               userpass[HTTP_MAX_URI],         /* Username:password */
-               hostname[HTTP_MAX_URI],         /* Hostname */
-               resource[HTTP_MAX_URI];         /* Resource path */
-          int  port;                           /* Port number */
+         char  method[HTTP_MAX_URI],   /* Method/scheme */
+               userpass[HTTP_MAX_URI], /* Username:password */
+               hostname[HTTP_MAX_URI], /* Hostname */
+               resource[HTTP_MAX_URI]; /* Resource path */
+          int  port;                   /* Port number */
 
 
          /*
@@ -1097,7 +1145,8 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
            * Nope, we don't do proxies...
            */
 
-           cupsdLogMessage(L_ERROR, "Bad URI \"%s\" in request!", con->uri);
+           cupsdLogMessage(CUPSD_LOG_ERROR, "Bad URI \"%s\" in request!",
+                           con->uri);
            cupsdSendError(con, HTTP_METHOD_NOT_ALLOWED);
            return (cupsdCloseClient(con));
          }
@@ -1114,23 +1163,23 @@ cupsdReadClient(cupsd_client_t *con)            /* I - Client to read from */
         * Process the request...
        */
 
-        if (strcmp(operation, "GET") == 0)
+        if (!strcmp(operation, "GET"))
          con->http.state = HTTP_GET;
-        else if (strcmp(operation, "PUT") == 0)
+        else if (!strcmp(operation, "PUT"))
          con->http.state = HTTP_PUT;
-        else if (strcmp(operation, "POST") == 0)
+        else if (!strcmp(operation, "POST"))
          con->http.state = HTTP_POST;
-        else if (strcmp(operation, "DELETE") == 0)
+        else if (!strcmp(operation, "DELETE"))
          con->http.state = HTTP_DELETE;
-        else if (strcmp(operation, "TRACE") == 0)
+        else if (!strcmp(operation, "TRACE"))
          con->http.state = HTTP_TRACE;
-        else if (strcmp(operation, "OPTIONS") == 0)
+        else if (!strcmp(operation, "OPTIONS"))
          con->http.state = HTTP_OPTIONS;
-        else if (strcmp(operation, "HEAD") == 0)
+        else if (!strcmp(operation, "HEAD"))
          con->http.state = HTTP_HEAD;
        else
        {
-         cupsdLogMessage(L_ERROR, "Bad operation \"%s\"!", operation);
+         cupsdLogMessage(CUPSD_LOG_ERROR, "Bad operation \"%s\"!", operation);
          cupsdSendError(con, HTTP_BAD_REQUEST);
          return (cupsdCloseClient(con));
        }
@@ -1138,9 +1187,9 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
         con->start     = time(NULL);
         con->operation = con->http.state;
 
-        cupsdLogMessage(L_DEBUG, "cupsdReadClient: %d %s %s HTTP/%d.%d", con->http.fd,
-                  operation, con->uri,
-                  con->http.version / 100, con->http.version % 100);
+        cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdReadClient: %d %s %s HTTP/%d.%d", con->http.fd,
+                       operation, con->uri,
+                       con->http.version / 100, con->http.version % 100);
 
        con->http.status = HTTP_OK;
 
@@ -1211,11 +1260,11 @@ cupsdReadClient(cupsd_client_t *con)            /* I - Client to read from */
 
     decode_auth(con);
 
-    if (strncmp(con->http.fields[HTTP_FIELD_CONNECTION], "Keep-Alive", 10) == 0 &&
+    if (!strncmp(con->http.fields[HTTP_FIELD_CONNECTION], "Keep-Alive", 10) &&
         KeepAlive)
       con->http.keep_alive = HTTP_KEEPALIVE_ON;
 
-    if (con->http.fields[HTTP_FIELD_HOST][0] == '\0' &&
+    if (!con->http.fields[HTTP_FIELD_HOST][0] &&
         con->http.version >= HTTP_1_1)
     {
      /*
@@ -1311,8 +1360,9 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
 
       if ((status = cupsdIsAuthorized(con, NULL)) != HTTP_OK)
       {
-        cupsdLogMessage(L_DEBUG2, "cupsdReadClient: Unauthorized request for %s...\n",
-                  con->uri);
+        cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                       "cupsdReadClient: Unauthorized request for %s...\n",
+                       con->uri);
        cupsdSendError(con, status);
        return (cupsdCloseClient(con));
       }
@@ -1325,8 +1375,8 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
       switch (con->http.state)
       {
        case HTTP_GET_SEND :
-            if (strncmp(con->uri, "/printers/", 10) == 0 &&
-               strcmp(con->uri + strlen(con->uri) - 4, ".ppd") == 0)
+            if (!strncmp(con->uri, "/printers/", 10) &&
+               !strcmp(con->uri + strlen(con->uri) - 4, ".ppd"))
            {
             /*
              * Send PPD file - get the real printer name since printer
@@ -1360,7 +1410,8 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
 
               if (!strncmp(con->uri, "/admin", 6))
              {
-               cupsdSetStringf(&con->command, "%s/cgi-bin/admin.cgi", ServerBin);
+               cupsdSetStringf(&con->command, "%s/cgi-bin/admin.cgi",
+                               ServerBin);
 
                if ((ptr = strchr(con->uri + 6, '?')) != NULL)
                  cupsdSetStringf(&con->options, "admin%s", ptr);
@@ -1369,22 +1420,26 @@ cupsdReadClient(cupsd_client_t *con)            /* I - Client to read from */
              }
               else if (!strncmp(con->uri, "/printers", 9))
              {
-               cupsdSetStringf(&con->command, "%s/cgi-bin/printers.cgi", ServerBin);
+               cupsdSetStringf(&con->command, "%s/cgi-bin/printers.cgi",
+                               ServerBin);
                cupsdSetString(&con->options, con->uri + 9);
              }
              else if (!strncmp(con->uri, "/classes", 8))
              {
-               cupsdSetStringf(&con->command, "%s/cgi-bin/classes.cgi", ServerBin);
+               cupsdSetStringf(&con->command, "%s/cgi-bin/classes.cgi",
+                               ServerBin);
                cupsdSetString(&con->options, con->uri + 8);
              }
              else if (!strncmp(con->uri, "/jobs", 5))
              {
-               cupsdSetStringf(&con->command, "%s/cgi-bin/jobs.cgi", ServerBin);
+               cupsdSetStringf(&con->command, "%s/cgi-bin/jobs.cgi",
+                               ServerBin);
                 cupsdSetString(&con->options, con->uri + 5);
              }
              else
              {
-               cupsdSetStringf(&con->command, "%s/cgi-bin/help.cgi", ServerBin);
+               cupsdSetStringf(&con->command, "%s/cgi-bin/help.cgi",
+                               ServerBin);
                 cupsdSetString(&con->options, con->uri + 5);
              }
 
@@ -1480,11 +1535,13 @@ cupsdReadClient(cupsd_client_t *con)            /* I - Client to read from */
            * so check the length against any limits that are set...
            */
 
-            cupsdLogMessage(L_DEBUG2, "POST %s", con->uri);
-           cupsdLogMessage(L_DEBUG2, "CONTENT_TYPE = %s", con->http.fields[HTTP_FIELD_CONTENT_TYPE]);
+            cupsdLogMessage(CUPSD_LOG_DEBUG2, "POST %s", con->uri);
+           cupsdLogMessage(CUPSD_LOG_DEBUG2, "CONTENT_TYPE = %s",
+                           con->http.fields[HTTP_FIELD_CONTENT_TYPE]);
 
             if (con->http.fields[HTTP_FIELD_CONTENT_LENGTH][0] &&
-               atoi(con->http.fields[HTTP_FIELD_CONTENT_LENGTH]) > MaxRequestSize &&
+               atoi(con->http.fields[HTTP_FIELD_CONTENT_LENGTH]) >
+                   MaxRequestSize &&
                MaxRequestSize > 0)
            {
             /*
@@ -1513,7 +1570,8 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
            * content-type field will be "application/ipp"...
            */
 
-           if (strcmp(con->http.fields[HTTP_FIELD_CONTENT_TYPE], "application/ipp") == 0)
+           if (!strcmp(con->http.fields[HTTP_FIELD_CONTENT_TYPE],
+                       "application/ipp"))
               con->request = ippNew();
            else if ((!strncmp(con->uri, "/admin", 6) &&
                      strncmp(con->uri, "/admin/conf/", 12) &&
@@ -1529,7 +1587,8 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
 
               if (!strncmp(con->uri, "/admin", 6))
              {
-               cupsdSetStringf(&con->command, "%s/cgi-bin/admin.cgi", ServerBin);
+               cupsdSetStringf(&con->command, "%s/cgi-bin/admin.cgi",
+                               ServerBin);
 
                if ((ptr = strchr(con->uri + 6, '?')) != NULL)
                  cupsdSetStringf(&con->options, "admin%s", ptr);
@@ -1538,30 +1597,35 @@ cupsdReadClient(cupsd_client_t *con)            /* I - Client to read from */
              }
               else if (!strncmp(con->uri, "/printers", 9))
              {
-               cupsdSetStringf(&con->command, "%s/cgi-bin/printers.cgi", ServerBin);
+               cupsdSetStringf(&con->command, "%s/cgi-bin/printers.cgi",
+                               ServerBin);
                cupsdSetString(&con->options, con->uri + 9);
              }
              else if (!strncmp(con->uri, "/classes", 8))
              {
-               cupsdSetStringf(&con->command, "%s/cgi-bin/classes.cgi", ServerBin);
+               cupsdSetStringf(&con->command, "%s/cgi-bin/classes.cgi",
+                               ServerBin);
                cupsdSetString(&con->options, con->uri + 8);
              }
              else if (!strncmp(con->uri, "/jobs", 5))
              {
-               cupsdSetStringf(&con->command, "%s/cgi-bin/jobs.cgi", ServerBin);
+               cupsdSetStringf(&con->command, "%s/cgi-bin/jobs.cgi",
+                               ServerBin);
                cupsdSetString(&con->options, con->uri + 5);
              }
              else
              {
-               cupsdSetStringf(&con->command, "%s/cgi-bin/help.cgi", ServerBin);
+               cupsdSetStringf(&con->command, "%s/cgi-bin/help.cgi",
+                               ServerBin);
                cupsdSetString(&con->options, con->uri + 5);
              }
 
              if (con->options[0] == '/')
                _cups_strcpy(con->options, con->options + 1);
 
-              cupsdLogMessage(L_DEBUG2, "cupsdReadClient: %d command=\"%s\", options = \"%s\"",
-                        con->http.fd, con->command, con->options);
+              cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                             "cupsdReadClient: %d command=\"%s\", options = \"%s\"",
+                             con->http.fd, con->command, con->options);
 
              if (con->http.version <= HTTP_1_0)
                con->http.keep_alive = HTTP_KEEPALIVE_OFF;
@@ -1620,11 +1684,13 @@ cupsdReadClient(cupsd_client_t *con)            /* I - Client to read from */
            * so check the length against any limits that are set...
            */
 
-            cupsdLogMessage(L_DEBUG2, "PUT %s", con->uri);
-           cupsdLogMessage(L_DEBUG2, "CONTENT_TYPE = %s", con->http.fields[HTTP_FIELD_CONTENT_TYPE]);
+            cupsdLogMessage(CUPSD_LOG_DEBUG2, "PUT %s", con->uri);
+           cupsdLogMessage(CUPSD_LOG_DEBUG2, "CONTENT_TYPE = %s",
+                           con->http.fields[HTTP_FIELD_CONTENT_TYPE]);
 
             if (con->http.fields[HTTP_FIELD_CONTENT_LENGTH][0] &&
-               atoi(con->http.fields[HTTP_FIELD_CONTENT_LENGTH]) > MaxRequestSize &&
+               atoi(con->http.fields[HTTP_FIELD_CONTENT_LENGTH]) >
+                   MaxRequestSize &&
                MaxRequestSize > 0)
            {
             /*
@@ -1652,11 +1718,13 @@ cupsdReadClient(cupsd_client_t *con)            /* I - Client to read from */
            * Open a temporary file to hold the request...
            */
 
-            cupsdSetStringf(&con->filename, "%s/%08x", RequestRoot, request_id ++);
+            cupsdSetStringf(&con->filename, "%s/%08x", RequestRoot,
+                           request_id ++);
            con->file = open(con->filename, O_WRONLY | O_CREAT | O_TRUNC, 0640);
 
-            cupsdLogMessage(L_DEBUG2, "cupsdReadClient: %d REQUEST %s=%d", con->http.fd,
-                      con->filename, con->file);
+            cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                           "cupsdReadClient: %d REQUEST %s=%d", con->http.fd,
+                           con->filename, con->file);
 
            if (con->file < 0)
            {
@@ -1793,10 +1861,12 @@ cupsdReadClient(cupsd_client_t *con)            /* I - Client to read from */
   switch (con->http.state)
   {
     case HTTP_PUT_RECV :
-        cupsdLogMessage(L_DEBUG2, "cupsdReadClient: %d con->data_encoding = %s, con->data_remaining = %d, con->file = %d",
-                  con->http.fd,
-                  con->http.data_encoding == HTTP_ENCODE_CHUNKED ? "chunked" : "length",
-                  con->http.data_remaining, con->file);
+        cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                       "cupsdReadClient: %d con->data_encoding = %s, con->data_remaining = %d, con->file = %d",
+                       con->http.fd,
+                       con->http.data_encoding == HTTP_ENCODE_CHUNKED ?
+                           "chunked" : "length",
+                       con->http.data_remaining, con->file);
 
         if ((bytes = httpRead(HTTP(con), line, sizeof(line))) < 0)
          return (cupsdCloseClient(con));
@@ -1804,16 +1874,19 @@ cupsdReadClient(cupsd_client_t *con)            /* I - Client to read from */
        {
          con->bytes += bytes;
 
-          cupsdLogMessage(L_DEBUG2, "cupsdReadClient: %d writing %d bytes to %d",
-                    con->http.fd, bytes, con->file);
+          cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                         "cupsdReadClient: %d writing %d bytes to %d",
+                         con->http.fd, bytes, con->file);
 
           if (write(con->file, line, bytes) < bytes)
          {
-            cupsdLogMessage(L_ERROR, "cupsdReadClient: Unable to write %d bytes to %s: %s",
-                      bytes, con->filename, strerror(errno));
+            cupsdLogMessage(CUPSD_LOG_ERROR,
+                           "cupsdReadClient: Unable to write %d bytes to %s: %s",
+                           bytes, con->filename, strerror(errno));
 
-           cupsdLogMessage(L_DEBUG2, "cupsdReadClient: Closing data file %d...",
-                      con->file);
+           cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                           "cupsdReadClient: Closing data file %d...",
+                           con->file);
 
            close(con->file);
            con->file = -1;
@@ -1833,8 +1906,9 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
 
          fstat(con->file, &filestats);
 
-          cupsdLogMessage(L_DEBUG2, "cupsdReadClient: %d Closing data file %d, size = %d.",
-                     con->http.fd, con->file, (int)filestats.st_size);
+          cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                         "cupsdReadClient: %d Closing data file %d, size = %d.",
+                          con->http.fd, con->file, (int)filestats.st_size);
 
          close(con->file);
          con->file = -1;
@@ -1846,8 +1920,9 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
            * Request is too big; remove it and send an error...
            */
 
-            cupsdLogMessage(L_DEBUG2, "cupsdReadClient: %d Removing temp file %s",
-                      con->http.fd, con->filename);
+            cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                           "cupsdReadClient: %d Removing temp file %s",
+                           con->http.fd, con->filename);
            unlink(con->filename);
            cupsdClearString(&con->filename);
 
@@ -1871,10 +1946,12 @@ cupsdReadClient(cupsd_client_t *con)            /* I - Client to read from */
         break;
 
     case HTTP_POST_RECV :
-        cupsdLogMessage(L_DEBUG2, "cupsdReadClient: %d con->data_encoding = %s, con->data_remaining = %d, con->file = %d",
-                  con->http.fd,
-                  con->http.data_encoding == HTTP_ENCODE_CHUNKED ? "chunked" : "length",
-                  con->http.data_remaining, con->file);
+        cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                       "cupsdReadClient: %d con->data_encoding = %s, con->data_remaining = %d, con->file = %d",
+                       con->http.fd,
+                       con->http.data_encoding == HTTP_ENCODE_CHUNKED ?
+                           "chunked" : "length",
+                       con->http.data_remaining, con->file);
 
         if (con->request != NULL)
        {
@@ -1884,8 +1961,9 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
 
          if ((ipp_state = ippRead(&(con->http), con->request)) == IPP_ERROR)
          {
-            cupsdLogMessage(L_ERROR, "cupsdReadClient: %d IPP Read Error!",
-                      con->http.fd);
+            cupsdLogMessage(CUPSD_LOG_ERROR,
+                           "cupsdReadClient: %d IPP Read Error!",
+                           con->http.fd);
 
            cupsdSendError(con, HTTP_BAD_REQUEST);
            return (cupsdCloseClient(con));
@@ -1913,8 +1991,8 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
           cupsdSetStringf(&con->filename, "%s/%08x", RequestRoot, request_id ++);
          con->file = open(con->filename, O_WRONLY | O_CREAT | O_TRUNC, 0640);
 
-          cupsdLogMessage(L_DEBUG2, "cupsdReadClient: %d REQUEST %s=%d", con->http.fd,
-                    con->filename, con->file);
+          cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdReadClient: %d REQUEST %s=%d", con->http.fd,
+                         con->filename, con->file);
 
          if (con->file < 0)
          {
@@ -1935,16 +2013,19 @@ cupsdReadClient(cupsd_client_t *con)            /* I - Client to read from */
          {
            con->bytes += bytes;
 
-            cupsdLogMessage(L_DEBUG2, "cupsdReadClient: %d writing %d bytes to %d",
-                      con->http.fd, bytes, con->file);
+            cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                           "cupsdReadClient: %d writing %d bytes to %d",
+                           con->http.fd, bytes, con->file);
 
             if (write(con->file, line, bytes) < bytes)
            {
-              cupsdLogMessage(L_ERROR, "cupsdReadClient: Unable to write %d bytes to %s: %s",
-                        bytes, con->filename, strerror(errno));
+              cupsdLogMessage(CUPSD_LOG_ERROR,
+                             "cupsdReadClient: Unable to write %d bytes to %s: %s",
+                             bytes, con->filename, strerror(errno));
 
-             cupsdLogMessage(L_DEBUG2, "cupsdReadClient: Closing file %d...",
-                        con->file);
+             cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                             "cupsdReadClient: Closing file %d...",
+                             con->file);
 
              close(con->file);
              con->file = -1;
@@ -1967,8 +2048,9 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
          {
            fstat(con->file, &filestats);
 
-            cupsdLogMessage(L_DEBUG2, "cupsdReadClient: %d Closing data file %d, size = %d.",
-                       con->http.fd, con->file, (int)filestats.st_size);
+            cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                           "cupsdReadClient: %d Closing data file %d, size = %d.",
+                            con->http.fd, con->file, (int)filestats.st_size);
 
            close(con->file);
            con->file = -1;
@@ -1980,8 +2062,9 @@ cupsdReadClient(cupsd_client_t *con)              /* I - Client to read from */
              * Request is too big; remove it and send an error...
              */
 
-              cupsdLogMessage(L_DEBUG2, "cupsdReadClient: %d Removing temp file %s",
-                        con->http.fd, con->filename);
+              cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                             "cupsdReadClient: %d Removing temp file %s",
+                             con->http.fd, con->filename);
              unlink(con->filename);
              cupsdClearString(&con->filename);
 
@@ -2032,10 +2115,11 @@ cupsdReadClient(cupsd_client_t *con)            /* I - Client to read from */
  */
 
 int                                    /* O - 1 on success, 0 on failure */
-cupsdSendCommand(cupsd_client_t      *con,             /* I - Client connection */
-           char          *command,     /* I - Command to run */
-           char          *options,     /* I - Command-line options */
-           int           root)         /* I - Run as root? */
+cupsdSendCommand(
+    cupsd_client_t *con,               /* I - Client connection */
+    char           *command,           /* I - Command to run */
+    char           *options,           /* I - Command-line options */
+    int            root)               /* I - Run as root? */
 {
   int  fd;                             /* Standard input file descriptor */
 
@@ -2047,9 +2131,10 @@ cupsdSendCommand(cupsd_client_t      *con,               /* I - Client connection */
 
   if (fd < 0)
   {
-    cupsdLogMessage(L_ERROR, "cupsdSendCommand: %d Unable to open \"%s\" for reading: %s",
-               con->http.fd, con->filename ? con->filename : "/dev/null",
-              strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdSendCommand: %d Unable to open \"%s\" for reading: %s",
+                    con->http.fd, con->filename ? con->filename : "/dev/null",
+                   strerror(errno));
     return (0);
   }
 
@@ -2059,18 +2144,22 @@ cupsdSendCommand(cupsd_client_t      *con,              /* I - Client connection */
 
   close(fd);
 
-  cupsdLogMessage(L_INFO, "Started \"%s\" (pid=%d)", command, con->pipe_pid);
+  cupsdLogMessage(CUPSD_LOG_INFO, "Started \"%s\" (pid=%d)", command,
+                  con->pipe_pid);
 
-  cupsdLogMessage(L_DEBUG, "cupsdSendCommand: %d file=%d", con->http.fd, con->file);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdSendCommand: %d file=%d",
+                  con->http.fd, con->file);
 
   if (con->pipe_pid == 0)
     return (0);
 
   fcntl(con->file, F_SETFD, fcntl(con->file, F_GETFD) | FD_CLOEXEC);
 
-  cupsdLogMessage(L_DEBUG2, "cupsdSendCommand: Adding fd %d to InputSet...", con->file);
-  cupsdLogMessage(L_DEBUG2, "cupsdSendCommand: Adding fd %d to OutputSet...",
-             con->http.fd);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdSendCommand: Adding fd %d to InputSet...", con->file);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdSendCommand: Adding fd %d to OutputSet...",
+                  con->http.fd);
 
   FD_SET(con->file, InputSet);
   FD_SET(con->http.fd, OutputSet);
@@ -2088,11 +2177,11 @@ cupsdSendCommand(cupsd_client_t      *con,              /* I - Client connection */
  * 'cupsdSendError()' - Send an error message via HTTP.
  */
 
-int                            /* O - 1 if successful, 0 otherwise */
-cupsdSendError(cupsd_client_t      *con,       /* I - Connection */
-          http_status_t code)  /* I - Error code */
+int                                    /* O - 1 if successful, 0 otherwise */
+cupsdSendError(cupsd_client_t *con,    /* I - Connection */
+               http_status_t  code)    /* I - Error code */
 {
-  char         message[1024];  /* Message for user */
+  char         message[1024];          /* Message for user */
 
 
  /*
@@ -2101,8 +2190,8 @@ cupsdSendError(cupsd_client_t      *con,  /* I - Connection */
 
   cupsdLogRequest(con, code);
 
-  cupsdLogMessage(L_DEBUG, "cupsdSendError: %d code=%d (%s)", con->http.fd, code,
-             httpStatus(code));
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdSendError: %d code=%d (%s)",
+                  con->http.fd, code, httpStatus(code));
 
  /*
   * To work around bugs in some proxies, don't use Keep-Alive for some
@@ -2172,16 +2261,17 @@ cupsdSendError(cupsd_client_t      *con,        /* I - Connection */
  * 'cupsdSendFile()' - Send a file via HTTP.
  */
 
-int
-cupsdSendFile(cupsd_client_t    *con,
-         http_status_t code,
-        char        *filename,
-        char        *type,
-        struct stat *filestats)
+int                                    /* O - 0 on failure, 1 on success */
+cupsdSendFile(cupsd_client_t *con,     /* I - Client connection */
+              http_status_t  code,     /* I - HTTP status */
+             char           *filename, /* I - Filename */
+             char           *type,     /* I - File type */
+             struct stat    *filestats)/* O - File information */
 {
   con->file = open(filename, O_RDONLY);
 
-  cupsdLogMessage(L_DEBUG, "cupsdSendFile: %d file=%d", con->http.fd, con->file);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdSendFile: %d file=%d", con->http.fd,
+                  con->file);
 
   if (con->file < 0)
     return (0);
@@ -2193,7 +2283,8 @@ cupsdSendFile(cupsd_client_t    *con,
   if (!cupsdSendHeader(con, code, type))
     return (0);
 
-  if (httpPrintf(HTTP(con), "Last-Modified: %s\r\n", httpGetDateString(filestats->st_mtime)) < 0)
+  if (httpPrintf(HTTP(con), "Last-Modified: %s\r\n",
+                 httpGetDateString(filestats->st_mtime)) < 0)
     return (0);
   if (httpPrintf(HTTP(con), "Content-Length: %lu\r\n",
                  (unsigned long)filestats->st_size) < 0)
@@ -2201,7 +2292,8 @@ cupsdSendFile(cupsd_client_t    *con,
   if (httpPrintf(HTTP(con), "\r\n") < 0)
     return (0);
 
-  cupsdLogMessage(L_DEBUG2, "cupsdSendFile: Adding fd %d to OutputSet...", con->http.fd);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdSendFile: Adding fd %d to OutputSet...", con->http.fd);
 
   FD_SET(con->http.fd, OutputSet);
 
@@ -2213,10 +2305,10 @@ cupsdSendFile(cupsd_client_t    *con,
  * 'cupsdSendHeader()' - Send an HTTP request.
  */
 
-int                            /* O - 1 on success, 0 on failure */
-cupsdSendHeader(cupsd_client_t    *con,        /* I - Client to send to */
-           http_status_t code, /* I - HTTP status code */
-          char        *type)   /* I - MIME type of document */
+int                                    /* O - 1 on success, 0 on failure */
+cupsdSendHeader(cupsd_client_t *con,   /* I - Client to send to */
+                http_status_t  code,   /* I - HTTP status code */
+               char           *type)   /* I - MIME type of document */
 {
   if (httpPrintf(HTTP(con), "HTTP/%d.%d %d %s\r\n", con->http.version / 100,
                  con->http.version % 100, code, httpStatus(code)) < 0)
@@ -2230,7 +2322,8 @@ cupsdSendHeader(cupsd_client_t    *con,   /* I - Client to send to */
   {
     if (httpPrintf(HTTP(con), "Connection: Keep-Alive\r\n") < 0)
       return (0);
-    if (httpPrintf(HTTP(con), "Keep-Alive: timeout=%d\r\n", KeepAliveTimeout) < 0)
+    if (httpPrintf(HTTP(con), "Keep-Alive: timeout=%d\r\n",
+                   KeepAliveTimeout) < 0)
       return (0);
   }
   if (code == HTTP_METHOD_NOT_ALLOWED)
@@ -2249,13 +2342,15 @@ cupsdSendHeader(cupsd_client_t    *con, /* I - Client to send to */
       
     if (auth_type != AUTH_DIGEST)
     {
-      if (httpPrintf(HTTP(con), "WWW-Authenticate: Basic realm=\"CUPS\"\r\n") < 0)
+      if (httpPrintf(HTTP(con),
+                     "WWW-Authenticate: Basic realm=\"CUPS\"\r\n") < 0)
        return (0);
     }
     else
     {
-      if (httpPrintf(HTTP(con), "WWW-Authenticate: Digest realm=\"CUPS\", "
-                                "nonce=\"%s\"\r\n", con->http.hostname) < 0)
+      if (httpPrintf(HTTP(con),
+                     "WWW-Authenticate: Digest realm=\"CUPS\", nonce=\"%s\"\r\n",
+                    con->http.hostname) < 0)
        return (0);
     }
   }
@@ -2271,7 +2366,8 @@ cupsdSendHeader(cupsd_client_t    *con,   /* I - Client to send to */
   {
     if (!strcmp(type, "text/html"))
     {
-      if (httpPrintf(HTTP(con), "Content-Type: text/html; charset=utf-8\r\n") < 0)
+      if (httpPrintf(HTTP(con),
+                     "Content-Type: text/html; charset=utf-8\r\n") < 0)
         return (0);
     }
     else if (httpPrintf(HTTP(con), "Content-Type: %s\r\n", type) < 0)
@@ -2305,8 +2401,9 @@ cupsdUpdateCGI(void)
     * Fatal error on pipe - should never happen!
     */
 
-    cupsdLogMessage(L_CRIT, "cupsdUpdateCGI: error reading from CGI error pipe - %s",
-               strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_CRIT,
+                    "cupsdUpdateCGI: error reading from CGI error pipe - %s",
+                    strerror(errno));
   }
 }
 
@@ -2316,7 +2413,7 @@ cupsdUpdateCGI(void)
  */
 
 int                                    /* O - 1 if success, 0 if fail */
-cupsdWriteClient(cupsd_client_t *con)          /* I - Client connection */
+cupsdWriteClient(cupsd_client_t *con)  /* I - Client connection */
 {
   int          bytes;                  /* Number of bytes written */
   char         buf[16385];             /* Data buffer */
@@ -2325,8 +2422,9 @@ cupsdWriteClient(cupsd_client_t *con)             /* I - Client connection */
 
 
 #ifdef DEBUG
-  cupsdLogMessage(L_DEBUG2, "cupsdWriteClient(con=%p) %d response=%p, file=%d pipe_pid=%d",
-             con, con->http.fd, con->response, con->file, con->pipe_pid);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdWriteClient(con=%p) %d response=%p, file=%d pipe_pid=%d",
+                  con, con->http.fd, con->response, con->file, con->pipe_pid);
 #endif /* DEBUG */
 
   if (con->http.state != HTTP_GET_SEND &&
@@ -2340,8 +2438,9 @@ cupsdWriteClient(cupsd_client_t *con)             /* I - Client connection */
   }
   else if ((bytes = read(con->file, buf, sizeof(buf) - 1)) > 0)
   {
-    cupsdLogMessage(L_DEBUG2, "cupsdWriteClient: Read %d bytes from file %d...",
-               bytes, con->file);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdWriteClient: Read %d bytes from file %d...",
+                    bytes, con->file);
 
     if (con->pipe_pid && !con->got_fields)
     {
@@ -2362,7 +2461,7 @@ cupsdWriteClient(cupsd_client_t *con)             /* I - Client connection */
            bufptr[-1] = '\0';
          *bufptr++ = '\0';
 
-          cupsdLogMessage(L_DEBUG2, "Script header: %s", buf);
+          cupsdLogMessage(CUPSD_LOG_DEBUG2, "Script header: %s", buf);
 
           if (!con->sent_header)
          {
@@ -2391,7 +2490,8 @@ cupsdWriteClient(cupsd_client_t *con)             /* I - Client connection */
          if (strncasecmp(buf, "Status:", 7))
            httpPrintf(HTTP(con), "%s\r\n", buf);
 
-         cupsdLogMessage(L_DEBUG2, "cupsdWriteClient: %d %s", con->http.fd, buf);
+         cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdWriteClient: %d %s",
+                         con->http.fd, buf);
 
          /*
          * Update buffer...
@@ -2413,8 +2513,9 @@ cupsdWriteClient(cupsd_client_t *con)             /* I - Client connection */
        else if (*bufptr != '\r')
          con->field_col ++;
 
-      cupsdLogMessage(L_DEBUG2, "cupsdWriteClient: %d bytes=%d, got_fields=%d",
-                 con->http.fd, bytes, con->got_fields);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdWriteClient: %d bytes=%d, got_fields=%d",
+                      con->http.fd, bytes, con->got_fields);
 
       if (bytes > 0 && !con->got_fields)
       {
@@ -2436,8 +2537,9 @@ cupsdWriteClient(cupsd_client_t *con)             /* I - Client connection */
 
     if (httpWrite(HTTP(con), buf, bytes) < 0)
     {
-      cupsdLogMessage(L_DEBUG2, "cupsdWriteClient: %d Write of %d bytes failed!",
-                 con->http.fd, bytes);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdWriteClient: %d Write of %d bytes failed!",
+                      con->http.fd, bytes);
 
       cupsdCloseClient(con);
       return (0);
@@ -2448,7 +2550,8 @@ cupsdWriteClient(cupsd_client_t *con)             /* I - Client connection */
 
   if (bytes <= 0)
   {
-    cupsdLogMessage(L_DEBUG2, "cupsdWriteClient: %d bytes < 0", con->http.fd);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdWriteClient: %d bytes < 0",
+                    con->http.fd);
 
     cupsdLogRequest(con, HTTP_OK);
 
@@ -2465,8 +2568,9 @@ cupsdWriteClient(cupsd_client_t *con)             /* I - Client connection */
 
     con->http.state = HTTP_WAITING;
 
-    cupsdLogMessage(L_DEBUG2, "cupsdWriteClient: Removing fd %d from OutputSet...",
-               con->http.fd);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdWriteClient: Removing fd %d from OutputSet...",
+                    con->http.fd);
 
     FD_CLR(con->http.fd, OutputSet);
 
@@ -2474,16 +2578,18 @@ cupsdWriteClient(cupsd_client_t *con)           /* I - Client connection */
     {
       if (FD_ISSET(con->file, InputSet))
       {
-       cupsdLogMessage(L_DEBUG2, "cupsdWriteClient: Removing fd %d from InputSet...",
-                   con->file);
+       cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                       "cupsdWriteClient: Removing fd %d from InputSet...",
+                        con->file);
        FD_CLR(con->file, InputSet);
       }
 
       if (con->pipe_pid)
        cupsdEndProcess(con->pipe_pid, 0);
 
-      cupsdLogMessage(L_DEBUG2, "cupsdWriteClient: %d Closing data file %d.",
-                 con->http.fd, con->file);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdWriteClient: %d Closing data file %d.",
+                      con->http.fd, con->file);
 
       close(con->file);
       con->file     = -1;
@@ -2492,8 +2598,9 @@ cupsdWriteClient(cupsd_client_t *con)             /* I - Client connection */
 
     if (con->filename)
     {
-      cupsdLogMessage(L_DEBUG2, "cupsdWriteClient: %d Removing temp file %s",
-                 con->http.fd, con->filename);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdWriteClient: %d Removing temp file %s",
+                      con->http.fd, con->filename);
       unlink(con->filename);
       cupsdClearString(&con->filename);
     }
@@ -2525,7 +2632,9 @@ cupsdWriteClient(cupsd_client_t *con)             /* I - Client connection */
 
     if (con->pipe_pid && !FD_ISSET(con->file, InputSet))
     {
-      cupsdLogMessage(L_DEBUG2, "cupsdWriteClient: Adding fd %d to InputSet...", con->file);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdWriteClient: Adding fd %d to InputSet...",
+                     con->file);
       FD_SET(con->file, InputSet);
     }
   }
@@ -2540,13 +2649,14 @@ cupsdWriteClient(cupsd_client_t *con)           /* I - Client connection */
  * 'check_if_modified()' - Decode an "If-Modified-Since" line.
  */
 
-static int                                     /* O - 1 if modified since */
-check_if_modified(cupsd_client_t    *con,              /* I - Client connection */
-                  struct stat *filestats)      /* I - File information */
+static int                             /* O - 1 if modified since */
+check_if_modified(
+    cupsd_client_t *con,               /* I - Client connection */
+    struct stat    *filestats)         /* I - File information */
 {
-  char         *ptr;                           /* Pointer into field */
-  time_t       date;                           /* Time/date value */
-  int          size;                           /* Size/length value */
+  char         *ptr;                   /* Pointer into field */
+  time_t       date;                   /* Time/date value */
+  int          size;                   /* Size/length value */
 
 
   size = 0;
@@ -2556,8 +2666,9 @@ check_if_modified(cupsd_client_t    *con,         /* I - Client connection */
   if (*ptr == '\0')
     return (1);
 
-  cupsdLogMessage(L_DEBUG2, "check_if_modified: %d If-Modified-Since=\"%s\"",
-             con->http.fd, ptr);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "check_if_modified: %d If-Modified-Since=\"%s\"",
+                  con->http.fd, ptr);
 
   while (*ptr != '\0')
   {
@@ -2580,9 +2691,10 @@ check_if_modified(cupsd_client_t    *con,                /* I - Client connection */
     }
   }
 
-  cupsdLogMessage(L_DEBUG2, "check_if_modified: %d sizes=%d,%d dates=%d,%d",
-             con->http.fd, size, (int)filestats->st_size, (int)date,
-            (int)filestats->st_mtime);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "check_if_modified: %d sizes=%d,%d dates=%d,%d",
+                  con->http.fd, size, (int)filestats->st_size, (int)date,
+                 (int)filestats->st_mtime);
 
   return ((size != filestats->st_size && size != 0) ||
           (date < filestats->st_mtime && date != 0) ||
@@ -2595,7 +2707,7 @@ check_if_modified(cupsd_client_t    *con,         /* I - Client connection */
  */
 
 static void
-decode_auth(cupsd_client_t *con)               /* I - Client to decode to */
+decode_auth(cupsd_client_t *con)       /* I - Client to decode to */
 {
   char         *s,                     /* Authorization string */
                value[1024];            /* Value string */
@@ -2608,10 +2720,10 @@ decode_auth(cupsd_client_t *con)                /* I - Client to decode to */
 
   s = con->http.fields[HTTP_FIELD_AUTHORIZATION];
 
-  cupsdLogMessage(L_DEBUG2, "decode_auth(%p): Authorization string = \"%s\"",
-             con, s);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "decode_auth(%p): Authorization string = \"%s\"", con, s);
 
-  if (strncmp(s, "Basic", 5) == 0)
+  if (!strncmp(s, "Basic", 5))
   {
     s += 5;
     while (isspace(*s))
@@ -2625,8 +2737,9 @@ decode_auth(cupsd_client_t *con)          /* I - Client to decode to */
 
     if ((s = strchr(value, ':')) == NULL)
     {
-      cupsdLogMessage(L_DEBUG, "decode_auth: %d no colon in auth string \"%s\"",
-                con->http.fd, value);
+      cupsdLogMessage(CUPSD_LOG_DEBUG,
+                      "decode_auth: %d no colon in auth string \"%s\"",
+                     con->http.fd, value);
       return;
     }
 
@@ -2635,7 +2748,7 @@ decode_auth(cupsd_client_t *con)          /* I - Client to decode to */
     strlcpy(con->username, value, sizeof(con->username));
     strlcpy(con->password, s, sizeof(con->password));
   }
-  else if (strncmp(s, "Local", 5) == 0)
+  else if (!strncmp(s, "Local", 5))
   {
     s += 5;
     while (isspace(*s))
@@ -2644,7 +2757,7 @@ decode_auth(cupsd_client_t *con)          /* I - Client to decode to */
     if ((username = cupsdFindCert(s)) != NULL)
       strlcpy(con->username, username, sizeof(con->username));
   }
-  else if (strncmp(s, "Digest", 5) == 0)
+  else if (!strncmp(s, "Digest", 6))
   {
    /*
     * Get the username and password from the Digest attributes...
@@ -2659,8 +2772,8 @@ decode_auth(cupsd_client_t *con)          /* I - Client to decode to */
       strlcpy(con->password, value, sizeof(con->password));
   }
 
-  cupsdLogMessage(L_DEBUG2, "decode_auth: %d username=\"%s\"",
-             con->http.fd, con->username);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "decode_auth: %d username=\"%s\"",
+                  con->http.fd, con->username);
 }
 
 
@@ -2669,10 +2782,10 @@ decode_auth(cupsd_client_t *con)                /* I - Client to decode to */
  */
 
 static char *                          /* O  - Real filename */
-get_file(cupsd_client_t    *con,               /* I  - Client connection */
-         struct stat *filestats,       /* O  - File information */
-         char        *filename,                /* IO - Filename buffer */
-         int         len)              /* I  - Buffer length */
+get_file(cupsd_client_t *con,          /* I  - Client connection */
+         struct stat    *filestats,    /* O  - File information */
+         char           *filename,     /* IO - Filename buffer */
+         int            len)           /* I  - Buffer length */
 {
   int          status;                 /* Status of filesystem calls */
   char         *ptr;                   /* Pointer info filename */
@@ -2785,8 +2898,9 @@ get_file(cupsd_client_t    *con,          /* I  - Client connection */
 #endif /* HAVE_PYTHON */
   }
 
-  cupsdLogMessage(L_DEBUG2, "get_file: %d filename=%s size=%d",
-             con->http.fd, filename, status ? -1 : (int)filestats->st_size);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_file: %d filename=%s size=%d",
+                  con->http.fd, filename,
+                 status ? -1 : (int)filestats->st_size);
 
   if (!status)
     con->http.data_remaining = (int)filestats->st_size;
@@ -2823,7 +2937,7 @@ install_conf_file(cupsd_client_t *con)    /* I - Connection */
   snprintf(newfile, sizeof(newfile), "%s%s.N", ServerRoot, con->uri + 11);
   snprintf(oldfile, sizeof(oldfile), "%s%s.O", ServerRoot, con->uri + 11);
 
-  cupsdLogMessage(L_INFO, "Installing config file \"%s\"...", conffile);
+  cupsdLogMessage(CUPSD_LOG_INFO, "Installing config file \"%s\"...", conffile);
 
  /*
   * Get the owner, group, and permissions of the configuration file.
@@ -2844,16 +2958,16 @@ install_conf_file(cupsd_client_t *con)  /* I - Connection */
 
   if ((in = cupsFileOpen(con->filename, "rb")) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "Unable to open request file \"%s\" - %s",
-               con->filename, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open request file \"%s\" - %s",
+                    con->filename, strerror(errno));
     return (HTTP_SERVER_ERROR);
   }
 
   if ((out = cupsFileOpen(newfile, "wb")) == NULL)
   {
     cupsFileClose(in);
-    cupsdLogMessage(L_ERROR, "Unable to open config file \"%s\" - %s",
-               newfile, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open config file \"%s\" - %s",
+                    newfile, strerror(errno));
     return (HTTP_SERVER_ERROR);
   }
 
@@ -2867,8 +2981,9 @@ install_conf_file(cupsd_client_t *con)    /* I - Connection */
   while ((bytes = cupsFileRead(in, buffer, sizeof(buffer))) > 0)
     if (cupsFileWrite(out, buffer, bytes) < bytes)
     {
-      cupsdLogMessage(L_ERROR, "Unable to copy to config file \"%s\" - %s",
-                newfile, strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Unable to copy to config file \"%s\" - %s",
+                     newfile, strerror(errno));
 
       cupsFileClose(in);
       cupsFileClose(out);
@@ -2884,8 +2999,9 @@ install_conf_file(cupsd_client_t *con)    /* I - Connection */
   cupsFileClose(in);
   if (cupsFileClose(out))
   {
-    cupsdLogMessage(L_ERROR, "Error file closing config file \"%s\" - %s",
-               newfile, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "Error file closing config file \"%s\" - %s",
+                    newfile, strerror(errno));
 
     unlink(newfile);
 
@@ -2907,8 +3023,9 @@ install_conf_file(cupsd_client_t *con)    /* I - Connection */
   if (unlink(oldfile))
     if (errno != ENOENT)
     {
-      cupsdLogMessage(L_ERROR, "Unable to remove backup config file \"%s\" - %s",
-                oldfile, strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Unable to remove backup config file \"%s\" - %s",
+                     oldfile, strerror(errno));
 
       unlink(newfile);
 
@@ -2918,8 +3035,9 @@ install_conf_file(cupsd_client_t *con)    /* I - Connection */
   if (rename(conffile, oldfile))
     if (errno != ENOENT)
     {
-      cupsdLogMessage(L_ERROR, "Unable to rename old config file \"%s\" - %s",
-                conffile, strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Unable to rename old config file \"%s\" - %s",
+                     conffile, strerror(errno));
 
       unlink(newfile);
 
@@ -2928,8 +3046,9 @@ install_conf_file(cupsd_client_t *con)    /* I - Connection */
 
   if (rename(newfile, conffile))
   {
-    cupsdLogMessage(L_ERROR, "Unable to rename new config file \"%s\" - %s",
-               newfile, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "Unable to rename new config file \"%s\" - %s",
+                    newfile, strerror(errno));
 
     rename(oldfile, conffile);
     unlink(newfile);
@@ -2996,12 +3115,12 @@ is_path_absolute(const char *path)      /* I - Input path */
  */
 
 static int                             /* O - Process ID */
-pipe_command(cupsd_client_t *con,              /* I - Client connection */
-             int      infile,          /* I - Standard input for command */
-             int      *outfile,                /* O - Standard output for command */
-            char     *command,         /* I - Command to run */
-            char     *options,         /* I - Options for command */
-            int      root)             /* I - Run as root? */
+pipe_command(cupsd_client_t *con,      /* I - Client connection */
+             int            infile,    /* I - Standard input for command */
+             int            *outfile,  /* O - Standard output for command */
+            char           *command,   /* I - Command to run */
+            char           *options,   /* I - Options for command */
+            int            root)       /* I - Run as root? */
 {
   int          i;                      /* Looping var */
   int          pid;                    /* Process ID */
@@ -3025,46 +3144,6 @@ pipe_command(cupsd_client_t *con,                /* I - Client connection */
                script_name[1024],      /* SCRIPT_NAME environment variable */
                server_name[1024],      /* SERVER_NAME environment variable */
                server_port[1024];      /* SERVER_PORT environment variable */
-  static const char * const locale_encodings[] =
-               {                       /* Locale charset names */
-                 "ASCII",      "ISO8859-1",    "ISO8859-2",    "ISO8859-3",
-                 "ISO8859-4",  "ISO8859-5",    "ISO8859-6",    "ISO8859-7",
-                 "ISO8859-8",  "ISO8859-9",    "ISO8859-10",   "UTF-8",
-                 "ISO8859-13", "ISO8859-14",   "ISO8859-15",   "CP874",
-                 "CP1250",     "CP1251",       "CP1252",       "CP1253",
-                 "CP1254",     "CP1255",       "CP1256",       "CP1257",
-                 "CP1258",     "KOI8R",        "KOI8U",        "ISO8859-11",
-                 "ISO8859-16", "",             "",             "",
-
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-
-                 "CP932",      "CP936",        "CP949",        "CP950",
-                 "CP1361",     "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-                 "",           "",             "",             "",
-
-                 "EUC-CN",     "EUC-JP",       "EUC-KR",       "EUC-TW"
-               };
 
 
  /*
@@ -3083,8 +3162,9 @@ pipe_command(cupsd_client_t *con,         /* I - Client connection */
   * be consistent with Apache...
   */
 
-  cupsdLogMessage(L_DEBUG2, "pipe_command: command=\"%s\", options=\"%s\"",
-             command, options);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "pipe_command: command=\"%s\", options=\"%s\"",
+                  command, options);
 
   strlcpy(argbuf, options, sizeof(argbuf));
 
@@ -3172,8 +3252,7 @@ pipe_command(cupsd_client_t *con,         /* I - Client connection */
   */
 
   if (con->language)
-    snprintf(lang, sizeof(lang), "LANG=%s.%s", con->language->language,
-             locale_encodings[con->language->encoding]);
+    snprintf(lang, sizeof(lang), "LANG=%s.UTF-8", con->language->language);
   else
     strcpy(lang, "LANG=C");
 
@@ -3234,7 +3313,7 @@ pipe_command(cupsd_client_t *con,         /* I - Client connection */
   if (con->operation == HTTP_GET)
   {
     for (i = 0; i < argc; i ++)
-      cupsdLogMessage(L_DEBUG2, "argv[%d] = \"%s\"", i, argv[i]);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2, "argv[%d] = \"%s\"", i, argv[i]);
 
     envp[envc ++] = "REQUEST_METHOD=GET";
 
@@ -3271,12 +3350,14 @@ pipe_command(cupsd_client_t *con,               /* I - Client connection */
 
   envp[envc] = NULL;
 
-  if (LogLevel == L_DEBUG2)
+  if (LogLevel == CUPSD_LOG_DEBUG2)
   {
     for (i = 0; i < argc; i ++)
-      cupsdLogMessage(L_DEBUG2, "pipe_command: argv[%d] = \"%s\"", i, argv[i]);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "pipe_command: argv[%d] = \"%s\"", i, argv[i]);
     for (i = 0; i < envc; i ++)
-      cupsdLogMessage(L_DEBUG2, "pipe_command: envp[%d] = \"%s\"", i, envp[i]);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "pipe_command: envp[%d] = \"%s\"", i, envp[i]);
   }
 
  /*
@@ -3287,8 +3368,8 @@ pipe_command(cupsd_client_t *con,         /* I - Client connection */
   {
     cupsdClearString(&query_string);
 
-    cupsdLogMessage(L_ERROR, "Unable to create pipes for CGI %s - %s",
-               argv[0], strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to create pipes for CGI %s - %s",
+                    argv[0], strerror(errno));
     return (0);
   }
 
@@ -3303,8 +3384,8 @@ pipe_command(cupsd_client_t *con,         /* I - Client connection */
     * Error - can't fork!
     */
 
-    cupsdLogMessage(L_ERROR, "Unable to fork for CGI %s - %s", argv[0],
-               strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to fork for CGI %s - %s", argv[0],
+                    strerror(errno));
 
     cupsdClosePipe(fds);
     pid = 0;
@@ -3318,7 +3399,7 @@ pipe_command(cupsd_client_t *con,         /* I - Client connection */
     if (con->username[0])
       cupsdAddCert(pid, con->username);
 
-    cupsdLogMessage(L_DEBUG, "CGI %s started - PID = %d", command, pid);
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "CGI %s started - PID = %d", command, pid);
 
     *outfile = fds[0];
     close(fds[1]);
@@ -3335,12 +3416,13 @@ pipe_command(cupsd_client_t *con,               /* I - Client connection */
  * 'CDSAReadFunc()' - Read function for CDSA decryption code.
  */
 
-static OSStatus                                        /* O  - -1 on error, 0 on success */
-CDSAReadFunc(SSLConnectionRef connection,      /* I  - SSL/TLS connection */
-             void             *data,           /* I  - Data buffer */
-            size_t           *dataLength)      /* IO - Number of bytes */
+static OSStatus                                /* O  - -1 on error, 0 on success */
+CDSAReadFunc(
+    SSLConnectionRef connection,       /* I  - SSL/TLS connection */
+    void             *data,            /* I  - Data buffer */
+    size_t           *dataLength)      /* IO - Number of bytes */
 {
-  ssize_t      bytes;                          /* Number of bytes read */
+  ssize_t      bytes;                  /* Number of bytes read */
 
 
   bytes = recv((int)connection, data, *dataLength, 0);
@@ -3358,10 +3440,11 @@ CDSAReadFunc(SSLConnectionRef connection,       /* I  - SSL/TLS connection */
  * 'CDSAWriteFunc()' - Write function for CDSA encryption code.
  */
 
-static OSStatus                                        /* O  - -1 on error, 0 on success */
-CDSAWriteFunc(SSLConnectionRef connection,     /* I  - SSL/TLS connection */
-              const void       *data,          /* I  - Data buffer */
-             size_t           *dataLength)     /* IO - Number of bytes */
+static OSStatus                                /* O  - -1 on error, 0 on success */
+CDSAWriteFunc(
+    SSLConnectionRef connection,       /* I  - SSL/TLS connection */
+    const void       *data,            /* I  - Data buffer */
+    size_t           *dataLength)      /* IO - Number of bytes */
 {
   ssize_t bytes;
 
index d0fe636d6c94c9b7b52373fc89408e7e9151409d..ab06a805ee9881f2c1a569eeeb61544cef76a607 100644 (file)
 
 struct cupsd_client_s
 {
-  http_t       http;                   /* HTTP client connection */
-  ipp_t                *request,               /* IPP request information */
-               *response;              /* IPP response information */
-  cupsd_location_t     *best;                  /* Best match for AAA */
-  time_t       start;                  /* Request start time */
-  http_state_t operation;              /* Request operation */
-  int          bytes;                  /* Bytes transferred for this request */
-  char         username[33],           /* Username from Authorization: line */
-               password[33],           /* Password from Authorization: line */
-               uri[HTTP_MAX_URI],      /* Localized URL/URI for GET/PUT */
-               *filename,              /* Filename of output file */
-               *command,               /* Command to run */
-               *options;               /* Options for command */
-  int          file;                   /* Input/output file */
-  int          file_ready;             /* Input ready on file/pipe? */
-  int          pipe_pid;               /* Pipe process ID (or 0 if not a pipe) */
-  int          sent_header,            /* Non-zero if sent HTTP header */
-               got_fields,             /* Non-zero if all fields seen */
-               field_col;              /* Column within line */
-  cups_lang_t  *language;              /* Language to use */
+  http_t               http;           /* HTTP client connection */
+  ipp_t                        *request,       /* IPP request information */
+                       *response;      /* IPP response information */
+  cupsd_location_t     *best;          /* Best match for AAA */
+  time_t               start;          /* Request start time */
+  http_state_t         operation;      /* Request operation */
+  int                  bytes;          /* Bytes transferred for this request */
+  char                 username[33],   /* Username from Authorization: line */
+                       password[33],   /* Password from Authorization: line */
+                       uri[HTTP_MAX_URI],
+                                       /* Localized URL/URI for GET/PUT */
+                       *filename,      /* Filename of output file */
+                       *command,       /* Command to run */
+                       *options;       /* Options for command */
+  int                  file;           /* Input/output file */
+  int                  file_ready;     /* Input ready on file/pipe? */
+  int                  pipe_pid;       /* Pipe process ID (or 0 if not a pipe) */
+  int                  sent_header,    /* Non-zero if sent HTTP header */
+                       got_fields,     /* Non-zero if all fields seen */
+                       field_col;      /* Column within line */
+  cups_lang_t          *language;      /* Language to use */
 #ifdef HAVE_SSL
-  int          auto_ssl;               /* Automatic test for SSL/TLS */
+  int                  auto_ssl;       /* Automatic test for SSL/TLS */
 #endif /* HAVE_SSL */
-  char         servername[256];        /* Server name for connection */
-  int          serverport;             /* Server port for connection */
+  char                 servername[256];/* Server name for connection */
+  int                  serverport;     /* Server port for connection */
 };
 
 #define HTTP(con) &((con)->http)
@@ -106,17 +107,19 @@ extern void       cupsdCloseAllClients(void);
 extern int     cupsdCloseClient(cupsd_client_t *con);
 extern int     cupsdEncryptClient(cupsd_client_t *con);
 extern int     cupsdIsCGI(cupsd_client_t *con, const char *filename,
-                     struct stat *filestats, mime_type_t *type);
+                          struct stat *filestats, mime_type_t *type);
 extern void    cupsdPauseListening(void);
 extern int     cupsdProcessIPPRequest(cupsd_client_t *con);
 extern int     cupsdReadClient(cupsd_client_t *con);
 extern void    cupsdResumeListening(void);
-extern int     cupsdSendCommand(cupsd_client_t *con, char *command, char *options,
-                           int root);
+extern int     cupsdSendCommand(cupsd_client_t *con, char *command,
+                                char *options, int root);
 extern int     cupsdSendError(cupsd_client_t *con, http_status_t code);
-extern int     cupsdSendFile(cupsd_client_t *con, http_status_t code, char *filename,
-                        char *type, struct stat *filestats);
-extern int     cupsdSendHeader(cupsd_client_t *con, http_status_t code, char *type);
+extern int     cupsdSendFile(cupsd_client_t *con, http_status_t code,
+                             char *filename, char *type,
+                             struct stat *filestats);
+extern int     cupsdSendHeader(cupsd_client_t *con, http_status_t code,
+                               char *type);
 extern void    cupsdShutdownClient(cupsd_client_t *con);
 extern void    cupsdStartListening(void);
 extern void    cupsdStopListening(void);
index 549de038e4a2cea1c5346f864e6063396bff92f4..8ae27c83751aa5a35385ca44f96b94e911ff0458 100644 (file)
  *
  * Contents:
  *
- *   cupsdReadConfiguration()  - Read the cupsd.conf file.
- *   get_address()        - Get an address + port number from a line.
- *   get_addr_and_mask()  - Get an IP address and netmask.
- *   parse_aaa()          - Parse authentication, authorization, and
- *                          access control lines.
- *   read_configuration() - Read a configuration file.
- *   read_location()      - Read a <Location path> definition.
- *   read_policy()        - Read a <Policy name> definition.
- *   CDSAGetServerCerts() - Convert a keychain name into the CFArrayRef
- *                          required by SSLSetCertificate.
+ *   cupsdReadConfiguration() - Read the cupsd.conf file.
+ *   get_address()            - Get an address + port number from a line.
+ *   get_addr_and_mask()      - Get an IP address and netmask.
+ *   parse_aaa()              - Parse authentication, authorization, and
+ *                              access control lines.
+ *   read_configuration()     - Read a configuration file.
+ *   read_location()          - Read a <Location path> definition.
+ *   read_policy()            - Read a <Policy name> definition.
+ *   CDSAGetServerCerts()     - Convert a keychain name into the CFArrayRef
+ *                              required by SSLSetCertificate.
  */
 
 /*
 #include <sys/utsname.h>
 #include <cups/dir.h>
 
-#ifdef HAVE_DOMAINSOCKETS
-#  include <sys/un.h>
-#endif /* HAVE_DOMAINSOCKETS */
-
 #ifdef HAVE_CDSASSL
 #  include <Security/SecureTransport.h>
 #  include <Security/SecIdentitySearch.h>
  * Configuration variable structure...
  */
 
-typedef struct
+typedef enum
 {
-  char *name;          /* Name of variable */
-  void *ptr;           /* Pointer to variable */
-  int  type;           /* Type (int, string, address) */
-} var_t;
+  CUPSD_VARTYPE_INTEGER,               /* Integer option */
+  CUPSD_VARTYPE_STRING,                        /* String option */
+  CUPSD_VARTYPE_BOOLEAN                        /* Boolean option */
+} cupsd_vartype_t;
 
-#define VAR_INTEGER    0
-#define VAR_STRING     1
-#define VAR_BOOLEAN    2
+typedef struct
+{
+  char                 *name;          /* Name of variable */
+  void                 *ptr;           /* Pointer to variable */
+  cupsd_vartype_t      type;           /* Type (int, string, address) */
+} cupsd_var_t;
 
 
 /*
  * Local globals...
  */
 
-static var_t   variables[] =
+static cupsd_var_t     variables[] =
 {
-  { "AccessLog",               &AccessLog,             VAR_STRING },
-  { "AutoPurgeJobs",           &JobAutoPurge,          VAR_BOOLEAN },
-  { "BrowseInterval",          &BrowseInterval,        VAR_INTEGER },
-  { "BrowseLocalOptions",      &BrowseLocalOptions,    VAR_STRING },
-  { "BrowsePort",              &BrowsePort,            VAR_INTEGER },
-  { "BrowseRemoteOptions",     &BrowseRemoteOptions,   VAR_STRING },
-  { "BrowseShortNames",                &BrowseShortNames,      VAR_BOOLEAN },
-  { "BrowseTimeout",           &BrowseTimeout,         VAR_INTEGER },
-  { "Browsing",                        &Browsing,              VAR_BOOLEAN },
-  { "CacheDir",                        &CacheDir,              VAR_STRING },
-  { "Classification",          &Classification,        VAR_STRING },
-  { "ClassifyOverride",                &ClassifyOverride,      VAR_BOOLEAN },
-  { "ConfigFilePerm",          &ConfigFilePerm,        VAR_INTEGER },
-  { "DataDir",                 &DataDir,               VAR_STRING },
-  { "DefaultCharset",          &DefaultCharset,        VAR_STRING },
-  { "DefaultLanguage",         &DefaultLanguage,       VAR_STRING },
-  { "DefaultPolicy",           &DefaultPolicy,         VAR_STRING },
-  { "DocumentRoot",            &DocumentRoot,          VAR_STRING },
-  { "ErrorLog",                        &ErrorLog,              VAR_STRING },
-  { "FaxRetryLimit",           &FaxRetryLimit,         VAR_INTEGER },
-  { "FaxRetryInterval",                &FaxRetryInterval,      VAR_INTEGER },
-  { "FileDevice",              &FileDevice,            VAR_BOOLEAN },
-  { "FilterLimit",             &FilterLimit,           VAR_INTEGER },
-  { "FilterNice",              &FilterNice,            VAR_INTEGER },
-  { "FontPath",                        &FontPath,              VAR_STRING },
-  { "HideImplicitMembers",     &HideImplicitMembers,   VAR_BOOLEAN },
-  { "ImplicitClasses",         &ImplicitClasses,       VAR_BOOLEAN },
-  { "ImplicitAnyClasses",      &ImplicitAnyClasses,    VAR_BOOLEAN },
-  { "KeepAliveTimeout",                &KeepAliveTimeout,      VAR_INTEGER },
-  { "KeepAlive",               &KeepAlive,             VAR_BOOLEAN },
-  { "LimitRequestBody",                &MaxRequestSize,        VAR_INTEGER },
-  { "ListenBackLog",           &ListenBackLog,         VAR_INTEGER },
-  { "LogFilePerm",             &LogFilePerm,           VAR_INTEGER },
-  { "MaxActiveJobs",           &MaxActiveJobs,         VAR_INTEGER },
-  { "MaxClients",              &MaxClients,            VAR_INTEGER },
-  { "MaxClientsPerHost",       &MaxClientsPerHost,     VAR_INTEGER },
-  { "MaxCopies",               &MaxCopies,             VAR_INTEGER },
-  { "MaxJobs",                 &MaxJobs,               VAR_INTEGER },
-  { "MaxJobsPerPrinter",       &MaxJobsPerPrinter,     VAR_INTEGER },
-  { "MaxJobsPerUser",          &MaxJobsPerUser,        VAR_INTEGER },
-  { "MaxLogSize",              &MaxLogSize,            VAR_INTEGER },
-  { "MaxPrinterHistory",       &MaxPrinterHistory,     VAR_INTEGER },
-  { "MaxRequestSize",          &MaxRequestSize,        VAR_INTEGER },
-  { "PageLog",                 &PageLog,               VAR_STRING },
-  { "PreserveJobFiles",                &JobFiles,              VAR_BOOLEAN },
-  { "PreserveJobHistory",      &JobHistory,            VAR_BOOLEAN },
-  { "Printcap",                        &Printcap,              VAR_STRING },
-  { "PrintcapGUI",             &PrintcapGUI,           VAR_STRING },
-  { "ReloadTimeout",           &ReloadTimeout,         VAR_INTEGER },
-  { "RemoteRoot",              &RemoteRoot,            VAR_STRING },
-  { "RequestRoot",             &RequestRoot,           VAR_STRING },
-  { "RIPCache",                        &RIPCache,              VAR_STRING },
-  { "RunAsUser",               &RunAsUser,             VAR_BOOLEAN },
-  { "RootCertDuration",                &RootCertDuration,      VAR_INTEGER },
-  { "ServerAdmin",             &ServerAdmin,           VAR_STRING },
-  { "ServerBin",               &ServerBin,             VAR_STRING },
+  { "AccessLog",               &AccessLog,             CUPSD_VARTYPE_STRING },
+  { "AutoPurgeJobs",           &JobAutoPurge,          CUPSD_VARTYPE_BOOLEAN },
+  { "BrowseInterval",          &BrowseInterval,        CUPSD_VARTYPE_INTEGER },
+  { "BrowseLocalOptions",      &BrowseLocalOptions,    CUPSD_VARTYPE_STRING },
+  { "BrowsePort",              &BrowsePort,            CUPSD_VARTYPE_INTEGER },
+  { "BrowseRemoteOptions",     &BrowseRemoteOptions,   CUPSD_VARTYPE_STRING },
+  { "BrowseShortNames",                &BrowseShortNames,      CUPSD_VARTYPE_BOOLEAN },
+  { "BrowseTimeout",           &BrowseTimeout,         CUPSD_VARTYPE_INTEGER },
+  { "Browsing",                        &Browsing,              CUPSD_VARTYPE_BOOLEAN },
+  { "CacheDir",                        &CacheDir,              CUPSD_VARTYPE_STRING },
+  { "Classification",          &Classification,        CUPSD_VARTYPE_STRING },
+  { "ClassifyOverride",                &ClassifyOverride,      CUPSD_VARTYPE_BOOLEAN },
+  { "ConfigFilePerm",          &ConfigFilePerm,        CUPSD_VARTYPE_INTEGER },
+  { "DataDir",                 &DataDir,               CUPSD_VARTYPE_STRING },
+  { "DefaultCharset",          &DefaultCharset,        CUPSD_VARTYPE_STRING },
+  { "DefaultLanguage",         &DefaultLanguage,       CUPSD_VARTYPE_STRING },
+  { "DefaultPolicy",           &DefaultPolicy,         CUPSD_VARTYPE_STRING },
+  { "DocumentRoot",            &DocumentRoot,          CUPSD_VARTYPE_STRING },
+  { "ErrorLog",                        &ErrorLog,              CUPSD_VARTYPE_STRING },
+  { "FaxRetryLimit",           &FaxRetryLimit,         CUPSD_VARTYPE_INTEGER },
+  { "FaxRetryInterval",                &FaxRetryInterval,      CUPSD_VARTYPE_INTEGER },
+  { "FileDevice",              &FileDevice,            CUPSD_VARTYPE_BOOLEAN },
+  { "FilterLimit",             &FilterLimit,           CUPSD_VARTYPE_INTEGER },
+  { "FilterNice",              &FilterNice,            CUPSD_VARTYPE_INTEGER },
+  { "FontPath",                        &FontPath,              CUPSD_VARTYPE_STRING },
+  { "HideImplicitMembers",     &HideImplicitMembers,   CUPSD_VARTYPE_BOOLEAN },
+  { "ImplicitClasses",         &ImplicitClasses,       CUPSD_VARTYPE_BOOLEAN },
+  { "ImplicitAnyClasses",      &ImplicitAnyClasses,    CUPSD_VARTYPE_BOOLEAN },
+  { "KeepAliveTimeout",                &KeepAliveTimeout,      CUPSD_VARTYPE_INTEGER },
+  { "KeepAlive",               &KeepAlive,             CUPSD_VARTYPE_BOOLEAN },
+  { "LimitRequestBody",                &MaxRequestSize,        CUPSD_VARTYPE_INTEGER },
+  { "ListenBackLog",           &ListenBackLog,         CUPSD_VARTYPE_INTEGER },
+  { "LogFilePerm",             &LogFilePerm,           CUPSD_VARTYPE_INTEGER },
+  { "MaxActiveJobs",           &MaxActiveJobs,         CUPSD_VARTYPE_INTEGER },
+  { "MaxClients",              &MaxClients,            CUPSD_VARTYPE_INTEGER },
+  { "MaxClientsPerHost",       &MaxClientsPerHost,     CUPSD_VARTYPE_INTEGER },
+  { "MaxCopies",               &MaxCopies,             CUPSD_VARTYPE_INTEGER },
+  { "MaxJobs",                 &MaxJobs,               CUPSD_VARTYPE_INTEGER },
+  { "MaxJobsPerPrinter",       &MaxJobsPerPrinter,     CUPSD_VARTYPE_INTEGER },
+  { "MaxJobsPerUser",          &MaxJobsPerUser,        CUPSD_VARTYPE_INTEGER },
+  { "MaxLogSize",              &MaxLogSize,            CUPSD_VARTYPE_INTEGER },
+  { "MaxPrinterHistory",       &MaxPrinterHistory,     CUPSD_VARTYPE_INTEGER },
+  { "MaxRequestSize",          &MaxRequestSize,        CUPSD_VARTYPE_INTEGER },
+  { "PageLog",                 &PageLog,               CUPSD_VARTYPE_STRING },
+  { "PreserveJobFiles",                &JobFiles,              CUPSD_VARTYPE_BOOLEAN },
+  { "PreserveJobHistory",      &JobHistory,            CUPSD_VARTYPE_BOOLEAN },
+  { "Printcap",                        &Printcap,              CUPSD_VARTYPE_STRING },
+  { "PrintcapGUI",             &PrintcapGUI,           CUPSD_VARTYPE_STRING },
+  { "ReloadTimeout",           &ReloadTimeout,         CUPSD_VARTYPE_INTEGER },
+  { "RemoteRoot",              &RemoteRoot,            CUPSD_VARTYPE_STRING },
+  { "RequestRoot",             &RequestRoot,           CUPSD_VARTYPE_STRING },
+  { "RIPCache",                        &RIPCache,              CUPSD_VARTYPE_STRING },
+  { "RunAsUser",               &RunAsUser,             CUPSD_VARTYPE_BOOLEAN },
+  { "RootCertDuration",                &RootCertDuration,      CUPSD_VARTYPE_INTEGER },
+  { "ServerAdmin",             &ServerAdmin,           CUPSD_VARTYPE_STRING },
+  { "ServerBin",               &ServerBin,             CUPSD_VARTYPE_STRING },
 #ifdef HAVE_SSL
-  { "ServerCertificate",       &ServerCertificate,     VAR_STRING },
+  { "ServerCertificate",       &ServerCertificate,     CUPSD_VARTYPE_STRING },
 #  if defined(HAVE_LIBSSL) || defined(HAVE_GNUTLS)
-  { "ServerKey",               &ServerKey,             VAR_STRING },
+  { "ServerKey",               &ServerKey,             CUPSD_VARTYPE_STRING },
 #  endif /* HAVE_LIBSSL || HAVE_GNUTLS */
 #endif /* HAVE_SSL */
-  { "ServerName",              &ServerName,            VAR_STRING },
-  { "ServerRoot",              &ServerRoot,            VAR_STRING },
-  { "StateDir",                        &StateDir,              VAR_STRING },
-  { "TempDir",                 &TempDir,               VAR_STRING },
-  { "Timeout",                 &Timeout,               VAR_INTEGER }
+  { "ServerName",              &ServerName,            CUPSD_VARTYPE_STRING },
+  { "ServerRoot",              &ServerRoot,            CUPSD_VARTYPE_STRING },
+  { "StateDir",                        &StateDir,              CUPSD_VARTYPE_STRING },
+  { "TempDir",                 &TempDir,               CUPSD_VARTYPE_STRING },
+  { "Timeout",                 &Timeout,               CUPSD_VARTYPE_INTEGER }
 };
 #define NUM_VARS       (sizeof(variables) / sizeof(variables[0]))
 
@@ -203,13 +202,12 @@ cupsdReadConfiguration(void)
                *slash;                 /* Directory separator */
   char         type[MIME_MAX_SUPER + MIME_MAX_TYPE];
                                        /* MIME type name */
-  char         *language;              /* Language string */
+  cups_lang_t  *language;              /* Language */
   struct passwd        *user;                  /* Default user */
   struct group *group;                 /* Default group */
   char         *old_serverroot,        /* Old ServerRoot */
                *old_requestroot;       /* Old RequestRoot */
 
-
  /*
   * Shutdown the server...
   */
@@ -259,8 +257,8 @@ cupsdReadConfiguration(void)
   if (NumListeners > 0)
   {
 #ifdef HAVE_DOMAINSOCKETS
-    int i;                             /* Looping var */
-    cupsd_listener_t   *lis;                   /* Current listening socket */
+    int                        i;              /* Looping var */
+    cupsd_listener_t   *lis;           /* Current listening socket */
 
     for (i = NumListeners, lis = Listeners; i > 0; i --, lis ++)
       if (lis->address.sin_family == AF_LOCAL)
@@ -311,13 +309,14 @@ cupsdReadConfiguration(void)
 #  endif /* HAVE_CDSASSL */
 #endif /* HAVE_SSL */
 
-  if ((language = DEFAULT_LANGUAGE) == NULL)
-    language = "en";
-  else if (!strcmp(language, "C") || !strcmp(language, "POSIX"))
-    language = "en";
+  language = cupsLangDefault();
+
+  if (!strcmp(language->language, "C") || !strcmp(language->language, "POSIX"))
+    cupsdSetString(&DefaultLanguage, "en");
+  else
+    cupsdSetString(&DefaultLanguage, language->language);
 
-  cupsdSetString(&DefaultLanguage, language);
-  cupsdSetString(&DefaultCharset, DEFAULT_CHARSET);
+  cupsdSetString(&DefaultCharset, cupsEncodingName(language->encoding));
 
   cupsdSetString(&RIPCache, "8m");
 
@@ -419,7 +418,7 @@ cupsdReadConfiguration(void)
   KeepAliveTimeout    = DEFAULT_KEEPALIVE;
   ListenBackLog       = SOMAXCONN;
   LogFilePerm         = 0644;
-  LogLevel            = L_ERROR;
+  LogLevel            = CUPSD_LOG_ERROR;
   MaxClients          = 100;
   MaxClientsPerHost   = 0;
   MaxLogSize          = 1024 * 1024;
@@ -499,7 +498,8 @@ cupsdReadConfiguration(void)
   * Log the configuration file that was used...
   */
 
-  cupsdLogMessage(L_INFO, "Loaded configuration file \"%s\"", ConfigurationFile);
+  cupsdLogMessage(CUPSD_LOG_INFO, "Loaded configuration file \"%s\"",
+                  ConfigurationFile);
 
  /*
   * Validate the Group and SystemGroup settings - they cannot be the same,
@@ -519,8 +519,9 @@ cupsdReadConfiguration(void)
       * Log the error and reset the group to a safe value...
       */
 
-      cupsdLogMessage(L_NOTICE, "Group and SystemGroup cannot use the same groups!");
-      cupsdLogMessage(L_INFO, "Resetting Group to \"nobody\"...");
+      cupsdLogMessage(CUPSD_LOG_NOTICE,
+                      "Group and SystemGroup cannot use the same groups!");
+      cupsdLogMessage(CUPSD_LOG_INFO, "Resetting Group to \"nobody\"...");
 
       group = getgrnam("nobody");
       endgrent();
@@ -550,7 +551,8 @@ cupsdReadConfiguration(void)
     * No listeners!
     */
 
-    cupsdLogMessage(L_EMERG, "No valid Listen or Port lines were found in the configuration file!");
+    cupsdLogMessage(CUPSD_LOG_EMERG,
+                    "No valid Listen or Port lines were found in the configuration file!");
 
    /*
     * Commit suicide...
@@ -693,25 +695,28 @@ cupsdReadConfiguration(void)
 
     if ((dir = cupsDirOpen(TempDir)) != NULL)
     {
-      cupsdLogMessage(L_INFO, "Cleaning out old temporary files in \"%s\"...",
-                 TempDir);
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "Cleaning out old temporary files in \"%s\"...", TempDir);
 
       while ((dent = cupsDirRead(dir)) != NULL)
       {
         snprintf(tempfile, sizeof(tempfile), "%s/%s", TempDir, dent->filename);
 
        if (unlink(tempfile))
-         cupsdLogMessage(L_ERROR, "Unable to remove temporary file \"%s\" - %s",
-                    tempfile, strerror(errno));
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "Unable to remove temporary file \"%s\" - %s",
+                         tempfile, strerror(errno));
         else
-         cupsdLogMessage(L_DEBUG, "Removed temporary file \"%s\"...", tempfile);
+         cupsdLogMessage(CUPSD_LOG_DEBUG, "Removed temporary file \"%s\"...",
+                         tempfile);
       }
 
       cupsDirClose(dir);
     }
     else
-      cupsdLogMessage(L_ERROR, "Unable to open temporary directory \"%s\" - %s",
-                 TempDir, strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Unable to open temporary directory \"%s\" - %s",
+                      TempDir, strerror(errno));
   }
 
  /*
@@ -727,7 +732,7 @@ cupsdReadConfiguration(void)
   if (MaxClients > (MaxFDs / 3) || MaxClients <= 0)
   {
     if (MaxClients > 0)
-      cupsdLogMessage(L_INFO, "MaxClients limited to 1/3 (%d) of the file descriptor limit (%d)...",
+      cupsdLogMessage(CUPSD_LOG_INFO, "MaxClients limited to 1/3 (%d) of the file descriptor limit (%d)...",
                  MaxFDs / 3, MaxFDs);
 
     MaxClients = MaxFDs / 3;
@@ -735,12 +740,14 @@ cupsdReadConfiguration(void)
 
   if ((Clients = calloc(sizeof(cupsd_client_t), MaxClients)) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "cupsdReadConfiguration: Unable to allocate memory for %d clients: %s",
-               MaxClients, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdReadConfiguration: Unable to allocate memory for %d clients: %s",
+                    MaxClients, strerror(errno));
     exit(1);
   }
   else
-    cupsdLogMessage(L_INFO, "Configured for up to %d clients.", MaxClients);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Configured for up to %d clients.",
+                    MaxClients);
 
  /*
   * Check the MaxActiveJobs setting; limit to 1/3 the available
@@ -754,7 +761,7 @@ cupsdReadConfiguration(void)
     cupsdClearString(&Classification);
 
   if (Classification)
-    cupsdLogMessage(L_INFO, "Security set to \"%s\"", Classification);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Security set to \"%s\"", Classification);
 
  /*
   * Update the MaxClientsPerHost value, as needed...
@@ -766,8 +773,9 @@ cupsdReadConfiguration(void)
   if (MaxClientsPerHost > MaxClients)
     MaxClientsPerHost = MaxClients;
 
-  cupsdLogMessage(L_INFO, "Allowing up to %d client connections per host.",
-             MaxClientsPerHost);
+  cupsdLogMessage(CUPSD_LOG_INFO,
+                  "Allowing up to %d client connections per host.",
+                  MaxClientsPerHost);
 
  /*
   * Update the default policy, as needed...
@@ -781,29 +789,33 @@ cupsdReadConfiguration(void)
   if (!DefaultPolicyPtr)
   {
     cupsd_policy_t     *p;             /* New policy */
-    cupsd_location_t           *po;            /* New policy operation */
+    cupsd_location_t   *po;            /* New policy operation */
 
 
     if (DefaultPolicy)
-      cupsdLogMessage(L_ERROR, "Default policy \"%s\" not found!", DefaultPolicy);
+      cupsdLogMessage(CUPSD_LOG_ERROR, "Default policy \"%s\" not found!",
+                      DefaultPolicy);
 
     if ((DefaultPolicyPtr = cupsdFindPolicy("default")) != NULL)
-      cupsdLogMessage(L_INFO, "Using policy \"default\" as the default!");
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "Using policy \"default\" as the default!");
     else
     {
-      cupsdLogMessage(L_INFO, "Creating CUPS default administrative policy:");
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "Creating CUPS default administrative policy:");
 
       DefaultPolicyPtr = p = cupsdAddPolicy("default");
 
-      cupsdLogMessage(L_INFO, "<Policy default>");
-      cupsdLogMessage(L_INFO, "<Limit Send-Document Send-URI Cancel-Job Hold-Job "
-                         "Release-Job Restart-Job Purge-Jobs "
-                        "Set-Job-Attributes Create-Job-Subscription "
-                        "Renew-Subscription Cancel-Subscription "
-                        "Get-Notifications Reprocess-Job Cancel-Current-Job "
-                        "Suspend-Current-Job Resume-Job CUPS-Move-Job "
-                        "CUPS-Authenticate-Job>");
-      cupsdLogMessage(L_INFO, "Order Deny,Allow");
+      cupsdLogMessage(CUPSD_LOG_INFO, "<Policy default>");
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "<Limit Send-Document Send-URI Cancel-Job Hold-Job "
+                      "Release-Job Restart-Job Purge-Jobs "
+                     "Set-Job-Attributes Create-Job-Subscription "
+                     "Renew-Subscription Cancel-Subscription "
+                     "Get-Notifications Reprocess-Job Cancel-Current-Job "
+                     "Suspend-Current-Job Resume-Job CUPS-Move-Job "
+                     "CUPS-Authenticate-Job>");
+      cupsdLogMessage(CUPSD_LOG_INFO, "Order Deny,Allow");
 
       po = cupsdAddPolicyOp(p, NULL, IPP_SEND_DOCUMENT);
       po->order_type = AUTH_ALLOW;
@@ -811,7 +823,7 @@ cupsdReadConfiguration(void)
 
       cupsdAddName(po, "@OWNER");
       cupsdAddName(po, "@SYSTEM");
-      cupsdLogMessage(L_INFO, "Require user @OWNER @SYSTEM");
+      cupsdLogMessage(CUPSD_LOG_INFO, "Require user @OWNER @SYSTEM");
 
       cupsdAddPolicyOp(p, po, IPP_SEND_URI);
       cupsdAddPolicyOp(p, po, IPP_CANCEL_JOB);
@@ -831,19 +843,20 @@ cupsdReadConfiguration(void)
       cupsdAddPolicyOp(p, po, CUPS_MOVE_JOB);
       cupsdAddPolicyOp(p, po, CUPS_AUTHENTICATE_JOB);
 
-      cupsdLogMessage(L_INFO, "</Limit>");
-
-      cupsdLogMessage(L_INFO, "<Limit Pause-Printer Resume-Printer "
-                         "Set-Printer-Attributes Enable-Printer "
-                        "Disable-Printer Pause-Printer-After-Current-Job "
-                        "Hold-New-Jobs Release-Held-New-Jobs "
-                        "Deactivate-Printer Activate-Printer Restart-Printer "
-                        "Shutdown-Printer Startup-Printer Promote-Job "
-                        "Schedule-Job-After CUPS-Add-Printer "
-                        "CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class "
-                        "CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>");
-      cupsdLogMessage(L_INFO, "Order Deny,Allow");
-      cupsdLogMessage(L_INFO, "AuthType Basic");
+      cupsdLogMessage(CUPSD_LOG_INFO, "</Limit>");
+
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "<Limit Pause-Printer Resume-Printer "
+                      "Set-Printer-Attributes Enable-Printer "
+                     "Disable-Printer Pause-Printer-After-Current-Job "
+                     "Hold-New-Jobs Release-Held-New-Jobs "
+                     "Deactivate-Printer Activate-Printer Restart-Printer "
+                     "Shutdown-Printer Startup-Printer Promote-Job "
+                     "Schedule-Job-After CUPS-Add-Printer "
+                     "CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class "
+                     "CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>");
+      cupsdLogMessage(CUPSD_LOG_INFO, "Order Deny,Allow");
+      cupsdLogMessage(CUPSD_LOG_INFO, "AuthType Basic");
 
       po = cupsdAddPolicyOp(p, NULL, IPP_PAUSE_PRINTER);
       po->order_type = AUTH_ALLOW;
@@ -851,7 +864,7 @@ cupsdReadConfiguration(void)
       po->level      = AUTH_USER;
 
       cupsdAddName(po, "@SYSTEM");
-      cupsdLogMessage(L_INFO, "Require user @SYSTEM");
+      cupsdLogMessage(CUPSD_LOG_INFO, "Require user @SYSTEM");
 
       cupsdAddPolicyOp(p, po, IPP_RESUME_PRINTER);
       cupsdAddPolicyOp(p, po, IPP_SET_PRINTER_ATTRIBUTES);
@@ -875,16 +888,16 @@ cupsdReadConfiguration(void)
       cupsdAddPolicyOp(p, po, CUPS_REJECT_JOBS);
       cupsdAddPolicyOp(p, po, CUPS_SET_DEFAULT);
 
-      cupsdLogMessage(L_INFO, "</Limit>");
+      cupsdLogMessage(CUPSD_LOG_INFO, "</Limit>");
 
-      cupsdLogMessage(L_INFO, "<Limit All>");
-      cupsdLogMessage(L_INFO, "Order Deny,Allow");
+      cupsdLogMessage(CUPSD_LOG_INFO, "<Limit All>");
+      cupsdLogMessage(CUPSD_LOG_INFO, "Order Deny,Allow");
 
       po = cupsdAddPolicyOp(p, NULL, IPP_ANY_OPERATION);
       po->order_type = AUTH_ALLOW;
 
-      cupsdLogMessage(L_INFO, "</Limit>");
-      cupsdLogMessage(L_INFO, "</Policy>");
+      cupsdLogMessage(CUPSD_LOG_INFO, "</Limit>");
+      cupsdLogMessage(CUPSD_LOG_INFO, "</Policy>");
     }
   }
 
@@ -897,7 +910,7 @@ cupsdReadConfiguration(void)
       !old_serverroot || !ServerRoot || strcmp(old_serverroot, ServerRoot) ||
       !old_requestroot || !RequestRoot || strcmp(old_requestroot, RequestRoot))
   {
-    cupsdLogMessage(L_INFO, "Full reload is required.");
+    cupsdLogMessage(CUPSD_LOG_INFO, "Full reload is required.");
 
    /*
     * Free all memory...
@@ -930,13 +943,14 @@ cupsdReadConfiguration(void)
 
     if (!MimeDatabase)
     {
-      cupsdLogMessage(L_EMERG, "Unable to load MIME database from \'%s\'!",
-                 ServerRoot);
+      cupsdLogMessage(CUPSD_LOG_EMERG,
+                      "Unable to load MIME database from \'%s\'!", ServerRoot);
       exit(errno);
     }
 
-    cupsdLogMessage(L_INFO, "Loaded MIME database from \'%s\': %d types, %d filters...",
-               ServerRoot, MimeDatabase->num_types, MimeDatabase->num_filters);
+    cupsdLogMessage(CUPSD_LOG_INFO,
+                    "Loaded MIME database from \'%s\': %d types, %d filters...",
+                    ServerRoot, MimeDatabase->num_types, MimeDatabase->num_filters);
 
    /*
     * Create a list of MIME types for the document-format-supported
@@ -982,13 +996,13 @@ cupsdReadConfiguration(void)
 
     cupsdLoadAllJobs();
 
-    cupsdLogMessage(L_INFO, "Full reload complete.");
+    cupsdLogMessage(CUPSD_LOG_INFO, "Full reload complete.");
   }
   else
   {
     cupsdCreateCommonData();
 
-    cupsdLogMessage(L_INFO, "Partial reload complete.");
+    cupsdLogMessage(CUPSD_LOG_INFO, "Partial reload complete.");
   }
 
  /*
@@ -1034,7 +1048,7 @@ get_address(const char  *value,           /* I - Value string */
 
   if (!*value)
   {
-    cupsdLogMessage(L_ERROR, "Bad (empty) address!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Bad (empty) address!");
     return (0);
   }
 
@@ -1071,7 +1085,8 @@ get_address(const char  *value,           /* I - Value string */
   {
     if (strlen(value) >= sizeof(address->un.sun_path))
     {
-      cupsdLogMessage(L_ERROR, "Domain socket name \"%s\" too long!", value);
+      cupsdLogMessage(CUPSD_LOG_ERROR, "Domain socket name \"%s\" too long!",
+                      value);
       return (0);
     }
 
@@ -1124,8 +1139,8 @@ get_address(const char  *value,           /* I - Value string */
   {
     if ((host = httpGetHostByName(hostname)) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "httpGetHostByName(\"%s\") failed - %s!", hostname,
-                 hstrerror(h_errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR, "httpGetHostByName(\"%s\") failed - %s!",
+                      hostname, hstrerror(h_errno));
       return (0);
     }
 
@@ -1147,8 +1162,8 @@ get_address(const char  *value,           /* I - Value string */
     {
       if ((port = getservbyname(portname, NULL)) == NULL)
       {
-        cupsdLogMessage(L_ERROR, "getservbyname(\"%s\") failed - %s!", portname,
-                   strerror(errno));
+        cupsdLogMessage(CUPSD_LOG_ERROR, "getservbyname(\"%s\") failed - %s!",
+                       portname, strerror(errno));
         return (0);
       }
       else
@@ -1349,8 +1364,9 @@ get_addr_and_mask(const char *value,      /* I - String from config file */
   else
     memcpy(mask, netmasks[ipcount - 1], sizeof(unsigned) * 4);
 
-  cupsdLogMessage(L_DEBUG2, "get_addr_and_mask(value=\"%s\", "
-                       "ip=[%08x:%08x:%08x:%08x], mask=[%08x:%08x:%08x:%08x]",
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "get_addr_and_mask(value=\"%s\", "
+                  "ip=[%08x:%08x:%08x:%08x], mask=[%08x:%08x:%08x:%08x]",
              value, ip[0], ip[1], ip[2], ip[3], mask[0], mask[1], mask[2],
             mask[3]);
 
@@ -1373,10 +1389,10 @@ get_addr_and_mask(const char *value,    /* I - String from config file */
  */
 
 static int                             /* O - 1 on success, 0 on failure */
-parse_aaa(cupsd_location_t *loc,               /* I - Location */
-          char       *line,            /* I - Line from file */
-         char       *value,            /* I - Start of value data */
-         int        linenum)           /* I - Current line number */
+parse_aaa(cupsd_location_t *loc,       /* I - Location */
+          char             *line,      /* I - Line from file */
+         char             *value,      /* I - Start of value data */
+         int              linenum)     /* I - Current line number */
 {
   char         *valptr;                /* Pointer into value */
   unsigned     ip[4],                  /* IP address components */
@@ -1393,8 +1409,9 @@ parse_aaa(cupsd_location_t *loc,          /* I - Location */
       loc->encryption = HTTP_ENCRYPT_NEVER;
     else if (!strcasecmp(value, "always"))
     {
-      cupsdLogMessage(L_ERROR, "Encryption value \"%s\" on line %d is invalid in this context. "
-                         "Using \"required\" instead.", value, linenum);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Encryption value \"%s\" on line %d is invalid in this "
+                     "context. Using \"required\" instead.", value, linenum);
 
       loc->encryption = HTTP_ENCRYPT_REQUIRED;
     }
@@ -1404,8 +1421,8 @@ parse_aaa(cupsd_location_t *loc,          /* I - Location */
       loc->encryption = HTTP_ENCRYPT_IF_REQUESTED;
     else
     {
-      cupsdLogMessage(L_ERROR, "Unknown Encryption value %s on line %d.",
-                value, linenum);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Unknown Encryption value %s on line %d.", value, linenum);
       return (0);
     }
   }
@@ -1421,8 +1438,8 @@ parse_aaa(cupsd_location_t *loc,          /* I - Location */
       loc->order_type = AUTH_DENY;
     else
     {
-      cupsdLogMessage(L_ERROR, "Unknown Order value %s on line %d.",
-                value, linenum);
+      cupsdLogMessage(CUPSD_LOG_ERROR, "Unknown Order value %s on line %d.",
+                     value, linenum);
       return (0);
     }
   }
@@ -1505,8 +1522,8 @@ parse_aaa(cupsd_location_t *loc,          /* I - Location */
 
       if (!get_addr_and_mask(value, ip, mask))
       {
-        cupsdLogMessage(L_ERROR, "Bad netmask value %s on line %d.",
-                  value, linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR, "Bad netmask value %s on line %d.",
+                       value, linenum);
         return (0);
       }
 
@@ -1550,8 +1567,9 @@ parse_aaa(cupsd_location_t *loc,          /* I - Location */
     }
     else
     {
-      cupsdLogMessage(L_WARN, "Unknown authorization type %s on line %d.",
-                value, linenum);
+      cupsdLogMessage(CUPSD_LOG_WARN,
+                      "Unknown authorization type %s on line %d.",
+                     value, linenum);
       return (0);
     }
   }
@@ -1578,8 +1596,9 @@ parse_aaa(cupsd_location_t *loc,          /* I - Location */
     }
     else
     {
-      cupsdLogMessage(L_WARN, "Unknown authorization class %s on line %d.",
-                value, linenum);
+      cupsdLogMessage(CUPSD_LOG_WARN,
+                      "Unknown authorization class %s on line %d.",
+                     value, linenum);
       return (0);
     }
   }
@@ -1609,8 +1628,8 @@ parse_aaa(cupsd_location_t *loc,          /* I - Location */
       loc->level = AUTH_GROUP;
     else
     {
-      cupsdLogMessage(L_WARN, "Unknown Require type %s on line %d.",
-                value, linenum);
+      cupsdLogMessage(CUPSD_LOG_WARN, "Unknown Require type %s on line %d.",
+                     value, linenum);
       return (0);
     }
 
@@ -1658,8 +1677,8 @@ parse_aaa(cupsd_location_t *loc,          /* I - Location */
       loc->satisfy = AUTH_SATISFY_ANY;
     else
     {
-      cupsdLogMessage(L_WARN, "Unknown Satisfy value %s on line %d.", value,
-                linenum);
+      cupsdLogMessage(CUPSD_LOG_WARN, "Unknown Satisfy value %s on line %d.",
+                      value, linenum);
       return (0);
     }
   }
@@ -1677,24 +1696,27 @@ parse_aaa(cupsd_location_t *loc,                /* I - Location */
 static int                             /* O - 1 on success, 0 on failure */
 read_configuration(cups_file_t *fp)    /* I - File to read from */
 {
-  int          i;                      /* Looping var */
-  int          linenum;                /* Current line number */
-  char         line[HTTP_MAX_BUFFER],  /* Line from file */
-               temp[HTTP_MAX_BUFFER],  /* Temporary buffer for value */
-               temp2[HTTP_MAX_BUFFER], /* Temporary buffer 2 for value */
-               *ptr,                   /* Pointer into line/temp */
-               *value;                 /* Pointer to value */
-  int          valuelen;               /* Length of value */
-  var_t                *var;                   /* Current variable */
-  unsigned     ip[4],                  /* Address value */
-               mask[4];                /* Netmask value */
-  cupsd_dirsvc_relay_t *relay;         /* Relay data */
-  cupsd_dirsvc_poll_t  *poll;                  /* Polling data */
-  http_addr_t  polladdr;               /* Polling address */
-  cupsd_location_t     *location;              /* Browse location */
-  cups_file_t  *incfile;               /* Include file */
-  char         incname[1024];          /* Include filename */
-  struct group *group;                 /* Group */
+  int                  i;              /* Looping var */
+  int                  linenum;        /* Current line number */
+  char                 line[HTTP_MAX_BUFFER],
+                                       /* Line from file */
+                       temp[HTTP_MAX_BUFFER],
+                                       /* Temporary buffer for value */
+                       temp2[HTTP_MAX_BUFFER],
+                                       /* Temporary buffer 2 for value */
+                       *ptr,           /* Pointer into line/temp */
+                       *value;         /* Pointer to value */
+  int                  valuelen;       /* Length of value */
+  cupsd_var_t          *var;           /* Current variable */
+  unsigned             ip[4],          /* Address value */
+                       mask[4];        /* Netmask value */
+  cupsd_dirsvc_relay_t *relay;         /* Relay data */
+  cupsd_dirsvc_poll_t  *poll;          /* Polling data */
+  http_addr_t          polladdr;       /* Polling address */
+  cupsd_location_t     *location;      /* Browse location */
+  cups_file_t          *incfile;       /* Include file */
+  char                 incname[1024];  /* Include filename */
+  struct group         *group;         /* Group */
 
 
  /*
@@ -1721,8 +1743,9 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
         snprintf(incname, sizeof(incname), "%s/%s", ServerRoot, value);
 
       if ((incfile = cupsFileOpen(incname, "rb")) == NULL)
-        cupsdLogMessage(L_ERROR, "Unable to include config file \"%s\" - %s",
-                  incname, strerror(errno));
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Unable to include config file \"%s\" - %s",
+                       incname, strerror(errno));
       else
       {
         read_configuration(incfile);
@@ -1743,7 +1766,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
       }
       else
       {
-        cupsdLogMessage(L_ERROR, "Syntax error on line %d.",
+        cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d.",
                   linenum);
         return (0);
       }
@@ -1762,8 +1785,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
       }
       else
       {
-        cupsdLogMessage(L_ERROR, "Syntax error on line %d.",
-                  linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d.", linenum);
         return (0);
       }
     }
@@ -1783,8 +1805,9 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
 
       if (!lis)
       {
-        cupsdLogMessage(L_ERROR, "Unable to allocate %s at line %d - %s.",
-                  line, linenum, strerror(errno));
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Unable to allocate %s at line %d - %s.",
+                       line, linenum, strerror(errno));
         continue;
       }
 
@@ -1803,23 +1826,23 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
 
 #ifdef AF_INET6
         if (lis->address.addr.sa_family == AF_INET6)
-          cupsdLogMessage(L_INFO, "Listening to %s:%d (IPv6)", temp,
-                     ntohs(lis->address.ipv6.sin6_port));
+          cupsdLogMessage(CUPSD_LOG_INFO, "Listening to %s:%d (IPv6)", temp,
+                          ntohs(lis->address.ipv6.sin6_port));
        else
 #endif /* AF_INET6 */
 #ifdef AF_LOCAL
         if (lis->address.addr.sa_family == AF_LOCAL)
-          cupsdLogMessage(L_INFO, "Listening to %s (Domain)", temp);
+          cupsdLogMessage(CUPSD_LOG_INFO, "Listening to %s (Domain)", temp);
        else
 #endif /* AF_LOCAL */
-         cupsdLogMessage(L_INFO, "Listening to %s:%d", temp,
-                     ntohs(lis->address.ipv4.sin_port));
+         cupsdLogMessage(CUPSD_LOG_INFO, "Listening to %s:%d (IPv4)", temp,
+                          ntohs(lis->address.ipv4.sin_port));
 
        NumListeners ++;
       }
       else
-        cupsdLogMessage(L_ERROR, "Bad %s address %s at line %d.", line,
-                  value, linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR, "Bad %s address %s at line %d.", line,
+                       value, linenum);
     }
 #ifdef HAVE_SSL
     else if (!strcasecmp(line, "SSLPort") || !strcasecmp(line, "SSLListen"))
@@ -1838,8 +1861,9 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
 
       if (!lis)
       {
-        cupsdLogMessage(L_ERROR, "Unable to allocate %s at line %d - %s.",
-                  line, linenum, strerror(errno));
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Unable to allocate %s at line %d - %s.",
+                       line, linenum, strerror(errno));
         continue;
       }
 
@@ -1852,18 +1876,23 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
 
 #ifdef AF_INET6
         if (lis->address.addr.sa_family == AF_INET6)
-          cupsdLogMessage(L_INFO, "Listening to %s:%d (IPv6)", temp,
-                     ntohs(lis->address.ipv6.sin6_port));
+          cupsdLogMessage(CUPSD_LOG_INFO, "Listening to %s:%d (IPv6)", temp,
+                          ntohs(lis->address.ipv6.sin6_port));
        else
 #endif /* AF_INET6 */
-        cupsdLogMessage(L_INFO, "Listening to %s:%d", temp,
-                   ntohs(lis->address.ipv4.sin_port));
+#ifdef AF_LOCAL
+        if (lis->address.addr.sa_family == AF_LOCAL)
+          cupsdLogMessage(CUPSD_LOG_INFO, "Listening to %s (Domain)", temp);
+       else
+#endif /* AF_LOCAL */
+        cupsdLogMessage(CUPSD_LOG_INFO, "Listening to %s:%d (IPv4)", temp,
+                        ntohs(lis->address.ipv4.sin_port));
         lis->encryption = HTTP_ENCRYPT_ALWAYS;
        NumListeners ++;
       }
       else
-        cupsdLogMessage(L_ERROR, "Bad %s address %s at line %d.", line,
-                  value, linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR, "Bad %s address %s at line %d.", line,
+                       value, linenum);
     }
 #endif /* HAVE_SSL */
     else if (!strcasecmp(line, "BrowseAddress"))
@@ -1872,7 +1901,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
       * Add a browse address to the list...
       */
 
-      cupsd_dirsvc_addr_t      *dira;          /* New browse address array */
+      cupsd_dirsvc_addr_t      *dira;  /* New browse address array */
 
 
       if (NumBrowsers == 0)
@@ -1882,8 +1911,9 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
 
       if (!dira)
       {
-        cupsdLogMessage(L_ERROR, "Unable to allocate BrowseAddress at line %d - %s.",
-                  linenum, strerror(errno));
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Unable to allocate BrowseAddress at line %d - %s.",
+                       linenum, strerror(errno));
         continue;
       }
 
@@ -1921,18 +1951,19 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
 
 #ifdef AF_INET6
         if (dira->to.addr.sa_family == AF_INET6)
-          cupsdLogMessage(L_INFO, "Sending browsing info to %s:%d (IPv6)", temp,
-                     ntohs(dira->to.ipv6.sin6_port));
+          cupsdLogMessage(CUPSD_LOG_INFO,
+                         "Sending browsing info to %s:%d (IPv6)", temp,
+                          ntohs(dira->to.ipv6.sin6_port));
        else
 #endif /* AF_INET6 */
-        cupsdLogMessage(L_INFO, "Sending browsing info to %s:%d", temp,
-                   ntohs(dira->to.ipv4.sin_port));
+        cupsdLogMessage(CUPSD_LOG_INFO, "Sending browsing info to %s:%d (IPv4)",
+                       temp, ntohs(dira->to.ipv4.sin_port));
 
        NumBrowsers ++;
       }
       else
-        cupsdLogMessage(L_ERROR, "Bad BrowseAddress %s at line %d.", value,
-                  linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR, "Bad BrowseAddress %s at line %d.",
+                       value, linenum);
     }
     else if (!strcasecmp(line, "BrowseOrder"))
     {
@@ -1944,14 +1975,16 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
         location = cupsdAddLocation("CUPS_INTERNAL_BROWSE_ACL");
 
       if (location == NULL)
-        cupsdLogMessage(L_ERROR, "Unable to initialize browse access control list!");
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Unable to initialize browse access control list!");
       else if (!strncasecmp(value, "deny", 4))
         location->order_type = AUTH_ALLOW;
       else if (!strncasecmp(value, "allow", 5))
         location->order_type = AUTH_DENY;
       else
-        cupsdLogMessage(L_ERROR, "Unknown BrowseOrder value %s on line %d.",
-                  value, linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Unknown BrowseOrder value %s on line %d.",
+                       value, linenum);
     }
     else if (!strcasecmp(line, "BrowseProtocols") ||
              !strcasecmp(line, "BrowseLocalProtocols") ||
@@ -2008,8 +2041,9 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
        }
        else
        {
-         cupsdLogMessage(L_ERROR, "Unknown browse protocol \"%s\" on line %d.",
-                    value, linenum);
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "Unknown browse protocol \"%s\" on line %d.",
+                         value, linenum);
           break;
        }
 
@@ -2030,7 +2064,8 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
         location = cupsdAddLocation("CUPS_INTERNAL_BROWSE_ACL");
 
       if (location == NULL)
-        cupsdLogMessage(L_ERROR, "Unable to initialize browse access control list!");
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Unable to initialize browse access control list!");
       else
       {
        if (!strncasecmp(value, "from ", 5))
@@ -2105,8 +2140,8 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
 
           if (!get_addr_and_mask(value, ip, mask))
          {
-            cupsdLogMessage(L_ERROR, "Bad netmask value %s on line %d.",
-                      value, linenum);
+            cupsdLogMessage(CUPSD_LOG_ERROR, "Bad netmask value %s on line %d.",
+                           value, linenum);
            break;
          }
 
@@ -2130,8 +2165,9 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
 
       if (!relay)
       {
-        cupsdLogMessage(L_ERROR, "Unable to allocate BrowseRelay at line %d - %s.",
-                  linenum, strerror(errno));
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Unable to allocate BrowseRelay at line %d - %s.",
+                       linenum, strerror(errno));
         continue;
       }
 
@@ -2191,8 +2227,8 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
 
         if (!get_addr_and_mask(value, ip, mask))
        {
-          cupsdLogMessage(L_ERROR, "Bad netmask value %s on line %d.",
-                    value, linenum);
+          cupsdLogMessage(CUPSD_LOG_ERROR, "Bad netmask value %s on line %d.",
+                         value, linenum);
          break;
        }
 
@@ -2249,12 +2285,12 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
 
 #ifdef AF_INET6
         if (relay->to.addr.sa_family == AF_INET6)
-          cupsdLogMessage(L_INFO, "Relaying from %s to %s:%d", temp, temp2,
-                     ntohs(relay->to.ipv6.sin6_port));
+          cupsdLogMessage(CUPSD_LOG_INFO, "Relaying from %s to %s:%d (IPv6)",
+                         temp, temp2, ntohs(relay->to.ipv6.sin6_port));
        else
 #endif /* AF_INET6 */
-        cupsdLogMessage(L_INFO, "Relaying from %s to %s:%d", temp, temp2,
-                   ntohs(relay->to.ipv4.sin_port));
+        cupsdLogMessage(CUPSD_LOG_INFO, "Relaying from %s to %s:%d (IPv4)",
+                       temp, temp2, ntohs(relay->to.ipv4.sin_port));
 
        NumRelays ++;
       }
@@ -2263,7 +2299,8 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
         if (relay->from.type == AUTH_NAME)
          free(relay->from.mask.name.name);
 
-        cupsdLogMessage(L_ERROR, "Bad relay address %s at line %d.", value, linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR, "Bad relay address %s at line %d.",
+                       value, linenum);
       }
     }
     else if (!strcasecmp(line, "BrowsePoll"))
@@ -2279,8 +2316,9 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
 
       if (!poll)
       {
-        cupsdLogMessage(L_ERROR, "Unable to allocate BrowsePoll at line %d - %s.",
-                  linenum, strerror(errno));
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Unable to allocate BrowsePoll at line %d - %s.",
+                       linenum, strerror(errno));
         continue;
       }
 
@@ -2305,10 +2343,12 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
 #endif /* AF_INET6 */
         poll->port = ntohs(polladdr.ipv4.sin_port);
 
-        cupsdLogMessage(L_INFO, "Polling %s:%d", poll->hostname, poll->port);
+        cupsdLogMessage(CUPSD_LOG_INFO, "Polling %s:%d", poll->hostname,
+                       poll->port);
       }
       else
-        cupsdLogMessage(L_ERROR, "Bad poll address %s at line %d.", value, linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR, "Bad poll address %s at line %d.",
+                       value, linenum);
     }
     else if (!strcasecmp(line, "DefaultAuthType"))
     {
@@ -2324,8 +2364,9 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
        DefaultAuthType = AUTH_BASICDIGEST;
       else
       {
-       cupsdLogMessage(L_WARN, "Unknown default authorization type %s on line %d.",
-                  value, linenum);
+       cupsdLogMessage(CUPSD_LOG_WARN,
+                       "Unknown default authorization type %s on line %d.",
+                       value, linenum);
        return (0);
       }
     }
@@ -2347,8 +2388,9 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
        if (p != NULL)
          User = p->pw_uid;
        else
-         cupsdLogMessage(L_ERROR, "Unknown User \"%s\" on line %d, ignoring!",
-                    value, linenum);
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "Unknown User \"%s\" on line %d, ignoring!",
+                         value, linenum);
       }
     }
     else if (!strcasecmp(line, "Group"))
@@ -2367,8 +2409,9 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
        if (group != NULL)
          Group = group->gr_gid;
        else
-         cupsdLogMessage(L_ERROR, "Unknown Group \"%s\" on line %d, ignoring!",
-                    value, linenum);
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "Unknown Group \"%s\" on line %d, ignoring!",
+                         value, linenum);
       }
     }
     else if (!strcasecmp(line, "SystemGroup"))
@@ -2377,8 +2420,8 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
       * System (admin) group(s)...
       */
 
-      char     *valueptr,      /* Pointer into value */
-               quote;          /* Quote character */
+      char     *valueptr,              /* Pointer into value */
+               quote;                  /* Quote character */
 
 
       for (i = NumSystemGroups; *value && i < MAX_SYSTEM_GROUPS;)
@@ -2418,8 +2461,9 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
          i ++;
        }
        else
-         cupsdLogMessage(L_ERROR, "Unknown SystemGroup \"%s\" on line %d, ignoring!",
-                    value, linenum);
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "Unknown SystemGroup \"%s\" on line %d, ignoring!",
+                         value, linenum);
 
         endgrent();
 
@@ -2445,8 +2489,8 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
       else if (!strcasecmp(value, "double"))
         HostNameLookups = 2;
       else
-       cupsdLogMessage(L_WARN, "Unknown HostNameLookups %s on line %d.",
-                  value, linenum);
+       cupsdLogMessage(CUPSD_LOG_WARN, "Unknown HostNameLookups %s on line %d.",
+                       value, linenum);
     }
     else if (!strcasecmp(line, "LogLevel"))
     {
@@ -2455,27 +2499,28 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
       */
 
       if (!strcasecmp(value, "debug2"))
-        LogLevel = L_DEBUG2;
+        LogLevel = CUPSD_LOG_DEBUG2;
       else if (!strcasecmp(value, "debug"))
-        LogLevel = L_DEBUG;
+        LogLevel = CUPSD_LOG_DEBUG;
       else if (!strcasecmp(value, "info"))
-        LogLevel = L_INFO;
+        LogLevel = CUPSD_LOG_INFO;
       else if (!strcasecmp(value, "notice"))
-        LogLevel = L_NOTICE;
+        LogLevel = CUPSD_LOG_NOTICE;
       else if (!strcasecmp(value, "warn"))
-        LogLevel = L_WARN;
+        LogLevel = CUPSD_LOG_WARN;
       else if (!strcasecmp(value, "error"))
-        LogLevel = L_ERROR;
+        LogLevel = CUPSD_LOG_ERROR;
       else if (!strcasecmp(value, "crit"))
-        LogLevel = L_CRIT;
+        LogLevel = CUPSD_LOG_CRIT;
       else if (!strcasecmp(value, "alert"))
-        LogLevel = L_ALERT;
+        LogLevel = CUPSD_LOG_ALERT;
       else if (!strcasecmp(value, "emerg"))
-        LogLevel = L_EMERG;
+        LogLevel = CUPSD_LOG_EMERG;
       else if (!strcasecmp(value, "none"))
-        LogLevel = L_NONE;
+        LogLevel = CUPSD_LOG_NONE;
       else
-        cupsdLogMessage(L_WARN, "Unknown LogLevel %s on line %d.", value, linenum);
+        cupsdLogMessage(CUPSD_LOG_WARN, "Unknown LogLevel %s on line %d.",
+                       value, linenum);
     }
     else if (!strcasecmp(line, "PrintcapFormat"))
     {
@@ -2488,8 +2533,8 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
       else if (!strcasecmp(value, "solaris"))
         PrintcapFormat = PRINTCAP_SOLARIS;
       else
-       cupsdLogMessage(L_WARN, "Unknown PrintcapFormat %s on line %d.",
-                  value, linenum);
+       cupsdLogMessage(CUPSD_LOG_WARN, "Unknown PrintcapFormat %s on line %d.",
+                       value, linenum);
     }
     else if (!strcasecmp(line, "ServerTokens"))
     {
@@ -2497,7 +2542,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
       * Set the string used for the Server header...
       */
 
-      struct utsname plat;           /* Platform info */
+      struct utsname plat;             /* Platform info */
 
 
       uname(&plat);
@@ -2513,11 +2558,13 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
       else if (!strcasecmp(value, "OS"))
        cupsdSetStringf(&ServerHeader, CUPS_MINIMAL " (%s)", plat.sysname);
       else if (!strcasecmp(value, "Full"))
-       cupsdSetStringf(&ServerHeader, CUPS_MINIMAL " (%s) IPP/1.1", plat.sysname);
+       cupsdSetStringf(&ServerHeader, CUPS_MINIMAL " (%s) IPP/1.1",
+                       plat.sysname);
       else if (!strcasecmp(value, "None"))
        cupsdClearString(&ServerHeader);
       else
-       cupsdLogMessage(L_WARN, "Unknown ServerTokens %s on line %d.", value, linenum);
+       cupsdLogMessage(CUPSD_LOG_WARN, "Unknown ServerTokens %s on line %d.",
+                        value, linenum);
     }
     else
     {
@@ -2535,17 +2582,17 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
         * Unknown directive!  Output an error message and continue...
        */
 
-        cupsdLogMessage(L_ERROR, "Unknown directive %s on line %d.", line,
-                  linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR, "Unknown directive %s on line %d.",
+                       line, linenum);
         continue;
       }
 
       switch (var->type)
       {
-        case VAR_INTEGER :
+        case CUPSD_VARTYPE_INTEGER :
            {
-             int       n;      /* Number */
-             char      *units; /* Units */
+             int       n;              /* Number */
+             char      *units;         /* Units */
 
 
               n = strtol(value, &units, 0);
@@ -2566,7 +2613,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
            }
            break;
 
-       case VAR_BOOLEAN :
+       case CUPSD_VARTYPE_BOOLEAN :
            if (!strcasecmp(value, "true") ||
                !strcasecmp(value, "on") ||
                !strcasecmp(value, "enabled") ||
@@ -2580,11 +2627,12 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
                     !strcasecmp(value, "0"))
               *((int *)var->ptr) = FALSE;
            else
-              cupsdLogMessage(L_ERROR, "Unknown boolean value %s on line %d.",
-                        value, linenum);
+              cupsdLogMessage(CUPSD_LOG_ERROR,
+                             "Unknown boolean value %s on line %d.",
+                             value, linenum);
            break;
 
-       case VAR_STRING :
+       case CUPSD_VARTYPE_STRING :
            cupsdSetString((char **)var->ptr, value);
            break;
       }
@@ -2604,11 +2652,12 @@ read_location(cups_file_t *fp,          /* I - Configuration file */
               char        *location,   /* I - Location name/path */
              int         linenum)      /* I - Current line number */
 {
-  cupsd_location_t     *loc,                   /* New location */
-               *parent;                /* Parent location */
-  char         line[HTTP_MAX_BUFFER],  /* Line buffer */
-               *value,                 /* Value for directive */
-               *valptr;                /* Pointer into value */
+  cupsd_location_t     *loc,           /* New location */
+                       *parent;        /* Parent location */
+  char                 line[HTTP_MAX_BUFFER],
+                                       /* Line buffer */
+                       *value,         /* Value for directive */
+                       *valptr;        /* Pointer into value */
 
 
   if ((parent = cupsdAddLocation(location)) == NULL)
@@ -2630,7 +2679,7 @@ read_location(cups_file_t *fp,            /* I - Configuration file */
     {
       if (!value)
       {
-        cupsdLogMessage(L_ERROR, "Syntax error on line %d.", linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d.", linenum);
         return (0);
       }
       
@@ -2660,8 +2709,8 @@ read_location(cups_file_t *fp,            /* I - Configuration file */
        else if (!strcmp(value, "TRACE"))
          loc->limit |= AUTH_LIMIT_TRACE;
        else
-         cupsdLogMessage(L_WARN, "Unknown request type %s on line %d!", value,
-                    linenum);
+         cupsdLogMessage(CUPSD_LOG_WARN, "Unknown request type %s on line %d!",
+                         value, linenum);
 
         for (value = valptr; isspace(*value & 255); value ++);
       }
@@ -2675,14 +2724,16 @@ read_location(cups_file_t *fp,          /* I - Configuration file */
       loc = parent;
     else if (!parse_aaa(loc, line, value, linenum))
     {
-      cupsdLogMessage(L_ERROR, "Unknown Location directive %s on line %d.",
-                line, linenum);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Unknown Location directive %s on line %d.",
+                     line, linenum);
       return (0);
     }
   }
 
-  cupsdLogMessage(L_ERROR, "Unexpected end-of-file at line %d while reading location!",
-             linenum);
+  cupsdLogMessage(CUPSD_LOG_ERROR,
+                  "Unexpected end-of-file at line %d while reading location!",
+                  linenum);
 
   return (0);
 }
@@ -2699,7 +2750,7 @@ read_policy(cups_file_t *fp,              /* I - Configuration file */
 {
   int                  i;              /* Looping var */
   cupsd_policy_t       *pol;           /* Policy */
-  cupsd_location_t             *op;            /* Policy operation */
+  cupsd_location_t     *op;            /* Policy operation */
   int                  num_ops;        /* Number of IPP operations */
   ipp_op_t             ops[100];       /* Operations */
   char                 line[HTTP_MAX_BUFFER],
@@ -2731,8 +2782,9 @@ read_policy(cups_file_t *fp,              /* I - Configuration file */
     if (!strcasecmp(line, "</Policy>"))
     {
       if (op)
-        cupsdLogMessage(L_WARN, "Missing </Limit> before </Policy> on line %d!",
-                  linenum);
+        cupsdLogMessage(CUPSD_LOG_WARN,
+                       "Missing </Limit> before </Policy> on line %d!",
+                       linenum);
 
       return (linenum);
     }
@@ -2740,7 +2792,7 @@ read_policy(cups_file_t *fp,              /* I - Configuration file */
     {
       if (!value)
       {
-        cupsdLogMessage(L_ERROR, "Syntax error on line %d.", linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d.", linenum);
         return (0);
       }
       
@@ -2762,14 +2814,16 @@ read_policy(cups_file_t *fp,            /* I - Configuration file */
          if (!strcasecmp(value, "All"))
            ops[num_ops] = IPP_ANY_OPERATION;
          else if ((ops[num_ops] = ippOpValue(value)) == IPP_BAD_OPERATION)
-           cupsdLogMessage(L_ERROR, "Bad IPP operation name \"%s\" on line %d!",
-                      value, linenum);
+           cupsdLogMessage(CUPSD_LOG_ERROR,
+                           "Bad IPP operation name \"%s\" on line %d!",
+                           value, linenum);
           else
            num_ops ++;
        }
        else
-         cupsdLogMessage(L_ERROR, "Too many operations listed on line %d!",
-                    linenum);
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "Too many operations listed on line %d!",
+                         linenum);
 
         for (value = valptr; isspace(*value & 255); value ++);
       }
@@ -2810,25 +2864,29 @@ read_policy(cups_file_t *fp,            /* I - Configuration file */
     }
     else if (!op)
     {
-      cupsdLogMessage(L_ERROR, "Missing <Limit ops> directive before %s on line %d.",
-                 line, linenum);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Missing <Limit ops> directive before %s on line %d.",
+                      line, linenum);
       return (0);
     }
     else if (!parse_aaa(op, line, value, linenum))
     {
       if (op)
-       cupsdLogMessage(L_ERROR, "Unknown Policy Limit directive %s on line %d.",
-                  line, linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Unknown Policy Limit directive %s on line %d.",
+                       line, linenum);
       else
-       cupsdLogMessage(L_ERROR, "Unknown Policy directive %s on line %d.",
-                  line, linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Unknown Policy directive %s on line %d.",
+                       line, linenum);
 
       return (0);
     }
   }
 
-  cupsdLogMessage(L_ERROR, "Unexpected end-of-file at line %d while reading policy \"%s\"!",
-             linenum, policy);
+  cupsdLogMessage(CUPSD_LOG_ERROR,
+                  "Unexpected end-of-file at line %d while reading policy \"%s\"!",
+                  linenum, policy);
 
   return (0);
 }
@@ -2868,8 +2926,8 @@ CDSAGetServerCerts(void)
   err      = SecKeychainOpen(ServerCertificate, &kcRef);
 
   if (err)
-    cupsdLogMessage(L_ERROR, "Cannot open keychain \"%s\", error %d.",
-               ServerCertificate, err);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Cannot open keychain \"%s\", error %d.",
+                    ServerCertificate, err);
   else
   {
    /*
@@ -2880,21 +2938,22 @@ CDSAGetServerCerts(void)
     err = SecIdentitySearchCreate(kcRef, CSSM_KEYUSE_SIGN, &srchRef);
 
     if (err)
-      cupsdLogMessage(L_ERROR,
-                 "Cannot find signing key in keychain \"%s\", error %d",
-                 ServerCertificate, err);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Cannot find signing key in keychain \"%s\", error %d",
+                      ServerCertificate, err);
     else
     {
       err = SecIdentitySearchCopyNext(srchRef, &identity);
 
       if (err)
-       cupsdLogMessage(L_ERROR,
-                  "Cannot find signing key in keychain \"%s\", error %d",
-                  ServerCertificate, err);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Cannot find signing key in keychain \"%s\", error %d",
+                       ServerCertificate, err);
       else
       {
        if (CFGetTypeID(identity) != SecIdentityGetTypeID())
-         cupsdLogMessage(L_ERROR, "SecIdentitySearchCopyNext CFTypeID failure!");
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "SecIdentitySearchCopyNext CFTypeID failure!");
        else
        {
         /* 
@@ -2906,7 +2965,7 @@ CDSAGetServerCerts(void)
          ca = CFArrayCreate(NULL, (const void **)&identity, 1, NULL);
 
          if (ca == nil)
-           cupsdLogMessage(L_ERROR, "CFArrayCreate error");
+           cupsdLogMessage(CUPSD_LOG_ERROR, "CFArrayCreate error");
        }
 
        /*CFRelease(identity);*/
index 7c2528c8053d7a16fbb694fb42d5bcb2243e9930..b7b9cf116b6141a6365901c041e9925f447f77e1 100644 (file)
  * Log levels...
  */
 
-#define L_ATTR         -3      /* Used internally for attributes */
-#define L_STATE                -2      /* Used internally for state-reasons */
-#define L_PAGE         -1      /* Used internally for page logging */
-#define L_NONE         0
-#define L_EMERG                1       /* Emergency issues */
-#define L_ALERT                2       /* Something bad happened that needs attention */
-#define L_CRIT         3       /* Critical error but server continues */
-#define L_ERROR                4       /* Error condition */
-#define L_WARN         5       /* Warning */
-#define L_NOTICE       6       /* Normal condition that needs logging */
-#define L_INFO         7       /* General information */
-#define L_DEBUG                8       /* General debugging */
-#define L_DEBUG2       9       /* Detailed debugging */
+typedef enum
+{
+  CUPSD_LOG_ATTR = -3,         /* Used internally for attributes */
+  CUPSD_LOG_STATE,             /* Used internally for state-reasons */
+  CUPSD_LOG_PAGE,              /* Used internally for page logging */
+  CUPSD_LOG_NONE,
+  CUPSD_LOG_EMERG,             /* Emergency issues */
+  CUPSD_LOG_ALERT,             /* Something bad happened that needs attention */
+  CUPSD_LOG_CRIT,              /* Critical error but server continues */
+  CUPSD_LOG_ERROR,             /* Error condition */
+  CUPSD_LOG_WARN,              /* Warning */
+  CUPSD_LOG_NOTICE,            /* Normal condition that needs logging */
+  CUPSD_LOG_INFO,              /* General information */
+  CUPSD_LOG_DEBUG,             /* General debugging */
+  CUPSD_LOG_DEBUG2             /* Detailed debugging */
+} cupsd_loglevel_t;
 
 
 /*
@@ -117,7 +120,7 @@ VAR int                     ClassifyOverride        VALUE(0),
                                        /* Permissions for config files */
                        LogFilePerm             VALUE(0644),
                                        /* Permissions for log files */
-                       LogLevel                VALUE(L_ERROR),
+                       LogLevel                VALUE(CUPSD_LOG_ERROR),
                                        /* Log level */
                        MaxClients              VALUE(0),
                                        /* Maximum number of clients */
index 6fc3ebaf7e1e7be60d94683d9e50bc299b9c9049..7b369bd122fd71dbfa59c3c5009fbfc8d33590fc 100644 (file)
@@ -99,8 +99,6 @@ extern const char *cups_hstrerror(int);
 #define DEFAULT_TIMEOUT                300     /* Timeout during requests/updates */
 #define DEFAULT_KEEPALIVE      60      /* Timeout between requests */
 #define DEFAULT_INTERVAL       30      /* Interval between browse updates */
-#define DEFAULT_LANGUAGE       setlocale(LC_ALL,"")
-                                       /* Default language encoding */
 #define DEFAULT_CHARSET                "utf-8" /* Default charset */
 
 
index 59d2e39def4fb1b7f8fe737b42fa9c5f4cb70dcc..40684138bc5f538a4cb4ee7b4340eafb2fb28162 100644 (file)
  *   cupsdStopPolling()       - Stop polling servers as needed.
  *   cupsdUpdateCUPSBrowse()  - Update the browse lists using the CUPS protocol.
  *   cupsdUpdatePolling()     - Read status messages from the poll daemons.
- *   RegReportCallback() - Empty SLPRegReport.
+ *   slp_reg_callback()      - Empty SLPRegReport.
  *   cupsdSendSLPBrowse()     - Register the specified printer with SLP.
- *   SLPDeregPrinter()   - SLPDereg() the specified printer
- *   GetSlpAttrVal()     - Get an attribute from an SLP registration.
- *   AttrCallback()      - SLP attribute callback 
- *   SrvUrlCallback()    - SLP service url callback
+ *   slp_dereg_printer()        - SLPDereg() the specified printer
+ *   slp_get_attr()          - Get an attribute from an SLP registration.
+ *   slp_attr_callback()           - SLP attribute callback 
+ *   slp_url_callback()         - SLP service url callback
  *   cupsdUpdateSLPBrowse()   - Get browsing information via SLP.
  */
 
@@ -51,7 +51,7 @@
 
 
 #ifdef HAVE_LIBSLP
-void   SLPDeregPrinter(cupsd_printer_t *p);
+static void    slp_dereg_printer(cupsd_printer_t *p);
 #endif /* HAVE_LIBSLP */
 
 
@@ -60,12 +60,13 @@ void        SLPDeregPrinter(cupsd_printer_t *p);
  */
 
 void
-cupsdProcessBrowseData(const char   *uri,      /* I - URI of printer/class */
-                  cups_ptype_t type,   /* I - Printer type */
-                 ipp_pstate_t state,   /* I - Printer state */
-                  const char   *location,/* I - Printer location */
-                 const char   *info,   /* I - Printer information */
-                  const char   *make_model) /* I - Printer make and model */
+cupsdProcessBrowseData(
+    const char   *uri,                 /* I - URI of printer/class */
+    cups_ptype_t type,                 /* I - Printer type */
+    ipp_pstate_t state,                        /* I - Printer state */
+    const char   *location,            /* I - Printer location */
+    const char   *info,                        /* I - Printer information */
+    const char   *make_model)          /* I - Printer make and model */
 {
   int          i;                      /* Looping var */
   int          update;                 /* Update printer attributes? */
@@ -80,7 +81,7 @@ cupsdProcessBrowseData(const char   *uri,     /* I - URI of printer/class */
                *sptr;                  /* Pointer into ServerName */
   char         local_make_model[IPP_MAX_NAME];
                                        /* Local make and model */
-  cupsd_printer_t      *p,                     /* Printer information */
+  cupsd_printer_t *p,                  /* Printer information */
                *pclass,                /* Printer class */
                *first;                 /* First printer in class */
   int          offset,                 /* Offset of name */
@@ -101,8 +102,9 @@ cupsdProcessBrowseData(const char   *uri,   /* I - URI of printer/class */
       (strncmp(resource, "/printers/", 10) &&
        strncmp(resource, "/classes/", 9)))
   {
-    cupsdLogMessage(L_ERROR, "cupsdProcessBrowseData: Bad printer URI in browse data: %s",
-               uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdProcessBrowseData: Bad printer URI in browse data: %s",
+                    uri);
     return;
   }
 
@@ -110,8 +112,9 @@ cupsdProcessBrowseData(const char   *uri,   /* I - URI of printer/class */
       (!strncmp(resource, "/printers/", 10) && strchr(resource + 10, '/')) ||
       (!strncmp(resource, "/classes/", 9) && strchr(resource + 9, '/')))
   {
-    cupsdLogMessage(L_ERROR, "cupsdProcessBrowseData: Bad resource in browse data: %s",
-               resource);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdProcessBrowseData: Bad resource in browse data: %s",
+                    resource);
     return;
   }
 
@@ -213,8 +216,9 @@ cupsdProcessBrowseData(const char   *uri,   /* I - URI of printer/class */
 
          if (p->type & CUPS_PRINTER_REMOTE)
          {
-           cupsdLogMessage(L_INFO, "Renamed remote class \"%s\" to \"%s@%s\"...",
-                      p->name, p->name, p->hostname);
+           cupsdLogMessage(CUPSD_LOG_INFO,
+                           "Renamed remote class \"%s\" to \"%s@%s\"...",
+                           p->name, p->name, p->hostname);
            cupsdAddEvent(CUPSD_EVENT_PRINTER_DELETED, p, NULL,
                          "Class \'%s\' deleted by directory services.",
                          p->name);
@@ -274,7 +278,7 @@ cupsdProcessBrowseData(const char   *uri,   /* I - URI of printer/class */
 
       p = cupsdAddClass(name);
 
-      cupsdLogMessage(L_INFO, "Added remote class \"%s\"...", name);
+      cupsdLogMessage(CUPSD_LOG_INFO, "Added remote class \"%s\"...", name);
 
       cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED, p, NULL,
                     "Class \'%s\' added by directory services.", name);
@@ -317,8 +321,9 @@ cupsdProcessBrowseData(const char   *uri,   /* I - URI of printer/class */
 
          if (p->type & CUPS_PRINTER_REMOTE)
          {
-           cupsdLogMessage(L_INFO, "Renamed remote printer \"%s\" to \"%s@%s\"...",
-                      p->name, p->name, p->hostname);
+           cupsdLogMessage(CUPSD_LOG_INFO,
+                           "Renamed remote printer \"%s\" to \"%s@%s\"...",
+                           p->name, p->name, p->hostname);
            cupsdAddEvent(CUPSD_EVENT_PRINTER_DELETED, p, NULL,
                          "Printer \'%s\' deleted by directory services.",
                          p->name);
@@ -381,7 +386,7 @@ cupsdProcessBrowseData(const char   *uri,   /* I - URI of printer/class */
       cupsdAddEvent(CUPSD_EVENT_PRINTER_ADDED, p, NULL,
                     "Printer \'%s\' added by directory services.", name);
 
-      cupsdLogMessage(L_INFO, "Added remote printer \"%s\"...", name);
+      cupsdLogMessage(CUPSD_LOG_INFO, "Added remote printer \"%s\"...", name);
 
      /*
       * Force the URI to point to the real server...
@@ -496,8 +501,8 @@ cupsdProcessBrowseData(const char   *uri,   /* I - URI of printer/class */
     * Loop through all available printers and create classes as needed...
     */
 
-    for (p = (cupsd_printer_t *)cupsArrayFirst(Printers), len = 0, offset = 0, update = 0,
-             pclass = NULL, first = NULL;
+    for (p = (cupsd_printer_t *)cupsArrayFirst(Printers), len = 0, offset = 0,
+             update = 0, pclass = NULL, first = NULL;
          p != NULL;
         p = (cupsd_printer_t *)cupsArrayNext(Printers))
     {
@@ -550,7 +555,8 @@ cupsdProcessBrowseData(const char   *uri,   /* I - URI of printer/class */
 
           update = 1;
 
-          cupsdLogMessage(L_INFO, "Added implicit class \"%s\"...", name);
+          cupsdLogMessage(CUPSD_LOG_INFO, "Added implicit class \"%s\"...",
+                         name);
        }
 
         if (first != NULL)
@@ -642,7 +648,8 @@ cupsdProcessBrowseData(const char   *uri,   /* I - URI of printer/class */
  */
 
 void
-cupsdSendBrowseDelete(cupsd_printer_t *p)              /* I - Printer to delete */
+cupsdSendBrowseDelete(
+    cupsd_printer_t *p)                        /* I - Printer to delete */
 {
  /*
   * Only announce if browsing is enabled...
@@ -665,7 +672,7 @@ cupsdSendBrowseDelete(cupsd_printer_t *p)           /* I - Printer to delete */
     cupsdSendCUPSBrowse(p);
 #ifdef HAVE_LIBSLP
   if (BrowseLocalProtocols & BROWSE_SLP)
-    SLPDeregPrinter(p);
+    slp_dereg_printer(p);
 #endif /* HAVE_LIBSLP */
 }
 
@@ -678,7 +685,7 @@ void
 cupsdSendBrowseList(void)
 {
   int                  count;          /* Number of dests to update */
-  cupsd_printer_t              *p;             /* Current printer */
+  cupsd_printer_t      *p;             /* Current printer */
   time_t               ut,             /* Minimum update time */
                        to;             /* Timeout time */
 
@@ -785,8 +792,9 @@ cupsdSendBrowseList(void)
                      (p->type & CUPS_PRINTER_CLASS) ? "Class" : "Printer",
                      p->name);
 
-        cupsdLogMessage(L_INFO, "Remote destination \"%s\" has timed out; deleting it...",
-                  p->name);
+        cupsdLogMessage(CUPSD_LOG_INFO,
+                       "Remote destination \"%s\" has timed out; deleting it...",
+                       p->name);
 
         cupsdDeletePrinter(p, 1);
       }
@@ -800,11 +808,11 @@ cupsdSendBrowseList(void)
  */
 
 void
-cupsdSendCUPSBrowse(cupsd_printer_t *p)                /* I - Printer to send */
+cupsdSendCUPSBrowse(cupsd_printer_t *p)        /* I - Printer to send */
 {
   int                  i;              /* Looping var */
   cups_ptype_t         type;           /* Printer type */
-  cupsd_dirsvc_addr_t          *b;             /* Browse address */
+  cupsd_dirsvc_addr_t  *b;             /* Browse address */
   int                  bytes;          /* Length of packet */
   char                 packet[1453];   /* Browse data packet */
   char                 options[1024];  /* Browse local options */
@@ -871,8 +879,9 @@ cupsdSendCUPSBrowse(cupsd_printer_t *p)             /* I - Printer to send */
 
          bytes = strlen(packet);
 
-         cupsdLogMessage(L_DEBUG2, "cupsdSendBrowseList: (%d bytes to \"%s\") %s", bytes,
-                    iface->name, packet);
+         cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                         "cupsdSendBrowseList: (%d bytes to \"%s\") %s", bytes,
+                         iface->name, packet);
 
           if (iface->broadcast.addr.sa_family == AF_INET)
          {
@@ -894,7 +903,7 @@ cupsdSendCUPSBrowse(cupsd_printer_t *p)             /* I - Printer to send */
 #endif /* AF_INET6 */
         }
       }
-      else if ((iface = NetIFFind(b->iface)) != NULL)
+      else if ((iface = cupsdNetIFFind(b->iface)) != NULL)
       {
        /*
         * Send to the named interface...
@@ -912,8 +921,9 @@ cupsdSendCUPSBrowse(cupsd_printer_t *p)             /* I - Printer to send */
 
        bytes = strlen(packet);
 
-       cupsdLogMessage(L_DEBUG2, "cupsdSendBrowseList: (%d bytes to \"%s\") %s", bytes,
-                  iface->name, packet);
+       cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                       "cupsdSendBrowseList: (%d bytes to \"%s\") %s", bytes,
+                       iface->name, packet);
 
         if (iface->broadcast.addr.sa_family == AF_INET)
        {
@@ -949,7 +959,8 @@ cupsdSendCUPSBrowse(cupsd_printer_t *p)             /* I - Printer to send */
               p->make_model ? p->make_model : "Unknown");
 
       bytes = strlen(packet);
-      cupsdLogMessage(L_DEBUG2, "cupsdSendBrowseList: (%d bytes) %s", bytes, packet);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdSendBrowseList: (%d bytes) %s", bytes, packet);
 
 #ifdef AF_INET6
       if (sendto(BrowseSocket, packet, bytes, 0,
@@ -968,8 +979,9 @@ cupsdSendCUPSBrowse(cupsd_printer_t *p)             /* I - Printer to send */
        * list...
        */
 
-       cupsdLogMessage(L_ERROR, "cupsdSendBrowseList: sendto failed for browser %d - %s.",
-                  b - Browsers + 1, strerror(errno));
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdSendBrowseList: sendto failed for browser %d - %s.",
+                       b - Browsers + 1, strerror(errno));
 
         if (i > 1)
          memcpy(b, b + 1, (i - 1) * sizeof(cupsd_dirsvc_addr_t));
@@ -988,8 +1000,8 @@ cupsdSendCUPSBrowse(cupsd_printer_t *p)            /* I - Printer to send */
 void
 cupsdStartBrowsing(void)
 {
-  int                  val;    /* Socket option value */
-  struct sockaddr_in   addr;   /* Broadcast address */
+  int                  val;            /* Socket option value */
+  struct sockaddr_in   addr;           /* Broadcast address */
 
 
   if (!Browsing || !(BrowseLocalProtocols | BrowseRemoteProtocols))
@@ -1003,8 +1015,9 @@ cupsdStartBrowsing(void)
 
     if ((BrowseSocket = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
     {
-      cupsdLogMessage(L_ERROR, "cupsdStartBrowsing: Unable to create broadcast socket - %s.",
-                strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cupsdStartBrowsing: Unable to create broadcast socket - %s.",
+                     strerror(errno));
       BrowseLocalProtocols &= ~BROWSE_CUPS;
       BrowseRemoteProtocols &= ~BROWSE_CUPS;
       return;
@@ -1017,8 +1030,9 @@ cupsdStartBrowsing(void)
     val = 1;
     if (setsockopt(BrowseSocket, SOL_SOCKET, SO_BROADCAST, &val, sizeof(val)))
     {
-      cupsdLogMessage(L_ERROR, "cupsdStartBrowsing: Unable to set broadcast mode - %s.",
-                strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cupsdStartBrowsing: Unable to set broadcast mode - %s.",
+                     strerror(errno));
 
 #ifdef WIN32
       closesocket(BrowseSocket);
@@ -1043,8 +1057,9 @@ cupsdStartBrowsing(void)
 
     if (bind(BrowseSocket, (struct sockaddr *)&addr, sizeof(addr)))
     {
-      cupsdLogMessage(L_ERROR, "cupsdStartBrowsing: Unable to bind broadcast socket - %s.",
-                strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cupsdStartBrowsing: Unable to bind broadcast socket - %s.",
+                     strerror(errno));
 
 #ifdef WIN32
       closesocket(BrowseSocket);
@@ -1068,8 +1083,9 @@ cupsdStartBrowsing(void)
     * Finally, add the socket to the input selection set...
     */
 
-    cupsdLogMessage(L_DEBUG2, "cupsdStartBrowsing: Adding fd %d to InputSet...",
-               BrowseSocket);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdStartBrowsing: Adding fd %d to InputSet...",
+                    BrowseSocket);
 
     FD_SET(BrowseSocket, InputSet);
   }
@@ -1085,7 +1101,8 @@ cupsdStartBrowsing(void)
 
     if (SLPOpen("en", SLP_FALSE, &BrowseSLPHandle) != SLP_OK)
     {
-      cupsdLogMessage(L_ERROR, "Unable to open an SLP handle; disabling SLP browsing!");
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Unable to open an SLP handle; disabling SLP browsing!");
       BrowseLocalProtocols &= ~BROWSE_SLP;
       BrowseRemoteProtocols &= ~BROWSE_SLP;
     }
@@ -1103,15 +1120,15 @@ cupsdStartBrowsing(void)
 void
 cupsdStartPolling(void)
 {
-  int          i;                      /* Looping var */
-  cupsd_dirsvc_poll_t  *poll;                  /* Current polling server */
-  char         polld[1024];            /* Poll daemon path */
-  char         sport[10];              /* Server port */
-  char         bport[10];              /* Browser port */
-  char         interval[10];           /* Poll interval */
-  int          statusfds[2];           /* Status pipe */
-  char         *argv[6];               /* Arguments */
-  char         *envp[100];             /* Environment */
+  int                  i;              /* Looping var */
+  cupsd_dirsvc_poll_t  *poll;          /* Current polling server */
+  char                 polld[1024];    /* Poll daemon path */
+  char                 sport[10];      /* Server port */
+  char                 bport[10];      /* Browser port */
+  char                 interval[10];   /* Poll interval */
+  int                  statusfds[2];   /* Status pipe */
+  char                 *argv[6];       /* Arguments */
+  char                 *envp[100];     /* Environment */
 
 
  /*
@@ -1153,8 +1170,9 @@ cupsdStartPolling(void)
 
   if (cupsdOpenPipe(statusfds))
   {
-    cupsdLogMessage(L_ERROR, "Unable to create polling status pipes - %s.",
-              strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "Unable to create polling status pipes - %s.",
+                   strerror(errno));
     PollPipe         = -1;
     PollStatusBuffer = NULL;
     return;
@@ -1176,14 +1194,16 @@ cupsdStartPolling(void)
     if (cupsdStartProcess(polld, argv, envp, -1, -1, statusfds[1], -1,
                           0, &(poll->pid)) < 0)
     {
-      cupsdLogMessage(L_ERROR, "cupsdStartPolling: Unable to fork polling daemon - %s",
-                 strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cupsdStartPolling: Unable to fork polling daemon - %s",
+                      strerror(errno));
       poll->pid = 0;
       break;
     }
     else
-      cupsdLogMessage(L_DEBUG, "cupsdStartPolling: Started polling daemon for %s:%d, pid = %d",
-                 poll->hostname, poll->port, poll->pid);
+      cupsdLogMessage(CUPSD_LOG_DEBUG,
+                      "cupsdStartPolling: Started polling daemon for %s:%d, pid = %d",
+                      poll->hostname, poll->port, poll->pid);
   }
 
   close(statusfds[1]);
@@ -1192,8 +1212,8 @@ cupsdStartPolling(void)
   * Finally, add the pipe to the input selection set...
   */
 
-  cupsdLogMessage(L_DEBUG2, "cupsdStartPolling: Adding fd %d to InputSet...",
-             PollPipe);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdStartPolling: Adding fd %d to InputSet...", PollPipe);
 
   FD_SET(PollPipe, InputSet);
 }
@@ -1223,8 +1243,9 @@ cupsdStopBrowsing(void)
       close(BrowseSocket);
 #endif /* WIN32 */
 
-      cupsdLogMessage(L_DEBUG2, "cupsdStopBrowsing: Removing fd %d from InputSet...",
-                BrowseSocket);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdStopBrowsing: Removing fd %d from InputSet...",
+                     BrowseSocket);
 
       FD_CLR(BrowseSocket, InputSet);
       BrowseSocket = -1;
@@ -1251,7 +1272,7 @@ cupsdStopBrowsing(void)
 void
 cupsdStopPolling(void)
 {
-  int          i;              /* Looping var */
+  int                  i;              /* Looping var */
   cupsd_dirsvc_poll_t  *poll;          /* Current polling server */
 
 
@@ -1260,8 +1281,8 @@ cupsdStopPolling(void)
     cupsdStatBufDelete(PollStatusBuffer);
     close(PollPipe);
 
-    cupsdLogMessage(L_DEBUG2, "cupsdStopPolling: removing fd %d from InputSet.",
-               PollPipe);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdStopPolling: removing fd %d from InputSet.", PollPipe);
     FD_CLR(PollPipe, InputSet);
 
     PollPipe         = -1;
@@ -1289,8 +1310,7 @@ cupsdUpdateCUPSBrowse(void)
                *pptr;                  /* Pointer into packet */
   http_addr_t  srcaddr;                /* Source address */
   char         srcname[1024];          /* Source hostname */
-  unsigned     address[4],             /* Source address */
-               temp;                   /* Temporary address var (host order) */
+  unsigned     address[4];             /* Source address */
   unsigned     type;                   /* Printer type */
   unsigned     state;                  /* Printer state */
   char         uri[HTTP_MAX_URI],      /* Printer URI */
@@ -1321,8 +1341,9 @@ cupsdUpdateCUPSBrowse(void)
 
     if (errno != ECONNREFUSED && errno != EAGAIN)
     {
-      cupsdLogMessage(L_ERROR, "Browse recv failed - %s.", strerror(errno));
-      cupsdLogMessage(L_ERROR, "Browsing turned off.");
+      cupsdLogMessage(CUPSD_LOG_ERROR, "Browse recv failed - %s.",
+                      strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR, "Browsing turned off.");
 
       cupsdStopBrowsing();
       Browsing = 0;
@@ -1348,15 +1369,10 @@ cupsdUpdateCUPSBrowse(void)
   else
 #endif /* AF_INET6 */
   {
-    temp = ntohl(srcaddr.ipv4.sin_addr.s_addr);
-
-    address[3] = temp & 255;
-    temp       >>= 8;
-    address[2] = temp & 255;
-    temp       >>= 8;
-    address[1] = temp & 255;
-    temp       >>= 8;
-    address[0] = temp & 255;
+    address[0] = 0;
+    address[1] = 0;
+    address[2] = 0;
+    address[3] = ntohl(srcaddr.ipv4.sin_addr.s_addr);
   }
 
   if (HostNameLookups)
@@ -1423,13 +1439,15 @@ cupsdUpdateCUPSBrowse(void)
 
   if (auth == AUTH_DENY)
   {
-    cupsdLogMessage(L_DEBUG, "cupsdUpdateCUPSBrowse: Refused %d bytes from %s", bytes,
-               srcname);
+    cupsdLogMessage(CUPSD_LOG_DEBUG,
+                    "cupsdUpdateCUPSBrowse: Refused %d bytes from %s", bytes,
+                    srcname);
     return;
   }
 
-  cupsdLogMessage(L_DEBUG2, "cupsdUpdateCUPSBrowse: (%d bytes from %s) %s", bytes, srcname,
-             packet);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdUpdateCUPSBrowse: (%d bytes from %s) %s", bytes,
+                 srcname, packet);
 
  /*
   * Parse packet...
@@ -1437,8 +1455,8 @@ cupsdUpdateCUPSBrowse(void)
 
   if (sscanf(packet, "%x%x%1023s", &type, &state, uri) < 3)
   {
-    cupsdLogMessage(L_WARN, "cupsdUpdateCUPSBrowse: Garbled browse packet - %s",
-               packet);
+    cupsdLogMessage(CUPSD_LOG_WARN,
+                    "cupsdUpdateCUPSBrowse: Garbled browse packet - %s", packet);
     return;
   }
 
@@ -1532,8 +1550,9 @@ cupsdUpdateCUPSBrowse(void)
                  (struct sockaddr *)&(Relays[i].to),
                 sizeof(http_addr_t)) <= 0)
       {
-       cupsdLogMessage(L_ERROR, "cupsdUpdateCUPSBrowse: sendto failed for relay %d - %s.",
-                  i + 1, strerror(errno));
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdUpdateCUPSBrowse: sendto failed for relay %d - %s.",
+                       i + 1, strerror(errno));
        return;
       }
 
@@ -1542,7 +1561,7 @@ cupsdUpdateCUPSBrowse(void)
   */
 
   cupsdProcessBrowseData(uri, (cups_ptype_t)type, (ipp_pstate_t)state, location,
-                    info, make_model);
+                         info, make_model);
 }
 
 
@@ -1569,7 +1588,8 @@ cupsdUpdatePolling(void)
     * All polling processes have died; stop polling...
     */
 
-    cupsdLogMessage(L_ERROR, "cupsdUpdatePolling: all polling processes have exited!");
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdUpdatePolling: all polling processes have exited!");
     cupsdStopPolling();
   }
 }
@@ -1600,11 +1620,11 @@ typedef struct _slpsrvurl
 
 
 /*
- * 'RegReportCallback()' - Empty SLPRegReport.
+ * 'slp_reg_callback()' - Empty SLPRegReport.
  */
 
-void
-RegReportCallback(SLPHandle hslp,
+static void
+slp_reg_callback(SLPHandle hslp,
                   SLPError  errcode,
                  void      *cookie)
 {
@@ -1621,7 +1641,7 @@ RegReportCallback(SLPHandle hslp,
  */
 
 void 
-cupsdSendSLPBrowse(cupsd_printer_t *p)         /* I - Printer to register */
+cupsdSendSLPBrowse(cupsd_printer_t *p) /* I - Printer to register */
 {
   char         srvurl[HTTP_MAX_URI],   /* Printer service URI */
                attrs[8192],            /* Printer attributes */
@@ -1630,15 +1650,15 @@ cupsdSendSLPBrowse(cupsd_printer_t *p)          /* I - Printer to register */
                                        /* Make and model, quoted */
                location[IPP_MAX_NAME * 2],
                                        /* Location, quoted */
-               info[IPP_MAX_NAME * 2],
-                                       /* Info, quoted */
+               info[IPP_MAX_NAME * 2], /* Info, quoted */
                *src,                   /* Pointer to original string */
                *dst;                   /* Pointer to destination string */
   ipp_attribute_t *authentication;     /* uri-authentication-supported value */
   SLPError     error;                  /* SLP error, if any */
 
 
-  cupsdLogMessage(L_DEBUG, "cupsdSendSLPBrowse(%p = \"%s\")", p, p->name);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdSendSLPBrowse(%p = \"%s\")", p,
+                  p->name);
 
  /*
   * Make the SLP service URL that conforms to the IANA 
@@ -1647,7 +1667,7 @@ cupsdSendSLPBrowse(cupsd_printer_t *p)            /* I - Printer to register */
 
   snprintf(srvurl, sizeof(srvurl), SLP_CUPS_SRVTYPE ":%s", p->uri);
 
-  cupsdLogMessage(L_DEBUG2, "Service URL = \"%s\"", srvurl);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "Service URL = \"%s\"", srvurl);
 
  /*
   * Figure out the finishings string...
@@ -1779,34 +1799,34 @@ cupsdSendSLPBrowse(cupsd_printer_t *p)          /* I - Printer to register */
            p->type & CUPS_PRINTER_DUPLEX ?
               ",two-sided-long-edge,two-sided-short-edge" : "");
 
-  cupsdLogMessage(L_DEBUG2, "Attributes = \"%s\"", attrs);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "Attributes = \"%s\"", attrs);
 
  /*
   * Register the printer with the SLP server...
   */
 
   error = SLPReg(BrowseSLPHandle, srvurl, BrowseTimeout,
-                SLP_CUPS_SRVTYPE, attrs, SLP_TRUE, RegReportCallback, 0);
+                SLP_CUPS_SRVTYPE, attrs, SLP_TRUE, slp_reg_callback, 0);
 
   if (error != SLP_OK)
-    cupsdLogMessage(L_ERROR, "SLPReg of \"%s\" failed with status %d!", p->name,
-               error);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "SLPReg of \"%s\" failed with status %d!", p->name,
+                    error);
 }
 
 
 /*
- * 'SLPDeregPrinter()' - SLPDereg() the specified printer
+ * 'slp_dereg_printer()' - SLPDereg() the specified printer
  */
 
-void 
-SLPDeregPrinter(cupsd_printer_t *p)
+static void 
+slp_dereg_printer(cupsd_printer_t *p)
 {
   char srvurl[HTTP_MAX_URI];   /* Printer service URI */
 
 
-  cupsdLogMessage(L_DEBUG, "SLPDeregPrinter: printer=\"%s\"", p->name);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "slp_dereg_printer: printer=\"%s\"", p->name);
 
-  if((p->type & CUPS_PRINTER_REMOTE) == 0)
+  if (!(p->type & CUPS_PRINTER_REMOTE))
   {
    /*
     * Make the SLP service URL that conforms to the IANA 
@@ -1819,19 +1839,19 @@ SLPDeregPrinter(cupsd_printer_t *p)
     * Deregister the printer...
     */
 
-    SLPDereg(BrowseSLPHandle, srvurl, RegReportCallback, 0);
+    SLPDereg(BrowseSLPHandle, srvurl, slp_reg_callback, 0);
   }
 }
 
 
 /*
- * 'GetSlpAttrVal()' - Get an attribute from an SLP registration.
+ * 'slp_get_attr()' - Get an attribute from an SLP registration.
  */
 
-int                                    /* O - 0 on success */
-GetSlpAttrVal(const char *attrlist,    /* I - Attribute list string */
-              const char *tag,         /* I - Name of attribute */
-              char       **valbuf)     /* O - Value */
+static int                             /* O - 0 on success */
+slp_get_attr(const char *attrlist,     /* I - Attribute list string */
+             const char *tag,          /* I - Name of attribute */
+             char       **valbuf)      /* O - Value */
 {
   char *ptr1,                          /* Pointer into string */
        *ptr2;                          /* ... */
@@ -1869,17 +1889,18 @@ GetSlpAttrVal(const char *attrlist,     /* I - Attribute list string */
 
 
 /*
- * 'AttrCallback()' - SLP attribute callback 
+ * 'slp_attr_callback()' - SLP attribute callback 
  */
 
-SLPBoolean                             /* O - SLP_TRUE for success */
-AttrCallback(SLPHandle  hslp,          /* I - SLP handle */
-             const char *attrlist,     /* I - Attribute list */
-             SLPError   errcode,       /* I - Parsing status for this attr */
-             void       *cookie)       /* I - Current printer */
+static SLPBoolean                      /* O - SLP_TRUE for success */
+slp_attr_callback(
+    SLPHandle  hslp,                   /* I - SLP handle */
+    const char *attrlist,              /* I - Attribute list */
+    SLPError   errcode,                        /* I - Parsing status for this attr */
+    void       *cookie)                        /* I - Current printer */
 {
-  char         *tmp = 0;
-  cupsd_printer_t    *p = (cupsd_printer_t*)cookie;
+  char                 *tmp = 0;
+  cupsd_printer_t      *p = (cupsd_printer_t*)cookie;
 
 
  /*
@@ -1903,19 +1924,19 @@ AttrCallback(SLPHandle  hslp,           /* I - SLP handle */
 
   p->type = CUPS_PRINTER_REMOTE;
 
-  if (GetSlpAttrVal(attrlist, "(printer-location=", &(p->location)))
+  if (slp_get_attr(attrlist, "(printer-location=", &(p->location)))
     return (SLP_FALSE);
-  if (GetSlpAttrVal(attrlist, "(printer-info=", &(p->info)))
+  if (slp_get_attr(attrlist, "(printer-info=", &(p->info)))
     return (SLP_FALSE);
-  if (GetSlpAttrVal(attrlist, "(printer-make-and-model=", &(p->make_model)))
+  if (slp_get_attr(attrlist, "(printer-make-and-model=", &(p->make_model)))
     return (SLP_FALSE);
 
-  if (GetSlpAttrVal(attrlist, "(color-supported=", &tmp))
+  if (slp_get_attr(attrlist, "(color-supported=", &tmp))
     return (SLP_FALSE);
   if (strcasecmp(tmp, "true") == 0)
     p->type |= CUPS_PRINTER_COLOR;
 
-  if (GetSlpAttrVal(attrlist, "(finishings-supported=", &tmp))
+  if (slp_get_attr(attrlist, "(finishings-supported=", &tmp))
     return (SLP_FALSE);
   if (strstr(tmp, "staple"))
     p->type |= CUPS_PRINTER_STAPLE;
@@ -1924,7 +1945,7 @@ AttrCallback(SLPHandle  hslp,             /* I - SLP handle */
   if (strstr(tmp, "punch"))
     p->type |= CUPS_PRINTER_PUNCH;
 
-  if (GetSlpAttrVal(attrlist, "(sides-supported=", &tmp))
+  if (slp_get_attr(attrlist, "(sides-supported=", &tmp))
     return (SLP_FALSE);
   if (strstr(tmp,"two-sided"))
     p->type |= CUPS_PRINTER_DUPLEX;
@@ -1936,15 +1957,16 @@ AttrCallback(SLPHandle  hslp,           /* I - SLP handle */
 
 
 /*
- * 'SrvUrlCallback()' - SLP service url callback
+ * 'slp_url_callback()' - SLP service url callback
  */
 
-SLPBoolean                             /* O - TRUE = OK, FALSE = error */
-SrvUrlCallback(SLPHandle      hslp,    /* I - SLP handle */
-               const char     *srvurl,         /* I - URL of service */
-               unsigned short lifetime,        /* I - Life of service */
-               SLPError       errcode,         /* I - Existing error code */
-               void           *cookie) /* I - Pointer to service list */
+static SLPBoolean                      /* O - TRUE = OK, FALSE = error */
+slp_url_callback(
+    SLPHandle      hslp,               /* I - SLP handle */
+    const char     *srvurl,            /* I - URL of service */
+    unsigned short lifetime,           /* I - Life of service */
+    SLPError       errcode,            /* I - Existing error code */
+    void           *cookie)            /* I - Pointer to service list */
 {
   slpsrvurl_t  *s,                     /* New service entry */
                **head;                 /* Pointer to head of entry */
@@ -2014,7 +2036,7 @@ cupsdUpdateSLPBrowse(void)
   int          port;                   /* Port portion of URI */
 
 
-  cupsdLogMessage(L_DEBUG, "cupsdUpdateSLPBrowse() Start...");
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdUpdateSLPBrowse() Start...");
 
  /*
   * Reset the refresh time...
@@ -2029,7 +2051,7 @@ cupsdUpdateSLPBrowse(void)
   s = NULL;
 
   SLPFindSrvs(BrowseSLPHandle, SLP_CUPS_SRVTYPE, "", "",
-             SrvUrlCallback, &s);
+             slp_url_callback, &s);
 
  /*
   * Loop through the list of available printers...
@@ -2047,7 +2069,7 @@ cupsdUpdateSLPBrowse(void)
     * Load a cupsd_printer_t structure with the SLP service attributes...
     */
 
-    SLPFindAttrs(BrowseSLPHandle, s->url, "", "", AttrCallback, &p);
+    SLPFindAttrs(BrowseSLPHandle, s->url, "", "", slp_attr_callback, &p);
 
    /*
     * Process this printer entry...
@@ -2087,7 +2109,7 @@ cupsdUpdateSLPBrowse(void)
     free(s);
   }       
 
-  cupsdLogMessage(L_DEBUG, "cupsdUpdateSLPBrowse() End...");
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdUpdateSLPBrowse() End...");
 }
 #endif /* HAVE_LIBSLP */
 
index 4ba9f1db1630c66a4e537735c33ebe7ad9e1839b..92b6c3df3404a8da75504c0fa24a102ef36d2e90 100644 (file)
@@ -59,7 +59,7 @@ typedef struct
 
 typedef struct
 {
-  cupsd_authmask_t             from;           /* Source address/name mask */
+  cupsd_authmask_t     from;           /* Source address/name mask */
   http_addr_t          to;             /* Destination address */
 } cupsd_dirsvc_relay_t;
 
@@ -108,13 +108,13 @@ VAR char          *BrowseLocalOptions
                                        /* Options to add to remote printer URIs */
 VAR cupsd_dirsvc_addr_t        *Browsers       VALUE(NULL);
                                        /* Broadcast addresses */
-VAR cupsd_location_t           *BrowseACL      VALUE(NULL);
+VAR cupsd_location_t   *BrowseACL      VALUE(NULL);
                                        /* Browser access control list */
-VAR cupsd_printer_t            *BrowseNext     VALUE(NULL);
+VAR cupsd_printer_t    *BrowseNext     VALUE(NULL);
                                        /* Next class/printer to broadcast */
 VAR int                        NumRelays       VALUE(0);
                                        /* Number of broadcast relays */
-VAR cupsd_dirsvc_relay_t       *Relays         VALUE(NULL);
+VAR cupsd_dirsvc_relay_t *Relays       VALUE(NULL);
                                        /* Broadcast relays */
 VAR int                        NumPolled       VALUE(0);
                                        /* Number of polled servers */
@@ -138,8 +138,8 @@ VAR time_t          BrowseSLPRefresh VALUE(0);
  */
 
 extern void    cupsdProcessBrowseData(const char *uri, cups_ptype_t type,
-                                 ipp_pstate_t state, const char *location,
-                                 const char *info, const char *make_model);
+                                      ipp_pstate_t state, const char *location,
+                                      const char *info, const char *make_model);
 extern void    cupsdSendBrowseDelete(cupsd_printer_t *p);
 extern void    cupsdSendBrowseList(void);
 extern void    cupsdSendCUPSBrowse(cupsd_printer_t *p);
index e5277b6b70b1aa2d937041770b982c6c6222c7a2..dba2bcc43ea4ec1de395639003042ed706286505 100644 (file)
@@ -162,7 +162,8 @@ cupsdSetEnv(const char *name,               /* I - Name of variable */
 
   if (num_common_env >= (int)(sizeof(common_env) / sizeof(common_env[0])))
   {
-    cupsdLogMessage(L_ERROR, "cupsdSetEnv: Too many environment variables set!");
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdSetEnv: Too many environment variables set!");
     return;
   }
 
@@ -182,7 +183,8 @@ cupsdSetEnv(const char *name,               /* I - Name of variable */
 
   cupsdSetStringf(common_env + num_common_env, "%s=%s", name, value);
 
-  cupsdLogMessage(L_DEBUG, "cupsdSetEnv: %s\n", common_env[num_common_env]);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdSetEnv: %s\n",
+                  common_env[num_common_env]);
 
   num_common_env ++;
 }
index 5cafcfc021fc9a6476274513a557a8e9a28fb2a8..bde3ad099585a6deefdf8cf546eb2002aa227e2b 100644 (file)
  *
  * Contents:
  *
- *   cupsdProcessIPPRequest()         - Process an incoming IPP request...
+ *   cupsdProcessIPPRequest()    - Process an incoming IPP request...
  *   accept_jobs()               - Accept print jobs to a printer.
  *   add_class()                 - Add a class to the system.
  *   add_file()                  - Add a file to a job.
- *   add_cupsd_job_state_reasons()     - Add the "job-state-reasons" attribute based
+ *   add_job_state_reasons()     - Add the "job-state-reasons" attribute based
  *                                 upon the job and printer state...
- *   add_cupsd_job_subscriptions()     - Add any subcriptions for a job.
+ *   add_job_subscriptions()     - Add any subcriptions for a job.
  *   add_printer()               - Add a printer to the system.
- *   add_cupsd_printer_state_reasons() - Add the "printer-state-reasons" attribute
+ *   add_printer_state_reasons() - Add the "printer-state-reasons" attribute
  *                                 based upon the printer state...
  *   add_queued_job_count()      - Add the "queued-job-count" attribute for
  *   authenticate_job()          - Set job authentication info.
@@ -67,7 +67,7 @@
  *   ppd_parse_line()            - Parse a PPD default line.
  *   print_job()                 - Print a file to a printer or class.
  *   read_ps_line()              - Read a line from a PS file...
- *   read_ps_cupsd_job_ticket()        - Reads a job ticket embedded in a PS file.
+ *   read_ps_job_ticket()        - Reads a job ticket embedded in a PS file.
  *   reject_jobs()               - Reject print jobs to a printer.
  *   release_job()               - Release a held print job.
  *   restart_job()               - Restart an old print job.
@@ -115,10 +115,10 @@ static void       accept_jobs(cupsd_client_t *con, ipp_attribute_t *uri);
 static void    add_class(cupsd_client_t *con, ipp_attribute_t *uri);
 static int     add_file(cupsd_client_t *con, cupsd_job_t *job, mime_type_t *filetype,
                         int compression);
-static void    add_cupsd_job_state_reasons(cupsd_client_t *con, cupsd_job_t *job);
-static void    add_cupsd_job_subscriptions(cupsd_client_t *con, cupsd_job_t *job);
+static void    add_job_state_reasons(cupsd_client_t *con, cupsd_job_t *job);
+static void    add_job_subscriptions(cupsd_client_t *con, cupsd_job_t *job);
 static void    add_printer(cupsd_client_t *con, ipp_attribute_t *uri);
-static void    add_cupsd_printer_state_reasons(cupsd_client_t *con, cupsd_printer_t *p);
+static void    add_printer_state_reasons(cupsd_client_t *con, cupsd_printer_t *p);
 static void    add_queued_job_count(cupsd_client_t *con, cupsd_printer_t *p);
 static void    authenticate_job(cupsd_client_t *con, ipp_attribute_t *uri);
 static void    cancel_all_jobs(cupsd_client_t *con, ipp_attribute_t *uri);
@@ -152,7 +152,7 @@ static int  ppd_add_default(const char *option, const char *choice,
 static int     ppd_parse_line(const char *line, char *option, int olen,
                               char *choice, int clen);
 static void    print_job(cupsd_client_t *con, ipp_attribute_t *uri);
-static void    read_ps_cupsd_job_ticket(cupsd_client_t *con);
+static void    read_ps_job_ticket(cupsd_client_t *con);
 static void    reject_jobs(cupsd_client_t *con, ipp_attribute_t *uri);
 static void    release_job(cupsd_client_t *con, ipp_attribute_t *uri);
 static void    renew_subscription(cupsd_client_t *con, int sub_id);
@@ -177,7 +177,8 @@ static int  validate_user(cupsd_job_t *job, cupsd_client_t *con,
  */
 
 int                                    /* O - 1 on success, 0 on failure */
-cupsdProcessIPPRequest(cupsd_client_t *con)    /* I - Client connection */
+cupsdProcessIPPRequest(
+    cupsd_client_t *con)               /* I - Client connection */
 {
   ipp_tag_t            group;          /* Current group tag */
   ipp_attribute_t      *attr;          /* Current attribute */
@@ -188,8 +189,9 @@ cupsdProcessIPPRequest(cupsd_client_t *con) /* I - Client connection */
   int                  sub_id;         /* Subscription ID */
 
 
-  cupsdLogMessage(L_DEBUG2, "cupsdProcessIPPRequest(%p[%d]): operation_id = %04x",
-             con, con->http.fd, con->request->request.op.operation_id);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdProcessIPPRequest(%p[%d]): operation_id = %04x",
+                  con, con->http.fd, con->request->request.op.operation_id);
 
  /*
   * First build an empty response message for this request...
@@ -211,9 +213,10 @@ cupsdProcessIPPRequest(cupsd_client_t *con)        /* I - Client connection */
     * Return an error, since we only support IPP 1.x.
     */
 
-    cupsdLogMessage(L_ERROR, "cupsdProcessIPPRequest: bad request version (%d.%d)!",
-               con->request->request.any.version[0],
-              con->request->request.any.version[1]);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdProcessIPPRequest: bad request version (%d.%d)!",
+                    con->request->request.any.version[0],
+                   con->request->request.any.version[1]);
 
     cupsdAddEvent(CUPSD_EVENT_SERVER_AUDIT, NULL, NULL,
                   "%04X %s Bad request version (%d.%d)",
@@ -225,7 +228,8 @@ cupsdProcessIPPRequest(cupsd_client_t *con) /* I - Client connection */
   }  
   else if (con->request->attrs == NULL)
   {
-    cupsdLogMessage(L_ERROR, "cupsdProcessIPPRequest: no attributes in request!");
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdProcessIPPRequest: no attributes in request!");
 
     cupsdAddEvent(CUPSD_EVENT_SERVER_AUDIT, NULL, NULL,
                   "%04X %s No attributes in request",
@@ -249,7 +253,8 @@ cupsdProcessIPPRequest(cupsd_client_t *con) /* I - Client connection */
        * Out of order; return an error...
        */
 
-       cupsdLogMessage(L_ERROR, "cupsdProcessIPPRequest: attribute groups are out of order!");
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdProcessIPPRequest: attribute groups are out of order!");
 
        cupsdAddEvent(CUPSD_EVENT_SERVER_AUDIT, NULL, NULL,
                       "%04X %s Attribute groups are out of order",
@@ -325,7 +330,8 @@ cupsdProcessIPPRequest(cupsd_client_t *con) /* I - Client connection */
 
         if (!charset)
        {
-         cupsdLogMessage(L_ERROR, "cupsdProcessIPPRequest: missing attributes-charset attribute!");
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "cupsdProcessIPPRequest: missing attributes-charset attribute!");
 
          cupsdAddEvent(CUPSD_EVENT_SERVER_AUDIT, NULL, NULL,
                        "%04X %s Missing attributes-charset attribute",
@@ -334,7 +340,8 @@ cupsdProcessIPPRequest(cupsd_client_t *con) /* I - Client connection */
 
         if (!language)
        {
-         cupsdLogMessage(L_ERROR, "cupsdProcessIPPRequest: missing attributes-natural-language attribute!");
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "cupsdProcessIPPRequest: missing attributes-natural-language attribute!");
 
          cupsdAddEvent(CUPSD_EVENT_SERVER_AUDIT, NULL, NULL,
                        "%04X %s Missing attributes-natural-language attribute",
@@ -343,21 +350,23 @@ cupsdProcessIPPRequest(cupsd_client_t *con)       /* I - Client connection */
 
         if (!uri)
        {
-         cupsdLogMessage(L_ERROR, "cupsdProcessIPPRequest: missing printer-uri or job-uri attribute!");
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "cupsdProcessIPPRequest: missing printer-uri or job-uri attribute!");
 
          cupsdAddEvent(CUPSD_EVENT_SERVER_AUDIT, NULL, NULL,
                        "%04X %s Missing printer-uri or job-uri attribute",
                        IPP_BAD_REQUEST, con->http.hostname);
         }
 
-       cupsdLogMessage(L_DEBUG, "Request attributes follow...");
+       cupsdLogMessage(CUPSD_LOG_DEBUG, "Request attributes follow...");
 
        for (attr = con->request->attrs; attr != NULL; attr = attr->next)
-         cupsdLogMessage(L_DEBUG, "attr \"%s\": group_tag = %x, value_tag = %x",
-                    attr->name ? attr->name : "(null)", attr->group_tag,
-                    attr->value_tag);
+         cupsdLogMessage(CUPSD_LOG_DEBUG, 
+                         "attr \"%s\": group_tag = %x, value_tag = %x",
+                         attr->name ? attr->name : "(null)", attr->group_tag,
+                         attr->value_tag);
 
-       cupsdLogMessage(L_DEBUG, "End of attributes...");
+       cupsdLogMessage(CUPSD_LOG_DEBUG, "End of attributes...");
 
        send_ipp_error(con, IPP_BAD_REQUEST);
       }
@@ -398,8 +407,9 @@ cupsdProcessIPPRequest(cupsd_client_t *con) /* I - Client connection */
        */
 
         if (uri)
-          cupsdLogMessage(L_DEBUG2, "cupsdProcessIPPRequest: URI=\"%s\"",
-                    uri->values[0].string.text);
+          cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                         "cupsdProcessIPPRequest: URI=\"%s\"",
+                         uri->values[0].string.text);
 
        switch (con->request->request.op.operation_id)
        {
@@ -566,9 +576,10 @@ cupsdProcessIPPRequest(cupsd_client_t *con)        /* I - Client connection */
     * Sending data from the scheduler...
     */
 
-    cupsdLogMessage(L_DEBUG, "cupsdProcessIPPRequest: %d status_code=%x (%s)",
-               con->http.fd, con->response->request.status.status_code,
-              ippErrorString(con->response->request.status.status_code));
+    cupsdLogMessage(CUPSD_LOG_DEBUG,
+                    "cupsdProcessIPPRequest: %d status_code=%x (%s)",
+                    con->http.fd, con->response->request.status.status_code,
+                   ippErrorString(con->response->request.status.status_code));
 
     if (cupsdSendHeader(con, HTTP_OK, "application/ipp"))
     {
@@ -587,8 +598,9 @@ cupsdProcessIPPRequest(cupsd_client_t *con) /* I - Client connection */
                   con->http.data_remaining);
       }
 
-      cupsdLogMessage(L_DEBUG2, "cupsdProcessIPPRequest: Adding fd %d to OutputSet...",
-                con->http.fd);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdProcessIPPRequest: Adding fd %d to OutputSet...",
+                     con->http.fd);
 
       FD_SET(con->http.fd, OutputSet);
 
@@ -624,7 +636,7 @@ cupsdProcessIPPRequest(cupsd_client_t *con) /* I - Client connection */
  */
 
 static void
-accept_jobs(cupsd_client_t        *con,        /* I - Client connection */
+accept_jobs(cupsd_client_t  *con,      /* I - Client connection */
             ipp_attribute_t *uri)      /* I - Printer or class URI */
 {
   cups_ptype_t dtype;                  /* Destination type (printer or class) */
@@ -634,11 +646,11 @@ accept_jobs(cupsd_client_t        *con,   /* I - Client connection */
                resource[HTTP_MAX_URI]; /* Resource portion of URI */
   int          port;                   /* Port portion of URI */
   const char   *name;                  /* Printer name */
-  cupsd_printer_t      *printer;               /* Printer data */
+  cupsd_printer_t *printer;            /* Printer data */
 
 
-  cupsdLogMessage(L_DEBUG2, "accept_jobs(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "accept_jobs(%p[%d], %s)\n", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Was this operation called from the correct URI?
@@ -646,8 +658,9 @@ accept_jobs(cupsd_client_t        *con,     /* I - Client connection */
 
   if (strncmp(con->uri, "/admin/", 7) != 0)
   {
-    cupsdLogMessage(L_ERROR, "accept_jobs: admin request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "accept_jobs: admin request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -664,7 +677,8 @@ accept_jobs(cupsd_client_t        *con,     /* I - Client connection */
     * Bad URI...
     */
 
-    cupsdLogMessage(L_ERROR, "accept_jobs: resource name \'%s\' no good!", resource);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "accept_jobs: resource name \'%s\' no good!", resource);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -675,7 +689,7 @@ accept_jobs(cupsd_client_t        *con,     /* I - Client connection */
 
   if (!cupsdCheckPolicy(printer->op_policy_ptr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "accept_jobs: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "accept_jobs: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -694,8 +708,8 @@ accept_jobs(cupsd_client_t        *con,     /* I - Client connection */
   else
     cupsdSaveAllPrinters();
 
-  cupsdLogMessage(L_INFO, "Printer \'%s\' now accepting jobs (\'%s\').", name,
-             con->username);
+  cupsdLogMessage(CUPSD_LOG_INFO, "Printer \'%s\' now accepting jobs (\'%s\').", name,
+                  con->username);
 
  /*
   * Everything was ok, so return OK status...
@@ -710,7 +724,7 @@ accept_jobs(cupsd_client_t        *con,     /* I - Client connection */
  */
 
 static void
-add_class(cupsd_client_t        *con,          /* I - Client connection */
+add_class(cupsd_client_t  *con,                /* I - Client connection */
           ipp_attribute_t *uri)                /* I - URI of class */
 {
   int          i;                      /* Looping var */
@@ -719,7 +733,7 @@ add_class(cupsd_client_t        *con,               /* I - Client connection */
                host[HTTP_MAX_URI],     /* Host portion of URI */
                resource[HTTP_MAX_URI]; /* Resource portion of URI */
   int          port;                   /* Port portion of URI */
-  cupsd_printer_t      *pclass,                /* Class */
+  cupsd_printer_t *pclass,             /* Class */
                *member;                /* Member printer/class */
   cups_ptype_t dtype;                  /* Destination type */
   const char   *dest;                  /* Printer or class name */
@@ -727,8 +741,8 @@ add_class(cupsd_client_t        *con,               /* I - Client connection */
   int          modify;                 /* Non-zero if we just modified */
 
 
-  cupsdLogMessage(L_DEBUG2, "add_class(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_class(%p[%d], %s)\n", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Was this operation called from the correct URI?
@@ -736,8 +750,9 @@ add_class(cupsd_client_t        *con,               /* I - Client connection */
 
   if (strncmp(con->uri, "/admin/", 7) != 0)
   {
-    cupsdLogMessage(L_ERROR, "add_class: admin request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "add_class: admin request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -778,7 +793,7 @@ add_class(cupsd_client_t        *con,               /* I - Client connection */
 
   if (!cupsdCheckPolicy(DefaultPolicyPtr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "add_class: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "add_class: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -867,7 +882,7 @@ add_class(cupsd_client_t        *con,               /* I - Client connection */
 
   if ((attr = ippFindAttribute(con->request, "printer-is-accepting-jobs", IPP_TAG_BOOLEAN)) != NULL)
   {
-    cupsdLogMessage(L_INFO, "Setting %s printer-is-accepting-jobs to %d (was %d.)",
+    cupsdLogMessage(CUPSD_LOG_INFO, "Setting %s printer-is-accepting-jobs to %d (was %d.)",
                pclass->name, attr->values[0].boolean, pclass->accepting);
 
     pclass->accepting = attr->values[0].boolean;
@@ -876,8 +891,9 @@ add_class(cupsd_client_t        *con,               /* I - Client connection */
 
   if ((attr = ippFindAttribute(con->request, "printer-is-shared", IPP_TAG_BOOLEAN)) != NULL)
   {
-    cupsdLogMessage(L_INFO, "Setting %s printer-is-shared to %d (was %d.)",
-               pclass->name, attr->values[0].boolean, pclass->shared);
+    cupsdLogMessage(CUPSD_LOG_INFO,
+                    "Setting %s printer-is-shared to %d (was %d.)",
+                    pclass->name, attr->values[0].boolean, pclass->shared);
 
     pclass->shared = attr->values[0].boolean;
   }
@@ -887,14 +903,15 @@ add_class(cupsd_client_t        *con,             /* I - Client connection */
     if (attr->values[0].integer != IPP_PRINTER_IDLE &&
         attr->values[0].integer == IPP_PRINTER_STOPPED)
     {
-      cupsdLogMessage(L_ERROR, "Attempt to set %s printer-state to bad value %d!",
-                 pclass->name, attr->values[0].integer);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Attempt to set %s printer-state to bad value %d!",
+                      pclass->name, attr->values[0].integer);
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
 
-    cupsdLogMessage(L_INFO, "Setting %s printer-state to %d (was %d.)", pclass->name,
-               attr->values[0].integer, pclass->state);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Setting %s printer-state to %d (was %d.)", pclass->name,
+                    attr->values[0].integer, pclass->state);
 
     cupsdSetPrinterState(pclass, (ipp_pstate_t)(attr->values[0].integer), 0);
   }
@@ -907,11 +924,11 @@ add_class(cupsd_client_t        *con,             /* I - Client connection */
   if ((attr = ippFindAttribute(con->request, "job-sheets-default", IPP_TAG_ZERO)) != NULL &&
       !Classification)
   {
-    cupsdSetString(&pclass->cupsd_job_sheets[0], attr->values[0].string.text);
+    cupsdSetString(&pclass->job_sheets[0], attr->values[0].string.text);
     if (attr->num_values > 1)
-      cupsdSetString(&pclass->cupsd_job_sheets[1], attr->values[1].string.text);
+      cupsdSetString(&pclass->job_sheets[1], attr->values[1].string.text);
     else
-      cupsdSetString(&pclass->cupsd_job_sheets[1], "none");
+      cupsdSetString(&pclass->job_sheets[1], "none");
   }
   if ((attr = ippFindAttribute(con->request, "requesting-user-name-allowed",
                                IPP_TAG_ZERO)) != NULL)
@@ -940,24 +957,27 @@ add_class(cupsd_client_t        *con,             /* I - Client connection */
   if ((attr = ippFindAttribute(con->request, "job-quota-period",
                                IPP_TAG_INTEGER)) != NULL)
   {
-    cupsdLogMessage(L_DEBUG, "add_class: Setting job-quota-period to %d...",
-               attr->values[0].integer);
+    cupsdLogMessage(CUPSD_LOG_DEBUG,
+                    "add_class: Setting job-quota-period to %d...",
+                    attr->values[0].integer);
     cupsdFreeQuotas(pclass);
     pclass->quota_period = attr->values[0].integer;
   }
   if ((attr = ippFindAttribute(con->request, "job-k-limit",
                                IPP_TAG_INTEGER)) != NULL)
   {
-    cupsdLogMessage(L_DEBUG, "add_class: Setting job-k-limit to %d...",
-               attr->values[0].integer);
+    cupsdLogMessage(CUPSD_LOG_DEBUG,
+                    "add_class: Setting job-k-limit to %d...",
+                    attr->values[0].integer);
     cupsdFreeQuotas(pclass);
     pclass->k_limit = attr->values[0].integer;
   }
   if ((attr = ippFindAttribute(con->request, "job-page-limit",
                                IPP_TAG_INTEGER)) != NULL)
   {
-    cupsdLogMessage(L_DEBUG, "add_class: Setting job-page-limit to %d...",
-               attr->values[0].integer);
+    cupsdLogMessage(CUPSD_LOG_DEBUG,
+                    "add_class: Setting job-page-limit to %d...",
+                    attr->values[0].integer);
     cupsdFreeQuotas(pclass);
     pclass->page_limit = attr->values[0].integer;
   }
@@ -968,15 +988,17 @@ add_class(cupsd_client_t        *con,             /* I - Client connection */
 
     if ((p = cupsdFindPolicy(attr->values[0].string.text)) != NULL)
     {
-      cupsdLogMessage(L_DEBUG, "add_class: Setting printer-op-policy to \"%s\"...",
-                 attr->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_DEBUG,
+                      "add_class: Setting printer-op-policy to \"%s\"...",
+                      attr->values[0].string.text);
       cupsdSetString(&pclass->op_policy, attr->values[0].string.text);
       pclass->op_policy_ptr = p;
     }
     else
     {
-      cupsdLogMessage(L_ERROR, "add_class: Unknown printer-op-policy \"%s\"...",
-                 attr->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "add_class: Unknown printer-op-policy \"%s\"...",
+                      attr->values[0].string.text);
       send_ipp_error(con, IPP_NOT_POSSIBLE);
       return;
     }
@@ -987,14 +1009,16 @@ add_class(cupsd_client_t        *con,            /* I - Client connection */
         strcmp(attr->values[0].string.text, "retry-job") &&
         strcmp(attr->values[0].string.text, "stop-printer"))
     {
-      cupsdLogMessage(L_ERROR, "add_class: Unknown printer-error-policy \"%s\"...",
-                 attr->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                     "add_class: Unknown printer-error-policy \"%s\"...",
+                     attr->values[0].string.text);
       send_ipp_error(con, IPP_NOT_POSSIBLE);
       return;
     }
 
-    cupsdLogMessage(L_DEBUG, "add_class: Setting printer-error-policy to \"%s\"...",
-               attr->values[0].string.text);
+    cupsdLogMessage(CUPSD_LOG_DEBUG,
+                    "add_class: Setting printer-error-policy to \"%s\"...",
+                    attr->values[0].string.text);
     cupsdSetString(&pclass->error_policy, attr->values[0].string.text);
   }
   if ((attr = ippFindAttribute(con->request, "member-uris", IPP_TAG_URI)) != NULL)
@@ -1028,7 +1052,8 @@ add_class(cupsd_client_t        *con,             /* I - Client connection */
        * Bad URI...
        */
 
-        cupsdLogMessage(L_ERROR, "add_class: resource name \'%s\' no good!", resource);
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "add_class: resource name \'%s\' no good!", resource);
        send_ipp_error(con, IPP_NOT_FOUND);
        return;
       }
@@ -1057,8 +1082,8 @@ add_class(cupsd_client_t        *con,             /* I - Client connection */
                   "Class \'%s\' modified by \'%s\'.", pclass->name,
                  con->username);
 
-    cupsdLogMessage(L_INFO, "Class \'%s\' modified by \'%s\'.", pclass->name,
-               con->username);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Class \'%s\' modified by \'%s\'.",
+                    pclass->name, con->username);
   }
   else
   {
@@ -1068,8 +1093,8 @@ add_class(cupsd_client_t        *con,             /* I - Client connection */
                   "New class \'%s\' added by \'%s\'.", pclass->name,
                  con->username);
 
-    cupsdLogMessage(L_INFO, "New class \'%s\' added by \'%s\'.", pclass->name,
-               con->username);
+    cupsdLogMessage(CUPSD_LOG_INFO, "New class \'%s\' added by \'%s\'.",
+                    pclass->name, con->username);
   }
 
   con->response->request.status.status_code = IPP_OK;
@@ -1081,18 +1106,19 @@ add_class(cupsd_client_t        *con,           /* I - Client connection */
  */
 
 static int                             /* O - 0 on success, -1 on error */
-add_file(cupsd_client_t    *con,               /* I - Connection to client */
-         cupsd_job_t       *job,               /* I - Job to add to */
-         mime_type_t *filetype,                /* I - Type of file */
-        int         compression)       /* I - Compression */
+add_file(cupsd_client_t *con,          /* I - Connection to client */
+         cupsd_job_t    *job,          /* I - Job to add to */
+         mime_type_t    *filetype,     /* I - Type of file */
+        int            compression)    /* I - Compression */
 {
   mime_type_t  **filetypes;            /* New filetypes array... */
   int          *compressions;          /* New compressions array... */
 
 
-  cupsdLogMessage(L_DEBUG2, "add_file(con=%p[%d], job=%d, filetype=%s/%s, compression=%d)\n",
-             con, con->http.fd, job->id, filetype->super, filetype->type,
-            compression);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                 "add_file(con=%p[%d], job=%d, filetype=%s/%s, compression=%d)",
+                 con, con->http.fd, job->id, filetype->super, filetype->type,
+                 compression);
 
  /*
   * Add the file to the job...
@@ -1115,7 +1141,8 @@ add_file(cupsd_client_t    *con,          /* I - Connection to client */
   if (compressions == NULL || filetypes == NULL)
   {
     cupsdCancelJob(job->id, 1);
-    cupsdLogMessage(L_ERROR, "add_file: unable to allocate memory for file types!");
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "add_file: unable to allocate memory for file types!");
     send_ipp_error(con, IPP_INTERNAL_ERROR);
     return (-1);
   }
@@ -1132,19 +1159,20 @@ add_file(cupsd_client_t    *con,                /* I - Connection to client */
 
 
 /*
- * 'add_cupsd_job_state_reasons()' - Add the "job-state-reasons" attribute based
+ * 'add_job_state_reasons()' - Add the "job-state-reasons" attribute based
  *                             upon the job and printer state...
  */
 
 static void
-add_cupsd_job_state_reasons(cupsd_client_t *con,       /* I - Client connection */
-                      cupsd_job_t    *job)     /* I - Job info */
+add_job_state_reasons(
+    cupsd_client_t *con,               /* I - Client connection */
+    cupsd_job_t    *job)               /* I - Job info */
 {
-  cupsd_printer_t      *dest;                  /* Destination printer */
+  cupsd_printer_t      *dest;          /* Destination printer */
 
 
-  cupsdLogMessage(L_DEBUG2, "add_cupsd_job_state_reasons(%p[%d], %d)\n", con, con->http.fd,
-             job ? job->id : 0);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_job_state_reasons(%p[%d], %d)\n",
+                  con, con->http.fd, job ? job->id : 0);
 
   switch (job ? job->state->values[0].integer : IPP_JOB_CANCELLED)
   {
@@ -1201,12 +1229,13 @@ add_cupsd_job_state_reasons(cupsd_client_t *con,        /* I - Client connection */
 
 
 /*
- * 'add_cupsd_job_subscriptions()' - Add any subcriptions for a job.
+ * 'add_job_subscriptions()' - Add any subcriptions for a job.
  */
 
 static void
-add_cupsd_job_subscriptions(cupsd_client_t *con,       /* I - Client connection */
-                      cupsd_job_t    *job)     /* I - Newly created job */
+add_job_subscriptions(
+    cupsd_client_t *con,               /* I - Client connection */
+    cupsd_job_t    *job)               /* I - Newly created job */
 {
   int                  i;              /* Looping var */
   ipp_attribute_t      *prev,          /* Previous attribute */
@@ -1225,7 +1254,9 @@ add_cupsd_job_subscriptions(cupsd_client_t *con,  /* I - Client connection */
   * none...
   */
 
-  for (attr = job->attrs->attrs, prev = NULL; attr; prev = attr, attr = attr->next)
+  for (attr = job->attrs->attrs, prev = NULL;
+       attr;
+       prev = attr, attr = attr->next)
     if (attr->group_tag == IPP_TAG_SUBSCRIPTION)
       break;
 
@@ -1354,7 +1385,7 @@ add_cupsd_job_subscriptions(cupsd_client_t *con,  /* I - Client connection */
  */
 
 static void
-add_printer(cupsd_client_t        *con,        /* I - Client connection */
+add_printer(cupsd_client_t  *con,      /* I - Client connection */
             ipp_attribute_t *uri)      /* I - URI of printer */
 {
   int          i;                      /* Looping var */
@@ -1363,7 +1394,7 @@ add_printer(cupsd_client_t        *con,   /* I - Client connection */
                host[HTTP_MAX_URI],     /* Host portion of URI */
                resource[HTTP_MAX_URI]; /* Resource portion of URI */
   int          port;                   /* Port portion of URI */
-  cupsd_printer_t      *printer;               /* Printer/class */
+  cupsd_printer_t *printer;            /* Printer/class */
   ipp_attribute_t *attr;               /* Printer attribute */
   cups_file_t  *fp;                    /* Script/PPD file */
   char         line[1024];             /* Line from file... */
@@ -1372,8 +1403,8 @@ add_printer(cupsd_client_t        *con,   /* I - Client connection */
   int          modify;                 /* Non-zero if we are modifying */
 
 
-  cupsdLogMessage(L_DEBUG2, "add_printer(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_printer(%p[%d], %s)\n", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Was this operation called from the correct URI?
@@ -1381,8 +1412,9 @@ add_printer(cupsd_client_t        *con,   /* I - Client connection */
 
   if (strncmp(con->uri, "/admin/", 7) != 0)
   {
-    cupsdLogMessage(L_ERROR, "add_printer: admin request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "add_printer: admin request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -1399,8 +1431,8 @@ add_printer(cupsd_client_t        *con,   /* I - Client connection */
     * No, return an error...
     */
 
-    cupsdLogMessage(L_ERROR, "add_printer: bad printer URI \"%s\"!",
-               uri->values[0].string.text);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "add_printer: bad printer URI \"%s\"!",
+                    uri->values[0].string.text);
     send_ipp_error(con, IPP_BAD_REQUEST);
     return;
   }
@@ -1425,7 +1457,7 @@ add_printer(cupsd_client_t        *con,   /* I - Client connection */
 
   if (!cupsdCheckPolicy(DefaultPolicyPtr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "add_printer: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "add_printer: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -1447,8 +1479,9 @@ add_printer(cupsd_client_t        *con,   /* I - Client connection */
       * Yes, return an error...
       */
 
-      cupsdLogMessage(L_ERROR, "add_printer: \"%s\" already exists as a class!",
-                resource + 10);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "add_printer: \"%s\" already exists as a class!",
+                     resource + 10);
       send_ipp_error(con, IPP_NOT_POSSIBLE);
       return;
     }
@@ -1535,8 +1568,9 @@ add_printer(cupsd_client_t        *con,   /* I - Client connection */
         * File devices are disabled and the URL is not file:/dev/null...
        */
 
-       cupsdLogMessage(L_ERROR, "add_printer: File device URIs have been disabled! "
-                           "To enable, see the FileDevice directive in cupsd.conf.");
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "add_printer: File device URIs have been disabled! "
+                       "To enable, see the FileDevice directive in cupsd.conf.");
        send_ipp_error(con, IPP_NOT_POSSIBLE);
        return;
       }
@@ -1554,17 +1588,21 @@ add_printer(cupsd_client_t        *con, /* I - Client connection */
         * Could not find device in list!
        */
 
-       cupsdLogMessage(L_ERROR, "add_printer: bad device-uri attribute \'%s\'!",
-                  attr->values[0].string.text);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "add_printer: bad device-uri attribute \'%s\'!",
+                       attr->values[0].string.text);
        send_ipp_error(con, IPP_NOT_POSSIBLE);
        return;
       }
     }
 
-    cupsdLogMessage(L_INFO, "Setting %s device-uri to \"%s\" (was \"%s\".)",
-               printer->name,
-              cupsdSanitizeURI(attr->values[0].string.text, line, sizeof(line)),
-              cupsdSanitizeURI(printer->device_uri, resource, sizeof(resource)));
+    cupsdLogMessage(CUPSD_LOG_INFO,
+                    "Setting %s device-uri to \"%s\" (was \"%s\".)",
+                   printer->name,
+                   cupsdSanitizeURI(attr->values[0].string.text, line,
+                                    sizeof(line)),
+                   cupsdSanitizeURI(printer->device_uri, resource,
+                                    sizeof(resource)));
 
     cupsdSetString(&printer->device_uri, attr->values[0].string.text);
   }
@@ -1583,15 +1621,17 @@ add_printer(cupsd_client_t        *con, /* I - Client connection */
 
     if (i >= supported->num_values)
     {
-      cupsdLogMessage(L_ERROR, "add_printer: bad port-monitor attribute \'%s\'!",
-                attr->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "add_printer: bad port-monitor attribute \'%s\'!",
+                     attr->values[0].string.text);
       send_ipp_error(con, IPP_NOT_POSSIBLE);
       return;
     }
 
-    cupsdLogMessage(L_INFO, "Setting %s port-monitor to \"%s\" (was \"%s\".)",
-               printer->name, attr->values[0].string.text,
-              printer->port_monitor);
+    cupsdLogMessage(CUPSD_LOG_INFO,
+                    "Setting %s port-monitor to \"%s\" (was \"%s\".)",
+                    printer->name, attr->values[0].string.text,
+                   printer->port_monitor);
 
     if (strcmp(attr->values[0].string.text, "none"))
       cupsdSetString(&printer->port_monitor, attr->values[0].string.text);
@@ -1601,8 +1641,9 @@ add_printer(cupsd_client_t        *con,   /* I - Client connection */
 
   if ((attr = ippFindAttribute(con->request, "printer-is-accepting-jobs", IPP_TAG_BOOLEAN)) != NULL)
   {
-    cupsdLogMessage(L_INFO, "Setting %s printer-is-accepting-jobs to %d (was %d.)",
-               printer->name, attr->values[0].boolean, printer->accepting);
+    cupsdLogMessage(CUPSD_LOG_INFO,
+                    "Setting %s printer-is-accepting-jobs to %d (was %d.)",
+                    printer->name, attr->values[0].boolean, printer->accepting);
 
     printer->accepting = attr->values[0].boolean;
     cupsdAddPrinterHistory(printer);
@@ -1610,8 +1651,9 @@ add_printer(cupsd_client_t        *con,   /* I - Client connection */
 
   if ((attr = ippFindAttribute(con->request, "printer-is-shared", IPP_TAG_BOOLEAN)) != NULL)
   {
-    cupsdLogMessage(L_INFO, "Setting %s printer-is-shared to %d (was %d.)",
-               printer->name, attr->values[0].boolean, printer->shared);
+    cupsdLogMessage(CUPSD_LOG_INFO,
+                    "Setting %s printer-is-shared to %d (was %d.)",
+                    printer->name, attr->values[0].boolean, printer->shared);
 
     printer->shared = attr->values[0].boolean;
   }
@@ -1621,13 +1663,14 @@ add_printer(cupsd_client_t        *con, /* I - Client connection */
     if (attr->values[0].integer != IPP_PRINTER_IDLE &&
         attr->values[0].integer == IPP_PRINTER_STOPPED)
     {
-      cupsdLogMessage(L_ERROR, "Attempt to set %s printer-state to bad value %d!",
-                 printer->name, attr->values[0].integer);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Attempt to set %s printer-state to bad value %d!",
+                      printer->name, attr->values[0].integer);
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
 
-    cupsdLogMessage(L_INFO, "Setting %s printer-state to %d (was %d.)", printer->name,
+    cupsdLogMessage(CUPSD_LOG_INFO, "Setting %s printer-state to %d (was %d.)", printer->name,
                attr->values[0].integer, printer->state);
 
     cupsdSetPrinterState(printer, (ipp_pstate_t)(attr->values[0].integer), 0);
@@ -1641,11 +1684,11 @@ add_printer(cupsd_client_t        *con, /* I - Client connection */
   if ((attr = ippFindAttribute(con->request, "job-sheets-default", IPP_TAG_ZERO)) != NULL &&
       !Classification)
   {
-    cupsdSetString(&printer->cupsd_job_sheets[0], attr->values[0].string.text);
+    cupsdSetString(&printer->job_sheets[0], attr->values[0].string.text);
     if (attr->num_values > 1)
-      cupsdSetString(&printer->cupsd_job_sheets[1], attr->values[1].string.text);
+      cupsdSetString(&printer->job_sheets[1], attr->values[1].string.text);
     else
-      cupsdSetString(&printer->cupsd_job_sheets[1], "none");
+      cupsdSetString(&printer->job_sheets[1], "none");
   }
   if ((attr = ippFindAttribute(con->request, "requesting-user-name-allowed",
                                IPP_TAG_ZERO)) != NULL)
@@ -1674,7 +1717,7 @@ add_printer(cupsd_client_t        *con,   /* I - Client connection */
   if ((attr = ippFindAttribute(con->request, "job-quota-period",
                                IPP_TAG_INTEGER)) != NULL)
   {
-    cupsdLogMessage(L_DEBUG, "add_printer: Setting job-quota-period to %d...",
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "add_printer: Setting job-quota-period to %d...",
                attr->values[0].integer);
     cupsdFreeQuotas(printer);
     printer->quota_period = attr->values[0].integer;
@@ -1682,7 +1725,7 @@ add_printer(cupsd_client_t        *con,   /* I - Client connection */
   if ((attr = ippFindAttribute(con->request, "job-k-limit",
                                IPP_TAG_INTEGER)) != NULL)
   {
-    cupsdLogMessage(L_DEBUG, "add_printer: Setting job-k-limit to %d...",
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "add_printer: Setting job-k-limit to %d...",
                attr->values[0].integer);
     cupsdFreeQuotas(printer);
     printer->k_limit = attr->values[0].integer;
@@ -1690,7 +1733,7 @@ add_printer(cupsd_client_t        *con,   /* I - Client connection */
   if ((attr = ippFindAttribute(con->request, "job-page-limit",
                                IPP_TAG_INTEGER)) != NULL)
   {
-    cupsdLogMessage(L_DEBUG, "add_printer: Setting job-page-limit to %d...",
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "add_printer: Setting job-page-limit to %d...",
                attr->values[0].integer);
     cupsdFreeQuotas(printer);
     printer->page_limit = attr->values[0].integer;
@@ -1702,15 +1745,17 @@ add_printer(cupsd_client_t        *con, /* I - Client connection */
 
     if ((p = cupsdFindPolicy(attr->values[0].string.text)) != NULL)
     {
-      cupsdLogMessage(L_DEBUG, "add_printer: Setting printer-op-policy to \"%s\"...",
-                 attr->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_DEBUG,
+                      "add_printer: Setting printer-op-policy to \"%s\"...",
+                      attr->values[0].string.text);
       cupsdSetString(&printer->op_policy, attr->values[0].string.text);
       printer->op_policy_ptr = p;
     }
     else
     {
-      cupsdLogMessage(L_ERROR, "add_printer: Unknown printer-op-policy \"%s\"...",
-                 attr->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "add_printer: Unknown printer-op-policy \"%s\"...",
+                      attr->values[0].string.text);
       send_ipp_error(con, IPP_NOT_POSSIBLE);
       return;
     }
@@ -1721,14 +1766,16 @@ add_printer(cupsd_client_t        *con, /* I - Client connection */
         strcmp(attr->values[0].string.text, "retry-job") &&
         strcmp(attr->values[0].string.text, "stop-printer"))
     {
-      cupsdLogMessage(L_ERROR, "add_printer: Unknown printer-error-policy \"%s\"...",
-                 attr->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "add_printer: Unknown printer-error-policy \"%s\"...",
+                      attr->values[0].string.text);
       send_ipp_error(con, IPP_NOT_POSSIBLE);
       return;
     }
 
-    cupsdLogMessage(L_DEBUG, "add_printer: Setting printer-error-policy to \"%s\"...",
-               attr->values[0].string.text);
+    cupsdLogMessage(CUPSD_LOG_DEBUG,
+                    "add_printer: Setting printer-error-policy to \"%s\"...",
+                    attr->values[0].string.text);
     cupsdSetString(&printer->error_policy, attr->values[0].string.text);
   }
 
@@ -1782,14 +1829,16 @@ add_printer(cupsd_client_t        *con, /* I - Client connection */
 
        if (copy_file(srcfile, dstfile))
        {
-          cupsdLogMessage(L_ERROR, "add_printer: Unable to copy interface script from %s to %s - %s!",
-                    srcfile, dstfile, strerror(errno));
+          cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "add_printer: Unable to copy interface script from %s to %s - %s!",
+                         srcfile, dstfile, strerror(errno));
           send_ipp_error(con, IPP_INTERNAL_ERROR);
          return;
        }
        else
        {
-          cupsdLogMessage(L_DEBUG, "add_printer: Copied interface script successfully!");
+          cupsdLogMessage(CUPSD_LOG_DEBUG,
+                         "add_printer: Copied interface script successfully!");
           chmod(dstfile, 0755);
        }
       }
@@ -1806,14 +1855,16 @@ add_printer(cupsd_client_t        *con, /* I - Client connection */
 
        if (copy_file(srcfile, dstfile))
        {
-          cupsdLogMessage(L_ERROR, "add_printer: Unable to copy PPD file from %s to %s - %s!",
-                    srcfile, dstfile, strerror(errno));
+          cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "add_printer: Unable to copy PPD file from %s to %s - %s!",
+                         srcfile, dstfile, strerror(errno));
           send_ipp_error(con, IPP_INTERNAL_ERROR);
          return;
        }
        else
        {
-          cupsdLogMessage(L_DEBUG, "add_printer: Copied PPD file successfully!");
+          cupsdLogMessage(CUPSD_LOG_DEBUG,
+                         "add_printer: Copied PPD file successfully!");
           chmod(dstfile, 0644);
        }
       }
@@ -1859,14 +1910,16 @@ add_printer(cupsd_client_t        *con, /* I - Client connection */
 
       if (copy_model(con, attr->values[0].string.text, dstfile))
       {
-        cupsdLogMessage(L_ERROR, "add_printer: Unable to copy PPD file from %s to %s - %s!",
-                  attr->values[0].string.text, dstfile, strerror(errno));
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "add_printer: Unable to copy PPD file from %s to %s!",
+                       attr->values[0].string.text, dstfile);
         send_ipp_error(con, IPP_INTERNAL_ERROR);
        return;
       }
       else
       {
-        cupsdLogMessage(L_DEBUG, "add_printer: Copied PPD file successfully!");
+        cupsdLogMessage(CUPSD_LOG_DEBUG,
+                       "add_printer: Copied PPD file successfully!");
         chmod(dstfile, 0644);
       }
     }
@@ -1910,8 +1963,8 @@ add_printer(cupsd_client_t        *con,   /* I - Client connection */
                   "Printer \'%s\' modified by \'%s\'.", printer->name,
                  con->username);
 
-    cupsdLogMessage(L_INFO, "Printer \'%s\' modified by \'%s\'.", printer->name,
-               con->username);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Printer \'%s\' modified by \'%s\'.",
+                    printer->name, con->username);
   }
   else
   {
@@ -1921,8 +1974,8 @@ add_printer(cupsd_client_t        *con,   /* I - Client connection */
                   "New printer \'%s\' added by \'%s\'.", printer->name,
                  con->username);
 
-    cupsdLogMessage(L_INFO, "New printer \'%s\' added by \'%s\'.", printer->name,
-               con->username);
+    cupsdLogMessage(CUPSD_LOG_INFO, "New printer \'%s\' added by \'%s\'.",
+                    printer->name, con->username);
   }
 
   con->response->request.status.status_code = IPP_OK;
@@ -1930,17 +1983,18 @@ add_printer(cupsd_client_t        *con, /* I - Client connection */
 
 
 /*
- * 'add_cupsd_printer_state_reasons()' - Add the "printer-state-reasons" attribute
+ * 'add_printer_state_reasons()' - Add the "printer-state-reasons" attribute
  *                                 based upon the printer state...
  */
 
 static void
-add_cupsd_printer_state_reasons(
-    cupsd_client_t  *con,                      /* I - Client connection */
+add_printer_state_reasons(
+    cupsd_client_t  *con,              /* I - Client connection */
     cupsd_printer_t *p)                        /* I - Printer info */
 {
-  cupsdLogMessage(L_DEBUG2, "add_cupsd_printer_state_reasons(%p[%d], %p[%s])\n",
-             con, con->http.fd, p, p->name);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "add_printer_state_reasons(%p[%d], %p[%s])",
+                  con, con->http.fd, p, p->name);
 
   if (p->num_reasons == 0)
     ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
@@ -1959,14 +2013,15 @@ add_cupsd_printer_state_reasons(
  */
 
 static void
-add_queued_job_count(cupsd_client_t  *con,     /* I - Client connection */
-                     cupsd_printer_t *p)       /* I - Printer or class */
+add_queued_job_count(
+    cupsd_client_t  *con,              /* I - Client connection */
+    cupsd_printer_t *p)                        /* I - Printer or class */
 {
   int          count;                  /* Number of jobs on destination */
 
 
-  cupsdLogMessage(L_DEBUG2, "add_queued_job_count(%p[%d], %p[%s])\n",
-             con, con->http.fd, p, p->name);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_queued_job_count(%p[%d], %p[%s])",
+                  con, con->http.fd, p, p->name);
 
   count = cupsdGetPrinterJobCount(p->name);
 
@@ -1980,12 +2035,12 @@ add_queued_job_count(cupsd_client_t  *con,      /* I - Client connection */
  */
 
 static void
-authenticate_job(cupsd_client_t        *con,   /* I - Client connection */
+authenticate_job(cupsd_client_t  *con, /* I - Client connection */
                 ipp_attribute_t *uri)  /* I - Job URI */
 {
   ipp_attribute_t      *attr;          /* Job-id attribute */
   int                  jobid;          /* Job ID */
-  cupsd_job_t                  *job;           /* Current job */
+  cupsd_job_t          *job;           /* Current job */
   char                 method[HTTP_MAX_URI],
                                        /* Method portion of URI */
                        username[HTTP_MAX_URI],
@@ -1997,8 +2052,8 @@ authenticate_job(cupsd_client_t        *con,      /* I - Client connection */
   int                  port;           /* Port portion of URI */
 
 
-  cupsdLogMessage(L_DEBUG2, "authenticate_job(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "authenticate_job(%p[%d], %s)",
+                  con, con->http.fd, uri->values[0].string.text);
 
  /*
   * Start with "everything is OK" status...
@@ -2018,7 +2073,8 @@ authenticate_job(cupsd_client_t        *con,      /* I - Client connection */
 
     if ((attr = ippFindAttribute(con->request, "job-id", IPP_TAG_INTEGER)) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "authenticate_job: got a printer-uri attribute but no job-id!");
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "authenticate_job: got a printer-uri attribute but no job-id!");
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -2039,8 +2095,9 @@ authenticate_job(cupsd_client_t        *con,      /* I - Client connection */
       * Not a valid URI!
       */
 
-      cupsdLogMessage(L_ERROR, "authenticate_job: bad job-uri attribute \'%s\'!\n",
-                 uri->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "authenticate_job: bad job-uri attribute \'%s\'!\n",
+                      uri->values[0].string.text);
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -2058,7 +2115,8 @@ authenticate_job(cupsd_client_t        *con,      /* I - Client connection */
     * Nope - return a "not found" error...
     */
 
-    cupsdLogMessage(L_ERROR, "authenticate_job: job #%d doesn't exist!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "authenticate_job: job #%d doesn't exist!", jobid);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -2073,7 +2131,9 @@ authenticate_job(cupsd_client_t        *con,      /* I - Client connection */
     * Return a "not-possible" error...
     */
 
-    cupsdLogMessage(L_ERROR, "authenticate_job: job #%d is not held for authentication!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "authenticate_job: job #%d is not held for authentication!",
+                   jobid);
     send_ipp_error(con, IPP_NOT_POSSIBLE);
     return;
   }
@@ -2094,8 +2154,10 @@ authenticate_job(cupsd_client_t        *con,     /* I - Client connection */
 
   if (!validate_user(job, con, job->username, username, sizeof(username)))
   {
-    cupsdLogMessage(L_ERROR, "authenticate_job: \"%s\" not authorized to authenticate job id %d owned by \"%s\"!",
-               username, jobid, job->username);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "authenticate_job: \"%s\" not authorized to authenticate "
+                   "job id %d owned by \"%s\"!",
+                    username, jobid, job->username);
     send_ipp_error(con, IPP_FORBIDDEN);
     return;
   }
@@ -2125,8 +2187,8 @@ authenticate_job(cupsd_client_t        *con,      /* I - Client connection */
 
   cupsdReleaseJob(jobid);
 
-  cupsdLogMessage(L_INFO, "Job %d was authenticated by \'%s\'.", jobid,
-             con->username);
+  cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was authenticated by \'%s\'.", jobid,
+                  con->username);
 }
 
 
@@ -2135,7 +2197,7 @@ authenticate_job(cupsd_client_t        *con,      /* I - Client connection */
  */
 
 static void
-cancel_all_jobs(cupsd_client_t        *con,    /* I - Client connection */
+cancel_all_jobs(cupsd_client_t  *con,  /* I - Client connection */
                ipp_attribute_t *uri)   /* I - Job or Printer URI */
 {
   const char   *dest;                  /* Destination */
@@ -2148,11 +2210,11 @@ cancel_all_jobs(cupsd_client_t        *con,     /* I - Client connection */
   ipp_attribute_t *attr;               /* Attribute in request */
   const char   *username;              /* Username */
   int          purge;                  /* Purge? */
-  cupsd_printer_t      *printer;               /* Printer */
+  cupsd_printer_t *printer;            /* Printer */
 
 
-  cupsdLogMessage(L_DEBUG2, "cancel_all_jobs(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cancel_all_jobs(%p[%d], %s)", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Was this operation called from the correct URI?
@@ -2161,8 +2223,9 @@ cancel_all_jobs(cupsd_client_t        *con,       /* I - Client connection */
   if (strncmp(con->uri, "/admin/", 7) &&
       strncmp(con->uri, "/jobs/", 7))
   {
-    cupsdLogMessage(L_ERROR, "cancel_all_jobs: admin request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cancel_all_jobs: admin request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -2173,8 +2236,9 @@ cancel_all_jobs(cupsd_client_t        *con,       /* I - Client connection */
 
   if (strcmp(uri->name, "printer-uri"))
   {
-    cupsdLogMessage(L_ERROR, "cancel_all_jobs: bad %s attribute \'%s\'!",
-               uri->name, uri->values[0].string.text);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cancel_all_jobs: bad %s attribute \'%s\'!",
+                    uri->name, uri->values[0].string.text);
     send_ipp_error(con, IPP_BAD_REQUEST);
     return;
   }
@@ -2191,7 +2255,8 @@ cancel_all_jobs(cupsd_client_t        *con,       /* I - Client connection */
       username = attr->values[0].string.text;
     else
     {
-      cupsdLogMessage(L_ERROR, "cancel_all_jobs: missing requesting-user-name attribute!");
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cancel_all_jobs: missing requesting-user-name attribute!");
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -2199,16 +2264,6 @@ cancel_all_jobs(cupsd_client_t        *con,      /* I - Client connection */
   else
     username = NULL;
 
-  if ((!username ||
-       (username && con->username[0] && strcmp(username, con->username))) &&
-      strncmp(con->uri, "/admin/", 7))
-  {
-    cupsdLogMessage(L_ERROR, "cancel_all_jobs: only administrators can cancel "
-                        "other users\' jobs!");
-    send_ipp_error(con, IPP_NOT_AUTHORIZED);
-    return;
-  }
-
  /*
   * Look for the "purge-jobs" attribute...
   */
@@ -2233,7 +2288,9 @@ cancel_all_jobs(cupsd_client_t        *con,       /* I - Client connection */
 
     if (strcmp(resource, "/printers/") != 0)
     {
-      cupsdLogMessage(L_ERROR, "cancel_all_jobs: resource name \'%s\' no good!", resource);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cancel_all_jobs: resource name \'%s\' no good!",
+                     resource);
       send_ipp_error(con, IPP_NOT_FOUND);
       return;
     }
@@ -2244,7 +2301,7 @@ cancel_all_jobs(cupsd_client_t        *con,       /* I - Client connection */
 
     if (!cupsdCheckPolicy(DefaultPolicyPtr, con, NULL))
     {
-      cupsdLogMessage(L_ERROR, "cancel_all_jobs: not authorized!");
+      cupsdLogMessage(CUPSD_LOG_ERROR, "cancel_all_jobs: not authorized!");
       send_ipp_error(con, IPP_NOT_AUTHORIZED);
       return;
     }
@@ -2255,7 +2312,7 @@ cancel_all_jobs(cupsd_client_t        *con,       /* I - Client connection */
 
     cupsdCancelJobs(NULL, username, purge);
 
-    cupsdLogMessage(L_INFO, "All jobs were %s by \'%s\'.",
+    cupsdLogMessage(CUPSD_LOG_INFO, "All jobs were %s by \'%s\'.",
                purge ? "purged" : "cancelled", con->username);
   }
   else
@@ -2266,7 +2323,7 @@ cancel_all_jobs(cupsd_client_t        *con,       /* I - Client connection */
 
     if (!cupsdCheckPolicy(printer->op_policy_ptr, con, NULL))
     {
-      cupsdLogMessage(L_ERROR, "cancel_all_jobs: not authorized!");
+      cupsdLogMessage(CUPSD_LOG_ERROR, "cancel_all_jobs: not authorized!");
       send_ipp_error(con, IPP_NOT_AUTHORIZED);
       return;
     }
@@ -2277,8 +2334,8 @@ cancel_all_jobs(cupsd_client_t        *con,       /* I - Client connection */
 
     cupsdCancelJobs(dest, username, purge);
 
-    cupsdLogMessage(L_INFO, "All jobs on \'%s\' were %s by \'%s\'.", dest,
-               purge ? "purged" : "cancelled", con->username);
+    cupsdLogMessage(CUPSD_LOG_INFO, "All jobs on \'%s\' were %s by \'%s\'.",
+                    dest, purge ? "purged" : "cancelled", con->username);
   }
 
   con->response->request.status.status_code = IPP_OK;
@@ -2290,7 +2347,7 @@ cancel_all_jobs(cupsd_client_t        *con,       /* I - Client connection */
  */
 
 static void
-cancel_job(cupsd_client_t        *con, /* I - Client connection */
+cancel_job(cupsd_client_t  *con,       /* I - Client connection */
           ipp_attribute_t *uri)        /* I - Job or Printer URI */
 {
   ipp_attribute_t *attr;               /* Current attribute */
@@ -2300,14 +2357,14 @@ cancel_job(cupsd_client_t        *con,  /* I - Client connection */
                host[HTTP_MAX_URI],     /* Host portion of URI */
                resource[HTTP_MAX_URI]; /* Resource portion of URI */
   int          port;                   /* Port portion of URI */
-  cupsd_job_t          *job;                   /* Job information */
+  cupsd_job_t  *job;                   /* Job information */
   const char   *dest;                  /* Destination */
   cups_ptype_t dtype;                  /* Destination type (printer or class) */
-  cupsd_printer_t      *printer;               /* Printer data */
+  cupsd_printer_t *printer;            /* Printer data */
 
 
-  cupsdLogMessage(L_DEBUG2, "cancel_job(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cancel_job(%p[%d], %s)", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Verify that the POST operation was done to a valid URI.
@@ -2317,8 +2374,9 @@ cancel_job(cupsd_client_t        *con,    /* I - Client connection */
       strncmp(con->uri, "/jobs/", 5) != 0 &&
       strncmp(con->uri, "/printers/", 10) != 0)
   {
-    cupsdLogMessage(L_ERROR, "cancel_job: cancel request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cancel_job: cancel request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -2327,7 +2385,7 @@ cancel_job(cupsd_client_t        *con,    /* I - Client connection */
   * See if we have a job URI or a printer URI...
   */
 
-  if (strcmp(uri->name, "printer-uri") == 0)
+  if (!strcmp(uri->name, "printer-uri"))
   {
    /*
     * Got a printer URI; see if we also have a job-id attribute...
@@ -2335,7 +2393,8 @@ cancel_job(cupsd_client_t        *con,    /* I - Client connection */
 
     if ((attr = ippFindAttribute(con->request, "job-id", IPP_TAG_INTEGER)) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "cancel_job: got a printer-uri attribute but no job-id!");
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cancel_job: got a printer-uri attribute but no job-id!");
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -2354,7 +2413,8 @@ cancel_job(cupsd_client_t        *con,    /* I - Client connection */
        * Bad URI...
        */
 
-       cupsdLogMessage(L_ERROR, "cancel_job: resource name \'%s\' no good!", resource);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cancel_job: resource name \'%s\' no good!", resource);
        send_ipp_error(con, IPP_NOT_FOUND);
        return;
       }
@@ -2382,7 +2442,8 @@ cancel_job(cupsd_client_t        *con,    /* I - Client connection */
          jobid = job->id;
        else
        {
-         cupsdLogMessage(L_ERROR, "cancel_job: No active jobs on %s!", dest);
+         cupsdLogMessage(CUPSD_LOG_ERROR, "cancel_job: No active jobs on %s!",
+                         dest);
          send_ipp_error(con, IPP_NOT_POSSIBLE);
          return;
        }
@@ -2395,7 +2456,8 @@ cancel_job(cupsd_client_t        *con,    /* I - Client connection */
     * Got a job URI; parse it to get the job ID...
     */
 
-    httpSeparate(uri->values[0].string.text, method, username, host, &port, resource);
+    httpSeparate(uri->values[0].string.text, method, username, host, &port,
+                 resource);
  
     if (strncmp(resource, "/jobs/", 6) != 0)
     {
@@ -2403,8 +2465,9 @@ cancel_job(cupsd_client_t        *con,    /* I - Client connection */
       * Not a valid URI!
       */
 
-      cupsdLogMessage(L_ERROR, "cancel_job: bad job-uri attribute \'%s\'!",
-                 uri->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cancel_job: bad job-uri attribute \'%s\'!",
+                      uri->values[0].string.text);
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -2422,7 +2485,8 @@ cancel_job(cupsd_client_t        *con,    /* I - Client connection */
     * Nope - return a "not found" error...
     */
 
-    cupsdLogMessage(L_ERROR, "cancel_job: job #%d doesn't exist!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "cancel_job: job #%d doesn't exist!",
+                    jobid);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -2433,8 +2497,10 @@ cancel_job(cupsd_client_t        *con,   /* I - Client connection */
 
   if (!validate_user(job, con, job->username, username, sizeof(username)))
   {
-    cupsdLogMessage(L_ERROR, "cancel_job: \"%s\" not authorized to delete job id %d owned by \"%s\"!",
-               username, jobid, job->username);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cancel_job: \"%s\" not authorized to delete job id %d "
+                   "owned by \"%s\"!",
+                    username, jobid, job->username);
     send_ipp_error(con, IPP_FORBIDDEN);
     return;
   }
@@ -2446,11 +2512,12 @@ cancel_job(cupsd_client_t        *con,  /* I - Client connection */
 
   if (job->state->values[0].integer >= IPP_JOB_CANCELLED)
   {
-    cupsdLogMessage(L_ERROR, "cancel_job: job id %d is %s - can't cancel!",
-               jobid,
-              job->state->values[0].integer == IPP_JOB_CANCELLED ? "cancelled" :
-              job->state->values[0].integer == IPP_JOB_ABORTED ? "aborted" :
-              "completed");
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cancel_job: job id %d is %s - can't cancel!",
+                   jobid,
+                   job->state->values[0].integer == IPP_JOB_CANCELLED ? "cancelled" :
+                   job->state->values[0].integer == IPP_JOB_ABORTED ? "aborted" :
+                   "completed");
     send_ipp_error(con, IPP_NOT_POSSIBLE);
     return;
   }
@@ -2465,7 +2532,8 @@ cancel_job(cupsd_client_t        *con,    /* I - Client connection */
   cupsdCancelJob(jobid, 0);
   cupsdCheckJobs();
 
-  cupsdLogMessage(L_INFO, "Job %d was cancelled by \'%s\'.", jobid, username);
+  cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was cancelled by \'%s\'.", jobid,
+                  username);
 
   con->response->request.status.status_code = IPP_OK;
 }
@@ -2476,8 +2544,9 @@ cancel_job(cupsd_client_t        *con,    /* I - Client connection */
  */
 
 static void
-cancel_subscription(cupsd_client_t *con,       /* I - Client connection */
-                    int      sub_id)   /* I - Subscription ID */
+cancel_subscription(
+    cupsd_client_t *con,               /* I - Client connection */
+    int            sub_id)             /* I - Subscription ID */
 {
 }
 
@@ -2487,8 +2556,8 @@ cancel_subscription(cupsd_client_t *con,  /* I - Client connection */
  */
 
 static int                             /* O - 1 if OK, 0 if not */
-check_quotas(cupsd_client_t  *con,             /* I - Client connection */
-             cupsd_printer_t *p)               /* I - Printer or class */
+check_quotas(cupsd_client_t  *con,     /* I - Client connection */
+             cupsd_printer_t *p)       /* I - Printer or class */
 {
   int          i;                      /* Looping var */
   ipp_attribute_t *attr;               /* Current attribute */
@@ -2497,8 +2566,8 @@ check_quotas(cupsd_client_t  *con,                /* I - Client connection */
   struct passwd        *pw;                    /* User password data */
 
 
-  cupsdLogMessage(L_DEBUG2, "check_quotas(%p[%d], %p[%s])\n",
-             con, con->http.fd, p, p->name);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "check_quotas(%p[%d], %p[%s])",
+                  con, con->http.fd, p, p->name);
 
  /*
   * Check input...
@@ -2517,8 +2586,9 @@ check_quotas(cupsd_client_t  *con,                /* I - Client connection */
     strlcpy(username, con->username, sizeof(username));
   else if (attr != NULL)
   {
-    cupsdLogMessage(L_DEBUG, "check_quotas: requesting-user-name = \'%s\'",
-               attr->values[0].string.text);
+    cupsdLogMessage(CUPSD_LOG_DEBUG,
+                    "check_quotas: requesting-user-name = \'%s\'",
+                    attr->values[0].string.text);
 
     strlcpy(username, attr->values[0].string.text, sizeof(username));
   }
@@ -2537,7 +2607,8 @@ check_quotas(cupsd_client_t  *con,                /* I - Client connection */
 
     if (cupsdGetPrinterJobCount(p->name) >= MaxJobsPerPrinter)
     {
-      cupsdLogMessage(L_INFO, "Too many jobs for printer \"%s\"...", p->name);
+      cupsdLogMessage(CUPSD_LOG_INFO, "Too many jobs for printer \"%s\"...",
+                      p->name);
       return (0);
     }
   }
@@ -2550,7 +2621,8 @@ check_quotas(cupsd_client_t  *con,                /* I - Client connection */
 
     if (cupsdGetUserJobCount(username) >= MaxJobsPerUser)
     {
-      cupsdLogMessage(L_INFO, "Too many jobs for user \"%s\"...", username);
+      cupsdLogMessage(CUPSD_LOG_INFO, "Too many jobs for user \"%s\"...",
+                      username);
       return (0);
     }
   }
@@ -2582,8 +2654,9 @@ check_quotas(cupsd_client_t  *con,                /* I - Client connection */
 
     if ((i < p->num_users) == p->deny_users)
     {
-      cupsdLogMessage(L_INFO, "Denying user \"%s\" access to printer \"%s\"...",
-                username, p->name);
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "Denying user \"%s\" access to printer \"%s\"...",
+                     username, p->name);
       return (0);
     }
   }
@@ -2596,16 +2669,17 @@ check_quotas(cupsd_client_t  *con,              /* I - Client connection */
   {
     if ((q = cupsdUpdateQuota(p, username, 0, 0)) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "Unable to allocate quota data for user \"%s\"!",
-                 username);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Unable to allocate quota data for user \"%s\"!",
+                      username);
       return (0);
     }
 
     if ((q->k_count >= p->k_limit && p->k_limit) ||
         (q->page_count >= p->page_limit && p->page_limit))
     {
-      cupsdLogMessage(L_INFO, "User \"%s\" is over the quota limit...",
-                 username);
+      cupsdLogMessage(CUPSD_LOG_INFO, "User \"%s\" is over the quota limit...",
+                      username);
       return (0);
     }
   }
@@ -2632,9 +2706,10 @@ copy_attribute(
   ipp_attribute_t      *toattr;        /* Destination attribute */
 
 
-  cupsdLogMessage(L_DEBUG2, "copy_attribute(%p, %p[%s,%x,%x])\n", to, attr,
-             attr->name ? attr->name : "(null)", attr->group_tag,
-            attr->value_tag);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "copy_attribute(%p, %p[%s,%x,%x])", to, attr,
+                 attr->name ? attr->name : "(null)", attr->group_tag,
+                 attr->value_tag);
 
   switch (attr->value_tag & ~IPP_TAG_COPY)
   {
@@ -2795,7 +2870,8 @@ copy_attrs(ipp_t           *to,           /* I - Destination request */
   ipp_attribute_t      *fromattr;      /* Source attribute */
 
 
-  cupsdLogMessage(L_DEBUG2, "copy_attrs(%p, %p, %p, %x)\n", to, from, req, group);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "copy_attrs(%p, %p, %p, %x)", to, from,
+                  req, group);
 
   if (to == NULL || from == NULL)
     return;
@@ -2834,14 +2910,14 @@ copy_attrs(ipp_t           *to,         /* I - Destination request */
  */
 
 static int                             /* O - Size of banner file in kbytes */
-copy_banner(cupsd_client_t   *con,             /* I - Client connection */
-            cupsd_job_t      *job,             /* I - Job information */
-            const char *name)          /* I - Name of banner */
+copy_banner(cupsd_client_t *con,       /* I - Client connection */
+            cupsd_job_t    *job,       /* I - Job information */
+            const char     *name)      /* I - Name of banner */
 {
   int          i;                      /* Looping var */
   int          kbytes;                 /* Size of banner file in kbytes */
   char         filename[1024];         /* Job filename */
-  cupsd_banner_t       *banner;                /* Pointer to banner */
+  cupsd_banner_t *banner;              /* Pointer to banner */
   cups_file_t  *in;                    /* Input file */
   cups_file_t  *out;                   /* Output file */
   int          ch;                     /* Character from file */
@@ -2850,8 +2926,8 @@ copy_banner(cupsd_client_t   *con,                /* I - Client connection */
   ipp_attribute_t *attr;               /* Attribute */
 
 
-  cupsdLogMessage(L_DEBUG2, "copy_banner(%p[%d], %p[%d], %s)",
-             con, con->http.fd, job, job->id, name ? name : "(null)");
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "copy_banner(%p[%d], %p[%d], %s)",
+                  con, con->http.fd, job, job->id, name ? name : "(null)");
 
  /*
   * Find the banner; return if not found or "none"...
@@ -2873,8 +2949,9 @@ copy_banner(cupsd_client_t   *con,                /* I - Client connection */
            job->num_files);
   if ((out = cupsFileOpen(filename, "w")) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "copy_banner: Unable to create banner job file %s - %s",
-               filename, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "copy_banner: Unable to create banner job file %s - %s",
+                    filename, strerror(errno));
     job->num_files --;
     return (0);
   }
@@ -2928,8 +3005,9 @@ copy_banner(cupsd_client_t   *con,                /* I - Client connection */
   {
     cupsFileClose(out);
     unlink(filename);
-    cupsdLogMessage(L_ERROR, "copy_banner: Unable to open banner template file %s - %s",
-               filename, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "copy_banner: Unable to open banner template file %s - %s",
+                    filename, strerror(errno));
     job->num_files --;
     return (0);
   }
@@ -3112,7 +3190,7 @@ copy_file(const char *from,               /* I - Source file */
   char         buffer[2048];           /* Copy buffer */
 
 
-  cupsdLogMessage(L_DEBUG2, "copy_file(\"%s\", \"%s\")\n", from, to);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "copy_file(\"%s\", \"%s\")", from, to);
 
  /*
   * Open the source and destination file for a copy...
@@ -3155,9 +3233,9 @@ copy_file(const char *from,               /* I - Source file */
  */
 
 static int                             /* O - 0 = success, -1 = error */
-copy_model(cupsd_client_t   *con,              /* I - Client connection */
-           const char *from,           /* I - Source file */
-           const char *to)             /* I - Destination file */
+copy_model(cupsd_client_t *con,                /* I - Client connection */
+           const char     *from,       /* I - Source file */
+           const char     *to)         /* I - Destination file */
 {
   fd_set       *input;                 /* select() input set */
   struct timeval timeout;              /* select() timeout */
@@ -3189,8 +3267,9 @@ copy_model(cupsd_client_t   *con,         /* I - Client connection */
 #endif /* HAVE_LIBPAPER */
 
 
-  cupsdLogMessage(L_DEBUG2, "copy_model(con=%p, from=\"%s\", to=\"%s\")\n",
-             con, from, to);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                 "copy_model(con=%p, from=\"%s\", to=\"%s\")",
+                 con, from, to);
 
  /*
   * Run cups-driverd to get the PPD file...
@@ -3216,12 +3295,14 @@ copy_model(cupsd_client_t   *con,               /* I - Client connection */
     close(tempfd);
     unlink(tempfile);
 
-    cupsdLogMessage(L_ERROR, "copy_model: Unable to allocate %d bytes for select()...",
-               SetSize);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "copy_model: Unable to allocate %d bytes for select()...",
+                    SetSize);
     return (-1);
   }
 
-  cupsdLogMessage(L_DEBUG, "copy_model: Running \"cups-driverd cat %s\"...", from);
+  cupsdLogMessage(CUPSD_LOG_DEBUG,
+                  "copy_model: Running \"cups-driverd cat %s\"...", from);
 
   if (!cupsdStartProcess(buffer, argv, envp, -1, temppipe[1], CGIPipes[1],
                          -1, 0, &temppid))
@@ -3304,7 +3385,7 @@ copy_model(cupsd_client_t   *con,         /* I - Client connection */
     * No data from cups-deviced...
     */
 
-    cupsdLogMessage(L_ERROR, "copy_model: empty PPD file!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "copy_model: empty PPD file!");
     unlink(tempfile);
     return (-1);
   }
@@ -3525,7 +3606,7 @@ copy_model(cupsd_client_t   *con,         /* I - Client connection */
  */
 
 static void
-create_job(cupsd_client_t        *con, /* I - Client connection */
+create_job(cupsd_client_t  *con,       /* I - Client connection */
           ipp_attribute_t *uri)        /* I - Printer URI */
 {
   ipp_attribute_t *attr;               /* Current attribute */
@@ -3533,21 +3614,21 @@ create_job(cupsd_client_t        *con,  /* I - Client connection */
   cups_ptype_t dtype;                  /* Destination type (printer or class) */
   int          priority;               /* Job priority */
   char         *title;                 /* Job name/title */
-  cupsd_job_t          *job;                   /* Current job */
+  cupsd_job_t  *job;                   /* Current job */
   char         job_uri[HTTP_MAX_URI],  /* Job URI */
                method[HTTP_MAX_URI],   /* Method portion of URI */
                username[HTTP_MAX_URI], /* Username portion of URI */
                host[HTTP_MAX_URI],     /* Host portion of URI */
                resource[HTTP_MAX_URI]; /* Resource portion of URI */
   int          port;                   /* Port portion of URI */
-  cupsd_printer_t      *printer;               /* Printer data */
+  cupsd_printer_t *printer;            /* Printer data */
   int          kbytes;                 /* Size of print file */
   int          i;                      /* Looping var */
   int          lowerpagerange;         /* Page range bound */
 
 
-  cupsdLogMessage(L_DEBUG2, "create_job(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "create_job(%p[%d], %s)", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Verify that the POST operation was done to a valid URI.
@@ -3556,8 +3637,9 @@ create_job(cupsd_client_t        *con,    /* I - Client connection */
   if (strncmp(con->uri, "/classes/", 9) != 0 &&
       strncmp(con->uri, "/printers/", 10) != 0)
   {
-    cupsdLogMessage(L_ERROR, "create_job: cancel request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "create_job: cancel request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -3574,7 +3656,8 @@ create_job(cupsd_client_t        *con,    /* I - Client connection */
     * Bad URI...
     */
 
-    cupsdLogMessage(L_ERROR, "create_job: resource name \'%s\' no good!", resource);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "create_job: resource name \'%s\' no good!", resource);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -3587,7 +3670,7 @@ create_job(cupsd_client_t        *con,    /* I - Client connection */
       strcasecmp(con->http.hostname, "localhost") &&
       strcasecmp(con->http.hostname, ServerName))
   {
-    cupsdLogMessage(L_ERROR, "print_job: printer not shared!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "print_job: printer not shared!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -3599,7 +3682,7 @@ create_job(cupsd_client_t        *con,    /* I - Client connection */
   if (!cupsdCheckPolicy(printer->op_policy_ptr, con, NULL) ||
       ((printer->type & CUPS_PRINTER_AUTHENTICATED) && !con->username[0]))
   {
-    cupsdLogMessage(L_ERROR, "create_job: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "create_job: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -3610,8 +3693,9 @@ create_job(cupsd_client_t        *con,    /* I - Client connection */
 
   if (!printer->accepting)
   {
-    cupsdLogMessage(L_INFO, "create_job: destination \'%s\' is not accepting jobs.",
-               dest);
+    cupsdLogMessage(CUPSD_LOG_INFO,
+                    "create_job: destination \'%s\' is not accepting jobs.",
+                    dest);
     send_ipp_error(con, IPP_NOT_ACCEPTING);
     return;
   }
@@ -3624,8 +3708,8 @@ create_job(cupsd_client_t        *con,    /* I - Client connection */
   {
     if (attr->values[0].integer < 1 || attr->values[0].integer > MaxCopies)
     {
-      cupsdLogMessage(L_ERROR, "create_job: Bad copies value %d.",
-                 attr->values[0].integer);
+      cupsdLogMessage(CUPSD_LOG_ERROR, "create_job: Bad copies value %d.",
+                      attr->values[0].integer);
       send_ipp_error(con, IPP_ATTRIBUTES);
       ippAddInteger(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_INTEGER,
                   "copies", attr->values[0].integer);
@@ -3640,8 +3724,10 @@ create_job(cupsd_client_t        *con,   /* I - Client connection */
       if (attr->values[i].range.lower < lowerpagerange || 
          attr->values[i].range.lower > attr->values[i].range.upper)
       {
-       cupsdLogMessage(L_ERROR, "create_job: bad page-ranges values %d-%d.",
-                  attr->values[i].range.lower, attr->values[i].range.upper);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "create_job: bad page-ranges values %d-%d.",
+                       attr->values[i].range.lower,
+                       attr->values[i].range.upper);
        send_ipp_error(con, IPP_BAD_REQUEST);
        return;
       }
@@ -3659,7 +3745,7 @@ create_job(cupsd_client_t        *con,    /* I - Client connection */
 
   if (cupsArrayCount(Jobs) >= MaxJobs && MaxJobs)
   {
-    cupsdLogMessage(L_INFO, "create_job: too many jobs.");
+    cupsdLogMessage(CUPSD_LOG_INFO, "create_job: too many jobs.");
     send_ipp_error(con, IPP_NOT_POSSIBLE);
     return;
   }
@@ -3688,8 +3774,9 @@ create_job(cupsd_client_t        *con,    /* I - Client connection */
 
   if ((job = cupsdAddJob(priority, printer->name)) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "create_job: unable to add job for destination \'%s\'!",
-               dest);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "create_job: unable to add job for destination \'%s\'!",
+                    dest);
     send_ipp_error(con, IPP_INTERNAL_ERROR);
     return;
   }
@@ -3707,8 +3794,9 @@ create_job(cupsd_client_t        *con,    /* I - Client connection */
   }
   else if (attr != NULL)
   {
-    cupsdLogMessage(L_DEBUG, "create_job: requesting-user-name = \'%s\'",
-               attr->values[0].string.text);
+    cupsdLogMessage(CUPSD_LOG_DEBUG,
+                    "create_job: requesting-user-name = \'%s\'",
+                    attr->values[0].string.text);
 
     cupsdSetString(&job->username, attr->values[0].string.text);
   }
@@ -3716,8 +3804,8 @@ create_job(cupsd_client_t        *con,    /* I - Client connection */
     cupsdSetString(&job->username, "anonymous");
 
   if (attr == NULL)
-    ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-originating-user-name",
-                 NULL, job->username);
+    ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME,
+                 "job-originating-user-name", NULL, job->username);
   else
   {
     attr->group_tag = IPP_TAG_JOB;
@@ -3851,16 +3939,17 @@ create_job(cupsd_client_t        *con,  /* I - Client connection */
 
     if ((attr = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_ZERO)) == NULL)
     {
-      cupsdLogMessage(L_DEBUG, "Adding default job-sheets values \"%s,%s\"...",
-                 printer->cupsd_job_sheets[0], printer->cupsd_job_sheets[1]);
+      cupsdLogMessage(CUPSD_LOG_DEBUG,
+                      "Adding default job-sheets values \"%s,%s\"...",
+                      printer->job_sheets[0], printer->job_sheets[1]);
 
       attr = ippAddStrings(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-sheets",
                            2, NULL, NULL);
-      attr->values[0].string.text = strdup(printer->cupsd_job_sheets[0]);
-      attr->values[1].string.text = strdup(printer->cupsd_job_sheets[1]);
+      attr->values[0].string.text = strdup(printer->job_sheets[0]);
+      attr->values[1].string.text = strdup(printer->job_sheets[1]);
     }
 
-    job->cupsd_job_sheets = attr;
+    job->job_sheets = attr;
 
    /*
     * Enforce classification level if set...
@@ -3868,14 +3957,16 @@ create_job(cupsd_client_t        *con,  /* I - Client connection */
 
     if (Classification)
     {
-      cupsdLogMessage(L_INFO, "Classification=\"%s\", ClassifyOverride=%d",
-                 Classification ? Classification : "(null)", ClassifyOverride);
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "Classification=\"%s\", ClassifyOverride=%d",
+                      Classification ? Classification : "(null)",
+                     ClassifyOverride);
 
       if (ClassifyOverride)
       {
-        if (strcmp(attr->values[0].string.text, "none") == 0 &&
+        if (!strcmp(attr->values[0].string.text, "none") &&
            (attr->num_values == 1 ||
-            strcmp(attr->values[1].string.text, "none") == 0))
+            !strcmp(attr->values[1].string.text, "none")))
         {
         /*
           * Force the leading banner to have the classification on it...
@@ -3883,11 +3974,10 @@ create_job(cupsd_client_t        *con,  /* I - Client connection */
 
           cupsdSetString(&attr->values[0].string.text, Classification);
 
-         cupsdLogMessage(L_NOTICE, "[Job %d] CLASSIFICATION FORCED "
-                              "job-sheets=\"%s,none\", "
-                              "job-originating-user-name=\"%s\"",
-                    job->id, Classification,
-                    job->username);
+         cupsdLogMessage(CUPSD_LOG_NOTICE, "[Job %d] CLASSIFICATION FORCED "
+                                           "job-sheets=\"%s,none\", "
+                                           "job-originating-user-name=\"%s\"",
+                        job->id, Classification, job->username);
        }
        else if (attr->num_values == 2 &&
                 strcmp(attr->values[0].string.text, attr->values[1].string.text) != 0 &&
@@ -3900,12 +3990,11 @@ create_job(cupsd_client_t        *con,  /* I - Client connection */
 
           cupsdSetString(&attr->values[1].string.text, attr->values[0].string.text);
 
-         cupsdLogMessage(L_NOTICE, "[Job %d] CLASSIFICATION FORCED "
-                              "job-sheets=\"%s,%s\", "
-                              "job-originating-user-name=\"%s\"",
-                    job->id, attr->values[0].string.text,
-                    attr->values[1].string.text,
-                    job->username);
+         cupsdLogMessage(CUPSD_LOG_NOTICE, "[Job %d] CLASSIFICATION FORCED "
+                                           "job-sheets=\"%s,%s\", "
+                                           "job-originating-user-name=\"%s\"",
+                        job->id, attr->values[0].string.text,
+                        attr->values[1].string.text, job->username);
        }
        else if (strcmp(attr->values[0].string.text, Classification) &&
                 strcmp(attr->values[0].string.text, "none") &&
@@ -3914,18 +4003,18 @@ create_job(cupsd_client_t        *con,  /* I - Client connection */
                   strcmp(attr->values[1].string.text, "none"))))
         {
          if (attr->num_values == 1)
-            cupsdLogMessage(L_NOTICE, "[Job %d] CLASSIFICATION OVERRIDDEN "
-                                "job-sheets=\"%s\", "
-                                "job-originating-user-name=\"%s\"",
-                      job->id, attr->values[0].string.text,
-                      job->username);
+            cupsdLogMessage(CUPSD_LOG_NOTICE,
+                           "[Job %d] CLASSIFICATION OVERRIDDEN "
+                           "job-sheets=\"%s\", "
+                           "job-originating-user-name=\"%s\"",
+                      job->id, attr->values[0].string.text, job->username);
           else
-            cupsdLogMessage(L_NOTICE, "[Job %d] CLASSIFICATION OVERRIDDEN "
-                                "job-sheets=\"%s,%s\",fffff "
-                                "job-originating-user-name=\"%s\"",
-                      job->id, attr->values[0].string.text,
-                      attr->values[1].string.text,
-                      job->username);
+            cupsdLogMessage(CUPSD_LOG_NOTICE,
+                           "[Job %d] CLASSIFICATION OVERRIDDEN "
+                           "job-sheets=\"%s,%s\",fffff "
+                           "job-originating-user-name=\"%s\"",
+                           job->id, attr->values[0].string.text,
+                           attr->values[1].string.text, job->username);
         }
       }
       else if (strcmp(attr->values[0].string.text, Classification) != 0 &&
@@ -3954,18 +4043,18 @@ create_job(cupsd_client_t        *con,  /* I - Client connection */
         }
 
         if (attr->num_values > 1)
-         cupsdLogMessage(L_NOTICE, "[Job %d] CLASSIFICATION FORCED "
-                              "job-sheets=\"%s,%s\", "
-                              "job-originating-user-name=\"%s\"",
-                    job->id, attr->values[0].string.text,
-                    attr->values[1].string.text,
-                    job->username);
+         cupsdLogMessage(CUPSD_LOG_NOTICE,
+                         "[Job %d] CLASSIFICATION FORCED "
+                         "job-sheets=\"%s,%s\", "
+                         "job-originating-user-name=\"%s\"",
+                         job->id, attr->values[0].string.text,
+                         attr->values[1].string.text, job->username);
         else
-         cupsdLogMessage(L_NOTICE, "[Job %d] CLASSIFICATION FORCED "
-                              "job-sheets=\"%s\", "
-                              "job-originating-user-name=\"%s\"",
-                    job->id, Classification,
-                    job->username);
+         cupsdLogMessage(CUPSD_LOG_NOTICE,
+                         "[Job %d] CLASSIFICATION FORCED "
+                         "job-sheets=\"%s\", "
+                         "job-originating-user-name=\"%s\"",
+                        job->id, Classification, job->username);
       }
     }
 
@@ -3975,8 +4064,9 @@ create_job(cupsd_client_t        *con,    /* I - Client connection */
 
     if (!(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)))
     {
-      cupsdLogMessage(L_INFO, "Adding start banner page \"%s\" to job %d.",
-                 attr->values[0].string.text, job->id);
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "Adding start banner page \"%s\" to job %d.",
+                      attr->values[0].string.text, job->id);
 
       kbytes = copy_banner(con, job, attr->values[0].string.text);
 
@@ -3990,7 +4080,7 @@ create_job(cupsd_client_t        *con,    /* I - Client connection */
   * Add any job subscriptions...
   */
 
-  add_cupsd_job_subscriptions(con, job);
+  add_job_subscriptions(con, job);
 
  /*
   * Set all but the first two attributes to the job attributes group...
@@ -4005,8 +4095,8 @@ create_job(cupsd_client_t        *con,    /* I - Client connection */
    
   cupsdSaveJob(job->id);
 
-  cupsdLogMessage(L_INFO, "Job %d created on \'%s\' by \'%s\'.", job->id,
-             job->dest, job->username);
+  cupsdLogMessage(CUPSD_LOG_INFO, "Job %d created on \'%s\' by \'%s\'.",
+                  job->id, job->dest, job->username);
 
   cupsdAddEvent(CUPSD_EVENT_JOB_CREATED, printer, job, "Job created.");
 
@@ -4034,7 +4124,7 @@ create_job(cupsd_client_t        *con,    /* I - Client connection */
 
 static void
 create_subscription(
-    cupsd_client_t        *con,                /* I - Client connection */
+    cupsd_client_t  *con,              /* I - Client connection */
     ipp_attribute_t *uri)              /* I - Printer URI */
 {
 }
@@ -4045,7 +4135,7 @@ create_subscription(
  */
 
 static void
-delete_printer(cupsd_client_t        *con,     /* I - Client connection */
+delete_printer(cupsd_client_t  *con,   /* I - Client connection */
                ipp_attribute_t *uri)   /* I - URI of printer or class */
 {
   const char   *dest;                  /* Destination */
@@ -4055,12 +4145,12 @@ delete_printer(cupsd_client_t        *con,      /* I - Client connection */
                host[HTTP_MAX_URI],     /* Host portion of URI */
                resource[HTTP_MAX_URI]; /* Resource portion of URI */
   int          port;                   /* Port portion of URI */
-  cupsd_printer_t      *printer;               /* Printer/class */
+  cupsd_printer_t *printer;            /* Printer/class */
   char         filename[1024];         /* Script/PPD filename */
 
 
-  cupsdLogMessage(L_DEBUG2, "delete_printer(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "delete_printer(%p[%d], %s)", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Was this operation called from the correct URI?
@@ -4068,8 +4158,9 @@ delete_printer(cupsd_client_t        *con,        /* I - Client connection */
 
   if (strncmp(con->uri, "/admin/", 7) != 0)
   {
-    cupsdLogMessage(L_ERROR, "delete_printer: admin request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "delete_printer: admin request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -4086,7 +4177,8 @@ delete_printer(cupsd_client_t        *con,        /* I - Client connection */
     * Bad URI...
     */
 
-    cupsdLogMessage(L_ERROR, "delete_printer: resource name \'%s\' no good!", resource);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "delete_printer: resource name \'%s\' no good!", resource);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -4097,7 +4189,7 @@ delete_printer(cupsd_client_t        *con,        /* I - Client connection */
 
   if (!cupsdCheckPolicy(DefaultPolicyPtr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "delete_printer: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "delete_printer: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -4131,16 +4223,16 @@ delete_printer(cupsd_client_t        *con,      /* I - Client connection */
 
   if (dtype & CUPS_PRINTER_CLASS)
   {
-    cupsdLogMessage(L_INFO, "Class \'%s\' deleted by \'%s\'.", dest,
-               con->username);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Class \'%s\' deleted by \'%s\'.", dest,
+                    con->username);
 
     cupsdDeletePrinter(printer, 0);
     cupsdSaveAllClasses();
   }
   else
   {
-    cupsdLogMessage(L_INFO, "Printer \'%s\' deleted by \'%s\'.", dest,
-               con->username);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Printer \'%s\' deleted by \'%s\'.", dest,
+                    con->username);
 
     cupsdDeletePrinter(printer, 0);
     cupsdSaveAllPrinters();
@@ -4159,7 +4251,7 @@ delete_printer(cupsd_client_t        *con,        /* I - Client connection */
  */
 
 static void
-get_default(cupsd_client_t *con)               /* I - Client connection */
+get_default(cupsd_client_t *con)       /* I - Client connection */
 {
   int                  i;              /* Looping var */
   ipp_attribute_t      *requested,     /* requested-attributes */
@@ -4170,7 +4262,7 @@ get_default(cupsd_client_t *con)          /* I - Client connection */
   time_t               curtime;        /* Current time */
 
 
-  cupsdLogMessage(L_DEBUG2, "get_default(%p[%d])\n", con, con->http.fd);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_default(%p[%d])", con, con->http.fd);
 
  /*
   * Check policy...
@@ -4178,7 +4270,7 @@ get_default(cupsd_client_t *con)          /* I - Client connection */
 
   if (!cupsdCheckPolicy(DefaultPolicyPtr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "get_default: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "get_default: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -4197,13 +4289,14 @@ get_default(cupsd_client_t *con)                /* I - Client connection */
                con->servername, con->serverport, DefaultPrinter->name);
       ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_URI,
                   "printer-uri-supported", NULL, printer_uri);
-      cupsdLogMessage(L_DEBUG2, "printer-uri-supported=\"%s\"", printer_uri);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2, "printer-uri-supported=\"%s\"",
+                      printer_uri);
     }
 
     ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state",
                   DefaultPrinter->state);
 
-    add_cupsd_printer_state_reasons(con, DefaultPrinter);
+    add_printer_state_reasons(con, DefaultPrinter);
 
     ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_TEXT,
                 "printer-state-message", NULL, DefaultPrinter->state_message);
@@ -4271,7 +4364,7 @@ get_default(cupsd_client_t *con)          /* I - Client connection */
  */
 
 static void
-get_devices(cupsd_client_t *con)               /* I - Client connection */
+get_devices(cupsd_client_t *con)       /* I - Client connection */
 {
   int                  i;              /* Looping var */
   ipp_attribute_t      *limit,         /* Limit attribute */
@@ -4283,7 +4376,7 @@ get_devices(cupsd_client_t *con)          /* I - Client connection */
   int                  alen;           /* Length of attribute value */
 
 
-  cupsdLogMessage(L_DEBUG2, "get_devices(%p[%d])\n", con, con->http.fd);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_devices(%p[%d])", con, con->http.fd);
 
  /*
   * Check policy...
@@ -4291,7 +4384,7 @@ get_devices(cupsd_client_t *con)          /* I - Client connection */
 
   if (!cupsdCheckPolicy(DefaultPolicyPtr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "get_devices: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "get_devices: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -4374,7 +4467,7 @@ get_devices(cupsd_client_t *con)          /* I - Client connection */
  */
 
 static void
-get_jobs(cupsd_client_t        *con,           /* I - Client connection */
+get_jobs(cupsd_client_t  *con,         /* I - Client connection */
         ipp_attribute_t *uri)          /* I - Printer URI */
 {
   ipp_attribute_t *attr,               /* Current attribute */
@@ -4391,14 +4484,14 @@ get_jobs(cupsd_client_t        *con,            /* I - Client connection */
   int          first;                  /* First job ID */
   int          limit;                  /* Maximum number of jobs to return */
   int          count;                  /* Number of jobs that match */
-  cupsd_job_t          *job;                   /* Current job pointer */
+  cupsd_job_t  *job;                   /* Current job pointer */
   char         job_uri[HTTP_MAX_URI];  /* Job URI... */
-  cupsd_printer_t      *printer;               /* Printer */
+  cupsd_printer_t *printer;            /* Printer */
   cups_array_t *list;                  /* Which job list... */
 
 
-  cupsdLogMessage(L_DEBUG2, "get_jobs(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_jobs(%p[%d], %s)", con, con->http.fd,
+                  uri->values[0].string.text);
 
  /*
   * Is the destination valid?
@@ -4434,7 +4527,8 @@ get_jobs(cupsd_client_t        *con,              /* I - Client connection */
     * Bad URI...
     */
 
-    cupsdLogMessage(L_ERROR, "get_jobs: resource name \'%s\' no good!", resource);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "get_jobs: resource name \'%s\' no good!",
+                    resource);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -4449,14 +4543,14 @@ get_jobs(cupsd_client_t        *con,            /* I - Client connection */
   {
     if (!cupsdCheckPolicy(printer->op_policy_ptr, con, NULL))
     {
-      cupsdLogMessage(L_ERROR, "get_jobs: not authorized!");
+      cupsdLogMessage(CUPSD_LOG_ERROR, "get_jobs: not authorized!");
       send_ipp_error(con, IPP_NOT_AUTHORIZED);
       return;
     }
   }
   else if (!cupsdCheckPolicy(DefaultPolicyPtr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "get_jobs: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "get_jobs: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -4528,7 +4622,7 @@ get_jobs(cupsd_client_t        *con,              /* I - Client connection */
     * Filter out jobs that don't match...
     */
 
-    cupsdLogMessage(L_DEBUG2, "get_jobs: job->id = %d", job->id);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_jobs: job->id = %d", job->id);
 
     if ((dest != NULL && strcmp(job->dest, dest) != 0) &&
         (job->printer == NULL || dest == NULL ||
@@ -4548,7 +4642,7 @@ get_jobs(cupsd_client_t        *con,              /* I - Client connection */
 
     count ++;
 
-    cupsdLogMessage(L_DEBUG2, "get_jobs: count = %d", count);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_jobs: count = %d", count);
 
    /*
     * Send the requested attributes for each job...
@@ -4573,7 +4667,7 @@ get_jobs(cupsd_client_t        *con,              /* I - Client connection */
 
     copy_attrs(con->response, job->attrs, requested, IPP_TAG_JOB, 0);
 
-    add_cupsd_job_state_reasons(con, job);
+    add_job_state_reasons(con, job);
 
     ippAddSeparator(con->response);
   }
@@ -4590,13 +4684,13 @@ get_jobs(cupsd_client_t        *con,            /* I - Client connection */
  */
 
 static void
-get_job_attrs(cupsd_client_t        *con,      /* I - Client connection */
+get_job_attrs(cupsd_client_t  *con,    /* I - Client connection */
              ipp_attribute_t *uri)     /* I - Job URI */
 {
   ipp_attribute_t *attr,               /* Current attribute */
                *requested;             /* Requested attributes */
   int          jobid;                  /* Job ID */
-  cupsd_job_t          *job;                   /* Current job */
+  cupsd_job_t  *job;                   /* Current job */
   char         method[HTTP_MAX_URI],   /* Method portion of URI */
                username[HTTP_MAX_URI], /* Username portion of URI */
                host[HTTP_MAX_URI],     /* Host portion of URI */
@@ -4605,8 +4699,8 @@ get_job_attrs(cupsd_client_t        *con, /* I - Client connection */
   char         job_uri[HTTP_MAX_URI];  /* Job URI... */
 
 
-  cupsdLogMessage(L_DEBUG2, "get_job_attrs(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_job_attrs(%p[%d], %s)\n", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * See if we have a job URI or a printer URI...
@@ -4620,7 +4714,8 @@ get_job_attrs(cupsd_client_t        *con, /* I - Client connection */
 
     if ((attr = ippFindAttribute(con->request, "job-id", IPP_TAG_INTEGER)) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "get_job_attrs: got a printer-uri attribute but no job-id!");
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "get_job_attrs: got a printer-uri attribute but no job-id!");
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -4633,7 +4728,8 @@ get_job_attrs(cupsd_client_t        *con, /* I - Client connection */
     * Got a job URI; parse it to get the job ID...
     */
 
-    httpSeparate(uri->values[0].string.text, method, username, host, &port, resource);
+    httpSeparate(uri->values[0].string.text, method, username, host, &port,
+                 resource);
  
     if (strncmp(resource, "/jobs/", 6) != 0)
     {
@@ -4641,8 +4737,9 @@ get_job_attrs(cupsd_client_t        *con, /* I - Client connection */
       * Not a valid URI!
       */
 
-      cupsdLogMessage(L_ERROR, "get_job_attrs: bad job-uri attribute \'%s\'!\n",
-                 uri->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "get_job_attrs: bad job-uri attribute \'%s\'!\n",
+                      uri->values[0].string.text);
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -4660,7 +4757,8 @@ get_job_attrs(cupsd_client_t        *con, /* I - Client connection */
     * Nope - return a "not found" error...
     */
 
-    cupsdLogMessage(L_ERROR, "get_job_attrs: job #%d doesn't exist!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "get_job_attrs: job #%d doesn't exist!",
+                    jobid);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -4671,7 +4769,7 @@ get_job_attrs(cupsd_client_t        *con, /* I - Client connection */
 
   if (!cupsdCheckPolicy(DefaultPolicyPtr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "get_job_attrs: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "get_job_attrs: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -4704,7 +4802,7 @@ get_job_attrs(cupsd_client_t        *con, /* I - Client connection */
 
   copy_attrs(con->response, job->attrs, requested, IPP_TAG_JOB, 0);
 
-  add_cupsd_job_state_reasons(con, job);
+  add_job_state_reasons(con, job);
 
   if (requested != NULL)
     con->response->request.status.status_code = IPP_OK_SUBST;
@@ -4719,7 +4817,7 @@ get_job_attrs(cupsd_client_t        *con, /* I - Client connection */
 
 static void
 get_notifications(cupsd_client_t *con, /* I - Client connection */
-                  int      id)         /* I - Subscription ID */
+                  int            id)   /* I - Subscription ID */
 {
 }
 
@@ -4729,7 +4827,7 @@ get_notifications(cupsd_client_t *con,    /* I - Client connection */
  */
 
 static void
-get_ppds(cupsd_client_t *con)                  /* I - Client connection */
+get_ppds(cupsd_client_t *con)          /* I - Client connection */
 {
   int                  i;              /* Looping var */
   ipp_attribute_t      *limit,         /* Limit attribute */
@@ -4742,7 +4840,7 @@ get_ppds(cupsd_client_t *con)                     /* I - Client connection */
   int                  alen;           /* Length of attribute value */
 
 
-  cupsdLogMessage(L_DEBUG2, "get_ppds(%p[%d])\n", con, con->http.fd);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_ppds(%p[%d])", con, con->http.fd);
 
  /*
   * Check policy...
@@ -4750,7 +4848,7 @@ get_ppds(cupsd_client_t *con)                     /* I - Client connection */
 
   if (!cupsdCheckPolicy(DefaultPolicyPtr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "get_ppds: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "get_ppds: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -4836,7 +4934,7 @@ get_ppds(cupsd_client_t *con)                     /* I - Client connection */
  */
 
 static void
-get_printer_attrs(cupsd_client_t        *con,  /* I - Client connection */
+get_printer_attrs(cupsd_client_t  *con,        /* I - Client connection */
                  ipp_attribute_t *uri) /* I - Printer URI */
 {
   const char           *dest;          /* Destination */
@@ -4850,7 +4948,7 @@ get_printer_attrs(cupsd_client_t        *con,     /* I - Client connection */
                        resource[HTTP_MAX_URI];
                                        /* Resource portion of URI */
   int                  port;           /* Port portion of URI */
-  cupsd_printer_t              *printer;       /* Printer/class */
+  cupsd_printer_t      *printer;       /* Printer/class */
   char                 printer_uri[HTTP_MAX_URI];
                                        /* Printer URI */
   time_t               curtime;        /* Current time */
@@ -4860,14 +4958,15 @@ get_printer_attrs(cupsd_client_t        *con,   /* I - Client connection */
   int                  need_history;   /* Need to send history collection? */
 
 
-  cupsdLogMessage(L_DEBUG2, "get_printer_attrs(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_printer_attrs(%p[%d], %s)", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Is the destination valid?
   */
 
-  httpSeparate(uri->values[0].string.text, method, username, host, &port, resource);
+  httpSeparate(uri->values[0].string.text, method, username, host, &port,
+               resource);
 
   if ((dest = cupsdValidateDest(host, resource, &dtype, &printer)) == NULL)
   {
@@ -4875,7 +4974,9 @@ get_printer_attrs(cupsd_client_t        *con,     /* I - Client connection */
     * Bad URI...
     */
 
-    cupsdLogMessage(L_ERROR, "get_printer_attrs: resource name \'%s\' no good!", resource);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "get_printer_attrs: resource name \'%s\' no good!",
+                   resource);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -4886,7 +4987,7 @@ get_printer_attrs(cupsd_client_t        *con,     /* I - Client connection */
 
   if (!cupsdCheckPolicy(printer->op_policy_ptr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "get_printer_attrs: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "get_printer_attrs: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -4905,13 +5006,14 @@ get_printer_attrs(cupsd_client_t        *con,   /* I - Client connection */
              con->servername, con->serverport, printer->name);
     ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_URI,
                 "printer-uri-supported", NULL, printer_uri);
-    cupsdLogMessage(L_DEBUG2, "printer-uri-supported=\"%s\"", printer_uri);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2, "printer-uri-supported=\"%s\"",
+                    printer_uri);
   }
 
   ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state",
                 printer->state);
 
-  add_cupsd_printer_state_reasons(con, printer);
+  add_printer_state_reasons(con, printer);
 
   ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_TEXT,
                "printer-state-message", NULL, printer->state_message);
@@ -4974,8 +5076,8 @@ get_printer_attrs(cupsd_client_t        *con,     /* I - Client connection */
  */
 
 static void
-get_printers(cupsd_client_t *con,              /* I - Client connection */
-             int      type)            /* I - 0 or CUPS_PRINTER_CLASS */
+get_printers(cupsd_client_t *con,      /* I - Client connection */
+             int            type)      /* I - 0 or CUPS_PRINTER_CLASS */
 {
   int          i;                      /* Looping var */
   ipp_attribute_t *requested,          /* requested-attributes */
@@ -4984,20 +5086,21 @@ get_printers(cupsd_client_t *con,               /* I - Client connection */
   int          need_history;           /* Need to send history collection? */
   int          limit;                  /* Maximum number of printers to return */
   int          count;                  /* Number of printers that match */
-  cupsd_printer_t      *printer;               /* Current printer pointer */
+  cupsd_printer_t *printer;            /* Current printer pointer */
   time_t       curtime;                /* Current time */
-  int          cupsd_printer_type,             /* printer-type attribute */
+  int          printer_type,           /* printer-type attribute */
                printer_mask;           /* printer-type-mask attribute */
   char         *location;              /* Location string */
   char         name[IPP_MAX_NAME],     /* Printer name */
                *nameptr;               /* Pointer into name */
-  cupsd_printer_t      *iclass;                /* Implicit class */
+  cupsd_printer_t *iclass;             /* Implicit class */
   const char   *username;              /* Current user */
   char         printer_uri[HTTP_MAX_URI];
                                        /* Printer URI */
 
 
-  cupsdLogMessage(L_DEBUG2, "get_printers(%p[%d], %x)\n", con, con->http.fd, type);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_printers(%p[%d], %x)", con,
+                  con->http.fd, type);
 
   if (!Printers || !cupsArrayCount(Printers))
   {
@@ -5011,7 +5114,7 @@ get_printers(cupsd_client_t *con,         /* I - Client connection */
 
   if (!cupsdCheckPolicy(DefaultPolicyPtr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "get_printers: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "get_printers: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -5030,9 +5133,9 @@ get_printers(cupsd_client_t *con,         /* I - Client connection */
   */
 
   if ((attr = ippFindAttribute(con->request, "printer-type", IPP_TAG_ENUM)) != NULL)
-    cupsd_printer_type = attr->values[0].integer;
+    printer_type = attr->values[0].integer;
   else
-    cupsd_printer_type = 0;
+    printer_type = 0;
 
   if ((attr = ippFindAttribute(con->request, "printer-type-mask", IPP_TAG_ENUM)) != NULL)
     printer_mask = attr->values[0].integer;
@@ -5077,7 +5180,7 @@ get_printers(cupsd_client_t *con,         /* I - Client connection */
        count < limit && printer != NULL;
        printer = (cupsd_printer_t *)cupsArrayNext(Printers))
     if ((!type || (printer->type & CUPS_PRINTER_CLASS) == type) &&
-        (printer->type & printer_mask) == cupsd_printer_type &&
+        (printer->type & printer_mask) == printer_type &&
        (location == NULL || printer->location == NULL ||
         !strcasecmp(printer->location, location)))
     {
@@ -5149,13 +5252,13 @@ get_printers(cupsd_client_t *con,               /* I - Client connection */
                 con->servername, con->serverport, printer->name);
        ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_URI,
                     "printer-uri-supported", NULL, printer_uri);
-        cupsdLogMessage(L_DEBUG2, "printer-uri-supported=\"%s\"", printer_uri);
+        cupsdLogMessage(CUPSD_LOG_DEBUG2, "printer-uri-supported=\"%s\"", printer_uri);
       }
 
       ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_ENUM,
                     "printer-state", printer->state);
 
-      add_cupsd_printer_state_reasons(con, printer);
+      add_printer_state_reasons(con, printer);
 
       ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_TEXT,
                    "printer-state-message", NULL, printer->state_message);
@@ -5205,8 +5308,9 @@ get_printers(cupsd_client_t *con,         /* I - Client connection */
  */
 
 static void
-get_subscription_attrs(cupsd_client_t *con,    /* I - Client connection */
-                       int      sub_id)        /* I - Subscription ID */
+get_subscription_attrs(
+    cupsd_client_t *con,               /* I - Client connection */
+    int            sub_id)             /* I - Subscription ID */
 {
 }
 
@@ -5216,7 +5320,7 @@ get_subscription_attrs(cupsd_client_t *con,       /* I - Client connection */
  */
 
 static void
-get_subscriptions(cupsd_client_t *con, /* I - Client connection */
+get_subscriptions(cupsd_client_t  *con,        /* I - Client connection */
                   ipp_attribute_t *uri)        /* I - Printer URI */
 {
 }
@@ -5227,7 +5331,7 @@ get_subscriptions(cupsd_client_t *con,    /* I - Client connection */
  */
 
 static void
-hold_job(cupsd_client_t        *con,           /* I - Client connection */
+hold_job(cupsd_client_t  *con,         /* I - Client connection */
          ipp_attribute_t *uri)         /* I - Job or Printer URI */
 {
   ipp_attribute_t *attr,               /* Current job-hold-until */
@@ -5238,10 +5342,10 @@ hold_job(cupsd_client_t        *con,            /* I - Client connection */
                host[HTTP_MAX_URI],     /* Host portion of URI */
                resource[HTTP_MAX_URI]; /* Resource portion of URI */
   int          port;                   /* Port portion of URI */
-  cupsd_job_t          *job;                   /* Job information */
+  cupsd_job_t  *job;                   /* Job information */
 
 
-  cupsdLogMessage(L_DEBUG2, "hold_job(%p[%d], %s)\n", con, con->http.fd,
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "hold_job(%p[%d], %s)", con, con->http.fd,
              uri->values[0].string.text);
 
  /*
@@ -5252,8 +5356,9 @@ hold_job(cupsd_client_t        *con,              /* I - Client connection */
       strncmp(con->uri, "/jobs/", 5) != 0 &&
       strncmp(con->uri, "/printers/", 10) != 0)
   {
-    cupsdLogMessage(L_ERROR, "hold_job: hold request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "hold_job: hold request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -5270,7 +5375,8 @@ hold_job(cupsd_client_t        *con,              /* I - Client connection */
 
     if ((attr = ippFindAttribute(con->request, "job-id", IPP_TAG_INTEGER)) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "hold_job: got a printer-uri attribute but no job-id!");
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "hold_job: got a printer-uri attribute but no job-id!");
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -5291,8 +5397,9 @@ hold_job(cupsd_client_t        *con,              /* I - Client connection */
       * Not a valid URI!
       */
 
-      cupsdLogMessage(L_ERROR, "hold_job: bad job-uri attribute \'%s\'!",
-                 uri->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "hold_job: bad job-uri attribute \'%s\'!",
+                      uri->values[0].string.text);
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -5310,7 +5417,7 @@ hold_job(cupsd_client_t        *con,              /* I - Client connection */
     * Nope - return a "not found" error...
     */
 
-    cupsdLogMessage(L_ERROR, "hold_job: job #%d doesn't exist!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "hold_job: job #%d doesn't exist!", jobid);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -5321,8 +5428,9 @@ hold_job(cupsd_client_t        *con,              /* I - Client connection */
 
   if (!validate_user(job, con, job->username, username, sizeof(username)))
   {
-    cupsdLogMessage(L_ERROR, "hold_job: \"%s\" not authorized to hold job id %d owned by \"%s\"!",
-               username, jobid, job->username);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "hold_job: \"%s\" not authorized to hold job id %d owned by \"%s\"!",
+                    username, jobid, job->username);
     send_ipp_error(con, IPP_FORBIDDEN);
     return;
   }
@@ -5365,7 +5473,7 @@ hold_job(cupsd_client_t        *con,              /* I - Client connection */
     cupsdSetJobHoldUntil(job->id, attr->values[0].string.text);
   }
 
-  cupsdLogMessage(L_INFO, "Job %d was held by \'%s\'.", jobid, username);
+  cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was held by \'%s\'.", jobid, username);
 
   con->response->request.status.status_code = IPP_OK;
 }
@@ -5376,12 +5484,12 @@ hold_job(cupsd_client_t        *con,            /* I - Client connection */
  */
 
 static void
-move_job(cupsd_client_t        *con,           /* I - Client connection */
+move_job(cupsd_client_t  *con,         /* I - Client connection */
         ipp_attribute_t *uri)          /* I - Job URI */
 {
   ipp_attribute_t *attr;               /* Current attribute */
   int          jobid;                  /* Job ID */
-  cupsd_job_t          *job;                   /* Current job */
+  cupsd_job_t  *job;                   /* Current job */
   const char   *dest;                  /* Destination */
   cups_ptype_t dtype;                  /* Destination type (printer or class) */
   char         method[HTTP_MAX_URI],   /* Method portion of URI */
@@ -5389,11 +5497,11 @@ move_job(cupsd_client_t        *con,            /* I - Client connection */
                host[HTTP_MAX_URI],     /* Host portion of URI */
                resource[HTTP_MAX_URI]; /* Resource portion of URI */
   int          port;                   /* Port portion of URI */
-  cupsd_printer_t      *printer;               /* Printer */
+  cupsd_printer_t *printer;            /* Printer */
 
 
-  cupsdLogMessage(L_DEBUG2, "move_job(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "move_job(%p[%d], %s)", con, con->http.fd,
+                  uri->values[0].string.text);
 
  /*
   * See if we have a job URI or a printer URI...
@@ -5407,7 +5515,7 @@ move_job(cupsd_client_t        *con,              /* I - Client connection */
 
     if ((attr = ippFindAttribute(con->request, "job-id", IPP_TAG_INTEGER)) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "move_job: got a printer-uri attribute but no job-id!");
+      cupsdLogMessage(CUPSD_LOG_ERROR, "move_job: got a printer-uri attribute but no job-id!");
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -5420,7 +5528,8 @@ move_job(cupsd_client_t        *con,              /* I - Client connection */
     * Got a job URI; parse it to get the job ID...
     */
 
-    httpSeparate(uri->values[0].string.text, method, username, host, &port, resource);
+    httpSeparate(uri->values[0].string.text, method, username, host, &port,
+                 resource);
  
     if (strncmp(resource, "/jobs/", 6) != 0)
     {
@@ -5428,8 +5537,9 @@ move_job(cupsd_client_t        *con,              /* I - Client connection */
       * Not a valid URI!
       */
 
-      cupsdLogMessage(L_ERROR, "move_job: bad job-uri attribute \'%s\'!\n",
-                 uri->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "move_job: bad job-uri attribute \'%s\'!\n",
+                      uri->values[0].string.text);
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -5447,7 +5557,7 @@ move_job(cupsd_client_t        *con,              /* I - Client connection */
     * Nope - return a "not found" error...
     */
 
-    cupsdLogMessage(L_ERROR, "move_job: job #%d doesn't exist!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "move_job: job #%d doesn't exist!", jobid);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -5462,7 +5572,9 @@ move_job(cupsd_client_t        *con,              /* I - Client connection */
     * Return a "not-possible" error...
     */
 
-    cupsdLogMessage(L_ERROR, "move_job: job #%d is finished and cannot be altered!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "move_job: job #%d is finished and cannot be altered!",
+                   jobid);
     send_ipp_error(con, IPP_NOT_POSSIBLE);
     return;
   }
@@ -5473,8 +5585,10 @@ move_job(cupsd_client_t        *con,             /* I - Client connection */
 
   if (!validate_user(job, con, job->username, username, sizeof(username)))
   {
-    cupsdLogMessage(L_ERROR, "move_job: \"%s\" not authorized to move job id %d owned by \"%s\"!",
-               username, jobid, job->username);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "move_job: \"%s\" not authorized to move job id %d owned "
+                   "by \"%s\"!",
+                    username, jobid, job->username);
     send_ipp_error(con, IPP_FORBIDDEN);
     return;
   }
@@ -5485,7 +5599,8 @@ move_job(cupsd_client_t        *con,              /* I - Client connection */
     * Need job-printer-uri...
     */
 
-    cupsdLogMessage(L_ERROR, "move_job: job-printer-uri attribute missing!");
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "move_job: job-printer-uri attribute missing!");
     send_ipp_error(con, IPP_BAD_REQUEST);
     return;
   }
@@ -5502,7 +5617,8 @@ move_job(cupsd_client_t        *con,              /* I - Client connection */
     * Bad URI...
     */
 
-    cupsdLogMessage(L_ERROR, "move_job: resource name \'%s\' no good!", resource);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "move_job: resource name \'%s\' no good!",
+                    resource);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -5513,7 +5629,7 @@ move_job(cupsd_client_t        *con,              /* I - Client connection */
 
   if (!cupsdCheckPolicy(printer->op_policy_ptr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "move_job: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "move_job: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -5573,7 +5689,7 @@ ppd_add_default(
 
   if (!temp)
   {
-    cupsdLogMessage(L_ERROR, "ppd_add_default: Unable to add default value for \"%s\" - %s",
+    cupsdLogMessage(CUPSD_LOG_ERROR, "ppd_add_default: Unable to add default value for \"%s\" - %s",
                option, strerror(errno));
     return (num_defaults);
   }
@@ -5660,7 +5776,7 @@ ppd_parse_line(const char *line,  /* I - Line */
  */
 
 static void
-print_job(cupsd_client_t        *con,          /* I - Client connection */
+print_job(cupsd_client_t  *con,                /* I - Client connection */
          ipp_attribute_t *uri)         /* I - Printer URI */
 {
   ipp_attribute_t *attr;               /* Current attribute */
@@ -5669,7 +5785,7 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
   cups_ptype_t dtype;                  /* Destination type (printer or class) */
   int          priority;               /* Job priority */
   char         *title;                 /* Job name/title */
-  cupsd_job_t          *job;                   /* Current job */
+  cupsd_job_t  *job;                   /* Current job */
   int          jobid;                  /* Job ID number */
   char         job_uri[HTTP_MAX_URI],  /* Job URI */
                method[HTTP_MAX_URI],   /* Method portion of URI */
@@ -5683,7 +5799,7 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
                type[MIME_MAX_TYPE],    /* Subtype of file */
                mimetype[MIME_MAX_SUPER + MIME_MAX_TYPE + 2];
                                        /* Textual name of mime type */
-  cupsd_printer_t      *printer;               /* Printer data */
+  cupsd_printer_t *printer;            /* Printer data */
   struct stat  fileinfo;               /* File information */
   int          kbytes;                 /* Size of file */
   int          i;                      /* Looping var */
@@ -5691,8 +5807,8 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
   int          compression;            /* Document compression */
 
 
-  cupsdLogMessage(L_DEBUG2, "print_job(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "print_job(%p[%d], %s)", con, con->http.fd,
+                  uri->values[0].string.text);
 
  /*
   * Verify that the POST operation was done to a valid URI.
@@ -5701,8 +5817,9 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
   if (strncmp(con->uri, "/classes/", 9) != 0 &&
       strncmp(con->uri, "/printers/", 10) != 0)
   {
-    cupsdLogMessage(L_ERROR, "print_job: cancel request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "print_job: cancel request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -5715,11 +5832,11 @@ print_job(cupsd_client_t        *con,           /* I - Client connection */
   {
     if (attr->values[0].integer < 1 || attr->values[0].integer > MaxCopies)
     {
-      cupsdLogMessage(L_ERROR, "print_job: Bad copies value %d.",
-                 attr->values[0].integer);
+      cupsdLogMessage(CUPSD_LOG_ERROR, "print_job: Bad copies value %d.",
+                      attr->values[0].integer);
       send_ipp_error(con, IPP_ATTRIBUTES);
       ippAddInteger(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_INTEGER,
-                  "copies", attr->values[0].integer);
+                   "copies", attr->values[0].integer);
       return;
     }
   }
@@ -5731,8 +5848,10 @@ print_job(cupsd_client_t        *con,            /* I - Client connection */
       if (attr->values[i].range.lower < lowerpagerange || 
          attr->values[i].range.lower > attr->values[i].range.upper)
       {
-       cupsdLogMessage(L_ERROR, "print_job: bad page-ranges values %d-%d.",
-                  attr->values[i].range.lower, attr->values[i].range.upper);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "print_job: bad page-ranges values %d-%d.",
+                       attr->values[i].range.lower,
+                       attr->values[i].range.upper);
        send_ipp_error(con, IPP_BAD_REQUEST);
        return;
       }
@@ -5756,8 +5875,9 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
 #endif /* HAVE_LIBZ */
       )
     {
-      cupsdLogMessage(L_ERROR, "print_job: Unsupported compression \"%s\"!",
-                attr->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "print_job: Unsupported compression \"%s\"!",
+                     attr->values[0].string.text);
       send_ipp_error(con, IPP_ATTRIBUTES);
       ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_KEYWORD,
                   "compression", NULL, attr->values[0].string.text);
@@ -5776,7 +5896,7 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
 
   if (!con->filename)
   {
-    cupsdLogMessage(L_ERROR, "print_job: No file!?!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "print_job: No file!?!");
     send_ipp_error(con, IPP_BAD_REQUEST);
     return;
   }
@@ -5785,7 +5905,8 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
   * Is it a format we support?
   */
 
-  if ((format = ippFindAttribute(con->request, "document-format", IPP_TAG_MIMETYPE)) != NULL)
+  if ((format = ippFindAttribute(con->request, "document-format",
+                                 IPP_TAG_MIMETYPE)) != NULL)
   {
    /*
     * Grab format from client...
@@ -5793,8 +5914,9 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
 
     if (sscanf(format->values[0].string.text, "%15[^/]/%31[^;]", super, type) != 2)
     {
-      cupsdLogMessage(L_ERROR, "print_job: could not scan type \'%s\'!",
-                format->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "print_job: could not scan type \'%s\'!",
+                     format->values[0].string.text);
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -5815,7 +5937,7 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
     * Auto-type the file...
     */
 
-    cupsdLogMessage(L_DEBUG, "print_job: auto-typing file...");
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "print_job: auto-typing file...");
 
     filetype = mimeFileType(MimeDatabase, con->filename, &compression);
 
@@ -5845,9 +5967,10 @@ print_job(cupsd_client_t        *con,            /* I - Client connection */
 
   if (filetype == NULL)
   {
-    cupsdLogMessage(L_ERROR, "print_job: Unsupported format \'%s/%s\'!",
-              super, type);
-    cupsdLogMessage(L_INFO, "Hint: Do you have the raw file printing rules enabled?");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "print_job: Unsupported format \'%s/%s\'!",
+                   super, type);
+    cupsdLogMessage(CUPSD_LOG_INFO,
+                    "Hint: Do you have the raw file printing rules enabled?");
     send_ipp_error(con, IPP_DOCUMENT_FORMAT);
 
     if (format)
@@ -5857,7 +5980,7 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
     return;
   }
 
-  cupsdLogMessage(L_DEBUG, "print_job: request file type is %s/%s.",
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "print_job: request file type is %s/%s.",
             filetype->super, filetype->type);
 
  /*
@@ -5866,7 +5989,7 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
 
   if (!strcasecmp(filetype->super, "application") &&
       !strcasecmp(filetype->type, "postscript"))
-    read_ps_cupsd_job_ticket(con);
+    read_ps_job_ticket(con);
 
  /*
   * Is the destination valid?
@@ -5880,7 +6003,8 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
     * Bad URI...
     */
 
-    cupsdLogMessage(L_ERROR, "print_job: resource name \'%s\' no good!", resource);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "print_job: resource name \'%s\' no good!",
+                    resource);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -5893,7 +6017,7 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
       strcasecmp(con->http.hostname, "localhost") &&
       strcasecmp(con->http.hostname, ServerName))
   {
-    cupsdLogMessage(L_ERROR, "print_job: printer not shared!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "print_job: printer not shared!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -5905,7 +6029,7 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
   if (!cupsdCheckPolicy(printer->op_policy_ptr, con, NULL) ||
       ((printer->type & CUPS_PRINTER_AUTHENTICATED) && !con->username[0]))
   {
-    cupsdLogMessage(L_ERROR, "print_job: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "print_job: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -5916,8 +6040,9 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
 
   if (!printer->accepting)
   {
-    cupsdLogMessage(L_INFO, "print_job: destination \'%s\' is not accepting jobs.",
-               dest);
+    cupsdLogMessage(CUPSD_LOG_INFO,
+                    "print_job: destination \'%s\' is not accepting jobs.",
+                    dest);
     send_ipp_error(con, IPP_NOT_ACCEPTING);
     return;
   }
@@ -5931,8 +6056,9 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
 
   if (cupsArrayCount(Jobs) >= MaxJobs && MaxJobs)
   {
-    cupsdLogMessage(L_INFO, "print_job: too many jobs - %d jobs, max jobs is %d.",
-               cupsArrayCount(Jobs), MaxJobs);
+    cupsdLogMessage(CUPSD_LOG_INFO,
+                    "print_job: too many jobs - %d jobs, max jobs is %d.",
+                    cupsArrayCount(Jobs), MaxJobs);
     send_ipp_error(con, IPP_NOT_POSSIBLE);
     return;
   }
@@ -5961,8 +6087,9 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
 
   if ((job = cupsdAddJob(priority, printer->name)) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "print_job: unable to add job for destination \'%s\'!",
-               dest);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "print_job: unable to add job for destination \'%s\'!",
+                    dest);
     send_ipp_error(con, IPP_INTERNAL_ERROR);
     return;
   }
@@ -5984,7 +6111,7 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
   }
   else if (attr != NULL)
   {
-    cupsdLogMessage(L_DEBUG, "print_job: requesting-user-name = \'%s\'",
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "print_job: requesting-user-name = \'%s\'",
                attr->values[0].string.text);
 
     cupsdSetString(&job->username, attr->values[0].string.text);
@@ -5993,8 +6120,8 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
     cupsdSetString(&job->username, "anonymous");
 
   if (attr == NULL)
-    ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-originating-user-name",
-                 NULL, job->username);
+    ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME,
+                 "job-originating-user-name", NULL, job->username);
   else
   {
     attr->group_tag = IPP_TAG_JOB;
@@ -6132,16 +6259,17 @@ print_job(cupsd_client_t        *con,           /* I - Client connection */
 
     if ((attr = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_ZERO)) == NULL)
     {
-      cupsdLogMessage(L_DEBUG, "Adding default job-sheets values \"%s,%s\"...",
-                 printer->cupsd_job_sheets[0], printer->cupsd_job_sheets[1]);
+      cupsdLogMessage(CUPSD_LOG_DEBUG,
+                      "Adding default job-sheets values \"%s,%s\"...",
+                      printer->job_sheets[0], printer->job_sheets[1]);
 
       attr = ippAddStrings(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-sheets",
                            2, NULL, NULL);
-      attr->values[0].string.text = strdup(printer->cupsd_job_sheets[0]);
-      attr->values[1].string.text = strdup(printer->cupsd_job_sheets[1]);
+      attr->values[0].string.text = strdup(printer->job_sheets[0]);
+      attr->values[1].string.text = strdup(printer->job_sheets[1]);
     }
 
-    job->cupsd_job_sheets = attr;
+    job->job_sheets = attr;
 
    /*
     * Enforce classification level if set...
@@ -6149,8 +6277,10 @@ print_job(cupsd_client_t        *con,            /* I - Client connection */
 
     if (Classification)
     {
-      cupsdLogMessage(L_INFO, "Classification=\"%s\", ClassifyOverride=%d",
-                 Classification ? Classification : "(null)", ClassifyOverride);
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "Classification=\"%s\", ClassifyOverride=%d",
+                      Classification ? Classification : "(null)",
+                     ClassifyOverride);
 
       if (ClassifyOverride)
       {
@@ -6164,11 +6294,11 @@ print_job(cupsd_client_t        *con,           /* I - Client connection */
 
           cupsdSetString(&attr->values[0].string.text, Classification);
 
-         cupsdLogMessage(L_NOTICE, "[Job %d] CLASSIFICATION FORCED "
-                              "job-sheets=\"%s,none\", "
-                              "job-originating-user-name=\"%s\"",
-                    job->id, Classification,
-                    job->username);
+         cupsdLogMessage(CUPSD_LOG_NOTICE,
+                         "[Job %d] CLASSIFICATION FORCED "
+                         "job-sheets=\"%s,none\", "
+                         "job-originating-user-name=\"%s\"",
+                         job->id, Classification, job->username);
        }
        else if (attr->num_values == 2 &&
                 strcmp(attr->values[0].string.text, attr->values[1].string.text) != 0 &&
@@ -6181,12 +6311,12 @@ print_job(cupsd_client_t        *con,           /* I - Client connection */
 
           cupsdSetString(&attr->values[1].string.text, attr->values[0].string.text);
 
-         cupsdLogMessage(L_NOTICE, "[Job %d] CLASSIFICATION FORCED "
-                              "job-sheets=\"%s,%s\", "
-                              "job-originating-user-name=\"%s\"",
-                    job->id, attr->values[0].string.text,
-                    attr->values[1].string.text,
-                    job->username);
+         cupsdLogMessage(CUPSD_LOG_NOTICE,
+                         "[Job %d] CLASSIFICATION FORCED "
+                         "job-sheets=\"%s,%s\", "
+                         "job-originating-user-name=\"%s\"",
+                         job->id, attr->values[0].string.text,
+                         attr->values[1].string.text, job->username);
        }
        else if (strcmp(attr->values[0].string.text, Classification) &&
                 strcmp(attr->values[0].string.text, "none") &&
@@ -6195,18 +6325,19 @@ print_job(cupsd_client_t        *con,           /* I - Client connection */
                   strcmp(attr->values[1].string.text, "none"))))
         {
          if (attr->num_values == 1)
-            cupsdLogMessage(L_NOTICE, "[Job %d] CLASSIFICATION OVERRIDDEN "
-                                "job-sheets=\"%s\", "
-                                "job-originating-user-name=\"%s\"",
-                      job->id, attr->values[0].string.text,
-                      job->username);
+            cupsdLogMessage(CUPSD_LOG_NOTICE,
+                           "[Job %d] CLASSIFICATION OVERRIDDEN "
+                           "job-sheets=\"%s\", "
+                           "job-originating-user-name=\"%s\"",
+                           job->id, attr->values[0].string.text,
+                           job->username);
           else
-            cupsdLogMessage(L_NOTICE, "[Job %d] CLASSIFICATION OVERRIDDEN "
-                                "job-sheets=\"%s,%s\", "
-                                "job-originating-user-name=\"%s\"",
-                      job->id, attr->values[0].string.text,
-                      attr->values[1].string.text,
-                      job->username);
+            cupsdLogMessage(CUPSD_LOG_NOTICE,
+                           "[Job %d] CLASSIFICATION OVERRIDDEN "
+                           "job-sheets=\"%s,%s\", "
+                           "job-originating-user-name=\"%s\"",
+                           job->id, attr->values[0].string.text,
+                           attr->values[1].string.text, job->username);
         }
       }
       else if (strcmp(attr->values[0].string.text, Classification) != 0 &&
@@ -6235,18 +6366,18 @@ print_job(cupsd_client_t        *con,           /* I - Client connection */
         }
 
         if (attr->num_values > 1)
-         cupsdLogMessage(L_NOTICE, "[Job %d] CLASSIFICATION FORCED "
-                              "job-sheets=\"%s,%s\", "
-                              "job-originating-user-name=\"%s\"",
-                    job->id, attr->values[0].string.text,
-                    attr->values[1].string.text,
-                    job->username);
+         cupsdLogMessage(CUPSD_LOG_NOTICE,
+                         "[Job %d] CLASSIFICATION FORCED "
+                         "job-sheets=\"%s,%s\", "
+                         "job-originating-user-name=\"%s\"",
+                         job->id, attr->values[0].string.text,
+                         attr->values[1].string.text, job->username);
         else
-         cupsdLogMessage(L_NOTICE, "[Job %d] CLASSIFICATION FORCED "
-                              "job-sheets=\"%s\", "
-                              "job-originating-user-name=\"%s\"",
-                    job->id, Classification,
-                    job->username);
+         cupsdLogMessage(CUPSD_LOG_NOTICE,
+                         "[Job %d] CLASSIFICATION FORCED "
+                         "job-sheets=\"%s\", "
+                         "job-originating-user-name=\"%s\"",
+                         job->id, Classification, job->username);
       }
     }
 
@@ -6256,8 +6387,9 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
 
     if (!(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)))
     {
-      cupsdLogMessage(L_INFO, "Adding start banner page \"%s\" to job %d.",
-                attr->values[0].string.text, job->id);
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "Adding start banner page \"%s\" to job %d.",
+                     attr->values[0].string.text, job->id);
 
       kbytes = copy_banner(con, job, attr->values[0].string.text);
 
@@ -6290,8 +6422,8 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
     * Yes...
     */
 
-    cupsdLogMessage(L_INFO, "Adding end banner page \"%s\" to job %d.",
-               attr->values[1].string.text, job->id);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Adding end banner page \"%s\" to job %d.",
+                    attr->values[1].string.text, job->id);
 
     kbytes = copy_banner(con, job, attr->values[1].string.text);
 
@@ -6302,7 +6434,7 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
   * Add any job subscriptions...
   */
 
-  add_cupsd_job_subscriptions(con, job);
+  add_job_subscriptions(con, job);
 
  /*
   * Set all but the first two attributes to the job attributes group...
@@ -6315,17 +6447,18 @@ print_job(cupsd_client_t        *con,           /* I - Client connection */
   * Log and save the job...
   */
 
-  cupsdLogMessage(L_INFO, "Job %d queued on \'%s\' by \'%s\'.", job->id,
-             job->dest, job->username);
-  cupsdLogMessage(L_DEBUG, "Job %d hold_until = %d", job->id, (int)job->hold_until);
+  cupsdLogMessage(CUPSD_LOG_INFO, "Job %d queued on \'%s\' by \'%s\'.", job->id,
+                  job->dest, job->username);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "Job %d hold_until = %d", job->id,
+                  (int)job->hold_until);
 
   cupsdSaveJob(job->id);
 
   cupsdAddEvent(CUPSD_EVENT_JOB_CREATED, printer, job, "Job created.");
 
  /*
-  * Start the job if possible...  Since cupsdCheckJobs() can cancel a job if it
-  * doesn't print, we need to re-find the job afterwards...
+  * Start the job if possible...  Since cupsdCheckJobs() can cancel a job
+  * if it doesn't print, we need to re-find the job afterwards...
   */
 
   jobid = job->id;
@@ -6341,20 +6474,21 @@ print_job(cupsd_client_t        *con,           /* I - Client connection */
   snprintf(job_uri, sizeof(job_uri), "http://%s:%d/jobs/%d", ServerName,
           LocalPort, jobid);
 
-  ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI, "job-uri", NULL, job_uri);
+  ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI, "job-uri", NULL,
+               job_uri);
 
   ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-id", jobid);
 
   ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_ENUM, "job-state",
                 job ? job->state->values[0].integer : IPP_JOB_CANCELLED);
-  add_cupsd_job_state_reasons(con, job);
+  add_job_state_reasons(con, job);
 
   con->response->request.status.status_code = IPP_OK;
 }
 
 
 /*
- * 'read_ps_cupsd_job_ticket()' - Reads a job ticket embedded in a PS file.
+ * 'read_ps_job_ticket()' - Reads a job ticket embedded in a PS file.
  *
  * This function only gets called when printing a single PostScript
  * file using the Print-Job operation.  It doesn't work for Create-Job +
@@ -6387,7 +6521,7 @@ print_job(cupsd_client_t        *con,             /* I - Client connection */
  */
 
 static void
-read_ps_cupsd_job_ticket(cupsd_client_t *con)  /* I - Client connection */
+read_ps_job_ticket(cupsd_client_t *con)        /* I - Client connection */
 {
   cups_file_t          *fp;            /* File to read from */
   char                 line[256];      /* Line data */
@@ -6405,8 +6539,10 @@ read_ps_cupsd_job_ticket(cupsd_client_t *con)    /* I - Client connection */
 
   if ((fp = cupsFileOpen(con->filename, "rb")) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "read_ps_cupsd_job_ticket: Unable to open PostScript print file - %s",
-               strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "read_ps_job_ticket: Unable to open PostScript print file "
+                   "- %s",
+                    strerror(errno));
     return;
   }
 
@@ -6416,8 +6552,10 @@ read_ps_cupsd_job_ticket(cupsd_client_t *con)    /* I - Client connection */
 
   if (cupsFileGets(fp, line, sizeof(line)) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "read_ps_cupsd_job_ticket: Unable to read from PostScript print file - %s",
-               strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "read_ps_job_ticket: Unable to read from PostScript print "
+                   "file - %s",
+                    strerror(errno));
     cupsFileClose(fp);
     return;
   }
@@ -6481,13 +6619,13 @@ read_ps_cupsd_job_ticket(cupsd_client_t *con)   /* I - Client connection */
     if (attr->group_tag != IPP_TAG_JOB || !attr->name)
       continue;
 
-    if (strcmp(attr->name, "job-originating-host-name") == 0 ||
-        strcmp(attr->name, "job-originating-user-name") == 0 ||
-       strcmp(attr->name, "job-media-sheets-completed") == 0 ||
-       strcmp(attr->name, "job-k-octets") == 0 ||
-       strcmp(attr->name, "job-id") == 0 ||
-       strncmp(attr->name, "job-state", 9) == 0 ||
-       strncmp(attr->name, "time-at-", 8) == 0)
+    if (!strcmp(attr->name, "job-originating-host-name") ||
+        !strcmp(attr->name, "job-originating-user-name") ||
+       !strcmp(attr->name, "job-media-sheets-completed") ||
+       !strcmp(attr->name, "job-k-octets") ||
+       !strcmp(attr->name, "job-id") ||
+       !strncmp(attr->name, "job-state", 9) ||
+       !strncmp(attr->name, "time-at-", 8))
       continue; /* Read-only attrs */
 
     if ((attr2 = ippFindAttribute(con->request, attr->name, IPP_TAG_ZERO)) != NULL)
@@ -6538,7 +6676,7 @@ read_ps_cupsd_job_ticket(cupsd_client_t *con)     /* I - Client connection */
  */
 
 static void
-reject_jobs(cupsd_client_t        *con,        /* I - Client connection */
+reject_jobs(cupsd_client_t  *con,      /* I - Client connection */
             ipp_attribute_t *uri)      /* I - Printer or class URI */
 {
   cups_ptype_t dtype;                  /* Destination type (printer or class) */
@@ -6548,12 +6686,12 @@ reject_jobs(cupsd_client_t        *con, /* I - Client connection */
                resource[HTTP_MAX_URI]; /* Resource portion of URI */
   int          port;                   /* Port portion of URI */
   const char   *name;                  /* Printer name */
-  cupsd_printer_t      *printer;               /* Printer data */
+  cupsd_printer_t *printer;            /* Printer data */
   ipp_attribute_t *attr;               /* printer-state-message text */
 
 
-  cupsdLogMessage(L_DEBUG2, "reject_jobs(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "reject_jobs(%p[%d], %s)", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Was this operation called from the correct URI?
@@ -6561,8 +6699,9 @@ reject_jobs(cupsd_client_t        *con,   /* I - Client connection */
 
   if (strncmp(con->uri, "/admin/", 7) != 0)
   {
-    cupsdLogMessage(L_ERROR, "reject_jobs: admin request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "reject_jobs: admin request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -6571,7 +6710,8 @@ reject_jobs(cupsd_client_t        *con,   /* I - Client connection */
   * Is the destination valid?
   */
 
-  httpSeparate(uri->values[0].string.text, method, username, host, &port, resource);
+  httpSeparate(uri->values[0].string.text, method, username, host, &port,
+               resource);
 
   if ((name = cupsdValidateDest(host, resource, &dtype, &printer)) == NULL)
   {
@@ -6579,7 +6719,8 @@ reject_jobs(cupsd_client_t        *con,   /* I - Client connection */
     * Bad URI...
     */
 
-    cupsdLogMessage(L_ERROR, "reject_jobs: resource name \'%s\' no good!", resource);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "reject_jobs: resource name \'%s\' no good!", resource);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -6590,7 +6731,7 @@ reject_jobs(cupsd_client_t        *con,   /* I - Client connection */
 
   if (!cupsdCheckPolicy(printer->op_policy_ptr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "reject_jobs: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "reject_jobs: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -6614,15 +6755,15 @@ reject_jobs(cupsd_client_t        *con, /* I - Client connection */
   {
     cupsdSaveAllClasses();
 
-    cupsdLogMessage(L_INFO, "Class \'%s\' rejecting jobs (\'%s\').", name,
-               con->username);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Class \'%s\' rejecting jobs (\'%s\').",
+                    name, con->username);
   }
   else
   {
     cupsdSaveAllPrinters();
 
-    cupsdLogMessage(L_INFO, "Printer \'%s\' rejecting jobs (\'%s\').", name,
-               con->username);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Printer \'%s\' rejecting jobs (\'%s\').",
+                    name, con->username);
   }
 
  /*
@@ -6638,7 +6779,7 @@ reject_jobs(cupsd_client_t        *con,   /* I - Client connection */
  */
 
 static void
-release_job(cupsd_client_t        *con,        /* I - Client connection */
+release_job(cupsd_client_t  *con,      /* I - Client connection */
             ipp_attribute_t *uri)      /* I - Job or Printer URI */
 {
   ipp_attribute_t *attr;               /* Current attribute */
@@ -6648,11 +6789,11 @@ release_job(cupsd_client_t        *con, /* I - Client connection */
                host[HTTP_MAX_URI],     /* Host portion of URI */
                resource[HTTP_MAX_URI]; /* Resource portion of URI */
   int          port;                   /* Port portion of URI */
-  cupsd_job_t          *job;                   /* Job information */
+  cupsd_job_t  *job;                   /* Job information */
 
 
-  cupsdLogMessage(L_DEBUG2, "release_job(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "release_job(%p[%d], %s)", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Verify that the POST operation was done to a valid URI.
@@ -6662,8 +6803,9 @@ release_job(cupsd_client_t        *con,   /* I - Client connection */
       strncmp(con->uri, "/jobs/", 5) != 0 &&
       strncmp(con->uri, "/printers/", 10) != 0)
   {
-    cupsdLogMessage(L_ERROR, "release_job: release request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "release_job: release request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -6680,7 +6822,8 @@ release_job(cupsd_client_t        *con,   /* I - Client connection */
 
     if ((attr = ippFindAttribute(con->request, "job-id", IPP_TAG_INTEGER)) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "release_job: got a printer-uri attribute but no job-id!");
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "release_job: got a printer-uri attribute but no job-id!");
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -6693,7 +6836,8 @@ release_job(cupsd_client_t        *con,   /* I - Client connection */
     * Got a job URI; parse it to get the job ID...
     */
 
-    httpSeparate(uri->values[0].string.text, method, username, host, &port, resource);
+    httpSeparate(uri->values[0].string.text, method, username, host, &port,
+                 resource);
  
     if (strncmp(resource, "/jobs/", 6) != 0)
     {
@@ -6701,8 +6845,9 @@ release_job(cupsd_client_t        *con,   /* I - Client connection */
       * Not a valid URI!
       */
 
-      cupsdLogMessage(L_ERROR, "release_job: bad job-uri attribute \'%s\'!",
-                 uri->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "release_job: bad job-uri attribute \'%s\'!",
+                      uri->values[0].string.text);
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -6720,7 +6865,8 @@ release_job(cupsd_client_t        *con,   /* I - Client connection */
     * Nope - return a "not found" error...
     */
 
-    cupsdLogMessage(L_ERROR, "release_job: job #%d doesn't exist!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "release_job: job #%d doesn't exist!",
+                    jobid);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -6735,7 +6881,8 @@ release_job(cupsd_client_t        *con,   /* I - Client connection */
     * Nope - return a "not possible" error...
     */
 
-    cupsdLogMessage(L_ERROR, "release_job: job #%d is not held!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "release_job: job #%d is not held!",
+                    jobid);
     send_ipp_error(con, IPP_NOT_POSSIBLE);
     return;
   }
@@ -6746,8 +6893,10 @@ release_job(cupsd_client_t        *con,  /* I - Client connection */
 
   if (!validate_user(job, con, job->username, username, sizeof(username)))
   {
-    cupsdLogMessage(L_ERROR, "release_job: \"%s\" not authorized to release job id %d owned by \"%s\"!",
-               username, jobid, job->username);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "release_job: \"%s\" not authorized to release job id "
+                   "%d owned by \"%s\"!",
+                    username, jobid, job->username);
     send_ipp_error(con, IPP_FORBIDDEN);
     return;
   }
@@ -6772,7 +6921,8 @@ release_job(cupsd_client_t        *con,   /* I - Client connection */
 
   cupsdReleaseJob(jobid);
 
-  cupsdLogMessage(L_INFO, "Job %d was released by \'%s\'.", jobid, username);
+  cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was released by \'%s\'.", jobid,
+                  username);
 
   con->response->request.status.status_code = IPP_OK;
 }
@@ -6783,8 +6933,9 @@ release_job(cupsd_client_t        *con,   /* I - Client connection */
  */
 
 static void
-renew_subscription(cupsd_client_t *con,        /* I - Client connection */
-                   int      sub_id)    /* I - Subscription ID */
+renew_subscription(
+    cupsd_client_t *con,               /* I - Client connection */
+    int            sub_id)             /* I - Subscription ID */
 {
 }
 
@@ -6794,7 +6945,7 @@ renew_subscription(cupsd_client_t *con,   /* I - Client connection */
  */
 
 static void
-restart_job(cupsd_client_t        *con,        /* I - Client connection */
+restart_job(cupsd_client_t  *con,      /* I - Client connection */
             ipp_attribute_t *uri)      /* I - Job or Printer URI */
 {
   ipp_attribute_t *attr;               /* Current attribute */
@@ -6804,11 +6955,11 @@ restart_job(cupsd_client_t        *con, /* I - Client connection */
                host[HTTP_MAX_URI],     /* Host portion of URI */
                resource[HTTP_MAX_URI]; /* Resource portion of URI */
   int          port;                   /* Port portion of URI */
-  cupsd_job_t          *job;                   /* Job information */
+  cupsd_job_t  *job;                   /* Job information */
 
 
-  cupsdLogMessage(L_DEBUG2, "restart_job(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "restart_job(%p[%d], %s)", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Verify that the POST operation was done to a valid URI.
@@ -6818,8 +6969,9 @@ restart_job(cupsd_client_t        *con,   /* I - Client connection */
       strncmp(con->uri, "/jobs/", 5) != 0 &&
       strncmp(con->uri, "/printers/", 10) != 0)
   {
-    cupsdLogMessage(L_ERROR, "restart_job: restart request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "restart_job: restart request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -6836,7 +6988,8 @@ restart_job(cupsd_client_t        *con,   /* I - Client connection */
 
     if ((attr = ippFindAttribute(con->request, "job-id", IPP_TAG_INTEGER)) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "restart_job: got a printer-uri attribute but no job-id!");
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "restart_job: got a printer-uri attribute but no job-id!");
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -6849,7 +7002,8 @@ restart_job(cupsd_client_t        *con,   /* I - Client connection */
     * Got a job URI; parse it to get the job ID...
     */
 
-    httpSeparate(uri->values[0].string.text, method, username, host, &port, resource);
+    httpSeparate(uri->values[0].string.text, method, username, host, &port,
+                 resource);
  
     if (strncmp(resource, "/jobs/", 6) != 0)
     {
@@ -6857,8 +7011,9 @@ restart_job(cupsd_client_t        *con,   /* I - Client connection */
       * Not a valid URI!
       */
 
-      cupsdLogMessage(L_ERROR, "restart_job: bad job-uri attribute \'%s\'!",
-                 uri->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "restart_job: bad job-uri attribute \'%s\'!",
+                      uri->values[0].string.text);
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -6876,7 +7031,8 @@ restart_job(cupsd_client_t        *con,   /* I - Client connection */
     * Nope - return a "not found" error...
     */
 
-    cupsdLogMessage(L_ERROR, "restart_job: job #%d doesn't exist!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "restart_job: job #%d doesn't exist!",
+                    jobid);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -6891,7 +7047,8 @@ restart_job(cupsd_client_t        *con,   /* I - Client connection */
     * Nope - return a "not possible" error...
     */
 
-    cupsdLogMessage(L_ERROR, "restart_job: job #%d is not complete!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "restart_job: job #%d is not complete!",
+                    jobid);
     send_ipp_error(con, IPP_NOT_POSSIBLE);
     return;
   }
@@ -6906,7 +7063,9 @@ restart_job(cupsd_client_t        *con,   /* I - Client connection */
     * Nope - return a "not possible" error...
     */
 
-    cupsdLogMessage(L_ERROR, "restart_job: job #%d cannot be restarted - no files!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "restart_job: job #%d cannot be restarted - no files!",
+                   jobid);
     send_ipp_error(con, IPP_NOT_POSSIBLE);
     return;
   }
@@ -6917,8 +7076,10 @@ restart_job(cupsd_client_t        *con,  /* I - Client connection */
 
   if (!validate_user(job, con, job->username, username, sizeof(username)))
   {
-    cupsdLogMessage(L_ERROR, "restart_job: \"%s\" not authorized to restart job id %d owned by \"%s\"!",
-               username, jobid, job->username);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "restart_job: \"%s\" not authorized to restart job id "
+                   "%d owned by \"%s\"!",
+                    username, jobid, job->username);
     send_ipp_error(con, IPP_FORBIDDEN);
     return;
   }
@@ -6929,7 +7090,8 @@ restart_job(cupsd_client_t        *con,   /* I - Client connection */
 
   cupsdRestartJob(jobid);
 
-  cupsdLogMessage(L_INFO, "Job %d was restarted by \'%s\'.", jobid, username);
+  cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was restarted by \'%s\'.", jobid,
+                  username);
 
   con->response->request.status.status_code = IPP_OK;
 }
@@ -6940,8 +7102,8 @@ restart_job(cupsd_client_t        *con,   /* I - Client connection */
  */
 
 static void
-save_auth_info(cupsd_client_t *con,            /* I - Client connection */
-               int      job_id)                /* I - Job ID */
+save_auth_info(cupsd_client_t *con,    /* I - Client connection */
+               int            job_id)  /* I - Job ID */
 {
   int          i;                      /* Looping var */
   char         filename[1024];         /* Job authentication filename */
@@ -6982,8 +7144,9 @@ save_auth_info(cupsd_client_t *con,               /* I - Client connection */
   snprintf(filename, sizeof(filename), "%s/a%05d", RequestRoot, job_id);
   if ((fp = cupsFileOpen(filename, "w")) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "Unable to save authentication info to \"%s\" - %s",
-               filename, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "Unable to save authentication info to \"%s\" - %s",
+                    filename, strerror(errno));
     return;
   }
 
@@ -7024,13 +7187,13 @@ save_auth_info(cupsd_client_t *con,             /* I - Client connection */
  */
 
 static void
-send_document(cupsd_client_t        *con,      /* I - Client connection */
+send_document(cupsd_client_t  *con,    /* I - Client connection */
              ipp_attribute_t *uri)     /* I - Printer URI */
 {
   ipp_attribute_t      *attr;          /* Current attribute */
   ipp_attribute_t      *format;        /* Document-format attribute */
   int                  jobid;          /* Job ID number */
-  cupsd_job_t                  *job;           /* Current job */
+  cupsd_job_t          *job;           /* Current job */
   char                 job_uri[HTTP_MAX_URI],
                                        /* Job URI */
                        method[HTTP_MAX_URI],
@@ -7050,14 +7213,14 @@ send_document(cupsd_client_t        *con,       /* I - Client connection */
                        mimetype[MIME_MAX_SUPER + MIME_MAX_TYPE + 2];
                                        /* Textual name of mime type */
   char                 filename[1024]; /* Job filename */
-  cupsd_printer_t              *printer;       /* Current printer */
+  cupsd_printer_t      *printer;       /* Current printer */
   struct stat          fileinfo;       /* File information */
   int                  kbytes;         /* Size of file */
   int                  compression;    /* Type of compression */
 
 
-  cupsdLogMessage(L_DEBUG2, "send_document(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "send_document(%p[%d], %s)", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Verify that the POST operation was done to a valid URI.
@@ -7067,8 +7230,9 @@ send_document(cupsd_client_t        *con, /* I - Client connection */
       strncmp(con->uri, "/jobs/", 6) != 0 &&
       strncmp(con->uri, "/printers/", 10) != 0)
   {
-    cupsdLogMessage(L_ERROR, "send_document: print request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "send_document: print request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -7085,7 +7249,8 @@ send_document(cupsd_client_t        *con, /* I - Client connection */
 
     if ((attr = ippFindAttribute(con->request, "job-id", IPP_TAG_INTEGER)) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "send_document: got a printer-uri attribute but no job-id!");
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "send_document: got a printer-uri attribute but no job-id!");
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -7106,8 +7271,9 @@ send_document(cupsd_client_t        *con, /* I - Client connection */
       * Not a valid URI!
       */
 
-      cupsdLogMessage(L_ERROR, "send_document: bad job-uri attribute \'%s\'!",
-                 uri->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "send_document: bad job-uri attribute \'%s\'!",
+                      uri->values[0].string.text);
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -7125,7 +7291,8 @@ send_document(cupsd_client_t        *con, /* I - Client connection */
     * Nope - return a "not found" error...
     */
 
-    cupsdLogMessage(L_ERROR, "send_document: job #%d doesn't exist!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "send_document: job #%d doesn't exist!",
+                    jobid);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -7136,8 +7303,10 @@ send_document(cupsd_client_t        *con,        /* I - Client connection */
 
   if (!validate_user(job, con, job->username, username, sizeof(username)))
   {
-    cupsdLogMessage(L_ERROR, "send_document: \"%s\" not authorized to send document for job id %d owned by \"%s\"!",
-               username, jobid, job->username);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "send_document: \"%s\" not authorized to send document "
+                   "for job id %d owned by \"%s\"!",
+                    username, jobid, job->username);
     send_ipp_error(con, IPP_FORBIDDEN);
     return;
   }
@@ -7157,8 +7326,9 @@ send_document(cupsd_client_t        *con, /* I - Client connection */
 #endif /* HAVE_LIBZ */
       )
     {
-      cupsdLogMessage(L_ERROR, "print_job: Unsupported compression \"%s\"!",
-                attr->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "print_job: Unsupported compression \"%s\"!",
+                     attr->values[0].string.text);
       send_ipp_error(con, IPP_ATTRIBUTES);
       ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_KEYWORD,
                   "compression", NULL, attr->values[0].string.text);
@@ -7177,7 +7347,7 @@ send_document(cupsd_client_t        *con, /* I - Client connection */
 
   if (!con->filename)
   {
-    cupsdLogMessage(L_ERROR, "send_document: No file!?!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "send_document: No file!?!");
     send_ipp_error(con, IPP_BAD_REQUEST);
     return;
   }
@@ -7186,7 +7356,8 @@ send_document(cupsd_client_t        *con, /* I - Client connection */
   * Is it a format we support?
   */
 
-  if ((format = ippFindAttribute(con->request, "document-format", IPP_TAG_MIMETYPE)) != NULL)
+  if ((format = ippFindAttribute(con->request, "document-format",
+                                 IPP_TAG_MIMETYPE)) != NULL)
   {
    /*
     * Grab format from client...
@@ -7194,8 +7365,9 @@ send_document(cupsd_client_t        *con, /* I - Client connection */
 
     if (sscanf(format->values[0].string.text, "%15[^/]/%31[^;]", super, type) != 2)
     {
-      cupsdLogMessage(L_ERROR, "send_document: could not scan type \'%s\'!",
-                format->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "send_document: could not scan type \'%s\'!",
+                     format->values[0].string.text);
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -7217,7 +7389,7 @@ send_document(cupsd_client_t        *con, /* I - Client connection */
     * Auto-type the file...
     */
 
-    cupsdLogMessage(L_DEBUG, "send_document: auto-typing file...");
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "send_document: auto-typing file...");
 
     filetype = mimeFileType(MimeDatabase, con->filename, &compression);
 
@@ -7247,9 +7419,11 @@ send_document(cupsd_client_t        *con,        /* I - Client connection */
 
   if (filetype == NULL)
   {
-    cupsdLogMessage(L_ERROR, "send_document: Unsupported format \'%s/%s\'!",
-              super, type);
-    cupsdLogMessage(L_INFO, "Hint: Do you have the raw file printing rules enabled?");
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "send_document: Unsupported format \'%s/%s\'!",
+                   super, type);
+    cupsdLogMessage(CUPSD_LOG_INFO,
+                    "Hint: Do you have the raw file printing rules enabled?");
     send_ipp_error(con, IPP_DOCUMENT_FORMAT);
 
     if (format)
@@ -7259,8 +7433,9 @@ send_document(cupsd_client_t        *con, /* I - Client connection */
     return;
   }
 
-  cupsdLogMessage(L_DEBUG, "send_document: request file type is %s/%s.",
-            filetype->super, filetype->type);
+  cupsdLogMessage(CUPSD_LOG_DEBUG,
+                  "send_document: request file type is %s/%s.",
+                 filetype->super, filetype->type);
 
  /*
   * Add the file to the job...
@@ -7290,8 +7465,9 @@ send_document(cupsd_client_t        *con, /* I - Client connection */
 
   cupsdClearString(&con->filename);
 
-  cupsdLogMessage(L_INFO, "File of type %s/%s queued in job #%d by \'%s\'.",
-             filetype->super, filetype->type, job->id, job->username);
+  cupsdLogMessage(CUPSD_LOG_INFO,
+                  "File of type %s/%s queued in job #%d by \'%s\'.",
+                  filetype->super, filetype->type, job->id, job->username);
 
  /*
   * Start the job if this is the last document...
@@ -7313,8 +7489,9 @@ send_document(cupsd_client_t        *con, /* I - Client connection */
       * Yes...
       */
 
-      cupsdLogMessage(L_INFO, "Adding end banner page \"%s\" to job %d.",
-                attr->values[1].string.text, job->id);
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "Adding end banner page \"%s\" to job %d.",
+                     attr->values[1].string.text, job->id);
 
       kbytes = copy_banner(con, job, attr->values[1].string.text);
 
@@ -7335,8 +7512,8 @@ send_document(cupsd_client_t        *con, /* I - Client connection */
     cupsdSaveJob(job->id);
 
    /*
-    * Start the job if possible...  Since cupsdCheckJobs() can cancel a job if it
-    * doesn't print, we need to re-find the job afterwards...
+    * Start the job if possible...  Since cupsdCheckJobs() can cancel a
+    * job if it doesn't print, we need to re-find the job afterwards...
     */
 
     jobid = job->id;
@@ -7372,7 +7549,7 @@ send_document(cupsd_client_t        *con, /* I - Client connection */
 
   ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_ENUM, "job-state",
                 job ? job->state->values[0].integer : IPP_JOB_CANCELLED);
-  add_cupsd_job_state_reasons(con, job);
+  add_job_state_reasons(con, job);
 
   con->response->request.status.status_code = IPP_OK;
 }
@@ -7383,13 +7560,13 @@ send_document(cupsd_client_t        *con,       /* I - Client connection */
  */
 
 static void
-send_ipp_error(cupsd_client_t     *con,        /* I - Client connection */
-               ipp_status_t status)    /* I - IPP status code */
+send_ipp_error(cupsd_client_t *con,    /* I - Client connection */
+               ipp_status_t   status)  /* I - IPP status code */
 {
-  cupsdLogMessage(L_DEBUG2, "send_ipp_error(%p[%d], %x)\n", con, con->http.fd,
-             status);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "send_ipp_error(%p[%d], %x)", con,
+                  con->http.fd, status);
 
-  cupsdLogMessage(L_DEBUG, "Sending error: %s", ippErrorString(status));
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "Sending error: %s", ippErrorString(status));
 
   if (status == IPP_NOT_AUTHORIZED)
   {
@@ -7424,7 +7601,7 @@ send_ipp_error(cupsd_client_t     *con,   /* I - Client connection */
  */
 
 static void
-set_default(cupsd_client_t        *con,        /* I - Client connection */
+set_default(cupsd_client_t  *con,      /* I - Client connection */
             ipp_attribute_t *uri)      /* I - Printer URI */
 {
   cups_ptype_t         dtype;          /* Destination type (printer or class) */
@@ -7438,11 +7615,11 @@ set_default(cupsd_client_t        *con, /* I - Client connection */
                                        /* Resource portion of URI */
   int                  port;           /* Port portion of URI */
   const char           *name;          /* Printer name */
-  cupsd_printer_t              *printer;       /* Printer */
+  cupsd_printer_t      *printer;       /* Printer */
 
 
-  cupsdLogMessage(L_DEBUG2, "set_default(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "set_default(%p[%d], %s)", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Was this operation called from the correct URI?
@@ -7450,8 +7627,9 @@ set_default(cupsd_client_t        *con,   /* I - Client connection */
 
   if (strncmp(con->uri, "/admin/", 7) != 0)
   {
-    cupsdLogMessage(L_ERROR, "set_default: admin request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "set_default: admin request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -7460,7 +7638,8 @@ set_default(cupsd_client_t        *con,   /* I - Client connection */
   * Is the destination valid?
   */
 
-  httpSeparate(uri->values[0].string.text, method, username, host, &port, resource);
+  httpSeparate(uri->values[0].string.text, method, username, host, &port,
+               resource);
 
   if ((name = cupsdValidateDest(host, resource, &dtype, &printer)) == NULL)
   {
@@ -7468,7 +7647,8 @@ set_default(cupsd_client_t        *con,   /* I - Client connection */
     * Bad URI...
     */
 
-    cupsdLogMessage(L_ERROR, "set_default: resource name \'%s\' no good!", resource);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "set_default: resource name \'%s\' no good!", resource);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -7479,7 +7659,7 @@ set_default(cupsd_client_t        *con,   /* I - Client connection */
 
   if (!cupsdCheckPolicy(DefaultPolicyPtr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "set_default: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "set_default: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -7493,8 +7673,9 @@ set_default(cupsd_client_t        *con,   /* I - Client connection */
   cupsdSaveAllPrinters();
   cupsdSaveAllClasses();
 
-  cupsdLogMessage(L_INFO, "Default destination set to \'%s\' by \'%s\'.", name,
-             con->username);
+  cupsdLogMessage(CUPSD_LOG_INFO,
+                  "Default destination set to \'%s\' by \'%s\'.", name,
+                  con->username);
 
  /*
   * Everything was ok, so return OK status...
@@ -7509,14 +7690,14 @@ set_default(cupsd_client_t        *con, /* I - Client connection */
  */
 
 static void
-set_job_attrs(cupsd_client_t        *con,      /* I - Client connection */
+set_job_attrs(cupsd_client_t  *con,    /* I - Client connection */
              ipp_attribute_t *uri)     /* I - Job URI */
 {
   ipp_attribute_t      *attr,          /* Current attribute */
                        *attr2,         /* Job attribute */
                        *prev2;         /* Previous job attribute */
   int                  jobid;          /* Job ID */
-  cupsd_job_t                  *job;           /* Current job */
+  cupsd_job_t          *job;           /* Current job */
   char                 method[HTTP_MAX_URI],
                                        /* Method portion of URI */
                        username[HTTP_MAX_URI],
@@ -7528,8 +7709,8 @@ set_job_attrs(cupsd_client_t        *con, /* I - Client connection */
   int                  port;           /* Port portion of URI */
 
 
-  cupsdLogMessage(L_DEBUG2, "set_job_attrs(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "set_job_attrs(%p[%d], %s)", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Start with "everything is OK" status...
@@ -7549,7 +7730,8 @@ set_job_attrs(cupsd_client_t        *con, /* I - Client connection */
 
     if ((attr = ippFindAttribute(con->request, "job-id", IPP_TAG_INTEGER)) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "set_job_attrs: got a printer-uri attribute but no job-id!");
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "set_job_attrs: got a printer-uri attribute but no job-id!");
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -7570,8 +7752,9 @@ set_job_attrs(cupsd_client_t        *con, /* I - Client connection */
       * Not a valid URI!
       */
 
-      cupsdLogMessage(L_ERROR, "set_job_attrs: bad job-uri attribute \'%s\'!\n",
-                 uri->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "set_job_attrs: bad job-uri attribute \'%s\'!\n",
+                      uri->values[0].string.text);
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -7589,7 +7772,8 @@ set_job_attrs(cupsd_client_t        *con, /* I - Client connection */
     * Nope - return a "not found" error...
     */
 
-    cupsdLogMessage(L_ERROR, "set_job_attrs: job #%d doesn't exist!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "set_job_attrs: job #%d doesn't exist!",
+                    jobid);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -7604,7 +7788,9 @@ set_job_attrs(cupsd_client_t        *con, /* I - Client connection */
     * Return a "not-possible" error...
     */
 
-    cupsdLogMessage(L_ERROR, "set_job_attrs: job #%d is finished and cannot be altered!", jobid);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "set_job_attrs: job #%d is finished and cannot be altered!",
+                   jobid);
     send_ipp_error(con, IPP_NOT_POSSIBLE);
     return;
   }
@@ -7615,8 +7801,10 @@ set_job_attrs(cupsd_client_t        *con,        /* I - Client connection */
 
   if (!validate_user(job, con, job->username, username, sizeof(username)))
   {
-    cupsdLogMessage(L_ERROR, "set_job_attrs: \"%s\" not authorized to alter job id %d owned by \"%s\"!",
-               username, jobid, job->username);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "set_job_attrs: \"%s\" not authorized to alter job id "
+                   "%d owned by \"%s\"!",
+                    username, jobid, job->username);
     send_ipp_error(con, IPP_FORBIDDEN);
     return;
   }
@@ -7785,11 +7973,11 @@ set_job_attrs(cupsd_client_t        *con,       /* I - Client connection */
       * See if the job-name or job-hold-until is being changed.
       */
 
-      if (strcmp(attr->name, "job-hold-until") == 0)
+      if (!strcmp(attr->name, "job-hold-until"))
       {
         cupsdSetJobHoldUntil(job->id, attr->values[0].string.text);
 
-       if (strcmp(attr->values[0].string.text, "no-hold") == 0)
+       if (!strcmp(attr->values[0].string.text, "no-hold"))
          cupsdReleaseJob(job->id);
        else
          cupsdHoldJob(job->id);
@@ -7849,7 +8037,7 @@ set_job_attrs(cupsd_client_t        *con, /* I - Client connection */
  */
 
 static void
-start_printer(cupsd_client_t        *con,      /* I - Client connection */
+start_printer(cupsd_client_t  *con,    /* I - Client connection */
               ipp_attribute_t *uri)    /* I - Printer URI */
 {
   cups_ptype_t         dtype;          /* Destination type (printer or class) */
@@ -7863,11 +8051,11 @@ start_printer(cupsd_client_t        *con,       /* I - Client connection */
                                        /* Resource portion of URI */
   int                  port;           /* Port portion of URI */
   const char           *name;          /* Printer name */
-  cupsd_printer_t              *printer;       /* Printer data */
+  cupsd_printer_t      *printer;       /* Printer data */
 
 
-  cupsdLogMessage(L_DEBUG2, "start_printer(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_printer(%p[%d], %s)", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Was this operation called from the correct URI?
@@ -7875,8 +8063,9 @@ start_printer(cupsd_client_t        *con, /* I - Client connection */
 
   if (strncmp(con->uri, "/admin/", 7) != 0)
   {
-    cupsdLogMessage(L_ERROR, "start_printer: admin request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "start_printer: admin request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -7885,7 +8074,8 @@ start_printer(cupsd_client_t        *con, /* I - Client connection */
   * Is the destination valid?
   */
 
-  httpSeparate(uri->values[0].string.text, method, username, host, &port, resource);
+  httpSeparate(uri->values[0].string.text, method, username, host, &port,
+               resource);
 
   if ((name = cupsdValidateDest(host, resource, &dtype, &printer)) == NULL)
   {
@@ -7893,7 +8083,8 @@ start_printer(cupsd_client_t        *con, /* I - Client connection */
     * Bad URI...
     */
 
-    cupsdLogMessage(L_ERROR, "start_printer: resource name \'%s\' no good!", resource);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "start_printer: resource name \'%s\' no good!", resource);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -7904,7 +8095,7 @@ start_printer(cupsd_client_t        *con, /* I - Client connection */
 
   if (!cupsdCheckPolicy(printer->op_policy_ptr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "start_printer: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "start_printer: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -7918,10 +8109,10 @@ start_printer(cupsd_client_t        *con,       /* I - Client connection */
   cupsdStartPrinter(printer, 1);
 
   if (dtype & CUPS_PRINTER_CLASS)
-    cupsdLogMessage(L_INFO, "Class \'%s\' started by \'%s\'.", name,
-               con->username);
-    cupsdLogMessage(L_INFO, "Printer \'%s\' started by \'%s\'.", name,
-               con->username);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Class \'%s\' started by \'%s\'.", name,
+                    con->username);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Printer \'%s\' started by \'%s\'.", name,
+                    con->username);
 
   cupsdCheckJobs();
 
@@ -7938,7 +8129,7 @@ start_printer(cupsd_client_t        *con, /* I - Client connection */
  */
 
 static void
-stop_printer(cupsd_client_t        *con,       /* I - Client connection */
+stop_printer(cupsd_client_t  *con,     /* I - Client connection */
              ipp_attribute_t *uri)     /* I - Printer URI */
 {
   cups_ptype_t         dtype;          /* Destination type (printer or class) */
@@ -7952,12 +8143,12 @@ stop_printer(cupsd_client_t        *con,        /* I - Client connection */
                                        /* Resource portion of URI */
   int                  port;           /* Port portion of URI */
   const char           *name;          /* Printer name */
-  cupsd_printer_t              *printer;       /* Printer data */
+  cupsd_printer_t      *printer;       /* Printer data */
   ipp_attribute_t      *attr;          /* printer-state-message attribute */
 
 
-  cupsdLogMessage(L_DEBUG2, "stop_printer(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "stop_printer(%p[%d], %s)", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Was this operation called from the correct URI?
@@ -7965,8 +8156,9 @@ stop_printer(cupsd_client_t        *con,  /* I - Client connection */
 
   if (strncmp(con->uri, "/admin/", 7) != 0)
   {
-    cupsdLogMessage(L_ERROR, "stop_printer: admin request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "stop_printer: admin request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -7983,7 +8175,8 @@ stop_printer(cupsd_client_t        *con,  /* I - Client connection */
     * Bad URI...
     */
 
-    cupsdLogMessage(L_ERROR, "stop_printer: resource name \'%s\' no good!", resource);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "stop_printer: resource name \'%s\' no good!", resource);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -7994,7 +8187,7 @@ stop_printer(cupsd_client_t        *con,  /* I - Client connection */
 
   if (!cupsdCheckPolicy(printer->op_policy_ptr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "stop_printer: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "stop_printer: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -8015,11 +8208,11 @@ stop_printer(cupsd_client_t        *con,        /* I - Client connection */
   cupsdStopPrinter(printer, 1);
 
   if (dtype & CUPS_PRINTER_CLASS)
-    cupsdLogMessage(L_INFO, "Class \'%s\' stopped by \'%s\'.", name,
-               con->username);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Class \'%s\' stopped by \'%s\'.", name,
+                    con->username);
   else
-    cupsdLogMessage(L_INFO, "Printer \'%s\' stopped by \'%s\'.", name,
-               con->username);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Printer \'%s\' stopped by \'%s\'.", name,
+                    con->username);
 
  /*
   * Everything was ok, so return OK status...
@@ -8034,8 +8227,8 @@ stop_printer(cupsd_client_t        *con,  /* I - Client connection */
  */
 
 static int                             /* O - 0 if not allowed, 1 if allowed */
-user_allowed(cupsd_printer_t  *p,              /* I - Printer or class */
-             const char *username)     /* I - Username */
+user_allowed(cupsd_printer_t *p,       /* I - Printer or class */
+             const char      *username)        /* I - Username */
 {
   int          i;                      /* Looping var */
   struct passwd        *pw;                    /* User password data */
@@ -8074,7 +8267,7 @@ user_allowed(cupsd_printer_t  *p,         /* I - Printer or class */
  */
 
 static void
-validate_job(cupsd_client_t        *con,       /* I - Client connection */
+validate_job(cupsd_client_t  *con,     /* I - Client connection */
             ipp_attribute_t *uri)      /* I - Printer URI */
 {
   ipp_attribute_t      *attr;          /* Current attribute */
@@ -8093,11 +8286,11 @@ validate_job(cupsd_client_t        *con,        /* I - Client connection */
                                        /* Supertype of file */
                        type[MIME_MAX_TYPE];
                                        /* Subtype of file */
-  cupsd_printer_t              *printer;       /* Printer */
+  cupsd_printer_t      *printer;       /* Printer */
 
 
-  cupsdLogMessage(L_DEBUG2, "validate_job(%p[%d], %s)\n", con, con->http.fd,
-             uri->values[0].string.text);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "validate_job(%p[%d], %s)\n", con,
+                  con->http.fd, uri->values[0].string.text);
 
  /*
   * Verify that the POST operation was done to a valid URI.
@@ -8106,8 +8299,9 @@ validate_job(cupsd_client_t        *con,  /* I - Client connection */
   if (strncmp(con->uri, "/classes/", 9) != 0 &&
       strncmp(con->uri, "/printers/", 10) != 0)
   {
-    cupsdLogMessage(L_ERROR, "validate_job: request on bad resource \'%s\'!",
-               con->uri);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "validate_job: request on bad resource \'%s\'!",
+                    con->uri);
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -8120,8 +8314,9 @@ validate_job(cupsd_client_t        *con,  /* I - Client connection */
   if ((attr = ippFindAttribute(con->request, "compression", IPP_TAG_KEYWORD)) != NULL &&
       strcmp(attr->values[0].string.text, "none") == 0)
   {
-    cupsdLogMessage(L_ERROR, "validate_job: Unsupported compression attribute %s!",
-               attr->values[0].string.text);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "validate_job: Unsupported compression attribute %s!",
+                    attr->values[0].string.text);
     send_ipp_error(con, IPP_ATTRIBUTES);
     ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_KEYWORD,
                 "compression", NULL, attr->values[0].string.text);
@@ -8132,12 +8327,14 @@ validate_job(cupsd_client_t        *con,        /* I - Client connection */
   * Is it a format we support?
   */
 
-  if ((format = ippFindAttribute(con->request, "document-format", IPP_TAG_MIMETYPE)) != NULL)
+  if ((format = ippFindAttribute(con->request, "document-format",
+                                 IPP_TAG_MIMETYPE)) != NULL)
   {
     if (sscanf(format->values[0].string.text, "%15[^/]/%31[^;]", super, type) != 2)
     {
-      cupsdLogMessage(L_ERROR, "validate_job: could not scan type \'%s\'!\n",
-                format->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "validate_job: could not scan type \'%s\'!\n",
+                     format->values[0].string.text);
       send_ipp_error(con, IPP_BAD_REQUEST);
       return;
     }
@@ -8146,9 +8343,11 @@ validate_job(cupsd_client_t        *con, /* I - Client connection */
         strcmp(type, "octet-stream") != 0) &&
        mimeType(MimeDatabase, super, type) == NULL)
     {
-      cupsdLogMessage(L_ERROR, "validate_job: Unsupported format \'%s\'!\n",
-                format->values[0].string.text);
-      cupsdLogMessage(L_INFO, "Hint: Do you have the raw file printing rules enabled?");
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "validate_job: Unsupported format \'%s\'!\n",
+                     format->values[0].string.text);
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "Hint: Do you have the raw file printing rules enabled?");
       send_ipp_error(con, IPP_DOCUMENT_FORMAT);
       ippAddString(con->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_MIMETYPE,
                    "document-format", NULL, format->values[0].string.text);
@@ -8168,7 +8367,8 @@ validate_job(cupsd_client_t        *con,  /* I - Client connection */
     * Bad URI...
     */
 
-    cupsdLogMessage(L_ERROR, "validate_job: resource name \'%s\' no good!", resource);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "validate_job: resource name \'%s\' no good!", resource);
     send_ipp_error(con, IPP_NOT_FOUND);
     return;
   }
@@ -8179,7 +8379,7 @@ validate_job(cupsd_client_t        *con,  /* I - Client connection */
 
   if (!cupsdCheckPolicy(printer->op_policy_ptr, con, NULL))
   {
-    cupsdLogMessage(L_ERROR, "validate_job: not authorized!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "validate_job: not authorized!");
     send_ipp_error(con, IPP_NOT_AUTHORIZED);
     return;
   }
@@ -8223,19 +8423,21 @@ validate_name(const char *name) /* I - Name to check */
  */
 
 static int                             /* O - 1 if permitted, 0 otherwise */
-validate_user(cupsd_job_t      *job,           /* I - Job */
-              cupsd_client_t   *con,           /* I - Client connection */
-              const char *owner,       /* I - Owner of job/resource */
-              char       *username,    /* O - Authenticated username */
-             int        userlen)       /* I - Length of username */
+validate_user(cupsd_job_t    *job,     /* I - Job */
+              cupsd_client_t *con,     /* I - Client connection */
+              const char     *owner,   /* I - Owner of job/resource */
+              char           *username,        /* O - Authenticated username */
+             int            userlen)   /* I - Length of username */
 {
   ipp_attribute_t      *attr;          /* requesting-user-name attribute */
-  cupsd_printer_t              *printer;       /* Printer for job */
+  cupsd_printer_t      *printer;       /* Printer for job */
 
 
-  cupsdLogMessage(L_DEBUG2, "validate_user(job=%d, con=%d, owner=\"%s\", username=%p, userlen=%d)\n",
-             job ? job->id : 0, con->http.fd, owner ? owner : "(null)",
-            username, userlen);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "validate_user(job=%d, con=%d, owner=\"%s\", username=%p, "
+                 "userlen=%d)",
+                 job ? job->id : 0, con->http.fd, owner ? owner : "(null)",
+                 username, userlen);
 
  /*
   * Validate input...
@@ -8250,7 +8452,8 @@ validate_user(cupsd_job_t      *job,              /* I - Job */
 
   if (con->username[0])
     strlcpy(username, con->username, userlen);
-  else if ((attr = ippFindAttribute(con->request, "requesting-user-name", IPP_TAG_NAME)) != NULL)
+  else if ((attr = ippFindAttribute(con->request, "requesting-user-name",
+                                    IPP_TAG_NAME)) != NULL)
     strlcpy(username, attr->values[0].string.text, userlen);
   else
     strlcpy(username, "anonymous", userlen);
index 5fd2e00a51db77077e773586eafbee937d7a473f..3c5473a10a619fd63496cf12e59ef5d24517e0ca 100644 (file)
  *   cupsdCancelJob()           - Cancel the specified print job.
  *   cupsdCancelJobs()          - Cancel all jobs for the given destination/user...
  *   cupsdCheckJobs()           - Check the pending jobs and start any if the
- *                           destination is available.
+ *                                destination is available.
  *   cupsdCleanJobs()           - Clean out old jobs.
  *   cupsdFreeAllJobs()         - Free all jobs from memory.
  *   cupsdFindJob()             - Find the specified job.
  *   cupsdGetPrinterJobCount()  - Get the number of pending, processing,
- *                           or held jobs in a printer or class.
+ *                                or held jobs in a printer or class.
  *   cupsdGetUserJobCount()     - Get the number of pending, processing,
- *                           or held jobs for a user.
+ *                                or held jobs for a user.
  *   cupsdHoldJob()             - Hold the specified job.
  *   cupsdLoadAllJobs()         - Load all jobs from disk.
  *   cupsdMoveJob()             - Move the specified job to a different
- *                           destination.
+ *                                destination.
  *   cupsdReleaseJob()          - Release the specified job.
  *   cupsdRestartJob()          - Restart the specified job.
  *   cupsdSaveJob()             - Save a job to disk.
  *   cupsdSetJobHoldUntil()     - Set the hold time for a job...
  *   cupsdSetJobPriority()      - Set the priority of a job, moving it up/down
- *                           in the list as needed.
+ *                                in the list as needed.
  *   cupsdStartJob()            - Start a print job.
  *   cupsdStopAllJobs()         - Stop all print jobs.
  *   cupsdStopJob()             - Stop a print job.
  *   cupsdUpdateJob()           - Read a status update from a job's filters.
- *   compare_active_jobs() - Compare the job IDs and priorities of two jobs.
- *   compare_jobs()        - Compare the job IDs of two jobs.
- *   ipp_length()          - Compute the size of the buffer needed to hold 
- *                          the textual IPP attributes.
- *   set_hold_until()      - Set the hold time and update job-hold-until attribute.
+ *   compare_active_jobs()      - Compare the job IDs and priorities of two jobs.
+ *   compare_jobs()             - Compare the job IDs of two jobs.
+ *   ipp_length()               - Compute the size of the buffer needed to hold 
+ *                               the textual IPP attributes.
+ *   set_hold_until()           - Set the hold time and update job-hold-until attribute.
  */
 
 /*
@@ -94,11 +94,11 @@ static void set_hold_until(cupsd_job_t *job, time_t holdtime);
  * 'cupsdAddJob()' - Add a new job to the job queue...
  */
 
-cupsd_job_t *                                  /* O - New job record */
-cupsdAddJob(int        priority,               /* I - Job priority */
-       const char *dest)               /* I - Job destination */
+cupsd_job_t *                          /* O - New job record */
+cupsdAddJob(int        priority,       /* I - Job priority */
+            const char *dest)          /* I - Job destination */
 {
-  cupsd_job_t  *job;                           /* New job record */
+  cupsd_job_t  *job;                   /* New job record */
 
 
   job = calloc(sizeof(cupsd_job_t), 1);
@@ -129,14 +129,14 @@ cupsdAddJob(int        priority,          /* I - Job priority */
 
 void
 cupsdCancelJob(int id,                 /* I - Job to cancel */
-          int purge)                   /* I - Purge jobs? */
+               int purge)              /* I - Purge jobs? */
 {
-  int  i;                              /* Looping var */
-  cupsd_job_t  *job;                           /* Current job */
-  char filename[1024];                 /* Job filename */
+  int          i;                      /* Looping var */
+  cupsd_job_t  *job;                   /* Current job */
+  char         filename[1024];         /* Job filename */
 
 
-  cupsdLogMessage(L_DEBUG, "cupsdCancelJob: id = %d", id);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdCancelJob: id = %d", id);
 
  /*
   * Find the job...
@@ -242,11 +242,11 @@ cupsdCancelJob(int id,                    /* I - Job to cancel */
  */
 
 void
-cupsdCancelJobs(const char *dest,              /* I - Destination to cancel */
-           const char *username,       /* I - Username or NULL */
-          int        purge)            /* I - Purge jobs? */
+cupsdCancelJobs(const char *dest,      /* I - Destination to cancel */
+                const char *username,  /* I - Username or NULL */
+               int        purge)       /* I - Purge jobs? */
 {
-  cupsd_job_t  *job;                           /* Current job */
+  cupsd_job_t  *job;                   /* Current job */
 
 
   for (job = (cupsd_job_t *)cupsArrayFirst(Jobs);
@@ -271,15 +271,15 @@ cupsdCancelJobs(const char *dest,         /* I - Destination to cancel */
 
 /*
  * 'cupsdCheckJobs()' - Check the pending jobs and start any if the destination
- *                 is available.
+ *                      is available.
  */
 
 void
 cupsdCheckJobs(void)
 {
-  cupsd_job_t          *job;                   /* Current job in queue */
-  cupsd_printer_t      *printer,               /* Printer destination */
-               *pclass;                /* Printer class destination */
+  cupsd_job_t          *job;           /* Current job in queue */
+  cupsd_printer_t      *printer,       /* Printer destination */
+                       *pclass;        /* Printer class destination */
 
 
   DEBUG_puts("cupsdCheckJobs()");
@@ -330,8 +330,9 @@ cupsdCheckJobs(void)
        * cancel the job...
        */
 
-        cupsdLogMessage(L_WARN, "Printer/class %s has gone away; cancelling job %d!",
-                  job->dest, job->id);
+        cupsdLogMessage(CUPSD_LOG_WARN,
+                       "Printer/class %s has gone away; cancelling job %d!",
+                       job->dest, job->id);
 
        cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
                       "Job cancelled because the destination printer/class has gone away.");
@@ -362,7 +363,7 @@ cupsdCheckJobs(void)
 void
 cupsdCleanJobs(void)
 {
-  cupsd_job_t  *job;                           /* Current job */
+  cupsd_job_t  *job;                   /* Current job */
 
 
   if (!MaxJobs)
@@ -381,16 +382,18 @@ cupsdCleanJobs(void)
  */
 
 void
-cupsdFinishJob(cupsd_job_t *job)                       /* I - Job */
+cupsdFinishJob(cupsd_job_t *job)       /* I - Job */
 {
-  int          job_history;            /* Did cupsdCancelJob() keep the job? */
-  cupsd_printer_t      *printer;               /* Current printer */
+  int                  job_history;    /* Did cupsdCancelJob() keep the job? */
+  cupsd_printer_t      *printer;       /* Current printer */
 
 
-  cupsdLogMessage(L_DEBUG, "cupsdFinishJob: job %d, file %d is complete.",
-             job->id, job->current_file - 1);
+  cupsdLogMessage(CUPSD_LOG_DEBUG,
+                  "cupsdFinishJob: job %d, file %d is complete.",
+                  job->id, job->current_file - 1);
 
-  cupsdLogMessage(L_DEBUG2, "cupsdFinishJob: job->status is %d", job->status);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFinishJob: job->status is %d",
+                  job->status);
 
   if (job->status_buffer && job->current_file >= job->num_files)
   {
@@ -398,13 +401,15 @@ cupsdFinishJob(cupsd_job_t *job)                  /* I - Job */
     * Close the pipe and clear the input bit.
     */
 
-    cupsdLogMessage(L_DEBUG2, "cupsdFinishJob: Removing fd %d from InputSet...",
-               job->status_buffer->fd);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdFinishJob: Removing fd %d from InputSet...",
+                    job->status_buffer->fd);
 
     FD_CLR(job->status_buffer->fd, InputSet);
 
-    cupsdLogMessage(L_DEBUG2, "cupsdFinishJob: Closing status input pipe %d...",
-               job->status_buffer->fd);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdFinishJob: Closing status input pipe %d...",
+                    job->status_buffer->fd);
 
     cupsdStatBufDelete(job->status_buffer);
 
@@ -455,8 +460,9 @@ cupsdFinishJob(cupsd_job_t *job)                    /* I - Job */
              * Too many tries...
              */
 
-             cupsdLogMessage(L_ERROR, "Canceling job %d since it could not be sent after %d tries.",
-                        job->id, FaxRetryLimit);
+             cupsdLogMessage(CUPSD_LOG_ERROR,
+                             "Canceling job %d since it could not be sent after %d tries.",
+                             job->id, FaxRetryLimit);
 
              cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
                            "Job cancelled since it could not be sent after %d tries.",
@@ -589,7 +595,7 @@ cupsdFinishJob(cupsd_job_t *job)                    /* I - Job */
 void
 cupsdFreeAllJobs(void)
 {
-  cupsd_job_t  *job;                           /* Current job */
+  cupsd_job_t  *job;                   /* Current job */
 
 
   cupsdHoldSignals();
@@ -622,10 +628,10 @@ cupsdFreeAllJobs(void)
  * 'cupsdFindJob()' - Find the specified job.
  */
 
-cupsd_job_t *                                  /* O - Job data */
-cupsdFindJob(int id)                           /* I - Job ID */
+cupsd_job_t *                          /* O - Job data */
+cupsdFindJob(int id)                   /* I - Job ID */
 {
-  cupsd_job_t          key;                    /* Search key */
+  cupsd_job_t          key;            /* Search key */
 
 
   key.id = id;
@@ -636,14 +642,15 @@ cupsdFindJob(int id)                              /* I - Job ID */
 
 /*
  * 'cupsdGetPrinterJobCount()' - Get the number of pending, processing,
- *                          or held jobs in a printer or class.
+ *                               or held jobs in a printer or class.
  */
 
 int                                    /* O - Job count */
-cupsdGetPrinterJobCount(const char *dest)      /* I - Printer or class name */
+cupsdGetPrinterJobCount(
+    const char *dest)                  /* I - Printer or class name */
 {
-  int  count;                          /* Job count */
-  cupsd_job_t  *job;                           /* Current job */
+  int          count;                  /* Job count */
+  cupsd_job_t  *job;                   /* Current job */
 
 
   for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs), count = 0;
@@ -658,14 +665,15 @@ cupsdGetPrinterJobCount(const char *dest) /* I - Printer or class name */
 
 /*
  * 'cupsdGetUserJobCount()' - Get the number of pending, processing,
- *                       or held jobs for a user.
+ *                            or held jobs for a user.
  */
 
 int                                    /* O - Job count */
-cupsdGetUserJobCount(const char *username)     /* I - Username */
+cupsdGetUserJobCount(
+    const char *username)              /* I - Username */
 {
-  int  count;                          /* Job count */
-  cupsd_job_t  *job;                           /* Current job */
+  int          count;                  /* Job count */
+  cupsd_job_t  *job;                   /* Current job */
 
 
   for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs), count = 0;
@@ -683,12 +691,12 @@ cupsdGetUserJobCount(const char *username)        /* I - Username */
  */
 
 void
-cupsdHoldJob(int id)                           /* I - Job ID */
+cupsdHoldJob(int id)                   /* I - Job ID */
 {
-  cupsd_job_t  *job;                           /* Job data */
+  cupsd_job_t  *job;                   /* Job data */
 
 
-  cupsdLogMessage(L_DEBUG, "cupsdHoldJob: id = %d", id);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdHoldJob: id = %d", id);
 
   if ((job = cupsdFindJob(id)) == NULL)
     return;
@@ -713,23 +721,27 @@ cupsdHoldJob(int id)                              /* I - Job ID */
 void
 cupsdLoadAllJobs(void)
 {
-  cups_dir_t   *dir;                   /* Directory */
-  cups_dentry_t        *dent;                  /* Directory entry */
-  char         filename[1024];         /* Full filename of job file */
-  int          fd;                     /* File descriptor */
-  cupsd_job_t          *job;                   /* New job */
-  int          jobid,                  /* Current job ID */
-               fileid;                 /* Current file ID */
-  ipp_attribute_t *attr;               /* Job attribute */
-  char         method[HTTP_MAX_URI],   /* Method portion of URI */
-               username[HTTP_MAX_URI], /* Username portion of URI */
-               host[HTTP_MAX_URI],     /* Host portion of URI */
-               resource[HTTP_MAX_URI]; /* Resource portion of URI */
-  int          port;                   /* Port portion of URI */
-  cupsd_printer_t      *p;                     /* Printer or class */
-  const char   *dest;                  /* Destination */
-  mime_type_t  **filetypes;            /* New filetypes array */
-  int          *compressions;          /* New compressions array */
+  cups_dir_t           *dir;           /* Directory */
+  cups_dentry_t                *dent;          /* Directory entry */
+  char                 filename[1024]; /* Full filename of job file */
+  int                  fd;             /* File descriptor */
+  cupsd_job_t          *job;           /* New job */
+  int                  jobid,          /* Current job ID */
+                       fileid;         /* Current file ID */
+  ipp_attribute_t      *attr;          /* Job attribute */
+  char                 method[HTTP_MAX_URI],
+                                       /* Method portion of URI */
+                       username[HTTP_MAX_URI],
+                                       /* Username portion of URI */
+                       host[HTTP_MAX_URI],
+                                       /* Host portion of URI */
+                       resource[HTTP_MAX_URI];
+                                       /* Resource portion of URI */
+  int                  port;           /* Port portion of URI */
+  cupsd_printer_t      *p;             /* Printer or class */
+  const char           *dest;          /* Destination */
+  mime_type_t          **filetypes;    /* New filetypes array */
+  int                  *compressions;  /* New compressions array */
 
 
  /*
@@ -746,12 +758,14 @@ cupsdLoadAllJobs(void)
   * Then open the requests directory...
   */
 
-  cupsdLogMessage(L_DEBUG, "cupsdLoadAllJobs: Scanning %s...", RequestRoot);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdLoadAllJobs: Scanning %s...",
+                  RequestRoot);
 
   if ((dir = cupsDirOpen(RequestRoot)) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "cupsdLoadAllJobs: Unable to open spool directory %s: %s",
-               RequestRoot, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdLoadAllJobs: Unable to open spool directory %s: %s",
+                    RequestRoot, strerror(errno));
     return;
   }
 
@@ -768,7 +782,8 @@ cupsdLoadAllJobs(void)
 
       if ((job = calloc(sizeof(cupsd_job_t), 1)) == NULL)
       {
-        cupsdLogMessage(L_ERROR, "cupsdLoadAllJobs: Ran out of memory for jobs!");
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdLoadAllJobs: Ran out of memory for jobs!");
        cupsDirClose(dir);
        return;
       }
@@ -776,7 +791,8 @@ cupsdLoadAllJobs(void)
       if ((job->attrs = ippNew()) == NULL)
       {
         free(job);
-        cupsdLogMessage(L_ERROR, "cupsdLoadAllJobs: Ran out of memory for job attributes!");
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdLoadAllJobs: Ran out of memory for job attributes!");
        cupsDirClose(dir);
        return;
       }
@@ -791,8 +807,9 @@ cupsdLoadAllJobs(void)
       job->print_pipes[0] = -1;
       job->print_pipes[1] = -1;
 
-      cupsdLogMessage(L_DEBUG, "cupsdLoadAllJobs: Loading attributes for job %d...\n",
-                 job->id);
+      cupsdLogMessage(CUPSD_LOG_DEBUG,
+                      "cupsdLoadAllJobs: Loading attributes for job %d...",
+                      job->id);
 
       if (job->id >= NextJobId)
         NextJobId = job->id + 1;
@@ -804,8 +821,9 @@ cupsdLoadAllJobs(void)
       snprintf(filename, sizeof(filename), "%s/%s", RequestRoot, dent->filename);
       if ((fd = open(filename, O_RDONLY)) < 0)
       {
-        cupsdLogMessage(L_ERROR, "cupsdLoadAllJobs: Unable to open job control file \"%s\" - %s!",
-                  filename, strerror(errno));
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdLoadAllJobs: Unable to open job control file \"%s\" - %s!",
+                       filename, strerror(errno));
        ippDelete(job->attrs);
        free(job);
        unlink(filename);
@@ -815,8 +833,9 @@ cupsdLoadAllJobs(void)
       {
         if (ippReadFile(fd, job->attrs) != IPP_DATA)
        {
-          cupsdLogMessage(L_ERROR, "cupsdLoadAllJobs: Unable to read job control file \"%s\"!",
-                    filename);
+          cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "cupsdLoadAllJobs: Unable to read job control file \"%s\"!",
+                         filename);
          close(fd);
          ippDelete(job->attrs);
          free(job);
@@ -829,8 +848,9 @@ cupsdLoadAllJobs(void)
 
       if ((job->state = ippFindAttribute(job->attrs, "job-state", IPP_TAG_ENUM)) == NULL)
       {
-        cupsdLogMessage(L_ERROR, "cupsdLoadAllJobs: Missing or bad job-state attribute in control file \"%s\"!",
-                  filename);
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdLoadAllJobs: Missing or bad job-state attribute in control file \"%s\"!",
+                       filename);
        ippDelete(job->attrs);
        free(job);
        unlink(filename);
@@ -839,8 +859,9 @@ cupsdLoadAllJobs(void)
 
       if ((attr = ippFindAttribute(job->attrs, "job-printer-uri", IPP_TAG_URI)) == NULL)
       {
-        cupsdLogMessage(L_ERROR, "cupsdLoadAllJobs: No job-printer-uri attribute in control file \"%s\"!",
-                  filename);
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdLoadAllJobs: No job-printer-uri attribute in control file \"%s\"!",
+                       filename);
        ippDelete(job->attrs);
        free(job);
        unlink(filename);
@@ -883,8 +904,9 @@ cupsdLoadAllJobs(void)
 
       if (dest == NULL)
       {
-        cupsdLogMessage(L_ERROR, "cupsdLoadAllJobs: Unable to queue job for destination \"%s\"!",
-                  attr->values[0].string.text);
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdLoadAllJobs: Unable to queue job for destination \"%s\"!",
+                       attr->values[0].string.text);
        ippDelete(job->attrs);
        free(job);
        unlink(filename);
@@ -895,12 +917,13 @@ cupsdLoadAllJobs(void)
 
       job->sheets     = ippFindAttribute(job->attrs, "job-media-sheets-completed",
                                          IPP_TAG_INTEGER);
-      job->cupsd_job_sheets = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_NAME);
+      job->job_sheets = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_NAME);
 
       if ((attr = ippFindAttribute(job->attrs, "job-priority", IPP_TAG_INTEGER)) == NULL)
       {
-        cupsdLogMessage(L_ERROR, "cupsdLoadAllJobs: Missing or bad job-priority attribute in control file \"%s\"!",
-                  filename);
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdLoadAllJobs: Missing or bad job-priority attribute in control file \"%s\"!",
+                       filename);
        ippDelete(job->attrs);
        free(job);
        unlink(filename);
@@ -910,8 +933,9 @@ cupsdLoadAllJobs(void)
 
       if ((attr = ippFindAttribute(job->attrs, "job-originating-user-name", IPP_TAG_NAME)) == NULL)
       {
-        cupsdLogMessage(L_ERROR, "cupsdLoadAllJobs: Missing or bad job-originating-user-name attribute in control file \"%s\"!",
-                  filename);
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdLoadAllJobs: Missing or bad job-originating-user-name attribute in control file \"%s\"!",
+                       filename);
        ippDelete(job->attrs);
        free(job);
        unlink(filename);
@@ -962,15 +986,17 @@ cupsdLoadAllJobs(void)
       jobid  = atoi(dent->filename + 1);
       fileid = atoi(strchr(dent->filename, '-') + 1);
 
-      cupsdLogMessage(L_DEBUG, "cupsdLoadAllJobs: Auto-typing document file %s...",
-                 dent->filename);
+      cupsdLogMessage(CUPSD_LOG_DEBUG,
+                      "cupsdLoadAllJobs: Auto-typing document file %s...",
+                      dent->filename);
 
       snprintf(filename, sizeof(filename), "%s/%s", RequestRoot, dent->filename);
 
       if ((job = cupsdFindJob(jobid)) == NULL)
       {
-        cupsdLogMessage(L_ERROR, "cupsdLoadAllJobs: Orphaned print file \"%s\"!",
-                  filename);
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "cupsdLoadAllJobs: Orphaned print file \"%s\"!",
+                       filename);
         unlink(filename);
        continue;
       }
@@ -992,7 +1018,7 @@ cupsdLoadAllJobs(void)
 
         if (compressions == NULL || filetypes == NULL)
        {
-          cupsdLogMessage(L_ERROR, "cupsdLoadAllJobs: Ran out of memory for job file types!");
+          cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdLoadAllJobs: Ran out of memory for job file types!");
          continue;
        }
 
@@ -1024,12 +1050,12 @@ cupsdLoadAllJobs(void)
  */
 
 void
-cupsdMoveJob(int        id,                    /* I - Job ID */
-        const char *dest)              /* I - Destination */
+cupsdMoveJob(int        id,            /* I - Job ID */
+             const char *dest)         /* I - Destination */
 {
-  cupsd_job_t                  *job;           /* Current job */
+  cupsd_job_t          *job;           /* Current job */
   ipp_attribute_t      *attr;          /* job-printer-uri attribute */
-  cupsd_printer_t              *p;             /* Destination printer or class */
+  cupsd_printer_t      *p;             /* Destination printer or class */
 
 
  /*
@@ -1071,10 +1097,10 @@ cupsdMoveJob(int        id,                     /* I - Job ID */
 void
 cupsdReleaseJob(int id)                        /* I - Job ID */
 {
-  cupsd_job_t  *job;                           /* Job data */
+  cupsd_job_t  *job;                   /* Job data */
 
 
-  cupsdLogMessage(L_DEBUG, "cupsdReleaseJob: id = %d", id);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdReleaseJob: id = %d", id);
 
   if ((job = cupsdFindJob(id)) == NULL)
     return;
@@ -1097,7 +1123,7 @@ cupsdReleaseJob(int id)                   /* I - Job ID */
 void
 cupsdRestartJob(int id)                        /* I - Job ID */
 {
-  cupsd_job_t  *job;                           /* Job data */
+  cupsd_job_t  *job;                   /* Job data */
 
 
   if ((job = cupsdFindJob(id)) == NULL)
@@ -1118,11 +1144,11 @@ cupsdRestartJob(int id)                 /* I - Job ID */
  */
 
 void
-cupsdSaveJob(int id)                           /* I - Job ID */
+cupsdSaveJob(int id)                   /* I - Job ID */
 {
-  cupsd_job_t  *job;                           /* Pointer to job */
-  char filename[1024];                 /* Job control filename */
-  int  fd;                             /* File descriptor */
+  cupsd_job_t  *job;                   /* Pointer to job */
+  char         filename[1024];         /* Job control filename */
+  int          fd;                     /* File descriptor */
 
 
   if ((job = cupsdFindJob(id)) == NULL)
@@ -1132,8 +1158,9 @@ cupsdSaveJob(int id)                              /* I - Job ID */
 
   if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0)
   {
-    cupsdLogMessage(L_ERROR, "cupsdSaveJob: Unable to create job control file \"%s\" - %s.",
-               filename, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdSaveJob: Unable to create job control file \"%s\" - %s.",
+                    filename, strerror(errno));
     return;
   }
 
@@ -1142,7 +1169,7 @@ cupsdSaveJob(int id)                              /* I - Job ID */
 
   ippWriteFile(fd, job->attrs);
 
-  cupsdLogMessage(L_DEBUG2, "cupsdSaveJob: Closing file %d...", fd);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdSaveJob: Closing file %d...", fd);
 
   close(fd);
 }
@@ -1153,10 +1180,10 @@ cupsdSaveJob(int id)                            /* I - Job ID */
  */
 
 void
-cupsdSetJobHoldUntil(int        id,            /* I - Job ID */
-                const char *when)      /* I - When to resume */
+cupsdSetJobHoldUntil(int        id,    /* I - Job ID */
+                     const char *when) /* I - When to resume */
 {
-  cupsd_job_t          *job;                   /* Pointer to job */
+  cupsd_job_t          *job;           /* Pointer to job */
   time_t       curtime;                /* Current time */
   struct tm    *curdate;               /* Current date */
   int          hour;                   /* Hold hour */
@@ -1164,7 +1191,7 @@ cupsdSetJobHoldUntil(int        id,               /* I - Job ID */
   int          second;                 /* Hold second */
 
 
-  cupsdLogMessage(L_DEBUG, "cupsdSetJobHoldUntil(%d, \"%s\")", id, when);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdSetJobHoldUntil(%d, \"%s\")", id, when);
 
   if ((job = cupsdFindJob(id)) == NULL)
     return;
@@ -1281,7 +1308,8 @@ cupsdSetJobHoldUntil(int        id,               /* I - Job ID */
       job->hold_until += 24 * 60 * 60 * 60;
   }
 
-  cupsdLogMessage(L_DEBUG, "cupsdSetJobHoldUntil: hold_until = %d", (int)job->hold_until);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdSetJobHoldUntil: hold_until = %d",
+                  (int)job->hold_until);
 }
 
 
@@ -1291,11 +1319,11 @@ cupsdSetJobHoldUntil(int        id,             /* I - Job ID */
  */
 
 void
-cupsdSetJobPriority(int id,                    /* I - Job ID */
-               int priority)           /* I - New priority (0 to 100) */
+cupsdSetJobPriority(int id,            /* I - Job ID */
+                    int priority)      /* I - New priority (0 to 100) */
 {
-  cupsd_job_t          *job;                   /* Job to change */
-  ipp_attribute_t *attr;               /* Job attribute */
+  cupsd_job_t          *job;           /* Job to change */
+  ipp_attribute_t      *attr;          /* Job attribute */
 
 
  /*
@@ -1337,55 +1365,62 @@ cupsdSetJobPriority(int id,                     /* I - Job ID */
  */
 
 void
-cupsdStartJob(int       id,                    /* I - Job ID */
-         cupsd_printer_t *printer)             /* I - Printer to print job */
+cupsdStartJob(int             id,      /* I - Job ID */
+              cupsd_printer_t *printer)        /* I - Printer to print job */
 {
   cupsd_job_t          *job;           /* Current job */
-  int          i;                      /* Looping var */
-  int          slot;                   /* Pipe slot */
-  int          num_filters;            /* Number of filters for job */
-  mime_filter_t        *filters;               /* Filters for job */
-  char         method[255],            /* Method for output */
-               *optptr,                /* Pointer to options */
-               *valptr;                /* Pointer in value string */
-  ipp_attribute_t *attr;               /* Current attribute */
-  int          pid;                    /* Process ID of new filter process */
-  int          banner_page;            /* 1 if banner page, 0 otherwise */
-  int          statusfds[2],           /* Pipes used between the filters and scheduler */
-               filterfds[2][2];        /* Pipes used between the filters */
-  int          envc;                   /* Number of environment variables */
-  char         *argv[8],               /* Filter command-line arguments */
-               sani_uri[1024],         /* Sanitized DEVICE_URI env var */
-               filename[1024],         /* Job filename */
-               command[1024],          /* Full path to filter/backend command */
-               jobid[255],             /* Job ID string */
-               title[IPP_MAX_NAME],    /* Job title string */
-               copies[255],            /* # copies string */
-               *envp[100],             /* Environment variables */
-               charset[255],           /* CHARSET environment variable */
-               class_name[255],        /* CLASS environment variable */
-               classification[1024],   /* CLASSIFICATION environment variable */
-               content_type[1024],     /* CONTENT_TYPE environment variable */
-               device_uri[1024],       /* DEVICE_URI environment variable */
-               lang[255],              /* LANG environment variable */
-               ppd[1024],              /* PPD environment variable */
-               printer_name[255],      /* PRINTER environment variable */
-               rip_max_cache[255];     /* RIP_MAX_CACHE environment variable */
-  static char  *options = NULL;        /* Full list of options */
-  static int   optlength = 0;          /* Length of option buffer */
-
-
-  cupsdLogMessage(L_DEBUG, "cupsdStartJob(%d, %p)", id, printer);
+  int                  i;              /* Looping var */
+  int                  slot;           /* Pipe slot */
+  int                  num_filters;    /* Number of filters for job */
+  mime_filter_t                *filters;       /* Filters for job */
+  char                 method[255],    /* Method for output */
+                       *optptr,        /* Pointer to options */
+                       *valptr;        /* Pointer in value string */
+  ipp_attribute_t      *attr;          /* Current attribute */
+  int                  pid;            /* Process ID of new filter process */
+  int                  banner_page;    /* 1 if banner page, 0 otherwise */
+  int                  statusfds[2],   /* Pipes used between the filters and scheduler */
+                       filterfds[2][2];/* Pipes used between the filters */
+  int                  envc;           /* Number of environment variables */
+  char                 *argv[8],       /* Filter command-line arguments */
+                       sani_uri[1024], /* Sanitized DEVICE_URI env var */
+                       filename[1024], /* Job filename */
+                       command[1024],  /* Full path to filter/backend command */
+                       jobid[255],     /* Job ID string */
+                       title[IPP_MAX_NAME],
+                                       /* Job title string */
+                       copies[255],    /* # copies string */
+                       *envp[100],     /* Environment variables */
+                       charset[255],   /* CHARSET environment variable */
+                       class_name[255],/* CLASS environment variable */
+                       classification[1024],
+                                       /* CLASSIFICATION environment variable */
+                       content_type[1024],
+                                       /* CONTENT_TYPE environment variable */
+                       device_uri[1024],
+                                       /* DEVICE_URI environment variable */
+                       lang[255],      /* LANG environment variable */
+                       ppd[1024],      /* PPD environment variable */
+                       printer_name[255],
+                                       /* PRINTER environment variable */
+                       rip_max_cache[255];
+                                       /* RIP_MAX_CACHE environment variable */
+  static char          *options = NULL;/* Full list of options */
+  static int           optlength = 0;  /* Length of option buffer */
+
+
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdStartJob(%d, %p)", id, printer);
 
   if ((job = cupsdFindJob(id)) == NULL)
     return;
 
-  cupsdLogMessage(L_DEBUG, "cupsdStartJob() id = %d, file = %d/%d", id,
-             job->current_file, job->num_files);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdStartJob() id = %d, file = %d/%d", id,
+                  job->current_file, job->num_files);
 
   if (job->num_files == 0)
   {
-    cupsdLogMessage(L_ERROR, "Job ID %d has no files!  Cancelling it!", id);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Job ID %d has no files!  Cancelling it!",
+                    id);
 
     cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
                   "Job cancelled because it has no files.");
@@ -1409,7 +1444,8 @@ cupsdStartJob(int       id,                       /* I - Job ID */
     * filtering...
     */
 
-    cupsdLogMessage(L_DEBUG, "cupsdStartJob: Sending job to queue tagged as raw...");
+    cupsdLogMessage(CUPSD_LOG_DEBUG,
+                    "cupsdStartJob: Sending job to queue tagged as raw...");
 
     filters = NULL;
   }
@@ -1424,12 +1460,15 @@ cupsdStartJob(int       id,                     /* I - Job ID */
 
     if (num_filters == 0)
     {
-      cupsdLogMessage(L_ERROR, "Unable to convert file %d to printable format for job %d!",
-                job->current_file, job->id);
-      cupsdLogMessage(L_INFO, "Hint: Do you have ESP Ghostscript installed?");
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Unable to convert file %d to printable format for job %d!",
+                     job->current_file, job->id);
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "Hint: Do you have ESP Ghostscript installed?");
 
-      if (LogLevel < L_DEBUG)
-        cupsdLogMessage(L_INFO, "Hint: Try setting the LogLevel to \"debug\".");
+      if (LogLevel < CUPSD_LOG_DEBUG)
+        cupsdLogMessage(CUPSD_LOG_INFO,
+                       "Hint: Try setting the LogLevel to \"debug\".");
 
       job->current_file ++;
 
@@ -1489,12 +1528,12 @@ cupsdStartJob(int       id,                     /* I - Job ID */
     if (filters != NULL)
       free(filters);
 
-    cupsdLogMessage(L_INFO, "Holding job %d because filter limit has been reached.",
-               id);
-    cupsdLogMessage(L_DEBUG, "cupsdStartJob: id = %d, file = %d, "
-                        "cost = %d, level = %d, limit = %d",
-               id, job->current_file, job->cost, FilterLevel,
-              FilterLimit);
+    cupsdLogMessage(CUPSD_LOG_INFO,
+                    "Holding job %d because filter limit has been reached.",
+                    id);
+    cupsdLogMessage(CUPSD_LOG_DEBUG,
+                    "cupsdStartJob: id=%d, file=%d, cost=%d, level=%d, limit=%d",
+                    id, job->current_file, job->cost, FilterLevel, FilterLimit);
     return;
   }
 
@@ -1520,8 +1559,8 @@ cupsdStartJob(int       id,                       /* I - Job ID */
 
     if (temp_filters == NULL)
     {
-      cupsdLogMessage(L_ERROR, "Unable to add decompression filter - %s",
-                 strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to add decompression filter - %s",
+                      strerror(errno));
 
       if (filters != NULL)
         free(filters);
@@ -1565,8 +1604,8 @@ cupsdStartJob(int       id,                       /* I - Job ID */
 
     if (temp_filters == NULL)
     {
-      cupsdLogMessage(L_ERROR, "Unable to add port monitor - %s",
-                 strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to add port monitor - %s",
+                      strerror(errno));
 
       if (filters != NULL)
         free(filters);
@@ -1611,36 +1650,37 @@ cupsdStartJob(int       id,                     /* I - Job ID */
   * Determine if we are printing a banner page or not...
   */
 
-  if (job->cupsd_job_sheets == NULL)
+  if (job->job_sheets == NULL)
   {
-    cupsdLogMessage(L_DEBUG, "No job-sheets attribute.");
-    if ((job->cupsd_job_sheets =
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "No job-sheets attribute.");
+    if ((job->job_sheets =
          ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_ZERO)) != NULL)
-      cupsdLogMessage(L_DEBUG, "... but someone added one without setting cupsd_job_sheets!");
+      cupsdLogMessage(CUPSD_LOG_DEBUG,
+                      "... but someone added one without setting job_sheets!");
   }
-  else if (job->cupsd_job_sheets->num_values == 1)
-    cupsdLogMessage(L_DEBUG, "job-sheets=%s",
-               job->cupsd_job_sheets->values[0].string.text);
+  else if (job->job_sheets->num_values == 1)
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "job-sheets=%s",
+               job->job_sheets->values[0].string.text);
   else
-    cupsdLogMessage(L_DEBUG, "job-sheets=%s,%s",
-               job->cupsd_job_sheets->values[0].string.text,
-               job->cupsd_job_sheets->values[1].string.text);
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "job-sheets=%s,%s",
+               job->job_sheets->values[0].string.text,
+               job->job_sheets->values[1].string.text);
 
   if (printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT))
     banner_page = 0;
-  else if (job->cupsd_job_sheets == NULL)
+  else if (job->job_sheets == NULL)
     banner_page = 0;
-  else if (strcasecmp(job->cupsd_job_sheets->values[0].string.text, "none") != 0 &&
+  else if (strcasecmp(job->job_sheets->values[0].string.text, "none") != 0 &&
           job->current_file == 0)
     banner_page = 1;
-  else if (job->cupsd_job_sheets->num_values > 1 &&
-          strcasecmp(job->cupsd_job_sheets->values[1].string.text, "none") != 0 &&
+  else if (job->job_sheets->num_values > 1 &&
+          strcasecmp(job->job_sheets->values[1].string.text, "none") != 0 &&
           job->current_file == (job->num_files - 1))
     banner_page = 1;
   else
     banner_page = 0;
 
-  cupsdLogMessage(L_DEBUG, "banner_page = %d", banner_page);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "banner_page = %d", banner_page);
 
  /*
   * Building the options string is harder than it needs to be, but
@@ -1661,8 +1701,9 @@ cupsdStartJob(int       id,                       /* I - Job ID */
 
     if (optptr == NULL)
     {
-      cupsdLogMessage(L_CRIT, "cupsdStartJob: Unable to allocate %d bytes for option buffer for job %d!",
-                 i, id);
+      cupsdLogMessage(CUPSD_LOG_CRIT,
+                      "cupsdStartJob: Unable to allocate %d bytes for option buffer for job %d!",
+                      i, id);
 
       if (filters != NULL)
         free(filters);
@@ -1851,8 +1892,9 @@ cupsdStartJob(int       id,                       /* I - Job ID */
   argv[6] = filename;
   argv[7] = NULL;
 
-  cupsdLogMessage(L_DEBUG, "cupsdStartJob: argv = \"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"",
-             argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
+  cupsdLogMessage(CUPSD_LOG_DEBUG,
+                  "cupsdStartJob: argv = \"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"",
+                  argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
 
  /*
   * Create environment variable strings for the filters...
@@ -1953,9 +1995,11 @@ cupsdStartJob(int       id,                      /* I - Job ID */
 
   for (i = 0; i < envc; i ++)
     if (strncmp(envp[i], "DEVICE_URI=", 11))
-      cupsdLogMessage(L_DEBUG, "cupsdStartJob: envp[%d]=\"%s\"", i, envp[i]);
+      cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdStartJob: envp[%d]=\"%s\"",
+                      i, envp[i]);
     else
-      cupsdLogMessage(L_DEBUG, "cupsdStartJob: envp[%d]=\"DEVICE_URI=%s\"", i, sani_uri);
+      cupsdLogMessage(CUPSD_LOG_DEBUG,
+                      "cupsdStartJob: envp[%d]=\"DEVICE_URI=%s\"", i, sani_uri);
 
   job->current_file ++;
 
@@ -1965,8 +2009,8 @@ cupsdStartJob(int       id,                       /* I - Job ID */
 
   if (cupsdOpenPipe(statusfds))
   {
-    cupsdLogMessage(L_ERROR, "Unable to create job status pipes - %s.",
-              strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to create job status pipes - %s.",
+                   strerror(errno));
     snprintf(printer->state_message, sizeof(printer->state_message),
              "Unable to create status pipes - %s.", strerror(errno));
 
@@ -1982,8 +2026,8 @@ cupsdStartJob(int       id,                       /* I - Job ID */
     return;
   }
 
-  cupsdLogMessage(L_DEBUG, "cupsdStartJob: statusfds = [ %d %d ]",
-             statusfds[0], statusfds[1]);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdStartJob: statusfds = [ %d %d ]",
+                  statusfds[0], statusfds[1]);
 
 #ifdef FD_CLOEXEC
   fcntl(statusfds[0], F_SETFD, FD_CLOEXEC);
@@ -2000,7 +2044,8 @@ cupsdStartJob(int       id,                       /* I - Job ID */
 
   if (filterfds[1][0] < 0)
   {
-    cupsdLogMessage(L_ERROR, "Unable to open \"/dev/null\" - %s.", strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open \"/dev/null\" - %s.",
+                    strerror(errno));
     snprintf(printer->state_message, sizeof(printer->state_message),
              "Unable to open \"/dev/null\" - %s.", strerror(errno));
 
@@ -2016,8 +2061,8 @@ cupsdStartJob(int       id,                       /* I - Job ID */
 
   fcntl(filterfds[1][0], F_SETFD, fcntl(filterfds[1][0], F_GETFD) | FD_CLOEXEC);
 
-  cupsdLogMessage(L_DEBUG, "cupsdStartJob: filterfds[%d] = [ %d %d ]", 1, filterfds[1][0],
-             filterfds[1][1]);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdStartJob: filterfds[%d] = [ %d %d ]",
+                  1, filterfds[1][0], filterfds[1][1]);
 
   for (i = 0, slot = 0; i < num_filters; i ++)
   {
@@ -2031,8 +2076,9 @@ cupsdStartJob(int       id,                       /* I - Job ID */
     {
       if (cupsdOpenPipe(filterfds[slot]))
       {
-       cupsdLogMessage(L_ERROR, "Unable to create job filter pipes - %s.",
-               strerror(errno));
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Unable to create job filter pipes - %s.",
+                       strerror(errno));
        snprintf(printer->state_message, sizeof(printer->state_message),
                "Unable to create filter pipes - %s.", strerror(errno));
        cupsdAddPrinterHistory(printer);
@@ -2058,8 +2104,9 @@ cupsdStartJob(int       id,                       /* I - Job ID */
        {
          if (cupsdOpenPipe(job->print_pipes))
          {
-           cupsdLogMessage(L_ERROR, "Unable to create job backend pipes - %s.",
-                      strerror(errno));
+           cupsdLogMessage(CUPSD_LOG_ERROR,
+                           "Unable to create job backend pipes - %s.",
+                           strerror(errno));
            snprintf(printer->state_message, sizeof(printer->state_message),
                    "Unable to create backend pipes - %s.", strerror(errno));
            cupsdAddPrinterHistory(printer);
@@ -2083,19 +2130,20 @@ cupsdStartJob(int       id,                     /* I - Job ID */
          if (!strncmp(printer->device_uri, "file:/dev/", 10) &&
              strcmp(printer->device_uri, "file:/dev/null"))
            job->print_pipes[1] = open(printer->device_uri + 5,
-                                          O_WRONLY | O_EXCL);
+                                      O_WRONLY | O_EXCL);
          else if (!strncmp(printer->device_uri, "file:///dev/", 12) &&
                   strcmp(printer->device_uri, "file:///dev/null"))
            job->print_pipes[1] = open(printer->device_uri + 7,
-                                          O_WRONLY | O_EXCL);
+                                      O_WRONLY | O_EXCL);
          else
            job->print_pipes[1] = open(printer->device_uri + 5,
-                                          O_WRONLY | O_CREAT | O_TRUNC, 0600);
+                                      O_WRONLY | O_CREAT | O_TRUNC, 0600);
 
          if (job->print_pipes[1] < 0)
          {
-            cupsdLogMessage(L_ERROR, "Unable to open output file \"%s\" - %s.",
-                      printer->device_uri, strerror(errno));
+            cupsdLogMessage(CUPSD_LOG_ERROR,
+                           "Unable to open output file \"%s\" - %s.",
+                           printer->device_uri, strerror(errno));
             snprintf(printer->state_message, sizeof(printer->state_message),
                     "Unable to open output file \"%s\" - %s.",
                     printer->device_uri, strerror(errno));
@@ -2119,7 +2167,7 @@ cupsdStartJob(int       id,                       /* I - Job ID */
                fcntl(job->print_pipes[1], F_GETFD) | FD_CLOEXEC);
        }
 
-       cupsdLogMessage(L_DEBUG2, "cupsdStartJob: print_pipes = [ %d %d ]",
+       cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdStartJob: print_pipes = [ %d %d ]",
                    job->print_pipes[0], job->print_pipes[1]);
       }
 
@@ -2127,23 +2175,24 @@ cupsdStartJob(int       id,                     /* I - Job ID */
       filterfds[slot][1] = job->print_pipes[1];
     }
 
-    cupsdLogMessage(L_DEBUG, "cupsdStartJob: filter = \"%s\"", command);
-    cupsdLogMessage(L_DEBUG, "cupsdStartJob: filterfds[%d] = [ %d %d ]",
-               slot, filterfds[slot][0], filterfds[slot][1]);
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdStartJob: filter = \"%s\"", command);
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdStartJob: filterfds[%d] = [ %d %d ]",
+                    slot, filterfds[slot][0], filterfds[slot][1]);
 
     pid = cupsdStartProcess(command, argv, envp, filterfds[!slot][0],
                             filterfds[slot][1], statusfds[1],
                            job->back_pipes[0], 0, job->filters + i);
 
-    cupsdLogMessage(L_DEBUG2, "cupsdStartJob: Closing filter pipes for slot %d [ %d %d ]...",
-               !slot, filterfds[!slot][0], filterfds[!slot][1]);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdStartJob: Closing filter pipes for slot %d [ %d %d ]...",
+                    !slot, filterfds[!slot][0], filterfds[!slot][1]);
 
     cupsdClosePipe(filterfds[!slot]);
 
     if (pid == 0)
     {
-      cupsdLogMessage(L_ERROR, "Unable to start filter \"%s\" - %s.",
-                 filters[i].filter, strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to start filter \"%s\" - %s.",
+                      filters[i].filter, strerror(errno));
       snprintf(printer->state_message, sizeof(printer->state_message),
                "Unable to start filter \"%s\" - %s.",
                filters[i].filter, strerror(errno));
@@ -2162,8 +2211,8 @@ cupsdStartJob(int       id,                       /* I - Job ID */
       return;
     }
 
-    cupsdLogMessage(L_INFO, "Started filter %s (PID %d) for job %d.",
-               command, pid, job->id);
+    cupsdLogMessage(CUPSD_LOG_INFO, "Started filter %s (PID %d) for job %d.",
+                    command, pid, job->id);
 
     argv[6] = NULL;
     slot    = !slot;
@@ -2190,7 +2239,8 @@ cupsdStartJob(int       id,                       /* I - Job ID */
 
       if (filterfds[slot][1] < 0)
       {
-       cupsdLogMessage(L_ERROR, "Unable to open \"/dev/null\" - %s.", strerror(errno));
+       cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to open \"/dev/null\" - %s.",
+                       strerror(errno));
        snprintf(printer->state_message, sizeof(printer->state_message),
                 "Unable to open \"/dev/null\" - %s.", strerror(errno));
 
@@ -2211,9 +2261,11 @@ cupsdStartJob(int       id,                      /* I - Job ID */
       fcntl(filterfds[slot][1], F_SETFD,
             fcntl(filterfds[slot][1], F_GETFD) | FD_CLOEXEC);
 
-      cupsdLogMessage(L_DEBUG, "cupsdStartJob: backend = \"%s\"", command);
-      cupsdLogMessage(L_DEBUG, "cupsdStartJob: filterfds[%d] = [ %d %d ]",
-                slot, filterfds[slot][0], filterfds[slot][1]);
+      cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdStartJob: backend = \"%s\"",
+                      command);
+      cupsdLogMessage(CUPSD_LOG_DEBUG,
+                      "cupsdStartJob: filterfds[%d] = [ %d %d ]",
+                     slot, filterfds[slot][0], filterfds[slot][1]);
 
       pid = cupsdStartProcess(command, argv, envp, filterfds[!slot][0],
                              filterfds[slot][1], statusfds[1],
@@ -2222,18 +2274,20 @@ cupsdStartJob(int       id,                     /* I - Job ID */
 
       if (pid == 0)
       {
-       cupsdLogMessage(L_ERROR, "Unable to start backend \"%s\" - %s.",
-                   method, strerror(errno));
+       cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to start backend \"%s\" - %s.",
+                        method, strerror(errno));
        snprintf(printer->state_message, sizeof(printer->state_message),
                 "Unable to start backend \"%s\" - %s.", method, strerror(errno));
 
-       cupsdLogMessage(L_DEBUG2, "cupsdStartJob: Closing print pipes [ %d %d ]...",
-                  job->print_pipes[0], job->print_pipes[1]);
+       cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                       "cupsdStartJob: Closing print pipes [ %d %d ]...",
+                       job->print_pipes[0], job->print_pipes[1]);
 
         cupsdClosePipe(job->print_pipes);
 
-       cupsdLogMessage(L_DEBUG2, "cupsdStartJob: Closing back pipes [ %d %d ]...",
-                  job->back_pipes[0], job->back_pipes[1]);
+       cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                       "cupsdStartJob: Closing back pipes [ %d %d ]...",
+                       job->back_pipes[0], job->back_pipes[1]);
 
         cupsdClosePipe(job->back_pipes);
 
@@ -2245,20 +2299,23 @@ cupsdStartJob(int       id,                     /* I - Job ID */
       }
       else
       {
-       cupsdLogMessage(L_INFO, "Started backend %s (PID %d) for job %d.",
-                  command, pid, job->id);
+       cupsdLogMessage(CUPSD_LOG_INFO,
+                       "Started backend %s (PID %d) for job %d.",
+                       command, pid, job->id);
       }
     }
 
     if (job->current_file == job->num_files)
     {
-      cupsdLogMessage(L_DEBUG2, "cupsdStartJob: Closing print pipes [ %d %d ]...",
-                job->print_pipes[0], job->print_pipes[1]);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdStartJob: Closing print pipes [ %d %d ]...",
+                     job->print_pipes[0], job->print_pipes[1]);
 
       cupsdClosePipe(job->print_pipes);
 
-      cupsdLogMessage(L_DEBUG2, "cupsdStartJob: Closing back pipes [ %d %d ]...",
-                job->back_pipes[0], job->back_pipes[1]);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdStartJob: Closing back pipes [ %d %d ]...",
+                     job->back_pipes[0], job->back_pipes[1]);
 
       cupsdClosePipe(job->back_pipes);
     }
@@ -2270,25 +2327,29 @@ cupsdStartJob(int       id,                     /* I - Job ID */
 
     if (job->current_file == job->num_files)
     {
-      cupsdLogMessage(L_DEBUG2, "cupsdStartJob: Closing print pipes [ %d %d ]...",
-                job->print_pipes[0], job->print_pipes[1]);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdStartJob: Closing print pipes [ %d %d ]...",
+                     job->print_pipes[0], job->print_pipes[1]);
 
       cupsdClosePipe(job->print_pipes);
     }
   }
 
-  cupsdLogMessage(L_DEBUG2, "cupsdStartJob: Closing filter pipes for slot %d [ %d %d ]...",
-             slot, filterfds[slot][0], filterfds[slot][1]);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdStartJob: Closing filter pipes for slot %d [ %d %d ]...",
+                  slot, filterfds[slot][0], filterfds[slot][1]);
 
   cupsdClosePipe(filterfds[slot]);
 
-  cupsdLogMessage(L_DEBUG2, "cupsdStartJob: Closing status output pipe %d...",
-             statusfds[1]);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdStartJob: Closing status output pipe %d...",
+                  statusfds[1]);
 
   close(statusfds[1]);
 
-  cupsdLogMessage(L_DEBUG2, "cupsdStartJob: Adding fd %d to InputSet...",
-             job->status_buffer->fd);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdStartJob: Adding fd %d to InputSet...",
+                  job->status_buffer->fd);
 
   FD_SET(job->status_buffer->fd, InputSet);
 }
@@ -2322,14 +2383,15 @@ cupsdStopAllJobs(void)
  */
 
 void
-cupsdStopJob(int id,                           /* I - Job ID */
-        int force)                     /* I - 1 = Force all filters to stop */
+cupsdStopJob(int id,                   /* I - Job ID */
+             int force)                        /* I - 1 = Force all filters to stop */
 {
-  int  i;                              /* Looping var */
+  int          i;                      /* Looping var */
   cupsd_job_t  *job;                   /* Current job */
 
 
-  cupsdLogMessage(L_DEBUG, "cupsdStopJob: id = %d, force = %d", id, force);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdStopJob: id = %d, force = %d",
+                  id, force);
 
   if ((job = cupsdFindJob(id)) == NULL)
     return;
@@ -2347,7 +2409,8 @@ cupsdStopJob(int id,                              /* I - Job ID */
   else if (job->printer->state != IPP_PRINTER_STOPPED)
     cupsdSetPrinterState(job->printer, IPP_PRINTER_IDLE, 0);
 
-  cupsdLogMessage(L_DEBUG, "cupsdStopJob: printer state is %d", job->printer->state);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdStopJob: printer state is %d",
+                  job->printer->state);
 
   job->state->values[0].integer = IPP_JOB_STOPPED;
   job->printer->job = NULL;
@@ -2368,13 +2431,15 @@ cupsdStopJob(int id,                            /* I - Job ID */
     job->backend = 0;
   }
 
-  cupsdLogMessage(L_DEBUG2, "cupsdStopJob: Closing print pipes [ %d %d ]...",
-             job->print_pipes[0], job->print_pipes[1]);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdStopJob: Closing print pipes [ %d %d ]...",
+                  job->print_pipes[0], job->print_pipes[1]);
 
   cupsdClosePipe(job->print_pipes);
 
-  cupsdLogMessage(L_DEBUG2, "cupsdStopJob: Closing back pipes [ %d %d ]...",
-             job->back_pipes[0], job->back_pipes[1]);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdStopJob: Closing back pipes [ %d %d ]...",
+                  job->back_pipes[0], job->back_pipes[1]);
 
   cupsdClosePipe(job->back_pipes);
 
@@ -2384,13 +2449,15 @@ cupsdStopJob(int id,                            /* I - Job ID */
     * Close the pipe and clear the input bit.
     */
 
-    cupsdLogMessage(L_DEBUG2, "cupsdStopJob: Removing fd %d from InputSet...",
-              job->status_buffer->fd);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdStopJob: Removing fd %d from InputSet...",
+                   job->status_buffer->fd);
 
     FD_CLR(job->status_buffer->fd, InputSet);
 
-    cupsdLogMessage(L_DEBUG2, "cupsdStopJob: Closing status input pipe %d...",
-               job->status_buffer->fd);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdStopJob: Closing status input pipe %d...",
+                    job->status_buffer->fd);
 
     cupsdStatBufDelete(job->status_buffer);
 
@@ -2404,7 +2471,7 @@ cupsdStopJob(int id,                              /* I - Job ID */
  */
 
 void
-cupsdUpdateJob(cupsd_job_t *job)                       /* I - Job to check */
+cupsdUpdateJob(cupsd_job_t *job)       /* I - Job to check */
 {
   int          i;                      /* Looping var */
   int          copies;                 /* Number of copies printed */
@@ -2420,7 +2487,7 @@ cupsdUpdateJob(cupsd_job_t *job)                  /* I - Job to check */
     * Process page and printer state messages as needed...
     */
 
-    if (loglevel == L_PAGE)
+    if (loglevel == CUPSD_LOG_PAGE)
     {
      /*
       * Page message; send the message to the page_log file and update the
@@ -2452,9 +2519,9 @@ cupsdUpdateJob(cupsd_job_t *job)                  /* I - Job to check */
       cupsdAddEvent(CUPSD_EVENT_JOB_PROGRESS, job->printer, job,
                     "Printed %d page(s).", job->sheets->values[0].integer);
     }
-    else if (loglevel == L_STATE)
+    else if (loglevel == CUPSD_LOG_STATE)
       cupsdSetPrinterReasons(job->printer, message);
-    else if (loglevel == L_ATTR)
+    else if (loglevel == CUPSD_LOG_ATTR)
     {
      /*
       * Set attribute(s)...
@@ -2650,10 +2717,10 @@ ipp_length(ipp_t *ipp)                  /* I - IPP request */
  */
 
 static void
-set_time(cupsd_job_t      *job,        /* I - Job to update */
-         const char *name)     /* I - Name of attribute */
+set_time(cupsd_job_t *job,             /* I - Job to update */
+         const char  *name)            /* I - Name of attribute */
 {
-  ipp_attribute_t      *attr;  /* Time attribute */
+  ipp_attribute_t      *attr;          /* Time attribute */
 
 
   if ((attr = ippFindAttribute(job->attrs, name, IPP_TAG_ZERO)) != NULL)
@@ -2669,8 +2736,8 @@ set_time(cupsd_job_t      *job,   /* I - Job to update */
  */
 
 static void 
-set_hold_until(cupsd_job_t *job,               /* I - Job to update */
-              time_t holdtime)         /* I - Hold until time */
+set_hold_until(cupsd_job_t *job,       /* I - Job to update */
+              time_t      holdtime)    /* I - Hold until time */
 {
   ipp_attribute_t      *attr;          /* job-hold-until attribute */
   struct tm            *holddate;      /* Hold date */
@@ -2681,7 +2748,7 @@ set_hold_until(cupsd_job_t *job,          /* I - Job to update */
   * Set the hold_until value and hold the job...
   */
 
-  cupsdLogMessage(L_DEBUG, "set_hold_until: hold_until = %d", (int)holdtime);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "set_hold_until: hold_until = %d", (int)holdtime);
 
   job->state->values[0].integer = IPP_JOB_HELD;
   job->hold_until               = holdtime;
index 0cf92cfd4131432176d5ac8303d17c9afae5ab0f..8437dee811720088a915ea9231b94c9bd3209edb 100644 (file)
  *         WWW: http://www.cups.org
  */
 
-/*
- * Constants...
- */
-
-#define JOB_BUFFER_SIZE        1024    /* Bytes for job status buffer */
-
-
 /*
  * Job request structure...
  */
 
 typedef struct cupsd_job_s
 {
-  int          id,                     /* Job ID */
-               priority;               /* Job priority */
-  ipp_attribute_t *state;              /* Job state */
-  ipp_attribute_t *sheets;             /* job-media-sheets-completed */
-  time_t       hold_until;             /* Hold expiration date/time */
-  char         *username;              /* Printing user */
-  char         *dest;                  /* Destination printer or class */
-  cups_ptype_t dtype;                  /* Destination type (class/remote bits) */
-  ipp_attribute_t *cupsd_job_sheets;           /* Job sheets (NULL if none) */
-  int          num_files;              /* Number of files in job */
-  int          current_file;           /* Current file in job */
-  mime_type_t  **filetypes;            /* File types */
-  int          *compressions;          /* Compression status of each file */
-  ipp_t                *attrs;                 /* Job attributes */
-  cupsd_statbuf_t *status_buffer;      /* Status buffer for this job */
-  int          print_pipes[2],         /* Print data pipes */
-               back_pipes[2];          /* Backchannel pipes */
-  int          cost;                   /* Filtering cost */
-  int          filters[MAX_FILTERS + 1];/* Filter process IDs, 0 terminated */
-  int          backend;                /* Backend process ID */
-  int          status;                 /* Status code from filters */
-  cupsd_printer_t      *printer;               /* Printer this job is assigned to */
-  int          tries;                  /* Number of tries for this job */
+  int                  id,             /* Job ID */
+                       priority;       /* Job priority */
+  ipp_attribute_t      *state;         /* Job state */
+  ipp_attribute_t      *sheets;        /* job-media-sheets-completed */
+  time_t               hold_until;     /* Hold expiration date/time */
+  char                 *username;      /* Printing user */
+  char                 *dest;          /* Destination printer or class */
+  cups_ptype_t         dtype;          /* Destination type (class/remote bits) */
+  ipp_attribute_t      *job_sheets;    /* Job sheets (NULL if none) */
+  int                  num_files;      /* Number of files in job */
+  int                  current_file;   /* Current file in job */
+  mime_type_t          **filetypes;    /* File types */
+  int                  *compressions;  /* Compression status of each file */
+  ipp_t                        *attrs;         /* Job attributes */
+  cupsd_statbuf_t      *status_buffer; /* Status buffer for this job */
+  int                  print_pipes[2], /* Print data pipes */
+                       back_pipes[2];  /* Backchannel pipes */
+  int                  cost;           /* Filtering cost */
+  int                  filters[MAX_FILTERS + 1];
+                                       /* Filter process IDs, 0 terminated */
+  int                  backend;        /* Backend process ID */
+  int                  status;         /* Status code from filters */
+  cupsd_printer_t      *printer;       /* Printer this job is assigned to */
+  int                  tries;          /* Number of tries for this job */
 } cupsd_job_t;
 
 
@@ -96,28 +90,29 @@ VAR int                     FaxRetryLimit   VALUE(5),
  */
 
 extern cupsd_job_t     *cupsdAddJob(int priority, const char *dest);
-extern void    cupsdCancelJob(int id, int purge);
-extern void    cupsdCancelJobs(const char *dest, const char *username, int purge);
-extern void    cupsdCheckJobs(void);
-extern void    cupsdCleanJobs(void);
-extern void    cupsdDeleteJob(int id);
+extern void            cupsdCancelJob(int id, int purge);
+extern void            cupsdCancelJobs(const char *dest, const char *username,
+                                       int purge);
+extern void            cupsdCheckJobs(void);
+extern void            cupsdCleanJobs(void);
+extern void            cupsdDeleteJob(int id);
 extern cupsd_job_t     *cupsdFindJob(int id);
-extern void    cupsdFinishJob(cupsd_job_t *job);
-extern void    cupsdFreeAllJobs(void);
-extern int     cupsdGetPrinterJobCount(const char *dest);
-extern int     cupsdGetUserJobCount(const char *username);
-extern void    cupsdHoldJob(int id);
-extern void    cupsdLoadAllJobs(void);
-extern void    cupsdMoveJob(int id, const char *dest);
-extern void    cupsdReleaseJob(int id);
-extern void    cupsdRestartJob(int id);
-extern void    cupsdSaveJob(int id);
-extern void    cupsdSetJobHoldUntil(int id, const char *when);
-extern void    cupsdSetJobPriority(int id, int priority);
-extern void    cupsdStartJob(int id, cupsd_printer_t *printer);
-extern void    cupsdStopAllJobs(void);
-extern void    cupsdStopJob(int id, int force);
-extern void    cupsdUpdateJob(cupsd_job_t *job);
+extern void            cupsdFinishJob(cupsd_job_t *job);
+extern void            cupsdFreeAllJobs(void);
+extern int             cupsdGetPrinterJobCount(const char *dest);
+extern int             cupsdGetUserJobCount(const char *username);
+extern void            cupsdHoldJob(int id);
+extern void            cupsdLoadAllJobs(void);
+extern void            cupsdMoveJob(int id, const char *dest);
+extern void            cupsdReleaseJob(int id);
+extern void            cupsdRestartJob(int id);
+extern void            cupsdSaveJob(int id);
+extern void            cupsdSetJobHoldUntil(int id, const char *when);
+extern void            cupsdSetJobPriority(int id, int priority);
+extern void            cupsdStartJob(int id, cupsd_printer_t *printer);
+extern void            cupsdStopAllJobs(void);
+extern void            cupsdStopJob(int id, int force);
+extern void            cupsdUpdateJob(cupsd_job_t *job);
 
 
 /*
index 08813c3c0602d06f286304dddd1be9ae4609ca85..45272d233071ff3aad57a3033eaec1d2a2817b34 100644 (file)
@@ -44,7 +44,7 @@
 void
 cupsdPauseListening(void)
 {
-  int          i;              /* Looping var */
+  int                  i;              /* Looping var */
   cupsd_listener_t     *lis;           /* Current listening socket */
 
 
@@ -52,14 +52,16 @@ cupsdPauseListening(void)
     return;
 
   if (NumClients == MaxClients)
-    cupsdLogMessage(L_WARN, "Max clients reached, holding new connections...");
+    cupsdLogMessage(CUPSD_LOG_WARN,
+                    "Max clients reached, holding new connections...");
 
-  cupsdLogMessage(L_DEBUG, "cupsdPauseListening: Clearing input bits...");
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdPauseListening: Clearing input bits...");
 
   for (i = NumListeners, lis = Listeners; i > 0; i --, lis ++)
   {
-    cupsdLogMessage(L_DEBUG2, "cupsdPauseListening: Removing fd %d from InputSet...",
-               lis->fd);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdPauseListening: Removing fd %d from InputSet...",
+                    lis->fd);
 
     FD_CLR(lis->fd, InputSet);
   }
@@ -73,7 +75,7 @@ cupsdPauseListening(void)
 void
 cupsdResumeListening(void)
 {
-  int          i;              /* Looping var */
+  int                  i;              /* Looping var */
   cupsd_listener_t     *lis;           /* Current listening socket */
 
 
@@ -81,14 +83,15 @@ cupsdResumeListening(void)
     return;
 
   if (NumClients >= (MaxClients - 1))
-    cupsdLogMessage(L_WARN, "Resuming new connection processing...");
+    cupsdLogMessage(CUPSD_LOG_WARN, "Resuming new connection processing...");
 
-  cupsdLogMessage(L_DEBUG, "cupsdResumeListening: Setting input bits...");
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdResumeListening: Setting input bits...");
 
   for (i = NumListeners, lis = Listeners; i > 0; i --, lis ++)
   {
-    cupsdLogMessage(L_DEBUG2, "cupsdResumeListening: Adding fd %d to InputSet...",
-               lis->fd);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdResumeListening: Adding fd %d to InputSet...",
+                    lis->fd);
     FD_SET(lis->fd, InputSet);
   }
 }
@@ -101,14 +104,14 @@ cupsdResumeListening(void)
 void
 cupsdStartListening(void)
 {
-  int          status;                 /* Bind result */
-  int          i,                      /* Looping var */
-               p,                      /* Port number */
-               val;                    /* Parameter value */
-  cupsd_listener_t     *lis;                   /* Current listening socket */
-  struct hostent *host;                        /* Host entry for server address */
-  char         s[256];                 /* String addresss */
-  const char   *have_domain;           /* Have a domain socket? */
+  int                  status;         /* Bind result */
+  int                  i,              /* Looping var */
+                       p,              /* Port number */
+                       val;            /* Parameter value */
+  cupsd_listener_t     *lis;           /* Current listening socket */
+  struct hostent       *host;          /* Host entry for server address */
+  char                 s[256];         /* String addresss */
+  const char           *have_domain;   /* Have a domain socket? */
   static const char * const encryptions[] =
                {                       /* Encryption values */
                  "IfRequested",
@@ -118,7 +121,8 @@ cupsdStartListening(void)
                };
 
 
-  cupsdLogMessage(L_DEBUG, "cupsdStartListening: NumListeners=%d", NumListeners);
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdStartListening: NumListeners=%d",
+                  NumListeners);
 
  /*
   * Get the server's IP address...
@@ -140,8 +144,9 @@ cupsdStartListening(void)
     * Didn't find it!  Use an address of 0...
     */
 
-    cupsdLogMessage(L_ERROR, "cupsdStartListening: Unable to find IP address for server name \"%s\" - %s\n",
-               ServerName, hstrerror(h_errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdStartListening: Unable to find IP address for server name \"%s\" - %s\n",
+                    ServerName, hstrerror(h_errno));
 
     ServerAddr.ipv4.sin_family = AF_INET;
   }
@@ -197,7 +202,8 @@ cupsdStartListening(void)
       * Try binding to an IPv4 address instead...
       */
 
-      cupsdLogMessage(L_NOTICE, "cupsdStartListening: Unable to use IPv6 address, trying IPv4...");
+      cupsdLogMessage(CUPSD_LOG_NOTICE,
+                      "cupsdStartListening: Unable to use IPv6 address, trying IPv4...");
 
       p = ntohs(lis->address.ipv6.sin6_port);
 
@@ -215,8 +221,9 @@ cupsdStartListening(void)
 
     if (lis->fd == -1)
     {
-      cupsdLogMessage(L_ERROR, "cupsdStartListening: Unable to open listen socket for address %s:%d - %s.",
-                 s, p, strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cupsdStartListening: Unable to open listen socket for address %s:%d - %s.",
+                      s, p, strerror(errno));
       exit(errno);
     }
 
@@ -305,8 +312,9 @@ cupsdStartListening(void)
 
     if (status < 0)
     {
-      cupsdLogMessage(L_ERROR, "cupsdStartListening: Unable to bind socket for address %s:%d - %s.",
-                 s, p, strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cupsdStartListening: Unable to bind socket for address %s:%d - %s.",
+                      s, p, strerror(errno));
       exit(errno);
     }
 
@@ -316,17 +324,20 @@ cupsdStartListening(void)
 
     if (listen(lis->fd, ListenBackLog) < 0)
     {
-      cupsdLogMessage(L_ERROR, "cupsdStartListening: Unable to listen for clients on address %s:%d - %s.",
-                 s, p, strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "cupsdStartListening: Unable to listen for clients on address %s:%d - %s.",
+                      s, p, strerror(errno));
       exit(errno);
     }
 
     if (p)
-      cupsdLogMessage(L_INFO, "cupsdStartListening: Listening to %s:%d on fd %d...",
-                s, p, lis->fd);
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "cupsdStartListening: Listening to %s:%d on fd %d...",
+                     s, p, lis->fd);
     else
-      cupsdLogMessage(L_INFO, "cupsdStartListening: Listening to %s on fd %d...",
-                s, lis->fd);
+      cupsdLogMessage(CUPSD_LOG_INFO,
+                      "cupsdStartListening: Listening to %s on fd %d...",
+                     s, lis->fd);
   }
 
  /*
@@ -335,7 +346,8 @@ cupsdStartListening(void)
 
   if (!LocalPort && !have_domain)
   {
-    cupsdLogMessage(L_EMERG, "No Listen or Port lines were found to allow access via localhost!");
+    cupsdLogMessage(CUPSD_LOG_EMERG,
+                    "No Listen or Port lines were found to allow access via localhost!");
 
    /*
     * Commit suicide...
@@ -386,7 +398,8 @@ cupsdStopListening(void)
   cupsd_listener_t     *lis;           /* Current listening socket */
 
 
-  cupsdLogMessage(L_DEBUG, "cupsdStopListening: closing all listen sockets.");
+  cupsdLogMessage(CUPSD_LOG_DEBUG,
+                  "cupsdStopListening: closing all listen sockets.");
 
   cupsdPauseListening();
 
index 9ca80365d5fce28ce44f82d23a26aa3fa2268393..a3a13e2262e97a721bca06f7b7376ed3e057fdeb 100644 (file)
@@ -53,14 +53,14 @@ static int  check_log_file(cups_file_t **, const char *);
  * 'cupsdGetDateTime()' - Returns a pointer to a date/time string.
  */
 
-char *                         /* O - Date/time string */
+char *                                 /* O - Date/time string */
 cupsdGetDateTime(time_t t)             /* I - Time value */
 {
-  struct tm    *date;          /* Date/time value */
-  static time_t        last_time = -1; /* Last time value */
-  static char  s[1024];        /* Date/time string */
-  static const char * const months[12] =
-               {               /* Months */
+  struct tm    *date;                  /* Date/time value */
+  static time_t        last_time = -1;         /* Last time value */
+  static char  s[1024];                /* Date/time string */
+  static const char * const months[12] =/* Months */
+               {
                  "Jan",
                  "Feb",
                  "Mar",
@@ -115,13 +115,13 @@ cupsdGetDateTime(time_t t)                /* I - Time value */
  */
 
 int                                    /* O - 1 on success, 0 on error */
-cupsdLogMessage(int        level,              /* I - Log level */
-           const char *message,                /* I - printf-style message string */
-          ...)                         /* I - Additional args as needed */
+cupsdLogMessage(int        level,      /* I - Log level */
+                const char *message,   /* I - printf-style message string */
+               ...)                    /* I - Additional args as needed */
 {
-  int          len;                    /* Length of message */
-  va_list      ap;                     /* Argument pointer */
-  static const char levels[] =         /* Log levels... */
+  int                  len;            /* Length of message */
+  va_list              ap;             /* Argument pointer */
+  static const char    levels[] =      /* Log levels... */
                {
                  ' ',
                  'X',
@@ -165,7 +165,7 @@ cupsdLogMessage(int        level,           /* I - Log level */
   * See if we are logging errors via syslog...
   */
 
-  if (strcmp(ErrorLog, "syslog") == 0)
+  if (!strcmp(ErrorLog, "syslog"))
   {
     va_start(ap, message);
     vsyslog(syslevels[level], message, ap);
@@ -278,12 +278,12 @@ cupsdLogMessage(int        level,         /* I - Log level */
  * 'cupsdLogPage()' - Log a page to the page log file.
  */
 
-int                            /* O - 1 on success, 0 on error */
-cupsdLogPage(cupsd_job_t       *job,   /* I - Job being printed */
-        const char  *page)     /* I - Page being printed */
+int                                    /* O - 1 on success, 0 on error */
+cupsdLogPage(cupsd_job_t *job,         /* I - Job being printed */
+             const char  *page)                /* I - Page being printed */
 {
-  ipp_attribute_t *billing,    /* job-billing attribute */
-                  *hostname;   /* job-originating-host-name attribute */
+  ipp_attribute_t *billing,            /* job-billing attribute */
+                  *hostname;           /* job-originating-host-name attribute */
 
 
   billing  = ippFindAttribute(job->attrs, "job-billing", IPP_TAG_ZERO);
@@ -295,7 +295,7 @@ cupsdLogPage(cupsd_job_t       *job,        /* I - Job being printed */
   * See if we are logging pages via syslog...
   */
 
-  if (strcmp(PageLog, "syslog") == 0)
+  if (!strcmp(PageLog, "syslog"))
   {
     syslog(LOG_INFO, "PAGE %s %s %d %s %s %s", job->printer->name,
            job->username ? job->username : "-",
@@ -335,12 +335,12 @@ cupsdLogPage(cupsd_job_t       *job,      /* I - Job being printed */
  * 'cupsdLogRequest()' - Log an HTTP request in Common Log Format.
  */
 
-int                            /* O - 1 on success, 0 on error */
-cupsdLogRequest(cupsd_client_t      *con,      /* I - Request to log */
-           http_status_t code) /* I - Response code */
+int                                    /* O - 1 on success, 0 on error */
+cupsdLogRequest(cupsd_client_t *con,   /* I - Request to log */
+                http_status_t  code)   /* I - Response code */
 {
-  static const char * const states[] =
-               {               /* HTTP client states... */
+  static const char * const states[] = /* HTTP client states... */
+               {
                  "WAITING",
                  "OPTIONS",
                  "GET",
@@ -363,7 +363,7 @@ cupsdLogRequest(cupsd_client_t      *con,   /* I - Request to log */
   * See if we are logging accesses via syslog...
   */
 
-  if (strcmp(AccessLog, "syslog") == 0)
+  if (!strcmp(AccessLog, "syslog"))
   {
     syslog(LOG_INFO, "REQUEST %s - %s \"%s %s HTTP/%d.%d\" %d %d\n",
            con->http.hostname, con->username[0] != '\0' ? con->username : "-",
index 30a7fe4dc7fd573686f79282a23caf4dbd5f2110..fdfe84726498fa4a99c47f9f9e70a6934a90d4fb 100644 (file)
  *
  * Contents:
  *
- *   main()               - Main entry for the CUPS scheduler.
- *   cupsdClosePipe()     - Close a pipe as necessary.
- *   cupsdOpenPipe()      - Create a pipe which is closed on exec.
+ *   main()                    - Main entry for the CUPS scheduler.
+ *   cupsdClosePipe()          - Close a pipe as necessary.
+ *   cupsdOpenPipe()           - Create a pipe which is closed on exec.
  *   cupsdCatchChildSignals()  - Catch SIGCHLD signals...
  *   cupsdHoldSignals()        - Hold child and termination signals.
  *   cupsdIgnoreChildSignals() - Ignore SIGCHLD signals...
  *   cupsdReleaseSignals()     - Release signals for delivery.
  *   cupsdSetString()          - Set a string value.
  *   cupsdSetStringf()         - Set a formatted string value.
- *   parent_handler()     - Catch USR1/CHLD signals...
- *   process_children()   - Process all dead children...
- *   sigchld_handler()    - Handle 'child' signals from old processes.
- *   sighup_handler()     - Handle 'hangup' signals to reconfigure the scheduler.
- *   sigterm_handler()    - Handle 'terminate' signals that stop the scheduler.
- *   select_timeout()     - Calculate the select timeout value.
- *   usage()              - Show scheduler usage.
+ *   parent_handler()          - Catch USR1/CHLD signals...
+ *   process_children()        - Process all dead children...
+ *   sigchld_handler()         - Handle 'child' signals from old processes.
+ *   sighup_handler()          - Handle 'hangup' signals to reconfigure the
+ *                               scheduler.
+ *   sigterm_handler()         - Handle 'terminate' signals that stop the
+ *                               scheduler.
+ *   select_timeout()          - Calculate the select timeout value.
+ *   usage()                   - Show scheduler usage.
  */
 
 /*
@@ -96,9 +98,9 @@ main(int  argc,                               /* I - Number of command-line arguments */
   int                  fds;            /* Number of ready descriptors select returns */
   fd_set               *input,         /* Input set for select() */
                        *output;        /* Output set for select() */
-  cupsd_client_t               *con;           /* Current client */
-  cupsd_job_t                  *job;           /* Current job */
-  cupsd_listener_t             *lis;           /* Current listener */
+  cupsd_client_t       *con;           /* Current client */
+  cupsd_job_t          *job;           /* Current job */
+  cupsd_listener_t     *lis;           /* Current listener */
   time_t               activity;       /* Activity timer */
   time_t               browse_time;    /* Next browse send time */
   time_t               senddoc_time;   /* Send-Document time */
@@ -163,7 +165,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
              break;
 
          default : /* Unknown option */
-              fprintf(stderr, "cupsd: Unknown option \'%c\' - aborting!\n", *opt);
+              fprintf(stderr, "cupsd: Unknown option \'%c\' - aborting!\n",
+                     *opt);
              usage();
              break;
        }
@@ -459,8 +462,9 @@ main(int  argc,                             /* I - Number of command-line arguments */
   while (!stop_scheduler)
   {
 #ifdef DEBUG
-    cupsdLogMessage(L_DEBUG2, "main: Top of loop, dead_children=%d, NeedReload=%d",
-               dead_children, NeedReload);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "main: Top of loop, dead_children=%d, NeedReload=%d",
+                    dead_children, NeedReload);
 #endif /* DEBUG */
 
    /*
@@ -537,9 +541,9 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
     if ((fds = select(MaxFDs, input, output, NULL, &timeout)) < 0)
     {
-      char     s[16384],       /* String buffer */
-               *sptr;          /* Pointer into buffer */
-      int      slen;           /* Length of string buffer */
+      char     s[16384],               /* String buffer */
+               *sptr;                  /* Pointer into buffer */
+      int      slen;                   /* Length of string buffer */
 
 
      /*
@@ -553,7 +557,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
       * Log all sorts of debug info to help track down the problem.
       */
 
-      cupsdLogMessage(L_EMERG, "select() failed - %s!", strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_EMERG, "select() failed - %s!",
+                      strerror(errno));
 
       strcpy(s, "InputSet =");
       slen = 10;
@@ -567,7 +572,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
          sptr += strlen(sptr);
        }
 
-      cupsdLogMessage(L_EMERG, s);
+      cupsdLogMessage(CUPSD_LOG_EMERG, s);
 
       strcpy(s, "OutputSet =");
       slen = 11;
@@ -581,24 +586,26 @@ main(int  argc,                           /* I - Number of command-line arguments */
          sptr += strlen(sptr);
        }
 
-      cupsdLogMessage(L_EMERG, s);
+      cupsdLogMessage(CUPSD_LOG_EMERG, s);
 
       for (i = 0, con = Clients; i < NumClients; i ++, con ++)
-        cupsdLogMessage(L_EMERG, "Clients[%d] = %d, file = %d, state = %d",
-                  i, con->http.fd, con->file, con->http.state);
+        cupsdLogMessage(CUPSD_LOG_EMERG,
+                       "Clients[%d] = %d, file = %d, state = %d",
+                       i, con->http.fd, con->file, con->http.state);
 
       for (i = 0, lis = Listeners; i < NumListeners; i ++, lis ++)
-        cupsdLogMessage(L_EMERG, "Listeners[%d] = %d", i, lis->fd);
+        cupsdLogMessage(CUPSD_LOG_EMERG, "Listeners[%d] = %d", i, lis->fd);
 
-      cupsdLogMessage(L_EMERG, "BrowseSocket = %d", BrowseSocket);
+      cupsdLogMessage(CUPSD_LOG_EMERG, "BrowseSocket = %d", BrowseSocket);
 
       for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs);
           job;
           job = (cupsd_job_t *)cupsArrayNext(ActiveJobs))
-        cupsdLogMessage(L_EMERG, "Jobs[%d] = %d < [%d %d] > [%d %d]",
-                  job->id, job->status_buffer ? job->status_buffer->fd : -1,
-                  job->print_pipes[0], job->print_pipes[1],
-                  job->back_pipes[0], job->back_pipes[1]);
+        cupsdLogMessage(CUPSD_LOG_EMERG, "Jobs[%d] = %d < [%d %d] > [%d %d]",
+                       job->id,
+                       job->status_buffer ? job->status_buffer->fd : -1,
+                       job->print_pipes[0], job->print_pipes[1],
+                       job->back_pipes[0], job->back_pipes[1]);
       break;
     }
 
@@ -708,12 +715,14 @@ main(int  argc,                           /* I - Number of command-line arguments */
         con->file_ready = 1;
 
 #ifdef DEBUG
-        cupsdLogMessage(L_DEBUG2, "main: Data ready file %d!", con->file);
+        cupsdLogMessage(CUPSD_LOG_DEBUG2, "main: Data ready file %d!",
+                       con->file);
 #endif /* DEBUG */
 
        if (!FD_ISSET(con->http.fd, output))
        {
-         cupsdLogMessage(L_DEBUG2, "main: Removing fd %d from InputSet...", con->file);
+         cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                         "main: Removing fd %d from InputSet...", con->file);
          FD_CLR(con->file, InputSet);
        }
       }
@@ -737,8 +746,9 @@ main(int  argc,                             /* I - Number of command-line arguments */
       activity = time(NULL) - Timeout;
       if (con->http.activity < activity && !con->pipe_pid)
       {
-        cupsdLogMessage(L_DEBUG, "Closing client %d after %d seconds of inactivity...",
-                  con->http.fd, Timeout);
+        cupsdLogMessage(CUPSD_LOG_DEBUG,
+                       "Closing client %d after %d seconds of inactivity...",
+                       con->http.fd, Timeout);
 
         cupsdCloseClient(con);
         con --;
@@ -761,15 +771,16 @@ main(int  argc,                           /* I - Number of command-line arguments */
     * Log memory usage every minute...
     */
 
-    if ((time(NULL) - mallinfo_time) >= 60 && LogLevel >= L_DEBUG)
+    if ((time(NULL) - mallinfo_time) >= 60 && LogLevel >= CUPSD_LOG_DEBUG)
     {
-      struct mallinfo mem;     /* Malloc information */
+      struct mallinfo mem;             /* Malloc information */
 
 
       mem = mallinfo();
-      cupsdLogMessage(L_DEBUG, "mallinfo: arena = %d, used = %d, free = %d\n",
-                 mem.arena, mem.usmblks + mem.uordblks,
-                mem.fsmblks + mem.fordblks);
+      cupsdLogMessage(CUPSD_LOG_DEBUG,
+                      "mallinfo: arena = %d, used = %d, free = %d\n",
+                      mem.arena, mem.usmblks + mem.uordblks,
+                     mem.fsmblks + mem.fordblks);
       mallinfo_time = time(NULL);
     }
 #endif /* HAVE_MALLINFO */
@@ -795,9 +806,10 @@ main(int  argc,                            /* I - Number of command-line arguments */
   */
 
   if (stop_scheduler)
-    cupsdLogMessage(L_INFO, "Scheduler shutting down normally.");
+    cupsdLogMessage(CUPSD_LOG_INFO, "Scheduler shutting down normally.");
   else
-    cupsdLogMessage(L_ERROR, "Scheduler shutting down due to program error.");
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "Scheduler shutting down due to program error.");
 
  /*
   * Close all network clients and stop all jobs...
@@ -930,7 +942,7 @@ cupsdCatchChildSignals(void)
  */
 
 void
-cupsdClearString(char **s)                     /* O - String value */
+cupsdClearString(char **s)             /* O - String value */
 {
   if (s && *s)
   {
@@ -1024,7 +1036,7 @@ cupsdReleaseSignals(void)
 
 void
 cupsdSetString(char       **s,         /* O - New string */
-          const char *v)               /* I - String value */
+               const char *v)          /* I - String value */
 {
   if (!s || *s == v)
     return;
@@ -1045,8 +1057,8 @@ cupsdSetString(char       **s,            /* O - New string */
 
 void
 cupsdSetStringf(char       **s,                /* O - New string */
-           const char *f,              /* I - Printf-style format string */
-          ...)                         /* I - Additional args as needed */
+                const char *f,         /* I - Printf-style format string */
+               ...)                    /* I - Additional args as needed */
 {
   char         v[4096];                /* Formatting string value */
   va_list      ap;                     /* Argument pointer */
@@ -1079,7 +1091,7 @@ cupsdSetStringf(char       **s,           /* O - New string */
  */
 
 static void
-parent_handler(int sig)                /* I - Signal */
+parent_handler(int sig)                        /* I - Signal */
 {
  /*
   * Store the signal we got from the OS and return...
@@ -1096,13 +1108,13 @@ parent_handler(int sig)         /* I - Signal */
 static void
 process_children(void)
 {
-  int          status;         /* Exit status of child */
-  int          pid;            /* Process ID of child */
-  cupsd_job_t          *job;           /* Current job */
-  int          i;              /* Looping var */
+  int          status;                 /* Exit status of child */
+  int          pid;                    /* Process ID of child */
+  cupsd_job_t  *job;                   /* Current job */
+  int          i;                      /* Looping var */
 
 
-  cupsdLogMessage(L_DEBUG2, "process_children()");
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "process_children()");
 
  /*
   * Reset the dead_children flag...
@@ -1122,7 +1134,8 @@ process_children(void)
   if ((pid = wait(&status)) > 0)
 #endif /* HAVE_WAITPID */
   {
-    cupsdLogMessage(L_DEBUG2, "process_children: pid = %d, status = %d\n", pid, status);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "process_children: pid = %d, status = %d\n", pid, status);
 
    /*
     * Ignore SIGTERM errors - that comes when a job is cancelled...
@@ -1134,17 +1147,18 @@ process_children(void)
     if (status)
     {
       if (WIFEXITED(status))
-       cupsdLogMessage(L_ERROR, "PID %d stopped with status %d!", pid,
-                  WEXITSTATUS(status));
+       cupsdLogMessage(CUPSD_LOG_ERROR, "PID %d stopped with status %d!", pid,
+                       WEXITSTATUS(status));
       else
-       cupsdLogMessage(L_ERROR, "PID %d crashed on signal %d!", pid,
-                  WTERMSIG(status));
+       cupsdLogMessage(CUPSD_LOG_ERROR, "PID %d crashed on signal %d!", pid,
+                       WTERMSIG(status));
 
-      if (LogLevel < L_DEBUG)
-        cupsdLogMessage(L_INFO, "Hint: Try setting the LogLevel to \"debug\" to find out more.");
+      if (LogLevel < CUPSD_LOG_DEBUG)
+        cupsdLogMessage(CUPSD_LOG_INFO,
+                       "Hint: Try setting the LogLevel to \"debug\" to find out more.");
     }
     else
-      cupsdLogMessage(L_DEBUG2, "PID %d exited with no errors.", pid);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2, "PID %d exited with no errors.", pid);
 
    /*
     * Delete certificates for CGI processes...
@@ -1290,9 +1304,9 @@ select_timeout(int fds)                   /* I - Number of ready descriptors select returned */
   int                  i;              /* Looping var */
   long                 timeout;        /* Timeout for select */
   time_t               now;            /* Current time */
-  cupsd_client_t               *con;           /* Client information */
-  cupsd_printer_t              *p;             /* Printer information */
-  cupsd_job_t                  *job;           /* Job information */
+  cupsd_client_t       *con;           /* Client information */
+  cupsd_printer_t      *p;             /* Printer information */
+  cupsd_job_t          *job;           /* Job information */
   const char           *why;           /* Debugging aid */
 
 
@@ -1395,7 +1409,7 @@ select_timeout(int fds)                   /* I - Number of ready descriptors select returned */
   * Log memory usage every minute...
   */
 
-  if (LogLevel >= L_DEBUG && (mallinfo_time + 60) < timeout)
+  if (LogLevel >= CUPSD_LOG_DEBUG && (mallinfo_time + 60) < timeout)
   {
     timeout = mallinfo_time + 60;
     why     = "display memory usage";
@@ -1433,7 +1447,8 @@ select_timeout(int fds)                   /* I - Number of ready descriptors select returned */
   * Log and return the timeout value...
   */
 
-  cupsdLogMessage(L_DEBUG2, "select_timeout: %ld seconds to %s", timeout, why);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "select_timeout: %ld seconds to %s",
+                  timeout, why);
 
   return (timeout);
 }
index 69a7c1c72ccd4d19d1c9e698d468d9ec6e0db68a..f8fd6b3794a4e7436a8d22101586d52a656c67d3 100644 (file)
  *       Voice: (301) 373-9600
  *       EMail: cups-info@cups.org
  *         WWW: http://www.cups.org
+ *
+ * Contents:
+ *
+ *   cupsdNetIFFind()   - Find a network interface.
+ *   cupsdNetIFFree()   - Free the current network interface list.
+ *   cupsdNetIFUpdate() - Update the network interface list as needed...
+ *   getifaddrs()       - Get a list of network interfaces on the system.
+ *   freeifaddrs()      - Free an interface list...
  */
 
 /*
@@ -53,7 +61,7 @@
 #    define ifr_netmask ifr_addr
 #  endif /* !ifr_netmask */
 
-struct ifaddrs                 /**** Interface Structure ****/
+struct ifaddrs                         /**** Interface Structure ****/
 {
   struct ifaddrs       *ifa_next;      /* Next interface in list */
   char                 *ifa_name;      /* Name of interface */
@@ -70,13 +78,13 @@ void        freeifaddrs(struct ifaddrs *addrs);
 
 
 /*
- * 'NetIFFind()' - Find a network interface.
+ * 'cupsdNetIFFind()' - Find a network interface.
  */
 
-cupsd_netif_t *                        /* O - Network interface data */
-NetIFFind(const char *name)    /* I - Name of interface */
+cupsd_netif_t *                                /* O - Network interface data */
+cupsdNetIFFind(const char *name)       /* I - Name of interface */
 {
-  cupsd_netif_t        *temp;          /* Current network interface */
+  cupsd_netif_t        *temp;                  /* Current network interface */
 
 
  /*
@@ -90,7 +98,7 @@ NetIFFind(const char *name)   /* I - Name of interface */
   */
 
   for (temp = NetIFList; temp != NULL; temp = temp->next)
-    if (strcasecmp(name, temp->name) == 0)
+    if (!strcasecmp(name, temp->name))
       return (temp);
 
   return (NULL);
@@ -104,7 +112,7 @@ NetIFFind(const char *name) /* I - Name of interface */
 void
 cupsdNetIFFree(void)
 {
-  cupsd_netif_t        *next;          /* Next interface in list */
+  cupsd_netif_t        *next;                  /* Next interface in list */
 
 
  /*
@@ -129,12 +137,12 @@ cupsdNetIFFree(void)
 void
 cupsdNetIFUpdate(void)
 {
-  int          i,              /* Looping var */
-               match;          /* Matching address? */
+  int                  i,              /* Looping var */
+                       match;          /* Matching address? */
   cupsd_listener_t     *lis;           /* Listen address */
-  cupsd_netif_t        *temp;          /* Current interface */
-  struct ifaddrs *addrs,       /* Interface address list */
-               *addr;          /* Current interface address */
+  cupsd_netif_t                *temp;          /* Current interface */
+  struct ifaddrs       *addrs,         /* Interface address list */
+                       *addr;          /* Current interface address */
 
 
  /*
@@ -201,7 +209,8 @@ cupsdNetIFUpdate(void)
       memcpy(&(temp->mask), addr->ifa_netmask, sizeof(struct sockaddr_in));
 
       if (addr->ifa_dstaddr)
-       memcpy(&(temp->broadcast), addr->ifa_dstaddr, sizeof(struct sockaddr_in));
+       memcpy(&(temp->broadcast), addr->ifa_dstaddr,
+              sizeof(struct sockaddr_in));
     }
 #ifdef AF_INET6
     else
@@ -214,7 +223,8 @@ cupsdNetIFUpdate(void)
       memcpy(&(temp->mask), addr->ifa_netmask, sizeof(struct sockaddr_in6));
 
       if (addr->ifa_dstaddr)
-       memcpy(&(temp->broadcast), addr->ifa_dstaddr, sizeof(struct sockaddr_in6));
+       memcpy(&(temp->broadcast), addr->ifa_dstaddr,
+              sizeof(struct sockaddr_in6));
     }
 #endif /* AF_INET6 */
 
@@ -528,7 +538,6 @@ freeifaddrs(struct ifaddrs *addrs)  /* I - Interface list to free */
     addrs = next;
   }
 }
-
 #endif /* !HAVE_GETIFADDRS */
 
 
index ef19510d65096c33b0ae9eb500e6b68ad31a117a..9dffc821dbbe7075cffe871fd2f5503e68dd0267 100644 (file)
@@ -54,7 +54,7 @@ VAR cupsd_netif_t     *NetIFList      VALUE(NULL);
  * Prototypes...
  */
 
-extern cupsd_netif_t   *NetIFFind(const char *name);
+extern cupsd_netif_t   *cupsdNetIFFind(const char *name);
 extern void            cupsdNetIFFree(void);
 extern void            cupsdNetIFUpdate(void);
 
index ae031012648bdc5da34f1129d918368067b7b6fd..a742f30f81dd655091b5b0e8e919fd139dc4412b 100644 (file)
@@ -70,9 +70,9 @@ enum
  * Types and structures...
  */
 
-typedef struct cupsd_subscription_str  /**** Subscription object ****/
+typedef struct cupsd_subscription_s    /**** Subscription object ****/
 {
-  struct cupsd_subscription_str *next; /* Pointer to next subscription */
+  struct cupsd_subscription_s *next;   /* Pointer to next subscription */
   int          id;                     /* subscription-id */
   unsigned     mask;                   /* Event mask */
   ipp_t                *attrs;                 /* Subscription attributes */
@@ -89,9 +89,9 @@ typedef struct cupsd_subscription_str /**** Subscription object ****/
   time_t       last_time;              /* Time of last notification */
 } cupsd_subscription_t;
 
-typedef struct cupsd_event_str         /**** Event object ****/
+typedef struct cupsd_event_s           /**** Event object ****/
 {
-  struct cupsd_event_str *next;                /* Pointer to next event */
+  struct cupsd_event_s *next;          /* Pointer to next event */
   int          id;                     /* event-id */
   time_t       event_time;             /* event-time */
   ipp_t                *attrs;                 /* Event attributes */
index c7e7dae5e15eb278144b086e2ab337fb8733dc3a..1255dde6a9cebc6bdb14895960d880dd73d7ddb1 100644 (file)
@@ -80,19 +80,19 @@ cupsdAddPolicy(const char *policy)  /* I - Name of policy */
  * 'cupsdAddPolicyOp()' - Add an operation to a policy.
  */
 
-cupsd_location_t *                             /* O - New policy operation */
-cupsdAddPolicyOp(cupsd_policy_t *p,    /* I - Policy */
-                 cupsd_location_t     *po,     /* I - Policy operation to copy */
-                 ipp_op_t       op)    /* I - IPP operation code */
+cupsd_location_t *                     /* O - New policy operation */
+cupsdAddPolicyOp(cupsd_policy_t   *p,  /* I - Policy */
+                 cupsd_location_t *po, /* I - Policy operation to copy */
+                 ipp_op_t         op)  /* I - IPP operation code */
 {
-  int          i;                      /* Looping var */
-  cupsd_location_t     *temp,                  /* New policy operation */
-               **tempa;                /* New policy operation array */
-  char         name[1024];             /* Interface name */
+  int                  i;              /* Looping var */
+  cupsd_location_t     *temp,          /* New policy operation */
+                       **tempa;        /* New policy operation array */
+  char                 name[1024];     /* Interface name */
 
 
-  cupsdLogMessage(L_DEBUG2, "cupsdAddPolicyOp(p=%p, po=%p, op=%x(%s))",
-             p, po, op, ippOpString(op));
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddPolicyOp(p=%p, po=%p, op=%x(%s))",
+                  p, po, op, ippOpString(op));
 
   if (p == NULL)
     return (NULL);
@@ -181,10 +181,10 @@ cupsdAddPolicyOp(cupsd_policy_t *p,       /* I - Policy */
 
 int                                    /* I - 1 if OK, 0 otherwise */
 cupsdCheckPolicy(cupsd_policy_t *p,    /* I - Policy */
-                 cupsd_client_t       *con,    /* I - Client connection */
+                 cupsd_client_t *con,  /* I - Client connection */
                 const char     *owner) /* I - Owner of object */
 {
-  cupsd_location_t     *po;                    /* Current policy operation */
+  cupsd_location_t     *po;            /* Current policy operation */
 
 
  /*
@@ -193,7 +193,7 @@ cupsdCheckPolicy(cupsd_policy_t *p, /* I - Policy */
 
   if (!p || !con)
   {
-    cupsdLogMessage(L_CRIT, "cupsdCheckPolicy: p=%p, con=%p!", p, con);
+    cupsdLogMessage(CUPSD_LOG_CRIT, "cupsdCheckPolicy: p=%p, con=%p!", p, con);
 
     return (0);
   }
@@ -204,7 +204,7 @@ cupsdCheckPolicy(cupsd_policy_t *p, /* I - Policy */
 
   if ((po = cupsdFindPolicyOp(p, con->request->request.op.operation_id)) == NULL)
   {
-    cupsdLogMessage(L_DEBUG2, "cupsdCheckPolicy: No matching operation, returning 0!");
+    cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdCheckPolicy: No matching operation, returning 0!");
     return (0);
   }
 
@@ -227,7 +227,7 @@ cupsdDeleteAllPolicies(void)
 {
   int                  i, j;           /* Looping vars */
   cupsd_policy_t       **p;            /* Current policy */
-  cupsd_location_t             **po;           /* Current policy op */
+  cupsd_location_t     **po;           /* Current policy op */
 
 
   if (NumPolicies == 0)
@@ -288,16 +288,16 @@ cupsdFindPolicy(const char *policy)       /* I - Name of policy */
  * 'cupsdFindPolicyOp()' - Find a policy operation.
  */
 
-cupsd_location_t *                             /* O - Policy operation */
+cupsd_location_t *                     /* O - Policy operation */
 cupsdFindPolicyOp(cupsd_policy_t *p,   /* I - Policy */
                   ipp_op_t       op)   /* I - IPP operation */
 {
-  int          i;                      /* Looping var */
-  cupsd_location_t     **po;                   /* Current policy operation */
+  int                  i;              /* Looping var */
+  cupsd_location_t     **po;           /* Current policy operation */
 
 
-  cupsdLogMessage(L_DEBUG2, "cupsdFindPolicyOp(p=%p, op=%x(%s))\n",
-             p, op, ippOpString(op));
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindPolicyOp(p=%p, op=%x(%s))\n",
+                  p, op, ippOpString(op));
 
  /*
   * Range check...
@@ -313,18 +313,20 @@ cupsdFindPolicyOp(cupsd_policy_t *p,      /* I - Policy */
   for (i = p->num_ops, po = p->ops; i > 0; i --, po ++)
     if ((*po)->op == op)
     {
-      cupsdLogMessage(L_DEBUG2, "cupsdFindPolicyOp: Found exact match...");
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdFindPolicyOp: Found exact match...");
       return (*po);
     }
 
   for (i = p->num_ops, po = p->ops; i > 0; i --, po ++)
     if ((*po)->op == IPP_ANY_OPERATION)
     {
-      cupsdLogMessage(L_DEBUG2, "cupsdFindPolicyOp: Found wildcard match...");
+      cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                      "cupsdFindPolicyOp: Found wildcard match...");
       return (*po);
     }
 
-  cupsdLogMessage(L_DEBUG2, "cupsdFindPolicyOp: No match found!");
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindPolicyOp: No match found!");
 
   return (NULL);
 }
index 9a2ff7da5818def73a4b1c94a5f83eaccb608cb4..e7d0eb2cd9a8ae3c2f0557683d55ce80cc8e43c4 100644 (file)
@@ -30,9 +30,9 @@
 
 typedef struct
 {
-  char         *name;                  /* Policy name */
-  int          num_ops;                /* Number of operations */
-  cupsd_location_t     **ops;                  /* Operations */
+  char                 *name;          /* Policy name */
+  int                  num_ops;        /* Number of operations */
+  cupsd_location_t     **ops;          /* Operations */
 } cupsd_policy_t;
 
 
@@ -51,7 +51,8 @@ VAR cupsd_policy_t    **Policies      VALUE(NULL);
  */
 
 extern cupsd_policy_t  *cupsdAddPolicy(const char *policy);
-extern cupsd_location_t        *cupsdAddPolicyOp(cupsd_policy_t *p, cupsd_location_t *po,
+extern cupsd_location_t        *cupsdAddPolicyOp(cupsd_policy_t *p,
+                                         cupsd_location_t *po,
                                          ipp_op_t op);
 extern int             cupsdCheckPolicy(cupsd_policy_t *p, cupsd_client_t *con,
                                         const char *owner);
diff --git a/scheduler/ppds.c b/scheduler/ppds.c
deleted file mode 100644 (file)
index e31af3c..0000000
+++ /dev/null
@@ -1,781 +0,0 @@
-/*
- * "$Id$"
- *
- *   PPD scanning routines for the Common UNIX Printing System (CUPS).
- *
- *   Copyright 1997-2005 by Easy Software Products.
- *
- *   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
- *
- * Contents:
- *
- *   LoadPPDs()      - Load PPD files from the specified directory...
- *   buf_read()      - Read a buffer of data into memory...
- *   check_ppds()    - Check to see if we need to regenerate the PPD file
- *                     list...
- *   compare_names() - Compare PPD filenames for sorting.
- *   compare_ppds()  - Compare PPD file make and model names for sorting.
- *   load_ppds()     - Load PPD files recursively.
- */
-
-/*
- * Include necessary headers...
- */
-
-#include "cupsd.h"
-#include <ctype.h>
-
-
-/*
- * PPD information structures...
- */
-
-typedef struct
-{
-  char ppd_make[128],                  /* Manufacturer */
-       ppd_make_and_model[248];        /* Make and model */
-  int  ppd_size,                       /* Size in bytes */
-       ppd_mtime;                      /* Modification time */
-  char ppd_name[256],                  /* PPD filename */
-       ppd_natural_language[16];       /* Natural language */
-} ppd_rec_t;
-
-typedef struct
-{
-  int          found;                  /* 1 if PPD is found */
-  ppd_rec_t    record;                 /* ppds.dat record */
-} ppd_info_t;
-
-
-/*
- * Local globals...
- */
-
-static int             num_ppds,       /* Number of PPD files */
-                       sorted_ppds,    /* Number of sorted PPD files */
-                       alloc_ppds;     /* Number of allocated entries */
-static ppd_info_t      *ppds;          /* PPD file info */
-static int             changed_ppd;    /* Did we change the PPD database? */
-
-
-/*
- * Local functions...
- */
-
-static int     compare_names(const ppd_info_t *p0, const ppd_info_t *p1);
-static int     compare_ppds(const ppd_info_t *p0, const ppd_info_t *p1);
-static void    load_ppds(const char *d, const char *p);
-
-
-/*
- * 'LoadPPDs()' - Load PPD files from the specified directory...
- */
-
-void
-LoadPPDs(const char *d)                        /* I - Directory to scan... */
-{
-  int          i;                      /* Looping var */
-  ppd_info_t   *ppd;                   /* Current PPD file */
-  cups_file_t  *fp;                    /* ppds.dat file */
-  struct stat  fileinfo;               /* ppds.dat information */
-  char         filename[1024];         /* ppds.dat filename */
-
-
- /*
-  * See if we a PPD database file...
-  */
-
-  num_ppds    = 0;
-  alloc_ppds  = 0;
-  ppds        = (ppd_info_t *)0;
-  changed_ppd = 0;
-
-  snprintf(filename, sizeof(filename), "%s/ppds.dat", ServerRoot);
-  if (!stat(filename, &fileinfo) &&
-      (num_ppds = fileinfo.st_size / sizeof(ppd_rec_t)) > 0)
-  {
-   /*
-    * We have a ppds.dat file, so read it!
-    */
-
-    alloc_ppds = num_ppds;
-
-    if ((ppds = malloc(sizeof(ppd_info_t) * num_ppds)) == NULL)
-    {
-      cupsdLogMessage(L_ERROR, "LoadPPDs: Unable to allocate memory for %d PPD files!",
-                 num_ppds);
-      num_ppds   = 0;
-      alloc_ppds = 0;
-    }
-    else if ((fp = cupsFileOpen(filename, "rb")) != NULL)
-    {
-      for (i = num_ppds, ppd = ppds; i > 0; i --, ppd ++)
-      {
-        cupsFileRead(fp, (char *)&(ppd->record), sizeof(ppd_rec_t));
-       ppd->found = 0;
-      }
-
-      cupsFileClose(fp);
-
-      cupsdLogMessage(L_INFO, "LoadPPDs: Read \"%s\", %d PPDs...", filename,
-                 num_ppds);
-
-     /*
-      * Sort the PPDs by name...
-      */
-
-      if (num_ppds > 1)
-      {
-       qsort(ppds, num_ppds, sizeof(ppd_info_t),
-              (int (*)(const void *, const void *))compare_names);
-      }
-    }
-    else
-    {
-      cupsdLogMessage(L_ERROR, "LoadPPDs: Unable to read \"%s\" - %s", filename,
-                 strerror(errno));
-      num_ppds = 0;
-    }
-  }
-
- /*
-  * Load all PPDs in the specified directory and below...
-  */
-
-  sorted_ppds = num_ppds;
-
-  load_ppds(d, "");
-
- /*
-  * Cull PPD files that are no longer present...
-  */
-
-  for (i = num_ppds, ppd = ppds; i > 0; i --, ppd ++)
-    if (!ppd->found)
-    {
-     /*
-      * Remove this PPD file from the list...
-      */
-
-      if (i > 1)
-        memmove(ppd, ppd + 1, (i - 1) * sizeof(ppd_info_t));
-
-      num_ppds --;
-      ppd --;
-    }
-
- /*
-  * Sort the PPDs by make and model...
-  */
-
-  if (num_ppds > 1)
-    qsort(ppds, num_ppds, sizeof(ppd_info_t),
-          (int (*)(const void *, const void *))compare_ppds);
-
- /*
-  * Write the new ppds.dat file...
-  */
-
-  if (changed_ppd)
-  {
-    if ((fp = cupsFileOpen(filename, "wb")) != NULL)
-    {
-      for (i = num_ppds, ppd = ppds; i > 0; i --, ppd ++)
-       cupsFileWrite(fp, (char *)&(ppd->record), sizeof(ppd_rec_t));
-
-      cupsFileClose(fp);
-
-      cupsdLogMessage(L_INFO, "LoadPPDs: Wrote \"%s\", %d PPDs...", filename,
-                num_ppds);
-    }
-    else
-      cupsdLogMessage(L_ERROR, "LoadPPDs: Unable to write \"%s\" - %s", filename,
-                strerror(errno));
-  }
-  else
-    cupsdLogMessage(L_INFO, "LoadPPDs: No new or changed PPDs...");
-
- /*
-  * Create the list of PPDs...
-  */
-
-  PPDs = ippNew();
-
- /*
-  * First the raw driver...
-  */
-
-  ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_NAME,
-               "ppd-name", NULL, "raw");
-  ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
-               "ppd-make", NULL, "Raw");
-  ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
-               "ppd-make-and-model", NULL, "Raw Queue");
-  ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE,
-               "ppd-natural-language", NULL, "en");
-
- /*
-  * Then the PPD files...
-  */
-
-  for (i = num_ppds, ppd = ppds; i > 0; i --, ppd ++)
-  {
-    ippAddSeparator(PPDs);
-
-    ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_NAME,
-                 "ppd-name", NULL, ppd->record.ppd_name);
-    ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
-                 "ppd-make", NULL, ppd->record.ppd_make);
-    ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_TEXT,
-                 "ppd-make-and-model", NULL, ppd->record.ppd_make_and_model);
-    ippAddString(PPDs, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE,
-                 "ppd-natural-language", NULL, ppd->record.ppd_natural_language);
-  }
-
- /*
-  * Free the memory used...
-  */
-
-  if (alloc_ppds)
-  {
-    free(ppds);
-    alloc_ppds = 0;
-  }
-}
-
-
-/*
- * 'compare_names()' - Compare PPD filenames for sorting.
- */
-
-static int                             /* O - Result of comparison */
-compare_names(const ppd_info_t *p0,    /* I - First PPD file */
-              const ppd_info_t *p1)    /* I - Second PPD file */
-{
-  return (strcasecmp(p0->record.ppd_name, p1->record.ppd_name));
-}
-
-
-/*
- * 'compare_ppds()' - Compare PPD file make and model names for sorting.
- */
-
-static int                             /* O - Result of comparison */
-compare_ppds(const ppd_info_t *p0,     /* I - First PPD file */
-             const ppd_info_t *p1)     /* I - Second PPD file */
-{
-  const char   *s,                     /* First name */
-               *t;                     /* Second name */
-  int          diff,                   /* Difference between digits */
-               digits;                 /* Number of digits */
-
-
- /*
-  * First compare manufacturers...
-  */
-
-  if ((diff = strcasecmp(p0->record.ppd_make, p1->record.ppd_make)) != 0)
-    return (diff);
-
- /* 
-  * Then compare names...
-  */
-
-  s = p0->record.ppd_make_and_model;
-  t = p1->record.ppd_make_and_model;
-
- /*
-  * Loop through both nicknames, returning only when a difference is
-  * seen.  Also, compare whole numbers rather than just characters, too!
-  */
-
-  while (*s && *t)
-  {
-    if (isdigit(*s & 255) && isdigit(*t & 255))
-    {
-     /*
-      * Got a number; start by skipping leading 0's...
-      */
-
-      while (*s == '0')
-        s ++;
-      while (*t == '0')
-        t ++;
-
-     /*
-      * Skip equal digits...
-      */
-
-      while (isdigit(*s & 255) && *s == *t)
-      {
-        s ++;
-       t ++;
-      }
-
-     /*
-      * Bounce out if *s and *t aren't both digits...
-      */
-
-      if (isdigit(*s & 255) && !isdigit(*t & 255))
-        return (1);
-      else if (!isdigit(*s & 255) && isdigit(*t & 255))
-        return (-1);
-      else if (!isdigit(*s & 255) || !isdigit(*t & 255))
-        continue;     
-
-      if (*s < *t)
-        diff = -1;
-      else
-        diff = 1;
-
-     /*
-      * Figure out how many more digits there are...
-      */
-
-      digits = 0;
-      s ++;
-      t ++;
-
-      while (isdigit(*s & 255))
-      {
-        digits ++;
-       s ++;
-      }
-
-      while (isdigit(*t & 255))
-      {
-        digits --;
-       t ++;
-      }
-
-     /*
-      * Return if the number or value of the digits is different...
-      */
-
-      if (digits < 0)
-        return (-1);
-      else if (digits > 0)
-        return (1);
-      else if (diff)
-        return (diff);
-    }
-    else if (tolower(*s & 255) < tolower(*t & 255))
-      return (-1);
-    else if (tolower(*s & 255) > tolower(*t & 255))
-      return (1);
-    else
-    {
-      s ++;
-      t ++;
-    }
-  }
-
- /*
-  * Return the results of the final comparison...
-  */
-
-  if (*s)
-    return (1);
-  else if (*t)
-    return (-1);
-  else
-    return (strcasecmp(p0->record.ppd_natural_language,
-                       p1->record.ppd_natural_language));
-}
-
-
-/*
- * 'load_ppds()' - Load PPD files recursively.
- */
-
-static void
-load_ppds(const char *d,               /* I - Actual directory */
-          const char *p)               /* I - Virtual path in name */
-{
-  int          i;                      /* Looping var */
-  cups_file_t  *fp;                    /* Pointer to file */
-  DIR          *dir;                   /* Directory pointer */
-  struct dirent        *dent;                  /* Directory entry */
-  struct stat  fileinfo;               /* File information */
-  char         filename[1024],         /* Name of PPD or directory */
-               line[256],              /* Line from backend */
-               *ptr,                   /* Pointer into name */
-               name[128],              /* Name of PPD file */
-               language[64],           /* PPD language version */
-               country[64],            /* Country code */
-               manufacturer[256],      /* Manufacturer */
-               make_model[256],        /* Make and Model */
-               model_name[256],        /* ModelName */
-               nick_name[256];         /* NickName */
-  ppd_info_t   *ppd,                   /* New PPD file */
-               key;                    /* Search key */
-  int          new_ppd;                /* Is this a new PPD? */
-  struct                               /* LanguageVersion translation table */
-  {
-    const char *version,               /* LanguageVersion string */
-               *language;              /* Language code */
-  }            languages[] =
-  {
-    { "chinese",       "cn" },
-    { "danish",                "da" },
-    { "dutch",         "nl" },
-    { "english",       "en" },
-    { "finnish",       "fi" },
-    { "french",                "fr" },
-    { "german",                "de" },
-    { "greek",         "el" },
-    { "italian",       "it" },
-    { "japanese",      "jp" },
-    { "norwegian",     "no" },
-    { "polish",                "pl" },
-    { "portuguese",    "pt" },
-    { "russian",       "ru" },
-    { "slovak",                "sk" },
-    { "spanish",       "es" },
-    { "swedish",       "sv" },
-    { "turkish",       "tr" }
-  };
-
-
-  if ((dir = opendir(d)) == NULL)
-  {
-    cupsdLogMessage(L_ERROR, "LoadPPDs: Unable to open PPD directory \"%s\": %s",
-               d, strerror(errno));
-    return;
-  }
-
-  while ((dent = readdir(dir)) != NULL)
-  {
-   /*
-    * Skip "." and ".."...
-    */
-
-    if (dent->d_name[0] == '.')
-      continue;
-
-   /*
-    * See if this is a file...
-    */
-
-    snprintf(filename, sizeof(filename), "%s/%s", d, dent->d_name);
-
-    if (p[0])
-      snprintf(name, sizeof(name), "%s/%s", p, dent->d_name);
-    else
-      strlcpy(name, dent->d_name, sizeof(name));
-
-    if (stat(filename, &fileinfo))
-      continue;
-
-    if (S_ISDIR(fileinfo.st_mode))
-    {
-     /*
-      * Do subdirectory...
-      */
-
-      load_ppds(filename, name);
-      continue;
-    }
-
-   /*
-    * See if this file has been scanned before...
-    */
-
-    if (sorted_ppds > 0)
-    {
-      strcpy(key.record.ppd_name, name);
-
-      ppd = bsearch(&key, ppds, sorted_ppds, sizeof(ppd_info_t),
-                    (int (*)(const void *, const void *))compare_names);
-
-      if (ppd &&
-          ppd->record.ppd_size == fileinfo.st_size &&
-         ppd->record.ppd_mtime == fileinfo.st_mtime)
-      {
-        ppd->found = 1;
-        continue;
-      }
-    }
-    else
-      ppd = NULL;
-
-   /*
-    * No, file is new/changed, so re-scan it...
-    */
-
-    if ((fp = cupsFileOpen(filename, "rb")) == NULL)
-      continue;
-
-   /*
-    * Now see if this is a PPD file...
-    */
-
-    line[0] = '\0';
-    cupsFileGets(fp, line, sizeof(line));
-
-    if (strncmp(line, "*PPD-Adobe:", 11) != 0)
-    {
-     /*
-      * Nope, close the file and continue...
-      */
-
-      cupsFileClose(fp);
-
-      continue;
-    }
-
-   /*
-    * Now read until we get the NickName field...
-    */
-
-    model_name[0]   = '\0';
-    nick_name[0]    = '\0';
-    manufacturer[0] = '\0';
-    strcpy(language, "en");
-
-    while (cupsFileGets(fp, line, sizeof(line)) != NULL)
-    {
-      if (strncmp(line, "*Manufacturer:", 14) == 0)
-       sscanf(line, "%*[^\"]\"%255[^\"]", manufacturer);
-      else if (strncmp(line, "*ModelName:", 11) == 0)
-       sscanf(line, "%*[^\"]\"%127[^\"]", model_name);
-      else if (strncmp(line, "*LanguageVersion:", 17) == 0)
-       sscanf(line, "%*[^:]:%63s", language);
-      else if (strncmp(line, "*NickName:", 10) == 0)
-       sscanf(line, "%*[^\"]\"%255[^\"]", nick_name);
-      else if (strncmp(line, "*OpenUI", 7) == 0)
-      {
-       /*
-        * Stop early if we have a NickName or ModelName attributes
-       * before the first OpenUI...
-       */
-
-        if (model_name[0] || nick_name[0])
-         break;
-      }
-
-     /*
-      * Stop early if we have both the Manufacturer and NickName
-      * attributes...
-      */
-
-      if (manufacturer[0] && nick_name[0])
-        break;
-    }
-
-   /*
-    * Close the file...
-    */
-
-    cupsFileClose(fp);
-
-   /*
-    * See if we got all of the required info...
-    */
-
-    if (nick_name[0])
-      strcpy(make_model, nick_name);
-    else
-      strcpy(make_model, model_name);
-
-    while (isspace(make_model[0] & 255))
-      cups_strcpy(make_model, make_model + 1);
-
-    if (!make_model[0])
-      continue;        /* Nope... */
-
-   /*
-    * See if we got a manufacturer...
-    */
-
-    while (isspace(manufacturer[0] & 255))
-      cups_strcpy(manufacturer, manufacturer + 1);
-
-    if (!manufacturer[0] || strcmp(manufacturer, "ESP") == 0)
-    {
-     /*
-      * Nope, copy the first part of the make and model then...
-      */
-
-      strlcpy(manufacturer, make_model, sizeof(manufacturer));
-
-     /*
-      * Truncate at the first space, dash, or slash, or make the
-      * manufacturer "Other"...
-      */
-
-      for (ptr = manufacturer; *ptr; ptr ++)
-       if (*ptr == ' ' || *ptr == '-' || *ptr == '/')
-         break;
-
-      if (*ptr && ptr > manufacturer)
-       *ptr = '\0';
-      else if (strncasecmp(manufacturer, "agfa", 4) == 0)
-       strcpy(manufacturer, "AGFA");
-      else if (strncasecmp(manufacturer, "herk", 4) == 0 ||
-               strncasecmp(manufacturer, "linotype", 8) == 0)
-       strcpy(manufacturer, "LHAG");
-      else
-       strcpy(manufacturer, "Other");
-
-     /*
-      * Hack for various vendors...
-      */
-
-      if (strcasecmp(manufacturer, "XPrint") == 0)
-       strcpy(manufacturer, "Xerox");
-      else if (strcasecmp(manufacturer, "Eastman") == 0)
-       strcpy(manufacturer, "Kodak");
-      else if (strcasecmp(manufacturer, "laserwriter") == 0)
-       strcpy(manufacturer, "Apple");
-      else if (strcasecmp(manufacturer, "colorpoint") == 0)
-       strcpy(manufacturer, "Seiko");
-      else if (strcasecmp(manufacturer, "fiery") == 0)
-       strcpy(manufacturer, "EFI");
-      else if (strcasecmp(manufacturer, "ps") == 0 ||
-               strcasecmp(manufacturer, "colorpass") == 0)
-       strcpy(manufacturer, "Canon");
-      else if (strncasecmp(manufacturer, "primera", 7) == 0)
-       strcpy(manufacturer, "Fargo");
-      else if (strcasecmp(manufacturer, "designjet") == 0)
-       strcpy(manufacturer, "HP");
-    }
-    else if (strncasecmp(manufacturer, "LHAG", 4) == 0 ||
-             strncasecmp(manufacturer, "linotype", 8) == 0)
-      strcpy(manufacturer, "LHAG");
-
-   /*
-    * Fix the language as needed...
-    */
-
-    if ((ptr = strchr(language, '-')) != NULL)
-      *ptr++ = '\0';
-    else if ((ptr = strchr(language, '_')) != NULL)
-      *ptr++ = '\0';
-
-    if (ptr)
-    {
-     /*
-      * Setup the country suffix...
-      */
-
-      country[0] = '_';
-      cups_strcpy(country + 1, ptr);
-    }
-    else
-    {
-     /*
-      * No country suffix...
-      */
-
-      country[0] = '\0';
-    }
-
-    for (i = 0; i < (int)(sizeof(languages) / sizeof(languages[0])); i ++)
-      if (strcasecmp(languages[i].version, language) == 0)
-        break;
-
-    if (i < (int)(sizeof(languages) / sizeof(languages[0])))
-    {
-     /*
-      * Found a known language...
-      */
-
-      snprintf(language, sizeof(language), "%s%s", languages[i].language, 
-               country);
-    }
-    else
-    {
-     /*
-      * Unknown language; use "xx"...
-      */
-
-      strcpy(language, "xx");
-    }
-
-   /*
-    * Add the PPD file...
-    */
-
-    new_ppd = !ppd;
-
-    if (new_ppd)
-    {
-     /*
-      * Allocate memory for the new PPD file...
-      */
-
-      cupsdLogMessage(L_DEBUG, "LoadPPDs: Adding ppd \"%s\"...", name);
-
-      if (num_ppds >= alloc_ppds)
-      {
-       /*
-       * Allocate (more) memory for the PPD files...
-       */
-
-       if (alloc_ppds == 0)
-          ppd = malloc(sizeof(ppd_info_t) * 32);
-       else
-          ppd = realloc(ppds, sizeof(ppd_info_t) * (alloc_ppds + 32));
-
-       if (ppd == NULL)
-       {
-          cupsdLogMessage(L_ERROR, "load_ppds: Ran out of memory for %d PPD files!",
-                    alloc_ppds + 32);
-          closedir(dir);
-         return;
-       }
-
-       ppds = ppd;
-       alloc_ppds += 32;
-      }
-
-      ppd = ppds + num_ppds;
-      num_ppds ++;
-    }
-    else
-      cupsdLogMessage(L_DEBUG, "LoadPPDs: Updating ppd \"%s\"...", name);
-
-   /*
-    * Zero the PPD record and copy the info over...
-    */
-
-    memset(ppd, 0, sizeof(ppd_info_t));
-
-    ppd->found            = 1;
-    ppd->record.ppd_mtime = fileinfo.st_mtime;
-    ppd->record.ppd_size  = fileinfo.st_size;
-
-    strlcpy(ppd->record.ppd_name, name,
-            sizeof(ppd->record.ppd_name));
-    strlcpy(ppd->record.ppd_make, manufacturer,
-            sizeof(ppd->record.ppd_make));
-    strlcpy(ppd->record.ppd_make_and_model, make_model,
-            sizeof(ppd->record.ppd_make_and_model));
-    strlcpy(ppd->record.ppd_natural_language, language,
-            sizeof(ppd->record.ppd_natural_language));
-
-    changed_ppd = 1;
-  }
-
-  closedir(dir);
-}
-
-
-/*
- * End of "$Id$".
- */
index 7bb07d4f7a5e884520b592dbfcf363a0caa72d3a..1ffe665be18ea696011ee6aad40ea0e0b2e3ce9b 100644 (file)
  *   cupsdSetPrinterAttrs()      - Set printer attributes based upon the PPD file.
  *   cupsdSetPrinterReasons()    - Set/update the reasons strings.
  *   cupsdSetPrinterState()      - Update the current state of a printer.
- *   SortPrinters()         - Sort the printer list when a printer name is
- *                            changed.
  *   cupsdStopPrinter()          - Stop a printer from printing any jobs...
  *   cupsdValidateDest()         - Validate a printer/class destination.
  *   cupsdWritePrintcap()        - Write a pseudo-printcap file for older
- *                            applications that need it...
- *   cupsdSanitizeURI()     - Sanitize a device URI...
- *   write_irix_config()    - Update the config files used by the IRIX
- *                            desktop tools.
- *   write_irix_state()     - Update the status files used by IRIX printing
- *                            desktop tools.
+ *                                 applications that need it...
+ *   cupsdSanitizeURI()          - Sanitize a device URI...
+ *   compare_printers()          - Compare two printers.
+ *   write_irix_config()         - Update the config files used by the IRIX
+ *                                 desktop tools.
+ *   write_irix_state()          - Update the status files used by IRIX printing
+ *                                 desktop tools.
  */
 
 /*
@@ -82,10 +81,7 @@ cupsdAddPrinter(const char *name)    /* I - Name of printer */
   * Range check input...
   */
 
-  cupsdLogMessage(L_DEBUG2, "cupsdAddPrinter(\"%s\")", name ? name : "(null)");
-
-  if (name == NULL)
-    return (NULL);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddPrinter(\"%s\")", name);
 
  /*
   * Create a new printer entity...
@@ -93,8 +89,8 @@ cupsdAddPrinter(const char *name)     /* I - Name of printer */
 
   if ((p = calloc(1, sizeof(cupsd_printer_t))) == NULL)
   {
-    cupsdLogMessage(L_CRIT, "Unable to allocate memory for printer - %s",
-               strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_CRIT, "Unable to allocate memory for printer - %s",
+                    strerror(errno));
     return (NULL);
   }
 
@@ -110,8 +106,8 @@ cupsdAddPrinter(const char *name)   /* I - Name of printer */
   p->shared    = 1;
   p->filetype  = mimeAddType(MimeDatabase, "printer", name);
 
-  cupsdSetString(&p->cupsd_job_sheets[0], "none");
-  cupsdSetString(&p->cupsd_job_sheets[1], "none");
+  cupsdSetString(&p->job_sheets[0], "none");
+  cupsdSetString(&p->job_sheets[1], "none");
 
   cupsdSetString(&p->error_policy, "stop-printer");
   cupsdSetString(&p->op_policy, DefaultPolicy);
@@ -149,8 +145,9 @@ cupsdAddPrinter(const char *name)   /* I - Name of printer */
  */
 
 void
-cupsdAddPrinterFilter(cupsd_printer_t  *p,             /* I - Printer to add to */
-                 const char *filter)   /* I - Filter to add */
+cupsdAddPrinterFilter(
+    cupsd_printer_t  *p,               /* I - Printer to add to */
+    const char       *filter)          /* I - Filter to add */
 {
   int          i;                      /* Looping var */
   char         super[MIME_MAX_SUPER],  /* Super-type for filter */
@@ -175,8 +172,9 @@ cupsdAddPrinterFilter(cupsd_printer_t  *p,          /* I - Printer to add to */
 
   if (sscanf(filter, "%15[^/]/%31s%d%1023s", super, type, &cost, program) != 4)
   {
-    cupsdLogMessage(L_ERROR, "cupsdAddPrinterFilter: Invalid filter string \"%s\"!",
-               filter);
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdAddPrinterFilter: Invalid filter string \"%s\"!",
+                    filter);
     return;
   }
 
@@ -191,10 +189,10 @@ cupsdAddPrinterFilter(cupsd_printer_t  *p,                /* I - Printer to add to */
          !strcasecmp((*temptype)->super, super)) &&
         (type[0] == '*' || !strcasecmp((*temptype)->type, type)))
     {
-      cupsdLogMessage(L_DEBUG2, "Adding filter %s/%s %s/%s %d %s",
-                 (*temptype)->super, (*temptype)->type,
-                p->filetype->super, p->filetype->type,
-                 cost, program);
+      cupsdLogMessage(CUPSD_LOG_DEBUG2, "Adding filter %s/%s %s/%s %d %s",
+                      (*temptype)->super, (*temptype)->type,
+                     p->filetype->super, p->filetype->type,
+                      cost, program);
       mimeAddFilter(MimeDatabase, *temptype, p->filetype, cost, program);
     }
 }
@@ -205,7 +203,8 @@ cupsdAddPrinterFilter(cupsd_printer_t  *p,          /* I - Printer to add to */
  */
 
 void
-cupsdAddPrinterHistory(cupsd_printer_t *p)             /* I - Printer */
+cupsdAddPrinterHistory(
+    cupsd_printer_t *p)                        /* I - Printer */
 {
   ipp_t        *history;                       /* History collection */
 
@@ -265,8 +264,9 @@ cupsdAddPrinterHistory(cupsd_printer_t *p)          /* I - Printer */
  */
 
 void
-cupsdAddPrinterUser(cupsd_printer_t  *p,               /* I - Printer */
-               const char *username)   /* I - User */
+cupsdAddPrinterUser(
+    cupsd_printer_t *p,                        /* I - Printer */
+    const char      *username)         /* I - User */
 {
   const char   **temp;                 /* Temporary array pointer */
 
@@ -297,9 +297,9 @@ cupsdAddPrinterUser(cupsd_printer_t  *p,            /* I - Printer */
 void
 cupsdCreateCommonData(void)
 {
-  int          i;                      /* Looping var */
-  ipp_attribute_t *attr;               /* Attribute data */
-  cupsd_printer_t      *p;                     /* Current printer */
+  int                  i;              /* Looping var */
+  ipp_attribute_t      *attr;          /* Attribute data */
+  cupsd_printer_t      *p;             /* Current printer */
   static const int nups[] =            /* number-up-supported values */
                { 1, 2, 4, 6, 9, 16 };
   static const ipp_orient_t orients[4] =/* orientation-requested-supported values */
@@ -474,9 +474,9 @@ cupsdCreateCommonData(void)
                           "job-sheets-supported", NumBanners + 1, NULL, NULL);
 
     if (attr == NULL)
-      cupsdLogMessage(L_EMERG, "cupsdSetPrinterAttrs: Unable to allocate memory for "
-                          "job-sheets-supported attribute: %s!",
-                strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_EMERG,
+                      "cupsdSetPrinterAttrs: Unable to allocate memory for "
+                      "job-sheets-supported attribute: %s!", strerror(errno));
     else if (!Classification || ClassifyOverride)
     {
       attr->values[0].string.text = strdup("none");
@@ -508,7 +508,7 @@ cupsdCreateCommonData(void)
 void
 cupsdDeleteAllPrinters(void)
 {
-  cupsd_printer_t      *p;     /* Pointer to current printer/class */
+  cupsd_printer_t      *p;             /* Pointer to current printer/class */
 
 
   for (p = (cupsd_printer_t *)cupsArrayFirst(Printers);
@@ -524,8 +524,9 @@ cupsdDeleteAllPrinters(void)
  */
 
 void
-cupsdDeletePrinter(cupsd_printer_t *p,         /* I - Printer to delete */
-             int       update)         /* I - Update printers.conf? */
+cupsdDeletePrinter(
+    cupsd_printer_t *p,                        /* I - Printer to delete */
+    int             update)            /* I - Update printers.conf? */
 {
   int          i;                      /* Looping var */
 #ifdef __sgi
@@ -634,8 +635,8 @@ cupsdDeletePrinter(cupsd_printer_t *p,              /* I - Printer to delete */
   cupsdClearString(&p->location);
   cupsdClearString(&p->make_model);
   cupsdClearString(&p->info);
-  cupsdClearString(&p->cupsd_job_sheets[0]);
-  cupsdClearString(&p->cupsd_job_sheets[1]);
+  cupsdClearString(&p->job_sheets[0]);
+  cupsdClearString(&p->job_sheets[1]);
   cupsdClearString(&p->device_uri);
   cupsdClearString(&p->port_monitor);
   cupsdClearString(&p->op_policy);
@@ -656,7 +657,8 @@ cupsdDeletePrinter(cupsd_printer_t *p,              /* I - Printer to delete */
  */
 
 void
-cupsdDeletePrinterFilters(cupsd_printer_t *p)  /* I - Printer to remove from */
+cupsdDeletePrinterFilters(
+    cupsd_printer_t *p)                        /* I - Printer to remove from */
 {
   int          i;                      /* Looping var */
   mime_filter_t        *filter;                /* MIME filter looping var */
@@ -698,7 +700,7 @@ cupsdDeletePrinterFilters(cupsd_printer_t *p)       /* I - Printer to remove from */
  */
 
 cupsd_printer_t *                      /* O - Destination in list */
-cupsdFindDest(const char *name)        /* I - Name of printer or class to find */
+cupsdFindDest(const char *name)                /* I - Name of printer or class to find */
 {
   cupsd_printer_t      key;            /* Search key */
 
@@ -730,9 +732,10 @@ cupsdFindPrinter(const char *name) /* I - Name of printer to find */
  */
 
 void
-cupsdFreePrinterUsers(cupsd_printer_t *p)      /* I - Printer */
+cupsdFreePrinterUsers(
+    cupsd_printer_t *p)                        /* I - Printer */
 {
-  int  i;                      /* Looping var */
+  int  i;                              /* Looping var */
 
 
   if (!p || !p->num_users)
@@ -755,12 +758,12 @@ cupsdFreePrinterUsers(cupsd_printer_t *p) /* I - Printer */
 void
 cupsdLoadAllPrinters(void)
 {
-  cups_file_t  *fp;                    /* printers.conf file */
-  int          linenum;                /* Current line number */
-  char         line[1024],             /* Line from file */
-               *value,                 /* Pointer to value */
-               *valueptr;              /* Pointer into value */
-  cupsd_printer_t      *p;                     /* Current printer */
+  cups_file_t          *fp;            /* printers.conf file */
+  int                  linenum;        /* Current line number */
+  char                 line[1024],     /* Line from file */
+                       *value,         /* Pointer to value */
+                       *valueptr;      /* Pointer into value */
+  cupsd_printer_t      *p;             /* Current printer */
 
 
  /*
@@ -770,8 +773,9 @@ cupsdLoadAllPrinters(void)
   snprintf(line, sizeof(line), "%s/printers.conf", ServerRoot);
   if ((fp = cupsFileOpen(line, "r")) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "cupsdLoadAllPrinters: Unable to open %s - %s", line,
-               strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdLoadAllPrinters: Unable to open %s - %s", line,
+                    strerror(errno));
     return;
   }
 
@@ -801,7 +805,8 @@ cupsdLoadAllPrinters(void)
         * Add the printer and a base file type...
        */
 
-        cupsdLogMessage(L_DEBUG, "cupsdLoadAllPrinters: Loading printer %s...", value);
+        cupsdLogMessage(CUPSD_LOG_DEBUG,
+                       "cupsdLoadAllPrinters: Loading printer %s...", value);
 
         p = cupsdAddPrinter(value);
        p->accepting = 1;
@@ -816,8 +821,8 @@ cupsdLoadAllPrinters(void)
       }
       else
       {
-        cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
         return;
       }
     }
@@ -861,15 +866,15 @@ cupsdLoadAllPrinters(void)
       }
       else
       {
-        cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
         return;
       }
     }
     else if (!p)
     {
-      cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                linenum);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Syntax error on line %d of printers.conf.", linenum);
       return;
     }
     else if (!strcasecmp(line, "Info"))
@@ -888,8 +893,8 @@ cupsdLoadAllPrinters(void)
        cupsdSetString(&p->device_uri, value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
        return;
       }
     }
@@ -901,8 +906,8 @@ cupsdLoadAllPrinters(void)
         cupsdClearString(&p->port_monitor);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
        return;
       }
     }
@@ -918,8 +923,8 @@ cupsdLoadAllPrinters(void)
         p->state = IPP_PRINTER_STOPPED;
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
        return;
       }
     }
@@ -950,8 +955,8 @@ cupsdLoadAllPrinters(void)
         p->accepting = 0;
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
        return;
       }
     }
@@ -973,8 +978,8 @@ cupsdLoadAllPrinters(void)
         p->shared = 0;
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
        return;
       }
     }
@@ -991,7 +996,7 @@ cupsdLoadAllPrinters(void)
        if (*valueptr)
           *valueptr++ = '\0';
 
-       cupsdSetString(&p->cupsd_job_sheets[0], value);
+       cupsdSetString(&p->job_sheets[0], value);
 
        while (isspace(*valueptr & 255))
           valueptr ++;
@@ -1003,13 +1008,13 @@ cupsdLoadAllPrinters(void)
          if (*valueptr)
             *valueptr++ = '\0';
 
-         cupsdSetString(&p->cupsd_job_sheets[1], value);
+         cupsdSetString(&p->job_sheets[1], value);
        }
       }
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
        return;
       }
     }
@@ -1022,8 +1027,8 @@ cupsdLoadAllPrinters(void)
       }
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
        return;
       }
     }
@@ -1036,8 +1041,8 @@ cupsdLoadAllPrinters(void)
       }
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
        return;
       }
     }
@@ -1047,8 +1052,8 @@ cupsdLoadAllPrinters(void)
         p->quota_period = atoi(value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
        return;
       }
     }
@@ -1058,8 +1063,8 @@ cupsdLoadAllPrinters(void)
         p->page_limit = atoi(value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
        return;
       }
     }
@@ -1069,8 +1074,8 @@ cupsdLoadAllPrinters(void)
         p->k_limit = atoi(value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
        return;
       }
     }
@@ -1080,8 +1085,8 @@ cupsdLoadAllPrinters(void)
         cupsdSetString(&p->op_policy, value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
        return;
       }
     }
@@ -1091,8 +1096,8 @@ cupsdLoadAllPrinters(void)
         cupsdSetString(&p->error_policy, value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of printers.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of printers.conf.", linenum);
        return;
       }
     }
@@ -1102,8 +1107,9 @@ cupsdLoadAllPrinters(void)
       * Something else we don't understand...
       */
 
-      cupsdLogMessage(L_ERROR, "Unknown configuration directive %s on line %d of printers.conf.",
-                line, linenum);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Unknown configuration directive %s on line %d of printers.conf.",
+                     line, linenum);
     }
   }
 
@@ -1119,13 +1125,13 @@ cupsdLoadAllPrinters(void)
 void
 cupsdSaveAllPrinters(void)
 {
-  int          i;                      /* Looping var */
-  cups_file_t  *fp;                    /* printers.conf file */
-  char         temp[1024];             /* Temporary string */
-  char         backup[1024];           /* printers.conf.O file */
-  cupsd_printer_t      *printer;               /* Current printer class */
-  time_t       curtime;                /* Current time */
-  struct tm    *curdate;               /* Current date */
+  int                  i;              /* Looping var */
+  cups_file_t          *fp;            /* printers.conf file */
+  char                 temp[1024];     /* Temporary string */
+  char                 backup[1024];   /* printers.conf.O file */
+  cupsd_printer_t      *printer;       /* Current printer class */
+  time_t               curtime;        /* Current time */
+  struct tm            *curdate;       /* Current date */
 
 
  /*
@@ -1136,18 +1142,21 @@ cupsdSaveAllPrinters(void)
   snprintf(backup, sizeof(backup), "%s/printers.conf.O", ServerRoot);
 
   if (rename(temp, backup))
-    cupsdLogMessage(L_ERROR, "Unable to backup printers.conf - %s", strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "Unable to backup printers.conf - %s", strerror(errno));
 
   if ((fp = cupsFileOpen(temp, "w")) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "Unable to save printers.conf - %s", strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "Unable to save printers.conf - %s", strerror(errno));
 
     if (rename(backup, temp))
-      cupsdLogMessage(L_ERROR, "Unable to restore printers.conf - %s", strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Unable to restore printers.conf - %s", strerror(errno));
     return;
   }
   else
-    cupsdLogMessage(L_INFO, "Saving printers.conf...");
+    cupsdLogMessage(CUPSD_LOG_INFO, "Saving printers.conf...");
 
  /*
   * Restrict access to the file...
@@ -1223,8 +1232,8 @@ cupsdSaveAllPrinters(void)
     else
       cupsFilePuts(fp, "Shared No\n");
 
-    cupsFilePrintf(fp, "JobSheets %s %s\n", printer->cupsd_job_sheets[0],
-            printer->cupsd_job_sheets[1]);
+    cupsFilePrintf(fp, "JobSheets %s %s\n", printer->job_sheets[0],
+            printer->job_sheets[1]);
 
     cupsFilePrintf(fp, "QuotaPeriod %d\n", printer->quota_period);
     cupsFilePrintf(fp, "PageLimit %d\n", printer->page_limit);
@@ -1259,27 +1268,30 @@ cupsdSaveAllPrinters(void)
  */
 
 void
-cupsdSetPrinterAttrs(cupsd_printer_t *p)               /* I - Printer to setup */
+cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
 {
-  char         uri[HTTP_MAX_URI];      /* URI for printer */
-  char         resource[HTTP_MAX_URI]; /* Resource portion of URI */
-  int          i;                      /* Looping var */
-  char         filename[1024];         /* Name of PPD file */
-  int          num_media;              /* Number of media options */
-  cupsd_location_t     *auth;                  /* Pointer to authentication element */
-  const char   *auth_supported;        /* Authentication supported */
-  cups_ptype_t cupsd_printer_type;             /* Printer type data */
-  ppd_file_t   *ppd;                   /* PPD file data */
-  ppd_option_t *input_slot,            /* InputSlot options */
-               *media_type,            /* MediaType options */
-               *page_size,             /* PageSize options */
-               *output_bin,            /* OutputBin options */
-               *media_quality;         /* EFMediaQualityMode options */
-  ppd_attr_t   *ppdattr;               /* PPD attribute */
-  ipp_attribute_t *attr;               /* Attribute data */
-  ipp_value_t  *val;                   /* Attribute value */
-  int          num_finishings;
-  ipp_finish_t finishings[5];          /* finishings-supported values */
+  char                 uri[HTTP_MAX_URI];
+                                       /* URI for printer */
+  char                 resource[HTTP_MAX_URI];
+                                       /* Resource portion of URI */
+  int                  i;              /* Looping var */
+  char                 filename[1024]; /* Name of PPD file */
+  int                  num_media;      /* Number of media options */
+  cupsd_location_t     *auth;          /* Pointer to authentication element */
+  const char           *auth_supported;/* Authentication supported */
+  cups_ptype_t         cupsd_printer_type;
+                                       /* Printer type data */
+  ppd_file_t           *ppd;           /* PPD file data */
+  ppd_option_t         *input_slot,    /* InputSlot options */
+                       *media_type,    /* MediaType options */
+                       *page_size,     /* PageSize options */
+                       *output_bin,    /* OutputBin options */
+                       *media_quality; /* EFMediaQualityMode options */
+  ppd_attr_t           *ppdattr;       /* PPD attribute */
+  ipp_attribute_t      *attr;          /* Attribute data */
+  ipp_value_t          *val;           /* Attribute value */
+  int                  num_finishings; /* Number of finishings */
+  ipp_finish_t         finishings[5];  /* finishings-supported values */
   static const char * const sides[3] = /* sides-supported values */
                {
                  "one",
@@ -1388,9 +1400,9 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)          /* I - Printer to setup */
     if (attr != NULL)
     {
       attr->values[0].string.text = strdup(Classification ?
-                                          Classification : p->cupsd_job_sheets[0]);
+                                          Classification : p->job_sheets[0]);
       attr->values[1].string.text = strdup(Classification ?
-                                          Classification : p->cupsd_job_sheets[1]);
+                                          Classification : p->job_sheets[1]);
     }
   }
 
@@ -1555,7 +1567,7 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)          /* I - Printer to setup */
 
         if (num_media == 0)
        {
-         cupsdLogMessage(L_CRIT, "cupsdSetPrinterAttrs: The PPD file for printer %s "
+         cupsdLogMessage(CUPSD_LOG_CRIT, "cupsdSetPrinterAttrs: The PPD file for printer %s "
                             "contains no media options and is therefore "
                             "invalid!", p->name);
        }
@@ -1739,15 +1751,15 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)                /* I - Printer to setup */
 
         pstatus = ppdLastError(&pline);
 
-       cupsdLogMessage(L_ERROR, "PPD file for %s cannot be loaded!", p->name);
+       cupsdLogMessage(CUPSD_LOG_ERROR, "PPD file for %s cannot be loaded!", p->name);
 
        if (pstatus <= PPD_ALLOC_ERROR)
-         cupsdLogMessage(L_ERROR, "%s", strerror(errno));
+         cupsdLogMessage(CUPSD_LOG_ERROR, "%s", strerror(errno));
         else
-         cupsdLogMessage(L_ERROR, "%s on line %d.", ppdErrorString(pstatus),
+         cupsdLogMessage(CUPSD_LOG_ERROR, "%s on line %d.", ppdErrorString(pstatus),
                     pline);
 
-        cupsdLogMessage(L_INFO, "Hint: Run \"cupstestppd %s\" and fix any errors.",
+        cupsdLogMessage(CUPSD_LOG_INFO, "Hint: Run \"cupstestppd %s\" and fix any errors.",
                   filename);
 
        /*
@@ -1868,8 +1880,9 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)          /* I - Printer to setup */
  */
 
 void
-cupsdSetPrinterReasons(cupsd_printer_t  *p,    /* I - Printer */
-                  const char *s)       /* I - Reasons strings */
+cupsdSetPrinterReasons(
+    cupsd_printer_t  *p,               /* I - Printer */
+    const char *s)                     /* I - Reasons strings */
 {
   int          i;                      /* Looping var */
   const char   *sptr;                  /* Pointer into reasons */
@@ -1969,9 +1982,10 @@ cupsdSetPrinterReasons(cupsd_printer_t  *p,      /* I - Printer */
  */
 
 void
-cupsdSetPrinterState(cupsd_printer_t    *p,    /* I - Printer to change */
-                ipp_pstate_t s,                /* I - New state */
-               int          update)    /* I - Update printers.conf? */
+cupsdSetPrinterState(
+    cupsd_printer_t *p,                        /* I - Printer to change */
+    ipp_pstate_t    s,                 /* I - New state */
+    int             update)            /* I - Update printers.conf? */
 {
   ipp_pstate_t old_state;              /* Old printer state */
 
@@ -2028,10 +2042,10 @@ cupsdSetPrinterState(cupsd_printer_t    *p,     /* I - Printer to change */
  */
 
 void
-cupsdStopPrinter(cupsd_printer_t *p,           /* I - Printer to stop */
-            int       update)          /* I - Update printers.conf? */
+cupsdStopPrinter(cupsd_printer_t *p,   /* I - Printer to stop */
+                 int             update)/* I - Update printers.conf? */
 {
-  cupsd_job_t  *job;                           /* Active print job */
+  cupsd_job_t  *job;                   /* Active print job */
 
 
  /*
@@ -2074,15 +2088,16 @@ cupsdStopPrinter(cupsd_printer_t *p,            /* I - Printer to stop */
  */
 
 const char *                           /* O - Printer or class name */
-cupsdValidateDest(const char   *hostname,      /* I - Host name */
-             const char   *resource,   /* I - Resource name */
-             cups_ptype_t *dtype,      /* O - Type (printer or class) */
-            cupsd_printer_t    **printer)      /* O - Printer pointer */
+cupsdValidateDest(
+    const char      *hostname,         /* I - Host name */
+    const char      *resource,         /* I - Resource name */
+    cups_ptype_t    *dtype,            /* O - Type (printer or class) */
+    cupsd_printer_t **printer)         /* O - Printer pointer */
 {
-  cupsd_printer_t      *p;                     /* Current printer */
-  char         localname[1024],        /* Localized hostname */
-               *lptr,                  /* Pointer into localized hostname */
-               *sptr;                  /* Pointer into server name */
+  cupsd_printer_t      *p;             /* Current printer */
+  char                 localname[1024],/* Localized hostname */
+                       *lptr,          /* Pointer into localized hostname */
+                       *sptr;          /* Pointer into server name */
 
 
   DEBUG_printf(("cupsdValidateDest(\"%s\", \"%s\", %p, %p)\n", hostname, resource,
@@ -2207,13 +2222,13 @@ cupsdValidateDest(const char   *hostname,       /* I - Host name */
 
 /*
  * 'cupsdWritePrintcap()' - Write a pseudo-printcap file for older applications
- *                     that need it...
+ *                          that need it...
  */
 
 void
 cupsdWritePrintcap(void)
 {
-  cups_file_t  *fp;            /* printcap file */
+  cups_file_t          *fp;            /* printcap file */
   cupsd_printer_t      *p;             /* Current printer */
 
 
@@ -2248,7 +2263,7 @@ cupsdWritePrintcap(void)
 
   cupsFilePuts(fp, "# This file was automatically generated by cupsd(8) from the\n");
   cupsFilePrintf(fp, "# %s/printers.conf file.  All changes to this file\n",
-          ServerRoot);
+                 ServerRoot);
   cupsFilePuts(fp, "# will be lost.\n");
 
   if (Printers)
@@ -2421,7 +2436,7 @@ compare_printers(void *first,             /* I - First printer */
  */
 
 static void
-write_irix_config(cupsd_printer_t *p)          /* I - Printer to update */
+write_irix_config(cupsd_printer_t *p)  /* I - Printer to update */
 {
   char         filename[1024];         /* Interface script filename */
   cups_file_t  *fp;                    /* Interface script file */
@@ -2547,7 +2562,7 @@ write_irix_config(cupsd_printer_t *p)             /* I - Printer to update */
  */
 
 static void
-write_irix_state(cupsd_printer_t *p)           /* I - Printer to update */
+write_irix_state(cupsd_printer_t *p)   /* I - Printer to update */
 {
   char         filename[1024];         /* Interface script filename */
   cups_file_t  *fp;                    /* Interface script file */
index cc2eb00ec6d09fb4c1efcbffede28d0e37ed578e..523e7ebd60823f4b50c000f653167b50b7b00ec4 100644 (file)
 
 typedef struct
 {
-  char         username[33];   /* User data */
-  time_t       next_update;    /* Next update time */
-  int          page_count,     /* Count of pages */
-               k_count;        /* Count of kilobytes */
+  char         username[33];           /* User data */
+  time_t       next_update;            /* Next update time */
+  int          page_count,             /* Count of pages */
+               k_count;                /* Count of kilobytes */
 } cupsd_quota_t;
 
 
@@ -57,7 +57,7 @@ typedef struct cupsd_printer_s
   int          num_reasons;            /* Number of printer-state-reasons */
   char         *reasons[16];           /* printer-state-reasons strings */
   time_t       state_time;             /* Time at this state */
-  char         *cupsd_job_sheets[2];           /* Banners/job sheets */
+  char         *job_sheets[2];         /* Banners/job sheets */
   cups_ptype_t type;                   /* Printer type (color, small, etc.) */
   time_t       browse_time;            /* Last time update was sent/received */
   char         *device_uri;            /* Device URI */
@@ -68,7 +68,7 @@ typedef struct cupsd_printer_s
   ipp_t                *attrs;                 /* Attributes supported by this printer */
   int          num_printers,           /* Number of printers in class */
                last_printer;           /* Last printer job was sent to */
-  struct cupsd_printer_s **printers;           /* Printers in class */
+  struct cupsd_printer_s **printers;   /* Printers in class */
   int          quota_period,           /* Period for quotas */
                page_limit,             /* Maximum number of pages */
                k_limit,                /* Maximum number of kilobytes */
@@ -91,7 +91,7 @@ VAR ipp_t             *CommonData     VALUE(NULL);
                                        /* Common printer object attrs */
 VAR cups_array_t       *Printers       VALUE(NULL);
                                        /* Printer list */
-VAR cupsd_printer_t            *DefaultPrinter VALUE(NULL);
+VAR cupsd_printer_t    *DefaultPrinter VALUE(NULL);
                                        /* Default printer */
 VAR char               *DefaultPolicy  VALUE(NULL);
                                        /* Default policy name */
@@ -108,14 +108,14 @@ extern cupsd_printer_t    *cupsdAddPrinter(const char *name);
 extern void            cupsdAddPrinterFilter(cupsd_printer_t *p, const char *filter);
 extern void            cupsdAddPrinterHistory(cupsd_printer_t *p);
 extern void            cupsdAddPrinterUser(cupsd_printer_t *p, const char *username);
-extern cupsd_quota_t           *cupsdAddQuota(cupsd_printer_t *p, const char *username);
+extern cupsd_quota_t   *cupsdAddQuota(cupsd_printer_t *p, const char *username);
 extern void            cupsdCreateCommonData(void);
 extern void            cupsdDeleteAllPrinters(void);
 extern void            cupsdDeletePrinter(cupsd_printer_t *p, int update);
 extern void            cupsdDeletePrinterFilters(cupsd_printer_t *p);
 extern cupsd_printer_t *cupsdFindDest(const char *name);
 extern cupsd_printer_t *cupsdFindPrinter(const char *name);
-extern cupsd_quota_t           *cupsdFindQuota(cupsd_printer_t *p, const char *username);
+extern cupsd_quota_t   *cupsdFindQuota(cupsd_printer_t *p, const char *username);
 extern void            cupsdFreePrinterUsers(cupsd_printer_t *p);
 extern void            cupsdFreeQuotas(cupsd_printer_t *p);
 extern void            cupsdLoadAllPrinters(void);
@@ -125,12 +125,12 @@ extern void               cupsdSetPrinterReasons(cupsd_printer_t *p, const char *s);
 extern void            cupsdSetPrinterState(cupsd_printer_t *p, ipp_pstate_t s, int update);
 #define                        cupsdStartPrinter(p,u) cupsdSetPrinterState((p), IPP_PRINTER_IDLE, (u))
 extern void            cupsdStopPrinter(cupsd_printer_t *p, int update);
-extern cupsd_quota_t           *cupsdUpdateQuota(cupsd_printer_t *p, const char *username,
-                                    int pages, int k);
+extern cupsd_quota_t   *cupsdUpdateQuota(cupsd_printer_t *p, const char *username,
+                                         int pages, int k);
 extern const char      *cupsdValidateDest(const char *hostname,
-                                     const char *resource,
-                                     cups_ptype_t *dtype,
-                                     cupsd_printer_t **printer);
+                                          const char *resource,
+                                          cups_ptype_t *dtype,
+                                          cupsd_printer_t **printer);
 extern void            cupsdWritePrintcap(void);
 
 extern char            *cupsdSanitizeURI(const char *uri, char *buffer,
index 38f6a41f985b9ebe6af12299fc3f724a42cb6163..e94d0ddb288558fa636b8e95d2796560c41a2399 100644 (file)
@@ -71,8 +71,9 @@ cupsdStartProcess(
 #endif /* HAVE_SIGACTION && !HAVE_SIGSET */
 
 
-  cupsdLogMessage(L_DEBUG2, "cupsdStartProcess(\"%s\", %p, %p, %d, %d, %d)",
-             command, argv, envp, infd, outfd, errfd);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdStartProcess(\"%s\", %p, %p, %d, %d, %d)",
+                  command, argv, envp, infd, outfd, errfd);
 
  /*
   * Block signals before forking...
@@ -206,7 +207,8 @@ cupsdStartProcess(
     * Error - couldn't fork a new process!
     */
 
-    cupsdLogMessage(L_ERROR, "Unable to fork %s - %s.", command, strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to fork %s - %s.", command,
+                    strerror(errno));
 
     *pid = 0;
   }
index ffb457ce855bb3b56f85451be1244960857d0c13..0baf61d1825dc045a4baadbb1d493bf8618dcf89 100644 (file)
@@ -27,7 +27,7 @@
  *   cupsdFindQuota()   - Find a quota record.
  *   cupsdFreeQuotas()  - Free quotas for a printer.
  *   cupsdUpdateQuota() - Update quota data for the specified printer and user.
- *   compare()     - Compare two quota records...
+ *   compare()          - Compare two quota records...
  */
 
 /*
@@ -49,8 +49,8 @@ static int    compare(const cupsd_quota_t *q1, const cupsd_quota_t *q2);
  */
 
 cupsd_quota_t *                                /* O - Quota data */
-cupsdAddQuota(cupsd_printer_t  *p,                     /* I - Printer */
-         const char *username)         /* I - User */
+cupsdAddQuota(cupsd_printer_t *p,      /* I - Printer */
+              const char      *username)/* I - User */
 {
   cupsd_quota_t        *q;                     /* New quota data */
 
@@ -86,8 +86,9 @@ cupsdAddQuota(cupsd_printer_t  *p,                    /* I - Printer */
  */
 
 cupsd_quota_t *                                /* O - Quota data */
-cupsdFindQuota(cupsd_printer_t  *p,            /* I - Printer */
-          const char *username)                /* I - User */
+cupsdFindQuota(
+    cupsd_printer_t *p,                        /* I - Printer */
+    const char      *username)         /* I - User */
 {
   cupsd_quota_t        *q,                     /* Quota data pointer */
                match;                  /* Search data */
@@ -136,15 +137,16 @@ cupsdFreeQuotas(cupsd_printer_t *p)               /* I - Printer */
  */
 
 cupsd_quota_t *                                /* O - Quota data */
-cupsdUpdateQuota(cupsd_printer_t  *p,          /* I - Printer */
-            const char *username,      /* I - User */
-           int        pages,           /* I - Number of pages */
-           int        k)               /* I - Number of kilobytes */
+cupsdUpdateQuota(
+    cupsd_printer_t *p,                        /* I - Printer */
+    const char      *username,         /* I - User */
+    int             pages,             /* I - Number of pages */
+    int             k)                 /* I - Number of kilobytes */
 {
-  cupsd_quota_t        *q;                     /* Quota data */
-  cupsd_job_t          *job;                   /* Current job */
-  time_t       curtime;                /* Current time */
-  ipp_attribute_t *attr;               /* Job attribute */
+  cupsd_quota_t                *q;             /* Quota data */
+  cupsd_job_t          *job;           /* Current job */
+  time_t               curtime;        /* Current time */
+  ipp_attribute_t      *attr;          /* Job attribute */
 
 
   if (!p || !username)
@@ -156,8 +158,9 @@ cupsdUpdateQuota(cupsd_printer_t  *p,               /* I - Printer */
   if ((q = cupsdFindQuota(p, username)) == NULL)
     return (NULL);
 
-  cupsdLogMessage(L_DEBUG, "cupsdUpdateQuota: p=%s username=%s pages=%d k=%d",
-             p->name, username, pages, k);
+  cupsdLogMessage(CUPSD_LOG_DEBUG,
+                  "cupsdUpdateQuota: p=%s username=%s pages=%d k=%d",
+                  p->name, username, pages, k);
 
   curtime = time(NULL);
 
@@ -225,8 +228,8 @@ cupsdUpdateQuota(cupsd_printer_t  *p,               /* I - Printer */
  */
 
 static int                             /* O - Result of comparison */
-compare(const cupsd_quota_t *q1,               /* I - First quota record */
-        const cupsd_quota_t *q2)               /* I - Second quota record */
+compare(const cupsd_quota_t *q1,       /* I - First quota record */
+        const cupsd_quota_t *q2)       /* I - Second quota record */
 {
   return (strcasecmp(q1->username, q2->username));
 }
index 0465a031c547aa16f7d69d7e6edf006467445d84..007374656616ff5dc3dc6a02d7e233585a1909c4 100644 (file)
@@ -45,9 +45,9 @@ void
 cupsdStartServer(void)
 {
 #ifdef HAVE_LIBSSL
-  int          i;              /* Looping var */
-  struct timeval curtime;      /* Current time in microseconds */
-  unsigned char        data[1024];     /* Seed data */
+  int                  i;              /* Looping var */
+  struct timeval       curtime;        /* Current time in microseconds */
+  unsigned char                data[1024];     /* Seed data */
 #endif /* HAVE_LIBSSL */
 
 
@@ -94,12 +94,15 @@ cupsdStartServer(void)
   */
 
   if (cupsdOpenPipe(CGIPipes))
-    cupsdLogMessage(L_ERROR, "cupsdStartServer: Unable to create pipes for CGI status!");
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "cupsdStartServer: Unable to create pipes for CGI status!");
   else
   {
     CGIStatusBuffer = cupsdStatBufNew(CGIPipes[0], "[CGI]");
 
-    cupsdLogMessage(L_DEBUG2, "cupsdStartServer: Adding fd %d to InputSet...", CGIPipes[0]);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdStartServer: Adding fd %d to InputSet...",
+                   CGIPipes[0]);
     FD_SET(CGIPipes[0], InputSet);
   }
 }
@@ -145,8 +148,9 @@ cupsdStopServer(void)
 
   if (CGIPipes[0] >= 0)
   {
-    cupsdLogMessage(L_DEBUG2, "cupsdStopServer: Removing fd %d from InputSet...",
-               CGIPipes[0]);
+    cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                    "cupsdStopServer: Removing fd %d from InputSet...",
+                    CGIPipes[0]);
 
     FD_CLR(CGIPipes[0], InputSet);
 
index d14a8cd0905981334310cee758690781cc7729dd..f066f6a85cfc711e831dea7b7dcf87ba7a98f1af 100644 (file)
@@ -170,7 +170,7 @@ cupsdStatBufUpdate(cupsd_statbuf_t *sb,     /* I - Status buffer */
       * Return an empty line if we are interrupted...
       */
 
-      *loglevel = L_NONE;
+      *loglevel = CUPSD_LOG_NONE;
       line[0]   = '\0';
 
       return (line);
@@ -199,7 +199,7 @@ cupsdStatBufUpdate(cupsd_statbuf_t *sb,     /* I - Status buffer */
     * End of file...
     */
 
-    *loglevel = L_NONE;
+    *loglevel = CUPSD_LOG_NONE;
     line[0]   = '\0';
 
     return (NULL);
@@ -217,67 +217,67 @@ cupsdStatBufUpdate(cupsd_statbuf_t *sb,   /* I - Status buffer */
 
   if (!strncmp(sb->buffer, "EMERG:", 6))
   {
-    *loglevel = L_EMERG;
+    *loglevel = CUPSD_LOG_EMERG;
     message   = sb->buffer + 6;
   }
   else if (!strncmp(sb->buffer, "ALERT:", 6))
   {
-    *loglevel = L_ALERT;
+    *loglevel = CUPSD_LOG_ALERT;
     message   = sb->buffer + 6;
   }
   else if (!strncmp(sb->buffer, "CRIT:", 5))
   {
-    *loglevel = L_CRIT;
+    *loglevel = CUPSD_LOG_CRIT;
     message   = sb->buffer + 5;
   }
   else if (!strncmp(sb->buffer, "ERROR:", 6))
   {
-    *loglevel = L_ERROR;
+    *loglevel = CUPSD_LOG_ERROR;
     message   = sb->buffer + 6;
   }
   else if (!strncmp(sb->buffer, "WARNING:", 8))
   {
-    *loglevel = L_WARN;
+    *loglevel = CUPSD_LOG_WARN;
     message   = sb->buffer + 8;
   }
   else if (!strncmp(sb->buffer, "NOTICE:", 7))
   {
-    *loglevel = L_NOTICE;
+    *loglevel = CUPSD_LOG_NOTICE;
     message   = sb->buffer + 7;
   }
   else if (!strncmp(sb->buffer, "INFO:", 5))
   {
-    *loglevel = L_INFO;
+    *loglevel = CUPSD_LOG_INFO;
     message   = sb->buffer + 5;
   }
   else if (!strncmp(sb->buffer, "DEBUG:", 6))
   {
-    *loglevel = L_DEBUG;
+    *loglevel = CUPSD_LOG_DEBUG;
     message   = sb->buffer + 6;
   }
   else if (!strncmp(sb->buffer, "DEBUG2:", 7))
   {
-    *loglevel = L_DEBUG2;
+    *loglevel = CUPSD_LOG_DEBUG2;
     message   = sb->buffer + 7;
   }
   else if (!strncmp(sb->buffer, "PAGE:", 5))
   {
-    *loglevel = L_PAGE;
+    *loglevel = CUPSD_LOG_PAGE;
     message   = sb->buffer + 5;
   }
   else if (!strncmp(sb->buffer, "STATE:", 6))
   {
-    *loglevel = L_STATE;
+    *loglevel = CUPSD_LOG_STATE;
     message   = sb->buffer + 6;
   }
   else if (!strncmp(sb->buffer, "ATTR:", 5))
   {
-    *loglevel = L_ATTR;
+    *loglevel = CUPSD_LOG_ATTR;
     message   = sb->buffer + 5;
   }
   else
   {
-    *loglevel = L_DEBUG;
+    *loglevel = CUPSD_LOG_DEBUG;
     message   = sb->buffer;
   }
 
@@ -292,7 +292,8 @@ cupsdStatBufUpdate(cupsd_statbuf_t *sb,     /* I - Status buffer */
   * Send it to the log file as needed...
   */
 
-  if (*loglevel > L_NONE && (*loglevel != L_INFO || LogLevel == L_DEBUG2))
+  if (*loglevel > CUPSD_LOG_NONE &&
+      (*loglevel != CUPSD_LOG_INFO || LogLevel == CUPSD_LOG_DEBUG2))
   {
    /*
     * General status message; send it to the error_log file...
index a61b857d6435bfc91001e8df168ef32a6fad6667..3ff7a16129705c1fa7c5e0ef7dc913b6466747f5 100644 (file)
@@ -59,8 +59,8 @@ static void   cupsd_delete_event(cupsd_event_t *event);
 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 */
+    cupsd_printer_t   *dest,           /* I - Printer associated with event */
+    cupsd_job_t       *job,            /* I - Job associated with event */
     const char        *text,           /* I - Notification text */
     ...)                               /* I - Additional arguments as needed */
 {
@@ -77,8 +77,9 @@ cupsdAddEvent(
 
   if (MaxEvents <= 0)
   {
-    cupsdLogMessage(L_WARN, "cupsdAddEvent: Discarding %s event since MaxEvents is %d!",
-               cupsdEventName(event), MaxEvents);
+    cupsdLogMessage(CUPSD_LOG_WARN,
+                    "cupsdAddEvent: Discarding %s event since MaxEvents is %d!",
+                    cupsdEventName(event), MaxEvents);
     return;
   }
 
@@ -93,8 +94,9 @@ cupsdAddEvent(
 
     if (!Events)
     {
-      cupsdLogMessage(L_CRIT, "Unable to allocate memory for event cache - %s",
-                strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_CRIT,
+                      "Unable to allocate memory for event cache - %s",
+                     strerror(errno));
       return;
     }
   }
@@ -128,8 +130,9 @@ cupsdAddEvent(
 
        if ((temp = (cupsd_event_t *)calloc(1, sizeof(cupsd_event_t))) == NULL)
        {
-         cupsdLogMessage(L_CRIT, "Unable to allocate memory for event - %s",
-                    strerror(errno));
+         cupsdLogMessage(CUPSD_LOG_CRIT,
+                         "Unable to allocate memory for event - %s",
+                         strerror(errno));
          return;
        }
 
@@ -296,8 +299,8 @@ cupsdAddEvent(
   if (temp)
     cupsdSaveAllSubscriptions();
   else
-    cupsdLogMessage(L_DEBUG, "Discarding unused %s event...",
-               cupsdEventName(event));
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "Discarding unused %s event...",
+                    cupsdEventName(event));
 }
 
 
@@ -315,9 +318,10 @@ cupsdAddSubscription(
   cupsd_subscription_t *temp;          /* New subscription object */
 
 
-  cupsdLogMessage(L_DEBUG, "cupsdAddSubscription(mask=%x(%s), dest=%p(%s), job=%p(%d), uri=\"%s\")",
-             mask, cupsdEventName(mask), dest, dest ? dest->name : "",
-            job, job ? job->id : 0, uri);
+  cupsdLogMessage(CUPSD_LOG_DEBUG,
+                  "cupsdAddSubscription(mask=%x(%s), dest=%p(%s), job=%p(%d), uri=\"%s\")",
+                  mask, cupsdEventName(mask), dest, dest ? dest->name : "",
+                 job, job ? job->id : 0, uri);
 
   if (!Subscriptions)
   {
@@ -330,8 +334,9 @@ cupsdAddSubscription(
 
     if (!Subscriptions)
     {
-      cupsdLogMessage(L_CRIT, "Unable to allocate memory for subscriptions - %s",
-                strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_CRIT,
+                      "Unable to allocate memory for subscriptions - %s",
+                     strerror(errno));
       return (NULL);
     }
   }
@@ -349,8 +354,9 @@ cupsdAddSubscription(
 
   if ((temp = calloc(1, sizeof(cupsd_subscription_t))) == NULL)
   {
-    cupsdLogMessage(L_CRIT, "Unable to allocate memory for subscription object - %s",
-               strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_CRIT,
+                    "Unable to allocate memory for subscription object - %s",
+                    strerror(errno));
     return (NULL);
   }
 
@@ -617,8 +623,8 @@ 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_printer_t *dest,             /* I - Printer, if any */
+    cupsd_job_t     *job)              /* I - Job, if any */
 {
   int                  i;              /* Looping var */
   cupsd_subscription_t *sub;           /* Current subscription */
@@ -636,7 +642,7 @@ cupsdExpireSubscriptions(
         (dest && sub->dest == dest) ||
        (job && sub->job == job))
     {
-      cupsdLogMessage(L_INFO, "Subscription %d has expired...", sub->id);
+      cupsdLogMessage(CUPSD_LOG_INFO, "Subscription %d has expired...", sub->id);
 
       cupsdDeleteSubscription(sub, 0);
 
@@ -721,8 +727,9 @@ cupsdLoadAllSubscriptions(void)
   snprintf(line, sizeof(line), "%s/subscriptions.conf", ServerRoot);
   if ((fp = cupsFileOpen(line, "r")) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "LoadAllSubscriptions: Unable to open %s - %s", line,
-               strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR,
+                    "LoadAllSubscriptions: Unable to open %s - %s", line,
+                    strerror(errno));
     return;
   }
 
@@ -749,8 +756,9 @@ cupsdLoadAllSubscriptions(void)
       }
       else
       {
-        cupsdLogMessage(L_ERROR, "Syntax error on line %d of subscriptions.conf.",
-                  linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
         return;
       }
     }
@@ -758,8 +766,9 @@ cupsdLoadAllSubscriptions(void)
     {
       if (!sub)
       {
-        cupsdLogMessage(L_ERROR, "Syntax error on line %d of subscriptions.conf.",
-                  linenum);
+        cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
         return;
       }
 
@@ -771,8 +780,9 @@ cupsdLoadAllSubscriptions(void)
     }
     else if (!sub)
     {
-      cupsdLogMessage(L_ERROR, "Syntax error on line %d of subscriptions.conf.",
-                linenum);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Syntax error on line %d of subscriptions.conf.",
+                     linenum);
       return;
     }
     else if (!strcasecmp(name, "Events"))
@@ -784,8 +794,9 @@ cupsdLoadAllSubscriptions(void)
 
       if (!value)
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of subscriptions.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        return;
       }
 
@@ -806,8 +817,9 @@ cupsdLoadAllSubscriptions(void)
 
         if ((sub->mask |= cupsdEventValue(value)) == CUPSD_EVENT_NONE)
        {
-         cupsdLogMessage(L_ERROR, "Unknown event name \'%s\' on line %d of subscriptions.conf.",
-                    value, linenum);
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "Unknown event name \'%s\' on line %d of subscriptions.conf.",
+                         value, linenum);
          return;
        }
 
@@ -824,8 +836,9 @@ cupsdLoadAllSubscriptions(void)
        cupsdSetString(&sub->owner, value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of subscriptions.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        return;
       }
     }
@@ -839,8 +852,9 @@ cupsdLoadAllSubscriptions(void)
        cupsdSetString(&sub->recipient, value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of subscriptions.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        return;
       }
     }
@@ -854,15 +868,17 @@ cupsdLoadAllSubscriptions(void)
       {
         if ((sub->job = cupsdFindJob(atoi(value))) == NULL)
        {
-         cupsdLogMessage(L_ERROR, "Job %s not found on line %d of subscriptions.conf.",
-                    value, linenum);
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "Job %s not found on line %d of subscriptions.conf.",
+                         value, linenum);
          delete_sub = 1;
        }
       }
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of subscriptions.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        return;
       }
     }
@@ -876,15 +892,17 @@ cupsdLoadAllSubscriptions(void)
       {
         if ((sub->dest = cupsdFindDest(value)) == NULL)
        {
-         cupsdLogMessage(L_ERROR, "Printer \'%s\' not found on line %d of subscriptions.conf.",
-                    value, linenum);
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "Printer \'%s\' not found on line %d of subscriptions.conf.",
+                         value, linenum);
          delete_sub = 1;
        }
       }
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of subscriptions.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        return;
       }
     }
@@ -935,16 +953,18 @@ cupsdLoadAllSubscriptions(void)
 
        if (*valueptr)
        {
-         cupsdLogMessage(L_ERROR, "Bad UserData \'%s\' on line %d of subscriptions.conf.",
-                    value, linenum);
+         cupsdLogMessage(CUPSD_LOG_ERROR,
+                         "Bad UserData \'%s\' on line %d of subscriptions.conf.",
+                         value, linenum);
        }
        else
          sub->user_data_len = i;
       }
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of subscriptions.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        return;
       }
     }
@@ -958,8 +978,9 @@ cupsdLoadAllSubscriptions(void)
         sub->lease = atoi(value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of subscriptions.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        return;
       }
     }
@@ -973,8 +994,9 @@ cupsdLoadAllSubscriptions(void)
         sub->interval = atoi(value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of subscriptions.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        return;
       }
     }
@@ -988,8 +1010,9 @@ cupsdLoadAllSubscriptions(void)
         sub->expire = atoi(value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of subscriptions.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        return;
       }
     }
@@ -1003,8 +1026,9 @@ cupsdLoadAllSubscriptions(void)
         sub->next_event_id = sub->first_event_id = atoi(value);
       else
       {
-       cupsdLogMessage(L_ERROR, "Syntax error on line %d of subscriptions.conf.",
-                  linenum);
+       cupsdLogMessage(CUPSD_LOG_ERROR,
+                       "Syntax error on line %d of subscriptions.conf.",
+                       linenum);
        return;
       }
     }
@@ -1014,8 +1038,9 @@ cupsdLoadAllSubscriptions(void)
       * Something else we don't understand...
       */
 
-      cupsdLogMessage(L_ERROR, "Unknown configuration directive %s on line %d of subscriptions.conf.",
-                name, linenum);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Unknown configuration directive %s on line %d of subscriptions.conf.",
+                     name, linenum);
     }
   }
 
@@ -1050,21 +1075,22 @@ cupsdSaveAllSubscriptions(void)
   snprintf(backup, sizeof(backup), "%s/subscriptions.conf.O", ServerRoot);
 
   if (rename(temp, backup))
-    cupsdLogMessage(L_ERROR, "Unable to backup subscriptions.conf - %s",
-               strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to backup subscriptions.conf - %s",
+                    strerror(errno));
 
   if ((fp = cupsFileOpen(temp, "w")) == NULL)
   {
-    cupsdLogMessage(L_ERROR, "Unable to save subscriptions.conf - %s",
-               strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to save subscriptions.conf - %s",
+                    strerror(errno));
 
     if (rename(backup, temp))
-      cupsdLogMessage(L_ERROR, "Unable to restore subscriptions.conf - %s",
-                 strerror(errno));
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                      "Unable to restore subscriptions.conf - %s",
+                      strerror(errno));
     return;
   }
   else
-    cupsdLogMessage(L_INFO, "Saving subscriptions.conf...");
+    cupsdLogMessage(CUPSD_LOG_INFO, "Saving subscriptions.conf...");
 
  /*
   * Restrict access to the file...
@@ -1183,8 +1209,9 @@ cupsdSendNotification(
     cupsd_subscription_t *sub,         /* I - Subscription object */
     cupsd_event_t        *event)       /* I - Event to send */
 {
-  cupsdLogMessage(L_DEBUG, "cupsdSendNotification(sub=%p(%d), event=%p(%s))\n",
-             sub, sub->id, event, cupsdEventName(event->event));
+  cupsdLogMessage(CUPSD_LOG_DEBUG,
+                  "cupsdSendNotification(sub=%p(%d), event=%p(%s))\n",
+                  sub, sub->id, event, cupsdEventName(event->event));
 
  /*
   * Allocate the events array as needed...
@@ -1196,8 +1223,9 @@ cupsdSendNotification(
 
     if (!sub->events)
     {
-      cupsdLogMessage(L_CRIT, "Unable to allocate memory for subscription #%d!",
-                 sub->id);
+      cupsdLogMessage(CUPSD_LOG_CRIT,
+                      "Unable to allocate memory for subscription #%d!",
+                      sub->id);
       return;
     }
   }
@@ -1265,8 +1293,9 @@ cupsdStopAllNotifiers(void)
   * Close the status pipes...
   */
 
-  cupsdLogMessage(L_DEBUG2, "cupsdStopAllNotifiers: Removing fd %d from InputSet...",
-            NotifierPipes[0]);
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                  "cupsdStopAllNotifiers: Removing fd %d from InputSet...",
+                 NotifierPipes[0]);
   FD_CLR(NotifierPipes[0], InputSet);
 
   cupsdStatBufDelete(NotifierStatusBuffer);
@@ -1303,8 +1332,9 @@ cupsdUpdateNotiferStatus(void)
     * Fatal error on pipe - should never happen!
     */
 
-    cupsdLogMessage(L_CRIT, "cupsdUpdateNotifierStatus: error reading from notifier error pipe - %s",
-               strerror(errno));
+    cupsdLogMessage(CUPSD_LOG_CRIT,
+                    "cupsdUpdateNotifierStatus: error reading from notifier error pipe - %s",
+                    strerror(errno));
   }
 }
 
index 6419a85cebbaf03938a84a04aa9b5af3427612a8..2d7ef2f5600cd6922a6868af770850c876b15024 100644 (file)
@@ -78,34 +78,34 @@ typedef enum
 
 typedef struct cupsd_event_s           /**** Event structure ****/
 {
-  cupsd_eventmask_t event;             /* Event */
-  time_t       time;                   /* Time of event */
-  ipp_t                *attrs;                 /* Notification message */
-  cupsd_printer_t      *dest;                  /* Associated printer, if any */
-  cupsd_job_t          *job;                   /* Associated job, if any */
+  cupsd_eventmask_t    event;          /* Event */
+  time_t               time;           /* Time of event */
+  ipp_t                        *attrs;         /* Notification message */
+  cupsd_printer_t      *dest;          /* Associated printer, if any */
+  cupsd_job_t          *job;           /* Associated job, if any */
 } cupsd_event_t; 
 
 typedef struct cupsd_subscription_s    /**** Subscription structure ****/
 {
-  int          id;                     /* subscription-id */
-  unsigned     mask;                   /* Event mask */
-  char         *owner;                 /* notify-subscriber-user-name */
-  char         *recipient;             /* notify-recipient-uri, if applicable */
-  unsigned char        user_data[64];          /* notify-user-data */
-  int          user_data_len;          /* Length of notify-user-data */
-  int          lease;                  /* notify-lease-time */
-  int          interval;               /* notify-interval */
-  cupsd_printer_t      *dest;                  /* notify-printer-uri, if any */
-  cupsd_job_t          *job;                   /* notify-job-id, if any */
-  int          pid;                    /* Process ID of notifier */
-  int          pipe;                   /* Pipe to notifier */
-  int          status;                 /* Exit status of notifier */
-  time_t       last;                   /* Time of last notification */
-  time_t       expire;                 /* Lease expiration time */
-  int          first_event_id,         /* First event-id in cache */
-               next_event_id,          /* Next event-id to use */
-               num_events;             /* Number of cached events */
-  cupsd_event_t        **events;               /* Cached events */
+  int                  id;             /* subscription-id */
+  unsigned             mask;           /* Event mask */
+  char                 *owner;         /* notify-subscriber-user-name */
+  char                 *recipient;     /* notify-recipient-uri, if applicable */
+  unsigned char                user_data[64];  /* notify-user-data */
+  int                  user_data_len;  /* Length of notify-user-data */
+  int                  lease;          /* notify-lease-time */
+  int                  interval;       /* notify-interval */
+  cupsd_printer_t      *dest;          /* notify-printer-uri, if any */
+  cupsd_job_t          *job;           /* notify-job-id, if any */
+  int                  pid;            /* Process ID of notifier */
+  int                  pipe;           /* Pipe to notifier */
+  int                  status;         /* Exit status of notifier */
+  time_t               last;           /* Time of last notification */
+  time_t               expire;         /* Lease expiration time */
+  int                  first_event_id, /* First event-id in cache */
+                       next_event_id,  /* Next event-id to use */
+                       num_events;     /* Number of cached events */
+  cupsd_event_t                **events;       /* Cached events */
 } cupsd_subscription_t;
 
 
@@ -161,7 +161,8 @@ extern cupsd_eventmask_t
 
 extern cupsd_subscription_t *
                cupsdFindSubscription(int id);
-extern void    cupsdExpireSubscriptions(cupsd_printer_t *dest, cupsd_job_t *job);
+extern void    cupsdExpireSubscriptions(cupsd_printer_t *dest,
+                                        cupsd_job_t *job);
 extern void    cupsdLoadAllSubscriptions(void);
 extern void    cupsdSaveAllSubscriptions(void);
 extern void    cupsdSendNotification(cupsd_subscription_t *sub,
index 5f96b670f09434613f1ef9a9319cf1873d273889..b68b00ceeacd509d0103d3492c941ea3597c210c 100644 (file)
@@ -241,7 +241,6 @@ print_rules(mime_magic_t *rules)    /* I - Rules to print */
 }
 
 
-
 /*
  * End of "$Id$".
  */
index ee26d23357f891b76f5d668dce1e907188d7500a..516fe9c9bb009c6e62599625da7b0fe1c3652c12 100644 (file)
@@ -23,6 +23,7 @@
  *
  * Contents:
  *
+ *   cupsdCompareNames()   - Compare two names.
  *   cupsdSendIPPGroup()   - Send a group tag.
  *   cupsdSendIPPHeader()  - Send the IPP response header.
  *   cupsdSendIPPInteger() - Send an integer attribute.