+2020-03-29 Frank Ch. Eigler <fche@redhat.com>
+
+ * debuginfod-client.c (struct debuginfod_client): Add a flag field
+ for progressfn printing.
+ (default_progressfn): Set it if printing \rsomething.
+ (debuginfod_end): Terminate with \n if flag set, i.e., only if the
+ default_progressfn was actually called.
+
2020-03-27 Mark Wielaard <mark@klomp.org>
* debuginfod.cxx (parse_opt): Check port is not zero.
int user_agent_set_p; /* affects add_default_headers */
struct curl_slist *headers;
+ /* Flags the default_progressfn having printed something that
+ debuginfod_end needs to terminate. */
+ int default_progressfn_printed_p;
+
/* Can contain all other context, like cache_path, server_urls,
timeout or other info gotten from environment variables, the
handle data, etc. So those don't have to be reparsed and
dprintf(STDERR_FILENO,
"\rDownloading from %.*s %ld/%ld",
len, url, a, b);
+ c->default_progressfn_printed_p = 1;
return 0;
}
/* general purpose exit */
out:
/* Conclude the last \r status line */
- if (c->progressfn == & default_progressfn)
+ /* Another possibility is to use the ANSI CSI n K EL "Erase in Line"
+ code. That way, the previously printed messages would be erased,
+ and without a newline. */
+ if (c->default_progressfn_printed_p)
dprintf(STDERR_FILENO, "\n");
free (cache_path);