summaryrefslogtreecommitdiff
path: root/jim-nosignal.c
blob: bc3971297a8c03ab822b69e88c203299f74f61f2 (plain)
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
#include <stdio.h>
#include <signal.h>

#include <jim-signal.h>
#include <jim.h>

/* Implement trivial Jim_SignalId() just good enough for JimMakeErrorCode() in [exec] */


/* This works for mingw, but is not really portable */
#ifndef SIGPIPE
#define SIGPIPE 13
#endif
#ifndef SIGINT
#define SIGINT 2
#endif

const char *Jim_SignalId(int sig)
{
	static char buf[10];
	switch (sig) {
		case SIGINT: return "SIGINT";
		case SIGPIPE: return "SIGPIPE";

	}
	snprintf(buf, sizeof(buf), "%d", sig);
	return buf;
}