Block a user
Formatting
Iterating through characters in arguments looks something like:
for(size_t i = optind; i < argc; ++i) {
for(size_t j = 0; argv[i][j] != '\0'; ++j) { // two dereferences (p[i][j])
…
Formatting
Yes, not setting an intermediate variable but relying on argv[0]
elsewhere, only falling back to program_name
here.
So:
if (argc < 3) { return usage(argv[0] == NULL ? program_name…
Formatting
@trinity: Are you cool with this being merged without
.clang-format
?
Yeah, we can do it later down the line.
Formatting
s
didn't work because the argv[0]
you replaced later in the program wasn't the program name but an iterating pointer.
Formatting
Instead of opts
here I would call this a variant of arg
. opts
is a little misleading; this is used for all given arguments, not just parsed options.