summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/Makefile.in8
-rw-r--r--lib-src/emacsclient.c4
-rw-r--r--lib-src/etags.c2
-rw-r--r--lib-src/ntlib.c67
4 files changed, 73 insertions, 8 deletions
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index fa37d8ed85d..b2b901788a5 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -361,13 +361,9 @@ TAGS: etags${EXEEXT} ${tagsfiles}
../lib/libgnu.a: $(config_h)
$(MAKE) -C ../lib all
-regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
- $(AM_V_CC)$(CC) -c $(CPP_CFLAGS) $<
-
-
-etags_deps = ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
+etags_deps = ${srcdir}/etags.c $(NTLIB) $(config_h)
etags_cflags = -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" -o $@
-etags_libs = regex.o $(NTLIB) $(LOADLIBES)
+etags_libs = $(NTLIB) $(LOADLIBES)
etags${EXEEXT}: ${etags_deps}
$(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(etags_cflags) $< $(etags_libs)
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 739e6d5949e..4fe3a588b19 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1117,7 +1117,9 @@ find_tty (const char **tty_type, const char **tty_name, int noabort)
}
}
- if (strcmp (type, "eterm") == 0)
+ const char *inside_emacs = egetenv ("INSIDE_EMACS");
+ if (inside_emacs && strstr (inside_emacs, ",term:")
+ && strprefix ("eterm", type))
{
if (noabort)
return 0;
diff --git a/lib-src/etags.c b/lib-src/etags.c
index b3b4575e0a6..ee506703436 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -6401,7 +6401,7 @@ add_regex (char *regexp_pattern, language *lang)
*patbuf = zeropattern;
if (ignore_case)
{
- static char lc_trans[UCHAR_MAX + 1];
+ static unsigned char lc_trans[UCHAR_MAX + 1];
int i;
for (i = 0; i < UCHAR_MAX + 1; i++)
lc_trans[i] = c_tolower (i);
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index 95512854839..4ca521d2775 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -31,6 +31,10 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <ctype.h>
#include <sys/timeb.h>
#include <mbstring.h>
+#include <locale.h>
+
+#include <nl_types.h>
+#include <langinfo.h>
#include "ntlib.h"
@@ -423,3 +427,66 @@ sys_open (const char * path, int oflag, int mode)
{
return _open (path, oflag, mode);
}
+
+/* Emulation of nl_langinfo that supports only CODESET.
+ Used in Gnulib regex.c. */
+char *
+nl_langinfo (nl_item item)
+{
+ switch (item)
+ {
+ case CODESET:
+ {
+ /* Shamelessly stolen from Gnulib's nl_langinfo.c, modulo
+ CPP directives. */
+ static char buf[2 + 10 + 1];
+ char const *locale = setlocale (LC_CTYPE, NULL);
+ char *codeset = buf;
+ size_t codesetlen;
+ codeset[0] = '\0';
+
+ if (locale && locale[0])
+ {
+ /* If the locale name contains an encoding after the
+ dot, return it. */
+ char *dot = strchr (locale, '.');
+
+ if (dot)
+ {
+ /* Look for the possible @... trailer and remove it,
+ if any. */
+ char *codeset_start = dot + 1;
+ char const *modifier = strchr (codeset_start, '@');
+
+ if (! modifier)
+ codeset = codeset_start;
+ else
+ {
+ codesetlen = modifier - codeset_start;
+ if (codesetlen < sizeof buf)
+ {
+ codeset = memcpy (buf, codeset_start, codesetlen);
+ codeset[codesetlen] = '\0';
+ }
+ }
+ }
+ }
+ /* If setlocale is successful, it returns the number of the
+ codepage, as a string. Otherwise, fall back on Windows
+ API GetACP, which returns the locale's codepage as a
+ number (although this doesn't change according to what
+ the 'setlocale' call specified). Either way, prepend
+ "CP" to make it a valid codeset name. */
+ codesetlen = strlen (codeset);
+ if (0 < codesetlen && codesetlen < sizeof buf - 2)
+ memmove (buf + 2, codeset, codesetlen + 1);
+ else
+ sprintf (buf + 2, "%u", GetACP ());
+ codeset = memcpy (buf, "CP", 2);
+
+ return codeset;
+ }
+ default:
+ return (char *) "";
+ }
+}