changeset 26083:134b57acef68

Add support for large files. Merge glibc 2.1.2. * b2m.c, emacsclient.c, emacsserver.c, fakemail.c, make-docfile.c, movemail.c, pop.c: Do not include <stdlib.h>, as <config.h> does this now. * b2m.c, emacsserver.c, etags.c, profile.c: Include <config.h> before any system include files. * emacsclient.c, emacsserver.c, fakemail.c, movemail.c, pop.c, test-distrib.c: (read, write, open, close): Do not undef. * getopt.c, getopt1.c: Adopt glibc 2.1.2, with the following fix: (const): Do not define if HAVE_CONFIG_H; that's config.h's job. * getopt.h: Adopt glibc 2.1.2.
author Paul Eggert <eggert@twinsun.com>
date Tue, 19 Oct 1999 07:17:20 +0000
parents 3002a7df8351
children 804cba424b64
files lib-src/ChangeLog lib-src/b2m.c lib-src/emacsclient.c lib-src/emacsserver.c lib-src/etags.c lib-src/fakemail.c lib-src/getopt.c lib-src/getopt.h lib-src/getopt1.c lib-src/make-docfile.c lib-src/movemail.c lib-src/pop.c lib-src/profile.c lib-src/test-distrib.c
diffstat 14 files changed, 136 insertions(+), 146 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Tue Oct 19 07:16:11 1999 +0000
+++ b/lib-src/ChangeLog	Tue Oct 19 07:17:20 1999 +0000
@@ -1,3 +1,23 @@
+1999-10-19  Paul Eggert  <eggert@twinsun.com>
+
+	Add support for large files.  Merge glibc 2.1.2.
+	
+	* b2m.c, emacsclient.c, emacsserver.c, fakemail.c, make-docfile.c,
+	movemail.c, pop.c:
+	Do not include <stdlib.h>, as <config.h> does this now.
+
+	* b2m.c, emacsserver.c, etags.c, profile.c:
+	Include <config.h> before any system include files.
+	
+	* emacsclient.c, emacsserver.c, fakemail.c, movemail.c, pop.c,
+	test-distrib.c:
+	(read, write, open, close): Do not undef.
+
+	* getopt.c, getopt1.c: Adopt glibc 2.1.2, with the following fix:
+	(const): Do not define if HAVE_CONFIG_H; that's config.h's job.
+
+	* getopt.h: Adopt glibc 2.1.2.
+ 	
 1999-10-15  Dave Love  <fx@gnu.org>
 
 	* Makefile.in (pop.o): Depend on config.h.
--- a/lib-src/b2m.c	Tue Oct 19 07:16:11 1999 +0000
+++ b/lib-src/b2m.c	Tue Oct 19 07:17:20 1999 +0000
@@ -18,14 +18,6 @@
 /* Made conformant to the GNU coding standards January, 1995
    by Francesco Potorti` <pot@cnuce.cnr.it>. */
 
-#include <stdio.h>
-#include <time.h>
-#include <sys/types.h>
-#include <getopt.h>
-#ifdef MSDOS
-#include <fcntl.h>
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 /* On some systems, Emacs defines static as nothing for the sake
@@ -33,8 +25,12 @@
 #undef static
 #endif
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+#include <sys/types.h>
+#include <getopt.h>
+#ifdef MSDOS
+#include <fcntl.h>
 #endif
 
 #undef TRUE
--- a/lib-src/emacsclient.c	Tue Oct 19 07:16:11 1999 +0000
+++ b/lib-src/emacsclient.c	Tue Oct 19 07:17:20 1999 +0000
@@ -1,5 +1,5 @@
 /* Client process that communicates with GNU Emacs acting as server.
-   Copyright (C) 1986, 1987, 1994 Free Software Foundation, Inc.
+   Copyright (C) 1986, 1987, 1994, 1999 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -21,17 +21,10 @@
 
 #define NO_SHORTNAMES
 #include <../src/config.h>
-#undef read
-#undef write
-#undef open
-#undef close
 #undef signal
 
 #include <stdio.h>
 #include <getopt.h>
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
--- a/lib-src/emacsserver.c	Tue Oct 19 07:16:11 1999 +0000
+++ b/lib-src/emacsserver.c	Tue Oct 19 07:17:20 1999 +0000
@@ -1,5 +1,5 @@
 /* Communication subprocess for GNU Emacs acting as server.
-   Copyright (C) 1986, 1987, 1992, 1994 Free Software Foundation, Inc.
+   Copyright (C) 1986, 1987, 1992, 1994, 1999 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -26,12 +26,8 @@
    up to the Emacs which then executes them.  */
 
 #define NO_SHORTNAMES
