/* This file is in the public domain. */ #include #include #include "repo.h" #include "config.h" #include "structs.h" extern const MAP_OPS map_ops_trivial; static int map_trivial_add(CONFIG *cfg, LISTEN *l, int pri, const char *key, int keylen, const char *rest) { MAP *map; if ((keylen != 7) || bcmp(key,"trivial",7)) return(0); if (*rest) config_err(cfg,"trailing junk on `map trivial' listen line"); map = malloc(sizeof(MAP)); map->pri = pri; map->ops = &map_ops_trivial; map->priv = l; map->link = l->mappings; l->mappings = map; return(1); } static MAPMATCH map_trivial_match(void *pv, const char *name) { REPO *r; for (r=((LISTEN *)pv)->conf->repos;r;r=r->link) if (!strcmp(name,r->name)) return(MATCH_MATCH); return(MATCH_NOMATCH); } static char *map_trivial_map(void *pv __attribute__((__unused__)), const char *name) { return(strdup(name)); } static void map_trivial_free(void *pv __attribute__((__unused__))) { } const MAP_OPS map_ops_trivial = MAP_OPS_INIT(trivial);