← Commit list

56450ce26f

Daniel Stenberg
Daniel Stenberg
2025-10-13
FAILED Duration: 746s

Subject

tool_msgs: make errorf() show if --show-error

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

src/tool_msgs.c+40 -39
@@ -43,45 +43,43 @@ static void voutf(const char *prefix,
va_list ap)
{
size_t width = (get_terminal_columns() - strlen(prefix));
+ size_t len;
+ char *ptr;
+ char *print_buffer;
DEBUGASSERT(!strchr(fmt, '\n'));
- if(!global->silent) {
- size_t len;
- char *ptr;
- char *print_buffer;
-
- print_buffer = curl_mvaprintf(fmt, ap);
- if(!print_buffer)
- return;
- len = strlen(print_buffer);
- ptr = print_buffer;
- while(len > 0) {
- fputs(prefix, tool_stderr);
+ print_buffer = curl_mvaprintf(fmt, ap);
+ if(!print_buffer)
+ return;
+ len = strlen(print_buffer);
- if(len > width) {
- size_t cut = width-1;
+ ptr = print_buffer;
+ while(len > 0) {
+ fputs(prefix, tool_stderr);
- while(!ISBLANK(ptr[cut]) && cut) {
- cut--;
- }
- if(cut == 0)
- /* not a single cutting position was found, just cut it at the
- max text width then! */
- cut = width-1;
+ if(len > width) {
+ size_t cut = width-1;
- (void)fwrite(ptr, cut + 1, 1, tool_stderr);
- fputs("\n", tool_stderr);
- ptr += cut + 1; /* skip the space too */
- len -= cut + 1;
- }
- else {
- fputs(ptr, tool_stderr);
- fputs("\n", tool_stderr);
- len = 0;
+ while(!ISBLANK(ptr[cut]) && cut) {
+ cut--;
}
+ if(cut == 0)
+ /* not a single cutting position was found, just cut it at the
+ max text width then! */
+ cut = width-1;
+
+ (void)fwrite(ptr, cut + 1, 1, tool_stderr);
+ fputs("\n", tool_stderr);
+ ptr += cut + 1; /* skip the space too */
+ len -= cut + 1;
+ }
+ else {
+ fputs(ptr, tool_stderr);
+ fputs("\n", tool_stderr);
+ len = 0;
}
- curl_free(print_buffer);
}
+ curl_free(print_buffer);
}
/*
@@ -90,11 +88,12 @@ static void voutf(const char *prefix,
*/
void notef(const char *fmt, ...)
{
- va_list ap;
- va_start(ap, fmt);
- if(global->tracetype)
+ if(global->tracetype) {
+ va_list ap;
+ va_start(ap, fmt);
voutf(NOTE_PREFIX, fmt, ap);
- va_end(ap);
+ va_end(ap);
+ }
}
/*
@@ -103,10 +102,12 @@ void notef(const char *fmt, ...)
*/
void warnf(const char *fmt, ...)
{
- va_list ap;
- va_start(ap, fmt);
- voutf(WARN_PREFIX, fmt, ap);
- va_end(ap);
+ if(!global->silent) {
+ va_list ap;
+ va_start(ap, fmt);
+ voutf(WARN_PREFIX, fmt, ap);
+ va_end(ap);
+ }
}
/*