Files
sbase/tty.c
T

31 lines
373 B
C
Raw Normal View History

2011-06-02 21:15:35 +01:00
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <unistd.h>
2014-11-13 18:29:30 +01:00
2013-10-07 15:50:41 +01:00
#include "util.h"
static void
usage(void)
{
eprintf("usage: %s\n", argv0);
}
2011-06-02 21:15:35 +01:00
int
2013-10-07 15:50:41 +01:00
main(int argc, char *argv[])
2011-06-02 21:15:35 +01:00
{
char *tty;
2013-10-07 15:50:41 +01:00
ARGBEGIN {
default:
usage();
} ARGEND;
2015-02-28 19:59:34 +01:00
if (argc)
usage();
2013-10-07 15:50:41 +01:00
tty = ttyname(STDIN_FILENO);
puts(tty ? tty : "not a tty");
2015-02-07 22:00:28 +01:00
2015-02-28 19:59:34 +01:00
return !tty;
2011-06-02 21:15:35 +01:00
}