Subject: Re: Redirecting console output
To: Simon Raahauge DeSantis <xiamin@gay-robot.com>
From: David Laight <david@l8s.co.uk>
List: netbsd-users
Date: 10/03/2003 00:17:34
On Thu, Oct 02, 2003 at 12:00:05PM -0400, Simon Raahauge DeSantis wrote:
> Hello,
> 	I'm wondering if there's a non-X version of xconsole. I'd like to 
> redirect the console output to somewhere else (an ssh session, or maybe 
> a file) temporarily. tail -f /dev/console doesn't seem to do the trick.

Write a program that calls openpty and does a TIOCCONS ioctl on the
slave side.  Collect the console output from the master.

int
main(int argc, char **argv)
{
	int i, m, s;
	char c;
	openpty(&m, &s, 0, 0, 0);
	ioctl(s, TIOCCONS, &i);
	while (read(m, &i, 1) != 0)
		write(1, &i, 1);
	return 0;
}

might do it....

	David

-- 
David Laight: david@l8s.co.uk