From 4c159323f3c6e5e4ed295576eb7d20007e17cfd4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 19 Oct 1999 07:17:20 +0000 Subject: 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 , as does this now. * b2m.c, emacsserver.c, etags.c, profile.c: Include 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. --- lib-src/ChangeLog | 20 ++++++++++++ lib-src/b2m.c | 16 ++++------ lib-src/emacsclient.c | 9 +----- lib-src/emacsserver.c | 12 ++------ lib-src/etags.c | 22 ++++++------- lib-src/fakemail.c | 13 +------- lib-src/getopt.c | 51 +++++++++++++++--------------- lib-src/getopt.h | 84 +++++++++++++++++++++++++++++++++++--------------- lib-src/getopt1.c | 14 ++++----- lib-src/make-docfile.c | 6 +--- lib-src/movemail.c | 12 +------- lib-src/pop.c | 13 +------- lib-src/profile.c | 4 +-- lib-src/test-distrib.c | 6 ---- 14 files changed, 136 insertions(+), 146 deletions(-) (limited to 'lib-src') diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 44785dee3a2..615d86f3e37 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,23 @@ +1999-10-19 Paul Eggert + + 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 , as does this now. + + * b2m.c, emacsserver.c, etags.c, profile.c: + Include 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 * Makefile.in (pop.o): Depend on config.h. diff --git a/lib-src/b2m.c b/lib-src/b2m.c index 6a2fcff9a21..4607dcea05d 100644 --- a/lib-src/b2m.c +++ b/lib-src/b2m.c @@ -18,14 +18,6 @@ /* Made conformant to the GNU coding standards January, 1995 by Francesco Potorti` . */ -#include -#include -#include -#include -#ifdef MSDOS -#include -#endif - #ifdef HAVE_CONFIG_H #include /* On some systems, Emacs defines static as nothing for the sake @@ -33,8 +25,12 @@ #undef static #endif -#ifdef STDC_HEADERS -#include +#include +#include +#include +#include +#ifdef MSDOS +#include #endif #undef TRUE diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index a08eab6ec0b..11946ff2ec0 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -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 #include -#ifdef STDC_HEADERS -#include -#endif #ifdef HAVE_UNISTD_H #include #endif diff --git a/lib-src/emacsserver.c b/lib-src/emacsserver.c index 541e57dcca0..fd532ce976c 100644 --- a/lib-src/emacsserver.c +++ b/lib-src/emacsserver.c @@ -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 #include <../src/config.h> -#undef read -#undef write -#undef open -#undef close +#include #undef signal #if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC) @@ -65,10 +61,6 @@ void fatal_error (); #include #endif -#ifdef STDC_HEADERS -#include -#endif - #ifndef errno extern int errno; #endif diff --git a/lib-src/etags.c b/lib-src/etags.c index 31308bf23e8..83a9f65f6ca 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -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 + /* 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 # include @@ -54,15 +63,6 @@ char pot_etags_version[] = "@(#) pot revision number is 12.11"; # define MAXPATHLEN _MAX_PATH #endif -#ifdef HAVE_CONFIG_H -# include - /* 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 #include @@ -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); diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c index 946165c2a28..c4354ab45a2 100644 --- a/lib-src/fakemail.c +++ b/lib-src/fakemail.c @@ -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 #endif - -#ifdef STDC_HEADERS -#include -#endif /* Type definitions */ diff --git a/lib-src/getopt.c b/lib-src/getopt.c index 03effcbdb3e..d176d3e7e72 100644 --- a/lib-src/getopt.c +++ b/lib-src/getopt.c @@ -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 . Ditto for AIX 3.2 and . */ @@ -32,13 +27,13 @@ #ifdef HAVE_CONFIG_H # include -#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 @@ 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); diff --git a/lib-src/getopt.h b/lib-src/getopt.h index fb30719a860..ac6728f83d4 100644 --- a/lib-src/getopt.h +++ b/lib-src/getopt.h @@ -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 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 */ diff --git a/lib-src/getopt1.c b/lib-src/getopt1.c index ff257374c33..9c8256567c4 100644 --- a/lib-src/getopt1.c +++ b/lib-src/getopt1.c @@ -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 -#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 diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 3045dc305f2..84c0c9d113d 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -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 #endif -#ifdef STDC_HEADERS -#include -#endif - /* Stdio stream for output to the DOC file. */ FILE *outfile; diff --git a/lib-src/movemail.c b/lib-src/movemail.c index 85a28615e42..df5cb5a2d1f 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -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 #include @@ -121,10 +115,6 @@ int _fmode = _O_BINARY; #include #endif -#ifdef STDC_HEADERS -#include -#endif - #if defined (XENIX) || defined (WINDOWSNT) #include #endif diff --git a/lib-src/pop.c b/lib-src/pop.c index 57a5b197b0b..c6b86e5a2dc 100644 --- a/lib-src/pop.c +++ b/lib-src/pop.c @@ -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 #ifdef WINDOWSNT #include "ntlib.h" @@ -76,9 +68,6 @@ extern struct servent *hes_getservbyname (/* char *, char * */); #include #define index strchr #endif -#ifdef STDC_HEADERS -#include -#endif #ifdef HAVE_UNISTD_H #include #endif diff --git a/lib-src/profile.c b/lib-src/profile.c index 2b27ce06119..3c76f8ed183 100644 --- a/lib-src/profile.c +++ b/lib-src/profile.c @@ -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 @@ -30,8 +30,8 @@ Boston, MA 02111-1307, USA. */ ** abstraction : a stopwatch ** operations: reset_watch, get_time */ -#include #include <../src/config.h> +#include #include <../src/systime.h> static EMACS_TIME TV1, TV2; diff --git a/lib-src/test-distrib.c b/lib-src/test-distrib.c index 79d899a280c..c2e9a2510ed 100644 --- a/lib-src/test-distrib.c +++ b/lib-src/test-distrib.c @@ -2,12 +2,6 @@ #include #endif -/* Cancel substitutions made by config.h for Emacs. */ -#undef open -#undef read -#undef write -#undef close - #include #ifdef HAVE_UNISTD_H -- cgit v1.2.1