[haiku-commits] r38962 - in haiku/trunk: headers/posix src/add-ons/print/transports/parallel_port src/add-ons/print/transports/serial_port src/bin/gawk

  • From: scott mc <scottmc2@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 13 Oct 2010 08:26:53 +0200 (CEST)

Author: scottmc
Date: 2010-10-13 08:26:53 +0200 (Wed, 13 Oct 2010)
New Revision: 38962
Changeset: http://dev.haiku-os.org/changeset/38962

Modified:
   haiku/trunk/headers/posix/fcntl.h
   haiku/trunk/src/add-ons/print/transports/parallel_port/ParallelTransport.cpp
   haiku/trunk/src/add-ons/print/transports/serial_port/SerialTransport.cpp
   haiku/trunk/src/bin/gawk/builtin.c
   haiku/trunk/src/bin/gawk/io.c
   haiku/trunk/src/bin/gawk/main.c
Log:
Removed definitions for O_BINARY and O_TEXT, and patched the few files that 
used them.


Modified: haiku/trunk/headers/posix/fcntl.h
===================================================================
--- haiku/trunk/headers/posix/fcntl.h   2010-10-13 06:11:51 UTC (rev 38961)
+++ haiku/trunk/headers/posix/fcntl.h   2010-10-13 06:26:53 UTC (rev 38962)
@@ -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 */

Modified: 
haiku/trunk/src/add-ons/print/transports/parallel_port/ParallelTransport.cpp
===================================================================
--- 
haiku/trunk/src/add-ons/print/transports/parallel_port/ParallelTransport.cpp    
    2010-10-13 06:11:51 UTC (rev 38961)
+++ 
haiku/trunk/src/add-ons/print/transports/parallel_port/ParallelTransport.cpp    
    2010-10-13 06:26:53 UTC (rev 38962)
@@ -64,11 +64,11 @@
        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)

Modified: 
haiku/trunk/src/add-ons/print/transports/serial_port/SerialTransport.cpp
===================================================================
--- haiku/trunk/src/add-ons/print/transports/serial_port/SerialTransport.cpp    
2010-10-13 06:11:51 UTC (rev 38961)
+++ haiku/trunk/src/add-ons/print/transports/serial_port/SerialTransport.cpp    
2010-10-13 06:26:53 UTC (rev 38962)
@@ -64,11 +64,11 @@
        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)

Modified: haiku/trunk/src/bin/gawk/builtin.c
===================================================================
--- haiku/trunk/src/bin/gawk/builtin.c  2010-10-13 06:11:51 UTC (rev 38961)
+++ haiku/trunk/src/bin/gawk/builtin.c  2010-10-13 06:26:53 UTC (rev 38962)
@@ -1484,9 +1484,10 @@
                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);

Modified: haiku/trunk/src/bin/gawk/io.c
===================================================================
--- haiku/trunk/src/bin/gawk/io.c       2010-10-13 06:11:51 UTC (rev 38961)
+++ haiku/trunk/src/bin/gawk/io.c       2010-10-13 06:26:53 UTC (rev 38962)
@@ -894,9 +894,10 @@
                }
        } 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 @@
                ret = 0;                /* lint */
                cant_happen();
        }
+#ifdef O_BINARY
        if (strchr(mode, 'b') != NULL)
                ret |= O_BINARY;
+#endif
        return ret;
 }
 
@@ -2126,8 +2129,10 @@
 
        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");

Modified: haiku/trunk/src/bin/gawk/main.c
===================================================================
--- haiku/trunk/src/bin/gawk/main.c     2010-10-13 06:11:51 UTC (rev 38961)
+++ haiku/trunk/src/bin/gawk/main.c     2010-10-13 06:26:53 UTC (rev 38962)
@@ -506,7 +506,7 @@
                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 @@
                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


Other related posts:

  • » [haiku-commits] r38962 - in haiku/trunk: headers/posix src/add-ons/print/transports/parallel_port src/add-ons/print/transports/serial_port src/bin/gawk - scott mc