aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorTom Tromey2018-08-09 17:56:53 -0600
committerTom Tromey2018-08-09 17:56:53 -0600
commitaccb7b7ecc19f85c2750ded1046a464bc73c6a52 (patch)
tree1aa94af022d6700a93a8ff2b73f5b210046ac010 /lib-src
parentf822a2516d88eeb2118fbbc8554f155e86dfd74e (diff)
parent53483df0de0085dbc9ef0b15a0f629ab808b0147 (diff)
downloademacs-accb7b7ecc19f85c2750ded1046a464bc73c6a52.tar.gz
emacs-accb7b7ecc19f85c2750ded1046a464bc73c6a52.zip
Merge remote-tracking branch 'origin/master' into feature/bignum
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/Makefile.in8
-rw-r--r--lib-src/etags.c2
-rw-r--r--lib-src/ntlib.c67
-rw-r--r--lib-src/pop.c8
4 files changed, 76 insertions, 9 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}
361../lib/libgnu.a: $(config_h) 361../lib/libgnu.a: $(config_h)
362 $(MAKE) -C ../lib all 362 $(MAKE) -C ../lib all
363 363
364regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h) 364etags_deps = ${srcdir}/etags.c $(NTLIB) $(config_h)
365 $(AM_V_CC)$(CC) -c $(CPP_CFLAGS) $<
366
367
368etags_deps = ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
369etags_cflags = -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" -o $@ 365etags_cflags = -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" -o $@
370etags_libs = regex.o $(NTLIB) $(LOADLIBES) 366etags_libs = $(NTLIB) $(LOADLIBES)
371 367
372etags${EXEEXT}: ${etags_deps} 368etags${EXEEXT}: ${etags_deps}
373 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(etags_cflags) $< $(etags_libs) 369 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(etags_cflags) $< $(etags_libs)
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)
6401 *patbuf = zeropattern; 6401 *patbuf = zeropattern;
6402 if (ignore_case) 6402 if (ignore_case)
6403 { 6403 {
6404 static char lc_trans[UCHAR_MAX + 1]; 6404 static unsigned char lc_trans[UCHAR_MAX + 1];
6405 int i; 6405 int i;
6406 for (i = 0; i < UCHAR_MAX + 1; i++) 6406 for (i = 0; i < UCHAR_MAX + 1; i++)
6407 lc_trans[i] = c_tolower (i); 6407 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/>. */
31#include <ctype.h> 31#include <ctype.h>
32#include <sys/timeb.h> 32#include <sys/timeb.h>
33#include <mbstring.h> 33#include <mbstring.h>
34#include <locale.h>
35
36#include <nl_types.h>
37#include <langinfo.h>
34 38
35#include "ntlib.h" 39#include "ntlib.h"
36 40
@@ -423,3 +427,66 @@ sys_open (const char * path, int oflag, int mode)
423{ 427{
424 return _open (path, oflag, mode); 428 return _open (path, oflag, mode);
425} 429}
430
431/* Emulation of nl_langinfo that supports only CODESET.
432 Used in Gnulib regex.c. */
433char *
434nl_langinfo (nl_item item)
435{
436 switch (item)
437 {
438 case CODESET:
439 {
440 /* Shamelessly stolen from Gnulib's nl_langinfo.c, modulo
441 CPP directives. */
442 static char buf[2 + 10 + 1];
443 char const *locale = setlocale (LC_CTYPE, NULL);
444 char *codeset = buf;
445 size_t codesetlen;
446 codeset[0] = '\0';
447
448 if (locale && locale[0])
449 {
450 /* If the locale name contains an encoding after the
451 dot, return it. */
452 char *dot = strchr (locale, '.');
453
454 if (dot)
455 {
456 /* Look for the possible @... trailer and remove it,
457 if any. */
458 char *codeset_start = dot + 1;
459 char const *modifier = strchr (codeset_start, '@');
460
461 if (! modifier)
462 codeset = codeset_start;
463 else
464 {
465 codesetlen = modifier - codeset_start;
466 if (codesetlen < sizeof buf)
467 {
468 codeset = memcpy (buf, codeset_start, codesetlen);
469 codeset[codesetlen] = '\0';
470 }
471 }
472 }
473 }
474 /* If setlocale is successful, it returns the number of the
475 codepage, as a string. Otherwise, fall back on Windows
476 API GetACP, which returns the locale's codepage as a
477 number (although this doesn't change according to what
478 the 'setlocale' call specified). Either way, prepend
479 "CP" to make it a valid codeset name. */
480 codesetlen = strlen (codeset);
481 if (0 < codesetlen && codesetlen < sizeof buf - 2)
482 memmove (buf + 2, codeset, codesetlen + 1);
483 else
484 sprintf (buf + 2, "%u", GetACP ());
485 codeset = memcpy (buf, "CP", 2);
486
487 return codeset;
488 }
489 default:
490 return (char *) "";
491 }
492}
diff --git a/lib-src/pop.c b/lib-src/pop.c
index 10aac957d4b..731f951fd14 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -30,8 +30,12 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
30#include "ntlib.h" 30#include "ntlib.h"
31#undef _WIN32_WINNT 31#undef _WIN32_WINNT
32#define _WIN32_WINNT 0x0501 /* for getaddrinfo stuff */ 32#define _WIN32_WINNT 0x0501 /* for getaddrinfo stuff */
33#include <winsock2.h> 33#if defined __MINGW32_VERSION && __MINGW32_VERSION >= 5000002L
34#include <ws2tcpip.h> 34# include <windows.h>
35#else
36# include <winsock2.h>
37#endif
38# include <ws2tcpip.h>
35#undef getaddrinfo 39#undef getaddrinfo
36#define getaddrinfo sys_getaddrinfo 40#define getaddrinfo sys_getaddrinfo
37#undef freeaddrinfo 41#undef freeaddrinfo