tRemove now useless pack() function - pm - barely a pack manager
(HTM) git clone git://z3bra.org/pm
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit c96c002a084e780cea693b4de0cc8a88b786fdc0
(DIR) parent ed5ad22415c5b5461837d4506b2b8d197dbbf4f4
(HTM) Author: z3bra <willyatmailoodotorg>
Date: Tue, 5 Jan 2016 01:46:06 +0100
Remove now useless pack() function
Diffstat:
M config.mk | 2 +-
M pm.c | 51 -------------------------------
2 files changed, 1 insertion(+), 52 deletions(-)
---
(DIR) diff --git a/config.mk b/config.mk
t@@ -4,5 +4,5 @@ LD = $(CC)
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/man
-CFLAGS = -Wall
+CFLAGS = -Wall -g
LDFLAGS = -larchive
(DIR) diff --git a/pm.c b/pm.c
t@@ -51,7 +51,6 @@ int list_archive(int fd, char *filename);
int list_local(int fd, char *packname);
int list_content(int fd, char *packname);
int metadata(char *datadir, struct pack *pack);
-int pack(char *out, char **filename);
int unpack(char *root, char *in);
int delete_content(FILE *metafile);
int delete(const char *datadir, const char *rootfs, const char *name);
t@@ -290,56 +289,6 @@ metadata(char *datadir, struct pack *pack)
return 0;
}
-
-/*
- * pack mutliple files into an archive
- */
-int
-pack(char *out, char **filename)
-{
- struct archive *a;
- struct archive_entry *e;
- struct stat st;
- char buf[PACKAGE_BUFF_SIZE];
- size_t len;
- int fd, r;
-
- a = archive_write_new();
- archive_write_add_filter_bzip2(a);
- archive_write_set_format_pax_restricted(a);
-
- r = archive_write_open_filename(a, out);
- if (r != ARCHIVE_OK)
- return r;
-
- while (*filename) {
- stat(*filename, &st);
- if (!S_ISDIR(st.st_mode)) {
- e = archive_entry_new();
-
- archive_entry_set_pathname(e, *filename);
- archive_entry_set_size(e, st.st_size);
- archive_entry_set_filetype(e, AE_IFREG);
- archive_entry_set_mode(e, st.st_mode);
- archive_write_header(a, e);
-
- fd = open(*filename, O_RDONLY);
- if (fd < 0)
- return fd;
-
- while ((len = read(fd, buf, sizeof(buf))) > 0)
- archive_write_data(a, buf, len);
-
- close(fd);
- archive_entry_free(e);
- }
- filename++;
- }
- archive_write_free(a);
- return 0;
-}
-
-
/*
* extract files into the given directory
*/