1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-27 02:56:18 -04:00

[dos] get System codepage under dos

This commit is contained in:
Witold Filipczyk 2022-06-05 19:12:25 +02:00
parent 3d1280fd2a
commit 064c79433d
2 changed files with 22 additions and 0 deletions

View File

@ -27,6 +27,9 @@
#include "document/options.h"
#include "intl/charsets.h"
#ifdef CONFIG_OS_DOS
#include "osdep/dos/dos.h"
#endif
#include "util/conv.h"
#include "util/error.h"
#include "util/fastfind.h"
@ -1500,8 +1503,17 @@ get_cp_index(const char *name)
#if HAVE_LANGINFO_CODESET
name = nl_langinfo(CODESET);
syscp = SYSTEM_CHARSET_FLAG;
#else
#ifdef CONFIG_OS_DOS
int cp = os_default_charset();
if (cp != -1) {
return cp | SYSTEM_CHARSET_FLAG;
} else {
name = "us-ascii";
}
#else
name = "us-ascii";
#endif
#endif
}
@ -1581,8 +1593,17 @@ get_cp_index(const char *name)
#if HAVE_LANGINFO_CODESET
name = nl_langinfo(CODESET);
syscp = SYSTEM_CHARSET_FLAG;
#else
#ifdef CONFIG_OS_DOS
int cp = os_default_charset();
if (cp != -1) {
return cp | SYSTEM_CHARSET_FLAG;
} else {
name = "us-ascii";
}
#else
name = "us-ascii";
#endif
#endif
}

View File

@ -26,6 +26,7 @@ void save_terminal(void);
void restore_terminal(void);
int dos_setraw(int ctl, int save);
void os_seed_random(unsigned char **pool, int *pool_size);
int os_default_charset(void);
#ifndef DOS_OVERRIDES_SELF