diff --git a/src/include/66/ssexec.h b/src/include/66/ssexec.h index 23c1e35db85e25169590ff57411fde94f082d0fd..faf442a2485bf4aa639040f54b5eb19c691a1b75 100644 --- a/src/include/66/ssexec.h +++ b/src/include/66/ssexec.h @@ -239,7 +239,7 @@ extern char const *help_halt ; #define OPTS_STOP_LEN (sizeof OPTS_STOP - 1) #define OPTS_STATUS "hno:grd:p:" #define OPTS_STATUS_LEN (sizeof OPTS_STATUS - 1) -#define OPTS_SIGNAL "habqHkti12pcyrodDuUxOQw:P" +#define OPTS_SIGNAL "habqHkti12pcys:rodDuUxOQw:P" #define OPTS_SIGNAL_LEN (sizeof OPTS_SIGNAL - 1) #define OPTS_ENV "hc:s:VLr:e:i:" #define OPTS_ENV_LEN (sizeof OPTS_ENV - 1) diff --git a/src/lib66/exec/ssexec_signal.c b/src/lib66/exec/ssexec_signal.c index 029f56ac61b30a8ac2728ae03a1c6722cdbb6dd7..e3b0c47538a80c7338cd960bef8355185760ee08 100644 --- a/src/lib66/exec/ssexec_signal.c +++ b/src/lib66/exec/ssexec_signal.c @@ -20,6 +20,7 @@ #include <oblibs/types.h> #include <skalibs/sgetopt.h> +#include <skalibs/nsig.h> #include <66/svc.h> #include <66/config.h> @@ -29,6 +30,22 @@ #include <66/state.h> #include <66/enum.h> +static char const cmdsig[NSIG] = { + + [SIGALRM] = 'a', + [SIGABRT] = 'b', + [SIGQUIT] = 'q', + [SIGHUP] = 'h', + [SIGKILL] = 'k', + [SIGTERM] = 't', + [SIGINT] = 'i', + [SIGUSR1] = '1', + [SIGUSR2] = '2', + [SIGSTOP] = 'p', + [SIGCONT] = 'c', + [SIGWINCH] = 'y' +} ; + int ssexec_signal(int argc, char const *const *argv, ssexec_t *info) { log_flow() ; @@ -77,6 +94,15 @@ int ssexec_signal(int argc, char const *const *argv, ssexec_t *info) if (opt == -1) break ; switch (opt) { + case 's' : + { + int sig ; + if (!sig0_scan(l.arg, &sig)) + log_die(LOG_EXIT_USER, "invalid signal: ", l.arg) ; + if (!cmdsig[sig]) + log_die(LOG_EXIT_USER, l.arg, " is not in the list of user-available signals") ; + opt = cmdsig[sig] ; + } case 'h' : info_help(info->help, info->usage) ; return 0 ; case 'a' : case 'b' :