1999-04-16 03:34:55 +02:00
|
|
|
/* nls.c -- skeletal internationalization code. */
|
|
|
|
|
2019-08-12 18:24:03 +02:00
|
|
|
/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
1999-04-16 03:34:55 +02:00
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
This file is part of the GNU Readline Library (Readline), a library
|
|
|
|
for reading lines of text with interactive input and history editing.
|
1999-04-16 03:34:55 +02:00
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
Readline 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
|
1999-04-16 03:34:55 +02:00
|
|
|
(at your option) any later version.
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
Readline 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
|
1999-04-16 03:34:55 +02:00
|
|
|
GNU General Public License for more details.
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Readline. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
#define READLINE_LIBRARY
|
|
|
|
|
|
|
|
#if defined (HAVE_CONFIG_H)
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
#if defined (HAVE_UNISTD_H)
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif /* HAVE_UNISTD_H */
|
|
|
|
|
|
|
|
#if defined (HAVE_STDLIB_H)
|
|
|
|
# include <stdlib.h>
|
|
|
|
#else
|
|
|
|
# include "ansi_stdlib.h"
|
|
|
|
#endif /* HAVE_STDLIB_H */
|
|
|
|
|
|
|
|
#if defined (HAVE_LOCALE_H)
|
|
|
|
# include <locale.h>
|
|
|
|
#endif
|
|
|
|
|
2018-10-07 20:52:13 +02:00
|
|
|
#if defined (HAVE_LANGINFO_CODESET)
|
|
|
|
# include <langinfo.h>
|
|
|
|
#endif
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
#include "rldefs.h"
|
readline:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.
doc:
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
2000-07-09 19:20:00 +02:00
|
|
|
#include "readline.h"
|
|
|
|
#include "rlshell.h"
|
|
|
|
#include "rlprivate.h"
|
1999-04-16 03:34:55 +02:00
|
|
|
|
2018-10-07 20:52:13 +02:00
|
|
|
static int utf8locale PARAMS((char *));
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
#if !defined (HAVE_SETLOCALE)
|
|
|
|
/* A list of legal values for the LANG or LC_CTYPE environment variables.
|
|
|
|
If a locale name in this list is the value for the LC_ALL, LC_CTYPE,
|
|
|
|
or LANG environment variable (using the first of those with a value),
|
|
|
|
readline eight-bit mode is enabled. */
|
|
|
|
static char *legal_lang_values[] =
|
|
|
|
{
|
|
|
|
"iso88591",
|
|
|
|
"iso88592",
|
|
|
|
"iso88593",
|
|
|
|
"iso88594",
|
|
|
|
"iso88595",
|
|
|
|
"iso88596",
|
|
|
|
"iso88597",
|
|
|
|
"iso88598",
|
|
|
|
"iso88599",
|
|
|
|
"iso885910",
|
|
|
|
"koi8r",
|
2019-08-12 18:24:03 +02:00
|
|
|
"utf8",
|
1999-04-16 03:34:55 +02:00
|
|
|
0
|
|
|
|
};
|
|
|
|
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
static char *normalize_codeset PARAMS((char *));
|
2015-07-25 21:41:05 +02:00
|
|
|
#endif /* !HAVE_SETLOCALE */
|
Sync readline/ to version 7.0 alpha
This patch syncs our upstream copy of readline from version 6.2 to the
latest version, 7.0 alpha (released July 10 2015).
I essentially copied what was done the last time readline was synced,
when Jan updated to readline 6.2 in 2011:
http://sourceware.org/ml/gdb-patches/2011-05/msg00003.html
Procedure:
1. I extracted the readline-7.0-alpha tarball on top of readline/.
2. I deleted all the new files under doc/ that were deliberately omitted
before.
3. I regenerated readline/configure and readline/examples/rlfe/configure
using autoconf 2.64. No other configure files need regenerating.
4. I updated the function gdb_printable_part in completer.c with a
trivial change made to the readline function it is based off of,
printable_part in readline/complete.c. There is more work to be done in
completer.c to sync it with readline/complete.c, but it is non-trivial
and should probably be done separately anyway.
Local patches that had to be reapplied:
None. readline 7.0 alpha contains all of our local readline
patches.
New files in readline/:
colors.{c,h}
examples/{hist_erasedups,hist_purgecmd,rl-callbacktest,rlbasic}.c
parse-colors.{c,h}
readline.pc.in
configure.ac
Deleted files in readline/:
configure.in
Regressions:
After the sync there is one testsuite regression, the test
"signal SIGINT" in gdb.gdb/selftest.exp which now FAILs. Previously,
the readline 6.2 SIGINT handler would temporarily reinstall the
underlying application's SIGINT handler and immediately re-raise SIGINT
so that the orginal handler gets invoked. But now (since readline 6.3)
its SIGINT handler does not re-raise SIGINT or directly invoke the
original handler; it now sets a flag marking that SIGINT was raised, and
waits until readline explicitly has control to call the application's
SIGINT handler. Anyway, because SIGINT is no longer re-raised from
within readline's SIGINT handler, doing "signal SIGINT" with a stopped
inferior gdb process will no longer resume and then immediately stop the
process (since there is no 2nd SIGINT to immediately catch). Instead,
the inferior gdb process will now just print "Quit" and continue to run.
So with this commit, this particular test case is adjusted to reflect
this change in behavior (we now have to send a 2nd SIGINT manually to
stop it).
Aside from this one testsuite regression, I personally noticed no
regression in user-visible behavior. Though I only tested on x86_64
and on i686 Debian Stretch.
Getting this kind of change in at the start of the GDB 7.11 development
cycle will allow us to get a lot of passive testing from developers and
from bleeding-edge users.
readline/ChangeLog.gdb:
Import readline 7.0 alpha
* configure: Regenerate.
* examples/rlfe/configure: Regenerate.
gdb/ChangeLog:
* completer.c (gdb_printable_part): Sync with readline function
it is based off of.
gdb/testsuite/ChangeLog:
* gdb.gdb/selftest.exp (test_with_self): Update test to now
expect the GDB inferior to no longer immediately stop after
being resumed with "signal SIGINT".
2015-07-15 02:29:21 +02:00
|
|
|
|
2018-10-07 20:52:13 +02:00
|
|
|
static char *find_codeset PARAMS((char *, size_t *));
|
|
|
|
|
2006-05-05 20:26:14 +02:00
|
|
|
static char *_rl_get_locale_var PARAMS((const char *));
|
|
|
|
|
|
|
|
static char *
|
2019-08-12 18:24:03 +02:00
|
|
|
_rl_get_locale_var (const char *v)
|
2006-05-05 20:26:14 +02:00
|
|
|
{
|
|
|
|
char *lspec;
|
|
|
|
|
|
|
|
lspec = sh_get_env_value ("LC_ALL");
|
|
|
|
if (lspec == 0 || *lspec == 0)
|
|
|
|
lspec = sh_get_env_value (v);
|
|
|
|
if (lspec == 0 || *lspec == 0)
|
|
|
|
lspec = sh_get_env_value ("LANG");
|
|
|
|
|
|
|
|
return lspec;
|
|
|
|
}
|
2018-10-07 20:52:13 +02:00
|
|
|
|
|
|
|
static int
|
2019-08-12 18:24:03 +02:00
|
|
|
utf8locale (char *lspec)
|
2018-10-07 20:52:13 +02:00
|
|
|
{
|
|
|
|
char *cp;
|
|
|
|
size_t len;
|
|
|
|
|
|
|
|
#if HAVE_LANGINFO_CODESET
|
|
|
|
cp = nl_langinfo (CODESET);
|
|
|
|
return (STREQ (cp, "UTF-8") || STREQ (cp, "utf8"));
|
|
|
|
#else
|
|
|
|
cp = find_codeset (lspec, &len);
|
|
|
|
|
|
|
|
if (cp == 0 || len < 4 || len > 5)
|
|
|
|
return 0;
|
|
|
|
return ((len == 5) ? strncmp (cp, "UTF-8", len) == 0 : strncmp (cp, "utf8", 4) == 0);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-08-12 18:24:03 +02:00
|
|
|
/* Query the right environment variables and call setlocale() to initialize
|
|
|
|
the C library locale settings. */
|
|
|
|
char *
|
|
|
|
_rl_init_locale (void)
|
1999-04-16 03:34:55 +02:00
|
|
|
{
|
2019-08-12 18:24:03 +02:00
|
|
|
char *ret, *lspec;
|
1999-04-16 03:34:55 +02:00
|
|
|
|
|
|
|
/* Set the LC_CTYPE locale category from environment variables. */
|
2006-05-05 20:26:14 +02:00
|
|
|
lspec = _rl_get_locale_var ("LC_CTYPE");
|
|
|
|
/* Since _rl_get_locale_var queries the right environment variables,
|
|
|
|
we query the current locale settings with setlocale(), and, if
|
|
|
|
that doesn't return anything, we set lspec to the empty string to
|
|
|
|
force the subsequent call to setlocale() to define the `native'
|
|
|
|
environment. */
|
|
|
|
if (lspec == 0 || *lspec == 0)
|
|
|
|
lspec = setlocale (LC_CTYPE, (char *)NULL);
|
|
|
|
if (lspec == 0)
|
|
|
|
lspec = "";
|
2019-08-12 18:24:03 +02:00
|
|
|
ret = setlocale (LC_CTYPE, lspec); /* ok, since it does not change locale */
|
|
|
|
|
|
|
|
_rl_utf8locale = (ret && *ret) ? utf8locale (ret) : 0;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value
|
|
|
|
to decide the defaults for 8-bit character input and output. Returns
|
|
|
|
1 if we set eight-bit mode. */
|
|
|
|
int
|
|
|
|
_rl_init_eightbit (void)
|
|
|
|
{
|
|
|
|
/* If we have setlocale(3), just check the current LC_CTYPE category
|
|
|
|
value, and go into eight-bit mode if it's not C or POSIX. */
|
|
|
|
#if defined (HAVE_SETLOCALE)
|
|
|
|
char *lspec, *t;
|
2006-05-05 20:26:14 +02:00
|
|
|
|
2019-08-12 18:24:03 +02:00
|
|
|
t = _rl_init_locale (); /* returns static pointer */
|
2018-10-07 20:52:13 +02:00
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
if (t && *t && (t[0] != 'C' || t[1]) && (STREQ (t, "POSIX") == 0))
|
|
|
|
{
|
|
|
|
_rl_meta_flag = 1;
|
|
|
|
_rl_convert_meta_chars_to_ascii = 0;
|
|
|
|
_rl_output_meta_chars = 1;
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
#else /* !HAVE_SETLOCALE */
|
|
|
|
char *lspec, *t;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* We don't have setlocale. Finesse it. Check the environment for the
|
|
|
|
appropriate variables and set eight-bit mode if they have the right
|
|
|
|
values. */
|
2006-05-05 20:26:14 +02:00
|
|
|
lspec = _rl_get_locale_var ("LC_CTYPE");
|
|
|
|
|
1999-04-16 03:34:55 +02:00
|
|
|
if (lspec == 0 || (t = normalize_codeset (lspec)) == 0)
|
|
|
|
return (0);
|
|
|
|
for (i = 0; t && legal_lang_values[i]; i++)
|
|
|
|
if (STREQ (t, legal_lang_values[i]))
|
|
|
|
{
|
|
|
|
_rl_meta_flag = 1;
|
|
|
|
_rl_convert_meta_chars_to_ascii = 0;
|
|
|
|
_rl_output_meta_chars = 1;
|
|
|
|
break;
|
|
|
|
}
|
2019-08-12 18:24:03 +02:00
|
|
|
|
|
|
|
_rl_utf8locale = *t ? STREQ (t, "utf8") : 0;
|
|
|
|
|
2011-05-12 01:38:44 +02:00
|
|
|
xfree (t);
|
1999-04-16 03:34:55 +02:00
|
|
|
return (legal_lang_values[i] ? 1 : 0);
|
|
|
|
#endif /* !HAVE_SETLOCALE */
|
|
|
|
}
|
|
|
|
|
|
|
|
#if !defined (HAVE_SETLOCALE)
|
|
|
|
static char *
|
2019-08-12 18:24:03 +02:00
|
|
|
normalize_codeset (char *codeset)
|
1999-04-16 03:34:55 +02:00
|
|
|
{
|
|
|
|
size_t namelen, i;
|
|
|
|
int len, all_digits;
|
|
|
|
char *wp, *retval;
|
|
|
|
|
|
|
|
codeset = find_codeset (codeset, &namelen);
|
|
|
|
|
|
|
|
if (codeset == 0)
|
|
|
|
return (codeset);
|
|
|
|
|
|
|
|
all_digits = 1;
|
|
|
|
for (len = 0, i = 0; i < namelen; i++)
|
|
|
|
{
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
if (ISALNUM ((unsigned char)codeset[i]))
|
1999-04-16 03:34:55 +02:00
|
|
|
{
|
|
|
|
len++;
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
all_digits &= _rl_digit_p (codeset[i]);
|
1999-04-16 03:34:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
retval = (char *)malloc ((all_digits ? 3 : 0) + len + 1);
|
|
|
|
if (retval == 0)
|
|
|
|
return ((char *)0);
|
|
|
|
|
|
|
|
wp = retval;
|
|
|
|
/* Add `iso' to beginning of an all-digit codeset */
|
|
|
|
if (all_digits)
|
|
|
|
{
|
|
|
|
*wp++ = 'i';
|
|
|
|
*wp++ = 's';
|
|
|
|
*wp++ = 'o';
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < namelen; i++)
|
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
2002-12-08 23:31:39 +01:00
|
|
|
if (ISALPHA ((unsigned char)codeset[i]))
|
|
|
|
*wp++ = _rl_to_lower (codeset[i]);
|
|
|
|
else if (_rl_digit_p (codeset[i]))
|
1999-04-16 03:34:55 +02:00
|
|
|
*wp++ = codeset[i];
|
|
|
|
*wp = '\0';
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
2018-10-07 20:52:13 +02:00
|
|
|
#endif /* !HAVE_SETLOCALE */
|
1999-04-16 03:34:55 +02:00
|
|
|
|
|
|
|
/* Isolate codeset portion of locale specification. */
|
|
|
|
static char *
|
2019-08-12 18:24:03 +02:00
|
|
|
find_codeset (char *name, size_t *lenp)
|
1999-04-16 03:34:55 +02:00
|
|
|
{
|
|
|
|
char *cp, *language, *result;
|
|
|
|
|
|
|
|
cp = language = name;
|
|
|
|
result = (char *)0;
|
|
|
|
|
|
|
|
while (*cp && *cp != '_' && *cp != '@' && *cp != '+' && *cp != ',')
|
|
|
|
cp++;
|
|
|
|
|
|
|
|
/* This does not make sense: language has to be specified. As
|
|
|
|
an exception we allow the variable to contain only the codeset
|
|
|
|
name. Perhaps there are funny codeset names. */
|
|
|
|
if (language == cp)
|
|
|
|
{
|
|
|
|
*lenp = strlen (language);
|
|
|
|
result = language;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Next is the territory. */
|
|
|
|
if (*cp == '_')
|
|
|
|
do
|
|
|
|
++cp;
|
|
|
|
while (*cp && *cp != '.' && *cp != '@' && *cp != '+' && *cp != ',' && *cp != '_');
|
|
|
|
|
|
|
|
/* Now, finally, is the codeset. */
|
|
|
|
result = cp;
|
|
|
|
if (*cp == '.')
|
|
|
|
do
|
|
|
|
++cp;
|
|
|
|
while (*cp && *cp != '@');
|
|
|
|
|
|
|
|
if (cp - result > 2)
|
|
|
|
{
|
|
|
|
result++;
|
|
|
|
*lenp = cp - result;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*lenp = strlen (language);
|
|
|
|
result = language;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|