Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
73deba97
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
73deba97
编写于
3月 01, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug
上级
5f08a0ff
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
10 deletion
+35
-10
src/kit/shell/inc/shell.h
src/kit/shell/inc/shell.h
+1
-1
src/kit/shell/src/shellDarwin.c
src/kit/shell/src/shellDarwin.c
+10
-3
src/kit/shell/src/shellLinux.c
src/kit/shell/src/shellLinux.c
+14
-3
src/kit/shell/src/shellWindows.c
src/kit/shell/src/shellWindows.c
+10
-3
未找到文件。
src/kit/shell/inc/shell.h
浏览文件 @
73deba97
...
...
@@ -64,7 +64,7 @@ extern TAOS* shellInit(SShellArguments* args);
extern
void
*
shellLoopQuery
(
void
*
arg
);
extern
void
taos_error
(
TAOS_RES
*
tres
,
int64_t
st
);
extern
int
regex_match
(
const
char
*
s
,
const
char
*
reg
,
int
cflags
);
void
shellReadCommand
(
TAOS
*
con
,
char
command
[]);
int32_t
shellReadCommand
(
TAOS
*
con
,
char
command
[]);
int32_t
shellRunCommand
(
TAOS
*
con
,
char
*
command
);
void
shellRunCommandOnServer
(
TAOS
*
con
,
char
command
[]);
void
read_history
();
...
...
src/kit/shell/src/shellDarwin.c
浏览文件 @
73deba97
...
...
@@ -180,7 +180,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
}
}
void
shellReadCommand
(
TAOS
*
con
,
char
*
command
)
{
int32_t
shellReadCommand
(
TAOS
*
con
,
char
*
command
)
{
unsigned
hist_counter
=
history
.
hend
;
char
utf8_array
[
10
]
=
"
\0
"
;
Command
cmd
;
...
...
@@ -233,7 +233,7 @@ void shellReadCommand(TAOS *con, char *command) {
sprintf
(
command
,
"%s%s"
,
cmd
.
buffer
,
cmd
.
command
);
tfree
(
cmd
.
buffer
);
tfree
(
cmd
.
command
);
return
;
return
0
;
}
else
{
updateBuffer
(
&
cmd
);
}
...
...
@@ -324,6 +324,8 @@ void shellReadCommand(TAOS *con, char *command) {
insertChar
(
&
cmd
,
&
c
,
1
);
}
}
return
0
;
}
void
*
shellLoopQuery
(
void
*
arg
)
{
...
...
@@ -342,11 +344,16 @@ void *shellLoopQuery(void *arg) {
return
NULL
;
}
int32_t
err
=
0
;
do
{
// Read command from shell.
memset
(
command
,
0
,
MAX_COMMAND_SIZE
);
set_terminal_mode
();
shellReadCommand
(
con
,
command
);
err
=
shellReadCommand
(
con
,
command
);
if
(
err
)
{
break
;
}
reset_terminal_mode
();
}
while
(
shellRunCommand
(
con
,
command
)
==
0
);
...
...
src/kit/shell/src/shellLinux.c
浏览文件 @
73deba97
...
...
@@ -172,7 +172,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
}
}
void
shellReadCommand
(
TAOS
*
con
,
char
*
command
)
{
int32_t
shellReadCommand
(
TAOS
*
con
,
char
*
command
)
{
unsigned
hist_counter
=
history
.
hend
;
char
utf8_array
[
10
]
=
"
\0
"
;
Command
cmd
;
...
...
@@ -186,6 +186,10 @@ void shellReadCommand(TAOS *con, char *command) {
while
(
1
)
{
c
=
(
char
)
getchar
();
// getchar() return an 'int' value
if
(
c
==
EOF
)
{
return
c
;
}
if
(
c
<
0
)
{
// For UTF-8
int
count
=
countPrefixOnes
(
c
);
utf8_array
[
0
]
=
c
;
...
...
@@ -225,7 +229,7 @@ void shellReadCommand(TAOS *con, char *command) {
sprintf
(
command
,
"%s%s"
,
cmd
.
buffer
,
cmd
.
command
);
tfree
(
cmd
.
buffer
);
tfree
(
cmd
.
command
);
return
;
return
0
;
}
else
{
updateBuffer
(
&
cmd
);
}
...
...
@@ -316,6 +320,8 @@ void shellReadCommand(TAOS *con, char *command) {
insertChar
(
&
cmd
,
&
c
,
1
);
}
}
return
0
;
}
void
*
shellLoopQuery
(
void
*
arg
)
{
...
...
@@ -333,12 +339,17 @@ void *shellLoopQuery(void *arg) {
uError
(
"failed to malloc command"
);
return
NULL
;
}
int32_t
err
=
0
;
do
{
// Read command from shell.
memset
(
command
,
0
,
MAX_COMMAND_SIZE
);
set_terminal_mode
();
shellReadCommand
(
con
,
command
);
err
=
shellReadCommand
(
con
,
command
);
if
(
err
)
{
break
;
}
reset_terminal_mode
();
}
while
(
shellRunCommand
(
con
,
command
)
==
0
);
...
...
src/kit/shell/src/shellWindows.c
浏览文件 @
73deba97
...
...
@@ -221,7 +221,7 @@ void insertChar(Command *cmd, char c) {
cmd
->
command
[
cmd
->
cursorOffset
++
]
=
c
;
}
void
shellReadCommand
(
TAOS
*
con
,
char
command
[])
{
int32_t
shellReadCommand
(
TAOS
*
con
,
char
command
[])
{
Command
cmd
;
memset
(
&
cmd
,
0
,
sizeof
(
cmd
));
cmd
.
buffer
=
(
char
*
)
calloc
(
1
,
MAX_COMMAND_SIZE
);
...
...
@@ -241,7 +241,7 @@ void shellReadCommand(TAOS *con, char command[]) {
cmd
.
buffer
=
NULL
;
free
(
cmd
.
command
);
cmd
.
command
=
NULL
;
return
;
return
0
;
}
else
{
shellPrintContinuePrompt
();
updateBuffer
(
&
cmd
);
...
...
@@ -251,6 +251,8 @@ void shellReadCommand(TAOS *con, char command[]) {
insertChar
(
&
cmd
,
c
);
}
}
return
0
;
}
void
*
shellLoopQuery
(
void
*
arg
)
{
...
...
@@ -258,12 +260,17 @@ void *shellLoopQuery(void *arg) {
char
*
command
=
malloc
(
MAX_COMMAND_SIZE
);
if
(
command
==
NULL
)
return
NULL
;
int32_t
err
=
0
;
do
{
memset
(
command
,
0
,
MAX_COMMAND_SIZE
);
shellPrintPrompt
();
// Read command from shell.
shellReadCommand
(
con
,
command
);
err
=
shellReadCommand
(
con
,
command
);
if
(
err
)
{
break
;
}
}
while
(
shellRunCommand
(
con
,
command
)
==
0
);
return
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录