x3hy/arglib
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
arglib.h --- arglib is a tinyflag argument parser for suckless or just minimal deps programs. Arglib parses arguments as follows ./program -m=123 -Tlo Which is interpreted as the following argument values: m, T, l and o. Arglib has a set of macros that let you start a loop where you can provide inline code for each condition. This is done using single line loops, whiles, switch(s) and if(s). Please read example.c for an idea of implementation. This lib is under 50 lines of code, please review arglib.h for more details on how arglib works. arglib will go arg by arg through argv and then letter by letter, skipping the first char of each arg that way things like "-abc" become "abc" which are then processed as args 'a', 'b' and 'c'. Features: - Minimal size (under 50 lines of code, or 1183 bytes). - Zero dependencies (not even standard lib, this is thanks to macro inclusion). - Zero memory allocation. - Fast and reliable - Easy implementation. - Multi-arg values (such as -Tlo being the same as -T -l -o) - Value collection (check example.h's "-t" flag) - Builtin HELP menu - Portable (will work on any OS) Notes: This library is not thread safe. Use it before thread execution. The HELP macro will return 1 after completion. Use it in a function other then main() for more control