Re: [PATCH 3/9] git-cat-file: Make option parsing a little more flexible
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 26, 2007, 20:56 UTC
- Message-ID
- <7vlk9py4r9.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <1193307927-3592-4-git-send-email-aroben@apple.com>
Adam Roben <aroben@apple.com> writes:
> This will make it easier to add newer options later.
A good change in principle.
Show 16 quoted lines
> diff --git a/builtin-cat-file.c b/builtin-cat-file.c
> index 34a63d1..3a0be4a 100644
> --- a/builtin-cat-file.c
> +++ b/builtin-cat-file.c
> @@ -143,23 +143,41 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
> return 0;
> }
>
> +static const char cat_file_usage[] = "git-cat-file [-t|-s|-e|-p|<type>] <sha1>";
> +
> int cmd_cat_file(int argc, const char **argv, const char *prefix)
> {
> - int opt;
> - const char *exp_type, *obj_name;
> + int i, opt = 0;
> + const char *exp_type = 0, *obj_name = 0;NULL pointer constants in git sources are spelled "NULL", not "0".