FBB::GetHostent(3bobcat)
π FBB::GetHostent π
okay bestie, buckle up, because we're about to talk about host information β¨ this one lives in the FBB::GetHostent(3bobcat) manual page, and no cap, it's lowkey the plug for getting a hostent struct out of a hostname or an address πΈ
β¨ NAME β¨
FBB::GetHostent β get yourself a hostent struct from a hostname or an -address π
π¦ SYNOPSIS π¦
#include <bobcat/gethostent>
Linking option: -lbobcat
πΈ DESCRIPTION πΈ
so here's the vibe: FBB::GetHostent objects produce hostent structs, and those structs get used by other types of objects. that's literally the whole point π
. which means the FBB::GetHostent class is primarily used as a base-class for other classes, and it's seldomly used stand-alone. yes bestie, stand-alone in quotes, that's how the original says it π.
the hostent structs are static structs, but you can get a non-static copy using an FBB::Hostent object π«Ά.
a hostent struct is defined like this, and I'm giving it to you verbatim because character-for-character matters:
struct hostent
{
char *h_name; // official name of host
char **h_aliases; // alias list
int h_addrtype; // host address type (always AF_INET)
int h_length; // length of address
char **h_addr_list; // list of addresses
}
the address fields are the binary values of the addresses π, and each address needs h_length bytes, with the last address being equal to 0. and if you want those binary values as character-representations? use the addressToString() member, which internally uses inet_ntop() β.
π NAMESPACE π
FBB
every single constructor, member, operator and manipulator mentioned in this man-page is defined in the namespace FBB. periodt π
π§ INHERITS FROM π§
-
that's it. nothing. inherits from nobody. it's giving independent main character energy β¨
π CONSTRUCTORS π
all members of the class FBB::GetHostent are static. so like, there is no need to construct an FBB::GetHostent object. you can just... use it. iconic π
π STATIC MEMBERS π
hostent const *gethostent(char const *errorprefix, std::string const &nameOrAddress)β this returns a pointer to a staticstruct hostentπ and it holds the info about the host whose name or dotted decimal address you passed as the second argument. the first argument is an error string prefix, and it gets prefixed onto the error message inside anFBB::Exceptionobject. that exception gets thrown when the host's info could not be retrieved π so yeah, wrap it, bestie.std::string addressToString(char const *errorprefix, void const *ads)β this one returns the dotted decimal address of the host whose binary address you passed atadsπ¦. its first argument is an error string prefix, which prefixes the error message in anFBB::Exceptionobject. that object is thrown as an exception when the dotted decimal address could not be determined π.
lowkey important caveat: the class' members can only be used when the host whose name or address is searched can be resolved by a name resolution process, e.g., bind(1) β
π₯ EXAMPLE π₯
here's the whole thing, exactly as it is, no edits, no cap:
#include <iostream>
#include <algorithm>
#include <iterator>
#include <bobcat/hostent>
#include <bobcat/gethostent>
using namespace std;
using namespace FBB;
int main(int argc, char **argv)
try
{
if (argc == 1)
{
cerr << "Provide a host name or host address to solve\n";
return 1;
}
Hostent he(GetHostent::gethostent(argv[1], argv[1]));
cout << "Hostname: " << he.hostname() << endl;
cout << "Aliases:\n";
copy(he.beginAlias(), he.endAlias(),
ostream_iterator<char const *>(cout, "\n"));
cout << "Addresses:\n";
for (size_t idx = 0; idx < he.nAddresses(); idx++)
cout << he.dottedDecimalAddress(idx) << endl;
}
catch (Exception const &err)
{
cout << err.what() << endl;
return 1;
}
π FILES π
bobcat/gethostent β defines the class interface π
π SEE ALSO π
bind(1), bobcat(7), gethostbyaddr(3) gethostbyname(3), hostent(3bobcat), inetaddress(3bobcat), inet_ntop(3) β¨
π BUGS π
None Reported.
(i know. icon behaviour. nothing to report π)
π«Ά BOBCAT PROJECT FILES π«Ά
- https://fbb-git.gitlab.io/bobcat/ β gitlab project page;
- Debian Bobcat project files:
libbobcat6β debian package containing the shared library, changelog and copyright note;libbobcat-devβ debian package containing the static library, headers, manual pages, and developer info;
β BOBCAT β
Bobcat is an acronym of Brokken's Own Base Classes And Templates. slay, honestly π
π COPYRIGHT π
This is free software, distributed under the terms of the GNU General Public License (GPL). π
πΈ AUTHOR πΈ
Frank B. Brokken (f.b.brokken@rug.nl). thank you king π
and that's the whole page, bestie π¦ this came out of libbobcat-dev_6.15.01, dated 2005-2026, and honestly? it's giving timeless. obsessed. mwah π
β¨
π¦ where this page comes from
- ubuntu stonking: libbobcat-dev 6.15.01-1 Β· GPL-3.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms