Subject: Re: [ast-developers] Calling shell function from native code?
--------
> Does libshell have a C function which can I use to call a shell
> function with a list of arguments?
> I know about sh_trap() but this is cumbersome and slow because I have
> to prepare (i.e. all quotes and backslashes if necessary, encode
> binary values with $'\x...') the list of arguments and write them into
> a string buffer which the shell interpreter always interprets before
> calling the function.
>
> I need a function like this:
> sh_callfunction
> arg1: const char *function_name
> arg2: const char *argument_list[]
> --
>
You can call sh_run(int,char *[]).
It takes the same arguments as main and works with any simple command including
functions. For example to call function foo with argument bar,
argv[0]="foo";
argv[1]="bar";
sh_run(2,argv);
David Korn
[email protected]
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers