summaryrefslogtreecommitdiff
path: root/src/system.c
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2015-06-11 20:59:00 +0200
committerAndreas Baumann <abaumann@yahoo.com>2015-06-11 20:59:00 +0200
commitc86834d40fa6b07828b10e2c6d8d2c6bd35fe116 (patch)
treeafca67b9f4287e07c12e076a96f359e0210edf6f /src/system.c
parent365d5c59d76831b7ec0d6c3ebe49ef1e3793ac7c (diff)
downloadbiruda-c86834d40fa6b07828b10e2c6d8d2c6bd35fe116.tar.gz
biruda-c86834d40fa6b07828b10e2c6d8d2c6bd35fe116.tar.bz2
replaced gethostname on Windows with GetComputerNameEx
Diffstat (limited to 'src/system.c')
-rw-r--r--src/system.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/system.c b/src/system.c
index 766e264..7d2e052 100644
--- a/src/system.c
+++ b/src/system.c
@@ -20,6 +20,7 @@
#ifdef __NetBSD__
#include <unistd.h>
#else /* __NetBSD__ */
+#include <unistd.h>
#endif /* __NetBSD__ */
#endif /* __FreeBSD__ */
#endif /* _WIN32 */
@@ -391,6 +392,17 @@ void system_arch( char *name, size_t len )
#endif
}
+int system_hostname( char *name, size_t len )
+{
+#ifdef _WIN32
+ DWORD dwSize = len;
+ int res = GetComputerNameExA( ComputerNamePhysicalDnsFullyQualified, name, &dwSize );
+ return ( res > 0 ) ? 0 : -1;
+#else
+ return gethostname( name, len );
+#endif
+}
+
unsigned int system_phys_memory( )
{
#ifdef _WIN32