提交 bce784ab 编写于 作者: S Shengliang Guan

refactor(tools): refact shell codes

上级 d2d51961
...@@ -207,7 +207,6 @@ static struct argp_option shellOptions[] = { ...@@ -207,7 +207,6 @@ static struct argp_option shellOptions[] = {
static error_t shellParseOpt(int32_t key, char *arg, struct argp_state *state) { static error_t shellParseOpt(int32_t key, char *arg, struct argp_state *state) {
SShellArgs *arguments = &shell.args; SShellArgs *arguments = &shell.args;
wordexp_t full_path = {0};
switch (key) { switch (key) {
case 'h': case 'h':
......
...@@ -178,7 +178,6 @@ int32_t shellRunCommand(char *command) { ...@@ -178,7 +178,6 @@ int32_t shellRunCommand(char *command) {
void shellRunSingleCommandImp(char *command) { void shellRunSingleCommandImp(char *command) {
int64_t st, et; int64_t st, et;
wordexp_t full_path;
char *sptr = NULL; char *sptr = NULL;
char *cptr = NULL; char *cptr = NULL;
char *fname = NULL; char *fname = NULL;
...@@ -250,10 +249,6 @@ void shellRunSingleCommandImp(char *command) { ...@@ -250,10 +249,6 @@ void shellRunSingleCommandImp(char *command) {
printf("\n"); printf("\n");
if (fname != NULL) {
wordfree(&full_path);
}
atomic_store_64(&shell.result, 0); atomic_store_64(&shell.result, 0);
} }
...@@ -396,7 +391,7 @@ int32_t shellDumpResultToFile(const char *fname, TAOS_RES *tres) { ...@@ -396,7 +391,7 @@ int32_t shellDumpResultToFile(const char *fname, TAOS_RES *tres) {
row = taos_fetch_row(tres); row = taos_fetch_row(tres);
} while (row != NULL); } while (row != NULL);
shell.result = 0; atomic_store_64(&shell.result, 0);
taosCloseFile(&pFile); taosCloseFile(&pFile);
return numOfRows; return numOfRows;
...@@ -862,7 +857,7 @@ void shellGetGrantInfo() { ...@@ -862,7 +857,7 @@ void shellGetGrantInfo() {
taos_get_server_info(shell.conn), expiretime); taos_get_server_info(shell.conn), expiretime);
} }
shell.result = 0; atomic_store_64(&shell.result, 0);
taos_free_result(tres); taos_free_result(tres);
} }
......
...@@ -20,11 +20,11 @@ SShellObj shell = {0}; ...@@ -20,11 +20,11 @@ SShellObj shell = {0};
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (shellCheckIntSize() != 0) { if (shellCheckIntSize() != 0) {
return 0; return -1;
} }
if (shellParseArgs(argc, argv) != 0) { if (shellParseArgs(argc, argv) != 0) {
return 0; return -1;
} }
if (shell.args.is_version) { if (shell.args.is_version) {
...@@ -38,6 +38,7 @@ int main(int argc, char *argv[]) { ...@@ -38,6 +38,7 @@ int main(int argc, char *argv[]) {
} }
if (shell.args.is_help) { if (shell.args.is_help) {
shellPrintVersion();
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册