Lines Matching refs:ttyfd
194 static void backspace_chars(int ttyfd, size_t p) {
196 if (ttyfd < 0)
202 loop_write(ttyfd, "\b \b", 3, false);
218 _cleanup_close_ int ttyfd = -1, notify = -1;
248 ttyfd = open("/dev/tty", O_RDWR|O_NOCTTY|O_CLOEXEC);
249 if (ttyfd >= 0) {
251 if (tcgetattr(ttyfd, &old_termios) < 0) {
256 loop_write(ttyfd, ANSI_HIGHLIGHT, strlen(ANSI_HIGHLIGHT), false);
257 loop_write(ttyfd, message, strlen(message), false);
258 loop_write(ttyfd, " ", 1, false);
259 loop_write(ttyfd, ANSI_NORMAL, strlen(ANSI_NORMAL), false);
266 if (tcsetattr(ttyfd, TCSADRAIN, &new_termios) < 0) {
275 pollfd[POLL_TTY].fd = ttyfd >= 0 ? ttyfd : STDIN_FILENO;
322 n = read(ttyfd >= 0 ? ttyfd : STDIN_FILENO, &c, 1);
338 backspace_chars(ttyfd, p);
346 backspace_chars(ttyfd, 1);
357 if (ttyfd >= 0)
358 loop_write(ttyfd, "(no echo) ", 10, false);
360 } else if (ttyfd >= 0)
361 loop_write(ttyfd, "\a", 1, false);
365 backspace_chars(ttyfd, p);
370 if (ttyfd >= 0)
371 loop_write(ttyfd, "(no echo) ", 10, false);
374 loop_write(ttyfd, "\a", 1, false);
380 if (!(flags & ASK_PASSWORD_SILENT) && ttyfd >= 0) {
384 loop_write(ttyfd, (flags & ASK_PASSWORD_ECHO) ? &c : "*", 1, false);
408 if (ttyfd >= 0 && reset_tty) {
409 loop_write(ttyfd, "\n", 1, false);
410 tcsetattr(ttyfd, TCSADRAIN, &old_termios);