Re: [PATCH 1/2] Show html help with git-help --html
Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
> This patch was inspired by ClearCase command 'ct man',...
Show 45 quoted lines
> diff --git a/help.c b/help.c
> index 6a9af4d..78b1023 100644
> --- a/help.c
> +++ b/help.c
> @@ -9,6 +9,14 @@
> #include "common-cmds.h"
> #include <sys/ioctl.h>
>
> +#ifndef HTML_DIR
> +#define HTML_DIR "/usr/share/html/"
> +#endif
> +
> +#ifndef HTML_PROGRAM
> +#define HTML_PROGRAM "xdg-open"
> +#endif
> +
> /* most GUI terminals set COLUMNS (although some don't export it) */
> static int term_columns(void)
> {
> @@ -183,6 +191,145 @@ 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 len, ret, nr_quotes;
> + char *p, *p2;
> + const char *cp, *cp2;
> + struct stat st;
> + char *quoted_git_cmd;
> + char *default_command = NULL;
> + const char *command;
>...
> + /* append %p if there is not any %x */
> + if (!strchr(command, '%')) {
> + len = strlen(command);
> + default_command = xmalloc(len + 3 + 1); /* space %p */
> + strcpy(default_command, command);
> + strcat(default_command, " %p");
> + command = default_command;
> + }
> +
> + /* first pass, calculate command length */
> ...Hmmm. Makes one wonder why interpolate is not used....