Browse Source

Define macros for bashrc, ashrc, and inputrc files.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Andrew Borodin 4 years ago
parent
commit
0c02118fad
4 changed files with 11 additions and 9 deletions
  1. 2 0
      lib/fileloc.h
  2. 3 3
      lib/mcconfig/paths.c
  3. 3 3
      src/subshell/common.c
  4. 3 3
      tests/lib/mcconfig/user_configs_path.c

+ 2 - 0
lib/fileloc.h

@@ -53,6 +53,8 @@
 
 #define MC_BASHRC_FILE          "bashrc"
 #define MC_ZSHRC_FILE           ".zshrc"
+#define MC_ASHRC_FILE           "ashrc"
+#define MC_INPUTRC_FILE         "inputrc"
 #define MC_CONFIG_FILE          "ini"
 #define MC_FILEBIND_FILE        "mc.ext"
 #define MC_FILEPOS_FILE         "filepos"

+ 3 - 3
lib/mcconfig/paths.c

@@ -74,9 +74,9 @@ static const struct
     /* data */
     { &mc_data_str, MC_SKINS_DIR },
     { &mc_data_str, FISH_PREFIX },
-    { &mc_data_str, "ashrc" },
-    { &mc_data_str, "bashrc" },
-    { &mc_data_str, "inputrc" },
+    { &mc_data_str, MC_ASHRC_FILE },
+    { &mc_data_str, MC_BASHRC_FILE },
+    { &mc_data_str, MC_INPUTRC_FILE },
     { &mc_data_str, MC_ZSHRC_FILE },
     { &mc_data_str, MC_EXTFS_DIR },
     { &mc_data_str, MC_HISTORY_FILE },

+ 3 - 3
src/subshell/common.c

@@ -324,7 +324,7 @@ init_subshell_child (const char *pty_name)
     {
     case SHELL_BASH:
         /* Do we have a custom init file ~/.local/share/mc/bashrc? */
-        init_file = mc_config_get_full_path ("bashrc");
+        init_file = mc_config_get_full_path (MC_BASHRC_FILE);
 
         /* Otherwise use ~/.bashrc */
         if (!exist_file (init_file))
@@ -341,7 +341,7 @@ init_subshell_child (const char *pty_name)
         {
             char *input_file;
 
-            input_file = mc_config_get_full_path ("inputrc");
+            input_file = mc_config_get_full_path (MC_INPUTRC_FILE);
             if (exist_file (input_file))
             {
                 putenv_str = g_strconcat ("INPUTRC=", input_file, (char *) NULL);
@@ -355,7 +355,7 @@ init_subshell_child (const char *pty_name)
     case SHELL_ASH_BUSYBOX:
     case SHELL_DASH:
         /* Do we have a custom init file ~/.local/share/mc/ashrc? */
-        init_file = mc_config_get_full_path ("ashrc");
+        init_file = mc_config_get_full_path (MC_ASHRC_FILE);
 
         /* Otherwise use ~/.profile */
         if (!exist_file (init_file))

+ 3 - 3
tests/lib/mcconfig/user_configs_path.c

@@ -122,15 +122,15 @@ static const struct test_user_config_paths_ds
     },
     { /* 11. */
         CONF_DATA,
-        "ashrc"
+        MC_ASHRC_FILE
     },
     { /* 12. */
         CONF_DATA,
-        "bashrc"
+        MC_BASHRC_FILE
     },
     { /* 13. */
         CONF_DATA,
-        "inputrc"
+        MC_INPUTRC_FILE
     },
     { /* 14. */
         CONF_DATA,