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

Re: [PATCH 1/2] Show html help with git-help --html

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Jun 6, 2007, 11:07 UTC
Message-ID
<fcaeb9bf0706060407k26bfc0baw91c08f907384949b@mail.gmail.com>
In-Reply-To
<7vzm3e9lui.fsf@assigned-by-dhcp.cox.net>
On 6/5/07, Junio C Hamano <gitster@pobox.com> wrote:
Show 51 quoted lines
> Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
>
> > This patch was inspired by ClearCase command 'ct man',...
>
> > 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....

Sorry for my ignorant. I have no idea where to use interpolate :( Did you mean to pretend adding %p to command without alloc new buffer (default_command) ?

-- 
Duy
Previous: Junio C HamanoNext: Nguyen Thai Ngoc Duy
Message 5 of 6 in “Show html help with git-help --html”
  1. 1/2 Show html help with git-help --htmlNguyen Thai Ngoc Duy, Jun 5, 2007
  2. Frank LichtenheldJun 5, 2007
  3. Nguyen Thai Ngoc DuyJun 5, 2007
  4. Junio C HamanoJun 5, 2007
  5. Nguyen Thai Ngoc DuyJun 6, 2007
  6. 1/2 Show html help with git-help --htmlNguyen Thai Ngoc Duy, Jun 9, 2007

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.