af_misc(3)

πŸ’– af_misc β€” miscellaneous AtFS functions πŸ’–

okay bestie, listen up, this is af_misc(3) from the Attribute Filesystem (AtFS) manual, and it's basically a lil grab-bag of helper functions. not the main character of the library, but lowkey iconic in its own way. let's go πŸ¦‹


✨ NAME ✨

af_afname, af_afpath, af_aftype, af_afuser, af_setarchpath, af_version β€” the miscellaneous AtFS functions. six lil besties, one page, no cap πŸ’…


🌸 SYNOPSIS 🌸

#include <atfs.h>

char  *af_afname (char *path)

char  *af_afpath (char *path)

char  *af_aftype (char *path)

Af_user*af_afuser (uit_t uid)

char  *af_setarchpath (char *path)

char  *af_version (void)

πŸŽ€ DESCRIPTION πŸŽ€

okay so first up: af_afname, af_afpath and af_aftype are the trio that extract stuff out of a given file identification (which is operating-system-dependent, iykyk). they pull out the name, the syspath, or the type.

in a UNIX environment, a pathname that looks like this:

/usr/lib/libatfs.a

gives you afname libatfs, afpath /usr/lib, and aftype a. slay, it just parses it like that ✨

now, if there's no path given (like otto.c), or no type given (like /usr/hugo/Makefile), the matching routine just hands you back an empty string. no drama, just vibes.

a period as the first character of a filename is always considered part of the name, periodt. so like .cshrc has the name .cshrc and an empty type string. πŸ™ˆ

and "." and ".." are recognized as names. yes bestie, they get name privileges too.

archive file extensions and AtFS specific path extensions get stripped from the resulting name / pathname. so don't come crying when they're not in the output, they were never invited 🧚

⚠️ note bestie: af_afname, af_afpath and af_aftype use static memory for the results they return. so if you call the same function again, it overwrites the former result. the way that one buffer is just out here getting reused 😭 save your string before you call again, fr fr.

next up, af_afuser returns an AtFS user identification, and it's giving full identity: the login name of the user identified by uid, the current host, and the current domain. πŸ’œ

Uid_t is defined according to the return type of getuid (2) on your system, so it matches whatever your system's getuid gives back.

the Af_user type has this structure:

typedef struct {
      charaf_username[MAXUSERNAMELEN];
      charaf_userhost[MAXHOSTNAMELEN];
      charaf_userdomain[MAXDOMAIN+1];
      } Af_user;

then we've got af_setarchpath, which defines the location of the AtFS archive files. iconic little setter 🫢

if you hand it a nil-pointer as the path argument, it clears the former setting of the global archive path. so nil = reset, got it?

af_setarchpath returns the old global archive path. initially, no global archive path is set at all. and in that case? all archive files are stored in a subdirectory called AtFS, relative to the directory where the corresponding busy version resides. that's just where they live, no cap 🏠


and finally af_version β€” it returns a string that names the version and the creator of the currently used AtFS library. cute lil flex, honestly ⭐


πŸ‘‘ SEE ALSO πŸ‘‘


that's the whole page bestie, hope it ate πŸ’–βœ¨

this was pulled from AtFS-1.71, dated Fri Jun 25 14:33:12 1993 β€” yeah she's vintage, she's a classic, she's still serving πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from