Multicodepage patch: comments and system default codepage in mc.charsets



Hi!

Today I applied patch for src/charset.c. Here is ChangeLog entry:

	* charsets.c (load_codepages_list): Lines in mc.charset beginning
	with a # are comments. Use "default character_set_name" in mc.charset
	to set default codepage for your system.
	(xstrncpy): Eliminate.

And this is its party for setup.c.

WBR,
Andrew.

Index: setup.c
===================================================================
RCS file: /home/sav/.cvsroot/mc/src/setup.c,v
retrieving revision 1.38
diff -u -p -u -r1.38 setup.c
--- setup.c	2001/05/31 12:56:12	1.38
+++ setup.c	2001/06/05 01:24:14
@@ -54,6 +54,11 @@
 #     define PORT_LIST_MODE_DEFAULT "full"
 #endif
 
+#ifdef HAVE_CHARSET
+#include "dialog.h"
+#include "charsets.h"
+#endif /* HAVE_CHARSET */
+
 #include "../vfs/vfs.h"
 #ifdef USE_NETCODE
 #   include "../vfs/ftpfs.h"
@@ -193,8 +193,10 @@ static const struct {
     { "safe_delete", &know_not_what_am_i_doing },
     { "mouse_repeat_rate", &mou_auto_repeat },
     { "double_click_speed", &double_click_speed },
+#ifndef HAVE_CHASET
     { "eight_bit_clean", &eight_bit_clean },
     { "full_eight_bits", &full_eight_bits },
+#endif /* HAVE_CHARSET */
     { "use_8th_bit_as_meta", &use_8th_bit_as_meta },
     { "confirm_view_dir", &confirm_view_dir },
     { "mouse_move_pages", &mouse_move_pages },
@@ -437,6 +431,10 @@ save_setup (void)
 				   ftpfs_proxy_host, profile);
 #endif
 #endif
+#ifdef HAVE_CODESET
+     save_string( "Misc", "display_codepage",
+    		  get_codepage_id( display_codepage ), profile_name );
+#endif /* HAVE_CODESET */
     g_free (profile);
     saving_setup = 0;
 }
@@ -636,6 +630,29 @@ load_setup (void)
     ftpfs_init_passwd ();
 #endif
 #endif
+#ifdef HAVE_CHARSET
+    if ( load_codepages_list() <= 0 ) {
+	message( 1, MSG_ERROR, _("Can't load %s/%s"), mc_home, "mc.charsets" );
+    } else {
+ 	char cpname[128];
+ 	load_string( "Misc", "display_codepage", "",
+ 		     cpname, sizeof(cpname) );
+
+	if ( cpname[0] == '\0' ) {
+	    /* There is not default codepage in mc.charset */
+	    if ( display_codepage == -1 )
+		message( 1, _(" Warning "),
+		    _("Select your codepage in Setup / Display Bits dialog!"));
+	} else
+	    display_codepage = get_codepage_index( cpname );
+    }
+    {
+ 	char *errmsg =
+	    init_translation_table( source_codepage, display_codepage );
+	if (errmsg)
+	    message( 1, MSG_ERROR, "%s", errmsg );
+    }
+#endif /* HAVE_CHARSET */
 }
 
 #ifdef USE_VFS




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]