8 * search for a tuple that has the given 'attr=val' and also 'rattr=x'.
9 * copy 'x' into 'buf' and return the whole tuple.
11 * return 0 if not found.
14 csgetvalue(char *netroot, char *attr, char *val, char *rattr, Ndbtuple **pp)
16 Ndbtuple *t, *first, *last;
28 snprint(line, sizeof(line), "%s/cs", netroot);
30 strcpy(line, "/net/cs");
31 fd = open(line, ORDWR);
35 snprint(line, sizeof(line), "!%s=%s %s=*", attr, val, rattr);
36 if(write(fd, line, strlen(line)) < 0){
45 n = read(fd, line, sizeof(line)-2);
51 t = _ndbparseline(line);
63 for(; t; t = t->entry){
65 if(strcmp(rattr, t->attr) == 0){
75 werrstr("buffer too short");
81 setmalloctag(first, getcallerpc(&netroot));
90 csgetval(char *netroot, char *attr, char *val, char *rattr, char *buf)
95 p = csgetvalue(netroot, attr, val, rattr, &t);
101 strncpy(buf, p, Ndbvlen-1);
106 ndbsetmalloctag(t, getcallerpc(&netroot));