+#include <../src/config.h>
 #include <signal.h>
-#include <../src/config.h>
-#undef read
-#undef write
-#undef open
-#undef close
 #undef signal
 
 #if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC)
@@ -65,10 +61,6 @@
 #include <unistd.h>
 #endif
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
 #ifndef errno
 extern int errno;
 #endif
--- a/lib-src/etags.c	Tue Oct 19 07:16:11 1999 +0000
+++ b/lib-src/etags.c	Tue Oct 19 07:17:20 1999 +0000
@@ -1,5 +1,5 @@
 /* Tags file maker to go with GNU Emacs
-   Copyright (C) 1984, 87, 88, 89, 93, 94, 95, 98
+   Copyright (C) 1984, 87, 88, 89, 93, 94, 95, 98, 99
    Free Software Foundation, Inc. and Ken Arnold
 
 This file is not considered part of GNU Emacs.
@@ -40,6 +40,15 @@
 # define DEBUG FALSE
 #endif
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+  /* On some systems, Emacs defines static as nothing for the sake
+     of unexec.  We don't want that here since we don't use unexec. */
+# undef static
+# define ETAGS_REGEXPS
+# define LONG_OPTIONS
+#endif
+
 #ifdef MSDOS
 # include <string.h>
 # include <fcntl.h>
@@ -54,15 +63,6 @@
 # define MAXPATHLEN _MAX_PATH
 #endif
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-  /* On some systems, Emacs defines static as nothing for the sake
-     of unexec.  We don't want that here since we don't use unexec. */
-# undef static
-# define ETAGS_REGEXPS
-# define LONG_OPTIONS
-#endif
-
 #if !defined (MSDOS) && !defined (WINDOWSNT) && defined (STDC_HEADERS)
 #include <stdlib.h>
 #include <string.h>
