usr.bin/write/write.c
/*
 * term_chk - check that a terminal exists, and get the message bit
 *     and the access time
 */
check that a terminal exists, and get the message bit
and the access time
check that a terminal exists and get the message bit and the access time
int
term_chk(char *tty, int *msgsokP, time_t *atimeP, int showerror)
{
	struct stat s;
	char path[MAXPATHLEN];
	(void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty);
	if (stat(path, &s) < 0) {
		if (showerror)
			warn("%s", path);
		return(1);
	}
	*msgsokP = (s.st_mode & (S_IWRITE >> 3)) != 0;	
	*atimeP = s.st_atime;
	return(0);
}
int term_chk ( char * tty , int * msgsokP , time_t * atimeP , int showerror ) { struct stat s ; char path [ MAXPATHLEN ] ; ( void ) snprintf ( path , sizeof ( path ) , " " , _PATH_DEV , tty ) ; if ( stat ( path , & s ) < 0 ) { if ( showerror ) warn ( " " , path ) ; return ( 1 ) ; } * msgsokP = ( s . st_mode & ( S_IWRITE >> 3 ) ) != 0 ; * atimeP = s . st_atime ; return ( 0 ) ; }
term_chk - check that a terminal exists, and get the message bit
     and the access time
term_chk - check that a terminal exists and get the message bit and the access time
/* group write bit */