blob: 3dfba9eef7414c56ae5a582b2c9d640d676d78fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
/* 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;
}
|