view toys/tty.c @ 186:25447caf1b4b

Change command main() functions to return void, and exit(toys.exitval) from the toybox infrastructure instead. Eliminates a return call from each command.
author Rob Landley <rob@landley.net>
date Thu, 29 Nov 2007 18:14:37 -0600
parents 78d93164a9d2
children d4176f3f3835
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"

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