Lines Matching refs:coll

47 static int		 config_parse_refusefiles(struct coll *);
48 static int config_parse_refusefile(struct coll *, char *);
53 static STAILQ_HEAD(, coll) colls;
54 static struct coll *cur_coll;
55 static struct coll *defaults;
56 static struct coll *ovcoll;
65 config_init(const char *file, struct coll *override, int overridemask)
68 struct coll *coll;
106 STAILQ_FOREACH(coll, &config->colls, co_next) {
107 if (coll->co_base == NULL)
108 coll->co_base = xstrdup("/usr/local/etc/cvsup");
109 if (coll->co_colldir == NULL)
110 coll->co_colldir = "sup";
111 if (coll->co_prefix == NULL) {
112 coll->co_prefix = xstrdup(coll->co_base);
117 } else if (coll->co_prefix[0] != '/') {
118 slen = strlen(coll->co_base);
119 if (slen > 0 && coll->co_base[slen - 1] != '/')
120 xasprintf(&prefix, "%s/%s", coll->co_base,
121 coll->co_prefix);
123 xasprintf(&prefix, "%s%s", coll->co_base,
124 coll->co_prefix);
125 free(coll->co_prefix);
126 coll->co_prefix = prefix;
128 coll->co_prefixlen = strlen(coll->co_prefix);
130 if (coll->co_options & CO_EXACTRCS)
131 coll->co_options |= CO_CHECKRCS;
133 coll->co_options &= ~CO_CHECKRCS;
135 coll->co_options |= CO_SETMODE;
136 coll->co_options |= CO_NORSYNC;
137 error = config_parse_refusefiles(coll);
158 struct coll *coll;
162 STAILQ_FOREACH(coll, &config->colls, co_next) {
163 error = stat(coll->co_prefix, &sb);
167 coll->co_options |= CO_SKIP;
168 ret = readlink(coll->co_prefix, linkname,
172 "%s/%s\n", coll->co_prefix, coll->co_name,
173 coll->co_release);
183 config_parse_refusefiles(struct coll *coll)
188 if (coll->co_colldir[0] == '/')
189 supdir = xstrdup(coll->co_colldir);
191 xasprintf(&supdir, "%s/%s", coll->co_base, coll->co_colldir);
195 error = config_parse_refusefile(coll, path);
204 xasprintf(&collstem, "%s/%s/refuse", supdir, coll->co_name);
206 error = config_parse_refusefile(coll, collstem);
213 suffix = coll_statussuffix(coll);
217 error = config_parse_refusefile(coll, path);
226 * coll->co_refusals. If the file does not exist, it is silently
230 config_parse_refusefile(struct coll *coll, char *path)
248 pattlist_add(coll->co_refusals, pat);
267 struct coll *coll;
270 coll = STAILQ_FIRST(&config->colls);
272 coll_free(coll);
282 struct coll *
283 coll_new(struct coll *def)
285 struct coll *new;
287 new = xmalloc(sizeof(struct coll));
288 memset(new, 0, sizeof(struct coll));
318 coll_override(struct coll *coll, struct coll *from, int mask)
324 oldoptions = coll->co_options & (CO_MASK & ~mask);
327 if (coll->co_release != NULL)
328 free(coll->co_release);
329 coll->co_release = xstrdup(from->co_release);
332 if (coll->co_host != NULL)
333 free(coll->co_host);
334 coll->co_host = xstrdup(from->co_host);
337 if (coll->co_base != NULL)
338 free(coll->co_base);
339 coll->co_base = xstrdup(from->co_base);
342 coll->co_colldir = from->co_colldir;
344 if (coll->co_prefix != NULL)
345 free(coll->co_prefix);
346 coll->co_prefix = xstrdup(from->co_prefix);
350 if (coll->co_tag != NULL)
351 free(coll->co_tag);
352 coll->co_tag = xstrdup(from->co_tag);
355 if (coll->co_date != NULL)
356 free(coll->co_date);
357 coll->co_date = xstrdup(from->co_date);
361 if (coll->co_listsuffix != NULL)
362 free(coll->co_listsuffix);
363 coll->co_listsuffix = xstrdup(from->co_listsuffix);
366 pattlist_add(coll->co_accepts,
370 pattlist_add(coll->co_refusals,
373 coll->co_options = oldoptions | newoptions;
377 coll_statussuffix(struct coll *coll)
382 if (coll->co_listsuffix != NULL) {
383 xasprintf(&suffix, ".%s", coll->co_listsuffix);
384 } else if (coll->co_options & CO_USERELSUFFIX) {
385 if (coll->co_tag == NULL)
388 tag = coll->co_tag;
389 if (coll->co_release != NULL) {
390 if (coll->co_options & CO_CHECKOUTMODE) {
392 coll->co_release, tag);
394 xasprintf(&suffix, ".%s", coll->co_release);
396 } else if (coll->co_options & CO_CHECKOUTMODE) {
405 coll_statuspath(struct coll *coll)
409 suffix = coll_statussuffix(coll);
411 if (coll->co_colldir[0] == '/')
412 xasprintf(&path, "%s/%s/checkouts%s", coll->co_colldir,
413 coll->co_name, suffix);
415 xasprintf(&path, "%s/%s/%s/checkouts%s", coll->co_base,
416 coll->co_colldir, coll->co_name, suffix);
418 if (coll->co_colldir[0] == '/')
419 xasprintf(&path, "%s/%s/checkouts", coll->co_colldir,
420 coll->co_name);
422 xasprintf(&path, "%s/%s/%s/checkouts", coll->co_base,
423 coll->co_colldir, coll->co_name);
432 struct coll *coll;
447 coll = STAILQ_LAST(&colls, coll, co_next);
448 if (strcmp(coll->co_host, cur_coll->co_host) != 0) {
459 coll_free(struct coll *coll)
462 if (coll == NULL)
464 if (coll->co_host != NULL)
465 free(coll->co_host);
466 if (coll->co_base != NULL)
467 free(coll->co_base);
468 if (coll->co_date != NULL)
469 free(coll->co_date);
470 if (coll->co_prefix != NULL)
471 free(coll->co_prefix);
472 if (coll->co_release != NULL)
473 free(coll->co_release);
474 if (coll->co_tag != NULL)
475 free(coll->co_tag);
476 if (coll->co_cvsroot != NULL)
477 free(coll->co_cvsroot);
478 if (coll->co_name != NULL)
479 free(coll->co_name);
480 if (coll->co_listsuffix != NULL)
481 free(coll->co_listsuffix);
482 keyword_free(coll->co_keyword);
483 if (coll->co_dirfilter != NULL)
484 globtree_free(coll->co_dirfilter);
485 if (coll->co_dirfilter != NULL)
486 globtree_free(coll->co_filefilter);
487 if (coll->co_norsync != NULL)
488 globtree_free(coll->co_norsync);
489 if (coll->co_accepts != NULL)
490 pattlist_free(coll->co_accepts);
491 if (coll->co_refusals != NULL)
492 pattlist_free(coll->co_refusals);
493 free(coll);
499 struct coll *coll;
502 coll = cur_coll;
505 if (coll->co_host != NULL)
506 free(coll->co_host);
507 coll->co_host = value;
510 if (coll->co_base != NULL)
511 free(coll->co_base);
512 coll->co_base = value;
515 if (coll->co_date != NULL)
516 free(coll->co_date);
517 coll->co_date = value;
518 coll->co_options |= CO_CHECKOUTMODE;
521 if (coll->co_prefix != NULL)
522 free(coll->co_prefix);
523 coll->co_prefix = value;
526 if (coll->co_release != NULL)
527 free(coll->co_release);
528 coll->co_release = value;
531 if (coll->co_tag != NULL)
532 free(coll->co_tag);
533 coll->co_tag = value;
534 coll->co_options |= CO_CHECKOUTMODE;
542 if (coll->co_listsuffix != NULL)
543 free(coll->co_listsuffix);
544 coll->co_listsuffix = value;
554 coll->co_umask = mask;
557 coll->co_options |= CO_USERELSUFFIX;
560 coll->co_options |= CO_DELETE | CO_EXACTRCS;
563 coll->co_options |= CO_COMPRESS;
566 coll->co_options |= CO_NORSYNC;
571 /* Set "coll" as being the default collection. */