summaryrefslogtreecommitdiffstats
path: root/cli_output.c
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2012-12-10 13:34:12 +0000
committerDavid Hendricks <david.hendricks@gmail.com>2017-06-03 20:15:56 +0200
commit1878110848f36c53667c9855f0a413c43e64597f (patch)
tree66bacd63991be932b3d031dfe280576449b3280e /cli_output.c
parenta9fc4f4ebf335f3f20a47a48f2b9c2b00a4de696 (diff)
downloadflashrom-1878110848f36c53667c9855f0a413c43e64597f.tar.gz
flashrom-1878110848f36c53667c9855f0a413c43e64597f.tar.bz2
flashrom-1878110848f36c53667c9855f0a413c43e64597f.zip
Adapt CLI to use new libflashrom interface' print callback
This renames CLI's print() to flashrom_print_cb() and registers it through the new libflashrom interface. v2: Add libflashrom.o to LIB_OBJS now that everything can be linked together. Change-Id: Idf19978eb8e340d258199193d2978f37409e9983 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/17948 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Diffstat (limited to 'cli_output.c')
-rw-r--r--cli_output.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/cli_output.c b/cli_output.c
index feafbd201..e69798503 100644
--- a/cli_output.c
+++ b/cli_output.c
@@ -71,19 +71,19 @@ void start_logging(void)
#endif /* !STANDALONE */
/* Please note that level is the verbosity, not the importance of the message. */
-int print(enum msglevel level, const char *fmt, ...)
+int flashrom_print_cb(enum msglevel level, const char *fmt, va_list ap)
{
- va_list ap;
int ret = 0;
FILE *output_type = stdout;
+ va_list logfile_args;
+ va_copy(logfile_args, ap);
+
if (level < MSG_INFO)
output_type = stderr;
if (level <= verbose_screen) {
- va_start(ap, fmt);
ret = vfprintf(output_type, fmt, ap);
- va_end(ap);
/* msg_*spew often happens inside chip accessors in possibly
* time-critical operations. Don't slow them down by flushing. */
if (level != MSG_SPEW)
@@ -91,12 +91,11 @@ int print(enum msglevel level, const char *fmt, ...)
}
#ifndef STANDALONE
if ((level <= verbose_logfile) && logfile) {
- va_start(ap, fmt);
- ret = vfprintf(logfile, fmt, ap);
- va_end(ap);
+ ret = vfprintf(logfile, fmt, logfile_args);
if (level != MSG_SPEW)
fflush(logfile);
}
#endif /* !STANDALONE */
+ va_end(logfile_args);
return ret;
}