Factor out the filter code in preparation for nicely configuring where
[platform/upstream/libsolv.git] / tools / mergesolv.c
1 /*
2  * Copyright (c) 2007, Novell Inc.
3  *
4  * This program is licensed under the BSD license, read LICENSE.BSD
5  * for further information
6  */
7
8 /*
9  * mergesolv
10  * 
11  */
12
13 #include <sys/types.h>
14 #include <limits.h>
15 #include <fcntl.h>
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <string.h>
19 #include <assert.h>
20
21 #include "pool.h"
22 #include "repo_solv.h"
23 #include "common_write.h"
24
25 int
26 main(int argc, char **argv)
27 {
28   Pool *pool = pool_create();
29   Repo *repo;
30
31   repo = repo_create(pool, "");
32   while (argc-- > 1)
33     {
34       FILE *fp;
35       argv++;
36       if ((fp = fopen(*argv, "r")) == NULL)
37         {
38           perror(argv[1]);
39           exit(0);
40         }
41       repo_add_solv(repo, fp);
42       fclose(fp);
43     }
44
45   tool_write(repo, 0, 0);
46   pool_free(pool);
47
48   return 0;
49 }