NBP_NAME(3)
β¨ NBP_NAME(3) β¨
okay bestie, sit down, we're talking about nbp_name from the Netatalk AFP Fileserver Manual β she's a lil function in section 3 of the manual, and she's lowkey the reason your AFP server knows its own name π
π NAME π
nbp_name β NBP name parsing. that's it, that's the whole vibe. she takes names and she dissects them π¦
πΈ SYNOPSIS πΈ
int nbp_name(name,
obj,
type,
zone);
char *name;
char **obj;
char **type;
char **zone;
look at her. four arguments. no notes. π
π DESCRIPTION π
so like, nbp_name() takes a name that a user just handed you and parses it into its component parts: the object, the type, and the zone. it's giving girlboss surgery, honestly π₯
here's the tea: obj, type, and zone should all be passed by reference, and they should point to the caller's default values. then nbp_name() goes in and changes those pointers to point at the parsed-out values. so your defaults are basically the placeholder outfit and she's the stylist swapping it out π
name is of the form object:type@zone, where each of object, :type, and @zone replace obj, type, and zone, respectively. (yes, exactly in that order, don't fight her on this.)
and the punctuation is not optional, bestie:
typemust be preceded by:β no colon, no type, periodt.zonemust be preceded by@β the@is doing a LOT of heavy lifting here.
π¦ EXAMPLES π¦
the argument of afpd(8)'s -n option is parsed with nbp_name(). iconic crossover moment β¨
so here's the defaults situation, and honestly it's kind of a cute little family:
- the default value of
objis the first component of the machine's hostname (as returned bygethostbyname(3)) β she's literally named after the computer, main character energy fr fr - the default value of
typeis"AFPServer" - the default value of
zoneis"*", the default zone π
now. say you want afpd to register itself in some zone other than the default. (very "I'm not like other zones" of you, and we support it.) you'd invoke it like this, where obj and type just retain their default values:
afpd -n @some-other-zone
see how she only touched the zone? obj and type didn't even have to get up. slay π
π BUGS π
okay this is the part where we have to be real with each other. π¨
obj, type, and zone return pointers into a static area which may be over-written on each call.
translation, bestie: they're not yours. that static area is shared, and every single time you call nbp_name() again, it can just... overwrite the thing you were pointing at. so if you were holding onto those pointers thinking they're safe β they are not π. copy what you need before the next call, or she WILL catch you slipping. this is not a drill, this is documented behavior. π
π AUTHOR π
Contributors to the Netatalk Project β the collective, the committee, the girlies who built it. π«Ά
π shoutout to all the references doing their lil cameo:afpd(8)andgethostbyname(3)β you two understood the assignment.
okay that's the whole page, you're officially an NBP name parsing expert, i don't make the rules π
this has been your girl signing off from the Netatalk 4.4.3 era, dated right there with NBP_NAME(3) β go parse something cute, mwah πβ¨πΈ
π¦ where this page comes from
- epel 10: netatalk-devel 5:4.4.3-1.el10_3 Β· GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND LicenseRef-Callaway-LGPLv2+ AND LicenseRef-Callaway-BSD AND FSFUL AND LicenseRef-Callaway-MIT
- fedora 43: netatalk-devel 5:4.4.3-1.fc43 Β· GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND LicenseRef-Callaway-LGPLv2+ AND LicenseRef-Callaway-BSD AND FSFUL AND LicenseRef-Callaway-MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms