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

Alistair Popple alistair at popple.id.au
Tue Nov 13 15:32:24 AEDT 2018


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 at popple.id.au>
 
> Signed-off-by: Amitay Isaacs <amitay at 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;
>  	}




More information about the Pdbg mailing list