2022-11-05 17:25:26 +00:00
|
|
|
# minitar
|
|
|
|
|
2022-11-05 19:10:48 +00:00
|
|
|
Tiny C library to interact with tar archives
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
```
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <minitar.h>
|
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
if(argc == 1)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "Usage: %s [file]\n", argv[0]);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
struct minitar* mp = minitar_open(argv[1]);
|
|
|
|
if(!mp)
|
|
|
|
{
|
|
|
|
perror(argv[1]);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
struct minitar_entry* entry;
|
|
|
|
do {
|
|
|
|
entry = minitar_read_entry(mp);
|
|
|
|
if(entry) {
|
|
|
|
printf("Found file %s\n", entry->metadata.name);
|
|
|
|
minitar_free_entry(entry);
|
|
|
|
}
|
|
|
|
} while(entry);
|
|
|
|
minitar_close(mp);
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
This program will list out the files in a tar archive :)
|