getnetbyname(3z)

πŸ“¦ version 1.10.1, in fedora 43, fedora 44

πŸ’– getnetbyname β€” z88dk Programmer's Manual πŸ’–

okay bestie, welcome to the z88dk manual, this one's all about network entries and honestly it's short and sweet, we love a low-effort slay ✨


🌸 NAME 🌸

getnetbyname, getnetbynumber β€” get network entry

like, that's the whole job. you want a network entry? girl, these two got you 🫢


✨ SYNOPSIS ✨

#include <net/resolv.h>

int getnetbyname(char *name);
char *getnetbynumber(int network, char * buf);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so first up, getnetbyname() β€” you hand it a network name, and it hands you back the standard number for that network. cute, right? but bestie, listen: if no network is known, you get NULL back. not a number, not a sad little zero, just NULL. so check it. 😭

then there's getnetbynumber() β€” this one takes network and copies the matching network into buf, and yes it also returns buf because it's generous like that πŸ’…. but plot twist: if no network is known, then network itself gets returned, in ASCII form. so like, you asked for a thing and you got the number you typed back as text. it's giving "we don't know her" energy fr fr.


πŸ‘‘ RETURN VALUE πŸ‘‘

detailed above, bestie. scroll up, it's all there, no cap 🌈


πŸŽ€ NOTES πŸŽ€

these functions use a lookup table compiled into the ZSock kernel, and ngl it is not likely that method will change in the near future. so like, the vibe is stable, iykyk 🧚


πŸ’œ AUTHOR πŸ’œ

Dominic Morris <dom@jb.man.ac.uk>


and that's the whole page, periodt πŸ’… go forth and resolve those networks bestie, you're literally the main character of this codebase β­πŸ¦‹πŸ’–

z88dk Programmer's Manual, dated 18 February 2000 β€” yeah it's vintage, and vintage is iconic, we don't question it 🌸

πŸ“¦ where this page comes from