sbase/tty.c

29 lines
420 B
C
Raw Normal View History

2011-06-02 16:15:35 -04:00
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <unistd.h>
#include "util.h"
static void
usage(void)
{
enprintf(2, "usage: %s\n", argv0);
}
2011-06-02 16:15:35 -04:00
int
main(int argc, char *argv[])
2011-06-02 16:15:35 -04:00
{
char *tty;
argv0 = *argv, argv0 ? (argc--, argv++) : (void *)0;
if (argc)
usage();
tty = ttyname(STDIN_FILENO);
puts(tty ? tty : "not a tty");
2015-02-07 16:00:28 -05:00
enfshut(2, stdout, "<stdout>");
return !tty;
2011-06-02 16:15:35 -04:00
}