mirror of
https://github.com/curl/curl.git
synced 2026-04-14 18:21:40 +03:00
src: stop overriding system printf symbols
Also:
- tool_operate: use the socket printf mask, drop cast.
Follow-up to 4deea9396b #18814
Closes #18844
This commit is contained in:
parent
34ad78da89
commit
db98daab05
25 changed files with 203 additions and 207 deletions
|
|
@ -1 +1,9 @@
|
|||
enable STDERR
|
||||
banfunc aprintf
|
||||
banfunc fprintf
|
||||
banfunc msnprintf
|
||||
banfunc mvsnprintf
|
||||
banfunc printf
|
||||
banfunc vaprintf
|
||||
banfunc vfprintf
|
||||
banfunc vprintf
|
||||
|
|
|
|||
|
|
@ -114,7 +114,8 @@ static char *ssl_backend(void)
|
|||
if(!already) { /* if there is no existing version */
|
||||
const char *v = curl_version_info(CURLVERSION_NOW)->ssl_version;
|
||||
if(v)
|
||||
msnprintf(ssl_ver, sizeof(ssl_ver), "%.*s", (int) strcspn(v, " "), v);
|
||||
curl_msnprintf(ssl_ver, sizeof(ssl_ver),
|
||||
"%.*s", (int)strcspn(v, " "), v);
|
||||
already = TRUE;
|
||||
}
|
||||
return ssl_ver;
|
||||
|
|
|
|||
|
|
@ -246,6 +246,7 @@ int main(int argc, char **argv)
|
|||
(void)argv;
|
||||
|
||||
for(i = 0; i < CURL_ARRAYSIZE(disabled); i++)
|
||||
/* !checksrc! disable BANNEDFUNC 1 */
|
||||
printf("%s\n", disabled[i]);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ static const char *hms_for_sec(time_t tv_sec)
|
|||
if(tv_sec != cached_tv_sec) {
|
||||
/* !checksrc! disable BANNEDFUNC 1 */
|
||||
struct tm *now = localtime(&tv_sec); /* not thread safe either */
|
||||
msnprintf(hms_buf, sizeof(hms_buf), "%02d:%02d:%02d",
|
||||
now->tm_hour, now->tm_min, now->tm_sec);
|
||||
curl_msnprintf(hms_buf, sizeof(hms_buf), "%02d:%02d:%02d",
|
||||
now->tm_hour, now->tm_min, now->tm_sec);
|
||||
cached_tv_sec = tv_sec;
|
||||
}
|
||||
return hms_buf;
|
||||
|
|
@ -64,7 +64,7 @@ static void log_line_start(FILE *log, const char *timebuf,
|
|||
"* ", "< ", "> ", "{ ", "} ", "{ ", "} "
|
||||
};
|
||||
if((timebuf && *timebuf) || (idsbuf && *idsbuf))
|
||||
fprintf(log, "%s%s%s", timebuf, idsbuf, s_infotype[type]);
|
||||
curl_mfprintf(log, "%s%s%s", timebuf, idsbuf, s_infotype[type]);
|
||||
else
|
||||
fputs(s_infotype[type], log);
|
||||
}
|
||||
|
|
@ -96,8 +96,8 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
|
|||
|
||||
if(global->tracetime) {
|
||||
tv = tvrealnow();
|
||||
msnprintf(timebuf, sizeof(timebuf), "%s.%06ld ",
|
||||
hms_for_sec(tv.tv_sec), (long)tv.tv_usec);
|
||||
curl_msnprintf(timebuf, sizeof(timebuf), "%s.%06ld ",
|
||||
hms_for_sec(tv.tv_sec), (long)tv.tv_usec);
|
||||
}
|
||||
else
|
||||
timebuf[0] = 0;
|
||||
|
|
@ -106,11 +106,11 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
|
|||
!curl_easy_getinfo(handle, CURLINFO_XFER_ID, &xfer_id) && xfer_id >= 0) {
|
||||
if(!curl_easy_getinfo(handle, CURLINFO_CONN_ID, &conn_id) &&
|
||||
conn_id >= 0) {
|
||||
msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_2,
|
||||
xfer_id, conn_id);
|
||||
curl_msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_2,
|
||||
xfer_id, conn_id);
|
||||
}
|
||||
else {
|
||||
msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_1, xfer_id);
|
||||
curl_msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_1, xfer_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -184,7 +184,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
|
|||
((output != tool_stderr) && (output != stdout))) {
|
||||
if(!newl)
|
||||
log_line_start(output, timebuf, idsbuf, type);
|
||||
fprintf(output, "[%zu bytes data]\n", size);
|
||||
curl_mfprintf(output, "[%zu bytes data]\n", size);
|
||||
newl = FALSE;
|
||||
traced_data = TRUE;
|
||||
}
|
||||
|
|
@ -201,7 +201,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
|
|||
|
||||
switch(type) {
|
||||
case CURLINFO_TEXT:
|
||||
fprintf(output, "%s%s* %.*s", timebuf, idsbuf, (int)size, data);
|
||||
curl_mfprintf(output, "%s%s* %.*s", timebuf, idsbuf, (int)size, data);
|
||||
FALLTHROUGH();
|
||||
default: /* in case a new one is introduced to shock us */
|
||||
return 0;
|
||||
|
|
@ -244,18 +244,18 @@ static void dump(const char *timebuf, const char *idsbuf, const char *text,
|
|||
/* without the hex output, we can fit more on screen */
|
||||
width = 0x40;
|
||||
|
||||
fprintf(stream, "%s%s%s, %zu bytes (0x%zx)\n", timebuf, idsbuf,
|
||||
text, size, size);
|
||||
curl_mfprintf(stream, "%s%s%s, %zu bytes (0x%zx)\n", timebuf, idsbuf,
|
||||
text, size, size);
|
||||
|
||||
for(i = 0; i < size; i += width) {
|
||||
|
||||
fprintf(stream, "%04zx: ", i);
|
||||
curl_mfprintf(stream, "%04zx: ", i);
|
||||
|
||||
if(tracetype == TRACE_BIN) {
|
||||
/* hex not disabled, show it */
|
||||
for(c = 0; c < width; c++)
|
||||
if(i + c < size)
|
||||
fprintf(stream, "%02x ", ptr[i + c]);
|
||||
curl_mfprintf(stream, "%02x ", ptr[i + c]);
|
||||
else
|
||||
fputs(" ", stream);
|
||||
}
|
||||
|
|
@ -269,8 +269,9 @@ static void dump(const char *timebuf, const char *idsbuf, const char *text,
|
|||
break;
|
||||
}
|
||||
(void)infotype;
|
||||
fprintf(stream, "%c", ((ptr[i + c] >= 0x20) && (ptr[i + c] < 0x7F)) ?
|
||||
ptr[i + c] : UNPRINTABLE_CHAR);
|
||||
curl_mfprintf(stream, "%c",
|
||||
((ptr[i + c] >= 0x20) && (ptr[i + c] < 0x7F)) ?
|
||||
ptr[i + c] : UNPRINTABLE_CHAR);
|
||||
/* check again for 0D0A, to avoid an extra \n if it is at width */
|
||||
if((tracetype == TRACE_ASCII) &&
|
||||
(i + c + 2 < size) && (ptr[i + c + 1] == 0x0D) &&
|
||||
|
|
|
|||
|
|
@ -217,8 +217,8 @@ size_t tool_header_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
|
|||
}
|
||||
|
||||
if(per->config->output_dir) {
|
||||
outs->filename = aprintf("%s/%s", per->config->output_dir,
|
||||
filename);
|
||||
outs->filename = curl_maprintf("%s/%s", per->config->output_dir,
|
||||
filename);
|
||||
free(filename);
|
||||
if(!outs->filename)
|
||||
return CURL_WRITEFUNC_ERROR;
|
||||
|
|
@ -248,7 +248,7 @@ size_t tool_header_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
|
|||
hdrcbdata->config->show_headers) {
|
||||
/* still awaiting the Content-Disposition header, store the header in
|
||||
memory. Since it is not null-terminated, we need an extra dance. */
|
||||
char *clone = aprintf("%.*s", (int)cb, str);
|
||||
char *clone = curl_maprintf("%.*s", (int)cb, str);
|
||||
if(clone) {
|
||||
struct curl_slist *old = hdrcbdata->headlist;
|
||||
hdrcbdata->headlist = curl_slist_append(old, clone);
|
||||
|
|
@ -295,7 +295,7 @@ size_t tool_header_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
|
|||
value = memchr(ptr, ':', cb);
|
||||
if(value) {
|
||||
size_t namelen = value - ptr;
|
||||
fprintf(outs->stream, BOLD "%.*s" BOLDOFF ":", (int)namelen, ptr);
|
||||
curl_mfprintf(outs->stream, BOLD "%.*s" BOLDOFF ":", (int)namelen, ptr);
|
||||
#ifndef LINK
|
||||
fwrite(&value[1], cb - namelen - 1, 1, outs->stream);
|
||||
#else
|
||||
|
|
@ -461,10 +461,10 @@ static void write_linked_location(CURL *curl, const char *location,
|
|||
!strcmp("https", scheme) ||
|
||||
!strcmp("ftp", scheme) ||
|
||||
!strcmp("ftps", scheme)) {
|
||||
fprintf(stream, "%.*s" LINK "%s" LINKST "%.*s" LINKOFF,
|
||||
space_skipped, location,
|
||||
finalurl,
|
||||
(int)loclen - space_skipped, loc);
|
||||
curl_mfprintf(stream, "%.*s" LINK "%s" LINKST "%.*s" LINKOFF,
|
||||
space_skipped, location,
|
||||
finalurl,
|
||||
(int)loclen - space_skipped, loc);
|
||||
goto locdone;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -208,12 +208,12 @@ int tool_progress_cb(void *clientp,
|
|||
num = MAX_BARLENGTH;
|
||||
memset(line, '#', num);
|
||||
line[num] = '\0';
|
||||
msnprintf(format, sizeof(format), "\r%%-%ds %%5.1f%%%%", barwidth);
|
||||
curl_msnprintf(format, sizeof(format), "\r%%-%ds %%5.1f%%%%", barwidth);
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
fprintf(bar->out, format, line, percent);
|
||||
curl_mfprintf(bar->out, format, line, percent);
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -39,24 +39,6 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
/* make the tool use the libcurl *printf family */
|
||||
# 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
|
||||
|
||||
#define checkprefix(a,b) curl_strnequal(b, STRCONST(a))
|
||||
|
||||
#define tool_safefree(ptr) \
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ CURLcode easysrc_addf(struct slist_wc **plist, const char *fmt, ...)
|
|||
char *bufp;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
bufp = vaprintf(fmt, ap);
|
||||
bufp = curl_mvaprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
if(!bufp) {
|
||||
ret = CURLE_OUT_OF_MEMORY;
|
||||
|
|
@ -190,41 +190,41 @@ void dumpeasysrc(void)
|
|||
const char *c;
|
||||
|
||||
for(i = 0; ((c = srchead[i]) != NULL); i++)
|
||||
fprintf(out, "%s\n", c);
|
||||
curl_mfprintf(out, "%s\n", c);
|
||||
|
||||
/* Declare variables used for complex setopt values */
|
||||
if(easysrc_decl) {
|
||||
for(ptr = easysrc_decl->first; ptr; ptr = ptr->next)
|
||||
fprintf(out, " %s\n", ptr->data);
|
||||
curl_mfprintf(out, " %s\n", ptr->data);
|
||||
}
|
||||
|
||||
/* Set up complex values for setopt calls */
|
||||
if(easysrc_data) {
|
||||
fprintf(out, "\n");
|
||||
curl_mfprintf(out, "\n");
|
||||
|
||||
for(ptr = easysrc_data->first; ptr; ptr = ptr->next)
|
||||
fprintf(out, " %s\n", ptr->data);
|
||||
curl_mfprintf(out, " %s\n", ptr->data);
|
||||
}
|
||||
|
||||
fprintf(out, "\n");
|
||||
curl_mfprintf(out, "\n");
|
||||
if(easysrc_code) {
|
||||
for(ptr = easysrc_code->first; ptr; ptr = ptr->next) {
|
||||
if(ptr->data[0]) {
|
||||
fprintf(out, " %s\n", ptr->data);
|
||||
curl_mfprintf(out, " %s\n", ptr->data);
|
||||
}
|
||||
else {
|
||||
fprintf(out, "\n");
|
||||
curl_mfprintf(out, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(easysrc_clean) {
|
||||
for(ptr = easysrc_clean->first; ptr; ptr = ptr->next)
|
||||
fprintf(out, " %s\n", ptr->data);
|
||||
curl_mfprintf(out, " %s\n", ptr->data);
|
||||
}
|
||||
|
||||
for(i = 0; ((c = srcend[i]) != NULL); i++)
|
||||
fprintf(out, "%s\n", c);
|
||||
curl_mfprintf(out, "%s\n", c);
|
||||
|
||||
if(fopened)
|
||||
curlx_fclose(out);
|
||||
|
|
|
|||
|
|
@ -69,9 +69,9 @@ static char *checkhome(const char *home, const char *fname, bool dotscore)
|
|||
for(i = 0; i < (dotscore ? 2 : 1); i++) {
|
||||
char *c;
|
||||
if(dotscore)
|
||||
c = aprintf("%s" DIR_CHAR "%c%s", home, pref[i], &fname[1]);
|
||||
c = curl_maprintf("%s" DIR_CHAR "%c%s", home, pref[i], &fname[1]);
|
||||
else
|
||||
c = aprintf("%s" DIR_CHAR "%s", home, fname);
|
||||
c = curl_maprintf("%s" DIR_CHAR "%s", home, fname);
|
||||
if(c) {
|
||||
int fd = curlx_open(c, O_RDONLY);
|
||||
if(fd >= 0) {
|
||||
|
|
@ -115,7 +115,7 @@ char *findfile(const char *fname, int dotscore)
|
|||
continue;
|
||||
}
|
||||
if(conf_list[i].append) {
|
||||
char *c = aprintf("%s%s", home, conf_list[i].append);
|
||||
char *c = curl_maprintf("%s%s", home, conf_list[i].append);
|
||||
curl_free(home);
|
||||
if(!c)
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -751,8 +751,8 @@ static CURLcode set_trace_config(const char *token)
|
|||
}
|
||||
else {
|
||||
char buffer[64];
|
||||
msnprintf(buffer, sizeof(buffer), "%c%.*s,-lib-ids", toggle ? '+' : '-',
|
||||
(int)len, name);
|
||||
curl_msnprintf(buffer, sizeof(buffer), "%c%.*s,-lib-ids",
|
||||
toggle ? '+' : '-', (int)len, name);
|
||||
result = curl_global_trace(buffer);
|
||||
if(result)
|
||||
goto out;
|
||||
|
|
@ -1140,7 +1140,7 @@ static ParameterError parse_localport(struct OperationConfig *config,
|
|||
if(ISBLANK(*pp))
|
||||
pp++;
|
||||
}
|
||||
msnprintf(buffer, sizeof(buffer), "%.*s", (int)plen, nextarg);
|
||||
curl_msnprintf(buffer, sizeof(buffer), "%.*s", (int)plen, nextarg);
|
||||
if(str2unummax(&config->localport, buffer, 65535))
|
||||
return PARAM_BAD_USE;
|
||||
if(!pp)
|
||||
|
|
@ -1222,7 +1222,7 @@ static ParameterError parse_ech(struct OperationConfig *config,
|
|||
curlx_fclose(file);
|
||||
if(err)
|
||||
return err;
|
||||
config->ech_config = aprintf("ecl:%s",tmpcfg);
|
||||
config->ech_config = curl_maprintf("ecl:%s",tmpcfg);
|
||||
free(tmpcfg);
|
||||
if(!config->ech_config)
|
||||
return PARAM_NO_MEM;
|
||||
|
|
@ -1405,8 +1405,8 @@ static ParameterError parse_range(struct OperationConfig *config,
|
|||
char buffer[32];
|
||||
warnf("A specified range MUST include at least one dash (-). "
|
||||
"Appending one for you");
|
||||
msnprintf(buffer, sizeof(buffer), "%" CURL_FORMAT_CURL_OFF_T "-",
|
||||
value);
|
||||
curl_msnprintf(buffer, sizeof(buffer), "%" CURL_FORMAT_CURL_OFF_T "-",
|
||||
value);
|
||||
free(config->range);
|
||||
config->range = strdup(buffer);
|
||||
if(!config->range)
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ static void print_category(unsigned int category, unsigned int cols)
|
|||
else
|
||||
opt = 0;
|
||||
}
|
||||
printf(" %-*s %s\n", (int)opt, helptext[i].opt, helptext[i].desc);
|
||||
curl_mprintf(" %-*s %s\n", (int)opt, helptext[i].opt, helptext[i].desc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ static int get_category_content(const char *category, unsigned int cols)
|
|||
unsigned int i;
|
||||
for(i = 0; i < CURL_ARRAYSIZE(categories); ++i)
|
||||
if(curl_strequal(categories[i].opt, category)) {
|
||||
printf("%s: %s\n", categories[i].opt, categories[i].desc);
|
||||
curl_mprintf("%s: %s\n", categories[i].opt, categories[i].desc);
|
||||
print_category(categories[i].category, cols);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ static void get_categories(void)
|
|||
{
|
||||
unsigned int i;
|
||||
for(i = 0; i < CURL_ARRAYSIZE(categories); ++i)
|
||||
printf(" %-11s %s\n", categories[i].opt, categories[i].desc);
|
||||
curl_mprintf(" %-11s %s\n", categories[i].opt, categories[i].desc);
|
||||
}
|
||||
|
||||
/* Prints all categories as a comma-separated list of given width */
|
||||
|
|
@ -135,18 +135,18 @@ static void get_categories_list(unsigned int width)
|
|||
if(i == CURL_ARRAYSIZE(categories) - 1) {
|
||||
/* final category */
|
||||
if(col + len + 1 < width)
|
||||
printf("%s.\n", categories[i].opt);
|
||||
curl_mprintf("%s.\n", categories[i].opt);
|
||||
else
|
||||
/* start a new line first */
|
||||
printf("\n%s.\n", categories[i].opt);
|
||||
curl_mprintf("\n%s.\n", categories[i].opt);
|
||||
}
|
||||
else if(col + len + 2 < width) {
|
||||
printf("%s, ", categories[i].opt);
|
||||
curl_mprintf("%s, ", categories[i].opt);
|
||||
col += len + 2;
|
||||
}
|
||||
else {
|
||||
/* start a new line first */
|
||||
printf("\n%s, ", categories[i].opt);
|
||||
curl_mprintf("\n%s, ", categories[i].opt);
|
||||
col = len + 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -268,17 +268,17 @@ void tool_help(const char *category)
|
|||
else if(!category[2])
|
||||
a = findshortopt(category[1]);
|
||||
if(!a) {
|
||||
fprintf(tool_stderr, "Incorrect option name to show help for,"
|
||||
" see curl -h\n");
|
||||
curl_mfprintf(tool_stderr, "Incorrect option name to show help for,"
|
||||
" see curl -h\n");
|
||||
}
|
||||
else {
|
||||
char cmdbuf[80];
|
||||
if(a->letter != ' ')
|
||||
msnprintf(cmdbuf, sizeof(cmdbuf), "\n -%c, --", a->letter);
|
||||
curl_msnprintf(cmdbuf, sizeof(cmdbuf), "\n -%c, --", a->letter);
|
||||
else if(a->desc & ARG_NO)
|
||||
msnprintf(cmdbuf, sizeof(cmdbuf), "\n --no-%s", a->lname);
|
||||
curl_msnprintf(cmdbuf, sizeof(cmdbuf), "\n --no-%s", a->lname);
|
||||
else
|
||||
msnprintf(cmdbuf, sizeof(cmdbuf), "\n %s", category);
|
||||
curl_msnprintf(cmdbuf, sizeof(cmdbuf), "\n %s", category);
|
||||
#ifdef USE_MANUAL
|
||||
if(a->cmd == C_XATTR)
|
||||
/* this is the last option, which then ends when FILES starts */
|
||||
|
|
@ -288,8 +288,8 @@ void tool_help(const char *category)
|
|||
#endif
|
||||
}
|
||||
#else
|
||||
fprintf(tool_stderr, "Cannot comply. "
|
||||
"This curl was built without built-in manual\n");
|
||||
curl_mfprintf(tool_stderr, "Cannot comply. "
|
||||
"This curl was built without built-in manual\n");
|
||||
#endif
|
||||
}
|
||||
/* Otherwise print category and handle the case if the cat was not found */
|
||||
|
|
@ -312,15 +312,15 @@ void tool_version_info(void)
|
|||
{
|
||||
const char *const *builtin;
|
||||
if(is_debug())
|
||||
fprintf(tool_stderr, "WARNING: this libcurl is Debug-enabled, "
|
||||
"do not use in production\n\n");
|
||||
curl_mfprintf(tool_stderr, "WARNING: this libcurl is Debug-enabled, "
|
||||
"do not use in production\n\n");
|
||||
|
||||
printf(CURL_ID "%s\n", curl_version());
|
||||
curl_mprintf(CURL_ID "%s\n", curl_version());
|
||||
#ifdef CURL_PATCHSTAMP
|
||||
printf("Release-Date: %s, security patched: %s\n",
|
||||
LIBCURL_TIMESTAMP, CURL_PATCHSTAMP);
|
||||
curl_mprintf("Release-Date: %s, security patched: %s\n",
|
||||
LIBCURL_TIMESTAMP, CURL_PATCHSTAMP);
|
||||
#else
|
||||
printf("Release-Date: %s\n", LIBCURL_TIMESTAMP);
|
||||
curl_mprintf("Release-Date: %s\n", LIBCURL_TIMESTAMP);
|
||||
#endif
|
||||
if(built_in_protos[0]) {
|
||||
#ifndef CURL_DISABLE_IPFS
|
||||
|
|
@ -339,15 +339,15 @@ void tool_version_info(void)
|
|||
}
|
||||
}
|
||||
#endif /* !CURL_DISABLE_IPFS */
|
||||
printf("Protocols:");
|
||||
curl_mprintf("Protocols:");
|
||||
for(builtin = built_in_protos; *builtin; ++builtin) {
|
||||
/* Special case: do not list rtmp?* protocols.
|
||||
They may only appear together with "rtmp" */
|
||||
if(!curl_strnequal(*builtin, "rtmp", 4) || !builtin[0][4])
|
||||
printf(" %s", *builtin);
|
||||
curl_mprintf(" %s", *builtin);
|
||||
#ifndef CURL_DISABLE_IPFS
|
||||
if(insert && insert == *builtin) {
|
||||
printf(" ipfs ipns");
|
||||
curl_mprintf(" ipfs ipns");
|
||||
insert = NULL;
|
||||
}
|
||||
#endif /* !CURL_DISABLE_IPFS */
|
||||
|
|
@ -371,16 +371,16 @@ void tool_version_info(void)
|
|||
feat_ext[feat_ext_count] = NULL;
|
||||
qsort((void *)feat_ext, feat_ext_count, sizeof(*feat_ext),
|
||||
struplocompare4sort);
|
||||
printf("Features:");
|
||||
curl_mprintf("Features:");
|
||||
for(builtin = feat_ext; *builtin; ++builtin)
|
||||
printf(" %s", *builtin);
|
||||
curl_mprintf(" %s", *builtin);
|
||||
puts(""); /* newline */
|
||||
free((void *)feat_ext);
|
||||
}
|
||||
}
|
||||
if(strcmp(CURL_VERSION, curlinfo->version)) {
|
||||
printf("WARNING: curl and libcurl versions do not match. "
|
||||
"Functionality may be affected.\n");
|
||||
curl_mprintf("WARNING: curl and libcurl versions do not match. "
|
||||
"Functionality may be affected.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -395,7 +395,7 @@ void tool_list_engines(void)
|
|||
puts("Build-time engines:");
|
||||
if(engines) {
|
||||
for(; engines; engines = engines->next)
|
||||
printf(" %s\n", engines->data);
|
||||
curl_mprintf(" %s\n", engines->data);
|
||||
}
|
||||
else {
|
||||
puts(" <none>");
|
||||
|
|
|
|||
|
|
@ -76,14 +76,14 @@ static char *ipfs_gateway(void)
|
|||
if(!ipfs_path) {
|
||||
char *home = getenv("HOME");
|
||||
if(home && *home)
|
||||
ipfs_path = aprintf("%s/.ipfs/", home);
|
||||
ipfs_path = curl_maprintf("%s/.ipfs/", home);
|
||||
/* fallback to "~/.ipfs", as that is the default location. */
|
||||
}
|
||||
|
||||
if(!ipfs_path || ensure_trailing_slash(&ipfs_path))
|
||||
goto fail;
|
||||
|
||||
gateway_composed_file_path = aprintf("%sgateway", ipfs_path);
|
||||
gateway_composed_file_path = curl_maprintf("%sgateway", ipfs_path);
|
||||
|
||||
if(!gateway_composed_file_path)
|
||||
goto fail;
|
||||
|
|
@ -233,8 +233,8 @@ CURLcode ipfs_url_rewrite(CURLU *uh, const char *protocol, char **url,
|
|||
/* ensure the gateway path ends with a trailing slash */
|
||||
ensure_trailing_slash(&gwpath);
|
||||
|
||||
pathbuffer = aprintf("%s%s/%s%s", gwpath, protocol, cid,
|
||||
inputpath ? inputpath : "");
|
||||
pathbuffer = curl_maprintf("%s%s/%s%s", gwpath, protocol, cid,
|
||||
inputpath ? inputpath : "");
|
||||
if(!pathbuffer) {
|
||||
goto clean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ int main(int argc, char *argv[])
|
|||
if(argc == 2 && !_tcscmp(argv[1], _T("--dump-module-paths"))) {
|
||||
struct curl_slist *item, *head = GetLoadedModulePaths();
|
||||
for(item = head; item; item = item->next)
|
||||
printf("%s\n", item->data);
|
||||
curl_mprintf("%s\n", item->data);
|
||||
curl_slist_free_all(head);
|
||||
return head ? 0 : 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ static void voutf(const char *prefix,
|
|||
char *ptr;
|
||||
char *print_buffer;
|
||||
|
||||
print_buffer = vaprintf(fmt, ap);
|
||||
print_buffer = curl_mvaprintf(fmt, ap);
|
||||
if(!print_buffer)
|
||||
return;
|
||||
len = strlen(print_buffer);
|
||||
|
|
@ -120,15 +120,15 @@ void helpf(const char *fmt, ...)
|
|||
va_start(ap, fmt);
|
||||
DEBUGASSERT(!strchr(fmt, '\n'));
|
||||
fputs("curl: ", tool_stderr); /* prefix it */
|
||||
vfprintf(tool_stderr, fmt, ap);
|
||||
curl_mvfprintf(tool_stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
fputs("\n", tool_stderr); /* newline it */
|
||||
}
|
||||
fprintf(tool_stderr, "curl: try 'curl --help' "
|
||||
curl_mfprintf(tool_stderr, "curl: try 'curl --help' "
|
||||
#ifdef USE_MANUAL
|
||||
"or 'curl --manual' "
|
||||
"or 'curl --manual' "
|
||||
#endif
|
||||
"for more information\n");
|
||||
"for more information\n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -584,8 +584,8 @@ static CURLcode post_per_transfer(struct per_transfer *per,
|
|||
if(!config->synthetic_error && result &&
|
||||
(!global->silent || global->showerror)) {
|
||||
const char *msg = per->errorbuffer;
|
||||
fprintf(tool_stderr, "curl: (%d) %s\n", result,
|
||||
msg[0] ? msg : curl_easy_strerror(result));
|
||||
curl_mfprintf(tool_stderr, "curl: (%d) %s\n", result,
|
||||
msg[0] ? msg : curl_easy_strerror(result));
|
||||
if(result == CURLE_PEER_FAILED_VERIFICATION)
|
||||
fputs(CURL_CA_CERT_ERRORMSG, tool_stderr);
|
||||
}
|
||||
|
|
@ -595,9 +595,9 @@ static CURLcode post_per_transfer(struct per_transfer *per,
|
|||
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code);
|
||||
if(code >= 400) {
|
||||
if(!global->silent || global->showerror)
|
||||
fprintf(tool_stderr,
|
||||
"curl: (%d) The requested URL returned error: %ld\n",
|
||||
CURLE_HTTP_RETURNED_ERROR, code);
|
||||
curl_mfprintf(tool_stderr,
|
||||
"curl: (%d) The requested URL returned error: %ld\n",
|
||||
CURLE_HTTP_RETURNED_ERROR, code);
|
||||
result = CURLE_HTTP_RETURNED_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
@ -806,11 +806,11 @@ static CURLcode etag_compare(struct OperationConfig *config)
|
|||
|
||||
if((PARAM_OK == file2string(&etag_from_file, file)) &&
|
||||
etag_from_file) {
|
||||
header = aprintf("If-None-Match: %s", etag_from_file);
|
||||
header = curl_maprintf("If-None-Match: %s", etag_from_file);
|
||||
tool_safefree(etag_from_file);
|
||||
}
|
||||
else
|
||||
header = aprintf("If-None-Match: \"\"");
|
||||
header = curl_maprintf("If-None-Match: \"\"");
|
||||
|
||||
if(!header) {
|
||||
if(file)
|
||||
|
|
@ -955,7 +955,7 @@ static CURLcode setup_outfile(struct OperationConfig *config,
|
|||
DEBUGASSERT(per->outfile);
|
||||
|
||||
if(config->output_dir && *config->output_dir) {
|
||||
char *d = aprintf("%s/%s", config->output_dir, per->outfile);
|
||||
char *d = curl_maprintf("%s/%s", config->output_dir, per->outfile);
|
||||
if(!d)
|
||||
return CURLE_WRITE_ERROR;
|
||||
free(per->outfile);
|
||||
|
|
@ -1505,7 +1505,7 @@ static void on_uv_timeout(uv_timer_t *req)
|
|||
{
|
||||
struct datauv *uv = (struct datauv *) req->data;
|
||||
#if DEBUG_UV
|
||||
fprintf(tool_stderr, "parallel_event: on_uv_timeout\n");
|
||||
curl_mfprintf(tool_stderr, "parallel_event: on_uv_timeout\n");
|
||||
#endif
|
||||
if(uv && uv->s) {
|
||||
curl_multi_socket_action(uv->s->multi, CURL_SOCKET_TIMEOUT, 0,
|
||||
|
|
@ -1520,7 +1520,7 @@ static int cb_timeout(CURLM *multi, long timeout_ms, void *userp)
|
|||
struct datauv *uv = userp;
|
||||
(void)multi;
|
||||
#if DEBUG_UV
|
||||
fprintf(tool_stderr, "parallel_event: cb_timeout=%ld\n", timeout_ms);
|
||||
curl_mfprintf(tool_stderr, "parallel_event: cb_timeout=%ld\n", timeout_ms);
|
||||
#endif
|
||||
if(timeout_ms < 0)
|
||||
uv_timer_stop(&uv->timeout);
|
||||
|
|
@ -1571,8 +1571,8 @@ static int cb_socket(CURL *easy, curl_socket_t s, int action,
|
|||
(void)easy;
|
||||
|
||||
#if DEBUG_UV
|
||||
fprintf(tool_stderr, "parallel_event: cb_socket, fd=%d, action=%x, p=%p\n",
|
||||
(int)s, action, socketp);
|
||||
curl_mfprintf(tool_stderr, "parallel_event: cb_socket, "
|
||||
"fd=%" FMT_SOCKET_T ", action=%x, p=%p\n", s, action, socketp);
|
||||
#endif
|
||||
switch(action) {
|
||||
case CURL_POLL_IN:
|
||||
|
|
@ -1632,12 +1632,13 @@ static CURLcode parallel_event(struct parastate *s)
|
|||
|
||||
while(!s->mcode && (s->still_running || s->more_transfers)) {
|
||||
#if DEBUG_UV
|
||||
fprintf(tool_stderr, "parallel_event: uv_run(), mcode=%d, %d running, "
|
||||
"%d more\n", s->mcode, uv.s->still_running, s->more_transfers);
|
||||
curl_mfprintf(tool_stderr, "parallel_event: uv_run(), "
|
||||
"mcode=%d, %d running, %d more\n",
|
||||
s->mcode, uv.s->still_running, s->more_transfers);
|
||||
#endif
|
||||
uv_run(uv.loop, UV_RUN_DEFAULT);
|
||||
#if DEBUG_UV
|
||||
fprintf(tool_stderr, "parallel_event: uv_run() returned\n");
|
||||
curl_mfprintf(tool_stderr, "parallel_event: uv_run() returned\n");
|
||||
#endif
|
||||
|
||||
result = check_finished(s);
|
||||
|
|
@ -1680,8 +1681,8 @@ static CURLcode parallel_event(struct parastate *s)
|
|||
curl_multi_cleanup(s->multi);
|
||||
|
||||
#if DEBUG_UV
|
||||
fprintf(tool_stderr, "DONE parallel_event -> %d, mcode=%d, %d running, "
|
||||
"%d more\n",
|
||||
curl_mfprintf(tool_stderr, "DONE parallel_event -> %d, mcode=%d, "
|
||||
"%d running, %d more\n",
|
||||
result, s->mcode, uv.s->still_running, s->more_transfers);
|
||||
#endif
|
||||
return result;
|
||||
|
|
@ -1708,9 +1709,9 @@ static CURLcode check_finished(struct parastate *s)
|
|||
curl_multi_remove_handle(s->multi, easy);
|
||||
|
||||
if(ended->abort && (tres == CURLE_ABORTED_BY_CALLBACK)) {
|
||||
msnprintf(ended->errorbuffer, CURL_ERROR_SIZE,
|
||||
"Transfer aborted due to critical error "
|
||||
"in another transfer");
|
||||
curl_msnprintf(ended->errorbuffer, CURL_ERROR_SIZE,
|
||||
"Transfer aborted due to critical error "
|
||||
"in another transfer");
|
||||
}
|
||||
tres = post_per_transfer(ended, tres, &retry, &delay);
|
||||
progress_finalize(ended); /* before it goes away */
|
||||
|
|
@ -2190,7 +2191,7 @@ CURLcode operate(int argc, argv_item_t argv[])
|
|||
/* Check if we were asked to dump the embedded CA bundle */
|
||||
else if(res == PARAM_CA_EMBED_REQUESTED) {
|
||||
#ifdef CURL_CA_EMBED
|
||||
printf("%s", curl_ca_embed);
|
||||
curl_mprintf("%s", curl_ca_embed);
|
||||
#endif
|
||||
}
|
||||
else if(res == PARAM_LIBCURL_UNSUPPORTED_PROTOCOL)
|
||||
|
|
|
|||
|
|
@ -134,10 +134,10 @@ CURLcode add_file_name_to_url(CURL *curl, char **inurlp, const char *filename)
|
|||
char *newurl;
|
||||
if(ptr)
|
||||
/* there is a trailing slash on the path */
|
||||
newpath = aprintf("%s%s", path, encfile);
|
||||
newpath = curl_maprintf("%s%s", path, encfile);
|
||||
else
|
||||
/* there is no trailing slash on the path */
|
||||
newpath = aprintf("%s/%s", path, encfile);
|
||||
newpath = curl_maprintf("%s/%s", path, encfile);
|
||||
|
||||
curl_free(encfile);
|
||||
|
||||
|
|
|
|||
|
|
@ -475,7 +475,7 @@ ParameterError proto2num(const char * const *val, char **ostr, const char *str)
|
|||
else {
|
||||
char buffer[32];
|
||||
const char *p;
|
||||
msnprintf(buffer, sizeof(buffer), "%.*s", (int)plen, str);
|
||||
curl_msnprintf(buffer, sizeof(buffer), "%.*s", (int)plen, str);
|
||||
|
||||
p = proto_token(buffer);
|
||||
|
||||
|
|
@ -584,13 +584,13 @@ static CURLcode checkpasswd(const char *kind, /* for what purpose */
|
|||
|
||||
/* build a nice-looking prompt */
|
||||
if(!i && last)
|
||||
msnprintf(prompt, sizeof(prompt),
|
||||
"Enter %s password for user '%s':",
|
||||
kind, *userpwd);
|
||||
curl_msnprintf(prompt, sizeof(prompt),
|
||||
"Enter %s password for user '%s':",
|
||||
kind, *userpwd);
|
||||
else
|
||||
msnprintf(prompt, sizeof(prompt),
|
||||
"Enter %s password for user '%s' on URL #%zu:",
|
||||
kind, *userpwd, i + 1);
|
||||
curl_msnprintf(prompt, sizeof(prompt),
|
||||
"Enter %s password for user '%s' on URL #%zu:",
|
||||
kind, *userpwd, i + 1);
|
||||
|
||||
/* get password */
|
||||
getpass_r(prompt, passwd, sizeof(passwd));
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ int parseconfig(const char *filename)
|
|||
*line++ = '\0'; /* null-terminate, we have a local copy of the data */
|
||||
|
||||
#ifdef DEBUG_CONFIG
|
||||
fprintf(tool_stderr, "GOT: %s\n", option);
|
||||
curl_mfprintf(tool_stderr, "GOT: %s\n", option);
|
||||
#endif
|
||||
|
||||
/* pass spaces and separator(s) */
|
||||
|
|
@ -204,7 +204,7 @@ int parseconfig(const char *filename)
|
|||
}
|
||||
|
||||
#ifdef DEBUG_CONFIG
|
||||
fprintf(tool_stderr, "PARAM: \"%s\"\n",(param ? param : "(null)"));
|
||||
curl_mfprintf(tool_stderr, "PARAM: \"%s\"\n",(param ? param : "(null)"));
|
||||
#endif
|
||||
res = getparameter(option, param, &usedarg, config);
|
||||
config = global->last;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ static char *max5data(curl_off_t bytes, char *max5)
|
|||
const char unit[] = { 'k', 'M', 'G', 'T', 'P', 0 };
|
||||
int k = 0;
|
||||
if(bytes < 100000) {
|
||||
msnprintf(max5, 6, "%5" CURL_FORMAT_CURL_OFF_T, bytes);
|
||||
curl_msnprintf(max5, 6, "%5" CURL_FORMAT_CURL_OFF_T, bytes);
|
||||
return max5;
|
||||
}
|
||||
|
||||
|
|
@ -43,14 +43,15 @@ static char *max5data(curl_off_t bytes, char *max5)
|
|||
curl_off_t nbytes = bytes / 1024;
|
||||
if(nbytes < 100) {
|
||||
/* display with a decimal */
|
||||
msnprintf(max5, 6, "%2" CURL_FORMAT_CURL_OFF_T ".%0"
|
||||
CURL_FORMAT_CURL_OFF_T "%c", bytes/1024,
|
||||
(bytes%1024) / (1024/10), unit[k]);
|
||||
curl_msnprintf(max5, 6, "%2" CURL_FORMAT_CURL_OFF_T ".%0"
|
||||
CURL_FORMAT_CURL_OFF_T "%c", bytes/1024,
|
||||
(bytes%1024) / (1024/10), unit[k]);
|
||||
break;
|
||||
}
|
||||
else if(nbytes < 10000) {
|
||||
/* no decimals */
|
||||
msnprintf(max5, 6, "%4" CURL_FORMAT_CURL_OFF_T "%c", nbytes, unit[k]);
|
||||
curl_msnprintf(max5, 6, "%4" CURL_FORMAT_CURL_OFF_T "%c", nbytes,
|
||||
unit[k]);
|
||||
break;
|
||||
}
|
||||
bytes = nbytes;
|
||||
|
|
@ -97,8 +98,9 @@ static void time2str(char *r, curl_off_t seconds)
|
|||
if(h <= 99) {
|
||||
curl_off_t m = (seconds - (h * 3600)) / 60;
|
||||
curl_off_t s = (seconds - (h * 3600)) - (m * 60);
|
||||
msnprintf(r, 9, "%2" CURL_FORMAT_CURL_OFF_T ":%02" CURL_FORMAT_CURL_OFF_T
|
||||
":%02" CURL_FORMAT_CURL_OFF_T, h, m, s);
|
||||
curl_msnprintf(r, 9, "%2" CURL_FORMAT_CURL_OFF_T
|
||||
":%02" CURL_FORMAT_CURL_OFF_T
|
||||
":%02" CURL_FORMAT_CURL_OFF_T, h, m, s);
|
||||
}
|
||||
else {
|
||||
/* this equals to more than 99 hours, switch to a more suitable output
|
||||
|
|
@ -106,10 +108,10 @@ static void time2str(char *r, curl_off_t seconds)
|
|||
curl_off_t d = seconds / 86400;
|
||||
h = (seconds - (d * 86400)) / 3600;
|
||||
if(d <= 999)
|
||||
msnprintf(r, 9, "%3" CURL_FORMAT_CURL_OFF_T
|
||||
"d %02" CURL_FORMAT_CURL_OFF_T "h", d, h);
|
||||
curl_msnprintf(r, 9, "%3" CURL_FORMAT_CURL_OFF_T
|
||||
"d %02" CURL_FORMAT_CURL_OFF_T "h", d, h);
|
||||
else
|
||||
msnprintf(r, 9, "%7" CURL_FORMAT_CURL_OFF_T "d", d);
|
||||
curl_msnprintf(r, 9, "%7" CURL_FORMAT_CURL_OFF_T "d", d);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -204,16 +206,16 @@ bool progress_meter(CURLM *multi,
|
|||
}
|
||||
}
|
||||
if(dlknown && all_dltotal)
|
||||
msnprintf(dlpercen, sizeof(dlpercen), "%3" CURL_FORMAT_CURL_OFF_T,
|
||||
all_dlnow < (CURL_OFF_T_MAX/100) ?
|
||||
(all_dlnow * 100 / all_dltotal) :
|
||||
(all_dlnow / (all_dltotal/100)));
|
||||
curl_msnprintf(dlpercen, sizeof(dlpercen), "%3" CURL_FORMAT_CURL_OFF_T,
|
||||
all_dlnow < (CURL_OFF_T_MAX/100) ?
|
||||
(all_dlnow * 100 / all_dltotal) :
|
||||
(all_dlnow / (all_dltotal/100)));
|
||||
|
||||
if(ulknown && all_ultotal)
|
||||
msnprintf(ulpercen, sizeof(ulpercen), "%3" CURL_FORMAT_CURL_OFF_T,
|
||||
all_ulnow < (CURL_OFF_T_MAX/100) ?
|
||||
(all_ulnow * 100 / all_ultotal) :
|
||||
(all_ulnow / (all_ultotal/100)));
|
||||
curl_msnprintf(ulpercen, sizeof(ulpercen), "%3" CURL_FORMAT_CURL_OFF_T,
|
||||
all_ulnow < (CURL_OFF_T_MAX/100) ?
|
||||
(all_ulnow * 100 / all_ultotal) :
|
||||
(all_ulnow / (all_ultotal/100)));
|
||||
|
||||
/* get the transfer speed, the higher of the two */
|
||||
|
||||
|
|
@ -266,31 +268,31 @@ bool progress_meter(CURLM *multi,
|
|||
|
||||
(void)curl_multi_get_offt(multi, CURLMINFO_XFERS_ADDED, &xfers_added);
|
||||
(void)curl_multi_get_offt(multi, CURLMINFO_XFERS_RUNNING, &xfers_running);
|
||||
fprintf(tool_stderr,
|
||||
"\r"
|
||||
"%-3s " /* percent downloaded */
|
||||
"%-3s " /* percent uploaded */
|
||||
"%s " /* Dled */
|
||||
"%s " /* Uled */
|
||||
"%5" CURL_FORMAT_CURL_OFF_T " " /* Xfers */
|
||||
"%5" CURL_FORMAT_CURL_OFF_T " " /* Live */
|
||||
" %s " /* Total time */
|
||||
"%s " /* Current time */
|
||||
"%s " /* Time left */
|
||||
"%s " /* Speed */
|
||||
"%5s" /* final newline */,
|
||||
curl_mfprintf(tool_stderr,
|
||||
"\r"
|
||||
"%-3s " /* percent downloaded */
|
||||
"%-3s " /* percent uploaded */
|
||||
"%s " /* Dled */
|
||||
"%s " /* Uled */
|
||||
"%5" CURL_FORMAT_CURL_OFF_T " " /* Xfers */
|
||||
"%5" CURL_FORMAT_CURL_OFF_T " " /* Live */
|
||||
" %s " /* Total time */
|
||||
"%s " /* Current time */
|
||||
"%s " /* Time left */
|
||||
"%s " /* Speed */
|
||||
"%5s" /* final newline */,
|
||||
|
||||
dlpercen, /* 3 letters */
|
||||
ulpercen, /* 3 letters */
|
||||
max5data(all_dlnow, buffer[0]),
|
||||
max5data(all_ulnow, buffer[1]),
|
||||
xfers_added,
|
||||
xfers_running,
|
||||
time_total,
|
||||
time_spent,
|
||||
time_left,
|
||||
max5data(speed, buffer[2]), /* speed */
|
||||
final ? "\n" :"");
|
||||
dlpercen, /* 3 letters */
|
||||
ulpercen, /* 3 letters */
|
||||
max5data(all_dlnow, buffer[0]),
|
||||
max5data(all_ulnow, buffer[1]),
|
||||
xfers_added,
|
||||
xfers_running,
|
||||
time_total,
|
||||
time_spent,
|
||||
time_left,
|
||||
max5data(speed, buffer[2]), /* speed */
|
||||
final ? "\n" :"");
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -334,8 +334,8 @@ CURLcode tool_setopt_bitmask(CURL *curl, const char *name, CURLoption tag,
|
|||
char preamble[80];
|
||||
unsigned long rest = (unsigned long)lval;
|
||||
const struct NameValueUnsigned *nv = NULL;
|
||||
msnprintf(preamble, sizeof(preamble),
|
||||
"curl_easy_setopt(hnd, %s, ", name);
|
||||
curl_msnprintf(preamble, sizeof(preamble),
|
||||
"curl_easy_setopt(hnd, %s, ", name);
|
||||
for(nv = nvlist; nv->name; nv++) {
|
||||
if((nv->value & ~ rest) == 0) {
|
||||
/* all value flags contained in rest */
|
||||
|
|
@ -345,8 +345,8 @@ CURLcode tool_setopt_bitmask(CURL *curl, const char *name, CURLoption tag,
|
|||
if(!rest || ret)
|
||||
break; /* handled them all */
|
||||
/* replace with all spaces for continuation line */
|
||||
msnprintf(preamble, sizeof(preamble), "%*s", (int)strlen(preamble),
|
||||
"");
|
||||
curl_msnprintf(preamble, sizeof(preamble), "%*s",
|
||||
(int)strlen(preamble), "");
|
||||
}
|
||||
}
|
||||
/* If any bits have no definition, output an explicit value.
|
||||
|
|
|
|||
|
|
@ -466,16 +466,16 @@ CURLcode glob_url(struct URLGlob *glob, char *url, curl_off_t *urlnum,
|
|||
char text[512];
|
||||
const char *t;
|
||||
if(glob->pos) {
|
||||
msnprintf(text, sizeof(text), "%s in URL position %zu:\n%s\n%*s^",
|
||||
glob->error,
|
||||
glob->pos, url, (int)glob->pos - 1, " ");
|
||||
curl_msnprintf(text, sizeof(text), "%s in URL position %zu:\n%s\n%*s^",
|
||||
glob->error,
|
||||
glob->pos, url, (int)glob->pos - 1, " ");
|
||||
t = text;
|
||||
}
|
||||
else
|
||||
t = glob->error;
|
||||
|
||||
/* send error description to the error-stream */
|
||||
fprintf(error, "curl: (%d) %s\n", res, t);
|
||||
curl_mfprintf(error, "curl: (%d) %s\n", res, t);
|
||||
}
|
||||
/* it failed, we cleanup */
|
||||
glob_cleanup(glob);
|
||||
|
|
|
|||
|
|
@ -176,14 +176,14 @@ static void decc_init(void)
|
|||
}
|
||||
else {
|
||||
/* Invalid DECC feature value. */
|
||||
printf(" INVALID DECC FEATURE VALUE, %d: %d <= %s <= %d.\n",
|
||||
feat_value,
|
||||
feat_value_min, decc_feat_array[i].name, feat_value_max);
|
||||
curl_mprintf(" INVALID DECC FEATURE VALUE, %d: %d <= %s <= %d.\n",
|
||||
feat_value,
|
||||
feat_value_min, decc_feat_array[i].name, feat_value_max);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Invalid DECC feature name. */
|
||||
printf(" UNKNOWN DECC FEATURE: %s.\n", decc_feat_array[i].name);
|
||||
curl_mprintf(" UNKNOWN DECC FEATURE: %s.\n", decc_feat_array[i].name);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,14 +176,14 @@ static int writeTime(FILE *stream, const struct writeoutvar *wovar,
|
|||
us %= 1000000;
|
||||
|
||||
if(use_json)
|
||||
fprintf(stream, "\"%s\":", wovar->name);
|
||||
curl_mfprintf(stream, "\"%s\":", wovar->name);
|
||||
|
||||
fprintf(stream, "%" CURL_FORMAT_CURL_OFF_TU
|
||||
".%06" CURL_FORMAT_CURL_OFF_TU, secs, us);
|
||||
curl_mfprintf(stream, "%" CURL_FORMAT_CURL_OFF_TU
|
||||
".%06" CURL_FORMAT_CURL_OFF_TU, secs, us);
|
||||
}
|
||||
else {
|
||||
if(use_json)
|
||||
fprintf(stream, "\"%s\":null", wovar->name);
|
||||
curl_mfprintf(stream, "\"%s\":null", wovar->name);
|
||||
}
|
||||
|
||||
return 1; /* return 1 if anything was written */
|
||||
|
|
@ -414,7 +414,7 @@ static int writeString(FILE *stream, const struct writeoutvar *wovar,
|
|||
DEBUGASSERT(!valid || strinfo);
|
||||
if(valid && strinfo) {
|
||||
if(use_json) {
|
||||
fprintf(stream, "\"%s\":", wovar->name);
|
||||
curl_mfprintf(stream, "\"%s\":", wovar->name);
|
||||
jsonWriteString(stream, strinfo, FALSE);
|
||||
}
|
||||
else
|
||||
|
|
@ -422,7 +422,7 @@ static int writeString(FILE *stream, const struct writeoutvar *wovar,
|
|||
}
|
||||
else {
|
||||
if(use_json)
|
||||
fprintf(stream, "\"%s\":null", wovar->name);
|
||||
curl_mfprintf(stream, "\"%s\":null", wovar->name);
|
||||
}
|
||||
curl_free((char *)CURL_UNCONST(freestr));
|
||||
|
||||
|
|
@ -470,17 +470,17 @@ static int writeLong(FILE *stream, const struct writeoutvar *wovar,
|
|||
|
||||
if(valid) {
|
||||
if(use_json)
|
||||
fprintf(stream, "\"%s\":%ld", wovar->name, longinfo);
|
||||
curl_mfprintf(stream, "\"%s\":%ld", wovar->name, longinfo);
|
||||
else {
|
||||
if(wovar->id == VAR_HTTP_CODE || wovar->id == VAR_HTTP_CODE_PROXY)
|
||||
fprintf(stream, "%03ld", longinfo);
|
||||
curl_mfprintf(stream, "%03ld", longinfo);
|
||||
else
|
||||
fprintf(stream, "%ld", longinfo);
|
||||
curl_mfprintf(stream, "%ld", longinfo);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(use_json)
|
||||
fprintf(stream, "\"%s\":null", wovar->name);
|
||||
curl_mfprintf(stream, "\"%s\":null", wovar->name);
|
||||
}
|
||||
|
||||
return 1; /* return 1 if anything was written */
|
||||
|
|
@ -516,13 +516,13 @@ static int writeOffset(FILE *stream, const struct writeoutvar *wovar,
|
|||
|
||||
if(valid) {
|
||||
if(use_json)
|
||||
fprintf(stream, "\"%s\":", wovar->name);
|
||||
curl_mfprintf(stream, "\"%s\":", wovar->name);
|
||||
|
||||
fprintf(stream, "%" CURL_FORMAT_CURL_OFF_T, offinfo);
|
||||
curl_mfprintf(stream, "%" CURL_FORMAT_CURL_OFF_T, offinfo);
|
||||
}
|
||||
else {
|
||||
if(use_json)
|
||||
fprintf(stream, "\"%s\":null", wovar->name);
|
||||
curl_mfprintf(stream, "\"%s\":null", wovar->name);
|
||||
}
|
||||
|
||||
return 1; /* return 1 if anything was written */
|
||||
|
|
@ -796,9 +796,9 @@ void ourWriteOut(struct OperationConfig *config, struct per_transfer *per,
|
|||
}
|
||||
}
|
||||
else {
|
||||
fprintf(tool_stderr,
|
||||
"curl: unknown --write-out variable: '%.*s'\n",
|
||||
(int)vlen, ptr);
|
||||
curl_mfprintf(tool_stderr,
|
||||
"curl: unknown --write-out variable: '%.*s'\n",
|
||||
(int)vlen, ptr);
|
||||
}
|
||||
ptr = end + 1; /* pass the end */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,9 +112,9 @@ void ourWriteOutJSON(FILE *stream, const struct writeoutvar mappings[],
|
|||
|
||||
/* The variables are sorted in alphabetical order but as a special case
|
||||
curl_version (which is not actually a --write-out variable) is last. */
|
||||
fprintf(stream, "\"curl_version\":");
|
||||
curl_mfprintf(stream, "\"curl_version\":");
|
||||
jsonWriteString(stream, curl_version(), FALSE);
|
||||
fprintf(stream, "}");
|
||||
curl_mfprintf(stream, "}");
|
||||
}
|
||||
|
||||
void headerJSON(FILE *stream, struct per_transfer *per)
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ static int xattr(int fd,
|
|||
if(value) {
|
||||
#ifdef DEBUGBUILD
|
||||
if(getenv("CURL_FAKE_XATTR")) {
|
||||
printf("%s => %s\n", attr, value);
|
||||
curl_mprintf("%s => %s\n", attr, value);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue