gd_flags(3)

πŸ’– gd_flags(3) πŸ’–

okay so welcome to the GetData manual, bestie β€” this one's gd_flags, and it's literally the little knob-panel for your dirfile's vibe settings. no cap.


✨ NAME ✨

gd_flags β€” alter GetData operational flags πŸŽ€


🌸 SYNOPSIS 🌸

#include <getdata.h>

unsigned long gd_flags(DIRFILE *dirfile, unsigned long set,
       unsigned long reset);

πŸ¦‹ DESCRIPTION πŸ¦‹

So gd_flags() does the thing where it messes with the operational flags of the dirfile(5) database you point at with dirfile, and then it hands you back the new value of the flags register. it's giving "I changed the settings AND I'm telling you what they are now" energy. πŸ’…

The flags you can peek at or poke with this interface are a subset of the open flags (go see gd_cbopen(3) for the full set). here's the lineup:

  • GD_PRETTY_PRINT β€” when your dirfile metadata get flushed to disk (either you asked for it explicitly with gd_metaflush(3), gd_rewrite_fragment(3), or gd_flush(3), or it just happens implicitly when the dirfile gets closed), GetData will attempt to cook up a nicer looking format specification β€” nicer from a human-readable standpoint, that is. πŸŽ€ BUT. What that explicitly means is not part of the API, so don't you dare rely on any particular behaviour, fr fr. Also, if the dirfile was opened read-only, this flag is just ignored. πŸ™ˆ
  • GD_VERBOSE β€” this one says: whenever the library triggers an error while working on this dirfile, the corresponding error string β€” the one you'd get by calling gd_error_string(3) β€” should get written to the caller's standard error stream (stderr(3)) by GetData. The error string may be prefixed by a string that the caller specified; peep gd_verbose_prefix(3) for that. Without this flag? GetData writes nothing to standard error. (and GetData never writes to standard output, periodt. πŸ‘‘)

🧠 the set/reset rules (this is the important part)

  • flags that show up only in set get turned on (enabled) βœ…
  • flags that show up only in reset get turned off (disabled) ❌
  • flags that show up in both set and reset get toggled πŸ”
  • flags that show up in neither are left completely unchanged πŸ’€

So, accordingly:

  • wanna just query the current flags? pass both set and reset as zero. πŸ‘€
  • wanna explicitly specify all the flags, ignoring their old values entirely? give the new flags register in set, and its bitwise complement in reset. slay.

πŸ”₯ RETURN VALUE πŸ”₯

gd_flags() returns a bitwise or'd collection of those flags from the list above which are enabled after it does the modifications you specified (if any).

And here's the best part: this function does not fail. no error codes, no drama, no nothing. iconic behaviour honestly. ✨


πŸ“œ HISTORY πŸ“œ

The gd_flags() function appeared in GetData-0.8.0. a whole era. πŸ’œ


πŸ‘€ SEE ALSO πŸ‘€


and that's the whole page, bestie!! this was Version 0.10.0, dated 25 December 2016, and yeah β€” it's a gd_flags(3) situation, written by the GETDATA girlies. mwah, go set some flags πŸ’…πŸ’–πŸ«Ά