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

Re: [PATCH 1/4] Add a simple option parser for use by builtin-commit.c.

From
Jonas Fonseca <fonseca@diku.dk>
Date
Oct 3, 2007, 20:11 UTC
Message-ID
<20071003201129.GB25856@diku.dk>
In-Reply-To
<Pine.LNX.4.64.0710011909291.28395@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote Mon, Oct 01, 2007:
Show 18 quoted lines
> On Mon, 1 Oct 2007, Kristian H?gsberg wrote:
> > On Sun, 2007-09-30 at 15:11 +0200, Jonas Fonseca wrote:
> > > > +
> > > > +extern int parse_options(const char ***argv,
> > > > +			 struct option *options, int count,
> > > > +			 const char *usage_string);
> > > 
> > > I think the interface could be improved a bit. For example, it doesn't 
> > > need to count argument since the last entry in the options array is 
> > > OPTION_LAST and thus the size can be detected that way.
> > 
> > Hehe, yeah, that's how I did it first.  I don't have a strong preference 
> > for terminator elements vs. ARRAY_SIZE(), but Junio prefers the 
> > ARRAY_SIZE() approach, I guess.  At this point I'm just trying the get 
> > the patches upstream...
> 
> FWIW I like the ARRAY_SIZE() approach better, too, since it is less error 
> prone.
OK, I must have missed that comment. Good point.

Thanks for the comments both of you. It's great to have something to work from. However, I also fear it will also require that some extra flags or information is added to the option information to make it more generally usable. But I guess that is easier to discuss in the context of a patch.

-- 
Jonas Fonseca
Previous: Johannes SchindelinNext: Kristian Høgsberg
Message 16 of 17 in “Add a simple option parser for use by builtin-commit.c.”
  1. 1/4 Add a simple option parser for use by builtin-commit.c.Kristian Høgsberg, Sep 27, 2007
  2. 2/4 This exports the update() function from builtin-add.c asKristian Høgsberg, Sep 27, 2007
  3. 3/4 Implement git commit as a builtin command.Kristian Høgsberg, Sep 27, 2007
  4. 4/4 Move launch_editor() and stripspace() to new file editor.c.Kristian Høgsberg, Sep 27, 2007
  5. Junio C HamanoSep 27, 2007
  6. Kristian HøgsbergOct 3, 2007
  7. Johannes SchindelinSep 27, 2007
  8. Junio C HamanoSep 27, 2007
  9. Jonas FonsecaSep 30, 2007
  10. Johannes SchindelinOct 1, 2007
  11. Jonas FonsecaOct 1, 2007
  12. Johannes SchindelinOct 1, 2007
  13. Jeff KingOct 1, 2007
  14. Kristian HøgsbergOct 1, 2007
  15. Johannes SchindelinOct 1, 2007
  16. Jonas FonsecaOct 3, 2007
  17. Kristian HøgsbergOct 3, 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.