added getuid() to check root
get tty name from command line