[openbeos] parsing command line arguments

  • From: "shatty" <shatty@xxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Sun, 07 Jul 2002 04:29:06 -0700

I've been gathering information about mkbfs and learning
about the filesystem in order to write the "mkbfs"
program, which initializes a file or partition with the
BFS.  I'm ready to get started with the code but I've
noted that there are various different mechanisms in use
throughout the source for parsing command line arguments.

Can we adopt a standard?  It's an annoying little thing
that is not too difficult to screw up.  Especially when
one adds flags that require arguments like this:

app -f something -g something_else

Or some apps that allow you to "coalesce" arguments such as:

ls -alFps

And then there are double hyphenated arguments:

configure --enable-shared

And arguments that use equals signs:

app -f=something

And combinations...

app --enabled-shared=yes

And there are those that allow flags and then soak up
the rest of the arguments as a list of filenames or
other strings.

mkbfs isn't this complicated at all, but since I've
seen so many different approaches in the cvs I thought
it best to raise the issue.  (perhaps multiple solutions are
warranted due to the proliferation of options, but at least
standard multiple solutions?)

Andrew Bachmann



Other related posts: