diff options
Diffstat (limited to 'jim-nosignal.c')
-rw-r--r-- | jim-nosignal.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/jim-nosignal.c b/jim-nosignal.c new file mode 100644 index 0000000..bc39712 --- /dev/null +++ b/jim-nosignal.c @@ -0,0 +1,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; +} |