|
|
1.1 root 1: #include "defs.h"
2: #include <signal.h>
3:
4: #define CAT(x) if (x) for(cp=x;bp-buf<sizeof(buf)-1&&*cp;) *bp++=*cp++; *bp='\0'
5:
6: /*
7: * Create an ipc path that starts in the /cs directory
8: *
9: * ipcpath("x", "d", "s") -> "/cs/d!x!s"
10: * ipcpath("x", "/d", "s") -> "/d!x!s"
11: * ipcpath("x!y", "d", "s") -> "/cs/x!y!s"
12: * ipcpath("x!y!z", "d", "s") -> "/cs/x!y!z"
13: * ipcpath("", "", "s") -> "/cs/s"
14: * ipcpath("x", "", "") -> "/cs/x"
15: *
16: * all other combinations are undefined
17: */
18: char *
19: ipcpath(machine, defdialer, service)
20: char *machine;
21: char *defdialer;
22: char *service;
23: {
24: char buf[256];
25: static char buf2[sizeof(buf)+sizeof(CSROOT)];
26: char *bp, *bang1;
27: char *cp;
28:
29: bp = buf;
30: if (machine!=NULL && *machine!='\0') {
31: if ((bang1=strchr(machine, '!'))==NULL){
32: if(defdialer!=NULL && *defdialer!='\0'){
33: CAT(defdialer);
34: CAT("!");
35: }
36: CAT(machine);
37: if (service!=NULL && *service!='\0') {
38: CAT("!");
39: CAT(service);
40: }
41: } else {
42: CAT(machine);
43: if (strchr(bang1+1, '!')==NULL && service!=NULL
44: && *service!='\0') {
45: CAT("!");
46: CAT(service);
47: }
48: }
49: } else {
50: if (service!=NULL && *service!='\0') {
51: CAT(service);
52: }
53: }
54: if (*buf=='/')
55: *buf2 = '\0';
56: else
57: strcpy(buf2, CSROOT);
58: strcat(buf2, buf);
59: return buf2;
60: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.