summaryrefslogtreecommitdiff
path: root/LibC/netdb.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-14 15:18:15 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-14 15:18:15 +0100
commit2c3cf22bc9de55d7ef4301f292a3f516f13cf813 (patch)
treeb712213ed7449d7bb7a9a8aa8b03df41a84e62c9 /LibC/netdb.cpp
parent48590a0e512a6fee823cdcd1f0cb75ad2fae83d0 (diff)
downloadserenity-2c3cf22bc9de55d7ef4301f292a3f516f13cf813.zip
LibC: A whole bunch of compat work towards porting Lynx.
Diffstat (limited to 'LibC/netdb.cpp')
-rw-r--r--LibC/netdb.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/LibC/netdb.cpp b/LibC/netdb.cpp
new file mode 100644
index 0000000000..3be3bc868e
--- /dev/null
+++ b/LibC/netdb.cpp
@@ -0,0 +1,31 @@
+#include <netdb.h>
+#include <stdio.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+
+extern "C" {
+
+static hostent __gethostbyname_buffer;
+static in_addr_t __gethostbyname_address;
+static in_addr_t* __gethostbyname_address_list_buffer[2];
+
+hostent* gethostbyname(const char* name)
+{
+ if (!strcmp(name, "boards.4channel.org")) {
+ __gethostbyname_buffer.h_name = "boards.4channel.org";
+ __gethostbyname_buffer.h_aliases = nullptr;
+ __gethostbyname_buffer.h_addrtype = AF_INET;
+ __gethostbyname_address = 0x4b4f1168;
+ __gethostbyname_address_list_buffer[0] = &__gethostbyname_address;
+ __gethostbyname_address_list_buffer[1] = nullptr;
+ __gethostbyname_buffer.h_addr_list = (char**)__gethostbyname_address_list_buffer;
+ __gethostbyname_buffer.h_length = 4;
+ return &__gethostbyname_buffer;
+ }
+ dbgprintf("FIXME(LibC): gethostbyname(%s)\n", name);
+ return nullptr;
+}
+
+}
+