Make sys_signame upper case.

This matches the constants from <signal.h> with 'SIG' removed, which POSIX
requires kill and trap to accept and 'kill -l' to write.

'kill -l', 'trap', 'trap -l' output is now upper case.

In Turkish locales, signal names with an upper case 'I' are now accepted,
while signal names with a lower case 'i' are no longer accepted, and the
output of 'killall -l' now contains proper capital 'I' without dot instead
of a dotted capital 'I'.
This commit is contained in:
Jilles Tjoelker 2011-02-04 16:40:50 +00:00
parent 729e10b9e2
commit 12dacf622b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=218285
7 changed files with 40 additions and 40 deletions

View File

@ -152,7 +152,7 @@ signame_to_signum(const char *sig)
{
int n;
if (!strncasecmp(sig, "sig", (size_t)3))
if (!strncasecmp(sig, "SIG", (size_t)3))
sig += 3;
for (n = 1; n < sys_nsig; n++) {
if (!strcasecmp(sys_signame[n], sig))

View File

@ -156,7 +156,7 @@ main(int argc, char **argv)
argv++;
argc--;
} else {
if (strncasecmp(p, "sig", 3) == 0)
if (strncasecmp(p, "SIG", 3) == 0)
p += 3;
for (i = 1; i < NSIG; i++)
if (strcasecmp(sys_signame[i], p) == 0)

View File

@ -101,12 +101,12 @@ sigstring_to_signum(char *sig)
signo = atoi(sig);
return ((signo >= 0 && signo < NSIG) ? signo : (-1));
} else if (strcasecmp(sig, "exit") == 0) {
} else if (strcasecmp(sig, "EXIT") == 0) {
return (0);
} else {
int n;
if (strncasecmp(sig, "sig", 3) == 0)
if (strncasecmp(sig, "SIG", 3) == 0)
sig += 3;
for (n = 1; n < sys_nsig; n++)
if (sys_signame[n] &&
@ -171,7 +171,7 @@ trapcmd(int argc, char **argv)
out1str("trap -- ");
out1qstr(trap[signo]);
if (signo == 0) {
out1str(" exit\n");
out1str(" EXIT\n");
} else if (sys_signame[signo]) {
out1fmt(" %s\n", sys_signame[signo]);
} else {

View File

@ -28,7 +28,7 @@
.\" @(#)psignal.3 8.2 (Berkeley) 2/27/95
.\" $FreeBSD$
.\"
.Dd February 27, 1995
.Dd February 4, 2011
.Dt PSIGNAL 3
.Os
.Sh NAME
@ -89,7 +89,7 @@ indexed by recognized signal numbers.
The external array
.Va sys_signame
is used similarly and
contains short, lower-case abbreviations for signals
contains short, upper-case abbreviations for signals
which are useful for recognizing signal names
in user input.
The defined variable

View File

@ -37,37 +37,37 @@ __FBSDID("$FreeBSD$");
const char *const sys_signame[NSIG] = {
"Signal 0",
"hup", /* SIGHUP */
"int", /* SIGINT */
"quit", /* SIGQUIT */
"ill", /* SIGILL */
"trap", /* SIGTRAP */
"abrt", /* SIGABRT */
"emt", /* SIGEMT */
"fpe", /* SIGFPE */
"kill", /* SIGKILL */
"bus", /* SIGBUS */
"segv", /* SIGSEGV */
"sys", /* SIGSYS */
"pipe", /* SIGPIPE */
"alrm", /* SIGALRM */
"term", /* SIGTERM */
"urg", /* SIGURG */
"stop", /* SIGSTOP */
"tstp", /* SIGTSTP */
"cont", /* SIGCONT */
"chld", /* SIGCHLD */
"ttin", /* SIGTTIN */
"ttou", /* SIGTTOU */
"io", /* SIGIO */
"xcpu", /* SIGXCPU */
"xfsz", /* SIGXFSZ */
"vtalrm", /* SIGVTALRM */
"prof", /* SIGPROF */
"winch", /* SIGWINCH */
"info", /* SIGINFO */
"usr1", /* SIGUSR1 */
"usr2" /* SIGUSR2 */
"HUP", /* SIGHUP */
"INT", /* SIGINT */
"QUIT", /* SIGQUIT */
"ILL", /* SIGILL */
"TRAP", /* SIGTRAP */
"ABRT", /* SIGABRT */
"EMT", /* SIGEMT */
"FPE", /* SIGFPE */
"KILL", /* SIGKILL */
"BUS", /* SIGBUS */
"SEGV", /* SIGSEGV */
"SYS", /* SIGSYS */
"PIPE", /* SIGPIPE */
"ALRM", /* SIGALRM */
"TERM", /* SIGTERM */
"URG", /* SIGURG */
"STOP", /* SIGSTOP */
"TSTP", /* SIGTSTP */
"CONT", /* SIGCONT */
"CHLD", /* SIGCHLD */
"TTIN", /* SIGTTIN */
"TTOU", /* SIGTTOU */
"IO", /* SIGIO */
"XCPU", /* SIGXCPU */
"XFSZ", /* SIGXFSZ */
"VTALRM", /* SIGVTALRM */
"PROF", /* SIGPROF */
"WINCH", /* SIGWINCH */
"INFO", /* SIGINFO */
"USR1", /* SIGUSR1 */
"USR2" /* SIGUSR2 */
};
const char *const sys_siglist[NSIG] = {

View File

@ -218,7 +218,7 @@ main(int ac, char **av)
break;
default:
if (isalpha((unsigned char)**av)) {
if (strncasecmp(*av, "sig", 3) == 0)
if (strncasecmp(*av, "SIG", 3) == 0)
*av += 3;
for (sig = NSIG, p = sys_signame + 1;
--sig; ++p)

View File

@ -155,7 +155,7 @@ strsig(int sig)
ret = NULL;
if (sig > 0 && sig < NSIG) {
int i;
asprintf(&ret, "sig%s", sys_signame[sig]);
asprintf(&ret, "SIG%s", sys_signame[sig]);
if (ret == NULL)
return (NULL);
for (i = 0; ret[i] != '\0'; ++i)