killall - Add support for pts specifications
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 28 Oct 2011 23:51:58 +0000 (16:51 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 28 Oct 2011 23:51:58 +0000 (16:51 -0700)
* killall -t <number> now uses /dev/pts/<number> instead of
  /dev/tty<number>.

  killall -t <alpha>* continues to use /dev/tty<alpha>*.

usr.bin/killall/killall.c

index d32efbe..f308b73 100644 (file)
@@ -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)