1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Dan Fandrich added --disable-verbose

This commit is contained in:
Daniel Stenberg 2004-11-11 16:34:24 +00:00
parent 7bb6d76d14
commit 710e370c34
6 changed files with 113 additions and 42 deletions

View File

@ -7,6 +7,10 @@
Changelog Changelog
Daniel (11 November 2004) Daniel (11 November 2004)
- Dan Fandrich added --disable-verbose to the configure script to allow builds
without verbose strings in the code, to save some 12KB space. Makes sense
only for systems with very little memory resources.
- Jeff Phillips found out that a date string with a year beyond 2038 could - Jeff Phillips found out that a date string with a year beyond 2038 could
crash the new date parser on systems with 32bit time_t. We now check for crash the new date parser on systems with 32bit time_t. We now check for
this case and deal with it. this case and deal with it.

View File

@ -55,7 +55,7 @@ AC_SUBST(PKGADD_NAME)
AC_SUBST(PKGADD_VENDOR) AC_SUBST(PKGADD_VENDOR)
dnl dnl
dnl initialize all the info variables to 'no' dnl initialize all the info variables
curl_ssl_msg="no (--with-ssl)" curl_ssl_msg="no (--with-ssl)"
curl_zlib_msg="no (--with-zlib)" curl_zlib_msg="no (--with-zlib)"
curl_krb4_msg="no (--with-krb4*)" curl_krb4_msg="no (--with-krb4*)"
@ -65,6 +65,7 @@ dnl initialize all the info variables to 'no'
curl_ipv6_msg="no (--enable-ipv6)" curl_ipv6_msg="no (--enable-ipv6)"
curl_idn_msg="no (--with-libidn)" curl_idn_msg="no (--with-libidn)"
curl_manual_msg="no (--enable-manual)" curl_manual_msg="no (--enable-manual)"
curl_verbose_msg="enabled (--disable-verbose)"
dnl dnl
dnl Detect the canonical host and target build environment dnl Detect the canonical host and target build environment
@ -1426,6 +1427,26 @@ int main(void)
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
dnl ************************************************************
dnl disable verbose text strings
dnl
AC_MSG_CHECKING([whether to enable verbose strings])
AC_ARG_ENABLE(verbose,
AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
[ case "$enableval" in
no)
AC_MSG_RESULT(no)
AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
AC_SUBST(CURL_DISABLE_VERBOSE_STRINGS)
curl_verbose_msg="no"
;;
*) AC_MSG_RESULT(yes)
;;
esac ],
AC_MSG_RESULT(yes)
)
dnl ************************************************************ dnl ************************************************************
dnl lame option to switch on debug options dnl lame option to switch on debug options
dnl dnl
@ -1497,4 +1518,5 @@ AC_MSG_NOTICE([Configured to build curl/libcurl:
IDN support: ${curl_idn_msg} IDN support: ${curl_idn_msg}
Build libcurl: Shared=${enable_shared}, Static=${enable_static} Build libcurl: Shared=${enable_shared}, Static=${enable_static}
Built-in manual: ${curl_manual_msg} Built-in manual: ${curl_manual_msg}
Verbose errors: ${curl_verbose_msg}
]) ])

View File

