On Thu, Jul 11, 2013 at 4:51 PM, David Korn <[email protected]> wrote:
> Subject: Re: Re: [ast-users] ksh93 returns "()" for "${a[@]}" if I clear an 
> array  with a=( )
> --------
>
>> (Slightly) offtopic: How can I clear a plain string array (e.g. $
>> typeset -a ar #) via the C API (without having to resort to
>> |sh_trap()| to do it...) ?
>
> You can do
>         nv_putsub(np,0,0,ARRAY_UNDEF);
> before calling
>         _nv_unset(np,NV_RDONLY);

Ok... so a function to clear an associative/indexed array would look like this:
-- snip --
void nv_clear_array(Namval_t* np)
{
        nv_putsub(np,0,0,ARRAY_UNDEF);
        _nv_unset(np,NV_RDONLY);
}
-- snip --
... right ?

Next question: How do I clear a compound variable using the libshell C API ?

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to