提交 55bce8c7 编写于 作者: sangshuduo's avatar sangshuduo

[TD-6280]<fix>: taosdump -P determine input.

上级 7c76e859
...@@ -370,6 +370,15 @@ struct arguments g_args = { ...@@ -370,6 +370,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");
}
/* Parse a single option. */ /* Parse a single option. */
static error_t parse_opt(int key, char *arg, struct argp_state *state) { static error_t parse_opt(int key, char *arg, struct argp_state *state) {
/* Get the input argument from argp_parse, which we /* Get the input argument from argp_parse, which we
...@@ -390,6 +399,10 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { ...@@ -390,6 +399,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.
先完成此消息的编辑!
想要评论请 注册