}
}
- if(!netname) {
- netname = getenv("NETNAME");
- if(netname)
- netname = xstrdup(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;
}
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 */
}
}
+ if(!netname && (netname = getenv("NETNAME")))
+ netname = xstrdup(netname);
+
+ /* netname "." is special: a "top-level name" */
+
+ if(!strcmp(netname, ".")) {
+ free(netname);
+ netname = NULL;
+ }
+
return true;
}