DNET_GETNODE(3)

πŸ“¦ version 2.65build2, in ubuntu jammy

πŸ’– DNET_GETNODE πŸ’–

okay bestie, welcome to the dnet_getnode manual page β€” it's a section 3 library function, part of the Library Functions Manual, and it's literally your all-access pass to the DECnet nodes database. let's go πŸ¦‹


✨ NAME ✨

dnet_getnode, dnet_nextnode, dnet_endnode β€” get nodes from the DECnet database 🫢


🌸 SYNOPSIS 🌸

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

void *dnet_getnode (void)
char *dnet_nextnode (void *)
void dnet_endnode (void *)

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so here's the trio, and they work as a little group chat, no cap:

  • dnet_getnode() β€” starts the search of the DECnet nodes database, which lives at /etc/decnet.conf. it hands you back an opaque pointer, and that pointer is the thing you pass to the other two functions. main character energy fr πŸ’…
  • dnet_nextnode() β€” returns the next node name in the list. heads up though: that pointer is private to the library and it will be overwritten on the next dnet_nextnode call. so don't go holding onto it, bestie 😭
  • dnet_endnode() β€” ends the search. it must be called when you're done with this group of functions, or you get a memory leak. not a vibe. not iconic. call it. periodt πŸ’€

🌈 EXAMPLE 🌈

here's the whole thing looking cute and doing its little loop:

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

main(void)
{
  void *nodelist;
  char *nodename;

  nodelist = dnet_getnode();
  nodename = dnet_nextnode(nodelist);
  while(nodename)
  {
      printf("Found node %s\n", nodename);
      nodename = dnet_nextnode(nodelist);
  }
  dnet_endnode(nodelist);

}

see how it grabs the list, walks it until nodename goes falsy, and then actually calls dnet_endnode? that last line is the glow-up πŸŽ€


πŸ”₯ SEE ALSO πŸ”₯


that's the whole page, bestie β€” DECnet database functions, from way back on April 3, 1999, page DNET_GETNODE(3). slay πŸ’–βœ¨

πŸ“¦ where this page comes from