Indentation fix, cleanup.
[AROS.git] / compiler / stdc / ftell.c
blobf13cc700f3b03c1ab8c3d56c12a5e63acdcddbd4
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function ftell()
6 */
7 #include <dos/dos.h>
8 #include <proto/dos.h>
9 #include <errno.h>
11 #include "__stdio.h"
13 #define DEBUG 0
14 #include <aros/debug.h>
16 /*****************************************************************************
18 NAME */
19 #include <stdio.h>
21 long int ftell (
23 /* SYNOPSIS */
24 FILE * stream)
26 /* FUNCTION
27 Tell the current position in a stream.
29 INPUTS
30 stream - Obtain position of this stream
32 RESULT
33 The position on success and -1 on error.
34 If an error occurred, the global variable errno is set.
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 fopen(), fseek(), fwrite()
45 INTERNALS
47 ******************************************************************************/
49 LONG cnt;
50 BPTR fh = stream->fh;
52 D(bug("[stdcio/ftell()] Entering\n"));
54 Flush (fh);
55 cnt = Seek (fh, 0, OFFSET_CURRENT);
57 if (cnt == -1)
58 errno = __stdc_ioerr2errno (IoErr ());
60 D(bug("[stdcio/ftell()] Leaving cnt=%d\n", cnt));
62 return (long int)cnt;
63 } /* ftell */