Renamed global variable mc_home into mc_main_sysconf_dir

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2009-09-25 12:32:55 +03:00
parent 62e4ab5d92
commit 1d4318a2be
16 changed files with 45 additions and 49 deletions

View File

@ -53,7 +53,7 @@
#include "../src/history.h" #include "../src/history.h"
#include "../src/widget.h" /* listbox_new() */ #include "../src/widget.h" /* listbox_new() */
#include "../src/layout.h" /* clr_scr() */ #include "../src/layout.h" /* clr_scr() */
#include "../src/main.h" /* mc_home source_codepage */ #include "../src/main.h" /* mc_main_sysconf_dir source_codepage */
#include "../src/help.h" /* interactive_display() */ #include "../src/help.h" /* interactive_display() */
#include "../src/wtools.h" /* message() */ #include "../src/wtools.h" /* message() */
#include "../src/charsets.h" #include "../src/charsets.h"
@ -898,7 +898,7 @@ edit_load_syntax_file (WEdit * edit)
_("&User"), _("&System Wide")); _("&User"), _("&System Wide"));
} }
extdir = concat_dir_and_file (mc_home, "syntax" PATH_SEP_STR "Syntax"); extdir = concat_dir_and_file (mc_main_sysconf_dir, "syntax" PATH_SEP_STR "Syntax");
if (!exist_file(extdir)) { if (!exist_file(extdir)) {
g_free (extdir); g_free (extdir);
extdir = concat_dir_and_file (mc_main_sharedata_dir, "syntax" PATH_SEP_STR "Syntax"); extdir = concat_dir_and_file (mc_main_sharedata_dir, "syntax" PATH_SEP_STR "Syntax");
@ -930,7 +930,7 @@ edit_load_menu_file (WEdit * edit)
geteuid() ? 2 : 3, _("&Local"), _("&User"), _("&System Wide") geteuid() ? 2 : 3, _("&Local"), _("&User"), _("&System Wide")
); );
menufile = concat_dir_and_file (mc_home, EDIT_GLOBAL_MENU); menufile = concat_dir_and_file (mc_main_sysconf_dir, EDIT_GLOBAL_MENU);
if (!exist_file (menufile)) { if (!exist_file (menufile)) {
g_free (menufile); g_free (menufile);
@ -950,7 +950,7 @@ edit_load_menu_file (WEdit * edit)
break; break;
case 2: case 2:
buffer = concat_dir_and_file (mc_home, EDIT_GLOBAL_MENU); buffer = concat_dir_and_file (mc_main_sysconf_dir, EDIT_GLOBAL_MENU);
if (!exist_file (buffer)) { if (!exist_file (buffer)) {
g_free (buffer); g_free (buffer);
buffer = concat_dir_and_file (mc_main_sharedata_dir, EDIT_GLOBAL_MENU); buffer = concat_dir_and_file (mc_main_sharedata_dir, EDIT_GLOBAL_MENU);
@ -2125,7 +2125,7 @@ edit_block_process_cmd (WEdit *edit, const char *shell_cmd, int block)
gchar *o, *h, *b, *tmp; gchar *o, *h, *b, *tmp;
char *quoted_name = NULL; char *quoted_name = NULL;
o = g_strconcat (mc_home, shell_cmd, (char *) NULL); /* original source script */ o = g_strconcat (mc_main_sysconf_dir, shell_cmd, (char *) NULL); /* original source script */
h = g_strconcat (home_dir, PATH_SEP_STR EDIT_DIR, shell_cmd, (char *) NULL); /* home script */ h = g_strconcat (home_dir, PATH_SEP_STR EDIT_DIR, shell_cmd, (char *) NULL); /* home script */
b = concat_dir_and_file (home_dir, EDIT_BLOCK_FILE); /* block file */ b = concat_dir_and_file (home_dir, EDIT_BLOCK_FILE); /* block file */

View File

@ -58,7 +58,7 @@
#include "edit-impl.h" #include "edit-impl.h"
#include "edit-widget.h" #include "edit-widget.h"
#include "../src/main.h" /* mc_home */ #include "../src/main.h" /* mc_main_sysconf_dir */
#include "../src/wtools.h" /* message() */ #include "../src/wtools.h" /* message() */
#include "../src/strutil.h" /* utf string functions */ #include "../src/strutil.h" /* utf string functions */
@ -690,7 +690,7 @@ static FILE *open_include_file (const char *filename)
return f; return f;
g_free (error_file_name); g_free (error_file_name);
error_file_name = g_strconcat (mc_home, PATH_SEP_STR, "syntax", PATH_SEP_STR, error_file_name = g_strconcat (mc_main_sysconf_dir, PATH_SEP_STR, "syntax", PATH_SEP_STR,
filename, (char *) NULL); filename, (char *) NULL);
if ((f = fopen (error_file_name, "r"))) { if ((f = fopen (error_file_name, "r"))) {
@ -1045,7 +1045,7 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
f = fopen (syntax_file, "r"); f = fopen (syntax_file, "r");
if (!f){ if (!f){
lib_file = concat_dir_and_file (mc_home, "Syntax"); lib_file = concat_dir_and_file (mc_main_sysconf_dir, "Syntax");
f = fopen (lib_file, "r"); f = fopen (lib_file, "r");
g_free (lib_file); g_free (lib_file);
if (!f) if (!f)

View File

@ -38,7 +38,7 @@
extern int reset_hp_softkeys; extern int reset_hp_softkeys;
extern char *mc_home; extern char *mc_main_sysconf_dir;
extern char *mc_main_sharedata_dir; extern char *mc_main_sharedata_dir;
/* colors specified on the command line: they override any other setting */ /* colors specified on the command line: they override any other setting */
@ -380,7 +380,7 @@ mc_args_process(void)
return FALSE; return FALSE;
} }
if (mc_args__show_datadirs){ if (mc_args__show_datadirs){
printf ("%s (%s)\n", mc_home, mc_main_sharedata_dir); printf ("%s (%s)\n", mc_main_sysconf_dir, mc_main_sharedata_dir);
return FALSE; return FALSE;
} }

View File

@ -55,7 +55,7 @@ load_codepages_list (void)
char buf[BUF_MEDIUM]; char buf[BUF_MEDIUM];
char *default_codepage = NULL; char *default_codepage = NULL;
fname = concat_dir_and_file (mc_home, CHARSETS_INDEX); fname = concat_dir_and_file (mc_main_sysconf_dir, CHARSETS_INDEX);
if (!(f = fopen (fname, "r"))) { if (!(f = fopen (fname, "r"))) {
fprintf (stderr, _("Warning: file %s not found\n"), fname); fprintf (stderr, _("Warning: file %s not found\n"), fname);
g_free (fname); g_free (fname);

View File

@ -598,7 +598,7 @@ void ext_cmd (void)
_(" Which extension file you want to edit? "), D_NORMAL, 2, _(" Which extension file you want to edit? "), D_NORMAL, 2,
_("&User"), _("&System Wide")); _("&User"), _("&System Wide"));
} }
extdir = concat_dir_and_file (mc_home, MC_LIB_EXT); extdir = concat_dir_and_file (mc_main_sysconf_dir, MC_LIB_EXT);
if (dir == 0){ if (dir == 0){
buffer = concat_dir_and_file (home_dir, MC_USER_EXT); buffer = concat_dir_and_file (home_dir, MC_USER_EXT);
@ -631,7 +631,7 @@ edit_mc_menu_cmd (void)
_("&Local"), _("&User"), _("&System Wide") _("&Local"), _("&User"), _("&System Wide")
); );
menufile = concat_dir_and_file (mc_home, MC_GLOBAL_MENU); menufile = concat_dir_and_file (mc_main_sysconf_dir, MC_GLOBAL_MENU);
if (!exist_file(menufile)) { if (!exist_file(menufile)) {
g_free (menufile); g_free (menufile);
@ -651,7 +651,7 @@ edit_mc_menu_cmd (void)
break; break;
case 2: case 2:
buffer = concat_dir_and_file (mc_home, MC_GLOBAL_MENU); buffer = concat_dir_and_file (mc_main_sysconf_dir, MC_GLOBAL_MENU);
if (!exist_file(buffer)) { if (!exist_file(buffer)) {
g_free (buffer); g_free (buffer);
buffer = concat_dir_and_file (mc_main_sharedata_dir, MC_GLOBAL_MENU); buffer = concat_dir_and_file (mc_main_sharedata_dir, MC_GLOBAL_MENU);
@ -683,7 +683,7 @@ void edit_fhl_cmd (void)
_(" Which highlighting file you want to edit? "), D_NORMAL, 2, _(" Which highlighting file you want to edit? "), D_NORMAL, 2,
_("&User"), _("&System Wide")); _("&User"), _("&System Wide"));
} }
fhlfile = concat_dir_and_file (mc_home, MC_FHL_INI_FILE); fhlfile = concat_dir_and_file (mc_main_sysconf_dir, MC_FHL_INI_FILE);
if (dir == 0){ if (dir == 0){
user_mc_dir = concat_dir_and_file (home_dir, MC_BASE); user_mc_dir = concat_dir_and_file (home_dir, MC_BASE);
@ -695,7 +695,7 @@ void edit_fhl_cmd (void)
} else if (dir == 1) { } else if (dir == 1) {
if (!exist_file(fhlfile)) { if (!exist_file(fhlfile)) {
g_free (fhlfile); g_free (fhlfile);
fhlfile = concat_dir_and_file (mc_home, MC_FHL_INI_FILE); fhlfile = concat_dir_and_file (mc_main_sysconf_dir, MC_FHL_INI_FILE);
} }
do_edit (fhlfile); do_edit (fhlfile);
} }

View File

@ -453,7 +453,7 @@ regex_command (const char *filename, const char *action, int *move_dir)
if (!exist_file (extension_file)) { if (!exist_file (extension_file)) {
g_free (extension_file); g_free (extension_file);
check_stock_mc_ext: check_stock_mc_ext:
extension_file = concat_dir_and_file (mc_home, MC_LIB_EXT); extension_file = concat_dir_and_file (mc_main_sysconf_dir, MC_LIB_EXT);
if (!exist_file (extension_file)) { if (!exist_file (extension_file)) {
g_free (extension_file); g_free (extension_file);
extension_file = concat_dir_and_file (mc_main_sharedata_dir, MC_LIB_EXT); extension_file = concat_dir_and_file (mc_main_sharedata_dir, MC_LIB_EXT);
@ -476,12 +476,12 @@ regex_command (const char *filename, const char *action, int *move_dir)
} else { } else {
char *title = char *title =
g_strdup_printf (_(" %s%s file error"), g_strdup_printf (_(" %s%s file error"),
mc_home, MC_LIB_EXT); mc_main_sysconf_dir, MC_LIB_EXT);
message (D_ERROR, title, _("The format of the %smc.ext " message (D_ERROR, title, _("The format of the %smc.ext "
"file has changed with version 3.0. It seems that " "file has changed with version 3.0. It seems that "
"the installation failed. Please fetch a fresh " "the installation failed. Please fetch a fresh "
"copy from the Midnight Commander package."), "copy from the Midnight Commander package."),
mc_home); mc_main_sysconf_dir);
g_free (title); g_free (title);
return 0; return 0;
} }
@ -493,7 +493,7 @@ regex_command (const char *filename, const char *action, int *move_dir)
message (D_ERROR, title, _("The format of the ~/%s file has " message (D_ERROR, title, _("The format of the ~/%s file has "
"changed with version 3.0. You may either want to copy " "changed with version 3.0. You may either want to copy "
"it from %smc.ext or use that file as an example of how " "it from %smc.ext or use that file as an example of how "
"to write it."), MC_USER_EXT, mc_home); "to write it."), MC_USER_EXT, mc_main_sysconf_dir);
g_free (title); g_free (title);
} }
} }

View File

@ -216,7 +216,7 @@ mc_fhl_init_from_standart_files (mc_fhl_t * fhl)
g_free (name); g_free (name);
/* ${sysconfdir}/mc/filehighlight.ini */ /* ${sysconfdir}/mc/filehighlight.ini */
name = concat_dir_and_file (mc_home, MC_FHL_INI_FILE); name = concat_dir_and_file (mc_main_sysconf_dir, MC_FHL_INI_FILE);
if (exist_file (name) && (!mc_fhl_read_ini_file (fhl, name))) { if (exist_file (name) && (!mc_fhl_read_ini_file (fhl, name))) {
g_free (name); g_free (name);
return FALSE; return FALSE;

View File

@ -289,10 +289,10 @@ int midnight_shutdown = 0;
/* The user's shell */ /* The user's shell */
char *shell = NULL; char *shell = NULL;
/* mc_home: The home of MC - /etc/mc or defined by MC_DATADIR */ /* mc_main_sysconf_dir: The main config dir for MC - ${prefix}/etc/mc or defined by MC_CONFDIR */
char *mc_home = NULL; char *mc_main_sysconf_dir = NULL;
/* mc_main_sharedata_dir: Alternative home of MC - deprecated /usr/share/mc */ /* mc_main_sharedata_dir: Share data dir for MC - ${prefix}/share/mc or defined by MC_DATADIR */
char *mc_main_sharedata_dir = NULL; char *mc_main_sharedata_dir = NULL;
char cmd_buf[512]; char cmd_buf[512];
@ -1876,22 +1876,17 @@ OS_Setup (void)
shell = g_strdup ("/bin/sh"); shell = g_strdup ("/bin/sh");
} }
/* This is the directory, where MC was installed, on Unix this is DATADIR */
/* and can be overriden by the MC_DATADIR environment variable */
mc_libdir = getenv ("MC_DATADIR"); mc_libdir = getenv ("MC_DATADIR");
if (mc_libdir != NULL) { mc_main_sharedata_dir = (mc_libdir != NULL) ? g_strdup (mc_libdir) : g_strdup (DATADIR);
mc_home = g_strdup (mc_libdir);
mc_main_sharedata_dir = g_strdup (SYSCONFDIR); mc_libdir = getenv ("MC_CONFDIR");
} else { mc_main_sysconf_dir = (mc_libdir != NULL) ? g_strdup (mc_libdir) : g_strdup (SYSCONFDIR);
mc_home = g_strdup (SYSCONFDIR);
mc_main_sharedata_dir = g_strdup (DATADIR);
}
/* This variable is used by the subshell */ /* This variable is used by the subshell */
home_dir = getenv ("HOME"); home_dir = getenv ("HOME");
if (!home_dir) if (!home_dir)
home_dir = mc_home; home_dir = mc_main_sysconf_dir;
} }
@ -2213,7 +2208,7 @@ main (int argc, char *argv[])
g_free (last_wd_string); g_free (last_wd_string);
g_free (mc_main_sharedata_dir); g_free (mc_main_sharedata_dir);
g_free (mc_home); g_free (mc_main_sysconf_dir);
g_free (shell); g_free (shell);
done_key (); done_key ();

