Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Nulls in scalar parameters



On Fri, Oct 21, 2022 at 6:51 AM Clinton Bunch <cdb_zsh@xxxxxxxxxxx> wrote:
>
> I'm working on a zsh/random module and I'm creating a builtin that
> returns a user-specified number of random bytes and either prints it or
> returns it in a parameter.  There exists a small possibility of embedded
> nulls in the output, and I'm not sure how to handle setting such a value
> in a parameter.

This is how bin_sysread does it in system.c.

    setsparam(outvar, metafy(inbuf, count, META_DUP));

`outvar` points to the name of the parameter (e.g., "REPLY"). `inbuf`
points data and `count` is the number of bytes in it.

Roman.




Messages sorted by: Reverse Date, Date, Thread, Author