Lines Matching refs:rcp
67 static struct rcsection *rc_findsect(struct rcfile *rcp, const char *sectname);
68 static struct rcsection *rc_addsect(struct rcfile *rcp, const char *sectname);
69 static int rc_freesect(struct rcfile *rcp, struct rcsection *rsp);
74 static void rc_parse(struct rcfile *rcp);
92 struct rcfile *rcp; in rc_open() local
97 rcp = rc_cachelookup(filename); in rc_open()
98 if (rcp) { in rc_open()
99 *rcfile = rcp; in rc_open()
109 rcp = malloc(sizeof (struct rcfile)); in rc_open()
110 if (rcp == NULL) { in rc_open()
114 bzero(rcp, sizeof (struct rcfile)); in rc_open()
115 rcp->rf_name = strdup(filename); in rc_open()
116 rcp->rf_f = f; in rc_open()
117 SLIST_INSERT_HEAD(&pf_head, rcp, rf_next); in rc_open()
118 rc_parse(rcp); in rc_open()
119 *rcfile = rcp; in rc_open()
127 struct rcfile *rcp = *rcfile; in rc_merge() local
133 if (rcp == NULL) { in rc_merge()
143 t = rcp->rf_f; in rc_merge()
144 rcp->rf_f = f; in rc_merge()
145 rc_parse(rcp); in rc_merge()
146 rcp->rf_f = t; in rc_merge()
160 struct rcfile *rcp = NULL; in rc_open_sharectl() local
187 rcp = malloc(sizeof (struct rcfile)); in rc_open_sharectl()
188 if (rcp == NULL) { in rc_open_sharectl()
192 bzero(rcp, sizeof (struct rcfile)); in rc_open_sharectl()
194 rcp->rf_name = strdup(template); in rc_open_sharectl()
195 if (rcp->rf_name == NULL) { in rc_open_sharectl()
199 rcp->rf_f = fp; in rc_open_sharectl()
200 rcp->rf_flags = RCFILE_DELETE_ON_CLOSE; in rc_open_sharectl()
202 SLIST_INSERT_HEAD(&pf_head, rcp, rf_next); in rc_open_sharectl()
204 rc_parse(rcp); in rc_open_sharectl()
205 *rcfile = rcp; in rc_open_sharectl()
210 if (rcp != NULL) in rc_open_sharectl()
211 free(rcp); in rc_open_sharectl()
224 rc_close(struct rcfile *rcp) in rc_close() argument
230 fclose(rcp->rf_f); in rc_close()
231 if (rcp->rf_flags & RCFILE_DELETE_ON_CLOSE) in rc_close()
232 (void) unlink(rcp->rf_name); in rc_close()
234 for (p = SLIST_FIRST(&rcp->rf_sect); p; ) { in rc_close()
237 rc_freesect(rcp, n); in rc_close()
239 free(rcp->rf_name); in rc_close()
240 SLIST_REMOVE(&pf_head, rcp, rcfile, rf_next); in rc_close()
241 free(rcp); in rc_close()
261 rc_findsect(struct rcfile *rcp, const char *sectname) in rc_findsect() argument
267 SLIST_FOREACH(p, &rcp->rf_sect, rs_next) in rc_findsect()
274 rc_addsect(struct rcfile *rcp, const char *sectname) in rc_addsect() argument
280 p = rc_findsect(rcp, sectname); in rc_addsect()
288 SLIST_INSERT_HEAD(&rcp->rf_sect, p, rs_next); in rc_addsect()
293 rc_freesect(struct rcfile *rcp, struct rcsection *rsp) in rc_freesect() argument
299 SLIST_REMOVE(&rcp->rf_sect, rsp, rcsection, rs_next); in rc_freesect()
386 set_value(struct rcfile *rcp, struct rcsection *rsp, struct rckey *rkp, in set_value() argument
426 rc_parse(struct rcfile *rcp) in rc_parse() argument
428 FILE *f = rcp->rf_f; in rc_parse()
467 rsp = rc_addsect(rcp, buf); in rc_parse()
520 "Well, I can't parse file '%s'\n"), rcp->rf_name); in rc_parse()
528 set_value(rcp, rsp, rkp, buf); in rc_parse()
534 set_value(rcp, rsp, rkp, buf); in rc_parse()
539 rc_getstringptr(struct rcfile *rcp, const char *section, const char *key, in rc_getstringptr() argument
549 rsp = rc_findsect(rcp, section); in rc_getstringptr()
568 rc_getstring(struct rcfile *rcp, const char *section, const char *key, in rc_getstring() argument
574 error = rc_getstringptr(rcp, section, key, &value); in rc_getstring()
588 rc_getint(struct rcfile *rcp, const char *section, const char *key, int *value) in rc_getint() argument
596 rsp = rc_findsect(rcp, section); in rc_getint()
624 rc_getbool(struct rcfile *rcp, const char *section, const char *key, int *value) in rc_getbool() argument
633 rsp = rc_findsect(rcp, section); in rc_getbool()
755 struct rcfile *rcp; in smb_close_rcfile() local
757 if ((rcp = smb_rc) != NULL) { in smb_close_rcfile()
759 rc_close(rcp); in smb_close_rcfile()