Start of an attribute store. It can hold arbitrary attributes for a
[platform/upstream/libsolv.git] / tools / susetags2solv.c
1 #include <sys/types.h>
2 #include <limits.h>
3 #include <fcntl.h>
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7
8 #include "pool.h"
9 #include "repo_susetags.h"
10 #include "repo_write.h"
11 #include "attr_store.h"
12
13 extern Attrstore *attr;
14
15 int
16 main(int argc, char **argv)
17 {
18   int with_attr = 0;
19   argv++;
20   argc--;
21   while (argc--)
22     {
23       const char *s = argv[0];
24       if (*s++ == '-')
25         while (*s)
26           switch (*s++)
27             {
28               case 'a': with_attr = 1; break;
29               default : break;
30             }
31       argv++;
32     }
33   Pool *pool = pool_create();
34   Repo *repo = pool_addrepo_susetags(pool, stdin, with_attr);
35   pool_writerepo(pool, repo, stdout);
36   if (with_attr && attr)
37     {
38       FILE *fp = fopen ("test.attr", "w");
39       write_attr_store (fp, attr);
40       fclose (fp);
41     }
42   pool_free(pool);
43   exit(0);
44 }