Re: [PATCH] Show html help with git-help --html

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

 



> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 3d8f03d..2ec8545 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -261,6 +261,18 @@ core.excludeFile::
> ...
> +core.htmlprogram::
> +	Specify the program used to open html help files when 'git-help'
> +	is called with option --html or core.help is other than 'man'.
> +	By default, xdg-open will be used.

Is the program's calling convention something that needs to be
customizable for this to be useful?

> diff --git a/Makefile b/Makefile
> index cac0a4a..43e0d15 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -145,6 +145,7 @@ prefix = $(HOME)
>  bindir = $(prefix)/bin
>  gitexecdir = $(bindir)
>  sharedir = $(prefix)/share/
> +htmldir = $(sharedir)/html/
>  template_dir = $(sharedir)/git-core/templates/
>  ifeq ($(prefix),/usr)
>  sysconfdir = /etc

Is it customary to have HTMLized documentation material for
different packages all together in a single .../share/html/
directory, like manpages are placed in share/man/man1/
directory?  I somehow had an impression that a layout to have
html directory per package (i.e. share/doc/$pkg/html/) was more
common.  I dunno.

> diff --git a/help.c b/help.c
> index 6a9af4d..e3e705b 100644
> --- a/help.c
> +++ b/help.c
> @@ -183,6 +187,36 @@ static void show_man_page(const char *git_cmd)
>  	execlp("man", "man", page, NULL);
>  }
>  
> +static void show_html_page(const char *git_cmd)
> +{
> +	const char *html_dir;
> +	int i,len,ret;
> +	char *p;
> +
> +	html_dir = HTML_DIR;
> +	if (!html_help_program)
> +		html_help_program = "xdg-open";
> +
> +	/* html_help_program space html_dir git- git_cmd .html */
> +	len = strlen(html_help_program) + 1 + strlen(html_dir) + 4 + strlen(git_cmd) + 5;
> +	p = xmalloc(len + 1);
> +
> +	strcpy(p, html_help_program);
> +	strcat(p," ");
> +	strcat(p,html_dir);
> +	if (prefixcmp(git_cmd, "git"))
> +		strcat(p,"git-");
> +	strcat(p,git_cmd);
> +	strcat(p,".html");
> +
> +	ret = system(p);

This is sloppy in the presense of potentially unsafe characters...

-
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