Imported Upstream version 0.7.12
[platform/upstream/libsolv.git] / tools / repomdxml2solv.c
index 58b1d00..fdf7666 100644 (file)
@@ -6,8 +6,6 @@
  */
 
 #include <sys/types.h>
-#include <limits.h>
-#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -76,12 +74,9 @@ doquery(Pool *pool, Repo *repo, const char *query)
        case REPOKEY_TYPE_CONSTANT:
          printf("%llu\n", SOLV_KV_NUM64(&di.kv));
          break;
-       case REPOKEY_TYPE_MD5:
-       case REPOKEY_TYPE_SHA1:
-       case REPOKEY_TYPE_SHA256:
-         printf("%s:%s\n", solv_chksum_type2str(di.key->type), repodata_chk2str(di.data, di.key->type, (unsigned char *)di.kv.str));
-         break;
        default:
+         if (solv_chksum_len(di.key->type))
+           printf("%s:%s\n", solv_chksum_type2str(di.key->type), repodata_chk2str(di.data, di.key->type, (unsigned char *)di.kv.str));
          break;
        }
     }
@@ -120,7 +115,7 @@ main(int argc, char **argv)
   if (query)
     doquery(pool, repo, query);
   else
-    tool_write(repo, 0, 0);
+    tool_write(repo, stdout);
   pool_free(pool);
   exit(0);
 }