File: ssh.c

package info (click to toggle)
tinyssh 20250501-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,388 kB
  • sloc: ansic: 20,245; sh: 1,582; python: 1,449; makefile: 913
file content (98 lines) | stat: -rw-r--r-- 1,713 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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include <signal.h>
#include "ssh.h"

#define X(e, s)                                                                \
    if (i == e) return s

/*
Return short name of signal.
*/
const char *ssh_sigstr(int i) {

#ifdef SIGABRT
    X(SIGABRT, "ABRT");
#endif
#ifdef SIGALRM
    X(SIGALRM, "ALRM");
#endif
#ifdef SIGFPE
    X(SIGFPE, "FPE");
#endif
#ifdef SIGHUP
    X(SIGHUP, "HUP");
#endif
#ifdef SIGILL
    X(SIGILL, "ILL");
#endif
#ifdef SIGINT
    X(SIGINT, "INT");
#endif
#ifdef SIGKILL
    X(SIGKILL, "KILL");
#endif
#ifdef SIGPIPE
    X(SIGPIPE, "PIPE");
#endif
#ifdef SIGQUIT
    X(SIGQUIT, "QUIT");
#endif
#ifdef SIGSEGV
    X(SIGSEGV, "SEGV");
#endif
#ifdef SIGTERM
    X(SIGTERM, "TERM");
#endif
#ifdef SIGUSR1
    X(SIGUSR1, "USR1");
#endif
#ifdef SIGUSR2
    X(SIGUSR2, "USR2");
#endif

    return "UNKNOWN";
}

/*
Return long name of signal.
*/
const char *ssh_sigstrlong(int i) {

#ifdef SIGABRT
    X(SIGABRT, "SIGABRT (abort)");
#endif
#ifdef SIGALRM
    X(SIGALRM, "SIGALRM (alarm clock)");
#endif
#ifdef SIGFPE
    X(SIGFPE, "SIGFPE (floating-point exception)");
#endif
#ifdef SIGILL
    X(SIGILL, "SIGILL (illegal instruction)");
#endif
#ifdef SIGINT
    X(SIGINT, "SIGINT (interrupt)");
#endif
#ifdef SIGKILL
    X(SIGKILL, "SIGKILL (kill, unblockable)");
#endif
#ifdef SIGPIPE
    X(SIGPIPE, "SIGPIPE (broken pipe)");
#endif
#ifdef SIGQUIT
    X(SIGQUIT, "SIGQUIT (quit)");
#endif
#ifdef SIGSEGV
    X(SIGSEGV, "SIGSEGV (segment violation)");
#endif
#ifdef SIGTERM
    X(SIGTERM, "SIGTERM (termination)");
#endif
#ifdef SIGUSR1
    X(SIGUSR1, "SIGUSR1 (user defined signal 1)");
#endif
#ifdef SIGUSR2
    X(SIGUSR2, "SIGUSR2 (user defined signal 2)");
#endif

    return "UNKNOWN SIGNAL";
}