@@ -498,7 +498,7 @@
 print_version ()
 {
   printf ("%s (GNU Emacs %s)\n", (CTAGS) ? "ctags" : "etags", VERSION);
-  puts ("Copyright (C) 1996 Free Software Foundation, Inc. and Ken Arnold");
+  puts ("Copyright (C) 1999 Free Software Foundation, Inc. and Ken Arnold");
   puts ("This program is distributed under the same terms as Emacs");
 
   exit (GOOD);
--- a/lib-src/fakemail.c	Tue Oct 19 07:16:11 1999 +0000
+++ b/lib-src/fakemail.c	Tue Oct 19 07:17:20 1999 +0000
@@ -1,5 +1,5 @@
 /* sendmail-like interface to /bin/mail for system V,
-   Copyright (C) 1985, 1994 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1994, 1999 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -48,13 +48,6 @@
 #undef static
 #endif
 
-#ifdef read
-#undef read
-#undef write
-#undef open
-#undef close
-#endif
-
 #ifdef WINDOWSNT
 #include "ntlib.h"
 #endif
@@ -69,10 +62,6 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
 
 /* Type definitions */
 
--- a/lib-src/getopt.c	Tue Oct 19 07:16:11 1999 +0000
+++ b/lib-src/getopt.c	Tue Oct 19 07:17:20 1999 +0000
@@ -1,14 +1,10 @@
 /* Getopt for GNU.
-   NOTE: getopt is now part of the C library, so if you don't know what
-   "Keep this file name-space clean" means, talk to drepper@gnu.org
-   before changing it!
+   NOTE: The canonical source of this file is maintained with the GNU
+   C Library.  Bugs can be reported to bug-glibc@gnu.org.
 
-   Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98
+   Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
    	Free Software Foundation, Inc.
 
-   NOTE: The canonical source of this file is maintained with the GNU C Library.
-   Bugs can be reported to bug-glibc@gnu.org.
-
    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
@@ -20,9 +16,8 @@
    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.  */
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
    Ditto for AIX 3.2 and <stdlib.h>.  */
@@ -32,13 +27,13 @@
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
-#endif
-
-#if !defined __STDC__ || !__STDC__
+#else
+# if !defined __STDC__ || !__STDC__
 /* This is a separate conditional since some stdc systems
    reject `defined (const)'.  */
-# ifndef const
-#  define const
+#  ifndef const
+#   define const
+#  endif
 # endif
 #endif
 
@@ -112,7 +107,7 @@
    Also, when `ordering' is RETURN_IN_ORDER,
    each non-option ARGV-element is returned here.  */
 
-char *optarg = NULL;
+char *optarg;
 
 /* Index in ARGV of the next element to be scanned.
    This is used for communication to and from the caller
@@ -133,7 +128,7 @@
    causes problems with re-calling getopt as programs generally don't
    know that. */
 
-int __getopt_initialized = 0;
+int __getopt_initialized;
 
 /* The next char to be scanned in the option-element
    in which the last option character we returned was found.
@@ -698,16 +693,18 @@
 	      else
 		{
 		  if (opterr)
-		   if (argv[optind - 1][1] == '-')
-		    /* --option */
-		    fprintf (stderr,
-		     _("%s: option `--%s' doesn't allow an argument\n"),
-		     argv[0], pfound->name);
-		   else
-		    /* +option or -option */
-		    fprintf (stderr,
-		     _("%s: option `%c%s' doesn't allow an argument\n"),
-		     argv[0], argv[optind - 1][0], pfound->name);
+		    {
+		      if (argv[optind - 1][1] == '-')
+			/* --option */
+			fprintf (stderr,
+				 _("%s: option `--%s' doesn't allow an argument\n"),
+				 argv[0], pfound->name);
+		      else
+			/* +option or -option */
+			fprintf (stderr,
+				 _("%s: option `%c%s' doesn't allow an argument\n"),
+				 argv[0], argv[optind - 1][0], pfound->name);
+		    }
 
 		  nextchar += strlen (nextchar);
 
--- a/lib-src/getopt.h	Tue Oct 19 07:16:11 1999 +0000
+++ b/lib-src/getopt.h	Tue Oct 19 07:17:20 1999 +0000
@@ -1,9 +1,7 @@
 /* Declarations for getopt.
-   Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc.
-
+   Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc.
    NOTE: The canonical source of this file is maintained with the GNU C Library.
    Bugs can be reported to bug-glibc@gnu.org.
-
    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
@@ -20,7 +18,10 @@
    USA.  */
 
 #ifndef _GETOPT_H
