shishi-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

shishi/gl argp-ba.c argp-eexst.c argp-fmtstream...


From: shishi-commit
Subject: shishi/gl argp-ba.c argp-eexst.c argp-fmtstream...
Date: Thu, 16 Oct 2003 06:53:29 -0400

CVSROOT:        /cvsroot/shishi
Module name:    shishi
Branch:         
Changes by:     Simon Josefsson <address@hidden>        03/10/16 06:53:29

Modified files:
        gl             : argp-ba.c argp-eexst.c argp-fmtstream.c 
                         argp-fmtstream.h argp-fs-xinl.c argp-help.c 
                         argp-namefrob.h argp-parse.c argp-pv.c 
                         argp-pvh.c argp-xinl.c argp.h error.c error.h 
                         getdate.y getdomainname.c getdomainname.h 
                         linebuffer.c unlocked-io.h xalloc.h 
                         xgetdomainname.c xgetdomainname.h 
                         xgethostname.h xmalloc.c xstrdup.c 
Added files:
        gl             : getline.c getline.h getndelim2.c getndelim2.h 
                         stdbool_.h 

Log message:
        Update.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/getline.c?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/getline.h?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/getndelim2.c?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/getndelim2.h?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/stdbool_.h?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/argp-ba.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/argp-eexst.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/argp-fmtstream.c.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/argp-fmtstream.h.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/argp-fs-xinl.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/argp-help.c.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/argp-namefrob.h.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/argp-parse.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/argp-pv.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/argp-pvh.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/argp-xinl.c.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/argp.h.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/error.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/error.h.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/getdate.y.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/getdomainname.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/getdomainname.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/linebuffer.c.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/unlocked-io.h.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/xalloc.h.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/xgetdomainname.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/xgetdomainname.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/xgethostname.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/xmalloc.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/gl/xstrdup.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: shishi/gl/argp-ba.c
diff -u shishi/gl/argp-ba.c:1.4 shishi/gl/argp-ba.c:1.5
--- shishi/gl/argp-ba.c:1.4     Thu Oct  2 20:15:30 2003
+++ shishi/gl/argp-ba.c Thu Oct 16 06:53:28 2003
@@ -3,25 +3,19 @@
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
+   This program 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.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program 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
-   Lesser General Public License for more details.
+   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 Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Get ELIDE_CODE. */
-#include "argp-namefrob.h"
-
-#ifndef ELIDE_CODE
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* If set by the user program, it should point to string that is the
    bug-reporting address for the program.  It will be printed by argp_help if
@@ -29,5 +23,3 @@
    messages), embedded in a sentence that says something like `Report bugs to
    ADDR.'.  */
 const char *argp_program_bug_address;
-
-#endif /* !ELIDE_CODE */
Index: shishi/gl/argp-eexst.c
diff -u shishi/gl/argp-eexst.c:1.4 shishi/gl/argp-eexst.c:1.5
--- shishi/gl/argp-eexst.c:1.4  Thu Oct  2 20:15:30 2003
+++ shishi/gl/argp-eexst.c      Thu Oct 16 06:53:29 2003
@@ -3,30 +3,24 @@
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
+   This program 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.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program 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
-   Lesser General Public License for more details.
+   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 Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 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 program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-/* Get ELIDE_CODE. */
-#include "argp-namefrob.h"
-
-#ifndef ELIDE_CODE
-
 #include <sysexits.h>
 
 #include "argp.h"
@@ -35,5 +29,3 @@
    If not defined or set by the user program, this defaults to EX_USAGE from
    <sysexits.h>.  */
 error_t argp_err_exit_status = EX_USAGE;
-
-#endif /* !ELIDE_CODE */
Index: shishi/gl/argp-fmtstream.c
diff -u shishi/gl/argp-fmtstream.c:1.5 shishi/gl/argp-fmtstream.c:1.6
--- shishi/gl/argp-fmtstream.c:1.5      Thu Oct  2 20:15:30 2003
+++ shishi/gl/argp-fmtstream.c  Thu Oct 16 06:53:29 2003
@@ -3,20 +3,19 @@
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
+   This program 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.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program 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
-   Lesser General Public License for more details.
+   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 Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 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 program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* This package emulates glibc `line_wrap_stream' semantics for systems that
    don't have that.  */
@@ -34,8 +33,6 @@
 #include "argp-fmtstream.h"
 #include "argp-namefrob.h"
 
-#ifndef ELIDE_CODE
-
 #ifndef ARGP_FMTSTREAM_USE_LINEWRAP
 
 #ifndef isblank
@@ -441,5 +438,3 @@
 #endif
 
 #endif /* !ARGP_FMTSTREAM_USE_LINEWRAP */
