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:
parent
84570275ac
commit
344d6b9ac3
3 changed files with 24 additions and 0 deletions
|
@ -1928,6 +1928,7 @@ tincctl -n @var{netname} reload
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* tincctl runtime options::
|
* tincctl runtime options::
|
||||||
|
* tincctl environment variables::
|
||||||
* tincctl commands::
|
* tincctl commands::
|
||||||
* tincctl examples::
|
* tincctl examples::
|
||||||
* tincctl top::
|
* tincctl top::
|
||||||
|
@ -1960,6 +1961,16 @@ Output version information and exit.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
@c ==================================================================
|
||||||
|
@node tincctl environment variables
|
||||||
|
@section tincctl environment variables
|
||||||
|
|
||||||
|
@table @env
|
||||||
|
@cindex NETNAME
|
||||||
|
@item NETNAME
|
||||||
|
If no netname is specified on the command line with the @option{-n} option,
|
||||||
|
the value of this environment variable is used.
|
||||||
|
@end table
|
||||||
|
|
||||||
@c ==================================================================
|
@c ==================================================================
|
||||||
@node tincctl commands
|
@node tincctl commands
|
||||||
|
|
|
@ -37,6 +37,13 @@ Display short list of options.
|
||||||
.It Fl -version
|
.It Fl -version
|
||||||
Output version information and exit.
|
Output version information and exit.
|
||||||
.El
|
.El
|
||||||
|
.Sh ENVIRONMENT VARIABLES
|
||||||
|
.Bl -tag -width indent
|
||||||
|
.It Ev NETNAME
|
||||||
|
If no netname is specified on the command line with the
|
||||||
|
.Fl n
|
||||||
|
option, the value of this environment variable is used.
|
||||||
|
.El
|
||||||
.Sh COMMANDS
|
.Sh COMMANDS
|
||||||
.zZ
|
.zZ
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
|
|
|
@ -138,6 +138,12 @@ static bool parse_options(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!netname) {
|
||||||
|
netname = getenv("NETNAME");
|
||||||
|
if(netname)
|
||||||
|
netname = xstrdup(netname);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue