Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=978973835bfaaca01be3282697450ec14491e63a
commit 978973835bfaaca01be3282697450ec14491e63a Author: Michel Hermier <[email protected]> Date: Fri Nov 8 12:16:18 2013 +0100 libpacman: Add small wrapper to open archive entries into a FILE. diff --git a/lib/libpacman/Makefile.am b/lib/libpacman/Makefile.am index 7ba5cce..5b2197a 100644 --- a/lib/libpacman/Makefile.am +++ b/lib/libpacman/Makefile.am @@ -17,6 +17,9 @@ HASH_TARGETS = \ hash/md5.c \ hash/sha1.c +IO_TARGETS = \ + io/archive.c + PACKAGE_TARGETS = \ package/pkginfo.c @@ -28,6 +31,7 @@ UTIL_TARGETS = \ TARGETS = \ $(DB_TARGETS) \ $(HASH_TARGETS) \ + $(IO_TARGETS) \ $(PACKAGE_TARGETS) \ $(UTIL_TARGETS) \ util.c \ diff --git a/lib/libpacman/io/archive.c b/lib/libpacman/io/archive.c new file mode 100644 index 0000000..491286f --- /dev/null +++ b/lib/libpacman/io/archive.c @@ -0,0 +1,47 @@ +/* + * archive.c + * + * Copyright (c) 2013 by Michel Hermier <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ + +#include "config.h" + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#include <stdio.h> + +#include "archive.h" + +#include "util.h" + +static const +cookie_io_functions_t _pacman_archive_io_functions = +{ + .read = (cookie_read_function_t *)&archive_read_data +}; + +FILE *_pacman_archive_read_fropen(struct archive *a) +{ + ASSERT(a != NULL, RET_ERR(PM_ERR_WRONG_ARGS, NULL)); + + return fopencookie(a, "r", _pacman_archive_io_functions); +} + +/* vim: set ts=2 sw=2 noet: */ diff --git a/lib/libpacman/io/archive.h b/lib/libpacman/io/archive.h new file mode 100644 index 0000000..c2fcd9f --- /dev/null +++ b/lib/libpacman/io/archive.h @@ -0,0 +1,30 @@ +/* + * archive_file.h + * + * Copyright (c) 2013 by Michel Hermier <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ +#ifndef _PACMAN_ARCHIVE_FILE_H +#define _PACMAN_ARCHIVE_FILE_H + +#include <archive.h> + +FILE *_pacman_archive_read_fropen(struct archive *a); + +#endif /* _PACMAN_UTIL_H */ + +/* vim: set ts=2 sw=2 noet: */ _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
