:: yarg

iczelia

Yet another UNIX-like argument parser for C. 0BSD-licensed.

recent commits

2026-08-12 13:19add project urlKamila Szewczyk
2026-08-12 13:03code volumeKamila Szewczyk
2026-08-12 13:02demo: fix the argument requirement for the flagKamila Szewczyk
2026-08-12 13:01stricter bounds checks, reject opt. args. with no_argument, ...Kamila Szewczyk
2026-08-12 12:57fix a handful of portability defectsKamila Szewczyk
2026-08-12 12:53styleKamila Szewczyk
2026-05-16 12:36CC0 -> 0BSDKamila Szewczyk
2026-05-16 12:36CC0 -> 0BSDKamila Szewczyk
2025-08-05 19:06Update yarg.hKamila Szewczyk
2024-12-17 11:20Update yarg.hKamila Szewczyk

branches

main (2026-08-12 13:19)

tags

no tags.

README.md

yarg

Yet another UNIX-like argument parser for C99. 0BSD-licensed.

Why another argument parsing library?

Four reasons:

  • yarg is a header-only library, meaning that you can simply copy-and-paste it into project. It is also 0BSD-licensed, meaning that you can use it in just about any program without complicated or undesirable licensing obligations.
  • yarg supports short and long options, Windows-style flags /like-this and short flag styles -like -this=3, not just the UNIX-y -ab5 --like-this.
  • yarg actually parses the arguments and gives you a structure that is fundamentally independent of the contents of argv.
  • yarg supports mixed positional arguments with flags, e.g. --flag file_name.txt --flag2.

Despite being more featured than argument parsers like getopt or getopt_long, yarg retains a relatively small code footprint (300 LoC).

tab: 248 wrap: offon