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

This commit is contained in:
Shuduo Sang 2021-08-27 11:44:33 +08:00 committed by GitHub
parent f9e22c1632
commit a8d688a745
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -367,6 +367,15 @@ struct arguments g_args = {
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)
{
fprintf(stderr,
@ -396,6 +405,10 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
case 'p':
break;
case 'P':
if (!isStringNumber(arg)) {
errorPrintReqArg2("taosdump", "P");
exit(EXIT_FAILURE);
}
g_args.port = atoi(arg);
break;
case 'q':