-
-#endif /* !ELIDE_CODE */
Index: shishi/gl/argp-fmtstream.h
diff -u shishi/gl/argp-fmtstream.h:1.4 shishi/gl/argp-fmtstream.h:1.5
--- shishi/gl/argp-fmtstream.h:1.4      Fri Aug 22 14:15:22 2003
+++ shishi/gl/argp-fmtstream.h  Thu Oct 16 06:53:29 2003
@@ -3,20 +3,19 @@
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
+   This program 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.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program 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
-   Lesser General Public License for more details.
+   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 Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 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 program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* This package emulates glibc `line_wrap_stream' semantics for systems that
    don't have that.  If the system does have it, it is just a wrapper for
Index: shishi/gl/argp-fs-xinl.c
diff -u shishi/gl/argp-fs-xinl.c:1.4 shishi/gl/argp-fs-xinl.c:1.5
--- shishi/gl/argp-fs-xinl.c:1.4        Thu Oct  2 20:15:30 2003
+++ shishi/gl/argp-fs-xinl.c    Thu Oct 16 06:53:29 2003
@@ -3,30 +3,24 @@
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
+   This program 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.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program 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
-   Lesser General Public License for more details.
+   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 Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 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 program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-/* Get ELIDE_CODE. */
-#include "argp-namefrob.h"
-
-#ifndef ELIDE_CODE
-
 #define ARGP_FS_EI
 #undef __OPTIMIZE__
 #define __OPTIMIZE__
@@ -47,5 +41,3 @@
 
 #endif
 #endif
-
-#endif /* !ELIDE_CODE */
Index: shishi/gl/argp-help.c
diff -u shishi/gl/argp-help.c:1.11 shishi/gl/argp-help.c:1.12
--- shishi/gl/argp-help.c:1.11  Thu Oct  2 20:15:30 2003
+++ shishi/gl/argp-help.c       Thu Oct 16 06:53:29 2003
@@ -3,20 +3,19 @@
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
+   This program 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.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program 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
-   Lesser General Public License for more details.
+   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 Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 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 program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #ifndef _GNU_SOURCE
 # define _GNU_SOURCE   1
@@ -85,11 +84,9 @@
 #include "argp-fmtstream.h"
 #include "argp-namefrob.h"
 
-#ifndef ELIDE_CODE
-
 #ifndef SIZE_MAX
 # define SIZE_MAX ((size_t) -1)
-#endif 
+#endif
 
 /* User-selectable (using an environment variable) formatting parameters.
 
@@ -1698,25 +1695,25 @@
   char *short_name = strrchr (name, '/');
   return short_name ? short_name + 1 : name;
 }
-#endif
 
 char *
 __argp_short_program_name (void)
 {
-#if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
+# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
   return program_invocation_short_name;
-#elif HAVE_DECL_PROGRAM_INVOCATION_NAME
+# elif HAVE_DECL_PROGRAM_INVOCATION_NAME
   return __argp_basename (program_invocation_name);
-#else
+# else
   /* FIXME: What now? Miles suggests that it is better to use NULL,
      but currently the value is passed on directly to fputs_unlocked,
      so that requires more changes. */
-#if __GNUC__
-# warning No reasonable value to return
-#endif /* __GNUC__ */
+# if __GNUC__
+#  warning No reasonable value to return
+# endif /* __GNUC__ */
   return "";
-#endif
+# endif
 }
+#endif
 
 /* Output, if appropriate, a usage message for STATE to STREAM.  FLAGS are
    from the set ARGP_HELP_*.  */
@@ -1905,5 +1902,3 @@
 #ifdef weak_alias
 weak_alias (__argp_failure, argp_failure)
 #endif
-
-#endif /* !ELIDE_CODE */
Index: shishi/gl/argp-namefrob.h
diff -u shishi/gl/argp-namefrob.h:1.7 shishi/gl/argp-namefrob.h:1.8
--- shishi/gl/argp-namefrob.h:1.7       Thu Oct  2 20:15:30 2003
+++ shishi/gl/argp-namefrob.h   Thu Oct 16 06:53:29 2003
@@ -1,22 +1,21 @@
 /* Name frobnication for compiling argp outside of glibc
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
+   This program 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.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program 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
-   Lesser General Public License for more details.
+   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 Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 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 program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #if !_LIBC
 /* This code is written for inclusion in gnu-libc, and uses names in the
@@ -138,7 +137,6 @@
 # endif
 
 extern char *__argp_basename (char *name);
-extern char *__argp_short_program_name (void);
 
 #endif /* !_LIBC */
 
@@ -146,26 +144,8 @@
 #define __set_errno(e) (errno = (e))
 #endif
 
-/* NOTE BEFORE MODIFYING ARGP: This version number must be
-   incremented whenever callers compiled using an old argp.h can no
-   longer properly call the functions in this argp*.c.  */
-#define ARGP_INTERFACE_VERSION 1
-
-/* Get __GNU_LIBRARY__.  */
-#include <stdio.h>
-
-/* Comment out all this code if we are using the GNU C Library, and are not
-   actually compiling the library itself, and the installed library
-   supports the same library interface we do.  This code is part of the GNU
-   C Library, but also included in many other GNU distributions.  Compiling
-   and linking in this code is a waste when using the GNU C library
-   (especially if it is a shared library).  Rather than having every GNU
-   program understand `configure --with-gnu-libc' and omit the object
-   files, it is simpler to just do this in the source for each such file.  */
-
-#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
-# include <gnu-versions.h>
-# if _GNU_ARGP_INTERFACE_VERSION == ARGP_INTERFACE_VERSION
-#  define ELIDE_CODE
-# endif
+#if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
+# define __argp_short_program_name()   (program_invocation_short_name)
+#else
+extern char *__argp_short_program_name (void);
 #endif
