getnetent(3) Library Functions Manual getnetent(3) getnetent, getnetbyname, getnetbyaddr, setnetent, endnetent - LIBRARY Standard C library (libc, -lc) #include struct netent *getnetent(void); struct netent *getnetbyname(const char *name); struct netent *getnetbyaddr(uint32_t net, int type); void setnetent(int stayopen); void endnetent(void); getnetent() , , netent, . . getnetbyname() netent , name. getnetbyaddr() netent , net type. net , . setnetent() . stayopen , getnet*() . endnetent() . netent : struct netent { char *n_name; /* */ char **n_aliases; /* */ int n_addrtype; /* */ uint32_t n_net; /* */ } netent: n_name . n_aliases , NULL. n_addrtype , AF_INET. n_net , . The getnetent(), getnetbyname(), and getnetbyaddr() functions return a pointer to a statically allocated netent structure, or a null pointer if an error occurs or the end of the file is reached. /etc/networks , attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |getnetent() | | MT-Unsafe race:netent | | | | race:netentbuf env | | | | locale | +----------------------------+----------------------------------------------------------+--------------------------+ |getnetbyname() | | MT-Unsafe race:netbyname | | | | env locale | +----------------------------+----------------------------------------------------------+--------------------------+ |getnetbyaddr() | | MT-Unsafe race:netbyaddr | | | | locale | +----------------------------+----------------------------------------------------------+--------------------------+ |setnetent(), endnetent() | | MT-Unsafe race:netent | | | | env locale | +----------------------------+----------------------------------------------------------+--------------------------+ netent race:netent , setnetent(), getnetent() endnetent(), . POSIX.1-2008. POSIX.1-2001, 4.3BSD. Before glibc 2.2, the net argument of getnetbyaddr() was of type long. . getnetent_r(3), getprotoent(3), getservent(3) RFC 1101 Azamat Hackimov , Dmitry Bolkhovskikh , Vladislav , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . getnetent(3)