2002-07-04 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/stdio.h: Add new prototypes. * libc/stdio/Makefile.am: Add fseeko.c and ftello.c. * libc/stdio/Makefile.in: Regenerated. * libc/stdio/fseek.c: Add fseeko documentation. * libc/stdio/ftell.c: Add ftello documentation. * libc/stdio/fseeko.c: New file. * libc/stdio/ftello.c: New file.
This commit is contained in:
parent
7501704dc9
commit
30b2092fcb
newlib
|
@ -1,3 +1,13 @@
|
||||||
|
2002-07-04 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
|
* libc/include/stdio.h: Add new prototypes.
|
||||||
|
* libc/stdio/Makefile.am: Add fseeko.c and ftello.c.
|
||||||
|
* libc/stdio/Makefile.in: Regenerated.
|
||||||
|
* libc/stdio/fseek.c: Add fseeko documentation.
|
||||||
|
* libc/stdio/ftell.c: Add ftello documentation.
|
||||||
|
* libc/stdio/fseeko.c: New file.
|
||||||
|
* libc/stdio/ftello.c: New file.
|
||||||
|
|
||||||
2002-07-04 Jeff Johnston <jjohnstn@redhat.com>
|
2002-07-04 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
* libc/stdio/Makefile.am: Add asprintf.c and vasprintf.c.
|
* libc/stdio/Makefile.am: Add asprintf.c and vasprintf.c.
|
||||||
|
|
|
@ -199,6 +199,8 @@ int _EXFUN(rename, (const char *, const char *));
|
||||||
#endif
|
#endif
|
||||||
#ifndef __STRICT_ANSI__
|
#ifndef __STRICT_ANSI__
|
||||||
int _EXFUN(asprintf, (char **, const char *, ...));
|
int _EXFUN(asprintf, (char **, const char *, ...));
|
||||||
|
int _EXFUN(fseeko, (FILE *, off_t, int));
|
||||||
|
off_t _EXFUN(ftello, ( FILE *));
|
||||||
int _EXFUN(vfiprintf, (FILE *, const char *, __VALIST));
|
int _EXFUN(vfiprintf, (FILE *, const char *, __VALIST));
|
||||||
int _EXFUN(iprintf, (const char *, ...));
|
int _EXFUN(iprintf, (const char *, ...));
|
||||||
int _EXFUN(fiprintf, (FILE *, const char *, ...));
|
int _EXFUN(fiprintf, (FILE *, const char *, ...));
|
||||||
|
|
|
@ -27,8 +27,10 @@ LIB_SOURCES = \
|
||||||
freopen.c \
|
freopen.c \
|
||||||
fscanf.c \
|
fscanf.c \
|
||||||
fseek.c \
|
fseek.c \
|
||||||
|
fseeko.c \
|
||||||
fsetpos.c \
|
fsetpos.c \
|
||||||
ftell.c \
|
ftell.c \
|
||||||
|
ftello.c \
|
||||||
fvwrite.c \
|
fvwrite.c \
|
||||||
fwalk.c \
|
fwalk.c \
|
||||||
fwrite.c \
|
fwrite.c \
|
||||||
|
|
|
@ -131,8 +131,10 @@ LIB_SOURCES = \
|
||||||
freopen.c \
|
freopen.c \
|
||||||
fscanf.c \
|
fscanf.c \
|
||||||
fseek.c \
|
fseek.c \
|
||||||
|
fseeko.c \
|
||||||
fsetpos.c \
|
fsetpos.c \
|
||||||
ftell.c \
|
ftell.c \
|
||||||
|
ftello.c \
|
||||||
fvwrite.c \
|
fvwrite.c \
|
||||||
fwalk.c \
|
fwalk.c \
|
||||||
fwrite.c \
|
fwrite.c \
|
||||||
|
@ -278,14 +280,14 @@ LIBS = @LIBS@
|
||||||
@USE_LIBTOOL_FALSE@flags.$(OBJEXT) fopen.$(OBJEXT) fprintf.$(OBJEXT) \
|
@USE_LIBTOOL_FALSE@flags.$(OBJEXT) fopen.$(OBJEXT) fprintf.$(OBJEXT) \
|
||||||
@USE_LIBTOOL_FALSE@fputc.$(OBJEXT) fputs.$(OBJEXT) fread.$(OBJEXT) \
|
@USE_LIBTOOL_FALSE@fputc.$(OBJEXT) fputs.$(OBJEXT) fread.$(OBJEXT) \
|
||||||
@USE_LIBTOOL_FALSE@freopen.$(OBJEXT) fscanf.$(OBJEXT) fseek.$(OBJEXT) \
|
@USE_LIBTOOL_FALSE@freopen.$(OBJEXT) fscanf.$(OBJEXT) fseek.$(OBJEXT) \
|
||||||
@USE_LIBTOOL_FALSE@fsetpos.$(OBJEXT) ftell.$(OBJEXT) fvwrite.$(OBJEXT) \
|
@USE_LIBTOOL_FALSE@fseeko.$(OBJEXT) fsetpos.$(OBJEXT) ftell.$(OBJEXT) \
|
||||||
@USE_LIBTOOL_FALSE@fwalk.$(OBJEXT) fwrite.$(OBJEXT) getc.$(OBJEXT) \
|
@USE_LIBTOOL_FALSE@ftello.$(OBJEXT) fvwrite.$(OBJEXT) fwalk.$(OBJEXT) \
|
||||||
@USE_LIBTOOL_FALSE@getchar.$(OBJEXT) getc_u.$(OBJEXT) \
|
@USE_LIBTOOL_FALSE@fwrite.$(OBJEXT) getc.$(OBJEXT) getchar.$(OBJEXT) \
|
||||||
@USE_LIBTOOL_FALSE@getchar_u.$(OBJEXT) getdelim.$(OBJEXT) \
|
@USE_LIBTOOL_FALSE@getc_u.$(OBJEXT) getchar_u.$(OBJEXT) \
|
||||||
@USE_LIBTOOL_FALSE@getline.$(OBJEXT) gets.$(OBJEXT) getw.$(OBJEXT) \
|
@USE_LIBTOOL_FALSE@getdelim.$(OBJEXT) getline.$(OBJEXT) gets.$(OBJEXT) \
|
||||||
@USE_LIBTOOL_FALSE@iprintf.$(OBJEXT) makebuf.$(OBJEXT) mktemp.$(OBJEXT) \
|
@USE_LIBTOOL_FALSE@getw.$(OBJEXT) iprintf.$(OBJEXT) makebuf.$(OBJEXT) \
|
||||||
@USE_LIBTOOL_FALSE@perror.$(OBJEXT) printf.$(OBJEXT) putc.$(OBJEXT) \
|
@USE_LIBTOOL_FALSE@mktemp.$(OBJEXT) perror.$(OBJEXT) printf.$(OBJEXT) \
|
||||||
@USE_LIBTOOL_FALSE@putchar.$(OBJEXT) putc_u.$(OBJEXT) \
|
@USE_LIBTOOL_FALSE@putc.$(OBJEXT) putchar.$(OBJEXT) putc_u.$(OBJEXT) \
|
||||||
@USE_LIBTOOL_FALSE@putchar_u.$(OBJEXT) puts.$(OBJEXT) putw.$(OBJEXT) \
|
@USE_LIBTOOL_FALSE@putchar_u.$(OBJEXT) puts.$(OBJEXT) putw.$(OBJEXT) \
|
||||||
@USE_LIBTOOL_FALSE@refill.$(OBJEXT) remove.$(OBJEXT) rename.$(OBJEXT) \
|
@USE_LIBTOOL_FALSE@refill.$(OBJEXT) remove.$(OBJEXT) rename.$(OBJEXT) \
|
||||||
@USE_LIBTOOL_FALSE@rewind.$(OBJEXT) rget.$(OBJEXT) scanf.$(OBJEXT) \
|
@USE_LIBTOOL_FALSE@rewind.$(OBJEXT) rget.$(OBJEXT) scanf.$(OBJEXT) \
|
||||||
|
@ -307,17 +309,17 @@ LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||||
@USE_LIBTOOL_TRUE@fgetc.lo fgetpos.lo fgets.lo fileno.lo findfp.lo \
|
@USE_LIBTOOL_TRUE@fgetc.lo fgetpos.lo fgets.lo fileno.lo findfp.lo \
|
||||||
@USE_LIBTOOL_TRUE@fiprintf.lo flags.lo fopen.lo fprintf.lo fputc.lo \
|
@USE_LIBTOOL_TRUE@fiprintf.lo flags.lo fopen.lo fprintf.lo fputc.lo \
|
||||||
@USE_LIBTOOL_TRUE@fputs.lo fread.lo freopen.lo fscanf.lo fseek.lo \
|
@USE_LIBTOOL_TRUE@fputs.lo fread.lo freopen.lo fscanf.lo fseek.lo \
|
||||||
@USE_LIBTOOL_TRUE@fsetpos.lo ftell.lo fvwrite.lo fwalk.lo fwrite.lo \
|
@USE_LIBTOOL_TRUE@fseeko.lo fsetpos.lo ftell.lo ftello.lo fvwrite.lo \
|
||||||
@USE_LIBTOOL_TRUE@getc.lo getchar.lo getc_u.lo getchar_u.lo getdelim.lo \
|
@USE_LIBTOOL_TRUE@fwalk.lo fwrite.lo getc.lo getchar.lo getc_u.lo \
|
||||||
@USE_LIBTOOL_TRUE@getline.lo gets.lo getw.lo iprintf.lo makebuf.lo \
|
@USE_LIBTOOL_TRUE@getchar_u.lo getdelim.lo getline.lo gets.lo getw.lo \
|
||||||
@USE_LIBTOOL_TRUE@mktemp.lo perror.lo printf.lo putc.lo putchar.lo \
|
@USE_LIBTOOL_TRUE@iprintf.lo makebuf.lo mktemp.lo perror.lo printf.lo \
|
||||||
@USE_LIBTOOL_TRUE@putc_u.lo putchar_u.lo puts.lo putw.lo refill.lo \
|
@USE_LIBTOOL_TRUE@putc.lo putchar.lo putc_u.lo putchar_u.lo puts.lo \
|
||||||
@USE_LIBTOOL_TRUE@remove.lo rename.lo rewind.lo rget.lo scanf.lo \
|
@USE_LIBTOOL_TRUE@putw.lo refill.lo remove.lo rename.lo rewind.lo \
|
||||||
@USE_LIBTOOL_TRUE@setbuf.lo setbuffer.lo setlinebuf.lo setvbuf.lo \
|
@USE_LIBTOOL_TRUE@rget.lo scanf.lo setbuf.lo setbuffer.lo setlinebuf.lo \
|
||||||
@USE_LIBTOOL_TRUE@siprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \
|
@USE_LIBTOOL_TRUE@setvbuf.lo siprintf.lo snprintf.lo sprintf.lo \
|
||||||
@USE_LIBTOOL_TRUE@tmpfile.lo tmpnam.lo ungetc.lo vasprintf.lo \
|
@USE_LIBTOOL_TRUE@sscanf.lo stdio.lo tmpfile.lo tmpnam.lo ungetc.lo \
|
||||||
@USE_LIBTOOL_TRUE@vfscanf.lo vprintf.lo vscanf.lo vsnprintf.lo \
|
@USE_LIBTOOL_TRUE@vasprintf.lo vfscanf.lo vprintf.lo vscanf.lo \
|
||||||
@USE_LIBTOOL_TRUE@vsprintf.lo vsscanf.lo wbuf.lo wsetup.lo
|
@USE_LIBTOOL_TRUE@vsnprintf.lo vsprintf.lo vsscanf.lo wbuf.lo wsetup.lo
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
|
|
|
@ -17,14 +17,17 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FUNCTION
|
FUNCTION
|
||||||
<<fseek>>---set file position
|
<<fseek>>, <<fseeko>>---set file position
|
||||||
|
|
||||||
INDEX
|
INDEX
|
||||||
fseek
|
fseek
|
||||||
|
INDEX
|
||||||
|
fseeko
|
||||||
|
|
||||||
ANSI_SYNOPSIS
|
ANSI_SYNOPSIS
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
int fseek(FILE *<[fp]>, long <[offset]>, int <[whence]>)
|
int fseek(FILE *<[fp]>, long <[offset]>, int <[whence]>)
|
||||||
|
int fseeko(FILE *<[fp]>, off_t <[offset]>, int <[whence]>)
|
||||||
|
|
||||||
TRAD_SYNOPSIS
|
TRAD_SYNOPSIS
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -33,12 +36,17 @@ TRAD_SYNOPSIS
|
||||||
long <[offset]>;
|
long <[offset]>;
|
||||||
int <[whence]>;
|
int <[whence]>;
|
||||||
|
|
||||||
|
int fseeko(<[fp]>, <[offset]>, <[whence]>)
|
||||||
|
FILE *<[fp]>;
|
||||||
|
off_t <[offset]>;
|
||||||
|
int <[whence]>;
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Objects of type <<FILE>> can have a ``position'' that records how much
|
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
|
of the file your program has already read. Many of the <<stdio>> functions
|
||||||
depend on this position, and many change it as a side effect.
|
depend on this position, and many change it as a side effect.
|
||||||
|
|
||||||
You can use <<fseek>> to set the position for the file identified by
|
You can use <<fseek>>/<<fseeko>> to set the position for the file identified by
|
||||||
<[fp]>. The value of <[offset]> determines the new position, in one
|
<[fp]>. The value of <[offset]> determines the new position, in one
|
||||||
of three ways selected by the value of <[whence]> (defined as macros
|
of three ways selected by the value of <[whence]> (defined as macros
|
||||||
in `<<stdio.h>>'):
|
in `<<stdio.h>>'):
|
||||||
|
@ -53,10 +61,10 @@ from the beginning of the file) desired. <[offset]> must be positive.
|
||||||
<[offset]> can meaningfully be either positive (to increase the size
|
<[offset]> can meaningfully be either positive (to increase the size
|
||||||
of the file) or negative.
|
of the file) or negative.
|
||||||
|
|
||||||
See <<ftell>> to determine the current file position.
|
See <<ftell>>/<<ftello>> to determine the current file position.
|
||||||
|
|
||||||
RETURNS
|
RETURNS
|
||||||
<<fseek>> returns <<0>> when successful. If <<fseek>> fails, the
|
<<fseek>>/<<fseeko>> return <<0>> when successful. On failure, the
|
||||||
result is <<EOF>>. The reason for failure is indicated in <<errno>>:
|
result is <<EOF>>. The reason for failure is indicated in <<errno>>:
|
||||||
either <<ESPIPE>> (the stream identified by <[fp]> doesn't support
|
either <<ESPIPE>> (the stream identified by <[fp]> doesn't support
|
||||||
repositioning) or <<EINVAL>> (invalid file position).
|
repositioning) or <<EINVAL>> (invalid file position).
|
||||||
|
@ -64,6 +72,8 @@ repositioning) or <<EINVAL>> (invalid file position).
|
||||||
PORTABILITY
|
PORTABILITY
|
||||||
ANSI C requires <<fseek>>.
|
ANSI C requires <<fseek>>.
|
||||||
|
|
||||||
|
<<fseeko>> is defined by the Single Unix specification.
|
||||||
|
|
||||||
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
||||||
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2002, Red Hat Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms are permitted
|
||||||
|
* provided that the above copyright notice and this paragraph are
|
||||||
|
* duplicated in all such forms and that any documentation,
|
||||||
|
* advertising materials, and other materials related to such
|
||||||
|
* distribution and use acknowledge that the software was developed
|
||||||
|
* by the University of California, Berkeley. The name of the
|
||||||
|
* University may not be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||||
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
fseeko (fp, offset, whence)
|
||||||
|
register FILE *fp;
|
||||||
|
off_t offset;
|
||||||
|
int whence;
|
||||||
|
{
|
||||||
|
/* for now we simply cast since off_t should be long */
|
||||||
|
return fseek (fp, (long)offset, whence);
|
||||||
|
}
|
|
@ -17,37 +17,44 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FUNCTION
|
FUNCTION
|
||||||
<<ftell>>---return position in a stream or file
|
<<ftell>>, <<ftello>>---return position in a stream or file
|
||||||
|
|
||||||
INDEX
|
INDEX
|
||||||
ftell
|
ftell
|
||||||
|
INDEX
|
||||||
|
ftello
|
||||||
|
|
||||||
ANSI_SYNOPSIS
|
ANSI_SYNOPSIS
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
long ftell(FILE *<[fp]>);
|
long ftell(FILE *<[fp]>);
|
||||||
|
off_t ftello(FILE *<[fp]>);
|
||||||
|
|
||||||
TRAD_SYNOPSIS
|
TRAD_SYNOPSIS
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
long ftell(<[fp]>)
|
long ftell(<[fp]>)
|
||||||
FILE *<[fp]>;
|
FILE *<[fp]>;
|
||||||
|
|
||||||
|
off_t ftello(<[fp]>)
|
||||||
|
FILE *<[fp]>;
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Objects of type <<FILE>> can have a ``position'' that records how much
|
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
|
of the file your program has already read. Many of the <<stdio>> functions
|
||||||
depend on this position, and many change it as a side effect.
|
depend on this position, and many change it as a side effect.
|
||||||
|
|
||||||
The result of <<ftell>> is the current position for a file
|
The result of <<ftell>>/<<ftello>> is the current position for a file
|
||||||
identified by <[fp]>. If you record this result, you can later
|
identified by <[fp]>. If you record this result, you can later
|
||||||
use it with <<fseek>> to return the file to this
|
use it with <<fseek>>/<<fseeko>> to return the file to this
|
||||||
position.
|
position. The difference between <<ftell>> and <<ftello>> is that
|
||||||
|
<<ftell>> returns <<long>> and <<ftello> returns <<off_t>>.
|
||||||
|
|
||||||
In the current implementation, <<ftell>> simply uses a character
|
In the current implementation, <<ftell>>/<<ftello>> simply uses a character
|
||||||
count to represent the file position; this is the same number that
|
count to represent the file position; this is the same number that
|
||||||
would be recorded by <<fgetpos>>.
|
would be recorded by <<fgetpos>>.
|
||||||
|
|
||||||
RETURNS
|
RETURNS
|
||||||
<<ftell>> returns the file position, if possible. If it cannot do
|
<<ftell>>/<<ftello>> return the file position, if possible. If they cannot do
|
||||||
this, it returns <<-1L>>. Failure occurs on streams that do not support
|
this, they return <<-1L>>. Failure occurs on streams that do not support
|
||||||
positioning; the global <<errno>> indicates this condition with the
|
positioning; the global <<errno>> indicates this condition with the
|
||||||
value <<ESPIPE>>.
|
value <<ESPIPE>>.
|
||||||
|
|
||||||
|
@ -58,6 +65,8 @@ acceptable as an argument to <<fseek>>. In particular, other
|
||||||
conforming C implementations may return a different result from
|
conforming C implementations may return a different result from
|
||||||
<<ftell>> than what <<fgetpos>> records.
|
<<ftell>> than what <<fgetpos>> records.
|
||||||
|
|
||||||
|
<<ftello>> is defined by the Single Unix specification.
|
||||||
|
|
||||||
No supporting OS subroutines are required.
|
No supporting OS subroutines are required.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2002, Red Hat Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms are permitted
|
||||||
|
* provided that the above copyright notice and this paragraph are
|
||||||
|
* duplicated in all such forms and that any documentation,
|
||||||
|
* advertising materials, and other materials related to such
|
||||||
|
* distribution and use acknowledge that the software was developed
|
||||||
|
* by the University of California, Berkeley. The name of the
|
||||||
|
* University may not be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||||
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
off_t
|
||||||
|
_DEFUN (ftello, (fp),
|
||||||
|
register FILE * fp)
|
||||||
|
{
|
||||||
|
/* for now we simply cast since off_t should be long */
|
||||||
|
return (off_t)ftell (fp);
|
||||||
|
}
|
Loading…
Reference in New Issue