]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - historic/mesg.c
2 * mesg.c The "mesg" utility. Gives / restrict access to
3 * your terminal by others.
6 * Without arguments prints out the current settings.
14 char *Version
= "@(#) mesg 1.0 08-12-92 MvS";
16 int main(int argc
, char **argv
)
21 /* Or should we look in /etc/utmp? */
22 fprintf(stderr
, "stdin: is not a tty");
26 if (fstat(0, &st
) < 0) {
31 printf("Is %s\n", ((st
.st_mode
& 022) == 022) ? "y" : "n");
34 if (argc
> 2 || (argv
[1][0] != 'y' && argv
[1][0] != 'n')) {
35 fprintf(stderr
, "Usage: mesg [y|n]\n");
38 if (argv
[1][0] == 'y')
42 fchmod(0, st
.st_mode
);