* charsets.c (get_codepage_index): Warning fix.

(init_printable_table): New function.
* charsets.h: Declare init_printable_table().
* setup.c (load_setup): Uncomment init_printable_table().
This commit is contained in:
Pavel Roskin 2001-06-07 20:04:03 +00:00
parent c4c5f40a87
commit d3b2663c2e
4 changed files with 34 additions and 3 deletions

View File

@ -1,5 +1,10 @@
2001-06-07 Pavel Roskin <proski@gnu.org>
* charsets.c (get_codepage_index): Warning fix.
(init_printable_table): New function.
* charsets.h: Declare init_printable_table().
* setup.c (load_setup): Uncomment init_printable_table().
* cons.saver.c: Make all functions except main() static.
* mfmt.c (omain): Remove, it's unused.

View File

@ -99,12 +99,12 @@ int get_codepage_index( const char *id )
return -1;
}
static char translate_character( iconv_t cd, const char c )
static char translate_character( iconv_t cd, char c )
{
char outbuf[4], *obuf;
size_t ibuflen, obuflen, count;
const char *ibuf = &c;
char *ibuf = &c;
obuf = outbuf;
ibuflen = 1; obuflen = 4;
@ -117,6 +117,31 @@ static char translate_character( iconv_t cd, const char c )
char errbuf[255];
/*
* FIXME: This assumes that ASCII is always the first encoding
* in mc.charsets
*/
#define CP_ASCII 0
char* init_printable_table( int cpdisplay )
{
int i;
uchar ch;
/* 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;
}
char* init_translation_table( int cpsource, int cpdisplay )
{
int i;

View File

@ -24,6 +24,7 @@ extern struct codepage_desc *codepages;
char *get_codepage_id( int n );
int get_codepage_index( const char *id );
int load_codepages_list();
char* init_printable_table( int cpdisplay );
char* init_translation_table( int cpsource, int cpdisplay );
void convert_to_display( char *str );
void convert_from_input( char *str );

View File

@ -650,7 +650,7 @@ load_setup (void)
char *errmsg;
display_codepage = get_codepage_index( cpname );
/* init_printable_table( display_codepage ); */
init_printable_table( display_codepage );
errmsg = init_translation_table( source_codepage, display_codepage );
if (errmsg)
message( 1, MSG_ERROR, "%s", errmsg );