From d7f635e142feae488cc453a95b9fd7691095278c Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sat, 17 Aug 2002 01:11:21 +0000 Subject: [PATCH] * setup.c: New variable global_profile_name to hold full name of mc.lib. (load_setup): Calculate global_profile_name. (done_setup): Free global_profile_name. (load_key_defs): Use global_profile_name. * treestore.c (should_skip_directory): Likewise. --- src/ChangeLog | 9 ++++++++- src/setup.c | 18 +++++++++++------- src/setup.h | 1 + src/treestore.c | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 728ffa3ca..06f75d944 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,12 +1,19 @@ 2002-08-16 Pavel Roskin + * setup.c: New variable global_profile_name to hold full name of + mc.lib. + (load_setup): Calculate global_profile_name. + (done_setup): Free global_profile_name. + (load_key_defs): Use global_profile_name. + * treestore.c (should_skip_directory): Likewise. + * man2hlp.c: Implement persistent fread and fwrite to make sure that all output is read and written. 2002-08-16 Andrew V. Samoilov * help.c (show): Cast *paint_start to unsigned char to display - Cyryllic with ncurses. + Cyrillic with ncurses. [HAS_ACS_AS_PCCHARS] (acs2pc_table): Make const. * user.c (expand_format): Cast the argument to functions diff --git a/src/setup.c b/src/setup.c index 5644840f7..cc67dbfdf 100644 --- a/src/setup.c +++ b/src/setup.c @@ -61,7 +61,8 @@ extern char *find_ignore_dirs; extern int num_history_items_recorded; -char *profile_name; +char *profile_name; /* .mc/ini */ +char *global_profile_name; /* mc.lib */ char setup_color_string [4096]; char term_color_string [4096]; @@ -499,6 +500,11 @@ load_setup (void) int i; profile = setup_init (); + + /* mc.lib is common for all users, but has priority lower than + ~/.mc/ini. FIXME: it's only used for keys and treestore now */ + global_profile_name = concat_dir_and_file (mc_home, "mc.lib"); + /* Load integer boolean options */ for (i = 0; options [i].opt_name; i++) *options [i].opt_addr = @@ -586,6 +592,7 @@ load_anon_passwd () void done_setup (void) { g_free (profile_name); + g_free (global_profile_name); done_hotlist (); done_panelize (); /* directory_history_free (); */ @@ -624,18 +631,15 @@ load_keys_from_section (char *terminal, char *profile_name) void load_key_defs (void) { - char *libfile = concat_dir_and_file (mc_home, "mc.lib"); - /* * Load keys from mc.lib before ~/.mc/ini, so that the user * definitions override global settings. */ - load_keys_from_section ("general", libfile); - load_keys_from_section (getenv ("TERM"), libfile); + load_keys_from_section ("general", global_profile_name); + load_keys_from_section (getenv ("TERM"), global_profile_name); load_keys_from_section ("general", profile_name); load_keys_from_section (getenv ("TERM"), profile_name); /* We don't want a huge database loaded in core */ - free_profile_name (libfile); - g_free (libfile); + free_profile_name (global_profile_name); } diff --git a/src/setup.h b/src/setup.h index 0e24c129f..fbe704318 100644 --- a/src/setup.h +++ b/src/setup.h @@ -19,6 +19,7 @@ void save_panel_types (void); char *load_anon_passwd (void); extern char *profile_name; +extern char *global_profile_name; extern char setup_color_string []; extern char term_color_string []; diff --git a/src/treestore.c b/src/treestore.c index b2f8bddd9..42c5c07fa 100644 --- a/src/treestore.c +++ b/src/treestore.c @@ -770,7 +770,7 @@ should_skip_directory(char *dir) loaded = 1; setup_init(); process_special_dirs(&special_dirs, profile_name); - process_special_dirs(&special_dirs, CONFDIR "mc.global"); + process_special_dirs(&special_dirs, global_profile_name); } for (l = special_dirs; l; l = l->next) {