diff mbox series

[v2,11/15] main: Do not use argv[0] for progname

Message ID 20181109071011.253734-12-amitay@ozlabs.org
State Superseded
Headers show
Series Device tree path based targeting | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/snowpatch_job_snowpatch-pdbg success Test snowpatch/job/snowpatch-pdbg on branch master

Commit Message

Amitay Isaacs Nov. 9, 2018, 7:10 a.m. UTC
When pdbg is built without "--disable-shared" option, libtool creates
pdbg as a wrapper around lt-pdbg binary.  This causes the tests to fail
which try to match the output containing argv[0].

Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
---
 src/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Alistair Popple Nov. 13, 2018, 4:32 a.m. UTC | #1
On Friday, 9 November 2018 6:10:07 PM AEDT Amitay Isaacs wrote:
> When pdbg is built without "--disable-shared" option, libtool creates
> pdbg as a wrapper around lt-pdbg binary.  This causes the tests to fail
> which try to match the output containing argv[0].

Fair enough, not really critical to print out the exact argv[0] command line.

Reviewed-by: Alistair Popple <alistair@popple.id.au>
 
> Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
> ---
>  src/main.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/main.c b/src/main.c
> index 2a11687..77db48e 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -143,11 +143,11 @@ static struct action actions[] = {
>  	{ "gdbserver", "", "Start a gdb server" },
>  };
> 
> -static void print_usage(char *pname)
> +static void print_usage(void)
>  {
>  	int i;
> 
> -	printf("Usage: %s [options] command ...\n\n", pname);
> +	printf("Usage: pdbg [options] command ...\n\n");
>  	printf(" Options:\n");
>  	printf("\t-p, --processor=<0-%d>|<range>|<list>\n", MAX_PROCESSORS-1);
>  	printf("\t-c, --chip=<0-%d>|<range>|<list>\n", MAX_CHIPS-1);
> @@ -440,7 +440,7 @@ static bool parse_options(int argc, char *argv[])
>  		case '?':
>  		case 'h':
>  			opt_error = true;
> -			print_usage(basename(argv[0]));
> +			print_usage();
>  			break;
>  		}
>  	} while (c != EOF && !opt_error);
> @@ -741,7 +741,7 @@ int main(int argc, char *argv[])
>  		return 1;
> 
>  	if (optind >= argc) {
> -		print_usage(basename(argv[0]));
> +		print_usage();
>  		return 1;
>  	}
diff mbox series

Patch

diff --git a/src/main.c b/src/main.c
index 2a11687..77db48e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -143,11 +143,11 @@  static struct action actions[] = {
 	{ "gdbserver", "", "Start a gdb server" },
 };
 
-static void print_usage(char *pname)
+static void print_usage(void)
 {
 	int i;
 
-	printf("Usage: %s [options] command ...\n\n", pname);
+	printf("Usage: pdbg [options] command ...\n\n");
 	printf(" Options:\n");
 	printf("\t-p, --processor=<0-%d>|<range>|<list>\n", MAX_PROCESSORS-1);
 	printf("\t-c, --chip=<0-%d>|<range>|<list>\n", MAX_CHIPS-1);
@@ -440,7 +440,7 @@  static bool parse_options(int argc, char *argv[])
 		case '?':
 		case 'h':
 			opt_error = true;
-			print_usage(basename(argv[0]));
+			print_usage();
 			break;
 		}
 	} while (c != EOF && !opt_error);
@@ -741,7 +741,7 @@  int main(int argc, char *argv[])
 		return 1;
 
 	if (optind >= argc) {
-		print_usage(basename(argv[0]));
+		print_usage();
 		return 1;
 	}