MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / get_tty_password_ext

Function get_tty_password_ext

client/get_password.c:67–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65 the keyboard */
66
67char *get_tty_password_ext(const char *opt_message,
68 strdup_handler_t strdup_function)
69{
70 char to[80];
71 char *pos=to,*end=to+sizeof(to)-1;
72 int i=0;
73 DBUG_ENTER("get_tty_password_ext");
74 _cputs(opt_message ? opt_message : "Enter password: ");
75 for (;;)
76 {
77 char tmp;
78 tmp=_getch();
79 if (tmp == '\b' || (int) tmp == 127)
80 {
81 if (pos != to)
82 {
83 _cputs("\b \b");
84 pos--;
85 continue;
86 }
87 }
88 if (tmp == '\n' || tmp == '\r' || tmp == 3)
89 break;
90 if (iscntrl(tmp) || pos == end)
91 continue;
92 _cputs("*");
93 *(pos++) = tmp;
94 }
95 while (pos != to && isspace(pos[-1]) == ' ')
96 pos--; /* Allow dummy space at end */
97 *pos=0;
98 _cputs("\n");
99 DBUG_RETURN(strdup_function(to,MYF(MY_FAE)));
100}
101
102#else
103

Callers 1

get_tty_passwordFunction · 0.85

Calls 2

strnmovFunction · 0.85
get_passwordFunction · 0.85

Tested by

no test coverage detected