af_history(3)

πŸ’– af_history(3) β€” the AtFS history functions, bestie edition πŸ’–

okay so this is a page from the Attribute Filesystem (AtFS) manual, and it's literally all about the history functions β€” af_histories and af_access. we're gonna get you fluent in ASO history lookups, no cap. πŸ¦‹


✨ NAME ✨

af_histories, af_access β€” AtFS history functions. that's the whole vibe. 🌸


✨ SYNOPSIS ✨

#include <atfs.h>

char**af_histories (char *path, char *pattern)

char**af_cachenames (char *path, char *pattern);

int   af_access (char *path, char *name, char *type, int mode)

look at that lil trio. 🫢


✨ DESCRIPTION ✨

πŸŽ€ af_histories

so af_histories hands you back a list of source history names from the directory that path points at, filtered by whatever pattern you gave it. and like, important: histories in a directory are represented by at least one version. that's the rule, periodt. πŸ‘‘

the pattern has to be ed(1) patterns β€” the kind that are processable by re_comp(3) and re_exec(3). don't come at it with anything else, bestie, it won't eat. πŸ’…

the resulting list from af_histories lives in allocated memory, so use free(3) to free it up for further allocation when you're done. and here's the iconic part: af_histories returns an empty list when no histories are found β€” not a NULL pointer. exclamation mark in the original, we respect it. ⭐

πŸŽ€ af_cachenames

af_cachenames does literally the same thing as af_histories... except it does it on derived object caches. same energy, different target. 😌

πŸŽ€ af_access

af_access determines the existence of an object history. here's the tea:

  • if any ASO (any version) exists with the given path, name and type attributes, af_access returns zero πŸŽ‰
  • otherwise it returns -1 πŸ’€

the mode argument can be either of these two:

  • AF_CLASS_SOURCE β€” indicating that only source objects shall be searched πŸ”
  • AF_CLASS_DERIVED β€” which means that only the derived object cache shall be searched for existence of a matching ASO πŸ”

pick one, don't be chaotic about it. πŸ™ˆ


✨ SEE ALSO ✨

ed(1), re_comp(3), re_exec(3), free(3) β€” go read those too, they're the supporting cast and they ate. 🌈


✨ DIAGNOSTICS ✨

upon error, -1 or a null pointer (depending on the return type) is returned, and af_errno is set to the corresponding error number. so yeah β€” if things go sideways, check af_errno, that's where the receipts are. 🧚

and that's the whole page, bestie!! this one's from AtFS-1.71, dated Fri Jun 25 14:33:09 1993 β€” vintage but still serving. πŸ’œ mwah, go forth and free your memory. πŸ“

πŸ“¦ where this page comes from