Add support for large files. Merge glibc 2.1.2.
authorPaul Eggert <eggert@twinsun.com>
Tue, 19 Oct 1999 07:17:20 +0000 (07:17 +0000)
committerPaul Eggert <eggert@twinsun.com>
Tue, 19 Oct 1999 07:17:20 +0000 (07:17 +0000)
* 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.

14 files changed:
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

index 44785de..615d86f 100644 (file)
@@ -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.
index 6a2fcff..4607dce 100644 (file)
 /* 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
 #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
index a08eab6..11946ff 100644 (file)
@@ -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 @@ Boston, MA 02111-1307, USA.  */
 
 #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
index 541e57d..fd532ce 100644 (file)
@@ -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 @@ Boston, MA 02111-1307, USA.  */
    up to the Emacs which then executes them.  */
 
 #define NO_SHORTNAMES
-#include <signal.h>
 #include <../src/config.h>
-#undef read
-#undef write
-#undef open
-#undef close
+#include <signal.h>
 #undef signal
 
 #if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC)
@@ -65,10 +61,6 @@ void fatal_error ();
 #include <unistd.h>
 #endif
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
 #ifndef errno
 extern int errno;
 #endif
index 31308bf..83a9f65 100644 (file)
@@ -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 @@ char pot_etags_version[] = "@(#) pot revision number is 12.11";
 # 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 @@ char pot_etags_version[] = "@(#) pot revision number is 12.11";
 # 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 @@ void
 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);
index 946165c..c4354ab 100644 (file)
@@ -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 @@ main ()
 #undef static
 #endif
 
-#ifdef read
-#undef read
-#undef write
-#undef open
-#undef close
-#endif
-
 #ifdef WINDOWSNT
 #include "ntlib.h"
 #endif
@@ -69,10 +62,6 @@ main ()
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
 \f
 /* Type definitions */
 
index 03effcb..d176d3e 100644 (file)
@@ -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.  */
 \f
 /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
    Ditto for AIX 3.2 and <stdlib.h>.  */
 
 #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
 
    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 @@ int optind = 1;
    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 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
              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);
 
index fb30719..ac6728f 100644 (file)
@@ -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
    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 opterr;
 
 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 @@ extern int optopt;
 
 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 @@ struct option
 
 /* 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.
 
-#if defined (__STDC__) && __STDC__
-#ifdef __GNU_LIBRARY__
+   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.
+
+   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 */
index ff25737..9c82565 100644 (file)
@@ -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.
 
    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.  */
 \f
 #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>
 
index 3045dc3..84c0c9d 100644 (file)
@@ -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 @@ int scan_c_file ();
 #include <unistd.h>
 #endif
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
 /* Stdio stream for output to the DOC file.  */
 FILE *outfile;
 
index 85a2861..df5cb5a 100644 (file)
@@ -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 @@ Boston, MA 02111-1307, USA.  */
 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 @@ int _fmode = _O_BINARY;
 #include <unistd.h>
 #endif
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
 #if defined (XENIX) || defined (WINDOWSNT)
 #include <sys/locking.h>
 #endif
index 57a5b19..c6b86e5 100644 (file)
@@ -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 @@ Boston, MA 02111-1307, USA.  */
 
 #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 @@ extern struct servent *hes_getservbyname (/* char *, char * */);
 #include <string.h>
 #define index strchr
 #endif
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
index 2b27ce0..3c76f8e 100644 (file)
@@ -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 @@ Boston, MA 02111-1307, USA.  */
  **  abstraction : a stopwatch
  **  operations: reset_watch, get_time
  */
-#include <stdio.h>
 #include <../src/config.h>
+#include <stdio.h>
 #include <../src/systime.h>
 
 static EMACS_TIME TV1, TV2;
index 79d899a..c2e9a25 100644 (file)
@@ -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