* charsets.c (load_codepages_list): Use concat_dir_and_file().

This commit is contained in:
Pavel Roskin 2001-08-12 03:27:27 +00:00
parent 50a2391d2b
commit 0177db2941
2 changed files with 11 additions and 5 deletions

View File

@ -1,5 +1,7 @@
2001-08-11 Pavel Roskin <proski@gnu.org> 2001-08-11 Pavel Roskin <proski@gnu.org>
* charsets.c (load_codepages_list): Use concat_dir_and_file().
* mad.h: Disable glib support - it doesn't work properly. * mad.h: Disable glib support - it doesn't work properly.
2001-08-07 Pavel Roskin <proski@gnu.org> 2001-08-07 Pavel Roskin <proski@gnu.org>

View File

@ -6,8 +6,9 @@
#include <string.h> #include <string.h>
#include <iconv.h> #include <iconv.h>
#include "global.h"
#include "x.h"
#include "charsets.h" #include "charsets.h"
#include "i18n.h"
int n_codepages = 0; int n_codepages = 0;
@ -21,17 +22,20 @@ int load_codepages_list(void)
{ {
int result = -1; int result = -1;
FILE *f; FILE *f;
char *fname;
char buf[256]; char buf[256];
extern char* mc_home; extern char* mc_home;
extern int display_codepage; extern int display_codepage;
char * default_codepage = NULL; char * default_codepage = NULL;
strcpy ( buf, mc_home ); fname = concat_dir_and_file (mc_home, CHARSETS_INDEX);
strcat ( buf, "/" CHARSETS_INDEX ); if ( !( f = fopen( fname, "r" ) ) ) {
if ( !( f = fopen( buf, "r" ) ) ) g_free (fname);
return -1; return -1;
}
g_free (fname);
for ( n_codepages=0; fgets( buf, sizeof buf, f ); ) for ( n_codepages=0; fgets( buf, sizeof (buf), f ); )
if ( buf[0] != '\n' && buf[0] != '\0' && buf [0] != '#' ) if ( buf[0] != '\n' && buf[0] != '\0' && buf [0] != '#' )
++n_codepages; ++n_codepages;
rewind( f ); rewind( f );