Index: shishi/gl/argp-parse.c
diff -u shishi/gl/argp-parse.c:1.6 shishi/gl/argp-parse.c:1.7
--- shishi/gl/argp-parse.c:1.6  Thu Oct  2 20:15:30 2003
+++ shishi/gl/argp-parse.c      Thu Oct 16 06:53:29 2003
@@ -3,20 +3,19 @@
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
+   This program 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.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program 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
-   Lesser General Public License for more details.
+   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 Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 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 program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -58,8 +57,6 @@
 #include "argp.h"
 #include "argp-namefrob.h"
 
-#ifndef ELIDE_CODE
-
 /* Getopt return values.  */
 #define KEY_END (-1)           /* The end of the options.  */
 #define KEY_ARG 1              /* A non-option argument.  */
@@ -977,5 +974,3 @@
 #ifdef weak_alias
 weak_alias (__argp_input, _argp_input)
 #endif
-
-#endif /* !ELIDE_CODE */
Index: shishi/gl/argp-pv.c
diff -u shishi/gl/argp-pv.c:1.4 shishi/gl/argp-pv.c:1.5
--- shishi/gl/argp-pv.c:1.4     Thu Oct  2 20:15:30 2003
+++ shishi/gl/argp-pv.c Thu Oct 16 06:53:29 2003
@@ -3,30 +3,22 @@
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
+   This program 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.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program 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
-   Lesser General Public License for more details.
+   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 Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Get ELIDE_CODE. */
-#include "argp-namefrob.h"
-
-#ifndef ELIDE_CODE
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* If set by the user program to a non-zero value, then a default option
    --version is added (unless the ARGP_NO_HELP flag is used), which will
    print this this string followed by a newline and exit (unless the
    ARGP_NO_EXIT flag is used).  Overridden by ARGP_PROGRAM_VERSION_HOOK.  */
 const char *argp_program_version;
-
-#endif /* !ELIDE_CODE */
Index: shishi/gl/argp-pvh.c
diff -u shishi/gl/argp-pvh.c:1.4 shishi/gl/argp-pvh.c:1.5
--- shishi/gl/argp-pvh.c:1.4    Thu Oct  2 20:15:30 2003
+++ shishi/gl/argp-pvh.c        Thu Oct 16 06:53:29 2003
@@ -3,30 +3,24 @@
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
+   This program 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.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program 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
-   Lesser General Public License for more details.
+   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 Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 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 program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-/* Get ELIDE_CODE. */
-#include "argp-namefrob.h"
-
-#ifndef ELIDE_CODE
-
 #include "argp.h"
 
 /* If set by the user program to a non-zero value, then a default option
@@ -35,5 +29,3 @@
    current parsing state, and then exits (unless the ARGP_NO_EXIT flag is
    used).  This variable takes precedent over ARGP_PROGRAM_VERSION.  */
 void (*argp_program_version_hook) (FILE *stream, struct argp_state *state);
-
-#endif /* !ELIDE_CODE */
Index: shishi/gl/argp-xinl.c
diff -u shishi/gl/argp-xinl.c:1.5 shishi/gl/argp-xinl.c:1.6
--- shishi/gl/argp-xinl.c:1.5   Thu Oct  2 20:15:30 2003
+++ shishi/gl/argp-xinl.c       Thu Oct 16 06:53:29 2003
@@ -3,30 +3,24 @@
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
+   This program 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.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program 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
-   Lesser General Public License for more details.
+   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 Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 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 program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-/* Get ELIDE_CODE. */
-#include "argp-namefrob.h"
-
-#ifndef ELIDE_CODE
-
 #if defined _LIBC || defined HAVE_FEATURES_H
 # include <features.h>
 #endif
@@ -47,5 +41,3 @@
 weak_alias (__option_is_end, _option_is_end)
 
 #endif
-
-#endif /* !ELIDE_CODE */
Index: shishi/gl/argp.h
diff -u shishi/gl/argp.h:1.7 shishi/gl/argp.h:1.8
--- shishi/gl/argp.h:1.7        Tue Sep 23 18:09:54 2003
+++ shishi/gl/argp.h    Thu Oct 16 06:53:29 2003
@@ -3,20 +3,19 @@
    This file is part of the GNU C Library.
    Written by Miles Bader <address@hidden>.
 
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
+   This program 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.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program 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
-   Lesser General Public License for more details.
+   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 Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 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 program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #ifndef _ARGP_H
 #define _ARGP_H
Index: shishi/gl/error.c
diff -u shishi/gl/error.c:1.4 shishi/gl/error.c:1.5
--- shishi/gl/error.c:1.4       Sun Sep 14 17:10:11 2003
+++ shishi/gl/error.c   Thu Oct 16 06:53:29 2003
@@ -1,5 +1,7 @@
 /* Error handler for noninteractive utilities
-   Copyright (C) 1990-1998, 2000, 2001, 2002, 2003 Free Software Foundation, 
Inc.
+   Copyright (C) 1990-1998, 2000-2002, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
    This program 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)
@@ -58,6 +60,7 @@
 /* In the GNU C library, there is a predefined variable for this.  */
 
 # define program_name program_invocation_name
