small command-line argument parser library
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Lambda System 85ca0018c4
switch to MPL-2.0 license, switch to meson build system
1 year ago
example Allow structs to be specified without struct keyword. 2 years ago
include switch to MPL-2.0 license, switch to meson build system 1 year ago
src switch to MPL-2.0 license, switch to meson build system 1 year ago
.gitignore switch to MPL-2.0 license, switch to meson build system 1 year ago
CHANGELOG.md Allow structs to be specified without struct keyword. 2 years ago
LICENSE.txt switch to MPL-2.0 license, switch to meson build system 1 year ago
README.md switch to MPL-2.0 license, switch to meson build system 1 year ago
meson.build switch to MPL-2.0 license, switch to meson build system 1 year ago

README.md

Adopt

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.

Build

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 Meson.

meson setup build
meson compile -C build

With the built libadopt.a being placed in build.

Installation

PREFIX="/usr/local"
cp "build/libadopt.a" "$PREFIX/lib/"
cp -r "include" "$PREFIX/"

Documentation

(TODO)
See example/main.c for now.

License

This project is licensed under the Mozilla Public License, Version 2.0.
See LICENSE.txt for more information.