Lines Matching refs:TT
50 TT.sc = 0; in parse_speeds()
52 TT.speeds[TT.sc] = atolx_range(ptr, 0, INT_MAX); in parse_speeds()
53 if (TT.speeds[TT.sc] < 0) perror_exit("bad speed %s", ptr); in parse_speeds()
54 if (++TT.sc > 10) perror_exit("too many speeds, max is 10"); in parse_speeds()
61 if (strcmp(TT.tty_name, "-")) { in open_tty()
62 if (*(TT.tty_name) != '/') TT.tty_name = xmprintf("/dev/%s", TT.tty_name); in open_tty()
69 xopen_stdio(TT.tty_name, O_RDWR|O_NDELAY|O_CLOEXEC); in open_tty()
74 if (!isatty(0)) perror_exit("/dev/%s: not a tty", TT.tty_name); in open_tty()
75 chown(TT.tty_name, 0, 0); // change ownership, Hope login will change this in open_tty()
76 chmod(TT.tty_name, 0620); in open_tty()
86 if (tcgetattr(0, &TT.termios) < 0) perror_exit("tcgetattr"); in termios_init()
89 TT.termios.c_cflag &= (0|CSTOPB|PARENB|PARODD); in termios_init()
91 if (FLAG(h)) TT.termios.c_cflag |= CRTSCTS; in termios_init()
93 if (FLAG(L)) TT.termios.c_cflag |= CLOCAL; in termios_init()
94 TT.termios.c_cc[VTIME] = 0; in termios_init()
95 TT.termios.c_cc[VMIN] = 1; in termios_init()
96 TT.termios.c_oflag = OPOST|ONLCR; in termios_init()
97 TT.termios.c_cflag |= CS8|CREAD|HUPCL|CBAUDEX; in termios_init()
99 TT.termios.c_lflag |= ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOKE; in termios_init()
100 TT.termios.c_cc[VINTR] = CTL('C'); in termios_init()
101 TT.termios.c_cc[VQUIT] = CTL('\\'); in termios_init()
102 TT.termios.c_cc[VEOF] = CTL('D'); in termios_init()
103 TT.termios.c_cc[VEOL] = '\n'; in termios_init()
104 TT.termios.c_cc[VKILL] = CTL('U'); in termios_init()
105 TT.termios.c_cc[VERASE] = 127; // CERASE in termios_init()
106 TT.termios.c_iflag = ICRNL|IXON|IXOFF; in termios_init()
108 if (TT.speeds[0] != 0) xsetspeed(&TT.termios, TT.speeds[0]); in termios_init()
109 if (tcsetattr(0, TCSANOW, &TT.termios) < 0) perror_exit("tcsetattr"); in termios_init()
119 vmin = TT.termios.c_cc[VMIN]; // Store old in sense_baud()
120 TT.termios.c_cc[VMIN] = 0; // No block even queue is empty. in sense_baud()
121 if (tcsetattr(0, TCSANOW, &TT.termios) < 0) perror_exit("tcsetattr"); in sense_baud()
122 size = readall(0, TT.buff, sizeof(TT.buff)-1); in sense_baud()
124 for (ptr = TT.buff; ptr < TT.buff+size; ptr++) { in sense_baud()
127 if (speed > 0) xsetspeed(&TT.termios, speed); in sense_baud()
132 TT.termios.c_cc[VMIN] = vmin; //restore old value in sense_baud()
133 if (tcsetattr(0, TCSANOW, &TT.termios) < 0) perror_exit("tcsetattr"); in sense_baud()
140 int fd = open(TT.f, O_RDONLY), size; in write_issue()
152 if (*ch == 'l') fputs(TT.tty_name, stdout); in write_issue()
167 if (!FLAG(i)) write_issue(TT.f, &uts); in read_login_name()
172 TT.buff[0] = getchar(); in read_login_name()
173 if (!TT.buff[0] && TT.sc > 1) return 0; // Switch speed in read_login_name()
174 if (TT.buff[0] == '\n') continue; in read_login_name()
175 if (TT.buff[0] != '\n') in read_login_name()
176 if (!fgets(&TT.buff[1], HOSTNAME_SIZE-1, stdin)) _exit(1); in read_login_name()
177 while (i < HOSTNAME_SIZE-1 && isgraph(TT.buff[i])) i++; in read_login_name()
178 TT.buff[i] = 0; in read_login_name()
204 if (FLAG(H)) xstrncpy(entry.ut_host, TT.H, sizeof(entry.ut_host)); in utmp_entry()
213 char ch, *cmd[3] = {TT.l ? : "/bin/login", 0, 0}; // space to add username in getty_main()
215 if (!FLAG(f)) TT.f = "/etc/issue"; in getty_main()
220 if (*++toys.optargs) TT.tty_name = xmprintf("%s", *toys.optargs); in getty_main()
222 TT.tty_name = xmprintf("%s", *toys.optargs); in getty_main()
231 if (FLAG(I)) xputsn(TT.I); in getty_main()
233 if (FLAG(t)) alarm(TT.t); in getty_main()
240 index %= TT.sc; in getty_main()
241 xsetspeed(&TT.termios, TT.speeds[index]); in getty_main()
243 if (tcsetattr(0, TCSANOW, &TT.termios) < 0) perror_exit("tcsetattr"); in getty_main()
245 cmd[1] = TT.buff; //put the username in the login command line in getty_main()