view toys/tty.c @ 183:93899f7c3e0c

Rebuild toybox when a header file changes
author Charlie Shepherd <masterdriverz@gentoo.org>
date Sun, 25 Nov 2007 16:54:29 +0000
parents 78d93164a9d2
children 25447caf1b4b
line wrap: on
line source

/* vi: set sw=4 ts=4: */
/* tty.c - print terminal name of stdin
 *
 * See http://www.opengroup.org/onlinepubs/009695399/utilities/tty.html
 */

#include "toys.h"

int tty_main(void)
{
	char *name = ttyname(0);
	if (!toys.optflags) {
		if (name) puts(name);
		else puts("Not a tty");
	}
	return !name;
}