未验证 提交 ebe11b89 编写于 作者: 羽飞's avatar 羽飞 提交者: GitHub

Merge pull request #52 from ChrisYuan/pr-add-psql-exit-cmd

add a psql exit cmd for miniob
...@@ -62,9 +62,14 @@ char *my_readline(const char *prompt) ...@@ -62,9 +62,14 @@ char *my_readline(const char *prompt)
} }
#endif // USE_READLINE #endif // USE_READLINE
/* this function config a exit-cmd list, strncasecmp func truncate the command from terminal according to the number,
'strncasecmp("exit", cmd, 4)' means that obclient read command string from terminal, truncate it to 4 chars from
the beginning, then compare the result with 'exit', if they match, exit the obclient.
*/
bool is_exit_command(const char *cmd) { bool is_exit_command(const char *cmd) {
return 0 == strncasecmp("exit", cmd, 4) || return 0 == strncasecmp("exit", cmd, 4) ||
0 == strncasecmp("bye", cmd, 3); 0 == strncasecmp("bye", cmd, 3) ||
0 == strncasecmp("\\q", cmd, 2) ;
} }
int init_unix_sock(const char *unix_sock_path) int init_unix_sock(const char *unix_sock_path)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册