FreeBSD/usr.bin/talk/init_disp.c
/*
 * Make sure the callee can write to the screen
 */
Make sure the callee can write to the screen
Make sure the callee can write to the screen
void
check_writeable(void)
{
	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\".");
}
void check_writeable ( void ) { char * tty ; struct stat sb ; if ( ( tty = ttyname ( STDERR_FILENO ) ) == NULL ) err ( 1 , " " ) ; if ( stat ( tty , & sb ) < 0 ) err ( 1 , " " , tty ) ; if ( ! ( sb . st_mode & S_IWGRP ) ) errx ( 1 , " \" \" " ) ; }
Make sure the callee can write to the screen
Make sure the callee can write to the screen