small C commandline argument parser library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Luna Catkins 9672c22303
Initial release
2 weeks ago
example Initial release 2 weeks ago
include Initial release 2 weeks ago
src Initial release 2 weeks ago
.gitignore Initial release 2 weeks ago Initial release 2 weeks ago
LICENSE.txt Initial release 2 weeks ago Initial release 2 weeks ago
premake5.lua Initial release 2 weeks ago


Adopt is a small, cross-platform argument parsing library for C programs. While mainly targeting Unix-like systems, it should build fine with any C99-compatible C compiler.

It aims to be explicit, having no hidden state or features.
It is also modular, each file has one source file and one header. You can simply discard what you don't need.

The API is fairly compact, with names being kept short without becoming obfuscated.

Adopt also doesn't try to be a comprehensive solution.
No automatic string conversions will be done for you, nor will it check that arguments are semantically sensible.


While Adopt is mainly meant to simply be dropped into your existing code, it can be built as a static library.

To do so, you will need Premake 5.

A typical Linux build will look like this:

premake5 gmake2
make -C build config=release

With the built libadopt.a being placed in build/bin/Release.


Premake doesn't currently feature a convenient way to handle install actions. If you really want to install Adopt globally, you can run a few shell commands after building:

cp "build/bin/Release/libadopt.a" "$PREFIX/lib/"
cp -r "include" "$PREFIX/"


See example/main.c for now.


This project is licensed under the MIT license. See LICENSE.txt for more information.