* 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.
This commit is contained in:
Andrew V. Samoilov 2001-06-07 22:36:45 +00:00
parent e7f81bb092
commit 46e9007ea3
5 changed files with 28 additions and 23 deletions

View File

@ -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>
* setup.c (load_setup): Call init_printable_table() and

View File

@ -27,7 +27,7 @@ int load_codepages_list()
char * default_codepage = NULL;
strcpy ( buf, mc_home );
strcat ( buf, "/mc.charsets" );
strcat ( buf, "/" CHARSETS_INDEX );
if ( !( f = fopen( buf, "r" ) ) )
return -1;
@ -104,7 +104,7 @@ static char translate_character( iconv_t cd, char c )
char outbuf[4], *obuf;
size_t ibuflen, obuflen, count;
char *ibuf = &c;
const char *ibuf = &c;
obuf = outbuf;
ibuflen = 1; obuflen = 4;
@ -126,17 +126,14 @@ char errbuf[255];
char* init_printable_table( int cpdisplay )
{
int i;
uchar ch;
uchar ch = (cpdisplay == CP_ASCII) ? 0 : 1;
/* Fill printable characters table */
for (i=0; i<=127; ++i)
printable[i] = (i > 31 && i != 127);
ch = (cpdisplay == CP_ASCII) ? 0 : 1;
for (i=128; i<=255; ++i) {
printable[i] = 1;
printable[i] = (i > 31 && i != 127);
}
return NULL;
@ -155,7 +152,6 @@ char* init_translation_table( int cpsource, int cpdisplay )
for (i=0; i<=255; ++i) {
conv_displ[i] = i;
conv_input[i] = i;
printable[i] = (i > 31 && i != 127);
}
return NULL;
}
@ -163,7 +159,6 @@ char* init_translation_table( int cpsource, int cpdisplay )
for (i=0; i<=127; ++i) {
conv_displ[i] = i;
conv_input[i] = i;
printable[i] = (i > 31 && i != 127);
}
cpsour = codepages[ cpsource ].id;
@ -193,7 +188,6 @@ char* init_translation_table( int cpsource, int cpdisplay )
for (i=128; i<=255; ++i) {
ch = translate_character( cd, i );
conv_input[i] = (ch == UNKNCHAR) ? i : ch;
printable[i] = 1;
}
iconv_close( cd );

View File

@ -4,7 +4,7 @@
#define UNKNCHAR '\001'
#define CHARSETS_INDEX LIBDIR "mc.charsets"
#define CHARSETS_INDEX "mc.charsets"
typedef unsigned char uchar;

View File

@ -68,29 +68,29 @@ int select_charset( int current_charset, int seldisplay )
int do_select_codepage()
{
char *errmsg;
#ifndef HAVE_ICONV
message( 1, _(" Warning "),
"Midnight Commander was compiled without iconv support,\n"
"so charsets recoding feature is not available!" );
_("Midnight Commander was compiled without iconv support,\n"
"so charsets recoding feature is not available!" ));
return -1;
#else
char *errmsg;
if (display_codepage > 0) {
source_codepage = select_charset( source_codepage, 0 );
errmsg = init_translation_table( source_codepage, display_codepage );
if (errmsg) {
message( 1, _(" Error "), errmsg );
message( 1, MSG_ERROR, "%s", errmsg );
return -1;
}
} else {
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"
"Do not forget to save options." );
"Do not forget to save options." ));
return -1;
}
return 0;

View File

@ -639,9 +639,7 @@ load_setup (void)
#ifdef HAVE_CHARSET
if ( load_codepages_list() <= 0 ) {
char errmsg[256];
sprintf( errmsg, _("Can't load %s"), CHARSETS_INDEX );
message( 1, MSG_ERROR, "%s", errmsg );
message( 1, MSG_ERROR, _("Can't load %s/%s"), mc_home, CHARSETS_INDEX );
} else {
char cpname[128];
load_string( "Misc", "display_codepage", "",
@ -708,10 +706,11 @@ load_keys_from_section (char *terminal, char *profile_name)
while (profile_keys){
profile_keys = profile_iterator_next (profile_keys, &key, &value);
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);
g_free (valcopy);
g_free (valcopy);
}
}
g_free (section_name);
return;