summaryrefslogtreecommitdiffstats
path: root/tools/msiinfo.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-11-30 17:14:22 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2012-12-06 20:30:31 +0100
commitab71f53366f751eb56d633c437c27f455f2250ff (patch)
treef3f9764f75ff3c0a7d8e2bcba6de2da054cff4cb /tools/msiinfo.c
parentf2cce94a36f41f92b4dac4ef50e06edb13c1078b (diff)
downloadmsitools-ab71f53366f751eb56d633c437c27f455f2250ff.tar.gz
msitools-ab71f53366f751eb56d633c437c27f455f2250ff.tar.xz
msitools-ab71f53366f751eb56d633c437c27f455f2250ff.zip
msiinfo: add export command
Diffstat (limited to 'tools/msiinfo.c')
-rw-r--r--tools/msiinfo.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/msiinfo.c b/tools/msiinfo.c
index 755df9e..496b594 100644
--- a/tools/msiinfo.c
+++ b/tools/msiinfo.c
@@ -248,6 +248,28 @@ static int cmd_tables(struct Command *cmd, int argc, char **argv)
libmsi_unref(db);
}
+static int cmd_export(struct Command *cmd, int argc, char **argv)
+{
+ LibmsiDatabase *db = NULL;
+ LibmsiResult r;
+
+ if (argc != 3) {
+ cmd_usage(stderr, cmd);
+ }
+
+ r = libmsi_database_open(argv[1], LIBMSI_DB_OPEN_READONLY, &db);
+ if (r) {
+ print_libmsi_error(r);
+ }
+
+ r = libmsi_database_export(db, argv[2], STDOUT_FILENO);
+ if (r) {
+ print_libmsi_error(r);
+ }
+
+ libmsi_unref(db);
+}
+
static int cmd_version(struct Command *cmd, int argc, char **argv)
{
printf("%s (%s) version %s\n", program_name, PACKAGE, VERSION);
@@ -286,6 +308,12 @@ static struct Command cmds[] = {
.func = cmd_tables,
},
{
+ .cmd = "export",
+ .opts = "FILE TABLE",
+ .desc = "Export a table in text form from an .msi file",
+ .func = cmd_export,
+ },
+ {
.cmd = "-h",
.func = cmd_help,
},