version 1.3, 1997/01/15 23:42:53 |
version 1.4, 1997/07/31 14:56:33 |
|
|
argv += optind; |
argv += optind; |
|
|
if ((tty = ttyname(STDERR_FILENO)) == NULL) |
if ((tty = ttyname(STDERR_FILENO)) == NULL) |
err(1, "ttyname"); |
err(2, "ttyname"); |
if (stat(tty, &sb) < 0) |
if (stat(tty, &sb) < 0) |
err(1, "%s", tty); |
err(2, "%s", tty); |
|
|
if (*argv == NULL) { |
if (*argv == NULL) { |
if (sb.st_mode & S_IWGRP) { |
if (sb.st_mode & S_IWGRP) { |
|
|
switch (*argv[0]) { |
switch (*argv[0]) { |
case 'y': |
case 'y': |
if (chmod(tty, sb.st_mode | S_IWGRP) < 0) |
if (chmod(tty, sb.st_mode | S_IWGRP) < 0) |
err(1, "%s", tty); |
err(2, "%s", tty); |
exit(0); |
exit(0); |
case 'n': |
case 'n': |
if (chmod(tty, sb.st_mode & ~S_IWGRP) < 0) |
if (chmod(tty, sb.st_mode & ~S_IWGRP) < 0) |
err(1, "%s", tty); |
err(2, "%s", tty); |
exit(1); |
exit(1); |
} |
} |
|
|