+# include <errno.h>
 # include <libio/libioP.h>
 
 /* In GNU libc we want do not want to use the common name `error' directly.
@@ -76,6 +79,8 @@
 # undef putc
 # define putc(c, fp) INTUSE(_IO_putc) (c, fp)
 
+# include <bits/libc-lock.h>
+
 #else /* not _LIBC */
 
 # if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
@@ -85,6 +90,10 @@
 char *strerror_r ();
 # endif
 
+# ifndef SIZE_MAX
+#  define SIZE_MAX ((size_t) -1)
+# endif
+
 /* The calling program should define program_name and set it to the
    name of the executing program.  */
 extern char *program_name;
@@ -137,40 +146,26 @@
     {
 # define ALLOCA_LIMIT 2000
       size_t len = strlen (message) + 1;
-      wchar_t *wmessage = NULL;
-      mbstate_t st;
-      size_t res;
-      const char *tmp;
+      const wchar_t *wmessage = L"out of memory";
+      wchar_t *wbuf = (len < ALLOCA_LIMIT
+                      ? alloca (len * sizeof *wbuf)
+                      : len <= SIZE_MAX / sizeof *wbuf
+                      ? malloc (len * sizeof *wbuf)
+                      : NULL);
 
-      do
+      if (wbuf)
        {
-         if (len < ALLOCA_LIMIT)
-           wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
-         else
-           {
-             if (wmessage != NULL && len / 2 < ALLOCA_LIMIT)
-               wmessage = NULL;
-
-             wmessage = (wchar_t *) realloc (wmessage,
-                                             len * sizeof (wchar_t));
-
-             if (wmessage == NULL)
-               {
-                 fputws_unlocked (L"out of memory\n", stderr);
-                 return;
-               }
-           }
-
+         size_t res;
+         mbstate_t st;
+         const char *tmp = message;
          memset (&st, '\0', sizeof (st));
-         tmp =message;
+         res = mbsrtowcs (wbuf, &tmp, len, &st);
+         wmessage = res == (size_t) -1 ? L"???" : wbuf;
        }
-      while ((res = mbsrtowcs (wmessage, &tmp, len, &st)) == len);
-
-      if (res == (size_t) -1)
-       /* The string cannot be converted.  */
-       wmessage = (wchar_t *) L"???";
 
       __vfwprintf (stderr, wmessage, args);
+      if (! (len < ALLOCA_LIMIT))
+       free (wbuf);
     }
   else
 #endif
@@ -201,6 +196,14 @@
 {
   va_list args;
 
+#if defined _LIBC && defined __libc_ptf_call
+  /* We do not want this call to be cut short by a thread
+     cancellation.  Therefore disable cancellation for now.  */
+  int state = PTHREAD_CANCEL_ENABLE;
+  __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
+                  0);
+#endif
+
   fflush (stdout);
 #ifdef _LIBC
   _IO_flockfile (stderr);
@@ -222,6 +225,9 @@
 
 #ifdef _LIBC
   _IO_funlockfile (stderr);
+# ifdef __libc_ptf_call
+  __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
+# endif
 #endif
 }
 
@@ -250,6 +256,14 @@
       old_line_number = line_number;
     }
 
+#if defined _LIBC && defined __libc_ptf_call
+  /* We do not want this call to be cut short by a thread
+     cancellation.  Therefore disable cancellation for now.  */
+  int state = PTHREAD_CANCEL_ENABLE;
+  __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
+                  0);
+#endif
+
   fflush (stdout);
 #ifdef _LIBC
   _IO_flockfile (stderr);
@@ -281,6 +295,9 @@
 
 #ifdef _LIBC
   _IO_funlockfile (stderr);
+# ifdef __libc_ptf_call
+  __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
+# endif
 #endif
 }
 
Index: shishi/gl/error.h
diff -u shishi/gl/error.h:1.2 shishi/gl/error.h:1.3
--- shishi/gl/error.h:1.2       Tue Sep  9 05:00:50 2003
+++ shishi/gl/error.h   Thu Oct 16 06:53:29 2003
@@ -1,24 +1,20 @@
 /* Declaration for error-reporting function
    Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-
-   NOTE: The canonical source of this file is maintained with the GNU C 
Library.
-   Bugs can be reported to address@hidden
-
-   This program 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 program 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 program 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 program; if not, write to the Free Software
-   Foundation, Inc., 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 program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #ifndef _ERROR_H
 #define _ERROR_H 1
@@ -44,11 +40,11 @@
    if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
    If STATUS is nonzero, terminate the program with `exit (STATUS)'.  */
 
-extern void error (int status, int errnum, const char *format, ...)
+extern void error (int __status, int __errnum, const char *__format, ...)
      __attribute__ ((__format__ (__printf__, 3, 4)));
 
