[10/11] app/regex: fix usage text

Message ID 20210309233116.1934666-11-thomas@monjalon.net (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series improve options help |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Thomas Monjalon March 9, 2021, 11:31 p.m. UTC
  The usage syntax help includes the program name which was fake.
It is replaced with the real name from argv.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 app/test-regex/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Ori Kam March 10, 2021, 7:08 a.m. UTC | #1
Hi

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Subject: [PATCH 10/11] app/regex: fix usage text
> 
> The usage syntax help includes the program name which was fake.
> It is replaced with the real name from argv.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  app/test-regex/main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test-regex/main.c b/app/test-regex/main.c
> index ba09b20126..73ba227fba 100644
> --- a/app/test-regex/main.c
> +++ b/app/test-regex/main.c
> @@ -151,10 +151,10 @@ args_parse(int argc, char **argv, char *rules_file,
> char *data_file,
>  			*nb_lcores = atoi(optarg);
>  			break;
>  		case ARG_HELP:
> -			usage("RegEx test app");
> +			usage(argv[0]);
>  			break;
>  		default:
> -			usage("RegEx test app");
> +			usage(argv[0]);
>  			rte_exit(EXIT_FAILURE, "Invalid option: %s\n",
> argv[optind]);
>  			break;
>  		}
> --
> 2.30.1
Acked-by: Ori Kam <orika@nvidia.com>

Best,
Ori
  

Patch

diff --git a/app/test-regex/main.c b/app/test-regex/main.c
index ba09b20126..73ba227fba 100644
--- a/app/test-regex/main.c
+++ b/app/test-regex/main.c
@@ -151,10 +151,10 @@  args_parse(int argc, char **argv, char *rules_file, char *data_file,
 			*nb_lcores = atoi(optarg);
 			break;
 		case ARG_HELP:
-			usage("RegEx test app");
+			usage(argv[0]);
 			break;
 		default:
-			usage("RegEx test app");
+			usage(argv[0]);
 			rte_exit(EXIT_FAILURE, "Invalid option: %s\n", argv[optind]);
 			break;
 		}