summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2023-02-23 19:54:44 +0200
committerArnold D. Robbins <arnold@skeeve.com>2023-02-23 19:54:44 +0200
commit1c16328521f317b4f3df3d3010fc17e9811bd5e1 (patch)
treeab42a19be4446a1dc8d24d50a992bb1ac507b39b
parent2480186827f4e5f9b4269426742d5f4985dcbe01 (diff)
downloadgawk-1c16328521f317b4f3df3d3010fc17e9811bd5e1.tar.gz
Code improvement: RED_NOBUF -> RED_FLUSH.
-rw-r--r--ChangeLog7
-rw-r--r--awk.h2
-rw-r--r--builtin.c2
-rw-r--r--io.c12
4 files changed, 15 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 6e2b302b..02b2427a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,13 @@
already being handled by an input parser. Found by
code inspection.
+ Unrelated:
+
+ * awk.h (struct redirect): Change RED_NOBUF to RED_FLUSH.
+ * builtin.c (efwrite): Ditto
+ * io.c (redflags2str, check_duplicated_redirections,
+ redirect_string): Ditto.
+
2023-02-09 Arnold D. Robbins <arnold@skeeve.com>
* main.c (usage): Include URL for source code in the message.
diff --git a/awk.h b/awk.h
index 79cdd85f..e9ed75ef 100644
--- a/awk.h
+++ b/awk.h
@@ -972,7 +972,7 @@ struct redirect {
RED_READ = 4,
RED_WRITE = 8,
RED_APPEND = 16,
- RED_NOBUF = 32,
+ RED_FLUSH = 32,
RED_USED = 64, /* closed temporarily to reuse fd */
RED_EOF = 128,
RED_TWOWAY = 256,
diff --git a/builtin.c b/builtin.c
index 95bcbadb..43ae6afc 100644
--- a/builtin.c
+++ b/builtin.c
@@ -192,7 +192,7 @@ efwrite(const void *ptr,
}
if (flush
&& ((fp == stdout && output_is_tty)
- || (rp != NULL && (rp->flag & RED_NOBUF) != 0)))
+ || (rp != NULL && (rp->flag & RED_FLUSH) != 0)))
efflush(fp, from, rp);
}
diff --git a/io.c b/io.c
index 0911899f..979cad45 100644
--- a/io.c
+++ b/io.c
@@ -693,7 +693,7 @@ redflags2str(int flags)
{ RED_READ, "RED_READ" },
{ RED_WRITE, "RED_WRITE" },
{ RED_APPEND, "RED_APPEND" },
- { RED_NOBUF, "RED_NOBUF" },
+ { RED_FLUSH, "RED_FLUSH" },
{ RED_EOF, "RED_EOF" },
{ RED_TWOWAY, "RED_TWOWAY" },
{ RED_PTY, "RED_PTY" },
@@ -745,8 +745,8 @@ check_duplicated_redirections(const char *name, size_t len,
};
int i = 0, j = sizeof(mixtures) / sizeof(mixtures[0]);
- oldflags &= ~(RED_NOBUF|RED_EOF|RED_PTY);
- newflags &= ~(RED_NOBUF|RED_EOF|RED_PTY);
+ oldflags &= ~(RED_FLUSH|RED_EOF|RED_PTY);
+ newflags &= ~(RED_FLUSH|RED_EOF|RED_PTY);
for (i = 0; i < j; i++) {
bool both_have_common = \
@@ -877,7 +877,7 @@ redirect_string(const char *str, size_t explen, bool not_string,
(redirect_flags_t) rp->flag, (redirect_flags_t) tflag);
}
- if (((rp->flag & ~(RED_NOBUF|RED_EOF|RED_PTY)) == tflag
+ if (((rp->flag & ~(RED_FLUSH|RED_EOF|RED_PTY)) == tflag
|| (outflag != 0
&& (rp->flag & (RED_FILE|RED_WRITE)) == outflag))) {
break;
@@ -951,7 +951,7 @@ redirect_string(const char *str, size_t explen, bool not_string,
/* set close-on-exec */
os_close_on_exec(fileno(rp->output.fp), str, "pipe", "to");
- rp->flag |= RED_NOBUF;
+ rp->flag |= RED_FLUSH;
break;
case redirect_pipein:
if (extfd >= 0) {
@@ -1032,7 +1032,7 @@ redirect_string(const char *str, size_t explen, bool not_string,
close(fd);
}
if (rp->output.fp != NULL && os_isatty(fd))
- rp->flag |= RED_NOBUF;
+ rp->flag |= RED_FLUSH;
/* Move rp to the head of the list. */
if (! new_rp && red_head != rp) {