Ticket #6705: O_BINARY.diff

File O_BINARY.diff, 4.1 KB (added by scottmc, 9 years ago)
  • src/add-ons/print/transports/parallel_port/ParallelTransport.cpp

     
    6464    address[size] = 0; // make sure string is 0-terminated
    6565       
    6666    strcat(strcpy(device, "/dev/parallel/"), address);
    67     fFile = open(device, O_RDWR | O_EXCL | O_BINARY, 0);
     67    fFile = open(device, O_RDWR | O_EXCL, 0);
    6868    if (fFile < 0) {
    6969        // Try unidirectional access mode
    7070        bidirectional = false;
    71         fFile = open(device, O_WRONLY | O_EXCL | O_BINARY, 0);
     71        fFile = open(device, O_WRONLY | O_EXCL, 0);
    7272    }
    7373
    7474    if (fFile < 0)
  • src/add-ons/print/transports/serial_port/SerialTransport.cpp

     
    6464    address[size] = 0; // make sure string is 0-terminated
    6565       
    6666    strcat(strcpy(device, "/dev/ports/"), address);
    67     fFile = open(device, O_RDWR | O_EXCL | O_BINARY, 0);
     67    fFile = open(device, O_RDWR | O_EXCL, 0);
    6868    if (fFile < 0) {
    6969        // Try unidirectional access mode
    7070        bidirectional = false;
    71         fFile = open(device, O_WRONLY | O_EXCL | O_BINARY, 0);
     71        fFile = open(device, O_WRONLY | O_EXCL, 0);
    7272    }
    7373
    7474    if (fFile < 0)
  • src/bin/gawk/builtin.c

     
    14841484        ret = system(cmd);
    14851485        if (ret != -1)
    14861486            ret = WEXITSTATUS(ret);
     1487#ifndef __HAIKU__
    14871488        if ((BINMODE & 1) != 0)
    14881489            os_setbinmode(fileno(stdin), O_BINARY);
    1489 
     1490#endif
    14901491        cmd[tmp->stlen] = save;
    14911492    }
    14921493    free_temp(tmp);
  • src/bin/gawk/io.c

     
    894894        }
    895895    } else if ((rp->flag & (RED_PIPE|RED_WRITE)) == (RED_PIPE|RED_WRITE)) { /* write to pipe */
    896896        status = pclose(rp->fp);
     897#ifndef __HAIKU__
    897898        if ((BINMODE & 1) != 0)
    898899            os_setbinmode(fileno(stdin), O_BINARY);
    899 
     900#endif
    900901        rp->fp = NULL;
    901902    } else if (rp->fp != NULL) {    /* write to file */
    902903        status = fclose(rp->fp);
     
    10791080        ret = 0;        /* lint */
    10801081        cant_happen();
    10811082    }
     1083#ifndef __HAIKU__
    10821084    if (strchr(mode, 'b') != NULL)
    10831085        ret |= O_BINARY;
     1086#endif
    10841087    return ret;
    10851088}
    10861089
     
    21262129
    21272130    os_restore_mode(fileno(stdin));
    21282131    current = popen(cmd, binmode("r"));
     2132#ifndef __HAIKU__
    21292133    if ((BINMODE & 1) != 0)
    21302134        os_setbinmode(fileno(stdin), O_BINARY);
     2135#endif
    21312136    if (current == NULL)
    21322137        return NULL;
    21332138    os_close_on_exec(fileno(current), cmd, "pipe", "from");
  • src/bin/gawk/main.c

     
    506506        else    /* PRE_ASSIGN_FS */
    507507            cmdline_fs(preassigns[i].val);
    508508    free(preassigns);
    509 
     509#ifdef O_BINARY
    510510    if ((BINMODE & 1) != 0)
    511511        if (os_setbinmode(fileno(stdin), O_BINARY) == -1)
    512512            fatal(_("can't set binary mode on stdin (%s)"), strerror(errno));
     
    516516        if (os_setbinmode(fileno(stderr), O_BINARY) == -1)
    517517            fatal(_("can't set binary mode on stderr (%s)"), strerror(errno));
    518518    }
    519 
     519#endif
    520520#ifdef GAWKDEBUG
    521521    setbuf(stdout, (char *) NULL);  /* make debugging easier */
    522522#endif
  • headers/posix/fcntl.h

     
    4848#define O_NONBLOCK      0x00000080  /* non blocking io */
    4949#define O_NDELAY        O_NONBLOCK
    5050#define O_APPEND        0x00000800  /* to end of file */
    51 #define O_TEXT          0x00004000  /* CR-LF translation */
    52 #define O_BINARY        0x00008000  /* no translation */
    5351#define O_SYNC          0x00010000  /* write synchronized I/O file integrity */
    5452#define O_RSYNC         0x00020000  /* read synchronized I/O file integrity */
    5553#define O_DSYNC         0x00040000  /* write synchronized I/O data integrity */