View File

@ -107,7 +107,7 @@ void print_vfs_message(const char *msg, ...)
extern const char *prompt; extern const char *prompt;
extern const char *edit_one_file; extern const char *edit_one_file;
extern char *mc_home; extern char *mc_main_sysconf_dir;
extern char *mc_main_sharedata_dir; extern char *mc_main_sharedata_dir;
struct mc_fhl_struct; struct mc_fhl_struct;

View File

@ -600,9 +600,9 @@ load_setup_get_full_config_name(const char *subdir, const char *config_file_name
if (subdir) if (subdir)
ret = g_build_filename (mc_home, subdir, basename, NULL); ret = g_build_filename (mc_main_sysconf_dir, subdir, basename, NULL);
else else
ret = g_build_filename (mc_home, basename, NULL); ret = g_build_filename (mc_main_sysconf_dir, basename, NULL);
if (exist_file(ret)) { if (exist_file(ret)) {
g_free(basename); g_free(basename);
@ -661,8 +661,8 @@ load_setup_get_keymap_profile_config(void)
load_setup_init_config_from_file( &keymap_config, fname); load_setup_init_config_from_file( &keymap_config, fname);
g_free(fname); g_free(fname);
/* 2) /etc/mc (mc_home) */ /* 2) /etc/mc (mc_main_sysconf_dir) */
fname = g_build_filename (mc_home, GLOBAL_KEYMAP_FILE, NULL); fname = g_build_filename (mc_main_sysconf_dir, GLOBAL_KEYMAP_FILE, NULL);
load_setup_init_config_from_file( &keymap_config, fname); load_setup_init_config_from_file( &keymap_config, fname);
g_free(fname); g_free(fname);
@ -712,7 +712,7 @@ setup_init (void)
profile = concat_dir_and_file (home_dir, PROFILE_NAME); profile = concat_dir_and_file (home_dir, PROFILE_NAME);
if (!exist_file (profile)){ if (!exist_file (profile)){
inifile = concat_dir_and_file (mc_home, "mc.ini"); inifile = concat_dir_and_file (mc_main_sysconf_dir, "mc.ini");
if (exist_file (inifile)){ if (exist_file (inifile)){
g_free (profile); g_free (profile);
profile = inifile; profile = inifile;
@ -743,7 +743,8 @@ load_setup (void)
/* mc.lib is common for all users, but has priority lower than /* mc.lib is common for all users, but has priority lower than
~/.mc/ini. FIXME: it's only used for keys and treestore now */ ~/.mc/ini. FIXME: it's only used for keys and treestore now */
global_profile_name = concat_dir_and_file (mc_home, "mc.lib"); global_profile_name = concat_dir_and_file (mc_main_sysconf_dir, "mc.lib");
if (!exist_file(global_profile_name)) { if (!exist_file(global_profile_name)) {
g_free (global_profile_name); g_free (global_profile_name);
global_profile_name = concat_dir_and_file (mc_main_sharedata_dir, "mc.lib"); global_profile_name = concat_dir_and_file (mc_main_sharedata_dir, "mc.lib");

View File

@ -99,7 +99,7 @@ mc_skin_ini_file_load (mc_skin_t * mc_skin)
g_free (user_home_dir); g_free (user_home_dir);
/* /etc/mc/skins/ */ /* /etc/mc/skins/ */
if (mc_skin_ini_file_load_search_in_dir (mc_skin, mc_home)) if (mc_skin_ini_file_load_search_in_dir (mc_skin, mc_main_sysconf_dir))
return TRUE; return TRUE;
/* /usr/share/mc/skins/ */ /* /usr/share/mc/skins/ */

View File

@ -763,7 +763,7 @@ user_menu_cmd (WEdit *edit_widget)
if (!exist_file (menu)){ if (!exist_file (menu)){
g_free (menu); g_free (menu);
menu = concat_dir_and_file menu = concat_dir_and_file
(mc_home, edit_widget ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU); (mc_main_sysconf_dir, edit_widget ? EDIT_GLOBAL_MENU : MC_GLOBAL_MENU);
if (!exist_file (menu)) { if (!exist_file (menu)) {
g_free (menu); g_free (menu);
menu = concat_dir_and_file menu = concat_dir_and_file

View File

@ -46,7 +46,7 @@
#include "../src/search/search.h" #include "../src/search/search.h"
#include "main.h" /* mc_home */ #include "main.h" /* mc_main_sysconf_dir */
#include "cmd.h" /* guess_message_value */ #include "cmd.h" /* guess_message_value */
#include "mountlist.h" #include "mountlist.h"
#include "timefmt.h" #include "timefmt.h"
@ -592,7 +592,7 @@ load_mc_home_file (const char *filename, char **allocated_filename)
char *lang; char *lang;
char *data; char *data;
hintfile_base = concat_dir_and_file (mc_home, filename); hintfile_base = concat_dir_and_file (mc_main_sysconf_dir, filename);
lang = guess_message_value (); lang = guess_message_value ();
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL); hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);

View File

@ -1306,7 +1306,7 @@ static int extfs_init (struct vfs_class *me)
(void) me; (void) me;
mc_extfsini = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR "extfs.ini"); mc_extfsini = concat_dir_and_file (mc_main_sysconf_dir, "extfs" PATH_SEP_STR "extfs.ini");
cfg = fopen (mc_extfsini, "r"); cfg = fopen (mc_extfsini, "r");
/* We may not use vfs_die() message or message or similar, /* We may not use vfs_die() message or message or similar,

View File

@ -570,7 +570,7 @@ ftpfs_load_no_proxy_list (void)
if (mc_file) if (mc_file)
return; return;
mc_file = concat_dir_and_file (mc_home, "mc.no_proxy"); mc_file = concat_dir_and_file (mc_main_sysconf_dir, "mc.no_proxy");
if (exist_file (mc_file) && if (exist_file (mc_file) &&
(npf = fopen (mc_file, "r"))) { (npf = fopen (mc_file, "r"))) {
while (fgets (s, sizeof (s), npf)) { while (fgets (s, sizeof (s), npf)) {

View File

@ -344,7 +344,7 @@ static int sfs_init (struct vfs_class *me)
(void) me; (void) me;
mc_sfsini = concat_dir_and_file (mc_home, "extfs" PATH_SEP_STR "sfs.ini"); mc_sfsini = concat_dir_and_file (mc_main_sysconf_dir, "extfs" PATH_SEP_STR "sfs.ini");
cfg = fopen (mc_sfsini, "r"); cfg = fopen (mc_sfsini, "r");
if (!cfg){ if (!cfg){