view toys/tty.c @ 181:78d93164a9d2

Add comment, and whitespace changes.
author Rob Landley <rob@landley.net>
date Tue, 27 Nov 2007 01:36:50 -0600
parents 4b683759de51
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;
}