-extern void error_at_line (int status, int errnum, const char *fname,
-                          unsigned int lineno, const char *format, ...)
+extern void error_at_line (int __status, int __errnum, const char *__fname,
+                          unsigned int __lineno, const char *__format, ...)
      __attribute__ ((__format__ (__printf__, 5, 6)));
 
 /* If NULL, error will flush stdout, then print on stderr the program
Index: shishi/gl/getdate.y
diff -u shishi/gl/getdate.y:1.2 shishi/gl/getdate.y:1.3
--- shishi/gl/getdate.y:1.2     Sat Sep  6 11:19:32 2003
+++ shishi/gl/getdate.y Thu Oct 16 06:53:29 2003
@@ -43,9 +43,7 @@
 
 #include <ctype.h>
 
-#if HAVE_STDLIB_H
-# include <stdlib.h> /* for `free'; used by Bison 1.27 */
-#endif
+#include <stdlib.h> /* for `free'; used by Bison 1.27 */
 
 #if STDC_HEADERS || (! defined isascii && ! HAVE_ISASCII)
 # define IN_CTYPE_DOMAIN(c) 1
@@ -67,9 +65,7 @@
    of `digit' even when the host does not conform to POSIX.  */
 #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
 
-#if STDC_HEADERS || HAVE_STRING_H
-# include <string.h>
-#endif
+#include <string.h>
 
 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
 # define __attribute__(x)
Index: shishi/gl/getdomainname.c
diff -u shishi/gl/getdomainname.c:1.1 shishi/gl/getdomainname.c:1.2
--- shishi/gl/getdomainname.c:1.1       Tue Sep 23 20:41:40 2003
+++ shishi/gl/getdomainname.c   Thu Oct 16 06:53:29 2003
@@ -15,24 +15,41 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-/* written by Simon Josefsson */
+/* Written by Simon Josefsson.  */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
-/* Get specification. */
+/* Specification. */
 #include "getdomainname.h"
 
-/* Get strcpy. */
 #include <string.h>
+#include <errno.h>
 
-/* Put up to LEN chars of the domain name into NAME.
+/* Return the NIS domain name of the machine.
+   WARNING! The NIS domain name is unrelated to the fully qualified host name
+            of the machine.  It is also unrelated to email addresses.
+   WARNING! The NIS domain name is usually the empty string or "(none)" when
+            not using NIS.
+
+   Put up to LEN bytes of the NIS domain name into NAME.
    Null terminate it if the name is shorter than LEN.
-   Return 0 if ok, -1 if error.  */
+   If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
+   Return 0 if successful, otherwise set errno and return -1.  */
 int
 getdomainname (char *name, size_t len)
 {
-  strcpy (name, "");           /* Hardcode your domain name if you want.  */
+  const char *result = "";     /* Hardcode your domain name if you want.  */
+  size_t result_len = strlen (result);
+
+  if (result_len > len)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  memcpy (name, result, result_len);
+  if (result_len < len)
+    name[result_len] = '\0';
   return 0;
 }
Index: shishi/gl/getdomainname.h
diff -u shishi/gl/getdomainname.h:1.1 shishi/gl/getdomainname.h:1.2
--- shishi/gl/getdomainname.h:1.1       Tue Sep 23 20:41:40 2003
+++ shishi/gl/getdomainname.h   Thu Oct 16 06:53:29 2003
@@ -1,4 +1,4 @@
-/* getdomainname emulation for systems that doesn't have it.
+/* getdomainname - Return the NIS domain name.
    Copyright (C) 2003 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -20,14 +20,23 @@
 
 #if HAVE_GETDOMAINNAME
 
-/* Get getdomainname() declarations.  */
+/* Get getdomainname() declaration.  */
 # include <unistd.h>
 
 #else
 
-/* Put up to LEN chars of the domain name into NAME.
+# include <stddef.h>
+
+/* Return the NIS domain name of the machine.
+   WARNING! The NIS domain name is unrelated to the fully qualified host name
+            of the machine.  It is also unrelated to email addresses.
+   WARNING! The NIS domain name is usually the empty string or "(none)" when
+            not using NIS.
+
+   Put up to LEN bytes of the NIS domain name into NAME.
    Null terminate it if the name is shorter than LEN.
-   Return 0 if ok, -1 if error.  */
+   If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
+   Return 0 if successful, otherwise set errno and return -1.  */
 extern int getdomainname(char *name, size_t len);
 
 #endif /* HAVE_GETDOMAINNAME */
Index: shishi/gl/linebuffer.c
diff -u shishi/gl/linebuffer.c:1.2 shishi/gl/linebuffer.c:1.3
--- shishi/gl/linebuffer.c:1.2  Tue Sep 23 18:06:15 2003
+++ shishi/gl/linebuffer.c      Thu Oct 16 06:53:29 2003
@@ -87,7 +87,7 @@
   return linebuffer;
 }
 
-/* Free linebuffer LINEBUFFER and its data, all allocated with malloc. */
+/* Free the buffer that was allocated for linebuffer LINEBUFFER.  */
 
 void
 freebuffer (struct linebuffer *linebuffer)
Index: shishi/gl/unlocked-io.h
diff -u shishi/gl/unlocked-io.h:1.2 shishi/gl/unlocked-io.h:1.3
--- shishi/gl/unlocked-io.h:1.2 Tue Aug 12 18:02:12 2003
+++ shishi/gl/unlocked-io.h     Thu Oct 16 06:53:29 2003
@@ -27,63 +27,106 @@
 
 # if USE_UNLOCKED_IO
 
-/* These are wrappers for functions/macros from GNU libc.
+/* These are wrappers for functions/macros from the GNU C library, and
+   from other C libraries supporting POSIX's optional thread-safe functions.
+
    The standard I/O functions are thread-safe.  These *_unlocked ones are
    more efficient but not thread-safe.  That they're not thread-safe is
-   fine since all of the applications in this package are single threaded.  */
+   fine since all of the applications in this package are single threaded.
+
+   Also, some code that is shared with the GNU C library may invoke
+   the *_unlocked functions directly.  On hosts that lack those
+   functions, invoke the non-thread-safe versions instead.  */
+
+#  include <stdio.h>
 
 #  if HAVE_DECL_CLEARERR_UNLOCKED
 #   undef clearerr
 #   define clearerr(x) clearerr_unlocked (x)
+#  else
+#   define clearerr_unlocked(x) clearerr (x)
 #  endif
 #  if HAVE_DECL_FEOF_UNLOCKED
 #   undef feof
 #   define feof(x) feof_unlocked (x)
+#  else
+#   define feof_unlocked(x) feof (x)
 #  endif
 #  if HAVE_DECL_FERROR_UNLOCKED
 #   undef ferror
 #   define ferror(x) ferror_unlocked (x)
+#  else
+#   define ferror_unlocked(x) ferror (x)
 #  endif
 #  if HAVE_DECL_FFLUSH_UNLOCKED
 #   undef fflush
 #   define fflush(x) fflush_unlocked (x)
+#  else
+#   define fflush_unlocked(x) fflush (x)
 #  endif
 #  if HAVE_DECL_FGETS_UNLOCKED
 #   undef fgets
 #   define fgets(x,y,z) fgets_unlocked (x,y,z)
+#  else
+#   define fgets_unlocked(x,y,z) fgets (x,y,z)
 #  endif
 #  if HAVE_DECL_FPUTC_UNLOCKED
 #   undef fputc
 #   define fputc(x,y) fputc_unlocked (x,y)
+#  else
+#   define fputc_unlocked(x,y) fputc (x,y)
 #  endif
 #  if HAVE_DECL_FPUTS_UNLOCKED
 #   undef fputs
 #   define fputs(x,y) fputs_unlocked (x,y)
+#  else
+#   define fputs_unlocked(x,y) fputs (x,y)
 #  endif
 #  if HAVE_DECL_FREAD_UNLOCKED
 #   undef fread
 #   define fread(w,x,y,z) fread_unlocked (w,x,y,z)
+#  else
+#   define fread_unlocked(w,x,y,z) fread (w,x,y,z)
 #  endif
 #  if HAVE_DECL_FWRITE_UNLOCKED
 #   undef fwrite
 #   define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z)
+#  else
+#   define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
 #  endif
 #  if HAVE_DECL_GETC_UNLOCKED
 #   undef getc
 #   define getc(x) getc_unlocked (x)
+#  else
+#   define getc_unlocked(x) getc (x)
 #  endif
 #  if HAVE_DECL_GETCHAR_UNLOCKED
 #   undef getchar
 #   define getchar() getchar_unlocked ()
+#  else
+#   define getchar_unlocked() getchar ()
 #  endif
 #  if HAVE_DECL_PUTC_UNLOCKED
 #   undef putc
 #   define putc(x,y) putc_unlocked (x,y)
+#  else
+#   define putc_unlocked(x,y) putc (x,y)
 #  endif
 #  if HAVE_DECL_PUTCHAR_UNLOCKED
 #   undef putchar
 #   define putchar(x) putchar_unlocked (x)
+#  else
+#   define putchar_unlocked(x) putchar (x)
 #  endif
+
+#  undef flockfile
+#  define flockfile(x) ((void) 0)
+
+#  undef ftrylockfile
+#  define ftrylockfile(x) 0
+
+#  undef funlockfile
+#  define funlockfile(x) ((void) 0)
 
 # endif /* USE_UNLOCKED_IO */
 #endif /* UNLOCKED_IO_H */
Index: shishi/gl/xalloc.h
diff -u shishi/gl/xalloc.h:1.3 shishi/gl/xalloc.h:1.4
--- shishi/gl/xalloc.h:1.3      Fri Aug 22 13:48:49 2003
+++ shishi/gl/xalloc.h  Thu Oct 16 06:53:29 2003
@@ -48,31 +48,23 @@
    memory allocation failure.  */
 extern void xalloc_die (void) ATTRIBUTE_NORETURN;
 
-void *xmalloc (size_t n);
+void *xmalloc (size_t s);
+void *xnmalloc (size_t n, size_t s);
+void *xzalloc (size_t s);
 void *xcalloc (size_t n, size_t s);
-void *xrealloc (void *p, size_t n);
+void *xrealloc (void *p, size_t s);
+void *xnrealloc (void *p, size_t n, size_t s);
+void *xclone (void const *p, size_t s);
 char *xstrdup (const char *str);
 
-# define XMALLOC(Type, N_items) xmalloc (sizeof (Type) * (N_items))
-# define XCALLOC(Type, N_items) xcalloc (sizeof (Type), N_items)
-# define XREALLOC(Ptr, Type, N_items) xrealloc (Ptr, sizeof (Type) * (N_items))
-
-/* Declare and alloc memory for VAR of type TYPE. */
-# define NEW(Type, Var)  Type *(Var) = XMALLOC (Type, 1)
-
-/* Free VAR only if non NULL. */
-# define XFREE(Var)    \
-   do {                 \
-      if (Var)          \
-        free (Var);     \
-   } while (0)
-
-/* Return a pointer to a malloc'ed copy of the array SRC of NUM elements. */
-# define CCLONE(Src, Num) \
-  (memcpy (xmalloc (sizeof *(Src) * (Num)), Src, sizeof *(Src) * (Num)))
-
-/* Return a malloc'ed copy of SRC. */
-# define CLONE(Src) CCLONE (Src, 1)
-
+/* These macros are deprecated; they will go away soon, and are retained
+   temporarily only to ease conversion to the functions described above.  */
+# define CCLONE(p, n) xclone (p, (n) * sizeof *(p))
+# define CLONE(p) xclone (p, sizeof *(p))
+# define NEW(type, var) type *var = xmalloc (sizeof (type))
+# define XCALLOC(type, n) xcalloc (n, sizeof (type))
+# define XMALLOC(type, n) xnmalloc (n, sizeof (type))
+# define XREALLOC(p, type, n) xnrealloc (p, n, sizeof (type))
+# define XFREE(p) free (p)
 
 #endif /* !XALLOC_H_ */
Index: shishi/gl/xgetdomainname.c
diff -u shishi/gl/xgetdomainname.c:1.1 shishi/gl/xgetdomainname.c:1.2
--- shishi/gl/xgetdomainname.c:1.1      Tue Sep 23 20:41:40 2003
+++ shishi/gl/xgetdomainname.c  Thu Oct 16 06:53:29 2003
@@ -1,4 +1,4 @@
-/* xgetdomainname.c -- return current domain name with unlimited length
+/* xgetdomainname.c -- Return the NIS domain name, without size limitations.
    Copyright (C) 1992, 1996, 2000, 2001, 2003 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -15,7 +15,7 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-/* based on xgethostname.c written by Jim Meyering */
+/* Based on xgethostname.c, written by Jim Meyering.  */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -36,9 +36,13 @@
 # define INITIAL_DOMAINNAME_LENGTH 34
 #endif
 
-/* Return the current domain name in malloc'd storage.
+/* Return the NIS domain name of the machine, in malloc'd storage.
+   WARNING! The NIS domain name is unrelated to the fully qualified host name
+            of the machine.  It is also unrelated to email addresses.
+   WARNING! The NIS domain name is usually the empty string or "(none)" when
+            not using NIS.
    If malloc fails, exit.
-   Upon any other failure, return NULL.  */
+   Upon any other failure, set errno and return NULL.  */
 char *
 xgetdomainname (void)
 {
Index: shishi/gl/xgetdomainname.h
diff -u shishi/gl/xgetdomainname.h:1.1 shishi/gl/xgetdomainname.h:1.2
--- shishi/gl/xgetdomainname.h:1.1      Tue Sep 23 20:41:40 2003
+++ shishi/gl/xgetdomainname.h  Thu Oct 16 06:53:29 2003
@@ -1,4 +1,4 @@
-/* xgetdomainname.h -- return current domain name with unlimited length
+/* xgetdomainname.h -- Return the NIS domain name, without size limitations.
    Copyright (C) 1992, 1996, 2000, 2001, 2003 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -18,9 +18,13 @@
 #ifndef _XGETDOMAINNAME_H
 #define _XGETDOMAINNAME_H
 
-/* Return the current domain name in malloc'd storage.
+/* Return the NIS domain name of the machine, in malloc'd storage.
+   WARNING! The NIS domain name is unrelated to the fully qualified host name
+            of the machine.  It is also unrelated to email addresses.
+   WARNING! The NIS domain name is usually the empty string or "(none)" when
+            not using NIS.
    If malloc fails, exit.
-   Upon any other failure, return NULL.  */
+   Upon any other failure, set errno and return NULL.  */
 extern char *xgetdomainname (void);
 
 #endif /* _XGETDOMAINNAME_H */
Index: shishi/gl/xgethostname.h
diff -u shishi/gl/xgethostname.h:1.1 shishi/gl/xgethostname.h:1.2
--- shishi/gl/xgethostname.h:1.1        Tue Sep 23 19:14:01 2003
+++ shishi/gl/xgethostname.h    Thu Oct 16 06:53:29 2003
@@ -1,26 +1 @@
-/* xgethostname.h -- return current hostname with unlimited length
-   Copyright (C) 1992, 1996, 2000, 2001, 2003 Free Software Foundation, Inc.
-
-   This program 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 program 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 program; if not, write to the Free Software Foundation,
-   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-#ifndef _XGETHOSTNAME_H
-#define _XGETHOSTNAME_H
-
-/* Return the current hostname in malloc'd storage.
-   If malloc fails, exit.
-   Upon any other failure, return NULL.  */
-extern char *xgethostname (void);
-
-#endif /* _XGETHOSTNAME_H */
+char *xgethostname (void);
Index: shishi/gl/xmalloc.c
diff -u shishi/gl/xmalloc.c:1.3 shishi/gl/xmalloc.c:1.4
--- shishi/gl/xmalloc.c:1.3     Sun Sep 14 17:10:11 2003
+++ shishi/gl/xmalloc.c Thu Oct 16 06:53:29 2003
@@ -1,6 +1,6 @@
 /* xmalloc.c -- malloc with out of memory checking
 
-   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003,
    1999, 2000, 2002, 2003 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -23,17 +23,20 @@
 
 #include "xalloc.h"
 
+#include <stdbool.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 #define N_(msgid) msgid
 
 #include "error.h"
-#include "exit.h"
 #include "exitfail.h"
 
-/* The following tests require AC_PREREQ(2.54).  */
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
 
 #ifndef HAVE_MALLOC
 "you must run the autoconf test for a GNU libc compatible malloc"
@@ -46,6 +49,15 @@
 /* If non NULL, call this function when memory is exhausted. */
 void (*xalloc_fail_func) (void) = 0;
 
+/* Return true if array of N objects, each of size S, cannot exist due
+   to arithmetic overflow.  S must be nonzero.  */
+
+static inline bool
+array_size_overflow (size_t n, size_t s)
+{
+  return SIZE_MAX / s < n;
+}
+
 /* If XALLOC_FAIL_FUNC is NULL, or does return, display this message
    before exiting when memory is exhausted.  Goes through gettext. */
 char const xalloc_msg_memory_exhausted[] = N_("memory exhausted");
@@ -58,8 +70,20 @@
   error (exit_failure, 0, "%s", _(xalloc_msg_memory_exhausted));
   /* The `noreturn' cannot be given to error, since it may return if
      its first argument is 0.  To help compilers understand the
