$ ./p.sh
Binary file ./reterm matches
grep tty $fil;
real ttyname is: /dev/tty
int msgsok, myttyfd;
if (isatty(fileno(stdin)))
myttyfd = fileno(stdin);
else if (isatty(fileno(stdout)))
myttyfd = fileno(stdout);
else if (isatty(fileno(stderr)))
myttyfd = fileno(stderr);
fprintf(stderr, "can't find tty\n");
ttyname(myttyfd);
if((fd = open("/dev/tty", O_RDWR)) < 0) {
Binary file ./ttytest matches
/*if((fd = open("/dev/tty", O_RDONLY )) < 0) {
perror("Can't open /dev/tty: ");
printf("fd 0: %s\n", isatty(0) ? "tty" : "not a tty");
printf("fd 1: %s\n", isatty(1) ? "tty" : "not a tty");
printf("fd 2: %s\n", isatty(2) ? "tty" : "not a tty");
printf("fd 0: %s\n", isatty(0) ? "tty" : "not a tty");
printf("fd 1: %s\n", isatty(1) ? "tty" : "not a tty");
printf("fd 2: %s\n", isatty(2) ? "tty" : "not a tty");*/
Binary file ./lockme matches
Binary file ./pass matches
Binary file ./me matches
if ((fd = open("/dev/tty", O_RDONLY)) < 0) {
name = ttyname(fd);
printf("real ttyname is: %s\n", name);
void changeme(char *tty)
strcpy(tty, nylons);
Binary file ./tty matches
if((fd = open("/dev/tty", O_RDWR)) < 0){
perror("Can't open tty\n");
grep: ./am: Permission denied
found 0 lines