"tests/valgrind.supp",
# checksrc control files
"docs/examples/.checksrc",
- "lib/.checksrc",
- "lib/curlx/.checksrc",
- "lib/vauth/.checksrc",
- "lib/vquic/.checksrc",
- "lib/vssh/.checksrc",
- "lib/vtls/.checksrc",
+ "scripts/.checksrc",
"src/.checksrc",
- "tests/libtest/.checksrc",
"tests/server/.checksrc",
- "tests/tunit/.checksrc",
- "tests/unit/.checksrc",
]
SPDX-FileCopyrightText = "Daniel Stenberg, <daniel@haxx.se>, et al."
SPDX-License-Identifier = "curl"
allowfunc fclose
allowfunc fdopen
allowfunc fopen
+allowfunc fprintf
allowfunc gmtime
allowfunc localtime
allowfunc open
+allowfunc printf
allowfunc snprintf
allowfunc socket
allowfunc sscanf
CMAKE_DIST = CMakeLists.txt curl_config.h.cmake
-CHECKSRC_DIST = .checksrc \
- curlx/.checksrc vauth/.checksrc vquic/.checksrc vssh/.checksrc vtls/.checksrc
-
EXTRA_DIST = config-mac.h config-os400.h config-plan9.h config-riscos.h \
config-win32.h curl_config.h.in $(LIB_RCFILES) libcurl.def \
- $(CMAKE_DIST) Makefile.soname optiontable.pl $(CHECKSRC_DIST)
+ $(CMAKE_DIST) Makefile.soname optiontable.pl
lib_LTLIBRARIES = libcurl.la
#include "curlx/strparse.h"
#include "connect.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
}
}
#endif
- fprintf(fp,
- "%s %s%s%s %u "
- "%s %s%s%s %u "
- "\"%d%02d%02d "
- "%02d:%02d:%02d\" "
- "%u %u\n",
- Curl_alpnid2str(as->src.alpnid),
- src6_pre, as->src.host, src6_post,
- as->src.port,
-
- Curl_alpnid2str(as->dst.alpnid),
- dst6_pre, as->dst.host, dst6_post,
- as->dst.port,
-
- stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
- stamp.tm_hour, stamp.tm_min, stamp.tm_sec,
- as->persist, as->prio);
+ curl_mfprintf(fp,
+ "%s %s%s%s %u "
+ "%s %s%s%s %u "
+ "\"%d%02d%02d "
+ "%02d:%02d:%02d\" "
+ "%u %u\n",
+ Curl_alpnid2str(as->src.alpnid),
+ src6_pre, as->src.host, src6_post,
+ as->src.port,
+
+ Curl_alpnid2str(as->dst.alpnid),
+ dst6_pre, as->dst.host, dst6_post,
+ as->dst.port,
+
+ stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
+ stamp.tm_hour, stamp.tm_min, stamp.tm_sec,
+ as->persist, as->prio);
return CURLE_OK;
}
#define HTTPSRR_WORKS
#endif
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
* accordingly to save a call to getservbyname in inside C-Ares
*/
hints.ai_flags = ARES_AI_NUMERICSERV;
- msnprintf(service, sizeof(service), "%d", port);
+ curl_msnprintf(service, sizeof(service), "%d", port);
ares->num_pending = 1;
ares_getaddrinfo(ares->channel, data->state.async.hostname,
service, &hints, async_ares_addrinfo_cb, data);
#endif
#endif
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
char service[12];
int rc;
- msnprintf(service, sizeof(service), "%d", addr_ctx->port);
+ curl_msnprintf(service, sizeof(service), "%d", addr_ctx->port);
rc = Curl_getaddrinfo_ex(addr_ctx->hostname, service,
&addr_ctx->hints, &addr_ctx->res);
#include "curl_setup.h"
#include "bufq.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "multiif.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "select.h"
#include "cf-h2-proxy.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
return result;
ts->authority = /* host:port with IPv6 support */
- aprintf("%s%s%s:%d", ipv6_ip ? "[":"", hostname,
- ipv6_ip ? "]" : "", port);
+ curl_maprintf("%s%s%s:%d", ipv6_ip ? "[":"", hostname,
+ ipv6_ip ? "]" : "", port);
if(!ts->authority)
return CURLE_OUT_OF_MEMORY;
{
switch(frame->hd.type) {
case NGHTTP2_DATA: {
- return msnprintf(buffer, blen,
- "FRAME[DATA, len=%d, eos=%d, padlen=%d]",
- (int)frame->hd.length,
- !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM),
- (int)frame->data.padlen);
+ return curl_msnprintf(buffer, blen,
+ "FRAME[DATA, len=%d, eos=%d, padlen=%d]",
+ (int)frame->hd.length,
+ !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM),
+ (int)frame->data.padlen);
}
case NGHTTP2_HEADERS: {
- return msnprintf(buffer, blen,
- "FRAME[HEADERS, len=%d, hend=%d, eos=%d]",
- (int)frame->hd.length,
- !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS),
- !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM));
+ return curl_msnprintf(buffer, blen,
+ "FRAME[HEADERS, len=%d, hend=%d, eos=%d]",
+ (int)frame->hd.length,
+ !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS),
+ !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM));
}
case NGHTTP2_PRIORITY: {
- return msnprintf(buffer, blen,
- "FRAME[PRIORITY, len=%d, flags=%d]",
- (int)frame->hd.length, frame->hd.flags);
+ return curl_msnprintf(buffer, blen,
+ "FRAME[PRIORITY, len=%d, flags=%d]",
+ (int)frame->hd.length, frame->hd.flags);
}
case NGHTTP2_RST_STREAM: {
- return msnprintf(buffer, blen,
- "FRAME[RST_STREAM, len=%d, flags=%d, error=%u]",
- (int)frame->hd.length, frame->hd.flags,
- frame->rst_stream.error_code);
+ return curl_msnprintf(buffer, blen,
+ "FRAME[RST_STREAM, len=%d, flags=%d, error=%u]",
+ (int)frame->hd.length, frame->hd.flags,
+ frame->rst_stream.error_code);
}
case NGHTTP2_SETTINGS: {
if(frame->hd.flags & NGHTTP2_FLAG_ACK) {
- return msnprintf(buffer, blen, "FRAME[SETTINGS, ack=1]");
+ return curl_msnprintf(buffer, blen, "FRAME[SETTINGS, ack=1]");
}
- return msnprintf(buffer, blen,
- "FRAME[SETTINGS, len=%d]", (int)frame->hd.length);
+ return curl_msnprintf(buffer, blen,
+ "FRAME[SETTINGS, len=%d]", (int)frame->hd.length);
}
case NGHTTP2_PUSH_PROMISE:
- return msnprintf(buffer, blen,
- "FRAME[PUSH_PROMISE, len=%d, hend=%d]",
- (int)frame->hd.length,
- !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS));
+ return curl_msnprintf(buffer, blen,
+ "FRAME[PUSH_PROMISE, len=%d, hend=%d]",
+ (int)frame->hd.length,
+ !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS));
case NGHTTP2_PING:
- return msnprintf(buffer, blen,
- "FRAME[PING, len=%d, ack=%d]",
- (int)frame->hd.length,
- frame->hd.flags & NGHTTP2_FLAG_ACK);
+ return curl_msnprintf(buffer, blen,
+ "FRAME[PING, len=%d, ack=%d]",
+ (int)frame->hd.length,
+ frame->hd.flags & NGHTTP2_FLAG_ACK);
case NGHTTP2_GOAWAY: {
char scratch[128];
size_t s_len = CURL_ARRAYSIZE(scratch);
if(len)
memcpy(scratch, frame->goaway.opaque_data, len);
scratch[len] = '\0';
- return msnprintf(buffer, blen, "FRAME[GOAWAY, error=%d, reason='%s', "
- "last_stream=%d]", frame->goaway.error_code,
- scratch, frame->goaway.last_stream_id);
+ return curl_msnprintf(buffer, blen,
+ "FRAME[GOAWAY, error=%d, reason='%s', "
+ "last_stream=%d]", frame->goaway.error_code,
+ scratch, frame->goaway.last_stream_id);
}
case NGHTTP2_WINDOW_UPDATE: {
- return msnprintf(buffer, blen,
- "FRAME[WINDOW_UPDATE, incr=%d]",
- frame->window_update.window_size_increment);
+ return curl_msnprintf(buffer, blen,
+ "FRAME[WINDOW_UPDATE, incr=%d]",
+ frame->window_update.window_size_increment);
}
default:
- return msnprintf(buffer, blen, "FRAME[%d, len=%d, flags=%d]",
- frame->hd.type, (int)frame->hd.length,
- frame->hd.flags);
+ return curl_msnprintf(buffer, blen, "FRAME[%d, len=%d, flags=%d]",
+ frame->hd.type, (int)frame->hd.length,
+ frame->hd.flags);
}
}
#include "multiif.h"
#include "select.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "select.h"
#include "vquic/vquic.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "select.h"
#include "vquic/vquic.h" /* for quic cfilters */
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#ifdef USE_UNIX_SOCKETS
if(conn->unix_domain_socket)
- msnprintf(viamsg, sizeof(viamsg), "over %s", conn->unix_domain_socket);
+ curl_msnprintf(viamsg, sizeof(viamsg), "over %s",
+ conn->unix_domain_socket);
else
#endif
{
port = conn->conn_to_port;
else
port = conn->remote_port;
- msnprintf(viamsg, sizeof(viamsg), "port %u", port);
+ curl_msnprintf(viamsg, sizeof(viamsg), "port %u", port);
}
failf(data, "Failed to connect to %s %s %s%s%safter "
#include "curlx/strerr.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "curlx/warnless.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "curlx/strparse.h"
#include "uint-table.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
if(!cpool)
return;
- fprintf(stderr, "=Bundle cache=\n");
+ curl_mfprintf(stderr, "=Bundle cache=\n");
Curl_hash_start_iterate(cpool->dest2bundle, &iter);
bundle = he->ptr;
- fprintf(stderr, "%s -", he->key);
+ curl_mfprintf(stderr, "%s -", he->key);
curr = Curl_llist_head(bundle->conns);
while(curr) {
conn = Curl_node_elem(curr);
- fprintf(stderr, " [%p %d]", (void *)conn, conn->refcount);
+ curl_mfprintf(stderr, " [%p %d]", (void *)conn, conn->refcount);
curr = Curl_node_next(curr);
}
- fprintf(stderr, "\n");
+ curl_mfprintf(stderr, "\n");
he = Curl_hash_next_element(&iter);
}
#include "http_proxy.h"
#include "socks.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
case AF_UNIX:
if(salen > (curl_socklen_t)sizeof(CURL_SA_FAMILY_T)) {
su = (struct sockaddr_un*)sa;
- msnprintf(addr, MAX_IPADR_LEN, "%s", su->sun_path);
+ curl_msnprintf(addr, MAX_IPADR_LEN, "%s", su->sun_path);
}
else
addr[0] = 0; /* socket with no name */
#include "content_encoding.h"
#include "strdup.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "llist.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
*/
static char *get_netscape_format(const struct Cookie *co)
{
- return aprintf(
+ return curl_maprintf(
"%s" /* httponly preamble */
"%s%s\t" /* domain */
"%s\t" /* tailmatch */
error = CURLE_OUT_OF_MEMORY;
goto error;
}
- fprintf(out, "%s\n", format_ptr);
+ curl_mfprintf(out, "%s\n", format_ptr);
free(format_ptr);
}
#include "select.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "fake_addrinfo.h"
#include "curlx/inet_pton.h"
#include "curlx/warnless.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "urldata.h"
#include "rand.h"
#include "curl_fopen.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
if(dir) {
/* The temp filename should not end up too long for the target file
system */
- tempstore = aprintf("%s%s.tmp", dir, randbuf);
+ tempstore = curl_maprintf("%s%s.tmp", dir, randbuf);
free(dir);
}
#include "curl_gssapi.h"
#include "sendf.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
}
/* Token format: creds:target:type:padding */
- used = msnprintf(token, length, "%s:%.*s:%d:", creds,
- (int)target_desc.length, (const char *)target_desc.value,
- ctx->sent);
+ used = curl_msnprintf(token, length, "%s:%.*s:%d:", creds,
+ (int)target_desc.length,
+ (const char *)target_desc.value,
+ ctx->sent);
gss_release_buffer(&minor_status, &target_desc);
}
&status_string);
if(maj_stat == GSS_S_COMPLETE && status_string.length > 0) {
if(GSS_LOG_BUFFER_LEN > len + status_string.length + 3) {
- len += msnprintf(buf + len, GSS_LOG_BUFFER_LEN - len,
- "%.*s. ", (int)status_string.length,
- (char *)status_string.value);
+ len += curl_msnprintf(buf + len, GSS_LOG_BUFFER_LEN - len,
+ "%.*s. ", (int)status_string.length,
+ (char *)status_string.value);
}
}
gss_release_buffer(&min_stat, &status_string);
#include "curl_endian.h"
#include "curl_des.h"
#include "curl_md4.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
return CURLE_OUT_OF_MEMORY;
/* Create the BLOB structure */
- msnprintf((char *)ptr + HMAC_MD5_LENGTH, NTLMv2_BLOB_LEN,
- "%c%c%c%c" /* NTLMv2_BLOB_SIGNATURE */
- "%c%c%c%c" /* Reserved = 0 */
- "%c%c%c%c%c%c%c%c", /* Timestamp */
- NTLMv2_BLOB_SIGNATURE[0], NTLMv2_BLOB_SIGNATURE[1],
- NTLMv2_BLOB_SIGNATURE[2], NTLMv2_BLOB_SIGNATURE[3],
- 0, 0, 0, 0,
- LONGQUARTET(tw.dwLowDateTime), LONGQUARTET(tw.dwHighDateTime));
+ curl_msnprintf((char *)ptr + HMAC_MD5_LENGTH, NTLMv2_BLOB_LEN,
+ "%c%c%c%c" /* NTLMv2_BLOB_SIGNATURE */
+ "%c%c%c%c" /* Reserved = 0 */
+ "%c%c%c%c%c%c%c%c", /* Timestamp */
+ NTLMv2_BLOB_SIGNATURE[0], NTLMv2_BLOB_SIGNATURE[1],
+ NTLMv2_BLOB_SIGNATURE[2], NTLMv2_BLOB_SIGNATURE[3],
+ 0, 0, 0, 0,
+ LONGQUARTET(tw.dwLowDateTime),
+ LONGQUARTET(tw.dwHighDateTime));
memcpy(ptr + 32, challenge_client, 8);
if(ntlm->target_info_len)
*
***************************************************************************/
-#include <curl/mprintf.h>
-
#define MERR_OK 0
#define MERR_MEM 1
#define MERR_TOO_LARGE 2
/* Upper-case digits. */
extern const unsigned char Curl_udigits[];
-#ifdef BUILDING_LIBCURL
-
-/*
- * This header should be included by ALL code in libcurl that uses any
- * *rintf() functions.
- */
-
-# undef printf
-# undef fprintf
-# undef msnprintf
-# undef vprintf
-# undef vfprintf
-# undef mvsnprintf
-# undef aprintf
-# undef vaprintf
-# define printf curl_mprintf
-# define fprintf curl_mfprintf
-# define msnprintf curl_msnprintf
-# define vprintf curl_mvprintf
-# define vfprintf curl_mvfprintf
-# define mvsnprintf curl_mvsnprintf
-# define aprintf curl_maprintf
-# define vaprintf curl_mvaprintf
-
-#endif /* BUILDING_LIBCURL */
#endif /* HEADER_CURL_PRINTF_H */
#include <curl/curl.h>
#include <librtmp/rtmp.h>
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
else
suff[0] = '\0';
- msnprintf(version, len, "librtmp/%d.%d%s",
- RTMP_LIB_VERSION >> 16, (RTMP_LIB_VERSION >> 8) & 0xff,
- suff);
+ curl_msnprintf(version, len, "librtmp/%d.%d%s",
+ RTMP_LIB_VERSION >> 16, (RTMP_LIB_VERSION >> 8) & 0xff,
+ suff);
}
#endif /* USE_LIBRTMP */
#include "curl_sasl.h"
#include "curlx/warnless.h"
#include "sendf.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#define Curl_safefree(ptr) \
do { free((ptr)); (ptr) = NULL;} while(0)
+#include <curl/curl.h> /* for CURL_EXTERN, mprintf.h */
+
#ifdef CURLDEBUG
#ifdef __clang__
# define ALLOC_FUNC __attribute__((__malloc__))
# define ALLOC_SIZE2(n, s)
#endif
-#include <curl/curl.h> /* for CURL_EXTERN */
-
extern FILE *curl_dbg_logfile;
/* memory functions */
#include "vtls/vtls.h"
#include "vquic/vquic.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
data->conn->connection_id : data->state.recent_conn_id;
if(data->id >= 0) {
if(cid >= 0)
- return msnprintf(buf, maxlen, CURL_TRC_FMT_IDSDC, data->id, cid);
+ return curl_msnprintf(buf, maxlen, CURL_TRC_FMT_IDSDC, data->id, cid);
else
- return msnprintf(buf, maxlen, CURL_TRC_FMT_IDSD, data->id);
+ return curl_msnprintf(buf, maxlen, CURL_TRC_FMT_IDSD, data->id);
}
else if(cid >= 0)
- return msnprintf(buf, maxlen, CURL_TRC_FMT_IDSC, cid);
+ return curl_msnprintf(buf, maxlen, CURL_TRC_FMT_IDSC, cid);
else {
- return msnprintf(buf, maxlen, "[x-x] ");
+ return curl_msnprintf(buf, maxlen, "[x-x] ");
}
}
if(CURL_TRC_IDS(data) && (size < TRC_LINE_MAX)) {
len = trc_print_ids(data, buf, TRC_LINE_MAX);
- len += msnprintf(buf + len, TRC_LINE_MAX - len, "%.*s",
- (int)size, ptr);
+ len += curl_msnprintf(buf + len, TRC_LINE_MAX - len, "%.*s",
+ (int)size, ptr);
len = trc_end_buf(buf, len, TRC_LINE_MAX, FALSE);
Curl_set_in_callback(data, TRUE);
(void)(*data->set.fdebug)(data, type, buf, len, data->set.debugdata);
size_t len;
char error[CURL_ERROR_SIZE + 2];
va_start(ap, fmt);
- len = mvsnprintf(error, CURL_ERROR_SIZE, fmt, ap);
+ len = curl_mvsnprintf(error, CURL_ERROR_SIZE, fmt, ap);
if(data->set.errorbuffer && !data->state.errorbuf) {
strcpy(data->set.errorbuffer, error);
if(CURL_TRC_IDS(data))
len += trc_print_ids(data, buf + len, TRC_LINE_MAX - len);
if(feat)
- len += msnprintf(buf + len, TRC_LINE_MAX - len, "[%s] ", feat->name);
+ len += curl_msnprintf(buf + len, TRC_LINE_MAX - len, "[%s] ", feat->name);
if(opt_id) {
if(opt_id_idx > 0)
- len += msnprintf(buf + len, TRC_LINE_MAX - len, "[%s-%d] ",
- opt_id, opt_id_idx);
+ len += curl_msnprintf(buf + len, TRC_LINE_MAX - len, "[%s-%d] ",
+ opt_id, opt_id_idx);
else
- len += msnprintf(buf + len, TRC_LINE_MAX - len, "[%s] ", opt_id);
+ len += curl_msnprintf(buf + len, TRC_LINE_MAX - len, "[%s] ", opt_id);
}
- len += mvsnprintf(buf + len, TRC_LINE_MAX - len, fmt, ap);
+ len += curl_mvsnprintf(buf + len, TRC_LINE_MAX - len, fmt, ap);
len = trc_end_buf(buf, len, TRC_LINE_MAX, TRUE);
trc_write(data, CURLINFO_TEXT, buf, len);
}
#include "cw-out.h"
#include "cw-pause.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "sendf.h"
#include "cw-pause.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "escape.h"
#include "progress.h"
#include "dict.h"
-#include "curl_printf.h"
+
+/* The last 2 #include files should be: */
#include "curl_memory.h"
-/* The last #include file should be: */
#include "memdebug.h"
char *sptr;
va_list ap;
va_start(ap, fmt);
- s = vaprintf(fmt, ap); /* returns an allocated string */
+ s = curl_mvaprintf(fmt, ap); /* returns an allocated string */
va_end(ap);
if(!s)
return CURLE_OUT_OF_MEMORY; /* failure */
#include <openssl/crypto.h>
#endif
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "escape.h"
#include "urlapi-int.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
/* Only use HTTPS RR for HTTP(S) transfers */
char *qname = NULL;
if(port != PORT_HTTPS) {
- qname = aprintf("_%d._https.%s", port, hostname);
+ qname = curl_maprintf("_%d._https.%s", port, hostname);
if(!qname)
goto error;
}
len = sizeof(buffer) - len;
for(j = 0; j < 16; j += 2) {
size_t l;
- msnprintf(ptr, len, "%s%02x%02x", j ? ":" : "", d->addr[i].ip.v6[j],
- d->addr[i].ip.v6[j + 1]);
+ curl_msnprintf(ptr, len, "%s%02x%02x", j ? ":" : "",
+ d->addr[i].ip.v6[j],
+ d->addr[i].ip.v6[j + 1]);
l = strlen(ptr);
len -= l;
ptr += l;
#include "dynhds.h"
#include "strcase.h"
-/* The last 3 #include files should be in this order */
#ifdef USE_NGHTTP2
#include <stdint.h>
#include <nghttp2/nghttp2.h>
#endif /* USE_NGHTTP2 */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "easy_lock.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
}
if(Curl_trc_init()) {
- DEBUGF(fprintf(stderr, "Error: Curl_trc_init failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: Curl_trc_init failed\n"));
goto fail;
}
if(!Curl_ssl_init()) {
- DEBUGF(fprintf(stderr, "Error: Curl_ssl_init failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: Curl_ssl_init failed\n"));
goto fail;
}
if(!Curl_vquic_init()) {
- DEBUGF(fprintf(stderr, "Error: Curl_vquic_init failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: Curl_vquic_init failed\n"));
goto fail;
}
if(Curl_win32_init(flags)) {
- DEBUGF(fprintf(stderr, "Error: win32_init failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: win32_init failed\n"));
goto fail;
}
if(Curl_amiga_init()) {
- DEBUGF(fprintf(stderr, "Error: Curl_amiga_init failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: Curl_amiga_init failed\n"));
goto fail;
}
if(Curl_macos_init()) {
- DEBUGF(fprintf(stderr, "Error: Curl_macos_init failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: Curl_macos_init failed\n"));
goto fail;
}
if(Curl_async_global_init()) {
- DEBUGF(fprintf(stderr, "Error: resolver_global_init failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: resolver_global_init failed\n"));
goto fail;
}
if(Curl_ssh_init()) {
- DEBUGF(fprintf(stderr, "Error: Curl_ssh_init failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: Curl_ssh_init failed\n"));
goto fail;
}
result = global_init(CURL_GLOBAL_DEFAULT, TRUE);
if(result) {
/* something in the global init failed, return nothing */
- DEBUGF(fprintf(stderr, "Error: curl_global_init failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: curl_global_init failed\n"));
global_init_unlock();
return NULL;
}
/* We use curl_open() with undefined URL so far */
result = Curl_open(&data);
if(result) {
- DEBUGF(fprintf(stderr, "Error: Curl_open failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: Curl_open failed\n"));
return NULL;
}
struct events *ev = userp;
(void)multi;
#if DEBUG_EV_POLL
- fprintf(stderr, "events_timer: set timeout %ldms\n", timeout_ms);
+ curl_mfprintf(stderr, "events_timer: set timeout %ldms\n", timeout_ms);
#endif
ev->ms = timeout_ms;
ev->msbump = TRUE;
f->events = m->socket.events;
f->revents = 0;
#if DEBUG_EV_POLL
- fprintf(stderr, "poll() %d check socket %d\n", numfds, f->fd);
+ curl_mfprintf(stderr, "poll() %d check socket %d\n", numfds, f->fd);
#endif
f++;
numfds++;
if(numfds) {
/* wait for activity or timeout */
#if DEBUG_EV_POLL
- fprintf(stderr, "poll(numfds=%u, timeout=%ldms)\n", numfds, ev->ms);
+ curl_mfprintf(stderr, "poll(numfds=%u, timeout=%ldms)\n", numfds, ev->ms);
#endif
*pollrc = Curl_poll(fds, numfds, ev->ms);
#if DEBUG_EV_POLL
- fprintf(stderr, "poll(numfds=%u, timeout=%ldms) -> %d\n",
- numfds, ev->ms, *pollrc);
+ curl_mfprintf(stderr, "poll(numfds=%u, timeout=%ldms) -> %d\n",
+ numfds, ev->ms, *pollrc);
#endif
if(*pollrc < 0)
return CURLE_UNRECOVERABLE_POLL;
}
else {
#if DEBUG_EV_POLL
- fprintf(stderr, "poll, but no fds, wait timeout=%ldms\n", ev->ms);
+ curl_mfprintf(stderr, "poll, but no fds, wait timeout=%ldms\n", ev->ms);
#endif
*pollrc = 0;
if(ev->ms > 0)
if(!pollrc) {
/* timeout! */
ev->ms = 0;
- /* fprintf(stderr, "call curl_multi_socket_action(TIMEOUT)\n"); */
+ /* curl_mfprintf(stderr, "call curl_multi_socket_action(TIMEOUT)\n"); */
mcode = curl_multi_socket_action(multi, CURL_SOCKET_TIMEOUT, 0,
&ev->running_handles);
}
timediff_t timediff = curlx_timediff(curlx_now(), before);
if(timediff > 0) {
#if DEBUG_EV_POLL
- fprintf(stderr, "poll timeout %ldms not updated, decrease by "
- "time spent %ldms\n", ev->ms, (long)timediff);
+ curl_mfprintf(stderr, "poll timeout %ldms not updated, decrease by "
+ "time spent %ldms\n", ev->ms, (long)timediff);
#endif
if(timediff > ev->ms)
ev->ms = 0;
#include "escape.h"
#include "strdup.h"
#include "curlx/strparse.h"
-
-/* The last 3 #include files should be in this order */
#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include <stdlib.h>
#include <ares.h>
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
if(env) {
rc = ares_set_servers_ports_csv(channel, env);
if(rc) {
- fprintf(stderr, "ares_set_servers_ports_csv failed: %d", rc);
+ curl_mfprintf(stderr, "ares_set_servers_ports_csv failed: %d", rc);
/* Cleanup */
ares_destroy(channel);
return EAI_MEMORY; /* we can't run */
#include "curlx/fopen.h"
#include "curlx/warnless.h"
#include "curl_range.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
static const char accept_ranges[]= { "Accept-ranges: bytes\r\n" };
if(expected_size >= 0) {
headerlen =
- msnprintf(header, sizeof(header), "Content-Length: %" FMT_OFF_T "\r\n",
- expected_size);
+ curl_msnprintf(header, sizeof(header),
+ "Content-Length: %" FMT_OFF_T "\r\n", expected_size);
result = Curl_client_write(data, CLIENTWRITE_HEADER, header, headerlen);
if(result)
return result;
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
headerlen =
- msnprintf(header, sizeof(header),
- "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
- Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
- tm->tm_mday,
- Curl_month[tm->tm_mon],
- tm->tm_year + 1900,
- tm->tm_hour,
- tm->tm_min,
- tm->tm_sec);
+ curl_msnprintf(header, sizeof(header),
+ "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
+ Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
+ tm->tm_mday,
+ Curl_month[tm->tm_mon],
+ tm->tm_year + 1900,
+ tm->tm_hour,
+ tm->tm_min,
+ tm->tm_sec);
result = Curl_client_write(data, CLIENTWRITE_HEADER, header, headerlen);
if(!result)
/* end of headers */
#include "strdup.h"
#include "rand.h"
#include "curlx/warnless.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "strdup.h"
#include "curlx/strerr.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
source++;
}
*dest = 0;
- msnprintf(dest, 20, ",%d,%d", (int)(port >> 8), (int)(port & 0xff));
+ curl_msnprintf(dest, 20, ",%d,%d", (int)(port >> 8), (int)(port & 0xff));
result = Curl_pp_sendf(data, &ftpc->pp, "%s %s", mode[fcmd], target);
if(result) {
}
}
- cmd = aprintf("%s%s%.*s",
- data->set.str[STRING_CUSTOMREQUEST] ?
- data->set.str[STRING_CUSTOMREQUEST] :
- (data->state.list_only ? "NLST" : "LIST"),
- lstArg ? " " : "",
- lstArglen, lstArg ? lstArg : "");
+ cmd = curl_maprintf("%s%s%.*s",
+ data->set.str[STRING_CUSTOMREQUEST] ?
+ data->set.str[STRING_CUSTOMREQUEST] :
+ (data->state.list_only ? "NLST" : "LIST"),
+ lstArg ? " " : "",
+ lstArglen, lstArg ? lstArg : "");
if(!cmd)
return CURLE_OUT_OF_MEMORY;
ftpc->newhost = control_address_dup(data, conn);
}
else
- ftpc->newhost = aprintf("%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]);
+ ftpc->newhost = curl_maprintf("%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]);
if(!ftpc->newhost)
return CURLE_OUT_OF_MEMORY;
if(ftp_213_date(resp, &year, &month, &day, &hour, &minute, &second)) {
/* we have a time, reformat it */
char timebuf[24];
- msnprintf(timebuf, sizeof(timebuf),
- "%04d%02d%02d %02d:%02d:%02d GMT",
- year, month, day, hour, minute, second);
+ curl_msnprintf(timebuf, sizeof(timebuf),
+ "%04d%02d%02d %02d:%02d:%02d GMT",
+ year, month, day, hour, minute, second);
/* now, convert this into a time() value: */
if(!Curl_getdate_capped(timebuf, &data->info.filetime))
showtime = TRUE;
/* format: "Tue, 15 Nov 1994 12:45:26" */
headerbuflen =
- msnprintf(headerbuf, sizeof(headerbuf),
- "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
- Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
- tm->tm_mday,
- Curl_month[tm->tm_mon],
- tm->tm_year + 1900,
- tm->tm_hour,
- tm->tm_min,
- tm->tm_sec);
+ curl_msnprintf(headerbuf, sizeof(headerbuf),
+ "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d "
+ "GMT\r\n",
+ Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
+ tm->tm_mday,
+ Curl_month[tm->tm_mon],
+ tm->tm_year + 1900,
+ tm->tm_hour,
+ tm->tm_min,
+ tm->tm_sec);
result = client_write_header(data, headerbuf, headerbuflen);
if(result)
return result;
#ifdef CURL_FTP_HTTPSTYLE_HEAD
if(filesize != -1) {
char clbuf[128];
- int clbuflen = msnprintf(clbuf, sizeof(clbuf),
- "Content-Length: %" FMT_OFF_T "\r\n", filesize);
+ int clbuflen = curl_msnprintf(clbuf, sizeof(clbuf),
+ "Content-Length: %" FMT_OFF_T "\r\n",
+ filesize);
result = client_write_header(data, clbuf, clbuflen);
if(result)
return result;
struct Curl_llist_node *head = Curl_llist_head(&wildcard->filelist);
struct curl_fileinfo *finfo = Curl_node_elem(head);
- char *tmp_path = aprintf("%s%s", wildcard->path, finfo->filename);
+ char *tmp_path = curl_maprintf("%s%s", wildcard->path, finfo->filename);
if(!tmp_path)
return CURLE_OUT_OF_MEMORY;
#include "multiif.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "url.h"
#include "escape.h"
#include "curlx/warnless.h"
-#include "curl_printf.h"
+
+/* The last 2 #include files should be: */
#include "curl_memory.h"
-/* The last #include file should be: */
#include "memdebug.h"
/*
DEBUGASSERT(path);
if(query)
- gopherpath = aprintf("%s?%s", path, query);
+ gopherpath = curl_maprintf("%s?%s", path, query);
else
gopherpath = strdup(path);
if(!h)
return;
- fprintf(stderr, "=Hash dump=\n");
+ curl_mfprintf(stderr, "=Hash dump=\n");
Curl_hash_start_iterate(h, &iter);
he = Curl_hash_next_element(&iter);
while(he) {
if(iter.slot_index != last_index) {
- fprintf(stderr, "index %d:", (int)iter.slot_index);
+ curl_mfprintf(stderr, "index %d:", (int)iter.slot_index);
if(last_index != UINT_MAX) {
- fprintf(stderr, "\n");
+ curl_mfprintf(stderr, "\n");
}
last_index = iter.slot_index;
}
if(func)
func(he->ptr);
else
- fprintf(stderr, " [key=%.*s, he=%p, ptr=%p]",
- (int)he->key_len, (char *)he->key,
- (void *)he, (void *)he->ptr);
+ curl_mfprintf(stderr, " [key=%.*s, he=%p, ptr=%p]",
+ (int)he->key_len, (char *)he->key,
+ (void *)he, (void *)he->ptr);
he = Curl_hash_next_element(&iter);
}
- fprintf(stderr, "\n");
+ curl_mfprintf(stderr, "\n");
}
#endif
#include "headers.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "easy_lock.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
len = buflen - 7;
/* store and lower case the name */
Curl_strntolower(ptr, name, len);
- return msnprintf(&ptr[len], 7, ":%u", port) + len;
+ return curl_msnprintf(&ptr[len], 7, ":%u", port) + len;
}
struct dnscache_prune_data {
#include "hash.h"
#include "share.h"
#include "url.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
hints.ai_family = PF_INET;
hints.ai_socktype = SOCK_STREAM;
if(port) {
- msnprintf(sbuf, sizeof(sbuf), "%d", port);
+ curl_msnprintf(sbuf, sizeof(sbuf), "%d", port);
sbufptr = sbuf;
}
#include "url.h"
#include "curlx/inet_pton.h"
#include "connect.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#ifdef DEBUG_ADDRINFO
static void dump_addrinfo(const struct Curl_addrinfo *ai)
{
- printf("dump_addrinfo:\n");
+ curl_mprintf("dump_addrinfo:\n");
for(; ai; ai = ai->ai_next) {
char buf[INET6_ADDRSTRLEN];
- printf(" fam %2d, CNAME %s, ",
- ai->ai_family, ai->ai_canonname ? ai->ai_canonname : "<none>");
+ curl_mprintf(" fam %2d, CNAME %s, ",
+ ai->ai_family,
+ ai->ai_canonname ? ai->ai_canonname : "<none>");
Curl_printable_address(ai, buf, sizeof(buf));
- printf("%s\n", buf);
+ curl_mprintf("%s\n", buf);
}
}
#else
#endif
if(port) {
- msnprintf(sbuf, sizeof(sbuf), "%d", port);
+ curl_msnprintf(sbuf, sizeof(sbuf), "%d", port);
sbufptr = sbuf;
}
#include "strdup.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
if(result)
return result;
- msnprintf(e.expire, sizeof(e.expire), "%d%02d%02d %02d:%02d:%02d",
- stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
- stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
+ curl_msnprintf(e.expire, sizeof(e.expire), "%d%02d%02d %02d:%02d:%02d",
+ stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
+ stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
}
else
strcpy(e.expire, UNLIMITED);
CURLcode result = Curl_gmtime((time_t)sts->expires, &stamp);
if(result)
return result;
- fprintf(fp, "%s%s \"%d%02d%02d %02d:%02d:%02d\"\n",
- sts->includeSubDomains ? ".": "", sts->host,
- stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
- stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
+ curl_mfprintf(fp, "%s%s \"%d%02d%02d %02d:%02d:%02d\"\n",
+ sts->includeSubDomains ? ".": "", sts->host,
+ stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
+ stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
}
else
- fprintf(fp, "%s%s \"%s\"\n",
- sts->includeSubDomains ? ".": "", sts->host, UNLIMITED);
+ curl_mfprintf(fp, "%s%s \"%s\"\n",
+ sts->includeSubDomains ? ".": "", sts->host, UNLIMITED);
return CURLE_OK;
}
#include "curl_ctype.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
pwd = data->state.aptr.passwd;
}
- out = aprintf("%s:%s", user ? user : "", pwd ? pwd : "");
+ out = curl_maprintf("%s:%s", user ? user : "", pwd ? pwd : "");
if(!out)
return CURLE_OUT_OF_MEMORY;
}
free(*userp);
- *userp = aprintf("%sAuthorization: Basic %s\r\n",
- proxy ? "Proxy-" : "",
- authorization);
+ *userp = curl_maprintf("%sAuthorization: Basic %s\r\n",
+ proxy ? "Proxy-" : "",
+ authorization);
free(authorization);
if(!*userp) {
result = CURLE_OUT_OF_MEMORY;
userp = &data->state.aptr.userpwd;
free(*userp);
- *userp = aprintf("Authorization: Bearer %s\r\n",
- data->set.str[STRING_BEARER]);
+ *userp = curl_maprintf("Authorization: Bearer %s\r\n",
+ data->set.str[STRING_BEARER]);
if(!*userp) {
result = CURLE_OUT_OF_MEMORY;
*/
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
- msnprintf(datestr, sizeof(datestr),
- "%s: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
- condp,
- Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
- tm->tm_mday,
- Curl_month[tm->tm_mon],
- tm->tm_year + 1900,
- tm->tm_hour,
- tm->tm_min,
- tm->tm_sec);
+ curl_msnprintf(datestr, sizeof(datestr),
+ "%s: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
+ condp,
+ Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
+ tm->tm_mday,
+ Curl_month[tm->tm_mon],
+ tm->tm_year + 1900,
+ tm->tm_hour,
+ tm->tm_min,
+ tm->tm_sec);
result = curlx_dyn_add(req, datestr);
return result;
#endif
if(!curl_strequal("Host:", ptr)) {
- aptr->host = aprintf("Host:%s\r\n", &ptr[5]);
+ aptr->host = curl_maprintf("Host:%s\r\n", &ptr[5]);
if(!aptr->host)
return CURLE_OUT_OF_MEMORY;
}
(conn->remote_port == PORT_HTTP)) )
/* if(HTTPS on port 443) OR (HTTP on port 80) then do not include
the port number in the host string */
- aptr->host = aprintf("Host: %s%s%s\r\n", conn->bits.ipv6_ip ? "[" : "",
- host, conn->bits.ipv6_ip ? "]" : "");
+ aptr->host = curl_maprintf("Host: %s%s%s\r\n",
+ conn->bits.ipv6_ip ? "[" : "",
+ host, conn->bits.ipv6_ip ? "]" : "");
else
- aptr->host = aprintf("Host: %s%s%s:%d\r\n",
- conn->bits.ipv6_ip ? "[" : "",
- host, conn->bits.ipv6_ip ? "]" : "",
- conn->remote_port);
+ aptr->host = curl_maprintf("Host: %s%s%s:%d\r\n",
+ conn->bits.ipv6_ip ? "[" : "",
+ host, conn->bits.ipv6_ip ? "]" : "",
+ conn->remote_port);
if(!aptr->host)
/* without Host: we cannot make a nice request */
!Curl_checkheaders(data, STRCONST("Range"))) {
/* if a line like this was already allocated, free the previous one */
free(data->state.aptr.rangeline);
- data->state.aptr.rangeline = aprintf("Range: bytes=%s\r\n",
- data->state.range);
+ data->state.aptr.rangeline = curl_maprintf("Range: bytes=%s\r\n",
+ data->state.range);
}
else if((httpreq == HTTPREQ_POST || httpreq == HTTPREQ_PUT) &&
!Curl_checkheaders(data, STRCONST("Content-Range"))) {
remote part so we tell the server (and act accordingly) that we
upload the whole file (again) */
data->state.aptr.rangeline =
- aprintf("Content-Range: bytes 0-%" FMT_OFF_T "/%" FMT_OFF_T "\r\n",
- req_clen - 1, req_clen);
+ curl_maprintf("Content-Range: bytes 0-%" FMT_OFF_T "/"
+ "%" FMT_OFF_T "\r\n", req_clen - 1, req_clen);
}
else if(data->state.resume_from) {
data->state.infilesize :
(data->state.resume_from + req_clen);
data->state.aptr.rangeline =
- aprintf("Content-Range: bytes %s%" FMT_OFF_T "/%" FMT_OFF_T "\r\n",
- data->state.range, total_len-1, total_len);
+ curl_maprintf("Content-Range: bytes %s%" FMT_OFF_T "/"
+ "%" FMT_OFF_T "\r\n",
+ data->state.range, total_len-1, total_len);
}
else {
/* Range was selected and then we just pass the incoming range and
append total size */
data->state.aptr.rangeline =
- aprintf("Content-Range: bytes %s/%" FMT_OFF_T "\r\n",
- data->state.range, req_clen);
+ curl_maprintf("Content-Range: bytes %s/%" FMT_OFF_T "\r\n",
+ data->state.range, req_clen);
}
if(!data->state.aptr.rangeline)
return CURLE_OUT_OF_MEMORY;
/* setup the authentication headers, how that method and host are known */
char *pq = NULL;
if(data->state.up.query) {
- pq = aprintf("%s?%s", data->state.up.path, data->state.up.query);
+ pq = curl_maprintf("%s?%s", data->state.up.path, data->state.up.query);
if(!pq)
return CURLE_OUT_OF_MEMORY;
}
#include "http1.h"
#include "urlapi-int.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "transfer.h"
#include "curlx/dynbuf.h"
#include "headers.h"
+
/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
void Curl_http2_ver(char *p, size_t len)
{
nghttp2_info *h2 = nghttp2_version(0);
- (void)msnprintf(p, len, "nghttp2/%s", h2->version_str);
+ (void)curl_msnprintf(p, len, "nghttp2/%s", h2->version_str);
}
static CURLcode nw_out_flush(struct Curl_cfilter *cf,
{
switch(frame->hd.type) {
case NGHTTP2_DATA: {
- return msnprintf(buffer, blen,
- "FRAME[DATA, len=%d, eos=%d, padlen=%d]",
- (int)frame->hd.length,
- !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM),
- (int)frame->data.padlen);
+ return curl_msnprintf(buffer, blen,
+ "FRAME[DATA, len=%d, eos=%d, padlen=%d]",
+ (int)frame->hd.length,
+ !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM),
+ (int)frame->data.padlen);
}
case NGHTTP2_HEADERS: {
- return msnprintf(buffer, blen,
- "FRAME[HEADERS, len=%d, hend=%d, eos=%d]",
- (int)frame->hd.length,
- !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS),
- !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM));
+ return curl_msnprintf(buffer, blen,
+ "FRAME[HEADERS, len=%d, hend=%d, eos=%d]",
+ (int)frame->hd.length,
+ !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS),
+ !!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM));
}
case NGHTTP2_PRIORITY: {
- return msnprintf(buffer, blen,
- "FRAME[PRIORITY, len=%d, flags=%d]",
- (int)frame->hd.length, frame->hd.flags);
+ return curl_msnprintf(buffer, blen,
+ "FRAME[PRIORITY, len=%d, flags=%d]",
+ (int)frame->hd.length, frame->hd.flags);
}
case NGHTTP2_RST_STREAM: {
- return msnprintf(buffer, blen,
- "FRAME[RST_STREAM, len=%d, flags=%d, error=%u]",
- (int)frame->hd.length, frame->hd.flags,
- frame->rst_stream.error_code);
+ return curl_msnprintf(buffer, blen,
+ "FRAME[RST_STREAM, len=%d, flags=%d, error=%u]",
+ (int)frame->hd.length, frame->hd.flags,
+ frame->rst_stream.error_code);
}
case NGHTTP2_SETTINGS: {
if(frame->hd.flags & NGHTTP2_FLAG_ACK) {
- return msnprintf(buffer, blen, "FRAME[SETTINGS, ack=1]");
+ return curl_msnprintf(buffer, blen, "FRAME[SETTINGS, ack=1]");
}
- return msnprintf(buffer, blen,
- "FRAME[SETTINGS, len=%d]", (int)frame->hd.length);
+ return curl_msnprintf(buffer, blen,
+ "FRAME[SETTINGS, len=%d]", (int)frame->hd.length);
}
case NGHTTP2_PUSH_PROMISE: {
- return msnprintf(buffer, blen,
- "FRAME[PUSH_PROMISE, len=%d, hend=%d]",
- (int)frame->hd.length,
- !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS));
+ return curl_msnprintf(buffer, blen,
+ "FRAME[PUSH_PROMISE, len=%d, hend=%d]",
+ (int)frame->hd.length,
+ !!(frame->hd.flags & NGHTTP2_FLAG_END_HEADERS));
}
case NGHTTP2_PING: {
- return msnprintf(buffer, blen,
- "FRAME[PING, len=%d, ack=%d]",
- (int)frame->hd.length,
- frame->hd.flags&NGHTTP2_FLAG_ACK);
+ return curl_msnprintf(buffer, blen,
+ "FRAME[PING, len=%d, ack=%d]",
+ (int)frame->hd.length,
+ frame->hd.flags&NGHTTP2_FLAG_ACK);
}
case NGHTTP2_GOAWAY: {
char scratch[128];
if(len)
memcpy(scratch, frame->goaway.opaque_data, len);
scratch[len] = '\0';
- return msnprintf(buffer, blen, "FRAME[GOAWAY, error=%d, reason='%s', "
- "last_stream=%d]", frame->goaway.error_code,
- scratch, frame->goaway.last_stream_id);
+ return curl_msnprintf(buffer, blen,
+ "FRAME[GOAWAY, error=%d, reason='%s', "
+ "last_stream=%d]", frame->goaway.error_code,
+ scratch, frame->goaway.last_stream_id);
}
case NGHTTP2_WINDOW_UPDATE: {
- return msnprintf(buffer, blen,
- "FRAME[WINDOW_UPDATE, incr=%d]",
- frame->window_update.window_size_increment);
+ return curl_msnprintf(buffer, blen,
+ "FRAME[WINDOW_UPDATE, incr=%d]",
+ frame->window_update.window_size_increment);
}
default:
- return msnprintf(buffer, blen, "FRAME[%d, len=%d, flags=%d]",
- frame->hd.type, (int)frame->hd.length,
- frame->hd.flags);
+ return curl_msnprintf(buffer, blen, "FRAME[%d, len=%d, flags=%d]",
+ frame->hd.type, (int)frame->hd.length,
+ frame->hd.flags);
}
}
if(!strcmp(HTTP_PSEUDO_AUTHORITY, (const char *)name)) {
/* pseudo headers are lower case */
int rc = 0;
- char *check = aprintf("%s:%d", cf->conn->host.name,
- cf->conn->remote_port);
+ char *check = curl_maprintf("%s:%d", cf->conn->host.name,
+ cf->conn->remote_port);
if(!check)
/* no memory */
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
stream->push_headers = headp;
}
- h = aprintf("%s:%s", name, value);
+ h = curl_maprintf("%s:%s", name, value);
if(h)
stream->push_headers[stream->push_headers_used++] = h;
return 0;
cf_h2_header_error(cf, data_s, stream, result);
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
- msnprintf(buffer, sizeof(buffer), HTTP_PSEUDO_STATUS ":%u\r",
- stream->status_code);
+ curl_msnprintf(buffer, sizeof(buffer), HTTP_PSEUDO_STATUS ":%u\r",
+ stream->status_code);
result = Curl_headers_push(data_s, buffer, CURLH_PSEUDO);
if(result) {
cf_h2_header_error(cf, data_s, stream, result);
#include <time.h>
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
struct curl_slist *l;
bool again = TRUE;
- msnprintf(date_hdr_key, DATE_HDR_KEY_LEN, "X-%.*s-Date",
- (int)plen, provider1);
+ curl_msnprintf(date_hdr_key, DATE_HDR_KEY_LEN, "X-%.*s-Date",
+ (int)plen, provider1);
/* provider1 ucfirst */
Curl_strntolower(&date_hdr_key[2], provider1, plen);
date_hdr_key[2] = Curl_raw_toupper(provider1[0]);
- msnprintf(date_full_hdr, DATE_FULL_HDR_LEN,
- "x-%.*s-date:%s", (int)plen, provider1, timestamp);
+ curl_msnprintf(date_full_hdr, DATE_FULL_HDR_LEN,
+ "x-%.*s-date:%s", (int)plen, provider1, timestamp);
/* provider1 lowercase */
Curl_strntolower(&date_full_hdr[2], provider1, plen);
fullhost = Curl_memdup0(data->state.aptr.host, pos);
}
else
- fullhost = aprintf("host:%s", hostname);
+ fullhost = curl_maprintf("host:%s", hostname);
if(fullhost)
head = Curl_slist_append_nodup(NULL, fullhost);
if(!tmp_head)
goto fail;
head = tmp_head;
- *date_header = aprintf("%s: %s\r\n", date_hdr_key, timestamp);
+ *date_header = curl_maprintf("%s: %s\r\n", date_hdr_key, timestamp);
}
else {
const char *value;
const char *value;
size_t len;
- key_len = msnprintf(key, sizeof(key), "x-%.*s-content-sha256",
- (int)plen, provider1);
+ key_len = curl_msnprintf(key, sizeof(key), "x-%.*s-content-sha256",
+ (int)plen, provider1);
value = Curl_checkheaders(data, key, key_len);
if(!value)
}
/* format the required content-sha256 header */
- msnprintf(header, CONTENT_SHA256_HDR_LEN,
- "x-%.*s-content-sha256: %s", (int)plen, provider1, sha_hex);
+ curl_msnprintf(header, CONTENT_SHA256_HDR_LEN,
+ "x-%.*s-content-sha256: %s", (int)plen, provider1, sha_hex);
ret = CURLE_OK;
fail:
result = CURLE_OUT_OF_MEMORY;
canonical_request =
- aprintf("%s\n" /* HTTPRequestMethod */
- "%s\n" /* CanonicalURI */
- "%s\n" /* CanonicalQueryString */
- "%s\n" /* CanonicalHeaders */
- "%s\n" /* SignedHeaders */
- "%.*s", /* HashedRequestPayload in hex */
- method,
- curlx_dyn_ptr(&canonical_path),
- curlx_dyn_ptr(&canonical_query) ?
- curlx_dyn_ptr(&canonical_query) : "",
- curlx_dyn_ptr(&canonical_headers),
- curlx_dyn_ptr(&signed_headers),
- (int)payload_hash_len, payload_hash);
+ curl_maprintf("%s\n" /* HTTPRequestMethod */
+ "%s\n" /* CanonicalURI */
+ "%s\n" /* CanonicalQueryString */
+ "%s\n" /* CanonicalHeaders */
+ "%s\n" /* SignedHeaders */
+ "%.*s", /* HashedRequestPayload in hex */
+ method,
+ curlx_dyn_ptr(&canonical_path),
+ curlx_dyn_ptr(&canonical_query) ?
+ curlx_dyn_ptr(&canonical_query) : "",
+ curlx_dyn_ptr(&canonical_headers),
+ curlx_dyn_ptr(&signed_headers),
+ (int)payload_hash_len, payload_hash);
if(!canonical_request)
goto fail;
infof(data, "aws_sigv4: Canonical request (enclosed in []) - [%s]",
canonical_request);
- request_type = aprintf("%.*s4_request",
- (int)curlx_strlen(&provider0), curlx_str(&provider0));
+ request_type = curl_maprintf("%.*s4_request",
+ (int)curlx_strlen(&provider0),
+ curlx_str(&provider0));
if(!request_type)
goto fail;
- /* provider0 is lowercased *after* aprintf() so that the buffer can be
- written to */
+ /* provider0 is lowercased *after* curl_maprintf() so that the buffer
+ can be written to */
Curl_strntolower(request_type, request_type, curlx_strlen(&provider0));
- credential_scope = aprintf("%s/%.*s/%.*s/%s", date,
- (int)curlx_strlen(®ion), curlx_str(®ion),
- (int)curlx_strlen(&service), curlx_str(&service),
- request_type);
+ credential_scope = curl_maprintf("%s/%.*s/%.*s/%s", date,
+ (int)curlx_strlen(®ion),
+ curlx_str(®ion),
+ (int)curlx_strlen(&service),
+ curlx_str(&service),
+ request_type);
if(!credential_scope)
goto fail;
* Google allows using RSA key instead of HMAC, so this code might change
* in the future. For now we only support HMAC.
*/
- str_to_sign = aprintf("%.*s4-HMAC-SHA256\n" /* Algorithm */
- "%s\n" /* RequestDateTime */
- "%s\n" /* CredentialScope */
- "%s", /* HashedCanonicalRequest in hex */
- (int)curlx_strlen(&provider0), curlx_str(&provider0),
- timestamp,
- credential_scope,
- sha_hex);
+ str_to_sign = curl_maprintf("%.*s4-HMAC-SHA256\n" /* Algorithm */
+ "%s\n" /* RequestDateTime */
+ "%s\n" /* CredentialScope */
+ "%s", /* HashedCanonicalRequest in hex */
+ (int)curlx_strlen(&provider0),
+ curlx_str(&provider0),
+ timestamp,
+ credential_scope,
+ sha_hex);
if(!str_to_sign)
goto fail;
infof(data, "aws_sigv4: String to sign (enclosed in []) - [%s]",
str_to_sign);
- secret = aprintf("%.*s4%s", (int)curlx_strlen(&provider0),
- curlx_str(&provider0), data->state.aptr.passwd ?
- data->state.aptr.passwd : "");
+ secret = curl_maprintf("%.*s4%s", (int)curlx_strlen(&provider0),
+ curlx_str(&provider0), data->state.aptr.passwd ?
+ data->state.aptr.passwd : "");
if(!secret)
goto fail;
/* make provider0 part done uppercase */
infof(data, "aws_sigv4: Signature - %s", sha_hex);
- auth_headers = aprintf("Authorization: %.*s4-HMAC-SHA256 "
- "Credential=%s/%s, "
- "SignedHeaders=%s, "
- "Signature=%s\r\n"
- /*
- * date_header is added here, only if it was not
- * user-specified (using CURLOPT_HTTPHEADER).
- * date_header includes \r\n
- */
- "%s"
- "%s", /* optional sha256 header includes \r\n */
- (int)curlx_strlen(&provider0), curlx_str(&provider0),
- user,
- credential_scope,
- curlx_dyn_ptr(&signed_headers),
- sha_hex,
- date_header ? date_header : "",
- content_sha256_hdr);
+ auth_headers = curl_maprintf("Authorization: %.*s4-HMAC-SHA256 "
+ "Credential=%s/%s, "
+ "SignedHeaders=%s, "
+ "Signature=%s\r\n"
+ /*
+ * date_header is added here, only if it was not
+ * user-specified (using CURLOPT_HTTPHEADER).
+ * date_header includes \r\n
+ */
+ "%s"
+ "%s", /* optional sha256 header includes \r\n */
+ (int)curlx_strlen(&provider0),
+ curlx_str(&provider0),
+ user,
+ credential_scope,
+ curlx_dyn_ptr(&signed_headers),
+ sha_hex,
+ date_header ? date_header : "",
+ content_sha256_hdr);
if(!auth_headers) {
goto fail;
}
#ifndef CURL_DISABLE_HTTP
#include "urldata.h" /* it includes http_chunks.h */
-#include "curl_printf.h"
#include "curl_trc.h"
#include "sendf.h" /* for the client write stuff */
#include "curlx/dynbuf.h"
int hdlen;
size_t n;
- hdlen = msnprintf(hd, sizeof(hd), "%zx\r\n", nread);
+ hdlen = curl_msnprintf(hd, sizeof(hd), "%zx\r\n", nread);
if(hdlen <= 0)
return CURLE_READ_ERROR;
/* On a soft-limited bufq, we do not need to check that all was written */
#include "http_digest.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
if(tmp) {
size_t urilen = tmp - (const char *)uripath;
/* typecast is fine here since the value is always less than 32 bits */
- path = (unsigned char *) aprintf("%.*s", (int)urilen, uripath);
+ path = (unsigned char *)curl_maprintf("%.*s", (int)urilen, uripath);
}
}
if(!tmp)
- path = (unsigned char *) strdup((const char *) uripath);
+ path = (unsigned char *)strdup((const char *) uripath);
if(!path)
return CURLE_OUT_OF_MEMORY;
if(result)
return result;
- *allocuserpwd = aprintf("%sAuthorization: Digest %s\r\n",
- proxy ? "Proxy-" : "",
- response);
+ *allocuserpwd = curl_maprintf("%sAuthorization: Digest %s\r\n",
+ proxy ? "Proxy-" : "", response);
free(response);
if(!*allocuserpwd)
return CURLE_OUT_OF_MEMORY;
#include "vtls/vtls.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
if(result)
return result;
- userp = aprintf("%sAuthorization: Negotiate %s\r\n", proxy ? "Proxy-" : "",
- base64);
+ userp = curl_maprintf("%sAuthorization: Negotiate %s\r\n",
+ proxy ? "Proxy-" : "", base64);
if(proxy) {
#ifndef CURL_DISABLE_PROXY
#include "curl_sspi.h"
#endif
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
Curl_bufref_len(&ntlmmsg), &base64, &len);
if(!result) {
free(*allocuserpwd);
- *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n",
- proxy ? "Proxy-" : "",
- base64);
+ *allocuserpwd = curl_maprintf("%sAuthorization: NTLM %s\r\n",
+ proxy ? "Proxy-" : "",
+ base64);
free(base64);
if(!*allocuserpwd)
result = CURLE_OUT_OF_MEMORY;
Curl_bufref_len(&ntlmmsg), &base64, &len);
if(!result) {
free(*allocuserpwd);
- *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n",
- proxy ? "Proxy-" : "",
- base64);
+ *allocuserpwd = curl_maprintf("%sAuthorization: NTLM %s\r\n",
+ proxy ? "Proxy-" : "",
+ base64);
free(base64);
if(!*allocuserpwd)
result = CURLE_OUT_OF_MEMORY;
#include "vauth/vauth.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
if(result)
goto out;
- authority = aprintf("%s%s%s:%d", ipv6_ip ? "[" : "", hostname,
- ipv6_ip ?"]" : "", port);
+ authority = curl_maprintf("%s%s%s:%d", ipv6_ip ? "[" : "", hostname,
+ ipv6_ip ?"]" : "", port);
if(!authority) {
result = CURLE_OUT_OF_MEMORY;
goto out;
#include "sendf.h"
#include "strdup.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#endif
#endif /* USE_LIBIDN2 */
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "curlx/inet_ntop.h"
#include "if2ip.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
}
if(scopeid)
- msnprintf(scope, sizeof(scope), "%%%u", scopeid);
+ curl_msnprintf(scope, sizeof(scope), "%%%u", scopeid);
#endif
}
else
&((struct sockaddr_in *)(void *)iface->ifa_addr)->sin_addr;
res = IF2IP_FOUND;
ip = curlx_inet_ntop(af, addr, ipstr, sizeof(ipstr));
- msnprintf(buf, buf_size, "%s%s", ip, scope);
+ curl_msnprintf(buf, buf_size, "%s%s", ip, scope);
break;
}
}
#include "curlx/warnless.h"
#include "curl_ctype.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
DEBUGASSERT(fmt);
/* Calculate the tag based on the connection ID and command ID */
- msnprintf(imapc->resptag, sizeof(imapc->resptag), "%c%03d",
- 'A' + curlx_sltosi((long)(data->conn->connection_id % 26)),
- ++imapc->cmdid);
+ curl_msnprintf(imapc->resptag, sizeof(imapc->resptag), "%c%03d",
+ 'A' + curlx_sltosi((long)(data->conn->connection_id % 26)),
+ ++imapc->cmdid);
/* start with a blank buffer */
curlx_dyn_reset(&imapc->dyn);
#include "curlx/multibyte.h"
#include "curlx/base64.h"
#include "connect.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
return;
va_start(args, fmt);
- vfprintf(stderr, fmt, args);
+ curl_mvfprintf(stderr, fmt, args);
va_end(args);
}
#endif /* DEBUG_LDAP */
#include <mbedtls/md4.h>
#endif
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include <wincrypt.h>
#endif
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "urldata.h"
#include "curlx/fopen.h" /* for CURLX_FOPEN_LOW() */
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
curl_dbg_log("LIMIT %s:%d %s reached memlimit\n",
source, line, func);
/* log to stderr also */
- fprintf(stderr, "LIMIT %s:%d %s reached memlimit\n",
- source, line, func);
+ curl_mfprintf(stderr, "LIMIT %s:%d %s reached memlimit\n",
+ source, line, func);
fflush(curl_dbg_logfile); /* because it might crash now */
/* !checksrc! disable ERRNOVAR 1 */
CURL_SETERRNO(ENOMEM);
return;
va_start(ap, format);
- nchars = mvsnprintf(buf, sizeof(buf), format, ap);
+ nchars = curl_mvsnprintf(buf, sizeof(buf), format, ap);
va_end(ap);
if(nchars > (int)sizeof(buf) - 1)
#include "rand.h"
#include "slist.h"
#include "curlx/dynbuf.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
va_list ap;
va_start(ap, fmt);
- s = vaprintf(fmt, ap);
+ s = curl_mvaprintf(fmt, ap);
va_end(ap);
if(s) {
#include "url.h"
#include "escape.h"
#include "curlx/warnless.h"
-#include "curl_printf.h"
-#include "curl_memory.h"
#include "multiif.h"
#include "rand.h"
-/* The last #include file should be: */
+/* The last 2 #includes file should be: */
+#include "curl_memory.h"
#include "memdebug.h"
/* first byte is command.
#include "socketpair.h"
#include "socks.h"
#include "urlapi-int.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
{
struct Curl_sh_entry *sh = (struct Curl_sh_entry *)p;
- fprintf(stderr, " [readers %u][writers %u]",
- sh->readers, sh->writers);
+ curl_mfprintf(stderr, " [readers %u][writers %u]",
+ sh->readers, sh->writers);
}
#endif
(void)multi;
if(!data) {
- fprintf(stderr, "mid=%u, entry=NULL, bug in xfer table?\n", mid);
+ curl_mfprintf(stderr, "mid=%u, entry=NULL, bug in xfer table?\n", mid);
}
else {
- fprintf(stderr, "mid=%u, magic=%s, p=%p, id=%" FMT_OFF_T ", url=%s\n",
- mid, (data->magic == CURLEASY_MAGIC_NUMBER) ? "GOOD" : "BAD!",
- (void *)data, data->id, data->state.url);
+ curl_mfprintf(stderr, "mid=%u, magic=%s, p=%p, id=%" FMT_OFF_T
+ ", url=%s\n",
+ mid,
+ (data->magic == CURLEASY_MAGIC_NUMBER) ? "GOOD" : "BAD!",
+ (void *)data, data->id, data->state.url);
}
}
{
unsigned int mid;
void *entry;
- fprintf(stderr, "=== multi xfer table (count=%u, capacity=%u\n",
- Curl_uint_tbl_count(&multi->xfers),
- Curl_uint_tbl_capacity(&multi->xfers));
+ curl_mfprintf(stderr, "=== multi xfer table (count=%u, capacity=%u\n",
+ Curl_uint_tbl_count(&multi->xfers),
+ Curl_uint_tbl_capacity(&multi->xfers));
if(Curl_uint_tbl_first(&multi->xfers, &mid, &entry)) {
multi_xfer_dump(multi, mid, entry);
while(Curl_uint_tbl_next(&multi->xfers, mid, &mid, &entry))
multi_xfer_dump(multi, mid, entry);
}
- fprintf(stderr, "===\n");
+ curl_mfprintf(stderr, "===\n");
fflush(stderr);
}
#endif /* DEBUGBUILD */
#include "curlx/warnless.h"
#include "multihandle.h"
#include "socks.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "curlx/fopen.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
return NETRC_FILE_MISSING; /* no home directory found (or possibly out
of memory) */
- filealloc = aprintf("%s%s.netrc", home, DIR_CHAR);
+ filealloc = curl_maprintf("%s%s.netrc", home, DIR_CHAR);
if(!filealloc) {
free(homea);
return NETRC_OUT_OF_MEMORY;
#ifdef _WIN32
if(retcode == NETRC_FILE_MISSING) {
/* fallback to the old-style "_netrc" file */
- filealloc = aprintf("%s%s_netrc", home, DIR_CHAR);
+ filealloc = curl_maprintf("%s%s_netrc", home, DIR_CHAR);
if(!filealloc) {
free(homea);
return NETRC_OUT_OF_MEMORY;
unsigned int haddr = htonl(address);
unsigned int hcheck = htonl(check);
#if 0
- fprintf(stderr, "Host %s (%x) network %s (%x) bits %u mask %x => %x\n",
- ipv4, haddr, network, hcheck, bits, mask,
- (haddr ^ hcheck) & mask);
+ curl_mfprintf(stderr, "Host %s (%x) network %s (%x) "
+ "bits %u mask %x => %x\n",
+ ipv4, haddr, network, hcheck, bits, mask,
+ (haddr ^ hcheck) & mask);
#endif
if((haddr ^ hcheck) & mask)
return FALSE;
#include "connect.h"
#include "curl_sasl.h"
#include "strcase.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
if(result)
goto out;
- hosturl = aprintf("%s://%s%s%s:%d",
- conn->handler->scheme,
- conn->bits.ipv6_ip ? "[" : "",
- conn->host.name,
- conn->bits.ipv6_ip ? "]" : "",
- conn->remote_port);
+ hosturl = curl_maprintf("%s://%s%s%s:%d",
+ conn->handler->scheme,
+ conn->bits.ipv6_ip ? "[" : "",
+ conn->host.name,
+ conn->bits.ipv6_ip ? "]" : "",
+ conn->remote_port);
if(!hosturl) {
result = CURLE_OUT_OF_MEMORY;
goto out;
#include "vtls/vtls.h"
#include "strdup.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "curl_md5.h"
#include "curlx/warnless.h"
#include "strdup.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
/* Convert the calculated 16 octet digest into a 32 byte hex string */
for(i = 0; i < MD5_DIGEST_LEN; i++)
- msnprintf(&secret[2 * i], 3, "%02x", digest[i]);
+ curl_msnprintf(&secret[2 * i], 3, "%02x", digest[i]);
result = Curl_pp_sendf(data, &pop3c->pp, "APOP %s %s", conn->user, secret);
#include "multiif.h"
#include "progress.h"
#include "curlx/timeval.h"
-#include "curl_printf.h"
/* check rate limits within this many recent milliseconds, at minimum. */
#define MIN_RATE_LIMIT_PERIOD 3000
if(h <= 99) {
curl_off_t m = (seconds - (h * 3600)) / 60;
curl_off_t s = (seconds - (h * 3600)) - (m * 60);
- msnprintf(r, 9, "%2" FMT_OFF_T ":%02" FMT_OFF_T ":%02" FMT_OFF_T, h, m, s);
+ curl_msnprintf(r, 9, "%2" FMT_OFF_T ":%02" FMT_OFF_T ":%02" FMT_OFF_T,
+ h, m, s);
}
else {
/* this equals to more than 99 hours, switch to a more suitable output
curl_off_t d = seconds / 86400;
h = (seconds - (d * 86400)) / 3600;
if(d <= 999)
- msnprintf(r, 9, "%3" FMT_OFF_T "d %02" FMT_OFF_T "h", d, h);
+ curl_msnprintf(r, 9, "%3" FMT_OFF_T "d %02" FMT_OFF_T "h", d, h);
else
- msnprintf(r, 9, "%7" FMT_OFF_T "d", d);
+ curl_msnprintf(r, 9, "%7" FMT_OFF_T "d", d);
}
}
const char unit[] = { 'k', 'M', 'G', 'T', 'P', 0 };
int k = 0;
if(bytes < 1000000) {
- msnprintf(max6, 7, "%5" CURL_FORMAT_CURL_OFF_T, bytes);
+ curl_msnprintf(max6, 7, "%5" CURL_FORMAT_CURL_OFF_T, bytes);
return max6;
}
curl_off_t nbytes = bytes / 1024;
if(nbytes < 1000) {
/* xxx.yU */
- msnprintf(max6, 7, "%3" CURL_FORMAT_CURL_OFF_T
- ".%" CURL_FORMAT_CURL_OFF_T "%c", nbytes,
- (bytes%1024) / (1024/10), unit[k]);
+ curl_msnprintf(max6, 7, "%3" CURL_FORMAT_CURL_OFF_T
+ ".%" CURL_FORMAT_CURL_OFF_T "%c", nbytes,
+ (bytes%1024) / (1024/10), unit[k]);
break;
}
else if(nbytes < 100000) {
/* xxxxxU */
- msnprintf(max6, 7, "%5" CURL_FORMAT_CURL_OFF_T "%c", nbytes, unit[k]);
+ curl_msnprintf(max6, 7, "%5" CURL_FORMAT_CURL_OFF_T "%c",
+ nbytes, unit[k]);
break;
}
bytes = nbytes;
if(!data->progress.hide && !data->progress.callback)
/* only output if we do not use a progress callback and we are not
* hidden */
- fprintf(data->set.err, "\n");
+ curl_mfprintf(data->set.err, "\n");
data->progress.speeder_c = 0; /* reset the progress meter display */
return 0;
if(!p->headers_out) {
if(data->state.resume_from) {
- fprintf(data->set.err,
- "** Resuming transfer from byte position %" FMT_OFF_T "\n",
- data->state.resume_from);
+ curl_mfprintf(data->set.err,
+ "** Resuming transfer from byte position %" FMT_OFF_T "\n",
+ data->state.resume_from);
}
- fprintf(data->set.err,
- " %% Total %% Received %% Xferd Average Speed "
- "Time Time Time Current\n"
- " Dload Upload "
- "Total Spent Left Speed\n");
+ curl_mfprintf(data->set.err,
+ " %% Total %% Received %% Xferd Average Speed "
+ "Time Time Time Current\n"
+ " Dload Upload "
+ "Total Spent Left Speed\n");
p->headers_out = TRUE; /* headers are shown */
}
/* Get the percentage of data transferred so far */
total_estm.percent = pgrs_est_percent(total_expected_size, total_cur_size);
- fprintf(data->set.err,
- "\r"
- "%3" FMT_OFF_T " %s "
- "%3" FMT_OFF_T " %s "
- "%3" FMT_OFF_T " %s %s %s %s %s %s %s",
- total_estm.percent, /* 3 letters */ /* total % */
- max6data(total_expected_size, max6[2]), /* total size */
- dl_estm.percent, /* 3 letters */ /* rcvd % */
- max6data(p->dl.cur_size, max6[0]), /* rcvd size */
- ul_estm.percent, /* 3 letters */ /* xfer % */
- max6data(p->ul.cur_size, max6[1]), /* xfer size */
- max6data(p->dl.speed, max6[3]), /* avrg dl speed */
- max6data(p->ul.speed, max6[4]), /* avrg ul speed */
- time_total, /* 8 letters */ /* total time */
- time_spent, /* 8 letters */ /* time spent */
- time_left, /* 8 letters */ /* time left */
- max6data(p->current_speed, max6[5])
+ curl_mfprintf(data->set.err,
+ "\r"
+ "%3" FMT_OFF_T " %s "
+ "%3" FMT_OFF_T " %s "
+ "%3" FMT_OFF_T " %s %s %s %s %s %s %s",
+ total_estm.percent, /* 3 letters */ /* total % */
+ max6data(total_expected_size, max6[2]), /* total size */
+ dl_estm.percent, /* 3 letters */ /* rcvd % */
+ max6data(p->dl.cur_size, max6[0]), /* rcvd size */
+ ul_estm.percent, /* 3 letters */ /* xfer % */
+ max6data(p->ul.cur_size, max6[1]), /* xfer size */
+ max6data(p->dl.speed, max6[3]), /* avrg dl speed */
+ max6data(p->ul.speed, max6[4]), /* avrg ul speed */
+ time_total, /* 8 letters */ /* total time */
+ time_spent, /* 8 letters */ /* time spent */
+ time_left, /* 8 letters */ /* time left */
+ max6data(p->current_speed, max6[5])
);
/* we flush the output stream to make it appear as soon as possible */
#include "psl.h"
#include "share.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "rand.h"
#include "escape.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "curlx/multibyte.h"
#include "curlx/timeval.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "url.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "cfilters.h"
#include "strdup.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
if(data->set.str[STRING_RTSP_TRANSPORT]) {
free(data->state.aptr.rtsp_transport);
data->state.aptr.rtsp_transport =
- aprintf("Transport: %s\r\n",
- data->set.str[STRING_RTSP_TRANSPORT]);
+ curl_maprintf("Transport: %s\r\n",
+ data->set.str[STRING_RTSP_TRANSPORT]);
if(!data->state.aptr.rtsp_transport)
return CURLE_OUT_OF_MEMORY;
}
data->set.str[STRING_ENCODING]) {
free(data->state.aptr.accept_encoding);
data->state.aptr.accept_encoding =
- aprintf("Accept-Encoding: %s\r\n", data->set.str[STRING_ENCODING]);
+ curl_maprintf("Accept-Encoding: %s\r\n",
+ data->set.str[STRING_ENCODING]);
if(!data->state.aptr.accept_encoding) {
result = CURLE_OUT_OF_MEMORY;
/* Referrer */
Curl_safefree(data->state.aptr.ref);
if(data->state.referer && !Curl_checkheaders(data, STRCONST("Referer")))
- data->state.aptr.ref = aprintf("Referer: %s\r\n", data->state.referer);
+ data->state.aptr.ref = curl_maprintf("Referer: %s\r\n",
+ data->state.referer);
p_referrer = data->state.aptr.ref;
/* Check to see if there is a range set in the custom headers */
if(!Curl_checkheaders(data, STRCONST("Range")) && data->state.range) {
free(data->state.aptr.rangeline);
- data->state.aptr.rangeline = aprintf("Range: %s\r\n", data->state.range);
+ data->state.aptr.rangeline = curl_maprintf("Range: %s\r\n",
+ data->state.range);
p_range = data->state.aptr.rangeline;
}
}
#include "curlx/timediff.h"
#include "curlx/wait.h"
#include "curlx/warnless.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "curlx/warnless.h"
#include "ws.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "strdup.h"
#include "escape.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include <wincrypt.h>
#endif
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "hsts.h"
#include "url.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "escape.h"
#include "curl_endian.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
p += sizeof(lm);
memcpy(p, nt, sizeof(nt));
p += sizeof(nt);
- p += msnprintf(p, byte_count - sizeof(nt) - sizeof(lm),
- "%s%c" /* user */
- "%s%c" /* domain */
- "%s%c" /* OS */
- "%s", /* client name */
- smbc->user, 0, smbc->domain, 0, CURL_OS, 0, CLIENTNAME);
+ p += curl_msnprintf(p, byte_count - sizeof(nt) - sizeof(lm),
+ "%s%c" /* user */
+ "%s%c" /* domain */
+ "%s%c" /* OS */
+ "%s", /* client name */
+ smbc->user, 0, smbc->domain, 0, CURL_OS, 0, CLIENTNAME);
p++; /* count the final null-termination */
DEBUGASSERT(byte_count == (size_t)(p - msg.bytes));
msg.byte_count = smb_swap16((unsigned short)byte_count);
msg.andx.command = SMB_COM_NO_ANDX_COMMAND;
msg.pw_len = 0;
- p += msnprintf(p, byte_count,
- "\\\\%s\\" /* hostname */
- "%s%c" /* share */
- "%s", /* service */
- conn->host.name, smbc->share, 0, SERVICENAME);
+ p += curl_msnprintf(p, byte_count,
+ "\\\\%s\\" /* hostname */
+ "%s%c" /* share */
+ "%s", /* service */
+ conn->host.name, smbc->share, 0, SERVICENAME);
p++; /* count the final null-termination */
DEBUGASSERT(byte_count == (size_t)(p - msg.bytes));
msg.byte_count = smb_swap16((unsigned short)byte_count);
#include "idn.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
(!Curl_is_ASCII_name(host.name)));
if(host.name) {
- from = aprintf("<%s@%s>%s", address, host.name, suffix);
+ from = curl_maprintf("<%s@%s>%s", address, host.name, suffix);
Curl_free_idnconverted_hostname(&host);
}
else
/* An invalid mailbox was provided but we will simply let the server
worry about that and reply with a 501 error */
- from = aprintf("<%s>%s", address, suffix);
+ from = curl_maprintf("<%s>%s", address, suffix);
free(address);
}
utf8 = TRUE;
if(host.name) {
- auth = aprintf("<%s@%s>%s", address, host.name, suffix);
+ auth = curl_maprintf("<%s@%s>%s", address, host.name, suffix);
Curl_free_idnconverted_hostname(&host);
}
else
/* An invalid mailbox was provided but we will simply let the server
worry about it */
- auth = aprintf("<%s>%s", address, suffix);
+ auth = curl_maprintf("<%s>%s", address, suffix);
free(address);
}
else
/* Calculate the optional SIZE parameter */
if(smtpc->size_supported && data->state.infilesize > 0) {
- size = aprintf("%" FMT_OFF_T, data->state.infilesize);
+ size = curl_maprintf("%" FMT_OFF_T, data->state.infilesize);
if(!size) {
result = CURLE_OUT_OF_MEMORY;
#include "curlx/timeval.h" /* needed before select.h */
#include "select.h" /* for Curl_poll */
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "curlx/inet_pton.h"
#include "url.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "curlx/warnless.h"
#include "strdup.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
return CURLE_OUT_OF_MEMORY;
service.length = serviceptr_length +
strlen(conn->socks_proxy.host.name) + 1;
- msnprintf(service.value, service.length + 1, "%s@%s",
- serviceptr, conn->socks_proxy.host.name);
+ curl_msnprintf(service.value, service.length + 1, "%s@%s",
+ serviceptr, conn->socks_proxy.host.name);
gss_major_status = gss_import_name(&gss_minor_status, &service,
GSS_C_NT_HOSTBASED_SERVICE, &server);
#include "curlx/multibyte.h"
#include "curlx/warnless.h"
#include "strdup.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
if(strchr(service, '/'))
service_name = strdup(service);
else
- service_name = aprintf("%s/%s", service, conn->socks_proxy.host.name);
+ service_name = curl_maprintf("%s/%s",
+ service, conn->socks_proxy.host.name);
if(!service_name)
return CURLE_OUT_OF_MEMORY;
#include "curlx/warnless.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
DEBUGF(infof(data, "set a non ASCII username in telnet"));
return CURLE_BAD_FUNCTION_ARGUMENT;
}
- msnprintf(buffer, sizeof(buffer), "USER,%s", data->conn->user);
+ curl_msnprintf(buffer, sizeof(buffer), "USER,%s", data->conn->user);
beg = curl_slist_append(tn->telnet_vars, buffer);
if(!beg) {
curl_slist_free_all(tn->telnet_vars);
failf(data, "Tool long telnet TTYPE");
return CURLE_SEND_ERROR;
}
- len = msnprintf((char *)temp, sizeof(temp), "%c%c%c%c%s%c%c",
- CURL_IAC, CURL_SB, CURL_TELOPT_TTYPE,
- CURL_TELQUAL_IS, tn->subopt_ttype, CURL_IAC, CURL_SE);
+ len = curl_msnprintf((char *)temp, sizeof(temp), "%c%c%c%c%s%c%c",
+ CURL_IAC, CURL_SB, CURL_TELOPT_TTYPE,
+ CURL_TELQUAL_IS, tn->subopt_ttype, CURL_IAC,
+ CURL_SE);
bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len);
if(bytes_written < 0) {
failf(data, "Tool long telnet XDISPLOC");
return CURLE_SEND_ERROR;
}
- len = msnprintf((char *)temp, sizeof(temp), "%c%c%c%c%s%c%c",
- CURL_IAC, CURL_SB, CURL_TELOPT_XDISPLOC,
- CURL_TELQUAL_IS, tn->subopt_xdisploc, CURL_IAC, CURL_SE);
+ len = curl_msnprintf((char *)temp, sizeof(temp), "%c%c%c%c%s%c%c",
+ CURL_IAC, CURL_SB, CURL_TELOPT_XDISPLOC,
+ CURL_TELQUAL_IS, tn->subopt_xdisploc, CURL_IAC,
+ CURL_SE);
bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len);
if(bytes_written < 0) {
err = SOCKERRNO;
printsub(data, '>', &temp[2], len-2);
break;
case CURL_TELOPT_NEW_ENVIRON:
- len = msnprintf((char *)temp, sizeof(temp), "%c%c%c%c",
- CURL_IAC, CURL_SB, CURL_TELOPT_NEW_ENVIRON,
- CURL_TELQUAL_IS);
+ len = curl_msnprintf((char *)temp, sizeof(temp), "%c%c%c%c",
+ CURL_IAC, CURL_SB, CURL_TELOPT_NEW_ENVIRON,
+ CURL_TELQUAL_IS);
for(v = tn->telnet_vars; v; v = v->next) {
size_t tmplen = (strlen(v->data) + 1);
if(bad_option(v->data))
if(len + tmplen < (int)sizeof(temp)-6) {
char *s = strchr(v->data, ',');
if(!s)
- len += msnprintf((char *)&temp[len], sizeof(temp) - len,
- "%c%s", CURL_NEW_ENV_VAR, v->data);
+ len += curl_msnprintf((char *)&temp[len], sizeof(temp) - len,
+ "%c%s", CURL_NEW_ENV_VAR, v->data);
else {
size_t vlen = s - v->data;
- len += msnprintf((char *)&temp[len], sizeof(temp) - len,
- "%c%.*s%c%s", CURL_NEW_ENV_VAR,
- (int)vlen, v->data, CURL_NEW_ENV_VALUE, ++s);
+ len += curl_msnprintf((char *)&temp[len], sizeof(temp) - len,
+ "%c%.*s%c%s", CURL_NEW_ENV_VAR,
+ (int)vlen, v->data, CURL_NEW_ENV_VALUE, ++s);
}
}
}
- msnprintf((char *)&temp[len], sizeof(temp) - len,
- "%c%c", CURL_IAC, CURL_SE);
+ curl_msnprintf((char *)&temp[len], sizeof(temp) - len,
+ "%c%c", CURL_IAC, CURL_SE);
len += 2;
bytes_written = swrite(conn->sock[FIRSTSOCKET], temp, len);
if(bytes_written < 0) {
#include "curlx/strerr.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
return CURLE_TFTP_ILLEGAL; /* too long filename field */
}
- msnprintf((char *)state->spacket.data + 2,
- state->blksize,
- "%s%c%s%c", filename, '\0', mode, '\0');
+ curl_msnprintf((char *)state->spacket.data + 2,
+ state->blksize,
+ "%s%c%s%c", filename, '\0', mode, '\0');
sbytes = 4 + strlen(filename) + strlen(mode);
/* optional addition of TFTP options */
if(!data->set.tftp_no_options) {
char buf[64];
/* add tsize option */
- msnprintf(buf, sizeof(buf), "%" FMT_OFF_T,
- data->state.upload && (data->state.infilesize != -1) ?
- data->state.infilesize : 0);
+ curl_msnprintf(buf, sizeof(buf), "%" FMT_OFF_T,
+ data->state.upload && (data->state.infilesize != -1) ?
+ data->state.infilesize : 0);
result = tftp_option_add(state, &sbytes,
(char *)state->spacket.data + sbytes,
(char *)state->spacket.data + sbytes, buf);
/* add blksize option */
- msnprintf(buf, sizeof(buf), "%d", state->requested_blksize);
+ curl_msnprintf(buf, sizeof(buf), "%d", state->requested_blksize);
if(result == CURLE_OK)
result = tftp_option_add(state, &sbytes,
(char *)state->spacket.data + sbytes,
(char *)state->spacket.data + sbytes, buf);
/* add timeout option */
- msnprintf(buf, sizeof(buf), "%d", state->retry_time);
+ curl_msnprintf(buf, sizeof(buf), "%d", state->retry_time);
if(result == CURLE_OK)
result = tftp_option_add(state, &sbytes,
(char *)state->spacket.data + sbytes,
#include "setopt.h"
#include "headers.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
if(data->set.str[STRING_USERAGENT]) {
free(data->state.aptr.uagent);
data->state.aptr.uagent =
- aprintf("User-Agent: %s\r\n", data->set.str[STRING_USERAGENT]);
+ curl_maprintf("User-Agent: %s\r\n", data->set.str[STRING_USERAGENT]);
if(!data->state.aptr.uagent)
return CURLE_OUT_OF_MEMORY;
}
#include "curl_setup.h"
#include "uint-bset.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "uint-bset.h"
#include "uint-spbset.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "curl_setup.h"
#include "uint-table.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
#include "headers.h"
#include "curlx/strerr.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
data = calloc(1, sizeof(struct Curl_easy));
if(!data) {
/* this is a serious error */
- DEBUGF(fprintf(stderr, "Error: calloc of Curl_easy failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: calloc of Curl_easy failed\n"));
return CURLE_OUT_OF_MEMORY;
}
if(data->set.str[STRING_DEFAULT_PROTOCOL] &&
!Curl_is_absolute_url(data->state.url, NULL, 0, TRUE)) {
- char *url = aprintf("%s://%s", data->set.str[STRING_DEFAULT_PROTOCOL],
- data->state.url);
+ char *url = curl_maprintf("%s://%s",
+ data->set.str[STRING_DEFAULT_PROTOCOL],
+ data->state.url);
if(!url)
return CURLE_OUT_OF_MEMORY;
if(data->state.url_alloc)
free(s->range);
if(s->resume_from)
- s->range = aprintf("%" FMT_OFF_T "-", s->resume_from);
+ s->range = curl_maprintf("%" FMT_OFF_T "-", s->resume_from);
else
s->range = strdup(data->set.str[STRING_SET_RANGE]);
}
#ifdef USE_IPV6
- conn->destination = aprintf("%u/%d/%s", conn->scope_id, port, hostname);
+ conn->destination = curl_maprintf("%u/%d/%s", conn->scope_id, port,
+ hostname);
#else
- conn->destination = aprintf("%d/%s", port, hostname);
+ conn->destination = curl_maprintf("%d/%s", port, hostname);
#endif
if(!conn->destination)
return CURLE_OUT_OF_MEMORY;
(void)data;
#endif
- msnprintf(proxy_env, sizeof(proxy_env), "%s_proxy", conn->handler->scheme);
+ curl_msnprintf(proxy_env, sizeof(proxy_env), "%s_proxy",
+ conn->handler->scheme);
/* read the protocol proxy: */
proxy = curl_getenv(proxy_env);
if(strcmp("/", path)) {
is_unix_proxy = TRUE;
free(host);
- host = aprintf(UNIX_SOCKET_PREFIX"%s", path);
+ host = curl_maprintf(UNIX_SOCKET_PREFIX"%s", path);
if(!host) {
result = CURLE_OUT_OF_MEMORY;
goto error;
char portbuf[16];
CURLUcode uc;
conn->remote_port = data->set.use_port;
- msnprintf(portbuf, sizeof(portbuf), "%d", conn->remote_port);
+ curl_msnprintf(portbuf, sizeof(portbuf), "%d", conn->remote_port);
uc = curl_url_set(data->state.uh, CURLUPART_PORT, portbuf, 0);
if(uc)
return CURLE_OUT_OF_MEMORY;
else {
/* check whether the URL's hostname matches */
size_t hostname_to_match_len;
- char *hostname_to_match = aprintf("%s%s%s",
- conn->bits.ipv6_ip ? "[" : "",
- conn->host.name,
- conn->bits.ipv6_ip ? "]" : "");
+ char *hostname_to_match = curl_maprintf("%s%s%s",
+ conn->bits.ipv6_ip ? "[" : "",
+ conn->host.name,
+ conn->bits.ipv6_ip ? "]" : "");
if(!hostname_to_match)
return CURLE_OUT_OF_MEMORY;
hostname_to_match_len = strlen(hostname_to_match);
*/
result = Curl_ssl_conn_config_init(data, conn);
if(result) {
- DEBUGF(fprintf(stderr, "Error: init connection ssl config\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: init connection ssl config\n"));
goto out;
}
#include "curlx/strparse.h"
#include "curl_memrchr.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
u->portnum = (unsigned short) port;
/* generate a new port number string to get rid of leading zeroes etc */
free(u->port);
- u->port = aprintf("%" CURL_FORMAT_CURL_OFF_T, port);
+ u->port = curl_maprintf("%" CURL_FORMAT_CURL_OFF_T, port);
if(!u->port)
return CURLUE_OUT_OF_MEMORY;
}
bool urlencode = (flags & CURLU_URLENCODE) ? 1 : 0;
char portbuf[7];
if(u->scheme && curl_strequal("file", u->scheme)) {
- url = aprintf("file://%s%s%s%s%s",
- u->path,
- show_query ? "?": "",
- u->query ? u->query : "",
- show_fragment ? "#": "",
- u->fragment ? u->fragment : "");
+ url = curl_maprintf("file://%s%s%s%s%s",
+ u->path,
+ show_query ? "?": "",
+ u->query ? u->query : "",
+ show_fragment ? "#": "",
+ u->fragment ? u->fragment : "");
}
else if(!u->host)
return CURLUE_NO_HOST;
/* there is no stored port number, but asked to deliver
a default one for the scheme */
if(h) {
- msnprintf(portbuf, sizeof(portbuf), "%u", h->defport);
+ curl_msnprintf(portbuf, sizeof(portbuf), "%u", h->defport);
port = portbuf;
}
}
}
if(!(flags & CURLU_NO_GUESS_SCHEME) || !u->guessed_scheme)
- msnprintf(schemebuf, sizeof(schemebuf), "%s://", scheme);
+ curl_msnprintf(schemebuf, sizeof(schemebuf), "%s://", scheme);
else
schemebuf[0] = 0;
- url = aprintf("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
- schemebuf,
- u->user ? u->user : "",
- u->password ? ":": "",
- u->password ? u->password : "",
- options ? ";" : "",
- options ? options : "",
- (u->user || u->password || options) ? "@": "",
- allochost ? allochost : u->host,
- port ? ":": "",
- port ? port : "",
- u->path ? u->path : "/",
- show_query ? "?": "",
- u->query ? u->query : "",
- show_fragment ? "#": "",
- u->fragment ? u->fragment : "");
+ url = curl_maprintf("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+ schemebuf,
+ u->user ? u->user : "",
+ u->password ? ":": "",
+ u->password ? u->password : "",
+ options ? ";" : "",
+ options ? options : "",
+ (u->user || u->password || options) ? "@": "",
+ allochost ? allochost : u->host,
+ port ? ":": "",
+ port ? port : "",
+ u->path ? u->path : "/",
+ show_query ? "?": "",
+ u->query ? u->query : "",
+ show_fragment ? "#": "",
+ u->fragment ? u->fragment : "");
free(allochost);
}
if(!url)
a default one for the scheme */
const struct Curl_handler *h = Curl_get_scheme_handler(u->scheme);
if(h) {
- msnprintf(portbuf, sizeof(portbuf), "%u", h->defport);
+ curl_msnprintf(portbuf, sizeof(portbuf), "%u", h->defport);
ptr = portbuf;
}
}
if(curlx_str_number(&provided_port, &port, 0xffff) || *provided_port)
/* weirdly provided number, not good! */
return CURLUE_BAD_PORT_NUMBER;
- tmp = aprintf("%" CURL_FORMAT_CURL_OFF_T, port);
+ tmp = curl_maprintf("%" CURL_FORMAT_CURL_OFF_T, port);
if(!tmp)
return CURLUE_OUT_OF_MEMORY;
free(u->port);
#include "vauth.h"
#include "../curlx/warnless.h"
#include "../sendf.h"
-#include "../curl_printf.h"
/* The last #include files should be: */
#include "../curl_memory.h"
#include "../curl_hmac.h"
#include "../curl_md5.h"
#include "../curlx/warnless.h"
-#include "../curl_printf.h"
/* The last #include files should be: */
#include "../curl_memory.h"
Curl_HMAC_final(ctxt, digest);
/* Generate the response */
- response = aprintf(
+ response = curl_maprintf(
"%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
userp, digest[0], digest[1], digest[2], digest[3], digest[4],
digest[5], digest[6], digest[7], digest[8], digest[9], digest[10],
#include "../vtls/vtls.h"
#include "../curlx/warnless.h"
#include "../curlx/strparse.h"
-#include "../curl_printf.h"
#include "../rand.h"
/* The last #include files should be: */
{
int i;
for(i = 0; i < 16; i++)
- msnprintf((char *) &dest[i * 2], 3, "%02x", source[i]);
+ curl_msnprintf((char *) &dest[i * 2], 3, "%02x", source[i]);
}
/* Convert sha256 or SHA-512/256 chunk to RFC7616 -suitable ASCII string */
{
int i;
for(i = 0; i < 32; i++)
- msnprintf((char *) &dest[i * 2], 3, "%02x", source[i]);
+ curl_msnprintf((char *) &dest[i * 2], 3, "%02x", source[i]);
}
/* Perform quoted-string escaping as described in RFC2616 and its errata */
/* Convert calculated 16 octet hex into 32 bytes string */
for(i = 0; i < MD5_DIGEST_LEN; i++)
- msnprintf(&HA1_hex[2 * i], 3, "%02x", digest[i]);
+ curl_msnprintf(&HA1_hex[2 * i], 3, "%02x", digest[i]);
/* Generate our SPN */
spn = Curl_auth_build_spn(service, data->conn->host.name, NULL);
Curl_MD5_final(ctxt, digest);
for(i = 0; i < MD5_DIGEST_LEN; i++)
- msnprintf(&HA2_hex[2 * i], 3, "%02x", digest[i]);
+ curl_msnprintf(&HA2_hex[2 * i], 3, "%02x", digest[i]);
/* Now calculate the response hash */
ctxt = Curl_MD5_init(&Curl_DIGEST_MD5);
Curl_MD5_final(ctxt, digest);
for(i = 0; i < MD5_DIGEST_LEN; i++)
- msnprintf(&resp_hash_hex[2 * i], 3, "%02x", digest[i]);
+ curl_msnprintf(&resp_hash_hex[2 * i], 3, "%02x", digest[i]);
/* Generate the response */
- response = aprintf("username=\"%s\",realm=\"%s\",nonce=\"%s\","
- "cnonce=\"%s\",nc=\"%s\",digest-uri=\"%s\",response=%s,"
- "qop=%s",
- userp, realm, nonce,
- cnonce, nonceCount, spn, resp_hash_hex, qop);
+ response = curl_maprintf("username=\"%s\",realm=\"%s\",nonce=\"%s\","
+ "cnonce=\"%s\",nc=\"%s\",digest-uri=\"%s\","
+ "response=%s,qop=%s",
+ userp, realm, nonce,
+ cnonce, nonceCount, spn, resp_hash_hex, qop);
free(spn);
if(!response)
return CURLE_OUT_OF_MEMORY;
}
if(digest->userhash) {
- hashthis = aprintf("%s:%s", userp, digest->realm ? digest->realm : "");
+ hashthis = curl_maprintf("%s:%s", userp,
+ digest->realm ? digest->realm : "");
if(!hashthis)
return CURLE_OUT_OF_MEMORY;
unq(nonce-value) ":" unq(cnonce-value)
*/
- hashthis = aprintf("%s:%s:%s", userp, digest->realm ? digest->realm : "",
- passwdp);
+ hashthis = curl_maprintf("%s:%s:%s", userp,
+ digest->realm ? digest->realm : "", passwdp);
if(!hashthis)
return CURLE_OUT_OF_MEMORY;
if(digest->algo & SESSION_ALGO) {
/* nonce and cnonce are OUTSIDE the hash */
- tmp = aprintf("%s:%s:%s", ha1, digest->nonce, digest->cnonce);
+ tmp = curl_maprintf("%s:%s:%s", ha1, digest->nonce, digest->cnonce);
if(!tmp)
return CURLE_OUT_OF_MEMORY;
5.1.1 of RFC 2616)
*/
- hashthis = aprintf("%s:%s", request, uripath);
+ hashthis = curl_maprintf("%s:%s", request, uripath);
if(!hashthis)
return CURLE_OUT_OF_MEMORY;
}
convert_to_ascii(hashbuf, (unsigned char *)hashed);
- hashthis2 = aprintf("%s:%s", hashthis, hashed);
+ hashthis2 = curl_maprintf("%s:%s", hashthis, hashed);
free(hashthis);
hashthis = hashthis2;
}
convert_to_ascii(hashbuf, ha2);
if(digest->qop) {
- hashthis = aprintf("%s:%s:%08x:%s:%s:%s", ha1, digest->nonce, digest->nc,
- digest->cnonce, digest->qop, ha2);
+ hashthis = curl_maprintf("%s:%s:%08x:%s:%s:%s", ha1, digest->nonce,
+ digest->nc, digest->cnonce, digest->qop, ha2);
}
else {
- hashthis = aprintf("%s:%s:%s", ha1, digest->nonce, ha2);
+ hashthis = curl_maprintf("%s:%s:%s", ha1, digest->nonce, ha2);
}
if(!hashthis)
}
if(digest->qop) {
- response = aprintf("username=\"%s\", "
- "realm=\"%s\", "
- "nonce=\"%s\", "
- "uri=\"%s\", "
- "cnonce=\"%s\", "
- "nc=%08x, "
- "qop=%s, "
- "response=\"%s\"",
- userp_quoted,
- realm_quoted,
- nonce_quoted,
- uripath,
- digest->cnonce,
- digest->nc,
- digest->qop,
- request_digest);
+ response = curl_maprintf("username=\"%s\", "
+ "realm=\"%s\", "
+ "nonce=\"%s\", "
+ "uri=\"%s\", "
+ "cnonce=\"%s\", "
+ "nc=%08x, "
+ "qop=%s, "
+ "response=\"%s\"",
+ userp_quoted,
+ realm_quoted,
+ nonce_quoted,
+ uripath,
+ digest->cnonce,
+ digest->nc,
+ digest->qop,
+ request_digest);
/* Increment nonce-count to use another nc value for the next request */
digest->nc++;
}
else {
- response = aprintf("username=\"%s\", "
- "realm=\"%s\", "
- "nonce=\"%s\", "
- "uri=\"%s\", "
- "response=\"%s\"",
- userp_quoted,
- realm_quoted,
- nonce_quoted,
- uripath,
- request_digest);
+ response = curl_maprintf("username=\"%s\", "
+ "realm=\"%s\", "
+ "nonce=\"%s\", "
+ "uri=\"%s\", "
+ "response=\"%s\"",
+ userp_quoted,
+ realm_quoted,
+ nonce_quoted,
+ uripath,
+ request_digest);
}
free(nonce_quoted);
free(realm_quoted);
free(response);
return CURLE_OUT_OF_MEMORY;
}
- tmp = aprintf("%s, opaque=\"%s\"", response, opaque_quoted);
+ tmp = curl_maprintf("%s, opaque=\"%s\"", response, opaque_quoted);
free(response);
free(opaque_quoted);
if(!tmp)
if(digest->algorithm) {
/* Append the algorithm */
- tmp = aprintf("%s, algorithm=%s", response, digest->algorithm);
+ tmp = curl_maprintf("%s, algorithm=%s", response, digest->algorithm);
free(response);
if(!tmp)
return CURLE_OUT_OF_MEMORY;
if(digest->userhash) {
/* Append the userhash */
- tmp = aprintf("%s, userhash=true", response);
+ tmp = curl_maprintf("%s, userhash=true", response);
free(response);
if(!tmp)
return CURLE_OUT_OF_MEMORY;
#include <gsasl.h>
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "../curl_memory.h"
#include "../memdebug.h"
#include "../urldata.h"
#include "../curl_gssapi.h"
#include "../sendf.h"
-#include "../curl_printf.h"
/* The last #include files should be: */
#include "../curl_memory.h"
#include "vauth.h"
#include "../curl_endian.h"
-#include "../curl_printf.h"
/* The last #include files should be: */
#include "../curl_memory.h"
static void ntlm_print_flags(FILE *handle, unsigned long flags)
{
if(flags & NTLMFLAG_NEGOTIATE_UNICODE)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_UNICODE ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_UNICODE ");
if(flags & NTLMFLAG_NEGOTIATE_OEM)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_OEM ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_OEM ");
if(flags & NTLMFLAG_REQUEST_TARGET)
- fprintf(handle, "NTLMFLAG_REQUEST_TARGET ");
+ curl_mfprintf(handle, "NTLMFLAG_REQUEST_TARGET ");
if(flags & (1 << 3))
- fprintf(handle, "NTLMFLAG_UNKNOWN_3 ");
+ curl_mfprintf(handle, "NTLMFLAG_UNKNOWN_3 ");
if(flags & NTLMFLAG_NEGOTIATE_SIGN)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_SIGN ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_SIGN ");
if(flags & NTLMFLAG_NEGOTIATE_SEAL)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_SEAL ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_SEAL ");
if(flags & NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE ");
if(flags & NTLMFLAG_NEGOTIATE_LM_KEY)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_LM_KEY ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_LM_KEY ");
if(flags & NTLMFLAG_NEGOTIATE_NTLM_KEY)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_NTLM_KEY ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_NTLM_KEY ");
if(flags & (1 << 10))
- fprintf(handle, "NTLMFLAG_UNKNOWN_10 ");
+ curl_mfprintf(handle, "NTLMFLAG_UNKNOWN_10 ");
if(flags & NTLMFLAG_NEGOTIATE_ANONYMOUS)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_ANONYMOUS ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_ANONYMOUS ");
if(flags & NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED ");
if(flags & NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED ");
if(flags & NTLMFLAG_NEGOTIATE_LOCAL_CALL)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_LOCAL_CALL ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_LOCAL_CALL ");
if(flags & NTLMFLAG_NEGOTIATE_ALWAYS_SIGN)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_ALWAYS_SIGN ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_ALWAYS_SIGN ");
if(flags & NTLMFLAG_TARGET_TYPE_DOMAIN)
- fprintf(handle, "NTLMFLAG_TARGET_TYPE_DOMAIN ");
+ curl_mfprintf(handle, "NTLMFLAG_TARGET_TYPE_DOMAIN ");
if(flags & NTLMFLAG_TARGET_TYPE_SERVER)
- fprintf(handle, "NTLMFLAG_TARGET_TYPE_SERVER ");
+ curl_mfprintf(handle, "NTLMFLAG_TARGET_TYPE_SERVER ");
if(flags & NTLMFLAG_TARGET_TYPE_SHARE)
- fprintf(handle, "NTLMFLAG_TARGET_TYPE_SHARE ");
+ curl_mfprintf(handle, "NTLMFLAG_TARGET_TYPE_SHARE ");
if(flags & NTLMFLAG_NEGOTIATE_NTLM2_KEY)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_NTLM2_KEY ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_NTLM2_KEY ");
if(flags & NTLMFLAG_REQUEST_INIT_RESPONSE)
- fprintf(handle, "NTLMFLAG_REQUEST_INIT_RESPONSE ");
+ curl_mfprintf(handle, "NTLMFLAG_REQUEST_INIT_RESPONSE ");
if(flags & NTLMFLAG_REQUEST_ACCEPT_RESPONSE)
- fprintf(handle, "NTLMFLAG_REQUEST_ACCEPT_RESPONSE ");
+ curl_mfprintf(handle, "NTLMFLAG_REQUEST_ACCEPT_RESPONSE ");
if(flags & NTLMFLAG_REQUEST_NONNT_SESSION_KEY)
- fprintf(handle, "NTLMFLAG_REQUEST_NONNT_SESSION_KEY ");
+ curl_mfprintf(handle, "NTLMFLAG_REQUEST_NONNT_SESSION_KEY ");
if(flags & NTLMFLAG_NEGOTIATE_TARGET_INFO)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_TARGET_INFO ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_TARGET_INFO ");
if(flags & (1 << 24))
- fprintf(handle, "NTLMFLAG_UNKNOWN_24 ");
+ curl_mfprintf(handle, "NTLMFLAG_UNKNOWN_24 ");
if(flags & (1 << 25))
- fprintf(handle, "NTLMFLAG_UNKNOWN_25 ");
+ curl_mfprintf(handle, "NTLMFLAG_UNKNOWN_25 ");
if(flags & (1 << 26))
- fprintf(handle, "NTLMFLAG_UNKNOWN_26 ");
+ curl_mfprintf(handle, "NTLMFLAG_UNKNOWN_26 ");
if(flags & (1 << 27))
- fprintf(handle, "NTLMFLAG_UNKNOWN_27 ");
+ curl_mfprintf(handle, "NTLMFLAG_UNKNOWN_27 ");
if(flags & (1 << 28))
- fprintf(handle, "NTLMFLAG_UNKNOWN_28 ");
+ curl_mfprintf(handle, "NTLMFLAG_UNKNOWN_28 ");
if(flags & NTLMFLAG_NEGOTIATE_128)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_128 ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_128 ");
if(flags & NTLMFLAG_NEGOTIATE_KEY_EXCHANGE)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_KEY_EXCHANGE ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_KEY_EXCHANGE ");
if(flags & NTLMFLAG_NEGOTIATE_56)
- fprintf(handle, "NTLMFLAG_NEGOTIATE_56 ");
+ curl_mfprintf(handle, "NTLMFLAG_NEGOTIATE_56 ");
}
static void ntlm_print_hex(FILE *handle, const char *buf, size_t len)
(void)handle;
- fprintf(stderr, "0x");
+ curl_mfprintf(stderr, "0x");
while(len-- > 0)
- fprintf(stderr, "%02.2x", (unsigned int)*p++);
+ curl_mfprintf(stderr, "%02.2x", (unsigned int)*p++);
}
#else
# define DEBUG_OUT(x) Curl_nop_stmt
}
DEBUG_OUT({
- fprintf(stderr, "**** TYPE2 header flags=0x%08.8lx ", ntlm->flags);
+ curl_mfprintf(stderr, "**** TYPE2 header flags=0x%08.8lx ", ntlm->flags);
ntlm_print_flags(stderr, ntlm->flags);
- fprintf(stderr, "\n nonce=");
+ curl_mfprintf(stderr, "\n nonce=");
ntlm_print_hex(stderr, (char *)ntlm->nonce, 8);
- fprintf(stderr, "\n****\n");
- fprintf(stderr, "**** Header %s\n ", header);
+ curl_mfprintf(stderr, "\n****\n");
+ curl_mfprintf(stderr, "**** Header %s\n ", header);
});
return result;
/* Clean up any former leftovers and initialise to defaults */
Curl_auth_cleanup_ntlm(ntlm);
- ntlmbuf = aprintf(NTLMSSP_SIGNATURE "%c"
- "\x01%c%c%c" /* 32-bit type = 1 */
- "%c%c%c%c" /* 32-bit NTLM flag field */
- "%c%c" /* domain length */
- "%c%c" /* domain allocated space */
- "%c%c" /* domain name offset */
- "%c%c" /* 2 zeroes */
- "%c%c" /* host length */
- "%c%c" /* host allocated space */
- "%c%c" /* hostname offset */
- "%c%c" /* 2 zeroes */
- "%s" /* hostname */
- "%s", /* domain string */
- 0, /* trailing zero */
- 0, 0, 0, /* part of type-1 long */
-
- LONGQUARTET(NTLMFLAG_NEGOTIATE_OEM |
- NTLMFLAG_REQUEST_TARGET |
- NTLMFLAG_NEGOTIATE_NTLM_KEY |
- NTLMFLAG_NEGOTIATE_NTLM2_KEY |
- NTLMFLAG_NEGOTIATE_ALWAYS_SIGN),
- SHORTPAIR(domlen),
- SHORTPAIR(domlen),
- SHORTPAIR(domoff),
- 0, 0,
- SHORTPAIR(hostlen),
- SHORTPAIR(hostlen),
- SHORTPAIR(hostoff),
- 0, 0,
- host, /* this is empty */
- domain /* this is empty */);
+ ntlmbuf = curl_maprintf(NTLMSSP_SIGNATURE "%c"
+ "\x01%c%c%c" /* 32-bit type = 1 */
+ "%c%c%c%c" /* 32-bit NTLM flag field */
+ "%c%c" /* domain length */
+ "%c%c" /* domain allocated space */
+ "%c%c" /* domain name offset */
+ "%c%c" /* 2 zeroes */
+ "%c%c" /* host length */
+ "%c%c" /* host allocated space */
+ "%c%c" /* hostname offset */
+ "%c%c" /* 2 zeroes */
+ "%s" /* hostname */
+ "%s", /* domain string */
+ 0, /* trailing zero */
+ 0, 0, 0, /* part of type-1 long */
+
+ LONGQUARTET(NTLMFLAG_NEGOTIATE_OEM |
+ NTLMFLAG_REQUEST_TARGET |
+ NTLMFLAG_NEGOTIATE_NTLM_KEY |
+ NTLMFLAG_NEGOTIATE_NTLM2_KEY |
+ NTLMFLAG_NEGOTIATE_ALWAYS_SIGN),
+ SHORTPAIR(domlen),
+ SHORTPAIR(domlen),
+ SHORTPAIR(domoff),
+ 0, 0,
+ SHORTPAIR(hostlen),
+ SHORTPAIR(hostlen),
+ SHORTPAIR(hostoff),
+ 0, 0,
+ host, /* this is empty */
+ domain /* this is empty */);
if(!ntlmbuf)
return CURLE_OUT_OF_MEMORY;
size = 32 + hostlen + domlen;
DEBUG_OUT({
- fprintf(stderr, "* TYPE1 header flags=0x%02.2x%02.2x%02.2x%02.2x "
- "0x%08.8x ",
- LONGQUARTET(NTLMFLAG_NEGOTIATE_OEM |
- NTLMFLAG_REQUEST_TARGET |
- NTLMFLAG_NEGOTIATE_NTLM_KEY |
- NTLMFLAG_NEGOTIATE_NTLM2_KEY |
- NTLMFLAG_NEGOTIATE_ALWAYS_SIGN),
- NTLMFLAG_NEGOTIATE_OEM |
- NTLMFLAG_REQUEST_TARGET |
- NTLMFLAG_NEGOTIATE_NTLM_KEY |
- NTLMFLAG_NEGOTIATE_NTLM2_KEY |
- NTLMFLAG_NEGOTIATE_ALWAYS_SIGN);
+ curl_mfprintf(stderr, "* TYPE1 header flags=0x%02.2x%02.2x%02.2x%02.2x "
+ "0x%08.8x ",
+ LONGQUARTET(NTLMFLAG_NEGOTIATE_OEM |
+ NTLMFLAG_REQUEST_TARGET |
+ NTLMFLAG_NEGOTIATE_NTLM_KEY |
+ NTLMFLAG_NEGOTIATE_NTLM2_KEY |
+ NTLMFLAG_NEGOTIATE_ALWAYS_SIGN),
+ NTLMFLAG_NEGOTIATE_OEM |
+ NTLMFLAG_REQUEST_TARGET |
+ NTLMFLAG_NEGOTIATE_NTLM_KEY |
+ NTLMFLAG_NEGOTIATE_NTLM2_KEY |
+ NTLMFLAG_NEGOTIATE_ALWAYS_SIGN);
ntlm_print_flags(stderr,
NTLMFLAG_NEGOTIATE_OEM |
NTLMFLAG_REQUEST_TARGET |
NTLMFLAG_NEGOTIATE_NTLM_KEY |
NTLMFLAG_NEGOTIATE_NTLM2_KEY |
NTLMFLAG_NEGOTIATE_ALWAYS_SIGN);
- fprintf(stderr, "\n****\n");
+ curl_mfprintf(stderr, "\n****\n");
});
Curl_bufref_set(out, ntlmbuf, size, curl_free);
hostoff = useroff + userlen;
/* Create the big type-3 message binary blob */
- size = msnprintf((char *)ntlmbuf, NTLM_BUFSIZE,
- NTLMSSP_SIGNATURE "%c"
- "\x03%c%c%c" /* 32-bit type = 3 */
-
- "%c%c" /* LanManager length */
- "%c%c" /* LanManager allocated space */
- "%c%c" /* LanManager offset */
- "%c%c" /* 2 zeroes */
-
- "%c%c" /* NT-response length */
- "%c%c" /* NT-response allocated space */
- "%c%c" /* NT-response offset */
- "%c%c" /* 2 zeroes */
-
- "%c%c" /* domain length */
- "%c%c" /* domain allocated space */
- "%c%c" /* domain name offset */
- "%c%c" /* 2 zeroes */
-
- "%c%c" /* user length */
- "%c%c" /* user allocated space */
- "%c%c" /* user offset */
- "%c%c" /* 2 zeroes */
-
- "%c%c" /* host length */
- "%c%c" /* host allocated space */
- "%c%c" /* host offset */
- "%c%c" /* 2 zeroes */
-
- "%c%c" /* session key length (unknown purpose) */
- "%c%c" /* session key allocated space (unknown purpose) */
- "%c%c" /* session key offset (unknown purpose) */
- "%c%c" /* 2 zeroes */
-
- "%c%c%c%c", /* flags */
-
- /* domain string */
- /* user string */
- /* host string */
- /* LanManager response */
- /* NT response */
-
- 0, /* null-termination */
- 0, 0, 0, /* type-3 long, the 24 upper bits */
-
- SHORTPAIR(0x18), /* LanManager response length, twice */
- SHORTPAIR(0x18),
- SHORTPAIR(lmrespoff),
- 0x0, 0x0,
-
- SHORTPAIR(ntresplen), /* NT-response length, twice */
- SHORTPAIR(ntresplen),
- SHORTPAIR(ntrespoff),
- 0x0, 0x0,
-
- SHORTPAIR(domlen),
- SHORTPAIR(domlen),
- SHORTPAIR(domoff),
- 0x0, 0x0,
-
- SHORTPAIR(userlen),
- SHORTPAIR(userlen),
- SHORTPAIR(useroff),
- 0x0, 0x0,
-
- SHORTPAIR(hostlen),
- SHORTPAIR(hostlen),
- SHORTPAIR(hostoff),
- 0x0, 0x0,
-
- 0x0, 0x0,
- 0x0, 0x0,
- 0x0, 0x0,
- 0x0, 0x0,
-
- LONGQUARTET(ntlm->flags));
+ size = curl_msnprintf((char *)ntlmbuf, NTLM_BUFSIZE,
+ NTLMSSP_SIGNATURE "%c"
+ "\x03%c%c%c" /* 32-bit type = 3 */
+
+ "%c%c" /* LanManager length */
+ "%c%c" /* LanManager allocated space */
+ "%c%c" /* LanManager offset */
+ "%c%c" /* 2 zeroes */
+
+ "%c%c" /* NT-response length */
+ "%c%c" /* NT-response allocated space */
+ "%c%c" /* NT-response offset */
+ "%c%c" /* 2 zeroes */
+
+ "%c%c" /* domain length */
+ "%c%c" /* domain allocated space */
+ "%c%c" /* domain name offset */
+ "%c%c" /* 2 zeroes */
+
+ "%c%c" /* user length */
+ "%c%c" /* user allocated space */
+ "%c%c" /* user offset */
+ "%c%c" /* 2 zeroes */
+
+ "%c%c" /* host length */
+ "%c%c" /* host allocated space */
+ "%c%c" /* host offset */
+ "%c%c" /* 2 zeroes */
+
+ "%c%c" /* session key length (unknown purpose) */
+ "%c%c" /* session key allocated space
+ (unknown purpose) */
+ "%c%c" /* session key offset (unknown purpose) */
+ "%c%c" /* 2 zeroes */
+
+ "%c%c%c%c", /* flags */
+
+ /* domain string */
+ /* user string */
+ /* host string */
+ /* LanManager response */
+ /* NT response */
+
+ 0, /* null-termination */
+ 0, 0, 0, /* type-3 long, the 24 upper bits */
+
+ SHORTPAIR(0x18), /* LanManager response length,
+ twice */
+ SHORTPAIR(0x18),
+ SHORTPAIR(lmrespoff),
+ 0x0, 0x0,
+
+ SHORTPAIR(ntresplen), /* NT-response length, twice */
+ SHORTPAIR(ntresplen),
+ SHORTPAIR(ntrespoff),
+ 0x0, 0x0,
+
+ SHORTPAIR(domlen),
+ SHORTPAIR(domlen),
+ SHORTPAIR(domoff),
+ 0x0, 0x0,
+
+ SHORTPAIR(userlen),
+ SHORTPAIR(userlen),
+ SHORTPAIR(useroff),
+ 0x0, 0x0,
+
+ SHORTPAIR(hostlen),
+ SHORTPAIR(hostlen),
+ SHORTPAIR(hostoff),
+ 0x0, 0x0,
+
+ 0x0, 0x0,
+ 0x0, 0x0,
+ 0x0, 0x0,
+ 0x0, 0x0,
+
+ LONGQUARTET(ntlm->flags));
DEBUGASSERT(size == 64);
DEBUGASSERT(size == (size_t)lmrespoff);
}
DEBUG_OUT({
- fprintf(stderr, "**** TYPE3 header lmresp=");
+ curl_mfprintf(stderr, "**** TYPE3 header lmresp=");
ntlm_print_hex(stderr, (char *)&ntlmbuf[lmrespoff], 0x18);
});
size += ntresplen;
DEBUG_OUT({
- fprintf(stderr, "\n ntresp=");
+ curl_mfprintf(stderr, "\n ntresp=");
ntlm_print_hex(stderr, (char *)&ntlmbuf[ntrespoff], ntresplen);
});
free(ntlmv2resp);/* Free the dynamic buffer allocated for NTLMv2 */
DEBUG_OUT({
- fprintf(stderr, "\n flags=0x%02.2x%02.2x%02.2x%02.2x 0x%08.8x ",
- LONGQUARTET(ntlm->flags), ntlm->flags);
+ curl_mfprintf(stderr, "\n flags=0x%02.2x%02.2x%02.2x%02.2x 0x%08.8x ",
+ LONGQUARTET(ntlm->flags), ntlm->flags);
ntlm_print_flags(stderr, ntlm->flags);
- fprintf(stderr, "\n****\n");
+ curl_mfprintf(stderr, "\n****\n");
});
/* Make sure that the domain, user and host strings fit in the
#include "vauth.h"
#include "../curlx/warnless.h"
-#include "../curl_printf.h"
/* The last #include files should be: */
#include "../curl_memory.h"
/* Generate the message */
if(port == 0 || port == 80)
- oauth = aprintf("n,a=%s,\1host=%s\1auth=Bearer %s\1\1", user, host,
- bearer);
+ oauth = curl_maprintf("n,a=%s,\1host=%s\1auth=Bearer %s\1\1", user, host,
+ bearer);
else
- oauth = aprintf("n,a=%s,\1host=%s\1port=%ld\1auth=Bearer %s\1\1", user,
- host, port, bearer);
+ oauth = curl_maprintf("n,a=%s,\1host=%s\1port=%ld\1auth=Bearer %s\1\1",
+ user, host, port, bearer);
if(!oauth)
return CURLE_OUT_OF_MEMORY;
struct bufref *out)
{
/* Generate the message */
- char *xoauth = aprintf("user=%s\1auth=Bearer %s\1\1", user, bearer);
+ char *xoauth = curl_maprintf("user=%s\1auth=Bearer %s\1\1", user, bearer);
if(!xoauth)
return CURLE_OUT_OF_MEMORY;
#include "../strdup.h"
#include "../urldata.h"
#include "../curlx/multibyte.h"
-#include "../curl_printf.h"
#include "../url.h"
/* The last #include files should be: */
/* Generate our SPN */
if(host && realm)
- spn = aprintf("%s/%s@%s", service, host, realm);
+ spn = curl_maprintf("%s/%s@%s", service, host, realm);
else if(host)
- spn = aprintf("%s/%s", service, host);
+ spn = curl_maprintf("%s/%s", service, host);
else if(realm)
- spn = aprintf("%s@%s", service, realm);
+ spn = curl_maprintf("%s@%s", service, realm);
/* Return our newly allocated SPN */
return spn;
formulate the SPN instead. */
/* Generate our UTF8 based SPN */
- utf8_spn = aprintf("%s/%s", service, host);
+ utf8_spn = curl_maprintf("%s/%s", service, host);
if(!utf8_spn)
return NULL;
#include "http2.h"
#include "vssh/ssh.h"
#include "vquic/vquic.h"
-#include "curl_printf.h"
#include "easy_lock.h"
#ifdef USE_ARES
unsigned int major = brotli_version >> 24;
unsigned int minor = (brotli_version & 0x00FFFFFF) >> 12;
unsigned int patch = brotli_version & 0x00000FFF;
- (void)msnprintf(buf, bufsz, "brotli/%u.%u.%u", major, minor, patch);
+ (void)curl_msnprintf(buf, bufsz, "brotli/%u.%u.%u", major, minor, patch);
}
#endif
unsigned int major = version / (100 * 100);
unsigned int minor = (version - (major * 100 * 100)) / 100;
unsigned int patch = version - (major * 100 * 100) - (minor * 100);
- (void)msnprintf(buf, bufsz, "zstd/%u.%u.%u", major, minor, patch);
+ (void)curl_msnprintf(buf, bufsz, "zstd/%u.%u.%u", major, minor, patch);
}
#endif
unsigned int minor =
(((unsigned int)api.ldapai_vendor_version - major * 10000)
- patch) / 100;
- msnprintf(buf, bufsz, "%s/%u.%u.%u",
- api.ldapai_vendor_name, major, minor, patch);
+ curl_msnprintf(buf, bufsz, "%s/%u.%u.%u",
+ api.ldapai_vendor_name, major, minor, patch);
ldap_memfree(api.ldapai_vendor_name);
ber_memvfree((void **)api.ldapai_extensions);
}
else
- msnprintf(buf, bufsz, "OpenLDAP");
+ curl_msnprintf(buf, bufsz, "OpenLDAP");
}
#endif
#if defined(PSL_VERSION_MAJOR) && (PSL_VERSION_MAJOR > 0 || \
PSL_VERSION_MINOR >= 11)
int num = psl_check_version_number(0);
- msnprintf(buf, bufsz, "libpsl/%d.%d.%d",
- num >> 16, (num >> 8) & 0xff, num & 0xff);
+ curl_msnprintf(buf, bufsz, "libpsl/%d.%d.%d",
+ num >> 16, (num >> 8) & 0xff, num & 0xff);
#else
- msnprintf(buf, bufsz, "libpsl/%s", psl_get_version());
+ curl_msnprintf(buf, bufsz, "libpsl/%s", psl_get_version());
#endif
}
#endif
static void idn_version(char *buf, size_t bufsz)
{
#ifdef USE_LIBIDN2
- msnprintf(buf, bufsz, "libidn2/%s", idn2_check_version(NULL));
+ curl_msnprintf(buf, bufsz, "libidn2/%s", idn2_check_version(NULL));
#elif defined(USE_WIN32_IDN)
- msnprintf(buf, bufsz, "WinIDN");
+ curl_msnprintf(buf, bufsz, "WinIDN");
#elif defined(USE_APPLE_IDN)
- msnprintf(buf, bufsz, "AppleIDN");
+ curl_msnprintf(buf, bufsz, "AppleIDN");
#endif
}
#endif
/* Override version string when environment variable CURL_VERSION is set */
const char *debugversion = getenv("CURL_VERSION");
if(debugversion) {
- msnprintf(out, sizeof(out), "%s", debugversion);
+ curl_msnprintf(out, sizeof(out), "%s", debugversion);
return out;
}
#endif
src[i++] = ssl_version;
#endif
#ifdef HAVE_LIBZ
- msnprintf(z_version, sizeof(z_version), "zlib/%s", zlibVersion());
+ curl_msnprintf(z_version, sizeof(z_version), "zlib/%s", zlibVersion());
src[i++] = z_version;
#endif
#ifdef HAVE_BROTLI
src[i++] = zstd_ver;
#endif
#ifdef USE_ARES
- msnprintf(cares_version, sizeof(cares_version),
- "c-ares/%s", ares_version(NULL));
+ curl_msnprintf(cares_version, sizeof(cares_version),
+ "c-ares/%s", ares_version(NULL));
src[i++] = cares_version;
#endif
#ifdef USE_IDN
src[i++] = rtmp_version;
#endif
#ifdef USE_GSASL
- msnprintf(gsasl_buf, sizeof(gsasl_buf), "libgsasl/%s",
- gsasl_check_version(NULL));
+ curl_msnprintf(gsasl_buf, sizeof(gsasl_buf), "libgsasl/%s",
+ gsasl_check_version(NULL));
src[i++] = gsasl_buf;
#endif
#ifdef USE_OPENLDAP
#include "../curlx/warnless.h"
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "../curl_memory.h"
#include "../memdebug.h"
{
const ngtcp2_info *ng2 = ngtcp2_version(0);
const nghttp3_info *ht3 = nghttp3_version(0);
- (void)msnprintf(p, len, "ngtcp2/%s nghttp3/%s",
- ng2->version_str, ht3->version_str);
+ (void)curl_msnprintf(p, len, "ngtcp2/%s nghttp3/%s",
+ ng2->version_str, ht3->version_str);
}
struct cf_ngtcp2_ctx {
(void)ctx; /* need an easy handle to infof() message */
va_list ap;
va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
+ curl_mvfprintf(stderr, fmt, ap);
va_end(ap);
- fprintf(stderr, "\n");
+ curl_mfprintf(stderr, "\n");
}
#endif
#include "../curlx/warnless.h"
#include "../curlx/strerr.h"
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "../curl_memory.h"
#include "../memdebug.h"
lerr = SSL_get_verify_result(ctx->tls.ossl.ssl);
if(lerr != X509_V_OK) {
ssl_config->certverifyresult = lerr;
- msnprintf(ebuf, sizeof(ebuf),
- "SSL certificate problem: %s",
- X509_verify_cert_error_string(lerr));
+ curl_msnprintf(ebuf, sizeof(ebuf),
+ "SSL certificate problem: %s",
+ X509_verify_cert_error_string(lerr));
}
else
err_descr = "SSL certificate verification failed";
(const char *)h3val.base, h3val.len);
if(result)
return -1;
- ncopy = msnprintf(line, sizeof(line), "HTTP/3 %03d \r\n",
- stream->status_code);
+ ncopy = curl_msnprintf(line, sizeof(line), "HTTP/3 %03d \r\n",
+ stream->status_code);
CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] status: %s", stream_id, line);
result = write_resp_raw(cf, data, line, ncopy, FALSE);
if(result) {
void Curl_osslq_ver(char *p, size_t len)
{
const nghttp3_info *ht3 = nghttp3_version(0);
- (void)msnprintf(p, len, "nghttp3/%s", ht3->version_str);
+ (void)curl_msnprintf(p, len, "nghttp3/%s", ht3->version_str);
}
#endif /* !CURL_DISABLE_HTTP && USE_OPENSSL_QUIC && USE_NGHTTP3 */
#include "../vtls/keylog.h"
#include "../vtls/vtls.h"
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "../curl_memory.h"
#include "../memdebug.h"
*/
void Curl_quiche_ver(char *p, size_t len)
{
- (void)msnprintf(p, len, "quiche/%s", quiche_version());
+ (void)curl_msnprintf(p, len, "quiche/%s", quiche_version());
}
struct cf_quiche_ctx {
static void quiche_debug_log(const char *line, void *argp)
{
(void)argp;
- fprintf(stderr, "%s\n", line);
+ curl_mfprintf(stderr, "%s\n", line);
}
#endif
#include "../vtls/vtls_scache.h"
#include "vquic-tls.h"
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "../curl_memory.h"
#include "../memdebug.h"
#include "../curlx/strerr.h"
#include "../curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "../curl_memory.h"
#include "../memdebug.h"
result = curlx_dyn_add(&fname, "/");
for(i = 0; (i < scidlen) && !result; i++) {
char hex[3];
- msnprintf(hex, 3, "%02x", scid[i]);
+ curl_msnprintf(hex, 3, "%02x", scid[i]);
result = curlx_dyn_add(&fname, hex);
}
if(!result)
#include <fcntl.h>
#endif
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "../curl_memory.h"
#include "../memdebug.h"
}
for(i = 0; i < 16; i++)
- msnprintf(&md5buffer[i*2], 3, "%02x", (unsigned char)hash[i]);
+ curl_msnprintf(&md5buffer[i*2], 3, "%02x", (unsigned char)hash[i]);
infof(data, "SSH MD5 fingerprint: %s", md5buffer);
if(data->set.list_only) {
char *tmpLine;
- tmpLine = aprintf("%s\n", sshc->readdir_filename);
+ tmpLine = curl_maprintf("%s\n", sshc->readdir_filename);
if(!tmpLine) {
myssh_to(data, sshc, SSH_SFTP_CLOSE);
sshc->actualcode = CURLE_OUT_OF_MEMORY;
if((sshc->readdir_attrs->flags & SSH_FILEXFER_ATTR_PERMISSIONS) &&
((sshc->readdir_attrs->permissions & SSH_S_IFMT) ==
SSH_S_IFLNK)) {
- sshc->readdir_linkPath = aprintf("%s%s", sshp->path,
- sshc->readdir_filename);
+ sshc->readdir_linkPath = curl_maprintf("%s%s", sshp->path,
+ sshc->readdir_filename);
if(!sshc->readdir_linkPath) {
myssh_to(data, sshc, SSH_SFTP_CLOSE);
#define CURL_LIBSSH_VFS_SIZE_MASK PRIu64
#endif
CURLcode result = CURLE_OK;
- char *tmp = aprintf("statvfs:\n"
- "f_bsize: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
- "f_frsize: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
- "f_blocks: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
- "f_bfree: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
- "f_bavail: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
- "f_files: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
- "f_ffree: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
- "f_favail: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
- "f_fsid: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
- "f_flag: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
- "f_namemax: %" CURL_LIBSSH_VFS_SIZE_MASK "\n",
- statvfs->f_bsize, statvfs->f_frsize,
- statvfs->f_blocks, statvfs->f_bfree,
- statvfs->f_bavail, statvfs->f_files,
- statvfs->f_ffree, statvfs->f_favail,
- statvfs->f_fsid, statvfs->f_flag,
- statvfs->f_namemax);
+ char *tmp = curl_maprintf("statvfs:\n"
+ "f_bsize: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+ "f_frsize: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+ "f_blocks: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+ "f_bfree: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+ "f_bavail: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+ "f_files: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+ "f_ffree: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+ "f_favail: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+ "f_fsid: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+ "f_flag: %" CURL_LIBSSH_VFS_SIZE_MASK "\n"
+ "f_namemax: %" CURL_LIBSSH_VFS_SIZE_MASK "\n",
+ statvfs->f_bsize, statvfs->f_frsize,
+ statvfs->f_blocks, statvfs->f_bfree,
+ statvfs->f_bavail, statvfs->f_files,
+ statvfs->f_ffree, statvfs->f_favail,
+ statvfs->f_fsid, statvfs->f_flag,
+ statvfs->f_namemax);
sftp_statvfs_free(statvfs);
if(!tmp)
if(curl_strequal("pwd", cmd)) {
/* output debug output if that is requested */
- char *tmp = aprintf("257 \"%s\" is current directory.\n", sshp->path);
+ char *tmp = curl_maprintf("257 \"%s\" is current directory.\n",
+ sshp->path);
if(!tmp) {
sshc->actualcode = CURLE_OUT_OF_MEMORY;
myssh_to(data, sshc, SSH_SFTP_CLOSE);
if(conn->bits.ipv6_ip) {
char ipv6[MAX_IPADR_LEN];
- msnprintf(ipv6, sizeof(ipv6), "[%s]", conn->host.name);
+ curl_msnprintf(ipv6, sizeof(ipv6), "[%s]", conn->host.name);
rc = ssh_options_set(sshc->ssh_session, SSH_OPTIONS_HOST, ipv6);
}
else
CURLcode Curl_ssh_init(void)
{
if(ssh_init()) {
- DEBUGF(fprintf(stderr, "Error: libssh_init failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: libssh_init failed\n"));
return CURLE_FAILED_INIT;
}
return CURLE_OK;
void Curl_ssh_version(char *buffer, size_t buflen)
{
- (void)msnprintf(buffer, buflen, "libssh/%s", ssh_version(0));
+ (void)curl_msnprintf(buffer, buflen, "libssh/%s", ssh_version(0));
}
#endif /* USE_LIBSSH */
#include "../curlx/base64.h" /* for base64 encoding/decoding */
#include "../curl_sha256.h"
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "../curl_memory.h"
#include "../memdebug.h"
struct Curl_easy *data = (struct Curl_easy *)*abstract;
#ifdef CURL_LIBSSH2_DEBUG
- fprintf(stderr, "name=%s\n", name);
- fprintf(stderr, "name_len=%d\n", name_len);
- fprintf(stderr, "instruction=%s\n", instruction);
- fprintf(stderr, "instruction_len=%d\n", instruction_len);
- fprintf(stderr, "num_prompts=%d\n", num_prompts);
+ curl_mfprintf(stderr, "name=%s\n", name);
+ curl_mfprintf(stderr, "name_len=%d\n", name_len);
+ curl_mfprintf(stderr, "instruction=%s\n", instruction);
+ curl_mfprintf(stderr, "instruction_len=%d\n", instruction_len);
+ curl_mfprintf(stderr, "num_prompts=%d\n", num_prompts);
#else
(void)name;
(void)name_len;
/* The fingerprint points to static storage (!), do not free() it. */
int i;
for(i = 0; i < 16; i++) {
- msnprintf(&md5buffer[i*2], 3, "%02x", (unsigned char) fingerprint[i]);
+ curl_msnprintf(&md5buffer[i*2], 3, "%02x",
+ (unsigned char)fingerprint[i]);
}
infof(data, "SSH MD5 fingerprint: %s", md5buffer);
if(curl_strequal("pwd", cmd)) {
/* output debug output if that is requested */
- char *tmp = aprintf("257 \"%s\" is current directory.\n", sshp->path);
+ char *tmp = curl_maprintf("257 \"%s\" is current directory.\n",
+ sshp->path);
if(!tmp)
return CURLE_OUT_OF_MEMORY;
Curl_debug(data, CURLINFO_HEADER_OUT, "PWD\n", 4);
/* If no private key file is specified, try some common paths. */
if(home) {
/* Try ~/.ssh first. */
- sshc->rsa = aprintf("%s/.ssh/id_rsa", home);
+ sshc->rsa = curl_maprintf("%s/.ssh/id_rsa", home);
if(!sshc->rsa)
out_of_memory = TRUE;
else if(curlx_stat(sshc->rsa, &sbuf)) {
free(sshc->rsa);
- sshc->rsa = aprintf("%s/.ssh/id_dsa", home);
+ sshc->rsa = curl_maprintf("%s/.ssh/id_dsa", home);
if(!sshc->rsa)
out_of_memory = TRUE;
else if(curlx_stat(sshc->rsa, &sbuf)) {
#define CURL_LIBSSH2_VFS_SIZE_MASK "llu"
#endif
CURLcode result;
- char *tmp = aprintf("statvfs:\n"
- "f_bsize: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
- "f_frsize: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
- "f_blocks: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
- "f_bfree: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
- "f_bavail: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
- "f_files: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
- "f_ffree: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
- "f_favail: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
- "f_fsid: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
- "f_flag: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
- "f_namemax: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n",
- statvfs.f_bsize, statvfs.f_frsize,
- statvfs.f_blocks, statvfs.f_bfree,
- statvfs.f_bavail, statvfs.f_files,
- statvfs.f_ffree, statvfs.f_favail,
- statvfs.f_fsid, statvfs.f_flag,
- statvfs.f_namemax);
+ char *tmp = curl_maprintf("statvfs:\n"
+ "f_bsize: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+ "f_frsize: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+ "f_blocks: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+ "f_bfree: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+ "f_bavail: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+ "f_files: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+ "f_ffree: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+ "f_favail: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+ "f_fsid: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+ "f_flag: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n"
+ "f_namemax: %" CURL_LIBSSH2_VFS_SIZE_MASK "\n",
+ statvfs.f_bsize, statvfs.f_frsize,
+ statvfs.f_blocks, statvfs.f_bfree,
+ statvfs.f_bavail, statvfs.f_files,
+ statvfs.f_ffree, statvfs.f_favail,
+ statvfs.f_fsid, statvfs.f_flag,
+ statvfs.f_namemax);
if(!tmp) {
myssh_state(data, sshc, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
CURLcode Curl_ssh_init(void)
{
if(libssh2_init(0)) {
- DEBUGF(fprintf(stderr, "Error: libssh2_init failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: libssh2_init failed\n"));
return CURLE_FAILED_INIT;
}
return CURLE_OK;
void Curl_ssh_version(char *buffer, size_t buflen)
{
- (void)msnprintf(buffer, buflen, "libssh2/%s", libssh2_version(0));
+ (void)curl_msnprintf(buffer, buflen, "libssh2/%s", libssh2_version(0));
}
/* The SSH session is associated with the *CONNECTION* but the callback user
#if defined(USE_MBEDTLS) || defined(USE_RUSTLS)
#include "cipher_suite.h"
-#include "../curl_printf.h"
#include <string.h>
/*
/* append the part string to the buffer */
if(i > 0)
- r = msnprintf(&buf[len], buf_size - len, "%c%s", separator, entry);
+ r = curl_msnprintf(&buf[len], buf_size - len, "%c%s", separator, entry);
else
- r = msnprintf(&buf[len], buf_size - len, "%s", entry);
+ r = curl_msnprintf(&buf[len], buf_size - len, "%s", entry);
if(r < 0)
return -1;
r = cs_zip_to_str(cs_list[j].zip, buf, buf_size);
if(r < 0)
- msnprintf(buf, buf_size, "TLS_UNKNOWN_0x%04x", id);
+ curl_msnprintf(buf, buf_size, "TLS_UNKNOWN_0x%04x", id);
return r;
}
#include "../curlx/warnless.h"
#include "x509asn1.h"
#include "../multiif.h"
-#include "../curl_printf.h"
#include "../curl_memory.h"
/* The last #include file should be: */
#include "../memdebug.h"
#ifdef GTLSDEBUG
static void tls_log_func(int level, const char *str)
{
- fprintf(stderr, "|<%d>| %s", level, str);
+ curl_mfprintf(stderr, "|<%d>| %s", level, str);
}
#endif
static bool gtls_inited = FALSE;
if(result)
return;
- msnprintf(str,
- sizeof(str),
- " %s: %s, %02d %s %4d %02d:%02d:%02d GMT",
- text,
- Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
- tm->tm_mday,
- Curl_month[tm->tm_mon],
- tm->tm_year + 1900,
- tm->tm_hour,
- tm->tm_min,
- tm->tm_sec);
+ curl_msnprintf(str,
+ sizeof(str),
+ " %s: %s, %02d %s %4d %02d:%02d:%02d GMT",
+ text,
+ Curl_wkday[tm->tm_wday ? tm->tm_wday-1 : 6],
+ tm->tm_mday,
+ Curl_month[tm->tm_mon],
+ tm->tm_year + 1900,
+ tm->tm_hour,
+ tm->tm_min,
+ tm->tm_sec);
infof(data, "%s", str);
}
#endif
size_t Curl_gtls_version(char *buffer, size_t size)
{
- return msnprintf(buffer, size, "GnuTLS/%s", gnutls_check_version(NULL));
+ return curl_msnprintf(buffer, size, "GnuTLS/%s", gnutls_check_version(NULL));
}
/* data might be NULL! */
#include "mbedtls_threadlock.h"
#include "../strdup.h"
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "../curl_memory.h"
#include "../memdebug.h"
bool prefer_rfc)
{
if(id == MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8)
- msnprintf(buf, buf_size, "%s", "TLS_ECJPAKE_WITH_AES_128_CCM_8");
+ curl_msnprintf(buf, buf_size, "%s", "TLS_ECJPAKE_WITH_AES_128_CCM_8");
else
return Curl_cipher_suite_get_str(id, buf, buf_size, prefer_rfc);
return 0;
#ifdef MBEDTLS_VERSION_C
/* if mbedtls_version_get_number() is available it is better */
unsigned int version = mbedtls_version_get_number();
- return msnprintf(buffer, size, "mbedTLS/%u.%u.%u", version >> 24,
- (version >> 16) & 0xff, (version >> 8) & 0xff);
+ return curl_msnprintf(buffer, size, "mbedTLS/%u.%u.%u", version >> 24,
+ (version >> 16) & 0xff, (version >> 8) & 0xff);
#else
- return msnprintf(buffer, size, "mbedTLS/%s", MBEDTLS_VERSION_STRING);
+ return curl_msnprintf(buffer, size, "mbedTLS/%s", MBEDTLS_VERSION_STRING);
#endif
}
#endif
#include "mbedtls_threadlock.h"
-#include "../curl_printf.h"
+
+/* The last 2 #include files should be: */
#include "../curl_memory.h"
-/* The last #include file should be: */
#include "../memdebug.h"
/* number of thread locks */
if(n < NUMT) {
#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
if(pthread_mutex_lock(&mutex_buf[n])) {
- DEBUGF(fprintf(stderr,
- "Error: mbedtlsthreadlock_lock_function failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: "
+ "mbedtlsthreadlock_lock_function failed\n"));
return 0; /* pthread_mutex_lock failed */
}
#elif defined(_WIN32)
if(WaitForSingleObject(mutex_buf[n], INFINITE) == WAIT_FAILED) {
- DEBUGF(fprintf(stderr,
- "Error: mbedtlsthreadlock_lock_function failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: "
+ "mbedtlsthreadlock_lock_function failed\n"));
return 0; /* pthread_mutex_lock failed */
}
#endif /* USE_THREADS_POSIX && HAVE_PTHREAD_H */
if(n < NUMT) {
#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
if(pthread_mutex_unlock(&mutex_buf[n])) {
- DEBUGF(fprintf(stderr,
- "Error: mbedtlsthreadlock_unlock_function failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: "
+ "mbedtlsthreadlock_unlock_function failed\n"));
return 0; /* pthread_mutex_unlock failed */
}
#elif defined(_WIN32)
if(!ReleaseMutex(mutex_buf[n])) {
- DEBUGF(fprintf(stderr,
- "Error: mbedtlsthreadlock_unlock_function failed\n"));
+ DEBUGF(curl_mfprintf(stderr, "Error: "
+ "mbedtlsthreadlock_unlock_function failed\n"));
return 0; /* pthread_mutex_lock failed */
}
#endif /* USE_THREADS_POSIX && HAVE_PTHREAD_H */
#include "../curlx/strerr.h"
#include "../curlx/strparse.h"
#include "../strdup.h"
-#include "../curl_printf.h"
#include "apple.h"
#include <openssl/ssl.h>
{
char namebuf[32];
- msnprintf(namebuf, sizeof(namebuf), "%s(%s)", type, name);
+ curl_msnprintf(namebuf, sizeof(namebuf), "%s(%s)", type, name);
if(bn)
BN_print(mem, bn);
case 0:
break;
default:
- msnprintf(unknown, sizeof(unknown), "(%x)", ssl_ver);
+ curl_msnprintf(unknown, sizeof(unknown), "(%x)", ssl_ver);
verstr = unknown;
break;
}
msg_name = ssl_msg_type(ssl_ver, msg_type);
}
- txt_len = msnprintf(ssl_buf, sizeof(ssl_buf),
- "%s (%s), %s, %s (%d):\n",
- verstr, direction ? "OUT" : "IN",
- tls_rt_name, msg_name, msg_type);
+ txt_len = curl_msnprintf(ssl_buf, sizeof(ssl_buf),
+ "%s (%s), %s, %s (%d):\n",
+ verstr, direction ? "OUT" : "IN",
+ tls_rt_name, msg_name, msg_type);
Curl_debug(data, CURLINFO_TEXT, ssl_buf, (size_t)txt_len);
}
char group_name[80] = "";
get_group_name = EVP_PKEY_get_group_name(current_pkey, group_name,
sizeof(group_name), NULL);
- msnprintf(group_name_final, sizeof(group_name_final), "/%s", group_name);
+ curl_msnprintf(group_name_final, sizeof(group_name_final), "/%s",
+ group_name);
}
type_name = current_pkey ? EVP_PKEY_get0_type_name(current_pkey) : NULL;
#else
else if(sockerr)
curlx_strerror(sockerr, error_buffer, sizeof(error_buffer));
else
- msnprintf(error_buffer, sizeof(error_buffer), "%s",
- SSL_ERROR_to_str(err));
+ curl_msnprintf(error_buffer, sizeof(error_buffer), "%s",
+ SSL_ERROR_to_str(err));
failf(data, OSSL_PACKAGE " SSL_write:early_data: %s, errno %d",
error_buffer, sockerr);
else if(sockerr)
curlx_strerror(sockerr, error_buffer, sizeof(error_buffer));
else
- msnprintf(error_buffer, sizeof(error_buffer), "%s",
- SSL_ERROR_to_str(err));
+ curl_msnprintf(error_buffer, sizeof(error_buffer), "%s",
+ SSL_ERROR_to_str(err));
failf(data, OSSL_PACKAGE " SSL_write: %s, errno %d",
error_buffer, sockerr);
else if(sockerr && err == SSL_ERROR_SYSCALL)
curlx_strerror(sockerr, error_buffer, sizeof(error_buffer));
else
- msnprintf(error_buffer, sizeof(error_buffer), "%s",
- SSL_ERROR_to_str(err));
+ curl_msnprintf(error_buffer, sizeof(error_buffer), "%s",
+ SSL_ERROR_to_str(err));
failf(data, OSSL_PACKAGE " SSL_read: %s, errno %d",
error_buffer, sockerr);
result = CURLE_RECV_ERROR;
if(sockerr)
curlx_strerror(sockerr, error_buffer, sizeof(error_buffer));
else {
- msnprintf(error_buffer, sizeof(error_buffer),
- "Connection closed abruptly");
+ curl_msnprintf(error_buffer, sizeof(error_buffer),
+ "Connection closed abruptly");
}
failf(data, OSSL_PACKAGE " SSL_read: %s, errno %d",
error_buffer, sockerr);
if(curl_strnequal(ver, expected, sizeof(expected) - 1)) {
ver += sizeof(expected) - 1;
}
- count = msnprintf(buffer, size, "%s/%s", OSSL_PACKAGE, ver);
+ count = curl_msnprintf(buffer, size, "%s/%s", OSSL_PACKAGE, ver);
for(p = buffer; *p; ++p) {
if(ISBLANK(*p))
*p = '_';
return count;
#elif defined(OPENSSL_IS_BORINGSSL)
#ifdef CURL_BORINGSSL_VERSION
- return msnprintf(buffer, size, "%s/%s",
- OSSL_PACKAGE, CURL_BORINGSSL_VERSION);
+ return curl_msnprintf(buffer, size, "%s/%s",
+ OSSL_PACKAGE, CURL_BORINGSSL_VERSION);
#else
- return msnprintf(buffer, size, OSSL_PACKAGE);
+ return curl_msnprintf(buffer, size, OSSL_PACKAGE);
#endif
#elif defined(OPENSSL_IS_AWSLC)
- return msnprintf(buffer, size, "%s/%s",
- OSSL_PACKAGE, AWSLC_VERSION_NUMBER_STRING);
+ return curl_msnprintf(buffer, size, "%s/%s",
+ OSSL_PACKAGE, AWSLC_VERSION_NUMBER_STRING);
#elif defined(OPENSSL_VERSION_STRING) /* OpenSSL 3+ */
- return msnprintf(buffer, size, "%s/%s",
- OSSL_PACKAGE, OpenSSL_version(OPENSSL_VERSION_STRING));
+ return curl_msnprintf(buffer, size, "%s/%s",
+ OSSL_PACKAGE, OpenSSL_version(OPENSSL_VERSION_STRING));
#else
/* not LibreSSL, BoringSSL and not using OpenSSL_version */
else
sub[0]='\0';
- return msnprintf(buffer, size, "%s/%lx.%lx.%lx%s"
+ return curl_msnprintf(buffer, size, "%s/%lx.%lx.%lx%s"
#ifdef OPENSSL_FIPS
- "-fips"
-#endif
- ,
- OSSL_PACKAGE,
- (ssleay_value >> 28) & 0xf,
- (ssleay_value >> 20) & 0xff,
- (ssleay_value >> 12) & 0xff,
- sub);
+ "-fips"
+#endif
+ ,
+ OSSL_PACKAGE,
+ (ssleay_value >> 28) & 0xf,
+ (ssleay_value >> 20) & 0xff,
+ (ssleay_value >> 12) & 0xff,
+ sub);
#endif
}
#ifdef USE_RUSTLS
-#include "../curl_printf.h"
-
#include <rustls.h>
#include "../curlx/fopen.h"
(void)client_random_len;
DEBUGASSERT(client_random_len == CLIENT_RANDOM_SIZE);
/* Turning a "rustls_str" into a null delimited "c" string */
- msnprintf(clabel, label.len + 1, "%.*s", (int)label.len, label.data);
+ curl_msnprintf(clabel, label.len + 1, "%.*s", (int)label.len, label.data);
Curl_tls_keylog_write(clabel, client_random, secret, secret_len);
}
static size_t cr_version(char *buffer, size_t size)
{
const struct rustls_str ver = rustls_version();
- return msnprintf(buffer, size, "%.*s", (int)ver.len, ver.data);
+ return curl_msnprintf(buffer, size, "%.*s", (int)ver.len, ver.data);
}
static CURLcode
#include "../curlx/multibyte.h"
#include "../curlx/warnless.h"
#include "x509asn1.h"
-#include "../curl_printf.h"
#include "../multiif.h"
#include "../system_win32.h"
#include "../curlx/version_win32.h"
#define CERT_THUMBPRINT_DATA_LEN 20
/* Uncomment to force verbose output
- * #define infof(x, y, ...) printf(y, __VA_ARGS__)
- * #define failf(x, y, ...) printf(y, __VA_ARGS__)
+ * #define infof(x, y, ...) curl_mprintf(y, __VA_ARGS__)
+ * #define failf(x, y, ...) curl_mprintf(y, __VA_ARGS__)
*/
/* Offered when targeting Vista (XP SP2+) */
static size_t schannel_version(char *buffer, size_t size)
{
- return msnprintf(buffer, size, "Schannel");
+ return curl_msnprintf(buffer, size, "Schannel");
}
static CURLcode schannel_random(struct Curl_easy *data,
#include "../strerror.h"
#include "../curlx/winapi.h"
#include "../curlx/multibyte.h"
-#include "../curl_printf.h"
#include "hostcheck.h"
#include "../curlx/version_win32.h"
#include "../curl_sha256.h"
#include "../curlx/warnless.h"
#include "../curlx/base64.h"
-#include "../curl_printf.h"
#include "../curlx/inet_pton.h"
#include "../connect.h"
#include "../select.h"
bool paren = (selected != available_backends[i]);
if(available_backends[i]->version(vb, sizeof(vb))) {
- p += msnprintf(p, end - p, "%s%s%s%s", (p != backends ? " " : ""),
- (paren ? "(" : ""), vb, (paren ? ")" : ""));
+ p += curl_msnprintf(p, end - p, "%s%s%s%s", (p != backends ? " " : ""),
+ (paren ? "(" : ""), vb, (paren ? ")" : ""));
}
}
#include "../curl_sha256.h"
#include "../rand.h"
#include "../curlx/warnless.h"
-#include "../curl_printf.h"
#include "../strdup.h"
/* The last #include files should be: */
#include "../select.h"
#include "../strdup.h"
#include "x509asn1.h"
-#include "../curl_printf.h"
#include "../multiif.h"
#include <wolfssl/ssl.h>
size_t Curl_wssl_version(char *buffer, size_t size)
{
#if LIBWOLFSSL_VERSION_HEX >= 0x03006000
- return msnprintf(buffer, size, "wolfSSL/%s", wolfSSL_lib_version());
+ return curl_msnprintf(buffer, size, "wolfSSL/%s", wolfSSL_lib_version());
#elif defined(WOLFSSL_VERSION)
- return msnprintf(buffer, size, "wolfSSL/%s", WOLFSSL_VERSION);
+ return curl_msnprintf(buffer, size, "wolfSSL/%s", WOLFSSL_VERSION);
#endif
}
#include "x509asn1.h"
#include "../curlx/dynbuf.h"
-/* The last 3 #include files should be in this order */
-#include "../curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "../curl_memory.h"
#include "../memdebug.h"
infof(data, " ECC Public Key (%zu bits)", len);
if(data->set.ssl.certinfo) {
char q[sizeof(len) * 8 / 3 + 1];
- (void)msnprintf(q, sizeof(q), "%zu", len);
+ (void)curl_msnprintf(q, sizeof(q), "%zu", len);
if(ssl_push_certinfo(data, certnum, "ECC Public Key", q))
return 1;
}
infof(data, " RSA Public Key (%zu bits)", len);
if(data->set.ssl.certinfo) {
char r[sizeof(len) * 8 / 3 + 1];
- msnprintf(r, sizeof(r), "%zu", len);
+ curl_msnprintf(r, sizeof(r), "%zu", len);
if(ssl_push_certinfo(data, certnum, "RSA Public Key", r))
return 1;
}
#include "curlx/nonblock.h"
#include "curlx/strparse.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
+/* The last 2 #include files should be in this order */
#include "curl_memory.h"
#include "memdebug.h"
}
if(quote) {
+ /* !checksrc! disable BANNEDFUNC 1 */
fprintf(stderr, "Unterminated quote: %c\n", quote);
return -1;
}
--- /dev/null
+allowfunc printf
mk-ca-bundle.pl mk-unity.pl schemetable.c cd2nroff nroff2cd cdall cd2cd managen \
dmaketgz maketgz release-tools.sh verify-release cmakelint.sh mdlinkcheck \
CMakeLists.txt perlcheck.sh pythonlint.sh randdisable wcurl top-complexity \
- extract-unit-protos
+ extract-unit-protos .checksrc
dist_bin_SCRIPTS = wcurl
"snprintf" => 1,
"vsprintf" => 1,
"vsnprintf" => 1,
+ "aprintf" => 1,
+ "fprintf" => 1,
+ "msnprintf" => 1,
+ "mvsnprintf" => 1,
+ "printf" => 1,
+ "vaprintf" => 1,
+ "vfprintf" => 1,
+ "vprintf" => 1,
"sscanf" => 1,
"strcat" => 1,
"strerror" => 1,
enable STDERR
-banfunc aprintf
-banfunc fprintf
-banfunc msnprintf
-banfunc mvsnprintf
-banfunc printf
-banfunc vaprintf
-banfunc vfprintf
-banfunc vprintf
int main(int argc, char **argv)
{
(void)argc;
+ /* !checksrc! disable BANNEDFUNC 1 */
printf("libcurl test: |%s|%s|\n", argv[0], curl_version());
return 0;
}
+++ /dev/null
-banfunc aprintf
-banfunc fprintf
-banfunc msnprintf
-banfunc mvsnprintf
-banfunc printf
-banfunc vaprintf
-banfunc vfprintf
-banfunc vprintf
# Get BUNDLE, FIRST_C, FIRST_H, UTILS_C, UTILS_H, CURLX_C, TESTS_C variables
include Makefile.inc
-EXTRA_DIST = CMakeLists.txt .checksrc $(FIRST_C) $(FIRST_H) $(UTILS_C) $(UTILS_H) $(TESTS_C) \
+EXTRA_DIST = CMakeLists.txt $(FIRST_C) $(FIRST_H) $(UTILS_C) $(UTILS_H) $(TESTS_C) \
test307.pl test610.pl test613.pl test1013.pl test1022.pl mk-lib1521.pl
CFLAGS += @CURL_CFLAG_EXTRAS@
allowfunc accept
allowfunc fclose
allowfunc fopen
+allowfunc fprintf
allowfunc freeaddrinfo
allowfunc getaddrinfo
allowfunc open
+allowfunc printf
allowfunc recv
allowfunc send
allowfunc snprintf
+++ /dev/null
-banfunc aprintf
-banfunc fprintf
-banfunc msnprintf
-banfunc mvsnprintf
-banfunc printf
-banfunc vaprintf
-banfunc vfprintf
-banfunc vprintf
# Get BUNDLE, FIRST_C, TESTS_C variables
include Makefile.inc
-EXTRA_DIST = CMakeLists.txt .checksrc README.md $(TESTS_C)
+EXTRA_DIST = CMakeLists.txt README.md $(TESTS_C)
CFLAGS += @CURL_CFLAG_EXTRAS@
+++ /dev/null
-banfunc aprintf
-banfunc fprintf
-banfunc msnprintf
-banfunc mvsnprintf
-banfunc printf
-banfunc vaprintf
-banfunc vfprintf
-banfunc vprintf
# Get BUNDLE, FIRST_C, TESTS_C variables
include Makefile.inc
-EXTRA_DIST = CMakeLists.txt .checksrc README.md $(TESTS_C)
+EXTRA_DIST = CMakeLists.txt README.md $(TESTS_C)
CFLAGS += @CURL_CFLAG_EXTRAS@