Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <errno.h>
  5. #include <fcntl.h>
  6. #include <unistd.h>
  7. #include <sys/stat.h>
  8. #include <io.h>
  9.  
  10. #include <libc/dosio.h>
  11.  
  12. int open(const char* filename, int oflag, ...)
  13. {
  14. /* int fd, dmode, bintext;
  15.  bintext = oflag & (O_TEXT | O_BINARY);
  16.  if (!bintext) bintext = _fmode & (O_TEXT | O_BINARY);
  17.  if (!bintext) bintext = O_BINARY;
  18.  oflag &= ~(O_TEXT | O_BINARY);
  19.  dmode = (*((&oflag)+1) & S_IWUSR) ? 1 : 0;
  20.  fd = _open(filename, oflag & 0xff);
  21.  if (fd == -1 && oflag & O_CREAT)
  22.  fd = _creat(filename, dmode);
  23.  if (fd == -1)  return fd;
  24.  if (oflag & O_TRUNC)
  25.   if (_write(fd, 0, 0) < 0)
  26.    return -1;
  27.  if(oflag & O_APPEND)
  28.   lseek(fd, 0, SEEK_END);
  29.   return fd;*/
  30.         return dosemu_open(filename, oflag);
  31. }
  32.