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:
Jeff Johnston 2002-07-04 19:33:54 +00:00
parent 7501704dc9
commit 30b2092fcb
8 changed files with 119 additions and 30 deletions

View File

@ -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>
* libc/stdio/Makefile.am: Add asprintf.c and vasprintf.c.

View File

@ -199,6 +199,8 @@ int _EXFUN(rename, (const char *, const char *));
#endif
#ifndef __STRICT_ANSI__
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(iprintf, (const char *, ...));
int _EXFUN(fiprintf, (FILE *, const char *, ...));

View File

@ -27,8 +27,10 @@ LIB_SOURCES = \
freopen.c \
fscanf.c \
fseek.c \
fseeko.c \
fsetpos.c \
ftell.c \
ftello.c \
fvwrite.c \
fwalk.c \
fwrite.c \

View File

@ -131,8 +131,10 @@ LIB_SOURCES = \
freopen.c \
fscanf.c \
fseek.c \
fseeko.c \
fsetpos.c \
ftell.c \
ftello.c \
fvwrite.c \
fwalk.c \
fwrite.c \
@ -278,14 +280,14 @@ LIBS = @LIBS@
@USE_LIBTOOL_FALSE@flags.$(OBJEXT) fopen.$(OBJEXT) fprintf.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fputc.$(OBJEXT) fputs.$(OBJEXT) fread.$(OBJEXT) \
@USE_LIBTOOL_FALSE@freopen.$(OBJEXT) fscanf.$(OBJEXT) fseek.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fsetpos.$(OBJEXT) ftell.$(OBJEXT) fvwrite.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fwalk.$(OBJEXT) fwrite.$(OBJEXT) getc.$(OBJEXT) \
@USE_LIBTOOL_FALSE@getchar.$(OBJEXT) getc_u.$(OBJEXT) \
@USE_LIBTOOL_FALSE@getchar_u.$(OBJEXT) getdelim.$(OBJEXT) \
@USE_LIBTOOL_FALSE@getline.$(OBJEXT) gets.$(OBJEXT) getw.$(OBJEXT) \
@USE_LIBTOOL_FALSE@iprintf.$(OBJEXT) makebuf.$(OBJEXT) mktemp.$(OBJEXT) \
@USE_LIBTOOL_FALSE@perror.$(OBJEXT) printf.$(OBJEXT) putc.$(OBJEXT) \
@USE_LIBTOOL_FALSE@putchar.$(OBJEXT) putc_u.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fseeko.$(OBJEXT) fsetpos.$(OBJEXT) ftell.$(OBJEXT) \
@USE_LIBTOOL_FALSE@ftello.$(OBJEXT) fvwrite.$(OBJEXT) fwalk.$(OBJEXT) \
@USE_LIBTOOL_FALSE@fwrite.$(OBJEXT) getc.$(OBJEXT) getchar.$(OBJEXT) \
@USE_LIBTOOL_FALSE@getc_u.$(OBJEXT) getchar_u.$(OBJEXT) \
@USE_LIBTOOL_FALSE@getdelim.$(OBJEXT) getline.$(OBJEXT) gets.$(OBJEXT) \
@USE_LIBTOOL_FALSE@getw.$(OBJEXT) iprintf.$(OBJEXT) makebuf.$(OBJEXT) \
@USE_LIBTOOL_FALSE@mktemp.$(OBJEXT) perror.$(OBJEXT) printf.$(OBJEXT) \
@USE_LIBTOOL_FALSE@putc.$(OBJEXT) putchar.$(OBJEXT) putc_u.$(OBJEXT) \
@USE_LIBTOOL_FALSE@putchar_u.$(OBJEXT) puts.$(OBJEXT) putw.$(OBJEXT) \
@USE_LIBTOOL_FALSE@refill.$(OBJEXT) remove.$(OBJEXT) rename.$(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@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@fsetpos.lo ftell.lo fvwrite.lo fwalk.lo fwrite.lo \
@USE_LIBTOOL_TRUE@getc.lo getchar.lo getc_u.lo getchar_u.lo getdelim.lo \
@USE_LIBTOOL_TRUE@getline.lo gets.lo getw.lo iprintf.lo makebuf.lo \
@USE_LIBTOOL_TRUE@mktemp.lo perror.lo printf.lo putc.lo putchar.lo \
@USE_LIBTOOL_TRUE@putc_u.lo putchar_u.lo puts.lo putw.lo refill.lo \
@USE_LIBTOOL_TRUE@remove.lo rename.lo rewind.lo rget.lo scanf.lo \
@USE_LIBTOOL_TRUE@setbuf.lo setbuffer.lo setlinebuf.lo setvbuf.lo \
@USE_LIBTOOL_TRUE@siprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \
@USE_LIBTOOL_TRUE@tmpfile.lo tmpnam.lo ungetc.lo vasprintf.lo \
@USE_LIBTOOL_TRUE@vfscanf.lo vprintf.lo vscanf.lo vsnprintf.lo \
@USE_LIBTOOL_TRUE@vsprintf.lo vsscanf.lo wbuf.lo wsetup.lo
@USE_LIBTOOL_TRUE@fseeko.lo fsetpos.lo ftell.lo ftello.lo fvwrite.lo \
@USE_LIBTOOL_TRUE@fwalk.lo fwrite.lo getc.lo getchar.lo getc_u.lo \
@USE_LIBTOOL_TRUE@getchar_u.lo getdelim.lo getline.lo gets.lo getw.lo \
@USE_LIBTOOL_TRUE@iprintf.lo makebuf.lo mktemp.lo perror.lo printf.lo \
@USE_LIBTOOL_TRUE@putc.lo putchar.lo putc_u.lo putchar_u.lo puts.lo \
@USE_LIBTOOL_TRUE@putw.lo refill.lo remove.lo rename.lo rewind.lo \
@USE_LIBTOOL_TRUE@rget.lo scanf.lo setbuf.lo setbuffer.lo setlinebuf.lo \
@USE_LIBTOOL_TRUE@setvbuf.lo siprintf.lo snprintf.lo sprintf.lo \
@USE_LIBTOOL_TRUE@sscanf.lo stdio.lo tmpfile.lo tmpnam.lo ungetc.lo \
@USE_LIBTOOL_TRUE@vasprintf.lo vfscanf.lo vprintf.lo vscanf.lo \
@USE_LIBTOOL_TRUE@vsnprintf.lo vsprintf.lo vsscanf.lo wbuf.lo wsetup.lo
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)

