gd_hidden(3)

πŸŽ€ NAME πŸŽ€

gd_hidden β€” the little vibe check that tells you whether a Dirfile entry is hidden or not πŸ’…


✨ SYNOPSIS ✨

#include <getdata.h>

int gd_hidden(const DIRFILE *dirfile, const char *entry_name);

πŸ’– DESCRIPTION πŸ’–

okay so bestie, gd_hidden() is literally the function you call when you need to know if something's being shady and hiding from you. It queries a dirfile(5) database (the one you point at with dirfile) to figure out whether the field or alias called entry_name is hidden or not. πŸ‘€

And ngl, that same info is also sitting right there in the entry object provided by gd_entry(3), so like, you have options. 🫢

By default (and this is the part that trips people up), a hidden entry does not show up in the lists returned by:

…including the special-case versions of gd_entry_list(3) like gd_field_list(3). πŸ™ˆ

And the way those omissions also carry over into the counts returned by the corresponding field counting function gd_nentries(3) and its special-case versions (gd_nfields(3), &c.). So yeah, if your count looks weird, check if something's hidden. Not me learning this the hard way πŸ’€


πŸ”₯ RETURN VALUE πŸ”₯

Upon successful completion, gd_hidden() returns:

  • 1 if the field or alias is hidden
  • 0 if the entry is not hidden

On error, it returns a negative-valued error code. ⚠️

🚨 IMPORTANT, bestie: because errors are negative and success is 0 or 1, the caller who just checks whether the return value is non-zero is usually making an error. Like, that check is giving "I didn't read the docs" energy. Don't be that person. πŸ’…

Possible error codes are:

  • GD_E_BAD_CODE β€” The field specified by field_code was not found in the database.
  • GD_E_BAD_DIRFILE β€” The supplied dirfile was invalid.

The error code is also stored in the DIRFILE object, and you can grab it after this function returns by calling gd_error(3). Want a descriptive error string instead? Call gd_error_string(3). πŸŽ€


🌸 HISTORY 🌸

  • The gd_hidden() function appeared in GetData-0.8.0.
  • In GetData-0.10.0, the error return from this function changed from -1 to a negative-valued error code. glow-up fr fr ✨

πŸ‘‘ SEE ALSO πŸ‘‘

gd_entry(3), gd_field_list(3), gd_hide(3), gd_nfields(3), gd_open(3), gd_unhide(3), dirfile(5)


Version 0.10.0 Β· 25 December 2016 β€” yeah this page is a lil vintage but she still ate, no cap πŸ’– mwah, go check your hidden entries bestie πŸ¦‹