@ -220,7 +220,7 @@ krb4_auth(void *app_data, struct connectdata *conn)
if(ret == KDC_PR_UNKNOWN) if(ret == KDC_PR_UNKNOWN)
ret = mk_auth(d, &adat, "rcmd", host, checksum); ret = mk_auth(d, &adat, "rcmd", host, checksum);
if(ret) { if(ret) {
Curl_infof(data, "%s\n", krb_get_err_text(ret)); infof(data, "%s\n", krb_get_err_text(ret));
return AUTH_CONTINUE; return AUTH_CONTINUE;
} }
@ -232,7 +232,7 @@ krb4_auth(void *app_data, struct connectdata *conn)
if (krb_get_our_ip_for_realm(krb_realmofhost(host), if (krb_get_our_ip_for_realm(krb_realmofhost(host),
&natAddr) != KSUCCESS &natAddr) != KSUCCESS
&& krb_get_our_ip_for_realm(NULL, &natAddr) != KSUCCESS) && krb_get_our_ip_for_realm(NULL, &natAddr) != KSUCCESS)
Curl_infof(data, "Can't get address for realm %s\n", infof(data, "Can't get address for realm %s\n",
krb_realmofhost(host)); krb_realmofhost(host));
else { else {
if (natAddr.s_addr != localaddr->sin_addr.s_addr) { if (natAddr.s_addr != localaddr->sin_addr.s_addr) {
@ -242,7 +242,7 @@ krb4_auth(void *app_data, struct connectdata *conn)
#else #else
char *ip = (char *)inet_ntoa(natAddr); char *ip = (char *)inet_ntoa(natAddr);
#endif #endif
Curl_infof(data, "Using NAT IP address (%s) for kerberos 4\n", ip); infof(data, "Using NAT IP address (%s) for kerberos 4\n", ip);
localaddr->sin_addr = natAddr; localaddr->sin_addr = natAddr;
} }
} }

View File

@ -28,7 +28,17 @@ CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *,
void Curl_infof(struct SessionHandle *, const char *fmt, ...); void Curl_infof(struct SessionHandle *, const char *fmt, ...);
void Curl_failf(struct SessionHandle *, const char *fmt, ...); void Curl_failf(struct SessionHandle *, const char *fmt, ...);
#if defined(CURL_DISABLE_VERBOSE_STRINGS)
#if defined(__GNUC__)
/* Variable argument macros is a C99 feature long supported by gcc */
#define infof(...) /*ignore*/
#else
/* Cast the args to void to make them a noop, side effects notwithstanding */
#define infof (void)
#endif
#else
#define infof Curl_infof #define infof Curl_infof
#endif
#define failf Curl_failf #define failf Curl_failf
#define CLIENTWRITE_BODY 1 #define CLIENTWRITE_BODY 1

View File

