diff options
| author | dev <dev@example> | 2026-11-14 17:42:44 +0000 |
|---|---|---|
| committer | dev <dev@example> | 2026-11-14 17:42:44 +0000 |
| commit | 12dcb09794c48a333bb850d353540c688c503b76 (patch) | |
| tree | f1538ec1b1c794790b16b2a4f3b6f1cd4cb99231 /src/policy.c | |
| parent | a2a702cb81eaf73a8989cc31c682592c8acb769a (diff) | |
| download | access-control-12dcb09794c48a333bb850d353540c688c503b76.tar.gz access-control-12dcb09794c48a333bb850d353540c688c503b76.zip | |
Options: getopt_long instead of three hand-rolled parsers
option() in hook.c and one_option() in cmd/main.c were the same function
under two names, and validate's seven options were a chain of seven calls
to one of them. getopt_long does all of it - both --opt value and
--opt=value, the lot - so the parsers are gone and what is left is a table
and what each entry sets.
Two small helpers carry what getopt_long cannot: the name behind a long
option's val, for the 'wants a value' message, and the optind reset that
lets a run parse options twice on two different argv slices.
A command now gets argv[0] as its own name, which is where getopt_long
expects argv[0]; the commands that take names step over it.
strip() in validate.c was authz_trim() again, and cmd_authorize freed the
same three pointers on four exit paths.
One behaviour change: 'authorize --' is now the end-of-options marker
rather than an unknown argument. Anything after it is still refused.
Diffstat (limited to 'src/policy.c')
0 files changed, 0 insertions, 0 deletions
