atprint(3)

✨ atprint(3) β€” the AtFS Toolkit Library bestie page ✨

okay so picture this: you're deep in the AtFS Toolkit Library and you need to turn weird internal attribute values into strings a human can actually read, or do the reverse and turn a string back into a number. that's literally this whole page. five little functions, one very specific job. let's get into it πŸ’…


🌸 NAME 🌸

atWriteStatus, atWriteMode, atWriteDate, atWriteName, atScanStatus β€” print and scan special attribute values πŸŽ€


🌈 SYNOPSIS 🌈

#include <atfs.h>
#include <atfstk.h>

char*atWriteStatus (Af_key *aso; int verbose);

char*atWriteMode (Af_key *aso);

char*atWriteDate (Af_key *aso, char *dateAttribute);

char*atWriteName (Af_key *aso, char *path);

int  atScanStatus (char *statusStr);

πŸ’– DESCRIPTION πŸ’–

πŸ¦‹ atWriteStatus

atWriteStatus hands you back a string representation of the Asos AF_STATE attribute. that's it, that's the job. ✨

here's the tea tho β€” the verbose argument changes everything:

  • if verbose is TRUE, you get the long status name (8 characters, iconic).
  • if verbose is FALSE, you get the short one-character representation (lowkey minimal, we love her).

and in any case, the result value is a statically defined string. so like, it lives in static memory. noted. πŸ’€

πŸŽ€ atWriteMode

atWriteMode generates an ls -l(1)-like string representation (think -rwxr-xr-x, the classic) of the AF_MODE attribute. 🫢

it returns its result in static memory, which will be overwritten on subsequent calls. so if you were planning to hold onto it and call this again, bestie… don't. copy it first. 😭

⭐ atWriteDate

atWriteDate produces a date string from the given dateAttribute, meant to be used for ls -l(1)-like output (for example Jan 8 11:07 or Jul 10 1992). 🌸

the format of the date string depends on the value of the date attribute. the rules, periodt:

  • the string is always 12 characters long and begins with the month and day.
  • for dates younger than 6 months, the third field is the time.
  • for dates older than 6 months, the third field is the year.

the result string resides in static memory, which will be overwritten on subsequent calls. same warning as before, same energy, be careful. πŸ™ˆ

🌟 atWriteName

atWriteName generates a bound pathname from path and aso. simple, clean, no notes. ✨

πŸ’œ atScanStatus

atScanStatus converts a status string to an internal numeric status value. it understands various abbreviations β€” including the one character status strings generated by atWriteStatus. so it's giving "i can read what she writes", a true duo, iykyk. πŸ‘‘


πŸ’€ BUGS πŸ’€

the format switch in afWriteDate (for dates older than six months) does not happen at exactly the right time. it may be a few days later. 😭 not me discovering this at 3am. it's a known thing, it's fine, we move.

and that's the page, bestie!! this one's from AtFStk-1.12, dated Fri Jun 25 16:39:43 1993 β€” yeah she's vintage, she's a classic, she ate and left no crumbs πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from