* libc/stdio/Makefile.am (lib_a_SOURCES): Added getw.c and putw.c.
(CHEWOUT_FILES): Added getw.def and putw.def. * libc/stdio/Makefile.in: Rebuilt. * libc/stdio/stdio.tex: Include getw.def and putw.def. * libc/stdio/getw.c: New file. * libc/stdio/putw.c: New file.
This commit is contained in:
parent
cba95ef1c8
commit
c505305855
@ -1,3 +1,12 @@
|
|||||||
|
Wed Mar 8 00:38:35 2000 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
|
||||||
|
|
||||||
|
* libc/stdio/Makefile.am (lib_a_SOURCES): Added getw.c and putw.c.
|
||||||
|
(CHEWOUT_FILES): Added getw.def and putw.def.
|
||||||
|
* libc/stdio/Makefile.in: Rebuilt.
|
||||||
|
* libc/stdio/stdio.tex: Include getw.def and putw.def.
|
||||||
|
* libc/stdio/getw.c: New file.
|
||||||
|
* libc/stdio/putw.c: New file.
|
||||||
|
|
||||||
Fri Feb 25 14:50:50 2000 Jeff Johnston <jjohnstn@cygnus.com>
|
Fri Feb 25 14:50:50 2000 Jeff Johnston <jjohnstn@cygnus.com>
|
||||||
|
|
||||||
* libc/stdio/flags.c (__sflags): Added check that mode[1]
|
* libc/stdio/flags.c (__sflags): Added check that mode[1]
|
||||||
|
@ -36,6 +36,7 @@ lib_a_SOURCES = \
|
|||||||
getc.c \
|
getc.c \
|
||||||
getchar.c \
|
getchar.c \
|
||||||
gets.c \
|
gets.c \
|
||||||
|
getw.c \
|
||||||
iprintf.c \
|
iprintf.c \
|
||||||
makebuf.c \
|
makebuf.c \
|
||||||
mktemp.c \
|
mktemp.c \
|
||||||
@ -44,6 +45,7 @@ lib_a_SOURCES = \
|
|||||||
putc.c \
|
putc.c \
|
||||||
putchar.c \
|
putchar.c \
|
||||||
puts.c \
|
puts.c \
|
||||||
|
putw.c \
|
||||||
refill.c \
|
refill.c \
|
||||||
remove.c \
|
remove.c \
|
||||||
rename.c \
|
rename.c \
|
||||||
@ -97,12 +99,14 @@ CHEWOUT_FILES = \
|
|||||||
getc.def \
|
getc.def \
|
||||||
getchar.def \
|
getchar.def \
|
||||||
gets.def \
|
gets.def \
|
||||||
|
getw.def \
|
||||||
iprintf.def \
|
iprintf.def \
|
||||||
mktemp.def \
|
mktemp.def \
|
||||||
perror.def \
|
perror.def \
|
||||||
putc.def \
|
putc.def \
|
||||||
putchar.def \
|
putchar.def \
|
||||||
puts.def \
|
puts.def \
|
||||||
|
putw.def \
|
||||||
remove.def \
|
remove.def \
|
||||||
rename.def \
|
rename.def \
|
||||||
rewind.def \
|
rewind.def \
|
||||||
|
@ -118,6 +118,7 @@ lib_a_SOURCES = \
|
|||||||
getc.c \
|
getc.c \
|
||||||
getchar.c \
|
getchar.c \
|
||||||
gets.c \
|
gets.c \
|
||||||
|
getw.c \
|
||||||
iprintf.c \
|
iprintf.c \
|
||||||
makebuf.c \
|
makebuf.c \
|
||||||
mktemp.c \
|
mktemp.c \
|
||||||
@ -126,6 +127,7 @@ lib_a_SOURCES = \
|
|||||||
putc.c \
|
putc.c \
|
||||||
putchar.c \
|
putchar.c \
|
||||||
puts.c \
|
puts.c \
|
||||||
|
putw.c \
|
||||||
refill.c \
|
refill.c \
|
||||||
remove.c \
|
remove.c \
|
||||||
rename.c \
|
rename.c \
|
||||||
@ -177,12 +179,14 @@ CHEWOUT_FILES = \
|
|||||||
getc.def \
|
getc.def \
|
||||||
getchar.def \
|
getchar.def \
|
||||||
gets.def \
|
gets.def \
|
||||||
|
getw.def \
|
||||||
iprintf.def \
|
iprintf.def \
|
||||||
mktemp.def \
|
mktemp.def \
|
||||||
perror.def \
|
perror.def \
|
||||||
putc.def \
|
putc.def \
|
||||||
putchar.def \
|
putchar.def \
|
||||||
puts.def \
|
puts.def \
|
||||||
|
putw.def \
|
||||||
remove.def \
|
remove.def \
|
||||||
rename.def \
|
rename.def \
|
||||||
rewind.def \
|
rewind.def \
|
||||||
@ -216,8 +220,8 @@ lib_a_DEPENDENCIES = vfiprintf.o
|
|||||||
lib_a_OBJECTS = clearerr.o fclose.o fdopen.o feof.o ferror.o fflush.o \
|
lib_a_OBJECTS = clearerr.o fclose.o fdopen.o feof.o ferror.o fflush.o \
|
||||||
fgetc.o fgetpos.o fgets.o fileno.o findfp.o fiprintf.o flags.o fopen.o \
|
fgetc.o fgetpos.o fgets.o fileno.o findfp.o fiprintf.o flags.o fopen.o \
|
||||||
fprintf.o fputc.o fputs.o fread.o freopen.o fscanf.o fseek.o fsetpos.o \
|
fprintf.o fputc.o fputs.o fread.o freopen.o fscanf.o fseek.o fsetpos.o \
|
||||||
ftell.o fvwrite.o fwalk.o fwrite.o getc.o getchar.o gets.o iprintf.o \
|
ftell.o fvwrite.o fwalk.o fwrite.o getc.o getchar.o gets.o getw.o iprintf.o \
|
||||||
makebuf.o mktemp.o perror.o printf.o putc.o putchar.o puts.o refill.o \
|
makebuf.o mktemp.o perror.o printf.o putc.o putchar.o puts.o putw.o refill.o \
|
||||||
remove.o rename.o rewind.o rget.o scanf.o setbuf.o setvbuf.o siprintf.o \
|
remove.o rename.o rewind.o rget.o scanf.o setbuf.o setvbuf.o siprintf.o \
|
||||||
snprintf.o sprintf.o sscanf.o stdio.o tmpfile.o tmpnam.o ungetc.o \
|
snprintf.o sprintf.o sscanf.o stdio.o tmpfile.o tmpnam.o ungetc.o \
|
||||||
vfprintf.o vfscanf.o vprintf.o vsnprintf.o vsprintf.o wbuf.o wsetup.o
|
vfprintf.o vfscanf.o vprintf.o vsnprintf.o vsprintf.o wbuf.o wsetup.o
|
||||||
|
67
newlib/libc/stdio/getw.c
Normal file
67
newlib/libc/stdio/getw.c
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1990 The Regents of the University of California.
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
FUNCTION
|
||||||
|
<<getw>>---read a word (int)
|
||||||
|
|
||||||
|
INDEX
|
||||||
|
getw
|
||||||
|
|
||||||
|
ANSI_SYNOPSIS
|
||||||
|
#include <stdio.h>
|
||||||
|
int getw(FILE *<[fp]>);
|
||||||
|
|
||||||
|
TRAD_SYNOPSIS
|
||||||
|
#include <stdio.h>
|
||||||
|
int getw(<[fp]>)
|
||||||
|
FILE *<[fp]>;
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
<<getw>> is a function, defined in <<stdio.h>>. You can use <<getw>>
|
||||||
|
to get the next word from the file or stream identified by <[fp]>. As
|
||||||
|
a side effect, <<getw>> advances the file's current position
|
||||||
|
indicator.
|
||||||
|
|
||||||
|
RETURNS The next word (read as an <<int>>), unless there is no more
|
||||||
|
data, or the host system reports a read error; in either of these
|
||||||
|
situations, <<getw>> returns <<EOF>>. Since <<EOF>> is a valid
|
||||||
|
<<int>>, you must use <<ferror>> or <<feof>> to distinguish these
|
||||||
|
situations.
|
||||||
|
|
||||||
|
PORTABILITY
|
||||||
|
<<getw>> is a remnant of K&R C, it is not part of any ISO C Standard.
|
||||||
|
<<fread>> should be used instead. In fact, this implementation of
|
||||||
|
<<getw>> is based upon <<fread>>.
|
||||||
|
|
||||||
|
Supporting OS subroutines required: <<fread>>. */
|
||||||
|
|
||||||
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
|
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||||
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
getw (fp)
|
||||||
|
register FILE *fp;
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
if (fread((char*)&result, sizeof(result), 1, fp) != 1)
|
||||||
|
return EOF;
|
||||||
|
return result;
|
||||||
|
}
|
66
newlib/libc/stdio/putw.c
Normal file
66
newlib/libc/stdio/putw.c
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1990 The Regents of the University of California.
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
FUNCTION
|
||||||
|
<<putw>>---write a word (int)
|
||||||
|
|
||||||
|
INDEX
|
||||||
|
putw
|
||||||
|
|
||||||
|
ANSI_SYNOPSIS
|
||||||
|
#include <stdio.h>
|
||||||
|
int putw(int <[w]>, FILE *<[fp]>);
|
||||||
|
|
||||||
|
TRAD_SYNOPSIS
|
||||||
|
#include <stdio.h>
|
||||||
|
int putw(<w>, <[fp]>)
|
||||||
|
int <w>;
|
||||||
|
FILE *<[fp]>;
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
<<putw>> is a function, defined in <<stdio.h>>. You can use <<putw>>
|
||||||
|
to write a word to the file or stream identified by <[fp]>. As a side
|
||||||
|
effect, <<putw>> advances the file's current position indicator.
|
||||||
|
|
||||||
|
RETURNS The written word, unless the host system reports a write
|
||||||
|
error, in which case <<putw>> returns <<EOF>>. Since <<EOF>> is a
|
||||||
|
valid <<int>>, you must use <<ferror>> or <<feof>> to distinguish
|
||||||
|
these situations when writing the integer equal to <<EOF>>.
|
||||||
|
|
||||||
|
PORTABILITY
|
||||||
|
<<putw>> is a remnant of K&R C, it is not part of any ISO C Standard.
|
||||||
|
<<fwrite>> should be used instead. In fact, this implementation of
|
||||||
|
<<putw>> is based upon <<fwrite>>.
|
||||||
|
|
||||||
|
Supporting OS subroutines required: <<fwrite>>. */
|
||||||
|
|
||||||
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
|
static char sccsid[] = "%W% (Berkeley) %G%";
|
||||||
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
putw (w, fp)
|
||||||
|
int w;
|
||||||
|
register FILE *fp;
|
||||||
|
{
|
||||||
|
if (fwrite((const char*)&w, sizeof(w), 1, fp) != 1)
|
||||||
|
return EOF;
|
||||||
|
return w;
|
||||||
|
}
|
@ -46,12 +46,14 @@ structure.
|
|||||||
* getc:: Get a character from a file or stream (macro)
|
* getc:: Get a character from a file or stream (macro)
|
||||||
* getchar:: Get a character from standard input (macro)
|
* getchar:: Get a character from standard input (macro)
|
||||||
* gets:: Get character string from standard input (obsolete)
|
* gets:: Get character string from standard input (obsolete)
|
||||||
|
* getw:: Get a word (int) from a file or stream
|
||||||
* iprintf:: Write formatted output (integer only)
|
* iprintf:: Write formatted output (integer only)
|
||||||
* mktemp:: Generate unused file name
|
* mktemp:: Generate unused file name
|
||||||
* perror:: Print an error message on standard error
|
* perror:: Print an error message on standard error
|
||||||
* putc:: Write a character on a stream or file (macro)
|
* putc:: Write a character on a stream or file (macro)
|
||||||
* putchar:: Write a character on standard output (macro)
|
* putchar:: Write a character on standard output (macro)
|
||||||
* puts:: Write a character string on standard output
|
* puts:: Write a character string on standard output
|
||||||
|
* putw:: Write a word (int) to a file or stream
|
||||||
* remove:: Delete a file's name
|
* remove:: Delete a file's name
|
||||||
* rename:: Rename a file
|
* rename:: Rename a file
|
||||||
* rewind:: Reinitialize a file or stream
|
* rewind:: Reinitialize a file or stream
|
||||||
@ -131,6 +133,9 @@ structure.
|
|||||||
@page
|
@page
|
||||||
@include stdio/gets.def
|
@include stdio/gets.def
|
||||||
|
|
||||||
|
@page
|
||||||
|
@include stdio/getw.def
|
||||||
|
|
||||||
@page
|
@page
|
||||||
@include stdio/iprintf.def
|
@include stdio/iprintf.def
|
||||||
|
|
||||||
@ -149,6 +154,9 @@ structure.
|
|||||||
@page
|
@page
|
||||||
@include stdio/puts.def
|
@include stdio/puts.def
|
||||||
|
|
||||||
|
@page
|
||||||
|
@include stdio/putw.def
|
||||||
|
|
||||||
@page
|
@page
|
||||||
@include stdio/remove.def
|
@include stdio/remove.def
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user