-     xalloc_die does terminate, call exit. */
-  exit (EXIT_FAILURE);
+     xalloc_die does terminate, call abort.  */
+  abort ();
+}
+
+/* Allocate an array of N objects, each with S bytes of memory,
+   dynamically, with error checking.  S must be nonzero.  */
+
+inline void *
+xnmalloc (size_t n, size_t s)
+{
+  void *p;
+  if (array_size_overflow (n, s) || ! (p = malloc (n * s)))
+    xalloc_die ();
+  return p;
 }
 
 /* Allocate N bytes of memory dynamically, with error checking.  */
@@ -67,10 +91,16 @@
 void *
 xmalloc (size_t n)
 {
-  void *p;
+  return xnmalloc (n, 1);
+}
+
+/* Change the size of an allocated block of memory P to an array of N
+   objects each of S bytes, with error checking.  S must be nonzero.  */
 
-  p = malloc (n);
-  if (p == 0)
+inline void *
+xnrealloc (void *p, size_t n, size_t s)
+{
+  if (array_size_overflow (n, s) || ! (p = realloc (p, n * s)))
     xalloc_die ();
   return p;
 }
@@ -81,21 +111,39 @@
 void *
 xrealloc (void *p, size_t n)
 {
-  p = realloc (p, n);
-  if (p == 0)
-    xalloc_die ();
-  return p;
+  return xnrealloc (p, n, 1);
+}
+
+/* Allocate S bytes of zeroed memory dynamically, with error checking.
+   There's no need for xnzalloc (N, S), since it would be equivalent
+   to xcalloc (N, S).  */
+
+void *
+xzalloc (size_t s)
+{
+  return memset (xmalloc (s), 0, s);
 }
 
