zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: PATCH: real-time signals support
Date: Wed, 28 Feb 2024 00:51:14 +0100	[thread overview]
Message-ID: <26831-1709077874.602561@9bQW.VzDm.Uqrt> (raw)
In-Reply-To: <CAH+w=7Z-18+FkppsqHExRjtiW6Cy6AOFeNu_FX08r7Xekjk=eg@mail.gmail.com>

Bart Schaefer wrote:
> I was thinking in terms of populating a hash-format of $signals given
> that the array-format default is probably not going away.  With the
> paren after the numbers I ended up with:
>
>  typeset -A sigs=( ${=${ printf "%d %s\n" ${=${ printf "(%s %s\n"
> ${=${ kill -L }} }} }} )

I'll grant you that isn't trivial even if there may be shorter
approaches.

> The main reason is for terminals narrower than 80-ish columns; wider ones, meh.

How about limiting it to a maximum of six columns like so?

		const int cols = zterm_columns >= 30 ?
		    (zterm_columns < 90 ? zterm_columns / 15 : 6) : 1;

Without the isatty(1) test it can still be piped in column form or you
can use COLUMNS=1 to force single-column output. Or the `isatty(1) &&`
can be added back in?

> > A greater range of values appear to be open to shell functions but
> > otherwise, that sounds about right. There's also negative values.
>
> There would never be a useful negative exit status, would there?

Except for functions (and maybe builtins). Don't think I've ever used
that.

From an external programme, it seems any value is received modulo 256.

> Negative signals translate into the absolute value sent to the process
> group leader, right?

Isn't that negative pids? Or do either have that effect?

Oliver


  reply	other threads:[~2024-02-27 23:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-24 22:01 Oliver Kiddle
2024-02-25 22:44 ` Bart Schaefer
2024-02-27 19:25   ` Oliver Kiddle
2024-02-27 21:12     ` Bart Schaefer
2024-02-27 23:51       ` Oliver Kiddle [this message]
2024-02-28  2:17         ` Bart Schaefer

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=26831-1709077874.602561@9bQW.VzDm.Uqrt \
    --to=opk@zsh.org \
    --cc=schaefer@brasslantern.com \
    --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).