author | Olivier Brunel
<jjk@jjacky.com> 2015-02-27 17:35:27 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2015-04-04 12:47:35 UTC |
parent | 6cd7623268dd78102a60b312826bb7e39f1ad780 |
doc/aa-echo.pod | +5 | -1 |
src/utils/aa-echo.c | +10 | -1 |
diff --git a/doc/aa-echo.pod b/doc/aa-echo.pod index c46a079..8f76893 100644 --- a/doc/aa-echo.pod +++ b/doc/aa-echo.pod @@ -4,12 +4,16 @@ aa-echo - Shows a message =head1 SYNOPSIS -B<aa-echo> [B<-D>] [B<-T> | B<-t> | B<-w> | B<-e> | B<-n>] I<MESSAGE...> +B<aa-echo> [B<-D>] [B<-B>] [B<-T> | B<-t> | B<-w> | B<-e> | B<-n>] I<MESSAGE...> =head1 OPTIONS =over +=item B<-B, --blank-first> + +Prints a blank line (LF) first. + =item B<-D, --double-output> Enable double-output mode. Instead of using stdout for regular output, and diff --git a/src/utils/aa-echo.c b/src/utils/aa-echo.c index 0162940..7025973 100644 --- a/src/utils/aa-echo.c +++ b/src/utils/aa-echo.c @@ -24,6 +24,7 @@ dieusage (int rc) { aa_die_usage (rc, "[OPTION...] MESSAGE...", " -D, --double-output Enable double-output mode\n" + " -B, --blank-first Print a blank line (LF) first\n" " -T, --title Show a main title (default)\n" " -t, --title2 Show a secondary title\n" " -w, --warning Show a warning\n" @@ -49,6 +50,7 @@ main (int argc, char * const argv[]) { PROG = "aa-echo"; int mode_both = 0; + int blank = 0; put_fn put = put_title; int where = AA_OUT; int i; @@ -56,6 +58,7 @@ main (int argc, char * const argv[]) for (;;) { struct option longopts[] = { + { "blank-first", no_argument, NULL, 'B' }, { "double-output", no_argument, NULL, 'D' }, { "error", no_argument, NULL, 'e' }, { "help", no_argument, NULL, 'h' }, @@ -68,11 +71,15 @@ main (int argc, char * const argv[]) }; int c; - c = getopt_long (argc, argv, "DehnTtVw", longopts, NULL); + c = getopt_long (argc, argv, "BDehnTtVw", longopts, NULL); if (c == -1) break; switch (c) { + case 'B': + blank = 1; + break; + case 'D': mode_both = 1; break; @@ -119,6 +126,8 @@ main (int argc, char * const argv[]) dieusage (1); aa_init_output (mode_both); + if (blank) + aa_bs_noflush (where, "\n"); if (put) put ("", NULL, 0); for (i = 0; i < argc; ++i)