Have tincd and tincctl use the same method of determining netname.
This commit is contained in:
parent
1d322d2eda
commit
33521eabd4
2 changed files with 20 additions and 8 deletions
|
@ -187,10 +187,14 @@ static bool parse_options(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!netname) {
|
||||
netname = getenv("NETNAME");
|
||||
if(netname)
|
||||
if(!netname && (netname = getenv("NETNAME")))
|
||||
netname = xstrdup(netname);
|
||||
|
||||
/* netname "." is special: a "top-level name" */
|
||||
|
||||
if(!strcmp(netname, ".")) {
|
||||
free(netname);
|
||||
netname = NULL;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
14
src/tincd.c
14
src/tincd.c
|
@ -177,9 +177,7 @@ static bool parse_options(int argc, char **argv) {
|
|||
break;
|
||||
|
||||
case 'n': /* net name given */
|
||||
/* netname "." is special: a "top-level name" */
|
||||
netname = strcmp(optarg, ".") != 0 ?
|
||||
xstrdup(optarg) : NULL;
|
||||
netname = xstrdup(optarg);
|
||||
break;
|
||||
|
||||
case 'o': /* option */
|
||||
|
@ -228,6 +226,16 @@ static bool parse_options(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!netname && (netname = getenv("NETNAME")))
|
||||
netname = xstrdup(netname);
|
||||
|
||||
/* netname "." is special: a "top-level name" */
|
||||
|
||||
if(!strcmp(netname, ".")) {
|
||||
free(netname);
|
||||
netname = NULL;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue