zsh-workers
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Clinton Bunch <cdb_zsh@zentaur.org>
Cc: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: Nulls in scalar parameters
Date: Fri, 21 Oct 2022 12:33:51 +0200	[thread overview]
Message-ID: <CAN=4vMp=_6iw89c6QgRdGce-dNk+CovsGeVOFwPj61RpJiR=vw@mail.gmail.com> (raw)
In-Reply-To: <cc0b034e-056d-3da6-e69b-55b447a6c235@zentaur.org>

On Fri, Oct 21, 2022 at 6:51 AM Clinton Bunch <cdb_zsh@zentaur.org> 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.


      reply	other threads:[~2022-10-21 10:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21  4:50 Clinton Bunch
2022-10-21 10:33 ` Roman Perepelitsa [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN=4vMp=_6iw89c6QgRdGce-dNk+CovsGeVOFwPj61RpJiR=vw@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=cdb_zsh@zentaur.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).