Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
06e8ba9f
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
06e8ba9f
编写于
6月 27, 2022
作者:
wafwerar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
os: win shell catch ctrl-c
上级
486f2683
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
6 deletion
+15
-6
include/os/osSystem.h
include/os/osSystem.h
+3
-0
source/os/src/osSystem.c
source/os/src/osSystem.c
+6
-3
tools/shell/src/shellArguments.c
tools/shell/src/shellArguments.c
+2
-2
tools/shell/src/shellCommand.c
tools/shell/src/shellCommand.c
+4
-1
未找到文件。
include/os/osSystem.h
浏览文件 @
06e8ba9f
...
...
@@ -29,6 +29,9 @@ extern "C" {
#define tcgetattr TCGETATTR_FUNC_TAOS_FORBID
#endif
#define TAOS_CONSOLE_PROMPT_HEADER "taos> "
#define TAOS_CONSOLE_PROMPT_CONTINUE " -> "
typedef
struct
TdCmd
*
TdCmdPtr
;
TdCmdPtr
taosOpenCmd
(
const
char
*
cmd
);
...
...
source/os/src/osSystem.c
浏览文件 @
06e8ba9f
...
...
@@ -18,6 +18,10 @@
#include "os.h"
#if defined(WINDOWS)
BOOL
WINAPI
CtrlHandler
(
DWORD
fdwCtrlType
)
{
printf
(
"
\n
"
TAOS_CONSOLE_PROMPT_HEADER
);
return
TRUE
;
}
#elif defined(_TD_DARWIN_64)
#else
#include <dlfcn.h>
...
...
@@ -124,7 +128,7 @@ int taosSetConsoleEcho(bool on) {
void
taosSetTerminalMode
()
{
#if defined(WINDOWS)
// assert(0
);
SetConsoleCtrlHandler
(
CtrlHandler
,
TRUE
);
#else
struct
termios
newtio
;
...
...
@@ -158,7 +162,6 @@ void taosSetTerminalMode() {
int32_t
taosGetOldTerminalMode
()
{
#if defined(WINDOWS)
// assert(0);
#else
/* Make sure stdin is a terminal. */
if
(
!
isatty
(
STDIN_FILENO
))
{
...
...
@@ -176,7 +179,7 @@ int32_t taosGetOldTerminalMode() {
void
taosResetTerminalMode
()
{
#if defined(WINDOWS)
// assert(0
);
SetConsoleCtrlHandler
(
CtrlHandler
,
FALSE
);
#else
if
(
tcsetattr
(
0
,
TCSANOW
,
&
oldtio
)
!=
0
)
{
fprintf
(
stderr
,
"Fail to reset the terminal properties!
\n
"
);
...
...
tools/shell/src/shellArguments.c
浏览文件 @
06e8ba9f
...
...
@@ -339,8 +339,8 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) {
shell
.
info
.
clientVersion
=
"Welcome to the TDengine shell from %s, Client Version:%s
\n
"
"Copyright (c) 2022 by TAOS Data, Inc. All rights reserved.
\n\n
"
;
shell
.
info
.
promptHeader
=
"taos> "
;
shell
.
info
.
promptContinue
=
" -> "
;
shell
.
info
.
promptHeader
=
TAOS_CONSOLE_PROMPT_HEADER
;
shell
.
info
.
promptContinue
=
TAOS_CONSOLE_PROMPT_CONTINUE
;
shell
.
info
.
promptSize
=
6
;
snprintf
(
shell
.
info
.
programVersion
,
sizeof
(
shell
.
info
.
programVersion
),
"version: %s"
,
version
);
...
...
tools/shell/src/shellCommand.c
浏览文件 @
06e8ba9f
...
...
@@ -411,8 +411,9 @@ char taosGetConsoleChar() {
static
char
mbStr
[
5
];
static
unsigned
long
bufLen
=
0
;
static
uint16_t
bufIndex
=
0
,
mbStrIndex
=
0
,
mbStrLen
=
0
;
if
(
bufLen
==
0
)
{
while
(
bufLen
==
0
)
{
ReadConsoleW
(
console
,
buf
,
SHELL_INPUT_MAX_COMMAND_SIZE
,
&
bufLen
,
NULL
);
if
(
bufLen
>
0
&&
buf
[
0
]
==
0
)
bufLen
=
0
;
bufIndex
=
0
;
}
if
(
mbStrLen
==
0
){
...
...
@@ -466,6 +467,8 @@ int32_t shellReadCommand(char *command) {
}
else
if
(
c
<
'\033'
)
{
// Ctrl keys. TODO: Implement ctrl combinations
switch
(
c
)
{
case
0
:
break
;
case
1
:
// ctrl A
shellPositionCursorHome
(
&
cmd
);
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录