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:
authorcvs2svn <>2006-03-21 03:57:37 +0300
committercvs2svn <>2006-03-21 03:57:37 +0300
commitcb45d10b1b96190cbc359b5df782730b1524d505 (patch)
tree6c36bba73142afd46d4b20314f5eaefc1e790ca2 /newlib/libc/stdio
parentf84325d0899e5052fd59892ece265f7c2bd6c6a7 (diff)
This commit was manufactured by cvs2svn to create tag 'newlib-1_12_0'.newlib-1_12_0
Sprout from newlib-csl-20060320-branch 2006-03-21 00:57:35 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch 'newlib-' Cherrypick from master 2004-02-03 00:05:49 UTC Jeff Johnston <jjohnstn@redhat.com> '': COPYING.LIBGLOSS COPYING.NEWLIB ChangeLog MAINTAINERS Makefile.def Makefile.in Makefile.tpl config-ml.in config.guess config.if config.sub config/ChangeLog config/accross.m4 config/acx.m4 config/gettext.m4 config/mh-mingw32 config/mt-linux config/no-executables.m4 configure configure.in etc/ChangeLog etc/Makefile.in etc/configure.texi etc/standards.texi etc/texi2pod.pl gettext.m4 install-sh libgloss/ChangeLog libgloss/Makefile.in libgloss/arm/Makefile.in libgloss/arm/configure libgloss/arm/configure.in libgloss/arm/elf-redboot.ld libgloss/arm/redboot-crt0.S libgloss/configure libgloss/configure.in libgloss/d30v/Makefile.in libgloss/doc/Makefile.in libgloss/fr30/Makefile.in libgloss/frv/Makefile.in libgloss/frv/crt0.S libgloss/hp74x/Makefile.in libgloss/i386/Makefile.in libgloss/i386/cygmon.ld libgloss/i960/Makefile.in libgloss/iq2000/Makefile.in libgloss/iq2000/sim.ld libgloss/libnosys/Makefile.in libgloss/libnosys/configure libgloss/libnosys/configure.in libgloss/libnosys/sbrk.c libgloss/libnosys/warning.h libgloss/m32r/Makefile.in libgloss/m68hc11/Makefile.in libgloss/m68hc11/sci-inout.S libgloss/m68hc11/sim-valid-m68hc11.ld libgloss/m68hc11/sim-valid-m68hc12.ld libgloss/m68k/Makefile.in libgloss/m68k/bcc.ld libgloss/m68k/crt0.S libgloss/m68k/idp.ld libgloss/m68k/idpgdb.ld libgloss/m68k/mvme135.ld libgloss/m68k/mvme162.ld libgloss/m68k/sbc5204.ld libgloss/m68k/sbc5206.ld libgloss/m68k/sim.ld libgloss/mcore/Makefile.in libgloss/mcore/elf-cmb.ld libgloss/mips/Makefile.in libgloss/mips/array.ld libgloss/mips/cfe.ld libgloss/mips/configure libgloss/mips/configure.in libgloss/mips/ddb-kseg0.ld libgloss/mips/ddb.ld libgloss/mips/dve.ld libgloss/mips/idt.ld libgloss/mips/idt32.ld libgloss/mips/idt64.ld libgloss/mips/idtecoff.ld libgloss/mips/jmr3904app-java.ld libgloss/mips/jmr3904app.ld libgloss/mips/jmr3904dram-java.ld libgloss/mips/jmr3904dram.ld libgloss/mips/lsi.ld libgloss/mips/nullmon.ld libgloss/mips/pmon.ld libgloss/mips/regs.S libgloss/mips/vr4300.S libgloss/mips/vr5xxx.S libgloss/mn10200/Makefile.in libgloss/mn10200/eval.ld libgloss/mn10200/sim.ld libgloss/mn10300/Makefile.in libgloss/mn10300/asb2303.ld libgloss/mn10300/asb2305.ld libgloss/mn10300/eval.ld libgloss/mn10300/sim.ld libgloss/pa/Makefile.in libgloss/rs6000/Makefile.in libgloss/rs6000/ads.ld libgloss/rs6000/mbx.ld libgloss/rs6000/simulator.S libgloss/rs6000/yellowknife.ld libgloss/sh/sh1lcevb.ld libgloss/sh/sh2lcevb.ld libgloss/sh/sh3bb.ld libgloss/sh/sh3lcevb.ld libgloss/sparc/Makefile.in libgloss/sparc/elfsim.ld libgloss/sparc/ex930.ld libgloss/sparc/ex931.ld libgloss/sparc/ex934.ld libgloss/sparc/libsys/Makefile.in libgloss/sparc/sparc86x.ld libgloss/xstormy16/Makefile.in libgloss/xstormy16/eva_app.ld libgloss/xstormy16/eva_stub.ld libgloss/xstormy16/sim_high.ld libgloss/xstormy16/sim_rom.ld libtool.m4 ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh ltconfig ltmain.sh missing mkinstalldirs newlib/ChangeLog newlib/MAINTAINERS newlib/Makefile.am newlib/Makefile.in newlib/NEWS newlib/README newlib/acinclude.m4 newlib/aclocal.m4 newlib/configure newlib/configure.host newlib/configure.in newlib/doc/aclocal.m4 newlib/doc/configure newlib/iconvdata/aclocal.m4 newlib/iconvdata/configure newlib/iconvdata/jis0208.h newlib/libc/Makefile.am newlib/libc/Makefile.in newlib/libc/aclocal.m4 newlib/libc/argz/argz_insert.c newlib/libc/configure newlib/libc/configure.in newlib/libc/ctype/ctype.tex newlib/libc/ctype/ctype_.c newlib/libc/ctype/islower.c newlib/libc/ctype/isupper.c newlib/libc/ctype/iswalnum.c newlib/libc/ctype/iswalpha.c newlib/libc/ctype/iswblank.c newlib/libc/ctype/iswcntrl.c newlib/libc/ctype/iswdigit.c newlib/libc/ctype/iswgraph.c newlib/libc/ctype/iswlower.c newlib/libc/ctype/iswprint.c newlib/libc/ctype/iswpunct.c newlib/libc/ctype/iswspace.c newlib/libc/ctype/iswupper.c newlib/libc/ctype/iswxdigit.c newlib/libc/ctype/jp2uc.c newlib/libc/ctype/tolower.c newlib/libc/ctype/toupper.c newlib/libc/ctype/towctrans.c newlib/libc/ctype/towlower.c newlib/libc/ctype/towupper.c newlib/libc/iconv/AUTHORS newlib/libc/iconv/COPYING newlib/libc/iconv/Makefile.am newlib/libc/iconv/Makefile.in newlib/libc/iconv/README.ORIGINAL newlib/libc/iconv/README.TODO newlib/libc/iconv/ccs/Makefile.am newlib/libc/iconv/ccs/Makefile.in newlib/libc/iconv/ccs/README.CCS.SOURCES newlib/libc/iconv/ccs/big5.c newlib/libc/iconv/ccs/binary/Makefile.am newlib/libc/iconv/ccs/binary/Makefile.in newlib/libc/iconv/ccs/binary/big5.cct newlib/libc/iconv/ccs/binary/cns11643_plane1.cct newlib/libc/iconv/ccs/binary/cns11643_plane14.cct newlib/libc/iconv/ccs/binary/cns11643_plane2.cct newlib/libc/iconv/ccs/binary/cp775.cct newlib/libc/iconv/ccs/binary/cp850.cct newlib/libc/iconv/ccs/binary/cp852.cct newlib/libc/iconv/ccs/binary/cp855.cct newlib/libc/iconv/ccs/binary/cp866.cct newlib/libc/iconv/ccs/binary/gb_2312_80.cct newlib/libc/iconv/ccs/binary/iso_8859_1.cct newlib/libc/iconv/ccs/binary/iso_8859_15.cct newlib/libc/iconv/ccs/binary/iso_8859_2.cct newlib/libc/iconv/ccs/binary/iso_8859_4.cct newlib/libc/iconv/ccs/binary/iso_8859_5.cct newlib/libc/iconv/ccs/binary/jis_x0201.cct newlib/libc/iconv/ccs/binary/jis_x0208_1983.cct newlib/libc/iconv/ccs/binary/jis_x0212_1990.cct newlib/libc/iconv/ccs/binary/koi8_r.cct newlib/libc/iconv/ccs/binary/koi8_u.cct newlib/libc/iconv/ccs/binary/ksx1001.cct newlib/libc/iconv/ccs/binary/shift_jis.cct newlib/libc/iconv/ccs/binary/us_ascii.cct newlib/libc/iconv/ccs/cns11643_plane1.c newlib/libc/iconv/ccs/cns11643_plane14.c newlib/libc/iconv/ccs/cns11643_plane2.c newlib/libc/iconv/ccs/cp775.c newlib/libc/iconv/ccs/cp850.c newlib/libc/iconv/ccs/cp852.c newlib/libc/iconv/ccs/cp855.c newlib/libc/iconv/ccs/cp866.c newlib/libc/iconv/ccs/gb_2312_80.c newlib/libc/iconv/ccs/iconv_mktbl newlib/libc/iconv/ccs/iso_8859_1.c newlib/libc/iconv/ccs/iso_8859_15.c newlib/libc/iconv/ccs/iso_8859_2.c newlib/libc/iconv/ccs/iso_8859_4.c newlib/libc/iconv/ccs/iso_8859_5.c newlib/libc/iconv/ccs/jis_x0201.c newlib/libc/iconv/ccs/jis_x0208_1983.c newlib/libc/iconv/ccs/jis_x0212_1990.c newlib/libc/iconv/ccs/koi8_r.c newlib/libc/iconv/ccs/koi8_u.c newlib/libc/iconv/ccs/ksx1001.c newlib/libc/iconv/ccs/shift_jis.c newlib/libc/iconv/ccs/us_ascii.c newlib/libc/iconv/ces/Makefile.am newlib/libc/iconv/ces/Makefile.in newlib/libc/iconv/ces/euc-jp.c newlib/libc/iconv/ces/euc-kr.c newlib/libc/iconv/ces/euc-tw.c newlib/libc/iconv/ces/gb2312.c newlib/libc/iconv/ces/iso-10646-ucs-2.c newlib/libc/iconv/ces/iso-10646-ucs-4.c newlib/libc/iconv/ces/ucs-2-internal.c newlib/libc/iconv/ces/ucs-4-internal.c newlib/libc/iconv/ces/utf-16.c newlib/libc/iconv/ces/utf-8.c newlib/libc/iconv/charset.aliases newlib/libc/iconv/iconv.tex newlib/libc/iconv/lib/Makefile.am newlib/libc/iconv/lib/Makefile.in newlib/libc/iconv/lib/aliases.c newlib/libc/iconv/lib/bialiasesi.c newlib/libc/iconv/lib/biccs.c newlib/libc/iconv/lib/bices.c newlib/libc/iconv/lib/ccs.c newlib/libc/iconv/lib/ces.c newlib/libc/iconv/lib/ces_euc.c newlib/libc/iconv/lib/ces_iso2022.c newlib/libc/iconv/lib/ces_table.c newlib/libc/iconv/lib/converter.c newlib/libc/iconv/lib/deps.h newlib/libc/iconv/lib/endian.h newlib/libc/iconv/lib/iconv.c newlib/libc/iconv/lib/loaddata.c newlib/libc/iconv/lib/local.h newlib/libc/include/_syslist.h newlib/libc/include/ctype.h newlib/libc/include/grp.h newlib/libc/include/iconv.h newlib/libc/include/ieeefp.h newlib/libc/include/machine/ieeefp.h newlib/libc/include/machine/setjmp.h newlib/libc/include/machine/types.h newlib/libc/include/math.h newlib/libc/include/pwd.h newlib/libc/include/stdio.h newlib/libc/include/stdlib.h newlib/libc/include/string.h newlib/libc/include/sys/_types.h newlib/libc/include/sys/config.h newlib/libc/include/sys/dirent.h newlib/libc/include/sys/fcntl.h newlib/libc/include/sys/features.h newlib/libc/include/sys/lock.h newlib/libc/include/sys/param.h newlib/libc/include/sys/reent.h newlib/libc/include/sys/signal.h newlib/libc/include/sys/stdio.h newlib/libc/include/sys/time.h newlib/libc/include/sys/types.h newlib/libc/include/sys/unistd.h newlib/libc/include/time.h newlib/libc/libc.texinfo newlib/libc/locale/locale.c newlib/libc/machine/a29k/aclocal.m4 newlib/libc/machine/a29k/configure newlib/libc/machine/aclocal.m4 newlib/libc/machine/arm/Makefile.am newlib/libc/machine/arm/Makefile.in newlib/libc/machine/arm/aclocal.m4 newlib/libc/machine/arm/configure newlib/libc/machine/configure newlib/libc/machine/d10v/aclocal.m4 newlib/libc/machine/d10v/configure newlib/libc/machine/d30v/aclocal.m4 newlib/libc/machine/d30v/configure newlib/libc/machine/fr30/aclocal.m4 newlib/libc/machine/fr30/configure newlib/libc/machine/frv/aclocal.m4 newlib/libc/machine/frv/configure newlib/libc/machine/h8300/Makefile.am newlib/libc/machine/h8300/Makefile.in newlib/libc/machine/h8300/aclocal.m4 newlib/libc/machine/h8300/configure newlib/libc/machine/h8300/defines.h newlib/libc/machine/h8300/memcpy.S newlib/libc/machine/h8300/memset.S newlib/libc/machine/h8300/setarch.h newlib/libc/machine/h8300/setjmp.S newlib/libc/machine/h8300/strcmp.S newlib/libc/machine/h8500/aclocal.m4 newlib/libc/machine/h8500/configure newlib/libc/machine/hppa/aclocal.m4 newlib/libc/machine/hppa/configure newlib/libc/machine/i386/aclocal.m4 newlib/libc/machine/i386/configure newlib/libc/machine/i960/aclocal.m4 newlib/libc/machine/i960/configure newlib/libc/machine/iq2000/aclocal.m4 newlib/libc/machine/iq2000/configure newlib/libc/machine/m32r/aclocal.m4 newlib/libc/machine/m32r/configure newlib/libc/machine/m68hc11/aclocal.m4 newlib/libc/machine/m68hc11/configure newlib/libc/machine/m68k/aclocal.m4 newlib/libc/machine/m68k/configure newlib/libc/machine/m88k/aclocal.m4 newlib/libc/machine/m88k/configure newlib/libc/machine/mips/aclocal.m4 newlib/libc/machine/mips/configure newlib/libc/machine/mn10200/aclocal.m4 newlib/libc/machine/mn10200/configure newlib/libc/machine/mn10300/aclocal.m4 newlib/libc/machine/mn10300/configure newlib/libc/machine/necv70/aclocal.m4 newlib/libc/machine/necv70/configure newlib/libc/machine/powerpc/aclocal.m4 newlib/libc/machine/powerpc/configure newlib/libc/machine/powerpc/vfprintf.c newlib/libc/machine/powerpc/vfscanf.c newlib/libc/machine/sh/Makefile.in newlib/libc/machine/sh/aclocal.m4 newlib/libc/machine/sh/asm.h newlib/libc/machine/sh/configure newlib/libc/machine/sparc/aclocal.m4 newlib/libc/machine/sparc/configure newlib/libc/machine/tic4x/aclocal.m4 newlib/libc/machine/tic4x/configure newlib/libc/machine/tic80/aclocal.m4 newlib/libc/machine/tic80/configure newlib/libc/machine/v850/aclocal.m4 newlib/libc/machine/v850/configure newlib/libc/machine/w65/aclocal.m4 newlib/libc/machine/w65/configure newlib/libc/machine/xscale/Makefile.am newlib/libc/machine/xscale/Makefile.in newlib/libc/machine/xscale/aclocal.m4 newlib/libc/machine/xscale/configure newlib/libc/machine/xstormy16/aclocal.m4 newlib/libc/machine/xstormy16/configure newlib/libc/machine/z8k/Makefile.am newlib/libc/machine/z8k/Makefile.in newlib/libc/machine/z8k/aclocal.m4 newlib/libc/machine/z8k/configure newlib/libc/machine/z8k/setjmp.S newlib/libc/misc/Makefile.am newlib/libc/misc/Makefile.in newlib/libc/misc/unctrl.c newlib/libc/posix/scandir.c newlib/libc/reent/impure.c newlib/libc/reent/reent.c newlib/libc/reent/reent.tex newlib/libc/search/hash.c newlib/libc/search/hash_buf.c newlib/libc/signal/signal.c newlib/libc/stdio/Makefile.am newlib/libc/stdio/Makefile.in newlib/libc/stdio/asprintf.c newlib/libc/stdio/clearerr.c newlib/libc/stdio/fclose.c newlib/libc/stdio/fcloseall.c newlib/libc/stdio/fdopen.c newlib/libc/stdio/feof.c newlib/libc/stdio/ferror.c newlib/libc/stdio/fflush.c newlib/libc/stdio/fgetc.c newlib/libc/stdio/fgetpos.c newlib/libc/stdio/fgets.c newlib/libc/stdio/fileno.c newlib/libc/stdio/findfp.c newlib/libc/stdio/fiprintf.c newlib/libc/stdio/flags.c newlib/libc/stdio/fopen.c newlib/libc/stdio/fprintf.c newlib/libc/stdio/fputc.c newlib/libc/stdio/fputs.c newlib/libc/stdio/fread.c newlib/libc/stdio/freopen.c newlib/libc/stdio/fscanf.c newlib/libc/stdio/fseek.c newlib/libc/stdio/fseeko.c newlib/libc/stdio/fsetpos.c newlib/libc/stdio/ftell.c newlib/libc/stdio/ftello.c newlib/libc/stdio/fvwrite.c newlib/libc/stdio/fwalk.c newlib/libc/stdio/fwrite.c newlib/libc/stdio/getc.c newlib/libc/stdio/getc_u.c newlib/libc/stdio/getchar.c newlib/libc/stdio/getchar_u.c newlib/libc/stdio/getdelim.c newlib/libc/stdio/getline.c newlib/libc/stdio/gets.c newlib/libc/stdio/getw.c newlib/libc/stdio/iprintf.c newlib/libc/stdio/local.h newlib/libc/stdio/makebuf.c newlib/libc/stdio/mktemp.c newlib/libc/stdio/perror.c newlib/libc/stdio/printf.c newlib/libc/stdio/putc.c newlib/libc/stdio/putc_u.c newlib/libc/stdio/putchar.c newlib/libc/stdio/putchar_u.c newlib/libc/stdio/puts.c newlib/libc/stdio/putw.c newlib/libc/stdio/refill.c newlib/libc/stdio/remove.c newlib/libc/stdio/rename.c newlib/libc/stdio/rewind.c newlib/libc/stdio/rget.c newlib/libc/stdio/scanf.c newlib/libc/stdio/setbuf.c newlib/libc/stdio/setbuffer.c newlib/libc/stdio/setlinebuf.c newlib/libc/stdio/setvbuf.c newlib/libc/stdio/siprintf.c newlib/libc/stdio/snprintf.c newlib/libc/stdio/sprintf.c newlib/libc/stdio/sscanf.c newlib/libc/stdio/stdio.c newlib/libc/stdio/stdio.tex newlib/libc/stdio/tmpfile.c newlib/libc/stdio/tmpnam.c newlib/libc/stdio/ungetc.c newlib/libc/stdio/vasprintf.c newlib/libc/stdio/vfieeefp.h newlib/libc/stdio/vfprintf.c newlib/libc/stdio/vfscanf.c newlib/libc/stdio/vprintf.c newlib/libc/stdio/vscanf.c newlib/libc/stdio/vsnprintf.c newlib/libc/stdio/vsprintf.c newlib/libc/stdio/vsscanf.c newlib/libc/stdio/wbuf.c newlib/libc/stdio/wsetup.c newlib/libc/stdio64/fdopen64.c newlib/libc/stdio64/fgetpos64.c newlib/libc/stdio64/fopen64.c newlib/libc/stdio64/freopen64.c newlib/libc/stdio64/fseeko64.c newlib/libc/stdio64/ftello64.c newlib/libc/stdlib/Makefile.am newlib/libc/stdlib/Makefile.in newlib/libc/stdlib/a64l.c newlib/libc/stdlib/assert.c newlib/libc/stdlib/atexit.c newlib/libc/stdlib/atexit.h newlib/libc/stdlib/efgcvt.c newlib/libc/stdlib/envlock.c newlib/libc/stdlib/exit.c newlib/libc/stdlib/getopt.c newlib/libc/stdlib/ldtoa.c newlib/libc/stdlib/mallocr.c newlib/libc/stdlib/mblen.c newlib/libc/stdlib/mblen_r.c newlib/libc/stdlib/mbrlen.c newlib/libc/stdlib/mbrtowc.c newlib/libc/stdlib/mbsrtowcs.c newlib/libc/stdlib/mbstowcs.c newlib/libc/stdlib/mbtowc.c newlib/libc/stdlib/mbtowc_r.c newlib/libc/stdlib/mlock.c newlib/libc/stdlib/mstats.c newlib/libc/stdlib/on_exit.c newlib/libc/stdlib/putenv.c newlib/libc/stdlib/putenv_r.c newlib/libc/stdlib/rand.c newlib/libc/stdlib/rand48.c newlib/libc/stdlib/setenv_r.c newlib/libc/stdlib/stdlib.tex newlib/libc/stdlib/strtod.c newlib/libc/stdlib/wcrtomb.c newlib/libc/stdlib/wcsrtombs.c newlib/libc/stdlib/wcstombs.c newlib/libc/stdlib/wctomb.c newlib/libc/string/bcmp.c newlib/libc/string/memchr.c newlib/libc/string/memcmp.c newlib/libc/string/strcasecmp.c newlib/libc/string/strcoll.c newlib/libc/string/strcspn.c newlib/libc/string/strerror_r.c newlib/libc/string/strings.tex newlib/libc/string/strlwr.c newlib/libc/string/strncasecmp.c newlib/libc/string/strncat.c newlib/libc/string/strndup_r.c newlib/libc/string/strnlen.c newlib/libc/string/strpbrk.c newlib/libc/string/strtok.c newlib/libc/string/strupr.c newlib/libc/string/wcscat.c newlib/libc/string/wcschr.c newlib/libc/string/wcscmp.c newlib/libc/string/wcscoll.c newlib/libc/string/wcscpy.c newlib/libc/string/wcscspn.c newlib/libc/string/wcslcat.c newlib/libc/string/wcslcpy.c newlib/libc/string/wcslen.c newlib/libc/string/wcsncat.c newlib/libc/string/wcsncmp.c newlib/libc/string/wcsncpy.c newlib/libc/string/wcsnlen.c newlib/libc/string/wcspbrk.c newlib/libc/string/wcsrchr.c newlib/libc/string/wcsspn.c newlib/libc/string/wcsstr.c newlib/libc/string/wcstrings.tex newlib/libc/string/wcswidth.c newlib/libc/string/wcwidth.c newlib/libc/string/wmemchr.c newlib/libc/string/wmemcmp.c newlib/libc/string/wmemcpy.c newlib/libc/string/wmemmove.c newlib/libc/string/wmemset.c newlib/libc/sys.tex newlib/libc/sys/a29khif/aclocal.m4 newlib/libc/sys/a29khif/configure newlib/libc/sys/aclocal.m4 newlib/libc/sys/arc/aclocal.m4 newlib/libc/sys/arc/configure newlib/libc/sys/arc/syscalls.c newlib/libc/sys/arm/Makefile.am newlib/libc/sys/arm/Makefile.in newlib/libc/sys/arm/access.c newlib/libc/sys/arm/aclocal.m4 newlib/libc/sys/arm/configure newlib/libc/sys/arm/crt0.S newlib/libc/sys/arm/libcfunc.c newlib/libc/sys/arm/setjmp.S newlib/libc/sys/arm/swi.h newlib/libc/sys/arm/sys/param.h newlib/libc/sys/arm/syscalls.c newlib/libc/sys/arm/trap.S newlib/libc/sys/configure newlib/libc/sys/configure.in newlib/libc/sys/d10v/aclocal.m4 newlib/libc/sys/d10v/configure newlib/libc/sys/decstation/aclocal.m4 newlib/libc/sys/decstation/configure newlib/libc/sys/h8300hms/Makefile.am newlib/libc/sys/h8300hms/Makefile.in newlib/libc/sys/h8300hms/_exit.c newlib/libc/sys/h8300hms/aclocal.m4 newlib/libc/sys/h8300hms/close.S newlib/libc/sys/h8300hms/configure newlib/libc/sys/h8300hms/crt0.S newlib/libc/sys/h8300hms/fstat.S newlib/libc/sys/h8300hms/lseek.S newlib/libc/sys/h8300hms/read.S newlib/libc/sys/h8300hms/setarch.h newlib/libc/sys/h8300hms/write.S newlib/libc/sys/h8500hms/aclocal.m4 newlib/libc/sys/h8500hms/configure newlib/libc/sys/linux/Makefile.am newlib/libc/sys/linux/Makefile.in newlib/libc/sys/linux/aclocal.m4 newlib/libc/sys/linux/aio.c newlib/libc/sys/linux/argp/argp-fs-xinl.c newlib/libc/sys/linux/argp/argp-xinl.c newlib/libc/sys/linux/configure newlib/libc/sys/linux/dl/dl-cache.c newlib/libc/sys/linux/dl/dl-load.c newlib/libc/sys/linux/dl/dl-open.c newlib/libc/sys/linux/dl/dl-reloc.c newlib/libc/sys/linux/dl/dl-runtime.c newlib/libc/sys/linux/dl/dl-support.c newlib/libc/sys/linux/dl/dlfcn.h newlib/libc/sys/linux/dl/do-rel.h newlib/libc/sys/linux/dl/dynamic-link.h newlib/libc/sys/linux/dl/ldsodefs.h newlib/libc/sys/linux/getpwnam.c newlib/libc/sys/linux/getpwuid.c newlib/libc/sys/linux/iconv/gconv_open.c newlib/libc/sys/linux/iconv/gconv_simple.c newlib/libc/sys/linux/include/dlfcn.h newlib/libc/sys/linux/include/getopt.h newlib/libc/sys/linux/include/stdint.h newlib/libc/sys/linux/include/time.h newlib/libc/sys/linux/include/unistd.h newlib/libc/sys/linux/inode.c newlib/libc/sys/linux/intl/dcigettext.c newlib/libc/sys/linux/intl/explodename.c newlib/libc/sys/linux/intl/finddomain.c newlib/libc/sys/linux/intl/l10nflist.c newlib/libc/sys/linux/intl/loadmsgcat.c newlib/libc/sys/linux/intl/localealias.c newlib/libc/sys/linux/linuxthreads/Makefile.am newlib/libc/sys/linux/linuxthreads/Makefile.in newlib/libc/sys/linux/linuxthreads/aclocal.m4 newlib/libc/sys/linux/linuxthreads/bits/libc-lock.h newlib/libc/sys/linux/linuxthreads/config.h newlib/libc/sys/linux/linuxthreads/configure newlib/libc/sys/linux/linuxthreads/machine/aclocal.m4 newlib/libc/sys/linux/linuxthreads/machine/configure newlib/libc/sys/linux/linuxthreads/machine/i386/aclocal.m4 newlib/libc/sys/linux/linuxthreads/machine/i386/configure newlib/libc/sys/linux/machine/aclocal.m4 newlib/libc/sys/linux/machine/configure newlib/libc/sys/linux/machine/i386/aclocal.m4 newlib/libc/sys/linux/machine/i386/configure newlib/libc/sys/linux/machine/i386/dl-machine.h newlib/libc/sys/linux/machine/i386/socketcall.h newlib/libc/sys/linux/machine/i386/syscall.h newlib/libc/sys/linux/machine/i386/weakalias.h newlib/libc/sys/linux/net/gethostbydns.c newlib/libc/sys/linux/net/ns_ntoa.c newlib/libc/sys/linux/shared.ld newlib/libc/sys/linux/stdlib/glob.c newlib/libc/sys/linux/sys/_types.h newlib/libc/sys/linux/sys/cdefs.h newlib/libc/sys/linux/sys/dirent.h newlib/libc/sys/linux/sys/lock.h newlib/libc/sys/linux/sys/stat.h newlib/libc/sys/linux/sys/types.h newlib/libc/sys/linux/sys/unistd.h newlib/libc/sys/m88kbug/aclocal.m4 newlib/libc/sys/m88kbug/configure newlib/libc/sys/mmixware/aclocal.m4 newlib/libc/sys/mmixware/configure newlib/libc/sys/netware/aclocal.m4 newlib/libc/sys/netware/configure newlib/libc/sys/rtems/aclocal.m4 newlib/libc/sys/rtems/configure newlib/libc/sys/rtems/crt0.c newlib/libc/sys/rtems/sys/param.h newlib/libc/sys/sh/aclocal.m4 newlib/libc/sys/sh/configure newlib/libc/sys/sh/crt0.S newlib/libc/sys/sparc64/aclocal.m4 newlib/libc/sys/sparc64/configure newlib/libc/sys/sun4/aclocal.m4 newlib/libc/sys/sun4/configure newlib/libc/sys/sysmec/aclocal.m4 newlib/libc/sys/sysmec/configure newlib/libc/sys/sysnec810/aclocal.m4 newlib/libc/sys/sysnec810/configure newlib/libc/sys/sysnecv850/aclocal.m4 newlib/libc/sys/sysnecv850/configure newlib/libc/sys/sysvi386/aclocal.m4 newlib/libc/sys/sysvi386/configure newlib/libc/sys/sysvi386/sys/param.h newlib/libc/sys/sysvnecv70/aclocal.m4 newlib/libc/sys/sysvnecv70/configure newlib/libc/sys/tic80/aclocal.m4 newlib/libc/sys/tic80/configure newlib/libc/sys/w65/aclocal.m4 newlib/libc/sys/w65/configure newlib/libc/sys/z8ksim/aclocal.m4 newlib/libc/sys/z8ksim/configure newlib/libc/time/Makefile.am newlib/libc/time/Makefile.in newlib/libc/time/local.h newlib/libc/time/mktime.c newlib/libc/time/mktm_r.c newlib/libc/time/strftime.c newlib/libc/time/strptime.c newlib/libc/time/time.tex newlib/libc/time/tzlock.c newlib/libc/time/tzset_r.c newlib/libc/unix/Makefile.am newlib/libc/unix/Makefile.in newlib/libc/unix/getcwd.c newlib/libc/unix/getlogin.c newlib/libc/unix/getpass.c newlib/libc/unix/getut.c newlib/libc/unix/ttyname.c newlib/libm/Makefile.am newlib/libm/Makefile.in newlib/libm/aclocal.m4 newlib/libm/common/Makefile.am newlib/libm/common/Makefile.in newlib/libm/common/common.tex newlib/libm/common/fdlibm.h newlib/libm/common/s_fmax.c newlib/libm/common/s_fmin.c newlib/libm/common/s_fpclassify.c newlib/libm/common/s_lrint.c newlib/libm/common/s_modf.c newlib/libm/common/sf_fmax.c newlib/libm/common/sf_fmin.c newlib/libm/common/sf_lrint.c newlib/libm/common/sf_round.c newlib/libm/configure newlib/libm/libm.texinfo newlib/libm/machine/aclocal.m4 newlib/libm/machine/configure newlib/libm/machine/i386/aclocal.m4 newlib/libm/machine/i386/configure newlib/libm/math/Makefile.am newlib/libm/math/Makefile.in newlib/libm/math/ef_atan2.c newlib/libm/math/ef_hypot.c newlib/libm/math/math.tex newlib/libm/math/s_infconst.c newlib/libm/math/s_isinf.c newlib/libm/math/s_isnan.c newlib/libm/math/s_ldexp.c newlib/libm/math/sf_isinf.c newlib/libm/math/sf_isnan.c newlib/libm/math/w_j0.c newlib/libm/math/w_log.c newlib/libm/mathfp/Makefile.am newlib/libm/mathfp/Makefile.in newlib/libm/mathfp/er_gamma.c newlib/libm/mathfp/er_lgamma.c newlib/libm/mathfp/erf_gamma.c newlib/libm/mathfp/erf_lgamma.c newlib/libm/mathfp/mathfp.tex newlib/libm/mathfp/s_atangent.c newlib/libm/mathfp/s_frexp.c newlib/libm/mathfp/s_infconst.c newlib/libm/mathfp/s_isinf.c newlib/libm/mathfp/s_isnan.c newlib/libm/mathfp/s_ldexp.c newlib/libm/mathfp/s_logarithm.c newlib/libm/mathfp/s_mathcnst.c newlib/libm/mathfp/s_pow.c newlib/libm/mathfp/sf_atangent.c newlib/libm/mathfp/sf_frexp.c newlib/libm/mathfp/sf_isinf.c newlib/libm/mathfp/sf_isnan.c newlib/libm/mathfp/sf_pow.c newlib/libm/mathfp/w_jn.c newlib/newlib.hin newlib/stamp-h.in newlib/testsuite/include/check.h newlib/testsuite/lib/checkoutput.exp newlib/testsuite/lib/flags.exp newlib/testsuite/lib/newlib.exp newlib/testsuite/lib/passfail.exp src-release symlink-tree texinfo/texinfo.tex Cherrypick from cygnus 1999-05-03 07:29:06 UTC Richard Henderson <rth@redhat.com> '19990502 sourceware import': COPYING COPYING.LIB move-if-change mpw-README mpw-build.in mpw-config.in mpw-configure mpw-install setup.com ylwrap Delete: config/codeset.m4 config/depstand.m4 config/enable.m4 config/gettext-sister.m4 config/glibc21.m4 config/gxx-include-dir.m4 config/iconv.m4 config/intdiv0.m4 config/inttypes-pri.m4 config/inttypes.m4 config/inttypes_h.m4 config/lcmessage.m4 config/lead-dot.m4 config/lib-ld.m4 config/lib-link.m4 config/lib-prefix.m4 config/mh-ppc-aix config/mh-ppc-darwin config/mh-x86omitfp config/mt-gnu config/nls.m4 config/po.m4 config/stdint.m4 config/stdint_h.m4 config/tls.m4 config/uintmax_t.m4 config/ulonglong.m4 config/warnings.m4 depcomp libgloss/arm/coff-rdimon.specs libgloss/arm/coff-rdpmon.specs libgloss/arm/crt0.S libgloss/arm/elf-rdimon.specs libgloss/arm/elf-rdpmon.specs libgloss/arm/libcfunc.c libgloss/arm/swi.h libgloss/arm/syscalls.c libgloss/arm/trap.S libgloss/cris/Makefile.in libgloss/cris/configure libgloss/cris/configure.in libgloss/cris/crt0.S libgloss/cris/crti.c libgloss/cris/crtn.c libgloss/cris/gensyscalls libgloss/cris/lcrt0.c libgloss/cris/linunistd.h libgloss/cris/outbyte.c libgloss/cris/setup.S libgloss/crx/Makefile.in libgloss/crx/_exit.c libgloss/crx/_getenv.c libgloss/crx/_rename.c libgloss/crx/close.c libgloss/crx/configure libgloss/crx/configure.in libgloss/crx/crt0.S libgloss/crx/crti.S libgloss/crx/crtn.S libgloss/crx/dvz_hndl.c libgloss/crx/flg_hndl.c libgloss/crx/fstat.c libgloss/crx/getpid.c libgloss/crx/iad_hndl.c libgloss/crx/intable.c libgloss/crx/isatty.c libgloss/crx/kill.c libgloss/crx/lseek.c libgloss/crx/open.c libgloss/crx/putnum.c libgloss/crx/read.c libgloss/crx/sbrk.c libgloss/crx/sim.ld libgloss/crx/stat.c libgloss/crx/svc_hndl.c libgloss/crx/time.c libgloss/crx/und_hndl.c libgloss/crx/unlink.c libgloss/crx/write.c libgloss/libnosys/_exit.c libgloss/libnosys/chown.c libgloss/libnosys/readlink.c libgloss/libnosys/symlink.c libgloss/m32c/Makefile.in libgloss/m32c/abort.S libgloss/m32c/argv.S libgloss/m32c/argvlen.S libgloss/m32c/chdir.S libgloss/m32c/chmod.S libgloss/m32c/close.S libgloss/m32c/configure libgloss/m32c/configure.in libgloss/m32c/crt0.S libgloss/m32c/crtn.S libgloss/m32c/exit.S libgloss/m32c/fstat.S libgloss/m32c/genscript libgloss/m32c/getpid.S libgloss/m32c/gettimeofday.S libgloss/m32c/heaptop.S libgloss/m32c/isatty.S libgloss/m32c/kill.S libgloss/m32c/link.S libgloss/m32c/lseek.S libgloss/m32c/m32c.tmpl libgloss/m32c/m32csys.h libgloss/m32c/open.S libgloss/m32c/read.S libgloss/m32c/sbrk.c libgloss/m32c/stat.S libgloss/m32c/time.S libgloss/m32c/times.S libgloss/m32c/unlink.S libgloss/m32c/utime.S libgloss/m32c/write.S libgloss/m68k/dbug-cf.sc libgloss/mt/16-002.ld libgloss/mt/16-003.ld libgloss/mt/64-001.ld libgloss/mt/Makefile.in libgloss/mt/access.c libgloss/mt/chmod.c libgloss/mt/close.c libgloss/mt/configure libgloss/mt/configure.in libgloss/mt/crt0-16-002.S libgloss/mt/crt0-16-003.S libgloss/mt/crt0-64-001.S libgloss/mt/crt0-ms2.S libgloss/mt/crt0.S libgloss/mt/exit-16-002.c libgloss/mt/exit-16-003.c libgloss/mt/exit-64-001.c libgloss/mt/exit-ms2.c libgloss/mt/exit.c libgloss/mt/fstat.c libgloss/mt/getpid.c libgloss/mt/gettime.c libgloss/mt/isatty.c libgloss/mt/kill.c libgloss/mt/lseek.c libgloss/mt/ms2.ld libgloss/mt/open.c libgloss/mt/read.c libgloss/mt/sbrk.c libgloss/mt/startup-16-002.S libgloss/mt/startup-16-003.S libgloss/mt/startup-64-001.S libgloss/mt/startup-ms2.S libgloss/mt/stat.c libgloss/mt/time.c libgloss/mt/times.c libgloss/mt/trap.S libgloss/mt/trap.h libgloss/mt/unlink.c libgloss/mt/utime.c libgloss/mt/write.c libgloss/rs6000/sim-getrusage.S newlib/acconfig.h newlib/libc/iconv/ccs/binary/iso_8859_10.cct newlib/libc/iconv/ccs/binary/iso_8859_11.cct newlib/libc/iconv/ccs/binary/iso_8859_13.cct newlib/libc/iconv/ccs/binary/iso_8859_14.cct newlib/libc/iconv/ccs/binary/iso_8859_3.cct newlib/libc/iconv/ccs/binary/iso_8859_6.cct newlib/libc/iconv/ccs/binary/iso_8859_7.cct newlib/libc/iconv/ccs/binary/iso_8859_8.cct newlib/libc/iconv/ccs/binary/iso_8859_9.cct newlib/libc/iconv/ccs/binary/iso_ir_111.cct newlib/libc/iconv/ccs/binary/jis_x0201_1976.cct newlib/libc/iconv/ccs/binary/jis_x0208_1990.cct newlib/libc/iconv/ccs/binary/koi8_ru.cct newlib/libc/iconv/ccs/binary/koi8_uni.cct newlib/libc/iconv/ccs/binary/win_1250.cct newlib/libc/iconv/ccs/binary/win_1251.cct newlib/libc/iconv/ccs/binary/win_1252.cct newlib/libc/iconv/ccs/binary/win_1253.cct newlib/libc/iconv/ccs/binary/win_1254.cct newlib/libc/iconv/ccs/binary/win_1255.cct newlib/libc/iconv/ccs/binary/win_1256.cct newlib/libc/iconv/ccs/binary/win_1257.cct newlib/libc/iconv/ccs/binary/win_1258.cct newlib/libc/iconv/ccs/ccs.h newlib/libc/iconv/ccs/ccsbi.c newlib/libc/iconv/ccs/ccsbi.h newlib/libc/iconv/ccs/ccsnames.h newlib/libc/iconv/ccs/iso_8859_10.c newlib/libc/iconv/ccs/iso_8859_11.c newlib/libc/iconv/ccs/iso_8859_13.c newlib/libc/iconv/ccs/iso_8859_14.c newlib/libc/iconv/ccs/iso_8859_3.c newlib/libc/iconv/ccs/iso_8859_6.c newlib/libc/iconv/ccs/iso_8859_7.c newlib/libc/iconv/ccs/iso_8859_8.c newlib/libc/iconv/ccs/iso_8859_9.c newlib/libc/iconv/ccs/iso_ir_111.c newlib/libc/iconv/ccs/jis_x0201_1976.c newlib/libc/iconv/ccs/jis_x0208_1990.c newlib/libc/iconv/ccs/koi8_ru.c newlib/libc/iconv/ccs/koi8_uni.c newlib/libc/iconv/ccs/mktbl.pl newlib/libc/iconv/ccs/win_1250.c newlib/libc/iconv/ccs/win_1251.c newlib/libc/iconv/ccs/win_1252.c newlib/libc/iconv/ccs/win_1253.c newlib/libc/iconv/ccs/win_1254.c newlib/libc/iconv/ccs/win_1255.c newlib/libc/iconv/ccs/win_1256.c newlib/libc/iconv/ccs/win_1257.c newlib/libc/iconv/ccs/win_1258.c newlib/libc/iconv/ces/cesbi.c newlib/libc/iconv/ces/cesbi.h newlib/libc/iconv/ces/cesdeps.h newlib/libc/iconv/ces/euc.c newlib/libc/iconv/ces/mkdeps.pl newlib/libc/iconv/ces/table-pcs.c newlib/libc/iconv/ces/table.c newlib/libc/iconv/ces/ucs-2.c newlib/libc/iconv/ces/ucs-4.c newlib/libc/iconv/ces/us-ascii.c newlib/libc/iconv/encoding.aliases newlib/libc/iconv/lib/aliasesbi.c newlib/libc/iconv/lib/aliasesi.c newlib/libc/iconv/lib/conv.h newlib/libc/iconv/lib/encnames.h newlib/libc/iconv/lib/encoding.deps newlib/libc/iconv/lib/iconvnls.c newlib/libc/iconv/lib/iconvnls.h newlib/libc/iconv/lib/nullconv.c newlib/libc/iconv/lib/ucsconv.c newlib/libc/iconv/lib/ucsconv.h newlib/libc/include/getopt.h newlib/libc/include/inttypes.h newlib/libc/include/libgen.h newlib/libc/include/machine/_types.h newlib/libc/include/machine/endian.h newlib/libc/include/machine/param.h newlib/libc/include/stdint.h newlib/libc/include/sys/iconvnls.h newlib/libc/include/sys/string.h newlib/libc/machine/arm/access.c newlib/libc/machine/arm/machine/endian.h newlib/libc/machine/arm/machine/param.h newlib/libc/machine/arm/setjmp.S newlib/libc/machine/cris/Makefile.am newlib/libc/machine/cris/Makefile.in newlib/libc/machine/cris/aclocal.m4 newlib/libc/machine/cris/configure newlib/libc/machine/cris/configure.in newlib/libc/machine/cris/include/pthread.h newlib/libc/machine/cris/libcdtor.c newlib/libc/machine/cris/memcpy.c newlib/libc/machine/cris/memmove.c newlib/libc/machine/cris/memset.c newlib/libc/machine/cris/setjmp.c newlib/libc/machine/cris/sys/errno.h newlib/libc/machine/cris/sys/fcntl.h newlib/libc/machine/cris/sys/signal.h newlib/libc/machine/crx/Makefile.am newlib/libc/machine/crx/Makefile.in newlib/libc/machine/crx/aclocal.m4 newlib/libc/machine/crx/configure newlib/libc/machine/crx/configure.in newlib/libc/machine/crx/getenv.c newlib/libc/machine/crx/setjmp.S newlib/libc/machine/crx/sys/asm.h newlib/libc/machine/crx/sys/libh.h newlib/libc/machine/crx/sys/syscall.h newlib/libc/machine/h8300/h8sx_strcpy.S newlib/libc/machine/m32c/Makefile.am newlib/libc/machine/m32c/Makefile.in newlib/libc/machine/m32c/aclocal.m4 newlib/libc/machine/m32c/configure newlib/libc/machine/m32c/configure.in newlib/libc/machine/m32c/setjmp.S newlib/libc/machine/mt/Makefile.am newlib/libc/machine/mt/Makefile.in newlib/libc/machine/mt/aclocal.m4 newlib/libc/machine/mt/configure newlib/libc/machine/mt/configure.in newlib/libc/machine/mt/setjmp.S newlib/libc/machine/xscale/setjmp.S newlib/libc/machine/z8k/memcmp.S newlib/libc/machine/z8k/memcpy.S newlib/libc/machine/z8k/memmove.S newlib/libc/machine/z8k/memset.S newlib/libc/misc/init.c newlib/libc/stdio/asiprintf.c newlib/libc/stdio/dprintf.c newlib/libc/stdio/fiscanf.c newlib/libc/stdio/iscanf.c newlib/libc/stdio/sccl.c newlib/libc/stdio/siscanf.c newlib/libc/stdio/sniprintf.c newlib/libc/stdio/vasiprintf.c newlib/libc/stdio/vdprintf.c newlib/libc/stdio/viprintf.c newlib/libc/stdio/viscanf.c newlib/libc/stdio/vsiprintf.c newlib/libc/stdio/vsiscanf.c newlib/libc/stdio/vsniprintf.c newlib/libc/stdlib/__atexit.c newlib/libc/stdlib/__call_atexit.c newlib/libc/stdlib/cxa_atexit.c newlib/libc/stdlib/cxa_finalize.c newlib/libc/sys/arm/aeabi_atexit.c newlib/libc/sys/h8300hms/_exit.S newlib/libc/sys/linux/bits/initspin.h newlib/libc/sys/linux/bits/libc-lock.h newlib/libc/sys/linux/bits/pthreadtypes.h newlib/libc/sys/linux/bits/typesizes.h newlib/libc/sys/linux/dl/dl-local.h newlib/libc/sys/linux/getpwent.c newlib/libc/sys/linux/include/ltdl.h newlib/libc/sys/linux/sys/string.h newlib/libc/sys/rdos/Makefile.am newlib/libc/sys/rdos/Makefile.in newlib/libc/sys/rdos/aclocal.m4 newlib/libc/sys/rdos/chown.c newlib/libc/sys/rdos/close.c newlib/libc/sys/rdos/config.h newlib/libc/sys/rdos/configure newlib/libc/sys/rdos/configure.in newlib/libc/sys/rdos/crt0.S newlib/libc/sys/rdos/execve.c newlib/libc/sys/rdos/fork.c newlib/libc/sys/rdos/fstat.c newlib/libc/sys/rdos/getenv.c newlib/libc/sys/rdos/getpid.c newlib/libc/sys/rdos/gettod.c newlib/libc/sys/rdos/isatty.c newlib/libc/sys/rdos/kill.c newlib/libc/sys/rdos/link.c newlib/libc/sys/rdos/lseek.c newlib/libc/sys/rdos/open.c newlib/libc/sys/rdos/rdos.S newlib/libc/sys/rdos/rdos.h newlib/libc/sys/rdos/rdoshelp.c newlib/libc/sys/rdos/read.c newlib/libc/sys/rdos/readlink.c newlib/libc/sys/rdos/sbrk.c newlib/libc/sys/rdos/stat.c newlib/libc/sys/rdos/symlink.c newlib/libc/sys/rdos/times.c newlib/libc/sys/rdos/unlink.c newlib/libc/sys/rdos/user.def newlib/libc/sys/rdos/wait.c newlib/libc/sys/rdos/write.c newlib/libc/time/gettzinfo.c newlib/libc/time/tzvars.c newlib/libc/unix/basename.c newlib/libc/unix/dirname.c newlib/libm/common/s_infconst.c newlib/libm/common/s_isinf.c newlib/libm/common/s_isinfd.c newlib/libm/common/s_isnan.c newlib/libm/common/s_isnand.c newlib/libm/common/sf_isinf.c newlib/libm/common/sf_isinff.c newlib/libm/common/sf_isnan.c newlib/libm/common/sf_isnanf.c newlib/testsuite/newlib.string/memmove1.c
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r--newlib/libc/stdio/Makefile.am37
-rw-r--r--newlib/libc/stdio/Makefile.in103
-rw-r--r--newlib/libc/stdio/asiprintf.c100
-rw-r--r--newlib/libc/stdio/asprintf.c31
-rw-r--r--newlib/libc/stdio/clearerr.c14
-rw-r--r--newlib/libc/stdio/dprintf.c129
-rw-r--r--newlib/libc/stdio/fclose.c90
-rw-r--r--newlib/libc/stdio/fcloseall.c53
-rw-r--r--newlib/libc/stdio/fdopen.c54
-rw-r--r--newlib/libc/stdio/feof.c29
-rw-r--r--newlib/libc/stdio/ferror.c11
-rw-r--r--newlib/libc/stdio/fflush.c27
-rw-r--r--newlib/libc/stdio/fgetc.c28
-rw-r--r--newlib/libc/stdio/fgetpos.c36
-rw-r--r--newlib/libc/stdio/fgets.c36
-rw-r--r--newlib/libc/stdio/fileno.c28
-rw-r--r--newlib/libc/stdio/findfp.c148
-rw-r--r--newlib/libc/stdio/fiprintf.c62
-rw-r--r--newlib/libc/stdio/fiscanf.c78
-rw-r--r--newlib/libc/stdio/flags.c13
-rw-r--r--newlib/libc/stdio/fopen.c36
-rw-r--r--newlib/libc/stdio/fprintf.c11
-rw-r--r--newlib/libc/stdio/fputc.c30
-rw-r--r--newlib/libc/stdio/fputs.c15
-rw-r--r--newlib/libc/stdio/fread.c129
-rw-r--r--newlib/libc/stdio/freopen.c114
-rw-r--r--newlib/libc/stdio/fscanf.c25
-rw-r--r--newlib/libc/stdio/fseek.c54
-rw-r--r--newlib/libc/stdio/fseeko.c20
-rw-r--r--newlib/libc/stdio/fsetpos.c33
-rw-r--r--newlib/libc/stdio/ftell.c27
-rw-r--r--newlib/libc/stdio/ftello.c12
-rw-r--r--newlib/libc/stdio/fvwrite.c25
-rw-r--r--newlib/libc/stdio/fwalk.c94
-rw-r--r--newlib/libc/stdio/fwrite.c19
-rw-r--r--newlib/libc/stdio/getc.c12
-rw-r--r--newlib/libc/stdio/getc_u.c5
-rw-r--r--newlib/libc/stdio/getchar.c14
-rw-r--r--newlib/libc/stdio/getchar_u.c9
-rw-r--r--newlib/libc/stdio/getdelim.c26
-rw-r--r--newlib/libc/stdio/getline.c14
-rw-r--r--newlib/libc/stdio/gets.c21
-rw-r--r--newlib/libc/stdio/getw.c14
-rw-r--r--newlib/libc/stdio/iprintf.c80
-rw-r--r--newlib/libc/stdio/iscanf.c78
-rw-r--r--newlib/libc/stdio/local.h42
-rw-r--r--newlib/libc/stdio/makebuf.c11
-rw-r--r--newlib/libc/stdio/mktemp.c48
-rw-r--r--newlib/libc/stdio/perror.c42
-rw-r--r--newlib/libc/stdio/printf.c43
-rw-r--r--newlib/libc/stdio/putc.c14
-rw-r--r--newlib/libc/stdio/putc_u.c10
-rw-r--r--newlib/libc/stdio/putchar.c19
-rw-r--r--newlib/libc/stdio/putchar_u.c14
-rw-r--r--newlib/libc/stdio/puts.c22
-rw-r--r--newlib/libc/stdio/putw.c16
-rw-r--r--newlib/libc/stdio/refill.c26
-rw-r--r--newlib/libc/stdio/remove.c34
-rw-r--r--newlib/libc/stdio/rename.c38
-rw-r--r--newlib/libc/stdio/rewind.c22
-rw-r--r--newlib/libc/stdio/rget.c8
-rw-r--r--newlib/libc/stdio/scanf.c27
-rw-r--r--newlib/libc/stdio/sccl.c127
-rw-r--r--newlib/libc/stdio/setbuf.c10
-rw-r--r--newlib/libc/stdio/setbuffer.c49
-rw-r--r--newlib/libc/stdio/setlinebuf.c6
-rw-r--r--newlib/libc/stdio/setvbuf.c24
-rw-r--r--newlib/libc/stdio/siprintf.c132
-rw-r--r--newlib/libc/stdio/siscanf.c195
-rw-r--r--newlib/libc/stdio/sniprintf.c103
-rw-r--r--newlib/libc/stdio/snprintf.c44
-rw-r--r--newlib/libc/stdio/sprintf.c35
-rw-r--r--newlib/libc/stdio/sscanf.c57
-rw-r--r--newlib/libc/stdio/stdio.c46
-rw-r--r--newlib/libc/stdio/stdio.tex72
-rw-r--r--newlib/libc/stdio/tmpfile.c12
-rw-r--r--newlib/libc/stdio/tmpnam.c48
-rw-r--r--newlib/libc/stdio/ungetc.c51
-rw-r--r--newlib/libc/stdio/vasiprintf.c75
-rw-r--r--newlib/libc/stdio/vasprintf.c23
-rw-r--r--newlib/libc/stdio/vdprintf.c46
-rw-r--r--newlib/libc/stdio/vfieeefp.h5
-rw-r--r--newlib/libc/stdio/vfprintf.c568
-rw-r--r--newlib/libc/stdio/vfscanf.c374
-rw-r--r--newlib/libc/stdio/viprintf.c163
-rw-r--r--newlib/libc/stdio/viscanf.c139
-rw-r--r--newlib/libc/stdio/vprintf.c24
-rw-r--r--newlib/libc/stdio/vscanf.c26
-rw-r--r--newlib/libc/stdio/vsiprintf.c73
-rw-r--r--newlib/libc/stdio/vsiscanf.c74
-rw-r--r--newlib/libc/stdio/vsniprintf.c115
-rw-r--r--newlib/libc/stdio/vsnprintf.c29
-rw-r--r--newlib/libc/stdio/vsprintf.c21
-rw-r--r--newlib/libc/stdio/vsscanf.c35
-rw-r--r--newlib/libc/stdio/wbuf.c12
-rw-r--r--newlib/libc/stdio/wsetup.c13
96 files changed, 1510 insertions, 3776 deletions
diff --git a/newlib/libc/stdio/Makefile.am b/newlib/libc/stdio/Makefile.am
index 1ae643f4d..37911efb9 100644
--- a/newlib/libc/stdio/Makefile.am
+++ b/newlib/libc/stdio/Makefile.am
@@ -6,7 +6,6 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
GENERAL_SOURCES = \
clearerr.c \
- dprintf.c \
fclose.c \
fdopen.c \
feof.c \
@@ -26,7 +25,6 @@ GENERAL_SOURCES = \
fread.c \
freopen.c \
fscanf.c \
- fiscanf.c \
fseek.c \
fsetpos.c \
ftell.c \
@@ -41,7 +39,6 @@ GENERAL_SOURCES = \
getline.c \
gets.c \
iprintf.c \
- iscanf.c \
makebuf.c \
perror.c \
printf.c \
@@ -56,14 +53,11 @@ GENERAL_SOURCES = \
rewind.c \
rget.c \
scanf.c \
- sccl.c \
setbuf.c \
setbuffer.c \
setlinebuf.c \
setvbuf.c \
siprintf.c \
- siscanf.c \
- sniprintf.c \
snprintf.c \
sprintf.c \
sscanf.c \
@@ -71,15 +65,10 @@ GENERAL_SOURCES = \
tmpfile.c \
tmpnam.c \
ungetc.c \
- vdprintf.c \
- viprintf.c \
- viscanf.c \
+ vfscanf.c \
vprintf.c \
vscanf.c \
- vsiprintf.c \
- vsiscanf.c \
vsnprintf.c \
- vsniprintf.c \
vsprintf.c \
vsscanf.c \
wbuf.c \
@@ -90,7 +79,6 @@ if ELIX_LEVEL_1
LIB_OBJS =
else
LIB_OBJS = \
- asiprintf.$(oext) \
asprintf.$(oext) \
fcloseall.$(oext) \
fseeko.$(oext) \
@@ -98,11 +86,10 @@ LIB_OBJS = \
getw.$(oext) \
mktemp.$(oext) \
putw.$(oext) \
- vasiprintf.$(oext) \
vasprintf.$(oext)
endif
-LIBADD_OBJS = vfiprintf.$(oext) vfprintf.$(oext) vfscanf.$(oext) vfiscanf.$(oext)
+LIBADD_OBJS = vfiprintf.$(oext) vfprintf.$(oext)
libstdio_la_LDFLAGS = -Xcompiler -nostdlib
@@ -133,15 +120,8 @@ vfprintf.$(oext): vfprintf.c
vfiprintf.$(oext): vfprintf.c
$(LIB_COMPILE) -fshort-enums -DINTEGER_ONLY -c $(srcdir)/vfprintf.c -o $@
-vfscanf.$(oext): vfscanf.c
- $(LIB_COMPILE) -c $(srcdir)/vfscanf.c
-
-vfiscanf.$(oext): vfscanf.c
- $(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfscanf.c -o $@
-
CHEWOUT_FILES = \
clearerr.def \
- dprintf.def \
fclose.def \
fcloseall.def \
fdopen.def \
@@ -170,6 +150,7 @@ CHEWOUT_FILES = \
getline.def \
gets.def \
getw.def \
+ iprintf.def \
mktemp.def \
perror.def \
putc.def \
@@ -186,15 +167,12 @@ CHEWOUT_FILES = \
setlinebuf.def \
setvbuf.def \
siprintf.def \
- siscanf.def \
sprintf.def \
sscanf.def \
tmpfile.def \
tmpnam.def \
vfprintf.def \
- vfscanf.def \
- viprintf.def \
- viscanf.def
+ vfscanf.def
SUFFIXES = .def
@@ -224,7 +202,6 @@ ftell.$(oext): local.h
fvwrite.$(oext): local.h fvwrite.h
fwalk.$(oext): local.h
fwrite.$(oext): local.h fvwrite.h
-iscanf.$(oext): local.h
makebuf.$(oext): local.h
puts.$(oext): fvwrite.h
refill.$(oext): local.h
@@ -232,20 +209,14 @@ scanf.$(oext): local.h
setbuf.$(oext): local.h
setvbuf.$(oext): local.h
siprintf.$(oext): local.h
-sniprintf.$(oext): local.h
sprintf.$(oext): local.h
-siscanf.$(oext): local.h
sscanf.$(oext): local.h
stdio.$(oext): local.h
ungetc.$(oext): local.h
vfiprintf.$(oext): local.h
vfprintf.$(oext): local.h
-vfiscanf.$(oext): local.h floatio.h
vfscanf.$(oext): local.h floatio.h
-viscanf.$(oext): local.h
vscanf.$(oext): local.h
-vsniprintf.$(oext): local.h
-vsiscanf.$(oext): local.h
vsscanf.$(oext): local.h
wbuf.$(oext): local.h fvwrite.h
wsetup.$(oext): local.h
diff --git a/newlib/libc/stdio/Makefile.in b/newlib/libc/stdio/Makefile.in
index 49827e332..c876b93a9 100644
--- a/newlib/libc/stdio/Makefile.in
+++ b/newlib/libc/stdio/Makefile.in
@@ -110,12 +110,12 @@ AUTOMAKE_OPTIONS = cygnus
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
-GENERAL_SOURCES = clearerr.c dprintf.c fclose.c fdopen.c feof.c ferror.c fflush.c fgetc.c fgetpos.c fgets.c fileno.c findfp.c fiprintf.c flags.c fopen.c fprintf.c fputc.c fputs.c fread.c freopen.c fscanf.c fiscanf.c fseek.c fsetpos.c ftell.c fvwrite.c fwalk.c fwrite.c getc.c getchar.c getc_u.c getchar_u.c getdelim.c getline.c gets.c iprintf.c iscanf.c makebuf.c perror.c printf.c putc.c putchar.c putc_u.c putchar_u.c puts.c refill.c remove.c rename.c rewind.c rget.c scanf.c sccl.c setbuf.c setbuffer.c setlinebuf.c setvbuf.c siprintf.c siscanf.c sniprintf.c snprintf.c sprintf.c sscanf.c stdio.c tmpfile.c tmpnam.c ungetc.c vdprintf.c viprintf.c viscanf.c vprintf.c vscanf.c vsiprintf.c vsiscanf.c vsnprintf.c vsniprintf.c vsprintf.c vsscanf.c wbuf.c wsetup.c
+GENERAL_SOURCES = clearerr.c fclose.c fdopen.c feof.c ferror.c fflush.c fgetc.c fgetpos.c fgets.c fileno.c findfp.c fiprintf.c flags.c fopen.c fprintf.c fputc.c fputs.c fread.c freopen.c fscanf.c fseek.c fsetpos.c ftell.c fvwrite.c fwalk.c fwrite.c getc.c getchar.c getc_u.c getchar_u.c getdelim.c getline.c gets.c iprintf.c makebuf.c perror.c printf.c putc.c putchar.c putc_u.c putchar_u.c puts.c refill.c remove.c rename.c rewind.c rget.c scanf.c setbuf.c setbuffer.c setlinebuf.c setvbuf.c siprintf.c snprintf.c sprintf.c sscanf.c stdio.c tmpfile.c tmpnam.c ungetc.c vfscanf.c vprintf.c vscanf.c vsnprintf.c vsprintf.c vsscanf.c wbuf.c wsetup.c
@ELIX_LEVEL_1_TRUE@LIB_OBJS =
-@ELIX_LEVEL_1_FALSE@LIB_OBJS = asiprintf.$(oext) asprintf.$(oext) fcloseall.$(oext) fseeko.$(oext) ftello.$(oext) getw.$(oext) mktemp.$(oext) putw.$(oext) vasiprintf.$(oext) vasprintf.$(oext)
+@ELIX_LEVEL_1_FALSE@LIB_OBJS = asprintf.$(oext) fcloseall.$(oext) fseeko.$(oext) ftello.$(oext) getw.$(oext) mktemp.$(oext) putw.$(oext) vasprintf.$(oext)
-LIBADD_OBJS = vfiprintf.$(oext) vfprintf.$(oext) vfscanf.$(oext) vfiscanf.$(oext)
+LIBADD_OBJS = vfiprintf.$(oext) vfprintf.$(oext)
libstdio_la_LDFLAGS = -Xcompiler -nostdlib
@@ -132,7 +132,7 @@ libstdio_la_LDFLAGS = -Xcompiler -nostdlib
@USE_LIBTOOL_FALSE@lib_a_LIBADD = $(LIBADD_OBJS) $(LIB_OBJS)
@USE_LIBTOOL_FALSE@lib_a_DEPENDENCIES = $(LIBADD_OBJS) $(LIB_OBJS)
-CHEWOUT_FILES = clearerr.def dprintf.def fclose.def fcloseall.def fdopen.def feof.def ferror.def fflush.def fgetc.def fgetpos.def fgets.def fileno.def fiprintf.def fopen.def fputc.def fputs.def fread.def freopen.def fseek.def fsetpos.def ftell.def fwrite.def getc.def getchar.def getc_u.def getchar_u.def getdelim.def getline.def gets.def getw.def mktemp.def perror.def putc.def putchar.def putc_u.def putchar_u.def puts.def putw.def remove.def rename.def rewind.def setbuf.def setbuffer.def setlinebuf.def setvbuf.def siprintf.def siscanf.def sprintf.def sscanf.def tmpfile.def tmpnam.def vfprintf.def vfscanf.def viprintf.def viscanf.def
+CHEWOUT_FILES = clearerr.def fclose.def fcloseall.def fdopen.def feof.def ferror.def fflush.def fgetc.def fgetpos.def fgets.def fileno.def fiprintf.def fopen.def fputc.def fputs.def fread.def freopen.def fseek.def fsetpos.def ftell.def fwrite.def getc.def getchar.def getc_u.def getchar_u.def getdelim.def getline.def gets.def getw.def iprintf.def mktemp.def perror.def putc.def putchar.def putc_u.def putchar_u.def puts.def putw.def remove.def rename.def rewind.def setbuf.def setbuffer.def setlinebuf.def setvbuf.def siprintf.def sprintf.def sscanf.def tmpfile.def tmpnam.def vfprintf.def vfscanf.def
SUFFIXES = .def
@@ -150,56 +150,48 @@ LIBRARIES = $(noinst_LIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LIBS = @LIBS@
-@USE_LIBTOOL_FALSE@lib_a_OBJECTS = clearerr.$(OBJEXT) dprintf.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@fclose.$(OBJEXT) fdopen.$(OBJEXT) feof.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@ferror.$(OBJEXT) fflush.$(OBJEXT) fgetc.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@fgetpos.$(OBJEXT) fgets.$(OBJEXT) fileno.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@findfp.$(OBJEXT) fiprintf.$(OBJEXT) flags.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@fopen.$(OBJEXT) fprintf.$(OBJEXT) fputc.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@fputs.$(OBJEXT) fread.$(OBJEXT) freopen.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@fscanf.$(OBJEXT) fiscanf.$(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@lib_a_OBJECTS = clearerr.$(OBJEXT) fclose.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@fdopen.$(OBJEXT) feof.$(OBJEXT) ferror.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@fflush.$(OBJEXT) fgetc.$(OBJEXT) fgetpos.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@fgets.$(OBJEXT) fileno.$(OBJEXT) findfp.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@fiprintf.$(OBJEXT) flags.$(OBJEXT) fopen.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@fprintf.$(OBJEXT) fputc.$(OBJEXT) fputs.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@fread.$(OBJEXT) freopen.$(OBJEXT) fscanf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@fseek.$(OBJEXT) fsetpos.$(OBJEXT) ftell.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@fvwrite.$(OBJEXT) fwalk.$(OBJEXT) fwrite.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@getc.$(OBJEXT) getchar.$(OBJEXT) getc_u.$(OBJEXT) \
@USE_LIBTOOL_FALSE@getchar_u.$(OBJEXT) getdelim.$(OBJEXT) \
@USE_LIBTOOL_FALSE@getline.$(OBJEXT) gets.$(OBJEXT) iprintf.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@iscanf.$(OBJEXT) makebuf.$(OBJEXT) perror.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@printf.$(OBJEXT) putc.$(OBJEXT) putchar.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@putc_u.$(OBJEXT) putchar_u.$(OBJEXT) puts.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@refill.$(OBJEXT) remove.$(OBJEXT) rename.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@rewind.$(OBJEXT) rget.$(OBJEXT) scanf.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sccl.$(OBJEXT) setbuf.$(OBJEXT) setbuffer.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@setlinebuf.$(OBJEXT) setvbuf.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@siprintf.$(OBJEXT) siscanf.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sniprintf.$(OBJEXT) snprintf.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@sprintf.$(OBJEXT) sscanf.$(OBJEXT) stdio.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@tmpfile.$(OBJEXT) tmpnam.$(OBJEXT) ungetc.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@vdprintf.$(OBJEXT) viprintf.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@viscanf.$(OBJEXT) vprintf.$(OBJEXT) vscanf.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@vsiprintf.$(OBJEXT) vsiscanf.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@vsnprintf.$(OBJEXT) vsniprintf.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@vsprintf.$(OBJEXT) vsscanf.$(OBJEXT) wbuf.$(OBJEXT) \
-@USE_LIBTOOL_FALSE@wsetup.$(OBJEXT)
+@USE_LIBTOOL_FALSE@makebuf.$(OBJEXT) perror.$(OBJEXT) printf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@putc.$(OBJEXT) putchar.$(OBJEXT) putc_u.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@putchar_u.$(OBJEXT) puts.$(OBJEXT) refill.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@remove.$(OBJEXT) rename.$(OBJEXT) rewind.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@rget.$(OBJEXT) scanf.$(OBJEXT) setbuf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@setbuffer.$(OBJEXT) setlinebuf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@setvbuf.$(OBJEXT) siprintf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@snprintf.$(OBJEXT) sprintf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@sscanf.$(OBJEXT) stdio.$(OBJEXT) tmpfile.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@tmpnam.$(OBJEXT) ungetc.$(OBJEXT) vfscanf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@vprintf.$(OBJEXT) vscanf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@vsnprintf.$(OBJEXT) vsprintf.$(OBJEXT) \
+@USE_LIBTOOL_FALSE@vsscanf.$(OBJEXT) wbuf.$(OBJEXT) wsetup.$(OBJEXT)
LTLIBRARIES = $(noinst_LTLIBRARIES)
-@USE_LIBTOOL_TRUE@libstdio_la_OBJECTS = clearerr.lo dprintf.lo \
-@USE_LIBTOOL_TRUE@fclose.lo fdopen.lo feof.lo ferror.lo fflush.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@fputs.lo fread.lo freopen.lo fscanf.lo fiscanf.lo \
-@USE_LIBTOOL_TRUE@fseek.lo fsetpos.lo ftell.lo fvwrite.lo fwalk.lo \
-@USE_LIBTOOL_TRUE@fwrite.lo getc.lo getchar.lo getc_u.lo getchar_u.lo \
-@USE_LIBTOOL_TRUE@getdelim.lo getline.lo gets.lo iprintf.lo iscanf.lo \
-@USE_LIBTOOL_TRUE@makebuf.lo perror.lo printf.lo putc.lo putchar.lo \
-@USE_LIBTOOL_TRUE@putc_u.lo putchar_u.lo puts.lo refill.lo remove.lo \
-@USE_LIBTOOL_TRUE@rename.lo rewind.lo rget.lo scanf.lo sccl.lo \
+@USE_LIBTOOL_TRUE@libstdio_la_OBJECTS = clearerr.lo fclose.lo fdopen.lo \
+@USE_LIBTOOL_TRUE@feof.lo ferror.lo fflush.lo fgetc.lo fgetpos.lo \
+@USE_LIBTOOL_TRUE@fgets.lo fileno.lo findfp.lo fiprintf.lo flags.lo \
+@USE_LIBTOOL_TRUE@fopen.lo fprintf.lo fputc.lo fputs.lo fread.lo \
+@USE_LIBTOOL_TRUE@freopen.lo fscanf.lo fseek.lo fsetpos.lo ftell.lo \
+@USE_LIBTOOL_TRUE@fvwrite.lo fwalk.lo fwrite.lo getc.lo getchar.lo \
+@USE_LIBTOOL_TRUE@getc_u.lo getchar_u.lo getdelim.lo getline.lo gets.lo \
+@USE_LIBTOOL_TRUE@iprintf.lo makebuf.lo perror.lo printf.lo putc.lo \
+@USE_LIBTOOL_TRUE@putchar.lo putc_u.lo putchar_u.lo puts.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 siscanf.lo sniprintf.lo snprintf.lo \
-@USE_LIBTOOL_TRUE@sprintf.lo sscanf.lo stdio.lo tmpfile.lo tmpnam.lo \
-@USE_LIBTOOL_TRUE@ungetc.lo vdprintf.lo viprintf.lo viscanf.lo \
-@USE_LIBTOOL_TRUE@vprintf.lo vscanf.lo vsiprintf.lo vsiscanf.lo \
-@USE_LIBTOOL_TRUE@vsnprintf.lo vsniprintf.lo vsprintf.lo vsscanf.lo \
-@USE_LIBTOOL_TRUE@wbuf.lo wsetup.lo
+@USE_LIBTOOL_TRUE@siprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \
+@USE_LIBTOOL_TRUE@tmpfile.lo tmpnam.lo ungetc.lo vfscanf.lo vprintf.lo \
+@USE_LIBTOOL_TRUE@vscanf.lo vsnprintf.lo vsprintf.lo vsscanf.lo wbuf.lo \
+@USE_LIBTOOL_TRUE@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)
@@ -440,12 +432,6 @@ vfprintf.$(oext): vfprintf.c
vfiprintf.$(oext): vfprintf.c
$(LIB_COMPILE) -fshort-enums -DINTEGER_ONLY -c $(srcdir)/vfprintf.c -o $@
-vfscanf.$(oext): vfscanf.c
- $(LIB_COMPILE) -c $(srcdir)/vfscanf.c
-
-vfiscanf.$(oext): vfscanf.c
- $(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfscanf.c -o $@
-
.c.def:
$(CHEW) < $< > $*.def 2> $*.ref
touch stmp-def
@@ -466,7 +452,6 @@ ftell.$(oext): local.h
fvwrite.$(oext): local.h fvwrite.h
fwalk.$(oext): local.h
fwrite.$(oext): local.h fvwrite.h
-iscanf.$(oext): local.h
makebuf.$(oext): local.h
puts.$(oext): fvwrite.h
refill.$(oext): local.h
@@ -474,20 +459,14 @@ scanf.$(oext): local.h
setbuf.$(oext): local.h
setvbuf.$(oext): local.h
siprintf.$(oext): local.h
-sniprintf.$(oext): local.h
sprintf.$(oext): local.h
-siscanf.$(oext): local.h
sscanf.$(oext): local.h
stdio.$(oext): local.h
ungetc.$(oext): local.h
vfiprintf.$(oext): local.h
vfprintf.$(oext): local.h
-vfiscanf.$(oext): local.h floatio.h
vfscanf.$(oext): local.h floatio.h
-viscanf.$(oext): local.h
vscanf.$(oext): local.h
-vsniprintf.$(oext): local.h
-vsiscanf.$(oext): local.h
vsscanf.$(oext): local.h
wbuf.$(oext): local.h fvwrite.h
wsetup.$(oext): local.h
diff --git a/newlib/libc/stdio/asiprintf.c b/newlib/libc/stdio/asiprintf.c
deleted file mode 100644
index e8e10bf38..000000000
--- a/newlib/libc/stdio/asiprintf.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.
- */
-/* This code was copied from asprintf.c */
-
-#include <_ansi.h>
-#include <reent.h>
-#include <stdio.h>
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include <limits.h>
-#include "local.h"
-
-int
-#ifdef _HAVE_STDC
-_DEFUN(_asiprintf_r, (ptr, strp, fmt),
- struct _reent *ptr _AND
- char **strp _AND
- _CONST char *fmt _DOTS)
-#else
-_asiprintf_r(ptr, strp, fmt, va_alist)
- struct _reent *ptr;
- char **strp;
- _CONST char *fmt;
- va_dcl
-#endif
-{
- int ret;
- va_list ap;
- FILE f;
-
- /* mark a zero-length reallocatable buffer */
- f._flags = __SWR | __SSTR | __SMBF;
- f._bf._base = f._p = NULL;
- f._bf._size = f._w = 0;
- f._file = -1; /* No file. */
-#ifdef _HAVE_STDC
- va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = vfiprintf (&f, fmt, ap);
- va_end (ap);
- *f._p = 0;
- *strp = f._bf._base;
- return (ret);
-}
-
-#ifndef _REENT_ONLY
-
-int
-#ifdef _HAVE_STDC
-_DEFUN(asiprintf, (strp, fmt),
- char **strp _AND
- _CONST char *fmt _DOTS)
-#else
-asiprintf(strp, fmt, va_alist)
- char **strp;
- _CONST char *fmt;
- va_dcl
-#endif
-{
- int ret;
- va_list ap;
- FILE f;
-
- /* mark a zero-length reallocatable buffer */
- f._flags = __SWR | __SSTR | __SMBF;
- f._bf._base = f._p = NULL;
- f._bf._size = f._w = 0;
- f._file = -1; /* No file. */
-#ifdef _HAVE_STDC
- va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = vfiprintf (&f, fmt, ap);
- va_end (ap);
- *f._p = 0;
- *strp = f._bf._base;
- return (ret);
-}
-
-#endif
diff --git a/newlib/libc/stdio/asprintf.c b/newlib/libc/stdio/asprintf.c
index 928e8497a..1d7dd4bae 100644
--- a/newlib/libc/stdio/asprintf.c
+++ b/newlib/libc/stdio/asprintf.c
@@ -14,10 +14,9 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
+
/* This code was copied from sprintf.c */
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#ifdef _HAVE_STDC
#include <stdarg.h>
@@ -25,20 +24,18 @@
#include <varargs.h>
#endif
#include <limits.h>
+#include <_ansi.h>
#include "local.h"
int
#ifdef _HAVE_STDC
-_DEFUN(_asprintf_r, (ptr, strp, fmt),
- struct _reent *ptr _AND
- char **strp _AND
- _CONST char *fmt _DOTS)
+_DEFUN (_asprintf_r, (ptr, strp, fmt), struct _reent *ptr _AND char **strp _AND _CONST char *fmt _DOTS)
#else
-_asprintf_r(ptr, strp, fmt, va_alist)
- struct _reent *ptr;
- char **strp;
- _CONST char *fmt;
- va_dcl
+_asprintf_r (ptr, strp, fmt, va_alist)
+ struct _reent *ptr;
+ char **strp;
+ _CONST char *fmt;
+ va_dcl
#endif
{
int ret;
@@ -66,14 +63,12 @@ _asprintf_r(ptr, strp, fmt, va_alist)
int
#ifdef _HAVE_STDC
-_DEFUN(asprintf, (strp, fmt),
- char **strp _AND
- _CONST char *fmt _DOTS)
+_DEFUN (asprintf, (strp, fmt), char **strp _AND _CONST char *fmt _DOTS)
#else
-asprintf(strp, fmt, va_alist)
- char **strp;
- _CONST char *fmt;
- va_dcl
+asprintf (strp, fmt, va_alist)
+ char **strp;
+ _CONST char *fmt;
+ va_dcl
#endif
{
int ret;
diff --git a/newlib/libc/stdio/clearerr.c b/newlib/libc/stdio/clearerr.c
index 0923ff84d..6a1b0af3c 100644
--- a/newlib/libc/stdio/clearerr.c
+++ b/newlib/libc/stdio/clearerr.c
@@ -52,20 +52,14 @@ ANSI C requires <<clearerr>>.
No supporting OS subroutines are required.
*/
-#include <_ansi.h>
#include <stdio.h>
-#include "local.h"
-
-/* A subroutine version of the macro clearerr. */
-
#undef clearerr
_VOID
-_DEFUN(clearerr, (fp),
- FILE * fp)
+_DEFUN (clearerr, (fp),
+ FILE * fp)
{
- CHECK_INIT(_REENT);
- _flockfile (fp);
+ _flockfile(fp);
__sclearerr (fp);
- _funlockfile (fp);
+ _funlockfile(fp);
}
diff --git a/newlib/libc/stdio/dprintf.c b/newlib/libc/stdio/dprintf.c
deleted file mode 100644
index 6ebf12e8d..000000000
--- a/newlib/libc/stdio/dprintf.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Copyright 2005 Shaun Jackman
- * Permission to use, copy, modify, and distribute this software
- * is freely granted, provided that this notice is preserved.
- */
-
-/*
-FUNCTION
-<<dprintf>>, <<vdprintf>>---print to a file descriptor
-
-INDEX
- dprintf
-INDEX
- vdprintf
-
-ANSI_SYNOPSIS
- #include <stdio.h>
- #include <stdarg.h>
- int dprintf(int <[fd]>, const char *<[format]>, ...);
- int vdprintf(int <[fd]>, const char *<[format]>, va_list <[ap]>);
- int _dprintf_r(struct _reent *<[ptr]>, int <[fd]>,
- const char *<[format]>, ...);
- int _vdprintf_r(struct _reent *<[ptr]>, int <[fd]>,
- const char *<[format]>, va_list <[ap]>);
-
-TRAD_SYNOPSIS
- #include <stdio.h>
- #include <varargs.h>
-
- int dprintf(<[fd]>, <[format]> [, <[arg]>, ...])
- int <[fd]>;
- char *<[format]>;
-
- int vdprintf(<[fd]>, <[fmt]>, <[list]>)
- int <[fd]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _dprintf_r(<[ptr]>, <[fd]>, <[format]> [, <[arg]>, ...])
- struct _reent *<[ptr]>;
- int <[fd]>;
- char *<[format]>;
-
- int _vdprintf_r(<[ptr]>, <[fd]>, <[fmt]>, <[list]>)
- struct _reent *<[ptr]>;
- int <[fd]>;
- char *<[fmt]>;
- va_list <[list]>;
-
-DESCRIPTION
-<<dprintf>> and <<vdprintf>> allow printing a format, similarly to
-<<printf>>, but write to a file descriptor instead of to a <<FILE>>
-stream.
-
-The functions <<_dprintf_r>> and <<_vdprintf_r>> are simply
-reentrant versions of the functions above.
-
-RETURNS
-The return value and errors are exactly as for <<write>>, except that
-<<errno>> may also be set to <<ENOMEM>> if the heap is exhausted.
-
-PORTABILITY
-This function is originally a GNU extension in glibc and is not portable.
-
-Supporting OS subroutines required: <<sbrk>>, <<write>>.
-*/
-
-#include <_ansi.h>
-#include <reent.h>
-#include <stdio.h>
-#include <unistd.h>
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#ifdef _HAVE_STDC
-int
-_dprintf_r(struct _reent *ptr, int fd, _CONST char *format, ...)
-#else
-int
-_dprintf_r(ptr, fd, format, va_alist)
- struct _reent *ptr;
- int fd;
- char *format;
- va_dcl
-#endif
-{
- va_list ap;
- int n;
- _REENT_SMALL_CHECK_INIT (ptr);
-#ifdef _HAVE_STDC
- va_start (ap, format);
-#else
- va_start (ap);
-#endif
- n = _vdprintf_r (ptr, fd, format, ap);
- va_end (ap);
- return n;
-}
-
-#ifndef _REENT_ONLY
-
-#ifdef _HAVE_STDC
-int
-dprintf(int fd, _CONST char *format, ...)
-#else
-int
-dprintf(fd, format, va_alist)
- struct _reent *ptr;
- int fd;
- char *format;
- va_dcl
-#endif
-{
- va_list ap;
- int n;
- _REENT_SMALL_CHECK_INIT (_REENT);
-#ifdef _HAVE_STDC
- va_start (ap, format);
-#else
- va_start (ap);
-#endif
- n = _vdprintf_r (_REENT, fd, format, ap);
- va_end (ap);
- return n;
-}
-
-#endif /* ! _REENT_ONLY */
diff --git a/newlib/libc/stdio/fclose.c b/newlib/libc/stdio/fclose.c
index 66d71c2d4..1caeb4cde 100644
--- a/newlib/libc/stdio/fclose.c
+++ b/newlib/libc/stdio/fclose.c
@@ -1,51 +1,24 @@
/*
- * 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
<<fclose>>---close a file
INDEX
fclose
-INDEX
- _fclose_r
ANSI_SYNOPSIS
#include <stdio.h>
int fclose(FILE *<[fp]>);
- int _fclose_r(struct _reent *<[reent]>, FILE *<[fp]>);
TRAD_SYNOPSIS
#include <stdio.h>
int fclose(<[fp]>)
FILE *<[fp]>;
-
- int fclose(<[fp]>)
- struct _reent *<[reent]>
- FILE *<[fp]>;
DESCRIPTION
If the file or stream identified by <[fp]> is open, <<fclose>> closes
it, after first ensuring that any pending data is written (by calling
<<fflush(<[fp]>)>>).
-The alternate function <<_fclose_r>> is a reentrant version.
-The extra argument <[reent]> is a pointer to a reentrancy structure.
-
RETURNS
<<fclose>> returns <<0>> if successful (including when <[fp]> is
<<NULL>> or not an open file); otherwise, it returns <<EOF>>.
@@ -57,63 +30,64 @@ Required OS subroutines: <<close>>, <<fstat>>, <<isatty>>, <<lseek>>,
<<read>>, <<sbrk>>, <<write>>.
*/
-#include <_ansi.h>
-#include <reent.h>
+/*
+ * 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.
+ */
+
#include <stdio.h>
#include <stdlib.h>
-#include <sys/lock.h>
#include "local.h"
+#include <sys/lock.h>
+
+/*
+ * Close a file.
+ */
int
-_DEFUN(_fclose_r, (rptr, fp),
- struct _reent *rptr _AND
- register FILE * fp)
+_DEFUN (fclose, (fp),
+ register FILE * fp)
{
int r;
if (fp == NULL)
return (0); /* on NULL */
- __sfp_lock_acquire ();
-
- CHECK_INIT (rptr);
-
- _flockfile (fp);
+ _flockfile(fp);
+ CHECK_INIT (fp);
+
if (fp->_flags == 0) /* not open! */
{
- _funlockfile (fp);
- __sfp_lock_release ();
+ _funlockfile(fp);
return (0);
}
r = fp->_flags & __SWR ? fflush (fp) : 0;
if (fp->_close != NULL && (*fp->_close) (fp->_cookie) < 0)
r = EOF;
if (fp->_flags & __SMBF)
- _free_r (rptr, (char *) fp->_bf._base);
+ _free_r (_REENT, (char *) fp->_bf._base);
if (HASUB (fp))
FREEUB (fp);
if (HASLB (fp))
FREELB (fp);
- fp->_flags = 0; /* release this FILE for reuse */
- _funlockfile (fp);
+ _funlockfile(fp);
#ifndef __SINGLE_THREAD__
- __lock_close_recursive (fp->_lock);
+ __lock_close_recursive (*(_LOCK_RECURSIVE_T *)&fp->_lock);
#endif
-
- __sfp_lock_release ();
+ fp->_flags = 0; /* release this FILE for reuse */
return (r);
}
-
-#ifndef _REENT_ONLY
-
-int
-_DEFUN(fclose, (fp),
- register FILE * fp)
-{
- return _fclose_r(_REENT, fp);
-}
-
-#endif
-
diff --git a/newlib/libc/stdio/fcloseall.c b/newlib/libc/stdio/fcloseall.c
index 090f3f2c3..d51c6fe34 100644
--- a/newlib/libc/stdio/fcloseall.c
+++ b/newlib/libc/stdio/fcloseall.c
@@ -1,21 +1,4 @@
/*
- * 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
<<fcloseall>>---close all files
@@ -54,26 +37,50 @@ PORTABILITY
Required OS subroutines: <<close>>, <<fstat>>, <<isatty>>, <<lseek>>,
<<read>>, <<sbrk>>, <<write>>.
*/
+
/* This file based upon fwalk.c. */
-#include <_ansi.h>
-#include <reent.h>
+/*
+ * 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.
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "local.h"
int
-_DEFUN(_fcloseall_r, (ptr),
- struct _reent *ptr)
+_fcloseall_r (ptr)
+ struct _reent *ptr;
{
- return _fwalk_reent (ptr, _fclose_r);
+ register FILE *fp;
+ register int n, ret = 0;
+ register struct _glue *g;
+
+ for (g = &ptr->__sglue; g != NULL; g = g->_next)
+ for (fp = g->_iobs, n = g->_niobs; --n >= 0; fp++)
+ if (fp->_flags != 0)
+ ret |= fclose (fp);
+ return ret;
}
#ifndef _REENT_ONLY
int
-_DEFUN_VOID(fcloseall)
+fcloseall (void)
{
return _fcloseall_r (_GLOBAL_REENT);
}
diff --git a/newlib/libc/stdio/fdopen.c b/newlib/libc/stdio/fdopen.c
index f4fc551c4..0db6062dd 100644
--- a/newlib/libc/stdio/fdopen.c
+++ b/newlib/libc/stdio/fdopen.c
@@ -1,21 +1,4 @@
/*
- * 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
<<fdopen>>---turn open file into a stream
@@ -27,9 +10,9 @@ INDEX
ANSI_SYNOPSIS
#include <stdio.h>
FILE *fdopen(int <[fd]>, const char *<[mode]>);
- FILE *_fdopen_r(struct _reent *<[reent]>,
- int <[fd]>, const char *<[mode]>);
-
+ FILE *_fdopen_r(void *<[reent]>,
+ int <[fd]>, const char *<[mode]>);
+
TRAD_SYNOPSIS
#include <stdio.h>
FILE *fdopen(<[fd]>, <[mode]>)
@@ -37,7 +20,7 @@ TRAD_SYNOPSIS
char *<[mode]>;
FILE *_fdopen_r(<[reent]>, <[fd]>, <[mode]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
int <[fd]>;
char *<[mode]>);
@@ -54,20 +37,21 @@ PORTABILITY
<<fdopen>> is ANSI.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <sys/types.h>
#include <sys/fcntl.h>
+
#include <stdio.h>
#include <errno.h>
#include "local.h"
#include <_syslist.h>
+extern int __sflags ();
+
FILE *
-_DEFUN(_fdopen_r, (ptr, fd, mode),
- struct _reent *ptr _AND
- int fd _AND
- _CONST char *mode)
+_DEFUN (_fdopen_r, (ptr, fd, mode),
+ struct _reent *ptr _AND
+ int fd _AND
+ _CONST char *mode)
{
register FILE *fp;
int flags, oflags;
@@ -92,9 +76,6 @@ _DEFUN(_fdopen_r, (ptr, fd, mode),
if ((fp = __sfp (ptr)) == 0)
return 0;
-
- _flockfile (fp);
-
fp->_flags = flags;
/*
* If opened for appending, but underlying descriptor
@@ -123,23 +104,22 @@ _DEFUN(_fdopen_r, (ptr, fd, mode),
#ifdef __SCLE
/* Explicit given mode results in explicit setting mode on fd */
if (oflags & O_BINARY)
- setmode (fp->_file, O_BINARY);
+ setmode(fp->_file, O_BINARY);
else if (oflags & O_TEXT)
- setmode (fp->_file, O_TEXT);
- if (__stextmode (fp->_file))
+ setmode(fp->_file, O_TEXT);
+ if (__stextmode(fp->_file))
fp->_flags |= __SCLE;
#endif
- _funlockfile (fp);
return fp;
}
#ifndef _REENT_ONLY
FILE *
-_DEFUN(fdopen, (fd, mode),
- int fd _AND
- _CONST char *mode)
+_DEFUN (fdopen, (fd, mode),
+ int fd _AND
+ _CONST char *mode)
{
return _fdopen_r (_REENT, fd, mode);
}
diff --git a/newlib/libc/stdio/feof.c b/newlib/libc/stdio/feof.c
index aff4e84c8..b7981bded 100644
--- a/newlib/libc/stdio/feof.c
+++ b/newlib/libc/stdio/feof.c
@@ -1,21 +1,4 @@
/*
- * 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
<<feof>>---test for end of file
@@ -46,20 +29,16 @@ No supporting OS subroutines are required.
*/
#include <stdio.h>
-#include "local.h"
-
-/* A subroutine version of the macro feof. */
#undef feof
int
-_DEFUN(feof, (fp),
- FILE * fp)
+_DEFUN (feof, (fp),
+ FILE * fp)
{
int result;
- CHECK_INIT(_REENT);
- _flockfile (fp);
+ _flockfile(fp);
result = __sfeof (fp);
- _funlockfile (fp);
+ _funlockfile(fp);
return result;
}
diff --git a/newlib/libc/stdio/ferror.c b/newlib/libc/stdio/ferror.c
index ea701bec7..ef17fd89d 100644
--- a/newlib/libc/stdio/ferror.c
+++ b/newlib/libc/stdio/ferror.c
@@ -53,22 +53,19 @@ No supporting OS subroutines are required.
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
#include <stdio.h>
-#include "local.h"
/* A subroutine version of the macro ferror. */
#undef ferror
int
-_DEFUN(ferror, (fp),
- FILE * fp)
+_DEFUN (ferror, (fp),
+ FILE * fp)
{
int result;
- CHECK_INIT(_REENT);
- _flockfile (fp);
+ _flockfile(fp);
result = __sferror (fp);
- _funlockfile (fp);
+ _funlockfile(fp);
return result;
}
diff --git a/newlib/libc/stdio/fflush.c b/newlib/libc/stdio/fflush.c
index 05084dde0..30ac9967f 100644
--- a/newlib/libc/stdio/fflush.c
+++ b/newlib/libc/stdio/fflush.c
@@ -51,15 +51,14 @@ ANSI C requires <<fflush>>.
No supporting OS subroutines are required.
*/
-#include <_ansi.h>
#include <stdio.h>
#include "local.h"
/* Flush a single file, or (if fp is NULL) all files. */
int
-_DEFUN(fflush, (fp),
- register FILE * fp)
+_DEFUN (fflush, (fp),
+ register FILE * fp)
{
register unsigned char *p;
register int n, t;
@@ -67,24 +66,14 @@ _DEFUN(fflush, (fp),
if (fp == NULL)
return _fwalk (_GLOBAL_REENT, fflush);
- CHECK_INIT (_REENT);
+ _flockfile(fp);
- _flockfile (fp);
+ CHECK_INIT (fp);
t = fp->_flags;
- if ((t & __SWR) == 0)
+ if ((t & __SWR) == 0 || (p = fp->_bf._base) == NULL)
{
- /* For a read stream, an fflush causes the next seek to be
- unoptimized (i.e. forces a system-level seek). This conforms
- to the POSIX and SUSv3 standards. */
- fp->_flags |= __SNPT;
- _funlockfile (fp);
- return 0;
- }
- if ((p = fp->_bf._base) == NULL)
- {
- /* Nothing to flush. */
- _funlockfile (fp);
+ _funlockfile(fp);
return 0;
}
n = fp->_p - p; /* write this much */
@@ -103,12 +92,12 @@ _DEFUN(fflush, (fp),
if (t <= 0)
{
fp->_flags |= __SERR;
- _funlockfile (fp);
+ _funlockfile(fp);
return EOF;
}
p += t;
n -= t;
}
- _funlockfile (fp);
+ _funlockfile(fp);
return 0;
}
diff --git a/newlib/libc/stdio/fgetc.c b/newlib/libc/stdio/fgetc.c
index 020b2da3a..1160b67a7 100644
--- a/newlib/libc/stdio/fgetc.c
+++ b/newlib/libc/stdio/fgetc.c
@@ -1,21 +1,4 @@
/*
- * 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
<<fgetc>>---get a character from a file or stream
@@ -53,18 +36,15 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
-#include <_ansi.h>
#include <stdio.h>
-#include "local.h"
int
-_DEFUN(fgetc, (fp),
- FILE * fp)
+_DEFUN (fgetc, (fp),
+ FILE * fp)
{
int result;
- CHECK_INIT(_REENT);
- _flockfile (fp);
+ _flockfile(fp);
result = __sgetc (fp);
- _funlockfile (fp);
+ _funlockfile(fp);
return result;
}
diff --git a/newlib/libc/stdio/fgetpos.c b/newlib/libc/stdio/fgetpos.c
index 21a63789d..26c69bf22 100644
--- a/newlib/libc/stdio/fgetpos.c
+++ b/newlib/libc/stdio/fgetpos.c
@@ -1,21 +1,4 @@
/*
- * 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
<<fgetpos>>---record position in a stream or file
@@ -71,31 +54,32 @@ conforming C implementations may return a different result from
No supporting OS subroutines are required.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
int
-_DEFUN(_fgetpos_r, (ptr, fp, pos),
- struct _reent * ptr _AND
- FILE * fp _AND
- _fpos_t * pos)
+_DEFUN (_fgetpos_r, (ptr, fp, pos),
+ struct _reent * ptr _AND
+ FILE * fp _AND
+ _fpos_t * pos)
{
+ _flockfile(fp);
*pos = _ftell_r (ptr, fp);
if (*pos != -1)
{
+ _funlockfile(fp);
return 0;
}
+ _funlockfile(fp);
return 1;
}
#ifndef _REENT_ONLY
int
-_DEFUN(fgetpos, (fp, pos),
- FILE * fp _AND
- _fpos_t * pos)
+_DEFUN (fgetpos, (fp, pos),
+ FILE * fp _AND
+ _fpos_t * pos)
{
return _fgetpos_r (_REENT, fp, pos);
}
diff --git a/newlib/libc/stdio/fgets.c b/newlib/libc/stdio/fgets.c
index f5dde4903..46e190077 100644
--- a/newlib/libc/stdio/fgets.c
+++ b/newlib/libc/stdio/fgets.c
@@ -16,9 +16,9 @@
*/
/*
-FUNCTION
-<<fgets>>---get character string from a file or stream
+FUNCTION
+ <<fgets>>---get character string from a file or stream
INDEX
fgets
@@ -54,10 +54,10 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
-#include <_ansi.h>
#include <stdio.h>
#include <string.h>
-#include "local.h"
+
+extern int __srefill ();
/*
* Read at most n-1 characters from the given file.
@@ -66,10 +66,10 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
*/
char *
-_DEFUN(fgets, (buf, n, fp),
- char *buf _AND
- int n _AND
- FILE * fp)
+_DEFUN (fgets, (buf, n, fp),
+ char *buf _AND
+ int n _AND
+ FILE * fp)
{
size_t len;
char *s;
@@ -80,15 +80,13 @@ _DEFUN(fgets, (buf, n, fp),
s = buf;
- CHECK_INIT(_REENT);
-
- _flockfile (fp);
+ _flockfile(fp);
#ifdef __SCLE
if (fp->_flags & __SCLE)
{
int c;
/* Sorry, have to do it the slow way */
- while (--n > 0 && (c = __sgetc (fp)) != EOF)
+ while (--n > 0 && (c = __sgetc(fp)) != EOF)
{
*s++ = c;
if (c == '\n')
@@ -96,11 +94,11 @@ _DEFUN(fgets, (buf, n, fp),
}
if (c == EOF && s == buf)
{
- _funlockfile (fp);
+ _funlockfile(fp);
return NULL;
}
*s = 0;
- _funlockfile (fp);
+ _funlockfile(fp);
return buf;
}
#endif
@@ -118,7 +116,7 @@ _DEFUN(fgets, (buf, n, fp),
/* EOF: stop with partial or no line */
if (s == buf)
{
- _funlockfile (fp);
+ _funlockfile(fp);
return 0;
}
break;
@@ -141,18 +139,18 @@ _DEFUN(fgets, (buf, n, fp),
len = ++t - p;
fp->_r -= len;
fp->_p = t;
- _CAST_VOID memcpy ((_PTR) s, (_PTR) p, len);
+ (void) memcpy ((_PTR) s, (_PTR) p, len);
s[len] = 0;
- _funlockfile (fp);
+ _funlockfile(fp);
return (buf);
}
fp->_r -= len;
fp->_p += len;
- _CAST_VOID memcpy ((_PTR) s, (_PTR) p, len);
+ (void) memcpy ((_PTR) s, (_PTR) p, len);
s += len;
}
while ((n -= len) != 0);
*s = 0;
- _funlockfile (fp);
+ _funlockfile(fp);
return buf;
}
diff --git a/newlib/libc/stdio/fileno.c b/newlib/libc/stdio/fileno.c
index b202cc5e3..c9ecbb424 100644
--- a/newlib/libc/stdio/fileno.c
+++ b/newlib/libc/stdio/fileno.c
@@ -1,21 +1,4 @@
/*
- * 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
<<fileno>>---return file descriptor associated with stream
@@ -45,18 +28,17 @@ POSIX requires <<fileno>>.
Supporting OS subroutines required: none.
*/
-#include <_ansi.h>
#include <stdio.h>
#include "local.h"
int
-_DEFUN(fileno, (f),
- FILE * f)
+_DEFUN (fileno, (f),
+ FILE * f)
{
int result;
- CHECK_INIT (_REENT);
- _flockfile (f);
+ _flockfile(f);
+ CHECK_INIT (f);
result = __sfileno (f);
- _funlockfile (f);
+ _funlockfile(f);
return result;
}
diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
index e3270af38..0ea7e31a2 100644
--- a/newlib/libc/stdio/findfp.c
+++ b/newlib/libc/stdio/findfp.c
@@ -1,3 +1,5 @@
+/* No user fns here. Pesch 15apr92. */
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -14,10 +16,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* No user fns here. Pesch 15apr92. */
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -26,12 +25,12 @@
#include <sys/lock.h>
#include "local.h"
-static _VOID
-_DEFUN(std, (ptr, flags, file, data),
- FILE *ptr _AND
- int flags _AND
- int file _AND
- struct _reent *data)
+static void
+std (ptr, flags, file, data)
+ FILE *ptr;
+ int flags;
+ int file;
+ struct _reent *data;
{
ptr->_p = 0;
ptr->_r = 0;
@@ -46,24 +45,20 @@ _DEFUN(std, (ptr, flags, file, data),
ptr->_write = __swrite;
ptr->_seek = __sseek;
ptr->_close = __sclose;
-#if !defined(__SINGLE_THREAD__) && !defined(_REENT_SMALL)
- __lock_init_recursive (ptr->_lock);
- /*
- * #else
- * lock is already initialized in __sfp
- */
+#ifndef __SINGLE_THREAD__
+ __lock_init_recursive (*(_LOCK_RECURSIVE_T *)&ptr->_lock);
#endif
#ifdef __SCLE
- if (__stextmode (ptr->_file))
+ if (__stextmode(ptr->_file))
ptr->_flags |= __SCLE;
#endif
}
struct _glue *
-_DEFUN(__sfmoreglue, (d, n),
- struct _reent *d _AND
- register int n)
+__sfmoreglue (d, n)
+ struct _reent *d;
+ register int n;
{
struct _glue *g;
FILE *p;
@@ -84,14 +79,18 @@ _DEFUN(__sfmoreglue, (d, n),
*/
FILE *
-_DEFUN(__sfp, (d),
- struct _reent *d)
+__sfp (d)
+ struct _reent *d;
{
FILE *fp;
int n;
struct _glue *g;
- __sfp_lock_acquire ();
+#ifndef __SINGLE_THREAD__
+ __LOCK_INIT(static, lock);
+
+ __lock_acquire(lock);
+#endif
if (!_GLOBAL_REENT->__sdidinit)
__sinit (_GLOBAL_REENT);
@@ -104,24 +103,24 @@ _DEFUN(__sfp, (d),
(g->_next = __sfmoreglue (d, NDYNAMIC)) == NULL)
break;
}
- __sfp_lock_release ();
+#ifndef __SINGLE_THREAD__
+ __lock_release(lock);
+#endif
d->_errno = ENOMEM;
return NULL;
found:
- fp->_file = -1; /* no file */
fp->_flags = 1; /* reserve this slot; caller sets real flags */
#ifndef __SINGLE_THREAD__
- __lock_init_recursive (fp->_lock);
+ __lock_release(lock);
#endif
- __sfp_lock_release ();
-
fp->_p = NULL; /* no current pointer */
fp->_w = 0; /* nothing to read or write */
fp->_r = 0;
fp->_bf._base = NULL; /* no buffer */
fp->_bf._size = 0;
fp->_lbfsize = 0; /* not line buffered */
+ fp->_file = -1; /* no file */
/* fp->_cookie = <any>; */ /* caller sets cookie, _read/_write etc */
fp->_ub._base = NULL; /* no ungetc buffer */
fp->_ub._size = 0;
@@ -139,17 +138,17 @@ found:
* The name `_cleanup' is, alas, fairly well known outside stdio.
*/
-_VOID
-_DEFUN(_cleanup_r, (ptr),
- struct _reent *ptr)
+void
+_cleanup_r (ptr)
+ struct _reent *ptr;
{
- _CAST_VOID _fwalk(ptr, fclose);
- /* _CAST_VOID _fwalk (ptr, fflush); */ /* `cheating' */
+ /* (void) _fwalk(fclose); */
+ (void) _fwalk (ptr, fflush); /* `cheating' */
}
#ifndef _REENT_ONLY
-_VOID
-_DEFUN_VOID(_cleanup)
+void
+_cleanup ()
{
_cleanup_r (_GLOBAL_REENT);
}
@@ -159,18 +158,10 @@ _DEFUN_VOID(_cleanup)
* __sinit() is called whenever stdio's internal variables must be set up.
*/
-_VOID
-_DEFUN(__sinit, (s),
- struct _reent *s)
+void
+__sinit (s)
+ struct _reent *s;
{
- __sinit_lock_acquire ();
-
- if (s->__sdidinit)
- {
- __sinit_lock_release ();
- return;
- }
-
/* make sure we clean up on exit */
s->__cleanup = _cleanup_r; /* conservative */
s->__sdidinit = 1;
@@ -200,71 +191,4 @@ _DEFUN(__sinit, (s),
std (s->_stderr, __SWR | __SNBF, 2, s);
- __sinit_lock_release ();
-}
-
-#ifndef __SINGLE_THREAD__
-
-__LOCK_INIT_RECURSIVE(static, __sfp_lock);
-__LOCK_INIT_RECURSIVE(static, __sinit_lock);
-
-_VOID
-_DEFUN_VOID(__sfp_lock_acquire)
-{
- __lock_acquire_recursive (__sfp_lock);
-}
-
-_VOID
-_DEFUN_VOID(__sfp_lock_release)
-{
- __lock_release_recursive (__sfp_lock);
-}
-
-_VOID
-_DEFUN_VOID(__sinit_lock_acquire)
-{
- __lock_acquire_recursive (__sinit_lock);
-}
-
-_VOID
-_DEFUN_VOID(__sinit_lock_release)
-{
- __lock_release_recursive (__sinit_lock);
-}
-
-/* Walkable file locking routine. */
-static int
-_DEFUN(__fp_lock, (ptr),
- FILE * ptr)
-{
- _flockfile (ptr);
-
- return 0;
-}
-
-/* Walkable file unlocking routine. */
-static int
-_DEFUN(__fp_unlock, (ptr),
- FILE * ptr)
-{
- _funlockfile (ptr);
-
- return 0;
-}
-
-_VOID
-_DEFUN_VOID(__fp_lock_all)
-{
- __sfp_lock_acquire ();
-
- _CAST_VOID _fwalk (_REENT, __fp_lock);
-}
-
-_VOID
-_DEFUN_VOID(__fp_unlock_all)
-{
- _CAST_VOID _fwalk (_REENT, __fp_unlock);
-
- __sfp_lock_release ();
}
-#endif
diff --git a/newlib/libc/stdio/fiprintf.c b/newlib/libc/stdio/fiprintf.c
index 3529e7f19..77199c2c9 100644
--- a/newlib/libc/stdio/fiprintf.c
+++ b/newlib/libc/stdio/fiprintf.c
@@ -1,22 +1,44 @@
/*
- * 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
+ <<fiprintf>>---format output to file (integer only)
+INDEX
+ fiprintf
+
+ANSI_SYNOPSIS
+ #include <stdio.h>
+
+ int fiprintf(FILE *<[fd]>, const char *<[format]>, ...);
+
+TRAD_SYNOPSIS
+ #include <stdio.h>
+
+ int fiprintf(<[fd]>, <[format]> [, <[arg]>, ...]);
+ FILE *<[fd]>;
+ char *<[format]>;
+
+DESCRIPTION
+<<fiprintf>> is a restricted version of <<fprintf>>: it has the same
+arguments and behavior, save that it cannot perform any floating-point
+formatting---the <<f>>, <<g>>, <<G>>, <<e>>, and <<F>> type specifiers
+are not recognized.
+
+RETURNS
+ <<fiprintf>> returns the number of bytes in the output string,
+ save that the concluding <<NULL>> is not counted.
+ <<fiprintf>> returns when the end of the format string is
+ encountered. If an error occurs, <<fiprintf>>
+ returns <<EOF>>.
+
+PORTABILITY
+<<fiprintf>> is not required by ANSI C.
+
+Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
+<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
+*/
#include <_ansi.h>
#include <stdio.h>
+
#ifdef _HAVE_STDC
#include <stdarg.h>
#else
@@ -25,13 +47,13 @@
#ifdef _HAVE_STDC
int
-fiprintf(FILE * fp, _CONST char *fmt,...)
+fiprintf (FILE * fp, const char *fmt,...)
#else
int
-fiprintf(fp, fmt, va_alist)
- FILE *fp;
- char *fmt;
- va_dcl
+fiprintf (fp, fmt, va_alist)
+ FILE *fp;
+ char *fmt;
+ va_dcl
#endif
{
int ret;
diff --git a/newlib/libc/stdio/fiscanf.c b/newlib/libc/stdio/fiscanf.c
deleted file mode 100644
index 53fee8454..000000000
--- a/newlib/libc/stdio/fiscanf.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.
- */
-
-#include <_ansi.h>
-#include <reent.h>
-#include <stdio.h>
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include "local.h"
-
-#ifndef _REENT_ONLY
-
-int
-#ifdef _HAVE_STDC
-fiscanf(FILE *fp, _CONST char *fmt, ...)
-#else
-fiscanf(FILE *fp, fmt, va_alist)
- FILE *fp;
- char *fmt;
- va_dcl
-#endif
-{
- int ret;
- va_list ap;
-
-#ifdef _HAVE_STDC
- va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = __svfiscanf_r (_REENT, fp, fmt, ap);
- va_end (ap);
- return ret;
-}
-
-#endif /* !_REENT_ONLY */
-
-int
-#ifdef _HAVE_STDC
-_fiscanf_r(struct _reent *ptr, FILE *fp, _CONST char *fmt, ...)
-#else
-_fiscanf_r(ptr, FILE *fp, fmt, va_alist)
- struct _reent *ptr;
- FILE *fp;
- char *fmt;
- va_dcl
-#endif
-{
- int ret;
- va_list ap;
-
-#ifdef _HAVE_STDC
- va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = __svfiscanf_r (ptr, fp, fmt, ap);
- va_end (ap);
- return (ret);
-}
-
diff --git a/newlib/libc/stdio/flags.c b/newlib/libc/stdio/flags.c
index d7bf52b97..e448cca80 100644
--- a/newlib/libc/stdio/flags.c
+++ b/newlib/libc/stdio/flags.c
@@ -1,3 +1,5 @@
+/* No user fns here. Pesch 15apr92 */
+
/*
* Copyright (c) 1990 Regents of the University of California.
* All rights reserved.
@@ -14,12 +16,11 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* No user fns here. Pesch 15apr92 */
-#include <_ansi.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
+
#include <errno.h>
#include <sys/types.h>
@@ -30,10 +31,10 @@
*/
int
-_DEFUN(__sflags, (ptr, mode, optr),
- struct _reent *ptr _AND
- register char *mode _AND
- int *optr)
+__sflags (ptr, mode, optr)
+ struct _reent *ptr;
+ register char *mode;
+ int *optr;
{
register int ret, m, o;
diff --git a/newlib/libc/stdio/fopen.c b/newlib/libc/stdio/fopen.c
index 64c24e7ef..bcd2287c5 100644
--- a/newlib/libc/stdio/fopen.c
+++ b/newlib/libc/stdio/fopen.c
@@ -28,7 +28,7 @@ ANSI_SYNOPSIS
#include <stdio.h>
FILE *fopen(const char *<[file]>, const char *<[mode]>);
- FILE *_fopen_r(struct _reent *<[reent]>,
+ FILE *_fopen_r(void *<[reent]>,
const char *<[file]>, const char *<[mode]>);
TRAD_SYNOPSIS
@@ -38,7 +38,7 @@ TRAD_SYNOPSIS
char *<[mode]>;
FILE *_fopen_r(<[reent]>, <[file]>, <[mode]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[file]>;
char *<[mode]>;
@@ -113,21 +113,19 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#include <errno.h>
-#include <sys/lock.h>
+#include "local.h"
#ifdef __CYGWIN__
#include <fcntl.h>
#endif
-#include "local.h"
+#include <sys/lock.h>
FILE *
-_DEFUN(_fopen_r, (ptr, file, mode),
- struct _reent *ptr _AND
- _CONST char *file _AND
- _CONST char *mode)
+_DEFUN (_fopen_r, (ptr, file, mode),
+ struct _reent *ptr _AND
+ _CONST char *file _AND
+ _CONST char *mode)
{
register FILE *fp;
register int f;
@@ -140,17 +138,10 @@ _DEFUN(_fopen_r, (ptr, file, mode),
if ((f = _open_r (ptr, file, oflags, 0666)) < 0)
{
- __sfp_lock_acquire ();
fp->_flags = 0; /* release */
-#ifndef __SINGLE_THREAD__
- __lock_close_recursive (fp->_lock);
-#endif
- __sfp_lock_release ();
return NULL;
}
- _flockfile (fp);
-
fp->_file = f;
fp->_flags = flags;
fp->_cookie = (_PTR) fp;
@@ -167,16 +158,19 @@ _DEFUN(_fopen_r, (ptr, file, mode),
fp->_flags |= __SCLE;
#endif
- _funlockfile (fp);
+#ifndef __SINGLE_THREAD__
+ __lock_init_recursive (*(_LOCK_RECURSIVE_T *)&fp->_lock);
+#endif
+
return fp;
}
#ifndef _REENT_ONLY
FILE *
-_DEFUN(fopen, (file, mode),
- _CONST char *file _AND
- _CONST char *mode)
+_DEFUN (fopen, (file, mode),
+ _CONST char *file _AND
+ _CONST char *mode)
{
return _fopen_r (_REENT, file, mode);
}
diff --git a/newlib/libc/stdio/fprintf.c b/newlib/libc/stdio/fprintf.c
index 56a08863a..8f97a8b28 100644
--- a/newlib/libc/stdio/fprintf.c
+++ b/newlib/libc/stdio/fprintf.c
@@ -17,6 +17,7 @@
#include <_ansi.h>
#include <stdio.h>
+
#ifdef _HAVE_STDC
#include <stdarg.h>
#else
@@ -25,13 +26,13 @@
#ifdef _HAVE_STDC
int
-fprintf(FILE * fp, _CONST char *fmt,...)
+fprintf (FILE * fp, const char *fmt,...)
#else
int
-fprintf(fp, fmt, va_alist)
- FILE *fp;
- char *fmt;
- va_dcl
+fprintf (fp, fmt, va_alist)
+ FILE *fp;
+ char *fmt;
+ va_dcl
#endif
{
int ret;
diff --git a/newlib/libc/stdio/fputc.c b/newlib/libc/stdio/fputc.c
index 422f6753a..b945095e5 100644
--- a/newlib/libc/stdio/fputc.c
+++ b/newlib/libc/stdio/fputc.c
@@ -1,21 +1,4 @@
/*
- * 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
<<fputc>>---write a character on a stream or file
@@ -57,19 +40,16 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
-#include <_ansi.h>
#include <stdio.h>
-#include "local.h"
int
-_DEFUN(fputc, (ch, file),
- int ch _AND
- FILE * file)
+_DEFUN (fputc, (ch, file),
+ int ch _AND
+ FILE * file)
{
int result;
- CHECK_INIT(_REENT);
- _flockfile (file);
+ _flockfile(file);
result = putc (ch, file);
- _funlockfile (file);
+ _funlockfile(file);
return result;
}
diff --git a/newlib/libc/stdio/fputs.c b/newlib/libc/stdio/fputs.c
index 8d02107df..78758ce93 100644
--- a/newlib/libc/stdio/fputs.c
+++ b/newlib/libc/stdio/fputs.c
@@ -47,20 +47,18 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
-#include <_ansi.h>
#include <stdio.h>
#include <string.h>
#include "fvwrite.h"
-#include "local.h"
/*
* Write the given string to the given file.
*/
int
-_DEFUN(fputs, (s, fp),
- char _CONST * s _AND
- FILE * fp)
+_DEFUN (fputs, (s, fp),
+ char _CONST * s _AND
+ FILE * fp)
{
int result;
struct __suio uio;
@@ -70,11 +68,8 @@ _DEFUN(fputs, (s, fp),
iov.iov_len = uio.uio_resid = strlen (s);
uio.uio_iov = &iov;
uio.uio_iovcnt = 1;
-
- CHECK_INIT(_REENT);
-
- _flockfile (fp);
+ _flockfile(fp);
result = __sfvwrite (fp, &uio);
- _funlockfile (fp);
+ _funlockfile(fp);
return result;
}
diff --git a/newlib/libc/stdio/fread.c b/newlib/libc/stdio/fread.c
index 1354c04ba..faca53735 100644
--- a/newlib/libc/stdio/fread.c
+++ b/newlib/libc/stdio/fread.c
@@ -55,19 +55,17 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
-#include <_ansi.h>
#include <stdio.h>
#include <string.h>
-#include <malloc.h>
#include "local.h"
#ifdef __SCLE
static size_t
-_DEFUN(crlf, (fp, buf, count, eof),
- FILE * fp _AND
- char * buf _AND
- size_t count _AND
- int eof)
+_DEFUN (crlf, (fp, buf, count, eof),
+ FILE * fp _AND
+ char * buf _AND
+ size_t count _AND
+ int eof)
{
int newcount = 0, r;
char *s, *d, *e;
@@ -86,11 +84,11 @@ _DEFUN(crlf, (fp, buf, count, eof),
{
if (*s == '\r')
{
- int c = __sgetc_raw (fp);
+ int c = __sgetc_raw(fp);
if (c == '\n')
*s = '\n';
else
- ungetc (c, fp);
+ ungetc(c, fp);
}
*d++ = *s++;
}
@@ -98,7 +96,7 @@ _DEFUN(crlf, (fp, buf, count, eof),
while (d < e)
{
- r = getc (fp);
+ r = getc(fp);
if (r == EOF)
return count - (e-d);
*d++ = r;
@@ -111,11 +109,11 @@ _DEFUN(crlf, (fp, buf, count, eof),
#endif
size_t
-_DEFUN(fread, (buf, size, count, fp),
- _PTR buf _AND
- size_t size _AND
- size_t count _AND
- FILE * fp)
+_DEFUN (fread, (buf, size, count, fp),
+ _PTR buf _AND
+ size_t size _AND
+ size_t count _AND
+ FILE * fp)
{
register size_t resid;
register char *p;
@@ -125,102 +123,43 @@ _DEFUN(fread, (buf, size, count, fp),
if ((resid = count * size) == 0)
return 0;
- CHECK_INIT(_REENT);
-
- _flockfile (fp);
+ _flockfile(fp);
if (fp->_r < 0)
fp->_r = 0;
total = resid;
p = buf;
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
-
- /* Optimize unbuffered I/O. */
- if (fp->_flags & __SNBF)
+ while (resid > (r = fp->_r))
{
- /* First copy any available characters from ungetc buffer. */
- int copy_size = resid > fp->_r ? fp->_r : resid;
- _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, (size_t) copy_size);
- fp->_p += copy_size;
- fp->_r -= copy_size;
- p += copy_size;
- resid -= copy_size;
-
- /* If still more data needed, free any allocated ungetc buffer. */
- if (HASUB (fp) && resid > 0)
- FREEUB (fp);
-
- /* Finally read directly into user's buffer if needed. */
- while (resid > 0)
+ (void) memcpy ((void *) p, (void *) fp->_p, (size_t) r);
+ fp->_p += r;
+ /* fp->_r = 0 ... done in __srefill */
+ p += r;
+ resid -= r;
+ if (__srefill (fp))
{
- int rc = 0;
- /* save fp buffering state */
- void *old_base = fp->_bf._base;
- void * old_p = fp->_p;
- int old_size = fp->_bf._size;
- /* allow __refill to use user's buffer */
- fp->_bf._base = p;
- fp->_bf._size = resid;
- fp->_p = p;
- rc = __srefill (fp);
- /* restore fp buffering back to original state */
- fp->_bf._base = old_base;
- fp->_bf._size = old_size;
- fp->_p = old_p;
- resid -= fp->_r;
- p += fp->_r;
- fp->_r = 0;
- if (rc)
- {
+ /* no more input: return partial result */
#ifdef __SCLE
- if (fp->_flags & __SCLE)
- {
- _funlockfile (fp);
- return crlf (fp, buf, total-resid, 1) / size;
- }
+ if (fp->_flags & __SCLE)
+ {
+ _funlockfile(fp);
+ return crlf(fp, buf, total-resid, 1) / size;
+ }
#endif
- _funlockfile (fp);
- return (total - resid) / size;
- }
+ _funlockfile(fp);
+ return (total - resid) / size;
}
}
- else
-#endif /* !PREFER_SIZE_OVER_SPEED && !__OPTIMIZE_SIZE__ */
- {
- while (resid > (r = fp->_r))
- {
- _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, (size_t) r);
- fp->_p += r;
- /* fp->_r = 0 ... done in __srefill */
- p += r;
- resid -= r;
- if (__srefill (fp))
- {
- /* no more input: return partial result */
-#ifdef __SCLE
- if (fp->_flags & __SCLE)
- {
- _funlockfile (fp);
- return crlf (fp, buf, total-resid, 1) / size;
- }
-#endif
- _funlockfile (fp);
- return (total - resid) / size;
- }
- }
- _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, resid);
- fp->_r -= resid;
- fp->_p += resid;
- }
-
- /* Perform any CR/LF clean-up if necessary. */
+ (void) memcpy ((void *) p, (void *) fp->_p, resid);
+ fp->_r -= resid;
+ fp->_p += resid;
#ifdef __SCLE
if (fp->_flags & __SCLE)
{
- _funlockfile (fp);
+ _funlockfile(fp);
return crlf(fp, buf, total, 0) / size;
}
#endif
- _funlockfile (fp);
+ _funlockfile(fp);
return count;
}
diff --git a/newlib/libc/stdio/freopen.c b/newlib/libc/stdio/freopen.c
index ae3444b1b..ba83dd215 100644
--- a/newlib/libc/stdio/freopen.c
+++ b/newlib/libc/stdio/freopen.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1990, 2006 The Regents of the University of California.
+ * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
@@ -55,12 +55,6 @@ it).
<[file]> and <[mode]> are used just as in <<fopen>>.
-If <[file]> is <<NULL>>, the underlying stream is modified rather than
-closed. The file cannot be given a more permissive access mode (for
-example, a <[mode]> of "w" will fail on a read-only file descriptor),
-but can change status such as append or binary mode. If modification
-is not possible, failure occurs.
-
RETURNS
If successful, the result is the same as the argument <[fp]>. If the
file cannot be opened as specified, the result is <<NULL>>.
@@ -72,42 +66,35 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<open>>, <<read>>, <<sbrk>>, <<write>>.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <time.h>
#include <stdio.h>
-#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
-#include <sys/lock.h>
#include "local.h"
+#include <sys/lock.h>
/*
* Re-direct an existing, open (probably) file to some other file.
*/
FILE *
-_DEFUN(_freopen_r, (ptr, file, mode, fp),
- struct _reent *ptr _AND
- _CONST char *file _AND
- _CONST char *mode _AND
- register FILE *fp)
+_DEFUN (_freopen_r, (ptr, file, mode, fp),
+ struct _reent *ptr _AND
+ _CONST char *file _AND
+ _CONST char *mode _AND
+ register FILE *fp)
{
register int f;
- int flags, oflags;
- int e = 0;
-
- __sfp_lock_acquire ();
+ int flags, oflags, e;
- CHECK_INIT (ptr);
+ _flockfile(fp);
- _flockfile (fp);
+ CHECK_INIT (fp);
if ((flags = __sflags (ptr, mode, &oflags)) == 0)
{
- _funlockfile (fp);
- _CAST_VOID _fclose_r (ptr, fp);
- __sfp_lock_release ();
+ (void) fclose (fp);
+ _funlockfile(fp);
return NULL;
}
@@ -124,61 +111,18 @@ _DEFUN(_freopen_r, (ptr, file, mode, fp),
else
{
if (fp->_flags & __SWR)
- _CAST_VOID fflush (fp);
- /*
- * If close is NULL, closing is a no-op, hence pointless.
- * If file is NULL, the file should not be closed.
- */
- if (fp->_close != NULL && file != NULL)
- _CAST_VOID (*fp->_close) (fp->_cookie);
+ (void) fflush (fp);
+ /* if close is NULL, closing is a no-op, hence pointless */
+ if (fp->_close != NULL)
+ (void) (*fp->_close) (fp->_cookie);
}
/*
- * Now get a new descriptor to refer to the new file, or reuse the
- * existing file descriptor if file is NULL.
+ * Now get a new descriptor to refer to the new file.
*/
- if (file != NULL)
- {
- f = _open_r (ptr, (char *) file, oflags, 0666);
- e = ptr->_errno;
- }
- else
- {
-#ifdef HAVE_FCNTL
- int oldflags;
- /*
- * Reuse the file descriptor, but only if the new access mode is
- * equal or less permissive than the old. F_SETFL correctly
- * ignores creation flags.
- */
- f = fp->_file;
- if ((oldflags = _fcntl_r (ptr, f, F_GETFL, 0)) == -1
- || ! ((oldflags & O_ACCMODE) == O_RDWR
- || ((oldflags ^ oflags) & O_ACCMODE) == 0)
- || _fcntl_r (ptr, f, F_SETFL, oflags) == -1)
- f = -1;
-#else
- /* We cannot modify without fcntl support. */
- f = -1;
-#endif
-
-#ifdef __SCLE
- /*
- * F_SETFL doesn't change textmode. Don't mess with modes of ttys.
- */
- if (0 <= f && ! isatty (f)
- && setmode (f, flags & (O_BINARY | O_TEXT)) == -1)
- f = -1;
-#endif
-
- if (f < 0)
- {
- e = EBADF;
- if (fp->_close != NULL)
- _CAST_VOID (*fp->_close) (fp->_cookie);
- }
- }
+ f = _open_r (ptr, (char *) file, oflags, 0666);
+ e = ptr->_errno;
/*
* Finish closing fp. Even if the open succeeded above,
@@ -204,13 +148,12 @@ _DEFUN(_freopen_r, (ptr, file, mode, fp),
if (f < 0)
{ /* did not get it after all */
- fp->_flags = 0; /* set it free */
ptr->_errno = e; /* restore in case _close clobbered */
- _funlockfile (fp);
+ _funlockfile(fp);
#ifndef __SINGLE_THREAD__
- __lock_close_recursive (fp->_lock);
+ __lock_close_recursive (*(_LOCK_RECURSIVE_T *)&fp->_lock);
#endif
- __sfp_lock_release ();
+ fp->_flags = 0; /* set it free */
return NULL;
}
@@ -223,22 +166,21 @@ _DEFUN(_freopen_r, (ptr, file, mode, fp),
fp->_close = __sclose;
#ifdef __SCLE
- if (__stextmode (fp->_file))
+ if (__stextmode(fp->_file))
fp->_flags |= __SCLE;
#endif
- _funlockfile (fp);
- __sfp_lock_release ();
+ _funlockfile(fp);
return fp;
}
#ifndef _REENT_ONLY
FILE *
-_DEFUN(freopen, (file, mode, fp),
- _CONST char *file _AND
- _CONST char *mode _AND
- register FILE *fp)
+_DEFUN (freopen, (file, mode, fp),
+ _CONST char *file _AND
+ _CONST char *mode _AND
+ register FILE *fp)
{
return _freopen_r (_REENT, file, mode, fp);
}
diff --git a/newlib/libc/stdio/fscanf.c b/newlib/libc/stdio/fscanf.c
index c00a4690e..92fc4ea7e 100644
--- a/newlib/libc/stdio/fscanf.c
+++ b/newlib/libc/stdio/fscanf.c
@@ -16,25 +16,26 @@
*/
#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
+
#ifdef _HAVE_STDC
#include <stdarg.h>
#else
#include <varargs.h>
#endif
+
#include "local.h"
#ifndef _REENT_ONLY
int
#ifdef _HAVE_STDC
-fscanf(FILE *fp, _CONST char *fmt, ...)
+fscanf (FILE *fp, const char *fmt, ...)
#else
-fscanf(FILE *fp, fmt, va_alist)
- FILE *fp;
- char *fmt;
- va_dcl
+fscanf (FILE *fp, fmt, va_alist)
+ FILE *fp;
+ char *fmt;
+ va_dcl
#endif
{
int ret;
@@ -54,13 +55,13 @@ fscanf(FILE *fp, fmt, va_alist)
int
#ifdef _HAVE_STDC
-_fscanf_r(struct _reent *ptr, FILE *fp, _CONST char *fmt, ...)
+_fscanf_r (struct _reent *ptr, FILE *fp, const char *fmt, ...)
#else
-_fscanf_r(ptr, FILE *fp, fmt, va_alist)
- struct _reent *ptr;
- FILE *fp;
- char *fmt;
- va_dcl
+_fscanf_r (ptr, FILE *fp, fmt, va_alist)
+ struct _reent *ptr;
+ FILE *fp;
+ char *fmt;
+ va_dcl
#endif
{
int ret;
diff --git a/newlib/libc/stdio/fseek.c b/newlib/libc/stdio/fseek.c
index 8b189ba17..4747e2156 100644
--- a/newlib/libc/stdio/fseek.c
+++ b/newlib/libc/stdio/fseek.c
@@ -98,8 +98,6 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
@@ -116,24 +114,23 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
*/
int
-_DEFUN(_fseek_r, (ptr, fp, offset, whence),
- struct _reent *ptr _AND
- register FILE *fp _AND
- long offset _AND
- int whence)
+_DEFUN (_fseek_r, (ptr, fp, offset, whence),
+ struct _reent *ptr _AND
+ register FILE *fp _AND
+ long offset _AND
+ int whence)
{
- _fpos_t _EXFUN((*seekfn), (_PTR, _fpos_t, int));
- _fpos_t target;
- _fpos_t curoff = 0;
+ _fpos_t _EXFUN ((*seekfn), (void *, _fpos_t, int));
+ _fpos_t target, curoff;
size_t n;
struct stat st;
int havepos;
- /* Make sure stdio is set up. */
+ _flockfile(fp);
- CHECK_INIT (ptr);
+ /* Make sure stdio is set up. */
- _flockfile (fp);
+ CHECK_INIT (fp);
/* If we've been doing some writing, and we're in append mode
then we don't really know where the filepos is. */
@@ -149,7 +146,7 @@ _DEFUN(_fseek_r, (ptr, fp, offset, whence),
if ((seekfn = fp->_seek) == NULL)
{
ptr->_errno = ESPIPE; /* ??? */
- _funlockfile (fp);
+ _funlockfile(fp);
return EOF;
}
@@ -166,7 +163,7 @@ _DEFUN(_fseek_r, (ptr, fp, offset, whence),
* we have to first find the current stream offset a la
* ftell (see ftell for details).
*/
- fflush (fp); /* may adjust seek offset on append stream */
+ fflush(fp); /* may adjust seek offset on append stream */
if (fp->_flags & __SOFF)
curoff = fp->_offset;
else
@@ -174,7 +171,7 @@ _DEFUN(_fseek_r, (ptr, fp, offset, whence),
curoff = (*seekfn) (fp->_cookie, (_fpos_t) 0, SEEK_CUR);
if (curoff == -1L)
{
- _funlockfile (fp);
+ _funlockfile(fp);
return EOF;
}
}
@@ -199,7 +196,7 @@ _DEFUN(_fseek_r, (ptr, fp, offset, whence),
default:
ptr->_errno = EINVAL;
- _funlockfile (fp);
+ _funlockfile(fp);
return (EOF);
}
@@ -309,7 +306,7 @@ _DEFUN(_fseek_r, (ptr, fp, offset, whence),
if (HASUB (fp))
FREEUB (fp);
fp->_flags &= ~__SEOF;
- _funlockfile (fp);
+ _funlockfile(fp);
return 0;
}
@@ -338,7 +335,7 @@ _DEFUN(_fseek_r, (ptr, fp, offset, whence),
fp->_p += n;
fp->_r -= n;
}
- _funlockfile (fp);
+ _funlockfile(fp);
return 0;
/*
@@ -349,7 +346,7 @@ _DEFUN(_fseek_r, (ptr, fp, offset, whence),
dumb:
if (fflush (fp) || (*seekfn) (fp->_cookie, offset, whence) == POS_ERR)
{
- _funlockfile (fp);
+ _funlockfile(fp);
return EOF;
}
/* success: clear EOF indicator and discard ungetc() data */
@@ -359,24 +356,17 @@ dumb:
fp->_r = 0;
/* fp->_w = 0; *//* unnecessary (I think...) */
fp->_flags &= ~__SEOF;
- /* Reset no-optimization flag after successful seek. The
- no-optimization flag may be set in the case of a read
- stream that is flushed which by POSIX/SUSv3 standards,
- means that a corresponding seek must not optimize. The
- optimization is then allowed if no subsequent flush
- is performed. */
- fp->_flags &= ~__SNPT;
- _funlockfile (fp);
+ _funlockfile(fp);
return 0;
}
#ifndef _REENT_ONLY
int
-_DEFUN(fseek, (fp, offset, whence),
- register FILE *fp _AND
- long offset _AND
- int whence)
+_DEFUN (fseek, (fp, offset, whence),
+ register FILE *fp _AND
+ long offset _AND
+ int whence)
{
return _fseek_r (_REENT, fp, offset, whence);
}
diff --git a/newlib/libc/stdio/fseeko.c b/newlib/libc/stdio/fseeko.c
index 0d655d0e7..62a9d43be 100644
--- a/newlib/libc/stdio/fseeko.c
+++ b/newlib/libc/stdio/fseeko.c
@@ -15,16 +15,14 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
int
-_DEFUN(_fseeko_r, (ptr, fp, offset, whence),
- struct _reent *ptr _AND
- register FILE *fp _AND
- _off_t offset _AND
- int whence)
+_DEFUN (_fseeko_r, (ptr, fp, offset, whence),
+ struct _reent *ptr _AND
+ register FILE *fp _AND
+ _off_t offset _AND
+ int whence)
{
return _fseek_r (ptr, fp, (long)offset, whence);
}
@@ -32,10 +30,10 @@ _DEFUN(_fseeko_r, (ptr, fp, offset, whence),
#ifndef _REENT_ONLY
int
-_DEFUN(fseeko, (fp, offset, whence),
- register FILE *fp _AND
- _off_t offset _AND
- int whence)
+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_r (_REENT, fp, (long)offset, whence);
diff --git a/newlib/libc/stdio/fsetpos.c b/newlib/libc/stdio/fsetpos.c
index e2dd39bc8..75f719b22 100644
--- a/newlib/libc/stdio/fsetpos.c
+++ b/newlib/libc/stdio/fsetpos.c
@@ -1,21 +1,4 @@
/*
- * 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
<<fsetpos>>---restore position of a stream or file
@@ -65,15 +48,13 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
int
-_DEFUN(_fsetpos_r, (ptr, iop, pos),
- struct _reent * ptr _AND
- FILE * iop _AND
- _CONST _fpos_t * pos)
+_DEFUN (_fsetpos_r, (ptr, iop, pos),
+ struct _reent * ptr _AND
+ FILE * iop _AND
+ _CONST _fpos_t * pos)
{
int x = _fseek_r (ptr, iop, *pos, SEEK_SET);
@@ -85,9 +66,9 @@ _DEFUN(_fsetpos_r, (ptr, iop, pos),
#ifndef _REENT_ONLY
int
-_DEFUN(fsetpos, (iop, pos),
- FILE * iop _AND
- _CONST _fpos_t * pos)
+_DEFUN (fsetpos, (iop, pos),
+ FILE * iop _AND
+ _CONST _fpos_t * pos)
{
return _fsetpos_r (_REENT, iop, pos);
}
diff --git a/newlib/libc/stdio/ftell.c b/newlib/libc/stdio/ftell.c
index 74d6d906c..1df856366 100644
--- a/newlib/libc/stdio/ftell.c
+++ b/newlib/libc/stdio/ftell.c
@@ -92,29 +92,28 @@ static char sccsid[] = "%W% (Berkeley) %G%";
* ftell: return current offset.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#include <errno.h>
+
#include "local.h"
long
-_DEFUN(_ftell_r, (ptr, fp),
- struct _reent *ptr _AND
- register FILE * fp)
+_DEFUN (_ftell_r, (ptr, fp),
+ struct _reent *ptr _AND
+ register FILE * fp)
{
_fpos_t pos;
- /* Ensure stdio is set up. */
+ _flockfile(fp);
- CHECK_INIT (ptr);
+ /* Ensure stdio is set up. */
- _flockfile (fp);
+ CHECK_INIT (fp);
if (fp->_seek == NULL)
{
ptr->_errno = ESPIPE;
- _funlockfile (fp);
+ _funlockfile(fp);
return -1L;
}
@@ -128,7 +127,7 @@ _DEFUN(_ftell_r, (ptr, fp),
pos = (*fp->_seek) (fp->_cookie, (_fpos_t) 0, SEEK_CUR);
if (pos == -1L)
{
- _funlockfile (fp);
+ _funlockfile(fp);
return pos;
}
}
@@ -143,7 +142,7 @@ _DEFUN(_ftell_r, (ptr, fp),
if (HASUB (fp))
pos -= fp->_ur;
}
- else if ((fp->_flags & __SWR) && fp->_p != NULL)
+ else if (fp->_flags & __SWR && fp->_p != NULL)
{
/*
* Writing. Any buffered characters cause the
@@ -153,15 +152,15 @@ _DEFUN(_ftell_r, (ptr, fp),
pos += fp->_p - fp->_bf._base;
}
- _funlockfile (fp);
+ _funlockfile(fp);
return pos;
}
#ifndef _REENT_ONLY
long
-_DEFUN(ftell, (fp),
- register FILE * fp)
+_DEFUN (ftell, (fp),
+ register FILE * fp)
{
return _ftell_r (_REENT, fp);
}
diff --git a/newlib/libc/stdio/ftello.c b/newlib/libc/stdio/ftello.c
index 216d88453..918883cf0 100644
--- a/newlib/libc/stdio/ftello.c
+++ b/newlib/libc/stdio/ftello.c
@@ -15,14 +15,12 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
_off_t
-_DEFUN(_ftello_r, (ptr, fp),
- struct _reent * ptr _AND
- register FILE * fp)
+_DEFUN (_ftello_r, (ptr, fp),
+ struct _reent * ptr _AND
+ register FILE * fp)
{
/* for now we simply cast since off_t should be long */
return (_off_t)_ftell_r (ptr, fp);
@@ -31,8 +29,8 @@ _DEFUN(_ftello_r, (ptr, fp),
#ifndef _REENT_ONLY
_off_t
-_DEFUN(ftello, (fp),
- register FILE * fp)
+_DEFUN (ftello, (fp),
+ register FILE * fp)
{
return (_off_t)_ftell_r (_REENT, fp);
}
diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c
index f036d7483..aaf3a192e 100644
--- a/newlib/libc/stdio/fvwrite.c
+++ b/newlib/libc/stdio/fvwrite.c
@@ -1,3 +1,5 @@
+/* No user fns here. Pesch 15apr92. */
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -14,9 +16,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* No user fns here. Pesch 15apr92. */
-#include <_ansi.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -24,7 +24,7 @@
#include "fvwrite.h"
#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#define COPY(n) _CAST_VOID memmove ((_PTR) fp->_p, (_PTR) p, (size_t) (n))
+#define COPY(n) (void) memmove((void *) fp->_p, (void *) p, (size_t) (n))
#define GETIOV(extra_work) \
while (len == 0) \
@@ -43,12 +43,12 @@
*/
int
-_DEFUN(__sfvwrite, (fp, uio),
- register FILE *fp _AND
- register struct __suio *uio)
+__sfvwrite (fp, uio)
+ register FILE *fp;
+ register struct __suio *uio;
{
register size_t len;
- register _CONST char *p = NULL;
+ register _CONST char *p;
register struct __siov *iov;
register int w, s;
char *nl;
@@ -72,7 +72,7 @@ _DEFUN(__sfvwrite, (fp, uio),
GETIOV (;);
while (len > 0)
{
- if (putc (*p, fp) == EOF)
+ if (putc(*p, fp) == EOF)
return EOF;
p++;
len--;
@@ -129,11 +129,7 @@ _DEFUN(__sfvwrite, (fp, uio),
fp->_bf._base,
curpos + len);
if (!ptr)
- {
- /* Free buffer which is no longer used. */
- _free_r (_REENT, fp->_bf._base);
- goto err;
- }
+ goto err;
fp->_bf._base = ptr;
fp->_p = ptr + curpos;
fp->_bf._size = curpos + len;
@@ -185,13 +181,12 @@ _DEFUN(__sfvwrite, (fp, uio),
* that the amount to write is MIN(len,nldist).
*/
nlknown = 0;
- nldist = 0;
do
{
GETIOV (nlknown = 0);
if (!nlknown)
{
- nl = memchr ((_PTR) p, '\n', len);
+ nl = memchr ((void *) p, '\n', len);
nldist = nl ? nl + 1 - p : len + 1;
nlknown = 1;
}
diff --git a/newlib/libc/stdio/fwalk.c b/newlib/libc/stdio/fwalk.c
index 376959dcd..b147da3af 100644
--- a/newlib/libc/stdio/fwalk.c
+++ b/newlib/libc/stdio/fwalk.c
@@ -1,3 +1,5 @@
+/* No user fns here. Pesch 15apr92. */
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -14,99 +16,39 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* No user fns here. Pesch 15apr92. */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "local.h"
-static int
-_DEFUN(__fwalk, (ptr, function),
- struct _reent *ptr _AND
- register int (*function) (FILE *))
-{
- register FILE *fp;
- register int n, ret = 0;
- register struct _glue *g;
-
- for (g = &ptr->__sglue; g != NULL; g = g->_next)
- for (fp = g->_iobs, n = g->_niobs; --n >= 0; fp++)
- if (fp->_flags != 0)
- {
- _flockfile (fp);
- if (fp->_flags != 0 && fp->_file != -1)
- ret |= (*function) (fp);
- _funlockfile (fp);
- }
-
- return ret;
-}
-
-/* Special version of __fwalk where the function pointer is a reentrant
- I/O function (e.g. _fclose_r). */
-static int
-_DEFUN(__fwalk_reent, (ptr, reent_function),
- struct _reent *ptr _AND
- register int (*reent_function) (struct _reent *, FILE *))
+int
+_fwalk (ptr, function)
+ struct _reent *ptr;
+ register int (*function) ();
{
register FILE *fp;
register int n, ret = 0;
register struct _glue *g;
- for (g = &ptr->__sglue; g != NULL; g = g->_next)
+ /* Must traverse given list for std streams. */
+ if (ptr != _GLOBAL_REENT)
+ {
+ for (g = &ptr->__sglue; g != NULL; g = g->_next)
+ for (fp = g->_iobs, n = g->_niobs; --n >= 0; fp++)
+ if (fp->_flags != 0)
+ ret |= (*function) (fp);
+ }
+
+ /* Must traverse global list for all other streams. */
+ for (g = &_GLOBAL_REENT->__sglue; g != NULL; g = g->_next)
for (fp = g->_iobs, n = g->_niobs; --n >= 0; fp++)
if (fp->_flags != 0)
- {
- _flockfile (fp);
- if (fp->_flags != 0 && fp->_file != -1)
- ret |= (*reent_function) (ptr, fp);
- _funlockfile (fp);
- }
-
- return ret;
-}
-
-int
-_DEFUN(_fwalk, (ptr, function),
- struct _reent *ptr _AND
- register int (*function)(FILE *))
-{
- register int ret = 0;
-
- __sfp_lock_acquire ();
-
- /* Must traverse given list for streams. Note that _GLOBAL_REENT
- only walked once in exit(). */
- ret |= __fwalk (ptr, function);
-
- __sfp_lock_release ();
-
- return ret;
-}
-
-/* Special version of _fwalk which handles a function pointer to a
- reentrant I/O function (e.g. _fclose_r). */
-int
-_DEFUN(_fwalk_reent, (ptr, reent_function),
- struct _reent *ptr _AND
- register int (*reent_function) (struct _reent *, FILE *))
-{
- register int ret = 0;
-
- __sfp_lock_acquire ();
-
- /* Must traverse given list for streams. Note that _GLOBAL_REENT
- only walked once in exit(). */
- ret |= __fwalk_reent (ptr, reent_function);
-
- __sfp_lock_release ();
+ ret |= (*function) (fp);
return ret;
}
diff --git a/newlib/libc/stdio/fwrite.c b/newlib/libc/stdio/fwrite.c
index 663fff62c..1c91632b8 100644
--- a/newlib/libc/stdio/fwrite.c
+++ b/newlib/libc/stdio/fwrite.c
@@ -61,7 +61,6 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
#include <stdio.h>
#include <string.h>
#if 0
@@ -78,11 +77,11 @@ static char sccsid[] = "%W% (Berkeley) %G%";
*/
size_t
-_DEFUN(fwrite, (buf, size, count, fp),
- _CONST _PTR buf _AND
- size_t size _AND
- size_t count _AND
- FILE * fp)
+_DEFUN (fwrite, (buf, size, count, fp),
+ _CONST _PTR buf _AND
+ size_t size _AND
+ size_t count _AND
+ FILE * fp)
{
size_t n;
struct __suio uio;
@@ -99,14 +98,12 @@ _DEFUN(fwrite, (buf, size, count, fp),
* generally slow and since this occurs whenever size==0.
*/
- CHECK_INIT(_REENT);
-
- _flockfile (fp);
+ _flockfile(fp);
if (__sfvwrite (fp, &uio) == 0)
{
- _funlockfile (fp);
+ _funlockfile(fp);
return count;
}
- _funlockfile (fp);
+ _funlockfile(fp);
return (n - uio.uio_resid) / size;
}
diff --git a/newlib/libc/stdio/getc.c b/newlib/libc/stdio/getc.c
index 9628a8740..f7a2cac5a 100644
--- a/newlib/libc/stdio/getc.c
+++ b/newlib/libc/stdio/getc.c
@@ -62,9 +62,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
#include <stdio.h>
-#include "local.h"
/*
* A subroutine version of the macro getc.
@@ -73,13 +71,13 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#undef getc
int
-_DEFUN(getc, (fp),
- register FILE *fp)
+getc (fp)
+ register FILE *fp;
{
int result;
- CHECK_INIT (_REENT);
- _flockfile (fp);
+ _flockfile(fp);
+ /* CHECK_INIT is called (eventually) by __srefill. */
result = __sgetc (fp);
- _funlockfile (fp);
+ _funlockfile(fp);
return result;
}
diff --git a/newlib/libc/stdio/getc_u.c b/newlib/libc/stdio/getc_u.c
index 9c05fa6f5..877c7f8a0 100644
--- a/newlib/libc/stdio/getc_u.c
+++ b/newlib/libc/stdio/getc_u.c
@@ -50,7 +50,6 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
#include <stdio.h>
/*
@@ -60,8 +59,8 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#undef getc_unlocked
int
-_DEFUN(getc_unlocked, (fp),
- register FILE *fp)
+getc_unlocked (fp)
+ register FILE *fp;
{
/* CHECK_INIT is called (eventually) by __srefill. */
diff --git a/newlib/libc/stdio/getchar.c b/newlib/libc/stdio/getchar.c
index 19301c113..345932666 100644
--- a/newlib/libc/stdio/getchar.c
+++ b/newlib/libc/stdio/getchar.c
@@ -28,7 +28,7 @@ ANSI_SYNOPSIS
#include <stdio.h>
int getchar(void);
- int _getchar_r(struct _reent *<[reent]>);
+ int _getchar_r(void *<[reent]>);
TRAD_SYNOPSIS
#include <stdio.h>
@@ -71,25 +71,25 @@ static char sccsid[] = "%W% (Berkeley) %G%";
* A subroutine version of the macro getchar.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
+#include <reent.h>
+
#include "local.h"
#undef getchar
int
-_DEFUN(_getchar_r, (f),
- struct _reent *f)
+_getchar_r (f)
+ struct _reent *f;
{
- _REENT_SMALL_CHECK_INIT (f);
+ _REENT_SMALL_CHECK_INIT(_stdin_r (f));
return getc (_stdin_r (f));
}
#ifndef _REENT_ONLY
int
-_DEFUN_VOID(getchar)
+getchar ()
{
/* CHECK_INIT is called (eventually) by __srefill. */
diff --git a/newlib/libc/stdio/getchar_u.c b/newlib/libc/stdio/getchar_u.c
index be566ea26..f36f88810 100644
--- a/newlib/libc/stdio/getchar_u.c
+++ b/newlib/libc/stdio/getchar_u.c
@@ -54,15 +54,14 @@ static char sccsid[] = "%W% (Berkeley) %G%";
* A subroutine version of the macro getchar_unlocked.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
+#include <reent.h>
#undef getchar_unlocked
int
-_DEFUN(_getchar_unlocked_r, (f),
- struct _reent *f)
+_getchar_unlocked_r (f)
+ struct _reent *f;
{
return getc_unlocked (_stdin_r (f));
}
@@ -70,7 +69,7 @@ _DEFUN(_getchar_unlocked_r, (f),
#ifndef _REENT_ONLY
int
-_DEFUN_VOID(getchar_unlocked)
+getchar_unlocked ()
{
/* CHECK_INIT is called (eventually) by __srefill. */
diff --git a/newlib/libc/stdio/getdelim.c b/newlib/libc/stdio/getdelim.c
index 0fdfb3add..64f60ee8c 100644
--- a/newlib/libc/stdio/getdelim.c
+++ b/newlib/libc/stdio/getdelim.c
@@ -1,7 +1,6 @@
-/* Copyright 2002, Red Hat Inc. - all rights reserved */
/*
FUNCTION
-<<getdelim>>---read a line up to a specified line delimiter
+<<getdelim>>---read a line up to a specified line delimeter
INDEX
getdelim
@@ -21,16 +20,16 @@ TRAD_SYNOPSIS
DESCRIPTION
<<getdelim>> reads a file <[fp]> up to and possibly including a specified
-delimiter <[delim]>. The line is read into a buffer pointed to
+delimeter <[delim]>. The line is read into a buffer pointed to
by <[bufptr]> and designated with size *<[n]>. If the buffer is
not large enough, it will be dynamically grown by <<getdelim>>.
As the buffer is grown, the pointer to the size <[n]> will be
updated.
RETURNS
-<<getdelim>> returns <<-1>> if no characters were successfully read;
+<<getdelim>> returns <<-1>> if no characters were successfully read,
otherwise, it returns the number of bytes successfully read.
-At end of file, the result is nonzero.
+at end of file, the result is nonzero.
PORTABILITY
<<getdelim>> is a glibc extension.
@@ -38,7 +37,8 @@ PORTABILITY
No supporting OS subroutines are directly required.
*/
-#include <_ansi.h>
+/* Copyright 2002, Red Hat Inc. - all rights reserved */
+
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -48,11 +48,11 @@ No supporting OS subroutines are directly required.
#define DEFAULT_LINE_SIZE 128
ssize_t
-_DEFUN(__getdelim, (bufptr, n, delim, fp),
- char **bufptr _AND
- size_t *n _AND
- int delim _AND
- FILE *fp)
+__getdelim (bufptr, n, delim, fp)
+ char **bufptr;
+ size_t *n;
+ int delim;
+ FILE *fp;
{
char *buf;
char *ptr;
@@ -79,9 +79,9 @@ _DEFUN(__getdelim, (bufptr, n, delim, fp),
*n = DEFAULT_LINE_SIZE;
}
- CHECK_INIT (_REENT);
+ _flockfile(fp);
- _flockfile (fp);
+ CHECK_INIT(fp);
numbytes = *n;
ptr = buf;
diff --git a/newlib/libc/stdio/getline.c b/newlib/libc/stdio/getline.c
index c758ae964..741a7dc77 100644
--- a/newlib/libc/stdio/getline.c
+++ b/newlib/libc/stdio/getline.c
@@ -1,4 +1,3 @@
-/* Copyright 2002, Red Hat Inc. - all rights reserved */
/*
FUNCTION
<<getline>>---read a line from a file
@@ -38,16 +37,17 @@ PORTABILITY
No supporting OS subroutines are directly required.
*/
-#include <_ansi.h>
+/* Copyright 2002, Red Hat Inc. - all rights reserved */
+
#include <stdio.h>
-extern ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *));
+extern ssize_t __getdelim (char **, size_t *, int, FILE *);
ssize_t
-_DEFUN(__getline, (lptr, n, fp),
- char **lptr _AND
- size_t *n _AND
- FILE *fp)
+__getline (lptr, n, fp)
+ char **lptr;
+ size_t *n;
+ FILE *fp;
{
return __getdelim (lptr, n, '\n', fp);
}
diff --git a/newlib/libc/stdio/gets.c b/newlib/libc/stdio/gets.c
index b90271fb9..796100e32 100644
--- a/newlib/libc/stdio/gets.c
+++ b/newlib/libc/stdio/gets.c
@@ -15,10 +15,11 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
+
/*
-FUNCTION
-<<gets>>---get character string (obsolete, use <<fgets>> instead)
+FUNCTION
+ <<gets>>---get character string (obsolete, use <<fgets>> instead)
INDEX
gets
INDEX
@@ -29,7 +30,7 @@ ANSI_SYNOPSIS
char *gets(char *<[buf]>);
- char *_gets_r(struct _reent *<[reent]>, char *<[buf]>);
+ char *_gets_r(void *<[reent]>, char *<[buf]>);
TRAD_SYNOPSIS
#include <stdio.h>
@@ -38,7 +39,7 @@ TRAD_SYNOPSIS
char *<[buf]>;
char *_gets_r(<[reent]>, <[buf]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[buf]>;
DESCRIPTION
@@ -67,14 +68,12 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
char *
-_DEFUN(_gets_r, (ptr, buf),
- struct _reent *ptr _AND
- char *buf)
+_gets_r (ptr, buf)
+ struct _reent *ptr;
+ char *buf;
{
register int c;
register char *s = buf;
@@ -94,8 +93,8 @@ _DEFUN(_gets_r, (ptr, buf),
#ifndef _REENT_ONLY
char *
-_DEFUN(gets, (buf),
- char *buf)
+gets (buf)
+ char *buf;
{
return _gets_r (_REENT, buf);
}
diff --git a/newlib/libc/stdio/getw.c b/newlib/libc/stdio/getw.c
index 210c5939a..b6fd87313 100644
--- a/newlib/libc/stdio/getw.c
+++ b/newlib/libc/stdio/getw.c
@@ -37,15 +37,14 @@ 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
+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.
+<<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>>.
@@ -55,15 +54,14 @@ Supporting OS subroutines required: <<fread>>. */
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
#include <stdio.h>
int
-_DEFUN(getw, (fp),
- register FILE *fp)
+getw (fp)
+ register FILE *fp;
{
int result;
- if (fread ((char*)&result, sizeof (result), 1, fp) != 1)
+ if (fread((char*)&result, sizeof(result), 1, fp) != 1)
return EOF;
return result;
}
diff --git a/newlib/libc/stdio/iprintf.c b/newlib/libc/stdio/iprintf.c
index c9a026424..dc91b12fa 100644
--- a/newlib/libc/stdio/iprintf.c
+++ b/newlib/libc/stdio/iprintf.c
@@ -1,46 +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
+ <<iprintf>>---write formatted output (integer only)
+INDEX
+ iprintf
+
+ANSI_SYNOPSIS
+ #include <stdio.h>
+
+ int iprintf(const char *<[format]>, ...);
+
+TRAD_SYNOPSIS
+ #include <stdio.h>
+
+ int iprintf(<[format]> [, <[arg]>, ...])
+ char *<[format]>;
+
+DESCRIPTION
+<<iprintf>> is a restricted version of <<printf>>: it has the same
+arguments and behavior, save that it cannot perform any floating-point
+formatting: the <<f>>, <<g>>, <<G>>, <<e>>, and <<F>> type specifiers
+are not recognized.
+
+RETURNS
+ <<iprintf>> returns the number of bytes in the output string,
+ save that the concluding <<NULL>> is not counted.
+ <<iprintf>> returns when the end of the format string is
+ encountered. If an error occurs, <<iprintf>>
+ returns <<EOF>>.
+
+PORTABILITY
+<<iprintf>> is not required by ANSI C.
+
+Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
+<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
+*/
#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
+
+#include "local.h"
+
#ifdef _HAVE_STDC
#include <stdarg.h>
#else
#include <varargs.h>
#endif
-#include "local.h"
#ifndef _REENT_ONLY
#ifdef _HAVE_STDC
int
-iprintf(_CONST char *fmt,...)
+iprintf (const char *fmt,...)
#else
int
-iprintf(fmt, va_alist)
- char *fmt;
- va_dcl
+iprintf (fmt, va_alist)
+ char *fmt;
+ va_dcl
#endif
{
int ret;
va_list ap;
- _REENT_SMALL_CHECK_INIT (_REENT);
+ _REENT_SMALL_CHECK_INIT(_stdout_r (_REENT));
#ifdef _HAVE_STDC
va_start (ap, fmt);
#else
@@ -55,26 +76,25 @@ iprintf(fmt, va_alist)
#ifdef _HAVE_STDC
int
-_iprintf_r(struct _reent *ptr, _CONST char *fmt, ...)
+_iprintf_r (struct _reent *ptr, const char *fmt, ...)
#else
int
-_iprintf_r(ptr, fmt, va_alist)
- struct _reent *ptr;
- char *fmt;
- va_dcl
+_iprintf_r (data, fmt, va_alist)
+ char *data;
+ char *fmt;
+ va_dcl
#endif
{
int ret;
va_list ap;
- _REENT_SMALL_CHECK_INIT (ptr);
+ _REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
#ifdef _HAVE_STDC
va_start (ap, fmt);
#else
va_start (ap);
#endif
- ret = _vfiprintf_r (ptr, _stdout_r (ptr), fmt, ap);
+ ret = vfiprintf (_stdout_r (ptr), fmt, ap);
va_end (ap);
return ret;
}
-
diff --git a/newlib/libc/stdio/iscanf.c b/newlib/libc/stdio/iscanf.c
deleted file mode 100644
index f35acd2ed..000000000
--- a/newlib/libc/stdio/iscanf.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.
- */
-
-#include <_ansi.h>
-#include <reent.h>
-#include <stdio.h>
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include "local.h"
-
-#ifndef _REENT_ONLY
-
-int
-#ifdef _HAVE_STDC
-iscanf(_CONST char *fmt, ...)
-#else
-iscanf(fmt, va_alist)
- char *fmt;
- va_dcl
-#endif
-{
- int ret;
- va_list ap;
-
- _REENT_SMALL_CHECK_INIT (_REENT);
-#ifdef _HAVE_STDC
- va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = __svfiscanf_r (_REENT, _stdin_r (_REENT), fmt, ap);
- va_end (ap);
- return ret;
-}
-
-#endif /* !_REENT_ONLY */
-
-int
-#ifdef _HAVE_STDC
-_iscanf_r(struct _reent *ptr, _CONST char *fmt, ...)
-#else
-_iscanf_r(ptr, fmt, va_alist)
- struct _reent *ptr;
- char *fmt;
- va_dcl
-#endif
-{
- int ret;
- va_list ap;
-
- _REENT_SMALL_CHECK_INIT (ptr);
-#ifdef _HAVE_STDC
- va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = __svfiscanf_r (ptr, _stdin_r (ptr), fmt, ap);
- va_end (ap);
- return (ret);
-}
-
diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h
index f7093b697..b4f4457fc 100644
--- a/newlib/libc/stdio/local.h
+++ b/newlib/libc/stdio/local.h
@@ -23,38 +23,34 @@
*/
#include <_ansi.h>
-#include <reent.h>
#include <stdarg.h>
#include <reent.h>
-#include <stdlib.h>
#include <unistd.h>
extern int _EXFUN(__svfscanf_r,(struct _reent *,FILE *, _CONST char *,va_list));
-extern int _EXFUN(__svfiscanf_r,(struct _reent *,FILE *, _CONST char *,va_list));
extern FILE *_EXFUN(__sfp,(struct _reent *));
extern int _EXFUN(__sflags,(struct _reent *,_CONST char*, int*));
extern int _EXFUN(__srefill,(FILE *));
-extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(_PTR, char *, int));
-extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite,(_PTR, char _CONST *, int));
-extern _fpos_t _EXFUN(__sseek,(_PTR, _fpos_t, int));
-extern int _EXFUN(__sclose,(_PTR));
+extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(void *, char *, int));
+extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite,(void *, char const *, int));
+extern _fpos_t _EXFUN(__sseek,(void *, _fpos_t, int));
+extern int _EXFUN(__sclose,(void *));
extern int _EXFUN(__stextmode,(int));
-extern _VOID _EXFUN(__sinit,(struct _reent *));
-extern _VOID _EXFUN(_cleanup_r,(struct _reent *));
-extern _VOID _EXFUN(__smakebuf,(FILE *));
+extern void _EXFUN(__sinit,(struct _reent *));
+extern void _EXFUN(_cleanup_r,(struct _reent *));
+extern void _EXFUN(__smakebuf,(FILE *));
extern int _EXFUN(_fwalk,(struct _reent *, int (*)(FILE *)));
-extern int _EXFUN(_fwalk_reent,(struct _reent *, int (*)(struct _reent *, FILE *)));
struct _glue * _EXFUN(__sfmoreglue,(struct _reent *,int n));
extern int _EXFUN(__srefill,(FILE *fp));
/* Called by the main entry point fns to ensure stdio has been initialized. */
-#define CHECK_INIT(ptr) \
- do \
- { \
- if ((ptr) && !(ptr)->__sdidinit) \
- __sinit (ptr); \
- } \
+#define CHECK_INIT(fp) \
+ do \
+ { \
+ if (!_REENT->__sdidinit) \
+ __sinit (_REENT); \
+ } \
while (0)
/* Return true iff the given FILE cannot be written now. */
@@ -91,15 +87,3 @@ char *_EXFUN(_llicvt,(char *, long long, char));
#define CVT_BUF_SIZE 128
#define NDYNAMIC 4 /* add four more whenever necessary */
-
-#ifdef __SINGLE_THREAD__
-#define __sfp_lock_acquire()
-#define __sfp_lock_release()
-#define __sinit_lock_acquire()
-#define __sinit_lock_release()
-#else
-_VOID _EXFUN(__sfp_lock_acquire,(_VOID));
-_VOID _EXFUN(__sfp_lock_release,(_VOID));
-_VOID _EXFUN(__sinit_lock_acquire,(_VOID));
-_VOID _EXFUN(__sinit_lock_release,(_VOID));
-#endif
diff --git a/newlib/libc/stdio/makebuf.c b/newlib/libc/stdio/makebuf.c
index c4d03ecb6..48b664588 100644
--- a/newlib/libc/stdio/makebuf.c
+++ b/newlib/libc/stdio/makebuf.c
@@ -1,3 +1,5 @@
+/* No user fns here. Pesch 15apr92. */
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -14,14 +16,13 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* No user fns here. Pesch 15apr92. */
-#include <_ansi.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/unistd.h>
+
#include "local.h"
/*
@@ -32,9 +33,9 @@
* optimization) right after the _fstat() that finds the buffer size.
*/
-_VOID
-_DEFUN(__smakebuf, (fp),
- register FILE *fp)
+void
+__smakebuf (fp)
+ register FILE *fp;
{
register size_t size, couldbetty;
register _PTR p;
diff --git a/newlib/libc/stdio/mktemp.c b/newlib/libc/stdio/mktemp.c
index 59e7a5c66..f5757f3c7 100644
--- a/newlib/libc/stdio/mktemp.c
+++ b/newlib/libc/stdio/mktemp.c
@@ -1,3 +1,8 @@
+/* This is file MKTEMP.C */
+/* This file may have been modified by DJ Delorie (Jan 1991). If so,
+** these modifications are Copyright (C) 1991 DJ Delorie.
+*/
+
/*
* Copyright (c) 1987 Regents of the University of California.
* All rights reserved.
@@ -16,10 +21,6 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* This is file MKTEMP.C */
-/* This file may have been modified by DJ Delorie (Jan 1991). If so,
-** these modifications are Copyright (C) 1991 DJ Delorie.
-*/
/*
FUNCTION
@@ -39,8 +40,8 @@ ANSI_SYNOPSIS
char *mktemp(char *<[path]>);
int mkstemp(char *<[path]>);
- char *_mktemp_r(struct _reent *<[reent]>, char *<[path]>);
- int *_mkstemp_r(struct _reent *<[reent]>, char *<[path]>);
+ char *_mktemp_r(void *<[reent]>, char *<[path]>);
+ int *_mkstemp_r(void *<[reent]>, char *<[path]>);
TRAD_SYNOPSIS
#include <stdio.h>
@@ -51,11 +52,11 @@ TRAD_SYNOPSIS
char *<[path]>;
char *_mktemp_r(<[reent]>, <[path]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[path]>;
int _mkstemp_r(<[reent]>, <[path]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[path]>;
DESCRIPTION
@@ -92,20 +93,19 @@ V Interface Definition requires <<mktemp>> as of Issue 2.
Supporting OS subroutines required: <<getpid>>, <<open>>, <<stat>>.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#include <stdio.h>
#include <ctype.h>
+#include <reent.h>
static int
-_DEFUN(_gettemp, (ptr, path, doopen),
- struct _reent *ptr _AND
- char *path _AND
- register int *doopen)
+_DEFUN (_gettemp, (ptr, path, doopen),
+ struct _reent *ptr _AND
+ char *path _AND
+ register int *doopen)
{
register char *start, *trv;
struct stat sbuf;
@@ -190,9 +190,9 @@ _DEFUN(_gettemp, (ptr, path, doopen),
}
int
-_DEFUN(_mkstemp_r, (ptr, path),
- struct _reent *ptr _AND
- char *path)
+_DEFUN (_mkstemp_r, (ptr, path),
+ struct _reent *ptr _AND
+ char *path)
{
int fd;
@@ -200,9 +200,9 @@ _DEFUN(_mkstemp_r, (ptr, path),
}
char *
-_DEFUN(_mktemp_r, (ptr, path),
- struct _reent *ptr _AND
- char *path)
+_DEFUN (_mktemp_r, (ptr, path),
+ struct _reent *ptr _AND
+ char *path)
{
return (_gettemp (ptr, path, (int *) NULL) ? path : (char *) NULL);
}
@@ -210,8 +210,8 @@ _DEFUN(_mktemp_r, (ptr, path),
#ifndef _REENT_ONLY
int
-_DEFUN(mkstemp, (path),
- char *path)
+_DEFUN (mkstemp, (path),
+ char *path)
{
int fd;
@@ -219,8 +219,8 @@ _DEFUN(mkstemp, (path),
}
char *
-_DEFUN(mktemp, (path),
- char *path)
+_DEFUN (mktemp, (path),
+ char *path)
{
return (_gettemp (_REENT, path, (int *) NULL) ? path : (char *) NULL);
}
diff --git a/newlib/libc/stdio/perror.c b/newlib/libc/stdio/perror.c
index 5dbf3326c..19354c112 100644
--- a/newlib/libc/stdio/perror.c
+++ b/newlib/libc/stdio/perror.c
@@ -1,21 +1,4 @@
/*
- * 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
<<perror>>---print an error message on standard error
@@ -28,7 +11,7 @@ ANSI_SYNOPSIS
#include <stdio.h>
void perror(char *<[prefix]>);
- void _perror_r(struct _reent *<[reent]>, char *<[prefix]>);
+ void _perror_r(void *<[reent]>, char *<[prefix]>);
TRAD_SYNOPSIS
#include <stdio.h>
@@ -36,7 +19,7 @@ TRAD_SYNOPSIS
char *<[prefix]>;
void _perror_r(<[reent]>, <[prefix]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[prefix]>;
DESCRIPTION
@@ -50,6 +33,7 @@ of the strings described for <<strerror>>.
The alternate function <<_perror_r>> is a reentrant version. The
extra argument <[reent]> is a pointer to a reentrancy structure.
+
RETURNS
<<perror>> returns no result.
@@ -61,20 +45,20 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
-#include <_ansi.h>
-#include <reent.h>
+#include <stddef.h>
#include <stdio.h>
#include <string.h>
+
#include "local.h"
-_VOID
-_DEFUN(_perror_r, (ptr, s),
- struct _reent *ptr _AND
- _CONST char *s)
+void
+_DEFUN (_perror_r, (ptr, s),
+ struct _reent *ptr _AND
+ _CONST char *s)
{
char *error;
- _REENT_SMALL_CHECK_INIT (ptr);
+ _REENT_SMALL_CHECK_INIT(_stderr_r (ptr));
if (s != NULL && *s != '\0')
{
fputs (s, _stderr_r (ptr));
@@ -89,9 +73,9 @@ _DEFUN(_perror_r, (ptr, s),
#ifndef _REENT_ONLY
-_VOID
-_DEFUN(perror, (s),
- _CONST char *s)
+void
+_DEFUN (perror, (s),
+ _CONST char *s)
{
_perror_r (_REENT, s);
}
diff --git a/newlib/libc/stdio/printf.c b/newlib/libc/stdio/printf.c
index 19f465e34..da4cb8ee8 100644
--- a/newlib/libc/stdio/printf.c
+++ b/newlib/libc/stdio/printf.c
@@ -1,45 +1,30 @@
-/*
- * 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.
- */
#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
+
+#include "local.h"
+
#ifdef _HAVE_STDC
#include <stdarg.h>
#else
#include <varargs.h>
#endif
-#include "local.h"
#ifdef _HAVE_STDC
int
-_printf_r(struct _reent *ptr, _CONST char *fmt, ...)
+_printf_r (struct _reent *ptr, const char *fmt, ...)
#else
int
-_printf_r(ptr, fmt, va_alist)
- struct _reent *ptr;
- char *fmt;
- va_dcl
+_printf_r (ptr, fmt, va_alist)
+ struct _reent *ptr;
+ char *fmt;
+ va_dcl
#endif
{
int ret;
va_list ap;
- _REENT_SMALL_CHECK_INIT (ptr);
+ _REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
#ifdef _HAVE_STDC
va_start (ap, fmt);
#else
@@ -54,18 +39,18 @@ _printf_r(ptr, fmt, va_alist)
#ifdef _HAVE_STDC
int
-printf(_CONST char *fmt, ...)
+printf (const char *fmt, ...)
#else
int
-printf(fmt, va_alist)
- char *fmt;
- va_dcl
+printf (fmt, va_alist)
+ char *fmt;
+ va_dcl
#endif
{
int ret;
va_list ap;
- _REENT_SMALL_CHECK_INIT (_REENT);
+ _REENT_SMALL_CHECK_INIT(_stdout_r (_REENT));
#ifdef _HAVE_STDC
va_start (ap, fmt);
#else
diff --git a/newlib/libc/stdio/putc.c b/newlib/libc/stdio/putc.c
index 097323417..7e53868ab 100644
--- a/newlib/libc/stdio/putc.c
+++ b/newlib/libc/stdio/putc.c
@@ -65,9 +65,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
#include <stdio.h>
-#include "local.h"
/*
* A subroutine version of the macro putc.
@@ -76,14 +74,14 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#undef putc
int
-_DEFUN(putc, (c, fp),
- int c _AND
- register FILE *fp)
+putc (c, fp)
+ int c;
+ register FILE *fp;
{
int result;
- CHECK_INIT (_REENT);
- _flockfile (fp);
+ _flockfile(fp);
+ /* CHECK_INIT is (eventually) called by __swbuf. */
result = __sputc (c, fp);
- _funlockfile (fp);
+ _funlockfile(fp);
return result;
}
diff --git a/newlib/libc/stdio/putc_u.c b/newlib/libc/stdio/putc_u.c
index aee11f4e7..a3c0e0864 100644
--- a/newlib/libc/stdio/putc_u.c
+++ b/newlib/libc/stdio/putc_u.c
@@ -44,14 +44,12 @@ POSIX 1003.1 requires <<putc_unlocked>>. <<putc_unlocked>> may be
implemented as a macro, so arguments should not have side-effects.
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
-<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
-*/
+<<lseek>>, <<read>>, <<sbrk>>, <<write>>. */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
#include <stdio.h>
/*
@@ -61,9 +59,9 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#undef putc_unlocked
int
-_DEFUN(putc_unlocked, (c, fp),
- int c _AND
- register FILE *fp)
+putc_unlocked (c, fp)
+ int c;
+ register FILE *fp;
{
/* CHECK_INIT is (eventually) called by __swbuf. */
diff --git a/newlib/libc/stdio/putchar.c b/newlib/libc/stdio/putchar.c
index e1d748ae2..ff207f3d0 100644
--- a/newlib/libc/stdio/putchar.c
+++ b/newlib/libc/stdio/putchar.c
@@ -28,7 +28,7 @@ ANSI_SYNOPSIS
#include <stdio.h>
int putchar(int <[ch]>);
- int _putchar_r(struct _reent *<[reent]>, int <[ch]>);
+ int _putchar_r(void *<[reent]>, int <[ch]>);
TRAD_SYNOPSIS
#include <stdio.h>
@@ -36,7 +36,7 @@ TRAD_SYNOPSIS
int <[ch]>;
int _putchar_r(<[reent]>, <[ch]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
int <[ch]>;
DESCRIPTION
@@ -68,27 +68,26 @@ static char sccsid[] = "%W% (Berkeley) %G%";
* A subroutine version of the macro putchar.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
+
#include "local.h"
#undef putchar
int
-_DEFUN(_putchar_r, (ptr, c),
- struct _reent *ptr _AND
- int c)
+_putchar_r (ptr, c)
+ struct _reent *ptr;
+ int c;
{
- _REENT_SMALL_CHECK_INIT (ptr);
+ _REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
return putc (c, _stdout_r (ptr));
}
#ifndef _REENT_ONLY
int
-_DEFUN(putchar, (c),
- int c)
+putchar (c)
+ int c;
{
/* CHECK_INIT is (eventually) called by __swbuf. */
diff --git a/newlib/libc/stdio/putchar_u.c b/newlib/libc/stdio/putchar_u.c
index 423ad77f1..3542fe443 100644
--- a/newlib/libc/stdio/putchar_u.c
+++ b/newlib/libc/stdio/putchar_u.c
@@ -54,16 +54,14 @@ static char sccsid[] = "%W% (Berkeley) %G%";
* A subroutine version of the macro putchar_unlocked.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#undef putchar_unlocked
int
-_DEFUN(_putchar_unlocked_r, (ptr, c),
- struct _reent *ptr _AND
- int c)
+_putchar_unlocked_r (ptr, c)
+ struct _reent *ptr;
+ int c;
{
return putc_unlocked (c, _stdout_r (ptr));
}
@@ -71,12 +69,12 @@ _DEFUN(_putchar_unlocked_r, (ptr, c),
#ifndef _REENT_ONLY
int
-_DEFUN(putchar_unlocked, (c),
- int c)
+putchar_unlocked (c)
+ int c;
{
/* CHECK_INIT is (eventually) called by __swbuf. */
- return _putchar_unlocked_r (_REENT, c);
+ _putchar_unlocked_r (_REENT, c);
}
#endif
diff --git a/newlib/libc/stdio/puts.c b/newlib/libc/stdio/puts.c
index bf32d0401..e270199d2 100644
--- a/newlib/libc/stdio/puts.c
+++ b/newlib/libc/stdio/puts.c
@@ -28,7 +28,7 @@ ANSI_SYNOPSIS
#include <stdio.h>
int puts(const char *<[s]>);
- int _puts_r(struct _reent *<[reent]>, const char *<[s]>);
+ int _puts_r(void *<[reent]>, const char *<[s]>);
TRAD_SYNOPSIS
#include <stdio.h>
@@ -36,7 +36,7 @@ TRAD_SYNOPSIS
char *<[s]>;
int _puts_r(<[reent]>, <[s]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[s]>;
DESCRIPTION
@@ -55,17 +55,15 @@ ANSI C requires <<puts>>, but does not specify that the result on
success must be <<0>>; any non-negative value is permitted.
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
-<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
-*/
+<<lseek>>, <<read>>, <<sbrk>>, <<write>>. */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#include <string.h>
+
#include "fvwrite.h"
#include "local.h"
@@ -74,9 +72,9 @@ static char sccsid[] = "%W% (Berkeley) %G%";
*/
int
-_DEFUN(_puts_r, (ptr, s),
- struct _reent *ptr _AND
- _CONST char * s)
+_DEFUN (_puts_r, (ptr, s),
+ struct _reent *ptr _AND
+ _CONST char * s)
{
size_t c = strlen (s);
struct __suio uio;
@@ -90,15 +88,15 @@ _DEFUN(_puts_r, (ptr, s),
uio.uio_iov = &iov[0];
uio.uio_iovcnt = 2;
- _REENT_SMALL_CHECK_INIT (ptr);
+ _REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
return (__sfvwrite (_stdout_r (ptr), &uio) ? EOF : '\n');
}
#ifndef _REENT_ONLY
int
-_DEFUN(puts, (s),
- char _CONST * s)
+_DEFUN (puts, (s),
+ char _CONST * s)
{
return _puts_r (_REENT, s);
}
diff --git a/newlib/libc/stdio/putw.c b/newlib/libc/stdio/putw.c
index 682015c0a..19f4abc01 100644
--- a/newlib/libc/stdio/putw.c
+++ b/newlib/libc/stdio/putw.c
@@ -37,16 +37,14 @@ DESCRIPTION
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
-Zero on success, <<EOF>> on failure.
+RETURNS Zero on success, <<EOF>> on failure.
PORTABILITY
-<<putw>> is a remnant of K&R C; it is not part of any ISO C Standard.
+<<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>>.
-*/
+Supporting OS subroutines required: <<fwrite>>. */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%";
@@ -55,11 +53,11 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#include <stdio.h>
int
-_DEFUN(putw, (w, fp),
- int w _AND
- register FILE *fp)
+putw (w, fp)
+ int w;
+ register FILE *fp;
{
- if (fwrite ((_CONST char*)&w, sizeof (w), 1, fp) != 1)
+ if (fwrite((const char*)&w, sizeof(w), 1, fp) != 1)
return EOF;
return 0;
}
diff --git a/newlib/libc/stdio/refill.c b/newlib/libc/stdio/refill.c
index 639ce6e24..66ce4ca22 100644
--- a/newlib/libc/stdio/refill.c
+++ b/newlib/libc/stdio/refill.c
@@ -1,3 +1,5 @@
+/* No user fns here. Pesch 15apr92. */
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -14,16 +16,14 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* No user fns here. Pesch 15apr92. */
-#include <_ansi.h>
#include <stdio.h>
-#include <stdlib.h>
#include "local.h"
+#include <stdlib.h>
static int
-_DEFUN(lflush, (fp),
- FILE *fp)
+lflush (fp)
+ FILE *fp;
{
if ((fp->_flags & (__SLBF | __SWR)) == (__SLBF | __SWR))
return fflush (fp);
@@ -36,20 +36,18 @@ _DEFUN(lflush, (fp),
*/
int
-_DEFUN(__srefill, (fp),
- register FILE * fp)
+_DEFUN (__srefill, (fp),
+ register FILE * fp)
{
/* make sure stdio is set up */
- CHECK_INIT (_REENT);
+ CHECK_INIT (fp);
fp->_r = 0; /* largely a convenience for callers */
-#ifndef __CYGWIN__
/* SysV does not make this test; take it out for compatibility */
if (fp->_flags & __SEOF)
return EOF;
-#endif
/* if not already reading, have to be reading and writing */
if ((fp->_flags & __SRD) == 0)
@@ -96,17 +94,11 @@ _DEFUN(__srefill, (fp),
*/
if (fp->_flags & (__SLBF | __SNBF))
- _CAST_VOID _fwalk (_GLOBAL_REENT, lflush);
+ (void) _fwalk (_GLOBAL_REENT, lflush);
fp->_p = fp->_bf._base;
fp->_r = (*fp->_read) (fp->_cookie, (char *) fp->_p, fp->_bf._size);
fp->_flags &= ~__SMOD; /* buffer contents are again pristine */
-#ifndef __CYGWIN__
if (fp->_r <= 0)
-#else
- if (fp->_r > 0)
- fp->_flags &= ~__SEOF;
- else
-#endif
{
if (fp->_r == 0)
fp->_flags |= __SEOF;
diff --git a/newlib/libc/stdio/remove.c b/newlib/libc/stdio/remove.c
index e026ce567..b24ce713f 100644
--- a/newlib/libc/stdio/remove.c
+++ b/newlib/libc/stdio/remove.c
@@ -1,21 +1,4 @@
/*
- * 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
<<remove>>---delete a file's name
@@ -26,7 +9,7 @@ ANSI_SYNOPSIS
#include <stdio.h>
int remove(char *<[filename]>);
- int _remove_r(struct _reent *<[reent]>, char *<[filename]>);
+ int _remove_r(void *<[reent]>, char *<[filename]>);
TRAD_SYNOPSIS
#include <stdio.h>
@@ -34,7 +17,7 @@ TRAD_SYNOPSIS
char *<[filename]>;
int _remove_r(<[reent]>, <[filename]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[filename]>;
DESCRIPTION
@@ -61,14 +44,13 @@ open file may vary among implementations.
Supporting OS subroutine required: <<unlink>>.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
+#include <reent.h>
int
-_DEFUN(_remove_r, (ptr, filename),
- struct _reent *ptr _AND
- _CONST char *filename)
+_remove_r (ptr, filename)
+ struct _reent *ptr;
+ _CONST char *filename;
{
if (_unlink_r (ptr, filename) == -1)
return -1;
@@ -79,8 +61,8 @@ _DEFUN(_remove_r, (ptr, filename),
#ifndef _REENT_ONLY
int
-_DEFUN(remove, (filename),
- _CONST char *filename)
+remove (filename)
+ _CONST char *filename;
{
return _remove_r (_REENT, filename);
}
diff --git a/newlib/libc/stdio/rename.c b/newlib/libc/stdio/rename.c
index 4fa8e39a2..19a6afdd3 100644
--- a/newlib/libc/stdio/rename.c
+++ b/newlib/libc/stdio/rename.c
@@ -1,21 +1,4 @@
/*
- * 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
<<rename>>---rename a file
@@ -28,7 +11,7 @@ ANSI_SYNOPSIS
#include <stdio.h>
int rename(const char *<[old]>, const char *<[new]>);
- int _rename_r(struct _reent *<[reent]>,
+ int _rename_r(void *<[reent]>,
const char *<[old]>, const char *<[new]>);
TRAD_SYNOPSIS
@@ -38,7 +21,7 @@ TRAD_SYNOPSIS
char *<[new]>;
int _rename_r(<[reent]>, <[old]>, <[new]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[old]>;
char *<[new]>;
@@ -65,16 +48,15 @@ as <<*<[new]>>> may vary from one implementation to another.
Supporting OS subroutines required: <<link>>, <<unlink>>, or <<rename>>.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#include <sys/unistd.h>
+#include <reent.h>
int
-_DEFUN(_rename_r, (ptr, old, new),
- struct _reent *ptr _AND
- _CONST char *old _AND
- _CONST char *new)
+_rename_r (ptr, old, new)
+ struct _reent *ptr;
+ _CONST char *old;
+ _CONST char *new;
{
#ifdef HAVE_RENAME
return _rename (old,new);
@@ -94,9 +76,9 @@ _DEFUN(_rename_r, (ptr, old, new),
#ifndef _REENT_ONLY
int
-_DEFUN(rename, (old, new),
- _CONST char *old _AND
- _CONST char *new)
+rename (old, new)
+ _CONST char *old;
+ _CONST char *new;
{
return _rename_r (_REENT, old, new);
}
diff --git a/newlib/libc/stdio/rewind.c b/newlib/libc/stdio/rewind.c
index 58f4cc3e8..2b9f3191f 100644
--- a/newlib/libc/stdio/rewind.c
+++ b/newlib/libc/stdio/rewind.c
@@ -56,26 +56,24 @@ No supporting OS subroutines are required.
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
-_VOID
-_DEFUN(_rewind_r, (ptr, fp),
- struct _reent * ptr _AND
- register FILE * fp)
+void
+_DEFUN (_rewind_r, (ptr, fp),
+ struct _reent * ptr _AND
+ register FILE * fp)
{
- _CAST_VOID _fseek_r (ptr, fp, 0L, SEEK_SET);
- clearerr (fp);
+ (void) _fseek_r (ptr, fp, 0L, SEEK_SET);
+ clearerr(fp);
}
#ifndef _REENT_ONLY
-_VOID
-_DEFUN(rewind, (fp),
- register FILE * fp)
+void
+_DEFUN (rewind, (fp),
+ register FILE * fp)
{
- _CAST_VOID _fseek_r (_REENT, fp, 0L, SEEK_SET);
+ (void) _fseek_r (_REENT, fp, 0L, SEEK_SET);
}
#endif /* !_REENT_ONLY */
diff --git a/newlib/libc/stdio/rget.c b/newlib/libc/stdio/rget.c
index ee4e49ec9..ea29c2bce 100644
--- a/newlib/libc/stdio/rget.c
+++ b/newlib/libc/stdio/rget.c
@@ -1,3 +1,5 @@
+/* No user fns here. Pesch 15apr92. */
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -14,13 +16,11 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* No user fns here. Pesch 15apr92. */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
#include <stdio.h>
#include "local.h"
@@ -31,8 +31,8 @@ static char sccsid[] = "%W% (Berkeley) %G%";
*/
int
-_DEFUN(__srget, (fp),
- register FILE *fp)
+__srget (fp)
+ register FILE *fp;
{
if (__srefill (fp) == 0)
{
diff --git a/newlib/libc/stdio/scanf.c b/newlib/libc/stdio/scanf.c
index cf1472ba7..de8e038fc 100644
--- a/newlib/libc/stdio/scanf.c
+++ b/newlib/libc/stdio/scanf.c
@@ -16,30 +16,30 @@
*/
#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
+#include "local.h"
+
#ifdef _HAVE_STDC
#include <stdarg.h>
#else
#include <varargs.h>
#endif
-#include "local.h"
#ifndef _REENT_ONLY
int
#ifdef _HAVE_STDC
-scanf(_CONST char *fmt, ...)
+scanf (const char *fmt, ...)
#else
-scanf(fmt, va_alist)
- char *fmt;
- va_dcl
+scanf (fmt, va_alist)
+ char *fmt;
+ va_dcl
#endif
{
int ret;
va_list ap;
- _REENT_SMALL_CHECK_INIT (_REENT);
+ _REENT_SMALL_CHECK_INIT(_stdin_r (_REENT));
#ifdef _HAVE_STDC
va_start (ap, fmt);
#else
@@ -54,18 +54,18 @@ scanf(fmt, va_alist)
int
#ifdef _HAVE_STDC
-_scanf_r(struct _reent *ptr, _CONST char *fmt, ...)
+_scanf_r (struct _reent *ptr, const char *fmt, ...)
#else
-_scanf_r(ptr, fmt, va_alist)
- struct _reent *ptr;
- char *fmt;
- va_dcl
+_scanf_r (ptr, fmt, va_alist)
+ struct _reent *ptr;
+ char *fmt;
+ va_dcl
#endif
{
int ret;
va_list ap;
- _REENT_SMALL_CHECK_INIT (ptr);
+ _REENT_SMALL_CHECK_INIT(_stdin_r (ptr));
#ifdef _HAVE_STDC
va_start (ap, fmt);
#else
@@ -76,3 +76,4 @@ _scanf_r(ptr, fmt, va_alist)
return (ret);
}
+
diff --git a/newlib/libc/stdio/sccl.c b/newlib/libc/stdio/sccl.c
deleted file mode 100644
index b01801145..000000000
--- a/newlib/libc/stdio/sccl.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*-
- * 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.
- */
-
-/* Split from vfscanf.c */
-
-#include <_ansi.h>
-#include <reent.h>
-#include <newlib.h>
-#include <stdio.h>
-#include "local.h"
-
-/*
- * Fill in the given table from the scanset at the given format
- * (just after `['). Return a pointer to the character past the
- * closing `]'. The table has a 1 wherever characters should be
- * considered part of the scanset.
- */
-
-u_char *
-_DEFUN(__sccl, (tab, fmt),
- register char *tab _AND
- register u_char *fmt)
-{
- register int c, n, v;
-
- /* first `clear' the whole table */
- c = *fmt++; /* first char hat => negated scanset */
- if (c == '^')
- {
- v = 1; /* default => accept */
- c = *fmt++; /* get new first char */
- }
- else
- v = 0; /* default => reject */
- /* should probably use memset here */
- for (n = 0; n < 256; n++)
- tab[n] = v;
- if (c == 0)
- return fmt - 1; /* format ended before closing ] */
-
- /*
- * Now set the entries corresponding to the actual scanset to the
- * opposite of the above.
- *
- * The first character may be ']' (or '-') without being special; the
- * last character may be '-'.
- */
-
- v = 1 - v;
- for (;;)
- {
- tab[c] = v; /* take character c */
- doswitch:
- n = *fmt++; /* and examine the next */
- switch (n)
- {
-
- case 0: /* format ended too soon */
- return fmt - 1;
-
- case '-':
- /*
- * A scanset of the form [01+-] is defined as `the digit 0, the
- * digit 1, the character +, the character -', but the effect of a
- * scanset such as [a-zA-Z0-9] is implementation defined. The V7
- * Unix scanf treats `a-z' as `the letters a through z', but treats
- * `a-a' as `the letter a, the character -, and the letter a'.
- *
- * For compatibility, the `-' is not considerd to define a range if
- * the character following it is either a close bracket (required by
- * ANSI) or is not numerically greater than the character we just
- * stored in the table (c).
- */
- n = *fmt;
- if (n == ']' || n < c)
- {
- c = '-';
- break; /* resume the for(;;) */
- }
- fmt++;
- do
- { /* fill in the range */
- tab[++c] = v;
- }
- while (c < n);
-#if 1 /* XXX another disgusting compatibility hack */
- /*
- * Alas, the V7 Unix scanf also treats formats such
- * as [a-c-e] as `the letters a through e'. This too
- * is permitted by the standard....
- */
- goto doswitch;
-#else
- c = *fmt++;
- if (c == 0)
- return fmt - 1;
- if (c == ']')
- return fmt;
-#endif
-
- break;
-
-
- case ']': /* end of scanset */
- return fmt;
-
- default: /* just another character */
- c = n;
- break;
- }
- }
- /* NOTREACHED */
-}
diff --git a/newlib/libc/stdio/setbuf.c b/newlib/libc/stdio/setbuf.c
index 1a8bc6de1..15d09e0f3 100644
--- a/newlib/libc/stdio/setbuf.c
+++ b/newlib/libc/stdio/setbuf.c
@@ -70,10 +70,10 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include <stdio.h>
#include "local.h"
-_VOID
-_DEFUN(setbuf, (fp, buf),
- FILE * fp _AND
- char *buf)
+void
+_DEFUN (setbuf, (fp, buf),
+ FILE * fp _AND
+ char *buf)
{
- _CAST_VOID setvbuf (fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
+ (void) setvbuf (fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
}
diff --git a/newlib/libc/stdio/setbuffer.c b/newlib/libc/stdio/setbuffer.c
index e88187446..c74c7fce1 100644
--- a/newlib/libc/stdio/setbuffer.c
+++ b/newlib/libc/stdio/setbuffer.c
@@ -14,6 +14,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
+
/*
Modified copy of setbuf.c to support the setbuffer function
defined as part of BSD.
@@ -65,17 +66,53 @@ This function comes from BSD not ANSI or POSIX.
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
+
+
+FUNCTION
+
+<<setlinebuf>>---specify line buffering for a file or stream
+
+INDEX
+ setlinebuf
+
+ANSI_SYNOPSIS
+ #include <stdio.h>
+ void setlinebuf(FILE *<[fp]>);
+
+TRAD_SYNOPSIS
+ #include <stdio.h>
+ void setlinebuf(<[fp]>)
+ FILE *<[fp]>;
+
+DESCRIPTION
+<<setlinebuf>> specifies that output to the file or stream identified by
+<[fp]> should be line buffered. This causes the file or stream to pass
+on output to the host system at every newline, as well as when the
+buffer is full, or when an input operation intervenes.
+
+WARNINGS
+You may only use <<setlinebuf>> before performing any file operation
+other than opening the file.
+
+RETURNS
+<<setlinebuf>> returns as per setvbuf.
+
+PORTABILITY
+This function comes from BSD not ANSI or POSIX.
+
+Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
+<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
#include <_ansi.h>
#include <stdio.h>
#include "local.h"
-_VOID
-_DEFUN(setbuffer, (fp, buf, size),
- FILE * fp _AND
- char *buf _AND
- int size)
+void
+_DEFUN (setbuffer, (fp, buf, size),
+ FILE * fp _AND
+ char *buf _AND
+ int size)
{
- _CAST_VOID setvbuf (fp, buf, buf ? _IOFBF : _IONBF, (size_t) size);
+ (void) setvbuf (fp, buf, buf ? _IOFBF : _IONBF, (size_t) size);
}
diff --git a/newlib/libc/stdio/setlinebuf.c b/newlib/libc/stdio/setlinebuf.c
index 0df6a579a..f27971357 100644
--- a/newlib/libc/stdio/setlinebuf.c
+++ b/newlib/libc/stdio/setlinebuf.c
@@ -14,6 +14,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
+
/*
Modified copy of setbuf.c to support setlinebuf function
defined as part of BSD.
@@ -22,6 +23,7 @@ Modifications by Gareth Pearce, 2001.
/*
FUNCTION
+
<<setlinebuf>>---specify line buffering for a file or stream
INDEX
@@ -61,8 +63,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include "local.h"
int
-_DEFUN(setlinebuf, (fp),
- FILE * fp)
+_DEFUN (setlinebuf, (fp),
+ FILE * fp)
{
return (setvbuf (fp, (char *) NULL, _IOLBF, (size_t) 0));
}
diff --git a/newlib/libc/stdio/setvbuf.c b/newlib/libc/stdio/setvbuf.c
index f6871c59d..74a4ceaf2 100644
--- a/newlib/libc/stdio/setvbuf.c
+++ b/newlib/libc/stdio/setvbuf.c
@@ -96,17 +96,17 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
*/
int
-_DEFUN(setvbuf, (fp, buf, mode, size),
- register FILE * fp _AND
- char *buf _AND
- register int mode _AND
- register size_t size)
+_DEFUN (setvbuf, (fp, buf, mode, size),
+ register FILE * fp _AND
+ char *buf _AND
+ register int mode _AND
+ register size_t size)
{
int ret = 0;
- CHECK_INIT (_REENT);
+ _flockfile(fp);
- _flockfile (fp);
+ CHECK_INIT (fp);
/*
* Verify arguments. The `int' limit on `size' is due to this
@@ -115,7 +115,7 @@ _DEFUN(setvbuf, (fp, buf, mode, size),
if ((mode != _IOFBF && mode != _IOLBF && mode != _IONBF) || (int)(_POINTER_INT) size < 0)
{
- _funlockfile (fp);
+ _funlockfile(fp);
return (EOF);
}
@@ -126,11 +126,11 @@ _DEFUN(setvbuf, (fp, buf, mode, size),
* non buffer flags, and clear malloc flag.
*/
- _CAST_VOID fflush (fp);
+ (void) fflush (fp);
fp->_r = 0;
fp->_lbfsize = 0;
if (fp->_flags & __SMBF)
- _free_r (_REENT, (_PTR) fp->_bf._base);
+ _free_r (_REENT, (void *) fp->_bf._base);
fp->_flags &= ~(__SLBF | __SNBF | __SMBF);
if (mode == _IONBF)
@@ -158,7 +158,7 @@ nbf:
fp->_w = 0;
fp->_bf._base = fp->_p = fp->_nbuf;
fp->_bf._size = 1;
- _funlockfile (fp);
+ _funlockfile(fp);
return (ret);
}
fp->_flags |= __SMBF;
@@ -193,6 +193,6 @@ nbf:
if (fp->_flags & __SWR)
fp->_w = fp->_flags & (__SLBF | __SNBF) ? 0 : size;
- _funlockfile (fp);
+ _funlockfile(fp);
return 0;
}
diff --git a/newlib/libc/stdio/siprintf.c b/newlib/libc/stdio/siprintf.c
index 4e8e95aaa..aeced2e53 100644
--- a/newlib/libc/stdio/siprintf.c
+++ b/newlib/libc/stdio/siprintf.c
@@ -1,92 +1,34 @@
/*
- * 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
- <<iprintf>>, <<fiprintf>>, <<asiprintf>>, <<siprintf>>, <<sniprintf>>---format output
-
-INDEX
- fiprintf
-INDEX
- iprintf
-INDEX
- asiprintf
+ <<siprintf>>---write formatted output (integer only)
INDEX
siprintf
-INDEX
- sniprintf
ANSI_SYNOPSIS
#include <stdio.h>
- int iprintf(const char *<[format]> [, <[arg]>, ...]);
- int fiprintf(FILE *<[fd]>, const char *<[format]> [, <[arg]>, ...]);
int siprintf(char *<[str]>, const char *<[format]> [, <[arg]>, ...]);
- int asiprintf(char **<[strp]>, const char *<[format]> [, <[arg]>, ...]);
- int sniprintf(char *<[str]>, size_t <[size]>, const char *<[format]>
- [, <[arg]>, ...]);
-
-TRAD_SYNOPSIS
- #include <stdio.h>
-
- int iprintf(<[format]> [, <[arg]>, ...])
- char *<[format]>;
-
- int fiprintf(<[fd]>, <[format]> [, <[arg]>, ...]);
- FILE *<[fd]>;
- char *<[format]>;
-
- int asiprintf(<[strp]>, <[format]> [, <[arg]>, ...]);
- char **<[strp]>;
- char *<[format]>;
- int siprintf(<[str]>, <[format]> [, <[arg]>, ...]);
- char *<[str]>;
- char *<[format]>;
-
- int sniprintf(<[str]>, size_t <[size]>, <[format]> [, <[arg]>, ...]);
- char *<[str]>;
- size_t <[size]>;
- char *<[format]>;
DESCRIPTION
- <<iprintf>>, <<fiprintf>>, <<siprintf>>, <<sniprintf>>,
- <<asiprintf>>, are the same as <<printf>>, <<fprintf>>,
- <<sprintf>>, <<snprintf>>, and <<asprintf>>, respectively,
- only that they restrict usage to non-floating-point format
- specifiers.
+<<siprintf>> is a restricted version of <<sprintf>>: it has the same
+arguments and behavior, save that it cannot perform any floating-point
+formatting: the <<f>>, <<g>>, <<G>>, <<e>>, and <<F>> type specifiers
+are not recognized.
RETURNS
-<<siprintf>> and <<asiprintf>> return the number of bytes in the output string,
-save that the concluding <<NULL>> is not counted.
-<<iprintf>> and <<fiprintf>> return the number of characters transmitted.
-If an error occurs, <<iprintf>> and <<fiprintf>> return <<EOF>> and
-<<asiprintf>> returns -1. No error returns occur for <<siprintf>>.
+ <<siprintf>> returns the number of bytes in the output string,
+ save that the concluding <<NULL>> is not counted.
+ <<siprintf>> returns when the end of the format string is
+ encountered.
PORTABILITY
-<<iprintf>>, <<fiprintf>>, <<siprintf>>, <<sniprintf>>, and <<asprintf>>
-are newlib extensions.
+<<siprintf>> is not required by ANSI C.
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#ifdef _HAVE_STDC
#include <stdarg.h>
@@ -94,20 +36,18 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include <varargs.h>
#endif
#include <limits.h>
+#include <_ansi.h>
+#include <reent.h>
#include "local.h"
int
#ifdef _HAVE_STDC
-_DEFUN(_siprintf_r, (ptr, str, fmt),
- struct _reent *ptr _AND
- char *str _AND
- _CONST char *fmt _DOTS)
+_DEFUN (siprintf, (str, fmt), char *str _AND _CONST char *fmt _DOTS)
#else
-_siprintf_r(ptr, str, fmt, va_alist)
- struct _reent *ptr;
- char *str;
- _CONST char *fmt;
- va_dcl
+siprintf (str, fmt, va_alist)
+ char *str;
+ _CONST char *fmt;
+ va_dcl
#endif
{
int ret;
@@ -117,49 +57,13 @@ _siprintf_r(ptr, str, fmt, va_alist)
f._flags = __SWR | __SSTR;
f._bf._base = f._p = (unsigned char *) str;
f._bf._size = f._w = INT_MAX;
- f._file = -1; /* No file. */
#ifdef _HAVE_STDC
va_start (ap, fmt);
#else
va_start (ap);
#endif
- ret = _vfiprintf_r (ptr, &f, fmt, ap);
+ ret = vfiprintf (&f, fmt, ap);
va_end (ap);
*f._p = 0;
return (ret);
}
-
-#ifndef _REENT_ONLY
-
-int
-#ifdef _HAVE_STDC
-_DEFUN(siprintf, (str, fmt),
- char *str _AND
- _CONST char *fmt _DOTS)
-#else
-siprintf(str, fmt, va_alist)
- char *str;
- _CONST char *fmt;
- va_dcl
-#endif
-{
- int ret;
- va_list ap;
- FILE f;
-
- f._flags = __SWR | __SSTR;
- f._bf._base = f._p = (unsigned char *) str;
- f._bf._size = f._w = INT_MAX;
- f._file = -1; /* No file. */
-#ifdef _HAVE_STDC
- va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = _vfiprintf_r (_REENT, &f, fmt, ap);
- va_end (ap);
- *f._p = 0;
- return (ret);
-}
-
-#endif
diff --git a/newlib/libc/stdio/siscanf.c b/newlib/libc/stdio/siscanf.c
deleted file mode 100644
index 694750dae..000000000
--- a/newlib/libc/stdio/siscanf.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * 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
-<<iscanf>>, <<fiscanf>>, <<siscanf>>---scan and format non-floating input
-
-INDEX
- iscanf
-INDEX
- fiscanf
-INDEX
- siscanf
-
-ANSI_SYNOPSIS
- #include <stdio.h>
-
- int iscanf(const char *<[format]> [, <[arg]>, ...]);
- int fiscanf(FILE *<[fd]>, const char *<[format]> [, <[arg]>, ...]);
- int siscanf(const char *<[str]>, const char *<[format]>
- [, <[arg]>, ...]);
-
- int _iscanf_r(struct _reent *<[ptr]>, const char *<[format]>
- [, <[arg]>, ...]);
- int _fiscanf_r(struct _reent *<[ptr]>, FILE *<[fd]>, const char *<[format]>
- [, <[arg]>, ...]);
- int _siscanf_r(struct _reent *<[ptr]>, const char *<[str]>,
- const char *<[format]> [, <[arg]>, ...]);
-
-
-TRAD_SYNOPSIS
- #include <stdio.h>
-
- int iscanf(<[format]> [, <[arg]>, ...])
- char *<[format]>;
-
- int fiscanf(<[fd]>, <[format]> [, <[arg]>, ...]);
- FILE *<[fd]>;
- char *<[format]>;
-
- int siscanf(<[str]>, <[format]> [, <[arg]>, ...]);
- char *<[str]>;
- char *<[format]>;
-
- int _iscanf_r(<[ptr]>, <[format]> [, <[arg]>, ...])
- struct _reent *<[ptr]>;
- char *<[format]>;
-
- int _fiscanf_r(<[ptr]>, <[fd]>, <[format]> [, <[arg]>, ...]);
- struct _reent *<[ptr]>;
- FILE *<[fd]>;
- char *<[format]>;
-
- int _siscanf_r(<[ptr]>, <[str]>, <[format]> [, <[arg]>, ...]);
- struct _reent *<[ptr]>;
- char *<[str]>;
- char *<[format]>;
-
-
-DESCRIPTION
- <<iscanf>>, <<fiscanf>>, and <<siscanf>> are the same as
- <<scanf>>, <<fscanf>>, and <<sscanf>> respectively, only that
- they restrict the available formats to non-floating-point
- format specifiers.
-
- The routines <<_iscanf_r>>, <<_fiscanf_r>>, and <<_siscanf_r>> are reentrant
- versions of <<iscanf>>, <<fiscanf>>, and <<siscanf>> that take an additional
- first argument pointing to a reentrancy structure.
-
-RETURNS
- <<iscanf>> returns the number of input fields successfully
- scanned, converted and stored; the return value does
- not include scanned fields which were not stored.
-
- If <<iscanf>> attempts to read at end-of-file, the return
- value is <<EOF>>.
-
- If no fields were stored, the return value is <<0>>.
-
-PORTABILITY
-<<iscanf>>, <<fiscanf>>, and <<siscanf>> are newlib extensions.
-
-Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
-<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
-*/
-
-#include <_ansi.h>
-#include <reent.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include "local.h"
-
-/* | ARGSUSED */
-/*SUPPRESS 590*/
-static _READ_WRITE_RETURN_TYPE
-_DEFUN(eofread, (cookie, buf, len),
- _PTR cookie _AND
- char *buf _AND
- int len)
-{
- return 0;
-}
-
-#ifndef _REENT_ONLY
-
-#ifdef _HAVE_STDC
-int
-_DEFUN(siscanf, (str, fmt),
- _CONST char *str _AND
- _CONST char *fmt _DOTS)
-#else
-int
-siscanf(str, fmt, va_alist)
- _CONST char *str;
- _CONST char *fmt;
- va_dcl
-#endif
-{
- int ret;
- va_list ap;
- FILE f;
-
- f._flags = __SRD | __SSTR;
- f._bf._base = f._p = (unsigned char *) str;
- f._bf._size = f._r = strlen (str);
- f._read = eofread;
- f._ub._base = NULL;
- f._lb._base = NULL;
- f._file = -1; /* No file. */
-#ifdef _HAVE_STDC
- va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = __svfiscanf_r (_REENT, &f, fmt, ap);
- va_end (ap);
- return ret;
-}
-
-#endif /* !_REENT_ONLY */
-
-#ifdef _HAVE_STDC
-int
-_DEFUN(_siscanf_r, (ptr, str, fmt),
- struct _reent *ptr _AND
- _CONST char *str _AND
- _CONST char *fmt _DOTS)
-#else
-int
-_siscanf_r(ptr, str, fmt, va_alist)
- struct _reent *ptr;
- _CONST char *str;
- _CONST char *fmt;
- va_dcl
-#endif
-{
- int ret;
- va_list ap;
- FILE f;
-
- f._flags = __SRD | __SSTR;
- f._bf._base = f._p = (unsigned char *) str;
- f._bf._size = f._r = strlen (str);
- f._read = eofread;
- f._ub._base = NULL;
- f._lb._base = NULL;
- f._file = -1; /* No file. */
-#ifdef _HAVE_STDC
- va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = __svfiscanf_r (ptr, &f, fmt, ap);
- va_end (ap);
- return ret;
-}
diff --git a/newlib/libc/stdio/sniprintf.c b/newlib/libc/stdio/sniprintf.c
deleted file mode 100644
index 7650cd080..000000000
--- a/newlib/libc/stdio/sniprintf.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.
- */
-
-/* This code created by modifying snprintf.c so copyright inherited. */
-
-#include <_ansi.h>
-#include <reent.h>
-#include <stdio.h>
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include <limits.h>
-#include "local.h"
-
-int
-#ifdef _HAVE_STDC
-_DEFUN (_sniprintf_r, (ptr, str, size, fmt),
- struct _reent *ptr _AND
- char *str _AND
- size_t size _AND
- _CONST char *fmt _DOTS)
-#else
-_sniprintf_r (ptr, str, size, fmt, va_alist)
- struct _reent *ptr;
- char *str;
- size_t size;
- _CONST char *fmt;
- va_dcl
-#endif
-{
- int ret;
- va_list ap;
- FILE f;
-
- f._flags = __SWR | __SSTR;
- f._bf._base = f._p = (unsigned char *) str;
- f._bf._size = f._w = (size > 0 ? size - 1 : 0);
- f._file = -1; /* No file. */
-#ifdef _HAVE_STDC
- va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = _vfiprintf_r (ptr, &f, fmt, ap);
- va_end (ap);
- if (size > 0)
- *f._p = 0;
- return (ret);
-}
-
-#ifndef _REENT_ONLY
-
-int
-#ifdef _HAVE_STDC
-_DEFUN (sniprintf, (str, size, fmt),
- char *str _AND
- size_t size _AND
- _CONST char *fmt _DOTS)
-#else
-sniprintf (str, size, fmt, va_alist)
- char *str;
- size_t size;
- _CONST char *fmt;
- va_dcl
-#endif
-{
- int ret;
- va_list ap;
- FILE f;
-
- f._flags = __SWR | __SSTR;
- f._bf._base = f._p = (unsigned char *) str;
- f._bf._size = f._w = (size > 0 ? size - 1 : 0);
- f._file = -1; /* No file. */
-#ifdef _HAVE_STDC
- va_start (ap, fmt);
-#else
- va_start (ap);
-#endif
- ret = _vfiprintf_r (_REENT, &f, fmt, ap);
- va_end (ap);
- if (size > 0)
- *f._p = 0;
- return (ret);
-}
-
-#endif
diff --git a/newlib/libc/stdio/snprintf.c b/newlib/libc/stdio/snprintf.c
index 9c5c7cbb4..fe54ea081 100644
--- a/newlib/libc/stdio/snprintf.c
+++ b/newlib/libc/stdio/snprintf.c
@@ -1,3 +1,7 @@
+/* doc in sprintf.c */
+
+/* This code created by modifying sprintf.c so copyright inherited. */
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -14,11 +18,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* doc in sprintf.c */
-/* This code created by modifying sprintf.c so copyright inherited. */
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#ifdef _HAVE_STDC
#include <stdarg.h>
@@ -26,22 +26,19 @@
#include <varargs.h>
#endif
#include <limits.h>
+#include <_ansi.h>
#include "local.h"
int
#ifdef _HAVE_STDC
-_DEFUN(_snprintf_r, (ptr, str, size, fmt),
- struct _reent *ptr _AND
- char *str _AND
- size_t size _AND
- _CONST char *fmt _DOTS)
+_DEFUN (_snprintf_r, (ptr, str, size, fmt), struct _reent *ptr _AND char *str _AND size_t size _AND _CONST char *fmt _DOTS)
#else
-_snprintf_r(ptr, str, size, fmt, va_alist)
- struct _reent *ptr;
- char *str;
- size_t size;
- _CONST char *fmt;
- va_dcl
+_snprintf_r (ptr, str, size, fmt, va_alist)
+ struct _reent *ptr;
+ char *str;
+ size_t size;
+ _CONST char *fmt;
+ va_dcl
#endif
{
int ret;
@@ -51,7 +48,6 @@ _snprintf_r(ptr, str, size, fmt, va_alist)
f._flags = __SWR | __SSTR;
f._bf._base = f._p = (unsigned char *) str;
f._bf._size = f._w = (size > 0 ? size - 1 : 0);
- f._file = -1; /* No file. */
#ifdef _HAVE_STDC
va_start (ap, fmt);
#else
@@ -68,16 +64,13 @@ _snprintf_r(ptr, str, size, fmt, va_alist)
int
#ifdef _HAVE_STDC
-_DEFUN(snprintf, (str, size, fmt),
- char *str _AND
- size_t size _AND
- _CONST char *fmt _DOTS)
+_DEFUN (snprintf, (str, size, fmt), char *str _AND size_t size _AND _CONST char *fmt _DOTS)
#else
-snprintf(str, size, fmt, va_alist)
- char *str;
- size_t size;
- _CONST char *fmt;
- va_dcl
+snprintf (str, size, fmt, va_alist)
+ char *str;
+ size_t size;
+ _CONST char *fmt;
+ va_dcl
#endif
{
int ret;
@@ -87,7 +80,6 @@ snprintf(str, size, fmt, va_alist)
f._flags = __SWR | __SSTR;
f._bf._base = f._p = (unsigned char *) str;
f._bf._size = f._w = (size > 0 ? size - 1 : 0);
- f._file = -1; /* No file. */
#ifdef _HAVE_STDC
va_start (ap, fmt);
#else
diff --git a/newlib/libc/stdio/sprintf.c b/newlib/libc/stdio/sprintf.c
index 346749a68..01be921aa 100644
--- a/newlib/libc/stdio/sprintf.c
+++ b/newlib/libc/stdio/sprintf.c
@@ -16,9 +16,9 @@
*/
/*
+
FUNCTION
<<printf>>, <<fprintf>>, <<asprintf>>, <<sprintf>>, <<snprintf>>---format output
-
INDEX
fprintf
INDEX
@@ -37,8 +37,7 @@ ANSI_SYNOPSIS
int fprintf(FILE *<[fd]>, const char *<[format]> [, <[arg]>, ...]);
int sprintf(char *<[str]>, const char *<[format]> [, <[arg]>, ...]);
int asprintf(char **<[strp]>, const char *<[format]> [, <[arg]>, ...]);
- int snprintf(char *<[str]>, size_t <[size]>, const char *<[format]>
- [, <[arg]>, ...]);
+ int snprintf(char *<[str]>, size_t <[size]>, const char *<[format]> [, <[arg]>, ...]);
TRAD_SYNOPSIS
#include <stdio.h>
@@ -306,8 +305,6 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#ifdef _HAVE_STDC
#include <stdarg.h>
@@ -315,20 +312,18 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include <varargs.h>
#endif
#include <limits.h>
+#include <_ansi.h>
#include "local.h"
int
#ifdef _HAVE_STDC
-_DEFUN(_sprintf_r, (ptr, str, fmt),
- struct _reent *ptr _AND
- char *str _AND
- _CONST char *fmt _DOTS)
+_DEFUN (_sprintf_r, (ptr, str, fmt), struct _reent *ptr _AND char *str _AND _CONST char *fmt _DOTS)
#else
-_sprintf_r(ptr, str, fmt, va_alist)
- struct _reent *ptr;
- char *str;
- _CONST char *fmt;
- va_dcl
+_sprintf_r (ptr, str, fmt, va_alist)
+ struct _reent *ptr;
+ char *str;
+ _CONST char *fmt;
+ va_dcl
#endif
{
int ret;
@@ -354,14 +349,12 @@ _sprintf_r(ptr, str, fmt, va_alist)
int
#ifdef _HAVE_STDC
-_DEFUN(sprintf, (str, fmt),
- char *str _AND
- _CONST char *fmt _DOTS)
+_DEFUN (sprintf, (str, fmt), char *str _AND _CONST char *fmt _DOTS)
#else
-sprintf(str, fmt, va_alist)
- char *str;
- _CONST char *fmt;
- va_dcl
+sprintf (str, fmt, va_alist)
+ char *str;
+ _CONST char *fmt;
+ va_dcl
#endif
{
int ret;
diff --git a/newlib/libc/stdio/sscanf.c b/newlib/libc/stdio/sscanf.c
index 5ad39d8b7..ca80c0e71 100644
--- a/newlib/libc/stdio/sscanf.c
+++ b/newlib/libc/stdio/sscanf.c
@@ -16,8 +16,9 @@
*/
/*
+
FUNCTION
-<<scanf>>, <<fscanf>>, <<sscanf>>---scan and format input
+ <<scanf>>, <<fscanf>>, <<sscanf>>---scan and format input
INDEX
scanf
@@ -34,12 +35,10 @@ ANSI_SYNOPSIS
int sscanf(const char *<[str]>, const char *<[format]>
[, <[arg]>, ...]);
- int _scanf_r(struct _reent *<[ptr]>, const char *<[format]>
- [, <[arg]>, ...]);
- int _fscanf_r(struct _reent *<[ptr]>, FILE *<[fd]>, const char *<[format]>
- [, <[arg]>, ...]);
- int _sscanf_r(struct _reent *<[ptr]>, const char *<[str]>,
- const char *<[format]> [, <[arg]>, ...]);
+ int _scanf_r(struct _reent *<[ptr]>, const char *<[format]> [, <[arg]>, ...]);
+ int _fscanf_r(struct _reent *<[ptr]>, FILE *<[fd]>, const char *<[format]> [, <[arg]>, ...]);
+ int _sscanf_r(struct _reent *<[ptr]>, const char *<[str]>, const char *<[format]>
+ [, <[arg]>, ...]);
TRAD_SYNOPSIS
@@ -376,11 +375,12 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
/* | ARGSUSED */
/*SUPPRESS 590*/
-static _READ_WRITE_RETURN_TYPE
-_DEFUN(eofread, (cookie, buf, len),
- _PTR cookie _AND
- char *buf _AND
- int len)
+static
+_READ_WRITE_RETURN_TYPE
+eofread (cookie, buf, len)
+ _PTR cookie;
+ char *buf;
+ int len;
{
return 0;
}
@@ -389,28 +389,25 @@ _DEFUN(eofread, (cookie, buf, len),
#ifdef _HAVE_STDC
int
-_DEFUN(sscanf, (str, fmt),
- _CONST char *str _AND
- _CONST char *fmt _DOTS)
+_DEFUN (sscanf, (str, fmt), _CONST char *str _AND _CONST char *fmt _DOTS)
#else
int
-sscanf(str, fmt, va_alist)
- _CONST char *str;
- _CONST char *fmt;
- va_dcl
+sscanf (str, fmt, va_alist)
+ _CONST char *str;
+ _CONST char *fmt;
+ va_dcl
#endif
{
int ret;
va_list ap;
FILE f;
- f._flags = __SRD | __SSTR;
+ f._flags = __SRD;
f._bf._base = f._p = (unsigned char *) str;
f._bf._size = f._r = strlen (str);
f._read = eofread;
f._ub._base = NULL;
f._lb._base = NULL;
- f._file = -1; /* No file. */
#ifdef _HAVE_STDC
va_start (ap, fmt);
#else
@@ -425,30 +422,26 @@ sscanf(str, fmt, va_alist)
#ifdef _HAVE_STDC
int
-_DEFUN(_sscanf_r, (ptr, str, fmt),
- struct _reent *ptr _AND
- _CONST char *str _AND
- _CONST char *fmt _DOTS)
+_DEFUN (_sscanf_r, (ptr, str, fmt), struct _reent *ptr _AND _CONST char *str _AND _CONST char *fmt _DOTS)
#else
int
-_sscanf_r(ptr, str, fmt, va_alist)
- struct _reent *ptr;
- _CONST char *str;
- _CONST char *fmt;
- va_dcl
+_sscanf_r (ptr, str, fmt, va_alist)
+ struct _reent *ptr;
+ _CONST char *str;
+ _CONST char *fmt;
+ va_dcl
#endif
{
int ret;
va_list ap;
FILE f;
- f._flags = __SRD | __SSTR;
+ f._flags = __SRD;
f._bf._base = f._p = (unsigned char *) str;
f._bf._size = f._r = strlen (str);
f._read = eofread;
f._ub._base = NULL;
f._lb._base = NULL;
- f._file = -1; /* No file. */
#ifdef _HAVE_STDC
va_start (ap, fmt);
#else
diff --git a/newlib/libc/stdio/stdio.c b/newlib/libc/stdio/stdio.c
index 8bc736088..bf304bc18 100644
--- a/newlib/libc/stdio/stdio.c
+++ b/newlib/libc/stdio/stdio.c
@@ -1,3 +1,5 @@
+/* No user fns here. Pesch 15apr92. */
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -14,10 +16,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* No user fns here. Pesch 15apr92. */
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
@@ -30,10 +29,10 @@
*/
_READ_WRITE_RETURN_TYPE
-_DEFUN(__sread, (cookie, buf, n),
- _PTR cookie _AND
- char *buf _AND
- int n)
+__sread (cookie, buf, n)
+ _PTR cookie;
+ char *buf;
+ int n;
{
register FILE *fp = (FILE *) cookie;
register int ret;
@@ -41,14 +40,14 @@ _DEFUN(__sread, (cookie, buf, n),
#ifdef __SCLE
int oldmode = 0;
if (fp->_flags & __SCLE)
- oldmode = setmode (fp->_file, O_BINARY);
+ oldmode = setmode(fp->_file, O_BINARY);
#endif
ret = _read_r (_REENT, fp->_file, buf, n);
#ifdef __SCLE
if (oldmode)
- setmode (fp->_file, oldmode);
+ setmode(fp->_file, oldmode);
#endif
/* If the read succeeded, update the current offset. */
@@ -61,10 +60,10 @@ _DEFUN(__sread, (cookie, buf, n),
}
_READ_WRITE_RETURN_TYPE
-_DEFUN(__swrite, (cookie, buf, n),
- _PTR cookie _AND
- char _CONST *buf _AND
- int n)
+__swrite (cookie, buf, n)
+ _PTR cookie;
+ char _CONST *buf;
+ int n;
{
register FILE *fp = (FILE *) cookie;
int w;
@@ -73,29 +72,29 @@ _DEFUN(__swrite, (cookie, buf, n),
#endif
if (fp->_flags & __SAPP)
- _CAST_VOID _lseek_r (_REENT, fp->_file, (_off_t) 0, SEEK_END);
+ (void) _lseek_r (_REENT, fp->_file, (_off_t) 0, SEEK_END);
fp->_flags &= ~__SOFF; /* in case O_APPEND mode is set */
#ifdef __SCLE
if (fp->_flags & __SCLE)
- oldmode = setmode (fp->_file, O_BINARY);
+ oldmode = setmode(fp->_file, O_BINARY);
#endif
w = _write_r (_REENT, fp->_file, buf, n);
#ifdef __SCLE
if (oldmode)
- setmode (fp->_file, oldmode);
+ setmode(fp->_file, oldmode);
#endif
return w;
}
_fpos_t
-_DEFUN(__sseek, (cookie, offset, whence),
- _PTR cookie _AND
- _fpos_t offset _AND
- int whence)
+__sseek (cookie, offset, whence)
+ _PTR cookie;
+ _fpos_t offset;
+ int whence;
{
register FILE *fp = (FILE *) cookie;
register _off_t ret;
@@ -112,8 +111,8 @@ _DEFUN(__sseek, (cookie, offset, whence),
}
int
-_DEFUN(__sclose, (cookie),
- _PTR cookie)
+__sclose (cookie)
+ _PTR cookie;
{
FILE *fp = (FILE *) cookie;
@@ -122,8 +121,7 @@ _DEFUN(__sclose, (cookie),
#ifdef __SCLE
int
-_DEFUN(__stextmode, (fd),
- int fd)
+__stextmode (int fd)
{
#ifdef __CYGWIN__
return _cygwin_istext_for_stdio (fd);
diff --git a/newlib/libc/stdio/stdio.tex b/newlib/libc/stdio/stdio.tex
index 9c2ca0f5d..217aed1ef 100644
--- a/newlib/libc/stdio/stdio.tex
+++ b/newlib/libc/stdio/stdio.tex
@@ -25,16 +25,14 @@ structure.
@menu
* clearerr:: Clear file or stream error indicator
-* dprintf:: Print to a file descriptor
* fclose:: Close a file
-* fcloseall:: Close all files
* feof:: Test for end of file
* ferror:: Test whether read/write error has occurred
* fflush:: Flush buffered file output
* fgetc:: Get a character from a file or stream
* fgetpos:: Record position in a stream or file
* fgets:: Get character string from a file or stream
-* fileno:: Get file descriptor associated with stream
+* fiprintf:: Write formatted output to file (integer only)
* fopen:: Open a file
* fdopen:: Turn an open file into a stream
* fputc:: Write a character on a stream or file
@@ -46,53 +44,36 @@ structure.
* ftell:: Return position in a stream or file
* fwrite:: Write array elements from memory to a file or stream
* getc:: Get a character from a file or stream (macro)
-* getc_unlocked:: Get a character from a file or stream (macro)
* getchar:: Get a character from standard input (macro)
-* getchar_unlocked:: Get a character from standard input (macro)
-* getdelim:: Get character string from a file or stream
-* getline:: Get character string from a file or stream
* gets:: Get character string from standard input (obsolete)
* getw:: Get a word (int) from a file or stream
+* iprintf:: Write formatted output (integer only)
* mktemp:: Generate unused file name
* perror:: Print an error message on standard error
* putc:: Write a character on a stream or file (macro)
-* putc_unlocked:: Write a character on a stream or file (macro)
* putchar:: Write a character on standard output (macro)
-* putchar_unlocked:: Write a character on standard output (macro)
* puts:: Write a character string on standard output
* putw:: Write a word (int) to a file or stream
* remove:: Delete a file's name
* rename:: Rename a file
* rewind:: Reinitialize a file or stream
* setbuf:: Specify full buffering for a file or stream
-* setbuffer:: Specify full buffering for a file or stream with size
-* setlinebuf:: Specify line buffering for a file or stream
* setvbuf:: Specify buffering for a file or stream
+* siprintf:: Write formatted output (integer only)
* printf:: Write formatted output
* scanf:: Scan and format input
-* iprintf:: Write formatted output (integer only)
-* iscanf:: Scan and format input (integer only)
* tmpfile:: Create a temporary file
* tmpnam:: Generate name for a temporary file
-* viprintf:: Format variable argument list for non-floating-point output
-* viscanf:: Scan variable format list for non-floating-point input
* vprintf:: Format variable argument list
-* vscanf:: Format variable argument list
@end menu
@page
@include stdio/clearerr.def
@page
-@include stdio/dprintf.def
-
-@page
@include stdio/fclose.def
@page
-@include stdio/fcloseall.def
-
-@page
@include stdio/feof.def
@page
@@ -111,7 +92,7 @@ structure.
@include stdio/fgets.def
@page
-@include stdio/fileno.def
+@include stdio/fiprintf.def
@page
@include stdio/fopen.def
@@ -147,20 +128,8 @@ structure.
@include stdio/getc.def
@page
-@include stdio/getc_u.def
-
-@page
@include stdio/getchar.def
-@page
-@include stdio/getchar_u.def
-
-@page
-@include stdio/getdelim.def
-
-@page
-@include stdio/getline.def
-
@page
@include stdio/gets.def
@@ -168,6 +137,9 @@ structure.
@include stdio/getw.def
@page
+@include stdio/iprintf.def
+
+@page
@include stdio/mktemp.def
@page
@@ -177,15 +149,9 @@ structure.
@include stdio/putc.def
@page
-@include stdio/putc_u.def
-
-@page
@include stdio/putchar.def
@page
-@include stdio/putchar_u.def
-
-@page
@include stdio/puts.def
@page
@@ -204,26 +170,17 @@ structure.
@include stdio/setbuf.def
@page
-@include stdio/setbuffer.def
-
-@page
-@include stdio/setlinebuf.def
-
-@page
@include stdio/setvbuf.def
@page
+@include stdio/siprintf.def
+
+@page
@include stdio/sprintf.def
@page
@include stdio/sscanf.def
-@page
-@include stdio/siprintf.def
-
-@page
-@include stdio/siscanf.def
-
@page
@include stdio/tmpfile.def
@@ -233,12 +190,3 @@ structure.
@page
@include stdio/vfprintf.def
-@page
-@include stdio/vfscanf.def
-
-@page
-@include stdio/viprintf.def
-
-@page
-@include stdio/viscanf.def
-
diff --git a/newlib/libc/stdio/tmpfile.c b/newlib/libc/stdio/tmpfile.c
index a6c2c9136..c38e61d34 100644
--- a/newlib/libc/stdio/tmpfile.c
+++ b/newlib/libc/stdio/tmpfile.c
@@ -11,14 +11,14 @@ ANSI_SYNOPSIS
#include <stdio.h>
FILE *tmpfile(void);
- FILE *_tmpfile_r(struct _reent *<[reent]>);
+ FILE *_tmpfile_r(void *<[reent]>);
TRAD_SYNOPSIS
#include <stdio.h>
FILE *tmpfile();
FILE *_tmpfile_r(<[reent]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
DESCRIPTION
Create a temporary file (a file which will be deleted automatically),
@@ -45,14 +45,12 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<getpid>>,
<<tmpfile>> also requires the global pointer <<environ>>.
*/
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#include <errno.h>
FILE *
-_DEFUN(_tmpfile_r, (ptr),
- struct _reent *ptr)
+_DEFUN (_tmpfile_r, (ptr),
+ struct _reent *ptr)
{
FILE *fp;
int e;
@@ -71,7 +69,7 @@ _DEFUN(_tmpfile_r, (ptr),
#ifndef _REENT_ONLY
FILE *
-_DEFUN_VOID(tmpfile)
+_DEFUN_VOID (tmpfile)
{
return _tmpfile_r (_REENT);
}
diff --git a/newlib/libc/stdio/tmpnam.c b/newlib/libc/stdio/tmpnam.c
index ee722e630..ec346c878 100644
--- a/newlib/libc/stdio/tmpnam.c
+++ b/newlib/libc/stdio/tmpnam.c
@@ -2,6 +2,7 @@
* tmpname.c
* Original Author: G. Haley
*/
+
/*
FUNCTION
<<tmpnam>>, <<tempnam>>---name for a temporary file
@@ -19,8 +20,8 @@ ANSI_SYNOPSIS
#include <stdio.h>
char *tmpnam(char *<[s]>);
char *tempnam(char *<[dir]>, char *<[pfx]>);
- char *_tmpnam_r(struct _reent *<[reent]>, char *<[s]>);
- char *_tempnam_r(struct _reent *<[reent]>, char *<[dir]>, char *<[pfx]>);
+ char *_tmpnam_r(void *<[reent]>, char *<[s]>);
+ char *_tempnam_r(void *<[reent]>, char *<[dir]>, char *<[pfx]>);
TRAD_SYNOPSIS
#include <stdio.h>
@@ -32,11 +33,11 @@ TRAD_SYNOPSIS
char *<[pfx]>;
char *_tmpnam_r(<[reent]>, <[s]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[s]>;
char *_tempnam_r(<[reent]>, <[dir]>, <[pfx]>)
- struct *<[reent]>;
+ char *<[reent]>;
char *<[dir]>;
char *<[pfx]>;
@@ -92,7 +93,6 @@ The global pointer <<environ>> is also required.
*/
#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -104,13 +104,13 @@ The global pointer <<environ>> is also required.
another one. Return nonzero if successful, otherwise zero. */
static int
-_DEFUN(worker, (ptr, result, part1, part2, part3, part4),
- struct _reent *ptr _AND
- char *result _AND
- _CONST char *part1 _AND
- _CONST char *part2 _AND
- int part3 _AND
- int *part4)
+worker (ptr, result, part1, part2, part3, part4)
+ struct _reent *ptr;
+ char *result;
+ _CONST char *part1;
+ _CONST char *part2;
+ int part3;
+ int *part4;
{
/* Generate the filename and make sure that there isn't one called
it already. */
@@ -136,9 +136,9 @@ _DEFUN(worker, (ptr, result, part1, part2, part3, part4),
}
char *
-_DEFUN(_tmpnam_r, (p, s),
- struct _reent *p _AND
- char *s)
+_DEFUN (_tmpnam_r, (p, s),
+ struct _reent *p _AND
+ char *s)
{
char *result;
int pid;
@@ -165,10 +165,10 @@ _DEFUN(_tmpnam_r, (p, s),
}
char *
-_DEFUN(_tempnam_r, (p, dir, pfx),
- struct _reent *p _AND
- _CONST char *dir _AND
- _CONST char *pfx)
+_DEFUN (_tempnam_r, (p, dir, pfx),
+ struct _reent *p _AND
+ _CONST char *dir _AND
+ _CONST char *pfx)
{
char *filename;
int length;
@@ -192,16 +192,16 @@ _DEFUN(_tempnam_r, (p, dir, pfx),
#ifndef _REENT_ONLY
char *
-_DEFUN(tempnam, (dir, pfx),
- _CONST char *dir _AND
- _CONST char *pfx)
+_DEFUN (tempnam, (dir, pfx),
+ _CONST char *dir _AND
+ _CONST char *pfx)
{
return _tempnam_r (_REENT, dir, pfx);
}
char *
-_DEFUN(tmpnam, (s),
- char *s)
+_DEFUN (tmpnam, (s),
+ char *s)
{
return _tmpnam_r (_REENT, s);
}
diff --git a/newlib/libc/stdio/ungetc.c b/newlib/libc/stdio/ungetc.c
index fc6fa3160..5ca98251d 100644
--- a/newlib/libc/stdio/ungetc.c
+++ b/newlib/libc/stdio/ungetc.c
@@ -19,8 +19,6 @@
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -35,9 +33,8 @@ static char sccsid[] = "%W% (Berkeley) %G%";
/*static*/
int
-_DEFUN(__submore, (rptr, fp),
- struct _reent *rptr _AND
- register FILE *fp)
+__submore (fp)
+ register FILE *fp;
{
register int i;
register unsigned char *p;
@@ -47,7 +44,7 @@ _DEFUN(__submore, (rptr, fp),
/*
* Get a new buffer (rather than expanding the old one).
*/
- if ((p = (unsigned char *) _malloc_r (rptr, (size_t) BUFSIZ)) == NULL)
+ if ((p = (unsigned char *) _malloc_r (_REENT, (size_t) BUFSIZ)) == NULL)
return EOF;
fp->_ub._base = p;
fp->_ub._size = BUFSIZ;
@@ -58,10 +55,10 @@ _DEFUN(__submore, (rptr, fp),
return 0;
}
i = fp->_ub._size;
- p = (unsigned char *) _realloc_r (rptr, (_PTR) (fp->_ub._base), i << 1);
+ p = (unsigned char *) _realloc_r (_REENT, (_PTR) (fp->_ub._base), i << 1);
if (p == NULL)
return EOF;
- _CAST_VOID memcpy ((_PTR) (p + i), (_PTR) p, (size_t) i);
+ (void) memcpy ((void *) (p + i), (void *) p, (size_t) i);
fp->_p = p + i;
fp->_ub._base = p;
fp->_ub._size = i << 1;
@@ -69,22 +66,21 @@ _DEFUN(__submore, (rptr, fp),
}
int
-_DEFUN(_ungetc_r, (rptr, c, fp),
- struct _reent *rptr _AND
- int c _AND
- register FILE *fp)
+ungetc (c, fp)
+ int c;
+ register FILE *fp;
{
if (c == EOF)
return (EOF);
+ _flockfile(fp);
+
/* Ensure stdio has been initialized.
??? Might be able to remove this as some other stdio routine should
have already been called to get the char we are un-getting. */
- CHECK_INIT (rptr);
+ CHECK_INIT (fp);
- _flockfile (fp);
-
/* After ungetc, we won't be at eof anymore */
fp->_flags &= ~__SEOF;
@@ -96,14 +92,14 @@ _DEFUN(_ungetc_r, (rptr, c, fp),
*/
if ((fp->_flags & __SRW) == 0)
{
- _funlockfile (fp);
+ _funlockfile(fp);
return EOF;
}
if (fp->_flags & __SWR)
{
if (fflush (fp))
{
- _funlockfile (fp);
+ _funlockfile(fp);
return EOF;
}
fp->_flags &= ~__SWR;
@@ -121,14 +117,14 @@ _DEFUN(_ungetc_r, (rptr, c, fp),
if (HASUB (fp))
{
- if (fp->_r >= fp->_ub._size && __submore (rptr, fp))
+ if (fp->_r >= fp->_ub._size && __submore (fp))
{
- _funlockfile (fp);
+ _funlockfile(fp);
return EOF;
}
*--fp->_p = c;
fp->_r++;
- _funlockfile (fp);
+ _funlockfile(fp);
return c;
}
@@ -142,7 +138,7 @@ _DEFUN(_ungetc_r, (rptr, c, fp),
{
fp->_p--;
fp->_r++;
- _funlockfile (fp);
+ _funlockfile(fp);
return c;
}
@@ -158,17 +154,6 @@ _DEFUN(_ungetc_r, (rptr, c, fp),
fp->_ubuf[sizeof (fp->_ubuf) - 1] = c;
fp->_p = &fp->_ubuf[sizeof (fp->_ubuf) - 1];
fp->_r = 1;
- _funlockfile (fp);
+ _funlockfile(fp);
return c;
}
-
-#ifndef _REENT_ONLY
-int
-_DEFUN(ungetc, (c, fp),
- int c _AND
- register FILE *fp)
-{
- return _ungetc_r (_REENT, c, fp);
-}
-#endif /* !_REENT_ONLY */
-
diff --git a/newlib/libc/stdio/vasiprintf.c b/newlib/libc/stdio/vasiprintf.c
deleted file mode 100644
index 721d6fb29..000000000
--- a/newlib/libc/stdio/vasiprintf.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.
- */
-/* This code was based on vsiprintf.c */
-/* doc in vfprintf.c */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "%W% (Berkeley) %G%";
-#endif /* LIBC_SCCS and not lint */
-
-#include <_ansi.h>
-#include <stdio.h>
-#include <limits.h>
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#ifndef _REENT_ONLY
-
-int
-_DEFUN(vasiprintf, (strp, fmt, ap),
- char **strp _AND
- _CONST char *fmt _AND
- va_list ap)
-{
- int ret;
- FILE f;
-
- f._flags = __SWR | __SSTR | __SMBF;
- f._bf._base = f._p = NULL;
- f._bf._size = f._w = 0;
- f._file = -1; /* No file. */
- ret = _vfiprintf_r (_REENT, &f, fmt, ap);
- *f._p = 0;
- *strp = f._bf._base;
- return ret;
-}
-
-#endif /* !_REENT_ONLY */
-
-int
-_DEFUN(_vasiprintf_r, (ptr, strp, fmt, ap),
- struct _reent *ptr _AND
- char **strp _AND
- _CONST char *fmt _AND
- va_list ap)
-{
- int ret;
- FILE f;
-
- f._flags = __SWR | __SSTR | __SMBF ;
- f._bf._base = f._p = NULL;
- f._bf._size = f._w = 0;
- f._file = -1; /* No file. */
- ret = _vfiprintf_r (ptr, &f, fmt, ap);
- *f._p = 0;
- *strp = f._bf._base;
- return ret;
-}
-
diff --git a/newlib/libc/stdio/vasprintf.c b/newlib/libc/stdio/vasprintf.c
index 43197d582..539e23114 100644
--- a/newlib/libc/stdio/vasprintf.c
+++ b/newlib/libc/stdio/vasprintf.c
@@ -1,3 +1,5 @@
+/* doc in vfprintf.c */
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -14,14 +16,15 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
+
/* This code was based on vsprintf.c */
-/* doc in vfprintf.c */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
#include <_ansi.h>
+#include <reent.h>
#include <stdio.h>
#include <limits.h>
#ifdef _HAVE_STDC
@@ -33,10 +36,10 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#ifndef _REENT_ONLY
int
-_DEFUN(vasprintf, (strp, fmt, ap),
- char **strp _AND
- _CONST char *fmt _AND
- va_list ap)
+_DEFUN (vasprintf, (strp, fmt, ap),
+ char **strp _AND
+ _CONST char *fmt _AND
+ va_list ap)
{
int ret;
FILE f;
@@ -54,11 +57,11 @@ _DEFUN(vasprintf, (strp, fmt, ap),
#endif /* !_REENT_ONLY */
int
-_DEFUN(_vasprintf_r, (ptr, strp, fmt, ap),
- struct _reent *ptr _AND
- char **strp _AND
- _CONST char *fmt _AND
- va_list ap)
+_DEFUN (_vasprintf_r, (ptr, strp, fmt, ap),
+ struct _reent *ptr _AND
+ char **strp _AND
+ _CONST char *fmt _AND
+ va_list ap)
{
int ret;
FILE f;
diff --git a/newlib/libc/stdio/vdprintf.c b/newlib/libc/stdio/vdprintf.c
deleted file mode 100644
index acd193a13..000000000
--- a/newlib/libc/stdio/vdprintf.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright 2005 Shaun Jackman
- * Permission to use, copy, modify, and distribute this software
- * is freely granted, provided that this notice is preserved.
- */
-
-#include <_ansi.h>
-#include <reent.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-int
-_DEFUN (_vdprintf_r, (ptr, fd, format, ap),
- struct _reent *ptr _AND
- int fd _AND
- _CONST char *format _AND
- va_list ap)
-{
- char *p;
- int n;
- _REENT_SMALL_CHECK_INIT (ptr);
- n = _vasprintf_r (ptr, &p, format, ap);
- if (n == -1) return -1;
- n = _write_r (ptr, fd, p, n);
- _free_r (ptr, p);
- return n;
-}
-
-#ifndef _REENT_ONLY
-
-int
-_DEFUN (vdprintf, (fd, format, ap),
- int fd _AND
- _CONST char *format _AND
- va_list ap)
-{
- _REENT_SMALL_CHECK_INIT (_REENT);
- return _vdprintf_r (_REENT, fd, format, ap);
-}
-
-#endif /* ! _REENT_ONLY */
diff --git a/newlib/libc/stdio/vfieeefp.h b/newlib/libc/stdio/vfieeefp.h
index 3691ffe73..1b240fcde 100644
--- a/newlib/libc/stdio/vfieeefp.h
+++ b/newlib/libc/stdio/vfieeefp.h
@@ -29,7 +29,6 @@
/* This header file is a modification of mprec.h that only contains floating
point union code. */
-#include <newlib.h>
#include <ieeefp.h>
#include <math.h>
#include <float.h>
@@ -58,7 +57,7 @@
Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
#endif
-#ifdef _WANT_IO_LONG_DOUBLE
+#ifdef WANT_IO_LONG_DBL
/* If we are going to examine or modify specific bits in a long double using
the lword0 or lwordx macros, then we must wrap the long double inside
a union. This is necessary to avoid undefined behavior according to
@@ -135,7 +134,7 @@ struct ldieee
};
#endif /* LDBL_MANT_DIG */
#endif /* !IEEE_8087 */
-#endif /* _WANT_IO_LONG_DOUBLE */
+#endif /* WANT_IO_LONG_DBL */
/* If we are going to examine or modify specific bits in a double using
the word0 and/or word1 macros, then we must wrap the double inside
diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
index a8c1f9bca..96fa4ba2e 100644
--- a/newlib/libc/stdio/vfprintf.c
+++ b/newlib/libc/stdio/vfprintf.c
@@ -1,40 +1,4 @@
/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
FUNCTION
<<vprintf>>, <<vfprintf>>, <<vsprintf>>---format argument list
@@ -54,19 +18,18 @@ ANSI_SYNOPSIS
int vfprintf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
int vsprintf(char *<[str]>, const char *<[fmt]>, va_list <[list]>);
int vasprintf(char **<[strp]>, const char *<[fmt]>, va_list <[list]>);
- int vsnprintf(char *<[str]>, size_t <[size]>, const char *<[fmt]>,
- va_list <[list]>);
+ int vsnprintf(char *<[str]>, size_t <[size]>, const char *<[fmt]>, va_list <[list]>);
- int _vprintf_r(struct _reent *<[reent]>, const char *<[fmt]>,
+ int _vprintf_r(void *<[reent]>, const char *<[fmt]>,
+ va_list <[list]>);
+ int _vfprintf_r(void *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
+ va_list <[list]>);
+ int _vasprintf_r(void *<[reent]>, char **<[str]>, const char *<[fmt]>,
va_list <[list]>);
- int _vfprintf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
+ int _vsprintf_r(void *<[reent]>, char *<[str]>, const char *<[fmt]>,
+ va_list <[list]>);
+ int _vsnprintf_r(void *<[reent]>, char *<[str]>, size_t <[size]>, const char *<[fmt]>,
va_list <[list]>);
- int _vasprintf_r(struct _reent *<[reent]>, char **<[str]>,
- const char *<[fmt]>, va_list <[list]>);
- int _vsprintf_r(struct _reent *<[reent]>, char *<[str]>,
- const char *<[fmt]>, va_list <[list]>);
- int _vsnprintf_r(struct _reent *<[reent]>, char *<[str]>, size_t <[size]>,
- const char *<[fmt]>, va_list <[list]>);
TRAD_SYNOPSIS
#include <stdio.h>
@@ -97,30 +60,30 @@ TRAD_SYNOPSIS
va_list <[list]>;
int _vprintf_r(<[reent]>, <[fmt]>, <[list]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[fmt]>;
va_list <[list]>;
int _vfprintf_r(<[reent]>, <[fp]>, <[fmt]>, <[list]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
FILE *<[fp]>;
char *<[fmt]>;
va_list <[list]>;
int _vasprintf_r(<[reent]>, <[strp]>, <[fmt]>, <[list]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char **<[strp]>;
char *<[fmt]>;
va_list <[list]>;
int _vsprintf_r(<[reent]>, <[str]>, <[fmt]>, <[list]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[str]>;
char *<[fmt]>;
va_list <[list]>;
int _vsnprintf_r(<[reent]>, <[str]>, <[size]>, <[fmt]>, <[list]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[str]>;
size_t <[size]>;
char *<[fmt]>;
@@ -148,6 +111,42 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
+/*
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)vfprintf.c 5.50 (Berkeley) 12/16/92";*/
static char *rcsid = "$Id$";
@@ -158,7 +157,6 @@ static char *rcsid = "$Id$";
*
* This code is large and complicated...
*/
-#include <newlib.h>
#ifdef INTEGER_ONLY
#define VFPRINTF vfiprintf
@@ -171,25 +169,32 @@ static char *rcsid = "$Id$";
#endif
#endif
+#define _NO_LONGLONG
+#if defined WANT_PRINTF_LONG_LONG && defined __GNUC__
+# undef _NO_LONGLONG
+#endif
+
#define _NO_POS_ARGS
-#if defined _WANT_IO_POS_ARGS
+#if defined WANT_IO_POS_ARGS
# undef _NO_POS_ARGS
#endif
#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
+#include <reent.h>
#include <wchar.h>
#include <string.h>
#include <sys/lock.h>
+
#ifdef _HAVE_STDC
#include <stdarg.h>
#else
#include <varargs.h>
#endif
+
#include "local.h"
#include "fvwrite.h"
#include "vfieeefp.h"
@@ -198,23 +203,18 @@ static char *rcsid = "$Id$";
This could be changed in the future should the _ldtoa_r code be
preferred over _dtoa_r. */
#define _NO_LONGDBL
-#if defined _WANT_IO_LONG_DOUBLE && (LDBL_MANT_DIG > DBL_MANT_DIG)
+#if defined WANT_IO_LONG_DBL && (LDBL_MANT_DIG > DBL_MANT_DIG)
#undef _NO_LONGDBL
#endif
-#define _NO_LONGLONG
-#if defined _WANT_IO_LONG_LONG && defined __GNUC__
-# undef _NO_LONGLONG
-#endif
-
/*
* Flush out all the vectors defined by the given uio,
* then reset it so that it can be reused.
*/
static int
-_DEFUN(__sprint, (fp, uio),
- FILE *fp _AND
- register struct __suio *uio)
+__sprint(fp, uio)
+ FILE *fp;
+ register struct __suio *uio;
{
register int err;
@@ -234,11 +234,10 @@ _DEFUN(__sprint, (fp, uio),
* worries about ungetc buffers and so forth.
*/
static int
-_DEFUN(__sbprintf, (rptr, fp, fmt, ap),
- struct _reent *rptr _AND
- register FILE *fp _AND
- _CONST char *fmt _AND
- va_list ap)
+__sbprintf(fp, fmt, ap)
+ register FILE *fp;
+ const char *fmt;
+ va_list ap;
{
int ret;
FILE fake;
@@ -252,21 +251,21 @@ _DEFUN(__sbprintf, (rptr, fp, fmt, ap),
/* set up the buffer */
fake._bf._base = fake._p = buf;
- fake._bf._size = fake._w = sizeof (buf);
+ fake._bf._size = fake._w = sizeof(buf);
fake._lbfsize = 0; /* not actually used, but Just In Case */
#ifndef __SINGLE_THREAD__
- __lock_init_recursive (fake._lock);
+ __lock_init_recursive (*(_LOCK_RECURSIVE_T *)&fake._lock);
#endif
/* do the work, then copy any error status */
- ret = _VFPRINTF_R (rptr, &fake, fmt, ap);
+ ret = VFPRINTF(&fake, fmt, ap);
if (ret >= 0 && fflush(&fake))
ret = EOF;
if (fake._flags & __SERR)
fp->_flags |= __SERR;
#ifndef __SINGLE_THREAD__
- __lock_close_recursive (fake._lock);
+ __lock_close_recursive (*(_LOCK_RECURSIVE_T *)&fake._lock);
#endif
return (ret);
}
@@ -286,15 +285,13 @@ _DEFUN(__sbprintf, (rptr, fp, fmt, ap),
#define DEFPREC 6
#ifdef _NO_LONGDBL
-static char *
-_EXFUN(cvt, (struct _reent *, double, int, int, char *, int *, int, int *));
+static char *cvt _PARAMS((struct _reent *, double, int, int, char *, int *, int, int *));
#else
-static char *
-_EXFUN(cvt, (struct _reent *, _LONG_DOUBLE, int, int, char *, int *, int, int *));
-extern int _EXFUN(_ldcheck,(_LONG_DOUBLE *));
+static char *cvt _PARAMS((struct _reent *, _LONG_DOUBLE, int, int, char *, int *, int, int *));
+extern int _ldcheck _PARAMS((_LONG_DOUBLE *));
#endif
-static int _EXFUN(exponent, (char *, int, int));
+static int exponent _PARAMS((char *, int, int));
#else /* no FLOATING_POINT */
@@ -311,7 +308,7 @@ static int _EXFUN(exponent, (char *, int, int));
#endif
typedef quad_t * quad_ptr_t;
-typedef _PTR void_ptr_t;
+typedef void * void_ptr_t;
typedef char * char_ptr_t;
typedef long * long_ptr_t;
typedef int * int_ptr_t;
@@ -340,17 +337,16 @@ union arg_val
wint_t val_wint_t;
};
-static union arg_val *
-_EXFUN(get_arg, (struct _reent *data, int n, char *fmt,
- va_list *ap, int *numargs, union arg_val *args,
- int *arg_type, char **last_fmt));
+static union arg_val *get_arg (struct _reent *data, int n, char *fmt,
+ va_list *ap, int *numargs, union arg_val *args,
+ int *arg_type, char **last_fmt);
#endif /* !_NO_POS_ARGS */
/*
* Macros for converting digits to letters and vice versa
*/
#define to_digit(c) ((c) - '0')
-#define is_digit(c) ((unsigned)to_digit (c) <= 9)
+#define is_digit(c) ((unsigned)to_digit(c) <= 9)
#define to_char(n) ((n) + '0')
/*
@@ -372,25 +368,28 @@ _EXFUN(get_arg, (struct _reent *data, int n, char *fmt,
#define ZEROPAD 0x080 /* zero (as opposed to blank) pad */
#define FPT 0x100 /* Floating point number */
-int _EXFUN(_VFPRINTF_R, (struct _reent *, FILE *, _CONST char *, va_list));
+int _EXFUN (_VFPRINTF_R, (struct _reent *, FILE *, _CONST char *, va_list));
int
-_DEFUN(VFPRINTF, (fp, fmt0, ap),
- FILE * fp _AND
- _CONST char *fmt0 _AND
- va_list ap)
+_DEFUN (VFPRINTF, (fp, fmt0, ap),
+ FILE * fp _AND
+ _CONST char *fmt0 _AND
+ va_list ap)
{
int result;
+ _flockfile(fp);
+ CHECK_INIT (fp);
result = _VFPRINTF_R (_REENT, fp, fmt0, ap);
+ _funlockfile(fp);
return result;
}
int
-_DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
- struct _reent *data _AND
- FILE * fp _AND
- _CONST char *fmt0 _AND
- va_list ap)
+_DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap),
+ struct _reent *data _AND
+ FILE * fp _AND
+ _CONST char *fmt0 _AND
+ va_list ap)
{
register char *fmt; /* format string */
register int ch; /* character from fmt */
@@ -440,7 +439,7 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
struct __siov iov[NIOV];/* ... and individual io vectors */
char buf[BUF]; /* space for %c, %[diouxX], %[eEfgG] */
char ox[2]; /* space for 0x hex-prefix */
-#ifdef _MB_CAPABLE
+#ifdef MB_CAPABLE
wchar_t wc;
mbstate_t state; /* mbtowc calls from library must not change state */
#endif
@@ -457,7 +456,7 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
static _CONST char zeroes[PADSIZE] =
{'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'};
-#ifdef _MB_CAPABLE
+#ifdef MB_CAPABLE
memset (&state, '\0', sizeof (state));
#endif
/*
@@ -477,10 +476,10 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
#define PAD(howmany, with) { \
if ((n = (howmany)) > 0) { \
while (n > PADSIZE) { \
- PRINT (with, PADSIZE); \
+ PRINT(with, PADSIZE); \
n -= PADSIZE; \
} \
- PRINT (with, n); \
+ PRINT(with, n); \
} \
}
#define FLUSH() { \
@@ -500,11 +499,11 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
: arg_index++ < numargs \
? args[n].val_##type \
: numargs < MAX_POS_ARGS \
- ? args[numargs++].val_##type = va_arg (ap, type) \
- : va_arg (ap, type) \
+ ? args[numargs++].val_##type = va_arg(ap, type) \
+ : va_arg(ap, type) \
)
#else
-#define GET_ARG(n, ap, type) (va_arg (ap, type))
+#define GET_ARG(n, ap, type) (va_arg(ap, type))
#endif
/*
@@ -513,41 +512,34 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
*/
#ifndef _NO_LONGLONG
#define SARG() \
- (flags&QUADINT ? GET_ARG (N, ap, quad_t) : \
- flags&LONGINT ? GET_ARG (N, ap, long) : \
- flags&SHORTINT ? (long)(short)GET_ARG (N, ap, int) : \
- (long)GET_ARG (N, ap, int))
+ (flags&QUADINT ? GET_ARG(N, ap, quad_t) : \
+ flags&LONGINT ? GET_ARG(N, ap, long) : \
+ flags&SHORTINT ? (long)(short)GET_ARG(N, ap, int) : \
+ (long)GET_ARG(N, ap, int))
#define UARG() \
- (flags&QUADINT ? GET_ARG (N, ap, u_quad_t) : \
- flags&LONGINT ? GET_ARG (N, ap, u_long) : \
- flags&SHORTINT ? (u_long)(u_short)GET_ARG (N, ap, int) : \
- (u_long)GET_ARG (N, ap, u_int))
+ (flags&QUADINT ? GET_ARG(N, ap, u_quad_t) : \
+ flags&LONGINT ? GET_ARG(N, ap, u_long) : \
+ flags&SHORTINT ? (u_long)(u_short)GET_ARG(N, ap, int) : \
+ (u_long)GET_ARG(N, ap, u_int))
#else
#define SARG() \
- (flags&LONGINT ? GET_ARG (N, ap, long) : \
- flags&SHORTINT ? (long)(short)GET_ARG (N, ap, int) : \
- (long)GET_ARG (N, ap, int))
+ (flags&LONGINT ? GET_ARG(N, ap, long) : \
+ flags&SHORTINT ? (long)(short)GET_ARG(N, ap, int) : \
+ (long)GET_ARG(N, ap, int))
#define UARG() \
- (flags&LONGINT ? GET_ARG (N, ap, u_long) : \
- flags&SHORTINT ? (u_long)(u_short)GET_ARG (N, ap, int) : \
- (u_long)GET_ARG (N, ap, u_int))
+ (flags&LONGINT ? GET_ARG(N, ap, u_long) : \
+ flags&SHORTINT ? (u_long)(u_short)GET_ARG(N, ap, int) : \
+ (u_long)GET_ARG(N, ap, u_int))
#endif
- CHECK_INIT (data);
- _flockfile (fp);
-
/* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
- if (cantwrite (fp)) {
- _funlockfile (fp);
+ if (cantwrite(fp))
return (EOF);
- }
/* optimise fprintf(stderr) (and other unbuffered Unix files) */
if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
- fp->_file >= 0) {
- _funlockfile (fp);
- return (__sbprintf (data, fp, fmt0, ap));
- }
+ fp->_file >= 0)
+ return (__sbprintf(fp, fmt0, ap));
fmt = (char *)fmt0;
uio.uio_iov = iovp = iov;
@@ -567,8 +559,8 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
*/
for (;;) {
cp = fmt;
-#ifdef _MB_CAPABLE
- while ((n = _mbtowc_r (data, &wc, fmt, MB_CUR_MAX, &state)) > 0) {
+#ifdef MB_CAPABLE
+ while ((n = _mbtowc_r(data, &wc, fmt, MB_CUR_MAX, &state)) > 0) {
if (wc == '%')
break;
fmt += n;
@@ -578,10 +570,10 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
fmt += 1;
#endif
if ((m = fmt - cp) != 0) {
- PRINT (cp, m);
+ PRINT(cp, m);
ret += m;
}
-#ifdef _MB_CAPABLE
+#ifdef MB_CAPABLE
if (n <= 0)
goto done;
#else
@@ -621,15 +613,15 @@ reswitch: switch (ch) {
/* we must check for positional arg used for dynamic width */
old_is_pos_arg = is_pos_arg;
is_pos_arg = 0;
- if (is_digit (*fmt)) {
+ if (is_digit(*fmt)) {
char *old_fmt = fmt;
n = 0;
ch = *fmt++;
do {
- n = 10 * n + to_digit (ch);
+ n = 10 * n + to_digit(ch);
ch = *fmt++;
- } while (is_digit (ch));
+ } while (is_digit(ch));
if (ch == '$') {
if (n <= MAX_POS_ARGS) {
@@ -652,7 +644,7 @@ reswitch: switch (ch) {
* -- ANSI X3J11
* They don't exclude field widths read from args.
*/
- width = GET_ARG (n, ap, int);
+ width = GET_ARG(n, ap, int);
#ifndef _NO_POS_ARGS
is_pos_arg = old_is_pos_arg;
#endif
@@ -673,15 +665,15 @@ reswitch: switch (ch) {
/* we must check for positional arg used for dynamic width */
old_is_pos_arg = is_pos_arg;
is_pos_arg = 0;
- if (is_digit (*fmt)) {
+ if (is_digit(*fmt)) {
char *old_fmt = fmt;
n = 0;
ch = *fmt++;
do {
- n = 10 * n + to_digit (ch);
+ n = 10 * n + to_digit(ch);
ch = *fmt++;
- } while (is_digit (ch));
+ } while (is_digit(ch));
if (ch == '$') {
if (n <= MAX_POS_ARGS) {
@@ -697,7 +689,7 @@ reswitch: switch (ch) {
}
}
#endif /* !_NO_POS_ARGS */
- prec = GET_ARG (n, ap, int);
+ prec = GET_ARG(n, ap, int);
#ifndef _NO_POS_ARGS
is_pos_arg = old_is_pos_arg;
#endif
@@ -706,8 +698,8 @@ reswitch: switch (ch) {
goto rflag;
}
n = 0;
- while (is_digit (ch)) {
- n = 10 * n + to_digit (ch);
+ while (is_digit(ch)) {
+ n = 10 * n + to_digit(ch);
ch = *fmt++;
}
prec = n < 0 ? -1 : n;
@@ -724,9 +716,9 @@ reswitch: switch (ch) {
case '5': case '6': case '7': case '8': case '9':
n = 0;
do {
- n = 10 * n + to_digit (ch);
+ n = 10 * n + to_digit(ch);
ch = *fmt++;
- } while (is_digit (ch));
+ } while (is_digit(ch));
#ifndef _NO_POS_ARGS
if (ch == '$') {
if (n <= MAX_POS_ARGS) {
@@ -765,16 +757,14 @@ reswitch: switch (ch) {
if (ch == 'C' || (flags & LONGINT)) {
mbstate_t ps;
- memset ((_PTR)&ps, '\0', sizeof (mbstate_t));
- if ((size = (int)_wcrtomb_r (data, cp,
- (wchar_t)GET_ARG (N, ap, wint_t),
- &ps)) == -1) {
- fp->_flags |= __SERR;
+ memset((void *)&ps, '\0', sizeof(mbstate_t));
+ if ((size = (int)_wcrtomb_r(data, cp,
+ (wchar_t)GET_ARG(N, ap, wint_t),
+ &ps)) == -1)
goto error;
- }
}
else {
- *cp = GET_ARG (N, ap, int);
+ *cp = GET_ARG(N, ap, int);
size = 1;
}
sign = '\0';
@@ -784,7 +774,7 @@ reswitch: switch (ch) {
/*FALLTHROUGH*/
case 'd':
case 'i':
- _uquad = SARG ();
+ _uquad = SARG();
#ifndef _NO_LONGLONG
if ((quad_t)_uquad < 0)
#else
@@ -801,7 +791,6 @@ reswitch: switch (ch) {
case 'e':
case 'E':
case 'f':
- case 'F':
case 'g':
case 'G':
if (prec == -1) {
@@ -812,27 +801,21 @@ reswitch: switch (ch) {
#ifdef _NO_LONGDBL
if (flags & LONGDBL) {
- _fpvalue = (double) GET_ARG (N, ap, _LONG_DOUBLE);
+ _fpvalue = (double) GET_ARG(N, ap, _LONG_DOUBLE);
} else {
- _fpvalue = GET_ARG (N, ap, double);
+ _fpvalue = GET_ARG(N, ap, double);
}
/* do this before tricky precision changes */
- if (isinf (_fpvalue)) {
+ if (isinf(_fpvalue)) {
if (_fpvalue < 0)
sign = '-';
- if (ch == 'E' || ch == 'F' || ch == 'G')
- cp = "INF";
- else
- cp = "inf";
+ cp = "Inf";
size = 3;
break;
}
- if (isnan (_fpvalue)) {
- if (ch == 'E' || ch == 'F' || ch == 'G')
- cp = "NAN";
- else
- cp = "nan";
+ if (isnan(_fpvalue)) {
+ cp = "NaN";
size = 3;
break;
}
@@ -840,9 +823,9 @@ reswitch: switch (ch) {
#else /* !_NO_LONGDBL */
if (flags & LONGDBL) {
- _fpvalue = GET_ARG (N, ap, _LONG_DOUBLE);
+ _fpvalue = GET_ARG(N, ap, _LONG_DOUBLE);
} else {
- _fpvalue = (_LONG_DOUBLE)GET_ARG (N, ap, double);
+ _fpvalue = (_LONG_DOUBLE)GET_ARG(N, ap, double);
}
/* do this before tricky precision changes */
@@ -850,18 +833,12 @@ reswitch: switch (ch) {
if (tmp == 2) {
if (_fpvalue < 0)
sign = '-';
- if (ch == 'E' || ch == 'F' || ch == 'G')
- cp = "INF";
- else
- cp = "inf";
+ cp = "Inf";
size = 3;
break;
}
if (tmp == 1) {
- if (ch == 'E' || ch == 'F' || ch == 'G')
- cp = "NAN";
- else
- cp = "nan";
+ cp = "NaN";
size = 3;
break;
}
@@ -869,7 +846,7 @@ reswitch: switch (ch) {
flags |= FPT;
- cp = cvt (data, _fpvalue, prec, flags, &softsign,
+ cp = cvt(data, _fpvalue, prec, flags, &softsign,
&expt, ch, &ndig);
if (ch == 'g' || ch == 'G') {
@@ -880,7 +857,7 @@ reswitch: switch (ch) {
}
if (ch <= 'e') { /* 'e' or 'E' fmt */
--expt;
- expsize = exponent (expstr, expt, ch);
+ expsize = exponent(expstr, expt, ch);
size = expsize + ndig;
if (ndig > 1 || flags & ALT)
++size;
@@ -908,21 +885,21 @@ reswitch: switch (ch) {
case 'n':
#ifndef _NO_LONGLONG
if (flags & QUADINT)
- *GET_ARG (N, ap, quad_ptr_t) = ret;
+ *GET_ARG(N, ap, quad_ptr_t) = ret;
else
#endif
if (flags & LONGINT)
- *GET_ARG (N, ap, long_ptr_t) = ret;
+ *GET_ARG(N, ap, long_ptr_t) = ret;
else if (flags & SHORTINT)
- *GET_ARG (N, ap, short_ptr_t) = ret;
+ *GET_ARG(N, ap, short_ptr_t) = ret;
else
- *GET_ARG (N, ap, int_ptr_t) = ret;
+ *GET_ARG(N, ap, int_ptr_t) = ret;
continue; /* no output */
case 'O':
flags |= LONGINT;
/*FALLTHROUGH*/
case 'o':
- _uquad = UARG ();
+ _uquad = UARG();
base = OCT;
goto nosign;
case 'p':
@@ -934,7 +911,7 @@ reswitch: switch (ch) {
* -- ANSI X3J11
*/
/* NOSTRICT */
- _uquad = (u_long)(unsigned _POINTER_INT)GET_ARG (N, ap, void_ptr_t);
+ _uquad = (u_long)(unsigned _POINTER_INT)GET_ARG(N, ap, void_ptr_t);
base = HEX;
xdigs = "0123456789abcdef";
flags |= HEXPREFIX;
@@ -943,7 +920,7 @@ reswitch: switch (ch) {
case 's':
case 'S':
sign = '\0';
- if ((cp = GET_ARG (N, ap, char_ptr_t)) == NULL) {
+ if ((cp = GET_ARG(N, ap, char_ptr_t)) == NULL) {
cp = "(null)";
size = 6;
}
@@ -953,7 +930,7 @@ reswitch: switch (ch) {
wcp = (_CONST wchar_t *)cp;
size = m = 0;
- memset ((_PTR)&ps, '\0', sizeof (mbstate_t));
+ memset((void *)&ps, '\0', sizeof(mbstate_t));
/* Count number of bytes needed for multibyte
string that will be produced from widechar
@@ -962,11 +939,9 @@ reswitch: switch (ch) {
while (1) {
if (wcp[m] == L'\0')
break;
- if ((n = (int)_wcrtomb_r (data,
- buf, wcp[m], &ps)) == -1) {
- fp->_flags |= __SERR;
+ if ((n = (int)_wcrtomb_r(data,
+ buf, wcp[m], &ps)) == -1)
goto error;
- }
if (n + size > prec)
break;
m += 1;
@@ -976,11 +951,9 @@ reswitch: switch (ch) {
}
}
else {
- if ((size = (int)_wcsrtombs_r (data,
- NULL, &wcp, 0, &ps)) == -1) {
- fp->_flags |= __SERR;
- goto error;
- }
+ if ((size = (int)_wcsrtombs_r(data,
+ NULL, &wcp, 0, &ps)) == -1)
+ goto error;
wcp = (_CONST wchar_t *)cp;
}
@@ -988,18 +961,14 @@ reswitch: switch (ch) {
break;
if ((malloc_buf =
- (char *)_malloc_r (data, size + 1)) == NULL) {
- fp->_flags |= __SERR;
+ (char *)_malloc_r(data, size + 1)) == NULL)
goto error;
- }
/* Convert widechar string to multibyte string. */
- memset ((_PTR)&ps, '\0', sizeof (mbstate_t));
- if (_wcsrtombs_r (data, malloc_buf,
- &wcp, size, &ps) != size) {
- fp->_flags |= __SERR;
+ memset((void *)&ps, '\0', sizeof(mbstate_t));
+ if (_wcsrtombs_r(data, malloc_buf,
+ &wcp, size, &ps) != size)
goto error;
- }
cp = malloc_buf;
cp[size] = '\0';
}
@@ -1007,9 +976,9 @@ reswitch: switch (ch) {
/*
* can't use strlen; can only look for the
* NUL in the first `prec' characters, and
- * strlen () will go further.
+ * strlen() will go further.
*/
- char *p = memchr (cp, 0, prec);
+ char *p = memchr(cp, 0, prec);
if (p != NULL) {
size = p - cp;
@@ -1018,14 +987,14 @@ reswitch: switch (ch) {
} else
size = prec;
} else
- size = strlen (cp);
+ size = strlen(cp);
break;
case 'U':
flags |= LONGINT;
/*FALLTHROUGH*/
case 'u':
- _uquad = UARG ();
+ _uquad = UARG();
base = DEC;
goto nosign;
case 'X':
@@ -1033,7 +1002,7 @@ reswitch: switch (ch) {
goto hex;
case 'x':
xdigs = "0123456789abcdef";
-hex: _uquad = UARG ();
+hex: _uquad = UARG();
base = HEX;
/* leading 0x/X only if non-zero */
if (flags & ALT && _uquad != 0)
@@ -1064,7 +1033,7 @@ number: if ((dprec = prec) >= 0)
switch (base) {
case OCT:
do {
- *--cp = to_char (_uquad & 7);
+ *--cp = to_char(_uquad & 7);
_uquad >>= 3;
} while (_uquad);
/* handle octal leading 0 */
@@ -1075,10 +1044,10 @@ number: if ((dprec = prec) >= 0)
case DEC:
/* many numbers are 1 digit */
while (_uquad >= 10) {
- *--cp = to_char (_uquad % 10);
+ *--cp = to_char(_uquad % 10);
_uquad /= 10;
}
- *--cp = to_char (_uquad);
+ *--cp = to_char(_uquad);
break;
case HEX:
@@ -1090,7 +1059,7 @@ number: if ((dprec = prec) >= 0)
default:
cp = "bug in vfprintf: bad base";
- size = strlen (cp);
+ size = strlen(cp);
goto skipsize;
}
}
@@ -1142,94 +1111,93 @@ number: if ((dprec = prec) >= 0)
/* right-adjusting blank padding */
if ((flags & (LADJUST|ZEROPAD)) == 0)
- PAD (width - realsz, blanks);
+ PAD(width - realsz, blanks);
/* prefix */
if (sign) {
- PRINT (&sign, 1);
+ PRINT(&sign, 1);
} else if (flags & HEXPREFIX) {
ox[0] = '0';
ox[1] = ch;
- PRINT (ox, 2);
+ PRINT(ox, 2);
}
/* right-adjusting zero padding */
if ((flags & (LADJUST|ZEROPAD)) == ZEROPAD)
- PAD (width - realsz, zeroes);
+ PAD(width - realsz, zeroes);
/* leading zeroes from decimal precision */
- PAD (dprec - size, zeroes);
+ PAD(dprec - size, zeroes);
/* the string or number proper */
#ifdef FLOATING_POINT
if ((flags & FPT) == 0) {
- PRINT (cp, size);
+ PRINT(cp, size);
} else { /* glue together f_p fragments */
if (ch >= 'f') { /* 'f' or 'g' */
if (_fpvalue == 0) {
/* kludge for __dtoa irregularity */
- PRINT ("0", 1);
+ PRINT("0", 1);
if (expt < ndig || (flags & ALT) != 0) {
- PRINT (decimal_point, 1);
- PAD (ndig - 1, zeroes);
+ PRINT(decimal_point, 1);
+ PAD(ndig - 1, zeroes);
}
} else if (expt <= 0) {
- PRINT ("0", 1);
+ PRINT("0", 1);
if(expt || ndig) {
- PRINT (decimal_point, 1);
- PAD (-expt, zeroes);
- PRINT (cp, ndig);
+ PRINT(decimal_point, 1);
+ PAD(-expt, zeroes);
+ PRINT(cp, ndig);
}
} else if (expt >= ndig) {
- PRINT (cp, ndig);
- PAD (expt - ndig, zeroes);
+ PRINT(cp, ndig);
+ PAD(expt - ndig, zeroes);
if (flags & ALT)
- PRINT (".", 1);
+ PRINT(".", 1);
} else {
- PRINT (cp, expt);
+ PRINT(cp, expt);
cp += expt;
- PRINT (".", 1);
- PRINT (cp, ndig-expt);
+ PRINT(".", 1);
+ PRINT(cp, ndig-expt);
}
} else { /* 'e' or 'E' */
if (ndig > 1 || flags & ALT) {
ox[0] = *cp++;
ox[1] = '.';
- PRINT (ox, 2);
+ PRINT(ox, 2);
if (_fpvalue) {
- PRINT (cp, ndig-1);
+ PRINT(cp, ndig-1);
} else /* 0.[0..] */
/* __dtoa irregularity */
- PAD (ndig - 1, zeroes);
+ PAD(ndig - 1, zeroes);
} else /* XeYYY */
- PRINT (cp, 1);
- PRINT (expstr, expsize);
+ PRINT(cp, 1);
+ PRINT(expstr, expsize);
}
}
#else
- PRINT (cp, size);
+ PRINT(cp, size);
#endif
/* left-adjusting padding (always blank) */
if (flags & LADJUST)
- PAD (width - realsz, blanks);
+ PAD(width - realsz, blanks);
/* finally, adjust ret */
ret += width > realsz ? width : realsz;
- FLUSH (); /* copy out the I/O vectors */
+ FLUSH(); /* copy out the I/O vectors */
if (malloc_buf != NULL) {
- _free_r (data, malloc_buf);
+ free(malloc_buf);
malloc_buf = NULL;
}
}
done:
- FLUSH ();
+ FLUSH();
error:
if (malloc_buf != NULL)
- _free_r (data, malloc_buf);
- _funlockfile (fp);
- return (__sferror (fp) ? EOF : ret);
+ free(malloc_buf);
+ return (__sferror(fp) ? EOF : ret);
/* NOTREACHED */
}
@@ -1245,40 +1213,23 @@ extern char *_ldtoa_r _PARAMS((struct _reent *, _LONG_DOUBLE, int,
#define word0(x) ldword0(x)
#endif
-#ifdef _NO_LONGDBL
static char *
-_DEFUN(cvt, (data, value, ndigits, flags, sign, decpt, ch, length),
- struct _reent *data _AND
- double value _AND
- int ndigits _AND
- int flags _AND
- char *sign _AND
- int *decpt _AND
- int ch _AND
- int *length)
+cvt(data, value, ndigits, flags, sign, decpt, ch, length)
+ struct _reent *data;
+#ifdef _NO_LONGDBL
+ double value;
#else
-static char *
-_DEFUN(cvt, (data, value, ndigits, flags, sign, decpt, ch, length),
- struct _reent *data _AND
- _LONG_DOUBLE value _AND
- int ndigits _AND
- int flags _AND
- char *sign _AND
- int *decpt _AND
- int ch _AND
- int *length)
+ _LONG_DOUBLE value;
#endif
+ int ndigits, flags, *decpt, ch, *length;
+ char *sign;
{
int mode, dsgn;
char *digits, *bp, *rve;
#ifdef _NO_LONGDBL
union double_union tmp;
#else
- union
- {
- struct ldieee ieee;
- _LONG_DOUBLE val;
- } ld;
+ struct ldieee *ldptr;
#endif
if (ch == 'f') {
@@ -1297,22 +1248,22 @@ _DEFUN(cvt, (data, value, ndigits, flags, sign, decpt, ch, length),
#ifdef _NO_LONGDBL
tmp.d = value;
- if (word0 (tmp) & Sign_bit) { /* this will check for < 0 and -0.0 */
+ if (word0(tmp) & Sign_bit) { /* this will check for < 0 and -0.0 */
value = -value;
*sign = '-';
} else
*sign = '\000';
- digits = _dtoa_r (data, value, mode, ndigits, decpt, &dsgn, &rve);
+ digits = _dtoa_r(data, value, mode, ndigits, decpt, &dsgn, &rve);
#else /* !_NO_LONGDBL */
- ld.val = value;
- if (ld.ieee.sign) { /* this will check for < 0 and -0.0 */
+ ldptr = (struct ldieee *)&value;
+ if (ldptr->sign) { /* this will check for < 0 and -0.0 */
value = -value;
*sign = '-';
} else
*sign = '\000';
- digits = _ldtoa_r (data, value, mode, ndigits, decpt, &dsgn, &rve);
+ digits = _ldtoa_r(data, value, mode, ndigits, decpt, &dsgn, &rve);
#endif /* !_NO_LONGDBL */
if ((ch != 'g' && ch != 'G') || flags & ALT) { /* Print trailing zeros */
@@ -1332,10 +1283,9 @@ _DEFUN(cvt, (data, value, ndigits, flags, sign, decpt, ch, length),
}
static int
-_DEFUN(exponent, (p0, exp, fmtch),
- char *p0 _AND
- int exp _AND
- int fmtch)
+exponent(p0, exp, fmtch)
+ char *p0;
+ int exp, fmtch;
{
register char *p, *t;
char expbuf[40];
@@ -1351,14 +1301,14 @@ _DEFUN(exponent, (p0, exp, fmtch),
t = expbuf + 40;
if (exp > 9) {
do {
- *--t = to_char (exp % 10);
+ *--t = to_char(exp % 10);
} while ((exp /= 10) > 9);
- *--t = to_char (exp);
+ *--t = to_char(exp);
for (; t < expbuf + 40; *p++ = *t++);
}
else {
*p++ = '0';
- *p++ = to_char (exp);
+ *p++ = to_char(exp);
}
return (p - p0);
}
@@ -1439,7 +1389,7 @@ typedef enum {
PWPOS, /* get positional parameter value for variable width or precision */
} ACTION;
-_CONST static CH_CLASS chclass[256] = {
+const static CH_CLASS chclass[256] = {
/* 00-07 */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
/* 08-0f */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
/* 10-17 */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
@@ -1474,7 +1424,7 @@ _CONST static CH_CLASS chclass[256] = {
/* f8-ff */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
};
-_CONST static STATE state_table[MAX_STATE][MAX_CH_CLASS] = {
+const static STATE state_table[MAX_STATE][MAX_CH_CLASS] = {
/* '0' '1-9' '$' MODFR SPEC '.' '*' FLAG OTHER */
/* START */ { SFLAG, WDIG, DONE, SMOD, DONE, SDOT, VARW, SFLAG, DONE },
/* SFLAG */ { SFLAG, WDIG, DONE, SMOD, DONE, SDOT, VARW, SFLAG, DONE },
@@ -1489,7 +1439,7 @@ _CONST static STATE state_table[MAX_STATE][MAX_CH_CLASS] = {
/* VPDIG */ { DONE, DONE, PREC, DONE, DONE, DONE, DONE, DONE, DONE },
};
-_CONST static ACTION action_table[MAX_STATE][MAX_CH_CLASS] = {
+const static ACTION action_table[MAX_STATE][MAX_CH_CLASS] = {
/* '0' '1-9' '$' MODFR SPEC '.' '*' FLAG OTHER */
/* START */ { NOOP, NUMBER, NOOP, GETMOD, GETARG, NOOP, NOOP, NOOP, NOOP },
/* SFLAG */ { NOOP, NUMBER, NOOP, GETMOD, GETARG, NOOP, NOOP, NOOP, NOOP },
@@ -1506,15 +1456,9 @@ _CONST static ACTION action_table[MAX_STATE][MAX_CH_CLASS] = {
/* function to get positional parameter N where n = N - 1 */
static union arg_val *
-_DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
- struct _reent *data _AND
- int n _AND
- char *fmt _AND
- va_list *ap _AND
- int *numargs_p _AND
- union arg_val *args _AND
- int *arg_type _AND
- char **last_fmt)
+get_arg (struct _reent *data, int n, char *fmt, va_list *ap,
+ int *numargs_p, union arg_val *args,
+ int *arg_type, char **last_fmt)
{
int ch;
int number, flags;
@@ -1526,7 +1470,7 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
int pos, last_arg;
int max_pos_arg = n;
enum types { INT, LONG_INT, SHORT_INT, QUAD_INT, CHAR, CHAR_PTR, DOUBLE, LONG_DOUBLE, WIDE_CHAR };
-#ifdef _MB_CAPABLE
+#ifdef MB_CAPABLE
wchar_t wc;
mbstate_t wc_state;
int nbytes;
@@ -1536,7 +1480,7 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
if (*last_fmt != NULL)
fmt = *last_fmt;
-#ifdef _MB_CAPABLE
+#ifdef MB_CAPABLE
memset (&wc_state, '\0', sizeof (wc_state));
#endif
@@ -1544,8 +1488,8 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
read the desired parameter from the vararg list. */
while (*fmt && n >= numargs)
{
-#ifdef _MB_CAPABLE
- while ((nbytes = _mbtowc_r (data, &wc, fmt, MB_CUR_MAX, &wc_state)) > 0)
+#ifdef MB_CAPABLE
+ while ((nbytes = _mbtowc_r(data, &wc, fmt, MB_CUR_MAX, &wc_state)) > 0)
{
fmt += nbytes;
if (wc == '%')
@@ -1666,27 +1610,27 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
switch (spec_type)
{
case LONG_INT:
- args[numargs++].val_long = va_arg (*ap, long);
+ args[numargs++].val_long = va_arg(*ap, long);
break;
case QUAD_INT:
- args[numargs++].val_quad_t = va_arg (*ap, quad_t);
+ args[numargs++].val_quad_t = va_arg(*ap, quad_t);
break;
case WIDE_CHAR:
- args[numargs++].val_wint_t = va_arg (*ap, wint_t);
+ args[numargs++].val_wint_t = va_arg(*ap, wint_t);
break;
case CHAR:
case SHORT_INT:
case INT:
- args[numargs++].val_int = va_arg (*ap, int);
+ args[numargs++].val_int = va_arg(*ap, int);
break;
case CHAR_PTR:
- args[numargs++].val_char_ptr_t = va_arg (*ap, char *);
+ args[numargs++].val_char_ptr_t = va_arg(*ap, char *);
break;
case DOUBLE:
- args[numargs++].val_double = va_arg (*ap, double);
+ args[numargs++].val_double = va_arg(*ap, double);
break;
case LONG_DOUBLE:
- args[numargs++].val__LONG_DOUBLE = va_arg (*ap, _LONG_DOUBLE);
+ args[numargs++].val__LONG_DOUBLE = va_arg(*ap, _LONG_DOUBLE);
break;
}
}
@@ -1694,13 +1638,13 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
break;
case GETPOS: /* we have positional specifier */
if (arg_type[0] == -1)
- memset (arg_type, 0, sizeof (int) * MAX_POS_ARGS);
+ memset (arg_type, 0, sizeof(int) * MAX_POS_ARGS);
pos = number - 1;
max_pos_arg = (max_pos_arg > pos ? max_pos_arg : pos);
break;
case PWPOS: /* we have positional specifier for width or precision */
if (arg_type[0] == -1)
- memset (arg_type, 0, sizeof (int) * MAX_POS_ARGS);
+ memset (arg_type, 0, sizeof(int) * MAX_POS_ARGS);
number -= 1;
arg_type[number] = INT;
max_pos_arg = (max_pos_arg > number ? max_pos_arg : number);
@@ -1709,18 +1653,18 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
--fmt;
/* fallthrough */
case GETPW: /* we have a variable precision or width to acquire */
- args[numargs++].val_int = va_arg (*ap, int);
+ args[numargs++].val_int = va_arg(*ap, int);
break;
case NUMBER: /* we have a number to process */
number = (ch - '0');
- while ((ch = *fmt) != '\0' && is_digit (ch))
+ while ((ch = *fmt) != '\0' && is_digit(ch))
{
number = number * 10 + (ch - '0');
++fmt;
}
break;
case SKIPNUM: /* we have a number to skip */
- while ((ch = *fmt) != '\0' && is_digit (ch))
+ while ((ch = *fmt) != '\0' && is_digit(ch))
++fmt;
break;
case NOOP:
@@ -1742,28 +1686,28 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
switch (arg_type[numargs])
{
case LONG_INT:
- args[numargs++].val_long = va_arg (*ap, long);
+ args[numargs++].val_long = va_arg(*ap, long);
break;
case QUAD_INT:
- args[numargs++].val_quad_t = va_arg (*ap, quad_t);
+ args[numargs++].val_quad_t = va_arg(*ap, quad_t);
break;
case CHAR_PTR:
- args[numargs++].val_char_ptr_t = va_arg (*ap, char *);
+ args[numargs++].val_char_ptr_t = va_arg(*ap, char *);
break;
case DOUBLE:
- args[numargs++].val_double = va_arg (*ap, double);
+ args[numargs++].val_double = va_arg(*ap, double);
break;
case LONG_DOUBLE:
- args[numargs++].val__LONG_DOUBLE = va_arg (*ap, _LONG_DOUBLE);
+ args[numargs++].val__LONG_DOUBLE = va_arg(*ap, _LONG_DOUBLE);
break;
case WIDE_CHAR:
- args[numargs++].val_wint_t = va_arg (*ap, wint_t);
+ args[numargs++].val_wint_t = va_arg(*ap, wint_t);
break;
case INT:
case SHORT_INT:
case CHAR:
default:
- args[numargs++].val_int = va_arg (*ap, int);
+ args[numargs++].val_int = va_arg(*ap, int);
break;
}
}
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c
index 4788938c9..eef38b9e8 100644
--- a/newlib/libc/stdio/vfscanf.c
+++ b/newlib/libc/stdio/vfscanf.c
@@ -1,20 +1,3 @@
-/*-
- * 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
<<vscanf>>, <<vfscanf>>, <<vsscanf>>---format argument list
@@ -33,12 +16,12 @@ ANSI_SYNOPSIS
int vfscanf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
int vsscanf(const char *<[str]>, const char *<[fmt]>, va_list <[list]>);
- int _vscanf_r(struct _reent *<[reent]>, const char *<[fmt]>,
+ int _vscanf_r(void *<[reent]>, const char *<[fmt]>,
+ va_list <[list]>);
+ int _vfscanf_r(void *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
va_list <[list]>);
- int _vfscanf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
+ int _vsscanf_r(void *<[reent]>, const char *<[str]>, const char *<[fmt]>,
va_list <[list]>);
- int _vsscanf_r(struct _reent *<[reent]>, const char *<[str]>,
- const char *<[fmt]>, va_list <[list]>);
TRAD_SYNOPSIS
#include <stdio.h>
@@ -58,18 +41,18 @@ TRAD_SYNOPSIS
va_list <[list]>;
int _vscanf_r( <[reent]>, <[fmt]>, <[ist]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[fmt]>;
va_list <[list]>;
int _vfscanf_r( <[reent]>, <[fp]>, <[fmt]>, <[list]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
FILE *<[fp]>;
char *<[fmt]>;
va_list <[list]>;
int _vsscanf_r( <[reent]>, <[str]>, <[fmt]>, <[list]>)
- struct _reent *<[reent]>;
+ char *<[reent]>;
char *<[str]>;
char *<[fmt]>;
va_list <[list]>;
@@ -102,9 +85,24 @@ These are GNU extensions.
Supporting OS subroutines required:
*/
+/*-
+ * 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.
+ */
+
#include <_ansi.h>
-#include <reent.h>
-#include <newlib.h>
#include <ctype.h>
#include <wctype.h>
#include <stdio.h>
@@ -119,34 +117,27 @@ Supporting OS subroutines required:
#endif
#include "local.h"
-#ifdef INTEGER_ONLY
-#define VFSCANF vfiscanf
-#define _VFSCANF_R _vfiscanf_r
-#define __SVFSCANF __svfiscanf
-#define __SVFSCANF_R __svfiscanf_r
-#else
-#define VFSCANF vfscanf
-#define _VFSCANF_R _vfscanf_r
-#define __SVFSCANF __svfscanf
-#define __SVFSCANF_R __svfscanf_r
-#ifndef NO_FLOATING_POINT
+#ifndef NO_FLOATING_POINT
#define FLOATING_POINT
#endif
-#endif
#ifdef FLOATING_POINT
-#include <math.h>
#include <float.h>
/* Currently a test is made to see if long double processing is warranted.
This could be changed in the future should the _ldtoa_r code be
preferred over _dtoa_r. */
#define _NO_LONGDBL
-#if defined _WANT_IO_LONG_DOUBLE && (LDBL_MANT_DIG > DBL_MANT_DIG)
+#if defined WANT_IO_LONG_DBL && (LDBL_MANT_DIG > DBL_MANT_DIG)
#undef _NO_LONGDBL
extern _LONG_DOUBLE _strtold _PARAMS((char *s, char **sptr));
#endif
+#define _NO_LONGLONG
+#if defined WANT_PRINTF_LONG_LONG && defined __GNUC__
+# undef _NO_LONGLONG
+#endif
+
#include "floatio.h"
#if ((MAXEXP+MAXFRACT+3) > MB_LEN_MAX)
@@ -162,11 +153,6 @@ extern _LONG_DOUBLE _strtold _PARAMS((char *s, char **sptr));
#define BUF 40
#endif
-#define _NO_LONGLONG
-#if defined _WANT_IO_LONG_LONG && defined __GNUC__
-# undef _NO_LONGLONG
-#endif
-
/*
* Flags used during conversion.
*/
@@ -193,7 +179,6 @@ extern _LONG_DOUBLE _strtold _PARAMS((char *s, char **sptr));
#define PFXOK 0x200 /* 0x prefix is (still) legal */
#define NZDIGITS 0x400 /* no zero digits detected */
-#define NNZDIGITS 0x800 /* no non-zero digits detected */
/*
* Conversion types.
@@ -226,44 +211,43 @@ typedef unsigned long long u_long_long;
#ifndef _REENT_ONLY
int
-_DEFUN(VFSCANF, (fp, fmt, ap),
- register FILE *fp _AND
- _CONST char *fmt _AND
- va_list ap)
+_DEFUN (vfscanf, (fp, fmt, ap),
+ register FILE *fp _AND
+ _CONST char *fmt _AND
+ va_list ap)
{
- CHECK_INIT(_REENT);
- return __SVFSCANF_R (_REENT, fp, fmt, ap);
+ CHECK_INIT(fp);
+ return __svfscanf_r (_REENT, fp, fmt, ap);
}
int
-_DEFUN(__SVFSCANF, (fp, fmt0, ap),
- register FILE *fp _AND
- char _CONST *fmt0 _AND
- va_list ap)
+__svfscanf (fp, fmt0, ap)
+ register FILE *fp;
+ char _CONST *fmt0;
+ va_list ap;
{
- return __SVFSCANF_R (_REENT, fp, fmt0, ap);
+ return __svfscanf_r (_REENT, fp, fmt0, ap);
}
#endif /* !_REENT_ONLY */
int
-_DEFUN(_VFSCANF_R, (data, fp, fmt, ap),
- struct _reent *data _AND
- register FILE *fp _AND
- _CONST char *fmt _AND
- va_list ap)
+_DEFUN (_vfscanf_r, (data, fp, fmt, ap),
+ struct _reent *data _AND
+ register FILE *fp _AND
+ _CONST char *fmt _AND
+ va_list ap)
{
- CHECK_INIT(data);
- return __SVFSCANF_R (data, fp, fmt, ap);
+ return __svfscanf_r (data, fp, fmt, ap);
}
int
-_DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
- struct _reent *rptr _AND
- register FILE *fp _AND
- char _CONST *fmt0 _AND
- va_list ap)
+__svfscanf_r (rptr, fp, fmt0, ap)
+ struct _reent *rptr;
+ register FILE *fp;
+ char _CONST *fmt0;
+ va_list ap;
{
register u_char *fmt = (u_char *) fmt0;
register int c; /* character from format, or conversion */
@@ -301,13 +285,11 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
static _CONST short basefix[17] =
{10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
- _flockfile (fp);
-
nassigned = 0;
nread = 0;
for (;;)
{
-#ifndef _MB_CAPABLE
+#ifndef MB_CAPABLE
wc = *fmt;
#else
memset (&state, '\0', sizeof (state));
@@ -315,7 +297,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
#endif
fmt += nbytes;
if (wc == 0)
- goto all_done;
+ return nassigned;
if (nbytes == 1 && isspace (wc))
{
for (;;)
@@ -517,7 +499,6 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
* Disgusting backwards compatibility hacks. XXX
*/
case '\0': /* compat */
- _funlockfile (fp);
return EOF;
default: /* compat */
@@ -570,7 +551,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
if (flags & LONG)
{
if ((flags & SUPPRESS) == 0)
- wcp = va_arg (ap, wchar_t *);
+ wcp = va_arg(ap, wchar_t *);
else
wcp = NULL;
n = 0;
@@ -581,8 +562,8 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
buf[n++] = *fp->_p;
fp->_r -= 1;
fp->_p += 1;
- memset ((_PTR)&state, '\0', sizeof (mbstate_t));
- if ((mbslen = _mbrtowc_r (rptr, wcp, buf, n, &state))
+ memset((void *)&state, '\0', sizeof(mbstate_t));
+ if ((mbslen = _mbrtowc_r(rptr, wcp, buf, n, &state))
== (size_t)-1)
goto input_failure; /* Invalid sequence */
if (mbslen == 0 && !(flags & SUPPRESS))
@@ -699,19 +680,19 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
{
/* Process %S and %ls placeholders */
if ((flags & SUPPRESS) == 0)
- wcp = va_arg (ap, wchar_t *);
+ wcp = va_arg(ap, wchar_t *);
else
wcp = &wc;
n = 0;
- while (!isspace (*fp->_p) && width != 0)
+ while (!isspace(*fp->_p) && width != 0)
{
if (n == MB_CUR_MAX)
goto input_failure;
buf[n++] = *fp->_p;
fp->_r -= 1;
fp->_p += 1;
- memset ((_PTR)&state, '\0', sizeof (mbstate_t));
- if ((mbslen = _mbrtowc_r (rptr, wcp, buf, n, &state))
+ memset((void *)&state, '\0', sizeof(mbstate_t));
+ if ((mbslen = _mbrtowc_r(rptr, wcp, buf, n, &state))
== (size_t)-1)
goto input_failure;
if (mbslen == 0)
@@ -721,7 +702,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
if (iswspace(*wcp))
{
while (n != 0)
- ungetc (buf[--n], fp);
+ ungetc(buf[--n], fp);
break;
}
nread += n;
@@ -775,21 +756,17 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
continue;
case CT_INT:
- {
/* scan an integer as if by strtol/strtoul */
- unsigned width_left = 0;
- int skips = 0;
#ifdef hardway
if (width == 0 || width > sizeof (buf) - 1)
+ width = sizeof (buf) - 1;
#else
/* size_t is unsigned, hence this optimisation */
- if (width - 1 > sizeof (buf) - 2)
+ if (--width > sizeof (buf) - 2)
+ width = sizeof (buf) - 2;
+ width++;
#endif
- {
- width_left = width - (sizeof (buf) - 1);
- width = sizeof (buf) - 1;
- }
- flags |= SIGNOK | NDIGITS | NZDIGITS | NNZDIGITS;
+ flags |= SIGNOK | NDIGITS | NZDIGITS;
for (p = buf; width; width--)
{
c = *fp->_p;
@@ -809,26 +786,16 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
* will turn it off if we have scanned any nonzero digits).
*/
case '0':
- if (! (flags & NNZDIGITS))
- goto ok;
if (base == 0)
{
base = 8;
flags |= PFXOK;
}
if (flags & NZDIGITS)
- {
- flags &= ~(SIGNOK | NZDIGITS | NDIGITS);
- goto ok;
- }
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- if (width_left)
- {
- width_left--;
- width++;
- }
- ++skips;
- goto skip;
+ flags &= ~(SIGNOK | NZDIGITS | NDIGITS);
+ else
+ flags &= ~(SIGNOK | PFXOK | NDIGITS);
+ goto ok;
/* 1 through 7 always legal */
case '1':
@@ -839,7 +806,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
case '6':
case '7':
base = basefix[base];
- flags &= ~(SIGNOK | PFXOK | NDIGITS | NNZDIGITS);
+ flags &= ~(SIGNOK | PFXOK | NDIGITS);
goto ok;
/* digits 8 and 9 ok iff decimal or hex */
@@ -848,7 +815,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
base = basefix[base];
if (base <= 8)
break; /* not legal here */
- flags &= ~(SIGNOK | PFXOK | NDIGITS | NNZDIGITS);
+ flags &= ~(SIGNOK | PFXOK | NDIGITS);
goto ok;
/* letters ok iff hex */
@@ -867,7 +834,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
/* no need to fix base here */
if (base <= 10)
break; /* not legal here */
- flags &= ~(SIGNOK | PFXOK | NDIGITS | NNZDIGITS);
+ flags &= ~(SIGNOK | PFXOK | NDIGITS);
goto ok;
/* sign ok only as first character */
@@ -887,10 +854,6 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
{
base = 16;/* if %i */
flags &= ~PFXOK;
- /* We must reset the NZDIGITS and NDIGITS
- flags that would have been unset by seeing
- the zero that preceded the X or x. */
- flags |= NZDIGITS | NDIGITS;
goto ok;
}
break;
@@ -906,7 +869,6 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
* c is legal: store it and look at the next.
*/
*p++ = c;
- skip:
if (--fp->_r > 0)
fp->_p++;
else
@@ -972,9 +934,9 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
}
nassigned++;
}
- nread += p - buf + skips;
+ nread += p - buf;
break;
- }
+
#ifdef FLOATING_POINT
case CT_FLOAT:
{
@@ -986,18 +948,15 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
long leading_zeroes = 0;
long zeroes, exp_adjust;
char *exp_start = NULL;
- unsigned width_left = 0;
- int nancount = 0;
#ifdef hardway
if (width == 0 || width > sizeof (buf) - 1)
+ width = sizeof (buf) - 1;
#else
/* size_t is unsigned, hence this optimisation */
- if (width - 1 > sizeof (buf) - 2)
+ if (--width > sizeof (buf) - 2)
+ width = sizeof (buf) - 2;
+ width++;
#endif
- {
- width_left = width - (sizeof (buf) - 1);
- width = sizeof (buf) - 1;
- }
flags |= SIGNOK | NDIGITS | DPTOK | EXPOK;
zeroes = 0;
exp_adjust = 0;
@@ -1010,16 +969,12 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
*/
switch (c)
{
+
case '0':
if (flags & NDIGITS)
{
flags &= ~SIGNOK;
zeroes++;
- if (width_left)
- {
- width_left--;
- width++;
- }
goto fskip;
}
/* Fall through. */
@@ -1032,12 +987,8 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
case '7':
case '8':
case '9':
- if (nancount == 0)
- {
- flags &= ~(SIGNOK | NDIGITS);
- goto fok;
- }
- break;
+ flags &= ~(SIGNOK | NDIGITS);
+ goto fok;
case '+':
case '-':
@@ -1047,30 +998,6 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
goto fok;
}
break;
- case 'n':
- case 'N':
- if (nancount == 0
- && (flags & (SIGNOK | NDIGITS | DPTOK | EXPOK)) ==
- (SIGNOK | NDIGITS | DPTOK | EXPOK))
- {
- flags &= ~(SIGNOK | DPTOK | EXPOK | NDIGITS);
- nancount = 1;
- goto fok;
- }
- else if (nancount == 2)
- {
- nancount = 3;
- goto fok;
- }
- break;
- case 'a':
- case 'A':
- if (nancount == 1)
- {
- nancount = 2;
- goto fok;
- }
- break;
case '.':
if (flags & DPTOK)
{
@@ -1112,24 +1039,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
}
if (zeroes)
flags &= ~NDIGITS;
- /* We may have a 'N' or possibly even a 'Na' as the start of 'NaN',
- only to run out of chars before it was complete (or having
- encountered a non- matching char). So check here if we have an
- outstanding nancount, and if so put back the chars we did
- swallow and treat as a failed match. */
- if (nancount && nancount != 3)
- {
- /* Ok... what are we supposed to do in the event that the
- __srefill call above was triggered in the middle of the partial
- 'NaN' and so we can't put it all back? */
- while (nancount-- && (p > buf))
- {
- ungetc (*(u_char *)--p, fp);
- --nread;
- }
- goto match_failure;
- }
- /*
+ /*
* If no digits, might be missing exponent digits
* (just give back the exponent) or might be missing
* regular digits, but had sign and/or decimal point.
@@ -1141,7 +1051,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
/* no digits at all */
while (p > buf)
{
- ungetc (*(u_char *)--p, fp);
+ ungetc (*(u_char *)-- p, fp);
--nread;
}
goto match_failure;
@@ -1210,10 +1120,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
else
{
flp = va_arg (ap, float *);
- if (isnan (res))
- *flp = nanf (NULL);
- else
- *flp = res;
+ *flp = res;
}
nassigned++;
}
@@ -1223,10 +1130,111 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
}
}
input_failure:
- _funlockfile (fp);
return nassigned ? nassigned : -1;
match_failure:
-all_done:
- _funlockfile (fp);
return nassigned;
}
+
+/*
+ * Fill in the given table from the scanset at the given format
+ * (just after `['). Return a pointer to the character past the
+ * closing `]'. The table has a 1 wherever characters should be
+ * considered part of the scanset.
+ */
+
+/*static*/
+u_char *
+__sccl (tab, fmt)
+ register char *tab;
+ register u_char *fmt;
+{
+ register int c, n, v;
+
+ /* first `clear' the whole table */
+ c = *fmt++; /* first char hat => negated scanset */
+ if (c == '^')
+ {
+ v = 1; /* default => accept */
+ c = *fmt++; /* get new first char */
+ }
+ else
+ v = 0; /* default => reject */
+ /* should probably use memset here */
+ for (n = 0; n < 256; n++)
+ tab[n] = v;
+ if (c == 0)
+ return fmt - 1; /* format ended before closing ] */
+
+ /*
+ * Now set the entries corresponding to the actual scanset to the
+ * opposite of the above.
+ *
+ * The first character may be ']' (or '-') without being special; the
+ * last character may be '-'.
+ */
+
+ v = 1 - v;
+ for (;;)
+ {
+ tab[c] = v; /* take character c */
+ doswitch:
+ n = *fmt++; /* and examine the next */
+ switch (n)
+ {
+
+ case 0: /* format ended too soon */
+ return fmt - 1;
+
+ case '-':
+ /*
+ * A scanset of the form [01+-] is defined as `the digit 0, the
+ * digit 1, the character +, the character -', but the effect of a
+ * scanset such as [a-zA-Z0-9] is implementation defined. The V7
+ * Unix scanf treats `a-z' as `the letters a through z', but treats
+ * `a-a' as `the letter a, the character -, and the letter a'.
+ *
+ * For compatibility, the `-' is not considerd to define a range if
+ * the character following it is either a close bracket (required by
+ * ANSI) or is not numerically greater than the character we just
+ * stored in the table (c).
+ */
+ n = *fmt;
+ if (n == ']' || n < c)
+ {
+ c = '-';
+ break; /* resume the for(;;) */
+ }
+ fmt++;
+ do
+ { /* fill in the range */
+ tab[++c] = v;
+ }
+ while (c < n);
+#if 1 /* XXX another disgusting compatibility hack */
+ /*
+ * Alas, the V7 Unix scanf also treats formats such
+ * as [a-c-e] as `the letters a through e'. This too
+ * is permitted by the standard....
+ */
+ goto doswitch;
+#else
+ c = *fmt++;
+ if (c == 0)
+ return fmt - 1;
+ if (c == ']')
+ return fmt;
+#endif
+
+ break;
+
+
+ case ']': /* end of scanset */
+ return fmt;
+
+ default: /* just another character */
+ c = n;
+ break;
+ }
+ }
+ /* NOTREACHED */
+}
diff --git a/newlib/libc/stdio/viprintf.c b/newlib/libc/stdio/viprintf.c
deleted file mode 100644
index cea96d3db..000000000
--- a/newlib/libc/stdio/viprintf.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * 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
-<<viprintf>>, <<vfiprintf>>, <<vsiprintf>>---format argument list
-
-INDEX
- viprintf
-INDEX
- vfiprintf
-INDEX
- vsiprintf
-INDEX
- vsniprintf
-
-ANSI_SYNOPSIS
- #include <stdio.h>
- #include <stdarg.h>
- int viprintf(const char *<[fmt]>, va_list <[list]>);
- int vfiprintf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
- int vsiprintf(char *<[str]>, const char *<[fmt]>, va_list <[list]>);
- int vasiprintf(char **<[strp]>, const char *<[fmt]>, va_list <[list]>);
- int vsniprintf(char *<[str]>, size_t <[size]>, const char *<[fmt]>,
- va_list <[list]>);
-
- int _viprintf_r(struct _reent *<[reent]>, const char *<[fmt]>,
- va_list <[list]>);
- int _vfiprintf_r(struct _reent *<[reent]>, FILE *<[fp]>,
- const char *<[fmt]>, va_list <[list]>);
- int _vasiprintf_r(struct _reent *<[reent]>, char **<[str]>,
- const char *<[fmt]>, va_list <[list]>);
- int _vsiprintf_r(struct _reent *<[reent]>, char *<[str]>,
- const char *<[fmt]>, va_list <[list]>);
- int _vsniprintf_r(struct _reent *<[reent]>, char *<[str]>, size_t <[size]>,
- const char *<[fmt]>, va_list <[list]>);
-
-TRAD_SYNOPSIS
- #include <stdio.h>
- #include <varargs.h>
- int viprintf( <[fmt]>, <[list]>)
- char *<[fmt]>;
- va_list <[list]>;
-
- int vfiprintf(<[fp]>, <[fmt]>, <[list]>)
- FILE *<[fp]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int vasiprintf(<[strp]>, <[fmt]>, <[list]>)
- char **<[strp]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int vsiprintf(<[str]>, <[fmt]>, <[list]>)
- char *<[str]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int vsniprintf(<[str]>, <[size]>, <[fmt]>, <[list]>)
- char *<[str]>;
- size_t <[size]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _viprintf_r(<[reent]>, <[fmt]>, <[list]>)
- struct _reent *<[reent]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _vfiprintf_r(<[reent]>, <[fp]>, <[fmt]>, <[list]>)
- struct _reent *<[reent]>;
- FILE *<[fp]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _vasiprintf_r(<[reent]>, <[strp]>, <[fmt]>, <[list]>)
- struct _reent *<[reent]>;
- char **<[strp]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _vsiprintf_r(<[reent]>, <[str]>, <[fmt]>, <[list]>)
- struct _reent *<[reent]>;
- char *<[str]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _vsniprintf_r(<[reent]>, <[str]>, <[size]>, <[fmt]>, <[list]>)
- struct _reent *<[reent]>;
- char *<[str]>;
- size_t <[size]>;
- char *<[fmt]>;
- va_list <[list]>;
-
-DESCRIPTION
-<<viprintf>>, <<vfiprintf>>, <<vasiprintf>>, <<vsiprintf>> and
-<<vsniprintf>> are (respectively) variants of <<iprintf>>, <<fiprintf>>,
-<<asiprintf>>, <<siprintf>>, and <<sniprintf>>. They differ only in
-restricting the caller to use non-floating-point format specifiers.
-
-RETURNS
-The return values are consistent with the corresponding functions:
-<<vasiprintf>>/<<vsiprintf>> returns the number of bytes in the output string,
-save that the concluding <<NULL>> is not counted.
-<<viprintf>> and <<vfiprintf>> return the number of characters transmitted.
-If an error occurs, <<viprintf>> and <<vfiprintf>> return <<EOF>> and
-<<vasiprintf>> returns -1. No error returns occur for <<vsiprintf>>.
-
-PORTABILITY
-<<viprintf>>, <<vfiprintf>>, <<vasiprintf>>, <<vsiprintf>> and <<vsniprintf>>
-are newlib extensions.
-
-Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
-<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
-*/
-
-#include <_ansi.h>
-#include <reent.h>
-#include <stdio.h>
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include "local.h"
-
-#ifndef _REENT_ONLY
-
-int
-_DEFUN(viprintf, (fmt, ap),
- _CONST char *fmt _AND
- va_list ap)
-{
- _REENT_SMALL_CHECK_INIT (_REENT);
- return _vfiprintf_r (_REENT, _stdout_r (_REENT), fmt, ap);
-}
-
-#endif /* !_REENT_ONLY */
-
-int
-_DEFUN(_viprintf_r, (ptr, fmt, ap),
- struct _reent *ptr _AND
- _CONST char *fmt _AND
- va_list ap)
-{
- _REENT_SMALL_CHECK_INIT (ptr);
- return _vfiprintf_r (ptr, _stdout_r (ptr), fmt, ap);
-}
diff --git a/newlib/libc/stdio/viscanf.c b/newlib/libc/stdio/viscanf.c
deleted file mode 100644
index f335f69ff..000000000
--- a/newlib/libc/stdio/viscanf.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*-
- * Code created by modifying iscanf.c which has following copyright.
- *
- * 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
-<<viscanf>>, <<vfiscanf>>, <<vsiscanf>>---format argument list
-
-INDEX
- viscanf
-INDEX
- vfiscanf
-INDEX
- vsiscanf
-
-ANSI_SYNOPSIS
- #include <stdio.h>
- #include <stdarg.h>
- int viscanf(const char *<[fmt]>, va_list <[list]>);
- int vfiscanf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
- int vsiscanf(const char *<[str]>, const char *<[fmt]>, va_list <[list]>);
-
- int _viscanf_r(struct _reent *<[reent]>, const char *<[fmt]>,
- va_list <[list]>);
- int _vfiscanf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
- va_list <[list]>);
- int _vsiscanf_r(struct _reent *<[reent]>, const char *<[str]>,
- const char *<[fmt]>, va_list <[list]>);
-
-TRAD_SYNOPSIS
- #include <stdio.h>
- #include <varargs.h>
- int viscanf( <[fmt]>, <[ist]>)
- char *<[fmt]>;
- va_list <[list]>;
-
- int vfiscanf( <[fp]>, <[fmt]>, <[list]>)
- FILE *<[fp]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int vsiscanf( <[str]>, <[fmt]>, <[list]>)
- char *<[str]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _viscanf_r( <[reent]>, <[fmt]>, <[ist]>)
- struct _reent *<[reent]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _vfiscanf_r( <[reent]>, <[fp]>, <[fmt]>, <[list]>)
- struct _reent *<[reent]>;
- FILE *<[fp]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _vsiscanf_r( <[reent]>, <[str]>, <[fmt]>, <[list]>)
- struct _reent *<[reent]>;
- char *<[str]>;
- char *<[fmt]>;
- va_list <[list]>;
-
-DESCRIPTION
-<<viscanf>>, <<vfiscanf>>, and <<vsiscanf>> are (respectively) variants
-of <<iscanf>>, <<fiscanf>>, and <<siscanf>>. They differ only in
-allowing their caller to pass the variable argument list as a
-<<va_list>> object (initialized by <<va_start>>) rather than
-directly accepting a variable number of arguments.
-
-RETURNS
-The return values are consistent with the corresponding functions:
-<<viscanf>> returns the number of input fields successfully scanned,
-converted, and stored; the return value does not include scanned
-fields which were not stored.
-
-If <<viscanf>> attempts to read at end-of-file, the return value
-is <<EOF>>.
-
-If no fields were stored, the return value is <<0>>.
-
-The routines <<_viscanf_r>>, <<_vfiscanf_f>>, and <<_vsiscanf_r>> are
-reentrant versions which take an additional first parameter which points to the
-reentrancy structure.
-
-PORTABILITY
-These are newlib extensions.
-
-Supporting OS subroutines required:
-*/
-
-#include <_ansi.h>
-#include <reent.h>
-#include <stdio.h>
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include "local.h"
-
-#ifndef _REENT_ONLY
-
-int
-_DEFUN(viscanf, (fmt, ap),
- _CONST char *fmt _AND
- va_list ap)
-{
- _REENT_SMALL_CHECK_INIT (_REENT);
- return __svfiscanf_r (_REENT, _stdin_r (_REENT), fmt, ap);
-}
-
-#endif /* !_REENT_ONLY */
-
-int
-_DEFUN(_viscanf_r, (ptr, fmt, ap),
- struct _reent *ptr _AND
- _CONST char *fmt _AND
- va_list ap)
-{
- _REENT_SMALL_CHECK_INIT (ptr);
- return __svfiscanf_r (ptr, _stdin_r (ptr), fmt, ap);
-}
-
diff --git a/newlib/libc/stdio/vprintf.c b/newlib/libc/stdio/vprintf.c
index 69edc87ae..916d51898 100644
--- a/newlib/libc/stdio/vprintf.c
+++ b/newlib/libc/stdio/vprintf.c
@@ -1,3 +1,5 @@
+/* doc in vfprintf.c */
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -14,37 +16,37 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* doc in vfprintf.c */
#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
+
#ifdef _HAVE_STDC
#include <stdarg.h>
#else
#include <varargs.h>
#endif
+
#include "local.h"
#ifndef _REENT_ONLY
int
-_DEFUN(vprintf, (fmt, ap),
- _CONST char *fmt _AND
- va_list ap)
+_DEFUN (vprintf, (fmt, ap),
+ _CONST char *fmt _AND
+ va_list ap)
{
- _REENT_SMALL_CHECK_INIT (_REENT);
+ _REENT_SMALL_CHECK_INIT(_stdout_r (_REENT));
return _vfprintf_r (_REENT, _stdout_r (_REENT), fmt, ap);
}
#endif /* !_REENT_ONLY */
int
-_DEFUN(_vprintf_r, (ptr, fmt, ap),
- struct _reent *ptr _AND
- _CONST char *fmt _AND
- va_list ap)
+_DEFUN (_vprintf_r, (ptr, fmt, ap),
+ struct _reent *ptr _AND
+ _CONST char *fmt _AND
+ va_list ap)
{
- _REENT_SMALL_CHECK_INIT (ptr);
+ _REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
return _vfprintf_r (ptr, _stdout_r (ptr), fmt, ap);
}
diff --git a/newlib/libc/stdio/vscanf.c b/newlib/libc/stdio/vscanf.c
index e559b77a8..e494aaf60 100644
--- a/newlib/libc/stdio/vscanf.c
+++ b/newlib/libc/stdio/vscanf.c
@@ -18,35 +18,39 @@
*/
#include <_ansi.h>
-#include <reent.h>
#include <stdio.h>
+#include "local.h"
+
#ifdef _HAVE_STDC
#include <stdarg.h>
#else
#include <varargs.h>
#endif
-#include "local.h"
+
+/*
+ * vscanf
+ */
#ifndef _REENT_ONLY
int
-_DEFUN(vscanf, (fmt, ap),
- _CONST char *fmt _AND
- va_list ap)
+_DEFUN (vscanf, (fmt, ap),
+ _CONST char *fmt _AND
+ va_list ap)
{
- _REENT_SMALL_CHECK_INIT (_REENT);
+ _REENT_SMALL_CHECK_INIT(_stdin_r (_REENT));
return __svfscanf_r (_REENT, _stdin_r (_REENT), fmt, ap);
}
#endif /* !_REENT_ONLY */
int
-_DEFUN(_vscanf_r, (ptr, fmt, ap),
- struct _reent *ptr _AND
- _CONST char *fmt _AND
- va_list ap)
+_DEFUN (_vscanf_r, (ptr, fmt, ap),
+ struct _reent *ptr _AND
+ _CONST char *fmt _AND
+ va_list ap)
{
- _REENT_SMALL_CHECK_INIT (ptr);
+ _REENT_SMALL_CHECK_INIT(_stdin_r (ptr));
return __svfscanf_r (ptr, _stdin_r (ptr), fmt, ap);
}
diff --git a/newlib/libc/stdio/vsiprintf.c b/newlib/libc/stdio/vsiprintf.c
deleted file mode 100644
index c9d263803..000000000
--- a/newlib/libc/stdio/vsiprintf.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.
- */
-/* doc in vfiprintf.c */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "%W% (Berkeley) %G%";
-#endif /* LIBC_SCCS and not lint */
-
-#include <_ansi.h>
-#include <reent.h>
-#include <stdio.h>
-#include <limits.h>
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#ifndef _REENT_ONLY
-
-int
-_DEFUN(vsiprintf, (str, fmt, ap),
- char *str _AND
- _CONST char *fmt _AND
- va_list ap)
-{
- int ret;
- FILE f;
-
- f._flags = __SWR | __SSTR;
- f._bf._base = f._p = (unsigned char *) str;
- f._bf._size = f._w = INT_MAX;
- f._file = -1; /* No file. */
- ret = _vfiprintf_r (_REENT, &f, fmt, ap);
- *f._p = 0;
- return ret;
-}
-
-#endif /* !_REENT_ONLY */
-
-int
-_DEFUN(_vsiprintf_r, (ptr, str, fmt, ap),
- struct _reent *ptr _AND
- char *str _AND
- _CONST char *fmt _AND
- va_list ap)
-{
- int ret;
- FILE f;
-
- f._flags = __SWR | __SSTR;
- f._bf._base = f._p = (unsigned char *) str;
- f._bf._size = f._w = INT_MAX;
- f._file = -1; /* No file. */
- ret = _vfiprintf_r (ptr, &f, fmt, ap);
- *f._p = 0;
- return ret;
-}
-
diff --git a/newlib/libc/stdio/vsiscanf.c b/newlib/libc/stdio/vsiscanf.c
deleted file mode 100644
index c6201847a..000000000
--- a/newlib/libc/stdio/vsiscanf.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Code created by modifying iscanf.c which has following copyright.
- *
- * 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.
- */
-
-#include <_ansi.h>
-#include <reent.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include "local.h"
-
-static _READ_WRITE_RETURN_TYPE
-_DEFUN(eofread1, (cookie, buf, len),
- _PTR cookie _AND
- char *buf _AND
- int len)
-{
- return 0;
-}
-
-/*
- * vsiscanf
- */
-
-#ifndef _REENT_ONLY
-
-int
-_DEFUN(vsiscanf, (str, fmt, ap),
- _CONST char *str _AND
- _CONST char *fmt _AND
- va_list ap)
-{
- return _vsiscanf_r (_REENT, str, fmt, ap);
-}
-
-#endif /* !_REENT_ONLY */
-
-int
-_DEFUN(_vsiscanf_r, (ptr, str, fmt, ap),
- struct _reent *ptr _AND
- _CONST char *str _AND
- _CONST char *fmt _AND
- va_list ap)
-{
- FILE f;
-
- f._flags = __SRD | __SSTR;
- f._bf._base = f._p = (unsigned char *) str;
- f._bf._size = f._r = strlen (str);
- f._read = eofread1;
- f._ub._base = NULL;
- f._lb._base = NULL;
- f._file = -1; /* No file. */
- return __svfiscanf_r (ptr, &f, fmt, ap);
-}
diff --git a/newlib/libc/stdio/vsniprintf.c b/newlib/libc/stdio/vsniprintf.c
deleted file mode 100644
index 6a5bd45bb..000000000
--- a/newlib/libc/stdio/vsniprintf.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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
-<<vsniprintf>>---write formatted output (integer only)
-
-INDEX
- vsniprintf
-
-ANSI_SYNOPSIS
- #include <stdio.h>
-
- int vsniprintf(char *<[str]>, size_t <[size]>, const char *<[fmt]>, va_list <[list]>);
-
-TRAD_SYNOPSIS
- #include <stdio.h>
-
- int vsnprintf(<[str]>, <[size]>, <[fmt]>, <[list]>)
- char *<[str]>;
- size_t <[size]>;
- char *<[fmt]>;
- va_list <[list]>;
-
-DESCRIPTION
-<<vsniprintf>> is a restricted version of <<vsnprintf>>: it has the same
-arguments and behavior, save that it cannot perform any floating-point
-formatting: the <<f>>, <<g>>, <<G>>, <<e>>, and <<F>> type specifiers
-are not recognized.
-
-RETURNS
- <<vsniprintf>> returns the number of bytes in the output string,
- save that the concluding <<NULL>> is not counted.
- <<vsniprintf>> returns when the end of the format string is
- encountered.
-
-PORTABILITY
-<<vsniprintf>> is not required by ANSI C.
-
-Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
-<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
-*/
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "%W% (Berkeley) %G%";
-#endif /* LIBC_SCCS and not lint */
-
-#include <_ansi.h>
-#include <reent.h>
-#include <stdio.h>
-#include <limits.h>
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#ifndef _REENT_ONLY
-
-int
-_DEFUN(vsniprintf, (str, size, fmt, ap),
- char *str _AND
- size_t size _AND
- _CONST char *fmt _AND
- va_list ap)
-{
- int ret;
- FILE f;
-
- f._flags = __SWR | __SSTR;
- f._bf._base = f._p = (unsigned char *) str;
- f._bf._size = f._w = (size > 0 ? size - 1 : 0);
- f._file = -1; /* No file. */
- ret = _vfiprintf_r (_REENT, &f, fmt, ap);
- if (size > 0)
- *f._p = 0;
- return ret;
-}
-
-#endif /* !_REENT_ONLY */
-
-int
-_DEFUN(_vsniprintf_r, (ptr, str, size, fmt, ap),
- struct _reent *ptr _AND
- char *str _AND
- size_t size _AND
- _CONST char *fmt _AND
- va_list ap)
-{
- int ret;
- FILE f;
-
- f._flags = __SWR | __SSTR;
- f._bf._base = f._p = (unsigned char *) str;
- f._bf._size = f._w = (size > 0 ? size - 1 : 0);
- f._file = -1; /* No file. */
- ret = _vfiprintf_r (ptr, &f, fmt, ap);
- if (size > 0)
- *f._p = 0;
- return ret;
-}
diff --git a/newlib/libc/stdio/vsnprintf.c b/newlib/libc/stdio/vsnprintf.c
index 9fc1b2d89..0393ead29 100644
--- a/newlib/libc/stdio/vsnprintf.c
+++ b/newlib/libc/stdio/vsnprintf.c
@@ -1,3 +1,7 @@
+/* doc in vfprintf.c */
+
+/* This code created by modifying vsprintf.c so copyright inherited. */
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -14,7 +18,6 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* doc in vfprintf.c */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%";
@@ -33,11 +36,11 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#ifndef _REENT_ONLY
int
-_DEFUN(vsnprintf, (str, size, fmt, ap),
- char *str _AND
- size_t size _AND
- _CONST char *fmt _AND
- va_list ap)
+_DEFUN (vsnprintf, (str, size, fmt, ap),
+ char *str _AND
+ size_t size _AND
+ _CONST char *fmt _AND
+ va_list ap)
{
int ret;
FILE f;
@@ -45,7 +48,6 @@ _DEFUN(vsnprintf, (str, size, fmt, ap),
f._flags = __SWR | __SSTR;
f._bf._base = f._p = (unsigned char *) str;
f._bf._size = f._w = (size > 0 ? size - 1 : 0);
- f._file = -1; /* No file. */
ret = _vfprintf_r (_REENT, &f, fmt, ap);
if (size > 0)
*f._p = 0;
@@ -55,12 +57,12 @@ _DEFUN(vsnprintf, (str, size, fmt, ap),
#endif /* !_REENT_ONLY */
int
-_DEFUN(_vsnprintf_r, (ptr, str, size, fmt, ap),
- struct _reent *ptr _AND
- char *str _AND
- size_t size _AND
- _CONST char *fmt _AND
- va_list ap)
+_DEFUN (_vsnprintf_r, (ptr, str, size, fmt, ap),
+ struct _reent *ptr _AND
+ char *str _AND
+ size_t size _AND
+ _CONST char *fmt _AND
+ va_list ap)
{
int ret;
FILE f;
@@ -68,7 +70,6 @@ _DEFUN(_vsnprintf_r, (ptr, str, size, fmt, ap),
f._flags = __SWR | __SSTR;
f._bf._base = f._p = (unsigned char *) str;
f._bf._size = f._w = (size > 0 ? size - 1 : 0);
- f._file = -1; /* No file. */
ret = _vfprintf_r (ptr, &f, fmt, ap);
if (size > 0)
*f._p = 0;
diff --git a/newlib/libc/stdio/vsprintf.c b/newlib/libc/stdio/vsprintf.c
index daf4605c1..5efd43a82 100644
--- a/newlib/libc/stdio/vsprintf.c
+++ b/newlib/libc/stdio/vsprintf.c
@@ -1,3 +1,5 @@
+/* doc in vfprintf.c */
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -14,7 +16,6 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* doc in vfprintf.c */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%";
@@ -33,10 +34,10 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#ifndef _REENT_ONLY
int
-_DEFUN(vsprintf, (str, fmt, ap),
- char *str _AND
- _CONST char *fmt _AND
- va_list ap)
+_DEFUN (vsprintf, (str, fmt, ap),
+ char *str _AND
+ _CONST char *fmt _AND
+ va_list ap)
{
int ret;
FILE f;
@@ -53,11 +54,11 @@ _DEFUN(vsprintf, (str, fmt, ap),
#endif /* !_REENT_ONLY */
int
-_DEFUN(_vsprintf_r, (ptr, str, fmt, ap),
- struct _reent *ptr _AND
- char *str _AND
- _CONST char *fmt _AND
- va_list ap)
+_DEFUN (_vsprintf_r, (ptr, str, fmt, ap),
+ struct _reent *ptr _AND
+ char *str _AND
+ _CONST char *fmt _AND
+ va_list ap)
{
int ret;
FILE f;
diff --git a/newlib/libc/stdio/vsscanf.c b/newlib/libc/stdio/vsscanf.c
index 22ed9cdf7..16f810465 100644
--- a/newlib/libc/stdio/vsscanf.c
+++ b/newlib/libc/stdio/vsscanf.c
@@ -28,11 +28,12 @@
#endif
#include "local.h"
-static _READ_WRITE_RETURN_TYPE
-_DEFUN(eofread1, (cookie, buf, len),
- _PTR cookie _AND
- char *buf _AND
- int len)
+static
+_READ_WRITE_RETURN_TYPE
+eofread1 (cookie, buf, len)
+ _PTR cookie;
+ char *buf;
+ int len;
{
return 0;
}
@@ -44,10 +45,10 @@ _DEFUN(eofread1, (cookie, buf, len),
#ifndef _REENT_ONLY
int
-_DEFUN(vsscanf, (str, fmt, ap),
- _CONST char *str _AND
- _CONST char *fmt _AND
- va_list ap)
+_DEFUN (vsscanf, (str, fmt, ap),
+ _CONST char *str _AND
+ _CONST char *fmt _AND
+ va_list ap)
{
return _vsscanf_r (_REENT, str, fmt, ap);
}
@@ -55,20 +56,20 @@ _DEFUN(vsscanf, (str, fmt, ap),
#endif /* !_REENT_ONLY */
int
-_DEFUN(_vsscanf_r, (ptr, str, fmt, ap),
- struct _reent *ptr _AND
- _CONST char *str _AND
- _CONST char *fmt _AND
- va_list ap)
+_DEFUN (_vsscanf_r, (ptr, str, fmt, ap),
+ struct _reent *ptr _AND
+ _CONST char *str _AND
+ _CONST char *fmt _AND
+ va_list ap)
{
FILE f;
- f._flags = __SRD | __SSTR;
+ f._flags = __SRD;
f._bf._base = f._p = (unsigned char *) str;
f._bf._size = f._r = strlen (str);
f._read = eofread1;
f._ub._base = NULL;
f._lb._base = NULL;
- f._file = -1; /* No file. */
- return __svfscanf_r (ptr, &f, fmt, ap);
+ return __svfscanf_r (ptr, &f, fmt, ap);
}
+
diff --git a/newlib/libc/stdio/wbuf.c b/newlib/libc/stdio/wbuf.c
index e7ddb4913..110682971 100644
--- a/newlib/libc/stdio/wbuf.c
+++ b/newlib/libc/stdio/wbuf.c
@@ -1,3 +1,5 @@
+/* No user fns here. Pesch 15apr92. */
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -14,13 +16,11 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-/* No user fns here. Pesch 15apr92. */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
-#include <_ansi.h>
#include <stdio.h>
#include "local.h"
#include "fvwrite.h"
@@ -32,15 +32,15 @@ static char sccsid[] = "%W% (Berkeley) %G%";
*/
int
-_DEFUN(__swbuf, (c, fp),
- register int c _AND
- register FILE *fp)
+__swbuf (c, fp)
+ register int c;
+ register FILE *fp;
{
register int n;
/* Ensure stdio has been initialized. */
- CHECK_INIT (_REENT);
+ CHECK_INIT (fp);
/*
* In case we cannot write, or longjmp takes us out early,
diff --git a/newlib/libc/stdio/wsetup.c b/newlib/libc/stdio/wsetup.c
index cf56c2abc..23b032efe 100644
--- a/newlib/libc/stdio/wsetup.c
+++ b/newlib/libc/stdio/wsetup.c
@@ -17,7 +17,6 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <_ansi.h>
#include <stdio.h>
#include <stdlib.h>
#include "local.h"
@@ -29,12 +28,12 @@
*/
int
-_DEFUN(__swsetup, (fp),
- register FILE * fp)
+_DEFUN (__swsetup, (fp),
+ register FILE * fp)
{
/* Make sure stdio is set up. */
- CHECK_INIT (_REENT);
+ CHECK_INIT (fp);
/*
* If we are not writing, we had better be reading and writing.
@@ -58,11 +57,9 @@ _DEFUN(__swsetup, (fp),
/*
* Make a buffer if necessary, then set _w.
- * A string I/O file should not explicitly allocate a buffer
- * unless asprintf is being used.
*/
- if (fp->_bf._base == NULL
- && (!(fp->_flags & __SSTR) || (fp->_flags & __SMBF)))
+ /* NOT NEEDED FOR CYGNUS SPRINTF ONLY jpg */
+ if (fp->_bf._base == NULL)
__smakebuf (fp);
if (fp->_flags & __SLBF)