On 2017-11-22 12:59, Andreas J. Reichel wrote: > From: Andreas Reichel <[email protected]> > > * Better string formatting > * Don't print verbose messages if not in verbose mode > * Always inform after successful update > > Signed-off-by: Andreas Reichel <[email protected]> > --- > tools/bg_setenv.c | 21 +++++++++++++-------- > 1 file changed, 13 insertions(+), 8 deletions(-) > > diff --git a/tools/bg_setenv.c b/tools/bg_setenv.c > index f865fce..df63265 100644 > --- a/tools/bg_setenv.c > +++ b/tools/bg_setenv.c > @@ -470,13 +470,13 @@ static void dump_uservars(uint8_t *udata) > static void dump_env(BG_ENVDATA *env) > { > char buffer[ENV_STRING_LENGTH]; > - printf("Values: \n"); > - printf("in_progress: %s\n", env->in_progress ? "yes" : "no"); > - printf("revision: %u\n", env->revision); > - printf("kernel: %s\n", str16to8(buffer, env->kernelfile)); > - printf("kernelargs: %s\n", str16to8(buffer, env->kernelparams)); > + printf("Values:\n"); > + printf("in_progress: %s\n", env->in_progress ? "yes" : "no"); > + printf("revision: %u\n", env->revision); > + printf("kernel: %s\n", str16to8(buffer, env->kernelfile)); > + printf("kernelargs: %s\n", str16to8(buffer, env->kernelparams)); > printf("watchdog timeout: %u seconds\n", env->watchdog_timeout_sec); > - printf("ustate: %u (%s)\n", (uint8_t)env->ustate, > + printf("ustate: %u (%s)\n", (uint8_t)env->ustate, > ustate2str(env->ustate)); > printf("\n"); > printf("user variables:\n"); > @@ -486,7 +486,9 @@ static void dump_env(BG_ENVDATA *env) > > static void update_environment(BGENV *env) > { > - printf("Processing journal...\n"); > + if (verbosity) { > + printf("Processing journal...\n"); > + } > > while (!STAILQ_EMPTY(&head)) { > struct env_action *action = STAILQ_FIRST(&head); > @@ -580,7 +582,7 @@ int main(int argc, char **argv) > fprintf(stderr, "Error closing output file.\n"); > result = errno; > }; > - printf("Output written to %s.\n", envfilepath); > + fprintf(stdout, "Output written to %s.\n", envfilepath); > } else { > fprintf(stderr, "Error opening output file %s (%s).\n", > envfilepath, strerror(errno)); > @@ -668,5 +670,8 @@ int main(int argc, char **argv) > fprintf(stderr, "Error closing environment.\n"); > return 1; > } > + > + fprintf(stdout, "Environment update was successful.\n");
What's the pattern in this file for choosing printf() vs. fprintf(stdout)? Jan > + > return result; > } > -- Siemens AG, Corporate Technology, CT RDA ITP SES-DE Corporate Competence Center Embedded Linux -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/d7bdc8a8-992c-0382-42d5-6bb02748ac38%40siemens.com. For more options, visit https://groups.google.com/d/optout.
