diff options
author | Eli Zaretskii <eliz@gnu.org> | 2009-04-19 18:29:33 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2009-04-19 18:29:33 +0000 |
commit | 7cf431690113efd48c887d9fda54f98091093794 (patch) | |
tree | f132157e563f5479a3b356f9de3180221a227969 /gdb/go32-nat.c | |
parent | 2931783d51fa2b396f506ddf570a6683ac71ddc5 (diff) | |
download | gdb-7cf431690113efd48c887d9fda54f98091093794.tar.gz |
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.
Diffstat (limited to 'gdb/go32-nat.c')
-rw-r--r-- | gdb/go32-nat.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 267df62b343..e49125f36dc 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -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. */ |