tar_extract_all(3)

✨ tar_extract_all(3) ✨

okay bestie, buckle up πŸŽ€ this is a C Library Calls page from the libtar crew, and it's literally the high-level tar archive manipulation trio. three little functions that do the heavy lifting so you don't have to πŸ’…


🌸 NAME 🌸

tar_extract_all, tar_extract_glob, tar_append_tree β€” high-level tar archive manipulation functions πŸ¦‹


πŸ’– SYNOPSIS πŸ’–

#include <libtar.h>

int tar_extract_all(TAR *t, char *prefix);

int tar_extract_glob(TAR *t, char *globname, char *prefix);

int tar_append_tree(TAR *t, char *realdir, char *savedir);

πŸŽ€ VERSION πŸŽ€

this man page documents version 1.2 of libtar. periodt, that's the one, no cap πŸ‘‘


🌈 DESCRIPTION 🌈

so here's the tea, three functions, three vibes, all iconic πŸ’œ

  • tar_extract_all() β€” extracts all the files from the tar archive that's associated with the TAR handle t, and drops them into the path named by the prefix argument. every single file. the whole squad. no one left behind 🫢
  • tar_extract_glob() β€” extracts all files that match the given glob pattern globname from the tar archive associated with the TAR handle t, into the path named by the prefix argument. it's giving selective, it's giving picky, and honestly? we respect it πŸ’…
  • tar_append_tree() β€” appends all files from the directory tree named by realdir to the tar archive associated with the TAR handle t. and here's the cute part: the pathnames stored in the tar archive get modified by replacing realdir with savedir, so that when the files get extracted they land in savedir instead. it's a lil name swap, a lil glow-up, main character energy ✨

πŸ”₯ RETURN VALUES πŸ”₯

on successful completion, these functions will return 0 πŸ˜ŒπŸ’–

on failure, they will return -1 and set errno to an appropriate value. yeah, it's a -1 situation, we've all been there 😭


πŸ’€ ERRORS πŸ’€

these functions will fail under the same conditions that the tar_skip_regfile(), tar_extract_regfile(), opendir(), lstat(), or tar_append_file() functions fail. so if you wanna know exactly why it went sideways, that's your reading list, bestie πŸ“


πŸ¦‹ SEE ALSO πŸ¦‹


fr fr, go read the SEE ALSO list before you start blaming yourself. it's not you, it's the errno πŸ’…

and that's a wrap on this one, bestie 🌸 this whole page is brought to you by the University of Illinois, dated Jan 2001 β€” yes, 2001, the lore is ancient but the code still ate πŸ‘‘βœ¨ bye pookie πŸŽ€

πŸ“¦ where this page comes from