File: __fish_status_to_signal.fish

package info (click to toggle)
fish 3.1.2-3%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 38,672 kB
  • sloc: ansic: 80,259; cpp: 47,069; javascript: 17,087; sh: 6,163; python: 3,429; makefile: 669; perl: 367; objc: 78; xml: 18
file content (22 lines) | stat: -rw-r--r-- 786 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function __fish_status_to_signal --description "Print signal name from argument (\$status), or just argument"
    if test (count $argv) -ne 1
        echo "expected single argument as integer from \$status" >&2
        return 1
    end

    if test $argv[1] -gt 128
        set -l signals SIGHUP SIGINT SIGQUIT SIGILL SIGTRAP SIGABRT SIGBUS \
            SIGFPE SIGKILL SIGUSR1 SIGSEGV SIGUSR2 SIGPIPE SIGALRM \
            SIGTERM SIGSTKFLT SIGCHLD SIGCONT SIGSTOP SIGTSTP \
            SIGTTIN SIGTTOU SIGURG SIGXCPU SIGXFSZ SIGVTALRM \
            SIGPROF SIGWINCH SIGIO SIGPWR SIGSYS
        set -l sigix (math $argv[1] - 128)
        if test $sigix -le (count $signals)
            echo $signals[$sigix]
            return 0
        end
    end

    echo $argv[1]
    return 0
end