3 // Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; version 2 of the License.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #include "matchlist.h"
30 #define ENSC_WRAPPERS_FCNTL 1
31 #define ENSC_WRAPPERS_UNISTD 1
32 #define ENSC_WRAPPERS_STDLIB 1
36 selectRefserver(struct dirent const *ent)
38 return strncmp(ent->d_name, "refserver.", 10)==0;
42 MatchList_initRefserverList(struct MatchList **lst, size_t *cnt,
45 int cur_dir = Eopen(".", O_RDONLY, 0);
46 struct dirent **entries;
50 count = scandir(".", &entries, selectRefserver, alphasort);
57 WRITE_MSG(2, "no reference vserver configured\n");
61 *lst = Emalloc(sizeof(struct MatchList) * count);
63 for (i=0; i<count; ++i) {
64 char const *tmp = entries[i]->d_name;
65 size_t l = strlen(tmp);
66 char vname[sizeof("./") + l];
68 memcpy(vname, "./", 2);
69 memcpy(vname+2, tmp, l+1);
71 if (!MatchList_initByVserver((*lst)+i, vname, 0)) {
72 WRITE_MSG(2, "unification for reference vserver not configured\n");