diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-08-20 03:53:21 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-08-20 03:53:21 +0000 |
commit | 40a55d2054ef9d9085c4e6b0157c5d30608736fc (patch) | |
tree | 7ccdbae13abe1988c2ce9af0f936daac639ba1b5 /libio | |
parent | ca34d7a7c77fa8dc823fd05439870e5a96610c5a (diff) | |
download | glibc-40a55d2054ef9d9085c4e6b0157c5d30608736fc.tar.gz |
Update.cvs/libc-ud-970819
1997-08-20 05:30 Ulrich Drepper <drepper@cygnus.com>
* catgets/catgets.c (catclose): Use __munmap instead of munmap.
* catgets/gencat.c (read_input_file): Fix typo.
* dirent/dirent.h: Make seekdir and telldir available for __USE_XOPEN.
* elf/dl-load.c: Fix case of missing DT_RPATH in object which gets
executed (e.g., when it is a static binary).
* intl/bindtextdomain.c: Use strdup in glibc. Correct comment.
* intl/dcgettext.c: Likewise.
* intl/dgettext.c: Likewise.
* intl/explodename.c: Likewise.
* intl/finddomain.c: Likewise.
* intl/gettext.c: Likewise.
* intl/gettext.h: Likewise.
* intl/hash-string.h: Likewise.
* intl/l10nflist.c: Likewise.
* intl/libintl.h: Likewise.
* intl/loadinfo.h: Likewise.
* intl/loadmsgcat.c: Likewise.
* intl/localealias.c: Likewise.
* intl/textdomain.c: Likewise.
Unify libio sources with code in libg++.
* libio/fcloseall.c: Update and reformat copyright. Protect use
of weak_alias. Use _IO_* thread macros instead of __libc_*.
* libio/feof.c: Likewise.
* libio/feof_u.c: Likewise.
* libio/ferror.c: Likewise.
* libio/ferror_u.c: Likewise.
* libio/fgetc.c: Likewise.
* libio/filedoalloc.c: Likewise.
* libio/fileno.c: Likewise.
* libio/fileops.c: Likewise.
* libio/fputc.c: Likewise.
* libio/fputc_u.c: Likewise.
* libio/freopen.c: Likewise.
* libio/fseek.c: Likewise.
* libio/genops.c: Likewise.
* libio/getc.c: Likewise.
* libio/getc_u.c: Likewise.
* libio/getchar.c: Likewise.
* libio/getchar_u.c: Likewise.
* libio/iofclose.c: Likewise.
* libio/iofdopen.c: Likewise.
* libio/iofflush.c: Likewise.
* libio/iofflush_u.c: Likewise.
* libio/iofgetpos.c: Likewise.
* libio/iofgets.c: Likewise.
* libio/iofopen.c: Likewise.
* libio/iofopncook.c: Likewise.
* libio/iofprintf.c: Likewise.
* libio/iofputs.c: Likewise.
* libio/iofread.c: Likewise.
* libio/iofsetpos.c: Likewise.
* libio/ioftell.c: Likewise.
* libio/iofwrite.c: Likewise.
* libio/iogetdelim.c: Likewise.
* libio/iogetline.c: Likewise.
* libio/iogets.c: Likewise.
* libio/iopadn.c: Likewise.
* libio/iopopen.c: Likewise.
* libio/ioputs.c: Likewise.
* libio/ioseekoff.c: Likewise.
* libio/ioseekpos.c: Likewise.
* libio/iosetbuffer.c: Likewise.
* libio/iosetvbuf.c: Likewise.
* libio/iosprintf.c: Likewise.
* libio/ioungetc.c: Likewise.
* libio/iovdprintf.c: Likewise.
* libio/iovsprintf.c: Likewise.
* libio/iovsscanf.c: Likewise.
* libio/libio.h: Likewise.
* libio/libioP.h: Likewise.
* libio/obprintf.c: Likewise.
* libio/pclose.c: Likewise.
* libio/peekc.c: Likewise.
* libio/putc.c: Likewise.
* libio/putchar.c: Likewise.
* libio/rewind.c: Likewise.
* libio/setbuf.c: Likewise.
* libio/setlinebuf.c: Likewise.
* libio/stdfiles.c: Likewise.
* libio/stdio.c: Likewise.
* libio/strfile.h: Likewise.
* libio/strops.c: Likewise.
* libio/vasprintf.c: Likewise.
* libio/vscanf.c: Likewise.
* libio/vsnprintf.c: Likewise.
* manual/libc.texinfo: Add menu entries for chapter on message
translation.
* manual/locale.texi: Correct next entry in @node for new chapter.
* manual/search.texi: Likewise for previous link.
* manual/message.texi: New file.
* manual/startup.texi: Document LC_ALL, LC_MESSAGES, NLSPATH,
setenv, unsetenv, and clearenv.
* manual/string.texi: Fix typos. Patch by Jim Meyering.
* math/Makefile (test-longdouble-yes): Enable. We want long double
tests now.
Crusade against strcat.
* nis/nss_nisplus/nisplus-publickey.c: Remove uses of strcat.
* stdlib/canonicalize.c: Likewise.
* posix/glob.h: Define __const if necessary. Use __const in all
prototypes.
* sysdeps/generic/stpcpy.c: Use K&R form to allow use in other
GNU packages.
* posix/wordexp.c: Completely reworked buffer handling for much
better performance. Patch by Tim Waugh.
* socket/sys/sochet.h (getpeername): Fix type of LEN parameter,
it must be socklen_t.
* sysdeps/libm-i387/e_remainder.S: Pretty print.
* sysdeps/libm-i387/e_remainderf.S: Likewise.
* sysdeps/libm-i387/e_remainderl.S: Pop extra value for FPU stack.
* sysdeps/libm-i387/s_cexp.S: Little optimization.
* sysdeps/libm-i387/s_cexpl.S: Likewise.
* sysdep/libm-ieee754/s_csinhl.c: Include <fenv.h>.
1997-08-18 15:21 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/if_index.c (if_nameindex): Fix memory leak
in cleanup code.
1997-08-17 Paul Eggert <eggert@twinsun.com>
* tzset.c (__tzset_internal): Fix memory leak when the user
specifies a TZ value that uses a default rule file.
Do not assume US DST rules when the user specifies
that there is no DST.
1997-08-10 19:17 Philip Blundell <Philip.Blundell@pobox.com>
* inet/getnameinfo.c: Tidy up.
* sysdeps/posix/getaddrinfo.c: Likewise.
* sysdeps/unix/sysv/linux/if_index.c (if_nametoindex): Return 0 if
using stub code.
(if_indextoname): Use SIOGIFNAME ioctl if the kernel supports it.
(if_nameindex): Use alloca() rather than malloc(); use
SIOCGIFCOUNT ioctl if the kernel supports it.
1997-08-16 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/sys/mount.h: Remove the IS_* macros,
they operate on internal kernel structures and have no place in a
user header.
1997-08-16 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makerules (lib%.so): Depend on $(+preinit) and $(+postinit).
(build-shlib): Filter them out of $^.
1997-08-15 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-error.c (_dl_signal_error): Fix error message.
1997-08-16 04:06 Ulrich Drepper <drepper@cygnus.com>
* assert/assert.h [__USE_GNU]: Undefine assert_perror.
Reported by Theodore C. Belding <Ted.Belding@umich.edu>.
1997-08-13 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makeconfig: Change object suffixes from *.[spgb]o to *.o[spgb]
to avoid conflict with PO files.
* Makerules: Likewise.
* Rules: Likewise.
* elf/Makefile: Likewise.
* extra-lib.mk: Likewise.
* gmon/Makefile: Likewise.
* nis/Makefile: Likewise.
* nss/Makefile: Likewise.
* resolv/Makefile: Likewise.
* rpm/Makefile: Likewise.
* sunrpc/Makefile: Likewise.
* sysdeps/sparc/elf/Makefile: Likewise.
* sysdeps/sparc64/elf/Makefile: Likewise.
* sysdeps/unix/sysv/linux/sparc/Makefile: Likewise.
(ASFLAGS-.os): Renamed from as-FLAGS.os.
Diffstat (limited to 'libio')
64 files changed, 2299 insertions, 2029 deletions
diff --git a/libio/fcloseall.c b/libio/fcloseall.c index 05693f3b61..cd01655450 100644 --- a/libio/fcloseall.c +++ b/libio/fcloseall.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include <stdio.h> @@ -32,4 +33,7 @@ __fcloseall () _IO_cleanup (); return 0; } + +#ifdef weak_alias weak_alias (__fcloseall, fcloseall) +#endif diff --git a/libio/feof.c b/libio/feof.c index 23674704d6..d06de044fb 100644 --- a/libio/feof.c +++ b/libio/feof.c @@ -1,25 +1,27 @@ -/* Copyright (C) 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" @@ -35,4 +37,7 @@ _IO_feof (fp) _IO_funlockfile (fp); return result; } + +#ifdef weak_alias weak_alias (_IO_feof, feof) +#endif diff --git a/libio/feof_u.c b/libio/feof_u.c index 6ed8b7d4fe..4773599012 100644 --- a/libio/feof_u.c +++ b/libio/feof_u.c @@ -1,25 +1,27 @@ -/* Copyright (C) 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" diff --git a/libio/ferror.c b/libio/ferror.c index b9ed64587c..855627ade6 100644 --- a/libio/ferror.c +++ b/libio/ferror.c @@ -1,25 +1,27 @@ -/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" @@ -35,4 +37,7 @@ _IO_ferror (fp) _IO_funlockfile (fp); return result; } + +#ifdef weak_alias weak_alias (_IO_ferror, ferror) +#endif diff --git a/libio/ferror_u.c b/libio/ferror_u.c index df550d9d4d..6e13e53ddc 100644 --- a/libio/ferror_u.c +++ b/libio/ferror_u.c @@ -1,25 +1,27 @@ -/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" diff --git a/libio/fgetc.c b/libio/fgetc.c index 25bfed5596..174e60fa3f 100644 --- a/libio/fgetc.c +++ b/libio/fgetc.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1995 Free Software Foundation +/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" diff --git a/libio/filedoalloc.c b/libio/filedoalloc.c index 836c56b63b..f1b781e8a0 100644 --- a/libio/filedoalloc.c +++ b/libio/filedoalloc.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993 Free Software Foundation +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -66,12 +67,12 @@ the executable file might be covered by the GNU General Public License. */ */ int -DEFUN(_IO_file_doallocate, (fp), - register _IO_FILE *fp) +_IO_file_doallocate (fp) + _IO_FILE *fp; { - register _IO_size_t size; + _IO_size_t size; int couldbetty; - register char *p; + char *p; struct stat st; #ifndef _LIBC @@ -80,7 +81,7 @@ DEFUN(_IO_file_doallocate, (fp), on exit. We call it from _IO_file_doallocate, since that is likely to get called by any program that does buffered I/O. */ if (_IO_cleanup_registration_needed) - (*_IO_cleanup_registration_needed)(); + (*_IO_cleanup_registration_needed) (); #endif if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0) @@ -94,16 +95,16 @@ DEFUN(_IO_file_doallocate, (fp), } else { - couldbetty = S_ISCHR(st.st_mode); + couldbetty = S_ISCHR (st.st_mode); #if _IO_HAVE_ST_BLKSIZE size = st.st_blksize <= 0 ? _IO_BUFSIZ : st.st_blksize; #else size = _IO_BUFSIZ; #endif } - ALLOC_BUF(p, size, EOF); - _IO_setb(fp, p, p+size, 1); - if (couldbetty && isatty(fp->_fileno)) + ALLOC_BUF (p, size, EOF); + _IO_setb (fp, p, p + size, 1); + if (couldbetty && isatty (fp->_fileno)) fp->_flags |= _IO_LINE_BUF; return 1; } diff --git a/libio/fileno.c b/libio/fileno.c index 269ecb875a..7ff93e6a81 100644 --- a/libio/fileno.c +++ b/libio/fileno.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" @@ -38,9 +39,11 @@ fileno (fp) } #ifdef _IO_MTSAFE_IO +#ifdef weak_alias /* The fileno implementation for libio does not require locking because it only accesses once a single variable and this is already atomic (at least at thread level). */ weak_alias (fileno, fileno_unlocked) #endif +#endif diff --git a/libio/fileops.c b/libio/fileops.c index afba972693..b3a3a24651 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -1,28 +1,29 @@ -/* -Copyright (C) 1993, 1995 Free Software Foundation +/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + Written by Per Bothner <bothner@cygnus.com>. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ -/* written by Per Bothner (bothner@cygnus.com) */ #ifndef _POSIX_SOURCE # define _POSIX_SOURCE @@ -97,8 +98,8 @@ extern int errno; void -DEFUN(_IO_file_init, (fp), - register _IO_FILE *fp) +_IO_file_init (fp) + _IO_FILE *fp; { /* POSIX.1 allows another file handle to be used to change the position of our file descriptor. Hence we actually don't know the actual @@ -111,11 +112,11 @@ DEFUN(_IO_file_init, (fp), } int -DEFUN(_IO_file_close_it, (fp), - register _IO_FILE* fp) +_IO_file_close_it (fp) + _IO_FILE *fp; { int write_status, close_status; - if (!_IO_file_is_open(fp)) + if (!_IO_file_is_open (fp)) return EOF; write_status = _IO_do_flush (fp); @@ -125,11 +126,11 @@ DEFUN(_IO_file_close_it, (fp), close_status = _IO_SYSCLOSE (fp); /* Free buffer. */ - _IO_setb(fp, NULL, NULL, 0); - _IO_setg(fp, NULL, NULL, NULL); - _IO_setp(fp, NULL, NULL); + _IO_setb (fp, NULL, NULL, 0); + _IO_setg (fp, NULL, NULL, NULL); + _IO_setp (fp, NULL, NULL); - _IO_un_link(fp); + _IO_un_link (fp); fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS; fp->_fileno = EOF; fp->_offset = _IO_pos_BAD; @@ -138,68 +139,74 @@ DEFUN(_IO_file_close_it, (fp), } void -DEFUN(_IO_file_finish, (fp, dummy), - register _IO_FILE* fp AND int dummy) +_IO_file_finish (fp, dummy) + _IO_FILE *fp; + int dummy; { - if (_IO_file_is_open(fp)) + if (_IO_file_is_open (fp)) { _IO_do_flush (fp); if (!(fp->_flags & _IO_DELETE_DONT_CLOSE)) _IO_SYSCLOSE (fp); } - _IO_default_finish(fp, 0); + _IO_default_finish (fp, 0); } _IO_FILE * -DEFUN(_IO_file_fopen, (fp, filename, mode), - register _IO_FILE *fp AND const char *filename AND const char *mode) +_IO_file_fopen (fp, filename, mode) + _IO_FILE *fp; + const char *filename; + const char *mode; { int oflags = 0, omode; int read_write, fdesc; int oprot = 0666; if (_IO_file_is_open (fp)) return 0; - switch (*mode++) { - case 'r': - omode = O_RDONLY; - read_write = _IO_NO_WRITES; - break; - case 'w': - omode = O_WRONLY; - oflags = O_CREAT|O_TRUNC; - read_write = _IO_NO_READS; - break; - case 'a': - omode = O_WRONLY; - oflags = O_CREAT|O_APPEND; - read_write = _IO_NO_READS|_IO_IS_APPENDING; - break; - default: - __set_errno (EINVAL); - return NULL; - } - if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+')) { - omode = O_RDWR; - read_write &= _IO_IS_APPENDING; - } - fdesc = open(filename, omode|oflags, oprot); + switch (*mode++) + { + case 'r': + omode = O_RDONLY; + read_write = _IO_NO_WRITES; + break; + case 'w': + omode = O_WRONLY; + oflags = O_CREAT|O_TRUNC; + read_write = _IO_NO_READS; + break; + case 'a': + omode = O_WRONLY; + oflags = O_CREAT|O_APPEND; + read_write = _IO_NO_READS|_IO_IS_APPENDING; + break; + default: + __set_errno (EINVAL); + return NULL; + } + if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+')) + { + omode = O_RDWR; + read_write &= _IO_IS_APPENDING; + } + fdesc = open (filename, omode|oflags, oprot); if (fdesc < 0) return NULL; fp->_fileno = fdesc; - _IO_mask_flags(fp, read_write,_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING); + _IO_mask_flags (fp, read_write,_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING); if (read_write & _IO_IS_APPENDING) if (_IO_SEEKOFF (fp, (_IO_off_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD && errno != ESPIPE) return NULL; - _IO_link_in(fp); + _IO_link_in (fp); return fp; } -_IO_FILE* -DEFUN(_IO_file_attach, (fp, fd), - _IO_FILE *fp AND int fd) +_IO_FILE * +_IO_file_attach (fp, fd) + _IO_FILE *fp; + int fd; { - if (_IO_file_is_open(fp)) + if (_IO_file_is_open (fp)) return NULL; fp->_fileno = fd; fp->_flags &= ~(_IO_NO_READS+_IO_NO_WRITES); @@ -213,16 +220,18 @@ DEFUN(_IO_file_attach, (fp, fd), return fp; } -_IO_FILE* -DEFUN(_IO_file_setbuf, (fp, p, len), - register _IO_FILE *fp AND char* p AND _IO_ssize_t len) +_IO_FILE * +_IO_file_setbuf (fp, p, len) + _IO_FILE *fp; + char *p; + _IO_ssize_t len; { - if (_IO_default_setbuf(fp, p, len) == NULL) - return NULL; + if (_IO_default_setbuf (fp, p, len) == NULL) + return NULL; fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end = fp->_IO_buf_base; - _IO_setg(fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base); + _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base); return fp; } @@ -231,8 +240,10 @@ DEFUN(_IO_file_setbuf, (fp, p, len), Then mark FP as having empty buffers. */ int -DEFUN(_IO_do_write, (fp, data, to_do), - register _IO_FILE *fp AND const char* data AND _IO_size_t to_do) +_IO_do_write (fp, data, to_do) + _IO_FILE *fp; + const char *data; + _IO_size_t to_do; { _IO_size_t count; if (to_do == 0) @@ -247,24 +258,24 @@ DEFUN(_IO_do_write, (fp, data, to_do), else if (fp->_IO_read_end != fp->_IO_write_base) { _IO_pos_t new_pos - = _IO_SYSSEEK(fp, fp->_IO_write_base - fp->_IO_read_end, 1); + = _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1); if (new_pos == _IO_pos_BAD) return EOF; fp->_offset = new_pos; } count = _IO_SYSWRITE (fp, data, to_do); if (fp->_cur_column) - fp->_cur_column = _IO_adjust_column(fp->_cur_column - 1, data, to_do) + 1; - _IO_setg(fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base); + fp->_cur_column = _IO_adjust_column (fp->_cur_column - 1, data, to_do) + 1; + _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base); fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_buf_base; - fp->_IO_write_end = (fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED)) ? fp->_IO_buf_base - : fp->_IO_buf_end; + fp->_IO_write_end = ((fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED)) + ? fp->_IO_buf_base : fp->_IO_buf_end); return count != to_do ? EOF : 0; } int -DEFUN(_IO_file_underflow, (fp), - register _IO_FILE *fp) +_IO_file_underflow (fp) + _IO_FILE *fp; { _IO_ssize_t count; #if 0 @@ -279,17 +290,17 @@ DEFUN(_IO_file_underflow, (fp), return EOF; } if (fp->_IO_read_ptr < fp->_IO_read_end) - return *(unsigned char*)fp->_IO_read_ptr; + return *(unsigned char *) fp->_IO_read_ptr; if (fp->_IO_buf_base == NULL) - _IO_doallocbuf(fp); + _IO_doallocbuf (fp); /* Flush all line buffered files before reading. */ /* FIXME This can/should be moved to genops ?? */ if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED)) - _IO_flush_all_linebuffered(); + _IO_flush_all_linebuffered (); - _IO_switch_to_get_mode(fp); + _IO_switch_to_get_mode (fp); /* This is very tricky. We have to adjust those pointers before we call _IO_SYSREAD () since @@ -313,13 +324,14 @@ DEFUN(_IO_file_underflow, (fp), if (count == 0) return EOF; if (fp->_offset != _IO_pos_BAD) - _IO_pos_adjust(fp->_offset, count); - return *(unsigned char*)fp->_IO_read_ptr; + _IO_pos_adjust (fp->_offset, count); + return *(unsigned char *) fp->_IO_read_ptr; } int -DEFUN(_IO_file_overflow, (f, ch), - register _IO_FILE* f AND int ch) +_IO_file_overflow (f, ch) + _IO_FILE *f; + int ch; { if (f->_flags & _IO_NO_WRITES) /* SET ERROR */ { @@ -333,7 +345,7 @@ DEFUN(_IO_file_overflow, (f, ch), /* Allocate a buffer if needed. */ if (f->_IO_write_base == 0) { - _IO_doallocbuf(f); + _IO_doallocbuf (f); _IO_setg (f, f->_IO_buf_base, f->_IO_buf_base, f->_IO_buf_base); } /* Otherwise must be currently reading. @@ -355,21 +367,21 @@ DEFUN(_IO_file_overflow, (f, ch), f->_flags |= _IO_CURRENTLY_PUTTING; } if (ch == EOF) - return _IO_do_flush(f); + return _IO_do_flush (f); if (f->_IO_write_ptr == f->_IO_buf_end ) /* Buffer is really full */ - if (_IO_do_flush(f) == EOF) + if (_IO_do_flush (f) == EOF) return EOF; *f->_IO_write_ptr++ = ch; if ((f->_flags & _IO_UNBUFFERED) || ((f->_flags & _IO_LINE_BUF) && ch == '\n')) - if (_IO_do_flush(f) == EOF) + if (_IO_do_flush (f) == EOF) return EOF; - return (unsigned char)ch; + return (unsigned char) ch; } int -DEFUN(_IO_file_sync, (fp), - register _IO_FILE* fp) +_IO_file_sync (fp) + _IO_FILE *fp; { _IO_size_t delta; /* char* ptr = cur_ptr(); */ @@ -379,11 +391,11 @@ DEFUN(_IO_file_sync, (fp), if (delta != 0) { #ifdef TODO - if (_IO_in_backup(fp)) - delta -= eGptr() - Gbase(); + if (_IO_in_backup (fp)) + delta -= eGptr () - Gbase (); #endif _IO_off_t new_pos = _IO_SYSSEEK (fp, delta, 1); - if (new_pos != (_IO_off_t)EOF) + if (new_pos != (_IO_off_t) EOF) fp->_IO_read_end = fp->_IO_read_ptr; #ifdef ESPIPE else if (errno == ESPIPE) @@ -399,8 +411,11 @@ DEFUN(_IO_file_sync, (fp), } _IO_pos_t -DEFUN(_IO_file_seekoff, (fp, offset, dir, mode), - register _IO_FILE *fp AND _IO_off_t offset AND int dir AND int mode) +_IO_file_seekoff (fp, offset, dir, mode) + _IO_FILE *fp; + _IO_off_t offset; + int dir; + int mode; { _IO_pos_t result; _IO_off_t delta, new_offset; @@ -421,14 +436,15 @@ DEFUN(_IO_file_seekoff, (fp, offset, dir, mode), end up flushing when we close(), it doesn't make much difference.) FIXME: simulate mem-papped files. */ - if (fp->_IO_write_ptr > fp->_IO_write_base || _IO_in_put_mode(fp)) - if (_IO_switch_to_get_mode(fp)) return EOF; + if (fp->_IO_write_ptr > fp->_IO_write_base || _IO_in_put_mode (fp)) + if (_IO_switch_to_get_mode (fp)) + return EOF; if (fp->_IO_buf_base == NULL) { - _IO_doallocbuf(fp); - _IO_setp(fp, fp->_IO_buf_base, fp->_IO_buf_base); - _IO_setg(fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base); + _IO_doallocbuf (fp); + _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base); + _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base); } switch (dir) @@ -439,7 +455,7 @@ DEFUN(_IO_file_seekoff, (fp, offset, dir, mode), if (fp->_offset == _IO_pos_BAD) goto dumb; /* Make offset absolute, assuming current pointer is file_ptr(). */ - offset += _IO_pos_as_off(fp->_offset); + offset += _IO_pos_as_off (fp->_offset); dir = _IO_seek_set; break; @@ -448,7 +464,7 @@ DEFUN(_IO_file_seekoff, (fp, offset, dir, mode), case _IO_seek_end: { struct stat st; - if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG(st.st_mode)) + if (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode)) { offset += st.st_size; dir = _IO_seek_set; @@ -464,46 +480,46 @@ DEFUN(_IO_file_seekoff, (fp, offset, dir, mode), && !_IO_in_backup (fp)) { /* Offset relative to start of main get area. */ - _IO_pos_t rel_offset = offset - fp->_offset - + (fp->_IO_read_end - fp->_IO_read_base); + _IO_pos_t rel_offset = (offset - fp->_offset + + (fp->_IO_read_end - fp->_IO_read_base)); if (rel_offset >= 0) { #if 0 - if (_IO_in_backup(fp)) - _IO_switch_to_main_get_area(fp); + if (_IO_in_backup (fp)) + _IO_switch_to_main_get_area (fp); #endif if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base) { - _IO_setg(fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset, - fp->_IO_read_end); - _IO_setp(fp, fp->_IO_buf_base, fp->_IO_buf_base); + _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset, + fp->_IO_read_end); + _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base); return offset; } #ifdef TODO /* If we have streammarkers, seek forward by reading ahead. */ - if (_IO_have_markers(fp)) + if (_IO_have_markers (fp)) { int to_skip = rel_offset - (fp->_IO_read_ptr - fp->_IO_read_base); - if (ignore(to_skip) != to_skip) + if (ignore (to_skip) != to_skip) goto dumb; return offset; } #endif } #ifdef TODO - if (rel_offset < 0 && rel_offset >= Bbase() - Bptr()) + if (rel_offset < 0 && rel_offset >= Bbase () - Bptr ()) { - if (!_IO_in_backup(fp)) - _IO_switch_to_backup_area(fp); - gbump(fp->_IO_read_end + rel_offset - fp->_IO_read_ptr); + if (!_IO_in_backup (fp)) + _IO_switch_to_backup_area (fp); + gbump (fp->_IO_read_end + rel_offset - fp->_IO_read_ptr); return offset; } #endif } #ifdef TODO - _IO_unsave_markers(fp); + _IO_unsave_markers (fp); #endif if (fp->_flags & _IO_NO_READS) @@ -535,30 +551,33 @@ DEFUN(_IO_file_seekoff, (fp, offset, dir, mode), goto dumb; } } - _IO_setg(fp, fp->_IO_buf_base, fp->_IO_buf_base+delta, fp->_IO_buf_base+count); - _IO_setp(fp, fp->_IO_buf_base, fp->_IO_buf_base); + _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + delta, + fp->_IO_buf_base + count); + _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base); fp->_offset = result + count; - _IO_mask_flags(fp, 0, _IO_EOF_SEEN); + _IO_mask_flags (fp, 0, _IO_EOF_SEEN); return offset; dumb: - _IO_unsave_markers(fp); + _IO_unsave_markers (fp); result = _IO_SYSSEEK (fp, offset, dir); if (result != EOF) - _IO_mask_flags(fp, 0, _IO_EOF_SEEN); + _IO_mask_flags (fp, 0, _IO_EOF_SEEN); fp->_offset = result; - _IO_setg(fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base); - _IO_setp(fp, fp->_IO_buf_base, fp->_IO_buf_base); + _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base); + _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base); return result; } _IO_ssize_t -DEFUN(_IO_file_read, (fp, buf, size), - register _IO_FILE* fp AND void* buf AND _IO_ssize_t size) +_IO_file_read (fp, buf, size) + _IO_FILE *fp; + void *buf; + _IO_ssize_t size; { for (;;) { - _IO_ssize_t count = _IO_read(fp->_fileno, buf, size); + _IO_ssize_t count = _IO_read (fp->_fileno, buf, size); #if 0 && defined EINTR /* We must not do this optimization since POSIX.1 explicitly requests that the stream operations must return with the @@ -572,34 +591,39 @@ DEFUN(_IO_file_read, (fp, buf, size), } _IO_pos_t -DEFUN(_IO_file_seek, (fp, offset, dir), - _IO_FILE *fp AND _IO_off_t offset AND int dir) +_IO_file_seek (fp, offset, dir) + _IO_FILE *fp; + _IO_off_t offset; + int dir; { - return _IO_lseek(fp->_fileno, offset, dir); + return _IO_lseek (fp->_fileno, offset, dir); } int -DEFUN(_IO_file_stat, (fp, st), - _IO_FILE *fp AND void* st) +_IO_file_stat (fp, st) + _IO_FILE *fp; + void *st; { - return _IO_fstat(fp->_fileno, (struct stat*)st); + return _IO_fstat (fp->_fileno, (struct stat *) st); } int -DEFUN(_IO_file_close, (fp), - _IO_FILE* fp) +_IO_file_close (fp) + _IO_FILE *fp; { - return _IO_close(fp->_fileno); + return _IO_close (fp->_fileno); } _IO_ssize_t -DEFUN(_IO_file_write, (f, data, n), - register _IO_FILE* f AND const void* data AND _IO_ssize_t n) +_IO_file_write (f, data, n) + _IO_FILE *f; + const void *data; + _IO_ssize_t n; { _IO_ssize_t to_do = n; while (to_do > 0) { - _IO_ssize_t count = _IO_write(f->_fileno, data, to_do); + _IO_ssize_t count = _IO_write (f->_fileno, data, to_do); if (count == EOF) { #if 0 && defined EINTR @@ -617,7 +641,7 @@ DEFUN(_IO_file_write, (f, data, n), } } to_do -= count; - data = (void*)((char*)data + count); + data = (void *) ((char *) data + count); } n -= to_do; if (f->_offset >= 0) @@ -626,10 +650,12 @@ DEFUN(_IO_file_write, (f, data, n), } _IO_size_t -DEFUN(_IO_file_xsputn, (f, data, n), - _IO_FILE *f AND const void *data AND _IO_size_t n) +_IO_file_xsputn (f, data, n) + _IO_FILE *f; + const void *data; + _IO_size_t n; { - register const char *s = (char*) data; + register const char *s = (char *) data; _IO_size_t to_do = n; int must_flush = 0; _IO_size_t count; @@ -646,14 +672,16 @@ DEFUN(_IO_file_xsputn, (f, data, n), { count = f->_IO_buf_end - f->_IO_write_ptr; if (count >= n) - { register const char *p; + { + register const char *p; for (p = s + n; p > s; ) { - if (*--p == '\n') { - count = p - s + 1; - must_flush = 1; - break; - } + if (*--p == '\n') + { + count = p - s + 1; + must_flush = 1; + break; + } } } } @@ -662,23 +690,26 @@ DEFUN(_IO_file_xsputn, (f, data, n), { if (count > to_do) count = to_do; - if (count > 20) { - memcpy(f->_IO_write_ptr, s, count); - s += count; - } + if (count > 20) + { + memcpy (f->_IO_write_ptr, s, count); + s += count; + } else { register char *p = f->_IO_write_ptr; - register int i = (int)count; - while (--i >= 0) *p++ = *s++; + register int i = (int) count; + while (--i >= 0) + *p++ = *s++; } f->_IO_write_ptr += count; to_do -= count; } if (to_do + must_flush > 0) - { _IO_size_t block_size, dont_write; + { + _IO_size_t block_size, dont_write; /* Next flush the (full) buffer. */ - if (__overflow(f, EOF) == EOF) + if (__overflow (f, EOF) == EOF) return n - to_do; /* Try to maintain alignment: write a whole number of blocks. @@ -687,7 +718,7 @@ DEFUN(_IO_file_xsputn, (f, data, n), dont_write = block_size >= 128 ? to_do % block_size : 0; count = to_do - dont_write; - if (_IO_do_write(f, s, count) == EOF) + if (_IO_do_write (f, s, count) == EOF) return n - to_do; to_do = dont_write; @@ -695,7 +726,7 @@ DEFUN(_IO_file_xsputn, (f, data, n), buffer, but it's somewhat messier for line-buffered files, so we let _IO_default_xsputn handle the general case. */ if (dont_write) - to_do -= _IO_default_xsputn(f, s+count, dont_write); + to_do -= _IO_default_xsputn (f, s+count, dont_write); } return n - to_do; } @@ -703,21 +734,24 @@ DEFUN(_IO_file_xsputn, (f, data, n), #if 0 /* Work in progress */ _IO_size_t -DEFUN(_IO_file_xsgetn, (fp, data, n), - _IO_FILE *fp AND void *data AND _IO_size_t n) +_IO_file_xsgetn (fp, data, n) + _IO_FILE *fp; + void *data; + _IO_size_t n; { register _IO_size_t more = n; register char *s = data; for (;;) { - _IO_ssize_t count = fp->_IO_read_end - fp->_IO_read_ptr; /* Data available. */ + /* Data available. */ + _IO_ssize_t count = fp->_IO_read_end - fp->_IO_read_ptr; if (count > 0) { if (count > more) count = more; if (count > 20) { - memcpy(s, fp->_IO_read_ptr, count); + memcpy (s, fp->_IO_read_ptr, count); s += count; fp->_IO_read_ptr += count; } @@ -726,8 +760,9 @@ DEFUN(_IO_file_xsgetn, (fp, data, n), else { register char *p = fp->_IO_read_ptr; - register int i = (int)count; - while (--i >= 0) *s++ = *p++; + register int i = (int) count; + while (--i >= 0) + *s++ = *p++; fp->_IO_read_ptr = p; } more -= count; @@ -742,11 +777,11 @@ DEFUN(_IO_file_xsgetn, (fp, data, n), /* If we're reading a lot of data, don't bother allocating a buffer. But if we're only reading a bit, perhaps we should ??*/ if (count <= 512 && fp->_IO_buf_base == NULL) - _IO_doallocbuf(fp); + _IO_doallocbuf (fp); if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED)) - _IO_flush_all_linebuffered(); + _IO_flush_all_linebuffered (); - _IO_switch_to_get_mode(fp); ???; + _IO_switch_to_get_mode (fp); ???; count = _IO_SYSREAD (fp, s, more); if (count <= 0) { @@ -760,14 +795,15 @@ DEFUN(_IO_file_xsgetn, (fp, data, n), more -= count; } #endif - if (more == 0 || __underflow(fp) == EOF) + if (more == 0 || __underflow (fp) == EOF) break; } return n - more; } #endif -struct _IO_jump_t _IO_file_jumps = { +struct _IO_jump_t _IO_file_jumps = +{ JUMP_INIT_DUMMY, JUMP_INIT(finish, _IO_file_finish), JUMP_INIT(overflow, _IO_file_overflow), diff --git a/libio/fputc.c b/libio/fputc.c index e1f10f1b20..22cdfab9a8 100644 --- a/libio/fputc.c +++ b/libio/fputc.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" diff --git a/libio/fputc_u.c b/libio/fputc_u.c index bc2cc2efb6..48701e1d6c 100644 --- a/libio/fputc_u.c +++ b/libio/fputc_u.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" diff --git a/libio/freopen.c b/libio/freopen.c index bb0c59788f..ff57d6033d 100644 --- a/libio/freopen.c +++ b/libio/freopen.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" diff --git a/libio/fseek.c b/libio/fseek.c index 3d4e4925b9..f2563d33f2 100644 --- a/libio/fseek.c +++ b/libio/fseek.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" diff --git a/libio/genops.c b/libio/genops.c index c08598686d..de9c826b9f 100644 --- a/libio/genops.c +++ b/libio/genops.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1995 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ /* Generic or default I/O operations. */ @@ -31,41 +32,46 @@ the executable file might be covered by the GNU General Public License. */ #include <string.h> void -DEFUN(_IO_un_link, (fp), - _IO_FILE *fp) -{ - if (fp->_flags & _IO_LINKED) { - _IO_FILE **f; - for (f = &_IO_list_all; *f != NULL; f = &(*f)->_chain) { - if (*f == fp) { - *f = fp->_chain; - break; - } +_IO_un_link (fp) + _IO_FILE *fp; +{ + if (fp->_flags & _IO_LINKED) + { + _IO_FILE **f; + for (f = &_IO_list_all; *f != NULL; f = &(*f)->_chain) + { + if (*f == fp) + { + *f = fp->_chain; + break; + } + } + fp->_flags &= ~_IO_LINKED; } - fp->_flags &= ~_IO_LINKED; - } } void -DEFUN(_IO_link_in, (fp), - _IO_FILE *fp) +_IO_link_in (fp) + _IO_FILE *fp; { - if ((fp->_flags & _IO_LINKED) == 0) { + if ((fp->_flags & _IO_LINKED) == 0) + { fp->_flags |= _IO_LINKED; fp->_chain = _IO_list_all; _IO_list_all = fp; - } + } } /* Return minimum _pos markers Assumes the current get area is the main get area. */ +static _IO_size_t _IO_least_marker __P ((_IO_FILE *fp)); -_IO_size_t -DEFUN(_IO_least_marker, (fp), - register _IO_FILE *fp) +static _IO_size_t +_IO_least_marker (fp) + _IO_FILE *fp; { _IO_ssize_t least_so_far = fp->_IO_read_end - fp->_IO_read_base; - register struct _IO_marker *mark; + struct _IO_marker *mark; for (mark = fp->_markers; mark != NULL; mark = mark->_next) if (mark->_pos < least_so_far) least_so_far = mark->_pos; @@ -75,41 +81,51 @@ DEFUN(_IO_least_marker, (fp), /* Switch current get area from backup buffer to (start of) main get area. */ void -DEFUN(_IO_switch_to_main_get_area, (fp), - _IO_FILE *fp) +_IO_switch_to_main_get_area (fp) + _IO_FILE *fp; { char *tmp; fp->_flags &= ~_IO_IN_BACKUP; /* Swap _IO_read_end and _IO_save_end. */ - tmp = fp->_IO_read_end; fp->_IO_read_end= fp->_IO_save_end; fp->_IO_save_end= tmp; + tmp = fp->_IO_read_end; + fp->_IO_read_end = fp->_IO_save_end; + fp->_IO_save_end= tmp; /* Swap _IO_read_base and _IO_save_base. */ - tmp = fp->_IO_read_base; fp->_IO_read_base = fp->_IO_save_base; fp->_IO_save_base = tmp; + tmp = fp->_IO_read_base; + fp->_IO_read_base = fp->_IO_save_base; + fp->_IO_save_base = tmp; + fp->_IO_read_ptr = fp->_IO_read_base; } /* Switch current get area from main get area to (end of) backup area. */ void -DEFUN(_IO_switch_to_backup_area, (fp), - register _IO_FILE *fp) +_IO_switch_to_backup_area (fp) + _IO_FILE *fp; { char *tmp; fp->_flags |= _IO_IN_BACKUP; /* Swap _IO_read_end and _IO_save_end. */ - tmp = fp->_IO_read_end; fp->_IO_read_end = fp->_IO_save_end; fp->_IO_save_end = tmp; + tmp = fp->_IO_read_end; + fp->_IO_read_end = fp->_IO_save_end; + fp->_IO_save_end = tmp; /* Swap _gbase and _IO_save_base. */ - tmp = fp->_IO_read_base; fp->_IO_read_base = fp->_IO_save_base; fp->_IO_save_base = tmp; + tmp = fp->_IO_read_base; + fp->_IO_read_base = fp->_IO_save_base; + fp->_IO_save_base = tmp; + fp->_IO_read_ptr = fp->_IO_read_end; } int -DEFUN(_IO_switch_to_get_mode, (fp), - register _IO_FILE *fp) +_IO_switch_to_get_mode (fp) + _IO_FILE *fp; { if (fp->_IO_write_ptr > fp->_IO_write_base) if (_IO_OVERFLOW (fp, EOF) == EOF) return EOF; - if (_IO_in_backup(fp)) + if (_IO_in_backup (fp)) fp->_IO_read_base = fp->_IO_backup_base; else { @@ -126,11 +142,11 @@ DEFUN(_IO_switch_to_get_mode, (fp), } void -DEFUN(_IO_free_backup_area, (fp), - register _IO_FILE *fp) +_IO_free_backup_area (fp) + _IO_FILE *fp; { if (_IO_in_backup (fp)) - _IO_switch_to_main_get_area(fp); /* Just in case. */ + _IO_switch_to_main_get_area (fp); /* Just in case. */ free (fp->_IO_save_base); fp->_IO_save_base = NULL; fp->_IO_save_end = NULL; @@ -139,13 +155,14 @@ DEFUN(_IO_free_backup_area, (fp), #if 0 int -DEFUN(_IO_switch_to_put_mode, (fp), - register _IO_FILE *fp) +_IO_switch_to_put_mode (fp) + _IO_FILE *fp; { fp->_IO_write_base = fp->_IO_read_ptr; fp->_IO_write_ptr = fp->_IO_read_ptr; /* Following is wrong if line- or un-buffered? */ - fp->_IO_write_end = fp->_flags & _IO_IN_BACKUP ? fp->_IO_read_end : fp->_IO_buf_end; + fp->_IO_write_end = (fp->_flags & _IO_IN_BACKUP + ? fp->_IO_read_end : fp->_IO_buf_end); fp->_IO_read_ptr = fp->_IO_read_end; fp->_IO_read_base = fp->_IO_read_end; @@ -156,18 +173,21 @@ DEFUN(_IO_switch_to_put_mode, (fp), #endif int -DEFUN(__overflow, (f, ch), - _IO_FILE *f AND int ch) +__overflow (f, ch) + _IO_FILE *f; + int ch; { return _IO_OVERFLOW (f, ch); } -static int -DEFUN(save_for_backup, (fp), - _IO_FILE *fp) +static int save_for_backup __P ((_IO_FILE *fp)); + + static int +save_for_backup (fp) + _IO_FILE *fp; { /* Append [_IO_read_base.._IO_read_end] to backup area. */ - int least_mark = _IO_least_marker(fp); + int least_mark = _IO_least_marker (fp); /* needed_size is how much space we need in the backup area. */ int needed_size = (fp->_IO_read_end - fp->_IO_read_base) - least_mark; int current_Bsize = fp->_IO_save_end - fp->_IO_save_base; @@ -178,22 +198,22 @@ DEFUN(save_for_backup, (fp), { char *new_buffer; avail = 100; - new_buffer = (char*)malloc(avail+needed_size); + new_buffer = (char *) malloc (avail + needed_size); if (new_buffer == NULL) return EOF; /* FIXME */ if (least_mark < 0) { - memcpy(new_buffer + avail, - fp->_IO_save_end + least_mark, - -least_mark); - memcpy(new_buffer +avail - least_mark, - fp->_IO_read_base, - fp->_IO_read_end - fp->_IO_read_base); + memcpy (new_buffer + avail, + fp->_IO_save_end + least_mark, + -least_mark); + memcpy (new_buffer + avail - least_mark, + fp->_IO_read_base, + fp->_IO_read_end - fp->_IO_read_base); } else - memcpy(new_buffer + avail, - fp->_IO_read_base + least_mark, - needed_size); + memcpy (new_buffer + avail, + fp->_IO_read_base + least_mark, + needed_size); if (fp->_IO_save_base) free (fp->_IO_save_base); fp->_IO_save_base = new_buffer; @@ -204,17 +224,17 @@ DEFUN(save_for_backup, (fp), avail = current_Bsize - needed_size; if (least_mark < 0) { - memmove(fp->_IO_save_base + avail, - fp->_IO_save_end + least_mark, - -least_mark); - memcpy(fp->_IO_save_base + avail - least_mark, - fp->_IO_read_base, - fp->_IO_read_end - fp->_IO_read_base); + memmove (fp->_IO_save_base + avail, + fp->_IO_save_end + least_mark, + -least_mark); + memcpy (fp->_IO_save_base + avail - least_mark, + fp->_IO_read_base, + fp->_IO_read_end - fp->_IO_read_base); } else if (needed_size > 0) - memcpy(fp->_IO_save_base + avail, - fp->_IO_read_base + least_mark, - needed_size); + memcpy (fp->_IO_save_base + avail, + fp->_IO_read_base + least_mark, + needed_size); } /* FIXME: Dubious arithmetic if pointers are NULL */ fp->_IO_backup_base = fp->_IO_save_base + avail; @@ -226,59 +246,64 @@ DEFUN(save_for_backup, (fp), } int -DEFUN(__underflow, (fp), - _IO_FILE *fp) +__underflow (fp) + _IO_FILE *fp; { - if (_IO_in_put_mode(fp)) - if (_IO_switch_to_get_mode(fp) == EOF) return EOF; + if (_IO_in_put_mode (fp)) + if (_IO_switch_to_get_mode (fp) == EOF) + return EOF; if (fp->_IO_read_ptr < fp->_IO_read_end) - return *(unsigned char*)fp->_IO_read_ptr; - if (_IO_in_backup(fp)) + return *(unsigned char *) fp->_IO_read_ptr; + if (_IO_in_backup (fp)) { - _IO_switch_to_main_get_area(fp); + _IO_switch_to_main_get_area (fp); if (fp->_IO_read_ptr < fp->_IO_read_end) return *fp->_IO_read_ptr; } - if (_IO_have_markers(fp)) + if (_IO_have_markers (fp)) { if (save_for_backup (fp)) return EOF; } - else if (_IO_have_backup(fp)) - _IO_free_backup_area(fp); + else if (_IO_have_backup (fp)) + _IO_free_backup_area (fp); return _IO_UNDERFLOW (fp); } int -DEFUN(__uflow, (fp), - _IO_FILE *fp) +__uflow (fp) + _IO_FILE *fp; { - if (_IO_in_put_mode(fp)) - if (_IO_switch_to_get_mode(fp) == EOF) return EOF; + if (_IO_in_put_mode (fp)) + if (_IO_switch_to_get_mode (fp) == EOF) + return EOF; if (fp->_IO_read_ptr < fp->_IO_read_end) - return *(unsigned char*)fp->_IO_read_ptr++; - if (_IO_in_backup(fp)) + return *(unsigned char *) fp->_IO_read_ptr++; + if (_IO_in_backup (fp)) { - _IO_switch_to_main_get_area(fp); + _IO_switch_to_main_get_area (fp); if (fp->_IO_read_ptr < fp->_IO_read_end) return *fp->_IO_read_ptr++; } - if (_IO_have_markers(fp)) + if (_IO_have_markers (fp)) { if (save_for_backup (fp)) return EOF; } - else if (_IO_have_backup(fp)) - _IO_free_backup_area(fp); + else if (_IO_have_backup (fp)) + _IO_free_backup_area (fp); return _IO_UFLOW (fp); } void -DEFUN(_IO_setb, (f, b, eb, a), - _IO_FILE *f AND char *b AND char *eb AND int a) +_IO_setb (f, b, eb, a) + _IO_FILE *f; + char *b; + char *eb; + int a; { if (f->_IO_buf_base && !(f->_flags & _IO_USER_BUF)) - FREE_BUF(f->_IO_buf_base, _IO_blen (f)); + FREE_BUF (f->_IO_buf_base, _IO_blen (f)); f->_IO_buf_base = b; f->_IO_buf_end = eb; if (a) @@ -288,52 +313,55 @@ DEFUN(_IO_setb, (f, b, eb, a), } void -DEFUN(_IO_doallocbuf, (fp), - register _IO_FILE *fp) +_IO_doallocbuf (fp) + _IO_FILE *fp; { if (fp->_IO_buf_base) return; if (!(fp->_flags & _IO_UNBUFFERED)) if (_IO_DOALLOCATE (fp) != EOF) return; - _IO_setb(fp, fp->_shortbuf, fp->_shortbuf+1, 0); + _IO_setb (fp, fp->_shortbuf, fp->_shortbuf+1, 0); } int -DEFUN(_IO_default_underflow, (fp), - _IO_FILE *fp) +_IO_default_underflow (fp) + _IO_FILE *fp; { return EOF; } int -DEFUN(_IO_default_uflow, (fp), - _IO_FILE *fp) +_IO_default_uflow (fp) + _IO_FILE *fp; { int ch = _IO_UNDERFLOW (fp); if (ch == EOF) return EOF; - return *(unsigned char*)fp->_IO_read_ptr++; + return *(unsigned char *) fp->_IO_read_ptr++; } _IO_size_t -DEFUN(_IO_default_xsputn, (f, data, n), - register _IO_FILE *f AND const void *data AND _IO_size_t n) +_IO_default_xsputn (f, data, n) + _IO_FILE *f; + const void *data; + _IO_size_t n; { - register const char *s = (char*) data; - register _IO_size_t more = n; + const char *s = (char *) data; + _IO_size_t more = n; if (more <= 0) return 0; for (;;) { - _IO_ssize_t count = f->_IO_write_end - f->_IO_write_ptr; /* Space available. */ + /* Space available. */ + _IO_ssize_t count = f->_IO_write_end - f->_IO_write_ptr; if (count > 0) { if ((_IO_size_t) count > more) count = more; if (count > 20) { - memcpy(f->_IO_write_ptr, s, count); + memcpy (f->_IO_write_ptr, s, count); s += count; f->_IO_write_ptr += count; } @@ -341,14 +369,15 @@ DEFUN(_IO_default_xsputn, (f, data, n), count = 0; else { - register char *p = f->_IO_write_ptr; - register _IO_ssize_t i; - for (i = count; --i >= 0; ) *p++ = *s++; + char *p = f->_IO_write_ptr; + _IO_ssize_t i; + for (i = count; --i >= 0; ) + *p++ = *s++; f->_IO_write_ptr = p; } more -= count; } - if (more == 0 || __overflow(f, (unsigned char)*s++) == EOF) + if (more == 0 || __overflow (f, (unsigned char) *s++) == EOF) break; more--; } @@ -356,29 +385,34 @@ DEFUN(_IO_default_xsputn, (f, data, n), } _IO_size_t -DEFUN(_IO_sgetn, (fp, data, n), - _IO_FILE *fp AND void *data AND _IO_size_t n) +_IO_sgetn (fp, data, n) + _IO_FILE *fp; + void *data; + _IO_size_t n; { /* FIXME handle putback buffer here! */ return _IO_XSGETN (fp, data, n); } _IO_size_t -DEFUN(_IO_default_xsgetn, (fp, data, n), - _IO_FILE *fp AND void *data AND _IO_size_t n) +_IO_default_xsgetn (fp, data, n) + _IO_FILE *fp; + void *data; + _IO_size_t n; { - register _IO_size_t more = n; - register char *s = (char*) data; + _IO_size_t more = n; + char *s = (char*) data; for (;;) { - _IO_ssize_t count = fp->_IO_read_end - fp->_IO_read_ptr; /* Data available. */ + /* Data available. */ + _IO_ssize_t count = fp->_IO_read_end - fp->_IO_read_ptr; if (count > 0) { if ((_IO_size_t) count > more) count = more; if (count > 20) { - memcpy(s, fp->_IO_read_ptr, count); + memcpy (s, fp->_IO_read_ptr, count); s += count; fp->_IO_read_ptr += count; } @@ -386,41 +420,47 @@ DEFUN(_IO_default_xsgetn, (fp, data, n), count = 0; else { - register char *p = fp->_IO_read_ptr; - register int i = (int)count; - while (--i >= 0) *s++ = *p++; + char *p = fp->_IO_read_ptr; + int i = (int) count; + while (--i >= 0) + *s++ = *p++; fp->_IO_read_ptr = p; } more -= count; } - if (more == 0 || __underflow(fp) == EOF) + if (more == 0 || __underflow (fp) == EOF) break; } return n - more; } +#if 0 +/* Seems not to be needed. --drepper */ int -DEFUN(_IO_sync, (fp), - register _IO_FILE *fp) +_IO_sync (fp) + _IO_FILE *fp; { return 0; } +#endif -_IO_FILE* -DEFUN(_IO_default_setbuf, (fp, p, len), - register _IO_FILE *fp AND char* p AND _IO_ssize_t len) +_IO_FILE * +_IO_default_setbuf (fp, p, len) + _IO_FILE *fp; + char *p; + _IO_ssize_t len; { if (_IO_SYNC (fp) == EOF) return NULL; if (p == NULL || len == 0) { fp->_flags |= _IO_UNBUFFERED; - _IO_setb(fp, fp->_shortbuf, fp->_shortbuf+1, 0); + _IO_setb (fp, fp->_shortbuf, fp->_shortbuf+1, 0); } else { fp->_flags &= ~_IO_UNBUFFERED; - _IO_setb(fp, p, p+len, 0); + _IO_setb (fp, p, p+len, 0); } fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end = 0; fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end = 0; @@ -428,26 +468,29 @@ DEFUN(_IO_default_setbuf, (fp, p, len), } _IO_pos_t -DEFUN(_IO_default_seekpos, (fp, pos, mode), - _IO_FILE *fp AND _IO_pos_t pos AND int mode) +_IO_default_seekpos (fp, pos, mode) + _IO_FILE *fp; + _IO_pos_t pos; + int mode; { - return _IO_SEEKOFF (fp, _IO_pos_as_off(pos), 0, mode); + return _IO_SEEKOFF (fp, _IO_pos_as_off (pos), 0, mode); } int -DEFUN(_IO_default_doallocate, (fp), - _IO_FILE *fp) +_IO_default_doallocate (fp) + _IO_FILE *fp; { char *buf; - ALLOC_BUF(buf, _IO_BUFSIZ, EOF); - _IO_setb(fp, buf, buf+_IO_BUFSIZ, 1); + ALLOC_BUF (buf, _IO_BUFSIZ, EOF); + _IO_setb (fp, buf, buf+_IO_BUFSIZ, 1); return 1; } void -DEFUN(_IO_init, (fp, flags), - register _IO_FILE *fp AND int flags) +_IO_init (fp, flags) + _IO_FILE *fp; + int flags; { fp->_flags = _IO_MAGIC|flags; fp->_IO_buf_base = NULL; @@ -471,8 +514,8 @@ DEFUN(_IO_init, (fp, flags), } int -DEFUN(_IO_default_sync, (fp), - _IO_FILE *fp) +_IO_default_sync (fp) + _IO_FILE *fp; { return 0; } @@ -481,13 +524,14 @@ DEFUN(_IO_default_sync, (fp), current implementation, this function can get called twice! */ void -DEFUN(_IO_default_finish, (fp, dummy), - _IO_FILE *fp AND int dummy) +_IO_default_finish (fp, dummy) + _IO_FILE *fp; + int dummy; { struct _IO_marker *mark; if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF)) { - FREE_BUF(fp->_IO_buf_base, _IO_blen (fp)); + FREE_BUF (fp->_IO_buf_base, _IO_blen (fp)); fp->_IO_buf_base = fp->_IO_buf_end = NULL; } @@ -504,19 +548,23 @@ DEFUN(_IO_default_finish, (fp, dummy), _IO_lock_fini (*fp->_lock); #endif - _IO_un_link(fp); + _IO_un_link (fp); } _IO_pos_t -DEFUN(_IO_default_seekoff, (fp, offset, dir, mode), - register _IO_FILE *fp AND _IO_off_t offset AND int dir AND int mode) +_IO_default_seekoff (fp, offset, dir, mode) + _IO_FILE *fp; + _IO_off_t offset; + int dir; + int mode; { return _IO_pos_BAD; } int -DEFUN(_IO_sputbackc, (fp, c), - register _IO_FILE *fp AND int c) +_IO_sputbackc (fp, c) + _IO_FILE *fp; + int c; { int result; @@ -524,7 +572,7 @@ DEFUN(_IO_sputbackc, (fp, c), && (unsigned char)fp->_IO_read_ptr[-1] == (unsigned char)c) { fp->_IO_read_ptr--; - result = (unsigned char)c; + result = (unsigned char) c; } else result = _IO_PBACKFAIL (fp, c); @@ -536,15 +584,15 @@ DEFUN(_IO_sputbackc, (fp, c), } int -DEFUN(_IO_sungetc, (fp), - register _IO_FILE *fp) +_IO_sungetc (fp) + _IO_FILE *fp; { int result; if (fp->_IO_read_ptr > fp->_IO_read_base) { fp->_IO_read_ptr--; - result = (unsigned char)*fp->_IO_read_ptr; + result = (unsigned char) *fp->_IO_read_ptr; } else result = _IO_PBACKFAIL (fp, EOF); @@ -556,9 +604,12 @@ DEFUN(_IO_sungetc, (fp), } #if 0 /* Work in progress */ +/* Seems not to be needed. */ +#if 0 void -DEFUN(_IO_set_column, (fp, c), - register _IO_FILE *fp AND int c) +_IO_set_column (fp, c) + _IO_FILE *fp; + int c; { if (c == -1) fp->_column = -1; @@ -567,39 +618,46 @@ DEFUN(_IO_set_column, (fp, c), } #else int -DEFUN(_IO_set_column, (fp, i), - register _IO_FILE *fp AND int i) +_IO_set_column (fp, i) + _IO_FILE *fp; + int i; { - fp->_cur_column = i+1; + fp->_cur_column = i + 1; return 0; } #endif +#endif unsigned -DEFUN(_IO_adjust_column, (start, line, count), - unsigned start AND const char *line AND int count) +_IO_adjust_column (start, line, count) + unsigned start; + const char *line; + int count; { - register const char *ptr = line + count; + const char *ptr = line + count; while (ptr > line) if (*--ptr == '\n') return line + count - ptr - 1; return start + count; } +#if 0 +/* Seems not to be needed. --drepper */ int -DEFUN(_IO_get_column, (fp), - register _IO_FILE *fp) +_IO_get_column (fp) + _IO_FILE *fp; { if (fp->_cur_column) - return _IO_adjust_column(fp->_cur_column - 1, + return _IO_adjust_column (fp->_cur_column - 1, fp->_IO_write_base, fp->_IO_write_ptr - fp->_IO_write_base); return -1; } +#endif int -DEFUN_VOID(_IO_flush_all) +_IO_flush_all () { int result = 0; _IO_FILE *fp; @@ -611,7 +669,7 @@ DEFUN_VOID(_IO_flush_all) } void -DEFUN_VOID(_IO_flush_all_linebuffered) +_IO_flush_all_linebuffered () { _IO_FILE *fp; for (fp = _IO_list_all; fp != NULL; fp = fp->_chain) @@ -619,8 +677,10 @@ DEFUN_VOID(_IO_flush_all_linebuffered) _IO_OVERFLOW (fp, EOF); } -void -DEFUN_VOID(_IO_unbuffer_all) +static void _IO_unbuffer_all __P ((void)); + +static void +_IO_unbuffer_all () { _IO_FILE *fp; for (fp = _IO_list_all; fp != NULL; fp = fp->_chain) @@ -629,7 +689,7 @@ DEFUN_VOID(_IO_unbuffer_all) } void -DEFUN_VOID(_IO_cleanup) +_IO_cleanup () { _IO_flush_all (); @@ -644,13 +704,14 @@ DEFUN_VOID(_IO_cleanup) } void -DEFUN(_IO_init_marker, (marker, fp), - struct _IO_marker *marker AND _IO_FILE *fp) +_IO_init_marker (marker, fp) + struct _IO_marker *marker; + _IO_FILE *fp; { marker->_sbuf = fp; - if (_IO_in_put_mode(fp)) - _IO_switch_to_get_mode(fp); - if (_IO_in_backup(fp)) + if (_IO_in_put_mode (fp)) + _IO_switch_to_get_mode (fp); + if (_IO_in_backup (fp)) marker->_pos = fp->_IO_read_ptr - fp->_IO_read_end; else marker->_pos = fp->_IO_read_ptr - fp->_IO_read_base; @@ -661,11 +722,11 @@ DEFUN(_IO_init_marker, (marker, fp), } void -DEFUN(_IO_remove_marker, (marker), - register struct _IO_marker *marker) +_IO_remove_marker (marker) + struct _IO_marker *marker; { /* Unlink from sb's chain. */ - register struct _IO_marker **ptr = &marker->_sbuf->_markers; + struct _IO_marker **ptr = &marker->_sbuf->_markers; for (; ; ptr = &(*ptr)->_next) { if (*ptr == NULL) @@ -685,21 +746,22 @@ DEFUN(_IO_remove_marker, (marker), #define BAD_DELTA EOF int -DEFUN(_IO_marker_difference, (mark1, mark2), - struct _IO_marker *mark1 AND struct _IO_marker *mark2) +_IO_marker_difference (mark1, mark2) + struct _IO_marker *mark1; + struct _IO_marker *mark2; { return mark1->_pos - mark2->_pos; } /* Return difference between MARK and current position of MARK's stream. */ int -DEFUN(_IO_marker_delta, (mark), - struct _IO_marker *mark) +_IO_marker_delta (mark) + struct _IO_marker *mark; { int cur_pos; if (mark->_sbuf == NULL) return BAD_DELTA; - if (_IO_in_backup(mark->_sbuf)) + if (_IO_in_backup (mark->_sbuf)) cur_pos = mark->_sbuf->_IO_read_ptr - mark->_sbuf->_IO_read_end; else cur_pos = mark->_sbuf->_IO_read_ptr - mark->_sbuf->_IO_read_base; @@ -707,135 +769,150 @@ DEFUN(_IO_marker_delta, (mark), } int -DEFUN(_IO_seekmark, (fp, mark, delta), - _IO_FILE *fp AND struct _IO_marker *mark AND int delta) +_IO_seekmark (fp, mark, delta) + _IO_FILE *fp; + struct _IO_marker *mark; + int delta; { if (mark->_sbuf != fp) return EOF; if (mark->_pos >= 0) { - if (_IO_in_backup(fp)) - _IO_switch_to_main_get_area(fp); + if (_IO_in_backup (fp)) + _IO_switch_to_main_get_area (fp); fp->_IO_read_ptr = fp->_IO_read_base + mark->_pos; } else { - if (!_IO_in_backup(fp)) - _IO_switch_to_backup_area(fp); + if (!_IO_in_backup (fp)) + _IO_switch_to_backup_area (fp); fp->_IO_read_ptr = fp->_IO_read_end + mark->_pos; } return 0; } void -DEFUN(_IO_unsave_markers, (fp), - register _IO_FILE *fp) +_IO_unsave_markers (fp) + _IO_FILE *fp; { - register struct _IO_marker *mark = fp->_markers; + struct _IO_marker *mark = fp->_markers; if (mark) { #ifdef TODO - streampos offset = seekoff(0, ios::cur, ios::in); + streampos offset = seekoff (0, ios::cur, ios::in); if (offset != EOF) { - offset += eGptr() - Gbase(); + offset += eGptr () - Gbase (); for ( ; mark != NULL; mark = mark->_next) - mark->set_streampos(mark->_pos + offset); + mark->set_streampos (mark->_pos + offset); } else { for ( ; mark != NULL; mark = mark->_next) - mark->set_streampos(EOF); + mark->set_streampos (EOF); } #endif fp->_markers = 0; } - if (_IO_have_backup(fp)) - _IO_free_backup_area(fp); + if (_IO_have_backup (fp)) + _IO_free_backup_area (fp); } +#if 0 +/* Seems not to be needed. --drepper */ int -DEFUN(_IO_nobackup_pbackfail, (fp, c), - register _IO_FILE *fp AND int c) +_IO_nobackup_pbackfail (fp, c) + _IO_FILE *fp; + int c; { if (fp->_IO_read_ptr > fp->_IO_read_base) fp->_IO_read_ptr--; if (c != EOF && *fp->_IO_read_ptr != c) *fp->_IO_read_ptr = c; - return (unsigned char)c; + return (unsigned char) c; } +#endif int -DEFUN(_IO_default_pbackfail, (fp, c), - register _IO_FILE *fp AND int c) +_IO_default_pbackfail (fp, c) + _IO_FILE *fp; + int c; { if (fp->_IO_read_ptr <= fp->_IO_read_base) - { - /* Need to handle a filebuf in write mode (switch to read mode). FIXME!*/ - if (_IO_have_backup(fp) && !_IO_in_backup(fp)) - _IO_switch_to_backup_area(fp); - - if (!_IO_have_backup(fp)) - { - /* No backup buffer: allocate one. */ - /* Use nshort buffer, if unused? (probably not) FIXME */ - int backup_size = 128; - char *bbuf = (char*)malloc(backup_size); - if (bbuf == NULL) - return EOF; - fp->_IO_save_base = bbuf; - fp->_IO_save_end = fp->_IO_save_base + backup_size; - fp->_IO_backup_base = fp->_IO_save_end; - _IO_switch_to_backup_area(fp); - } - else if (fp->_IO_read_ptr <= fp->_IO_read_base) - { - /* Increase size of existing backup buffer. */ - _IO_size_t new_size; - _IO_size_t old_size = fp->_IO_read_end - fp->_IO_read_base; - char *new_buf; - new_size = 2 * old_size; - new_buf = (char*)malloc(new_size); - if (new_buf == NULL) - return EOF; - memcpy(new_buf+(new_size-old_size), fp->_IO_read_base, old_size); - free (fp->_IO_read_base); - _IO_setg(fp, - new_buf, new_buf+(new_size-old_size), new_buf+new_size); - fp->_IO_backup_base = fp->_IO_read_ptr; - } - } - fp->_IO_read_ptr--; + { + /* Need to handle a filebuf in write mode (switch to read mode). FIXME!*/ + if (_IO_have_backup (fp) && !_IO_in_backup (fp)) + _IO_switch_to_backup_area (fp); + + if (!_IO_have_backup (fp)) + { + /* No backup buffer: allocate one. */ + /* Use nshort buffer, if unused? (probably not) FIXME */ + int backup_size = 128; + char *bbuf = (char *) malloc (backup_size); + if (bbuf == NULL) + return EOF; + fp->_IO_save_base = bbuf; + fp->_IO_save_end = fp->_IO_save_base + backup_size; + fp->_IO_backup_base = fp->_IO_save_end; + _IO_switch_to_backup_area (fp); + } + else if (fp->_IO_read_ptr <= fp->_IO_read_base) + { + /* Increase size of existing backup buffer. */ + _IO_size_t new_size; + _IO_size_t old_size = fp->_IO_read_end - fp->_IO_read_base; + char *new_buf; + new_size = 2 * old_size; + new_buf = (char *) malloc (new_size); + if (new_buf == NULL) + return EOF; + memcpy (new_buf + (new_size - old_size), fp->_IO_read_base, + old_size); + free (fp->_IO_read_base); + _IO_setg (fp, new_buf, new_buf + (new_size - old_size), + new_buf + new_size); + fp->_IO_backup_base = fp->_IO_read_ptr; + } + } + --fp->_IO_read_ptr; if (c != EOF && *fp->_IO_read_ptr != c) *fp->_IO_read_ptr = c; - return (unsigned char)*fp->_IO_read_ptr; + return (unsigned char) *fp->_IO_read_ptr; } _IO_pos_t -DEFUN(_IO_default_seek, (fp, offset, dir), - _IO_FILE *fp AND _IO_off_t offset AND int dir) +_IO_default_seek (fp, offset, dir) + _IO_FILE *fp; + _IO_off_t offset; + int dir; { return _IO_pos_BAD; } int -DEFUN(_IO_default_stat, (fp, st), - _IO_FILE *fp AND void* st) +_IO_default_stat (fp, st) + _IO_FILE *fp; + void* st; { return EOF; } _IO_ssize_t -DEFUN(_IO_default_read, (fp, data, n), - register _IO_FILE* fp AND void* data AND _IO_ssize_t n) +_IO_default_read (fp, data, n) + _IO_FILE* fp; + void *data; + _IO_ssize_t n; { return -1; } _IO_ssize_t -DEFUN(_IO_default_write, (fp, data, n), - register _IO_FILE* fp AND const void* data AND _IO_ssize_t n) +_IO_default_write (fp, data, n) + _IO_FILE *fp; + const void *data; + _IO_ssize_t n; { return 0; } @@ -851,7 +928,7 @@ DEFUN(_IO_default_write, (fp, data, n), #else struct __io_defs { __io_defs() { } - ~__io_defs() { _IO_cleanup(); } + ~__io_defs() { _IO_cleanup (); } }; __io_defs io_defs__; #endif diff --git a/libio/getc.c b/libio/getc.c index d3e89fcc27..1dc53b5ed6 100644 --- a/libio/getc.c +++ b/libio/getc.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" @@ -39,5 +40,9 @@ _IO_getc (fp) _IO_cleanup_region_end (1); return result; } + #undef getc + +#ifdef weak_alias weak_alias (_IO_getc, getc) +#endif diff --git a/libio/getc_u.c b/libio/getc_u.c index 569e063b1f..f074427446 100644 --- a/libio/getc_u.c +++ b/libio/getc_u.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" diff --git a/libio/getchar.c b/libio/getchar.c index 25eb2b10ae..93194b3912 100644 --- a/libio/getchar.c +++ b/libio/getchar.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" diff --git a/libio/getchar_u.c b/libio/getchar_u.c index 337f693709..bfbe56b30c 100644 --- a/libio/getchar_u.c +++ b/libio/getchar_u.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" diff --git a/libio/iofclose.c b/libio/iofclose.c index 67fadbed2d..35f4a8b569 100644 --- a/libio/iofclose.c +++ b/libio/iofclose.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1995 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #ifdef __STDC__ @@ -29,7 +30,7 @@ the executable file might be covered by the GNU General Public License. */ int _IO_fclose (fp) - register _IO_FILE *fp; + _IO_FILE *fp; { int status; @@ -52,4 +53,6 @@ _IO_fclose (fp) return status; } +#ifdef weak_alias weak_alias (_IO_fclose, fclose) +#endif diff --git a/libio/iofdopen.c b/libio/iofdopen.c index 4ec9a1cbce..841e7032b8 100644 --- a/libio/iofdopen.c +++ b/libio/iofdopen.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1994 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1993, 1994, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #ifdef __STDC__ #include <stdlib.h> diff --git a/libio/iofflush.c b/libio/iofflush.c index 082988875f..540c99d535 100644 --- a/libio/iofflush.c +++ b/libio/iofflush.c @@ -1,33 +1,34 @@ -/* -Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include <stdio.h> int _IO_fflush (fp) - register _IO_FILE *fp; + _IO_FILE *fp; { if (fp == NULL) return _IO_flush_all (); diff --git a/libio/iofflush_u.c b/libio/iofflush_u.c index b8af7101a1..b46ae4a3f9 100644 --- a/libio/iofflush_u.c +++ b/libio/iofflush_u.c @@ -1,33 +1,34 @@ -/* -Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include <stdio.h> int fflush_unlocked (fp) - register _IO_FILE *fp; + _IO_FILE *fp; { if (fp == NULL) return _IO_flush_all (); diff --git a/libio/iofgetpos.c b/libio/iofgetpos.c index 9682af96ae..08a3c20e86 100644 --- a/libio/iofgetpos.c +++ b/libio/iofgetpos.c @@ -1,30 +1,30 @@ -/* -Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include <errno.h> -/* ANSI explicitly requires setting errno to a positive value on failure. */ int _IO_fgetpos (fp, posp) @@ -39,6 +39,8 @@ _IO_fgetpos (fp, posp) _IO_cleanup_region_end (1); if (pos == _IO_pos_BAD) { + /* ANSI explicitly requires setting errno to a positive value on + failure. */ #ifdef EIO if (errno == 0) __set_errno (EIO); diff --git a/libio/iofgets.c b/libio/iofgets.c index c8ec289bd1..74754d5d1e 100644 --- a/libio/iofgets.c +++ b/libio/iofgets.c @@ -1,35 +1,36 @@ -/* -Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include <stdio.h> -char* +char * _IO_fgets (buf, n, fp) - char* buf; + char *buf; int n; - _IO_FILE* fp; + _IO_FILE *fp; { _IO_size_t count; char *result; diff --git a/libio/iofopen.c b/libio/iofopen.c index acf034cd22..1dbeccb81a 100644 --- a/libio/iofopen.c +++ b/libio/iofopen.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #ifdef __STDC__ diff --git a/libio/iofopncook.c b/libio/iofopncook.c index 718205e073..9bf29e71ae 100644 --- a/libio/iofopncook.c +++ b/libio/iofopncook.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1995 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include <libioP.h> #include <stdio.h> @@ -39,8 +40,8 @@ static int _IO_cookie_close __P ((_IO_FILE* fp)); static _IO_ssize_t _IO_cookie_read (fp, buf, size) - register _IO_FILE* fp; - void* buf; + _IO_FILE *fp; + void *buf; _IO_ssize_t size; { struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp; @@ -53,8 +54,8 @@ _IO_cookie_read (fp, buf, size) static _IO_ssize_t _IO_cookie_write (fp, buf, size) - register _IO_FILE* fp; - const void* buf; + _IO_FILE *fp; + const void *buf; _IO_ssize_t size; { struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp; @@ -88,7 +89,7 @@ _IO_cookie_seek (fp, offset, dir) static int _IO_cookie_close (fp) - _IO_FILE* fp; + _IO_FILE *fp; { struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp; diff --git a/libio/iofprintf.c b/libio/iofprintf.c index 74e28263b5..4dc9d3f661 100644 --- a/libio/iofprintf.c +++ b/libio/iofprintf.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993 Free Software Foundation +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" @@ -31,11 +32,13 @@ the executable file might be covered by the GNU General Public License. */ #endif int -_IO_fprintf #ifdef __STDC__ - (_IO_FILE *fp, const char* format, ...) +_IO_fprintf (_IO_FILE *fp, const char* format, ...) #else -(fp, format, va_alist) _IO_FILE *fp; char *format; va_dcl +_IO_fprintf (fp, format, va_alist) + _IO_FILE *fp; + char *format; + va_dcl #endif { int ret; diff --git a/libio/iofputs.c b/libio/iofputs.c index 7c76ac6336..1a329bbe26 100644 --- a/libio/iofputs.c +++ b/libio/iofputs.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include <string.h> diff --git a/libio/iofread.c b/libio/iofread.c index ad7e4845a8..c83d2b638c 100644 --- a/libio/iofread.c +++ b/libio/iofread.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1995 Free Software Foundation +/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" @@ -29,7 +30,7 @@ _IO_fread (buf, size, count, fp) void *buf; _IO_size_t size; _IO_size_t count; - _IO_FILE* fp; + _IO_FILE *fp; { _IO_size_t bytes_requested = size*count; _IO_size_t bytes_read; diff --git a/libio/iofsetpos.c b/libio/iofsetpos.c index 2f71d79708..a8d816f5a3 100644 --- a/libio/iofsetpos.c +++ b/libio/iofsetpos.c @@ -1,33 +1,34 @@ -/* -Copyright (C) 1993, 1995 Free Software Foundation +/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include <libioP.h> #include <errno.h> int _IO_fsetpos (fp, posp) - _IO_FILE* fp; + _IO_FILE *fp; const _IO_fpos_t *posp; { int result; diff --git a/libio/ioftell.c b/libio/ioftell.c index 37156bb22c..d8a1ce1d24 100644 --- a/libio/ioftell.c +++ b/libio/ioftell.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include <errno.h> @@ -28,7 +29,7 @@ the executable file might be covered by the GNU General Public License. */ long int _IO_ftell (fp) - _IO_FILE* fp; + _IO_FILE *fp; { _IO_pos_t pos; CHECK_FILE (fp, -1L); diff --git a/libio/iofwrite.c b/libio/iofwrite.c index 3f098e078e..5bc525ffc7 100644 --- a/libio/iofwrite.c +++ b/libio/iofwrite.c @@ -1,37 +1,38 @@ -/* -Copyright (C) 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" _IO_size_t _IO_fwrite (buf, size, count, fp) - const void* buf; + const void *buf; _IO_size_t size; _IO_size_t count; _IO_FILE *fp; { - _IO_size_t request = size*count; + _IO_size_t request = size * count; _IO_size_t written; CHECK_FILE (fp, 0); if (request == 0) @@ -41,11 +42,11 @@ _IO_fwrite (buf, size, count, fp) written = _IO_sputn (fp, (const char *) buf, request); _IO_cleanup_region_end (1); /* Many traditional implementations return 0 if size==0 && count > 0, - but ANSI seems to require us to return count in this case. */ + but ANSI requires us to return count in this case. */ if (written == request) return count; else - return written/size; + return written / size; } #ifdef weak_alias diff --git a/libio/iogetdelim.c b/libio/iogetdelim.c index 8e87511c12..50918b3e8d 100644 --- a/libio/iogetdelim.c +++ b/libio/iogetdelim.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1994, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #ifdef __STDC__ #include <stdlib.h> @@ -39,11 +40,11 @@ _IO_ssize_t _IO_getdelim (lineptr, n, delimiter, fp) char **lineptr; _IO_size_t *n; - int delimiter; - _IO_FILE *fp; + int delimiter; + _IO_FILE *fp; { int result; - register _IO_ssize_t cur_len = 0; + _IO_ssize_t cur_len = 0; _IO_ssize_t len; if (lineptr == NULL || n == NULL) diff --git a/libio/iogetline.c b/libio/iogetline.c index a72707196b..bd1a7431f3 100644 --- a/libio/iogetline.c +++ b/libio/iogetline.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993 Free Software Foundation +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include <string.h> @@ -34,38 +35,41 @@ the executable file might be covered by the GNU General Public License. */ If extract_delim > 0, insert delim in output. */ _IO_size_t -DEFUN(_IO_getline, (fp, buf, n, delim, extract_delim), - _IO_FILE *fp AND char* buf AND _IO_size_t n - AND int delim AND int extract_delim) +_IO_getline (fp, buf, n, delim, extract_delim) + _IO_FILE *fp; + char *buf; + _IO_size_t n; + int delim; + int extract_delim; { - register char *ptr = buf; + char *ptr = buf; do { _IO_ssize_t len = fp->_IO_read_end - fp->_IO_read_ptr; char *t; if (len <= 0) - if (__underflow(fp) == EOF) + if (__underflow (fp) == EOF) break; else len = fp->_IO_read_end - fp->_IO_read_ptr; if ((_IO_size_t) len >= n) len = n; - t = (char*)memchr((void*)fp->_IO_read_ptr, delim, len); + t = (char *) memchr ((void *) fp->_IO_read_ptr, delim, len); if (t != NULL) { _IO_size_t old_len = ptr-buf; len = t - fp->_IO_read_ptr; if (extract_delim >= 0) { - t++; + ++t; if (extract_delim > 0) - len++; + ++len; } - memcpy((void*)ptr, (void*)fp->_IO_read_ptr, len); + memcpy ((void *) ptr, (void *) fp->_IO_read_ptr, len); fp->_IO_read_ptr = t; return old_len + len; } - memcpy((void*)ptr, (void*)fp->_IO_read_ptr, len); + memcpy ((void *) ptr, (void *) fp->_IO_read_ptr, len); fp->_IO_read_ptr += len; ptr += len; n -= len; diff --git a/libio/iogets.c b/libio/iogets.c index ed078763c4..9e88ca1037 100644 --- a/libio/iogets.c +++ b/libio/iogets.c @@ -1,33 +1,34 @@ -/* -Copyright (C) 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include <limits.h> char* _IO_gets (buf) - char* buf; + char *buf; { _IO_size_t count; int ch; @@ -46,7 +47,7 @@ _IO_gets (buf) count = 0; else { - buf[0] = (char)ch; + buf[0] = (char) ch; count = _IO_getline (_IO_stdin, buf + 1, INT_MAX, '\n', 0) + 1; if (_IO_stdin->_IO_file_flags & _IO_ERR_SEEN) { diff --git a/libio/iopadn.c b/libio/iopadn.c index be2c2a6767..087715b349 100644 --- a/libio/iopadn.c +++ b/libio/iopadn.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993 Free Software Foundation +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" @@ -31,13 +32,16 @@ static char const zeroes[PADSIZE] = {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'}; _IO_ssize_t -DEFUN(_IO_padn, (fp, pad, count), - _IO_FILE *fp AND int pad AND _IO_ssize_t count) +_IO_padn (fp, pad, count) + _IO_FILE *fp; + int pad; + _IO_ssize_t count; { char padbuf[PADSIZE]; const char *padptr; - register int i; - _IO_size_t written = 0, w; + int i; + _IO_size_t written = 0; + _IO_size_t w; if (pad == ' ') padptr = blanks; @@ -45,12 +49,13 @@ DEFUN(_IO_padn, (fp, pad, count), padptr = zeroes; else { - for (i = PADSIZE; --i >= 0; ) padbuf[i] = pad; + for (i = PADSIZE; --i >= 0; ) + padbuf[i] = pad; padptr = padbuf; } for (i = count; i >= PADSIZE; i -= PADSIZE) { - w = _IO_sputn(fp, padptr, PADSIZE); + w = _IO_sputn (fp, padptr, PADSIZE); written += w; if (w != PADSIZE) return written; @@ -58,7 +63,7 @@ DEFUN(_IO_padn, (fp, pad, count), if (i > 0) { - w = _IO_sputn(fp, padptr, i); + w = _IO_sputn (fp, padptr, i); written += w; } return written; diff --git a/libio/iopopen.c b/libio/iopopen.c index 0768321281..434008609f 100644 --- a/libio/iopopen.c +++ b/libio/iopopen.c @@ -1,28 +1,28 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* written by Per Bothner (bothner@cygnus.com) */ +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + Written by Per Bothner <bothner@cygnus.com>. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #ifndef _POSIX_SOURCE # define _POSIX_SOURCE @@ -80,17 +80,19 @@ typedef struct _IO_proc_file _IO_proc_file; static struct _IO_proc_file *proc_file_chain = NULL; _IO_FILE * -DEFUN(_IO_proc_open, (fp, command, mode), - _IO_FILE* fp AND const char *command AND const char *mode) +_IO_proc_open (fp, command, mode) + _IO_FILE *fp; + const char *command; + const char *mode; { #if _IO_HAVE_SYS_WAIT volatile int read_or_write; volatile int parent_end, child_end; int pipe_fds[2]; _IO_pid_t child_pid; - if (_IO_file_is_open(fp)) + if (_IO_file_is_open (fp)) return NULL; - if (_IO_pipe(pipe_fds) < 0) + if (_IO_pipe (pipe_fds) < 0) return NULL; if (mode[0] == 'r') { @@ -104,17 +106,17 @@ DEFUN(_IO_proc_open, (fp, command, mode), child_end = pipe_fds[0]; read_or_write = _IO_NO_READS; } - ((_IO_proc_file*)fp)->pid = child_pid = _IO_fork(); + ((_IO_proc_file *) fp)->pid = child_pid = _IO_fork (); if (child_pid == 0) { int child_std_end = mode[0] == 'r' ? 1 : 0; - _IO_close(parent_end); + _IO_close (parent_end); if (child_end != child_std_end) { - _IO_dup2(child_end, child_std_end); - _IO_close(child_end); + _IO_dup2 (child_end, child_std_end); + _IO_close (child_end); } - /* Posix.2: "popen() shall ensure that any streams from previous + /* POSIX.2: "popen() shall ensure that any streams from previous popen() calls that remain open in the parent process are closed in the new child process." */ while (proc_file_chain) @@ -123,20 +125,20 @@ DEFUN(_IO_proc_open, (fp, command, mode), proc_file_chain = proc_file_chain->next; } - _IO_execl("/bin/sh", "sh", "-c", command, (char *) 0); - _IO__exit(127); + _IO_execl ("/bin/sh", "sh", "-c", command, (char *) 0); + _IO__exit (127); } - _IO_close(child_end); + _IO_close (child_end); if (child_pid < 0) { - _IO_close(parent_end); + _IO_close (parent_end); return NULL; } - _IO_fileno(fp) = parent_end; + _IO_fileno (fp) = parent_end; /* Link into proc_file_chain. */ - ((_IO_proc_file*)fp)->next = proc_file_chain; - proc_file_chain = (_IO_proc_file*)fp; + ((_IO_proc_file *) fp)->next = proc_file_chain; + proc_file_chain = (_IO_proc_file *) fp; _IO_mask_flags (fp, read_or_write, _IO_NO_READS|_IO_NO_WRITES); return fp; @@ -146,8 +148,9 @@ DEFUN(_IO_proc_open, (fp, command, mode), } _IO_FILE * -DEFUN(_IO_popen, (command, mode), - const char *command AND const char *mode) +_IO_popen (command, mode) + const char *command; + const char *mode; { struct locked_FILE { @@ -165,11 +168,11 @@ DEFUN(_IO_popen, (command, mode), new_f->fpx.file.file._lock = &new_f->lock; #endif fp = (_IO_FILE*)&new_f->fpx; - _IO_init(fp, 0); - _IO_JUMPS(fp) = &_IO_proc_jumps; - _IO_file_init(fp); + _IO_init (fp, 0); + _IO_JUMPS (fp) = &_IO_proc_jumps; + _IO_file_init (fp); #if !_IO_UNIFIED_JUMPTABLES - ((struct _IO_FILE_plus*)fp)->vtable = NULL; + ((struct _IO_FILE_plus *) fp)->vtable = NULL; #endif if (_IO_proc_open (fp, command, mode) != NULL) return fp; @@ -182,8 +185,8 @@ strong_alias (_IO_popen, popen); #endif int -DEFUN(_IO_proc_close, (fp), - _IO_FILE *fp) +_IO_proc_close (fp) + _IO_FILE *fp; { /* This is not name-space clean. FIXME! */ #if _IO_HAVE_SYS_WAIT @@ -195,7 +198,7 @@ DEFUN(_IO_proc_close, (fp), /* Unlink from proc_file_chain. */ for ( ; *ptr != NULL; ptr = &(*ptr)->next) { - if (*ptr == (_IO_proc_file*)fp) + if (*ptr == (_IO_proc_file *) fp) { *ptr = (*ptr)->next; status = 0; @@ -203,7 +206,7 @@ DEFUN(_IO_proc_close, (fp), } } - if (status < 0 || _IO_close(_IO_fileno(fp)) < 0) + if (status < 0 || _IO_close (_IO_fileno(fp)) < 0) return -1; /* POSIX.2 Rationale: "Some historical implementations either block or ignore the signals SIGINT, SIGQUIT, and SIGHUP while waiting @@ -211,8 +214,9 @@ DEFUN(_IO_proc_close, (fp), described in POSIX.2, such implementations are not conforming." */ do { - wait_pid = _IO_waitpid (((_IO_proc_file*)fp)->pid, &wstatus, 0); - } while (wait_pid == -1 && errno == EINTR); + wait_pid = _IO_waitpid (((_IO_proc_file *) fp)->pid, &wstatus, 0); + } + while (wait_pid == -1 && errno == EINTR); if (wait_pid == -1) return -1; return wstatus; diff --git a/libio/ioputs.c b/libio/ioputs.c index fcc296a45c..ab5e6aaa4c 100644 --- a/libio/ioputs.c +++ b/libio/ioputs.c @@ -1,37 +1,39 @@ -/* Copyright (C) 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include <string.h> int _IO_puts (str) - const char *str; + const char *str; { int result; _IO_size_t len = strlen (str); _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, - _IO_stdout); + _IO_stdout); _IO_flockfile (_IO_stdout); if (_IO_sputn (_IO_stdout, str, len) == len && _IO_putc_unlocked ('\n', _IO_stdout) != EOF) diff --git a/libio/ioseekoff.c b/libio/ioseekoff.c index 80720e5180..8c642165f6 100644 --- a/libio/ioseekoff.c +++ b/libio/ioseekoff.c @@ -1,32 +1,36 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include <libioP.h> _IO_pos_t -DEFUN(_IO_seekoff, (fp, offset, dir, mode), - _IO_FILE* fp AND _IO_off_t offset AND int dir AND int mode) +_IO_seekoff (fp, offset, dir, mode) + _IO_FILE *fp; + _IO_off_t offset; + int dir; + int mode; { /* If we have a backup buffer, get rid of it, since the __seekoff callback may not know to do the right thing about it. diff --git a/libio/ioseekpos.c b/libio/ioseekpos.c index dfb3b16d9b..1ae88fb848 100644 --- a/libio/ioseekpos.c +++ b/libio/ioseekpos.c @@ -1,32 +1,35 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include <libioP.h> _IO_pos_t -DEFUN(_IO_seekpos, (fp, pos, mode), - _IO_FILE* fp AND _IO_pos_t pos AND int mode) +_IO_seekpos (fp, pos, mode) + _IO_FILE *fp; + _IO_pos_t pos; + int mode; { /* If we have a backup buffer, get rid of it, since the __seekoff callback may not know to do the right thing about it. diff --git a/libio/iosetbuffer.c b/libio/iosetbuffer.c index 8921887985..f140a9ad04 100644 --- a/libio/iosetbuffer.c +++ b/libio/iosetbuffer.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" diff --git a/libio/iosetvbuf.c b/libio/iosetvbuf.c index 3e105f3b79..65eeea51a6 100644 --- a/libio/iosetvbuf.c +++ b/libio/iosetvbuf.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" @@ -30,8 +31,8 @@ the executable file might be covered by the GNU General Public License. */ int _IO_setvbuf (fp, buf, mode, size) - _IO_FILE* fp; - char* buf; + _IO_FILE *fp; + char *buf; int mode; _IO_size_t size; { diff --git a/libio/iosprintf.c b/libio/iosprintf.c index b873eb4455..704a6dbd72 100644 --- a/libio/iosprintf.c +++ b/libio/iosprintf.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993 Free Software Foundation +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" @@ -31,17 +32,19 @@ the executable file might be covered by the GNU General Public License. */ #endif int -_IO_sprintf #ifdef __STDC__ - (char *string, const char* format, ...) +_IO_sprintf (char *string, const char* format, ...) #else -(string, format, va_alist) char *string; char *format; va_dcl +_IO_sprintf (string, format, va_alist) + char *string; + char *format; + va_dcl #endif { int ret; va_list args; - _IO_va_start(args, format); - ret = _IO_vsprintf(string, format, args); - va_end(args); + _IO_va_start (args, format); + ret = _IO_vsprintf (string, format, args); + va_end (args); return ret; } diff --git a/libio/ioungetc.c b/libio/ioungetc.c index 866cba642d..07f38e747b 100644 --- a/libio/ioungetc.c +++ b/libio/ioungetc.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" diff --git a/libio/iovdprintf.c b/libio/iovdprintf.c index b4b1cc337c..a24d3b535e 100644 --- a/libio/iovdprintf.c +++ b/libio/iovdprintf.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1995 Free Software Foundation +/* Copyright (C) 1995, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "libio.h" @@ -63,4 +64,7 @@ _IO_vdprintf (d, format, arg) return done; } + +#ifdef weak_alias weak_alias (_IO_vdprintf, vdprintf) +#endif diff --git a/libio/iovsprintf.c b/libio/iovsprintf.c index 25bae66d93..34919588ce 100644 --- a/libio/iovsprintf.c +++ b/libio/iovsprintf.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "strfile.h" @@ -29,7 +30,7 @@ int _IO_vsprintf (string, format, args) char *string; const char *format; - _IO_va_list args; + _IO_va_list args; { _IO_strfile sf; #ifdef _IO_MTSAFE_IO diff --git a/libio/iovsscanf.c b/libio/iovsscanf.c index e9376fe03d..21600f53ef 100644 --- a/libio/iovsscanf.c +++ b/libio/iovsscanf.c @@ -1,33 +1,36 @@ -/* -Copyright (C) 1993 Free Software Foundation +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "strfile.h" int -DEFUN(_IO_vsscanf, (string, format, args), - const char *string AND const char *format AND _IO_va_list args) +_IO_vsscanf (string, format, args) + const char *string; + const char *format; + _IO_va_list args; { int ret; _IO_strfile sf; @@ -35,12 +38,12 @@ DEFUN(_IO_vsscanf, (string, format, args), _IO_lock_t lock; sf._sbf._f._lock = &lock; #endif - _IO_init(&sf._sbf._f, 0); - _IO_JUMPS(&sf._sbf._f) = &_IO_str_jumps; + _IO_init (&sf._sbf._f, 0); + _IO_JUMPS (&sf._sbf._f) = &_IO_str_jumps; _IO_str_init_static (&sf._sbf._f, (char*)string, 0, NULL); _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, &sf); _IO_flockfile (&sf._sbf._f); - ret = _IO_vfscanf(&sf._sbf._f, format, args, NULL); + ret = _IO_vfscanf (&sf._sbf._f, format, args, NULL); _IO_cleanup_region_end (1); return ret; } diff --git a/libio/libio.h b/libio/libio.h index 88bd0ae576..03b2afdf28 100644 --- a/libio/libio.h +++ b/libio/libio.h @@ -1,28 +1,28 @@ -/* -Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -/* This is part of the iostream library. Written by Per Bothner. */ +/* Copyright (C) 1991, 92, 93, 94, 95, 97 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + Written by Per Bothner <bothner@cygnus.com>. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #ifndef _IO_STDIO_H #define _IO_STDIO_H @@ -43,56 +43,56 @@ the executable file might be covered by the GNU General Public License. */ #ifdef _G_NEED_STDARG_H /* This define avoids name pollution if we're using GNU stdarg.h */ -#define __need___va_list -#include <stdarg.h> -#ifdef __GNUC_VA_LIST -#undef _IO_va_list -#define _IO_va_list __gnuc_va_list -#endif /* __GNUC_VA_LIST */ +# define __need___va_list +# include <stdarg.h> +# ifdef __GNUC_VA_LIST +# undef _IO_va_list +# define _IO_va_list __gnuc_va_list +# endif /* __GNUC_VA_LIST */ #endif #ifndef __P -#if _G_HAVE_SYS_CDEFS -#include <sys/cdefs.h> -#else -#ifdef __STDC__ -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif +# if _G_HAVE_SYS_CDEFS +# include <sys/cdefs.h> +# else +# ifdef __STDC__ +# define __P(protos) protos +# else +# define __P(protos) () +# endif +# endif #endif /*!__P*/ /* For backward compatibility */ #ifndef _PARAMS -#define _PARAMS(protos) __P(protos) +# define _PARAMS(protos) __P(protos) #endif /*!_PARAMS*/ #ifndef __STDC__ -#define const +# define const #endif #define _IO_UNIFIED_JUMPTABLES 1 #if 0 -#ifdef _IO_NEED_STDARG_H -#include <stdarg.h> -#endif +# ifdef _IO_NEED_STDARG_H +# include <stdarg.h> +# endif #endif #ifndef EOF -#define EOF (-1) +# define EOF (-1) #endif #ifndef NULL -#if defined __GNUG__ && \ +# if defined __GNUG__ && \ (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) -#define NULL (__null) -#else -#if !defined(__cplusplus) -#define NULL ((void*)0) -#else -#define NULL (0) -#endif -#endif +# define NULL (__null) +# else +# if !defined(__cplusplus) +# define NULL ((void*)0) +# else +# define NULL (0) +# endif +# endif #endif #define _IOS_INPUT 1 @@ -153,7 +153,7 @@ struct _IO_jump_t; struct _IO_FILE; /* Handle lock. */ #ifdef _IO_MTSAFE_IO -#include <bits/stdio-lock.h> +# include <bits/stdio-lock.h> #else typedef void _IO_lock_t; #endif @@ -239,7 +239,8 @@ typedef struct } _IO_cookie_io_functions_t; /* Special file type for fopencookie function. */ -struct _IO_cookie_file { +struct _IO_cookie_file +{ struct _IO_FILE file; const void *vtable; void *cookie; @@ -251,22 +252,22 @@ struct _IO_cookie_file { extern "C" { #endif -extern int __underflow __P((_IO_FILE*)); -extern int __uflow __P((_IO_FILE*)); -extern int __overflow __P((_IO_FILE*, int)); +extern int __underflow __P ((_IO_FILE *)); +extern int __uflow __P ((_IO_FILE *)); +extern int __overflow __P ((_IO_FILE *, int)); #define _IO_getc_unlocked(_fp) \ - ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end ? __uflow(_fp) \ - : *(unsigned char*)(_fp)->_IO_read_ptr++) + ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end ? __uflow (_fp) \ + : *(unsigned char *) (_fp)->_IO_read_ptr++) #define _IO_peekc_unlocked(_fp) \ ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end \ - && __underflow(_fp) == EOF ? EOF \ - : *(unsigned char*)(_fp)->_IO_read_ptr) + && __underflow (_fp) == EOF ? EOF \ + : *(unsigned char *) (_fp)->_IO_read_ptr) #define _IO_putc_unlocked(_ch, _fp) \ (((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end) \ - ? __overflow(_fp, (unsigned char)(_ch)) \ - : (unsigned char)(*(_fp)->_IO_write_ptr++ = (_ch))) + ? __overflow (_fp, (unsigned char) (_ch)) \ + : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch))) #define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0) #define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0) @@ -294,32 +295,17 @@ extern int _IO_ftrylockfile __P ((_IO_FILE *)); # define _IO_cleanup_region_end(_Doit) /**/ #endif /* !_IO_MTSAFE_IO */ -/* XXX Should we allow a symbol to be defined which selects the efficient - implementation when the user is really sure no threaded functions ever - will be used? */ -#if 1 -# define _IO_getc(_fp) _IO_getc (_fp) -# define _IO_peekc(_fp) _IO_peekc_locked (_fp) -# define _IO_putc(_ch, _fp) _IO_putc (_ch, _fp) -# define _IO_feof(_fp) _IO_feof (_fp) -# define _IO_ferror(_fp) _IO_ferror (_fp) -#else -# define _IO_getc(_fp) _IO_getc_unlocked (_fp) -# define _IO_peekc(_fp) _IO_peekc_unlocked (_fp) -# define _IO_putc(_ch, _fp) _IO_putc_unlocked (_ch, _fp) -# define _IO_feof(_fp) _IO_feof_unlocked (_fp) -# define _IO_ferror(_fp) _IO_ferror_unlocked (_fp) -#endif +#define _IO_peekc(_fp) _IO_peekc_locked (_fp) -extern int _IO_vfscanf __P((_IO_FILE*, const char*, _IO_va_list, int*)); -extern int _IO_vfprintf __P((_IO_FILE*, const char*, _IO_va_list)); -extern _IO_ssize_t _IO_padn __P((_IO_FILE *, int, _IO_ssize_t)); -extern _IO_size_t _IO_sgetn __P((_IO_FILE *, void*, _IO_size_t)); +extern int _IO_vfscanf __P ((_IO_FILE *, const char *, _IO_va_list, int *)); +extern int _IO_vfprintf __P ((_IO_FILE *, const char *, _IO_va_list)); +extern _IO_ssize_t _IO_padn __P ((_IO_FILE *, int, _IO_ssize_t)); +extern _IO_size_t _IO_sgetn __P ((_IO_FILE *, void *, _IO_size_t)); -extern _IO_fpos_t _IO_seekoff __P((_IO_FILE*, _IO_off_t, int, int)); -extern _IO_fpos_t _IO_seekpos __P((_IO_FILE*, _IO_fpos_t, int)); +extern _IO_fpos_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); +extern _IO_fpos_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos_t, int)); -extern void _IO_free_backup_area __P((_IO_FILE*)); +extern void _IO_free_backup_area __P ((_IO_FILE *)); #ifdef __cplusplus } diff --git a/libio/libioP.h b/libio/libioP.h index 7d033e02ee..1880e0bbde 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -1,57 +1,34 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include <errno.h> -#ifndef errno -extern int errno; -#endif #include <bits/libc-lock.h> #include "iolibio.h" -#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(__cplusplus) -/* All known AIX compilers implement these things (but don't always - define __STDC__). The RISC/OS MIPS compiler defines these things - in SVR4 mode, but does not define __STDC__. */ - -#define AND , -#define DEFUN(name, arglist, args) name(args) -#define DEFUN_VOID(name) name(void) - -#else /* Not ANSI C. */ - -#define AND ; -#ifndef const /* some systems define it in header files for non-ansi mode */ -#define const -#endif -#define DEFUN(name, arglist, args) name arglist args; -#define DEFUN_VOID(name) name() -#endif /* ANSI C. */ - -#ifdef __cplusplus -extern "C" { -#endif +__BEGIN_DECLS #define _IO_seek_set 0 #define _IO_seek_cur 1 @@ -78,103 +55,104 @@ extern "C" { * object being acted on (i.e. the 'this' parameter). */ -#define _IO_JUMPS(THIS) ((struct _IO_FILE_plus*)(THIS))->vtable +#define _IO_JUMPS(THIS) ((struct _IO_FILE_plus *) (THIS))->vtable #ifdef _G_USING_THUNKS -#define JUMP_FIELD(TYPE, NAME) TYPE NAME -#define JUMP0(FUNC, THIS) _IO_JUMPS(THIS)->FUNC(THIS) -#define JUMP1(FUNC, THIS, X1) _IO_JUMPS(THIS)->FUNC(THIS, X1) -#define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS(THIS)->FUNC(THIS, X1, X2) -#define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS(THIS)->FUNC(THIS, X1,X2, X3) -#define JUMP_INIT(NAME, VALUE) VALUE -#define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0), JUMP_INIT(dummy2, 0) +# define JUMP_FIELD(TYPE, NAME) TYPE NAME +# define JUMP0(FUNC, THIS) _IO_JUMPS(THIS)->FUNC (THIS) +# define JUMP1(FUNC, THIS, X1) _IO_JUMPS(THIS)->FUNC (THIS, X1) +# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS(THIS)->FUNC (THIS, X1, X2) +# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS(THIS)->FUNC (THIS, X1,X2, X3) +# define JUMP_INIT(NAME, VALUE) VALUE +# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0), JUMP_INIT (dummy2, 0) #else /* These macros will change when we re-implement vtables to use "thunks"! */ -#define JUMP_FIELD(TYPE, NAME) struct { short delta1, delta2; TYPE pfn; } NAME -#define JUMP0(FUNC, THIS) _IO_JUMPS(THIS)->FUNC.pfn(THIS) -#define JUMP1(FUNC, THIS, X1) _IO_JUMPS(THIS)->FUNC.pfn(THIS, X1) -#define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS(THIS)->FUNC.pfn(THIS, X1, X2) -#define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS(THIS)->FUNC.pfn(THIS, X1,X2, X3) -#define JUMP_INIT(NAME, VALUE) {0, 0, VALUE} -#define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0) +# define JUMP_FIELD(TYPE, NAME) struct { short delta1, delta2; TYPE pfn; } NAME +# define JUMP0(FUNC, THIS) _IO_JUMPS(THIS)->FUNC.pfn (THIS) +# define JUMP1(FUNC, THIS, X1) _IO_JUMPS(THIS)->FUNC.pfn (THIS, X1) +# define JUMP2(FUNC, THIS, X1, X2) _IO_JUMPS(THIS)->FUNC.pfn (THIS, X1, X2) +# define JUMP3(FUNC, THIS, X1,X2,X3) _IO_JUMPS(THIS)->FUNC.pfn (THIS, X1,X2,X3) +# define JUMP_INIT(NAME, VALUE) {0, 0, VALUE} +# define JUMP_INIT_DUMMY JUMP_INIT(dummy, 0) #endif /* The 'finish' function does any final cleaning up of an _IO_FILE object. It does not delete (free) it, but does everything else to finalize it/ It matches the streambuf::~streambuf virtual destructor. */ -typedef void (*_IO_finish_t) __P((_IO_FILE*, int)); /* finalize */ -#define _IO_FINISH(FP) JUMP1(__finish, FP, 0) +typedef void (*_IO_finish_t) __P ((_IO_FILE *, int)); /* finalize */ +#define _IO_FINISH(FP) JUMP1 (__finish, FP, 0) /* The 'overflow' hook flushes the buffer. The second argument is a character, or EOF. It matches the streambuf::overflow virtual function. */ -typedef int (*_IO_overflow_t) __P((_IO_FILE*, int)); -#define _IO_OVERFLOW(FP, CH) JUMP1(__overflow, FP, CH) +typedef int (*_IO_overflow_t) __P ((_IO_FILE *, int)); +#define _IO_OVERFLOW(FP, CH) JUMP1 (__overflow, FP, CH) /* The 'underflow' hook tries to fills the get buffer. It returns the next character (as an unsigned char) or EOF. The next character remains in the get buffer, and the get position is not changed. It matches the streambuf::underflow virtual function. */ -typedef int (*_IO_underflow_t) __P((_IO_FILE*)); -#define _IO_UNDERFLOW(FP) JUMP0(__underflow, FP) +typedef int (*_IO_underflow_t) __P ((_IO_FILE *)); +#define _IO_UNDERFLOW(FP) JUMP0 (__underflow, FP) /* The 'uflow' hook returns the next character in the input stream (cast to unsigned char), and increments the read position; EOF is returned on failure. It matches the streambuf::uflow virtual function, which is not in the cfront implementation, but was added to C++ by the ANSI/ISO committee. */ -#define _IO_UFLOW(FP) JUMP0(__uflow, FP) +#define _IO_UFLOW(FP) JUMP0 (__uflow, FP) /* The 'pbackfail' hook handles backing up. It matches the streambuf::pbackfail virtual function. */ -typedef int (*_IO_pbackfail_t) __P((_IO_FILE*, int)); -#define _IO_PBACKFAIL(FP, CH) JUMP1(__pbackfail, FP, CH) +typedef int (*_IO_pbackfail_t) __P ((_IO_FILE *, int)); +#define _IO_PBACKFAIL(FP, CH) JUMP1 (__pbackfail, FP, CH) /* The 'xsputn' hook writes upto N characters from buffer DATA. Returns the number of character actually written. It matches the streambuf::xsputn virtual function. */ -typedef _IO_size_t (*_IO_xsputn_t) - __P((_IO_FILE *FP, const void *DATA, _IO_size_t N)); -#define _IO_XSPUTN(FP, DATA, N) JUMP2(__xsputn, FP, DATA, N) +typedef _IO_size_t (*_IO_xsputn_t) __P ((_IO_FILE *FP, const void *DATA, + _IO_size_t N)); +#define _IO_XSPUTN(FP, DATA, N) JUMP2 (__xsputn, FP, DATA, N) /* The 'xsgetn' hook reads upto N characters into buffer DATA. Returns the number of character actually read. It matches the streambuf::xsgetn virtual function. */ -typedef _IO_size_t (*_IO_xsgetn_t) __P((_IO_FILE*FP, void*DATA, _IO_size_t N)); -#define _IO_XSGETN(FP, DATA, N) JUMP2(__xsgetn, FP, DATA, N) +typedef _IO_size_t (*_IO_xsgetn_t) __P ((_IO_FILE *FP, void *DATA, + _IO_size_t N)); +#define _IO_XSGETN(FP, DATA, N) JUMP2 (__xsgetn, FP, DATA, N) /* The 'seekoff' hook moves the stream position to a new position relative to the start of the file (if DIR==0), the current position (MODE==1), or the end of the file (MODE==2). It matches the streambuf::seekoff virtual function. It is also used for the ANSI fseek function. */ -typedef _IO_fpos_t (*_IO_seekoff_t) - __P((_IO_FILE* FP, _IO_off_t OFF, int DIR, int MODE)); -#define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3(__seekoff, FP, OFF, DIR, MODE) +typedef _IO_fpos_t (*_IO_seekoff_t) __P ((_IO_FILE *FP, _IO_off_t OFF, + int DIR, int MODE)); +#define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3 (__seekoff, FP, OFF, DIR, MODE) /* The 'seekpos' hook also moves the stream position, but to an absolute position given by a fpos_t (seekpos). It matches the streambuf::seekpos virtual function. It is also used for the ANSI fgetpos and fsetpos functions. */ /* The _IO_seek_cur and _IO_seek_end options are not allowed. */ -typedef _IO_fpos_t (*_IO_seekpos_t) __P((_IO_FILE*, _IO_fpos_t, int)); -#define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2(__seekpos, FP, POS, FLAGS) +typedef _IO_fpos_t (*_IO_seekpos_t) __P ((_IO_FILE *, _IO_fpos_t, int)); +#define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2 (__seekpos, FP, POS, FLAGS) /* The 'setbuf' hook gives a buffer to the file. It matches the streambuf::setbuf virtual function. */ -typedef _IO_FILE* (*_IO_setbuf_t) __P((_IO_FILE*, char *, _IO_ssize_t)); -#define _IO_SETBUF(FP, BUFFER, LENGTH) JUMP2(__setbuf, FP, BUFFER, LENGTH) +typedef _IO_FILE* (*_IO_setbuf_t) __P ((_IO_FILE *, char *, _IO_ssize_t)); +#define _IO_SETBUF(FP, BUFFER, LENGTH) JUMP2 (__setbuf, FP, BUFFER, LENGTH) /* The 'sync' hook attempts to synchronize the internal data structures of the file with the external state. It matches the streambuf::sync virtual function. */ -typedef int (*_IO_sync_t) __P((_IO_FILE*)); -#define _IO_SYNC(FP) JUMP0(__sync, FP) +typedef int (*_IO_sync_t) __P ((_IO_FILE *)); +#define _IO_SYNC(FP) JUMP0 (__sync, FP) /* The 'doallocate' hook is used to tell the file to allocate a buffer. It matches the streambuf::doallocate virtual function, which is not in the ANSI/ISO C++ standard, but is part traditional implementations. */ -typedef int (*_IO_doallocate_t) __P((_IO_FILE*)); -#define _IO_DOALLOCATE(FP) JUMP0(__doallocate, FP) +typedef int (*_IO_doallocate_t) __P ((_IO_FILE *)); +#define _IO_DOALLOCATE(FP) JUMP0 (__doallocate, FP) /* The following four hooks (sysread, syswrite, sysclose, sysseek, and sysstat) are low-level hooks specific to this implementation. @@ -191,42 +169,43 @@ typedef int (*_IO_doallocate_t) __P((_IO_FILE*)); an existing buffer. It generalizes the Unix read(2) function. It matches the streambuf::sys_read virtual function, which is specific to this implementation. */ -typedef _IO_ssize_t (*_IO_read_t) __P((_IO_FILE*, void*, _IO_ssize_t)); -#define _IO_SYSREAD(FP, DATA, LEN) JUMP2(__read, FP, DATA, LEN) +typedef _IO_ssize_t (*_IO_read_t) __P ((_IO_FILE *, void *, _IO_ssize_t)); +#define _IO_SYSREAD(FP, DATA, LEN) JUMP2 (__read, FP, DATA, LEN) /* The 'syswrite' hook is used to write data from an existing buffer to an external file. It generalizes the Unix write(2) function. It matches the streambuf::sys_write virtual function, which is specific to this implementation. */ -typedef _IO_ssize_t (*_IO_write_t) __P((_IO_FILE*,const void*,_IO_ssize_t)); -#define _IO_SYSWRITE(FP, DATA, LEN) JUMP2(__write, FP, DATA, LEN) +typedef _IO_ssize_t (*_IO_write_t) __P ((_IO_FILE *,const void *,_IO_ssize_t)); +#define _IO_SYSWRITE(FP, DATA, LEN) JUMP2 (__write, FP, DATA, LEN) /* The 'sysseek' hook is used to re-position an external file. It generalizes the Unix lseek(2) function. It matches the streambuf::sys_seek virtual function, which is specific to this implementation. */ -typedef _IO_fpos_t (*_IO_seek_t) __P((_IO_FILE*, _IO_off_t, int)); -#define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2(__seek, FP, OFFSET, MODE) +typedef _IO_fpos_t (*_IO_seek_t) __P ((_IO_FILE *, _IO_off_t, int)); +#define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2 (__seek, FP, OFFSET, MODE) /* The 'sysclose' hook is used to finalize (close, finish up) an external file. It generalizes the Unix close(2) function. It matches the streambuf::sys_close virtual function, which is specific to this implementation. */ -typedef int (*_IO_close_t) __P((_IO_FILE*)); /* finalize */ -#define _IO_SYSCLOSE(FP) JUMP0(__close, FP) +typedef int (*_IO_close_t) __P ((_IO_FILE *)); /* finalize */ +#define _IO_SYSCLOSE(FP) JUMP0 (__close, FP) /* The 'sysstat' hook is used to get information about an external file into a struct stat buffer. It generalizes the Unix fstat(2) call. It matches the streambuf::sys_stat virtual function, which is specific to this implementation. */ -typedef int (*_IO_stat_t) __P((_IO_FILE*, void*)); -#define _IO_SYSSTAT(FP, BUF) JUMP1(__stat, FP, BUF) +typedef int (*_IO_stat_t) __P ((_IO_FILE *, void *)); +#define _IO_SYSSTAT(FP, BUF) JUMP1 (__stat, FP, BUF) #define _IO_CHAR_TYPE char /* unsigned char ? */ #define _IO_INT_TYPE int -struct _IO_jump_t { +struct _IO_jump_t +{ JUMP_FIELD(_G_size_t, __dummy); #ifdef _G_USING_THUNKS JUMP_FIELD(_G_size_t, __dummy2); @@ -260,63 +239,69 @@ struct _IO_jump_t { This is for compatibility with C++ streambuf; the word can be used to smash to a pointer to a virtual function table. */ -struct _IO_FILE_plus { +struct _IO_FILE_plus +{ _IO_FILE file; const struct _IO_jump_t *vtable; }; /* Generic functions */ -extern _IO_fpos_t _IO_seekoff __P((_IO_FILE*, _IO_off_t, int, int)); -extern _IO_fpos_t _IO_seekpos __P((_IO_FILE*, _IO_fpos_t, int)); - -extern int _IO_switch_to_get_mode __P((_IO_FILE*)); -extern void _IO_init __P((_IO_FILE*, int)); -extern int _IO_sputbackc __P((_IO_FILE*, int)); -extern int _IO_sungetc __P((_IO_FILE*)); -extern void _IO_un_link __P((_IO_FILE*)); -extern void _IO_link_in __P((_IO_FILE *)); -extern void _IO_doallocbuf __P((_IO_FILE*)); -extern void _IO_unsave_markers __P((_IO_FILE*)); -extern void _IO_setb __P((_IO_FILE*, char*, char*, int)); -extern unsigned _IO_adjust_column __P((unsigned, const char *, int)); -#define _IO_sputn(__fp, __s, __n) _IO_XSPUTN(__fp, __s, __n) +extern _IO_fpos_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); +extern _IO_fpos_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos_t, int)); + +extern void _IO_switch_to_main_get_area __P ((_IO_FILE *)); +extern void _IO_switch_to_backup_area __P ((_IO_FILE *)); +extern int _IO_switch_to_get_mode __P ((_IO_FILE *)); +extern void _IO_init __P ((_IO_FILE *, int)); +extern int _IO_sputbackc __P ((_IO_FILE *, int)); +extern int _IO_sungetc __P ((_IO_FILE *)); +extern void _IO_un_link __P ((_IO_FILE *)); +extern void _IO_link_in __P ((_IO_FILE *)); +extern void _IO_doallocbuf __P ((_IO_FILE *)); +extern void _IO_unsave_markers __P ((_IO_FILE *)); +extern void _IO_setb __P ((_IO_FILE *, char *, char *, int)); +extern unsigned _IO_adjust_column __P ((unsigned, const char *, int)); +#define _IO_sputn(__fp, __s, __n) _IO_XSPUTN (__fp, __s, __n) /* Marker-related function. */ -extern void _IO_init_marker __P((struct _IO_marker *, _IO_FILE *)); -extern void _IO_remove_marker __P((struct _IO_marker*)); -extern int _IO_marker_difference __P((struct _IO_marker *, struct _IO_marker *)); -extern int _IO_marker_delta __P((struct _IO_marker *)); -extern int _IO_seekmark __P((_IO_FILE *, struct _IO_marker *, int)); +extern void _IO_init_marker __P ((struct _IO_marker *, _IO_FILE *)); +extern void _IO_remove_marker __P ((struct _IO_marker *)); +extern int _IO_marker_difference __P ((struct _IO_marker *, + struct _IO_marker *)); +extern int _IO_marker_delta __P ((struct _IO_marker *)); +extern int _IO_seekmark __P ((_IO_FILE *, struct _IO_marker *, int)); /* Default jumptable functions. */ -extern int _IO_default_underflow __P((_IO_FILE*)); -extern int _IO_default_uflow __P((_IO_FILE*)); -extern int _IO_default_doallocate __P((_IO_FILE*)); -extern void _IO_default_finish __P((_IO_FILE *, int)); -extern int _IO_default_pbackfail __P((_IO_FILE*, int)); -extern _IO_FILE* _IO_default_setbuf __P((_IO_FILE *, char*, _IO_ssize_t)); -extern _IO_size_t _IO_default_xsputn __P((_IO_FILE *, const void*, _IO_size_t)); -extern _IO_size_t _IO_default_xsgetn __P((_IO_FILE *, void*, _IO_size_t)); -extern _IO_fpos_t _IO_default_seekoff __P((_IO_FILE*, _IO_off_t, int, int)); -extern _IO_fpos_t _IO_default_seekpos __P((_IO_FILE*, _IO_fpos_t, int)); -extern _IO_ssize_t _IO_default_write __P((_IO_FILE*,const void*,_IO_ssize_t)); -extern _IO_ssize_t _IO_default_read __P((_IO_FILE*, void*, _IO_ssize_t)); -extern int _IO_default_stat __P((_IO_FILE*, void*)); -extern _IO_fpos_t _IO_default_seek __P((_IO_FILE*, _IO_off_t, int)); -extern int _IO_default_sync __P((_IO_FILE*)); -#define _IO_default_close ((_IO_close_t)_IO_default_sync) +extern int _IO_default_underflow __P ((_IO_FILE *)); +extern int _IO_default_uflow __P ((_IO_FILE *)); +extern int _IO_default_doallocate __P ((_IO_FILE *)); +extern void _IO_default_finish __P ((_IO_FILE *, int)); +extern int _IO_default_pbackfail __P ((_IO_FILE *, int)); +extern _IO_FILE* _IO_default_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t)); +extern _IO_size_t _IO_default_xsputn __P ((_IO_FILE *, const void *, + _IO_size_t)); +extern _IO_size_t _IO_default_xsgetn __P ((_IO_FILE *, void *, _IO_size_t)); +extern _IO_fpos_t _IO_default_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); +extern _IO_fpos_t _IO_default_seekpos __P ((_IO_FILE *, _IO_fpos_t, int)); +extern _IO_ssize_t _IO_default_write __P ((_IO_FILE *, const void *, + _IO_ssize_t)); +extern _IO_ssize_t _IO_default_read __P ((_IO_FILE *, void *, _IO_ssize_t)); +extern int _IO_default_stat __P ((_IO_FILE *, void *)); +extern _IO_fpos_t _IO_default_seek __P ((_IO_FILE *, _IO_off_t, int)); +extern int _IO_default_sync __P ((_IO_FILE *)); +#define _IO_default_close ((_IO_close_t) _IO_default_sync) extern struct _IO_jump_t _IO_file_jumps; extern struct _IO_jump_t _IO_streambuf_jumps; extern struct _IO_jump_t _IO_proc_jumps; extern struct _IO_jump_t _IO_str_jumps; -extern int _IO_do_write __P((_IO_FILE*, const char*, _IO_size_t)); -extern int _IO_flush_all __P((void)); -extern void _IO_cleanup __P((void)); -extern void _IO_flush_all_linebuffered __P((void)); +extern int _IO_do_write __P ((_IO_FILE *, const char *, _IO_size_t)); +extern int _IO_flush_all __P ((void)); +extern void _IO_cleanup __P ((void)); +extern void _IO_flush_all_linebuffered __P ((void)); #define _IO_do_flush(_f) \ _IO_do_write(_f, (_f)->_IO_write_base, \ @@ -335,40 +320,41 @@ extern void _IO_flush_all_linebuffered __P((void)); /* Jumptable functions for files. */ -extern int _IO_file_doallocate __P((_IO_FILE*)); -extern _IO_FILE* _IO_file_setbuf __P((_IO_FILE *, char*, _IO_ssize_t)); -extern _IO_fpos_t _IO_file_seekoff __P((_IO_FILE*, _IO_off_t, int, int)); -extern _IO_size_t _IO_file_xsputn __P((_IO_FILE*,const void*,_IO_size_t)); -extern int _IO_file_stat __P((_IO_FILE*, void*)); -extern int _IO_file_close __P((_IO_FILE*)); -extern int _IO_file_underflow __P((_IO_FILE *)); -extern int _IO_file_overflow __P((_IO_FILE *, int)); +extern int _IO_file_doallocate __P ((_IO_FILE *)); +extern _IO_FILE* _IO_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t)); +extern _IO_fpos_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); +extern _IO_size_t _IO_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t)); +extern int _IO_file_stat __P ((_IO_FILE *, void *)); +extern int _IO_file_close __P ((_IO_FILE *)); +extern int _IO_file_underflow __P ((_IO_FILE *)); +extern int _IO_file_overflow __P ((_IO_FILE *, int)); #define _IO_file_is_open(__fp) ((__fp)->_fileno >= 0) -extern void _IO_file_init __P((_IO_FILE*)); -extern _IO_FILE* _IO_file_attach __P((_IO_FILE*, int)); -extern _IO_FILE* _IO_file_fopen __P((_IO_FILE*, const char*, const char*)); -extern _IO_ssize_t _IO_file_write __P((_IO_FILE*,const void*,_IO_ssize_t)); -extern _IO_ssize_t _IO_file_read __P((_IO_FILE*, void*, _IO_ssize_t)); -extern int _IO_file_sync __P((_IO_FILE*)); -extern int _IO_file_close_it __P((_IO_FILE*)); -extern _IO_fpos_t _IO_file_seek __P((_IO_FILE *, _IO_off_t, int)); -extern void _IO_file_finish __P((_IO_FILE*, int)); +extern void _IO_file_init __P ((_IO_FILE *)); +extern _IO_FILE* _IO_file_attach __P ((_IO_FILE *, int)); +extern _IO_FILE* _IO_file_fopen __P ((_IO_FILE *, const char *, const char *)); +extern _IO_ssize_t _IO_file_write __P ((_IO_FILE *, const void *, + _IO_ssize_t)); +extern _IO_ssize_t _IO_file_read __P ((_IO_FILE *, void *, _IO_ssize_t)); +extern int _IO_file_sync __P ((_IO_FILE *)); +extern int _IO_file_close_it __P ((_IO_FILE *)); +extern _IO_fpos_t _IO_file_seek __P ((_IO_FILE *, _IO_off_t, int)); +extern void _IO_file_finish __P ((_IO_FILE *, int)); /* Jumptable functions for proc_files. */ -extern _IO_FILE* _IO_proc_open __P((_IO_FILE*, const char*, const char *)); -extern int _IO_proc_close __P((_IO_FILE*)); +extern _IO_FILE* _IO_proc_open __P ((_IO_FILE *, const char *, const char *)); +extern int _IO_proc_close __P ((_IO_FILE *)); /* Jumptable functions for strfiles. */ -extern int _IO_str_underflow __P((_IO_FILE*)); -extern int _IO_str_overflow __P((_IO_FILE *, int)); -extern int _IO_str_pbackfail __P((_IO_FILE*, int)); -extern _IO_fpos_t _IO_str_seekoff __P((_IO_FILE*,_IO_off_t,int,int)); -extern void _IO_str_finish __P ((_IO_FILE*, int)); +extern int _IO_str_underflow __P ((_IO_FILE *)); +extern int _IO_str_overflow __P ((_IO_FILE *, int)); +extern int _IO_str_pbackfail __P ((_IO_FILE *, int)); +extern _IO_fpos_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); +extern void _IO_str_finish __P ((_IO_FILE *, int)); /* Other strfile functions */ -extern void _IO_str_init_static __P((_IO_FILE *, char*, int, char*)); -extern void _IO_str_init_readonly __P((_IO_FILE *, const char*, int)); -extern _IO_ssize_t _IO_str_count __P ((_IO_FILE*)); +extern void _IO_str_init_static __P ((_IO_FILE *, char *, int, char *)); +extern void _IO_str_init_readonly __P ((_IO_FILE *, const char *, int)); +extern _IO_ssize_t _IO_str_count __P ((_IO_FILE *)); extern int _IO_vasprintf __P ((char **result_ptr, __const char *format, _IO_va_list args)); @@ -377,66 +363,66 @@ extern int _IO_vsnprintf __P ((char *string, _IO_size_t maxlen, __const char *format, _IO_va_list args)); -extern _IO_size_t _IO_getline __P((_IO_FILE*,char*,_IO_size_t,int,int)); -extern _IO_ssize_t _IO_getdelim __P((char**, _IO_size_t*, int, _IO_FILE*)); -extern double _IO_strtod __P((const char *, char **)); -extern char * _IO_dtoa __P((double __d, int __mode, int __ndigits, - int *__decpt, int *__sign, char **__rve)); -extern int _IO_outfloat __P((double __value, _IO_FILE *__sb, int __type, - int __width, int __precision, int __flags, - int __sign_mode, int __fill)); +extern _IO_size_t _IO_getline __P ((_IO_FILE *,char *, _IO_size_t, int, int)); +extern _IO_ssize_t _IO_getdelim __P ((char **, _IO_size_t *, int, _IO_FILE *)); +extern double _IO_strtod __P ((const char *, char **)); +extern char *_IO_dtoa __P ((double __d, int __mode, int __ndigits, + int *__decpt, int *__sign, char **__rve)); +extern int _IO_outfloat __P ((double __value, _IO_FILE *__sb, int __type, + int __width, int __precision, int __flags, + int __sign_mode, int __fill)); extern _IO_FILE *_IO_list_all; extern void (*_IO_cleanup_registration_needed) __P ((void)); #ifndef EOF -#define EOF (-1) +# define EOF (-1) #endif #ifndef NULL -#if defined __GNUG__ && \ +# if defined __GNUG__ && \ (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) -#define NULL (__null) -#else -#if !defined(__cplusplus) -#define NULL ((void*)0) -#else -#define NULL (0) -#endif -#endif +# define NULL (__null) +# else +# if !defined(__cplusplus) +# define NULL ((void*)0) +# else +# define NULL (0) +# endif +# endif #endif #if _G_HAVE_MMAP -#include <unistd.h> -#include <fcntl.h> -#include <sys/mman.h> -#include <sys/param.h> +# include <unistd.h> +# include <fcntl.h> +# include <sys/mman.h> +# include <sys/param.h> -#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) -#define MAP_ANONYMOUS MAP_ANON -#endif +# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) +# define MAP_ANONYMOUS MAP_ANON +# endif -#if !defined(MAP_ANONYMOUS) || !defined(EXEC_PAGESIZE) -#undef _G_HAVE_MMAP -#define _G_HAVE_MMAP 0 -#endif +# if !defined(MAP_ANONYMOUS) || !defined(EXEC_PAGESIZE) +# undef _G_HAVE_MMAP +# define _G_HAVE_MMAP 0 +# endif #endif /* _G_HAVE_MMAP */ #if _G_HAVE_MMAP -#ifdef _LIBC +# ifdef _LIBC /* When using this code in the GNU libc we must not pollute the name space. */ -#define mmap __mmap -#define munmap __munmap -#endif +# define mmap __mmap +# define munmap __munmap +# endif -#define ROUND_TO_PAGE(_S) \ +# define ROUND_TO_PAGE(_S) \ (((_S) + EXEC_PAGESIZE - 1) & ~(EXEC_PAGESIZE - 1)) -#define FREE_BUF(_B, _S) \ +# define FREE_BUF(_B, _S) \ munmap ((_B), ROUND_TO_PAGE (_S)) -#define ALLOC_BUF(_B, _S, _R) \ +# define ALLOC_BUF(_B, _S, _R) \ do { \ (_B) = (char *) mmap (0, ROUND_TO_PAGE (_S), \ PROT_READ | PROT_WRITE, \ @@ -447,9 +433,9 @@ extern void (*_IO_cleanup_registration_needed) __P ((void)); #else /* _G_HAVE_MMAP */ -#define FREE_BUF(_B, _S) \ +# define FREE_BUF(_B, _S) \ free(_B) -#define ALLOC_BUF(_B, _S, _R) \ +# define ALLOC_BUF(_B, _S, _R) \ do { \ (_B) = (char*)malloc(_S); \ if ((_B) == NULL) \ @@ -459,15 +445,15 @@ extern void (*_IO_cleanup_registration_needed) __P ((void)); #endif /* _G_HAVE_MMAP */ #ifndef OS_FSTAT -#define OS_FSTAT fstat +# define OS_FSTAT fstat #endif struct stat; -extern _IO_ssize_t _IO_read __P((int, void*, _IO_size_t)); -extern _IO_ssize_t _IO_write __P((int, const void*, _IO_size_t)); -extern _IO_off_t _IO_lseek __P((int, _IO_off_t, int)); -extern int _IO_close __P((int)); -extern int _IO_fstat __P((int, struct stat *)); -extern int _IO_vscanf __P((const char *, _IO_va_list)); +extern _IO_ssize_t _IO_read __P ((int, void *, _IO_size_t)); +extern _IO_ssize_t _IO_write __P ((int, const void *, _IO_size_t)); +extern _IO_off_t _IO_lseek __P ((int, _IO_off_t, int)); +extern int _IO_close __P ((int)); +extern int _IO_fstat __P ((int, struct stat *)); +extern int _IO_vscanf __P ((const char *, _IO_va_list)); /* Operations on _IO_fpos_t. Normally, these are trivial, but we provide hooks for configurations @@ -476,34 +462,32 @@ extern int _IO_vscanf __P((const char *, _IO_va_list)); /* _IO_pos_BAD is an _IO_fpos_t value indicating error, unknown, or EOF. */ #ifndef _IO_pos_BAD -#define _IO_pos_BAD ((_IO_fpos_t)(-1)) +# define _IO_pos_BAD ((_IO_fpos_t) -1) #endif /* _IO_pos_as_off converts an _IO_fpos_t value to an _IO_off_t value. */ #ifndef _IO_pos_as_off -#define _IO_pos_as_off(__pos) ((_IO_off_t)(__pos)) +# define _IO_pos_as_off(__pos) ((_IO_off_t) (__pos)) #endif /* _IO_pos_adjust adjust an _IO_fpos_t by some number of bytes. */ #ifndef _IO_pos_adjust -#define _IO_pos_adjust(__pos, __delta) ((__pos) += (__delta)) +# define _IO_pos_adjust(__pos, __delta) ((__pos) += (__delta)) #endif /* _IO_pos_0 is an _IO_fpos_t value indicating beginning of file. */ #ifndef _IO_pos_0 -#define _IO_pos_0 ((_IO_fpos_t)0) +# define _IO_pos_0 ((_IO_fpos_t) 0) #endif -#ifdef __cplusplus -} -#endif +__END_DECLS #ifdef _IO_MTSAFE_IO /* check following! */ -#define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \ +# define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD, \ 0, 0, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock } #else /* check following! */ -#define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \ +# define FILEBUF_LITERAL(CHAIN, FLAGS, FD) \ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD } #endif @@ -511,57 +495,56 @@ extern int _IO_vscanf __P((const char *, _IO_va_list)); /* VTABLE_LABEL defines NAME as of the CLASS class. CNLENGTH is strlen(#CLASS). */ #ifdef __GNUC__ -#if _G_VTABLE_LABEL_HAS_LENGTH -#define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \ +# if _G_VTABLE_LABEL_HAS_LENGTH +# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \ extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CNLENGTH #CLASS); -#else -#define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \ +# else +# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \ extern char NAME[] asm (_G_VTABLE_LABEL_PREFIX #CLASS); -#endif +# endif #endif /* __GNUC__ */ #if !defined(builtinbuf_vtable) && defined(__cplusplus) -#ifdef __GNUC__ +# ifdef __GNUC__ VTABLE_LABEL(builtinbuf_vtable, builtinbuf, 10) -#else -#if _G_VTABLE_LABEL_HAS_LENGTH -#define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##10builtinbuf -#else -#define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##builtinbuf -#endif -#endif +# else +# if _G_VTABLE_LABEL_HAS_LENGTH +# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##10builtinbuf +# else +# define builtinbuf_vtable _G_VTABLE_LABEL_PREFIX_ID##builtinbuf +# endif +# endif #endif /* !defined(builtinbuf_vtable) && defined(__cplusplus) */ #if defined(__STDC__) || defined(__cplusplus) -#define _IO_va_start(args, last) va_start(args, last) +# define _IO_va_start(args, last) va_start(args, last) #else -#define _IO_va_start(args, last) va_start(args) +# define _IO_va_start(args, last) va_start(args) #endif extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf; #if 1 -#define COERCE_FILE(FILE) /* Nothing */ +# define COERCE_FILE(FILE) /* Nothing */ #else /* This is part of the kludge for binary compatibility with old stdio. */ -#define COERCE_FILE(FILE) \ +# define COERCE_FILE(FILE) \ (((FILE)->_IO_file_flags & _IO_MAGIC_MASK) == _OLD_MAGIC_MASK \ && (FILE) = *(FILE**)&((int*)fp)[1]) #endif #ifdef EINVAL -#define MAYBE_SET_EINVAL __set_errno (EINVAL) +# define MAYBE_SET_EINVAL __set_errno (EINVAL) #else -#define MAYBE_SET_EINVAL /* nothing */ +# define MAYBE_SET_EINVAL /* nothing */ #endif #ifdef IO_DEBUG -#define CHECK_FILE(FILE,RET) \ +# define CHECK_FILE(FILE, RET) \ if ((FILE) == NULL) { MAYBE_SET_EINVAL; return RET; } \ else { COERCE_FILE(FILE); \ if (((FILE)->_IO_file_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \ { MAYBE_SET_EINVAL; return RET; }} #else -#define CHECK_FILE(FILE,RET) \ - COERCE_FILE(FILE) +# define CHECK_FILE(FILE, RET) COERCE_FILE (FILE) #endif diff --git a/libio/obprintf.c b/libio/obprintf.c index bd629f1ee0..6b959e455a 100644 --- a/libio/obprintf.c +++ b/libio/obprintf.c @@ -1,5 +1,5 @@ /* Print output of stream to given obstack. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -148,7 +148,9 @@ _IO_obstack_vprintf (struct obstack *obstack, const char *format, va_list args) return result; } +#ifdef weak_alias weak_alias (_IO_obstack_vprintf, obstack_vprintf) +#endif int @@ -161,4 +163,6 @@ _IO_obstack_printf (struct obstack *obstack, const char *format, ...) va_end (ap); return result; } +#ifdef weak_alias weak_alias (_IO_obstack_printf, obstack_printf) +#endif diff --git a/libio/pclose.c b/libio/pclose.c index e5d7c0c9c9..0640d47599 100644 --- a/libio/pclose.c +++ b/libio/pclose.c @@ -1,9 +1,34 @@ +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ + #include "libioP.h" #include "stdio.h" #include <errno.h> int -pclose(fp) +pclose (fp) FILE *fp; { #if 0 @@ -12,5 +37,5 @@ pclose(fp) if (fp is not a proc_file) return -1; #endif - return _IO_fclose(fp); + return _IO_fclose (fp); } diff --git a/libio/peekc.c b/libio/peekc.c index 2b0a812868..0b3b5140c2 100644 --- a/libio/peekc.c +++ b/libio/peekc.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" @@ -29,13 +30,13 @@ the executable file might be covered by the GNU General Public License. */ int _IO_peekc_locked (fp) - FILE *fp; + _IO_FILE *fp; { int result; CHECK_FILE (fp, EOF); - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); result = _IO_peekc_unlocked (fp); - __libc_cleanup_region_end (1); + _IO_cleanup_region_end (1); return result; } diff --git a/libio/putc.c b/libio/putc.c index 6d84f24995..3c35c365f0 100644 --- a/libio/putc.c +++ b/libio/putc.c @@ -28,11 +28,15 @@ _IO_putc (c, fp) { int result; CHECK_FILE (fp, EOF); - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); result = _IO_putc_unlocked (c, fp); - __libc_cleanup_region_end (1); + _IO_cleanup_region_end (1); return result; } + #undef putc + +#ifdef weak_alias weak_alias (_IO_putc, putc) +#endif diff --git a/libio/putchar.c b/libio/putchar.c index b8a41ebf76..1e1dd13762 100644 --- a/libio/putchar.c +++ b/libio/putchar.c @@ -26,10 +26,10 @@ putchar (c) int c; { int result; - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, _IO_stdout); _IO_flockfile (_IO_stdout); result = _IO_putc_unlocked (c, _IO_stdout); - __libc_cleanup_region_end (1); + _IO_cleanup_region_end (1); return result; } diff --git a/libio/rewind.c b/libio/rewind.c index 2af2dd84d3..bce27575fd 100644 --- a/libio/rewind.c +++ b/libio/rewind.c @@ -1,36 +1,38 @@ -/* Copyright (C) 1993, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" void rewind (fp) - _IO_FILE* fp; + _IO_FILE *fp; { CHECK_FILE (fp, ); - __libc_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); _IO_rewind (fp); - __libc_cleanup_region_end (1); + _IO_cleanup_region_end (1); } diff --git a/libio/setbuf.c b/libio/setbuf.c index f3518aadad..ac323a31b5 100644 --- a/libio/setbuf.c +++ b/libio/setbuf.c @@ -1,25 +1,27 @@ -/* Copyright (C) 1993 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" diff --git a/libio/setlinebuf.c b/libio/setlinebuf.c index b456d5846c..e4e029faea 100644 --- a/libio/setlinebuf.c +++ b/libio/setlinebuf.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993 Free Software Foundation +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" diff --git a/libio/stdfiles.c b/libio/stdfiles.c index 7c6f789912..8453e33c34 100644 --- a/libio/stdfiles.c +++ b/libio/stdfiles.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ /* This file provides definitions of _IO_stdin, _IO_stdout, and _IO_stderr diff --git a/libio/stdio.c b/libio/stdio.c index cd56dba307..27c298c184 100644 --- a/libio/stdio.c +++ b/libio/stdio.c @@ -1,12 +1,37 @@ +/* Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ + #include "libioP.h" #include "stdio.h" -/* Define non-macro versions of stdin/stdout/stderr, - * for use by debuggers. */ +/* Define non-macro versions of stdin/stdout/stderr, for use by + debuggers. */ #undef stdin #undef stdout #undef stderr -FILE* stdin = &_IO_stdin_.file; -FILE* stdout = &_IO_stdout_.file; -FILE* stderr = &_IO_stderr_.file; +FILE *stdin = &_IO_stdin_.file; +FILE *stdout = &_IO_stdout_.file; +FILE *stderr = &_IO_stderr_.file; diff --git a/libio/strfile.h b/libio/strfile.h index 76044f8927..a0e47021f6 100644 --- a/libio/strfile.h +++ b/libio/strfile.h @@ -1,34 +1,35 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include <libio.h> #ifdef TODO Merge into libio.h ? #endif -typedef void *(*_IO_alloc_type) __P((_IO_size_t)); -typedef void (*_IO_free_type) __P((void*)); +typedef void *(*_IO_alloc_type) __P ((_IO_size_t)); +typedef void (*_IO_free_type) __P ((void*)); struct _IO_str_fields { diff --git a/libio/strops.c b/libio/strops.c index afc293bd7d..f7c22627e7 100644 --- a/libio/strops.c +++ b/libio/strops.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993 Free Software Foundation +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "strfile.h" #include "libioP.h" @@ -59,11 +60,14 @@ the executable file might be covered by the GNU General Public License. */ #endif void -DEFUN(_IO_str_init_static, (fp, ptr, size, pstart), - _IO_FILE *fp AND char *ptr AND int size AND char *pstart) +_IO_str_init_static (fp, ptr, size, pstart) + _IO_FILE *fp; + char *ptr; + int size; + char *pstart; { if (size == 0) - size = strlen(ptr); + size = strlen (ptr); else if (size < 0) { /* If size is negative 'the characters are assumed to @@ -80,7 +84,7 @@ DEFUN(_IO_str_init_static, (fp, ptr, size, pstart), size += s; } } - _IO_setb(fp, ptr, ptr+size, 0); + _IO_setb (fp, ptr, ptr + size, 0); fp->_IO_write_base = ptr; fp->_IO_read_base = ptr; @@ -98,20 +102,23 @@ DEFUN(_IO_str_init_static, (fp, ptr, size, pstart), fp->_IO_read_end = ptr+size; } /* A null _allocate_buffer function flags the strfile as being static. */ - (((_IO_strfile*)(fp))->_s._allocate_buffer) = (_IO_alloc_type)0; + (((_IO_strfile *) fp)->_s._allocate_buffer) = (_IO_alloc_type)0; } void -DEFUN(_IO_str_init_readonly, (fp, ptr, size), - _IO_FILE *fp AND const char *ptr AND int size) +_IO_str_init_readonly (fp, ptr, size) + _IO_FILE *fp; + const char *ptr; + int size; { - _IO_str_init_static (fp, (char*)ptr, size, NULL); + _IO_str_init_static (fp, (char *) ptr, size, NULL); fp->_IO_file_flags |= _IO_NO_WRITES; } int -DEFUN(_IO_str_overflow, (fp, c), - register _IO_FILE* fp AND int c) +_IO_str_overflow (fp, c) + _IO_FILE *fp; + int c; { int flush_only = c == EOF; _IO_size_t pos; @@ -124,7 +131,7 @@ DEFUN(_IO_str_overflow, (fp, c), fp->_IO_read_ptr = fp->_IO_read_end; } pos = fp->_IO_write_ptr - fp->_IO_write_base; - if (pos >= (_IO_size_t) (_IO_blen(fp) + flush_only)) + if (pos >= (_IO_size_t) (_IO_blen (fp) + flush_only)) { if (fp->_flags & _IO_USER_BUF) /* not allowed to enlarge */ return EOF; @@ -132,9 +139,9 @@ DEFUN(_IO_str_overflow, (fp, c), { char *new_buf; char *old_buf = fp->_IO_buf_base; - _IO_size_t new_size = 2 * _IO_blen(fp) + 100; + _IO_size_t new_size = 2 * _IO_blen (fp) + 100; new_buf - = (char*)(*((_IO_strfile*)fp)->_s._allocate_buffer)(new_size); + = (char *) (*((_IO_strfile *) fp)->_s._allocate_buffer) (new_size); if (new_buf == NULL) { /* __ferror(fp) = 1; */ @@ -142,16 +149,16 @@ DEFUN(_IO_str_overflow, (fp, c), } if (fp->_IO_buf_base) { - memcpy(new_buf, old_buf, _IO_blen(fp)); - (*((_IO_strfile*)fp)->_s._free_buffer)(fp->_IO_buf_base); + memcpy (new_buf, old_buf, _IO_blen (fp)); + (*((_IO_strfile *) fp)->_s._free_buffer) (fp->_IO_buf_base); /* Make sure _IO_setb won't try to delete _IO_buf_base. */ fp->_IO_buf_base = NULL; } #if 0 if (lenp == &LEN(fp)) /* use '\0'-filling */ - memset(new_buf + pos, 0, blen() - pos); + memset (new_buf + pos, 0, blen() - pos); #endif - _IO_setb(fp, new_buf, new_buf + new_size, 1); + _IO_setb (fp, new_buf, new_buf + new_size, 1); fp->_IO_read_base = new_buf + (fp->_IO_read_base - old_buf); fp->_IO_read_ptr = new_buf + (fp->_IO_read_ptr - old_buf); fp->_IO_read_end = new_buf + (fp->_IO_read_end - old_buf); @@ -170,8 +177,8 @@ DEFUN(_IO_str_overflow, (fp, c), } int -DEFUN(_IO_str_underflow, (fp), - register _IO_FILE* fp) +_IO_str_underflow (fp) + _IO_FILE *fp; { if (fp->_IO_write_ptr > fp->_IO_read_end) fp->_IO_read_end = fp->_IO_write_ptr; @@ -190,19 +197,22 @@ DEFUN(_IO_str_underflow, (fp), /* The size of the valid part of the buffer. */ _IO_ssize_t -DEFUN(_IO_str_count, (fp), - register _IO_FILE *fp) +_IO_str_count (fp) + _IO_FILE *fp; { - return (fp->_IO_write_end > fp->_IO_read_end ? fp->_IO_write_end - : fp->_IO_read_end) - - fp->_IO_read_base; + return ((fp->_IO_write_end > fp->_IO_read_end + ? fp->_IO_write_end : fp->_IO_read_end) + - fp->_IO_read_base); } _IO_pos_t -DEFUN(_IO_str_seekoff, (fp, offset, dir, mode), - register _IO_FILE *fp AND _IO_off_t offset AND int dir AND int mode) +_IO_str_seekoff (fp, offset, dir, mode) + _IO_FILE *fp; + _IO_off_t offset; + int dir; + int mode; { - _IO_ssize_t cur_size = _IO_str_count(fp); + _IO_ssize_t cur_size = _IO_str_count (fp); _IO_pos_t new_pos = EOF; /* Move the get pointer, if requested. */ @@ -219,7 +229,7 @@ DEFUN(_IO_str_seekoff, (fp, offset, dir, mode), default: /* case _IO_seek_set: */ break; } - if (offset < 0 || (_IO_ssize_t)offset > cur_size) + if (offset < 0 || (_IO_ssize_t) offset > cur_size) return EOF; fp->_IO_read_ptr = fp->_IO_read_base + offset; fp->_IO_read_end = fp->_IO_read_base + cur_size; @@ -240,7 +250,7 @@ DEFUN(_IO_str_seekoff, (fp, offset, dir, mode), default: /* case _IO_seek_set: */ break; } - if (offset < 0 || (_IO_ssize_t)offset > cur_size) + if (offset < 0 || (_IO_ssize_t) offset > cur_size) return EOF; fp->_IO_write_ptr = fp->_IO_write_base + offset; new_pos = offset; @@ -249,26 +259,29 @@ DEFUN(_IO_str_seekoff, (fp, offset, dir, mode), } int -DEFUN(_IO_str_pbackfail, (fp, c), - register _IO_FILE *fp AND int c) +_IO_str_pbackfail (fp, c) + _IO_FILE *fp; + int c; { if ((fp->_flags & _IO_NO_WRITES) && c != EOF) return EOF; - return _IO_default_pbackfail(fp, c); + return _IO_default_pbackfail (fp, c); } void -DEFUN (_IO_str_finish, (fp, dummy), - register _IO_FILE* fp AND int dummy) +_IO_str_finish (fp, dummy) + _IO_FILE *fp; + int dummy; { if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF)) - (((_IO_strfile*)fp)->_s._free_buffer)(fp->_IO_buf_base); + (((_IO_strfile *) fp)->_s._free_buffer) (fp->_IO_buf_base); fp->_IO_buf_base = NULL; - _IO_default_finish(fp, 0); + _IO_default_finish (fp, 0); } -struct _IO_jump_t _IO_str_jumps = { +struct _IO_jump_t _IO_str_jumps = +{ JUMP_INIT_DUMMY, JUMP_INIT(finish, _IO_str_finish), JUMP_INIT(overflow, _IO_str_overflow), diff --git a/libio/vasprintf.c b/libio/vasprintf.c index 02289407f4..15513d0fca 100644 --- a/libio/vasprintf.c +++ b/libio/vasprintf.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1995 Free Software Foundation +/* Copyright (C) 1995, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include <malloc.h> #include "libioP.h" @@ -42,19 +43,19 @@ _IO_vasprintf (result_ptr, format, args) _IO_lock_t lock; #endif int ret; - string = malloc (init_string_size); + string = (char *) malloc (init_string_size); if (string == NULL) return -1; #ifdef _IO_MTSAFE_IO sf._sbf._f._lock = &lock; #endif - _IO_init((_IO_FILE*)&sf, 0); - _IO_JUMPS((_IO_FILE*)&sf) = &_IO_str_jumps; - _IO_str_init_static ((_IO_FILE*)&sf, string, init_string_size, string); + _IO_init ((_IO_FILE *) &sf, 0); + _IO_JUMPS ((_IO_FILE *) &sf) = &_IO_str_jumps; + _IO_str_init_static ((_IO_FILE *) &sf, string, init_string_size, string); sf._sbf._f._flags &= ~_IO_USER_BUF; sf._s._allocate_buffer = (_IO_alloc_type) malloc; sf._s._free_buffer = (_IO_free_type) free; - ret = _IO_vfprintf((_IO_FILE*)&sf, format, args); + ret = _IO_vfprintf ((_IO_FILE *) &sf, format, args); if (ret < 0) return ret; *result_ptr = (char *) realloc (sf._sbf._f._IO_buf_base, @@ -65,4 +66,7 @@ _IO_vasprintf (result_ptr, format, args) (*result_ptr)[sf._sbf._f._IO_write_ptr-sf._sbf._f._IO_write_base] = '\0'; return ret; } + +#ifdef weak_alias weak_alias (_IO_vasprintf, vasprintf) +#endif diff --git a/libio/vscanf.c b/libio/vscanf.c index f905cff5a3..8b92ae270e 100644 --- a/libio/vscanf.c +++ b/libio/vscanf.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "stdio.h" @@ -34,4 +35,7 @@ _IO_vscanf (format, args) { return _IO_vfscanf (_IO_stdin, format, args, NULL); } + +#ifdef weak_alias weak_alias (_IO_vscanf, vscanf) +#endif diff --git a/libio/vsnprintf.c b/libio/vsnprintf.c index 5ada74215c..3f35af299a 100644 --- a/libio/vsnprintf.c +++ b/libio/vsnprintf.c @@ -1,26 +1,27 @@ -/* -Copyright (C) 1994, 1997 Free Software Foundation, Inc. - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ +/* Copyright (C) 1994, 1997 Free Software Foundation, Inc. + This file is part of the GNU IO Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this library; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, if you link this library with files + compiled with a GNU compiler to produce an executable, this does + not cause the resulting executable to be covered by the GNU General + Public License. This exception does not however invalidate any + other reasons why the executable file might be covered by the GNU + General Public License. */ #include "libioP.h" #include "strfile.h" @@ -35,8 +36,12 @@ typedef struct } _IO_strnfile; +static int _IO_strn_overflow __P ((_IO_FILE *fp, int c)); + static int -_IO_strn_overflow (_IO_FILE* fp, int c) +_IO_strn_overflow (fp, c) + _IO_FILE *fp; + int c; { /* When we come to here this means the user supplied buffer is filled. But since we must return the number of characters which @@ -70,7 +75,8 @@ _IO_strn_overflow (_IO_FILE* fp, int c) } -static struct _IO_jump_t _IO_strn_jumps = { +static struct _IO_jump_t _IO_strn_jumps = +{ JUMP_INIT_DUMMY, JUMP_INIT(finish, _IO_str_finish), JUMP_INIT(overflow, _IO_strn_overflow), @@ -123,5 +129,8 @@ _IO_vsnprintf (string, maxlen, format, args) *sf.f._sbf._f._IO_write_ptr = '\0'; return ret; } + +#ifdef weak_alias weak_alias (_IO_vsnprintf, __vsnprintf) weak_alias (_IO_vsnprintf, vsnprintf) +#endif |