@ -48,6 +48,7 @@ extern char *strerror_r(int errnum, char *buf, size_t buflen);
const char * const char *
curl_easy_strerror(CURLcode error) curl_easy_strerror(CURLcode error)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS
switch (error) { switch (error) {
case CURLE_OK: case CURLE_OK:
return "no error"; return "no error";
@ -252,11 +253,18 @@ curl_easy_strerror(CURLcode error)
* is why it is here, and not at the start of the switch. * is why it is here, and not at the start of the switch.
*/ */
return "unknown error"; return "unknown error";
#else
if (error == CURLE_OK)
return "no error";
else
return "error";
#endif
} }
const char * const char *
curl_multi_strerror(CURLMcode error) curl_multi_strerror(CURLMcode error)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS
switch (error) { switch (error) {
case CURLM_CALL_MULTI_PERFORM: case CURLM_CALL_MULTI_PERFORM:
return "please call curl_multi_perform() soon"; return "please call curl_multi_perform() soon";
@ -281,11 +289,18 @@ curl_multi_strerror(CURLMcode error)
} }
return "unknown error"; return "unknown error";
#else
if (error == CURLM_OK)
return "no error";
else
return "error";
#endif
} }
const char * const char *
curl_share_strerror(CURLSHcode error) curl_share_strerror(CURLSHcode error)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS
switch (error) { switch (error) {
case CURLSHE_OK: case CURLSHE_OK:
return "no error"; return "no error";
@ -307,6 +322,12 @@ curl_share_strerror(CURLSHcode error)
} }
return "CURLSH unknown"; return "CURLSH unknown";
#else
if (error == CURLSHE_OK)
return "no error";
else
return "error";
#endif
} }
#if defined(WIN32) && !defined(__CYGWIN__) #if defined(WIN32) && !defined(__CYGWIN__)
@ -318,6 +339,7 @@ get_winsock_error (int err, char *buf, size_t len)
{ {
char *p; char *p;
#ifndef CURL_DISABLE_VERBOSE_STRINGS
switch (err) { switch (err) {
case WSAEINTR: case WSAEINTR:
p = "Call interrupted."; p = "Call interrupted.";
@ -485,6 +507,12 @@ get_winsock_error (int err, char *buf, size_t len)
default: default:
return NULL; return NULL;
} }
#else
if (error == CURLE_OK)
return NULL;
else
p = "error";
#endif
strncpy (buf, p, len); strncpy (buf, p, len);
buf [len-1] = '\0'; buf [len-1] = '\0';
return buf; return buf;
@ -594,6 +622,7 @@ const char *Curl_idn_strerror (struct connectdata *conn, int err)
buf = conn->syserr_buf; buf = conn->syserr_buf;
max = sizeof(conn->syserr_buf)-1; max = sizeof(conn->syserr_buf)-1;
#ifndef CURL_DISABLE_VERBOSE_STRINGS
switch ((Idna_rc)err) { switch ((Idna_rc)err) {
case IDNA_SUCCESS: case IDNA_SUCCESS:
str = "No error"; str = "No error";
@ -636,6 +665,12 @@ const char *Curl_idn_strerror (struct connectdata *conn, int err)
str = NULL; str = NULL;
break; break;
} }
#else
if ((Idna_rc)err == IDNA_SUCCESS)
str = "No error";
else
str = "error";
#endif
if (str) if (str)
strncpy(buf, str, max); strncpy(buf, str, max);
buf[max] = '\0'; buf[max] = '\0';

View File

@ -262,9 +262,9 @@ static void printoption(struct SessionHandle *data,
if (cmd == CURL_IAC) if (cmd == CURL_IAC)
{ {
if (CURL_TELCMD_OK(option)) if (CURL_TELCMD_OK(option))
Curl_infof(data, "%s IAC %s\n", direction, CURL_TELCMD(option)); infof(data, "%s IAC %s\n", direction, CURL_TELCMD(option));
else else
Curl_infof(data, "%s IAC %d\n", direction, option); infof(data, "%s IAC %d\n", direction, option);
} }
else else
{ {
@ -280,12 +280,12 @@ static void printoption(struct SessionHandle *data,
opt = NULL; opt = NULL;
if(opt) if(opt)
Curl_infof(data, "%s %s %s\n", direction, fmt, opt); infof(data, "%s %s %s\n", direction, fmt, opt);
else else
Curl_infof(data, "%s %s %d\n", direction, fmt, option); infof(data, "%s %s %d\n", direction, fmt, option);
} }
else else
Curl_infof(data, "%s %d %d\n", direction, cmd, option); infof(data, "%s %d %d\n", direction, cmd, option);
} }
} }
} }
@ -675,7 +675,7 @@ static void printsub(struct SessionHandle *data,
{ {
if (direction) if (direction)
{ {
Curl_infof(data, "%s IAC SB ", (direction == '<')? "RCVD":"SENT"); infof(data, "%s IAC SB ", (direction == '<')? "RCVD":"SENT");
if (length >= 3) if (length >= 3)
{ {
int j; int j;
@ -685,27 +685,27 @@ static void printsub(struct SessionHandle *data,
if (i != CURL_IAC || j != CURL_SE) if (i != CURL_IAC || j != CURL_SE)
{ {
Curl_infof(data, "(terminated by "); infof(data, "(terminated by ");
if (CURL_TELOPT_OK(i)) if (CURL_TELOPT_OK(i))
Curl_infof(data, "%s ", CURL_TELOPT(i)); infof(data, "%s ", CURL_TELOPT(i));
else if (CURL_TELCMD_OK(i)) else if (CURL_TELCMD_OK(i))
Curl_infof(data, "%s ", CURL_TELCMD(i)); infof(data, "%s ", CURL_TELCMD(i));
else else
Curl_infof(data, "%d ", i); infof(data, "%d ", i);
if (CURL_TELOPT_OK(j)) if (CURL_TELOPT_OK(j))
Curl_infof(data, "%s", CURL_TELOPT(j)); infof(data, "%s", CURL_TELOPT(j));
else if (CURL_TELCMD_OK(j)) else if (CURL_TELCMD_OK(j))
Curl_infof(data, "%s", CURL_TELCMD(j)); infof(data, "%s", CURL_TELCMD(j));
else else
Curl_infof(data, "%d", j); infof(data, "%d", j);
Curl_infof(data, ", not IAC SE!) "); infof(data, ", not IAC SE!) ");
} }
} }
length -= 2; length -= 2;
} }
if (length < 1) if (length < 1)
{ {
Curl_infof(data, "(Empty suboption?)"); infof(data, "(Empty suboption?)");
return; return;
} }
@ -714,28 +714,28 @@ static void printsub(struct SessionHandle *data,
case CURL_TELOPT_TTYPE: case CURL_TELOPT_TTYPE:
case CURL_TELOPT_XDISPLOC: case CURL_TELOPT_XDISPLOC:
case CURL_TELOPT_NEW_ENVIRON: case CURL_TELOPT_NEW_ENVIRON:
Curl_infof(data, "%s", CURL_TELOPT(pointer[0])); infof(data, "%s", CURL_TELOPT(pointer[0]));
break; break;
default: default:
Curl_infof(data, "%s (unsupported)", CURL_TELOPT(pointer[0])); infof(data, "%s (unsupported)", CURL_TELOPT(pointer[0]));
break; break;
} }
} }
else else
Curl_infof(data, "%d (unknown)", pointer[i]); infof(data, "%d (unknown)", pointer[i]);
switch(pointer[1]) { switch(pointer[1]) {
case CURL_TELQUAL_IS: case CURL_TELQUAL_IS:
Curl_infof(data, " IS"); infof(data, " IS");
break; break;
case CURL_TELQUAL_SEND: case CURL_TELQUAL_SEND:
Curl_infof(data, " SEND"); infof(data, " SEND");
break; break;
case CURL_TELQUAL_INFO: case CURL_TELQUAL_INFO:
Curl_infof(data, " INFO/REPLY"); infof(data, " INFO/REPLY");
break; break;
case CURL_TELQUAL_NAME: case CURL_TELQUAL_NAME:
Curl_infof(data, " NAME"); infof(data, " NAME");
break; break;
} }
@ -743,21 +743,21 @@ static void printsub(struct SessionHandle *data,
case CURL_TELOPT_TTYPE: case CURL_TELOPT_TTYPE:
case CURL_TELOPT_XDISPLOC: case CURL_TELOPT_XDISPLOC:
pointer[length] = 0; pointer[length] = 0;
Curl_infof(data, " \"%s\"", &pointer[2]); infof(data, " \"%s\"", &pointer[2]);
break; break;
case CURL_TELOPT_NEW_ENVIRON: case CURL_TELOPT_NEW_ENVIRON:
if(pointer[1] == CURL_TELQUAL_IS) { if(pointer[1] == CURL_TELQUAL_IS) {
Curl_infof(data, " "); infof(data, " ");
for(i = 3;i < length;i++) { for(i = 3;i < length;i++) {
switch(pointer[i]) { switch(pointer[i]) {
case CURL_NEW_ENV_VAR: case CURL_NEW_ENV_VAR:
Curl_infof(data, ", "); infof(data, ", ");
break; break;
case CURL_NEW_ENV_VALUE: case CURL_NEW_ENV_VALUE:
Curl_infof(data, " = "); infof(data, " = ");
break; break;
default: default:
Curl_infof(data, "%c", pointer[i]); infof(data, "%c", pointer[i]);
break; break;
} }
} }
@ -765,13 +765,13 @@ static void printsub(struct SessionHandle *data,
break; break;
default: default:
for (i = 2; i < length; i++) for (i = 2; i < length; i++)
Curl_infof(data, " %.2x", pointer[i]); infof(data, " %.2x", pointer[i]);
break; break;
} }
if (direction) if (direction)
{ {
Curl_infof(data, "\n"); infof(data, "\n");
} }
} }
} }