diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-01-27 23:08:56 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-01-27 23:08:56 +0100 |
commit | 0973d57d2a0ef04a97c405470689453ae939f498 (patch) | |
tree | 8cacd8ea20da1172878d314c9e47abbe09fba417 /hostmux/hostmux.c | |
parent | 0e023ff2146d086d10c63b8e19bd263ce40d05fe (diff) |
Add canonicalize option to hostmux
Taking the canonical name makes very little sense nowadays with a lot of
services behind the same IP but virtual hostnames.
* hostmux/hostmux.h (hostmux): Add canonicalize field.
* hostmux/hostmux.c (options, parse_opt): Add -C/--canonicalize option.
* hostmux/mux.c (lookup_host): Only call getaddrinfo if canonicalize is
true, pass NULL as HE to lookup_addrinfo otherwise.
(lookup_addrinfo): When !HE, use name given by user.
Diffstat (limited to 'hostmux/hostmux.c')
-rw-r--r-- | hostmux/hostmux.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hostmux/hostmux.c b/hostmux/hostmux.c index 3778613c..5296527b 100644 --- a/hostmux/hostmux.c +++ b/hostmux/hostmux.c @@ -45,6 +45,9 @@ static const struct argp_option options[] = "The string to replace in the translator specification with the hostname;" " if empty, or doesn't occur, the hostname is appended as additional" " argument instead (default `" DEFAULT_HOST_PAT "')" }, + { "canonicalize", 'C', 0, 0, + "Canonicalize hostname before passing it to TRANSLATOR, aliases will" + " show up as symbolic links to the canonicalized entry" }, { 0 } }; static const char args_doc[] = "TRANSLATOR [ARG...]"; @@ -97,6 +100,8 @@ main (int argc, char **argv) { case 'H': mux.host_pat = arg; break; + case 'C': + mux.canonicalize = 1; break; case ARGP_KEY_NO_ARGS: argp_usage (state); case ARGP_KEY_ARGS: |