2022-11-05 17:52:51 +00:00
|
|
|
#ifndef MINITAR_H
|
|
|
|
#define MINITAR_H
|
|
|
|
#include <stdio.h>
|
2022-11-05 19:10:48 +00:00
|
|
|
#include <sys/types.h>
|
2022-11-05 17:52:51 +00:00
|
|
|
|
2022-11-06 10:04:52 +00:00
|
|
|
#ifdef _IN_MINITAR
|
2022-11-05 17:52:51 +00:00
|
|
|
struct minitar
|
|
|
|
{
|
|
|
|
FILE* stream;
|
|
|
|
};
|
2022-11-06 10:04:52 +00:00
|
|
|
#else
|
|
|
|
struct minitar;
|
|
|
|
#endif
|
2022-11-05 17:52:51 +00:00
|
|
|
|
2022-11-05 19:10:48 +00:00
|
|
|
enum minitar_file_type
|
|
|
|
{
|
|
|
|
MTAR_REGULAR,
|
|
|
|
MTAR_CHRDEV,
|
|
|
|
MTAR_BLKDEV,
|
|
|
|
MTAR_DIRECTORY
|
|
|
|
};
|
|
|
|
|
|
|
|
struct minitar_entry_metadata
|
|
|
|
{
|
|
|
|
char name[257];
|
|
|
|
mode_t mode;
|
|
|
|
uid_t uid;
|
|
|
|
gid_t gid;
|
|
|
|
size_t size;
|
|
|
|
time_t mtime;
|
|
|
|
enum minitar_file_type type;
|
|
|
|
char uname[32];
|
|
|
|
char gname[32];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct minitar_entry
|
|
|
|
{
|
|
|
|
struct minitar_entry_metadata metadata;
|
|
|
|
char* ptr;
|
|
|
|
};
|
|
|
|
|
2022-11-05 17:52:51 +00:00
|
|
|
struct minitar* minitar_open(const char* pathname);
|
2022-11-05 19:10:48 +00:00
|
|
|
struct minitar_entry* minitar_read_entry(struct minitar* mp);
|
|
|
|
void minitar_free_entry(struct minitar_entry* entry);
|
2022-11-05 17:52:51 +00:00
|
|
|
int minitar_close(struct minitar* mp);
|
|
|
|
|
|
|
|
#endif
|