View File

@ -17,14 +17,17 @@
/*
FUNCTION
<<fseek>>---set file position
<<fseek>>, <<fseeko>>---set file position
INDEX
fseek
INDEX
fseeko
ANSI_SYNOPSIS
#include <stdio.h>
int fseek(FILE *<[fp]>, long <[offset]>, int <[whence]>)
int fseeko(FILE *<[fp]>, off_t <[offset]>, int <[whence]>)
TRAD_SYNOPSIS
#include <stdio.h>
@ -33,12 +36,17 @@ TRAD_SYNOPSIS
long <[offset]>;
int <[whence]>;
int fseeko(<[fp]>, <[offset]>, <[whence]>)
FILE *<[fp]>;
off_t <[offset]>;
int <[whence]>;
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
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
of three ways selected by the value of <[whence]> (defined as macros
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
of the file) or negative.
See <<ftell>> to determine the current file position.
See <<ftell>>/<<ftello>> to determine the current file position.
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>>:
either <<ESPIPE>> (the stream identified by <[fp]> doesn't support
repositioning) or <<EINVAL>> (invalid file position).
@ -64,6 +72,8 @@ repositioning) or <<EINVAL>> (invalid file position).
PORTABILITY
ANSI C requires <<fseek>>.
<<fseeko>> is defined by the Single Unix specification.
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/

View File

@ -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);
}

View File

@ -17,37 +17,44 @@
/*
FUNCTION
<<ftell>>---return position in a stream or file
<<ftell>>, <<ftello>>---return position in a stream or file
INDEX
ftell
INDEX
ftello
ANSI_SYNOPSIS
#include <stdio.h>
long ftell(FILE *<[fp]>);
off_t ftello(FILE *<[fp]>);
TRAD_SYNOPSIS
#include <stdio.h>
long ftell(<[fp]>)
FILE *<[fp]>;
off_t ftello(<[fp]>)
FILE *<[fp]>;
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
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
use it with <<fseek>> to return the file to this
position.
use it with <<fseek>>/<<fseeko>> to return the file to this
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
would be recorded by <<fgetpos>>.
RETURNS
<<ftell>> returns the file position, if possible. If it cannot do
this, it returns <<-1L>>. Failure occurs on streams that do not support
<<ftell>>/<<ftello>> return the file position, if possible. If they cannot do
this, they return <<-1L>>. Failure occurs on streams that do not support
positioning; the global <<errno>> indicates this condition with the
value <<ESPIPE>>.
@ -58,6 +65,8 @@ acceptable as an argument to <<fseek>>. In particular, other
conforming C implementations may return a different result from
<<ftell>> than what <<fgetpos>> records.
<<ftello>> is defined by the Single Unix specification.
No supporting OS subroutines are required.
*/

View File

@ -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);
}