optparse
Portable, reentrant, getopt-like option parser (by skeeto)
rust-fnv
Fowler–Noll–Vo hash function (by servo)
Our great sponsors
optparse | rust-fnv | |
---|---|---|
5 | 2 | |
314 | 324 | |
- | 2.5% | |
0.0 | 5.1 | |
6 months ago | about 1 month ago | |
C | Rust | |
The Unlicense | Apache License 2.0 |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
optparse
Posts with mentions or reviews of optparse.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-09-01.
-
Porting my very simple C code from Unixen/macOS to Windows
Between -std=c99 and removing these headers, you're missing time definitions (struct timeval, gettimeofday) and option parsing definitions (struct option, getopt_long). Mingw-w64 provides all this for compatibility, but MSVC has none of these, so you'll need to write replacements. I've written embeddable, public domain implementations of getopt and something like getopt_long, in case that helps. These are how I deal with option parsing portability.
-
How to properly handle position non-specific program arguments? ./my_prog --format:"mp3"
getopt_long is a GNU extension, common across unix-like systems, for parsing long options. You can find libraries for functionality as well.
-
How to make programs for linux
When I need something more sophisticated, where long options would be nice, I reach for my own Optparse.
-
[ Feed back wanted ] Is this a good way to handle lot of if instead of if else?
https://github.com/skeeto/optparse (short and long)
-
Debian discusses vendoring again
This is bug-free and feature complete so it never needs to be updated. When I need argument parsing in a C program, I just copy-paste that into my source and massage it into place. Sometimes I cut the fprintf() stuff, or replace the isalnum, or otherwise adapt it to fit the program's needs. The point is that it becomes wholly owned by the project using it. It's a similar story for long option parsing.
rust-fnv
Posts with mentions or reviews of rust-fnv.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2021-08-01.
-
How to write slow Rust code. My battle to beat Common Lisp and Java on a phone number encoding problem.
Use faster hashing function (e.g. fnv, there are other potentially faster options as well). By default Rust std uses a DoS-resistant function, which is relatively slow.
-
Debian discusses vendoring again
Looking at ripgrep myself, I'm seeing some trivial dependencies. One is fnv. Perhaps you're not aware, but FNV-1a is literally ~4 lines of code. It's about as sophisticated as left-pad. I've written it from scratch a dozen times off the top of my head (the official offset basis and prime are really not special, so you can just generate your own). It would take you about a minute to eliminate it.
What are some alternatives?
When comparing optparse and rust-fnv you can also consider the following projects:
getopt - POSIX getopt() as a portable header library
perl5 - 🐪 The Perl programming language
pre-commit - A framework for managing and maintaining multi-language pre-commit hooks.
itoa - Fast integer to ascii / integer to string conversion
fst - Represent large sets and maps compactly with finite state transducers.
wingetopt - getopt library for Windows compilers
itoa - Fast function for printing integer primitives to a decimal string
nixpkgs - Nix Packages collection & NixOS
rust-base64 - base64, in rust