mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-27 01:28:46 +00:00
Set default host and target charsets in the DJGPP port.
* config/djgpp/config.sed (am_cv_langinfo_codeset) (bash_cv_langinfo_codeset, ac_cv_header_nl_types_h): Set to "yes" in all configure scripts that define ac_cv_env_CPP_value. * go32-nat.c (dos_codepage, nl_langinfo): New functions. Include langinfo.h. * config/djgpp/nl_types.h: New file. * config/djgpp/langinfo.h: New file. * config/i386/go32.mh (MH_CFLAGS): Add $(srcdir)/config/djgpp.
This commit is contained in:
@@ -53,6 +53,8 @@
|
||||
#include <debug/redir.h>
|
||||
#endif
|
||||
|
||||
#include <langinfo.h>
|
||||
|
||||
#if __DJGPP_MINOR__ < 3
|
||||
/* This code will be provided from DJGPP 2.03 on. Until then I code it
|
||||
here */
|
||||
@@ -938,6 +940,47 @@ init_go32_ops (void)
|
||||
strcpy (gdbinit, "gdb.ini");
|
||||
}
|
||||
|
||||
/* Return the current DOS codepage number. */
|
||||
static int
|
||||
dos_codepage (void)
|
||||
{
|
||||
__dpmi_regs regs;
|
||||
|
||||
regs.x.ax = 0x6601;
|
||||
__dpmi_int (0x21, ®s);
|
||||
if (!(regs.x.flags & 1))
|
||||
return regs.x.bx & 0xffff;
|
||||
else
|
||||
return 437; /* default */
|
||||
}
|
||||
|
||||
/* Limited emulation of `nl_langinfo', for charset.c. */
|
||||
char *
|
||||
nl_langinfo (nl_item item)
|
||||
{
|
||||
char *retval;
|
||||
|
||||
switch (item)
|
||||
{
|
||||
case CODESET:
|
||||
{
|
||||
/* 8 is enough for SHORT_MAX + "CP" + null. */
|
||||
char buf[8];
|
||||
int blen = sizeof (buf);
|
||||
int needed = snprintf (buf, blen, "CP%d", dos_codepage ());
|
||||
|
||||
if (needed > blen) /* should never happen */
|
||||
buf[0] = 0;
|
||||
retval = xstrdup (buf);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
retval = xstrdup ("");
|
||||
break;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
unsigned short windows_major, windows_minor;
|
||||
|
||||
/* Compute the version Windows reports via Int 2Fh/AX=1600h. */
|
||||
|
||||
Reference in New Issue
Block a user