未验证 提交 41cd8500 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

[TD-6280]<fix>: taosdump -P determine input. (#7607)

上级 6718a7a4
...@@ -367,6 +367,15 @@ struct arguments g_args = { ...@@ -367,6 +367,15 @@ struct arguments g_args = {
false // performance_print false // performance_print
}; };
static void errorPrintReqArg2(char *program, char *wrong_arg)
{
fprintf(stderr,
"%s: option requires a number argument '-%s'\n",
program, wrong_arg);
fprintf(stderr,
"Try `taosdump --help' or `taosdump --usage' for more information.\n");
}
static void errorPrintReqArg3(char *program, char *wrong_arg) static void errorPrintReqArg3(char *program, char *wrong_arg)
{ {
fprintf(stderr, fprintf(stderr,
...@@ -396,6 +405,10 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { ...@@ -396,6 +405,10 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
case 'p': case 'p':
break; break;
case 'P': case 'P':
if (!isStringNumber(arg)) {
errorPrintReqArg2("taosdump", "P");
exit(EXIT_FAILURE);
}
g_args.port = atoi(arg); g_args.port = atoi(arg);
break; break;
case 'q': case 'q':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册