GETNODEBYNAME(3)

πŸ“¦ version 2.65build2, in ubuntu jammy

πŸ’– GETNODEBYNAME(3) πŸ’–

okay bestie, welcome to the DECnet node entry retrieval by address page β€” it's a Library Functions Manual moment and honestly? iconic. pull up a chair, we're finding nodes by name and we're gonna slay it πŸ¦‹


✨ NAME ✨

getnodebyname β€” DECnet node entry retrieval by address πŸ‘‘


🌸 SYNOPSIS 🌸

#include <netdnet/dn.h>
#include <netdnet/dnetdb.h>

struct nodeent *getnodebyname (char *name)

like literally just hand it a name and it hands you back a struct nodeent *. no cap. πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

so here's the vibe: getnodebyname goes digging through the decnet hosts file looking for the DECnet node whose name equals name, and when it finds it, it drops all that node info right into the nodeent structure. bestie behavior fr fr 🫢

and if there's no entry? it returns NULL. that's it. that's the whole thing. no drama, just NULL 😭


⭐ EXAMPLE ⭐

here's how you actually use it, watch and learn 🧚:

#include <netdnet/dn.h>
#include <netdnet/dnetdb.h>
#include <sys/socket.h>

main(void)
{
    struct nodeent      *dp;

    if ( (dp=getnodebyname("mv3100")) == NULL)
        printf("Error, cannot find node entry");
    else
        printf("Node name is %s",dp->n_name);
}

look at mv3100 doing main character energy in there. and if it can't find it, we print "Error, cannot find node entry" β€” the saddest little printf πŸ’€. otherwise we flex dp->n_name with "Node name is %s". periodt. 🌈


πŸ¦‹ SEE ALSO πŸ¦‹

the whole friend group, together again, iykyk πŸ’œ


this one's brought to you by the DECnet database functions girlies, dated July 28, 1998 β€” an absolute vintage baddie, still serving after all these years. bye bestie, go find your nodes πŸ’–βœ¨πŸŽ€
πŸ“¦ where this page comes from