Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
sysexits.h codes? (was: Re: [RFC][PATCH] `newuser` prompt theme)
> >> @@ -0,0 +1,197 @@
> >> +readonly -ga sysexits=(
> >> + USAGE
> > ⋮
> >> + CONFIG
> >
> > Two interrelated scripts on zsh.org hardcode these constants too.
> > I wonder if we should provide these constants in a standard autoloaded
> > function or preset variable.
>
> A preset variable would be great. In C code, you can get the names and values from `sysexits.h`, which is available in both GNU and BSD.
An associative array mapping symbolic names to integers? Just those
available on the target system, or?
> >> + emulate -L zsh
> >> +
> >> + psvar[1]=
> >> + case $exitstatus in
> >> + <128-> )
> >> + psvar[1]="SIG$signals[exitstatus-127] "
> >> + ;|
> >> + <64-78> )
> >> + psvar[1]="EX_$sysexits[exitstatus-63] "
> >
> > Nice, I might adopt this. Or, come to think of it, I might teach
> > PRINT_EXIT_VALUE to do this ☺
>
> It would be great if, besides printing the name, it could also add a
> short description of what the exit code actually means. Something like
> “SIGPIPE (140): write on a pipe with no reader”.
There's precedent to work with:
% =pwd | true
zsh: broken pipe =pwd
I suppose the default should be about this level of verbosity.
Other degrees of verbosity could be considered.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author