aboutsummaryrefslogtreecommitdiff
path: root/difftool/extract.c
diff options
context:
space:
mode:
Diffstat (limited to 'difftool/extract.c')
-rw-r--r--difftool/extract.c57
1 files changed, 0 insertions, 57 deletions
diff --git a/difftool/extract.c b/difftool/extract.c
deleted file mode 100644
index 979572a..0000000
--- a/difftool/extract.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
-/*
- * extract.c
- *
- * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
- */
-#include "sqfsdiff.h"
-
-static int extract(sqfs_data_reader_t *data, const sqfs_inode_generic_t *inode,
- const char *prefix, const char *path, size_t block_size)
-{
- char *ptr, *temp;
- FILE *fp;
-
- temp = alloca(strlen(prefix) + strlen(path) + 2);
- sprintf(temp, "%s/%s", prefix, path);
-
- ptr = strrchr(temp, '/');
- *ptr = '\0';
- if (mkdir_p(temp))
- return -1;
- *ptr = '/';
-
- fp = fopen(temp, "wb");
- if (fp == NULL) {
- perror(temp);
- return -1;
- }
-
- if (sqfs_data_reader_dump(path, data, inode, fp, block_size, true)) {
- fclose(fp);
- return -1;
- }
-
- fflush(fp);
- fclose(fp);
- return 0;
-}
-
-int extract_files(sqfsdiff_t *sd, const sqfs_inode_generic_t *old,
- const sqfs_inode_generic_t *new,
- const char *path)
-{
- if (old != NULL) {
- if (extract(sd->sqfs_old.data, old, "old",
- path, sd->sqfs_old.super.block_size))
- return -1;
- }
-
- if (new != NULL) {
- if (extract(sd->sqfs_new.data, new, "new",
- path, sd->sqfs_new.super.block_size))
- return -1;
- }
-
- return 0;
-}