ports/misc/mc/patches/patch-src_subshell_common_c

42 lines
1.3 KiB
Text
Raw Normal View History

2023-08-16 22:26:55 +00:00
Index: src/subshell/common.c
--- src/subshell/common.c.orig
+++ src/subshell/common.c
@@ -378,6 +378,21 @@ init_subshell_child (const char *pty_name)
}
break;
+ case SHELL_KSH:
+ /* Do we have a custom init file ~/.local/share/mc/kshrc? */
+ init_file = mc_config_get_full_path (MC_KSHRC_FILE);
+
+ /* Otherwise use ~/.kshrc */
+ if (!exist_file (init_file))
+ {
+ g_free (init_file);
+ init_file = g_strdup (".kshrc");
+ }
+
+ /* Put init file to ENV variable used by ksh */
+ g_setenv ("ENV", init_file, TRUE);
+ break;
+
/* TODO: Find a way to pass initfile to TCSH and FISH */
case SHELL_TCSH:
case SHELL_FISH:
@@ -427,6 +442,7 @@ init_subshell_child (const char *pty_name)
case SHELL_ASH_BUSYBOX:
case SHELL_DASH:
+ case SHELL_KSH:
case SHELL_TCSH:
case SHELL_FISH:
execl (mc_global.shell->path, mc_global.shell->path, (char *) NULL);
@@ -1134,6 +1150,7 @@ init_subshell_precmd (char *precmd, size_t buff_size)
* "PRECMD=precmd; "
* "PS1='$($PRECMD)$ '\n",
*/
+ case SHELL_KSH:
g_snprintf (precmd, buff_size,
"precmd() { "
"if [ ! \"${PWD##$HOME}\" ]; then "