diff --git a/headers/posix/fcntl.h b/headers/posix/fcntl.h index 7c995a011b..33d2565e9c 100644 --- a/headers/posix/fcntl.h +++ b/headers/posix/fcntl.h @@ -48,8 +48,6 @@ #define O_NONBLOCK 0x00000080 /* non blocking io */ #define O_NDELAY O_NONBLOCK #define O_APPEND 0x00000800 /* to end of file */ -#define O_TEXT 0x00004000 /* CR-LF translation */ -#define O_BINARY 0x00008000 /* no translation */ #define O_SYNC 0x00010000 /* write synchronized I/O file integrity */ #define O_RSYNC 0x00020000 /* read synchronized I/O file integrity */ #define O_DSYNC 0x00040000 /* write synchronized I/O data integrity */ diff --git a/src/add-ons/print/transports/parallel_port/ParallelTransport.cpp b/src/add-ons/print/transports/parallel_port/ParallelTransport.cpp index b0d2681471..02aa49a959 100644 --- a/src/add-ons/print/transports/parallel_port/ParallelTransport.cpp +++ b/src/add-ons/print/transports/parallel_port/ParallelTransport.cpp @@ -64,11 +64,11 @@ ParallelTransport::ParallelTransport(BDirectory* printer, BMessage* msg) address[size] = 0; // make sure string is 0-terminated strcat(strcpy(device, "/dev/parallel/"), address); - fFile = open(device, O_RDWR | O_EXCL | O_BINARY, 0); + fFile = open(device, O_RDWR | O_EXCL, 0); if (fFile < 0) { // Try unidirectional access mode bidirectional = false; - fFile = open(device, O_WRONLY | O_EXCL | O_BINARY, 0); + fFile = open(device, O_WRONLY | O_EXCL, 0); } if (fFile < 0) diff --git a/src/add-ons/print/transports/serial_port/SerialTransport.cpp b/src/add-ons/print/transports/serial_port/SerialTransport.cpp index d4955b1cd9..ffcc3978b1 100644 --- a/src/add-ons/print/transports/serial_port/SerialTransport.cpp +++ b/src/add-ons/print/transports/serial_port/SerialTransport.cpp @@ -64,11 +64,11 @@ SerialTransport::SerialTransport(BDirectory* printer, BMessage* msg) address[size] = 0; // make sure string is 0-terminated strcat(strcpy(device, "/dev/ports/"), address); - fFile = open(device, O_RDWR | O_EXCL | O_BINARY, 0); + fFile = open(device, O_RDWR | O_EXCL, 0); if (fFile < 0) { // Try unidirectional access mode bidirectional = false; - fFile = open(device, O_WRONLY | O_EXCL | O_BINARY, 0); + fFile = open(device, O_WRONLY | O_EXCL, 0); } if (fFile < 0) diff --git a/src/bin/gawk/builtin.c b/src/bin/gawk/builtin.c index ebd6e6cf26..02275221e6 100644 --- a/src/bin/gawk/builtin.c +++ b/src/bin/gawk/builtin.c @@ -1484,9 +1484,10 @@ do_system(NODE *tree) ret = system(cmd); if (ret != -1) ret = WEXITSTATUS(ret); +#ifdef O_BINARY if ((BINMODE & 1) != 0) os_setbinmode(fileno(stdin), O_BINARY); - +#endif cmd[tmp->stlen] = save; } free_temp(tmp); diff --git a/src/bin/gawk/io.c b/src/bin/gawk/io.c index fff1388324..461339899b 100644 --- a/src/bin/gawk/io.c +++ b/src/bin/gawk/io.c @@ -894,9 +894,10 @@ close_redir(register struct redirect *rp, int exitwarn, two_way_close_type how) } } else if ((rp->flag & (RED_PIPE|RED_WRITE)) == (RED_PIPE|RED_WRITE)) { /* write to pipe */ status = pclose(rp->fp); +#ifdef O_BINARY if ((BINMODE & 1) != 0) os_setbinmode(fileno(stdin), O_BINARY); - +#endif rp->fp = NULL; } else if (rp->fp != NULL) { /* write to file */ status = fclose(rp->fp); @@ -1079,8 +1080,10 @@ str2mode(const char *mode) ret = 0; /* lint */ cant_happen(); } +#ifdef O_BINARY if (strchr(mode, 'b') != NULL) ret |= O_BINARY; +#endif return ret; } @@ -2126,8 +2129,10 @@ gawk_popen(const char *cmd, struct redirect *rp) os_restore_mode(fileno(stdin)); current = popen(cmd, binmode("r")); +#ifdef O_BINARY if ((BINMODE & 1) != 0) os_setbinmode(fileno(stdin), O_BINARY); +#endif if (current == NULL) return NULL; os_close_on_exec(fileno(current), cmd, "pipe", "from"); diff --git a/src/bin/gawk/main.c b/src/bin/gawk/main.c index 40a12f834e..506106d3a8 100644 --- a/src/bin/gawk/main.c +++ b/src/bin/gawk/main.c @@ -506,7 +506,7 @@ out: else /* PRE_ASSIGN_FS */ cmdline_fs(preassigns[i].val); free(preassigns); - +#ifdef O_BINARY if ((BINMODE & 1) != 0) if (os_setbinmode(fileno(stdin), O_BINARY) == -1) fatal(_("can't set binary mode on stdin (%s)"), strerror(errno)); @@ -516,7 +516,7 @@ out: if (os_setbinmode(fileno(stderr), O_BINARY) == -1) fatal(_("can't set binary mode on stderr (%s)"), strerror(errno)); } - +#endif #ifdef GAWKDEBUG setbuf(stdout, (char *) NULL); /* make debugging easier */ #endif