diff --git a/man/remind.1.in b/man/remind.1.in index 61c3ee69..2a5761e4 100644 --- a/man/remind.1.in +++ b/man/remind.1.in @@ -620,8 +620,8 @@ The \fB\-\-test\fR long option is only for use by the acceptance tests run by "make test". Do not use this option in production. .TP .B \-\-flush -The \fB\-\-flush\fR long option makes \fBRemind\fR flush stdout and -stderr after processing each line. It is mostly used for testing and +The \fB\-\-flush\fR long option makes \fBRemind\fR's standard output +and standar error streams unbufferd. It is mostly used for testing and should probably not be used in production. .SH REMINDER FILES .PP diff --git a/src/calendar.c b/src/calendar.c index b55af374..2242f4f3 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -1846,10 +1846,6 @@ static void GenerateCalEntries(int col) } if (r && (!Hush || r != E_RUN_DISABLED)) Eprint("%s", GetErr(r)); - if (AutoFlush) { - fflush(stdout); - fflush(stderr); - } /* Destroy the parser - free up resources it may be tying up */ DestroyParser(&p); } diff --git a/src/globals.h b/src/globals.h index 8fe7b58b..a83c4743 100644 --- a/src/globals.h +++ b/src/globals.h @@ -56,7 +56,6 @@ EXTERN int FreshLine; EXTERN int WarnedAboutImplicit; EXTERN uid_t TrustedUsers[MAX_TRUSTED_USERS]; -EXTERN INIT( int AutoFlush, 0); EXTERN INIT( int JSONMode, 0); EXTERN INIT( int JSONLinesEmitted, 0); EXTERN INIT( int MaxLateMinutes, 0); diff --git a/src/init.c b/src/init.c index fa970da1..6d152d55 100644 --- a/src/init.c +++ b/src/init.c @@ -1167,7 +1167,8 @@ ProcessLongOption(char const *arg) return; } if (!strcmp(arg, "flush")) { - AutoFlush = 1; + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); return; } if (!strcmp(arg, "json")) { diff --git a/src/main.c b/src/main.c index d546ab6b..62548f32 100644 --- a/src/main.c +++ b/src/main.c @@ -473,10 +473,6 @@ static void DoReminders(void) } /* Destroy the parser - free up resources it may be tying up */ DestroyParser(&p); - if (AutoFlush) { - fflush(stdout); - fflush(stderr); - } } } } diff --git a/tests/test.cmp b/tests/test.cmp index 661cfcf8..a694abc8 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -18338,8 +18338,6 @@ Caching file `../tests/include_dir/subdir/04.rem' in memory Reading `subdir/04.rem': Opening file on disk ../tests/include_dir/02.rem(3): Can't open file: subdir/04.rem Reading `../tests/include_dir/04cantread.rem': Opening file on disk -Found cached directory listing for `../tests/include_dir' -Reading `../tests/include_dir/01.rem': Found in cache # translations {"LANGID":"en"} # rem2ps begin @@ -18347,6 +18345,8 @@ August 2007 31 3 0 Sunday Monday Tuesday Wednesday Thursday Friday Saturday July 31 September 30 +Found cached directory listing for `../tests/include_dir' +Reading `../tests/include_dir/01.rem': Found in cache Reading `../tests/include_dir/02.rem': Found in cache Reading `../tests/include_dir/subdir/04.rem': Found in cache Reading `subdir/04.rem': Opening file on disk @@ -18471,14 +18471,14 @@ Reading `../tests/include_dir/subdir/04.rem': Found in cache Reading `subdir/04.rem': Opening file on disk ../tests/include_dir/02.rem(3): Can't open file: subdir/04.rem Reading `../tests/include_dir/04cantread.rem': Opening file on disk -Found cached directory listing for `../tests/include_dir' -Reading `../tests/include_dir/01.rem': Found in cache # fileinfo 1 ../tests/include_dir/01.rem 2007/08/15 * * * * 01 # fileinfo 1 ../tests/include_dir/02.rem 2007/08/15 * * * * 02 # fileinfo 1 ../tests/include_dir/subdir/04.rem 2007/08/16 * * * * Should be included by 02.rem +Found cached directory listing for `../tests/include_dir' +Reading `../tests/include_dir/01.rem': Found in cache Reading `../tests/include_dir/02.rem': Found in cache Reading `../tests/include_dir/subdir/04.rem': Found in cache Reading `subdir/04.rem': Opening file on disk @@ -18594,9 +18594,6 @@ Caching directory `include_dir_no_rems' listing ../tests/include_test.rem(2): include_dir_no_rems: No files matching *.rem Reading `nonexistent_include_dir': Opening file on disk ../tests/include_test.rem(3): Can't open file: nonexistent_include_dir -Reading `../tests/include_test.rem': Found in cache -Found cached directory listing for `include_dir' -Reading `include_dir/01.rem': Found in cache # translations {"LANGID":"en"} # rem2ps begin @@ -18604,6 +18601,9 @@ August 2007 31 3 0 Sunday Monday Tuesday Wednesday Thursday Friday Saturday July 31 September 30 +Reading `../tests/include_test.rem': Found in cache +Found cached directory listing for `include_dir' +Reading `include_dir/01.rem': Found in cache Reading `include_dir/02.rem': Found in cache Reading `include_dir/subdir/04.rem': Found in cache Reading `subdir/04.rem': Opening file on disk @@ -18817,9 +18817,6 @@ Found cached directory listing for `include_dir_no_rems' ../tests/include_test.rem(2): include_dir_no_rems: No files matching *.rem Reading `nonexistent_include_dir': Opening file on disk ../tests/include_test.rem(3): Can't open file: nonexistent_include_dir -Reading `../tests/include_test.rem': Found in cache -Found cached directory listing for `include_dir' -Reading `include_dir/01.rem': Found in cache # fileinfo 1 include_dir/01.rem 2007/08/15 * * * * 01 # fileinfo 1 include_dir/02.rem @@ -18828,6 +18825,9 @@ Reading `include_dir/01.rem': Found in cache 2007/08/15 * * * * Whee!!!! # fileinfo 1 include_dir/subdir/04.rem 2007/08/16 * * * * Should be included by 02.rem +Reading `../tests/include_test.rem': Found in cache +Found cached directory listing for `include_dir' +Reading `include_dir/01.rem': Found in cache Reading `include_dir/02.rem': Found in cache Reading `include_dir/subdir/04.rem': Found in cache Reading `subdir/04.rem': Opening file on disk @@ -22791,7 +22791,6 @@ Reminders for Sunday, 1st January, 2012: 2 --stdin-(1): Undefined OMITFUNC function: `foo' -stdin-(1): Undefined OMITFUNC function: `foo' # translations {"LANGID":"en"} @@ -22834,6 +22833,7 @@ February 29 {"date":"2012-01-23","filename":"-stdin-","lineno":1,"wd":["Monday"],"is_todo":0,"priority":5000,"omitfunc":"foo","nonconst_expr":1,"body":"bar"} -stdin-(1): Undefined OMITFUNC function: `foo' -stdin-(1): Undefined OMITFUNC function: `foo' +-stdin-(1): Undefined OMITFUNC function: `foo' {"date":"2012-01-30","filename":"-stdin-","lineno":1,"wd":["Monday"],"is_todo":0,"priority":5000,"omitfunc":"foo","nonconst_expr":1,"body":"bar"} # rem2ps2 end -stdin-(8:9): Number too high @@ -24803,11 +24803,11 @@ set a 8 * "]]]" & 6 8 * "]]]" & 6 ^-- here msg [8 * "]]]" & 6] is weird +Reminders for Thursday, 1st February, 2024: + -stdin-(2): Parse error `&' (did you mean `&&'?) 8 * "]]]" & 6 ^-- here -Reminders for Thursday, 1st February, 2024: - set a 9 * -stdin-(3): Unexpected end of line 9 * @@ -25203,6 +25203,8 @@ a "xPOO" -stdin-(24): \x00 is not a valid escape sequence -stdin-(25): \x00 is not a valid escape sequence -stdin-(26): \x00 is not a valid escape sequence +Reminders for Thursday, 1st February, 2024: + -stdin-(1): `%0' substitution sequence should not be used without an AT clause -stdin-(1): `%1' substitution sequence should not be used without an AT clause -stdin-(1): `%2' substitution sequence should not be used without an AT clause @@ -25213,8 +25215,6 @@ a "xPOO" -stdin-(1): `%7' substitution sequence should not be used without an AT clause -stdin-(1): `%8' substitution sequence should not be used without an AT clause -stdin-(1): `%9' substitution sequence should not be used without an AT clause -Reminders for Thursday, 1st February, 2024: - s now at 1:00am at 01:00 0 0 from now 0 0 s hahaha # Translation table @@ -39464,11 +39464,11 @@ utctolocal(2050-11-06@07:00) => 2050-11-06@02:00 No reminders. -stdin-(9): `x' re-SET without being used (previous SET: -stdin-:8) -stdin-(11): `y' UNSET without being used (previous SET: -stdin-:10) +No reminders. The following variables were set, but not subsequently used: b - defined at -stdin-:2 x - defined at -stdin-:9 d - defined at -stdin-:5 -No reminders. Reminders for Sunday, 4th June, 2000: Always