mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 04:22:34 +03:00
Renamed global variable mc_home into mc_main_sysconf_dir
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
62e4ab5d92
commit
1d4318a2be
@ -53,7 +53,7 @@
|
||||
#include "../src/history.h"
|
||||
#include "../src/widget.h" /* listbox_new() */
|
||||
#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/wtools.h" /* message() */
|
||||
#include "../src/charsets.h"
|
||||
@ -898,7 +898,7 @@ edit_load_syntax_file (WEdit * edit)
|
||||
_("&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)) {
|
||||
g_free (extdir);
|
||||
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")
|
||||
);
|
||||
|
||||
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)) {
|
||||
g_free (menufile);
|
||||
@ -950,7 +950,7 @@ edit_load_menu_file (WEdit * edit)
|
||||
break;
|
||||
|
||||
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)) {
|
||||
g_free (buffer);
|
||||
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;
|
||||
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 */
|
||||
b = concat_dir_and_file (home_dir, EDIT_BLOCK_FILE); /* block file */
|
||||
|
||||
|
@ -58,7 +58,7 @@
|
||||
#include "edit-impl.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/strutil.h" /* utf string functions */
|
||||
|
||||
@ -690,7 +690,7 @@ static FILE *open_include_file (const char *filename)
|
||||
return f;
|
||||
|
||||
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);
|
||||
|
||||
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");
|
||||
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");
|
||||
g_free (lib_file);
|
||||
if (!f)
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
extern int reset_hp_softkeys;
|
||||
|
||||
extern char *mc_home;
|
||||
extern char *mc_main_sysconf_dir;
|
||||
extern char *mc_main_sharedata_dir;
|
||||
|
||||
/* colors specified on the command line: they override any other setting */
|
||||
@ -380,7 +380,7 @@ mc_args_process(void)
|
||||
return FALSE;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ load_codepages_list (void)
|
||||
char buf[BUF_MEDIUM];
|
||||
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"))) {
|
||||
fprintf (stderr, _("Warning: file %s not found\n"), fname);
|
||||
g_free (fname);
|
||||
|
10
src/cmd.c
10
src/cmd.c
@ -598,7 +598,7 @@ void ext_cmd (void)
|
||||
_(" Which extension file you want to edit? "), D_NORMAL, 2,
|
||||
_("&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){
|
||||
buffer = concat_dir_and_file (home_dir, MC_USER_EXT);
|
||||
@ -631,7 +631,7 @@ edit_mc_menu_cmd (void)
|
||||
_("&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)) {
|
||||
g_free (menufile);
|
||||
@ -651,7 +651,7 @@ edit_mc_menu_cmd (void)
|
||||
break;
|
||||
|
||||
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)) {
|
||||
g_free (buffer);
|
||||
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,
|
||||
_("&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){
|
||||
user_mc_dir = concat_dir_and_file (home_dir, MC_BASE);
|
||||
@ -695,7 +695,7 @@ void edit_fhl_cmd (void)
|
||||
} else if (dir == 1) {
|
||||
if (!exist_file(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);
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ regex_command (const char *filename, const char *action, int *move_dir)
|
||||
if (!exist_file (extension_file)) {
|
||||
g_free (extension_file);
|
||||
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)) {
|
||||
g_free (extension_file);
|
||||
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 {
|
||||
char *title =
|
||||
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 "
|
||||
"file has changed with version 3.0. It seems that "
|
||||
"the installation failed. Please fetch a fresh "
|
||||
"copy from the Midnight Commander package."),
|
||||
mc_home);
|
||||
mc_main_sysconf_dir);
|
||||
g_free (title);
|
||||
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 "
|
||||
"changed with version 3.0. You may either want to copy "
|
||||
"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);
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ mc_fhl_init_from_standart_files (mc_fhl_t * fhl)
|
||||
g_free (name);
|
||||
|
||||
/* ${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))) {
|
||||
g_free (name);
|
||||
return FALSE;
|
||||
|
23
src/main.c
23
src/main.c
@ -289,10 +289,10 @@ int midnight_shutdown = 0;
|
||||
/* The user's shell */
|
||||
char *shell = NULL;
|
||||
|
||||
/* mc_home: The home of MC - /etc/mc or defined by MC_DATADIR */
|
||||
char *mc_home = NULL;
|
||||
/* mc_main_sysconf_dir: The main config dir for MC - ${prefix}/etc/mc or defined by MC_CONFDIR */
|
||||
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 cmd_buf[512];
|
||||
@ -1876,22 +1876,17 @@ OS_Setup (void)
|
||||
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");
|
||||
if (mc_libdir != NULL) {
|
||||
mc_home = g_strdup (mc_libdir);
|
||||
mc_main_sharedata_dir = g_strdup (SYSCONFDIR);
|
||||
} else {
|
||||
mc_home = g_strdup (SYSCONFDIR);
|
||||
mc_main_sharedata_dir = g_strdup (DATADIR);
|
||||
}
|
||||
mc_main_sharedata_dir = (mc_libdir != NULL) ? g_strdup (mc_libdir) : g_strdup (DATADIR);
|
||||
|
||||
mc_libdir = getenv ("MC_CONFDIR");
|
||||
mc_main_sysconf_dir = (mc_libdir != NULL) ? g_strdup (mc_libdir) : g_strdup (SYSCONFDIR);
|
||||
|
||||
/* This variable is used by the subshell */
|
||||
home_dir = getenv ("HOME");
|
||||
|
||||
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 (mc_main_sharedata_dir);
|
||||
g_free (mc_home);
|
||||
g_free (mc_main_sysconf_dir);
|
||||
g_free (shell);
|
||||
|
||||
done_key ();
|
||||
|
@ -107,7 +107,7 @@ void print_vfs_message(const char *msg, ...)
|
||||
|
||||
extern const char *prompt;
|
||||
extern const char *edit_one_file;
|
||||
extern char *mc_home;
|
||||
extern char *mc_main_sysconf_dir;
|
||||
extern char *mc_main_sharedata_dir;
|
||||
|
||||
struct mc_fhl_struct;
|
||||
|
13
src/setup.c
13
src/setup.c
@ -600,9 +600,9 @@ load_setup_get_full_config_name(const char *subdir, const char *config_file_name
|
||||
|
||||
|
||||
if (subdir)
|
||||
ret = g_build_filename (mc_home, subdir, basename, NULL);
|
||||
ret = g_build_filename (mc_main_sysconf_dir, subdir, basename, NULL);
|
||||
else
|
||||
ret = g_build_filename (mc_home, basename, NULL);
|
||||
ret = g_build_filename (mc_main_sysconf_dir, basename, NULL);
|
||||
|
||||
if (exist_file(ret)) {
|
||||
g_free(basename);
|
||||
@ -661,8 +661,8 @@ load_setup_get_keymap_profile_config(void)
|
||||
load_setup_init_config_from_file( &keymap_config, fname);
|
||||
g_free(fname);
|
||||
|
||||
/* 2) /etc/mc (mc_home) */
|
||||
fname = g_build_filename (mc_home, GLOBAL_KEYMAP_FILE, NULL);
|
||||
/* 2) /etc/mc (mc_main_sysconf_dir) */
|
||||
fname = g_build_filename (mc_main_sysconf_dir, GLOBAL_KEYMAP_FILE, NULL);
|
||||
load_setup_init_config_from_file( &keymap_config, fname);
|
||||
g_free(fname);
|
||||
|
||||
@ -712,7 +712,7 @@ setup_init (void)
|
||||
|
||||
profile = concat_dir_and_file (home_dir, PROFILE_NAME);
|
||||
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)){
|
||||
g_free (profile);
|
||||
profile = inifile;
|
||||
@ -743,7 +743,8 @@ load_setup (void)
|
||||
|
||||
/* 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");
|
||||
global_profile_name = concat_dir_and_file (mc_main_sysconf_dir, "mc.lib");
|
||||
|
||||
if (!exist_file(global_profile_name)) {
|
||||
g_free (global_profile_name);
|
||||
global_profile_name = concat_dir_and_file (mc_main_sharedata_dir, "mc.lib");
|
||||
|
@ -99,7 +99,7 @@ mc_skin_ini_file_load (mc_skin_t * mc_skin)
|
||||
g_free (user_home_dir);
|
||||
|
||||
/* /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;
|
||||
|
||||
/* /usr/share/mc/skins/ */
|
||||
|
@ -763,7 +763,7 @@ user_menu_cmd (WEdit *edit_widget)
|
||||
if (!exist_file (menu)){
|
||||
g_free (menu);
|
||||
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)) {
|
||||
g_free (menu);
|
||||
menu = concat_dir_and_file
|
||||
|
@ -46,7 +46,7 @@
|
||||
|
||||
#include "../src/search/search.h"
|
||||
|
||||
#include "main.h" /* mc_home */
|
||||
#include "main.h" /* mc_main_sysconf_dir */
|
||||
#include "cmd.h" /* guess_message_value */
|
||||
#include "mountlist.h"
|
||||
#include "timefmt.h"
|
||||
@ -592,7 +592,7 @@ load_mc_home_file (const char *filename, char **allocated_filename)
|
||||
char *lang;
|
||||
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 ();
|
||||
|
||||
hintfile = g_strconcat (hintfile_base, ".", lang, (char *) NULL);
|
||||
|
@ -1306,7 +1306,7 @@ static int extfs_init (struct vfs_class *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");
|
||||
|
||||
/* We may not use vfs_die() message or message or similar,
|
||||
|
@ -570,7 +570,7 @@ ftpfs_load_no_proxy_list (void)
|
||||
if (mc_file)
|
||||
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) &&
|
||||
(npf = fopen (mc_file, "r"))) {
|
||||
while (fgets (s, sizeof (s), npf)) {
|
||||
|
Loading…
Reference in New Issue
Block a user