* charsets.h: Define CHARSETS_INDEX without leading LIBDIR.
* charsets.c (translate_character): Warning fix. (init_translation_table): Don't deal with printable. This one is initialized by init_printable_table (). (load_codepages_list): Use CHARSETS_INDEX. * selcodepage.c (do_select_codepage): Messages marked for i18n. * setup.c (load_setup): Eliminate errbuf. Fix error message.
Этот коммит содержится в:
родитель
e7f81bb092
Коммит
46e9007ea3
@ -1,3 +1,15 @@
|
|||||||
|
2001-06-07 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||||
|
|
||||||
|
* charsets.h: Define CHARSETS_INDEX without leading LIBDIR.
|
||||||
|
|
||||||
|
* charsets.c (translate_character): Warning fix.
|
||||||
|
(init_translation_table): Don't deal with printable.
|
||||||
|
This one is initialized by init_printable_table ().
|
||||||
|
(load_codepages_list): Use CHARSETS_INDEX.
|
||||||
|
|
||||||
|
* selcodepage.c (do_select_codepage): Messages marked for i18n.
|
||||||
|
* setup.c (load_setup): Eliminate errbuf. Fix error message.
|
||||||
|
|
||||||
2001-06-07 Pavel Roskin <proski@gnu.org>
|
2001-06-07 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
* setup.c (load_setup): Call init_printable_table() and
|
* setup.c (load_setup): Call init_printable_table() and
|
||||||
|
@ -27,7 +27,7 @@ int load_codepages_list()
|
|||||||
char * default_codepage = NULL;
|
char * default_codepage = NULL;
|
||||||
|
|
||||||
strcpy ( buf, mc_home );
|
strcpy ( buf, mc_home );
|
||||||
strcat ( buf, "/mc.charsets" );
|
strcat ( buf, "/" CHARSETS_INDEX );
|
||||||
if ( !( f = fopen( buf, "r" ) ) )
|
if ( !( f = fopen( buf, "r" ) ) )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ static char translate_character( iconv_t cd, char c )
|
|||||||
char outbuf[4], *obuf;
|
char outbuf[4], *obuf;
|
||||||
size_t ibuflen, obuflen, count;
|
size_t ibuflen, obuflen, count;
|
||||||
|
|
||||||
char *ibuf = &c;
|
const char *ibuf = &c;
|
||||||
obuf = outbuf;
|
obuf = outbuf;
|
||||||
ibuflen = 1; obuflen = 4;
|
ibuflen = 1; obuflen = 4;
|
||||||
|
|
||||||
@ -126,17 +126,14 @@ char errbuf[255];
|
|||||||
char* init_printable_table( int cpdisplay )
|
char* init_printable_table( int cpdisplay )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uchar ch;
|
uchar ch = (cpdisplay == CP_ASCII) ? 0 : 1;
|
||||||
|
|
||||||
/* Fill printable characters table */
|
/* Fill printable characters table */
|
||||||
for (i=0; i<=127; ++i)
|
for (i=0; i<=127; ++i)
|
||||||
printable[i] = (i > 31 && i != 127);
|
printable[i] = (i > 31 && i != 127);
|
||||||
|
|
||||||
ch = (cpdisplay == CP_ASCII) ? 0 : 1;
|
|
||||||
|
|
||||||
for (i=128; i<=255; ++i) {
|
for (i=128; i<=255; ++i) {
|
||||||
printable[i] = 1;
|
printable[i] = 1;
|
||||||
printable[i] = (i > 31 && i != 127);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -155,7 +152,6 @@ char* init_translation_table( int cpsource, int cpdisplay )
|
|||||||
for (i=0; i<=255; ++i) {
|
for (i=0; i<=255; ++i) {
|
||||||
conv_displ[i] = i;
|
conv_displ[i] = i;
|
||||||
conv_input[i] = i;
|
conv_input[i] = i;
|
||||||
printable[i] = (i > 31 && i != 127);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -163,7 +159,6 @@ char* init_translation_table( int cpsource, int cpdisplay )
|
|||||||
for (i=0; i<=127; ++i) {
|
for (i=0; i<=127; ++i) {
|
||||||
conv_displ[i] = i;
|
conv_displ[i] = i;
|
||||||
conv_input[i] = i;
|
conv_input[i] = i;
|
||||||
printable[i] = (i > 31 && i != 127);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cpsour = codepages[ cpsource ].id;
|
cpsour = codepages[ cpsource ].id;
|
||||||
@ -193,7 +188,6 @@ char* init_translation_table( int cpsource, int cpdisplay )
|
|||||||
for (i=128; i<=255; ++i) {
|
for (i=128; i<=255; ++i) {
|
||||||
ch = translate_character( cd, i );
|
ch = translate_character( cd, i );
|
||||||
conv_input[i] = (ch == UNKNCHAR) ? i : ch;
|
conv_input[i] = (ch == UNKNCHAR) ? i : ch;
|
||||||
printable[i] = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
iconv_close( cd );
|
iconv_close( cd );
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#define UNKNCHAR '\001'
|
#define UNKNCHAR '\001'
|
||||||
|
|
||||||
#define CHARSETS_INDEX LIBDIR "mc.charsets"
|
#define CHARSETS_INDEX "mc.charsets"
|
||||||
|
|
||||||
typedef unsigned char uchar;
|
typedef unsigned char uchar;
|
||||||
|
|
||||||
|
@ -68,29 +68,29 @@ int select_charset( int current_charset, int seldisplay )
|
|||||||
|
|
||||||
int do_select_codepage()
|
int do_select_codepage()
|
||||||
{
|
{
|
||||||
char *errmsg;
|
|
||||||
|
|
||||||
#ifndef HAVE_ICONV
|
#ifndef HAVE_ICONV
|
||||||
|
|
||||||
message( 1, _(" Warning "),
|
message( 1, _(" Warning "),
|
||||||
"Midnight Commander was compiled without iconv support,\n"
|
_("Midnight Commander was compiled without iconv support,\n"
|
||||||
"so charsets recoding feature is not available!" );
|
"so charsets recoding feature is not available!" ));
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
char *errmsg;
|
||||||
|
|
||||||
if (display_codepage > 0) {
|
if (display_codepage > 0) {
|
||||||
source_codepage = select_charset( source_codepage, 0 );
|
source_codepage = select_charset( source_codepage, 0 );
|
||||||
errmsg = init_translation_table( source_codepage, display_codepage );
|
errmsg = init_translation_table( source_codepage, display_codepage );
|
||||||
if (errmsg) {
|
if (errmsg) {
|
||||||
message( 1, _(" Error "), errmsg );
|
message( 1, MSG_ERROR, "%s", errmsg );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
message( 1, _(" Warning "),
|
message( 1, _(" Warning "),
|
||||||
"To use this feature select your codepage in\n"
|
_("To use this feature select your codepage in\n"
|
||||||
"Setup / Display Bits dialog!\n"
|
"Setup / Display Bits dialog!\n"
|
||||||
"Do not forget to save options." );
|
"Do not forget to save options." ));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
11
src/setup.c
11
src/setup.c
@ -639,9 +639,7 @@ load_setup (void)
|
|||||||
|
|
||||||
#ifdef HAVE_CHARSET
|
#ifdef HAVE_CHARSET
|
||||||
if ( load_codepages_list() <= 0 ) {
|
if ( load_codepages_list() <= 0 ) {
|
||||||
char errmsg[256];
|
message( 1, MSG_ERROR, _("Can't load %s/%s"), mc_home, CHARSETS_INDEX );
|
||||||
sprintf( errmsg, _("Can't load %s"), CHARSETS_INDEX );
|
|
||||||
message( 1, MSG_ERROR, "%s", errmsg );
|
|
||||||
} else {
|
} else {
|
||||||
char cpname[128];
|
char cpname[128];
|
||||||
load_string( "Misc", "display_codepage", "",
|
load_string( "Misc", "display_codepage", "",
|
||||||
@ -708,10 +706,11 @@ load_keys_from_section (char *terminal, char *profile_name)
|
|||||||
while (profile_keys){
|
while (profile_keys){
|
||||||
profile_keys = profile_iterator_next (profile_keys, &key, &value);
|
profile_keys = profile_iterator_next (profile_keys, &key, &value);
|
||||||
key_code = lookup_key (key);
|
key_code = lookup_key (key);
|
||||||
valcopy = convert_controls (value);
|
if (key_code){
|
||||||
if (key_code)
|
valcopy = convert_controls (value);
|
||||||
define_sequence (key_code, valcopy, MCKEY_NOACTION);
|
define_sequence (key_code, valcopy, MCKEY_NOACTION);
|
||||||
g_free (valcopy);
|
g_free (valcopy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
g_free (section_name);
|
g_free (section_name);
|
||||||
return;
|
return;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user