Let tincctl use the NETNAME environment variable if no -n option is given.

This allows administrators who frequently want to work with one tinc
network to omit the -n option. Since the NETNAME variable is set by
tincd when executing scripts, this makes it slightly easier to use
tincctl from within scripts.
This commit is contained in:
Guus Sliepen 2012-02-26 12:39:46 +01:00
parent 84570275ac
commit 344d6b9ac3
3 changed files with 24 additions and 0 deletions

View file

@ -138,6 +138,12 @@ static bool parse_options(int argc, char **argv) {
}
}
if(!netname) {
netname = getenv("NETNAME");
if(netname)
netname = xstrdup(netname);
}
return true;
}