6 * make an address, add the defaults
9 netmkaddr(char *linear, char *defnet, char *defsrv)
11 static char addr[256];
17 cp = strchr(linear, '!');
21 /* allow unix sockets to omit unix! prefix */
22 if(access(linear, 0) >= 0){
23 snprint(addr, sizeof(addr), "unix!%s", linear);
26 /* allow host:service in deference to Unix convention */
27 if((cp = strchr(linear, ':')) != nil){
28 snprint(addr, sizeof(addr), "%s!%.*s!%s",
29 defnet, utfnlen(linear, cp-linear),
34 snprint(addr, sizeof(addr), "%s!%s!%s",
35 defnet, linear, defsrv);
37 snprint(addr, sizeof(addr), "%s!%s", defnet, linear);
42 * if there is already a service, use it
44 cp = strchr(cp+1, '!');
49 * if the network is unix, no service
51 if(strncmp(linear, "unix!", 5) == 0)
60 snprint(addr, sizeof(addr), "%s!%s", linear, defsrv);