Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/fgetpos.c')
-rw-r--r--newlib/libc/stdio/fgetpos.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/newlib/libc/stdio/fgetpos.c b/newlib/libc/stdio/fgetpos.c
index 787f8007a..26c69bf22 100644
--- a/newlib/libc/stdio/fgetpos.c
+++ b/newlib/libc/stdio/fgetpos.c
@@ -4,10 +4,13 @@ FUNCTION
INDEX
fgetpos
+INDEX
+ _fgetpos_r
ANSI_SYNOPSIS
#include <stdio.h>
int fgetpos(FILE *<[fp]>, fpos_t *<[pos]>);
+ int _fgetpos_r(struct _reent *<[ptr]>, FILE *<[fp]>, fpos_t *<[pos]>);
TRAD_SYNOPSIS
#include <stdio.h>
@@ -15,6 +18,11 @@ TRAD_SYNOPSIS
FILE *<[fp]>;
fpos_t *<[pos]>;
+ int _fgetpos_r(<[ptr]>, <[fp]>, <[pos]>)
+ struct _reent *<[ptr]>;
+ FILE *<[fp]>;
+ fpos_t *<[pos]>;
+
DESCRIPTION
Objects of type <<FILE>> can have a ``position'' that records how much
of the file your program has already read. Many of the <<stdio>> functions
@@ -49,12 +57,13 @@ No supporting OS subroutines are required.
#include <stdio.h>
int
-_DEFUN (fgetpos, (fp, pos),
+_DEFUN (_fgetpos_r, (ptr, fp, pos),
+ struct _reent * ptr _AND
FILE * fp _AND
_fpos_t * pos)
{
_flockfile(fp);
- *pos = ftell (fp);
+ *pos = _ftell_r (ptr, fp);
if (*pos != -1)
{
@@ -64,3 +73,15 @@ _DEFUN (fgetpos, (fp, pos),
_funlockfile(fp);
return 1;
}
+
+#ifndef _REENT_ONLY
+
+int
+_DEFUN (fgetpos, (fp, pos),
+ FILE * fp _AND
+ _fpos_t * pos)
+{
+ return _fgetpos_r (_REENT, fp, pos);
+}
+
+#endif /* !_REENT_ONLY */