Commit 4ee9629e authored by Paul Eggert's avatar Paul Eggert
Browse files

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.
parent 09ed9b3c
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> 1999-10-15 Dave Love <fx@gnu.org>
* Makefile.in (pop.o): Depend on config.h. * Makefile.in (pop.o): Depend on config.h.
......
...@@ -18,14 +18,6 @@ ...@@ -18,14 +18,6 @@
/* Made conformant to the GNU coding standards January, 1995 /* Made conformant to the GNU coding standards January, 1995
by Francesco Potorti` <pot@cnuce.cnr.it>. */ 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 #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
/* On some systems, Emacs defines static as nothing for the sake /* On some systems, Emacs defines static as nothing for the sake
...@@ -33,8 +25,12 @@ ...@@ -33,8 +25,12 @@
#undef static #undef static
#endif #endif
#ifdef STDC_HEADERS #include <stdio.h>
#include <stdlib.h> #include <time.h>
#include <sys/types.h>
#include <getopt.h>
#ifdef MSDOS
#include <fcntl.h>
#endif #endif
#undef TRUE #undef TRUE
......
/* Client process that communicates with GNU Emacs acting as server. /* 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. This file is part of GNU Emacs.
...@@ -21,17 +21,10 @@ Boston, MA 02111-1307, USA. */ ...@@ -21,17 +21,10 @@ Boston, MA 02111-1307, USA. */
#define NO_SHORTNAMES #define NO_SHORTNAMES
#include <../src/config.h> #include <../src/config.h>
#undef read
#undef write
#undef open
#undef close
#undef signal #undef signal
#include <stdio.h> #include <stdio.h>
#include <getopt.h> #include <getopt.h>
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
......
/* Communication subprocess for GNU Emacs acting as server. /* 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. This file is part of GNU Emacs.
...@@ -26,12 +26,8 @@ Boston, MA 02111-1307, USA. */ ...@@ -26,12 +26,8 @@ Boston, MA 02111-1307, USA. */
up to the Emacs which then executes them. */ up to the Emacs which then executes them. */
#define NO_SHORTNAMES #define NO_SHORTNAMES
#include <signal.h>
#include <../src/config.h> #include <../src/config.h>
#undef read #include <signal.h>
#undef write
#undef open
#undef close
#undef signal #undef signal
#if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC) #if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC)
...@@ -65,10 +61,6 @@ void fatal_error (); ...@@ -65,10 +61,6 @@ void fatal_error ();
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifndef errno #ifndef errno
extern int errno; extern int errno;
#endif #endif
......
/* Tags file maker to go with GNU Emacs /* 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 Free Software Foundation, Inc. and Ken Arnold
This file is not considered part of GNU Emacs. This file is not considered part of GNU Emacs.
...@@ -40,6 +40,15 @@ char pot_etags_version[] = "@(#) pot revision number is 12.11"; ...@@ -40,6 +40,15 @@ char pot_etags_version[] = "@(#) pot revision number is 12.11";
# define DEBUG FALSE # define DEBUG FALSE
#endif #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 #ifdef MSDOS
# include <string.h> # include <string.h>
# include <fcntl.h> # include <fcntl.h>
...@@ -54,15 +63,6 @@ char pot_etags_version[] = "@(#) pot revision number is 12.11"; ...@@ -54,15 +63,6 @@ char pot_etags_version[] = "@(#) pot revision number is 12.11";
# define MAXPATHLEN _MAX_PATH # define MAXPATHLEN _MAX_PATH
#endif #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) #if !defined (MSDOS) && !defined (WINDOWSNT) && defined (STDC_HEADERS)
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -498,7 +498,7 @@ void ...@@ -498,7 +498,7 @@ void
print_version () print_version ()
{ {
printf ("%s (GNU Emacs %s)\n", (CTAGS) ? "ctags" : "etags", 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"); puts ("This program is distributed under the same terms as Emacs");
exit (GOOD); exit (GOOD);
......
/* sendmail-like interface to /bin/mail for system V, /* 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. This file is part of GNU Emacs.
...@@ -48,13 +48,6 @@ main () ...@@ -48,13 +48,6 @@ main ()
#undef static #undef static
#endif #endif
#ifdef read
#undef read
#undef write
#undef open
#undef close
#endif
#ifdef WINDOWSNT #ifdef WINDOWSNT
#include "ntlib.h" #include "ntlib.h"
#endif #endif
...@@ -69,10 +62,6 @@ main () ...@@ -69,10 +62,6 @@ main ()
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
/* Type definitions */ /* Type definitions */
......
/* Getopt for GNU. /* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what NOTE: The canonical source of this file is maintained with the GNU
"Keep this file name-space clean" means, talk to drepper@gnu.org C Library. Bugs can be reported to bug-glibc@gnu.org.
before changing it!
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. 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 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 under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any Free Software Foundation; either version 2, or (at your option) any
...@@ -20,9 +16,8 @@ ...@@ -20,9 +16,8 @@
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software Foundation,
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
USA. */
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */ Ditto for AIX 3.2 and <stdlib.h>. */
...@@ -32,13 +27,13 @@ ...@@ -32,13 +27,13 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #else
# if !defined __STDC__ || !__STDC__
#if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems /* This is a separate conditional since some stdc systems
reject `defined (const)'. */ reject `defined (const)'. */
# ifndef const # ifndef const
# define const # define const
# endif
# endif # endif
#endif #endif
...@@ -112,7 +107,7 @@ ...@@ -112,7 +107,7 @@
Also, when `ordering' is RETURN_IN_ORDER, Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */ each non-option ARGV-element is returned here. */
char *optarg = NULL; char *optarg;
/* Index in ARGV of the next element to be scanned. /* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller This is used for communication to and from the caller
...@@ -133,7 +128,7 @@ int optind = 1; ...@@ -133,7 +128,7 @@ int optind = 1;
causes problems with re-calling getopt as programs generally don't causes problems with re-calling getopt as programs generally don't
know that. */ know that. */
int __getopt_initialized = 0; int __getopt_initialized;
/* The next char to be scanned in the option-element /* The next char to be scanned in the option-element
in which the last option character we returned was found. in which the last option character we returned was found.
...@@ -698,16 +693,18 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) ...@@ -698,16 +693,18 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
else else
{ {
if (opterr) if (opterr)
if (argv[optind - 1][1] == '-') {
/* --option */ if (argv[optind - 1][1] == '-')
fprintf (stderr, /* --option */
_("%s: option `--%s' doesn't allow an argument\n"), fprintf (stderr,
argv[0], pfound->name); _("%s: option `--%s' doesn't allow an argument\n"),
else argv[0], pfound->name);
/* +option or -option */ else
fprintf (stderr, /* +option or -option */
_("%s: option `%c%s' doesn't allow an argument\n"), fprintf (stderr,
argv[0], argv[optind - 1][0], pfound->name); _("%s: option `%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
}
nextchar += strlen (nextchar); nextchar += strlen (nextchar);
......
/* Declarations for getopt. /* 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. NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org. Bugs can be reported to bug-glibc@gnu.org.
This program is free software; you can redistribute it and/or modify it 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 under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any Free Software Foundation; either version 2, or (at your option) any
...@@ -20,7 +18,10 @@ ...@@ -20,7 +18,10 @@
USA. */ USA. */
#ifndef _GETOPT_H #ifndef _GETOPT_H
#define _GETOPT_H 1
#ifndef __need_getopt
# define _GETOPT_H 1
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
...@@ -57,6 +58,7 @@ extern int opterr; ...@@ -57,6 +58,7 @@ extern int opterr;
extern int optopt; extern int optopt;
#ifndef __need_getopt
/* Describe the long-named options requested by the application. /* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector 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 of `struct option' terminated by an element containing a name which is
...@@ -80,11 +82,11 @@ extern int optopt; ...@@ -80,11 +82,11 @@ extern int optopt;
struct option struct option
{ {
#if defined (__STDC__) && __STDC__ # if defined __STDC__ && __STDC__
const char *name; const char *name;
#else # else
char *name; char *name;
#endif # endif
/* has_arg can't be an enum because some compilers complain about /* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */ type mismatches in all the code that assumes it is an int. */
int has_arg; int has_arg;
...@@ -94,40 +96,74 @@ struct option ...@@ -94,40 +96,74 @@ struct option
/* Names for the values of the `has_arg' field of `struct option'. */ /* Names for the values of the `has_arg' field of `struct option'. */
#define no_argument 0 # define no_argument 0
#define required_argument 1 # define required_argument 1
#define optional_argument 2 # 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__ Return the option character from OPTS just read. Return -1 when
#ifdef __GNU_LIBRARY__ 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 /* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */ errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts); extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
#else /* not __GNU_LIBRARY__ */ # else /* not __GNU_LIBRARY__ */
extern int getopt (); extern int getopt ();
#endif /* __GNU_LIBRARY__ */ # endif /* __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind); # ifndef __need_getopt
extern int getopt_long_only (int argc, char *const *argv, extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
const char *shortopts, const struct option *__longopts, int *__longind);
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. */ /* Internal only. Users should not call this directly. */
extern int _getopt_internal (int argc, char *const *argv, extern int _getopt_internal (int __argc, char *const *__argv,
const char *shortopts, const char *__shortopts,
const struct option *longopts, int *longind, const struct option *__longopts, int *__longind,
int long_only); int __long_only);
# endif
#else /* not __STDC__ */ #else /* not __STDC__ */
extern int getopt (); extern int getopt ();
# ifndef __need_getopt
extern int getopt_long (); extern int getopt_long ();
extern int getopt_long_only (); extern int getopt_long_only ();
extern int _getopt_internal (); extern int _getopt_internal ();
# endif
#endif /* __STDC__ */ #endif /* __STDC__ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* Make sure we later can get all the definitions and declarations. */
#undef __need_getopt
#endif /* getopt.h */ #endif /* getopt.h */
/* getopt_long and getopt_long_only entry points for GNU getopt. /* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
Free Software Foundation, Inc. Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library. NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org. Bugs can be reported to bug-glibc@gnu.org.
...@@ -16,16 +15,12 @@ ...@@ -16,16 +15,12 @@
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software Foundation,
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
USA. */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #else
#include "getopt.h"
#if !defined __STDC__ || !__STDC__ #if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems /* This is a separate conditional since some stdc systems
reject `defined (const)'. */ reject `defined (const)'. */
...@@ -33,6 +28,9 @@ ...@@ -33,6 +28,9 @@
#define const #define const
#endif #endif
#endif #endif
#endif
#include "getopt.h"
#include <stdio.h> #include <stdio.h>
......
/* Generate doc-string file for GNU Emacs from source files. /* 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. This file is part of GNU Emacs.
...@@ -72,10 +72,6 @@ int scan_c_file (); ...@@ -72,10 +72,6 @@ int scan_c_file ();
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
/* Stdio stream for output to the DOC file. */ /* Stdio stream for output to the DOC file. */
FILE *outfile; FILE *outfile;
......
/* movemail foo bar -- move file foo to file bar, /* movemail foo bar -- move file foo to file bar,
locking file foo the way /bin/mail respects. 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. This file is part of GNU Emacs.
...@@ -100,12 +100,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -100,12 +100,6 @@ Boston, MA 02111-1307, USA. */
int _fmode = _O_BINARY; int _fmode = _O_BINARY;
#endif /* WINDOWSNT */ #endif /* WINDOWSNT */
/* Cancel substitutions made by config.h for Emacs. */
#undef open
#undef read
#undef write
#undef close
#ifdef USG #ifdef USG
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h>