From e8fdd73561fac1e9b4b1114913cd47fcfd63f7b8 Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Thu, 15 Mar 2018 20:32:21 +0000 Subject: [PATCH] add support for finding nxlink host --- nx/external/bsd/include/netinet/in.h | 2 ++ nx/source/runtime/argv.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/nx/external/bsd/include/netinet/in.h b/nx/external/bsd/include/netinet/in.h index 0f624398..63495b76 100644 --- a/nx/external/bsd/include/netinet/in.h +++ b/nx/external/bsd/include/netinet/in.h @@ -678,6 +678,8 @@ struct sockaddr_in6 { extern const struct in6_addr in6addr_any; extern const struct in6_addr in6addr_loopback; +extern struct in_addr __nxlink_host; + #endif #endif /* !_NETINET_IN_H_*/ diff --git a/nx/source/runtime/argv.c b/nx/source/runtime/argv.c index 13c89c68..5b13deaa 100644 --- a/nx/source/runtime/argv.c +++ b/nx/source/runtime/argv.c @@ -1,5 +1,8 @@ #include #include +#include +#include + #include "result.h" #include "runtime/env.h" #include "kernel/svc.h" @@ -7,6 +10,7 @@ // System globals we define here int __system_argc; char** __system_argv; +struct in_addr __nxlink_host; extern char* fake_heap_start; extern char* fake_heap_end; @@ -136,6 +140,12 @@ void argvSetup(void) __system_argc++; } + if (strncmp(__system_argv[__system_argc - 1], "NXLINKED", 8) == 0 ) { + __system_argc--; + + __nxlink_host.s_addr = strtoul(&__system_argv[__system_argc][8], NULL, 16); + } + __system_argv[__system_argc] = NULL; }