]> git.ipfire.org Git - thirdparty/libsolv.git/blame - tools/updateinfoxml2solv.c
build: use GNUInstallDirs
[thirdparty/libsolv.git] / tools / updateinfoxml2solv.c
CommitLineData
13c0d331
MM
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#include <sys/types.h>
13c0d331
MM
9#include <stdio.h>
10#include <stdlib.h>
11#include <string.h>
23971442 12#include <unistd.h>
13c0d331
MM
13
14#include "pool.h"
15#include "repo.h"
16#include "repo_updateinfoxml.h"
17#include "common_write.h"
18
19static void
23971442 20usage(int status)
13c0d331 21{
13c0d331 22 fprintf(stderr, "\nUsage:\n"
63491bc9 23 "updateinfoxml2solv [-h]\n"
13c0d331
MM
24 " reads a 'updateinfo.xml' file from <stdin> and writes a .solv file to <stdout>\n"
25 " -h : print help & exit\n"
13c0d331 26 );
23971442 27 exit(status);
13c0d331
MM
28}
29
30int
31main(int argc, char **argv)
32{
23971442 33 int c, flags = 0;
13c0d331
MM
34
35 Pool *pool = pool_create();
36 Repo *repo = repo_create(pool, "<stdin>");
37
63491bc9 38 while ((c = getopt(argc, argv, "h")) >= 0)
13c0d331 39 {
23971442
MS
40 switch(c)
41 {
42 case 'h':
43 usage(0);
44 break;
23971442
MS
45 default:
46 usage(1);
47 break;
48 }
13c0d331 49 }
5702cc43
MS
50 if (repo_add_updateinfoxml(repo, stdin, flags))
51 {
52 fprintf(stderr, "updateinfoxml2solv: %s\n", pool_errstr(pool));
53 exit(1);
54 }
63491bc9 55 tool_write(repo, stdout);
13c0d331
MM
56 pool_free(pool);
57 exit(0);
58}