summaryrefslogtreecommitdiff
path: root/tools/updateinfoxml2solv.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2008-03-28 18:26:40 +0000
committerMichael Matz <matz@suse.de>2008-03-28 18:26:40 +0000
commit13c0d3313b590e583db62db7afba13518c81647c (patch)
treecc77e3f28fa45c88754eb998b4ec4d22e13cca4c /tools/updateinfoxml2solv.c
parent2a232b4550395f6ff3162da70fdf83a26df3848f (diff)
downloadlibsolv-13c0d3313b590e583db62db7afba13518c81647c.tar.gz
libsolv-13c0d3313b590e583db62db7afba13518c81647c.tar.bz2
libsolv-13c0d3313b590e583db62db7afba13518c81647c.zip
Let's be more forgiving and fix compilation without removing the
backup.
Diffstat (limited to 'tools/updateinfoxml2solv.c')
-rw-r--r--tools/updateinfoxml2solv.c75
1 files changed, 75 insertions, 0 deletions
diff --git a/tools/updateinfoxml2solv.c b/tools/updateinfoxml2solv.c
new file mode 100644
index 0000000..e893c1b
--- /dev/null
+++ b/tools/updateinfoxml2solv.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+#include <sys/types.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pool.h"
+#include "repo.h"
+#include "repo_updateinfoxml.h"
+#include "common_write.h"
+
+static void
+usage(const char *err)
+{
+ if (err)
+ fprintf(stderr, "\n** Error:\n %s\n", err);
+ fprintf(stderr, "\nUsage:\n"
+ "updateinfoxml2solv [-a][-h][-k][-n <attrname>]\n"
+ " reads a 'updateinfo.xml' file from <stdin> and writes a .solv file to <stdout>\n"
+ " -h : print help & exit\n"
+ " -k : don't mix kinds (experimental!)\n"
+ " -n <name>: save attributes as <name>.attr\n"
+ );
+ exit(0);
+}
+
+int
+main(int argc, char **argv)
+{
+ int flags = 0;
+ char *attrname = 0;
+
+ Pool *pool = pool_create();
+ Repo *repo = repo_create(pool, "<stdin>");
+
+ argv++;
+ argc--;
+ while (argc--)
+ {
+ const char *s = argv[0];
+ if (*s++ == '-')
+ while (*s)
+ switch (*s++)
+ {
+ case 'h': usage(NULL); break;
+ case 'n':
+ if (argc)
+ {
+ attrname = argv[1];
+ argv++;
+ argc--;
+ }
+ else
+ usage("argument required for '-n'");
+ break;
+ case 'k':
+ break;
+ default : break;
+ }
+ argv++;
+ }
+
+ repo_add_updateinfoxml(repo, stdin, flags);
+ tool_write(repo, 0, 0);
+ pool_free(pool);
+ exit(0);
+}