aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2012-12-09 20:02:07 +0200
committerArnold D. Robbins <arnold@skeeve.com>2012-12-09 20:02:07 +0200
commit549694bc88a7345c10551d13017fa8a0eccb8619 (patch)
tree1da27840ad10ac0f1b048f74a240647dee7148da /io.c
parentd20af67ae8a6a573a0db906f9c9960a092f21b41 (diff)
downloadegawk-549694bc88a7345c10551d13017fa8a0eccb8619.tar.gz
egawk-549694bc88a7345c10551d13017fa8a0eccb8619.tar.bz2
egawk-549694bc88a7345c10551d13017fa8a0eccb8619.zip
Change BINMODE to use symbolic values.
Diffstat (limited to 'io.c')
-rw-r--r--io.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/io.c b/io.c
index c57aef2a..efdec065 100644
--- a/io.c
+++ b/io.c
@@ -233,12 +233,12 @@ binmode(const char *mode)
{
switch (mode[0]) {
case 'r':
- if ((BINMODE & 1) != 0)
+ if ((BINMODE & BINMODE_INPUT) != 0)
mode = "rb";
break;
case 'w':
case 'a':
- if ((BINMODE & 2) != 0)
+ if ((BINMODE & BINMODE_OUTPUT) != 0)
mode = (mode[0] == 'w' ? "wb" : "ab");
break;
}
@@ -1017,7 +1017,7 @@ close_rp(struct redirect *rp, two_way_close_type how)
}
} else if ((rp->flag & (RED_PIPE|RED_WRITE)) == (RED_PIPE|RED_WRITE)) { /* write to pipe */
status = pclose(rp->fp);
- if ((BINMODE & 1) != 0)
+ if ((BINMODE & BINMODE_INPUT) != 0)
os_setbinmode(fileno(stdin), O_BINARY);
rp->fp = NULL;
@@ -2134,7 +2134,7 @@ gawk_popen(const char *cmd, struct redirect *rp)
os_restore_mode(fileno(stdin));
current = popen(cmd, binmode("r"));
- if ((BINMODE & 1) != 0)
+ if ((BINMODE & BINMODE_INPUT) != 0)
os_setbinmode(fileno(stdin), O_BINARY);
if (current == NULL)
return NULL;