Lines Matching defs:rcp

65 static struct rcsection *rc_findsect(struct rcfile *rcp, const char *sectname);
66 static struct rcsection *rc_addsect(struct rcfile *rcp, const char *sectname);
67 static int rc_freesect(struct rcfile *rcp, struct rcsection *rsp);
72 static void rc_parse(struct rcfile *rcp);
90 struct rcfile *rcp;
95 rcp = rc_cachelookup(filename);
96 if (rcp) {
97 *rcfile = rcp;
107 rcp = malloc(sizeof (struct rcfile));
108 if (rcp == NULL) {
112 bzero(rcp, sizeof (struct rcfile));
113 rcp->rf_name = strdup(filename);
114 rcp->rf_f = f;
115 SLIST_INSERT_HEAD(&pf_head, rcp, rf_next);
116 rc_parse(rcp);
117 *rcfile = rcp;
125 struct rcfile *rcp = *rcfile;
131 if (rcp == NULL) {
141 t = rcp->rf_f;
142 rcp->rf_f = f;
143 rc_parse(rcp);
144 rcp->rf_f = t;
156 struct rcfile *rcp;
166 rcp = malloc(sizeof (struct rcfile));
167 if (rcp == NULL) {
171 bzero(rcp, sizeof (struct rcfile));
172 rcp->rf_name = strdup(command);
173 rcp->rf_f = f;
174 SLIST_INSERT_HEAD(&pf_head, rcp, rf_next);
175 rc_parse(rcp);
176 *rcfile = rcp;
182 rc_close(struct rcfile *rcp)
188 fclose(rcp->rf_f);
189 for (p = SLIST_FIRST(&rcp->rf_sect); p; ) {
192 rc_freesect(rcp, n);
194 free(rcp->rf_name);
195 SLIST_REMOVE(&pf_head, rcp, rcfile, rf_next);
196 free(rcp);
216 rc_findsect(struct rcfile *rcp, const char *sectname)
222 SLIST_FOREACH(p, &rcp->rf_sect, rs_next)
229 rc_addsect(struct rcfile *rcp, const char *sectname)
235 p = rc_findsect(rcp, sectname);
243 SLIST_INSERT_HEAD(&rcp->rf_sect, p, rs_next);
248 rc_freesect(struct rcfile *rcp, struct rcsection *rsp)
254 SLIST_REMOVE(&rcp->rf_sect, rsp, rcsection, rs_next);
341 set_value(struct rcfile *rcp, struct rcsection *rsp, struct rckey *rkp,
382 rc_parse(struct rcfile *rcp)
384 FILE *f = rcp->rf_f;
423 rsp = rc_addsect(rcp, buf);
477 "Well, I can't parse file '%s'\n"), rcp->rf_name);
485 set_value(rcp, rsp, rkp, buf);
491 set_value(rcp, rsp, rkp, buf);
496 rc_getstringptr(struct rcfile *rcp, const char *section, const char *key,
506 rsp = rc_findsect(rcp, section);
525 rc_getstring(struct rcfile *rcp, const char *section, const char *key,
531 error = rc_getstringptr(rcp, section, key, &value);
545 rc_getint(struct rcfile *rcp, const char *section, const char *key, int *value)
553 rsp = rc_findsect(rcp, section);
581 rc_getbool(struct rcfile *rcp, const char *section, const char *key, int *value)
590 rsp = rc_findsect(rcp, section);
712 struct rcfile *rcp;
714 if ((rcp = smb_rc) != NULL) {
716 rc_close(rcp);