mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-05-18 19:06:18 -07:00
auto upstream
This commit is contained in:
commit
c655adbbab
21 changed files with 517 additions and 357 deletions
|
|
@ -1,3 +1,7 @@
|
|||
2013-01-11 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* lib/getopt_.h: Regenerate.
|
||||
|
||||
2013-01-10 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Merge from gnulib, incorporating:
|
||||
|
|
|
|||
568
lib/getopt_.h
568
lib/getopt_.h
|
|
@ -1,283 +1,285 @@
|
|||
/* Declarations for getopt.
|
||||
Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2013 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GL_GETOPT_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. We must
|
||||
also inform the replacement unistd.h to not recursively use
|
||||
<getopt.h>; our definitions will be present soon enough. */
|
||||
#if HAVE_GETOPT_H
|
||||
# define _GL_SYSTEM_GETOPT
|
||||
# ifndef __GNUC__
|
||||
# include <next_getopt.h>
|
||||
# else
|
||||
# include_next <getopt.h>
|
||||
# endif
|
||||
# undef _GL_SYSTEM_GETOPT
|
||||
#endif
|
||||
|
||||
#ifndef _GL_GETOPT_H
|
||||
|
||||
#ifndef __need_getopt
|
||||
# define _GL_GETOPT_H 1
|
||||
#endif
|
||||
|
||||
/* Standalone applications should #define __GETOPT_PREFIX to an
|
||||
identifier that prefixes the external functions and variables
|
||||
defined in this header. When this happens, include the
|
||||
headers that might declare getopt so that they will not cause
|
||||
confusion if included after this file (if the system had <getopt.h>,
|
||||
we have already included it). Then systematically rename
|
||||
identifiers so that they do not collide with the system functions
|
||||
and variables. Renaming avoids problems with some compilers and
|
||||
linkers. */
|
||||
#if defined __GETOPT_PREFIX && !defined __need_getopt
|
||||
# if !HAVE_GETOPT_H
|
||||
# include <stdlib.h>
|
||||
# include <stdio.h>
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
# undef __need_getopt
|
||||
# undef getopt
|
||||
# undef getopt_long
|
||||
# undef getopt_long_only
|
||||
# undef optarg
|
||||
# undef opterr
|
||||
# undef optind
|
||||
# undef optopt
|
||||
# undef option
|
||||
# define __GETOPT_CONCAT(x, y) x ## y
|
||||
# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
|
||||
# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
|
||||
# define getopt __GETOPT_ID (getopt)
|
||||
# define getopt_long __GETOPT_ID (getopt_long)
|
||||
# define getopt_long_only __GETOPT_ID (getopt_long_only)
|
||||
# define optarg __GETOPT_ID (optarg)
|
||||
# define opterr __GETOPT_ID (opterr)
|
||||
# define optind __GETOPT_ID (optind)
|
||||
# define optopt __GETOPT_ID (optopt)
|
||||
# define option __GETOPT_ID (option)
|
||||
# define _getopt_internal __GETOPT_ID (getopt_internal)
|
||||
#endif
|
||||
|
||||
/* Standalone applications get correct prototypes for getopt_long and
|
||||
getopt_long_only; they declare "char **argv". libc uses prototypes
|
||||
with "char *const *argv" that are incorrect because getopt_long and
|
||||
getopt_long_only can permute argv; this is required for backward
|
||||
compatibility (e.g., for LSB 2.0.1).
|
||||
|
||||
This used to be '#if defined __GETOPT_PREFIX && !defined __need_getopt',
|
||||
but it caused redefinition warnings if both unistd.h and getopt.h were
|
||||
included, since unistd.h includes getopt.h having previously defined
|
||||
__need_getopt.
|
||||
|
||||
The only place where __getopt_argv_const is used is in definitions
|
||||
of getopt_long and getopt_long_only below, but these are visible
|
||||
only if __need_getopt is not defined, so it is quite safe to rewrite
|
||||
the conditional as follows:
|
||||
*/
|
||||
#if !defined __need_getopt
|
||||
# if defined __GETOPT_PREFIX
|
||||
# define __getopt_argv_const /* empty */
|
||||
# else
|
||||
# define __getopt_argv_const const
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* If __GNU_LIBRARY__ is not already defined, either we are being used
|
||||
standalone, or this is the first header included in the source file.
|
||||
If we are being used with glibc, we need to include <features.h>, but
|
||||
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
|
||||
not defined, include <ctype.h>, which will pull in <features.h> for us
|
||||
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
|
||||
doesn't flood the namespace with stuff the way some other headers do.) */
|
||||
#if !defined __GNU_LIBRARY__
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
|
||||
#ifndef __THROW
|
||||
# ifndef __GNUC_PREREQ
|
||||
# define __GNUC_PREREQ(maj, min) (0)
|
||||
# endif
|
||||
# if defined __cplusplus && __GNUC_PREREQ (2,8)
|
||||
# define __THROW throw ()
|
||||
# else
|
||||
# define __THROW
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The definition of _GL_ARG_NONNULL is copied here. */
|
||||
/* A C macro for declaring that specific arguments must not be NULL.
|
||||
Copyright (C) 2009-2012 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
|
||||
that the values passed as arguments n, ..., m must be non-NULL pointers.
|
||||
n = 1 stands for the first argument, n = 2 for the second argument etc. */
|
||||
#ifndef _GL_ARG_NONNULL
|
||||
# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
|
||||
# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
|
||||
# else
|
||||
# define _GL_ARG_NONNULL(params)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* For communication from 'getopt' to the caller.
|
||||
When 'getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when 'ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
extern char *optarg;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to 'getopt'.
|
||||
|
||||
On entry to 'getopt', zero means this is the first call; initialize.
|
||||
|
||||
When 'getopt' returns -1, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, 'optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
extern int optind;
|
||||
|
||||
/* Callers store zero here to inhibit the error message 'getopt' prints
|
||||
for unrecognized options. */
|
||||
|
||||
extern int opterr;
|
||||
|
||||
/* Set to an option character which was unrecognized. */
|
||||
|
||||
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
|
||||
zero.
|
||||
|
||||
The field 'has_arg' is:
|
||||
no_argument (or 0) if the option does not take an argument,
|
||||
required_argument (or 1) if the option requires an argument,
|
||||
optional_argument (or 2) if the option takes an optional argument.
|
||||
|
||||
If the field 'flag' is not NULL, it points to a variable that is set
|
||||
to the value given in the field 'val' when the option is found, but
|
||||
left unchanged if the option is not found.
|
||||
|
||||
To have a long-named option do something other than set an 'int' to
|
||||
a compiled-in constant, such as set a value from 'optarg', set the
|
||||
option's 'flag' field to zero and its 'val' field to a nonzero
|
||||
value (the equivalent single-letter option character, if there is
|
||||
one). For long options that have a zero 'flag' field, 'getopt'
|
||||
returns the contents of the 'val' field. */
|
||||
|
||||
# if !GNULIB_defined_struct_option
|
||||
struct option
|
||||
{
|
||||
const char *name;
|
||||
/* 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;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
# define GNULIB_defined_struct_option 1
|
||||
# endif
|
||||
|
||||
/* Names for the values of the 'has_arg' field of 'struct option'. */
|
||||
|
||||
# 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.
|
||||
|
||||
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 '\1'. This behavior is specific to the GNU
|
||||
'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in
|
||||
the environment, then do not permute arguments. */
|
||||
|
||||
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
|
||||
__THROW _GL_ARG_NONNULL ((2, 3));
|
||||
|
||||
#ifndef __need_getopt
|
||||
extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind)
|
||||
__THROW _GL_ARG_NONNULL ((2, 3));
|
||||
extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind)
|
||||
__THROW _GL_ARG_NONNULL ((2, 3));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Make sure we later can get all the definitions and declarations. */
|
||||
#undef __need_getopt
|
||||
|
||||
#endif /* _GL_GETOPT_H */
|
||||
#endif /* _GL_GETOPT_H */
|
||||
/* Declarations for getopt.
|
||||
Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2013 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GL_GETOPT_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. We must
|
||||
also inform the replacement unistd.h to not recursively use
|
||||
<getopt.h>; our definitions will be present soon enough. */
|
||||
#if HAVE_GETOPT_H
|
||||
# define _GL_SYSTEM_GETOPT
|
||||
# ifndef __GNUC__
|
||||
# include <next_getopt.h>
|
||||
# else
|
||||
# include_next <getopt.h>
|
||||
# endif
|
||||
# undef _GL_SYSTEM_GETOPT
|
||||
#endif
|
||||
|
||||
#ifndef _GL_GETOPT_H
|
||||
|
||||
#ifndef __need_getopt
|
||||
# define _GL_GETOPT_H 1
|
||||
#endif
|
||||
|
||||
/* Standalone applications should #define __GETOPT_PREFIX to an
|
||||
identifier that prefixes the external functions and variables
|
||||
defined in this header. When this happens, include the
|
||||
headers that might declare getopt so that they will not cause
|
||||
confusion if included after this file (if the system had <getopt.h>,
|
||||
we have already included it). Then systematically rename
|
||||
identifiers so that they do not collide with the system functions
|
||||
and variables. Renaming avoids problems with some compilers and
|
||||
linkers. */
|
||||
#if defined __GETOPT_PREFIX && !defined __need_getopt
|
||||
# if !HAVE_GETOPT_H
|
||||
# define __need_system_stdlib_h
|
||||
# include <stdlib.h>
|
||||
# undef __need_system_stdlib_h
|
||||
# include <stdio.h>
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
# undef __need_getopt
|
||||
# undef getopt
|
||||
# undef getopt_long
|
||||
# undef getopt_long_only
|
||||
# undef optarg
|
||||
# undef opterr
|
||||
# undef optind
|
||||
# undef optopt
|
||||
# undef option
|
||||
# define __GETOPT_CONCAT(x, y) x ## y
|
||||
# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
|
||||
# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
|
||||
# define getopt __GETOPT_ID (getopt)
|
||||
# define getopt_long __GETOPT_ID (getopt_long)
|
||||
# define getopt_long_only __GETOPT_ID (getopt_long_only)
|
||||
# define optarg __GETOPT_ID (optarg)
|
||||
# define opterr __GETOPT_ID (opterr)
|
||||
# define optind __GETOPT_ID (optind)
|
||||
# define optopt __GETOPT_ID (optopt)
|
||||
# define option __GETOPT_ID (option)
|
||||
# define _getopt_internal __GETOPT_ID (getopt_internal)
|
||||
#endif
|
||||
|
||||
/* Standalone applications get correct prototypes for getopt_long and
|
||||
getopt_long_only; they declare "char **argv". libc uses prototypes
|
||||
with "char *const *argv" that are incorrect because getopt_long and
|
||||
getopt_long_only can permute argv; this is required for backward
|
||||
compatibility (e.g., for LSB 2.0.1).
|
||||
|
||||
This used to be '#if defined __GETOPT_PREFIX && !defined __need_getopt',
|
||||
but it caused redefinition warnings if both unistd.h and getopt.h were
|
||||
included, since unistd.h includes getopt.h having previously defined
|
||||
__need_getopt.
|
||||
|
||||
The only place where __getopt_argv_const is used is in definitions
|
||||
of getopt_long and getopt_long_only below, but these are visible
|
||||
only if __need_getopt is not defined, so it is quite safe to rewrite
|
||||
the conditional as follows:
|
||||
*/
|
||||
#if !defined __need_getopt
|
||||
# if defined __GETOPT_PREFIX
|
||||
# define __getopt_argv_const /* empty */
|
||||
# else
|
||||
# define __getopt_argv_const const
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* If __GNU_LIBRARY__ is not already defined, either we are being used
|
||||
standalone, or this is the first header included in the source file.
|
||||
If we are being used with glibc, we need to include <features.h>, but
|
||||
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
|
||||
not defined, include <ctype.h>, which will pull in <features.h> for us
|
||||
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
|
||||
doesn't flood the namespace with stuff the way some other headers do.) */
|
||||
#if !defined __GNU_LIBRARY__
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
|
||||
#ifndef __THROW
|
||||
# ifndef __GNUC_PREREQ
|
||||
# define __GNUC_PREREQ(maj, min) (0)
|
||||
# endif
|
||||
# if defined __cplusplus && __GNUC_PREREQ (2,8)
|
||||
# define __THROW throw ()
|
||||
# else
|
||||
# define __THROW
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The definition of _GL_ARG_NONNULL is copied here. */
|
||||
/* A C macro for declaring that specific arguments must not be NULL.
|
||||
Copyright (C) 2009-2013 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
|
||||
that the values passed as arguments n, ..., m must be non-NULL pointers.
|
||||
n = 1 stands for the first argument, n = 2 for the second argument etc. */
|
||||
#ifndef _GL_ARG_NONNULL
|
||||
# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
|
||||
# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
|
||||
# else
|
||||
# define _GL_ARG_NONNULL(params)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* For communication from 'getopt' to the caller.
|
||||
When 'getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when 'ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
extern char *optarg;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to 'getopt'.
|
||||
|
||||
On entry to 'getopt', zero means this is the first call; initialize.
|
||||
|
||||
When 'getopt' returns -1, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, 'optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
extern int optind;
|
||||
|
||||
/* Callers store zero here to inhibit the error message 'getopt' prints
|
||||
for unrecognized options. */
|
||||
|
||||
extern int opterr;
|
||||
|
||||
/* Set to an option character which was unrecognized. */
|
||||
|
||||
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
|
||||
zero.
|
||||
|
||||
The field 'has_arg' is:
|
||||
no_argument (or 0) if the option does not take an argument,
|
||||
required_argument (or 1) if the option requires an argument,
|
||||
optional_argument (or 2) if the option takes an optional argument.
|
||||
|
||||
If the field 'flag' is not NULL, it points to a variable that is set
|
||||
to the value given in the field 'val' when the option is found, but
|
||||
left unchanged if the option is not found.
|
||||
|
||||
To have a long-named option do something other than set an 'int' to
|
||||
a compiled-in constant, such as set a value from 'optarg', set the
|
||||
option's 'flag' field to zero and its 'val' field to a nonzero
|
||||
value (the equivalent single-letter option character, if there is
|
||||
one). For long options that have a zero 'flag' field, 'getopt'
|
||||
returns the contents of the 'val' field. */
|
||||
|
||||
# if !GNULIB_defined_struct_option
|
||||
struct option
|
||||
{
|
||||
const char *name;
|
||||
/* 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;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
# define GNULIB_defined_struct_option 1
|
||||
# endif
|
||||
|
||||
/* Names for the values of the 'has_arg' field of 'struct option'. */
|
||||
|
||||
# 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.
|
||||
|
||||
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 '\1'. This behavior is specific to the GNU
|
||||
'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in
|
||||
the environment, then do not permute arguments. */
|
||||
|
||||
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
|
||||
__THROW _GL_ARG_NONNULL ((2, 3));
|
||||
|
||||
#ifndef __need_getopt
|
||||
extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind)
|
||||
__THROW _GL_ARG_NONNULL ((2, 3));
|
||||
extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind)
|
||||
__THROW _GL_ARG_NONNULL ((2, 3));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Make sure we later can get all the definitions and declarations. */
|
||||
#undef __need_getopt
|
||||
|
||||
#endif /* _GL_GETOPT_H */
|
||||
#endif /* _GL_GETOPT_H */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,34 @@
|
|||
2013-01-11 Michael Albinus <michael.albinus@gmx.de>
|
||||
|
||||
* autorevert.el (top): Require 'cl in order to pacify byte compiler.
|
||||
(auto-revert-notify-rm-watch): Ignore errors.
|
||||
(auto-revert-notify-add-watch): Ignore errors. Use '(modify) for
|
||||
inotify, and '(size last-write-time) for w32notify. Set
|
||||
buffer-local `auto-revert-use-notify' to nil when adding a file
|
||||
watch fails - this is a fallback to the file modification check.
|
||||
(auto-revert-notify-event-p, auto-revert-notify-event-descriptor)
|
||||
(auto-revert-notify-event-action)
|
||||
(auto-revert-notify-event-file-name): New defuns.
|
||||
(auto-revert-notify-handler): Use them. Implement first
|
||||
plausibility checks.
|
||||
(auto-revert-handler): Handle also `auto-revert-tail-mode'.
|
||||
|
||||
2013-01-11 Julien Danjou <julien@danjou.info>
|
||||
|
||||
* color.el (color-rgb-to-hsv): Fix conversion computing in case min and
|
||||
max are almost equal. Also return the correct value for V which is
|
||||
already between 0 and 1.
|
||||
|
||||
2013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
* emacs-lisp/ert.el (ert-run-test): Use point-max-marker.
|
||||
|
||||
2013-01-11 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* autorevert.el (auto-revert-notify-rm-watch)
|
||||
(auto-revert-notify-add-watch): Fix typos in w32notify function
|
||||
names.
|
||||
|
||||
2013-01-10 Michael Albinus <michael.albinus@gmx.de>
|
||||
|
||||
* autorevert.el (auto-revert-notify-enabled): Move up.
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@
|
|||
|
||||
;; Dependencies:
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
(require 'timer)
|
||||
|
||||
;; Custom Group:
|
||||
|
|
@ -466,8 +467,10 @@ will use an up-to-date value of `auto-revert-interval'"
|
|||
(defun auto-revert-notify-rm-watch ()
|
||||
"Disable file watch for current buffer's associated file."
|
||||
(when auto-revert-notify-watch-descriptor
|
||||
(funcall (if (fboundp 'inotify-rm-watch) 'inotify-rm-watch 'w32-rm-watch)
|
||||
auto-revert-notify-watch-descriptor)
|
||||
(ignore-errors
|
||||
(funcall (if (fboundp 'inotify-rm-watch)
|
||||
'inotify-rm-watch 'w32notify-rm-watch)
|
||||
auto-revert-notify-watch-descriptor))
|
||||
(remhash auto-revert-notify-watch-descriptor
|
||||
auto-revert-notify-watch-descriptor-hash-list))
|
||||
(setq auto-revert-notify-watch-descriptor nil
|
||||
|
|
@ -478,21 +481,62 @@ will use an up-to-date value of `auto-revert-interval'"
|
|||
(when (and buffer-file-name auto-revert-use-notify)
|
||||
(auto-revert-notify-rm-watch)
|
||||
(let ((func (if (fboundp 'inotify-add-watch)
|
||||
'inotify-add-watch 'w32-add-watch))
|
||||
'inotify-add-watch 'w32notify-add-watch))
|
||||
(aspect (if (fboundp 'inotify-add-watch)
|
||||
'(close-write) '(last-write-time))))
|
||||
'(modify) '(size last-write-time))))
|
||||
(setq auto-revert-notify-watch-descriptor
|
||||
(funcall func buffer-file-name aspect 'auto-revert-notify-handler))
|
||||
(puthash auto-revert-notify-watch-descriptor
|
||||
(current-buffer)
|
||||
auto-revert-notify-watch-descriptor-hash-list))))
|
||||
(ignore-errors
|
||||
(funcall
|
||||
func buffer-file-name aspect 'auto-revert-notify-handler)))
|
||||
(if auto-revert-notify-watch-descriptor
|
||||
(puthash auto-revert-notify-watch-descriptor
|
||||
(current-buffer)
|
||||
auto-revert-notify-watch-descriptor-hash-list)
|
||||
;; Fallback to file checks.
|
||||
(set (make-local-variable 'auto-revert-use-notify) nil)))))
|
||||
|
||||
(defun auto-revert-notify-event-p (event)
|
||||
"Check that event is a file watch event."
|
||||
(cond ((featurep 'inotify)
|
||||
(and (listp event) (= (length event) 4)))
|
||||
((featurep 'w32notify)
|
||||
(and (listp event) (= (length event) 3) (stringp (nth 2 event))))))
|
||||
|
||||
(defun auto-revert-notify-event-descriptor (event)
|
||||
"Return watch descriptor of notification event, or nil."
|
||||
(and (auto-revert-notify-event-p event) (car event)))
|
||||
|
||||
(defun auto-revert-notify-event-action (event)
|
||||
"Return action of notification event, or nil."
|
||||
(and (auto-revert-notify-event-p event) (nth 1 event)))
|
||||
|
||||
(defun auto-revert-notify-event-file-name (event)
|
||||
"Return file name of notification event, or nil."
|
||||
(and (auto-revert-notify-event-p event)
|
||||
(cond ((featurep 'inotify) (nth 3 event))
|
||||
((featurep 'w32notify) (nth 2 event)))))
|
||||
|
||||
(defun auto-revert-notify-handler (event)
|
||||
"Handle an event returned from file watch."
|
||||
(when (listp event)
|
||||
(let ((buffer
|
||||
(gethash (car event) auto-revert-notify-watch-descriptor-hash-list)))
|
||||
(when (bufferp buffer)
|
||||
(when (auto-revert-notify-event-p event)
|
||||
(let* ((descriptor (auto-revert-notify-event-descriptor event))
|
||||
(action (auto-revert-notify-event-action event))
|
||||
(file (auto-revert-notify-event-file-name event))
|
||||
(buffer (gethash descriptor
|
||||
auto-revert-notify-watch-descriptor-hash-list)))
|
||||
(ignore-errors
|
||||
;; Check, that event is meant for us.
|
||||
;; TODO: Filter events which stop watching, like `move' or `removed'.
|
||||
(assert descriptor)
|
||||
(when (featurep 'inotify) (assert (memq 'modify descriptor)))
|
||||
(when (featurep 'w32notify) (assert (eq 'modified descriptor)))
|
||||
(assert (bufferp buffer))
|
||||
(when (stringp file)
|
||||
(assert (string-equal
|
||||
(directory-file-name file)
|
||||
(directory-file-name (buffer-file-name buffer)))))
|
||||
|
||||
;; Mark buffer modified.
|
||||
(with-current-buffer buffer
|
||||
(setq auto-revert-notify-modified-p t))))))
|
||||
|
||||
|
|
@ -513,6 +557,8 @@ This is an internal function used by Auto-Revert Mode."
|
|||
(let* ((buffer (current-buffer)) size
|
||||
(revert
|
||||
(or (and buffer-file-name
|
||||
(or (not auto-revert-use-notify)
|
||||
auto-revert-notify-modified-p)
|
||||
(if auto-revert-tail-mode
|
||||
;; Tramp caches the file attributes. Setting
|
||||
;; `remote-file-name-inhibit-cache' forces Tramp
|
||||
|
|
@ -523,12 +569,9 @@ This is an internal function used by Auto-Revert Mode."
|
|||
(setq size
|
||||
(nth 7 (file-attributes
|
||||
buffer-file-name))))))
|
||||
(if auto-revert-use-notify
|
||||
;; There are file watches.
|
||||
auto-revert-notify-modified-p
|
||||
(and (not (file-remote-p buffer-file-name))
|
||||
(file-readable-p buffer-file-name)
|
||||
(not (verify-visited-file-modtime buffer))))))
|
||||
(and (not (file-remote-p buffer-file-name))
|
||||
(file-readable-p buffer-file-name)
|
||||
(not (verify-visited-file-modtime buffer)))))
|
||||
(and (or auto-revert-mode
|
||||
global-auto-revert-non-file-buffers)
|
||||
revert-buffer-function
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ inclusive."
|
|||
(max (max r g b))
|
||||
(min (min r g b)))
|
||||
(if (< (- max min) 1e-8)
|
||||
(list 0.0 0.0 0.0)
|
||||
(list 0.0 0.0 min)
|
||||
(list
|
||||
(/ (* 2 float-pi
|
||||
(cond ((and (= r g) (= g b)) 0)
|
||||
|
|
@ -146,7 +146,7 @@ inclusive."
|
|||
(+ 240 (* 60 (/ (- r g) (- max min)))))))
|
||||
360)
|
||||
(if (= max 0) 0 (- 1 (/ min max)))
|
||||
(/ max 255.0)))))
|
||||
max))))
|
||||
|
||||
(defun color-rgb-to-hsl (red green blue)
|
||||
"Convert RGB colors to their HSL representation.
|
||||
|
|
|
|||
|
|
@ -937,7 +937,7 @@ Returns the result and stores it in ERT-TEST's `most-recent-result' slot."
|
|||
(cl-block error
|
||||
(let ((begin-marker
|
||||
(with-current-buffer (get-buffer-create "*Messages*")
|
||||
(set-marker (make-marker) (point-max)))))
|
||||
(point-max-marker))))
|
||||
(unwind-protect
|
||||
(let ((info (make-ert--test-execution-info
|
||||
:test ert-test
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
2013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
* erc-dcc.el (erc-dcc-send-file): Use point-min-marker.
|
||||
(erc-dcc-chat-setup): Use point-max-marker.
|
||||
|
||||
2013-01-04 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* erc-backend.el (312): Fix typo. (Bug#13235)
|
||||
|
|
|
|||
|
|
@ -897,7 +897,7 @@ other client."
|
|||
(let* ((buffer (erc-dcc-find-file file))
|
||||
(size (buffer-size buffer))
|
||||
(start (with-current-buffer buffer
|
||||
(set-marker (make-marker) (point-min))))
|
||||
(point-min-marker)))
|
||||
(sproc (erc-dcc-server "dcc-send"
|
||||
'erc-dcc-send-filter
|
||||
'erc-dcc-send-sentinel))
|
||||
|
|
@ -1166,7 +1166,7 @@ other client."
|
|||
(setq erc-dcc-from nick)
|
||||
(setq erc-dcc-entry-data entry)
|
||||
(setq erc-dcc-unprocessed-output "")
|
||||
(setq erc-insert-marker (set-marker (make-marker) (point-max)))
|
||||
(setq erc-insert-marker (point-max-marker))
|
||||
(setq erc-input-marker (make-marker))
|
||||
(erc-display-prompt buffer (point-max))
|
||||
(set-process-buffer proc buffer)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,15 @@
|
|||
2013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
* gnus-art.el (gnus-mime-display-security): Use point-min-marker
|
||||
and point-max-marker.
|
||||
* gnus-async.el (gnus-async-article-callback): Use point-max-marker.
|
||||
|
||||
2013-01-10 Uwe Brauer <oub@mat.ucm.es> (tiny change)
|
||||
|
||||
* mml-smime.el (mml-smime-encrypt-to-self): New user option analogous
|
||||
to mml2015-encrypt-to-self.
|
||||
(mml-smime-epg-encrypt): Respect mml-smime-encrypt-to-self.
|
||||
|
||||
2013-01-09 Daiki Ueno <ueno@gnu.org>
|
||||
|
||||
* mml-smime.el (epg-sub-key-fingerprint): Autoload for
|
||||
|
|
|
|||
|
|
@ -8688,9 +8688,7 @@ For example:
|
|||
gnus-mime-security-button-end-line-format))
|
||||
(gnus-insert-mime-security-button handle)))
|
||||
(mm-set-handle-multipart-parameter
|
||||
handle 'gnus-region
|
||||
(cons (set-marker (make-marker) (point-min))
|
||||
(set-marker (make-marker) (point-max))))
|
||||
handle 'gnus-region (cons (point-min-marker) (point-max-marker)))
|
||||
(goto-char (point-max))))
|
||||
|
||||
(defun gnus-mime-security-run-function (function)
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ that was fetched."
|
|||
gnus-async-article-alist
|
||||
(cons (list (intern (format "%s-%d" group article)
|
||||
gnus-async-hashtb)
|
||||
mark (set-marker (make-marker) (point-max))
|
||||
mark (point-max-marker)
|
||||
group article)
|
||||
gnus-async-article-alist))))
|
||||
(if (not (gnus-buffer-live-p summary))
|
||||
|
|
|
|||
|
|
@ -80,6 +80,12 @@ Whether the passphrase is cached at all is controlled by
|
|||
:version "24.4"
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom mml-smime-encrypt-to-self nil
|
||||
"If t, add your own key ID to recipient list when encryption."
|
||||
:group 'mime-security
|
||||
:version "24.4"
|
||||
:type 'boolean)
|
||||
|
||||
(defun mml-smime-sign (cont)
|
||||
(let ((func (nth 1 (assq mml-smime-use mml-smime-function-alist))))
|
||||
(if func
|
||||
|
|
@ -475,13 +481,17 @@ Content-Disposition: attachment; filename=smime.p7s
|
|||
(goto-char (point-max))))
|
||||
|
||||
(defun mml-smime-epg-encrypt (cont)
|
||||
(let ((inhibit-redisplay t)
|
||||
(context (epg-make-context 'CMS))
|
||||
(config (epg-configuration))
|
||||
(recipients (message-options-get 'mml-smime-epg-recipients))
|
||||
cipher signers
|
||||
(boundary (mml-compute-boundary cont))
|
||||
recipient-key)
|
||||
(let* ((inhibit-redisplay t)
|
||||
(context (epg-make-context 'CMS))
|
||||
(config (epg-configuration))
|
||||
(recipients (message-options-get 'mml-smime-epg-recipients))
|
||||
cipher signers
|
||||
(sender (message-options-get 'message-sender))
|
||||
(signer-names (or mml-smime-signers
|
||||
(if (and mml-smime-sign-with-sender sender)
|
||||
(list (concat "<" sender ">")))))
|
||||
(boundary (mml-compute-boundary cont))
|
||||
recipient-key)
|
||||
(unless recipients
|
||||
(setq recipients
|
||||
(apply #'nconc
|
||||
|
|
@ -494,6 +504,10 @@ Content-Disposition: attachment; filename=smime.p7s
|
|||
(message-options-set 'message-recipients
|
||||
(read-string "Recipients: ")))
|
||||
"[ \f\t\n\r\v,]+"))))
|
||||
(when mml-smime-encrypt-to-self
|
||||
(unless signer-names
|
||||
(error "Neither message sender nor mml-smime-signers are set"))
|
||||
(setq recipients (nconc recipients signer-names)))
|
||||
(if (eq mm-encrypt-option 'guided)
|
||||
(setq recipients
|
||||
(epa-select-keys context "\
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
2013-01-11 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* inc/unistd.h (O_IGNORE_CTTY): Define, as it is unconditionally
|
||||
used in term.c. (Bug#13387)
|
||||
|
||||
2013-01-09 Juanma Barranquero <lekktu@gmail.com>
|
||||
|
||||
* config.nt: Sync with autogen/config.in.
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ extern int faccessat (int, char const *, int, int);
|
|||
#define AT_SYMLINK_NOFOLLOW 4096
|
||||
|
||||
#define O_NOCTTY 0
|
||||
#define O_IGNORE_CTTY 0
|
||||
|
||||
/* This is normally on stdlib.h, but we don't override that header. */
|
||||
extern int unsetenv (const char *);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,28 @@
|
|||
2013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
Avoid unnecessary byte position calculation for the gap movement.
|
||||
Since all users of move_gap do CHAR_TO_BYTE for other purposes
|
||||
anyway, all of them should use move_gap_both instead.
|
||||
* lisp.h (move_gap): Remove prototype.
|
||||
* insdel.c (move_gap): Remove.
|
||||
(move_gap_both): Add eassert.
|
||||
* editfns.c (Ftranspose_regions): Tweak to use move_gap_both.
|
||||
* xml.c (parse_region): Likewise.
|
||||
|
||||
2013-01-11 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
emacsclient -t should not suspend Emacs server (Bug#13387)
|
||||
* lisp.h, sysdep.c (block_tty_out_signal, unblock_tty_out_signal):
|
||||
New functions.
|
||||
* term.c (init_tty): Use them instead of rolling our own code.
|
||||
* sysdep.c (tcsetpgrp_without_stopping): Likewise. Here, this
|
||||
switches from 'signal' to 'pthread_sigmask', which is safer in
|
||||
multithreaded applications.
|
||||
* term.c (Fresume_tty): Don't bother dissociating if O_IGNORE_CTTY,
|
||||
which has already arranged for that.
|
||||
(dissociate_if_controlling_tty): If setsid fails, fall back on TIOCNOTTY.
|
||||
This is the main part of the bug fix.
|
||||
|
||||
2013-01-10 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> (tiny change)
|
||||
|
||||
* gtkutil.c (xg_initialize): Add ifdef HAVE_FREETYPE around
|
||||
|
|
|
|||
|
|
@ -4522,7 +4522,7 @@ Transposing beyond buffer boundaries is an error. */)
|
|||
(Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers)
|
||||
{
|
||||
register ptrdiff_t start1, end1, start2, end2;
|
||||
ptrdiff_t start1_byte, start2_byte, len1_byte, len2_byte;
|
||||
ptrdiff_t start1_byte, start2_byte, len1_byte, len2_byte, end2_byte;
|
||||
ptrdiff_t gap, len1, len_mid, len2;
|
||||
unsigned char *start1_addr, *start2_addr, *temp;
|
||||
|
||||
|
|
@ -4583,20 +4583,22 @@ Transposing beyond buffer boundaries is an error. */)
|
|||
the gap the minimum distance to get it out of the way, and then
|
||||
deal with an unbroken array. */
|
||||
|
||||
start1_byte = CHAR_TO_BYTE (start1);
|
||||
end2_byte = CHAR_TO_BYTE (end2);
|
||||
|
||||
/* Make sure the gap won't interfere, by moving it out of the text
|
||||
we will operate on. */
|
||||
if (start1 < gap && gap < end2)
|
||||
{
|
||||
if (gap - start1 < end2 - gap)
|
||||
move_gap (start1);
|
||||
move_gap_both (start1, start1_byte);
|
||||
else
|
||||
move_gap (end2);
|
||||
move_gap_both (end2, end2_byte);
|
||||
}
|
||||
|
||||
start1_byte = CHAR_TO_BYTE (start1);
|
||||
start2_byte = CHAR_TO_BYTE (start2);
|
||||
len1_byte = CHAR_TO_BYTE (end1) - start1_byte;
|
||||
len2_byte = CHAR_TO_BYTE (end2) - start2_byte;
|
||||
len2_byte = end2_byte - start2_byte;
|
||||
|
||||
#ifdef BYTE_COMBINING_DEBUG
|
||||
if (end1 == start2)
|
||||
|
|
|
|||
11
src/insdel.c
11
src/insdel.c
|
|
@ -84,21 +84,14 @@ check_markers (void)
|
|||
|
||||
#endif /* MARKER_DEBUG */
|
||||
|
||||
/* Move gap to position CHARPOS.
|
||||
Note that this can quit! */
|
||||
|
||||
void
|
||||
move_gap (ptrdiff_t charpos)
|
||||
{
|
||||
move_gap_both (charpos, CHAR_TO_BYTE (charpos));
|
||||
}
|
||||
|
||||
/* Move gap to byte position BYTEPOS, which is also char position CHARPOS.
|
||||
Note that this can quit! */
|
||||
|
||||
void
|
||||
move_gap_both (ptrdiff_t charpos, ptrdiff_t bytepos)
|
||||
{
|
||||
eassert (charpos == BYTE_TO_CHAR (bytepos)
|
||||
&& bytepos == CHAR_TO_BYTE (charpos));
|
||||
if (bytepos < GPT_BYTE)
|
||||
gap_left (charpos, bytepos, 0);
|
||||
else if (bytepos > GPT_BYTE)
|
||||
|
|
|
|||
|
|
@ -2780,7 +2780,6 @@ extern void syms_of_image (void);
|
|||
|
||||
/* Defined in insdel.c. */
|
||||
extern Lisp_Object Qinhibit_modification_hooks;
|
||||
extern void move_gap (ptrdiff_t);
|
||||
extern void move_gap_both (ptrdiff_t, ptrdiff_t);
|
||||
extern _Noreturn void buffer_overflow (void);
|
||||
extern void make_gap (ptrdiff_t);
|
||||
|
|
@ -3467,6 +3466,8 @@ extern void init_sigio (int);
|
|||
extern void sys_subshell (void);
|
||||
extern void sys_suspend (void);
|
||||
extern void discard_tty_input (void);
|
||||
extern void block_tty_out_signal (void);
|
||||
extern void unblock_tty_out_signal (void);
|
||||
extern void init_sys_modes (struct tty_display_info *);
|
||||
extern void reset_sys_modes (struct tty_display_info *);
|
||||
extern void init_all_sys_modes (void);
|
||||
|
|
|
|||
26
src/sysdep.c
26
src/sysdep.c
|
|
@ -714,6 +714,27 @@ init_foreground_group (void)
|
|||
inherited_pgroup = getpid () == pgrp ? 0 : pgrp;
|
||||
}
|
||||
|
||||
/* Block and unblock SIGTTOU. */
|
||||
|
||||
void
|
||||
block_tty_out_signal (void)
|
||||
{
|
||||
#ifdef SIGTTOU
|
||||
sigset_t blocked;
|
||||
sigemptyset (&blocked);
|
||||
sigaddset (&blocked, SIGTTOU);
|
||||
pthread_sigmask (SIG_BLOCK, &blocked, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
unblock_tty_out_signal (void)
|
||||
{
|
||||
#ifdef SIGTTOU
|
||||
pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Safely set a controlling terminal FD's process group to PGID.
|
||||
If we are not in the foreground already, POSIX requires tcsetpgrp
|
||||
to deliver a SIGTTOU signal, which would stop us. This is an
|
||||
|
|
@ -725,11 +746,10 @@ static void
|
|||
tcsetpgrp_without_stopping (int fd, pid_t pgid)
|
||||
{
|
||||
#ifdef SIGTTOU
|
||||
signal_handler_t handler;
|
||||
block_input ();
|
||||
handler = signal (SIGTTOU, SIG_IGN);
|
||||
block_tty_out_signal ();
|
||||
tcsetpgrp (fd, pgid);
|
||||
signal (SIGTTOU, handler);
|
||||
unblock_tty_out_signal ();
|
||||
unblock_input ();
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
31
src/term.c
31
src/term.c
|
|
@ -2423,7 +2423,7 @@ frame's terminal). */)
|
|||
if (fd == -1)
|
||||
error ("Can not reopen tty device %s: %s", t->display_info.tty->name, strerror (errno));
|
||||
|
||||
if (strcmp (t->display_info.tty->name, DEV_TTY))
|
||||
if (!O_IGNORE_CTTY && strcmp (t->display_info.tty->name, DEV_TTY) != 0)
|
||||
dissociate_if_controlling_tty (fd);
|
||||
|
||||
t->display_info.tty->output = fdopen (fd, "w+");
|
||||
|
|
@ -2903,13 +2903,23 @@ set_tty_hooks (struct terminal *terminal)
|
|||
terminal->delete_terminal_hook = &delete_tty;
|
||||
}
|
||||
|
||||
/* Drop the controlling terminal if fd is the same device. */
|
||||
/* If FD is the controlling terminal, drop it. */
|
||||
static void
|
||||
dissociate_if_controlling_tty (int fd)
|
||||
{
|
||||
pid_t pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */
|
||||
if (0 <= pgid)
|
||||
setsid ();
|
||||
/* If tcgetpgrp succeeds, fd is the controlling terminal,
|
||||
so dissociate it by invoking setsid. */
|
||||
if (0 <= tcgetpgrp (fd) && setsid () < 0)
|
||||
{
|
||||
#ifdef TIOCNOTTY
|
||||
/* setsid failed, presumably because Emacs is already a process
|
||||
group leader. Fall back on the obsolescent way to dissociate
|
||||
a controlling tty. */
|
||||
block_tty_out_signal ();
|
||||
ioctl (fd, TIOCNOTTY, 0);
|
||||
unblock_tty_out_signal ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Create a termcap display on the tty device with the given name and
|
||||
|
|
@ -3030,14 +3040,9 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
|
|||
|
||||
/* On some systems, tgetent tries to access the controlling
|
||||
terminal. */
|
||||
{
|
||||
sigset_t blocked;
|
||||
sigemptyset (&blocked);
|
||||
sigaddset (&blocked, SIGTTOU);
|
||||
pthread_sigmask (SIG_BLOCK, &blocked, 0);
|
||||
status = tgetent (tty->termcap_term_buffer, terminal_type);
|
||||
pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
|
||||
}
|
||||
block_tty_out_signal ();
|
||||
status = tgetent (tty->termcap_term_buffer, terminal_type);
|
||||
unblock_tty_out_signal ();
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
|
|
|
|||
17
src/xml.c
17
src/xml.c
|
|
@ -180,8 +180,7 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
|
|||
xmlDoc *doc;
|
||||
Lisp_Object result = Qnil;
|
||||
const char *burl = "";
|
||||
ptrdiff_t bytes;
|
||||
ptrdiff_t istart, iend;
|
||||
ptrdiff_t istart, iend, istart_byte, iend_byte;
|
||||
|
||||
fn_xmlCheckVersion (LIBXML_VERSION);
|
||||
|
||||
|
|
@ -189,9 +188,11 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
|
|||
|
||||
istart = XINT (start);
|
||||
iend = XINT (end);
|
||||
istart_byte = CHAR_TO_BYTE (istart);
|
||||
iend_byte = CHAR_TO_BYTE (iend);
|
||||
|
||||
if (istart < GPT && GPT < iend)
|
||||
move_gap (iend);
|
||||
move_gap_both (iend, iend_byte);
|
||||
|
||||
if (! NILP (base_url))
|
||||
{
|
||||
|
|
@ -199,17 +200,15 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
|
|||
burl = SSDATA (base_url);
|
||||
}
|
||||
|
||||
bytes = CHAR_TO_BYTE (iend) - CHAR_TO_BYTE (istart);
|
||||
|
||||
if (htmlp)
|
||||
doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
|
||||
bytes, burl, "utf-8",
|
||||
doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte),
|
||||
iend_byte - istart_byte, burl, "utf-8",
|
||||
HTML_PARSE_RECOVER|HTML_PARSE_NONET|
|
||||
HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR|
|
||||
HTML_PARSE_NOBLANKS);
|
||||
else
|
||||
doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
|
||||
bytes, burl, "utf-8",
|
||||
doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte),
|
||||
iend_byte - istart_byte, burl, "utf-8",
|
||||
XML_PARSE_NONET|XML_PARSE_NOWARNING|
|
||||
XML_PARSE_NOBLANKS |XML_PARSE_NOERROR);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue