linux-sysprog · beginner · ~15 min
Translate a signal name to its number.
Implement int sig_number(const char *name) mapping "SIGINT", "SIGTERM", "SIGKILL" to their constants, or -1 for anything else.
#include <signal.h>
#include <string.h>
int sig_number(const char *name) {
/* TODO */
return -1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.