-#define _GETOPT_H 1
+
+#ifndef __need_getopt
+# define _GETOPT_H 1
+#endif
 
 #ifdef	__cplusplus
 extern "C" {
@@ -57,6 +58,7 @@
 
 extern int optopt;
 
+#ifndef __need_getopt
 /* Describe the long-named options requested by the application.
    The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
    of `struct option' terminated by an element containing a name which is
@@ -80,11 +82,11 @@
 
 struct option
 {
-#if defined (__STDC__) && __STDC__
+# if defined __STDC__ && __STDC__
   const char *name;
-#else
+# else
   char *name;
-#endif
+# endif
   /* has_arg can't be an enum because some compilers complain about
      type mismatches in all the code that assumes it is an int.  */
   int has_arg;
@@ -94,40 +96,74 @@
 
 /* Names for the values of the `has_arg' field of `struct option'.  */
 
-#define	no_argument		0
-#define required_argument	1
-#define optional_argument	2
+# define no_argument		0
+# define required_argument	1
+# define optional_argument	2
+#endif	/* need getopt */
+
+
+/* Get definitions and prototypes for functions to process the
+   arguments in ARGV (ARGC of them, minus the program name) for
+   options given in OPTS.
+
+   Return the option character from OPTS just read.  Return -1 when
+   there are no more options.  For unrecognized options, or options
+   missing arguments, `optopt' is set to the option letter, and '?' is
+   returned.
 
-#if defined (__STDC__) && __STDC__
-#ifdef __GNU_LIBRARY__
+   The OPTS string is a list of characters which are recognized option
+   letters, optionally followed by colons, specifying that that letter
+   takes an argument, to be placed in `optarg'.
+
+   If a letter in OPTS is followed by two colons, its argument is
+   optional.  This behavior is specific to the GNU `getopt'.
+
+   The argument `--' causes premature termination of argument
+   scanning, explicitly telling `getopt' that there are no more
+   options.
+
+   If OPTS begins with `--', then non-option arguments are treated as
+   arguments to the option '\0'.  This behavior is specific to the GNU
+   `getopt'.  */
+
+#if defined __STDC__ && __STDC__
+# ifdef __GNU_LIBRARY__
 /* Many other libraries have conflicting prototypes for getopt, with
    differences in the consts, in stdlib.h.  To avoid compilation
    errors, only prototype getopt for the GNU C library.  */
-extern int getopt (int argc, char *const *argv, const char *shortopts);
-#else /* not __GNU_LIBRARY__ */
+extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
+# else /* not __GNU_LIBRARY__ */
 extern int getopt ();
-#endif /* __GNU_LIBRARY__ */
-extern int getopt_long (int argc, char *const *argv, const char *shortopts,
-		        const struct option *longopts, int *longind);
-extern int getopt_long_only (int argc, char *const *argv,
-			     const char *shortopts,
-		             const struct option *longopts, int *longind);
+# endif /* __GNU_LIBRARY__ */
+
+# ifndef __need_getopt
+extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
+		        const struct option *__longopts, int *__longind);
+extern int getopt_long_only (int __argc, char *const *__argv,
+			     const char *__shortopts,
+		             const struct option *__longopts, int *__longind);
 
 /* Internal only.  Users should not call this directly.  */
-extern int _getopt_internal (int argc, char *const *argv,
-			     const char *shortopts,
-		             const struct option *longopts, int *longind,
-			     int long_only);
+extern int _getopt_internal (int __argc, char *const *__argv,
+			     const char *__shortopts,
+		             const struct option *__longopts, int *__longind,
+			     int __long_only);
+# endif
 #else /* not __STDC__ */
 extern int getopt ();
+# ifndef __need_getopt
 extern int getopt_long ();
 extern int getopt_long_only ();
 
 extern int _getopt_internal ();
+# endif
 #endif /* __STDC__ */
 
 #ifdef	__cplusplus
 }
 #endif
 
+/* Make sure we later can get all the definitions and declarations.  */
+#undef __need_getopt
+
 #endif /* getopt.h */
--- a/lib-src/getopt1.c	Tue Oct 19 07:16:11 1999 +0000
+++ b/lib-src/getopt1.c	Tue Oct 19 07:17:20 1999 +0000
@@ -1,7 +1,6 @@
 /* getopt_long and getopt_long_only entry points for GNU getopt.
    Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
      Free Software Foundation, Inc.
-
    NOTE: The canonical source of this file is maintained with the GNU C Library.
    Bugs can be reported to bug-glibc@gnu.org.
 
@@ -16,16 +15,12 @@
    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.  */
+   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
-
-#include "getopt.h"
-
+#else
 #if !defined __STDC__ || !__STDC__
 /* This is a separate conditional since some stdc systems
    reject `defined (const)'.  */
