1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

Fixed the printing and charset combo boxes in Unix PuTTY. (The

former by simply removing it; the latter by adding an enumeration
function to libcharset.) This has had slight `const' repercussions
on cp_name() and cp_enumerate() which might break the Mac build.

[originally from svn r3064]
This commit is contained in:
Simon Tatham
2003-04-05 16:36:11 +00:00
parent 09c9f31289
commit cf08c5a64a
8 changed files with 41 additions and 57 deletions

View File

@ -8,6 +8,7 @@
#include <time.h>
#include "putty.h"
#include "charset.h"
#include "terminal.h"
#include "misc.h"
@ -122,9 +123,7 @@ int init_ucs(struct unicode_data *ucsdata,
* line_codepage should be decoded from the specification in
* cfg.
*/
ucsdata->line_codepage = charset_from_mimeenc(linecharset);
if (ucsdata->line_codepage == CS_NONE)
ucsdata->line_codepage = charset_from_xenc(linecharset);
ucsdata->line_codepage = decode_codepage(linecharset);
/*
* If line_codepage is _still_ CS_NONE, we assume we're using
@ -218,3 +217,28 @@ int init_ucs(struct unicode_data *ucsdata,
return ret;
}
const char *cp_name(int codepage)
{
if (codepage == CS_NONE)
return "Use font encoding";
return charset_to_localenc(codepage);
}
const char *cp_enumerate(int index)
{
int charset;
if (index == 0)
return "Use font encoding";
charset = charset_localenc_nth(index-1);
if (charset == CS_NONE)
return NULL;
return charset_to_localenc(charset);
}
int decode_codepage(char *cp_name)
{
if (!*cp_name)
return CS_NONE; /* use font encoding */
return charset_from_localenc(cp_name);
}