/programs/develop/libraries/menuetlibc/src/libc/dos/io/Makefile |
---|
0,0 → 1,6 |
THIS_SRCS = _chmod.c _close.c _creat.c crlf2nl.c dosio.c doslock.c \ |
dosunloc.c fmode.c lock.c _open.c putpath.c _read.c setmode.c \ |
tell.c unlock.c _write.c |
include $(MENUET_LIBC_TOPDIR)/Make.rules |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/_chmod.c |
---|
0,0 → 1,17 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <libc/stubs.h> |
#include <io.h> |
#include <errno.h> |
#include <libc/dosio.h> |
#include <assert.h> |
#include <stdio.h> |
#include <fcntl.h> |
int _chmod(const char *filename, int func, ...) |
{ |
int i; |
i=open(filename,O_RDONLY); |
if(i<0) return -1; |
close(i); |
return 0; |
} |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/_close.c |
---|
0,0 → 1,25 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <unistd.h> |
#include <errno.h> |
#include <io.h> |
#include <sys/fsext.h> |
#include <libc/dosio.h> |
#include <menuet/os.h> |
int _close(int handle) |
{ |
__FSEXT_Function *func = __FSEXT_get_function(handle); |
if (func) |
{ |
int rv; |
if (func(__FSEXT_close, &rv, &handle)) |
{ |
__FSEXT_set_function(handle, 0); |
return rv; |
} |
__FSEXT_set_function(handle, 0); |
} |
return dosemu_close(handle); |
} |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/_creat.c |
---|
0,0 → 1,12 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <libc/stubs.h> |
#include <fcntl.h> |
#include <errno.h> |
#include <io.h> |
#include <libc/dosio.h> |
#include <sys/fsext.h> |
int _creat(const char* filename, int attrib) |
{ |
return _open(filename,attrib|O_CREAT); |
} |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/_open.c |
---|
0,0 → 1,18 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <libc/stubs.h> |
#include <string.h> |
#include <fcntl.h> |
#include <errno.h> |
#include <io.h> |
#include <libc/dosio.h> |
#include <sys/fsext.h> |
#define FSLAYER |
#include <menuet/os.h> |
int _open(const char* filename, int oflag) |
{ |
int rv; |
if (__FSEXT_call_open_handlers(__FSEXT_open, &rv, &filename)) |
return rv; |
return dosemu_open(filename,oflag); |
} |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/_read.c |
---|
0,0 → 1,22 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <libc/stubs.h> |
#include <unistd.h> |
#include <string.h> |
#include <errno.h> |
#include <io.h> |
#include <sys/fsext.h> |
#include <libc/dosio.h> |
#define FSLAYER |
#include <menuet/os.h> |
int _read(int handle, void* buffer, size_t count) |
{ |
__FSEXT_Function *func = __FSEXT_get_function(handle); |
if (func) |
{ |
int rv; |
if (func(__FSEXT_read, &rv, &handle)) return rv; |
} |
return dosemu_read(handle,buffer,count); |
} |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/_write.c |
---|
0,0 → 1,22 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <libc/stubs.h> |
#include <unistd.h> |
#include <string.h> |
#include <errno.h> |
#include <io.h> |
#include <sys/fsext.h> |
#include <libc/dosio.h> |
#define FSLAYER |
#include <menuet/os.h> |
int _write(int handle, const void* buffer, size_t count) |
{ |
__FSEXT_Function *func = __FSEXT_get_function(handle); |
if (func) |
{ |
int rv; |
if (func(__FSEXT_write, &rv, &handle)) return rv; |
} |
return dosemu_write(handle,buffer,count); |
} |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/crlf2nl.c |
---|
0,0 → 1,20 |
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ |
#include <libc/stubs.h> |
#include <io.h> |
ssize_t |
crlf2nl(char *buf, ssize_t len) |
{ |
char *bp = buf; |
int i=0; |
while (len--) |
{ |
if (*bp != 13) |
{ |
*buf++ = *bp; |
i++; |
} |
bp++; |
} |
return i; |
} |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/dosio.c |
---|
0,0 → 1,27 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <stdlib.h> |
#include <string.h> |
#include <fcntl.h> |
#include <libc/dosio.h> |
#include <libc/bss.h> |
static char init_file_handle_modes[20] = { |
O_TEXT, |
O_TEXT, |
O_TEXT, |
O_BINARY, |
O_BINARY |
}; |
static int dosio_bss_count = -1; |
static size_t count=20; /* DOS default limit */ |
char *__file_handle_modes = init_file_handle_modes; |
void |
__file_handle_set(int fd, int mode) |
{ |
/* Fill in the value */ |
__file_handle_modes[fd] = mode; |
} |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/doslock.c |
---|
0,0 → 1,8 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <io.h> |
#include <assert.h> |
int _dos_lock(int _fd, long _offset, long _length) |
{ |
return 0; |
} |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/dosunloc.c |
---|
0,0 → 1,8 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <io.h> |
#include <assert.h> |
int _dos_unlock(int _fd, long _offset, long _length) |
{ |
return 0; |
} |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/fmode.c |
---|
0,0 → 1,5 |
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ |
#include <fcntl.h> |
#include <io.h> |
int _fmode = O_TEXT; |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/lock.c |
---|
0,0 → 1,11 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <io.h> |
#include <errno.h> |
#include <assert.h> |
int |
lock(int fd, long offset, long length) |
{ |
unimpl(); |
return 0; |
} |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/putpath.c |
---|
0,0 → 1,19 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <libc/dosio.h> |
#include <libc/farptrgs.h> |
#include <stdlib.h> |
#include <string.h> |
#include <errno.h> |
#include <assert.h> |
void |
_put_path(const char *path) |
{ |
_put_path2(path, 0); |
} |
void |
_put_path2(const char *path, int offset) |
{ |
unimpl(); |
} |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/setmode.c |
---|
0,0 → 1,16 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <libc/stubs.h> |
#include <sys/exceptn.h> |
#include <errno.h> |
#include <fcntl.h> |
#include <io.h> |
#include <libc/dosio.h> |
#include <assert.h> |
void (*__setmode_stdio_hook)(int fd, int mode); /* BSS to zero */ |
int setmode(int handle, int mode) |
{ |
return 0; |
} |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/tell.c |
---|
0,0 → 1,10 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <libc/stubs.h> |
#include <errno.h> |
#include <io.h> |
#include <unistd.h> |
off_t tell(int _file) |
{ |
return dosemu_tell(_file); |
} |
/programs/develop/libraries/menuetlibc/src/libc/dos/io/unlock.c |
---|
0,0 → 1,11 |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
#include <io.h> |
#include <errno.h> |
#include <assert.h> |
int |
unlock(int fd, long offset, long length) |
{ |
unimpl(); |
} |