You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.4 KiB

  1. --- a/lib/shell.c
  2. +++ b/lib/shell.c
  3. @@ -68,6 +68,8 @@ mc_shell_get_installed_in_system (void)
  4. mc_shell->path = g_strdup ("/bin/bash");
  5. else if (access ("/bin/ash", X_OK) == 0)
  6. mc_shell->path = g_strdup ("/bin/ash");
  7. + else if (access ("/bin/mksh", X_OK) == 0)
  8. + mc_shell->path = g_strdup ("/bin/mksh");
  9. else if (access ("/bin/dash", X_OK) == 0)
  10. mc_shell->path = g_strdup ("/bin/dash");
  11. else if (access ("/bin/busybox", X_OK) == 0)
  12. @@ -149,6 +151,12 @@ mc_shell_recognize_real_path (mc_shell_t
  13. mc_shell->type = SHELL_ZSH;
  14. mc_shell->name = "zsh";
  15. }
  16. + else if (strstr (mc_shell->path, "/mksh") != NULL
  17. + || strstr (mc_shell->real_path, "/mksh") != NULL)
  18. + {
  19. + mc_shell->type = SHELL_MKSH;
  20. + mc_shell->name = "mksh";
  21. + }
  22. else if (strstr (mc_shell->path, "/tcsh") != NULL
  23. || strstr (mc_shell->real_path, "/tcsh") != NULL)
  24. {
  25. --- a/lib/shell.h
  26. +++ b/lib/shell.h
  27. @@ -16,6 +16,7 @@ typedef enum
  28. SHELL_BASH,
  29. SHELL_ASH_BUSYBOX, /* BusyBox default shell (ash) */
  30. SHELL_DASH, /* Debian variant of ash */
  31. + SHELL_MKSH,
  32. SHELL_TCSH,
  33. SHELL_ZSH,
  34. SHELL_FISH
  35. --- a/src/subshell/common.c
  36. +++ b/src/subshell/common.c
  37. @@ -378,6 +378,11 @@ init_subshell_child (const char *pty_nam
  38. }
  39. break;
  40. + case SHELL_MKSH:
  41. + init_file = g_strdup (".shrc");
  42. + g_setenv ("ENV", init_file, TRUE);
  43. + break;
  44. +
  45. /* TODO: Find a way to pass initfile to TCSH and FISH */
  46. case SHELL_TCSH:
  47. case SHELL_FISH:
  48. @@ -427,6 +432,7 @@ init_subshell_child (const char *pty_nam
  49. case SHELL_ASH_BUSYBOX:
  50. case SHELL_DASH:
  51. + case SHELL_MKSH:
  52. case SHELL_TCSH:
  53. case SHELL_FISH:
  54. execl (mc_global.shell->path, mc_global.shell->path, (char *) NULL);
  55. @@ -1091,6 +1097,10 @@ init_subshell_precmd (char *precmd, size
  56. "PS1='\\u@\\h:\\w\\$ '\n", command_buffer_pipe[WRITE],
  57. command_buffer_pipe[WRITE], subshell_pipe[WRITE]);
  58. break;
  59. + case SHELL_MKSH:
  60. + g_snprintf (precmd, buff_size,
  61. + "PS1='$(pwd>&%d; kill -STOP $$)'\"$((( USER_ID )) && print '$ ' || print '# ')\"\n", subshell_pipe[WRITE]);
  62. + break;
  63. case SHELL_ASH_BUSYBOX:
  64. /* BusyBox ash needs a somewhat complicated precmd emulation via PS1, and it is vital