home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Gadgets 1
/
ADE-1.bin
/
ade-dist
/
emacs-19.28-src.tgz
/
tar.out
/
fsf
/
emacs
/
unixlib
/
src
/
write.c
< prev
Wrap
C/C++ Source or Header
|
1996-09-28
|
526b
|
30 lines
#include "amiga.h"
#include "files.h"
#include <fcntl.h>
#include <unistd.h>
#undef write
int __write(int fd, const void *buffer, unsigned int length)
{
struct fileinfo *fi;
chkabort();
if (fi = _find_fd(fd))
{
if (fi->flags & FI_WRITE)
{
if (fi->flags & O_APPEND) fi->lseek(fi->userinfo, 0, SEEK_END);
return fi->write(fi->userinfo, buffer, length);
}
errno = EACCES;
}
return -1;
}
int write(int fd, const void *buffer, unsigned int length)
{
return __write(fd, buffer, length);
}