git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] git --help COMMAND brings up the git-COMMAND man-page.

From
Junio C Hamano <junkio@cox.net>
Date
Nov 15, 2005, 23:49 UTC
Message-ID
<7vsltxeakh.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20051115233125.2C0355BF73@nox.op5.se>
exon@op5.se (Andreas Ericsson) writes:
> It's by design a bit stupid (matching ^git rather than ^git-), so as
> to work with 'gitk' and 'git' as well.
>
> Signed-off-by: Andreas Ericsson <ae@op5.se>
Thanks, stupid is fine.
Show 19 quoted lines
> +/* has anyone seen 'man' installed anywhere else than in /usr/bin? */
> +#define PATH_TO_MAN "/usr/bin/man"
> +static void show_man_page(char *git_cmd)
> +{
> +	char *page;
> +
> +	if (!strncmp(git_cmd, "git", 3))
> +		page = git_cmd;
> +	else {
> +		int page_len = strlen(git_cmd) + 4;
> +
> +		page = malloc(page_len + 1);
> +		strcpy(page, "git-");
> +		strcpy(page + 4, git_cmd);
> +		page[page_len] = 0;
> +	}
> +
> +	execlp(PATH_TO_MAN, "man", page, NULL);
> +}

If you do PATH_TO_MAN absolute, execl would suffice, but just saying "man" and have execlp look for it would be easier to manage.

Previous: Andreas EricssonNext: Andreas Ericsson
Message 2 of 3 in “git --help COMMAND brings up the git-COMMAND man-page.”
  1. 3/3 git --help COMMAND brings up the git-COMMAND man-page.Andreas Ericsson, Nov 15, 2005
  2. Junio C HamanoNov 15, 2005
  3. Andreas EricssonNov 16, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.