Simplify various code that allowed for sys_signame being lower case.
This was changed in r218285.
This commit is contained in:
parent
afeb46924f
commit
f046771b04
@ -60,18 +60,6 @@ usage(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static char *
|
||||
upper(const char *str)
|
||||
{
|
||||
static char buf[80];
|
||||
char *s;
|
||||
|
||||
strlcpy(buf, str, sizeof(buf));
|
||||
for (s = buf; *s; s++)
|
||||
*s = toupper((unsigned char)*s);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
printsig(FILE *fp)
|
||||
@ -81,7 +69,7 @@ printsig(FILE *fp)
|
||||
int offset = 0;
|
||||
|
||||
for (cnt = NSIG, p = sys_signame + 1; --cnt; ++p) {
|
||||
offset += fprintf(fp, "%s ", upper(*p));
|
||||
offset += fprintf(fp, "%s ", *p);
|
||||
if (offset >= 75 && cnt > 1) {
|
||||
offset = 0;
|
||||
fprintf(fp, "\n");
|
||||
@ -401,14 +389,13 @@ main(int ac, char **av)
|
||||
thiscmd, thispid, thistdev, thisuid);
|
||||
|
||||
if (vflag || sflag)
|
||||
printf("kill -%s %d\n", upper(sys_signame[sig]),
|
||||
thispid);
|
||||
printf("kill -%s %d\n", sys_signame[sig], thispid);
|
||||
|
||||
killed++;
|
||||
if (!dflag && !sflag) {
|
||||
if (kill(thispid, sig) < 0 /* && errno != ESRCH */ ) {
|
||||
warn("warning: kill -%s %d",
|
||||
upper(sys_signame[sig]), thispid);
|
||||
sys_signame[sig], thispid);
|
||||
errors = 1;
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@ -154,12 +153,9 @@ strsig(int sig)
|
||||
|
||||
ret = NULL;
|
||||
if (sig > 0 && sig < NSIG) {
|
||||
int i;
|
||||
asprintf(&ret, "SIG%s", sys_signame[sig]);
|
||||
if (ret == NULL)
|
||||
return (NULL);
|
||||
for (i = 0; ret[i] != '\0'; ++i)
|
||||
ret[i] = toupper(ret[i]);
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user