Lines Matching defs:cbs
47 typedef struct cbs {
95 cbs_t cbs = { 0, 0, NULL };
112 (void) _enum_auths(username, add_auth, NULL, &cbs);
114 if (cbs.auth_cnt == 0)
121 simplify(&cbs);
127 for (i = 0; i < cbs.auth_cnt - 1; i++)
128 (void) printf("%s,", cbs.auths[i]);
131 (void) printf("%s\n", cbs.auths[cbs.auth_cnt - 1]);
134 free_auths(&cbs);
144 cbs_t *cbs = res;
146 if (cbs->auth_cnt >= cbs->auth_max) {
147 cbs->auth_max += INCRAUTHS;
148 cbs->auths = realloc(cbs->auths,
149 cbs->auth_max * sizeof (char *));
151 if (cbs->auths == NULL) {
158 cbs->auths[cbs->auth_cnt] = strdup(authname);
159 cbs->auth_cnt++;
165 free_auths(cbs_t *cbs)
169 for (i = 0; i < cbs->auth_cnt; i++)
170 free(cbs->auths[i]);
172 free(cbs->auths);
201 simplify(cbs_t *cbs)
206 qsort(cbs->auths, cbs->auth_cnt, sizeof (cbs->auths[0]), mstrptr);
214 for (i = 0, rem = 0; i < cbs->auth_cnt - rem - 1; ) {
215 if (strcmp(cbs->auths[i], cbs->auths[i + rem + 1]) == 0 ||
216 strchr(cbs->auths[i], KV_WILDCHAR) != NULL &&
217 auth_match(cbs->auths[i], cbs->auths[i + rem + 1])) {
218 free(cbs->auths[i + rem + 1]);
223 cbs->auths[i] = cbs->auths[i + rem];
227 cbs->auth_cnt -= rem;