Re: [PATCH 1/3] parse-opt: migrate fmt-merge-msg.

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

 



Pierre Habouzit <madcoder@xxxxxxxxxx> wrote:
> @@ -347,38 +349,32 @@ int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {
>  
>  int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
>  {
> +	const char *inpath = NULL;
> +	struct option options[] = {
> +		OPT_BOOLEAN(0, "log",     &merge_summary, "populate log with the shortlog"),
> +		OPT_BOOLEAN(0, "summary", &merge_summary, "alias for --log"),
> +		OPT_STRING('F', "file",   &inpath, "file", "file to read from"),
> +		OPT_END()


> +	argc = parse_options(argc, argv, options, fmt_merge_msg_usage, 0);
> +	if (argc > 0)
> +		usage_with_options(fmt_merge_msg_usage, options);
> +
> +	if (!inpath || strcmp(inpath, "-"))
> +		in = stdin;
> +	else {
> +		fclose(in);
> +		in = fopen(argv[2], "r");
> +		if (!in)
> +			die("cannot open %s", argv[2]);

Really argv[2]?  Shouldn't that be inpath?

-- 
Shawn.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux