k9core

Coreutils for *nix operating systems [fork]
git clone git://bvnf.space/k9core.git
Log | Files | Refs | LICENSE

tty.c (239B)


      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int
main(void)
{
	char *tty = ttyname(1);
	if(tty == NULL) {
		fprintf(stderr, "tty: %s\n", strerror(errno));
		return 1;
	}
	printf("%s\n", tty);
	return 0;
}