@@ -33,6 +28,9 @@
 #define const
 #endif
 #endif
+#endif
+
+#include "getopt.h"
 
 #include <stdio.h>
 
--- a/lib-src/make-docfile.c	Tue Oct 19 07:16:11 1999 +0000
+++ b/lib-src/make-docfile.c	Tue Oct 19 07:17:20 1999 +0000
@@ -1,5 +1,5 @@
 /* Generate doc-string file for GNU Emacs from source files.
-   Copyright (C) 1985, 1986, 92, 93, 94, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1985, 86, 92, 93, 94, 97, 1999 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -72,10 +72,6 @@
 #include <unistd.h>
 #endif
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
 /* Stdio stream for output to the DOC file.  */
 FILE *outfile;
 
--- a/lib-src/movemail.c	Tue Oct 19 07:16:11 1999 +0000
+++ b/lib-src/movemail.c	Tue Oct 19 07:17:20 1999 +0000
@@ -1,6 +1,6 @@
 /* movemail foo bar -- move file foo to file bar,
    locking file foo the way /bin/mail respects.
-   Copyright (C) 1986, 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1986, 92, 93, 94, 96, 1999 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -100,12 +100,6 @@
 int _fmode = _O_BINARY;
 #endif /* WINDOWSNT */
 
-/* Cancel substitutions made by config.h for Emacs.  */
-#undef open
-#undef read
-#undef write
-#undef close
-
 #ifdef USG
 #include <fcntl.h>
 #include <unistd.h>
@@ -121,10 +115,6 @@
 #include <unistd.h>
 #endif
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
 #if defined (XENIX) || defined (WINDOWSNT)
 #include <sys/locking.h>
 #endif
--- a/lib-src/pop.c	Tue Oct 19 07:16:11 1999 +0000
+++ b/lib-src/pop.c	Tue Oct 19 07:17:20 1999 +0000
@@ -1,5 +1,5 @@
 /* pop.c: client routines for talking to a POP3-protocol post-office server
-   Copyright (c) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (c) 1991, 1993, 1996, 1997, 1999 Free Software Foundation, Inc.
    Written by Jonathan Kamens, jik@security.ov.com.
 
 This file is part of GNU Emacs.
@@ -28,14 +28,6 @@
 
 #ifdef MAIL_USE_POP
 
-#ifdef HAVE_CONFIG_H
-/* Cancel these substitutions made in config.h */
-#undef open
-#undef read
-#undef write
-#undef close
-#endif
-
 #include <sys/types.h>
 #ifdef WINDOWSNT
 #include "ntlib.h"
@@ -76,9 +68,6 @@
 #include <string.h>
 #define index strchr
 #endif
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
--- a/lib-src/profile.c	Tue Oct 19 07:16:11 1999 +0000
+++ b/lib-src/profile.c	Tue Oct 19 07:17:20 1999 +0000
@@ -1,5 +1,5 @@
 /* profile.c --- generate periodic events for profiling of Emacs Lisp code.
- Copyright (C) 1992, 1994 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1994, 1999 Free Software Foundation, Inc.
 
  Author: Boaz Ben-Zvi <boaz@lcs.mit.edu>
 
@@ -30,8 +30,8 @@
  **  abstraction : a stopwatch
  **  operations: reset_watch, get_time
  */
+#include <../src/config.h>
 #include <stdio.h>
-#include <../src/config.h>
 #include <../src/systime.h>
 
 static EMACS_TIME TV1, TV2;
--- a/lib-src/test-distrib.c	Tue Oct 19 07:16:11 1999 +0000
+++ b/lib-src/test-distrib.c	Tue Oct 19 07:17:20 1999 +0000
@@ -2,12 +2,6 @@
 #include <config.h>
 #endif
 
-/* Cancel substitutions made by config.h for Emacs.  */
-#undef open
-#undef read
-#undef write
-#undef close
-
 #include <stdio.h>
 
 #ifdef HAVE_UNISTD_H