libropkg: implement tar file reader

This commit is contained in:
2025-08-06 22:11:02 +01:00
parent f2caad8251
commit 22510ca52c
3 changed files with 289 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#ifndef ROPKG_READER_H_
#define ROPKG_READER_H_
#include <ropkg/misc.h>
#include <ropkg/status.h>
struct ropkg_reader;
struct b_cstream;
struct ropkg_file_info {
char f_filename[255];
int f_mode;
int f_uid, f_gid;
unsigned long f_filesize;
unsigned long f_mtime;
int f_type;
char f_linkname[100];
};
ROPKG_API enum ropkg_status ropkg_reader_open(
struct b_cstream *fp,
struct ropkg_reader **out);
ROPKG_API enum ropkg_status ropkg_reader_close(struct ropkg_reader *pkg);
ROPKG_API const struct ropkg_file_info *ropkg_reader_current_file(
struct ropkg_reader *reader);
ROPKG_API enum ropkg_status ropkg_reader_move_next(struct ropkg_reader *pkg);
ROPKG_API enum ropkg_status ropkg_reader_move_to_file(
struct ropkg_reader *pkg,
const char *name);
ROPKG_API bool ropkg_reader_eof(const struct ropkg_reader *pkg);
#endif