summaryrefslogtreecommitdiff
path: root/cups
diff options
context:
space:
mode:
Diffstat (limited to 'cups')
-rw-r--r--cups/adminutil.c2
-rw-r--r--cups/array.c36
-rw-r--r--cups/attr.c6
-rw-r--r--cups/auth.c191
-rw-r--r--cups/backchannel.c8
-rw-r--r--cups/conflicts.c98
-rw-r--r--cups/debug.c67
-rw-r--r--cups/debug.h20
-rw-r--r--cups/dest.c30
-rw-r--r--cups/dir.c23
-rw-r--r--cups/emit.c16
-rw-r--r--cups/encode.c34
-rw-r--r--cups/file.c133
-rw-r--r--cups/getdevices.c37
-rw-r--r--cups/getputfile.c16
-rw-r--r--cups/globals.h1
-rw-r--r--cups/http-addr.c21
-rw-r--r--cups/http-addrlist.c8
-rw-r--r--cups/http-support.c32
-rw-r--r--cups/http.c191
-rw-r--r--cups/ipp-support.c46
-rw-r--r--cups/ipp.c270
-rw-r--r--cups/language.c45
-rw-r--r--cups/localize.c14
-rw-r--r--cups/mark.c14
-rw-r--r--cups/options.c54
-rw-r--r--cups/page.c12
-rw-r--r--cups/ppd.c64
-rw-r--r--cups/request.c73
-rw-r--r--cups/sidechannel.c16
-rw-r--r--cups/snmp.c82
-rw-r--r--cups/string.c22
-rw-r--r--cups/string.h2
-rw-r--r--cups/testarray.c39
-rw-r--r--cups/transcode.c154
-rw-r--r--cups/usersys.c386
-rw-r--r--cups/util.c51
37 files changed, 1197 insertions, 1117 deletions
diff --git a/cups/adminutil.c b/cups/adminutil.c
index 318fb730e..a46d34f69 100644
--- a/cups/adminutil.c
+++ b/cups/adminutil.c
@@ -2208,7 +2208,7 @@ do_samba_command(const char *command, /* I - Command to run */
if (logfile)
_cupsLangPuts(logfile, "\n");
- DEBUG_printf(("status=%d\n", status));
+ DEBUG_printf(("9do_samba_command: status=%d", status));
if (WIFEXITED(status))
return (WEXITSTATUS(status));
diff --git a/cups/array.c b/cups/array.c
index 4f40d7f4a..957ed913b 100644
--- a/cups/array.c
+++ b/cups/array.c
@@ -3,7 +3,7 @@
*
* Sorted array routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -109,7 +109,7 @@ int /* O - 1 on success, 0 on failure */
cupsArrayAdd(cups_array_t *a, /* I - Array */
void *e) /* I - Element */
{
- DEBUG_printf(("cupsArrayAdd(a=%p, e=%p)\n", a, e));
+ DEBUG_printf(("2cupsArrayAdd(a=%p, e=%p)", a, e));
/*
* Range check input...
@@ -117,7 +117,7 @@ cupsArrayAdd(cups_array_t *a, /* I - Array */
if (!a || !e)
{
- DEBUG_puts("cupsArrayAdd: returning 0");
+ DEBUG_puts("3cupsArrayAdd: returning 0");
return (0);
}
@@ -505,7 +505,7 @@ int /* O - 0 on failure, 1 on success */
cupsArrayInsert(cups_array_t *a, /* I - Array */
void *e) /* I - Element */
{
- DEBUG_printf(("cupsArrayInsert(a=%p, e=%p)\n", a, e));
+ DEBUG_printf(("2cupsArrayInsert(a=%p, e=%p)", a, e));
/*
* Range check input...
@@ -513,7 +513,7 @@ cupsArrayInsert(cups_array_t *a, /* I - Array */
if (!a || !e)
{
- DEBUG_puts("cupsArrayInsert: returning 0");
+ DEBUG_puts("3cupsArrayInsert: returning 0");
return (0);
}
@@ -846,7 +846,7 @@ cups_array_add(cups_array_t *a, /* I - Array */
diff; /* Comparison with current element */
- DEBUG_printf(("cups_array_add(a=%p, e=%p, insert=%d)\n", a, e, insert));
+ DEBUG_printf(("7cups_array_add(a=%p, e=%p, insert=%d)", a, e, insert));
/*
* Verify we have room for the new element...
@@ -879,11 +879,11 @@ cups_array_add(cups_array_t *a, /* I - Array */
temp = realloc(a->elements, count * sizeof(void *));
}
- DEBUG_printf(("cups_array_add: count=%d\n", count));
+ DEBUG_printf(("9cups_array_add: count=%d", count));
if (!temp)
{
- DEBUG_puts("cupsAddAdd: allocation failed, returning 0");
+ DEBUG_puts("9cups_array_add: allocation failed, returning 0");
return (0);
}
@@ -978,11 +978,11 @@ cups_array_add(cups_array_t *a, /* I - Array */
if (a->saved[i] >= current)
a->saved[i] ++;
- DEBUG_printf(("cups_array_add: insert element at index %d...\n", current));
+ DEBUG_printf(("9cups_array_add: insert element at index %d...", current));
}
#ifdef DEBUG
else
- DEBUG_printf(("cups_array_add: append element at %d...\n", current));
+ DEBUG_printf(("9cups_array_add: append element at %d...", current));
#endif /* DEBUG */
a->elements[current] = e;
@@ -991,11 +991,11 @@ cups_array_add(cups_array_t *a, /* I - Array */
#ifdef DEBUG
for (current = 0; current < a->num_elements; current ++)
- DEBUG_printf(("cups_array_add: a->elements[%d]=%p\n", current,
+ DEBUG_printf(("9cups_array_add: a->elements[%d]=%p", current,
a->elements[current]));
#endif /* DEBUG */
- DEBUG_puts("cups_array_add: returning 1");
+ DEBUG_puts("9cups_array_add: returning 1");
return (1);
}
@@ -1017,7 +1017,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
diff; /* Comparison with current element */
- DEBUG_printf(("cups_array_find(a=%p, e=%p, prev=%d, rdiff=%p)\n", a, e, prev,
+ DEBUG_printf(("7cups_array_find(a=%p, e=%p, prev=%d, rdiff=%p)", a, e, prev,
rdiff));
if (a->compare)
@@ -1026,7 +1026,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
* Do a binary search for the element...
*/
- DEBUG_puts("cups_array_find: binary search");
+ DEBUG_puts("9cups_array_find: binary search");
if (prev >= 0 && prev < a->num_elements)
{
@@ -1042,7 +1042,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
* Exact or edge match, return it!
*/
- DEBUG_printf(("cups_array_find: Returning %d, diff=%d\n", prev, diff));
+ DEBUG_printf(("9cups_array_find: Returning %d, diff=%d", prev, diff));
*rdiff = diff;
@@ -1082,7 +1082,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
current = (left + right) / 2;
diff = (*(a->compare))(e, a->elements[current], a->data);
- DEBUG_printf(("cups_array_find: left=%d, right=%d, current=%d, diff=%d\n",
+ DEBUG_printf(("9cups_array_find: left=%d, right=%d, current=%d, diff=%d",
left, right, current, diff));
if (diff == 0)
@@ -1115,7 +1115,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
* Do a linear pointer search...
*/
- DEBUG_puts("cups_array_find: linear search");
+ DEBUG_puts("9cups_array_find: linear search");
diff = 1;
@@ -1131,7 +1131,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
* Return the closest element and the difference...
*/
- DEBUG_printf(("cups_array_find: Returning %d, diff=%d\n", current, diff));
+ DEBUG_printf(("8cups_array_find: Returning %d, diff=%d", current, diff));
*rdiff = diff;
diff --git a/cups/attr.c b/cups/attr.c
index f7b1a76b8..c2c6eb512 100644
--- a/cups/attr.c
+++ b/cups/attr.c
@@ -4,7 +4,7 @@
* PPD model-specific attribute routines for the Common UNIX Printing System
* (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -44,8 +44,8 @@ ppdFindAttr(ppd_file_t *ppd, /* I - PPD file data */
*attr; /* Current attribute */
- DEBUG_printf(("ppdFindAttr(ppd=%p, name=\"%s\", spec=\"%s\")\n", ppd,
- name ? name : "(null)", spec ? spec : "(null)"));
+ DEBUG_printf(("2ppdFindAttr(ppd=%p, name=\"%s\", spec=\"%s\")", ppd, name,
+ spec));
/*
* Range check input...
diff --git a/cups/auth.c b/cups/auth.c
index 332301c81..da37c0bfc 100644
--- a/cups/auth.c
+++ b/cups/auth.c
@@ -3,7 +3,7 @@
*
* Authentication functions for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* This file contains Kerberos support code, copyright 2006 by
@@ -20,8 +20,8 @@
* Contents:
*
* cupsDoAuthentication() - Authenticate a request.
- * DEBUG_gss_printf() - Show debug error messages from GSSAPI...
- * cups_get_gss_creds() - Get CUPS service credentials for authentication.
+ * cups_get_gssname() - Get GSSAPI name for authentication.
+ * cups_gss_printf() - Show error messages from GSSAPI...
* cups_local_auth() - Get the local authorization certificate if
* available/applicable...
*/
@@ -62,13 +62,13 @@ extern const char *cssmErrorString(int error);
*/
#ifdef HAVE_GSSAPI
+static gss_name_t cups_get_gssname(http_t *http, const char *service_name);
# ifdef DEBUG
-static void DEBUG_gss_printf(OM_uint32 major_status, OM_uint32 minor_status,
- const char *message);
+static void cups_gss_printf(OM_uint32 major_status, OM_uint32 minor_status,
+ const char *message);
# else
-# define DEBUG_gss_printf(major, minor, message)
-# endif /* DEBUG */
-static gss_name_t cups_get_gss_creds(http_t *http, const char *service_name);
+# define cups_gss_printf(major, minor, message)
+# endif /* DEBUG */
#endif /* HAVE_GSSAPI */
static int cups_local_auth(http_t *http);
@@ -96,11 +96,11 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
_cups_globals_t *cg; /* Global data */
- DEBUG_printf(("cupsDoAuthentication(http=%p, method=\"%s\", resource=\"%s\")\n",
+ DEBUG_printf(("cupsDoAuthentication(http=%p, method=\"%s\", resource=\"%s\")",
http, method, resource));
- DEBUG_printf(("cupsDoAuthentication: digest_tries=%d, userpass=\"%s\"\n",
+ DEBUG_printf(("2cupsDoAuthentication: digest_tries=%d, userpass=\"%s\"",
http->digest_tries, http->userpass));
- DEBUG_printf(("cupsDoAuthentication: WWW-Authenticate=\"%s\"\n",
+ DEBUG_printf(("2cupsDoAuthentication: WWW-Authenticate=\"%s\"",
httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE)));
/*
@@ -117,7 +117,7 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
{
if ((localauth = cups_local_auth(http)) == 0)
{
- DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n",
+ DEBUG_printf(("2cupsDoAuthentication: authstring=\"%s\"",
http->authstring));
if (http->status == HTTP_UNAUTHORIZED)
@@ -199,7 +199,7 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
if (gss_init_sec_context == NULL)
{
- DEBUG_puts("cupsDoAuthentication: Weak-linked GSSAPI/Kerberos framework "
+ DEBUG_puts("1cupsDoAuthentication: Weak-linked GSSAPI/Kerberos framework "
"is not present");
return (-1);
}
@@ -207,7 +207,7 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
if (http->status == HTTP_UNAUTHORIZED && http->digest_tries >= 3)
{
- DEBUG_printf(("cupsDoAuthentication: too many Negotiate tries (%d)\n",
+ DEBUG_printf(("1cupsDoAuthentication: too many Negotiate tries (%d)",
http->digest_tries));
return (-1);
@@ -218,9 +218,10 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
if ((gss_service_name = getenv("CUPS_GSSSERVICENAME")) == NULL)
gss_service_name = CUPS_DEFAULT_GSSSERVICENAME;
else
- DEBUG_puts("cupsDoAuthentication: GSS service name set via environment");
+ DEBUG_puts("2cupsDoAuthentication: GSS service name set via "
+ "environment variable");
- http->gssname = cups_get_gss_creds(http, gss_service_name);
+ http->gssname = cups_get_gssname(http, gss_service_name);
}
# ifdef USE_SPNEGO /* We don't implement SPNEGO just yet... */
@@ -277,8 +278,10 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
major_status = gss_init_sec_context(&minor_status, GSS_C_NO_CREDENTIAL,
&http->gssctx,
http->gssname, http->gssmech,
- GSS_C_DELEG_FLAG | GSS_C_MUTUAL_FLAG |
- GSS_C_INTEG_FLAG,
+#ifdef GSS_C_DELEG_POLICY_FLAG
+ GSS_C_DELEG_POLICY_FLAG |
+#endif /* GSS_C_DELEG_POLICY_FLAG */
+ GSS_C_MUTUAL_FLAG | GSS_C_INTEG_FLAG,
GSS_C_INDEFINITE,
GSS_C_NO_CHANNEL_BINDINGS,
&input_token, &http->gssmech,
@@ -289,15 +292,15 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
if (GSS_ERROR(major_status))
{
-# ifdef DEBUG
- DEBUG_gss_printf(major_status, minor_status,
- "Unable to initialize security context");
-# endif /* DEBUG */
+ cups_gss_printf(major_status, minor_status,
+ "cupsDoAuthentication: Unable to initialize security "
+ "context");
return (-1);
}
if (major_status == GSS_S_CONTINUE_NEEDED)
- DEBUG_gss_printf(major_status, minor_status, "Continuation needed!");
+ cups_gss_printf(major_status, minor_status,
+ "cupsDoAuthentication: Continuation needed!");
if (output_token.length > 0 && output_token.length <= 65536)
{
@@ -326,8 +329,8 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
}
else
{
- DEBUG_printf(("cupsDoAuthentication: Kerberos credentials too large - "
- "%d bytes!\n", (int)output_token.length));
+ DEBUG_printf(("1cupsDoAuthentication: Kerberos credentials too large - "
+ "%d bytes!", (int)output_token.length));
gss_release_buffer(&minor_status, &output_token);
@@ -369,59 +372,19 @@ cupsDoAuthentication(http_t *http, /* I - Connection to server or @code CUPS
httpSetAuthString(http, "Digest", digest);
}
- DEBUG_printf(("cupsDoAuthentication: authstring=\"%s\"\n", http->authstring));
+ DEBUG_printf(("1cupsDoAuthentication: authstring=\"%s\"", http->authstring));
return (0);
}
#ifdef HAVE_GSSAPI
-# ifdef DEBUG
/*
- * 'DEBUG_gss_printf()' - Show debug error messages from GSSAPI...
- */
-
-static void
-DEBUG_gss_printf(OM_uint32 major_status,/* I - Major status code */
- OM_uint32 minor_status,/* I - Minor status code */
- const char *message) /* I - Prefix for error message */
-{
- OM_uint32 err_major_status, /* Major status code for display */
- err_minor_status; /* Minor status code for display */
- OM_uint32 msg_ctx; /* Message context */
- gss_buffer_desc major_status_string = GSS_C_EMPTY_BUFFER,
- /* Major status message */
- minor_status_string = GSS_C_EMPTY_BUFFER;
- /* Minor status message */
-
-
- msg_ctx = 0;
- err_major_status = gss_display_status(&err_minor_status,
- major_status,
- GSS_C_GSS_CODE,
- GSS_C_NO_OID,
- &msg_ctx,
- &major_status_string);
-
- if (!GSS_ERROR(err_major_status))
- gss_display_status(&err_minor_status, minor_status, GSS_C_MECH_CODE,
- GSS_C_NULL_OID, &msg_ctx, &minor_status_string);
-
- printf("%s: %s, %s\n", message, (char *)major_status_string.value,
- (char *)minor_status_string.value);
-
- gss_release_buffer(&err_minor_status, &major_status_string);
- gss_release_buffer(&err_minor_status, &minor_status_string);
-}
-# endif /* DEBUG */
-
-
-/*
- * 'cups_get_gss_creds()' - Get CUPS service credentials for authentication.
+ * 'cups_get_gssname()' - Get CUPS service credentials for authentication.
*/
static gss_name_t /* O - Server name */
-cups_get_gss_creds(
+cups_get_gssname(
http_t *http, /* I - Connection to server */
const char *service_name) /* I - Service name */
{
@@ -434,6 +397,10 @@ cups_get_gss_creds(
fqdn[HTTP_MAX_URI]; /* Server name buffer */
+ DEBUG_printf(("7cups_get_gssname(http=%p, service_name=\"%s\")", http,
+ service_name));
+
+
/*
* Get the hostname...
*/
@@ -449,7 +416,7 @@ cups_get_gss_creds(
snprintf(buf, sizeof(buf), "%s@%s", service_name, fqdn);
- DEBUG_printf(("cups_get_gss_creds: Looking up %s...\n", buf));
+ DEBUG_printf(("9cups_get_gssname: Looking up %s...", buf));
token.value = buf;
token.length = strlen(buf);
@@ -460,15 +427,53 @@ cups_get_gss_creds(
if (GSS_ERROR(major_status))
{
-# ifdef DEBUG
- DEBUG_gss_printf(major_status, minor_status, "gss_import_name() failed");
-# endif /* DEBUG */
-
+ cups_gss_printf(major_status, minor_status,
+ "cups_get_gssname: gss_import_name() failed");
return (NULL);
}
return (server_name);
}
+
+
+# ifdef DEBUG
+/*
+ * 'cups_gss_printf()' - Show debug error messages from GSSAPI...
+ */
+
+static void
+cups_gss_printf(OM_uint32 major_status,/* I - Major status code */
+ OM_uint32 minor_status,/* I - Minor status code */
+ const char *message) /* I - Prefix for error message */
+{
+ OM_uint32 err_major_status, /* Major status code for display */
+ err_minor_status; /* Minor status code for display */
+ OM_uint32 msg_ctx; /* Message context */
+ gss_buffer_desc major_status_string = GSS_C_EMPTY_BUFFER,
+ /* Major status message */
+ minor_status_string = GSS_C_EMPTY_BUFFER;
+ /* Minor status message */
+
+
+ msg_ctx = 0;
+ err_major_status = gss_display_status(&err_minor_status,
+ major_status,
+ GSS_C_GSS_CODE,
+ GSS_C_NO_OID,
+ &msg_ctx,
+ &major_status_string);
+
+ if (!GSS_ERROR(err_major_status))
+ gss_display_status(&err_minor_status, minor_status, GSS_C_MECH_CODE,
+ GSS_C_NULL_OID, &msg_ctx, &minor_status_string);
+
+ DEBUG_printf(("8%s: %s, %s", message, (char *)major_status_string.value,
+ (char *)minor_status_string.value));
+
+ gss_release_buffer(&err_minor_status, &major_status_string);
+ gss_release_buffer(&err_minor_status, &minor_status_string);
+}
+# endif /* DEBUG */
#endif /* HAVE_GSSAPI */
@@ -491,7 +496,8 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
#else
int pid; /* Current process ID */
FILE *fp; /* Certificate file */
- char filename[1024], /* Certificate filename */
+ char trc[16], /* Try Root Certificate parameter */
+ filename[1024], /* Certificate filename */
certificate[33];/* Certificate string */
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
# if defined(HAVE_AUTHORIZATION_H)
@@ -505,7 +511,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
# endif /* HAVE_AUTHORIZATION_H */
- DEBUG_printf(("cups_local_auth(http=%p) hostaddr=%s, hostname=\"%s\"\n",
+ DEBUG_printf(("7cups_local_auth(http=%p) hostaddr=%s, hostname=\"%s\"",
http, httpAddrString(http->hostaddr, filename, sizeof(filename)), http->hostname));
/*
@@ -515,7 +521,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
if (!httpAddrLocalhost(http->hostaddr) &&
strcasecmp(http->hostname, "localhost") != 0)
{
- DEBUG_puts("cups_local_auth: Not a local connection!");
+ DEBUG_puts("8cups_local_auth: Not a local connection!");
return (1);
}
@@ -538,7 +544,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
kAuthorizationFlagDefaults, &http->auth_ref);
if (status != errAuthorizationSuccess)
{
- DEBUG_printf(("cups_local_auth: AuthorizationCreate() returned %d (%s)\n",
+ DEBUG_printf(("8cups_local_auth: AuthorizationCreate() returned %d (%s)",
(int)status, cssmErrorString(status)));
return (-1);
}
@@ -573,14 +579,14 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
httpSetAuthString(http, "AuthRef", buffer);
- DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
+ DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
http->authstring));
return (0);
}
else if (status == errAuthorizationCanceled)
return (-1);
- DEBUG_printf(("cups_local_auth: AuthorizationCopyRights() returned %d (%s)\n",
+ DEBUG_printf(("9cups_local_auth: AuthorizationCopyRights() returned %d (%s)",
(int)status, cssmErrorString(status)));
/*
@@ -598,25 +604,34 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
snprintf(filename, sizeof(filename), "%s/certs/%d", cg->cups_statedir, pid);
if ((fp = fopen(filename, "r")) == NULL && pid > 0)
{
- DEBUG_printf(("cups_local_auth: Unable to open file %s: %s\n",
- filename, strerror(errno)));
-
-#ifdef HAVE_GSSAPI
/*
- * If local certificate authentication isn't available for this PID,
- * check if we need Kerberos authentication...
+ * No certificate for this PID; see if we can get the root certificate...
*/
+ DEBUG_printf(("9cups_local_auth: Unable to open file %s: %s",
+ filename, strerror(errno)));
+
+#ifdef HAVE_GSSAPI
if (!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9))
{
/*
- * Yes, don't try the root certificate...
+ * Kerberos required, don't try the root certificate...
*/
return (1);
}
#endif /* HAVE_GSSAPI */
+ if (!httpGetSubField2(http, HTTP_FIELD_WWW_AUTHENTICATE, "trc", trc,
+ sizeof(trc)))
+ {
+ /*
+ * Scheduler doesn't want us to use the root certificate...
+ */
+
+ return (1);
+ }
+
snprintf(filename, sizeof(filename), "%s/certs/0", cg->cups_statedir);
fp = fopen(filename, "r");
}
@@ -636,7 +651,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
httpSetAuthString(http, "Local", certificate);
- DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
+ DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
http->authstring));
return (0);
@@ -665,7 +680,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
{
httpSetAuthString(http, "PeerCred", username);
- DEBUG_printf(("cups_local_auth: Returning authstring = \"%s\"\n",
+ DEBUG_printf(("8cups_local_auth: Returning authstring=\"%s\"",
http->authstring));
return (0);
diff --git a/cups/backchannel.c b/cups/backchannel.c
index 23caace80..b264b5c89 100644
--- a/cups/backchannel.c
+++ b/cups/backchannel.c
@@ -76,7 +76,7 @@ cupsBackChannelRead(char *buffer, /* I - Buffer to read into */
else
status = select(4, &input, NULL, NULL, &tval);
}
- while (status < 0 && errno != EINTR);
+ while (status < 0 && errno != EINTR && errno != EAGAIN);
if (status < 0)
return (-1); /* Timeout! */
@@ -138,9 +138,9 @@ cupsBackChannelWrite(
else
status = select(4, NULL, &output, NULL, &tval);
}
- while (status < 0 && errno != EINTR);
+ while (status < 0 && errno != EINTR && errno != EAGAIN);
- if (status < 0)
+ if (status <= 0)
return (-1); /* Timeout! */
/*
@@ -159,7 +159,7 @@ cupsBackChannelWrite(
* Write error - abort on fatal errors...
*/
- if (errno != EINTR)
+ if (errno != EINTR && errno != EAGAIN)
return (-1);
}
else
diff --git a/cups/conflicts.c b/cups/conflicts.c
index 254138a49..d6de5a39b 100644
--- a/cups/conflicts.c
+++ b/cups/conflicts.c
@@ -47,6 +47,7 @@
enum
{
_PPD_NORMAL_CONSTRAINTS,
+ _PPD_OPTION_CONSTRAINTS,
_PPD_INSTALLABLE_CONSTRAINTS,
_PPD_ALL_CONSTRAINTS
};
@@ -255,7 +256,7 @@ cupsResolveConflicts(
* Resolver loop!
*/
- DEBUG_printf(("ppdResolveConflicts: Resolver loop with %s!\n",
+ DEBUG_printf(("1ppdResolveConflicts: Resolver loop with %s!",
consts->resolver));
goto error;
}
@@ -263,14 +264,14 @@ cupsResolveConflicts(
if ((resolver = ppdFindAttr(ppd, "cupsUIResolver",
consts->resolver)) == NULL)
{
- DEBUG_printf(("ppdResolveConflicts: Resolver %s not found!\n",
+ DEBUG_printf(("1ppdResolveConflicts: Resolver %s not found!",
consts->resolver));
goto error;
}
if (!resolver->value)
{
- DEBUG_printf(("ppdResolveConflicts: Resolver %s has no value!\n",
+ DEBUG_printf(("1ppdResolveConflicts: Resolver %s has no value!",
consts->resolver));
goto error;
}
@@ -428,7 +429,7 @@ cupsResolveConflicts(
(test = ppd_test_constraints(ppd, constptr->option->keyword,
constptr->option->defchoice,
num_newopts, newopts,
- _PPD_ALL_CONSTRAINTS)) == NULL)
+ _PPD_OPTION_CONSTRAINTS)) == NULL)
{
/*
* That worked...
@@ -459,7 +460,7 @@ cupsResolveConflicts(
(test = ppd_test_constraints(ppd, constptr->option->keyword,
cptr->choice, num_newopts,
newopts,
- _PPD_ALL_CONSTRAINTS)) == NULL)
+ _PPD_OPTION_CONSTRAINTS)) == NULL)
{
/*
* This choice works...
@@ -480,7 +481,7 @@ cupsResolveConflicts(
if (!changed)
{
- DEBUG_puts("ppdResolveConflicts: Unable to automatically resolve "
+ DEBUG_puts("1ppdResolveConflicts: Unable to automatically resolve "
"constraint!");
goto error;
}
@@ -519,10 +520,10 @@ cupsResolveConflicts(
cupsArrayRestore(ppd->sorted_attrs);
- DEBUG_printf(("cupsResolveConflicts: Returning %d options:", num_newopts));
+ DEBUG_printf(("1cupsResolveConflicts: Returning %d options:", num_newopts));
#ifdef DEBUG
for (i = 0; i < num_newopts; i ++)
- DEBUG_printf(("cupsResolveConflicts: options[%d]: %s=%s", i,
+ DEBUG_printf(("1cupsResolveConflicts: options[%d]: %s=%s", i,
newopts[i].name, newopts[i].value));
#endif /* DEBUG */
@@ -542,7 +543,7 @@ cupsResolveConflicts(
cupsArrayRestore(ppd->sorted_attrs);
- DEBUG_puts("cupsResolveConflicts: Unable to resolve conflicts!");
+ DEBUG_puts("1cupsResolveConflicts: Unable to resolve conflicts!");
return (0);
}
@@ -628,6 +629,9 @@ ppdInstallableConflict(
cups_array_t *active; /* Active conflicts */
+ DEBUG_printf(("2ppdInstallableConflict(ppd=%p, option=\"%s\", choice=\"%s\")",
+ ppd, option, choice));
+
/*
* Range check input...
*/
@@ -694,6 +698,8 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
*ptr; /* Pointer into option or choice */
+ DEBUG_printf(("7ppd_load_constraints(ppd=%p)", ppd));
+
/*
* Create an array to hold the constraint data...
*/
@@ -737,7 +743,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
if ((consts = calloc(1, sizeof(_ppd_cups_uiconsts_t))) == NULL)
{
- DEBUG_puts("ppd_load_constraints: Unable to allocate memory for "
+ DEBUG_puts("8ppd_load_constraints: Unable to allocate memory for "
"UIConstraints!");
return;
}
@@ -745,7 +751,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
if ((constptr = calloc(2, sizeof(_ppd_cups_uiconst_t))) == NULL)
{
free(consts);
- DEBUG_puts("ppd_load_constraints: Unable to allocate memory for "
+ DEBUG_puts("8ppd_load_constraints: Unable to allocate memory for "
"UIConstraints!");
return;
}
@@ -775,7 +781,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
if (!constptr[0].option || (!constptr[0].choice && oldconst->choice1[0]))
{
- DEBUG_printf(("ppd_load_constraints: Unknown option *%s %s!\n",
+ DEBUG_printf(("8ppd_load_constraints: Unknown option *%s %s!",
oldconst->option1, oldconst->choice1));
free(consts->constraints);
free(consts);
@@ -800,7 +806,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
if (!constptr[1].option || (!constptr[1].choice && oldconst->choice2[0]))
{
- DEBUG_printf(("ppd_load_constraints: Unknown option *%s %s!\n",
+ DEBUG_printf(("8ppd_load_constraints: Unknown option *%s %s!",
oldconst->option2, oldconst->choice2));
free(consts->constraints);
free(consts);
@@ -826,7 +832,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
{
if (!constattr->value)
{
- DEBUG_puts("ppd_load_constraints: Bad cupsUIConstraints value!");
+ DEBUG_puts("8ppd_load_constraints: Bad cupsUIConstraints value!");
continue;
}
@@ -836,13 +842,13 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
if (i == 0)
{
- DEBUG_puts("ppd_load_constraints: Bad cupsUIConstraints value!");
+ DEBUG_puts("8ppd_load_constraints: Bad cupsUIConstraints value!");
continue;
}
if ((consts = calloc(1, sizeof(_ppd_cups_uiconsts_t))) == NULL)
{
- DEBUG_puts("ppd_load_constraints: Unable to allocate memory for "
+ DEBUG_puts("8ppd_load_constraints: Unable to allocate memory for "
"cupsUIConstraints!");
return;
}
@@ -850,7 +856,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
if ((constptr = calloc(i, sizeof(_ppd_cups_uiconst_t))) == NULL)
{
free(consts);
- DEBUG_puts("ppd_load_constraints: Unable to allocate memory for "
+ DEBUG_puts("8ppd_load_constraints: Unable to allocate memory for "
"cupsUIConstraints!");
return;
}
@@ -901,7 +907,7 @@ ppd_load_constraints(ppd_file_t *ppd) /* I - PPD file */
if (!constptr->option || (!constptr->choice && choice[0]))
{
- DEBUG_printf(("ppd_load_constraints: Unknown option *%s %s!\n",
+ DEBUG_printf(("8ppd_load_constraints: Unknown option *%s %s!",
option, choice));
break;
}
@@ -940,13 +946,14 @@ ppd_test_constraints(
const char *value; /* Current value */
- DEBUG_printf(("ppd_test_constraints(ppd=%p, num_options=%d, options=%p, "
- "which=%d)\n", ppd, num_options, options, which));
+ DEBUG_printf(("7ppd_test_constraints(ppd=%p, option=\"%s\", choice=\"%s\", "
+ "num_options=%d, options=%p, which=%d)", ppd, option, choice,
+ num_options, options, which));
if (!ppd->cups_uiconstraints)
ppd_load_constraints(ppd);
- DEBUG_printf(("ppd_test_constraints: %d constraints!\n",
+ DEBUG_printf(("9ppd_test_constraints: %d constraints!",
cupsArrayCount(ppd->cups_uiconstraints)));
cupsArraySave(ppd->marked);
@@ -955,9 +962,9 @@ ppd_test_constraints(
consts;
consts = (_ppd_cups_uiconsts_t *)cupsArrayNext(ppd->cups_uiconstraints))
{
- DEBUG_printf(("ppd_test_constraints: installable=%d, resolver=\"%s\", "
+ DEBUG_printf(("9ppd_test_constraints: installable=%d, resolver=\"%s\", "
"num_constraints=%d option1=\"%s\", choice1=\"%s\", "
- "option2=\"%s\", choice2=\"%s\", ...\n",
+ "option2=\"%s\", choice2=\"%s\", ...",
consts->installable, consts->resolver, consts->num_constraints,
consts->constraints[0].option->keyword,
consts->constraints[0].choice ?
@@ -966,16 +973,35 @@ ppd_test_constraints(
consts->constraints[1].choice ?
consts->constraints[1].choice->choice : ""));
- if (which != _PPD_ALL_CONSTRAINTS && which != consts->installable)
- continue;
+ if (consts->installable && which < _PPD_INSTALLABLE_CONSTRAINTS)
+ continue; /* Skip installable option constraint */
+
+ if (!consts->installable && which == _PPD_INSTALLABLE_CONSTRAINTS)
+ continue; /* Skip non-installable option constraint */
+
+ if (which == _PPD_OPTION_CONSTRAINTS && option)
+ {
+ /*
+ * Skip constraints that do not involve the current option...
+ */
+
+ for (i = consts->num_constraints, constptr = consts->constraints;
+ i > 0;
+ i --, constptr ++)
+ if (!strcasecmp(constptr->option->keyword, option))
+ break;
+
+ if (!i)
+ continue;
+ }
- DEBUG_puts("ppd_test_constraints: Testing...");
+ DEBUG_puts("9ppd_test_constraints: Testing...");
for (i = consts->num_constraints, constptr = consts->constraints;
i > 0;
i --, constptr ++)
{
- DEBUG_printf(("ppd_test_constraints: %s=%s?\n", constptr->option->keyword,
+ DEBUG_printf(("9ppd_test_constraints: %s=%s?", constptr->option->keyword,
constptr->choice ? constptr->choice->choice : ""));
if (constptr->choice &&
@@ -1011,7 +1037,7 @@ ppd_test_constraints(
if (!value || strcasecmp(value, constptr->choice->choice))
{
- DEBUG_puts("ppd_test_constraints: NO");
+ DEBUG_puts("9ppd_test_constraints: NO");
break;
}
}
@@ -1026,7 +1052,7 @@ ppd_test_constraints(
if (strcasecmp(value, constptr->choice->choice))
{
- DEBUG_puts("ppd_test_constraints: NO");
+ DEBUG_puts("9ppd_test_constraints: NO");
break;
}
}
@@ -1038,13 +1064,13 @@ ppd_test_constraints(
if (strcasecmp(value, constptr->choice->choice))
{
- DEBUG_puts("ppd_test_constraints: NO");
+ DEBUG_puts("9ppd_test_constraints: NO");
break;
}
}
else if (!constptr->choice->marked)
{
- DEBUG_puts("ppd_test_constraints: NO");
+ DEBUG_puts("9ppd_test_constraints: NO");
break;
}
}
@@ -1054,7 +1080,7 @@ ppd_test_constraints(
if (!strcasecmp(choice, "None") || !strcasecmp(choice, "Off") ||
!strcasecmp(choice, "False"))
{
- DEBUG_puts("ppd_test_constraints: NO");
+ DEBUG_puts("9ppd_test_constraints: NO");
break;
}
}
@@ -1064,7 +1090,7 @@ ppd_test_constraints(
if (!strcasecmp(value, "None") || !strcasecmp(value, "Off") ||
!strcasecmp(value, "False"))
{
- DEBUG_puts("ppd_test_constraints: NO");
+ DEBUG_puts("9ppd_test_constraints: NO");
break;
}
}
@@ -1078,7 +1104,7 @@ ppd_test_constraints(
!strcasecmp(marked->choice, "Off") ||
!strcasecmp(marked->choice, "False")))
{
- DEBUG_puts("ppd_test_constraints: NO");
+ DEBUG_puts("9ppd_test_constraints: NO");
break;
}
}
@@ -1090,13 +1116,13 @@ ppd_test_constraints(
active = cupsArrayNew(NULL, NULL);
cupsArrayAdd(active, consts);
- DEBUG_puts("ppd_test_constraints: Added...");
+ DEBUG_puts("9ppd_test_constraints: Added...");
}
}
cupsArrayRestore(ppd->marked);
- DEBUG_printf(("ppd_test_constraints: Found %d active constraints!\n",
+ DEBUG_printf(("8ppd_test_constraints: Found %d active constraints!",
cupsArrayCount(active)));
return (active);
diff --git a/cups/debug.c b/cups/debug.c
index 80f28f1c2..cd622c961 100644
--- a/cups/debug.c
+++ b/cups/debug.c
@@ -3,7 +3,7 @@
*
* Debugging functions for the Common UNIX Printing System (CUPS).
*
- * Copyright 2008 by Apple Inc.
+ * Copyright 2008-2009 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -29,6 +29,7 @@
#include <sys/time.h>
#include <fcntl.h>
#include <unistd.h>
+#include <regex.h>
/*
@@ -44,8 +45,11 @@ int _cups_debug_fd = -1;
* Local globals...
*/
-static int debug_init = 0; /* Did we initialize debugging? */
+static regex_t *debug_filter = NULL;
+ /* Filter expression for messages */
+static int debug_init = 1; /* Did we initialize debugging? */
# ifdef HAVE_PTHREAD_H
+static int debug_level = 0;/* Log level (0 to 9) */
static pthread_mutex_t debug_mutex = PTHREAD_MUTEX_INITIALIZER;
/* Mutex to control initialization */
# endif /* HAVE_PTHREAD_H */
@@ -393,8 +397,13 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
struct timeval curtime; /* Current time */
char buffer[2048]; /* Output buffer */
size_t bytes; /* Number of bytes in buffer */
- const char *cups_debug_log;/* CUPS_DEBUG_LOG environment variable */
-
+ int level; /* Log level in message */
+ const char *cups_debug_filter,
+ /* CUPS_DEBUG_FILTER environment variable */
+ *cups_debug_level,
+ /* CUPS_DEBUG_LEVEL environment variable */
+ *cups_debug_log;/* CUPS_DEBUG_LOG environment variable */
+
/*
* See if we need to do any logging...
@@ -422,6 +431,23 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
snprintf(buffer, sizeof(buffer), cups_debug_log, getpid());
_cups_debug_fd = open(buffer, O_WRONLY | O_APPEND | O_CREAT, 0644);
}
+
+ if ((cups_debug_level = getenv("CUPS_DEBUG_LEVEL")) != NULL)
+ debug_level = atoi(cups_debug_level);
+
+ if ((cups_debug_filter = getenv("CUPS_DEBUG_FILTER")) != NULL)
+ {
+ if ((debug_filter = (regex_t *)calloc(1, sizeof(regex_t))) == NULL)
+ fputs("Unable to allocate memory for CUPS_DEBUG_FILTER - results not "
+ "filtered!\n", stderr);
+ else if (regcomp(debug_filter, cups_debug_filter, REG_EXTENDED))
+ {
+ fputs("Bad regular expression in CUPS_DEBUG_FILTER - results not "
+ "filtered!\n", stderr);
+ free(debug_filter);
+ debug_filter = NULL;
+ }
+ }
}
pthread_mutex_unlock(&debug_mutex);
@@ -431,6 +457,30 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
return;
/*
+ * Filter as needed...
+ */
+
+ if (isdigit(format[0]))
+ level = *format++ - '0';
+ else
+ level = 0;
+
+ if (level > debug_level)
+ return;
+
+ if (debug_filter)
+ {
+ int result; /* Filter result */
+
+ pthread_mutex_lock(&debug_mutex);
+ result = regexec(debug_filter, format, 0, NULL, 0);
+ pthread_mutex_unlock(&debug_mutex);
+
+ if (result)
+ return;
+ }
+
+ /*
* Format the message...
*/
@@ -467,7 +517,14 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
void
_cups_debug_puts(const char *s) /* I - String to output */
{
- _cups_debug_printf("%s\n", s);
+ char format[4]; /* C%s */
+
+ format[0] = *s++;
+ format[1] = '%';
+ format[2] = 's';
+ format[3] = '\0';
+
+ _cups_debug_printf(format, s);
}
diff --git a/cups/debug.h b/cups/debug.h
index 0d81b46cb..e13335bfc 100644
--- a/cups/debug.h
+++ b/cups/debug.h
@@ -3,7 +3,7 @@
*
* Debugging macros for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2005 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -36,6 +36,24 @@ extern "C" {
* DEBUG_printf(("format string", arg, arg, ...));
*
* Note the extra parenthesis around the DEBUG_printf macro...
+ *
+ * Newlines are not required on the end of messages, as both add one when
+ * writing the output.
+ *
+ * If the first character is a digit, then it represents the "log level" of the
+ * message from 0 to 9. The default level is 1. The following defines the
+ * current levels we use:
+ *
+ * 0 = public APIs, other than value accessor functions
+ * 1 = return values for public APIs
+ * 2 = public value accessor APIs, progress for public APIs
+ * 3 = return values for value accessor APIs
+ * 4 = private APIs, progress for value accessor APIs
+ * 5 = return values for private APIs
+ * 6 = progress for private APIs
+ * 7 = static functions
+ * 8 = return values for static functions
+ * 9 = progress for static functions
*/
# ifdef DEBUG
diff --git a/cups/dest.c b/cups/dest.c
index 2886a0478..f65e3152d 100644
--- a/cups/dest.c
+++ b/cups/dest.c
@@ -969,7 +969,7 @@ _cupsUserDefault(char *name, /* I - Name buffer */
if (!appleUseLastPrinter())
{
- DEBUG_puts("_cupsUserDefault: Not using last printer as default...");
+ DEBUG_puts("1_cupsUserDefault: Not using last printer as default...");
name[0] = '\0';
return (NULL);
}
@@ -980,14 +980,14 @@ _cupsUserDefault(char *name, /* I - Name buffer */
if ((network = appleCopyNetwork()) == NULL)
{
- DEBUG_puts("_cupsUserDefault: Unable to get current network...");
+ DEBUG_puts("1_cupsUserDefault: Unable to get current network...");
name[0] = '\0';
return (NULL);
}
# ifdef DEBUG
CFStringGetCString(network, name, namesize, kCFStringEncodingUTF8);
- DEBUG_printf(("_cupsUserDefault: network=\"%s\"\n", name));
+ DEBUG_printf(("2_cupsUserDefault: network=\"%s\"", name));
# endif /* DEBUG */
/*
@@ -1000,7 +1000,7 @@ _cupsUserDefault(char *name, /* I - Name buffer */
* Missing or bad location array, so no location-based default...
*/
- DEBUG_puts("_cupsUserDefault: Missing or bad location history array...");
+ DEBUG_puts("1_cupsUserDefault: Missing or bad location history array...");
CFRelease(network);
@@ -1008,7 +1008,7 @@ _cupsUserDefault(char *name, /* I - Name buffer */
return (NULL);
}
- DEBUG_printf(("_cupsUserDefault: Got location, %d entries...\n",
+ DEBUG_printf(("2_cupsUserDefault: Got location, %d entries...",
(int)CFArrayGetCount(locations)));
if ((locprinter = appleGetPrinter(locations, network, NULL)) != NULL)
@@ -1019,7 +1019,7 @@ _cupsUserDefault(char *name, /* I - Name buffer */
CFRelease(network);
CFRelease(locations);
- DEBUG_printf(("_cupsUserDefault: Returning \"%s\"...\n", name));
+ DEBUG_printf(("1_cupsUserDefault: Returning \"%s\"...", name));
return (*name ? name : NULL);
@@ -1191,7 +1191,7 @@ appleSetDefault(const char *name) /* I - Default printer/class name */
if ((network = appleCopyNetwork()) == NULL)
{
- DEBUG_puts("appleSetDefault: Unable to get current network...");
+ DEBUG_puts("1appleSetDefault: Unable to get current network...");
return;
}
@@ -1568,9 +1568,9 @@ cups_get_dests(
int linenum; /* Current line number */
- DEBUG_printf(("cups_get_dests(filename=\"%s\", match_name=\"%s\", "
+ DEBUG_printf(("7cups_get_dests(filename=\"%s\", match_name=\"%s\", "
"match_inst=\"%s\", user_default_set=%d, num_dests=%d, "
- "dests=%p)\n", filename, match_name, match_inst,
+ "dests=%p)", filename, match_name, match_inst,
user_default_set, num_dests, dests));
/*
@@ -1595,12 +1595,12 @@ cups_get_dests(
* See what type of line it is...
*/
- DEBUG_printf(("cups_get_dests: linenum=%d line=\"%s\" lineptr=\"%s\"\n",
+ DEBUG_printf(("9cups_get_dests: linenum=%d line=\"%s\" lineptr=\"%s\"",
linenum, line, lineptr));
if ((strcasecmp(line, "dest") && strcasecmp(line, "default")) || !lineptr)
{
- DEBUG_puts("cups_get_dests: Not a dest or default line...");
+ DEBUG_puts("9cups_get_dests: Not a dest or default line...");
continue;
}
@@ -1635,7 +1635,7 @@ cups_get_dests(
if (*lineptr)
*lineptr++ = '\0';
- DEBUG_printf(("cups_get_dests: name=\"%s\", instance=\"%s\"\n", name,
+ DEBUG_printf(("9cups_get_dests: name=\"%s\", instance=\"%s\"", name,
instance));
/*
@@ -1655,7 +1655,7 @@ cups_get_dests(
}
else if (cupsGetDest(name, NULL, num_dests, *dests) == NULL)
{
- DEBUG_puts("cups_get_dests: Not found!");
+ DEBUG_puts("9cups_get_dests: Not found!");
continue;
}
else
@@ -1672,7 +1672,7 @@ cups_get_dests(
* Out of memory!
*/
- DEBUG_puts("cups_get_dests: Out of memory!");
+ DEBUG_puts("9cups_get_dests: Out of memory!");
break;
}
}
@@ -1697,7 +1697,7 @@ cups_get_dests(
if (!user_default_set && !strcasecmp(line, "default"))
{
- DEBUG_puts("cups_get_dests: Setting as default...");
+ DEBUG_puts("9cups_get_dests: Setting as default...");
for (i = 0; i < num_dests; i ++)
(*dests)[i].is_default = 0;
diff --git a/cups/dir.c b/cups/dir.c
index 319908f1f..5cb4d060e 100644
--- a/cups/dir.c
+++ b/cups/dir.c
@@ -5,7 +5,7 @@
*
* This set of APIs abstracts enumeration of directory entries.
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -271,7 +271,7 @@ struct _cups_dir_s /**** Directory data structure ****/
void
cupsDirClose(cups_dir_t *dp) /* I - Directory pointer */
{
- DEBUG_printf(("cupsDirClose(dp=%p)\n", dp));
+ DEBUG_printf(("cupsDirClose(dp=%p)", dp));
/*
* Range check input...
@@ -301,7 +301,7 @@ cupsDirOpen(const char *directory) /* I - Directory name */
cups_dir_t *dp; /* Directory */
- DEBUG_printf(("cupsDirOpen(directory=\"%s\")\n", directory));
+ DEBUG_printf(("cupsDirOpen(directory=\"%s\")", directory));
/*
* Range check input...
@@ -360,7 +360,7 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
# endif /* HAVE_PTHREAD_H */
- DEBUG_printf(("cupsDirRead(dp=%p)\n", dp));
+ DEBUG_printf(("2cupsDirRead(dp=%p)", dp));
/*
* Range check input...
@@ -382,17 +382,18 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
if (readdir_r(dp->dir, (struct dirent *)buffer, &entry))
{
- DEBUG_printf((" readdir_r() failed - %s\n", strerror(errno)));
+ DEBUG_printf(("3cupsDirRead: readdir_r() failed - %s\n", strerror(errno)));
return (NULL);
}
if (!entry)
{
- DEBUG_puts(" readdir_r() returned a NULL pointer!");
+ DEBUG_puts("3cupsDirRead: readdir_r() returned a NULL pointer!");
return (NULL);
}
- DEBUG_printf((" readdir_r() returned \"%s\"...\n", entry->d_name));
+ DEBUG_printf(("4cupsDirRead: readdir_r() returned \"%s\"...",
+ entry->d_name));
# else
/*
@@ -401,11 +402,11 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
if ((entry = readdir(dp->dir)) == NULL)
{
- DEBUG_puts(" readdir() returned a NULL pointer!");
+ DEBUG_puts("3cupsDirRead: readdir() returned a NULL pointer!");
return (NULL);
}
- DEBUG_printf((" readdir() returned \"%s\"...\n", entry->d_name));
+ DEBUG_printf(("4cupsDirRead: readdir() returned \"%s\"...", entry->d_name));
# endif /* HAVE_PTHREAD_H */
@@ -426,7 +427,7 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
if (stat(filename, &(dp->entry.fileinfo)))
{
- DEBUG_printf((" stat() failed for \"%s\" - %s...\n", filename,
+ DEBUG_printf(("3cupsDirRead: stat() failed for \"%s\" - %s...", filename,
strerror(errno)));
continue;
}
@@ -449,7 +450,7 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
void
cupsDirRewind(cups_dir_t *dp) /* I - Directory pointer */
{
- DEBUG_printf(("cupsDirRewind(dp=%p)\n", dp));
+ DEBUG_printf(("cupsDirRewind(dp=%p)", dp));
/*
* Range check input...
diff --git a/cups/emit.c b/cups/emit.c
index 3389607f9..922c8b917 100644
--- a/cups/emit.c
+++ b/cups/emit.c
@@ -109,7 +109,7 @@ ppdCollect2(ppd_file_t *ppd, /* I - PPD file data */
float *orders; /* Collected order values */
- DEBUG_printf(("ppdCollect2(ppd=%p, section=%d, min_order=%f, choices=%p)\n",
+ DEBUG_printf(("ppdCollect2(ppd=%p, section=%d, min_order=%f, choices=%p)",
ppd, section, min_order, choices));
if (!ppd || !choices)
@@ -223,7 +223,7 @@ ppdCollect2(ppd_file_t *ppd, /* I - PPD file data */
free(orders);
- DEBUG_printf(("ppdCollect2: %d marked choices...\n", count));
+ DEBUG_printf(("2ppdCollect2: %d marked choices...", count));
/*
* Return the array and number of choices; if 0, free the array since
@@ -626,7 +626,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
struct lconv *loc; /* Locale data */
- DEBUG_printf(("ppdEmitString(ppd=%p, section=%d, min_order=%f)\n",
+ DEBUG_printf(("ppdEmitString(ppd=%p, section=%d, min_order=%f)",
ppd, section, min_order));
/*
@@ -697,7 +697,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
!strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
!strcasecmp(choices[i]->choice, "Custom"))
{
- DEBUG_puts("ppdEmitString: Custom size set!");
+ DEBUG_puts("2ppdEmitString: Custom size set!");
bufsize += 37; /* %%BeginFeature: *CustomPageSize True\n */
bufsize += 50; /* Five 9-digit numbers + newline */
@@ -752,7 +752,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
* Allocate memory...
*/
- DEBUG_printf(("ppdEmitString: Allocating %d bytes for string...\n",
+ DEBUG_printf(("2ppdEmitString: Allocating %d bytes for string...",
(int)bufsize));
if ((buffer = calloc(1, bufsize)) == NULL)
@@ -865,8 +865,8 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
* Send DSC comments with option...
*/
- DEBUG_printf(("Adding code for %s=%s...\n", choices[i]->option->keyword,
- choices[i]->choice));
+ DEBUG_printf(("2ppdEmitString: Adding code for %s=%s...",
+ choices[i]->option->keyword, choices[i]->choice));
if ((!strcasecmp(choices[i]->option->keyword, "PageSize") ||
!strcasecmp(choices[i]->option->keyword, "PageRegion")) &&
@@ -1070,7 +1070,7 @@ ppdEmitString(ppd_file_t *ppd, /* I - PPD file record */
"} stopped cleartomark\n", bufend - bufptr + 1);
bufptr += strlen(bufptr);
- DEBUG_printf(("ppdEmitString: Offset in string is %d...\n",
+ DEBUG_printf(("2ppdEmitString: Offset in string is %d...",
(int)(bufptr - buffer)));
}
else
diff --git a/cups/encode.c b/cups/encode.c
index 7ef63c915..3bdcbba05 100644
--- a/cups/encode.c
+++ b/cups/encode.c
@@ -187,7 +187,7 @@ cupsEncodeOptions(ipp_t *ipp, /* I - Request to add to */
int num_options, /* I - Number of options */
cups_option_t *options) /* I - Options */
{
- DEBUG_printf(("cupsEncodeOptions(%p, %d, %p)\n", ipp, num_options, options));
+ DEBUG_printf(("cupsEncodeOptions(%p, %d, %p)", ipp, num_options, options));
/*
* Add the options in the proper groups & order...
@@ -232,7 +232,7 @@ cupsEncodeOptions2(
DEBUG_printf(("cupsEncodeOptions2(ipp=%p, num_options=%d, options=%p, "
- "group_tag=%x)\n", ipp, num_options, options, group_tag));
+ "group_tag=%x)", ipp, num_options, options, group_tag));
/*
* Range check input...
@@ -340,7 +340,7 @@ cupsEncodeOptions2(
else
count = 1;
- DEBUG_printf(("cupsEncodeOptions2: option = \'%s\', count = %d\n",
+ DEBUG_printf(("2cupsEncodeOptions2: option=\"%s\", count=%d",
option->name, count));
/*
@@ -353,7 +353,7 @@ cupsEncodeOptions2(
* Ran out of memory!
*/
- DEBUG_puts("cupsEncodeOptions2: Ran out of memory for attributes!");
+ DEBUG_puts("1cupsEncodeOptions2: Ran out of memory for attributes!");
return;
}
@@ -382,7 +382,7 @@ cupsEncodeOptions2(
* Ran out of memory!
*/
- DEBUG_puts("cupsEncodeOptions2: Ran out of memory for value copy!");
+ DEBUG_puts("1cupsEncodeOptions2: Ran out of memory for value copy!");
ippDeleteAttribute(ipp, attr);
return;
}
@@ -459,8 +459,8 @@ cupsEncodeOptions2(
attr->values[j].integer = strtol(val, &s, 10);
- DEBUG_printf(("cupsEncodeOptions2: Added integer option value %d...\n",
- attr->values[j].integer));
+ DEBUG_printf(("2cupsEncodeOptions2: Added integer option value "
+ "%d...", attr->values[j].integer));
break;
case IPP_TAG_BOOLEAN :
@@ -474,7 +474,7 @@ cupsEncodeOptions2(
attr->values[j].boolean = 1;
- DEBUG_puts("cupsEncodeOptions2: Added boolean true value...");
+ DEBUG_puts("2cupsEncodeOptions2: Added boolean true value...");
}
else
{
@@ -484,7 +484,7 @@ cupsEncodeOptions2(
attr->values[j].boolean = 0;
- DEBUG_puts("cupsEncodeOptions2: Added boolean false value...");
+ DEBUG_puts("2cupsEncodeOptions2: Added boolean false value...");
}
break;
@@ -511,8 +511,8 @@ cupsEncodeOptions2(
else
attr->values[j].range.upper = attr->values[j].range.lower;
- DEBUG_printf(("cupsEncodeOptions2: Added range option value %d-%d...\n",
- attr->values[j].range.lower,
+ DEBUG_printf(("2cupsEncodeOptions2: Added range option value "
+ "%d-%d...", attr->values[j].range.lower,
attr->values[j].range.upper));
break;
@@ -533,8 +533,8 @@ cupsEncodeOptions2(
else
attr->values[j].resolution.units = IPP_RES_PER_INCH;
- DEBUG_printf(("cupsEncodeOptions2: Added resolution option value %s...\n",
- val));
+ DEBUG_printf(("2cupsEncodeOptions2: Added resolution option value "
+ "%s...", val));
break;
case IPP_TAG_STRING :
@@ -545,8 +545,8 @@ cupsEncodeOptions2(
attr->values[j].unknown.length = (int)strlen(val);
attr->values[j].unknown.data = strdup(val);
- DEBUG_printf(("cupsEncodeOptions2: Added octet-string value "
- "\"%s\"...\n", (char *)attr->values[j].unknown.data));
+ DEBUG_printf(("2cupsEncodeOptions2: Added octet-string value "
+ "\"%s\"...", (char *)attr->values[j].unknown.data));
break;
case IPP_TAG_BEGIN_COLLECTION :
@@ -578,7 +578,7 @@ cupsEncodeOptions2(
* Ran out of memory!
*/
- DEBUG_puts("cupsEncodeOptions2: Ran out of memory for string!");
+ DEBUG_puts("1cupsEncodeOptions2: Ran out of memory for string!");
if (copy)
free(copy);
@@ -587,7 +587,7 @@ cupsEncodeOptions2(
return;
}
- DEBUG_printf(("cupsEncodeOptions2: Added string value \"%s\"...\n",
+ DEBUG_printf(("2cupsEncodeOptions2: Added string value \"%s\"...",
val));
break;
}
diff --git a/cups/file.c b/cups/file.c
index ed54f22fc..4b9d65e79 100644
--- a/cups/file.c
+++ b/cups/file.c
@@ -88,7 +88,7 @@ cupsFileClose(cups_file_t *fp) /* I - CUPS file */
int is_stdio; /* Is a stdio file? */
- DEBUG_printf(("cupsFileClose(fp=%p)\n", fp));
+ DEBUG_printf(("cupsFileClose(fp=%p)", fp));
/*
* Range check...
@@ -258,6 +258,10 @@ cupsFileFind(const char *filename, /* I - File to find */
* Range check input...
*/
+ DEBUG_printf(("cupsFileFind(filename=\"%s\", path=\"%s\", executable=%d, "
+ "buffer=%p, bufsize=%d)", filename, path, executable, buffer,
+ bufsize));
+
if (!filename || !buffer || bufsize < 2)
return (NULL);
@@ -302,7 +306,7 @@ cupsFileFind(const char *filename, /* I - File to find */
if (!access(buffer, executable ? X_OK : 0))
#endif /* WIN32 */
{
- DEBUG_printf(("cupsFileFind: Returning \"%s\"\n", buffer));
+ DEBUG_printf(("1cupsFileFind: Returning \"%s\"", buffer));
return (buffer);
}
@@ -325,12 +329,12 @@ cupsFileFind(const char *filename, /* I - File to find */
if (!access(buffer, 0))
{
- DEBUG_printf(("cupsFileFind: Returning \"%s\"\n", buffer));
+ DEBUG_printf(("1cupsFileFind: Returning \"%s\"", buffer));
return (buffer);
}
else
{
- DEBUG_puts("cupsFileFind: Returning NULL");
+ DEBUG_puts("1cupsFileFind: Returning NULL");
return (NULL);
}
}
@@ -348,7 +352,7 @@ cupsFileFlush(cups_file_t *fp) /* I - CUPS file */
ssize_t bytes; /* Bytes to write */
- DEBUG_printf(("cupsFileFlush(fp=%p)\n", fp));
+ DEBUG_printf(("cupsFileFlush(fp=%p)", fp));
/*
* Range check input...
@@ -356,13 +360,13 @@ cupsFileFlush(cups_file_t *fp) /* I - CUPS file */
if (!fp || fp->mode != 'w')
{
- DEBUG_puts("cupsFileFlush: Attempt to flush a read-only file...");
+ DEBUG_puts("1cupsFileFlush: Attempt to flush a read-only file...");
return (-1);
}
bytes = (ssize_t)(fp->ptr - fp->buf);
- DEBUG_printf(("cupsFileFlush: Flushing " CUPS_LLFMT " bytes...\n",
+ DEBUG_printf(("2cupsFileFlush: Flushing " CUPS_LLFMT " bytes...",
CUPS_LLCAST bytes));
if (bytes > 0)
@@ -397,11 +401,9 @@ cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
* Range check input...
*/
- DEBUG_printf(("cupsFileGetChar(fp=%p)\n", fp));
-
if (!fp || (fp->mode != 'r' && fp->mode != 's'))
{
- DEBUG_puts("cupsFileGetChar: Bad arguments!");
+ DEBUG_puts("3cupsFileGetChar: Bad arguments!");
return (-1);
}
@@ -412,7 +414,7 @@ cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
if (fp->ptr >= fp->end)
if (cups_fill(fp) < 0)
{
- DEBUG_puts("cupsFileGetChar: Unable to fill buffer!");
+ DEBUG_puts("3cupsFileGetChar: Unable to fill buffer!");
return (-1);
}
@@ -420,11 +422,11 @@ cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
* Return the next character in the buffer...
*/
- DEBUG_printf(("cupsFileGetChar: Returning %d...\n", *(fp->ptr) & 255));
+ DEBUG_printf(("3cupsFileGetChar: Returning %d...", *(fp->ptr) & 255));
fp->pos ++;
- DEBUG_printf(("cupsFileGetChar: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("4cupsFileGetChar: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
return (*(fp->ptr)++ & 255);
}
@@ -450,8 +452,8 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
* Range check input...
*/
- DEBUG_printf(("cupsFileGetConf(fp=%p, buf=%p, buflen=" CUPS_LLFMT
- ", value=%p, linenum=%p)\n", fp, buf, CUPS_LLCAST buflen,
+ DEBUG_printf(("2cupsFileGetConf(fp=%p, buf=%p, buflen=" CUPS_LLFMT
+ ", value=%p, linenum=%p)", fp, buf, CUPS_LLCAST buflen,
value, linenum));
if (!fp || (fp->mode != 'r' && fp->mode != 's') ||
@@ -594,7 +596,7 @@ cupsFileGetLine(cups_file_t *fp, /* I - File to read from */
* Range check input...
*/
- DEBUG_printf(("cupsFileGetLine(fp=%p, buf=%p, buflen=" CUPS_LLFMT ")\n",
+ DEBUG_printf(("2cupsFileGetLine(fp=%p, buf=%p, buflen=" CUPS_LLFMT ")",
fp, buf, CUPS_LLCAST buflen));
if (!fp || (fp->mode != 'r' && fp->mode != 's') || !buf || buflen < 3)
@@ -643,7 +645,7 @@ cupsFileGetLine(cups_file_t *fp, /* I - File to read from */
*ptr = '\0';
- DEBUG_printf(("cupsFileGetLine: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("4cupsFileGetLine: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
return (ptr - buf);
}
@@ -669,7 +671,7 @@ cupsFileGets(cups_file_t *fp, /* I - CUPS file */
* Range check input...
*/
- DEBUG_printf(("cupsFileGets(fp=%p, buf=%p, buflen=" CUPS_LLFMT ")\n", fp, buf,
+ DEBUG_printf(("2cupsFileGets(fp=%p, buf=%p, buflen=" CUPS_LLFMT ")", fp, buf,
CUPS_LLCAST buflen));
if (!fp || (fp->mode != 'r' && fp->mode != 's') || !buf || buflen < 2)
@@ -725,7 +727,7 @@ cupsFileGets(cups_file_t *fp, /* I - CUPS file */
*ptr = '\0';
- DEBUG_printf(("cupsFileGets: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("4cupsFileGets: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
return (buf);
}
@@ -806,7 +808,7 @@ cupsFileOpen(const char *filename, /* I - Name of file */
http_addrlist_t *addrlist; /* Host address list */
- DEBUG_printf(("cupsFileOpen(filename=\"%s\", mode=\"%s\")\n", filename,
+ DEBUG_printf(("cupsFileOpen(filename=\"%s\", mode=\"%s\")", filename,
mode));
/*
@@ -909,7 +911,7 @@ cupsFileOpenFd(int fd, /* I - File descriptor */
cups_file_t *fp; /* New CUPS file */
- DEBUG_printf(("cupsFileOpenFd(fd=%d, mode=\"%s\")\n", fd, mode));
+ DEBUG_printf(("cupsFileOpenFd(fd=%d, mode=\"%s\")", fd, mode));
/*
* Range check input...
@@ -1055,7 +1057,7 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
ssize_t bytes; /* Formatted size */
- DEBUG_printf(("cupsFilePrintf(fp=%p, format=\"%s\", ...)\n", fp, format));
+ DEBUG_printf(("2cupsFilePrintf(fp=%p, format=\"%s\", ...)", fp, format));
if (!fp || !format || (fp->mode != 'w' && fp->mode != 's'))
return (-1);
@@ -1106,7 +1108,7 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
fp->pos += bytes;
- DEBUG_printf(("cupsFilePrintf: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("4cupsFilePrintf: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
return (bytes);
}
@@ -1117,7 +1119,7 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
fp->pos += bytes;
- DEBUG_printf(("cupsFilePrintf: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("4cupsFilePrintf: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
if (bytes > sizeof(fp->buf))
{
@@ -1183,7 +1185,7 @@ cupsFilePutChar(cups_file_t *fp, /* I - CUPS file */
fp->pos ++;
- DEBUG_printf(("cupsFilePutChar: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("4cupsFilePutChar: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
return (0);
}
@@ -1285,7 +1287,7 @@ cupsFilePuts(cups_file_t *fp, /* I - CUPS file */
fp->pos += bytes;
- DEBUG_printf(("cupsFilePuts: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("4cupsFilePuts: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
return (bytes);
}
@@ -1296,7 +1298,7 @@ cupsFilePuts(cups_file_t *fp, /* I - CUPS file */
fp->pos += bytes;
- DEBUG_printf(("cupsFilePuts: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("4cupsFilePuts: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
if (bytes > sizeof(fp->buf))
{
@@ -1331,7 +1333,7 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
ssize_t count; /* Bytes read */
- DEBUG_printf(("cupsFileRead(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n", fp, buf,
+ DEBUG_printf(("2cupsFileRead(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")", fp, buf,
CUPS_LLCAST bytes));
/*
@@ -1354,8 +1356,8 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
if (fp->ptr >= fp->end)
if (cups_fill(fp) <= 0)
{
- DEBUG_printf(("cupsFileRead: cups_fill() returned -1, total=" CUPS_LLFMT "\n",
- CUPS_LLCAST total));
+ DEBUG_printf(("4cupsFileRead: cups_fill() returned -1, total="
+ CUPS_LLFMT, CUPS_LLCAST total));
if (total > 0)
return ((ssize_t)total);
@@ -1371,7 +1373,7 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
fp->ptr += count;
fp->pos += count;
- DEBUG_printf(("cupsFileRead: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("4cupsFileRead: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
/*
* Update the counts for the last read...
@@ -1386,7 +1388,7 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
* Return the total number of bytes read...
*/
- DEBUG_printf(("cupsFileRead: total=%d\n", (int)total));
+ DEBUG_printf(("3cupsFileRead: total=" CUPS_LLFMT, CUPS_LLCAST total));
return ((ssize_t)total);
}
@@ -1406,8 +1408,8 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
* Range check input...
*/
- DEBUG_printf(("cupsFileRewind(fp=%p)\n", fp));
- DEBUG_printf(("cupsFileRewind: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("cupsFileRewind(fp=%p)", fp));
+ DEBUG_printf(("2cupsFileRewind: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
if (!fp || fp->mode != 'r')
return (-1);
@@ -1430,7 +1432,7 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
fp->eof = 0;
}
- DEBUG_printf(("cupsFileRewind: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("2cupsFileRewind: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
return (0);
}
@@ -1449,7 +1451,7 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
if (lseek(fp->fd, 0, SEEK_SET))
{
- DEBUG_printf(("cupsFileRewind: lseek failed: %s\n", strerror(errno)));
+ DEBUG_printf(("1cupsFileRewind: lseek failed: %s", strerror(errno)));
return (-1);
}
@@ -1459,7 +1461,7 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
fp->end = NULL;
fp->eof = 0;
- DEBUG_printf(("cupsFileRewind: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("2cupsFileRewind: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
return (0);
}
@@ -1478,10 +1480,10 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
ssize_t bytes; /* Number bytes in buffer */
- DEBUG_printf(("cupsFileSeek(fp=%p, pos=" CUPS_LLFMT ")\n", fp,
+ DEBUG_printf(("cupsFileSeek(fp=%p, pos=" CUPS_LLFMT ")", fp,
CUPS_LLCAST pos));
- DEBUG_printf(("cupsFileSeek: fp->pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
- DEBUG_printf(("cupsFileSeek: fp->ptr=%p, fp->end=%p\n", fp->ptr, fp->end));
+ DEBUG_printf(("2cupsFileSeek: fp->pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
+ DEBUG_printf(("2cupsFileSeek: fp->ptr=%p, fp->end=%p", fp->ptr, fp->end));
/*
* Range check input...
@@ -1501,7 +1503,7 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
{
bytes = (ssize_t)(fp->end - fp->buf);
- DEBUG_printf(("cupsFileSeek: bytes=" CUPS_LLFMT "\n", CUPS_LLCAST bytes));
+ DEBUG_printf(("2cupsFileSeek: bytes=" CUPS_LLFMT, CUPS_LLCAST bytes));
if (pos >= fp->bufpos && pos < (fp->bufpos + bytes))
{
@@ -1541,7 +1543,7 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
* Need to seek backwards...
*/
- DEBUG_puts("cupsFileSeek: SEEK BACKWARDS");
+ DEBUG_puts("2cupsFileSeek: SEEK BACKWARDS");
#ifdef HAVE_LIBZ
if (fp->compressed)
@@ -1572,7 +1574,7 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
fp->ptr = NULL;
fp->end = NULL;
- DEBUG_printf(("cupsFileSeek: lseek() returned " CUPS_LLFMT "...\n",
+ DEBUG_printf(("2cupsFileSeek: lseek() returned " CUPS_LLFMT,
CUPS_LLCAST fp->pos));
}
}
@@ -1582,7 +1584,7 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
* Need to seek forwards...
*/
- DEBUG_puts("cupsFileSeek: SEEK FORWARDS");
+ DEBUG_puts("2cupsFileSeek: SEEK FORWARDS");
#ifdef HAVE_LIBZ
if (fp->compressed)
@@ -1607,12 +1609,12 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
fp->ptr = NULL;
fp->end = NULL;
- DEBUG_printf(("cupsFileSeek: lseek() returned " CUPS_LLFMT "...\n",
+ DEBUG_printf(("2cupsFileSeek: lseek() returned " CUPS_LLFMT,
CUPS_LLCAST fp->pos));
}
}
- DEBUG_printf(("cupsFileSeek: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("2cupsFileSeek: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
return (fp->pos);
}
@@ -1729,8 +1731,9 @@ cupsFileStdout(void)
off_t /* O - File position */
cupsFileTell(cups_file_t *fp) /* I - CUPS file */
{
- DEBUG_printf(("cupsFileTell(fp=%p)\n", fp));
- DEBUG_printf(("cupsFileTell: pos=" CUPS_LLFMT "\n", CUPS_LLCAST (fp ? fp->pos : -1)));
+ DEBUG_printf(("2cupsFileTell(fp=%p)", fp));
+ DEBUG_printf(("3cupsFileTell: pos=" CUPS_LLFMT,
+ CUPS_LLCAST (fp ? fp->pos : -1)));
return (fp ? fp->pos : 0);
}
@@ -1749,7 +1752,7 @@ cupsFileUnlock(cups_file_t *fp) /* I - CUPS file */
* Range check...
*/
- DEBUG_printf(("cupsFileUnlock(fp=%p)\n", fp));
+ DEBUG_printf(("cupsFileUnlock(fp=%p)", fp));
if (!fp || fp->mode == 's')
return (-1);
@@ -1781,7 +1784,7 @@ cupsFileWrite(cups_file_t *fp, /* I - CUPS file */
* Range check input...
*/
- DEBUG_printf(("cupsFileWrite(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n",
+ DEBUG_printf(("2cupsFileWrite(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")",
fp, buf, CUPS_LLCAST bytes));
if (!fp || !buf || bytes < 0 || (fp->mode != 'w' && fp->mode != 's'))
@@ -1801,7 +1804,7 @@ cupsFileWrite(cups_file_t *fp, /* I - CUPS file */
fp->pos += (off_t)bytes;
- DEBUG_printf(("cupsFileWrite: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("4cupsFileWrite: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
return ((ssize_t)bytes);
}
@@ -1812,7 +1815,7 @@ cupsFileWrite(cups_file_t *fp, /* I - CUPS file */
fp->pos += (off_t)bytes;
- DEBUG_printf(("cupsFileWrite: pos=" CUPS_LLFMT "\n", CUPS_LLCAST fp->pos));
+ DEBUG_printf(("4cupsFileWrite: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
if (bytes > sizeof(fp->buf))
{
@@ -1842,7 +1845,7 @@ cups_compress(cups_file_t *fp, /* I - CUPS file */
const char *buf, /* I - Buffer */
size_t bytes) /* I - Number bytes */
{
- DEBUG_printf(("cups_compress(fp=%p, buf=%p, bytes=" CUPS_LLFMT "\n", fp, buf,
+ DEBUG_printf(("7cups_compress(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")", fp, buf,
CUPS_LLCAST bytes));
/*
@@ -1864,7 +1867,7 @@ cups_compress(cups_file_t *fp, /* I - CUPS file */
* Flush the current buffer...
*/
- DEBUG_printf(("cups_compress: avail_in=%d, avail_out=%d\n",
+ DEBUG_printf(("9cups_compress: avail_in=%d, avail_out=%d",
fp->stream.avail_in, fp->stream.avail_out));
if (fp->stream.avail_out < (int)(sizeof(fp->cbuf) / 8))
@@ -1899,16 +1902,16 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
#endif /* HAVE_LIBZ */
- DEBUG_printf(("cups_fill(fp=%p)\n", fp));
- DEBUG_printf(("cups_fill: fp->ptr=%p, fp->end=%p, fp->buf=%p, "
- "fp->bufpos=" CUPS_LLFMT ", fp->eof=%d\n",
+ DEBUG_printf(("7cups_fill(fp=%p)", fp));
+ DEBUG_printf(("9cups_fill: fp->ptr=%p, fp->end=%p, fp->buf=%p, "
+ "fp->bufpos=" CUPS_LLFMT ", fp->eof=%d",
fp->ptr, fp->end, fp->buf, CUPS_LLCAST fp->bufpos, fp->eof));
if (fp->ptr && fp->end)
fp->bufpos += fp->end - fp->buf;
#ifdef HAVE_LIBZ
- DEBUG_printf(("cups_fill: fp->compressed=%d\n", fp->compressed));
+ DEBUG_printf(("9cups_fill: fp->compressed=%d", fp->compressed));
while (!fp->ptr || fp->compressed)
{
@@ -1936,7 +1939,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
* Can't read from file!
*/
- DEBUG_printf(("cups_fill: cups_read() returned " CUPS_LLFMT "!\n",
+ DEBUG_printf(("9cups_fill: cups_read() returned " CUPS_LLFMT,
CUPS_LLCAST bytes));
return (-1);
@@ -1953,7 +1956,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
fp->ptr = fp->buf;
fp->end = fp->buf + bytes;
- DEBUG_printf(("cups_fill: Returning " CUPS_LLFMT "!\n",
+ DEBUG_printf(("9cups_fill: Returning " CUPS_LLFMT,
CUPS_LLCAST bytes));
return (bytes);
@@ -2144,7 +2147,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */
* Bad CRC, mark end-of-file...
*/
- DEBUG_printf(("cups_fill: tcrc=%08x, fp->crc=%08x\n",
+ DEBUG_printf(("9cups_fill: tcrc=%08x, fp->crc=%08x",
(unsigned int)tcrc, (unsigned int)fp->crc));
fp->eof = 1;
@@ -2217,7 +2220,7 @@ cups_read(cups_file_t *fp, /* I - CUPS file */
ssize_t total; /* Total bytes read */
- DEBUG_printf(("cups_read(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n", fp, buf,
+ DEBUG_printf(("7cups_read(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")", fp, buf,
CUPS_LLCAST bytes));
/*
@@ -2238,7 +2241,7 @@ cups_read(cups_file_t *fp, /* I - CUPS file */
total = read(fp->fd, buf, bytes);
#endif /* WIN32 */
- DEBUG_printf(("cups_read: total=" CUPS_LLFMT "\n", CUPS_LLCAST total));
+ DEBUG_printf(("9cups_read: total=" CUPS_LLFMT, CUPS_LLCAST total));
if (total >= 0)
break;
@@ -2274,7 +2277,7 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
ssize_t count; /* Count this time */
- DEBUG_printf(("cups_write(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")\n", fp, buf,
+ DEBUG_printf(("7cups_write(fp=%p, buf=%p, bytes=" CUPS_LLFMT ")", fp, buf,
CUPS_LLCAST bytes));
/*
@@ -2296,7 +2299,7 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
count = write(fp->fd, buf, bytes);
#endif /* WIN32 */
- DEBUG_printf(("cups_write: count=" CUPS_LLFMT "\n", CUPS_LLCAST count));
+ DEBUG_printf(("9cups_write: count=" CUPS_LLFMT, CUPS_LLCAST count));
if (count < 0)
{
diff --git a/cups/getdevices.c b/cups/getdevices.c
index 4f5f8d000..44500d3fc 100644
--- a/cups/getdevices.c
+++ b/cups/getdevices.c
@@ -3,7 +3,7 @@
*
* cupsGetDevices implementation for the Common UNIX Printing System (CUPS).
*
- * Copyright 2008 by Apple Inc.
+ * Copyright 2008-2009 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -66,6 +66,11 @@ cupsGetDevices(
* Range check input...
*/
+ DEBUG_printf(("cupsGetDevices(http=%p, timeout=%d, include_schemes=\"%s\", "
+ "exclude_schemes=\"%s\", callback=%p, user_data=%p)", http,
+ timeout, include_schemes, exclude_schemes, callback,
+ user_data));
+
if (!callback)
return (IPP_INTERNAL_ERROR);
@@ -107,10 +112,10 @@ cupsGetDevices(
do
{
- DEBUG_puts("cupsGetDevices: Sending request...");
+ DEBUG_puts("2cupsGetDevices: Sending request...");
status = cupsSendRequest(http, request, "/", ippLength(request));
- DEBUG_puts("cupsGetDevices: Waiting for response status...");
+ DEBUG_puts("2cupsGetDevices: Waiting for response status...");
while (status == HTTP_CONTINUE)
status = httpUpdate(http);
@@ -124,14 +129,12 @@ cupsGetDevices(
* See if we can do authentication...
*/
- int auth_result;
-
- DEBUG_puts("cupsGetDevices: Need authorization...");
+ DEBUG_puts("2cupsGetDevices: Need authorization...");
- if ((auth_result = cupsDoAuthentication(http, "POST", "/")) == 0)
+ if (!cupsDoAuthentication(http, "POST", "/"))
httpReconnect(http);
- else if (auth_result < 0)
- http->status = status = HTTP_FORBIDDEN;
+ else
+ break;
}
#ifdef HAVE_SSL
@@ -141,7 +144,7 @@ cupsGetDevices(
* Force a reconnect with encryption...
*/
- DEBUG_puts("cupsGetDevices: Need encryption...");
+ DEBUG_puts("2cupsGetDevices: Need encryption...");
if (!httpReconnect(http))
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
@@ -151,7 +154,7 @@ cupsGetDevices(
}
while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED);
- DEBUG_printf(("cupsGetDevices: status=%d\n", status));
+ DEBUG_printf(("2cupsGetDevices: status=%d", status));
ippDelete(request);
@@ -177,14 +180,14 @@ cupsGetDevices(
device_uri = NULL;
attr = NULL;
- DEBUG_puts("cupsGetDevices: Reading response...");
+ DEBUG_puts("2cupsGetDevices: Reading response...");
do
{
if ((state = ippRead(http, response)) == IPP_ERROR)
break;
- DEBUG_printf(("cupsGetDevices: state=%d, response->last=%p\n", state,
+ DEBUG_printf(("2cupsGetDevices: state=%d, response->last=%p", state,
response->last));
if (!response->attrs)
@@ -197,8 +200,8 @@ cupsGetDevices(
else
attr = attr->next;
- DEBUG_printf(("cupsGetDevices: attr->name=\"%s\", attr->value_tag=%d\n",
- attr->name ? attr->name : "(null)", attr->value_tag));
+ DEBUG_printf(("2cupsGetDevices: attr->name=\"%s\", attr->value_tag=%d",
+ attr->name, attr->value_tag));
if (!attr->name)
{
@@ -237,7 +240,7 @@ cupsGetDevices(
}
while (state != IPP_DATA);
- DEBUG_printf(("cupsGetDevices: state=%d, response->last=%p\n", state,
+ DEBUG_printf(("2cupsGetDevices: state=%d, response->last=%p", state,
response->last));
if (device_class && device_id && device_info && device_make_and_model &&
@@ -258,7 +261,7 @@ cupsGetDevices(
{
attr = ippFindAttribute(response, "status-message", IPP_TAG_TEXT);
- DEBUG_printf(("cupsGetDevices: status-code=%s, status-message=\"%s\"\n",
+ DEBUG_printf(("cupsGetDevices: status-code=%s, status-message=\"%s\"",
ippErrorString(response->request.status.status_code),
attr ? attr->values[0].string.text : ""));
diff --git a/cups/getputfile.c b/cups/getputfile.c
index c61da916b..43952dc1f 100644
--- a/cups/getputfile.c
+++ b/cups/getputfile.c
@@ -3,7 +3,7 @@
*
* Get/put file functions for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -66,7 +66,7 @@ cupsGetFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
* Range check input...
*/
- DEBUG_printf(("cupsGetFd(http=%p, resource=\"%s\", fd=%d)\n", http,
+ DEBUG_printf(("cupsGetFd(http=%p, resource=\"%s\", fd=%d)", http,
resource, fd));
if (!resource || fd < 0)
@@ -179,6 +179,8 @@ cupsGetFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
* Return the request status...
*/
+ DEBUG_printf(("1cupsGetFd: Returning %d...", status));
+
return (status);
}
@@ -274,7 +276,7 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
* Range check input...
*/
- DEBUG_printf(("cupsPutFd(http=%p, resource=\"%s\", fd=%d)\n", http,
+ DEBUG_printf(("cupsPutFd(http=%p, resource=\"%s\", fd=%d)", http,
resource, fd));
if (!resource || fd < 0)
@@ -297,7 +299,7 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
do
{
- DEBUG_printf(("cupsPutFd: starting attempt, authstring=\"%s\"...\n",
+ DEBUG_printf(("2cupsPutFd: starting attempt, authstring=\"%s\"...",
http->authstring));
httpClearFields(http);
@@ -355,7 +357,7 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
if (status == HTTP_ERROR && !retries)
{
- DEBUG_printf(("cupsPutFd: retry on status %d\n", status));
+ DEBUG_printf(("2cupsPutFd: retry on status %d", status));
retries ++;
@@ -373,7 +375,7 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
continue;
}
- DEBUG_printf(("cupsPutFd: status=%d\n", status));
+ DEBUG_printf(("2cupsPutFd: status=%d", status));
if (status == HTTP_UNAUTHORIZED)
{
@@ -432,6 +434,8 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
httpFlush(http);
}
+ DEBUG_printf(("1cupsPutFd: Returning %d...", status));
+
return (status);
}
diff --git a/cups/globals.h b/cups/globals.h
index cdf4d1fec..89139367f 100644
--- a/cups/globals.h
+++ b/cups/globals.h
@@ -142,6 +142,7 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
extern http_t *_cupsConnect(void);
extern const char *_cupsGetPassword(const char *prompt);
extern _cups_globals_t *_cupsGlobals(void);
+extern void _cupsSetDefaults(void);
extern void _cupsSetError(ipp_status_t status, const char *message,
int localize);
extern void _cupsSetHTTPError(http_status_t status);
diff --git a/cups/http-addr.c b/cups/http-addr.c
index 52e828525..31c8bca89 100644
--- a/cups/http-addr.c
+++ b/cups/http-addr.c
@@ -154,7 +154,7 @@ httpAddrLocalhost(
#endif /* AF_LOCAL */
if (addr->addr.sa_family == AF_INET &&
- ntohl(addr->ipv4.sin_addr.s_addr) == 0x7f000001)
+ (ntohl(addr->ipv4.sin_addr.s_addr) & 0xff000000) == 0x7f000000)
return (1);
return (0);
@@ -184,8 +184,8 @@ httpAddrLookup(
/* Global data */
- DEBUG_printf(("httpAddrLookup(addr=%p, name=%p, namelen=%d)\n",
- addr, name, namelen));
+ DEBUG_printf(("httpAddrLookup(addr=%p, name=%p, namelen=%d)", addr, name,
+ namelen));
/*
* Range check input...
@@ -289,6 +289,8 @@ httpAddrLookup(
}
#endif /* HAVE_GETNAMEINFO */
+ DEBUG_printf(("1httpAddrLookup: returning \"%s\"...", name));
+
return (name);
}
@@ -324,8 +326,7 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
char *s, /* I - String buffer */
int slen) /* I - Length of string */
{
- DEBUG_printf(("httpAddrString(addr=%p, s=%p, slen=%d)\n",
- addr, s, slen));
+ DEBUG_printf(("httpAddrString(addr=%p, s=%p, slen=%d)", addr, s, slen));
/*
* Range check input...
@@ -452,7 +453,7 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
else
strlcpy(s, "UNKNOWN", slen);
- DEBUG_printf(("httpAddrString: returning \"%s\"...\n", s));
+ DEBUG_printf(("1httpAddrString: returning \"%s\"...", s));
return (s);
}
@@ -474,7 +475,7 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
/* Pointer to library globals */
- DEBUG_printf(("httpGetHostByName(name=\"%s\")\n", name));
+ DEBUG_printf(("httpGetHostByName(name=\"%s\")", name));
/*
* Avoid lookup delays and configuration problems when connecting
@@ -512,7 +513,7 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
cg->ip_ptrs[0] = (char *)name;
cg->ip_ptrs[1] = NULL;
- DEBUG_puts("httpGetHostByName: returning domain socket address...");
+ DEBUG_puts("1httpGetHostByName: returning domain socket address...");
return (&cg->hostent);
}
@@ -548,7 +549,7 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
cg->ip_ptrs[0] = (char *)&(cg->ip_addr);
cg->ip_ptrs[1] = NULL;
- DEBUG_puts("httpGetHostByName: returning IPv4 address...");
+ DEBUG_puts("1httpGetHostByName: returning IPv4 address...");
return (&cg->hostent);
}
@@ -559,7 +560,7 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
* the name...
*/
- DEBUG_puts("httpGetHostByName: returning domain lookup address(es)...");
+ DEBUG_puts("1httpGetHostByName: returning domain lookup address(es)...");
return (gethostbyname(name));
}
diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c
index a5b2e1f58..e8f7c84dc 100644
--- a/cups/http-addrlist.c
+++ b/cups/http-addrlist.c
@@ -50,7 +50,7 @@ httpAddrConnect(
#endif /* DEBUG */
- DEBUG_printf(("httpAddrConnect(addrlist=%p, sock=%p)\n", addrlist, sock));
+ DEBUG_printf(("httpAddrConnect(addrlist=%p, sock=%p)", addrlist, sock));
if (!sock)
{
@@ -68,7 +68,7 @@ httpAddrConnect(
* Create the socket...
*/
- DEBUG_printf(("httpAddrConnect: Trying %s:%d...\n",
+ DEBUG_printf(("2httpAddrConnect: Trying %s:%d...",
httpAddrString(&(addrlist->addr), temp, sizeof(temp)),
_httpAddrPort(&(addrlist->addr))));
@@ -134,13 +134,13 @@ httpAddrConnect(
if (!connect(*sock, &(addrlist->addr.addr),
httpAddrLength(&(addrlist->addr))))
{
- DEBUG_printf(("httpAddrConnect: Connected to %s:%d...\n",
+ DEBUG_printf(("1httpAddrConnect: Connected to %s:%d...",
httpAddrString(&(addrlist->addr), temp, sizeof(temp)),
_httpAddrPort(&(addrlist->addr))));
break;
}
- DEBUG_printf(("httpAddrConnect: Unable to connect to %s:%d: %s\n",
+ DEBUG_printf(("1httpAddrConnect: Unable to connect to %s:%d: %s",
httpAddrString(&(addrlist->addr), temp, sizeof(temp)),
_httpAddrPort(&(addrlist->addr)), strerror(errno)));
diff --git a/cups/http-support.c b/cups/http-support.c
index c59ecfb50..baa45c122 100644
--- a/cups/http-support.c
+++ b/cups/http-support.c
@@ -727,7 +727,7 @@ httpGetDateTime(const char *s) /* I - Date/time string */
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 };
- DEBUG_printf(("httpGetDateTime(s=\"%s\")\n", s));
+ DEBUG_printf(("2httpGetDateTime(s=\"%s\")", s));
/*
* Extract the date and time from the formatted string...
@@ -736,8 +736,8 @@ httpGetDateTime(const char *s) /* I - Date/time string */
if (sscanf(s, "%*s%d%15s%d%d:%d:%d", &day, mon, &year, &hour, &min, &sec) < 6)
return (0);
- DEBUG_printf((" day=%d, mon=\"%s\", year=%d, hour=%d, min=%d, sec=%d\n",
- day, mon, year, hour, min, sec));
+ DEBUG_printf(("4httpGetDateTime: day=%d, mon=\"%s\", year=%d, hour=%d, "
+ "min=%d, sec=%d", day, mon, year, hour, min, sec));
/*
* Convert the month name to a number from 0 to 11.
@@ -750,7 +750,7 @@ httpGetDateTime(const char *s) /* I - Date/time string */
if (i >= 12)
return (0);
- DEBUG_printf((" i=%d\n", i));
+ DEBUG_printf(("4httpGetDateTime: i=%d", i));
/*
* Now convert the date and time to a UNIX time value in seconds since
@@ -763,14 +763,14 @@ httpGetDateTime(const char *s) /* I - Date/time string */
else
days = normal_days[i] + day - 1;
- DEBUG_printf((" days=%d\n", days));
+ DEBUG_printf(("4httpGetDateTime: days=%d", days));
days += (year - 1970) * 365 + /* 365 days per year (normally) */
((year - 1) / 4 - 492) - /* + leap days */
((year - 1) / 100 - 19) + /* - 100 year days */
((year - 1) / 400 - 4); /* + 400 year days */
- DEBUG_printf((" days=%d\n", days));
+ DEBUG_printf(("4httpGetDateTime: days=%d\n", days));
return (days * 86400 + hour * 3600 + min * 60 + sec);
}
@@ -1313,8 +1313,8 @@ _httpResolveURI(
#endif /* DEBUG */
- DEBUG_printf(("_httpResolveURI(uri=\"%s\", resolved_uri=%p, "
- "resolved_size=" CUPS_LLFMT ")\n", uri, resolved_uri,
+ DEBUG_printf(("4_httpResolveURI(uri=\"%s\", resolved_uri=%p, "
+ "resolved_size=" CUPS_LLFMT ")", uri, resolved_uri,
CUPS_LLCAST resolved_size));
/*
@@ -1336,8 +1336,8 @@ _httpResolveURI(
if (logit)
_cupsLangPrintf(stderr, _("Bad device URI \"%s\"!\n"), uri);
- DEBUG_printf(("_httpResolveURI: httpSeparateURI returned %d!\n", status));
- DEBUG_puts("_httpResolveURI: Returning NULL");
+ DEBUG_printf(("6_httpResolveURI: httpSeparateURI returned %d!", status));
+ DEBUG_puts("5_httpResolveURI: Returning NULL");
return (NULL);
}
@@ -1380,7 +1380,7 @@ _httpResolveURI(
if (regtype <= hostname)
{
- DEBUG_puts("_httpResolveURI: Bad hostname, returning NULL");
+ DEBUG_puts("5_httpResolveURI: Bad hostname, returning NULL");
return (NULL);
}
@@ -1398,7 +1398,7 @@ _httpResolveURI(
resolved_uri[0] = '\0';
- DEBUG_printf(("_httpResolveURI: Resolving hostname=\"%s\", regtype=\"%s\", "
+ DEBUG_printf(("6_httpResolveURI: Resolving hostname=\"%s\", regtype=\"%s\", "
"domain=\"%s\"\n", hostname, regtype, domain));
if (logit)
{
@@ -1479,7 +1479,7 @@ _httpResolveURI(
_cupsLangPuts(stderr, _("Unable to find printer!\n"));
}
- DEBUG_printf(("_httpResolveURI: Returning \"%s\"\n", uri));
+ DEBUG_printf(("5_httpResolveURI: Returning \"%s\"", uri));
return (uri);
}
@@ -1627,9 +1627,9 @@ resolve_callback(
_http_uribuf_t *uribuf; /* URI buffer */
- DEBUG_printf(("resolve_callback(sdRef=%p, flags=%x, interfaceIndex=%u, "
+ DEBUG_printf(("7resolve_callback(sdRef=%p, flags=%x, interfaceIndex=%u, "
"errorCode=%d, fullName=\"%s\", hostTarget=\"%s\", port=%u, "
- "txtLen=%u, txtRecord=%p, context=%p)\n", sdRef, flags,
+ "txtLen=%u, txtRecord=%p, context=%p)", sdRef, flags,
interfaceIndex, errorCode, fullName, hostTarget, port, txtLen,
txtRecord, context));
@@ -1673,7 +1673,7 @@ resolve_callback(
httpAssembleURI(HTTP_URI_CODING_ALL, uribuf->buffer, uribuf->bufsize, scheme,
NULL, hostTarget, ntohs(port), rp);
- DEBUG_printf(("resolve_callback: Resolved URI is \"%s\"...\n",
+ DEBUG_printf(("8resolve_callback: Resolved URI is \"%s\"...",
uribuf->buffer));
}
#endif /* HAVE_DNSSD */
diff --git a/cups/http.c b/cups/http.c
index eef9973b8..e5920fa3f 100644
--- a/cups/http.c
+++ b/cups/http.c
@@ -304,7 +304,7 @@ httpClose(http_t *http) /* I - Connection to server */
#endif /* HAVE_GSSAPI */
- DEBUG_printf(("httpClose(http=%p)\n", http));
+ DEBUG_printf(("httpClose(http=%p)", http));
if (!http)
return;
@@ -376,7 +376,7 @@ httpConnectEncrypt(
http_t *http; /* New HTTP connection */
- DEBUG_printf(("httpConnectEncrypt(host=\"%s\", port=%d, encryption=%d)\n",
+ DEBUG_printf(("httpConnectEncrypt(host=\"%s\", port=%d, encryption=%d)",
host, port, encryption));
/*
@@ -420,7 +420,7 @@ _httpCreate(
char service[255]; /* Service name */
- DEBUG_printf(("_httpCreate(host=\"%s\", port=%d, encryption=%d)\n",
+ DEBUG_printf(("4_httpCreate(host=\"%s\", port=%d, encryption=%d)",
host, port, encryption));
if (!host)
@@ -496,7 +496,7 @@ int /* O - -1 on error, 0 on success */
httpEncryption(http_t *http, /* I - Connection to server */
http_encryption_t e) /* I - New encryption preference */
{
- DEBUG_printf(("httpEncryption(http=%p, e=%d)\n", http, e));
+ DEBUG_printf(("httpEncryption(http=%p, e=%d)", http, e));
#ifdef HAVE_SSL
if (!http)
@@ -545,7 +545,7 @@ httpFlush(http_t *http) /* I - Connection to server */
int blocking; /* To block or not to block */
- DEBUG_printf(("httpFlush(http=%p), state=%d\n", http, http->state));
+ DEBUG_printf(("httpFlush(http=%p), state=%d", http, http->state));
/*
* Temporarily set non-blocking mode so we don't get stuck in httpRead()...
@@ -603,7 +603,7 @@ httpFlushWrite(http_t *http) /* I - Connection to server */
int bytes; /* Bytes written */
- DEBUG_printf(("httpFlushWrite(http=%p)\n", http));
+ DEBUG_printf(("httpFlushWrite(http=%p)", http));
if (!http || !http->wused)
return (0);
@@ -757,14 +757,14 @@ httpGetLength(http_t *http) /* I - Connection to server */
off_t /* O - Content length */
httpGetLength2(http_t *http) /* I - Connection to server */
{
- DEBUG_printf(("httpGetLength2(http=%p), state=%d\n", http, http->state));
+ DEBUG_printf(("2httpGetLength2(http=%p), state=%d", http, http->state));
if (!http)
return (-1);
if (!strcasecmp(http->fields[HTTP_FIELD_TRANSFER_ENCODING], "chunked"))
{
- DEBUG_puts("httpGetLength2: chunked request!");
+ DEBUG_puts("4httpGetLength2: chunked request!");
http->data_encoding = HTTP_ENCODE_CHUNKED;
http->data_remaining = 0;
@@ -797,7 +797,7 @@ httpGetLength2(http_t *http) /* I - Connection to server */
http->data_remaining = strtoll(http->fields[HTTP_FIELD_CONTENT_LENGTH],
NULL, 10);
- DEBUG_printf(("httpGetLength2: content_length=" CUPS_LLFMT "\n",
+ DEBUG_printf(("4httpGetLength2: content_length=" CUPS_LLFMT,
CUPS_LLCAST http->data_remaining));
}
@@ -857,8 +857,8 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
*ptr, /* Pointer into string buffer */
*end; /* End of value buffer */
- DEBUG_printf(("httpGetSubField2(http=%p, field=%d, name=\"%s\", value=%p, valuelen=%d)\n",
- http, field, name, value, valuelen));
+ DEBUG_printf(("2httpGetSubField2(http=%p, field=%d, name=\"%s\", value=%p, "
+ "valuelen=%d)", http, field, name, value, valuelen));
if (!http || !name || !value || valuelen < 2 ||
field <= HTTP_FIELD_UNKNOWN || field >= HTTP_FIELD_MAX)
@@ -892,7 +892,7 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
*ptr = '\0';
- DEBUG_printf(("httpGetSubField: name=\"%s\"\n", temp));
+ DEBUG_printf(("4httpGetSubField2: name=\"%s\"", temp));
/*
* Skip trailing chars up to the '='...
@@ -950,18 +950,23 @@ httpGetSubField2(http_t *http, /* I - Connection to server */
fptr ++;
}
- DEBUG_printf(("httpGetSubField: value=\"%s\"\n", value));
+ DEBUG_printf(("4httpGetSubField2: value=\"%s\"", value));
/*
* See if this is the one...
*/
if (!strcmp(name, temp))
+ {
+ DEBUG_printf(("3httpGetSubField2: Returning \"%s\"", value));
return (value);
+ }
}
value[0] = '\0';
+ DEBUG_puts("3httpGetSubField2: Returning NULL");
+
return (NULL);
}
@@ -983,7 +988,7 @@ httpGets(char *line, /* I - Line to read into */
eol; /* End-of-line? */
- DEBUG_printf(("httpGets(line=%p, length=%d, http=%p)\n", line, length, http));
+ DEBUG_printf(("2httpGets(line=%p, length=%d, http=%p)", line, length, http));
if (http == NULL || line == NULL)
return (NULL);
@@ -1016,7 +1021,7 @@ httpGets(char *line, /* I - Line to read into */
if (!http->blocking && !_httpWait(http, 10000, 1))
{
- DEBUG_puts("httpGets: Timed out!");
+ DEBUG_puts("3httpGets: Timed out!");
#ifdef WIN32
http->error = WSAETIMEDOUT;
#else
@@ -1034,7 +1039,7 @@ httpGets(char *line, /* I - Line to read into */
bytes = recv(http->fd, http->buffer + http->used,
HTTP_MAX_BUFFER - http->used, 0);
- DEBUG_printf(("httpGets: read %d bytes...\n", bytes));
+ DEBUG_printf(("4httpGets: read %d bytes...", bytes));
if (bytes < 0)
{
@@ -1049,11 +1054,11 @@ httpGets(char *line, /* I - Line to read into */
continue;
}
- DEBUG_printf(("httpGets: recv() error %d!\n", WSAGetLastError()));
+ DEBUG_printf(("3httpGets: recv() error %d!", WSAGetLastError()));
#else
- DEBUG_printf(("httpGets: recv() error %d!\n", errno));
+ DEBUG_printf(("3httpGets: recv() error %d!", errno));
- if (errno == EINTR)
+ if (errno == EINTR || errno == EAGAIN)
continue;
else if (errno != http->error)
{
@@ -1111,13 +1116,13 @@ httpGets(char *line, /* I - Line to read into */
*lineptr = '\0';
- DEBUG_printf(("httpGets: Returning \"%s\"\n", line));
+ DEBUG_printf(("3httpGets: Returning \"%s\"", line));
return (line);
}
}
- DEBUG_puts("httpGets: No new line available!");
+ DEBUG_puts("3httpGets: No new line available!");
return (NULL);
}
@@ -1131,6 +1136,7 @@ int /* O - Status of call (0 = success) */
httpHead(http_t *http, /* I - Connection to server */
const char *uri) /* I - URI for head */
{
+ DEBUG_printf(("httpHead(http=%p, uri=\"%s\")", http, uri));
return (http_send(http, HTTP_HEAD, uri));
}
@@ -1244,13 +1250,13 @@ httpPrintf(http_t *http, /* I - Connection to server */
va_list ap; /* Variable argument pointer */
- DEBUG_printf(("httpPrintf(http=%p, format=\"%s\", ...)\n", http, format));
+ DEBUG_printf(("2httpPrintf(http=%p, format=\"%s\", ...)", http, format));
va_start(ap, format);
bytes = vsnprintf(buf, sizeof(buf), format, ap);
va_end(ap);
- DEBUG_printf(("httpPrintf: %s", buf));
+ DEBUG_printf(("3httpPrintf: %s", buf));
if (http->data_encoding == HTTP_ENCODE_FIELDS)
return (httpWrite2(http, buf, bytes));
@@ -1258,7 +1264,7 @@ httpPrintf(http_t *http, /* I - Connection to server */
{
if (http->wused)
{
- DEBUG_puts(" flushing existing data...");
+ DEBUG_puts("4httpPrintf: flushing existing data...");
if (httpFlushWrite(http) < 0)
return (-1);
@@ -1277,6 +1283,7 @@ int /* O - Status of call (0 = success) */
httpPut(http_t *http, /* I - Connection to server */
const char *uri) /* I - URI to put */
{
+ DEBUG_printf(("httpPut(http=%p, uri=\"%s\")", http, uri));
return (http_send(http, HTTP_PUT, uri));
}
@@ -1314,7 +1321,7 @@ httpRead2(http_t *http, /* I - Connection to server */
char len[32]; /* Length string */
- DEBUG_printf(("httpRead2(http=%p, buffer=%p, length=" CUPS_LLFMT ")\n",
+ DEBUG_printf(("httpRead2(http=%p, buffer=%p, length=" CUPS_LLFMT ")",
http, buffer, CUPS_LLCAST length));
if (http == NULL || buffer == NULL)
@@ -1328,23 +1335,23 @@ httpRead2(http_t *http, /* I - Connection to server */
if (http->data_encoding == HTTP_ENCODE_CHUNKED &&
http->data_remaining <= 0)
{
- DEBUG_puts("httpRead2: Getting chunk length...");
+ DEBUG_puts("2httpRead2: Getting chunk length...");
if (httpGets(len, sizeof(len), http) == NULL)
{
- DEBUG_puts("httpRead2: Could not get length!");
+ DEBUG_puts("1httpRead2: Could not get length!");
return (0);
}
http->data_remaining = strtoll(len, NULL, 16);
if (http->data_remaining < 0)
{
- DEBUG_puts("httpRead2: Negative chunk length!");
+ DEBUG_puts("1httpRead2: Negative chunk length!");
return (0);
}
}
- DEBUG_printf(("httpRead2: data_remaining=" CUPS_LLFMT "\n",
+ DEBUG_printf(("2httpRead2: data_remaining=" CUPS_LLFMT,
CUPS_LLCAST http->data_remaining));
if (http->data_remaining <= 0)
@@ -1393,12 +1400,12 @@ httpRead2(http_t *http, /* I - Connection to server */
else
#endif /* HAVE_SSL */
{
- DEBUG_printf(("httpRead2: reading %d bytes from socket into buffer...\n",
+ DEBUG_printf(("2httpRead2: reading %d bytes from socket into buffer...",
(int)bytes));
bytes = recv(http->fd, http->buffer, bytes, 0);
- DEBUG_printf(("httpRead2: read %d bytes from socket into buffer...\n",
+ DEBUG_printf(("2httpRead2: read %d bytes from socket into buffer...",
(int)bytes));
}
@@ -1410,7 +1417,7 @@ httpRead2(http_t *http, /* I - Connection to server */
http->error = WSAGetLastError();
return (-1);
#else
- if (errno != EINTR)
+ if (errno != EINTR && errno != EAGAIN)
{
http->error = errno;
return (-1);
@@ -1431,7 +1438,7 @@ httpRead2(http_t *http, /* I - Connection to server */
bytes = (ssize_t)length;
- DEBUG_printf(("httpRead2: grabbing %d bytes from input buffer...\n",
+ DEBUG_printf(("2httpRead2: grabbing %d bytes from input buffer...",
(int)bytes));
memcpy(buffer, http->buffer, length);
@@ -1454,7 +1461,7 @@ httpRead2(http_t *http, /* I - Connection to server */
if (!http->blocking && !httpWait(http, 10000))
return (0);
- DEBUG_printf(("httpRead2: reading " CUPS_LLFMT " bytes from socket...\n",
+ DEBUG_printf(("2httpRead2: reading " CUPS_LLFMT " bytes from socket...",
CUPS_LLCAST length));
#ifdef WIN32
@@ -1465,7 +1472,7 @@ httpRead2(http_t *http, /* I - Connection to server */
break;
#endif /* WIN32 */
- DEBUG_printf(("httpRead2: read " CUPS_LLFMT " bytes from socket...\n",
+ DEBUG_printf(("2httpRead2: read " CUPS_LLFMT " bytes from socket...",
CUPS_LLCAST bytes));
}
@@ -1552,7 +1559,7 @@ _httpReadCDSA(
{
bytes = recv(http->fd, data, *dataLength, 0);
}
- while (bytes == -1 && errno == EINTR);
+ while (bytes == -1 && (errno == EINTR || errno == EAGAIN));
if (bytes == *dataLength)
{
@@ -1628,7 +1635,7 @@ httpReconnect(http_t *http) /* I - Connection to server */
#endif /* DEBUG */
- DEBUG_printf(("httpReconnect(http=%p)\n", http));
+ DEBUG_printf(("httpReconnect(http=%p)", http));
if (!http)
return (-1);
@@ -1636,7 +1643,7 @@ httpReconnect(http_t *http) /* I - Connection to server */
#ifdef HAVE_SSL
if (http->tls)
{
- DEBUG_puts("httpReconnect: Shutting down SSL/TLS...");
+ DEBUG_puts("2httpReconnect: Shutting down SSL/TLS...");
http_shutdown_ssl(http);
}
#endif /* HAVE_SSL */
@@ -1647,7 +1654,7 @@ httpReconnect(http_t *http) /* I - Connection to server */
if (http->fd >= 0)
{
- DEBUG_printf(("httpReconnect: Closing socket %d...\n", http->fd));
+ DEBUG_printf(("2httpReconnect: Closing socket %d...", http->fd));
#ifdef WIN32
closesocket(http->fd);
@@ -1666,7 +1673,7 @@ httpReconnect(http_t *http) /* I - Connection to server */
#ifdef DEBUG
for (current = http->addrlist; current; current = current->next)
- DEBUG_printf(("httpReconnect: Address %s:%d\n",
+ DEBUG_printf(("2httpReconnect: Address %s:%d",
httpAddrString(&(current->addr), temp, sizeof(temp)),
_httpAddrPort(&(current->addr))));
#endif /* DEBUG */
@@ -1684,13 +1691,13 @@ httpReconnect(http_t *http) /* I - Connection to server */
#endif /* WIN32 */
http->status = HTTP_ERROR;
- DEBUG_printf(("httpReconnect: httpAddrConnect failed: %s\n",
+ DEBUG_printf(("1httpReconnect: httpAddrConnect failed: %s",
strerror(http->error)));
return (-1);
}
- DEBUG_printf(("httpReconnect: New socket=%d\n", http->fd));
+ DEBUG_printf(("2httpReconnect: New socket=%d", http->fd));
http->hostaddr = &(addr->addr);
http->error = 0;
@@ -1718,7 +1725,7 @@ httpReconnect(http_t *http) /* I - Connection to server */
return (http_upgrade(http));
#endif /* HAVE_SSL */
- DEBUG_printf(("httpReconnect: Connected to %s:%d...\n",
+ DEBUG_printf(("1httpReconnect: Connected to %s:%d...",
httpAddrString(http->hostaddr, temp, sizeof(temp)),
_httpAddrPort(http->hostaddr)));
@@ -1844,18 +1851,35 @@ httpSetField(http_t *http, /* I - Connection to server */
strlcpy(http->fields[field], value, HTTP_MAX_VALUE);
- /*
- * Special case for Authorization: as its contents can be
- * longer than HTTP_MAX_VALUE
- */
-
if (field == HTTP_FIELD_AUTHORIZATION)
{
+ /*
+ * Special case for Authorization: as its contents can be
+ * longer than HTTP_MAX_VALUE
+ */
+
if (http->field_authorization)
free(http->field_authorization);
http->field_authorization = strdup(value);
}
+ else if (field == HTTP_FIELD_HOST)
+ {
+ /*
+ * Special-case for Host: as we don't want a trailing "." on the hostname.
+ */
+
+ char *ptr = http->fields[HTTP_FIELD_HOST];
+ /* Pointer into Host: field */
+
+ if (*ptr)
+ {
+ ptr += strlen(ptr) - 1;
+
+ if (*ptr == '.')
+ *ptr = '\0';
+ }
+ }
}
@@ -1912,7 +1936,7 @@ httpUpdate(http_t *http) /* I - Connection to server */
status; /* Request status */
- DEBUG_printf(("httpUpdate(http=%p), state=%d\n", http, http->state));
+ DEBUG_printf(("httpUpdate(http=%p), state=%d", http, http->state));
/*
* Flush pending data, if any...
@@ -1920,7 +1944,7 @@ httpUpdate(http_t *http) /* I - Connection to server */
if (http->wused)
{
- DEBUG_puts(" flushing buffer...");
+ DEBUG_puts("2httpUpdate: flushing buffer...");
if (httpFlushWrite(http) < 0)
return (HTTP_ERROR);
@@ -1939,7 +1963,7 @@ httpUpdate(http_t *http) /* I - Connection to server */
while (httpGets(line, sizeof(line), http) != NULL)
{
- DEBUG_printf(("httpUpdate: Got \"%s\"\n", line));
+ DEBUG_printf(("2httpUpdate: Got \"%s\"", line));
if (line[0] == '\0')
{
@@ -1996,7 +2020,7 @@ httpUpdate(http_t *http) /* I - Connection to server */
return (http->status);
}
- else if (strncmp(line, "HTTP/", 5) == 0)
+ else if (!strncmp(line, "HTTP/", 5))
{
/*
* Got the beginning of a response...
@@ -2040,7 +2064,7 @@ httpUpdate(http_t *http) /* I - Connection to server */
}
else if ((field = http_field(line)) == HTTP_FIELD_UNKNOWN)
{
- DEBUG_printf(("httpUpdate: unknown field %s seen!\n", line));
+ DEBUG_printf(("1httpUpdate: unknown field %s seen!", line));
continue;
}
else
@@ -2048,6 +2072,7 @@ httpUpdate(http_t *http) /* I - Connection to server */
}
else
{
+ DEBUG_printf(("1httpUpdate: Bad response line \"%s\"!", line));
http->status = HTTP_ERROR;
return (HTTP_ERROR);
}
@@ -2058,11 +2083,14 @@ httpUpdate(http_t *http) /* I - Connection to server */
*/
if (http->error == EPIPE && http->status > HTTP_CONTINUE)
+ {
+ DEBUG_printf(("1httpUpdate: Returning status %d...", http->status));
return (http->status);
+ }
if (http->error)
{
- DEBUG_printf(("httpUpdate: socket error %d - %s\n", http->error,
+ DEBUG_printf(("1httpUpdate: socket error %d - %s", http->error,
strerror(http->error)));
http->status = HTTP_ERROR;
return (HTTP_ERROR);
@@ -2094,7 +2122,7 @@ _httpWait(http_t *http, /* I - Connection to server */
int nfds; /* Result from select()/poll() */
- DEBUG_printf(("_httpWait(http=%p, msec=%d, usessl=%d)\n", http, msec, usessl));
+ DEBUG_printf(("4_httpWait(http=%p, msec=%d, usessl=%d)", http, msec, usessl));
if (http->fd < 0)
return (0);
@@ -2130,7 +2158,8 @@ _httpWait(http_t *http, /* I - Connection to server */
pfd.fd = http->fd;
pfd.events = POLLIN;
- while ((nfds = poll(&pfd, 1, msec)) < 0 && errno == EINTR);
+ while ((nfds = poll(&pfd, 1, msec)) < 0 &&
+ (errno == EINTR || errno == EAGAIN));
#else
do
@@ -2138,7 +2167,7 @@ _httpWait(http_t *http, /* I - Connection to server */
FD_ZERO(&input_set);
FD_SET(http->fd, &input_set);
- DEBUG_printf(("_httpWait: msec=%d, http->fd=%d\n", msec, http->fd));
+ DEBUG_printf(("6_httpWait: msec=%d, http->fd=%d", msec, http->fd));
if (msec >= 0)
{
@@ -2150,16 +2179,16 @@ _httpWait(http_t *http, /* I - Connection to server */
else
nfds = select(http->fd + 1, &input_set, NULL, NULL, NULL);
- DEBUG_printf(("_httpWait: select() returned %d...\n", nfds));
+ DEBUG_printf(("6_httpWait: select() returned %d...", nfds));
}
# ifdef WIN32
while (nfds < 0 && WSAGetLastError() == WSAEINTR);
# else
- while (nfds < 0 && errno == EINTR);
+ while (nfds < 0 && (errno == EINTR || errno == EAGAIN));
# endif /* WIN32 */
#endif /* HAVE_POLL */
- DEBUG_printf(("_httpWait: returning with nfds=%d...\n", nfds));
+ DEBUG_printf(("5_httpWait: returning with nfds=%d...", nfds));
return (nfds > 0);
}
@@ -2235,7 +2264,7 @@ httpWrite2(http_t *http, /* I - Connection to server */
ssize_t bytes; /* Bytes written */
- DEBUG_printf(("httpWrite2(http=%p, buffer=%p, length=" CUPS_LLFMT ")\n", http,
+ DEBUG_printf(("httpWrite2(http=%p, buffer=%p, length=" CUPS_LLFMT ")", http,
buffer, CUPS_LLCAST length));
/*
@@ -2259,8 +2288,8 @@ httpWrite2(http_t *http, /* I - Connection to server */
{
if (http->wused && (length + http->wused) > sizeof(http->wbuffer))
{
- DEBUG_printf(("httpWrite2: Flushing buffer (wused=%d, length="
- CUPS_LLFMT ")\n", http->wused, CUPS_LLCAST length));
+ DEBUG_printf(("2httpWrite2: Flushing buffer (wused=%d, length="
+ CUPS_LLFMT ")", http->wused, CUPS_LLCAST length));
httpFlushWrite(http);
}
@@ -2272,7 +2301,7 @@ httpWrite2(http_t *http, /* I - Connection to server */
* Write to buffer...
*/
- DEBUG_printf(("httpWrite2: Copying " CUPS_LLFMT " bytes to wbuffer...\n",
+ DEBUG_printf(("2httpWrite2: Copying " CUPS_LLFMT " bytes to wbuffer...",
CUPS_LLCAST length));
memcpy(http->wbuffer + http->wused, buffer, length);
@@ -2285,7 +2314,7 @@ httpWrite2(http_t *http, /* I - Connection to server */
* Otherwise write the data directly...
*/
- DEBUG_printf(("httpWrite2: Writing " CUPS_LLFMT " bytes to socket...\n",
+ DEBUG_printf(("2httpWrite2: Writing " CUPS_LLFMT " bytes to socket...",
CUPS_LLCAST length));
if (http->data_encoding == HTTP_ENCODE_CHUNKED)
@@ -2293,7 +2322,7 @@ httpWrite2(http_t *http, /* I - Connection to server */
else
bytes = (ssize_t)http_write(http, buffer, (int)length);
- DEBUG_printf(("httpWrite2: Wrote " CUPS_LLFMT " bytes...\n",
+ DEBUG_printf(("2httpWrite2: Wrote " CUPS_LLFMT " bytes...",
CUPS_LLCAST bytes));
}
@@ -2315,7 +2344,7 @@ httpWrite2(http_t *http, /* I - Connection to server */
* data, go idle...
*/
- DEBUG_puts("httpWrite: changing states...");
+ DEBUG_puts("2httpWrite: changing states...");
if (http->wused)
httpFlushWrite(http);
@@ -2370,7 +2399,7 @@ _httpWriteCDSA(
{
bytes = write(http->fd, data, *dataLength);
}
- while (bytes == -1 && errno == EINTR);
+ while (bytes == -1 && (errno == EINTR || errno == EAGAIN));
if (bytes == *dataLength)
{
@@ -2578,7 +2607,7 @@ http_debug_hex(const char *prefix, /* I - Prefix for line */
if (_cups_debug_fd < 0)
return;
- DEBUG_printf(("%s: %d bytes:\n", prefix, bytes));
+ DEBUG_printf(("6%s: %d bytes:\n", prefix, bytes));
snprintf(line, sizeof(line), "%s: ", prefix);
start = line + strlen(line);
@@ -2715,7 +2744,7 @@ http_send(http_t *http, /* I - Connection to server */
};
- DEBUG_printf(("http_send(http=%p, request=HTTP_%s, uri=\"%s\")\n",
+ DEBUG_printf(("7http_send(http=%p, request=HTTP_%s, uri=\"%s\")",
http, codes[request], uri));
if (http == NULL || uri == NULL)
@@ -2778,7 +2807,7 @@ http_send(http_t *http, /* I - Connection to server */
for (i = 0; i < HTTP_FIELD_MAX; i ++)
if (http->fields[i][0] != '\0')
{
- DEBUG_printf(("http_send: %s: %s\n", http_fields[i],
+ DEBUG_printf(("9http_send: %s: %s", http_fields[i],
httpGetField(http, i)));
if (httpPrintf(http, "%s: %s\r\n", http_fields[i],
@@ -2856,7 +2885,7 @@ http_setup_ssl(http_t *http) /* I - Connection to server */
# endif /* HAVE_LIBSSL */
- DEBUG_printf(("http_setup_ssl(http=%p)\n", http));
+ DEBUG_printf(("7http_setup_ssl(http=%p)", http));
# ifdef HAVE_LIBSSL
context = SSL_CTX_new(SSLv23_client_method());
@@ -2875,7 +2904,7 @@ http_setup_ssl(http_t *http) /* I - Connection to server */
unsigned long error; /* Error code */
while ((error = ERR_get_error()) != 0)
- printf("http_setup_ssl: %s\n", ERR_error_string(error, NULL));
+ DEBUG_printf(("8http_setup_ssl: %s", ERR_error_string(error, NULL)));
# endif /* DEBUG */
SSL_CTX_free(context);
@@ -3058,7 +3087,7 @@ http_upgrade(http_t *http) /* I - Connection to server */
http_t myhttp; /* Local copy of HTTP data */
- DEBUG_printf(("http_upgrade(%p)\n", http));
+ DEBUG_printf(("7http_upgrade(%p)", http));
/*
* Copy the HTTP data to a local variable so we can do the OPTIONS
@@ -3111,7 +3140,7 @@ http_upgrade(http_t *http) /* I - Connection to server */
* Server does not support HTTP upgrade...
*/
- DEBUG_puts("Server does not support HTTP upgrade!");
+ DEBUG_puts("8http_upgrade: Server does not support HTTP upgrade!");
# ifdef WIN32
closesocket(http->fd);
@@ -3162,7 +3191,7 @@ http_write(http_t *http, /* I - Connection to server */
continue;
}
#else
- if (errno == EINTR)
+ if (errno == EINTR || errno == EAGAIN)
continue;
else if (errno != http->error && errno != ECONNRESET)
{
@@ -3171,7 +3200,7 @@ http_write(http_t *http, /* I - Connection to server */
}
#endif /* WIN32 */
- DEBUG_puts("http_write: error writing data...\n");
+ DEBUG_puts("8http_write: error writing data...");
return (-1);
}
@@ -3201,7 +3230,7 @@ http_write_chunk(http_t *http, /* I - Connection to server */
char header[255]; /* Chunk header */
int bytes; /* Bytes written */
- DEBUG_printf(("http_write_chunk(http=%p, buffer=%p, length=%d)\n",
+ DEBUG_printf(("7http_write_chunk(http=%p, buffer=%p, length=%d)",
http, buffer, length));
/*
@@ -3211,19 +3240,19 @@ http_write_chunk(http_t *http, /* I - Connection to server */
sprintf(header, "%x\r\n", length);
if (http_write(http, header, (int)strlen(header)) < 0)
{
- DEBUG_puts(" http_write of length failed!");
+ DEBUG_puts("8http_write_chunk: http_write of length failed!");
return (-1);
}
if ((bytes = http_write(http, buffer, length)) < 0)
{
- DEBUG_puts(" http_write of buffer failed!");
+ DEBUG_puts("8http_write_chunk: http_write of buffer failed!");
return (-1);
}
if (http_write(http, "\r\n", 2) < 0)
{
- DEBUG_puts(" http_write of CR LF failed!");
+ DEBUG_puts("8http_write_chunk: http_write of CR LF failed!");
return (-1);
}
diff --git a/cups/ipp-support.c b/cups/ipp-support.c
index 8553a488e..c8c239c0f 100644
--- a/cups/ipp-support.c
+++ b/cups/ipp-support.c
@@ -4,7 +4,7 @@
* Internet Printing Protocol support functions for the Common UNIX
* Printing System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -391,53 +391,15 @@ ippOpValue(const char *name) /* I - Textual name */
int /* O - Port number */
ippPort(void)
{
- const char *ipp_port; /* IPP_PORT environment variable */
- struct servent *port; /* Port number info */
- int portnum; /* Port number */
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
DEBUG_puts("ippPort()");
if (!cg->ipp_port)
- {
- /*
- * See if the server definition includes the port number...
- */
+ _cupsSetDefaults();
- DEBUG_puts("ippPort: Not initialized...");
-
- cupsServer();
-
-#ifdef DEBUG
- if (cg->ipp_port)
- DEBUG_puts(("ippPort: Set via cupsServer()..."));
-#endif /* DEBUG */
- }
-
- if (!cg->ipp_port)
- {
- if ((ipp_port = getenv("IPP_PORT")) != NULL)
- {
- DEBUG_puts("ippPort: Set via IPP_PORT...");
- portnum = atoi(ipp_port);
- }
- else if ((port = getservbyname("ipp", NULL)) == NULL)
- {
- DEBUG_puts("ippPort: Set via CUPS_DEFAULT_IPP_PORT...");
- portnum = CUPS_DEFAULT_IPP_PORT;
- }
- else
- {
- DEBUG_puts("ippPort: Set via ipp service entry...");
- portnum = ntohs(port->s_port);
- }
-
- if (portnum > 0)
- cg->ipp_port = portnum;
- }
-
- DEBUG_printf(("ippPort: Returning %d...\n", cg->ipp_port));
+ DEBUG_printf(("1ippPort: Returning %d...", cg->ipp_port));
return (cg->ipp_port);
}
@@ -450,7 +412,7 @@ ippPort(void)
void
ippSetPort(int p) /* I - Port number to use */
{
- DEBUG_printf(("ippSetPort(p=%d)\n", p));
+ DEBUG_printf(("ippSetPort(p=%d)", p));
_cupsGlobals()->ipp_port = p;
}
diff --git a/cups/ipp.c b/cups/ipp.c
index a6c640856..021a56e11 100644
--- a/cups/ipp.c
+++ b/cups/ipp.c
@@ -99,7 +99,7 @@ ippAddBoolean(ipp_t *ipp, /* I - IPP message */
ipp_attribute_t *attr; /* New attribute */
- DEBUG_printf(("ippAddBoolean(ipp=%p, group=%02x(%s), name=\"%s\", value=%d)\n",
+ DEBUG_printf(("ippAddBoolean(ipp=%p, group=%02x(%s), name=\"%s\", value=%d)",
ipp, group, ippTagString(group), name, value));
if (!ipp || !name)
@@ -134,7 +134,7 @@ ippAddBooleans(ipp_t *ipp, /* I - IPP message */
DEBUG_printf(("ippAddBooleans(ipp=%p, group=%02x(%s), name=\"%s\", "
- "num_values=%d, values=%p)\n", ipp, group, ippTagString(group),
+ "num_values=%d, values=%p)", ipp, group, ippTagString(group),
name, num_values, values));
if (!ipp || !name || num_values < 1)
@@ -173,7 +173,7 @@ ippAddCollection(ipp_t *ipp, /* I - IPP message */
DEBUG_printf(("ippAddCollection(ipp=%p, group=%02x(%s), name=\"%s\", "
- "value=%p)\n", ipp, group, ippTagString(group), name, value));
+ "value=%p)", ipp, group, ippTagString(group), name, value));
if (!ipp || !name)
return (NULL);
@@ -210,7 +210,7 @@ ippAddCollections(
DEBUG_printf(("ippAddCollections(ipp=%p, group=%02x(%s), name=\"%s\", "
- "num_values=%d, values=%p)\n", ipp, group, ippTagString(group),
+ "num_values=%d, values=%p)", ipp, group, ippTagString(group),
name, num_values, values));
if (!ipp || !name || num_values < 1)
@@ -246,7 +246,7 @@ ippAddDate(ipp_t *ipp, /* I - IPP message */
ipp_attribute_t *attr; /* New attribute */
- DEBUG_printf(("ippAddDate(ipp=%p, group=%02x(%s), name=\"%s\", value=%p)\n",
+ DEBUG_printf(("ippAddDate(ipp=%p, group=%02x(%s), name=\"%s\", value=%p)",
ipp, group, ippTagString(group), name, value));
if (!ipp || !name || !value)
@@ -279,7 +279,7 @@ ippAddInteger(ipp_t *ipp, /* I - IPP message */
DEBUG_printf(("ippAddInteger(ipp=%p, group=%02x(%s), type=%02x(%s), "
- "name=\"%s\", value=%d)\n", ipp, group, ippTagString(group),
+ "name=\"%s\", value=%d)", ipp, group, ippTagString(group),
type, ippTagString(type), name, value));
if (!ipp || !name)
@@ -315,7 +315,7 @@ ippAddIntegers(ipp_t *ipp, /* I - IPP message */
DEBUG_printf(("ippAddIntegers(ipp=%p, group=%02x(%s), type=%02x(%s), "
- "name=\"%s\", num_values=%d, values=%p)\n", ipp,
+ "name=\"%s\", num_values=%d, values=%p)", ipp,
group, ippTagString(group), type, ippTagString(type), name,
num_values, values));
@@ -407,7 +407,7 @@ ippAddString(ipp_t *ipp, /* I - IPP message */
DEBUG_printf(("ippAddString(ipp=%p, group=%02x(%s), type=%02x(%s), "
- "name=\"%s\", charset=\"%s\", value=\"%s\")\n", ipp,
+ "name=\"%s\", charset=\"%s\", value=\"%s\")", ipp,
group, ippTagString(group), type, ippTagString(type), name,
charset, value));
@@ -476,7 +476,7 @@ ippAddStrings(
DEBUG_printf(("ippAddStrings(ipp=%p, group=%02x(%s), type=%02x(%s), "
- "name=\"%s\", num_values=%d, charset=\"%s\", values=%p)\n", ipp,
+ "name=\"%s\", num_values=%d, charset=\"%s\", values=%p)", ipp,
group, ippTagString(group), type, ippTagString(type), name,
num_values, charset, values));
@@ -538,7 +538,7 @@ ippAddRange(ipp_t *ipp, /* I - IPP message */
DEBUG_printf(("ippAddRange(ipp=%p, group=%02x(%s), name=\"%s\", lower=%d, "
- "upper=%d)\n", ipp, group, ippTagString(group), name, lower,
+ "upper=%d)", ipp, group, ippTagString(group), name, lower,
upper));
if (!ipp || !name)
@@ -575,7 +575,7 @@ ippAddRanges(ipp_t *ipp, /* I - IPP message */
DEBUG_printf(("ippAddRanges(ipp=%p, group=%02x(%s), name=\"%s\", "
- "num_values=%d, lower=%p, upper=%p)\n", ipp, group,
+ "num_values=%d, lower=%p, upper=%p)", ipp, group,
ippTagString(group), name, num_values, lower, upper));
if (!ipp || !name || num_values < 1)
@@ -617,7 +617,7 @@ ippAddResolution(ipp_t *ipp, /* I - IPP message */
DEBUG_printf(("ippAddResolution(ipp=%p, group=%02x(%s), name=\"%s\", "
- "units=%d, xres=%d, yres=%d)\n", ipp, group,
+ "units=%d, xres=%d, yres=%d)", ipp, group,
ippTagString(group), name, units, xres, yres));
if (!ipp || !name)
@@ -656,7 +656,7 @@ ippAddResolutions(ipp_t *ipp, /* I - IPP message */
DEBUG_printf(("ippAddResolutions(ipp=%p, group=%02x(%s), name=\"%s\", "
- "num_value=%d, units=%d, xres=%p, yres=%p)\n", ipp, group,
+ "num_value=%d, units=%d, xres=%p, yres=%p)", ipp, group,
ippTagString(group), name, num_values, units, xres, yres));
if (!ipp || !name || num_values < 1)
@@ -693,7 +693,7 @@ ippAddSeparator(ipp_t *ipp) /* I - IPP message */
ipp_attribute_t *attr; /* New attribute */
- DEBUG_printf(("ippAddSeparator(ipp=%p)\n", ipp));
+ DEBUG_printf(("ippAddSeparator(ipp=%p)", ipp));
if (!ipp)
return (NULL);
@@ -771,7 +771,7 @@ ippDelete(ipp_t *ipp) /* I - IPP message */
*next; /* Next attribute */
- DEBUG_printf(("ippDelete(ipp=%p)\n", ipp));
+ DEBUG_printf(("ippDelete(ipp=%p)", ipp));
if (!ipp)
return;
@@ -801,7 +801,8 @@ ippDeleteAttribute(
*prev; /* Previous attribute */
- DEBUG_printf(("ippDeleteAttribute(ipp=%p, attr=%p)\n", ipp, attr));
+ DEBUG_printf(("ippDeleteAttribute(ipp=%p, attr=%p(%s))", ipp, attr,
+ attr ? attr->name : "(null)"));
/*
* Find the attribute in the list...
@@ -843,7 +844,7 @@ ippFindAttribute(ipp_t *ipp, /* I - IPP message */
const char *name, /* I - Name of attribute */
ipp_tag_t type) /* I - Type of attribute */
{
- DEBUG_printf(("ippFindAttribute(ipp=%p, name=\"%s\", type=%02x(%s))\n", ipp,
+ DEBUG_printf(("2ippFindAttribute(ipp=%p, name=\"%s\", type=%02x(%s))", ipp,
name, type, ippTagString(type)));
if (!ipp || !name)
@@ -876,7 +877,7 @@ ippFindNextAttribute(ipp_t *ipp, /* I - IPP message */
ipp_tag_t value_tag; /* Value tag */
- DEBUG_printf(("ippFindNextAttribute(ipp=%p, name=\"%s\", type=%02x(%s))\n",
+ DEBUG_printf(("2ippFindNextAttribute(ipp=%p, name=\"%s\", type=%02x(%s))",
ipp, name, type, ippTagString(type)));
if (!ipp || !name)
@@ -895,7 +896,7 @@ ippFindNextAttribute(ipp_t *ipp, /* I - IPP message */
for (; attr != NULL; ipp->prev = attr, attr = attr->next)
{
- DEBUG_printf(("ippFindAttribute: attr=%p, name=\"%s\"\n", attr,
+ DEBUG_printf(("4ippFindAttribute: attr=%p, name=\"%s\"", attr,
attr->name));
value_tag = (ipp_tag_t)(attr->value_tag & IPP_TAG_MASK);
@@ -951,7 +952,7 @@ ippNew(void)
temp->request.any.version[1] = 1;
}
- DEBUG_printf(("ippNew: %p\n", temp));
+ DEBUG_printf(("1ippNew: Returning %p", temp));
return (temp);
}
@@ -974,7 +975,7 @@ ippNewRequest(ipp_op_t op) /* I - Operation code */
cups_lang_t *language; /* Current language localization */
- DEBUG_printf(("ippNewRequest(op=%02x(%s))\n", op, ippOpString(op)));
+ DEBUG_printf(("ippNewRequest(op=%02x(%s))", op, ippOpString(op)));
/*
* Create a new IPP message...
@@ -1022,13 +1023,13 @@ ipp_state_t /* O - Current state */
ippRead(http_t *http, /* I - HTTP connection */
ipp_t *ipp) /* I - IPP data */
{
- DEBUG_printf(("ippRead(http=%p, ipp=%p), data_remaining=" CUPS_LLFMT "\n",
+ DEBUG_printf(("ippRead(http=%p, ipp=%p), data_remaining=" CUPS_LLFMT,
http, ipp, CUPS_LLCAST (http ? http->data_remaining : -1)));
if (!http)
return (IPP_ERROR);
- DEBUG_printf(("ippRead: http->state=%d, http->used=%d\n", http->state,
+ DEBUG_printf(("2ippRead: http->state=%d, http->used=%d", http->state,
http->used));
return (ippReadIO(http, (ipp_iocb_t)ipp_read_http, http->blocking, NULL,
@@ -1046,7 +1047,7 @@ ipp_state_t /* O - Current state */
ippReadFile(int fd, /* I - HTTP data */
ipp_t *ipp) /* I - IPP data */
{
- DEBUG_printf(("ippReadFile(fd=%d, ipp=%p)\n", fd, ipp));
+ DEBUG_printf(("ippReadFile(fd=%d, ipp=%p)", fd, ipp));
return (ippReadIO(&fd, (ipp_iocb_t)ipp_read_file, 1, NULL, ipp));
}
@@ -1076,16 +1077,16 @@ ippReadIO(void *src, /* I - Data source */
ipp_value_t *value; /* Current value */
- DEBUG_printf(("ippReadIO(src=%p, cb=%p, blocking=%d, parent=%p, ipp=%p)\n",
+ DEBUG_printf(("ippReadIO(src=%p, cb=%p, blocking=%d, parent=%p, ipp=%p)",
src, cb, blocking, parent, ipp));
- DEBUG_printf(("ippReadIO: ipp->state=%d\n", ipp->state));
+ DEBUG_printf(("2ippReadIO: ipp->state=%d", ipp->state));
if (!src || !ipp)
return (IPP_ERROR);
if ((buffer = ipp_buffer_get()) == NULL)
{
- DEBUG_puts("ippReadIO: Unable to get read buffer!");
+ DEBUG_puts("1ippReadIO: Unable to get read buffer!");
return (IPP_ERROR);
}
@@ -1103,7 +1104,7 @@ ippReadIO(void *src, /* I - Data source */
if ((*cb)(src, buffer, 8) < 8)
{
- DEBUG_puts("ippReadIO: Unable to read header!");
+ DEBUG_puts("1ippReadIO: Unable to read header!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1118,10 +1119,10 @@ ippReadIO(void *src, /* I - Data source */
ipp->request.any.request_id = (((((buffer[4] << 8) | buffer[5]) << 8) |
buffer[6]) << 8) | buffer[7];
- DEBUG_printf(("ippReadIO: version=%d.%d\n", buffer[0], buffer[1]));
- DEBUG_printf(("ippReadIO: op_status=%04x\n",
+ DEBUG_printf(("2ippReadIO: version=%d.%d", buffer[0], buffer[1]));
+ DEBUG_printf(("2ippReadIO: op_status=%04x",
ipp->request.any.op_status));
- DEBUG_printf(("ippReadIO: request_id=%d\n",
+ DEBUG_printf(("2ippReadIO: request_id=%d",
ipp->request.any.request_id));
}
@@ -1142,12 +1143,12 @@ ippReadIO(void *src, /* I - Data source */
{
if ((*cb)(src, buffer, 1) < 1)
{
- DEBUG_puts("ippReadIO: Callback returned EOF/error");
+ DEBUG_puts("1ippReadIO: Callback returned EOF/error");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
- DEBUG_printf(("ippReadIO: ipp->current=%p, ipp->prev=%p\n",
+ DEBUG_printf(("1ippReadIO: ipp->current=%p, ipp->prev=%p",
ipp->current, ipp->prev));
/*
@@ -1162,7 +1163,7 @@ ippReadIO(void *src, /* I - Data source */
* No more attributes left...
*/
- DEBUG_puts("ippReadIO: IPP_TAG_END!");
+ DEBUG_puts("2ippReadIO: IPP_TAG_END!");
ipp->state = IPP_DATA;
break;
@@ -1180,12 +1181,12 @@ ippReadIO(void *src, /* I - Data source */
ipp->curtag = tag;
ipp->current = NULL;
- DEBUG_printf(("ippReadIO: group tag=%x(%s), ipp->prev=%p\n", tag,
+ DEBUG_printf(("2ippReadIO: group tag=%x(%s), ipp->prev=%p", tag,
ippTagString(tag), ipp->prev));
continue;
}
- DEBUG_printf(("ippReadIO: value tag=%x(%s)\n", tag,
+ DEBUG_printf(("2ippReadIO: value tag=%x(%s)", tag,
ippTagString(tag)));
/*
@@ -1194,7 +1195,7 @@ ippReadIO(void *src, /* I - Data source */
if ((*cb)(src, buffer, 2) < 2)
{
- DEBUG_puts("ippReadIO: unable to read name length!");
+ DEBUG_puts("1ippReadIO: unable to read name length!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1203,12 +1204,12 @@ ippReadIO(void *src, /* I - Data source */
if (n >= IPP_BUF_SIZE)
{
- DEBUG_printf(("ippReadIO: bad name length %d!\n", n));
+ DEBUG_printf(("1ippReadIO: bad name length %d!", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
- DEBUG_printf(("ippReadIO: name length=%d\n", n));
+ DEBUG_printf(("2ippReadIO: name length=%d", n));
if (n == 0 && tag != IPP_TAG_MEMBERNAME &&
tag != IPP_TAG_END_COLLECTION)
@@ -1219,7 +1220,7 @@ ippReadIO(void *src, /* I - Data source */
if (ipp->current == NULL)
{
- DEBUG_puts("ippReadIO: Attribute without name and no current");
+ DEBUG_puts("1ippReadIO: Attribute without name and no current");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1251,7 +1252,7 @@ ippReadIO(void *src, /* I - Data source */
if ((tag < IPP_TAG_TEXTLANG || tag > IPP_TAG_MIMETYPE) &&
tag != IPP_TAG_NOVALUE)
{
- DEBUG_printf(("ippReadIO: 1setOf value tag %x(%s) != %x(%s)\n",
+ DEBUG_printf(("1ippReadIO: 1setOf value tag %x(%s) != %x(%s)",
value_tag, ippTagString(value_tag), tag,
ippTagString(tag)));
ipp_buffer_release(buffer);
@@ -1260,7 +1261,7 @@ ippReadIO(void *src, /* I - Data source */
}
else if (value_tag != tag)
{
- DEBUG_printf(("ippReadIO: value tag %x(%s) != %x(%s)\n",
+ DEBUG_printf(("1ippReadIO: value tag %x(%s) != %x(%s)",
value_tag, ippTagString(value_tag), tag,
ippTagString(tag)));
ipp_buffer_release(buffer);
@@ -1278,7 +1279,7 @@ ippReadIO(void *src, /* I - Data source */
ipp_attribute_t *temp; /* Pointer to new buffer */
- DEBUG_printf(("ippReadIO: reallocating for up to %d values...\n",
+ DEBUG_printf(("2ippReadIO: reallocating for up to %d values...",
attr->num_values + IPP_MAX_VALUES));
/*
@@ -1289,7 +1290,7 @@ ippReadIO(void *src, /* I - Data source */
(attr->num_values + IPP_MAX_VALUES - 1) *
sizeof(ipp_value_t))) == NULL)
{
- DEBUG_puts("ippReadIO: Unable to resize attribute");
+ DEBUG_puts("1ippReadIO: Unable to resize attribute");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1317,7 +1318,7 @@ ippReadIO(void *src, /* I - Data source */
if (n)
{
- DEBUG_puts("ippReadIO: member name not empty!");
+ DEBUG_puts("1ippReadIO: member name not empty!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1327,8 +1328,8 @@ ippReadIO(void *src, /* I - Data source */
attr = ipp->current = _ippAddAttr(ipp, 1);
- DEBUG_printf(("ippReadIO: membername, ipp->current=%p, "
- "ipp->prev=%p\n", ipp->current, ipp->prev));
+ DEBUG_printf(("2ippReadIO: membername, ipp->current=%p, "
+ "ipp->prev=%p", ipp->current, ipp->prev));
attr->group_tag = ipp->curtag;
attr->value_tag = IPP_TAG_ZERO;
@@ -1342,7 +1343,7 @@ ippReadIO(void *src, /* I - Data source */
if ((*cb)(src, buffer, n) < n)
{
- DEBUG_puts("ippReadIO: unable to read name!");
+ DEBUG_puts("1ippReadIO: unable to read name!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1354,13 +1355,13 @@ ippReadIO(void *src, /* I - Data source */
if ((attr = ipp->current = _ippAddAttr(ipp, 1)) == NULL)
{
- DEBUG_puts("ippReadIO: unable to allocate attribute!");
+ DEBUG_puts("1ippReadIO: unable to allocate attribute!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
- DEBUG_printf(("ippReadIO: name=\"%s\", ipp->current=%p, "
- "ipp->prev=%p\n", buffer, ipp->current, ipp->prev));
+ DEBUG_printf(("2ippReadIO: name=\"%s\", ipp->current=%p, "
+ "ipp->prev=%p", buffer, ipp->current, ipp->prev));
attr->group_tag = ipp->curtag;
attr->value_tag = tag;
@@ -1377,13 +1378,13 @@ ippReadIO(void *src, /* I - Data source */
if ((*cb)(src, buffer, 2) < 2)
{
- DEBUG_puts("ippReadIO: unable to read value length!");
+ DEBUG_puts("1ippReadIO: unable to read value length!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
n = (buffer[0] << 8) | buffer[1];
- DEBUG_printf(("ippReadIO: value length=%d\n", n));
+ DEBUG_printf(("2ippReadIO: value length=%d", n));
switch (tag)
{
@@ -1391,14 +1392,14 @@ ippReadIO(void *src, /* I - Data source */
case IPP_TAG_ENUM :
if (n != 4)
{
- DEBUG_printf(("ippReadIO: bad value length %d!\n", n));
+ DEBUG_printf(("1ippReadIO: bad value length %d!", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
if ((*cb)(src, buffer, 4) < 4)
{
- DEBUG_puts("ippReadIO: Unable to read integer value!");
+ DEBUG_puts("1ippReadIO: Unable to read integer value!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1412,14 +1413,14 @@ ippReadIO(void *src, /* I - Data source */
case IPP_TAG_BOOLEAN :
if (n != 1)
{
- DEBUG_printf(("ippReadIO: bad value length %d!\n", n));
+ DEBUG_printf(("1ippReadIO: bad value length %d!", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
if ((*cb)(src, buffer, 1) < 1)
{
- DEBUG_puts("ippReadIO: Unable to read boolean value!");
+ DEBUG_puts("1ippReadIO: Unable to read boolean value!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1449,35 +1450,34 @@ ippReadIO(void *src, /* I - Data source */
case IPP_TAG_MIMETYPE :
if (n >= IPP_BUF_SIZE)
{
- DEBUG_printf(("ippReadIO: bad value length %d!\n", n));
+ DEBUG_printf(("1ippReadIO: bad value length %d!", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
if ((*cb)(src, buffer, n) < n)
{
- DEBUG_puts("ippReadIO: unable to read name!");
+ DEBUG_puts("1ippReadIO: unable to read name!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
buffer[n] = '\0';
value->string.text = _cupsStrAlloc((char *)buffer);
- DEBUG_printf(("ippReadIO: value=\"%s\"\n",
- value->string.text));
+ DEBUG_printf(("2ippReadIO: value=\"%s\"", value->string.text));
break;
case IPP_TAG_DATE :
if (n != 11)
{
- DEBUG_printf(("ippReadIO: bad value length %d!\n", n));
+ DEBUG_printf(("1ippReadIO: bad value length %d!", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
if ((*cb)(src, value->date, 11) < 11)
{
- DEBUG_puts("ippReadIO: Unable to date integer value!");
+ DEBUG_puts("1ippReadIO: Unable to read date value!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1486,14 +1486,14 @@ ippReadIO(void *src, /* I - Data source */
case IPP_TAG_RESOLUTION :
if (n != 9)
{
- DEBUG_printf(("ippReadIO: bad value length %d!\n", n));
+ DEBUG_printf(("1ippReadIO: bad value length %d!", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
if ((*cb)(src, buffer, 9) < 9)
{
- DEBUG_puts("ippReadIO: Unable to read resolution value!");
+ DEBUG_puts("1ippReadIO: Unable to read resolution value!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1511,14 +1511,14 @@ ippReadIO(void *src, /* I - Data source */
case IPP_TAG_RANGE :
if (n != 8)
{
- DEBUG_printf(("ippReadIO: bad value length %d!\n", n));
+ DEBUG_printf(("1ippReadIO: bad value length %d!", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
if ((*cb)(src, buffer, 8) < 8)
{
- DEBUG_puts("ippReadIO: Unable to read range value!");
+ DEBUG_puts("1ippReadIO: Unable to read range value!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1535,14 +1535,15 @@ ippReadIO(void *src, /* I - Data source */
case IPP_TAG_NAMELANG :
if (n >= IPP_BUF_SIZE || n < 4)
{
- DEBUG_printf(("ippReadIO: bad value length %d!\n", n));
+ DEBUG_printf(("1ippReadIO: bad value length %d!", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
if ((*cb)(src, buffer, n) < n)
{
- DEBUG_puts("ippReadIO: Unable to read string w/language value!");
+ DEBUG_puts("1ippReadIO: Unable to read string w/language "
+ "value!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1564,7 +1565,7 @@ ippReadIO(void *src, /* I - Data source */
if ((bufptr + 2 + n) >= (buffer + IPP_BUF_SIZE) ||
n >= sizeof(string))
{
- DEBUG_printf(("ippReadIO: bad value length %d!\n", n));
+ DEBUG_printf(("1ippReadIO: bad value length %d!", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1579,7 +1580,7 @@ ippReadIO(void *src, /* I - Data source */
if ((bufptr + 2 + n) >= (buffer + IPP_BUF_SIZE))
{
- DEBUG_printf(("ippReadIO: bad value length %d!\n", n));
+ DEBUG_printf(("1ippReadIO: bad value length %d!", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1597,7 +1598,7 @@ ippReadIO(void *src, /* I - Data source */
if (n > 0)
{
- DEBUG_puts("ippReadIO: begCollection tag with value length "
+ DEBUG_puts("1ippReadIO: begCollection tag with value length "
"> 0!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -1605,7 +1606,7 @@ ippReadIO(void *src, /* I - Data source */
if (ippReadIO(src, cb, 1, ipp, value->collection) == IPP_ERROR)
{
- DEBUG_puts("ippReadIO: Unable to read collection value!");
+ DEBUG_puts("1ippReadIO: Unable to read collection value!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1616,12 +1617,12 @@ ippReadIO(void *src, /* I - Data source */
if (n > 0)
{
- DEBUG_puts("ippReadIO: endCollection tag with value length "
+ DEBUG_puts("1ippReadIO: endCollection tag with value length "
"> 0!");
return (IPP_ERROR);
}
- DEBUG_puts("ippReadIO: endCollection tag...");
+ DEBUG_puts("1ippReadIO: endCollection tag...");
return (ipp->state = IPP_DATA);
case IPP_TAG_MEMBERNAME :
@@ -1632,14 +1633,14 @@ ippReadIO(void *src, /* I - Data source */
if (n >= IPP_BUF_SIZE)
{
- DEBUG_printf(("ippReadIO: bad value length %d!\n", n));
+ DEBUG_printf(("1ippReadIO: bad value length %d!", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
if ((*cb)(src, buffer, n) < n)
{
- DEBUG_puts("ippReadIO: Unable to read member name value!");
+ DEBUG_puts("1ippReadIO: Unable to read member name value!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1655,20 +1656,20 @@ ippReadIO(void *src, /* I - Data source */
attr->num_values --;
- DEBUG_printf(("ippReadIO: member name=\"%s\"\n", attr->name));
+ DEBUG_printf(("2ippReadIO: member name=\"%s\"", attr->name));
break;
default : /* Other unsupported values */
if (n > IPP_MAX_LENGTH)
{
- DEBUG_printf(("ippReadIO: bad value length %d!\n", n));
+ DEBUG_printf(("1ippReadIO: bad value length %d!", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
if (!value)
{
- DEBUG_puts("ippReadIO: NULL value!");
+ DEBUG_puts("1ippReadIO: NULL value!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1678,14 +1679,14 @@ ippReadIO(void *src, /* I - Data source */
{
if ((value->unknown.data = malloc(n)) == NULL)
{
- DEBUG_puts("ippReadIO: Unable to allocate value");
+ DEBUG_puts("1ippReadIO: Unable to allocate value");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
if ((*cb)(src, value->unknown.data, n) < n)
{
- DEBUG_puts("ippReadIO: Unable to read unsupported value!");
+ DEBUG_puts("1ippReadIO: Unable to read unsupported value!");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1713,7 +1714,7 @@ ippReadIO(void *src, /* I - Data source */
break; /* anti-compiler-warning-code */
}
- DEBUG_printf(("ippReadIO: returning ipp->state=%d!\n", ipp->state));
+ DEBUG_printf(("1ippReadIO: returning ipp->state=%d!", ipp->state));
ipp_buffer_release(buffer);
return (ipp->state);
@@ -1776,13 +1777,12 @@ ipp_state_t /* O - Current state */
ippWrite(http_t *http, /* I - HTTP connection */
ipp_t *ipp) /* I - IPP data */
{
- DEBUG_printf(("ippWrite(http=%p, ipp=%p)\n", http, ipp));
+ DEBUG_printf(("ippWrite(http=%p, ipp=%p)", http, ipp));
if (!http)
return (IPP_ERROR);
- return (ippWriteIO(http, (ipp_iocb_t)httpWrite2,
- http->blocking, NULL, ipp));
+ return (ippWriteIO(http, (ipp_iocb_t)httpWrite2, http->blocking, NULL, ipp));
}
@@ -1796,7 +1796,7 @@ ipp_state_t /* O - Current state */
ippWriteFile(int fd, /* I - HTTP data */
ipp_t *ipp) /* I - IPP data */
{
- DEBUG_printf(("ippWriteFile(fd=%d, ipp=%p)\n", fd, ipp));
+ DEBUG_printf(("ippWriteFile(fd=%d, ipp=%p)", fd, ipp));
ipp->state = IPP_IDLE;
@@ -1825,7 +1825,7 @@ ippWriteIO(void *dst, /* I - Destination */
ipp_value_t *value; /* Current value */
- DEBUG_printf(("ippWriteIO(dst=%p, cb=%p, blocking=%d, parent=%p, ipp=%p)\n",
+ DEBUG_printf(("ippWriteIO(dst=%p, cb=%p, blocking=%d, parent=%p, ipp=%p)",
dst, cb, blocking, parent, ipp));
if (!dst || !ipp)
@@ -1833,7 +1833,7 @@ ippWriteIO(void *dst, /* I - Destination */
if ((buffer = ipp_buffer_get()) == NULL)
{
- DEBUG_puts("ippWriteIO: Unable to get write buffer");
+ DEBUG_puts("1ippWriteIO: Unable to get write buffer");
return (IPP_ERROR);
}
@@ -1867,7 +1867,7 @@ ippWriteIO(void *dst, /* I - Destination */
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP header...");
+ DEBUG_puts("1ippWriteIO: Could not write IPP header...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1882,10 +1882,10 @@ ippWriteIO(void *dst, /* I - Destination */
ipp->current = ipp->attrs;
ipp->curtag = IPP_TAG_ZERO;
- DEBUG_printf(("ippWriteIO: version=%d.%d\n", buffer[0], buffer[1]));
- DEBUG_printf(("ippWriteIO: op_status=%04x\n",
+ DEBUG_printf(("2ippWriteIO: version=%d.%d", buffer[0], buffer[1]));
+ DEBUG_printf(("2ippWriteIO: op_status=%04x",
ipp->request.any.op_status));
- DEBUG_printf(("ippWriteIO: request_id=%d\n",
+ DEBUG_printf(("2ippWriteIO: request_id=%d",
ipp->request.any.request_id));
/*
@@ -1918,7 +1918,7 @@ ippWriteIO(void *dst, /* I - Destination */
if (attr->group_tag == IPP_TAG_ZERO)
continue;
- DEBUG_printf(("ippWriteIO: wrote group tag=%x(%s)\n",
+ DEBUG_printf(("2ippWriteIO: wrote group tag=%x(%s)",
attr->group_tag, ippTagString(attr->group_tag)));
*bufptr++ = attr->group_tag;
}
@@ -1945,7 +1945,7 @@ ippWriteIO(void *dst, /* I - Destination */
if ((n = (int)strlen(attr->name)) > (IPP_BUF_SIZE - 4))
{
- DEBUG_printf(("ippWriteIO: Attribute name too long (%d)\n", n));
+ DEBUG_printf(("1ippWriteIO: Attribute name too long (%d)", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1954,9 +1954,9 @@ ippWriteIO(void *dst, /* I - Destination */
* Write the value tag, name length, and name string...
*/
- DEBUG_printf(("ippWriteIO: writing value tag=%x(%s)\n",
+ DEBUG_printf(("2ippWriteIO: writing value tag=%x(%s)",
attr->value_tag, ippTagString(attr->value_tag)));
- DEBUG_printf(("ippWriteIO: writing name=%d,\"%s\"\n", n,
+ DEBUG_printf(("2ippWriteIO: writing name=%d,\"%s\"", n,
attr->name));
*bufptr++ = attr->value_tag;
@@ -1974,7 +1974,7 @@ ippWriteIO(void *dst, /* I - Destination */
if ((n = (int)strlen(attr->name)) > (IPP_BUF_SIZE - 7))
{
- DEBUG_printf(("ippWriteIO: Attribute name too long (%d)\n", n));
+ DEBUG_printf(("1ippWriteIO: Attribute name too long (%d)", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -1984,13 +1984,13 @@ ippWriteIO(void *dst, /* I - Destination */
* and empty name for the collection member attribute...
*/
- DEBUG_printf(("ippWriteIO: writing value tag=%x(memberName)\n",
+ DEBUG_printf(("2ippWriteIO: writing value tag=%x(memberName)",
IPP_TAG_MEMBERNAME));
- DEBUG_printf(("ippWriteIO: writing name=%d,\"%s\"\n", n,
+ DEBUG_printf(("2ippWriteIO: writing name=%d,\"%s\"", n,
attr->name));
- DEBUG_printf(("ippWriteIO: writing value tag=%x(%s)\n",
+ DEBUG_printf(("2ippWriteIO: writing value tag=%x(%s)",
attr->value_tag, ippTagString(attr->value_tag)));
- DEBUG_puts("ippWriteIO: writing name=0,\"\"\n");
+ DEBUG_puts("2ippWriteIO: writing name=0,\"\"");
*bufptr++ = IPP_TAG_MEMBERNAME;
*bufptr++ = 0;
@@ -2021,7 +2021,7 @@ ippWriteIO(void *dst, /* I - Destination */
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP "
+ DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -2067,7 +2067,7 @@ ippWriteIO(void *dst, /* I - Destination */
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP "
+ DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -2119,16 +2119,16 @@ ippWriteIO(void *dst, /* I - Destination */
* values with a zero-length name...
*/
- DEBUG_printf(("ippWriteIO: writing value tag=%x(%s)\n",
+ DEBUG_printf(("2ippWriteIO: writing value tag=%x(%s)",
attr->value_tag,
ippTagString(attr->value_tag)));
- DEBUG_printf(("ippWriteIO: writing name=0,\"\"\n"));
+ DEBUG_printf(("2ippWriteIO: writing name=0,\"\""));
if ((IPP_BUF_SIZE - (bufptr - buffer)) < 3)
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP "
+ DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -2149,19 +2149,19 @@ ippWriteIO(void *dst, /* I - Destination */
if (n > (IPP_BUF_SIZE - 2))
{
- DEBUG_printf(("ippWriteIO: String too long (%d)\n", n));
+ DEBUG_printf(("1ippWriteIO: String too long (%d)", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
- DEBUG_printf(("ippWriteIO: writing string=%d,\"%s\"\n", n,
+ DEBUG_printf(("2ippWriteIO: writing string=%d,\"%s\"", n,
value->string.text));
if ((int)(IPP_BUF_SIZE - (bufptr - buffer)) < (n + 2))
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP "
+ DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -2200,7 +2200,7 @@ ippWriteIO(void *dst, /* I - Destination */
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP "
+ DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -2245,7 +2245,7 @@ ippWriteIO(void *dst, /* I - Destination */
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP "
+ DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -2298,7 +2298,7 @@ ippWriteIO(void *dst, /* I - Destination */
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP "
+ DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -2357,7 +2357,7 @@ ippWriteIO(void *dst, /* I - Destination */
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP "
+ DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -2391,8 +2391,8 @@ ippWriteIO(void *dst, /* I - Destination */
if (n > (IPP_BUF_SIZE - 2))
{
- DEBUG_printf(("ippWriteIO: text/nameWithLanguage value "
- "too long (%d)\n", n));
+ DEBUG_printf(("1ippWriteIO: text/nameWithLanguage value "
+ "too long (%d)", n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -2401,7 +2401,7 @@ ippWriteIO(void *dst, /* I - Destination */
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP "
+ DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -2464,7 +2464,7 @@ ippWriteIO(void *dst, /* I - Destination */
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP "
+ DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -2494,7 +2494,7 @@ ippWriteIO(void *dst, /* I - Destination */
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP "
+ DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -2511,7 +2511,7 @@ ippWriteIO(void *dst, /* I - Destination */
if (ippWriteIO(dst, cb, 1, ipp,
value->collection) == IPP_ERROR)
{
- DEBUG_puts("ippWriteIO: Unable to write collection value");
+ DEBUG_puts("1ippWriteIO: Unable to write collection value");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -2534,7 +2534,7 @@ ippWriteIO(void *dst, /* I - Destination */
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP "
+ DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -2559,7 +2559,7 @@ ippWriteIO(void *dst, /* I - Destination */
if (n > (IPP_BUF_SIZE - 2))
{
- DEBUG_printf(("ippWriteIO: Data length too long (%d)\n",
+ DEBUG_printf(("1ippWriteIO: Data length too long (%d)",
n));
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -2569,7 +2569,7 @@ ippWriteIO(void *dst, /* I - Destination */
{
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP "
+ DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
@@ -2598,12 +2598,12 @@ ippWriteIO(void *dst, /* I - Destination */
if ((*cb)(dst, buffer, (int)(bufptr - buffer)) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP attribute...");
+ DEBUG_puts("1ippWriteIO: Could not write IPP attribute...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
- DEBUG_printf(("ippWriteIO: wrote %d bytes\n",
+ DEBUG_printf(("2ippWriteIO: wrote %d bytes",
(int)(bufptr - buffer)));
/*
@@ -2638,7 +2638,7 @@ ippWriteIO(void *dst, /* I - Destination */
if ((*cb)(dst, buffer, n) < 0)
{
- DEBUG_puts("ippWriteIO: Could not write IPP end-tag...");
+ DEBUG_puts("1ippWriteIO: Could not write IPP end-tag...");
ipp_buffer_release(buffer);
return (IPP_ERROR);
}
@@ -2671,7 +2671,7 @@ _ippAddAttr(ipp_t *ipp, /* I - IPP message */
ipp_attribute_t *attr; /* New attribute */
- DEBUG_printf(("_ippAddAttr(ipp=%p, num_values=%d)\n", ipp, num_values));
+ DEBUG_printf(("4_ippAddAttr(ipp=%p, num_values=%d)", ipp, num_values));
if (!ipp || num_values < 0)
return (NULL);
@@ -2691,7 +2691,7 @@ _ippAddAttr(ipp_t *ipp, /* I - IPP message */
ipp->last = attr;
}
- DEBUG_printf(("_ippAddAttr(): %p\n", attr));
+ DEBUG_printf(("5_ippAddAttr: Returning %p", attr));
return (attr);
}
@@ -2708,7 +2708,7 @@ _ippFreeAttr(ipp_attribute_t *attr) /* I - Attribute to free */
ipp_value_t *value; /* Current value */
- DEBUG_printf(("_ippFreeAttr(attr=%p)\n", attr));
+ DEBUG_printf(("4_ippFreeAttr(attr=%p)", attr));
switch (attr->value_tag)
{
@@ -2864,8 +2864,8 @@ ipp_length(ipp_t *ipp, /* I - IPP message or collection */
if (!attr->name)
continue;
- DEBUG_printf(("ipp_length: attr->name=\"%s\", attr->num_values=%d, "
- "bytes=%d\n", attr->name, attr->num_values, bytes));
+ DEBUG_printf(("9ipp_length: attr->name=\"%s\", attr->num_values=%d, "
+ "bytes=%d", attr->name, attr->num_values, bytes));
bytes += (int)strlen(attr->name); /* Name */
bytes += attr->num_values; /* Value tag for each value */
@@ -2955,7 +2955,7 @@ ipp_length(ipp_t *ipp, /* I - IPP message or collection */
else
bytes ++;
- DEBUG_printf(("ipp_length: bytes=%d\n", bytes));
+ DEBUG_printf(("8ipp_length: Returning %d bytes", bytes));
return (bytes);
}
@@ -2975,7 +2975,7 @@ ipp_read_http(http_t *http, /* I - Client connection */
char len[32]; /* Length string */
- DEBUG_printf(("ipp_read_http(http=%p, buffer=%p, length=%d)\n",
+ DEBUG_printf(("7ipp_read_http(http=%p, buffer=%p, length=%d)",
http, buffer, (int)length));
/*
@@ -2986,7 +2986,7 @@ ipp_read_http(http_t *http, /* I - Client connection */
tbytes < (int)length;
tbytes += bytes, buffer += bytes)
{
- DEBUG_printf(("ipp_read_http: tbytes=%d, http->state=%d\n", tbytes,
+ DEBUG_printf(("9ipp_read_http: tbytes=%d, http->state=%d", tbytes,
http->state));
if (http->state == HTTP_WAITING)
@@ -3086,7 +3086,7 @@ ipp_read_http(http_t *http, /* I - Client connection */
if (tbytes == 0 && bytes < 0)
tbytes = -1;
- DEBUG_printf(("ipp_read_http: returning %d bytes...\n", tbytes));
+ DEBUG_printf(("8ipp_read_http: Returning %d bytes", tbytes));
return (tbytes);
}
diff --git a/cups/language.c b/cups/language.c
index 02efaac0f..39ef43569 100644
--- a/cups/language.c
+++ b/cups/language.c
@@ -3,7 +3,7 @@
*
* I18N/language support for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -429,7 +429,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
};
- DEBUG_printf(("cupsLangGet(language=\"%s\")\n", language ? language : "(null)"));
+ DEBUG_printf(("cupsLangGet(language=\"%s\")", language));
#ifdef __APPLE__
/*
@@ -448,7 +448,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
if ((language = getenv("LANG")) == NULL)
language = appleLangDefault();
- DEBUG_printf(("cupsLangGet: language=\"%s\"\n", language));
+ DEBUG_printf(("2cupsLangGet: language=\"%s\"", language));
}
#else
@@ -477,8 +477,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
ptr = setlocale(LC_ALL, NULL);
# endif /* LC_MESSAGES */
- DEBUG_printf(("cupsLangGet: current locale is \"%s\"\n",
- ptr ? ptr : "(null)"));
+ DEBUG_printf(("2cupsLangGet: current locale is \"%s\"", ptr));
if (!ptr || !strcmp(ptr, "C") || !strcmp(ptr, "POSIX"))
{
@@ -526,7 +525,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
if (!strncmp(locale, "nb", 2))
locale[1] = 'o';
- DEBUG_printf(("cupsLangGet: new language value is \"%s\"\n", language));
+ DEBUG_printf(("2cupsLangGet: new language value is \"%s\"", language));
}
}
#endif /* __APPLE__ */
@@ -563,8 +562,8 @@ cupsLangGet(const char *language) /* I - Language or locale */
*ptr = '\0';
- DEBUG_printf(("cupsLangGet: charset set to \"%s\" via nl_langinfo(CODESET)...\n",
- charset));
+ DEBUG_printf(("2cupsLangGet: charset set to \"%s\" via "
+ "nl_langinfo(CODESET)...", charset));
}
#endif /* CODESET */
@@ -643,7 +642,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
}
}
- DEBUG_printf(("cupsLangGet: langname=\"%s\", country=\"%s\", charset=\"%s\"\n",
+ DEBUG_printf(("2cupsLangGet: langname=\"%s\", country=\"%s\", charset=\"%s\"",
langname, country, charset));
/*
@@ -681,7 +680,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
}
}
- DEBUG_printf(("cupsLangGet: encoding=%d(%s)\n", encoding,
+ DEBUG_printf(("2cupsLangGet: encoding=%d(%s)", encoding,
encoding == CUPS_AUTO_ENCODING ? "auto" :
lang_encodings[encoding]));
@@ -712,7 +711,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
pthread_mutex_unlock(&lang_mutex);
#endif /* HAVE_PTHREAD_H */
- DEBUG_printf(("cupsLangGet: Using cached copy of \"%s\"...\n", real));
+ DEBUG_printf(("1cupsLangGet: Using cached copy of \"%s\"...", real));
return (lang);
}
@@ -732,7 +731,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
* No generic localization, so use POSIX...
*/
- DEBUG_printf(("cupsLangGet: access(\"%s\", 0): %s\n", filename,
+ DEBUG_printf(("2cupsLangGet: access(\"%s\", 0): %s", filename,
strerror(errno)));
snprintf(filename, sizeof(filename), "%s/C/cups_C.po", cg->localedir);
@@ -895,7 +894,7 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
int length; /* Length of combined strings */
- DEBUG_printf(("_cupsMessageLoad(filename=\"%s\")\n", filename));
+ DEBUG_printf(("4_cupsMessageLoad(filename=\"%s\")", filename));
/*
* Create an array to hold the messages...
@@ -903,7 +902,7 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
if ((a = cupsArrayNew((cups_array_func_t)cups_message_compare, NULL)) == NULL)
{
- DEBUG_puts("_cupsMessageLoad: Unable to allocate array!");
+ DEBUG_puts("5_cupsMessageLoad: Unable to allocate array!");
return (NULL);
}
@@ -913,7 +912,7 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
if ((fp = cupsFileOpen(filename, "r")) == NULL)
{
- DEBUG_printf(("_cupsMessageLoad: Unable to open file: %s\n",
+ DEBUG_printf(("5_cupsMessageLoad: Unable to open file: %s",
strerror(errno)));
return (a);
}
@@ -1068,7 +1067,7 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
cupsFileClose(fp);
- DEBUG_printf(("_cupsMessageLoad: Returning %d messages...\n",
+ DEBUG_printf(("5_cupsMessageLoad: Returning %d messages...",
cupsArrayCount(a)));
return (a);
@@ -1165,7 +1164,7 @@ appleLangDefault(void)
kCFStringEncodingASCII);
CFRelease(localeName);
- DEBUG_printf(("appleLangDefault: cg->language=\"%s\"\n",
+ DEBUG_printf(("9appleLangDefault: cg->language=\"%s\"",
cg->language));
/*
@@ -1179,7 +1178,7 @@ appleLangDefault(void)
{
if (!strcmp(cg->language, apple_language_locale[i].language))
{
- DEBUG_printf(("appleLangDefault: mapping \"%s\" to \"%s\"...\n",
+ DEBUG_printf(("9appleLangDefault: mapping \"%s\" to \"%s\"...",
cg->language, apple_language_locale[i].locale));
strlcpy(cg->language, apple_language_locale[i].locale,
sizeof(cg->language));
@@ -1232,7 +1231,7 @@ cups_cache_lookup(const char *name,/* I - Name of locale */
cups_lang_t *lang; /* Current language */
- DEBUG_printf(("cups_cache_lookup(name=\"%s\", encoding=%d(%s))\n", name,
+ DEBUG_printf(("7cups_cache_lookup(name=\"%s\", encoding=%d(%s))", name,
encoding, encoding == CUPS_AUTO_ENCODING ? "auto" :
lang_encodings[encoding]));
@@ -1242,8 +1241,8 @@ cups_cache_lookup(const char *name,/* I - Name of locale */
for (lang = lang_cache; lang != NULL; lang = lang->next)
{
- DEBUG_printf(("cups_cache_lookup: lang=%p, language=\"%s\", encoding=%d(%s)\n",
- lang, lang->language, lang->encoding,
+ DEBUG_printf(("9cups_cache_lookup: lang=%p, language=\"%s\", "
+ "encoding=%d(%s)", lang, lang->language, lang->encoding,
lang_encodings[lang->encoding]));
if (!strcmp(lang->language, name) &&
@@ -1251,13 +1250,13 @@ cups_cache_lookup(const char *name,/* I - Name of locale */
{
lang->used ++;
- DEBUG_puts("cups_cache_lookup: returning match!");
+ DEBUG_puts("8cups_cache_lookup: returning match!");
return (lang);
}
}
- DEBUG_puts("cups_cache_lookup: returning NULL!");
+ DEBUG_puts("8cups_cache_lookup: returning NULL!");
return (NULL);
}
diff --git a/cups/localize.c b/cups/localize.c
index 236b8048e..07cfe8a55 100644
--- a/cups/localize.c
+++ b/cups/localize.c
@@ -3,7 +3,7 @@
*
* PPD localization routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -84,7 +84,7 @@ ppdLocalize(ppd_file_t *ppd) /* I - PPD file */
* Range check input...
*/
- DEBUG_printf(("ppdLocalize(ppd=%p)\n", ppd));
+ DEBUG_printf(("ppdLocalize(ppd=%p)", ppd));
if (!ppd)
return (-1);
@@ -602,8 +602,8 @@ _ppdLocalizedAttr(ppd_file_t *ppd, /* I - PPD file */
ppd_attr_t *attr; /* Current attribute */
- DEBUG_printf(("_ppdLocalizedAttr(ppd=%p, keyword=\"%s\", spec=\"%s\", "
- "ll_CC=\"%s\")\n", ppd, keyword, spec, ll_CC));
+ DEBUG_printf(("4_ppdLocalizedAttr(ppd=%p, keyword=\"%s\", spec=\"%s\", "
+ "ll_CC=\"%s\")", ppd, keyword, spec, ll_CC));
/*
* Look for Keyword.ll_CC, then Keyword.ll...
@@ -645,10 +645,10 @@ _ppdLocalizedAttr(ppd_file_t *ppd, /* I - PPD file */
#ifdef DEBUG
if (attr)
- DEBUG_printf(("_ppdLocalizedAttr: *%s %s/%s: \"%s\"\n", attr->name,
+ DEBUG_printf(("5_ppdLocalizedAttr: *%s %s/%s: \"%s\"\n", attr->name,
attr->spec, attr->text, attr->value ? attr->value : ""));
else
- DEBUG_puts("_ppdLocalizedAttr: NOT FOUND");
+ DEBUG_puts("5_ppdLocalizedAttr: NOT FOUND");
#endif /* DEBUG */
return (attr);
@@ -701,7 +701,7 @@ ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */
strlcpy(ll_CC, "zh_CN", ll_CC_size);
}
- DEBUG_printf(("ppd_ll_CC: lang->language=\"%s\", ll_CC=\"%s\"...\n",
+ DEBUG_printf(("8ppd_ll_CC: lang->language=\"%s\", ll_CC=\"%s\"...",
lang->language, ll_CC));
}
diff --git a/cups/mark.c b/cups/mark.c
index 84836390e..b14e1da5e 100644
--- a/cups/mark.c
+++ b/cups/mark.c
@@ -465,17 +465,17 @@ ppdFindMarkedChoice(ppd_file_t *ppd, /* I - PPD file */
*marked; /* Marked choice */
- DEBUG_printf(("ppdFindMarkedChoice(ppd=%p, option=\"%s\")", ppd, option));
+ DEBUG_printf(("2ppdFindMarkedChoice(ppd=%p, option=\"%s\")", ppd, option));
if ((key.option = ppdFindOption(ppd, option)) == NULL)
{
- DEBUG_puts("ppdFindMarkedChoice: Option not found, returning NULL");
+ DEBUG_puts("3ppdFindMarkedChoice: Option not found, returning NULL");
return (NULL);
}
marked = (ppd_choice_t *)cupsArrayFind(ppd->marked, &key);
- DEBUG_printf(("ppdFindMarkedChoice: Returning %p(%s)...", marked,
+ DEBUG_printf(("3ppdFindMarkedChoice: Returning %p(%s)...", marked,
marked ? marked->choice : "NULL"));
return (marked);
@@ -602,7 +602,7 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
const char *option, /* I - Keyword */
const char *choice) /* I - Option name */
{
- DEBUG_printf(("ppdMarkOption(ppd=%p, option=\"%s\", choice=\"%s\")\n",
+ DEBUG_printf(("ppdMarkOption(ppd=%p, option=\"%s\", choice=\"%s\")",
ppd, option, choice));
/*
@@ -756,12 +756,12 @@ debug_marked(ppd_file_t *ppd, /* I - PPD file data */
ppd_choice_t *c; /* Current choice */
- DEBUG_printf(("cupsMarkOptions: %s\n", title));
+ DEBUG_printf(("2cupsMarkOptions: %s", title));
for (c = (ppd_choice_t *)cupsArrayFirst(ppd->marked);
c;
c = (ppd_choice_t *)cupsArrayNext(ppd->marked))
- DEBUG_printf(("cupsMarkOptions: %s=%s\n", c->option->keyword, c->choice));
+ DEBUG_printf(("2cupsMarkOptions: %s=%s", c->option->keyword, c->choice));
}
#endif /* DEBUG */
@@ -832,7 +832,7 @@ ppd_mark_option(ppd_file_t *ppd, /* I - PPD file */
struct lconv *loc; /* Locale data */
- DEBUG_printf(("ppd_mark_option(ppd=%p, option=\"%s\", choice=\"%s\")\n",
+ DEBUG_printf(("7ppd_mark_option(ppd=%p, option=\"%s\", choice=\"%s\")",
ppd, option, choice));
/*
diff --git a/cups/options.c b/cups/options.c
index b1476a49a..ecc210e0b 100644
--- a/cups/options.c
+++ b/cups/options.c
@@ -62,11 +62,11 @@ cupsAddOption(const char *name, /* I - Name of option */
DEBUG_printf(("cupsAddOption(name=\"%s\", value=\"%s\", num_options=%d, "
- "options=%p)\n", name, value, num_options, options));
+ "options=%p)", name, value, num_options, options));
if (!name || !name[0] || !value || !options || num_options < 0)
{
- DEBUG_printf(("cupsAddOption: Returning %d\n", num_options));
+ DEBUG_printf(("1cupsAddOption: Returning %d", num_options));
return (num_options);
}
@@ -94,7 +94,7 @@ cupsAddOption(const char *name, /* I - Name of option */
* No matching option name...
*/
- DEBUG_printf(("cupsAddOption: New option inserted at index %d...\n",
+ DEBUG_printf(("2cupsAddOption: New option inserted at index %d...",
insert));
if (num_options == 0)
@@ -105,7 +105,7 @@ cupsAddOption(const char *name, /* I - Name of option */
if (temp == NULL)
{
- DEBUG_puts("cupsAddOption: Unable to expand option array, returning 0");
+ DEBUG_puts("1cupsAddOption: Unable to expand option array, returning 0");
return (0);
}
@@ -113,7 +113,7 @@ cupsAddOption(const char *name, /* I - Name of option */
if (insert < num_options)
{
- DEBUG_printf(("cupsAddOption: Shifting %d options...\n",
+ DEBUG_printf(("2cupsAddOption: Shifting %d options...",
(int)(num_options - insert)));
memmove(temp + insert + 1, temp + insert,
(num_options - insert) * sizeof(cups_option_t));
@@ -129,7 +129,7 @@ cupsAddOption(const char *name, /* I - Name of option */
* Match found; free the old value...
*/
- DEBUG_printf(("cupsAddOption: Option already exists at index %d...\n",
+ DEBUG_printf(("2cupsAddOption: Option already exists at index %d...",
insert));
temp = *options + insert;
@@ -138,7 +138,7 @@ cupsAddOption(const char *name, /* I - Name of option */
temp->value = _cupsStrAlloc(value);
- DEBUG_printf(("cupsAddOption: Returning %d\n", num_options));
+ DEBUG_printf(("1cupsAddOption: Returning %d", num_options));
return (num_options);
}
@@ -156,7 +156,7 @@ cupsFreeOptions(
int i; /* Looping var */
- DEBUG_printf(("cupsFreeOptions(num_options=%d, options=%p)\n", num_options,
+ DEBUG_printf(("cupsFreeOptions(num_options=%d, options=%p)", num_options,
options));
if (num_options <= 0 || !options)
@@ -185,12 +185,12 @@ cupsGetOption(const char *name, /* I - Name of option */
match; /* Matching index */
- DEBUG_printf(("cupsGetOption(name=\"%s\", num_options=%d, options=%p)\n",
+ DEBUG_printf(("2cupsGetOption(name=\"%s\", num_options=%d, options=%p)",
name, num_options, options));
if (!name || num_options <= 0 || !options)
{
- DEBUG_puts("cupsGetOption: Returning NULL");
+ DEBUG_puts("3cupsGetOption: Returning NULL");
return (NULL);
}
@@ -198,11 +198,11 @@ cupsGetOption(const char *name, /* I - Name of option */
if (!diff)
{
- DEBUG_printf(("cupsGetOption: Returning \"%s\"\n", options[match].value));
+ DEBUG_printf(("3cupsGetOption: Returning \"%s\"", options[match].value));
return (options[match].value);
}
- DEBUG_puts("cupsGetOption: Returning NULL");
+ DEBUG_puts("3cupsGetOption: Returning NULL");
return (NULL);
}
@@ -231,7 +231,7 @@ cupsParseOptions(
quote; /* Quote character */
- DEBUG_printf(("cupsParseOptions(arg=\"%s\", num_options=%d, options=%p)\n",
+ DEBUG_printf(("cupsParseOptions(arg=\"%s\", num_options=%d, options=%p)",
arg, num_options, options));
/*
@@ -240,13 +240,13 @@ cupsParseOptions(
if (!arg)
{
- DEBUG_printf(("cupsParseOptions: Returning %d\n", num_options));
+ DEBUG_printf(("1cupsParseOptions: Returning %d", num_options));
return (num_options);
}
if (!options || num_options < 0)
{
- DEBUG_puts("cupsParseOptions: Returning 0");
+ DEBUG_puts("1cupsParseOptions: Returning 0");
return (0);
}
@@ -256,8 +256,8 @@ cupsParseOptions(
if ((copyarg = strdup(arg)) == NULL)
{
- DEBUG_puts("cupsParseOptions: Unable to copy arg string");
- DEBUG_printf(("cupsParseOptions: Returning %d\n", num_options));
+ DEBUG_puts("1cupsParseOptions: Unable to copy arg string");
+ DEBUG_printf(("1cupsParseOptions: Returning %d", num_options));
return (num_options);
}
@@ -316,7 +316,7 @@ cupsParseOptions(
if ((sep = *ptr) == '=')
*ptr++ = '\0';
- DEBUG_printf(("cupsParseOptions: name=\"%s\"\n", name));
+ DEBUG_printf(("2cupsParseOptions: name=\"%s\"", name));
if (sep != '=')
{
@@ -407,7 +407,7 @@ cupsParseOptions(
if (*ptr != '\0')
*ptr++ = '\0';
- DEBUG_printf(("cupsParseOptions: value=\"%s\"\n", value));
+ DEBUG_printf(("2cupsParseOptions: value=\"%s\"", value));
/*
* Skip trailing whitespace...
@@ -430,7 +430,7 @@ cupsParseOptions(
free(copyarg);
- DEBUG_printf(("cupsParseOptions: Returning %d\n", num_options));
+ DEBUG_printf(("1cupsParseOptions: Returning %d", num_options));
return (num_options);
}
@@ -452,7 +452,7 @@ cupsRemoveOption(
cups_option_t *option; /* Current option */
- DEBUG_printf(("cupsRemoveOption(name=\"%s\", num_options=%d, options=%p)\n",
+ DEBUG_printf(("cupsRemoveOption(name=\"%s\", num_options=%d, options=%p)",
name, num_options, options));
/*
@@ -461,7 +461,7 @@ cupsRemoveOption(
if (!name || num_options < 1 || !options)
{
- DEBUG_printf(("cupsRemoveOption: Returning %d\n", num_options));
+ DEBUG_printf(("1cupsRemoveOption: Returning %d", num_options));
return (num_options);
}
@@ -479,7 +479,7 @@ cupsRemoveOption(
* Remove this option from the array...
*/
- DEBUG_puts("cupsRemoveOption: Found option, removing it...");
+ DEBUG_puts("2cupsRemoveOption: Found option, removing it...");
num_options --;
i --;
@@ -495,7 +495,7 @@ cupsRemoveOption(
* Return the new number of options...
*/
- DEBUG_printf(("cupsRemoveOption: Returning %d\n", num_options));
+ DEBUG_printf(("1cupsRemoveOption: Returning %d", num_options));
return (num_options);
}
@@ -531,13 +531,13 @@ cups_find_option(
cups_option_t key; /* Search key */
- DEBUG_printf(("cups_find_option(name=\"%s\", num_options=%d, options=%p, "
- "prev=%d, rdiff=%p)\n", name, num_options, options, prev,
+ DEBUG_printf(("7cups_find_option(name=\"%s\", num_options=%d, options=%p, "
+ "prev=%d, rdiff=%p)", name, num_options, options, prev,
rdiff));
#ifdef DEBUG
for (left = 0; left < num_options; left ++)
- DEBUG_printf(("cups_find_option: options[%d].name=\"%s\", .value=\"%s\"\n",
+ DEBUG_printf(("9cups_find_option: options[%d].name=\"%s\", .value=\"%s\"",
left, options[left].name, options[left].value));
#endif /* DEBUG */
diff --git a/cups/page.c b/cups/page.c
index b99b54a1e..21ee3ab25 100644
--- a/cups/page.c
+++ b/cups/page.c
@@ -54,7 +54,7 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
if (!ppd)
{
- DEBUG_puts("ppdPageSize: Bad PPD pointer, returning NULL...");
+ DEBUG_puts("1ppdPageSize: Bad PPD pointer, returning NULL...");
return (NULL);
}
@@ -72,7 +72,7 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
if (!i)
{
- DEBUG_puts("ppdPageSize: No custom sizes, returning NULL...");
+ DEBUG_puts("1ppdPageSize: No custom sizes, returning NULL...");
return (NULL);
}
@@ -144,7 +144,7 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
* Return the page size...
*/
- DEBUG_printf(("ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
+ DEBUG_printf(("1ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
size->name, size->width, size->length));
return (size);
@@ -158,7 +158,7 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++)
if (!strcasecmp(name, size->name))
{
- DEBUG_printf(("ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
+ DEBUG_printf(("1ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
size->name, size->width, size->length));
return (size);
@@ -174,14 +174,14 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++)
if (size->marked)
{
- DEBUG_printf(("ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
+ DEBUG_printf(("1ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
size->name, size->width, size->length));
return (size);
}
}
- DEBUG_puts("ppdPageSize: Size not found, returning NULL");
+ DEBUG_puts("1ppdPageSize: Size not found, returning NULL");
return (NULL);
}
diff --git a/cups/ppd.c b/cups/ppd.c
index c42d36d48..4018d803b 100644
--- a/cups/ppd.c
+++ b/cups/ppd.c
@@ -3,7 +3,7 @@
*
* PPD file routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -549,6 +549,8 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
};
+ DEBUG_printf(("ppdOpen2(fp=%p)", fp));
+
/*
* Default to "OK" status...
*/
@@ -575,7 +577,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
mask = ppd_read(fp, &line, keyword, name, text, &string, 0, cg);
- DEBUG_printf(("mask=%x, keyword=\"%s\"...\n", mask, keyword));
+ DEBUG_printf(("2ppdOpen2: mask=%x, keyword=\"%s\"...", mask, keyword));
if (mask == 0 ||
strcmp(keyword, "PPD-Adobe") ||
@@ -594,7 +596,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
return (NULL);
}
- DEBUG_printf(("ppdOpen: keyword = %s, string = %p\n", keyword, string));
+ DEBUG_printf(("2ppdOpen2: keyword=%s, string=%p", keyword, string));
_cupsStrFree(string);
@@ -639,8 +641,8 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
while ((mask = ppd_read(fp, &line, keyword, name, text, &string, 1, cg)) != 0)
{
- DEBUG_printf(("mask=%x, keyword=\"%s\", name=\"%s\", text=\"%s\", "
- "string=%d chars...", mask, keyword, name, text,
+ DEBUG_printf(("2ppdOpen2: mask=%x, keyword=\"%s\", name=\"%s\", "
+ "text=\"%s\", string=%d chars...", mask, keyword, name, text,
string ? (int)strlen(string) : 0));
if (strncmp(keyword, "Default", 7) && !string &&
@@ -690,7 +692,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
ui_keyword = 1;
- DEBUG_printf(("**** FOUND ADOBE UI KEYWORD %s WITHOUT OPENUI!\n",
+ DEBUG_printf(("2ppdOpen2: FOUND ADOBE UI KEYWORD %s WITHOUT OPENUI!",
keyword));
if (!group)
@@ -699,7 +701,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
encoding)) == NULL)
goto error;
- DEBUG_printf(("Adding to group %s...\n", group->text));
+ DEBUG_printf(("2ppdOpen2: Adding to group %s...", group->text));
option = ppd_get_option(group, keyword);
group = NULL;
}
@@ -734,7 +736,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
!strcmp(ppd->attrs[j]->name + 7, keyword) &&
ppd->attrs[j]->value)
{
- DEBUG_printf(("Setting Default%s to %s via attribute...\n",
+ DEBUG_printf(("2ppdOpen2: Setting Default%s to %s via attribute...",
option->keyword, ppd->attrs[j]->value));
strlcpy(option->defchoice, ppd->attrs[j]->value,
sizeof(option->defchoice));
@@ -1032,7 +1034,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
{
ppd_option_t *custom_option; /* Custom option */
- DEBUG_puts("Processing Custom option...");
+ DEBUG_puts("2ppdOpen2: Processing Custom option...");
/*
* Get the option and custom option...
@@ -1059,7 +1061,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
if ((choice = ppdFindChoice(custom_option, "Custom")) == NULL)
if ((choice = ppd_add_choice(custom_option, "Custom")) == NULL)
{
- DEBUG_puts("Unable to add Custom choice!");
+ DEBUG_puts("1ppdOpen2: Unable to add Custom choice!");
cg->ppd_status = PPD_ALLOC_ERROR;
@@ -1099,7 +1101,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
if ((choice = ppdFindChoice(custom_option, "Custom")) == NULL)
if ((choice = ppd_add_choice(custom_option, "Custom")) == NULL)
{
- DEBUG_puts("Unable to add Custom choice!");
+ DEBUG_puts("1ppdOpen2: Unable to add Custom choice!");
cg->ppd_status = PPD_ALLOC_ERROR;
@@ -1209,7 +1211,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
* Add an option record to the current sub-group, group, or file...
*/
- DEBUG_printf(("name=\"%s\" (%d)\n", name, (int)strlen(name)));
+ DEBUG_printf(("2ppdOpen2: name=\"%s\" (%d)", name, (int)strlen(name)));
if (name[0] == '*')
_cups_strcpy(name, name + 1); /* Eliminate leading asterisk */
@@ -1217,7 +1219,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
for (i = (int)strlen(name) - 1; i > 0 && isspace(name[i] & 255); i --)
name[i] = '\0'; /* Eliminate trailing spaces */
- DEBUG_printf(("OpenUI of %s in group %s...\n", name,
+ DEBUG_printf(("2ppdOpen2: OpenUI of %s in group %s...", name,
group ? group->text : "(null)"));
if (subgroup != NULL)
@@ -1228,7 +1230,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
encoding)) == NULL)
goto error;
- DEBUG_printf(("Adding to group %s...\n", group->text));
+ DEBUG_printf(("2ppdOpen2: Adding to group %s...", group->text));
option = ppd_get_option(group, name);
group = NULL;
}
@@ -1266,7 +1268,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
!strcmp(ppd->attrs[j]->name + 7, name) &&
ppd->attrs[j]->value)
{
- DEBUG_printf(("Setting Default%s to %s via attribute...\n",
+ DEBUG_printf(("2ppdOpen2: Setting Default%s to %s via attribute...",
option->keyword, ppd->attrs[j]->value));
strlcpy(option->defchoice, ppd->attrs[j]->value,
sizeof(option->defchoice));
@@ -1312,7 +1314,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
if ((choice = ppdFindChoice(option, "Custom")) == NULL)
if ((choice = ppd_add_choice(option, "Custom")) == NULL)
{
- DEBUG_puts("Unable to add Custom choice!");
+ DEBUG_puts("1ppdOpen2: Unable to add Custom choice!");
cg->ppd_status = PPD_ALLOC_ERROR;
@@ -1385,7 +1387,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
!strcmp(ppd->attrs[j]->name + 7, name) &&
ppd->attrs[j]->value)
{
- DEBUG_printf(("Setting Default%s to %s via attribute...\n",
+ DEBUG_printf(("2ppdOpen2: Setting Default%s to %s via attribute...",
option->keyword, ppd->attrs[j]->value));
strlcpy(option->defchoice, ppd->attrs[j]->value,
sizeof(option->defchoice));
@@ -1415,7 +1417,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
{
if ((choice = ppd_add_choice(option, "Custom")) == NULL)
{
- DEBUG_puts("Unable to add Custom choice!");
+ DEBUG_puts("1ppdOpen2: Unable to add Custom choice!");
cg->ppd_status = PPD_ALLOC_ERROR;
@@ -1588,11 +1590,11 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
* Set the default as part of the current option...
*/
- DEBUG_printf(("Setting %s to %s...\n", keyword, string));
+ DEBUG_printf(("2ppdOpen2: Setting %s to %s...", keyword, string));
strlcpy(option->defchoice, string, sizeof(option->defchoice));
- DEBUG_printf(("%s is now %s...\n", keyword, option->defchoice));
+ DEBUG_printf(("2ppdOpen2: %s is now %s...", keyword, option->defchoice));
}
else
{
@@ -1605,7 +1607,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
if ((toption = ppdFindOption(ppd, keyword + 7)) != NULL)
{
- DEBUG_printf(("Setting %s to %s...\n", keyword, string));
+ DEBUG_printf(("2ppdOpen2: Setting %s to %s...", keyword, string));
strlcpy(toption->defchoice, string, sizeof(toption->defchoice));
}
}
@@ -1836,7 +1838,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
(PPD_KEYWORD | PPD_OPTION | PPD_STRING) &&
!strcmp(keyword, option->keyword))
{
- DEBUG_printf(("group = %p, subgroup = %p\n", group, subgroup));
+ DEBUG_printf(("2ppdOpen2: group=%p, subgroup=%p", group, subgroup));
if (!strcmp(keyword, "PageSize"))
{
@@ -1897,7 +1899,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
#ifdef DEBUG
if (!cupsFileEOF(fp))
- DEBUG_printf(("Premature EOF at %lu...\n",
+ DEBUG_printf(("1ppdOpen2: Premature EOF at %lu...\n",
(unsigned long)cupsFileTell(fp)));
#endif /* DEBUG */
@@ -2497,7 +2499,7 @@ ppd_get_group(ppd_file_t *ppd, /* I - PPD file */
ppd_group_t *group; /* Group */
- DEBUG_printf(("ppd_get_group(ppd=%p, name=\"%s\", text=\"%s\", cg=%p)\n",
+ DEBUG_printf(("7ppd_get_group(ppd=%p, name=\"%s\", text=\"%s\", cg=%p)",
ppd, name, text, cg));
for (i = ppd->num_groups, group = ppd->groups; i > 0; i --, group ++)
@@ -2506,7 +2508,7 @@ ppd_get_group(ppd_file_t *ppd, /* I - PPD file */
if (i == 0)
{
- DEBUG_printf(("Adding group %s...\n", name));
+ DEBUG_printf(("8ppd_get_group: Adding group %s...", name));
if (cg->ppd_conform == PPD_CONFORM_STRICT && strlen(text) >= sizeof(group->text))
{
@@ -2555,7 +2557,7 @@ ppd_get_option(ppd_group_t *group, /* I - Group */
ppd_option_t *option; /* Option */
- DEBUG_printf(("ppd_get_option(group=%p(\"%s\"), name=\"%s\")\n",
+ DEBUG_printf(("7ppd_get_option(group=%p(\"%s\"), name=\"%s\")",
group, group->name, name));
for (i = group->num_options, option = group->options; i > 0; i --, option ++)
@@ -2890,7 +2892,7 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
*lineptr = '\0';
- DEBUG_printf(("LINE=\"%s\"\n", line->buffer));
+ DEBUG_printf(("9ppd_read: LINE=\"%s\"", line->buffer));
/*
* The dynamically created PPDs for older style Mac OS X
@@ -2988,8 +2990,6 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
mask |= PPD_KEYWORD;
-/* DEBUG_printf(("keyword = \"%s\", lineptr = \"%s\"\n", keyword, lineptr));*/
-
if (isspace(*lineptr & 255))
{
/*
@@ -3027,8 +3027,6 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
mask |= PPD_OPTION;
-/* DEBUG_printf(("option = \"%s\", lineptr = \"%s\"\n", option, lineptr));*/
-
if (*lineptr == '/')
{
/*
@@ -3062,8 +3060,6 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
mask |= PPD_TEXT;
}
-
-/* DEBUG_printf(("text = \"%s\", lineptr = \"%s\"\n", text, lineptr));*/
}
if (isspace(*lineptr & 255) && cg->ppd_conform == PPD_CONFORM_STRICT)
@@ -3101,8 +3097,6 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
*string = _cupsStrAlloc(lineptr);
-/* DEBUG_printf(("string = \"%s\", lineptr = \"%s\"\n", *string, lineptr));*/
-
mask |= PPD_STRING;
}
}
diff --git a/cups/request.c b/cups/request.c
index 8179e51cb..68b35c645 100644
--- a/cups/request.c
+++ b/cups/request.c
@@ -66,10 +66,9 @@ cupsDoFileRequest(http_t *http, /* I - Connection to server or @code CUPS_HT
DEBUG_printf(("cupsDoFileRequest(http=%p, request=%p(%s), resource=\"%s\", "
- "filename=\"%s\")\n", http, request,
+ "filename=\"%s\")", http, request,
request ? ippOpString(request->request.op.operation_id) : "?",
- resource ? resource : "(null)",
- filename ? filename : "(null)"));
+ resource, filename));
if (filename)
{
@@ -131,9 +130,9 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
DEBUG_printf(("cupsDoIORequest(http=%p, request=%p(%s), resource=\"%s\", "
- "infile=%d, outfile=%d)\n", http, request,
+ "infile=%d, outfile=%d)", http, request,
request ? ippOpString(request->request.op.operation_id) : "?",
- resource ? resource : "(null)", infile, outfile));
+ resource, infile, outfile));
/*
* Range check input...
@@ -203,7 +202,7 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
else
length = ippLength(request);
- DEBUG_printf(("cupsDoIORequest: Request length=%ld, total length=%ld",
+ DEBUG_printf(("2cupsDoIORequest: Request length=%ld, total length=%ld",
(long)ippLength(request), (long)length));
/*
@@ -219,7 +218,7 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
while (response == NULL)
{
- DEBUG_puts("cupsDoIORequest: setup...");
+ DEBUG_puts("2cupsDoIORequest: setup...");
/*
* Send the request...
@@ -227,11 +226,11 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
status = cupsSendRequest(http, request, resource, length);
- DEBUG_printf(("cupsDoIORequest: status=%d\n", status));
+ DEBUG_printf(("2cupsDoIORequest: status=%d", status));
if (status == HTTP_CONTINUE && request->state == IPP_DATA && infile >= 0)
{
- DEBUG_puts("cupsDoIORequest: file write...");
+ DEBUG_puts("2cupsDoIORequest: file write...");
/*
* Send the file with the request...
@@ -318,10 +317,10 @@ cupsDoRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
ipp_t *request, /* I - IPP request */
const char *resource) /* I - HTTP resource for POST */
{
- DEBUG_printf(("cupsDoRequest(http=%p, request=%p(%s), resource=\"%s\")\n",
+ DEBUG_printf(("cupsDoRequest(http=%p, request=%p(%s), resource=\"%s\")",
http, request,
request ? ippOpString(request->request.op.operation_id) : "?",
- resource ? resource : "(null)"));
+ resource));
return (cupsDoIORequest(http, request, resource, -1, -1));
}
@@ -346,8 +345,7 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
ipp_t *response = NULL; /* IPP response */
- DEBUG_printf(("cupsGetReponse(http=%p, resource=\"%s\")\n", http,
- resource ? resource : "(null)"));
+ DEBUG_printf(("cupsGetResponse(http=%p, resource=\"%s\")", http, resource));
/*
* Connect to the default server as needed...
@@ -369,7 +367,7 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
* Send a 0-length chunk to finish off the request...
*/
- DEBUG_puts("cupsGetResponse: Finishing chunked POST...");
+ DEBUG_puts("2cupsGetResponse: Finishing chunked POST...");
if (httpWrite2(http, "", 0) < 0)
return (NULL);
@@ -379,14 +377,14 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
* Wait for a response from the server...
*/
- DEBUG_printf(("cupsGetResponse: Update loop, http->status=%d...\n",
+ DEBUG_printf(("2cupsGetResponse: Update loop, http->status=%d...",
http->status));
status = http->status;
while (status == HTTP_CONTINUE)
status = httpUpdate(http);
- DEBUG_printf(("cupsGetResponse: status=%d\n", status));
+ DEBUG_printf(("2cupsGetResponse: status=%d", status));
if (status == HTTP_OK)
{
@@ -406,7 +404,7 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
* Delete the response...
*/
- DEBUG_puts("cupsGetResponse: IPP read error!");
+ DEBUG_puts("1cupsGetResponse: IPP read error!");
ippDelete(response);
response = NULL;
@@ -432,14 +430,10 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
* See if we can do authentication...
*/
- int auth_result;
+ DEBUG_puts("2cupsGetResponse: Need authorization...");
- DEBUG_puts("cupsGetResponse: Need authorization...");
-
- if ((auth_result = cupsDoAuthentication(http, "POST", resource)) == 0)
+ if (!cupsDoAuthentication(http, "POST", resource))
httpReconnect(http);
- else if (auth_result < 0)
- http->status = status = HTTP_FORBIDDEN;
}
#ifdef HAVE_SSL
@@ -449,7 +443,7 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
* Force a reconnect with encryption...
*/
- DEBUG_puts("cupsGetResponse: Need encryption...");
+ DEBUG_puts("2cupsGetResponse: Need encryption...");
if (!httpReconnect(http))
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
@@ -464,7 +458,7 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
attr = ippFindAttribute(response, "status-message", IPP_TAG_TEXT);
- DEBUG_printf(("cupsGetResponse: status-code=%s, status-message=\"%s\"\n",
+ DEBUG_printf(("1cupsGetResponse: status-code=%s, status-message=\"%s\"",
ippErrorString(response->request.status.status_code),
attr ? attr->values[0].string.text : ""));
@@ -499,7 +493,7 @@ cupsReadResponseData(
*/
DEBUG_printf(("cupsReadResponseData(http=%p, buffer=%p, "
- "length=" CUPS_LLFMT ")\n", http, buffer, CUPS_LLCAST length));
+ "length=" CUPS_LLFMT ")", http, buffer, CUPS_LLCAST length));
if (!http)
{
@@ -548,9 +542,9 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
DEBUG_printf(("cupsSendRequest(http=%p, request=%p(%s), resource=\"%s\", "
- "length=" CUPS_LLFMT ")\n", http, request,
+ "length=" CUPS_LLFMT ")", http, request,
request ? ippOpString(request->request.op.operation_id) : "?",
- resource ? resource : "(null)", CUPS_LLCAST length));
+ resource, CUPS_LLCAST length));
/*
* Range check input...
@@ -606,7 +600,7 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
for (;;)
{
- DEBUG_puts("cupsSendRequest: Setup...");
+ DEBUG_puts("2cupsSendRequest: Setup...");
/*
* Setup the HTTP variables needed...
@@ -618,13 +612,13 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
httpSetExpect(http, expect);
- DEBUG_printf(("cupsSendRequest: authstring=\"%s\"\n", http->authstring));
+ DEBUG_printf(("2cupsSendRequest: authstring=\"%s\"", http->authstring));
/*
* Try the request...
*/
- DEBUG_puts("cupsSendRequest: Sending HTTP POST...");
+ DEBUG_puts("2cupsSendRequest: Sending HTTP POST...");
if (httpPost(http, resource))
{
@@ -641,7 +635,7 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
* Send the IPP data...
*/
- DEBUG_puts("cupsSendRequest: Writing IPP request...");
+ DEBUG_puts("2cupsSendRequest: Writing IPP request...");
request->state = IPP_IDLE;
status = HTTP_CONTINUE;
@@ -664,7 +658,7 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
if (!got_status && expect == HTTP_CONTINUE)
{
- DEBUG_puts("cupsSendRequest: Waiting for 100-continue...");
+ DEBUG_puts("2cupsSendRequest: Waiting for 100-continue...");
if (httpWait(http, 1000))
status = httpUpdate(http);
@@ -672,7 +666,7 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
else if (httpCheck(http))
status = httpUpdate(http);
- DEBUG_printf(("cupsSendRequest: status=%d\n", status));
+ DEBUG_printf(("2cupsSendRequest: status=%d", status));
/*
* Process the current HTTP status...
@@ -761,7 +755,7 @@ cupsWriteRequestData(
*/
DEBUG_printf(("cupsWriteRequestData(http=%p, buffer=%p, "
- "length=" CUPS_LLFMT ")\n", http, buffer, CUPS_LLCAST length));
+ "length=" CUPS_LLFMT ")", http, buffer, CUPS_LLCAST length));
if (!http)
{
@@ -850,9 +844,8 @@ _cupsSetError(ipp_status_t status, /* I - IPP status code */
cg->last_status_message = _cupsStrAlloc(message);
}
- DEBUG_printf(("_cupsSetError: last_error=%s, last_status_message=\"%s\"\n",
- ippErrorString(cg->last_error),
- cg->last_status_message ? cg->last_status_message : ""));
+ DEBUG_printf(("4_cupsSetError: last_error=%s, last_status_message=\"%s\"",
+ ippErrorString(cg->last_error), cg->last_status_message));
}
@@ -894,8 +887,8 @@ _cupsSetHTTPError(http_status_t status) /* I - HTTP status code */
break;
default :
- DEBUG_printf(("HTTP error %d mapped to IPP_SERVICE_UNAVAILABLE!\n",
- status));
+ DEBUG_printf(("4_cupsSetHTTPError: HTTP error %d mapped to "
+ "IPP_SERVICE_UNAVAILABLE!", status));
_cupsSetError(IPP_SERVICE_UNAVAILABLE, httpStatus(status), 0);
break;
}
diff --git a/cups/sidechannel.c b/cups/sidechannel.c
index a59f5c305..41db25e67 100644
--- a/cups/sidechannel.c
+++ b/cups/sidechannel.c
@@ -121,7 +121,7 @@ cupsSideChannelRead(
DEBUG_printf(("cupsSideChannelRead(command=%p, status=%p, data=%p, "
- "datalen=%p(%d), timeout=%.3f)\n", command, status, data,
+ "datalen=%p(%d), timeout=%.3f)", command, status, data,
datalen, datalen ? *datalen : -1, timeout));
/*
@@ -155,7 +155,7 @@ cupsSideChannelRead(
{
if (select(CUPS_SC_FD + 1, &input_set, NULL, NULL, NULL) < 1)
{
- DEBUG_printf(("cupsSideChannelRead: Select error: %s\n", strerror(errno)));
+ DEBUG_printf(("1cupsSideChannelRead: Select error: %s", strerror(errno)));
return (-1);
}
}
@@ -166,7 +166,7 @@ cupsSideChannelRead(
if (select(CUPS_SC_FD + 1, &input_set, NULL, NULL, &stimeout) < 1)
{
- DEBUG_puts("cupsSideChannelRead: Select timeout");
+ DEBUG_puts("1cupsSideChannelRead: Select timeout");
return (-1);
}
}
@@ -186,7 +186,7 @@ cupsSideChannelRead(
while ((bytes = read(CUPS_SC_FD, buffer, sizeof(buffer))) < 0)
if (errno != EINTR && errno != EAGAIN)
{
- DEBUG_printf(("cupsSideChannelRead: Read error: %s\n", strerror(errno)));
+ DEBUG_printf(("1cupsSideChannelRead: Read error: %s", strerror(errno)));
return (-1);
}
@@ -197,7 +197,7 @@ cupsSideChannelRead(
if (buffer[0] < CUPS_SC_CMD_SOFT_RESET ||
buffer[0] > CUPS_SC_CMD_SNMP_GET_NEXT)
{
- DEBUG_printf(("cupsSideChannelRead: Bad command %d!\n", buffer[0]));
+ DEBUG_printf(("1cupsSideChannelRead: Bad command %d!", buffer[0]));
return (-1);
}
@@ -240,7 +240,7 @@ cupsSideChannelRead(
memcpy(data, buffer + 4, templen);
}
- DEBUG_printf(("cupsSideChannelRead: Returning status=%d\n", *status));
+ DEBUG_printf(("1cupsSideChannelRead: Returning status=%d", *status));
return (0);
}
@@ -284,7 +284,7 @@ cupsSideChannelSNMPGet(
DEBUG_printf(("cupsSideChannelSNMPGet(oid=\"%s\", data=%p, datalen=%p(%d), "
- "timeout=%.3f)\n", oid, data, datalen, datalen ? *datalen : -1,
+ "timeout=%.3f)", oid, data, datalen, datalen ? *datalen : -1,
timeout));
/*
@@ -378,7 +378,7 @@ cupsSideChannelSNMPWalk(
DEBUG_printf(("cupsSideChannelSNMPWalk(oid=\"%s\", timeout=%.3f, cb=%p, "
- "context=%p)\n", oid, timeout, cb, context));
+ "context=%p)", oid, timeout, cb, context));
/*
* Range check input...
diff --git a/cups/snmp.c b/cups/snmp.c
index 847f7c0d8..43722ba7d 100644
--- a/cups/snmp.c
+++ b/cups/snmp.c
@@ -116,7 +116,7 @@ static void snmp_set_error(cups_snmp_t *packet,
void
_cupsSNMPClose(int fd) /* I - SNMP socket file descriptor */
{
- DEBUG_printf(("_cupsSNMPClose(fd=%d)\n", fd));
+ DEBUG_printf(("4_cupsSNMPClose(fd=%d)", fd));
#ifdef WIN32
closesocket(fd);
@@ -140,7 +140,7 @@ _cupsSNMPCopyOID(int *dst, /* I - Destination OID */
int i; /* Looping var */
- DEBUG_printf(("_cupsSNMPCopyOID(dst=%p, src=%p, dstsize=%d)\n", dst, src,
+ DEBUG_printf(("4_cupsSNMPCopyOID(dst=%p, src=%p, dstsize=%d)", dst, src,
dstsize));
for (i = 0, dstsize --; src[i] >= 0 && i < dstsize; i ++)
@@ -169,7 +169,7 @@ _cupsSNMPDefaultCommunity(void)
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
- DEBUG_puts("_cupsSNMPDefaultCommunity()");
+ DEBUG_puts("4_cupsSNMPDefaultCommunity()");
if (!cg->snmp_community[0])
{
@@ -190,7 +190,7 @@ _cupsSNMPDefaultCommunity(void)
}
}
- DEBUG_printf(("_cupsSNMPDefaultCommunity: Returning \"%s\"\n",
+ DEBUG_printf(("5_cupsSNMPDefaultCommunity: Returning \"%s\"",
cg->snmp_community));
return (cg->snmp_community);
@@ -214,11 +214,11 @@ _cupsSNMPIsOID(cups_snmp_t *packet, /* I - Response packet */
* Range check input...
*/
- DEBUG_printf(("_cupsSNMPIsOID(packet=%p, oid=%p)\n", packet, oid));
+ DEBUG_printf(("4_cupsSNMPIsOID(packet=%p, oid=%p)", packet, oid));
if (!packet || !oid)
{
- DEBUG_puts("_cupsSNMPIsOID: Returning 0");
+ DEBUG_puts("5_cupsSNMPIsOID: Returning 0");
return (0);
}
@@ -232,12 +232,12 @@ _cupsSNMPIsOID(cups_snmp_t *packet, /* I - Response packet */
i ++)
if (oid[i] != packet->object_name[i])
{
- DEBUG_puts("_cupsSNMPIsOID: Returning 0");
+ DEBUG_puts("5_cupsSNMPIsOID: Returning 0");
return (0);
}
- DEBUG_printf(("_cupsSNMPIsOID: Returning %d\n",
+ DEBUG_printf(("5_cupsSNMPIsOID: Returning %d",
i < CUPS_SNMP_MAX_OID && oid[i] == packet->object_name[i]));
return (i < CUPS_SNMP_MAX_OID && oid[i] == packet->object_name[i]);
@@ -263,12 +263,12 @@ _cupsSNMPIsOIDPrefixed(
* Range check input...
*/
- DEBUG_printf(("_cupsSNMPIsOIDPrefixed(packet=%p, prefix=%p)\n", packet,
+ DEBUG_printf(("4_cupsSNMPIsOIDPrefixed(packet=%p, prefix=%p)", packet,
prefix));
if (!packet || !prefix)
{
- DEBUG_puts("_cupsSNMPIsOIDPrefixed: Returning 0");
+ DEBUG_puts("5_cupsSNMPIsOIDPrefixed: Returning 0");
return (0);
}
@@ -282,12 +282,12 @@ _cupsSNMPIsOIDPrefixed(
i ++)
if (prefix[i] != packet->object_name[i])
{
- DEBUG_puts("_cupsSNMPIsOIDPrefixed: Returning 0");
+ DEBUG_puts("5_cupsSNMPIsOIDPrefixed: Returning 0");
return (0);
}
- DEBUG_printf(("_cupsSNMPIsOIDPrefixed: Returning %d\n",
+ DEBUG_printf(("5_cupsSNMPIsOIDPrefixed: Returning %d",
i < CUPS_SNMP_MAX_OID));
return (i < CUPS_SNMP_MAX_OID);
@@ -308,7 +308,7 @@ _cupsSNMPOIDToString(const int *src, /* I - OID */
*dstend; /* End of string buffer */
- DEBUG_printf(("_cupsSNMPOIDToString(src=%p, dst=%p, dstsize=" CUPS_LLFMT ")\n",
+ DEBUG_printf(("4_cupsSNMPOIDToString(src=%p, dst=%p, dstsize=" CUPS_LLFMT ")",
src, dst, CUPS_LLCAST dstsize));
/*
@@ -349,11 +349,11 @@ _cupsSNMPOpen(int family) /* I - Address family - @code AF_INET@ or @code AF_IN
* Create the SNMP socket...
*/
- DEBUG_printf(("_cupsSNMPOpen(family=%d)\n", family));
+ DEBUG_printf(("4_cupsSNMPOpen(family=%d)", family));
if ((fd = socket(family, SOCK_DGRAM, 0)) < 0)
{
- DEBUG_printf(("_cupsSNMPOpen: Returning -1 (%s)\n", strerror(errno)));
+ DEBUG_printf(("5_cupsSNMPOpen: Returning -1 (%s)", strerror(errno)));
return (-1);
}
@@ -366,14 +366,14 @@ _cupsSNMPOpen(int family) /* I - Address family - @code AF_INET@ or @code AF_IN
if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &val, sizeof(val)))
{
- DEBUG_printf(("_cupsSNMPOpen: Returning -1 (%s)\n", strerror(errno)));
+ DEBUG_printf(("5_cupsSNMPOpen: Returning -1 (%s)", strerror(errno)));
close(fd);
return (-1);
}
- DEBUG_printf(("_cupsSNMPOpen: Returning %d\n", fd));
+ DEBUG_printf(("5_cupsSNMPOpen: Returning %d", fd));
return (fd);
}
@@ -402,12 +402,12 @@ _cupsSNMPRead(int fd, /* I - SNMP socket file descriptor */
* Range check input...
*/
- DEBUG_printf(("_cupsSNMPRead(fd=%d, packet=%p, timeout=%.1f)\n", fd, packet,
+ DEBUG_printf(("4_cupsSNMPRead(fd=%d, packet=%p, timeout=%.1f)", fd, packet,
timeout));
if (fd < 0 || !packet)
{
- DEBUG_puts("_cupsSNMPRead: Returning NULL");
+ DEBUG_puts("5_cupsSNMPRead: Returning NULL");
return (NULL);
}
@@ -426,7 +426,7 @@ _cupsSNMPRead(int fd, /* I - SNMP socket file descriptor */
pfd.events = POLLIN;
while ((ready = poll(&pfd, 1, (int)(timeout * 1000.0))) < 0 &&
- errno == EINTR);
+ (errno == EINTR || errno == EAGAIN));
#else
fd_set input_set; /* select() input set */
@@ -445,7 +445,7 @@ _cupsSNMPRead(int fd, /* I - SNMP socket file descriptor */
# ifdef WIN32
while (ready < 0 && WSAGetLastError() == WSAEINTR);
# else
- while (ready < 0 && errno == EINTR);
+ while (ready < 0 && (errno == EINTR || errno == EAGAIN));
# endif /* WIN32 */
#endif /* HAVE_POLL */
@@ -455,7 +455,7 @@ _cupsSNMPRead(int fd, /* I - SNMP socket file descriptor */
if (ready <= 0)
{
- DEBUG_puts("_cupsSNMPRead: Returning NULL (timeout)");
+ DEBUG_puts("5_cupsSNMPRead: Returning NULL (timeout)");
return (NULL);
}
@@ -470,7 +470,7 @@ _cupsSNMPRead(int fd, /* I - SNMP socket file descriptor */
if ((bytes = recvfrom(fd, buffer, sizeof(buffer), 0, (void *)&address,
&addrlen)) < 0)
{
- DEBUG_printf(("_cupsSNMPRead: Returning NULL (%s)\n", strerror(errno)));
+ DEBUG_printf(("5_cupsSNMPRead: Returning NULL (%s)", strerror(errno)));
return (NULL);
}
@@ -489,7 +489,7 @@ _cupsSNMPRead(int fd, /* I - SNMP socket file descriptor */
* Return decoded data packet...
*/
- DEBUG_puts("_cupsSNMPRead: Returning packet");
+ DEBUG_puts("5_cupsSNMPRead: Returning packet");
return (packet);
}
@@ -505,7 +505,7 @@ _cupsSNMPSetDebug(int level) /* I - 1 to enable debug output, 0 otherwise */
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
- DEBUG_printf(("_cupsSNMPSetDebug(level=%d)\n", level));
+ DEBUG_printf(("4_cupsSNMPSetDebug(level=%d)", level));
cg->snmp_debug = level;
}
@@ -530,7 +530,7 @@ _cupsSNMPStringToOID(const char *src, /* I - OID string */
*dstend; /* End of OID array */
- DEBUG_printf(("_cupsSNMPStringToOID(src=\"%s\", dst=%p, dstsize=%d)\n",
+ DEBUG_printf(("4_cupsSNMPStringToOID(src=\"%s\", dst=%p, dstsize=%d)",
src, dst, dstsize));
/*
@@ -610,15 +610,14 @@ _cupsSNMPWalk(int fd, /* I - SNMP socket */
* Range check input...
*/
- DEBUG_printf(("_cupsSNMPWalk(fd=%d, address=%p, version=%d, "
- "community=\"%s\", prefix=%p, timeout=%.1f, cb=%p, data=%p)\n",
- fd, address, version, community ? community : "(null)",
- prefix, timeout, cb, data));
+ DEBUG_printf(("4_cupsSNMPWalk(fd=%d, address=%p, version=%d, "
+ "community=\"%s\", prefix=%p, timeout=%.1f, cb=%p, data=%p)",
+ fd, address, version, community, prefix, timeout, cb, data));
if (fd < 0 || !address || version != CUPS_SNMP_VERSION_1 || !community ||
!prefix || !cb)
{
- DEBUG_puts("_cupsSNMPWalk: Returning -1");
+ DEBUG_puts("5_cupsSNMPWalk: Returning -1");
return (-1);
}
@@ -637,28 +636,28 @@ _cupsSNMPWalk(int fd, /* I - SNMP socket */
CUPS_ASN1_GET_NEXT_REQUEST, request_id,
packet.object_name))
{
- DEBUG_puts("_cupsSNMPWalk: Returning -1");
+ DEBUG_puts("5_cupsSNMPWalk: Returning -1");
return (-1);
}
if (!_cupsSNMPRead(fd, &packet, timeout))
{
- DEBUG_puts("_cupsSNMPWalk: Returning -1");
+ DEBUG_puts("5_cupsSNMPWalk: Returning -1");
return (-1);
}
if (!_cupsSNMPIsOIDPrefixed(&packet, prefix))
{
- DEBUG_printf(("_cupsSNMPWalk: Returning %d\n", count));
+ DEBUG_printf(("5_cupsSNMPWalk: Returning %d", count));
return (count);
}
if (packet.error || packet.error_status)
{
- DEBUG_printf(("_cupsSNMPWalk: Returning %d\n", count > 0 ? count : -1));
+ DEBUG_printf(("5_cupsSNMPWalk: Returning %d", count > 0 ? count : -1));
return (count > 0 ? count : -1);
}
@@ -698,16 +697,15 @@ _cupsSNMPWrite(
* Range check input...
*/
- DEBUG_printf(("_cupsSNMPWrite(fd=%d, address=%p, version=%d, "
- "community=\"%s\", request_type=%d, request_id=%u, oid=%p)\n",
- fd, address, version, community ? community : "(null)",
- request_type, request_id, oid));
+ DEBUG_printf(("4_cupsSNMPWrite(fd=%d, address=%p, version=%d, "
+ "community=\"%s\", request_type=%d, request_id=%u, oid=%p)",
+ fd, address, version, community, request_type, request_id, oid));
if (fd < 0 || !address || version != CUPS_SNMP_VERSION_1 || !community ||
(request_type != CUPS_ASN1_GET_REQUEST &&
request_type != CUPS_ASN1_GET_NEXT_REQUEST) || request_id < 1 || !oid)
{
- DEBUG_puts("_cupsSNMPWrite: Returning 0 (bad arguments)");
+ DEBUG_puts("5_cupsSNMPWrite: Returning 0 (bad arguments)");
return (0);
}
@@ -731,7 +729,7 @@ _cupsSNMPWrite(
if (oid[i] >= 0)
{
- DEBUG_puts("_cupsSNMPWrite: Returning 0 (OID too big)");
+ DEBUG_puts("5_cupsSNMPWrite: Returning 0 (OID too big)");
errno = E2BIG;
return (0);
@@ -741,7 +739,7 @@ _cupsSNMPWrite(
if (bytes < 0)
{
- DEBUG_puts("_cupsSNMPWrite: Returning 0 (request too big)");
+ DEBUG_puts("5_cupsSNMPWrite: Returning 0 (request too big)");
errno = E2BIG;
return (0);
diff --git a/cups/string.c b/cups/string.c
index 9b185f9cb..2d93eb8f3 100644
--- a/cups/string.c
+++ b/cups/string.c
@@ -119,8 +119,8 @@ _cupsStrAlloc(const char *s) /* I - String */
item->ref_count ++;
#ifdef DEBUG_GUARDS
- DEBUG_printf(("_cupsStrAlloc: Using string %p(%s) for \"%s\", guard=%08x, "
- "ref_count=%d\n", item, item->str, s, item->guard,
+ DEBUG_printf(("5_cupsStrAlloc: Using string %p(%s) for \"%s\", guard=%08x, "
+ "ref_count=%d", item, item->str, s, item->guard,
item->ref_count));
if (item->guard != _CUPS_STR_GUARD)
@@ -154,8 +154,8 @@ _cupsStrAlloc(const char *s) /* I - String */
#ifdef DEBUG_GUARDS
item->guard = _CUPS_STR_GUARD;
- DEBUG_printf(("_cupsStrAlloc: Created string %p(%s) for \"%s\", guard=%08x, "
- "ref_count=%d\n", item, item->str, s, item->guard,
+ DEBUG_printf(("5_cupsStrAlloc: Created string %p(%s) for \"%s\", guard=%08x, "
+ "ref_count=%d", item, item->str, s, item->guard,
item->ref_count));
#endif /* DEBUG_GUARDS */
@@ -183,7 +183,7 @@ _cupsStrFlush(void)
_cups_sp_item_t *item; /* Current item */
- DEBUG_printf(("_cupsStrFlush: %d strings in array\n",
+ DEBUG_printf(("4_cupsStrFlush: %d strings in array",
cupsArrayCount(stringpool)));
#ifdef HAVE_PTHREAD_H
@@ -326,8 +326,8 @@ _cupsStrFree(const char *s) /* I - String to free */
#ifdef DEBUG_GUARDS
if (key->guard != _CUPS_STR_GUARD)
{
- DEBUG_printf(("_cupsStrFree: Freeing string %p(%s), guard=%08x, "
- "ref_count=%d\n", key, key->str, key->guard, key->ref_count));
+ DEBUG_printf(("5_cupsStrFree: Freeing string %p(%s), guard=%08x, "
+ "ref_count=%d", key, key->str, key->guard, key->ref_count));
abort();
}
#endif /* DEBUG_GUARDS */
@@ -368,7 +368,7 @@ _cupsStrFree(const char *s) /* I - String to free */
*/
char * /* O - Pointer to string */
-_cupsStrRetain(char *s) /* I - String to retain */
+_cupsStrRetain(const char *s) /* I - String to retain */
{
_cups_sp_item_t *item; /* Pointer to string pool item */
@@ -380,8 +380,8 @@ _cupsStrRetain(char *s) /* I - String to retain */
#ifdef DEBUG_GUARDS
if (item->guard != _CUPS_STR_GUARD)
{
- DEBUG_printf(("_cupsStrRetain: Retaining string %p(%s), guard=%08x, "
- "ref_count=%d\n", item, s, item->guard, item->ref_count));
+ DEBUG_printf(("5_cupsStrRetain: Retaining string %p(%s), guard=%08x, "
+ "ref_count=%d", item, s, item->guard, item->ref_count));
abort();
}
#endif /* DEBUG_GUARDS */
@@ -397,7 +397,7 @@ _cupsStrRetain(char *s) /* I - String to retain */
#endif /* HAVE_PTHREAD_H */
}
- return (s);
+ return ((char *)s);
}
diff --git a/cups/string.h b/cups/string.h
index 99e3d5855..ac236a2b9 100644
--- a/cups/string.h
+++ b/cups/string.h
@@ -130,7 +130,7 @@ extern int _cups_vsnprintf(char *, size_t, const char *, va_list);
extern char *_cupsStrAlloc(const char *s);
extern void _cupsStrFlush(void);
extern void _cupsStrFree(const char *s);
-extern char *_cupsStrRetain(char *s);
+extern char *_cupsStrRetain(const char *s);
extern size_t _cupsStrStatistics(size_t *alloc_bytes, size_t *total_bytes);
diff --git a/cups/testarray.c b/cups/testarray.c
index 064ec892f..52aedff50 100644
--- a/cups/testarray.c
+++ b/cups/testarray.c
@@ -3,7 +3,7 @@
*
* Array test program for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -114,14 +114,6 @@ main(int argc, /* I - Number of command-line arguments */
}
else
{
-#ifdef DEBUG
- putchar('\n');
- for (text = (char *)cupsArrayFirst(array), i = 0;
- text;
- text = (char *)cupsArrayNext(array), i ++)
- printf(" #1 array[%d]=\"%s\"\n", i, text);
-#endif /* DEBUG */
-
if (!cupsArrayAdd(array, strdup("Two Fish")))
{
puts("FAIL (\"Two Fish\")");
@@ -129,13 +121,6 @@ main(int argc, /* I - Number of command-line arguments */
}
else
{
-#ifdef DEBUG
- for (text = (char *)cupsArrayFirst(array), i = 0;
- text;
- text = (char *)cupsArrayNext(array), i ++)
- printf(" #2 array[%d]=\"%s\"\n", i, text);
-#endif /* DEBUG */
-
if (!cupsArrayAdd(array, strdup("Red Fish")))
{
puts("FAIL (\"Red Fish\")");
@@ -143,29 +128,13 @@ main(int argc, /* I - Number of command-line arguments */
}
else
{
-#ifdef DEBUG
- for (text = (char *)cupsArrayFirst(array), i = 0;
- text;
- text = (char *)cupsArrayNext(array), i ++)
- printf(" #3 array[%d]=\"%s\"\n", i, text);
-#endif /* DEBUG */
-
if (!cupsArrayAdd(array, strdup("Blue Fish")))
{
puts("FAIL (\"Blue Fish\")");
status ++;
}
else
- {
-#ifdef DEBUG
- for (text = (char *)cupsArrayFirst(array), i = 0;
- text;
- text = (char *)cupsArrayNext(array), i ++)
- printf(" #4 array[%d]=\"%s\"\n", i, text);
-#endif /* DEBUG */
-
puts("PASS");
- }
}
}
}
@@ -491,8 +460,6 @@ load_words(const char *filename, /* I - File to load */
char word[256]; /* Word from file */
- DEBUG_printf((" Loading \"%s\"...\n", filename));
-
if ((fp = fopen(filename, "r")) == NULL)
{
perror(filename);
@@ -502,11 +469,7 @@ load_words(const char *filename, /* I - File to load */
while (fscanf(fp, "%255s", word) == 1)
{
if (!cupsArrayFind(array, word))
- {
- DEBUG_printf((" Adding \"%s\"...\n", word));
-
cupsArrayAdd(array, strdup(word));
- }
}
fclose(fp);
diff --git a/cups/transcode.c b/cups/transcode.c
index c04f0a71d..afeb2de4a 100644
--- a/cups/transcode.c
+++ b/cups/transcode.c
@@ -3,7 +3,7 @@
*
* Transcoding support for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -210,7 +210,7 @@ _cupsCharmapGet(
void *charmap; /* Charset map pointer */
- DEBUG_printf(("_cupsCharmapGet(encoding=%d)\n", encoding));
+ DEBUG_printf(("7_cupsCharmapGet(encoding=%d)", encoding));
/*
* Check for valid arguments...
@@ -218,7 +218,7 @@ _cupsCharmapGet(
if (encoding < 0 || encoding >= CUPS_ENCODING_VBCS_END)
{
- DEBUG_puts(" Bad encoding, returning NULL!");
+ DEBUG_puts("8_cupsCharmapGet: Bad encoding, returning NULL!");
return (NULL);
}
@@ -263,7 +263,7 @@ cupsCharsetToUTF8(
* Check for valid arguments...
*/
- DEBUG_printf(("cupsCharsetToUTF8(dest=%p, src=\"%s\", maxout=%d, encoding=%d)\n",
+ DEBUG_printf(("cupsCharsetToUTF8(dest=%p, src=\"%s\", maxout=%d, encoding=%d)",
dest, src, maxout, encoding));
if (dest)
@@ -271,7 +271,7 @@ cupsCharsetToUTF8(
if (!dest || !src || maxout < 1 || maxout > CUPS_MAX_USTRING)
{
- DEBUG_puts(" Bad arguments, returning -1");
+ DEBUG_puts("1cupsCharsetToUTF8: Bad arguments, returning -1");
return (-1);
}
@@ -473,15 +473,15 @@ cupsUTF8ToUTF32(
* Check for valid arguments and clear output...
*/
- DEBUG_printf(("cupsUTF8ToUTF32(dest=%p, src=\"%s\", maxout=%d)\n", dest,
- src ? (const char *)src : "(null)", maxout));
+ DEBUG_printf(("2cupsUTF8ToUTF32(dest=%p, src=\"%s\", maxout=%d)", dest,
+ src, maxout));
if (dest)
*dest = 0;
if (!dest || !src || maxout < 1 || maxout > CUPS_MAX_USTRING)
{
- DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad arguments)");
+ DEBUG_puts("3cupsUTF8ToUTF32: Returning -1 (bad arguments)");
return (-1);
}
@@ -506,7 +506,7 @@ cupsUTF8ToUTF32(
*dest++ = ch;
- DEBUG_printf(("cupsUTF8ToUTF32: %02x => %08X\n", src[-1], ch));
+ DEBUG_printf(("4cupsUTF8ToUTF32: %02x => %08X", src[-1], ch));
continue;
}
else if ((ch & 0xe0) == 0xc0)
@@ -518,7 +518,7 @@ cupsUTF8ToUTF32(
next = *src++;
if ((next & 0xc0) != 0x80)
{
- DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+ DEBUG_puts("3cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
return (-1);
}
@@ -531,14 +531,14 @@ cupsUTF8ToUTF32(
if (ch32 < 0x80)
{
- DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+ DEBUG_puts("3cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
return (-1);
}
*dest++ = ch32;
- DEBUG_printf(("cupsUTF8ToUTF32: %02x %02x => %08X\n",
+ DEBUG_printf(("4cupsUTF8ToUTF32: %02x %02x => %08X",
src[-2], src[-1], (unsigned)ch32));
}
else if ((ch & 0xf0) == 0xe0)
@@ -550,7 +550,7 @@ cupsUTF8ToUTF32(
next = *src++;
if ((next & 0xc0) != 0x80)
{
- DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+ DEBUG_puts("3cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
return (-1);
}
@@ -560,7 +560,7 @@ cupsUTF8ToUTF32(
next = *src++;
if ((next & 0xc0) != 0x80)
{
- DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+ DEBUG_puts("3cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
return (-1);
}
@@ -573,14 +573,14 @@ cupsUTF8ToUTF32(
if (ch32 < 0x800)
{
- DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+ DEBUG_puts("3cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
return (-1);
}
*dest++ = ch32;
- DEBUG_printf(("cupsUTF8ToUTF32: %02x %02x %02x => %08X\n",
+ DEBUG_printf(("4cupsUTF8ToUTF32: %02x %02x %02x => %08X",
src[-3], src[-2], src[-1], (unsigned)ch32));
}
else if ((ch & 0xf8) == 0xf0)
@@ -592,7 +592,7 @@ cupsUTF8ToUTF32(
next = *src++;
if ((next & 0xc0) != 0x80)
{
- DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+ DEBUG_puts("3cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
return (-1);
}
@@ -602,7 +602,7 @@ cupsUTF8ToUTF32(
next = *src++;
if ((next & 0xc0) != 0x80)
{
- DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+ DEBUG_puts("3cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
return (-1);
}
@@ -612,7 +612,7 @@ cupsUTF8ToUTF32(
next = *src++;
if ((next & 0xc0) != 0x80)
{
- DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+ DEBUG_puts("3cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
return (-1);
}
@@ -625,14 +625,14 @@ cupsUTF8ToUTF32(
if (ch32 < 0x10000)
{
- DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+ DEBUG_puts("3cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
return (-1);
}
*dest++ = ch32;
- DEBUG_printf(("cupsUTF8ToUTF32: %02x %02x %02x %02x => %08X\n",
+ DEBUG_printf(("4cupsUTF8ToUTF32: %02x %02x %02x %02x => %08X",
src[-4], src[-3], src[-2], src[-1], (unsigned)ch32));
}
else
@@ -641,7 +641,7 @@ cupsUTF8ToUTF32(
* More than 4-octet (invalid UTF-8 sequence)...
*/
- DEBUG_puts("cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
+ DEBUG_puts("3cupsUTF8ToUTF32: Returning -1 (bad UTF-8 sequence)");
return (-1);
}
@@ -656,7 +656,7 @@ cupsUTF8ToUTF32(
*dest = 0;
- DEBUG_printf(("cupsUTF8ToUTF32: Returning %d characters\n", maxout - 1 - i));
+ DEBUG_printf(("3cupsUTF8ToUTF32: Returning %d characters", maxout - 1 - i));
return (maxout - 1 - i);
}
@@ -694,7 +694,7 @@ cupsUTF32ToUTF8(
* Check for valid arguments and clear output...
*/
- DEBUG_printf(("cupsUTF32ToUTF8(dest=%p, src=%p, maxout=%d)\n", dest, src,
+ DEBUG_printf(("2cupsUTF32ToUTF8(dest=%p, src=%p, maxout=%d)", dest, src,
maxout));
if (dest)
@@ -702,7 +702,7 @@ cupsUTF32ToUTF8(
if (!dest || !src || maxout < 1)
{
- DEBUG_puts("cupsUTF32ToUTF8: Returning -1 (bad args)");
+ DEBUG_puts("3cupsUTF32ToUTF8: Returning -1 (bad args)");
return (-1);
}
@@ -714,7 +714,7 @@ cupsUTF32ToUTF8(
start = dest;
swap = *src == 0xfffe0000;
- DEBUG_printf(("cupsUTF32ToUTF8: swap=%d\n", swap));
+ DEBUG_printf(("4cupsUTF32ToUTF8: swap=%d", swap));
if (*src == 0xfffe0000 || *src == 0xfeff)
src ++;
@@ -741,7 +741,7 @@ cupsUTF32ToUTF8(
if (ch > 0x10ffff)
{
- DEBUG_puts("cupsUTF32ToUTF8: Returning -1 (character out of range)");
+ DEBUG_puts("3cupsUTF32ToUTF8: Returning -1 (character out of range)");
return (-1);
}
@@ -759,7 +759,7 @@ cupsUTF32ToUTF8(
*dest++ = (cups_utf8_t)ch;
i --;
- DEBUG_printf(("cupsUTF32ToUTF8: %08x => %02x\n", (unsigned)ch, dest[-1]));
+ DEBUG_printf(("4cupsUTF32ToUTF8: %08x => %02x", (unsigned)ch, dest[-1]));
}
else if (ch < 0x800)
{
@@ -769,7 +769,7 @@ cupsUTF32ToUTF8(
if (i < 2)
{
- DEBUG_puts("cupsUTF32ToUTF8: Returning -1 (too long 2)");
+ DEBUG_puts("3cupsUTF32ToUTF8: Returning -1 (too long 2)");
return (-1);
}
@@ -778,7 +778,7 @@ cupsUTF32ToUTF8(
*dest++ = (cups_utf8_t)(0x80 | (ch & 0x3f));
i -= 2;
- DEBUG_printf(("cupsUTF32ToUTF8: %08x => %02x %02x\n", (unsigned)ch,
+ DEBUG_printf(("4cupsUTF32ToUTF8: %08x => %02x %02x", (unsigned)ch,
dest[-2], dest[-1]));
}
else if (ch < 0x10000)
@@ -789,7 +789,7 @@ cupsUTF32ToUTF8(
if (i < 3)
{
- DEBUG_puts("cupsUTF32ToUTF8: Returning -1 (too long 3)");
+ DEBUG_puts("3cupsUTF32ToUTF8: Returning -1 (too long 3)");
return (-1);
}
@@ -799,7 +799,7 @@ cupsUTF32ToUTF8(
*dest++ = (cups_utf8_t)(0x80 | (ch & 0x3f));
i -= 3;
- DEBUG_printf(("cupsUTF32ToUTF8: %08x => %02x %02x %02x\n", (unsigned)ch,
+ DEBUG_printf(("4cupsUTF32ToUTF8: %08x => %02x %02x %02x", (unsigned)ch,
dest[-3], dest[-2], dest[-1]));
}
else
@@ -809,7 +809,11 @@ cupsUTF32ToUTF8(
*/
if (i < 4)
+ {
+ DEBUG_puts("3cupsUTF32ToUTF8: Returning -1 (too long 4)");
+
return (-1);
+ }
*dest++ = (cups_utf8_t)(0xf0 | ((ch >> 18) & 0x07));
*dest++ = (cups_utf8_t)(0x80 | ((ch >> 12) & 0x3f));
@@ -817,14 +821,14 @@ cupsUTF32ToUTF8(
*dest++ = (cups_utf8_t)(0x80 | (ch & 0x3f));
i -= 4;
- DEBUG_printf(("cupsUTF32ToUTF8: %08x => %02x %02x %02x %02x\n",
+ DEBUG_printf(("4cupsUTF32ToUTF8: %08x => %02x %02x %02x %02x",
(unsigned)ch, dest[-4], dest[-3], dest[-2], dest[-1]));
}
}
*dest = '\0';
- DEBUG_printf(("cupsUTF32ToUTF8: Returning %d\n", (int)(dest - start)));
+ DEBUG_printf(("3cupsUTF32ToUTF8: Returning %d", (int)(dest - start)));
return ((int)(dest - start));
}
@@ -1012,8 +1016,8 @@ conv_utf8_to_vbcs(
*workptr; /* Pointer into string */
- DEBUG_printf(("conv_utf8_to_vbcs(dest=%p, src=\"%s\", maxout=%d, "
- "encoding=%d)\n", dest, src, maxout, encoding));
+ DEBUG_printf(("7conv_utf8_to_vbcs(dest=%p, src=\"%s\", maxout=%d, "
+ "encoding=%d)", dest, src, maxout, encoding));
/*
* Find legacy charset map in cache...
@@ -1021,7 +1025,7 @@ conv_utf8_to_vbcs(
if ((vmap = (_cups_vmap_t *)get_charmap(encoding)) == NULL)
{
- DEBUG_puts("conv_utf8_to_vbcs: Returning -1 (no charmap)");
+ DEBUG_puts("8conv_utf8_to_vbcs: Returning -1 (no charmap)");
return (-1);
}
@@ -1032,7 +1036,7 @@ conv_utf8_to_vbcs(
if (cupsUTF8ToUTF32(work, src, CUPS_MAX_USTRING) < 0)
{
- DEBUG_puts("conv_utf8_to_vbcs: Returning -1 (Unable to convert to UTF-32)");
+ DEBUG_puts("8conv_utf8_to_vbcs: Returning -1 (Unable to convert to UTF-32)");
return (-1);
}
@@ -1053,7 +1057,7 @@ conv_utf8_to_vbcs(
{
*dest++ = (cups_sbcs_t)unichar;
- DEBUG_printf(("conv_utf8_to_vbcs: %08x => %02X\n", (unsigned)unichar,
+ DEBUG_printf(("9conv_utf8_to_vbcs: %08x => %02X", (unsigned)unichar,
dest[-1]));
continue;
@@ -1081,7 +1085,7 @@ conv_utf8_to_vbcs(
{
if (maxout < 5)
{
- DEBUG_puts("conv_utf8_to_vbcs: Returning -1 (out of space)");
+ DEBUG_puts("8conv_utf8_to_vbcs: Returning -1 (out of space)");
return (-1);
}
@@ -1093,14 +1097,14 @@ conv_utf8_to_vbcs(
maxout -= 3;
- DEBUG_printf(("conv_utf8_to_vbcs: %08x => %02X %02X %02X %02X\n",
+ DEBUG_printf(("9conv_utf8_to_vbcs: %08x => %02X %02X %02X %02X",
(unsigned)unichar, dest[-4], dest[-3], dest[-2], dest[-1]));
}
else if (legchar > 0xffff)
{
if (maxout < 4)
{
- DEBUG_puts("conv_utf8_to_vbcs: Returning -1 (out of space)");
+ DEBUG_puts("8conv_utf8_to_vbcs: Returning -1 (out of space)");
return (-1);
}
@@ -1111,7 +1115,7 @@ conv_utf8_to_vbcs(
maxout -= 2;
- DEBUG_printf(("conv_utf8_to_vbcs: %08x => %02X %02X %02X\n",
+ DEBUG_printf(("9conv_utf8_to_vbcs: %08x => %02X %02X %02X",
(unsigned)unichar, dest[-3], dest[-2], dest[-1]));
}
else if (legchar > 0xff)
@@ -1121,14 +1125,14 @@ conv_utf8_to_vbcs(
maxout --;
- DEBUG_printf(("conv_utf8_to_vbcs: %08x => %02X %02X\n",
+ DEBUG_printf(("9conv_utf8_to_vbcs: %08x => %02X %02X",
(unsigned)unichar, dest[-2], dest[-1]));
}
else
{
*dest++ = legchar;
- DEBUG_printf(("conv_utf8_to_vbcs: %08x => %02X\n",
+ DEBUG_printf(("9conv_utf8_to_vbcs: %08x => %02X",
(unsigned)unichar, dest[-1]));
}
}
@@ -1137,7 +1141,7 @@ conv_utf8_to_vbcs(
vmap->used --;
- DEBUG_printf(("conv_utf8_to_vbcs: Returning %d characters\n",
+ DEBUG_printf(("8conv_utf8_to_vbcs: Returning %d characters",
(int)(dest - start)));
return ((int)(dest - start));
@@ -1168,12 +1172,12 @@ conv_vbcs_to_utf8(
* Find legacy charset map in cache...
*/
- DEBUG_printf(("conv_vbcs_to_utf8(dest=%p, src=%p, maxout=%d, encoding=%d)\n",
+ DEBUG_printf(("7conv_vbcs_to_utf8(dest=%p, src=%p, maxout=%d, encoding=%d)",
dest, src, maxout, encoding));
if ((vmap = (_cups_vmap_t *)get_charmap(encoding)) == NULL)
{
- DEBUG_puts("conv_vbcs_to_utf8: Returning -1 (NULL vmap)");
+ DEBUG_puts("8conv_vbcs_to_utf8: Returning -1 (NULL vmap)");
return (-1);
}
@@ -1196,7 +1200,7 @@ conv_vbcs_to_utf8(
{
*workptr++ = (cups_utf32_t)legchar;
- DEBUG_printf(("conv_vbcs_to_utf8: %02X => %08X\n", src[-1],
+ DEBUG_printf(("9conv_vbcs_to_utf8: %02X => %08X", src[-1],
(unsigned)legchar));
continue;
}
@@ -1209,7 +1213,7 @@ conv_vbcs_to_utf8(
{
if (!*src)
{
- DEBUG_puts("conv_vbcs_to_utf8: Returning -1 (short string)");
+ DEBUG_puts("8conv_vbcs_to_utf8: Returning -1 (short string)");
return (-1);
}
@@ -1229,7 +1233,7 @@ conv_vbcs_to_utf8(
else
*workptr++ = (cups_utf32_t)*crow;
- DEBUG_printf(("conv_vbcs_to_utf8: %02X %02X => %08X\n",
+ DEBUG_printf(("9conv_vbcs_to_utf8: %02X %02X => %08X",
src[-2], src[-1], (unsigned)workptr[-1]));
continue;
}
@@ -1242,7 +1246,7 @@ conv_vbcs_to_utf8(
{
if (!*src || !src[1])
{
- DEBUG_puts("conv_vbcs_to_utf8: Returning -1 (short string 2)");
+ DEBUG_puts("8conv_vbcs_to_utf8: Returning -1 (short string 2)");
return (-1);
}
@@ -1254,7 +1258,7 @@ conv_vbcs_to_utf8(
{
if (!*src || !src[1] || !src[2])
{
- DEBUG_puts("conv_vbcs_to_utf8: Returning -1 (short string 3)");
+ DEBUG_puts("8conv_vbcs_to_utf8: Returning -1 (short string 3)");
return (-1);
}
@@ -1265,7 +1269,7 @@ conv_vbcs_to_utf8(
}
else
{
- DEBUG_puts("conv_vbcs_to_utf8: Returning -1 (bad character)");
+ DEBUG_puts("8conv_vbcs_to_utf8: Returning -1 (bad character)");
return (-1);
}
@@ -1290,10 +1294,10 @@ conv_vbcs_to_utf8(
*workptr++ = wide2uni->unichar;
if (vmap->lead3char[(int)leadchar] == leadchar)
- DEBUG_printf(("conv_vbcs_to_utf8: %02X %02X %02X => %08X\n",
+ DEBUG_printf(("9conv_vbcs_to_utf8: %02X %02X %02X => %08X",
src[-3], src[-2], src[-1], (unsigned)workptr[-1]));
else
- DEBUG_printf(("conv_vbcs_to_utf8: %02X %02X %02X %02X => %08X\n",
+ DEBUG_printf(("9conv_vbcs_to_utf8: %02X %02X %02X %02X => %08X",
src[-4], src[-3], src[-2], src[-1], (unsigned)workptr[-1]));
}
@@ -1301,7 +1305,7 @@ conv_vbcs_to_utf8(
vmap->used --;
- DEBUG_printf(("conv_vbcs_to_utf8: Converting %d UTF-32 characters to UTF-8\n",
+ DEBUG_printf(("9conv_vbcs_to_utf8: Converting %d UTF-32 characters to UTF-8",
(int)(workptr - work)));
/*
@@ -1373,7 +1377,7 @@ get_charmap(
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
- DEBUG_printf(("get_charmap(encoding=%d)\n", encoding));
+ DEBUG_printf(("7get_charmap(encoding=%d)", encoding));
/*
* Get the data directory and charset map name...
@@ -1382,7 +1386,7 @@ get_charmap(
snprintf(filename, sizeof(filename), "%s/charmaps/%s.txt",
cg->cups_datadir, _cupsEncodingName(encoding));
- DEBUG_printf(("get_charmap: filename=\"%s\"\n", filename));
+ DEBUG_printf(("9get_charmap: filename=\"%s\"", filename));
/*
* Read charset map input file into cache...
@@ -1452,7 +1456,7 @@ get_sbcs_charmap(
* See if we already have this SBCS charset map loaded...
*/
- DEBUG_printf(("get_sbcs_charmap(encoding=%d, filename=\"%s\")\n", encoding,
+ DEBUG_printf(("7get_sbcs_charmap(encoding=%d, filename=\"%s\")", encoding,
filename));
for (cmap = cmap_cache; cmap; cmap = cmap->next)
@@ -1460,7 +1464,7 @@ get_sbcs_charmap(
if (cmap->encoding == encoding)
{
cmap->used ++;
- DEBUG_printf(("get_sbcs_charmap: Returning existing cmap=%p\n", cmap));
+ DEBUG_printf(("8get_sbcs_charmap: Returning existing cmap=%p", cmap));
return ((void *)cmap);
}
@@ -1472,7 +1476,7 @@ get_sbcs_charmap(
if ((fp = cupsFileOpen(filename, "r")) == NULL)
{
- DEBUG_printf(("get_sbcs_charmap: Returning NULL (%s)\n", strerror(errno)));
+ DEBUG_printf(("8get_sbcs_charmap: Returning NULL (%s)", strerror(errno)));
return (NULL);
}
@@ -1484,7 +1488,7 @@ get_sbcs_charmap(
if ((cmap = (_cups_cmap_t *)calloc(1, sizeof(_cups_cmap_t))) == NULL)
{
cupsFileClose(fp);
- DEBUG_puts("get_sbcs_charmap: Returning NULL (Unable to allocate memory)");
+ DEBUG_puts("8get_sbcs_charmap: Returning NULL (Unable to allocate memory)");
return (NULL);
}
@@ -1556,7 +1560,7 @@ get_sbcs_charmap(
cmap->next = cmap_cache;
cmap_cache = cmap;
- DEBUG_printf(("get_sbcs_charmap: Returning new cmap=%p\n", cmap));
+ DEBUG_printf(("8get_sbcs_charmap: Returning new cmap=%p", cmap));
return (cmap);
@@ -1570,7 +1574,7 @@ get_sbcs_charmap(
cupsFileClose(fp);
- DEBUG_puts("get_sbcs_charmap: Returning NULL (Read/format error)");
+ DEBUG_puts("8get_sbcs_charmap: Returning NULL (Read/format error)");
return (NULL);
}
@@ -1600,7 +1604,7 @@ get_vbcs_charmap(
int legacy; /* 32-bit legacy char */
- DEBUG_printf(("get_vbcs_charmap(encoding=%d, filename=\"%s\")\n",
+ DEBUG_printf(("7get_vbcs_charmap(encoding=%d, filename=\"%s\")\n",
encoding, filename));
/*
@@ -1612,7 +1616,7 @@ get_vbcs_charmap(
if (vmap->encoding == encoding)
{
vmap->used ++;
- DEBUG_printf(("get_vbcs_charmap: Returning existing vmap=%p\n", vmap));
+ DEBUG_printf(("8get_vbcs_charmap: Returning existing vmap=%p", vmap));
return ((void *)vmap);
}
@@ -1624,7 +1628,7 @@ get_vbcs_charmap(
if ((fp = cupsFileOpen(filename, "r")) == NULL)
{
- DEBUG_printf(("get_vbcs_charmap: Returning NULL (%s)\n", strerror(errno)));
+ DEBUG_printf(("8get_vbcs_charmap: Returning NULL (%s)", strerror(errno)));
return (NULL);
}
@@ -1635,14 +1639,14 @@ get_vbcs_charmap(
if ((mapcount = get_charmap_count(fp)) <= 0)
{
- DEBUG_puts("get_vbcs_charmap: Unable to get charmap count!");
+ DEBUG_puts("8get_vbcs_charmap: Unable to get charmap count!");
cupsFileClose(fp);
return (NULL);
}
- DEBUG_printf(("get_vbcs_charmap: mapcount=%d\n", mapcount));
+ DEBUG_printf(("8get_vbcs_charmap: mapcount=%d", mapcount));
/*
* Allocate memory for DBCS/VBCS charset map...
@@ -1650,7 +1654,7 @@ get_vbcs_charmap(
if ((vmap = (_cups_vmap_t *)calloc(1, sizeof(_cups_vmap_t))) == NULL)
{
- DEBUG_puts("get_vbcs_charmap: Unable to allocate memory!");
+ DEBUG_puts("8get_vbcs_charmap: Unable to allocate memory!");
cupsFileClose(fp);
@@ -1686,8 +1690,8 @@ get_vbcs_charmap(
i ++;
-/* DEBUG_printf((" i=%d, legchar=0x%08lx, unichar=0x%04x\n", i,
- legchar, (unsigned)unichar)); */
+ DEBUG_printf(("9get_vbcs_charmap: i=%d, legchar=0x%08lx, unichar=0x%04x", i,
+ legchar, (unsigned)unichar));
/*
* Save lead char of 2/3/4-byte legacy char...
@@ -1796,7 +1800,7 @@ get_vbcs_charmap(
vmap->next = vmap_cache;
vmap_cache = vmap;
- DEBUG_printf(("get_vbcs_charmap: Returning new vmap=%p\n", vmap));
+ DEBUG_printf(("8get_vbcs_charmap: Returning new vmap=%p", vmap));
return (vmap);
@@ -1810,7 +1814,7 @@ get_vbcs_charmap(
cupsFileClose(fp);
- DEBUG_puts("get_vbcs_charmap: Returning NULL (Read/format error)");
+ DEBUG_puts("8get_vbcs_charmap: Returning NULL (Read/format error)");
return (NULL);
}
diff --git a/cups/usersys.c b/cups/usersys.c
index 8e4be9559..1ec589da9 100644
--- a/cups/usersys.c
+++ b/cups/usersys.c
@@ -1,10 +1,10 @@
/*
- * "$Id: usersys.c 7337 2008-02-22 04:44:04Z mike $"
+ * "$Id: usersys.c 8498 2009-04-13 17:03:15Z mike $"
*
* User, system, and password routines for the Common UNIX Printing
* System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2009 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -19,14 +19,16 @@
*
* cupsEncryption() - Get the default encryption settings.
* cupsGetPassword() - Get a password from the user.
- * cupsServer() - Return the hostname of the default server.
+ * cupsServer() - Return the hostname/address of the default
+ * server.
* cupsSetEncryption() - Set the encryption preference.
* cupsSetPasswordCB() - Set the password callback for CUPS.
* cupsSetServer() - Set the default server name.
* cupsSetUser() - Set the default user name.
- * cupsUser() - Return the current users name.
+ * cupsUser() - Return the current user's name.
* _cupsGetPassword() - Get a password from the user.
- * cups_open_client_conf() - Open the client.conf file.
+ * _cupsSetDefaults() - Set the default server, port, and encryption.
+ * cups_read_client_conf() - Read a client.conf file.
*/
/*
@@ -47,7 +49,10 @@
* Local functions...
*/
-static cups_file_t *cups_open_client_conf(void);
+static void cups_read_client_conf(cups_file_t *fp,
+ _cups_globals_t *cg,
+ const char *cups_encryption,
+ const char *cups_server);
/*
@@ -62,69 +67,11 @@ static cups_file_t *cups_open_client_conf(void);
http_encryption_t /* O - Encryption settings */
cupsEncryption(void)
{
- cups_file_t *fp; /* client.conf file */
- char *encryption; /* CUPS_ENCRYPTION variable */
- char line[1024], /* Line from file */
- *value; /* Value on line */
- int linenum; /* Line number */
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
- /*
- * First see if we have already set the encryption stuff...
- */
-
if (cg->encryption == (http_encryption_t)-1)
- {
- /*
- * Then see if the CUPS_ENCRYPTION environment variable is set...
- */
-
- if ((encryption = getenv("CUPS_ENCRYPTION")) == NULL)
- {
- /*
- * No, open the client.conf file...
- */
-
- fp = cups_open_client_conf();
- encryption = "IfRequested";
-
- if (fp)
- {
- /*
- * Read the config file and look for an Encryption line...
- */
-
- linenum = 0;
-
- while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum) != NULL)
- if (!strcasecmp(line, "Encryption") && value)
- {
- /*
- * Got it!
- */
-
- encryption = value;
- break;
- }
-
- cupsFileClose(fp);
- }
- }
-
- /*
- * Set the encryption preference...
- */
-
- if (!strcasecmp(encryption, "never"))
- cg->encryption = HTTP_ENCRYPT_NEVER;
- else if (!strcasecmp(encryption, "always"))
- cg->encryption = HTTP_ENCRYPT_ALWAYS;
- else if (!strcasecmp(encryption, "required"))
- cg->encryption = HTTP_ENCRYPT_REQUIRED;
- else
- cg->encryption = HTTP_ENCRYPT_IF_REQUESTED;
- }
+ _cupsSetDefaults();
return (cg->encryption);
}
@@ -145,23 +92,6 @@ cupsGetPassword(const char *prompt) /* I - Prompt string */
/*
- * 'cupsSetEncryption()' - Set the encryption preference.
- */
-
-void
-cupsSetEncryption(http_encryption_t e) /* I - New encryption preference */
-{
- _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
-
-
- cg->encryption = e;
-
- if (cg->http)
- httpEncryption(cg->http, e);
-}
-
-
-/*
* 'cupsServer()' - Return the hostname/address of the default server.
*
* The returned value can be a fully-qualified hostname, a numeric
@@ -171,101 +101,30 @@ cupsSetEncryption(http_encryption_t e) /* I - New encryption preference */
const char * /* O - Server name */
cupsServer(void)
{
- cups_file_t *fp; /* client.conf file */
- char *server; /* Pointer to server name */
- char *port; /* Port number */
- char line[1024], /* Line from file */
- *value; /* Value on line */
- int linenum; /* Line number in file */
-#ifdef CUPS_DEFAULT_DOMAINSOCKET
- struct stat sockinfo; /* Domain socket information */
-#endif /* CUPS_DEFAULT_DOMAINSOCKET */
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
- /*
- * First see if we have already set the server name...
- */
-
if (!cg->server[0])
- {
- /*
- * Then see if the CUPS_SERVER environment variable is set...
- */
+ _cupsSetDefaults();
- if ((server = getenv("CUPS_SERVER")) == NULL)
- {
- /*
- * No environment variable, try the client.conf file...
- */
-
- fp = cups_open_client_conf();
-
-#ifdef CUPS_DEFAULT_DOMAINSOCKET
- /*
- * If we are compiled with domain socket support, only use the
- * domain socket if it exists and has the right permissions...
- */
-
- if (!stat(CUPS_DEFAULT_DOMAINSOCKET, &sockinfo) &&
- (sockinfo.st_mode & S_IRWXO) == S_IRWXO)
- server = CUPS_DEFAULT_DOMAINSOCKET;
- else
-#endif /* CUPS_DEFAULT_DOMAINSOCKET */
- server = "localhost";
-
- if (fp)
- {
- /*
- * Read the config file and look for a ServerName line...
- */
-
- linenum = 0;
- while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum) != NULL)
- {
- DEBUG_printf(("cupsServer: %d: %s %s\n", linenum, line,
- value ? value : "(null)"));
-
- if (!strcasecmp(line, "ServerName") && value)
- {
- /*
- * Got it!
- */
-
- DEBUG_puts("cupsServer: Got a ServerName line!");
- server = value;
- break;
- }
- }
-
- cupsFileClose(fp);
- }
- }
-
- /*
- * Copy the server name over and set the port number, if any...
- */
+ return (cg->server);
+}
- DEBUG_printf(("cupsServer: Using server \"%s\"...\n", server));
- strlcpy(cg->server, server, sizeof(cg->server));
+/*
+ * 'cupsSetEncryption()' - Set the encryption preference.
+ */
- if (cg->server[0] != '/' && (port = strrchr(cg->server, ':')) != NULL &&
- !strchr(port, ']') && isdigit(port[1] & 255))
- {
- *port++ = '\0';
+void
+cupsSetEncryption(http_encryption_t e) /* I - New encryption preference */
+{
+ _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
- DEBUG_printf(("cupsServer: Using port %d...\n", atoi(port)));
- ippSetPort(atoi(port));
- }
- if (cg->server[0] == '/')
- strcpy(cg->servername, "localhost");
- else
- strlcpy(cg->servername, cg->server, sizeof(cg->servername));
- }
+ cg->encryption = e;
- return (cg->server);
+ if (cg->http)
+ httpEncryption(cg->http, e);
}
@@ -312,7 +171,7 @@ cupsSetServer(const char *server) /* I - Server name */
{
*port++ = '\0';
- ippSetPort(atoi(port));
+ cg->ipp_port = atoi(port);
}
if (cg->server[0] == '/')
@@ -464,44 +323,209 @@ _cupsGetPassword(const char *prompt) /* I - Prompt string */
/*
- * 'cups_open_client_conf()' - Open the client.conf file.
+ * '_cupsSetDefaults()' - Set the default server, port, and encryption.
*/
-static cups_file_t * /* O - File or NULL */
-cups_open_client_conf(void)
+void
+_cupsSetDefaults(void)
{
cups_file_t *fp; /* File */
- const char *home; /* Home directory of user */
+ const char *home, /* Home directory of user */
+ *cups_encryption, /* CUPS_ENCRYPTION env var */
+ *cups_server; /* CUPS_SERVER env var */
char filename[1024]; /* Filename */
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
- if ((home = getenv("HOME")) != NULL)
+ DEBUG_puts("_cupsSetDefaults()");
+
+ /*
+ * First collect environment variables...
+ */
+
+ cups_encryption = getenv("CUPS_ENCRYPTION");
+ cups_server = getenv("CUPS_SERVER");
+
+ /*
+ * Then, if needed, the .cups/client.conf or .cupsrc file in the home
+ * directory...
+ */
+
+ if ((cg->encryption == (http_encryption_t)-1 || !cg->server[0] ||
+ !cg->ipp_port) && (home = getenv("HOME")) != NULL)
{
/*
* Look for ~/.cups/client.conf or ~/.cupsrc...
*/
snprintf(filename, sizeof(filename), "%s/.cups/client.conf", home);
- if ((fp = cupsFileOpen(filename, "r")) != NULL)
+ if ((fp = cupsFileOpen(filename, "r")) == NULL)
{
- DEBUG_printf(("cups_open_client_conf: Using \"%s\"...\n", filename));
- return (fp);
+ snprintf(filename, sizeof(filename), "%s/.cupsrc", home);
+ fp = cupsFileOpen(filename, "r");
}
- snprintf(filename, sizeof(filename), "%s/.cupsrc", home);
+ if (fp)
+ {
+ cups_read_client_conf(fp, cg, cups_encryption, cups_server);
+ cupsFileClose(fp);
+ }
+ }
+
+ if (cg->encryption == (http_encryption_t)-1 || !cg->server[0] ||
+ !cg->ipp_port)
+ {
+ /*
+ * Look for CUPS_SERVERROOT/client.conf...
+ */
+
+ snprintf(filename, sizeof(filename), "%s/client.conf", cg->cups_serverroot);
if ((fp = cupsFileOpen(filename, "r")) != NULL)
{
- DEBUG_printf(("cups_open_client_conf: Using \"%s\"...\n", filename));
- return (fp);
+ cups_read_client_conf(fp, cg, cups_encryption, cups_server);
+ cupsFileClose(fp);
+ }
+ }
+
+ /*
+ * If we still have things that aren't set, use the compiled in defaults...
+ */
+
+ if (cg->encryption == (http_encryption_t)-1)
+ cg->encryption = HTTP_ENCRYPT_IF_REQUESTED;
+
+ if (!cg->server[0])
+ {
+ if (!cups_server)
+ {
+#ifdef CUPS_DEFAULT_DOMAINSOCKET
+ /*
+ * If we are compiled with domain socket support, only use the
+ * domain socket if it exists and has the right permissions...
+ */
+
+ struct stat sockinfo; /* Domain socket information */
+
+ if (!stat(CUPS_DEFAULT_DOMAINSOCKET, &sockinfo) &&
+ (sockinfo.st_mode & S_IRWXO) == S_IRWXO)
+ cups_server = CUPS_DEFAULT_DOMAINSOCKET;
+ else
+#endif /* CUPS_DEFAULT_DOMAINSOCKET */
+ cups_server = "localhost";
+ }
+
+ cupsSetServer(cups_server);
+ }
+
+ if (!cg->ipp_port)
+ {
+ const char *ipp_port; /* IPP_PORT environment variable */
+ struct servent *service; /* Port number info */
+
+
+ if ((ipp_port = getenv("IPP_PORT")) != NULL)
+ {
+ if ((cg->ipp_port = atoi(ipp_port)) <= 0)
+ cg->ipp_port = CUPS_DEFAULT_IPP_PORT;
}
+ else if ((service = getservbyname("ipp", NULL)) == NULL ||
+ service->s_port <= 0)
+ cg->ipp_port = CUPS_DEFAULT_IPP_PORT;
+ else
+ cg->ipp_port = ntohs(service->s_port);
+ }
+}
+
+
+/*
+ * 'cups_read_client_conf()' - Read a client.conf file.
+ */
+
+static void
+cups_read_client_conf(
+ cups_file_t *fp, /* I - File to read */
+ _cups_globals_t *cg, /* I - Global data */
+ const char *cups_encryption, /* I - CUPS_ENCRYPTION env var */
+ const char *cups_server) /* I - CUPS_SERVER env var */
+{
+ int linenum; /* Current line number */
+ char line[1024], /* Line from file */
+ *value, /* Pointer into line */
+ encryption[1024], /* Encryption value */
+ server_name[1024]; /* ServerName value */
+
+
+ /*
+ * Read from the file...
+ */
+
+ linenum = 0;
+ while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum))
+ {
+ if (!cups_encryption && cg->encryption == (http_encryption_t)-1 &&
+ !strcasecmp(line, "Encryption") && value)
+ {
+ strlcpy(encryption, value, sizeof(encryption));
+ cups_encryption = encryption;
+ }
+ else if (!cups_server && (!cg->server[0] || !cg->ipp_port) &&
+ !strcasecmp(line, "ServerName") && value)
+ {
+ strlcpy(server_name, value, sizeof(server_name));
+ cups_server = server_name;
+ }
+ }
+
+ /*
+ * Set values...
+ */
+
+ if (cg->encryption == (http_encryption_t)-1 && cups_encryption)
+ {
+ if (!strcasecmp(cups_encryption, "never"))
+ cg->encryption = HTTP_ENCRYPT_NEVER;
+ else if (!strcasecmp(cups_encryption, "always"))
+ cg->encryption = HTTP_ENCRYPT_ALWAYS;
+ else if (!strcasecmp(cups_encryption, "required"))
+ cg->encryption = HTTP_ENCRYPT_REQUIRED;
+ else
+ cg->encryption = HTTP_ENCRYPT_IF_REQUESTED;
}
- snprintf(filename, sizeof(filename), "%s/client.conf", cg->cups_serverroot);
- return (cupsFileOpen(filename, "r"));
+ if ((!cg->server[0] || !cg->ipp_port) && cups_server)
+ {
+ if (!cg->server[0])
+ {
+ /*
+ * Copy server name...
+ */
+
+ strlcpy(cg->server, cups_server, sizeof(cg->server));
+
+ if (cg->server[0] != '/' && (value = strrchr(cg->server, ':')) != NULL &&
+ !strchr(value, ']') && isdigit(value[1] & 255))
+ *value++ = '\0';
+ else
+ value = NULL;
+
+ if (cg->server[0] == '/')
+ strcpy(cg->servername, "localhost");
+ else
+ strlcpy(cg->servername, cg->server, sizeof(cg->servername));
+ }
+ else if (cups_server[0] != '/' &&
+ (value = strrchr(cups_server, ':')) != NULL &&
+ !strchr(value, ']') && isdigit(value[1] & 255))
+ value ++;
+ else
+ value = NULL;
+
+ if (!cg->ipp_port && value)
+ cg->ipp_port = atoi(value);
+ }
}
/*
- * End of "$Id: usersys.c 7337 2008-02-22 04:44:04Z mike $".
+ * End of "$Id: usersys.c 8498 2009-04-13 17:03:15Z mike $".
*/
diff --git a/cups/util.c b/cups/util.c
index ee1cdf372..b3a51af1b 100644
--- a/cups/util.c
+++ b/cups/util.c
@@ -220,7 +220,7 @@ cupsCreateJob(
DEBUG_printf(("cupsCreateJob(http=%p, name=\"%s\", title=\"%s\", "
- "num_options=%d, options=%p)\n",
+ "num_options=%d, options=%p)",
http, name, title, num_options, options));
/*
@@ -910,7 +910,7 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAUL
*/
DEBUG_printf(("cupsGetPPD3(http=%p, name=\"%s\", modtime=%p(%d), buffer=%p, "
- "bufsize=%d)\n", http, name ? name : "(null)", modtime,
+ "bufsize=%d)", http, name, modtime,
modtime ? (int)*modtime : 0, buffer, (int)bufsize));
if (!name)
@@ -1048,7 +1048,7 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAUL
resource, sizeof(resource), 0))
return (HTTP_NOT_FOUND);
- DEBUG_printf(("cupsGetPPD3: Printer hostname=\"%s\", port=%d\n", hostname,
+ DEBUG_printf(("2cupsGetPPD3: Printer hostname=\"%s\", port=%d", hostname,
port));
/*
@@ -1057,7 +1057,7 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAUL
httpGetHostname(NULL, localhost, sizeof(localhost));
- DEBUG_printf(("cupsGetPPD3: Local hostname=\"%s\"\n", localhost));
+ DEBUG_printf(("2cupsGetPPD3: Local hostname=\"%s\"", localhost));
if (!strcasecmp(localhost, hostname))
strcpy(hostname, "localhost");
@@ -1069,7 +1069,7 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAUL
httpGetHostname(http, http_hostname, sizeof(http_hostname));
http_port = _httpAddrPort(http->hostaddr);
- DEBUG_printf(("cupsGetPPD3: Connection hostname=\"%s\", port=%d\n",
+ DEBUG_printf(("2cupsGetPPD3: Connection hostname=\"%s\", port=%d",
http_hostname, http_port));
/*
@@ -1081,7 +1081,7 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAUL
else if ((http2 = httpConnectEncrypt(hostname, port,
cupsEncryption())) == NULL)
{
- DEBUG_puts("cupsGetPPD3: Unable to connect to server!");
+ DEBUG_puts("1cupsGetPPD3: Unable to connect to server!");
return (HTTP_SERVICE_UNAVAILABLE);
}
@@ -1131,22 +1131,7 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAUL
*modtime = httpGetDateTime(httpGetField(http2, HTTP_FIELD_DATE));
else if (status != HTTP_NOT_MODIFIED)
{
- switch (status)
- {
- case HTTP_NOT_FOUND :
- _cupsSetError(IPP_NOT_FOUND, httpStatus(status), 0);
- break;
-
- case HTTP_UNAUTHORIZED :
- _cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status), 0);
- break;
-
- default :
- DEBUG_printf(("cupsGetPPD3: HTTP error %d mapped to "
- "IPP_SERVICE_UNAVAILABLE!\n", status));
- _cupsSetError(IPP_SERVICE_UNAVAILABLE, httpStatus(status), 0);
- break;
- }
+ _cupsSetHTTPError(status);
unlink(cg->ppd_filename);
}
@@ -1158,6 +1143,8 @@ cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAUL
* Return the PPD file...
*/
+ DEBUG_printf(("1cupsGetPPD3: Returning status %d", status));
+
return (status);
}
@@ -1381,7 +1368,7 @@ cupsPrintFile(const char *name, /* I - Destination name */
cups_option_t *options) /* I - Options */
{
DEBUG_printf(("cupsPrintFile(name=\"%s\", filename=\"%s\", "
- "title=\"%s\", num_options=%d, options=%p)\n",
+ "title=\"%s\", num_options=%d, options=%p)",
name, filename, title, num_options, options));
return (cupsPrintFiles2(CUPS_HTTP_DEFAULT, name, 1, &filename, title,
@@ -1406,7 +1393,7 @@ cupsPrintFile2(
cups_option_t *options) /* I - Options */
{
DEBUG_printf(("cupsPrintFile2(http=%p, name=\"%s\", filename=\"%s\", "
- "title=\"%s\", num_options=%d, options=%p)\n",
+ "title=\"%s\", num_options=%d, options=%p)",
http, name, filename, title, num_options, options));
return (cupsPrintFiles2(http, name, 1, &filename, title, num_options,
@@ -1429,10 +1416,9 @@ cupsPrintFiles(
cups_option_t *options) /* I - Options */
{
DEBUG_printf(("cupsPrintFiles(name=\"%s\", num_files=%d, "
- "files=%p, title=\"%s\", num_options=%d, options=%p)\n",
+ "files=%p, title=\"%s\", num_options=%d, options=%p)",
name, num_files, files, title, num_options, options));
-
/*
* Print the file(s)...
*/
@@ -1470,7 +1456,7 @@ cupsPrintFiles2(
DEBUG_printf(("cupsPrintFiles2(http=%p, name=\"%s\", num_files=%d, "
- "files=%p, title=\"%s\", num_options=%d, options=%p)\n",
+ "files=%p, title=\"%s\", num_options=%d, options=%p)",
http, name, num_files, files, title, num_options, options));
/*
@@ -1711,10 +1697,9 @@ cups_get_printer_uri(
};
- DEBUG_printf(("cups_get_printer_uri(http=%p, name=\"%s\", host=%p, "
- "hostsize=%d, resource=%p, resourcesize=%d, depth=%d)\n",
- http, name ? name : "(null)", host, hostsize,
- resource, resourcesize, depth));
+ DEBUG_printf(("7cups_get_printer_uri(http=%p, name=\"%s\", host=%p, "
+ "hostsize=%d, resource=%p, resourcesize=%d, depth=%d)",
+ http, name, host, hostsize, resource, resourcesize, depth));
/*
* Setup the printer URI...
@@ -1731,7 +1716,7 @@ cups_get_printer_uri(
return (0);
}
- DEBUG_printf(("cups_get_printer_uri: printer-uri=\"%s\"\n", uri));
+ DEBUG_printf(("9cups_get_printer_uri: printer-uri=\"%s\"", uri));
/*
* Get the hostname and port number we are connected to...
@@ -1812,7 +1797,7 @@ cups_get_printer_uri(
else if ((http2 = httpConnectEncrypt(host, *port,
cupsEncryption())) == NULL)
{
- DEBUG_puts("Unable to connect to server!");
+ DEBUG_puts("8cups_get_printer_uri: Unable to connect to server!");
continue;
}