Fix: 64-bit compatibility
[AROS.git] / compiler / stdc / fputs.c
blobbb87df0355f8e8602409c96a24ecdc2feee39158
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function fputs().
6 */
7 #include <proto/dos.h>
8 #include <errno.h>
10 #include "__stdio.h"
12 /*****************************************************************************
14 NAME */
15 #include <stdio.h>
17 int fputs (
19 /* SYNOPSIS */
20 const char * str,
21 FILE * stream)
23 /* FUNCTION
24 Write a string to the specified stream.
26 INPUTS
27 str - Output this string...
28 fh - ...to this stream
30 RESULT
31 > 0 on success and EOF on error.
33 NOTES
35 EXAMPLE
37 BUGS
39 SEE ALSO
40 puts(), fputc(), putc()
42 INTERNALS
44 ******************************************************************************/
46 if (!(stream->flags & __STDCIO_STDIO_WRITE))
48 SetIoErr(ERROR_WRITE_PROTECTED);
49 errno = EACCES;
50 stream->flags |= __STDCIO_STDIO_ERROR;
51 return EOF;
54 if ((stream->flags & __STDCIO_STDIO_APPEND))
55 Seek(stream->fh, 0, OFFSET_END);
57 if (!str) str = "(null)";
59 if (FPuts(stream->fh, str) == -1)
61 errno = __stdc_ioerr2errno(IoErr());
62 return EOF;
65 return 0;
66 } /* fputs */