muimaster.library: support Listview_List in List
[AROS.git] / compiler / posixc / write.c
blob94c28ac38956f1e0187bdc1c5a507fce96578fee
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX.1-2008 function write().
6 */
8 #include <errno.h>
9 #include <dos/dos.h>
10 #include <dos/dosextens.h>
11 #include <proto/exec.h>
12 #include <proto/dos.h>
13 #include "__fdesc.h"
15 /*****************************************************************************
17 NAME */
18 #include <unistd.h>
20 ssize_t write (
22 /* SYNOPSIS */
23 int fd,
24 const void * buf,
25 size_t count)
27 /* FUNCTION
28 Write an amount of characters to the specified file descriptor.
30 INPUTS
31 fd - The file descriptor to write to
32 buf - Write these bytes into the file descriptor
33 count - Write that many bytes
35 RESULT
36 The number of characters written or -1 on error.
38 NOTES
40 EXAMPLE
42 BUGS
44 SEE ALSO
46 INTERNALS
48 ******************************************************************************/
50 ssize_t cnt;
52 fdesc *fdesc = __getfdesc(fd);
53 if (!fdesc)
55 errno = EBADF;
56 return -1;
59 cnt = Write (fdesc->fcb->handle, (void *)buf, count);
61 if (cnt == -1)
62 errno = __stdc_ioerr2errno (IoErr ());
64 return cnt;
65 } /* write */