argtable / argtable3

A single-file, ANSI C, command-line parsing library that parses GNU-style command-line options.
http://www.argtable.org
Other
372 stars 65 forks source link

argtable3.c contains a copy of getopt.c from NetBSD under a different license #16

Closed micolous closed 6 years ago

micolous commented 6 years ago

This should be in a different file, as any project with getopt.c it will also have the functions from argtable3 conflict with it.

Also, it's under a different license to argtable3, and the project's README does not contain the required attribution acknowledgement string.

Ref:

https://github.com/argtable/argtable3/blob/611d1608598df1ba9280a29f3807d22c007c9938/argtable3.c#L169

https://github.com/argtable/argtable3/blob/611d1608598df1ba9280a29f3807d22c007c9938/argtable3.c#L262

surreylabs commented 6 years ago

Hi @micolous, the original idea of developing argtable3 is to replace getopt.c, so I never think about this conflict situation. May I know in what use cases we need to have both getopt.c and argtable3.c at the same time?

The reason to include getopt.c in argtable3.c is to make argtable3 an amalgamation library like SQLite, because it can make using the library so much easier. By including getopt.c inside argtable3.c, we can make sure the library has no external dependencies.

Thank you for reminding me the README attribution acknowledgement issue. I'll fix this.

surreylabs commented 6 years ago

Have added the copyright notice from NetBSD getopt library to README.md and LICENSE.

micolous commented 6 years ago

What prompted this is that proxmark3 has, over the years, collected a number of different standalone-programs which have been compiled into the main binary, but they each can include things like getopt. Additionally, any program which migrates to argparse3 will have to replace getopt immediately with argparse's version.

There are a few different implementations of getopt around, and they're not all compatible.

I acknowledge what you're trying to achieve, however sqlite3 does the source amalgamation by Makefile.

You'll also see this sort of thing in Javascript projects like jQuery and Leaflet, where they have a build step to generate the single source file (and then cut releases of that file). A couple of other projects also include these single source files in the git repository directly, and periodically rebuild them with a CI system which allows use as a git submodule.

This way, it's easier to track when there are changes introduced to getopt.c, and you can handle the case where you already use getopt somewhere else more cleanly, as you don't have to pull apart argparse3's getopt.h.

It also makes license tracking much easier, which keeps corporate lawyercats happy. :cat:

While having the acknowledgement in there now is a great step, I don't think it sufficiently addresses the other issues above.

surreylabs commented 6 years ago

@micolous , I think you're right. There should be two versions of argtable3, one is composed of several files (including getopt), and the other is the amalgamation version, which is generated from the Makefile.

I do make the amalgamation version from an internal Makefile, however, I never publish it. I'll cleanup the code and re-arrange the source code directory structure, so that projects like proxmark3 can use argtable3 in their own way.