-/* Allocate memory for N elements of S bytes, with error checking.  */
+/* Allocate zeroed memory for N elements of S bytes, with error
+   checking.  S must be nonzero.  */
 
 void *
 xcalloc (size_t n, size_t s)
 {
   void *p;
-
-  p = calloc (n, s);
-  if (p == 0)
+  /* Test for overflow, since some calloc implementations don't have
+     proper overflow checks.  */
+  if (array_size_overflow (n, s) || ! (p = calloc (n, s)))
     xalloc_die ();
   return p;
+}
+
+/* Clone an object P of size S, with error checking.  There's no need
+   for xnclone (P, N, S), since xclone (P, N * S) works without any
+   need for an arithmetic overflow check.  */
+
+void *
+xclone (void const *p, size_t s)
+{
+  return memcpy (xmalloc (s), p, s);
 }
Index: shishi/gl/xstrdup.c
diff -u shishi/gl/xstrdup.c:1.3 shishi/gl/xstrdup.c:1.4
--- shishi/gl/xstrdup.c:1.3     Fri Aug 22 18:59:19 2003
+++ shishi/gl/xstrdup.c Thu Oct 16 06:53:29 2003
@@ -29,5 +29,5 @@
 char *
 xstrdup (const char *string)
 {
-  return strcpy (xmalloc (strlen (string) + 1), string);
+  return xclone (string, strlen (string) + 1);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]