diff options
Diffstat (limited to 'src/util.c')
| -rw-r--r-- | src/util.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -114,3 +114,24 @@ char *xsubstr(const char *s, size_t len) p[len] = '\0'; return p; } + +// The two things every caller of getopt_long otherwise writes by hand. + +const char *authz_optname(int val, const struct option *lo) +{ + for (; lo->name != NULL; lo++) { + if (lo->val == val) + return lo->name; + } + return "?"; +} + +// optind = 1 is how a second getopt_long call is told to begin again; opterr = 0 +// is so the messages come out in this program's words and not glibc's. + +void authz_opt_reset(void) +{ + optind = 1; + opterr = 0; +} + |
