Re: [PATCH 1/2] rpc.idmapd: Added a usage routine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 12/09/2015 11:01 AM, Steve Dickson wrote:
> Show the correct arguments when invalid
> arguments are used.
> 
> Signed-off-by: Steve Dickson <steved@xxxxxxxxxx>
Committed...

steved.

> ---
>  utils/idmapd/idmapd.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
> index 689608a..910b02e 100644
> --- a/utils/idmapd/idmapd.c
> +++ b/utils/idmapd/idmapd.c
> @@ -199,6 +199,12 @@ flush_nfsd_idmap_cache(void)
>  	return ret;
>  }
>  
> +void usage(char *progname)
> +{
> +	fprintf(stderr, "Usage: %s [-fvCS] [-p path] [-c path]\n",
> +		basename(progname));
> +}
> +
>  int
>  main(int argc, char **argv)
>  {
> @@ -232,9 +238,11 @@ main(int argc, char **argv)
>  			conf_path = optarg;
>  		if (opt == '?') {
>  			if (strchr(GETOPTSTR, optopt))
> -				errx(1, "'-%c' option requires an argument.", optopt);
> +				warnx("'-%c' option requires an argument.", optopt);
>  			else
> -				errx(1, "'-%c' is an invalid argument.", optopt);
> +				warnx("'-%c' is an invalid argument.", optopt);
> +			usage(progname);
> +			exit(1);
>  		}
>  	}
>  	optind = 1;
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux