From c5017cd942302c2a55d0f46405436109f5f887dc Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 28 Oct 2011 16:51:58 -0700 Subject: [PATCH] killall - Add support for pts specifications * killall -t now uses /dev/pts/ instead of /dev/tty. killall -t * continues to use /dev/tty*. --- usr.bin/killall/killall.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usr.bin/killall/killall.c b/usr.bin/killall/killall.c index d32efbee02..f308b73c07 100644 --- a/usr.bin/killall/killall.c +++ b/usr.bin/killall/killall.c @@ -51,8 +51,11 @@ static void __dead2 usage(void) { - fprintf(stderr, "usage: %s [-l] [-v] [-m] [-sig] [-u user] [-j jail] [-t tty] [-c cmd] [cmd]...\n", prog); - fprintf(stderr, "At least one option or argument to specify processes must be given.\n"); + fprintf(stderr, "usage: %s [-l] [-v] [-m] [-sig] " + "[-u user] [-j jail] [-t tty] " + "[-c cmd] [cmd]...\n", prog); + fprintf(stderr, "At least one option or argument to specify " + "processes must be given.\n"); exit(1); } @@ -232,6 +235,8 @@ main(int ac, char **av) snprintf(buf, sizeof(buf), "%s", tty); else if (strncmp(tty, "tty", 3) == 0) snprintf(buf, sizeof(buf), "/dev/%s", tty); + else if (isdigit(tty[0])) + snprintf(buf, sizeof(buf), "/dev/pts/%s", tty); else snprintf(buf, sizeof(buf), "/dev/tty%s", tty); if (stat(buf, &sb) < 0) -- 2.41.0