diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 1994-12-30 16:09:31 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 1994-12-30 16:09:31 +0000 |
commit | f3392428da6aba471c4606682a03552772722f63 (patch) | |
tree | 67041f45827a69bcfaf475609076a8fff174fc9f /usr.bin/talk/init_disp.c | |
parent | 54b77925eefab2ec16ab6eeb34dbb4e44eb6270e (diff) | |
download | src-f3392428da6aba471c4606682a03552772722f63.tar.gz src-f3392428da6aba471c4606682a03552772722f63.zip |
Notes
Diffstat (limited to 'usr.bin/talk/init_disp.c')
-rw-r--r-- | usr.bin/talk/init_disp.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/usr.bin/talk/init_disp.c b/usr.bin/talk/init_disp.c index 5bebcd8bbef4..ee9955600e28 100644 --- a/usr.bin/talk/init_disp.c +++ b/usr.bin/talk/init_disp.c @@ -42,12 +42,31 @@ static char sccsid[] = "@(#)init_disp.c 8.2 (Berkeley) 2/16/94"; #include <sys/ioctl.h> #include <sys/ioctl_compat.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> #include <signal.h> #include <err.h> #include "talk.h" /* + * Make sure the callee can write to the screen + */ +void check_writeable() +{ + char *tty; + struct stat sb; + + if ((tty = ttyname(STDERR_FILENO)) == NULL) + err(1, "ttyname"); + if (stat(tty, &sb) < 0) + err(1, "%s", tty); + if (!(sb.st_mode & S_IWGRP)) + errx(1, "The callee cannot write to this terminal, use \"mesg y\"."); +} + +/* * Set up curses, catch the appropriate signals, * and build the various windows. */ |