#include "vunify-init.ic"
-static void
-initModeManually(struct Arguments const UNUSED *args, int argc, char *argv[])
-{
- int i, count=argc/2;
-
- if (argc%2) {
- WRITE_MSG(2, "Odd number of (path,excludelist) arguments\n");
- exit(1);
- }
-
- if (count<2) {
- WRITE_MSG(2, "No reference path(s) given\n");
- exit(1);
- }
-
- initMatchList(&global_info.dst_list, 0, argv[0], argv[1]);
-
- --count;
- global_info.src_lists.v = Emalloc(sizeof(struct MatchList) * count);
- global_info.src_lists.l = count;
-
- for (i=0; i<count; ++i)
- initMatchList(global_info.src_lists.v+i, 0, argv[2 + i*2], argv[3 + i*2]);
-}
-
-static int
-selectRefserver(struct dirent const *ent)
-{
- return strncmp(ent->d_name, "refserver.", 10)==0;
-}
-
-static void
-initModeVserver(struct Arguments const UNUSED *args, int argc, char *argv[])
-{
- char const *appdir;
- int cur_dir = Eopen(".", O_RDONLY, 0);
- struct dirent **entries;
- int count, i;
-
- if (argc!=1) {
- WRITE_MSG(2, "More than one vserver is not supported\n");
- exit(1);
- }
-
- if (!initMatchListByVserver(&global_info.dst_list, argv[0], &appdir)) {
- WRITE_MSG(2, "unification not configured for this vserver\n");
- exit(1);
- }
-
- Echdir(appdir);
- count = scandir(".", &entries, selectRefserver, alphasort);
- if (count==-1) {
- perror("scandir()");
- exit(1);
- }
-
- if (count==0) {
- WRITE_MSG(2, "no reference vserver configured\n");
- exit(1);
- }
-
- global_info.src_lists.v = Emalloc(sizeof(struct MatchList) * count);
- global_info.src_lists.l = count;
- for (i=0; i<count; ++i) {
- char const *tmp = entries[i]->d_name;
- size_t l = strlen(tmp);
- char vname[sizeof("./") + l];
-
- memcpy(vname, "./", 2);
- memcpy(vname+2, tmp, l+1);
-
- if (!initMatchListByVserver(global_info.src_lists.v+i, vname, 0)) {
- WRITE_MSG(2, "unification for reference vserver not configured\n");
- exit(1);
- }
-
- free(entries[i]);
- }
- free(entries);
- free(const_cast(char *)(appdir));
-
- Efchdir(cur_dir);
- Eclose(cur_dir);
-}
-
int main(int argc, char *argv[])
{
struct Arguments args = {