How to add subshell support for ash

Oswald Buddenhagen ossi at kde.org
Mon Mar 5 08:27:20 UTC 2012


On Sun, Mar 04, 2012 at 03:19:52PM +0100, Alexander Kriegisch wrote:
> I know how to do this via shell script, but not cleanly via C, sorry.
> 
you could start by posting the sh code as text or a comment ...

>   - Plese refer to code comments for how and why I implemented the
>     precmd via PS1 with two-fold indirection.
>
as ash is as close to pure posix as it gets, this pretty much qualifies
as a generic solution. one could even remove the paths for the other
bourne-compatible shells (except that they are less hacky) ...

> Remark: In order to get ENV into the environment for the init file, I
> had to uncomment "g_free (putenv_str)".
>
that sounds like adding a memory leak. you need to move, not remove the
free.  but then, i don't know that code, maybe there is already a second
cleanup path.

> I hope you are interested in this feature
> 
totally. but i'm only a lurker ...

> +                    // A: This leads to a stopped subshell (=frozen mc) if user calls "sh" command
>
please fix the indentation and avoid c99/c++ comments.



More information about the mc-devel mailing list