Lines Matching refs:state
61 cssetdb(register Cs_t* state)
66 if (state->db <= 0 && ++state->db)
84 csname(register Cs_t* state, unsigned long addr)
88 messagef((state->id, NiL, -8, "name(%s) call", csntoa(state, addr)));
101 csdb(state);
110 if (!((state->flags | state->disc->flags) & CS_ADDR_FULL))
117 strncpy(state->temp, s, sizeof(state->temp) - 1);
118 *(t = state->temp + (t - s)) = 0;
119 s = state->temp;
120 if (csaddr(state, s) != addr) *t = '.';
126 messagef((state->id, NiL, -1, "name: %s: gethostbyaddr error", csntoa(state, addr)));
127 s = csntoa(state, addr);
132 if (!state->name[0])
137 if (gethostname(state->full, sizeof(state->full) - 1))
149 if (uname(&un) >= 0) strncpy(state->full, un.nodename, sizeof(state->full) - 1);
159 if ((n = read(fd, state->full, sizeof(state->full))) > 0) state->full[n - 1] = 0;
169 messagef((state->id, NiL, -1, "name: %s: gethostname error", csntoa(state, addr)));
170 strcpy(state->full, CS_HOST_LOCAL);
172 state->full[sizeof(state->full) - 1] = 0;
173 strncpy(state->name, state->full, sizeof(state->name) - 1);
174 if (s = strchr(state->name, '.')) *s = 0;
176 return ((state->flags | state->disc->flags) & CS_ADDR_FULL) ? state->full : state->name;