diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-11-30 14:27:35 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-11-30 14:27:35 +0200 |
commit | 71157f7f5f2fb9bf0fe588135485a8dcec322786 (patch) | |
tree | 45a0fd2d2aa49e87955e31ff313ad4d0b008c494 /builtin.c | |
parent | d3699b66e430f40943242dcc2b2687e871207471 (diff) | |
parent | 242ee720a6387f87e05d3eb8e30d2c7061cbf8ef (diff) | |
download | egawk-71157f7f5f2fb9bf0fe588135485a8dcec322786.tar.gz egawk-71157f7f5f2fb9bf0fe588135485a8dcec322786.tar.bz2 egawk-71157f7f5f2fb9bf0fe588135485a8dcec322786.zip |
Merge branch 'master' into array-iface
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 26 |
1 files changed, 21 insertions, 5 deletions
@@ -182,24 +182,40 @@ do_fflush(int nargs) int status = 0; const char *file; - /* fflush() --- flush stdout */ + /* + * November, 2012. + * It turns out that circa 2002, when BWK + * added fflush() and fflush("") to his awk, he made both of + * them flush everything. + * + * Now, with our inside agent getting ready to try to get fflush() + * standardized in POSIX, we are going to make our awk consistent + * with his. This should not really affect anyone, as flushing + * everything also flushes stdout. + * + * So. Once upon a time: + * fflush() --- flush stdout + * fflush("") --- flush everything + * Now, both calls flush everything. + */ + + /* fflush() */ if (nargs == 0) { - if (output_fp != stdout) - (void) fflush(output_fp); - status = fflush(stdout); + status = flush_io(); return make_number((AWKNUM) status); } tmp = POP_STRING(); file = tmp->stptr; - /* fflush("") --- flush all */ + /* fflush("") */ if (tmp->stlen == 0) { status = flush_io(); DEREF(tmp); return make_number((AWKNUM) status); } + /* fflush("/some/path") */ rp = getredirect(tmp->stptr, tmp->stlen); status = -1; if (rp != NULL) { |