On Thu, 24 May 2001, Jeremy C. Reed wrote:
> On Thu, 24 May 2001, Wilbert Berendsen wrote:
> > Well, maybe yes it's more elegant then to have blackbox launch the app
> > directly; when you want, you can always type sh -c 'blabla | bla' in
> > the bb menu file.
>
> That is the easy way!
>
> Can anyone share a routine or is there a exec()-type function where you
> can pass one NULL-terminated string for the args and it will split it up
> to arg0, arg1, arg2, ... ??
>
I've attached a C source file with a function (nsh_exec() - no shell exec)
which will take a string, split it (obeying quotes and expanding wildcards
when possible, I might add), and then fork() and execute it.
Also here's a patch on main.cc and which changes main() to grab the
environment and copy it to an external variable 'envlist'. This must be
applied for nsh_exec() to work.
Maybe it'll help...
--gile
--
I am gile.
I am smiling.
You should be afraid.
bb_exec2.c
main.cc.diff