diff options
Diffstat (limited to 'util-src')
-rw-r--r-- | util-src/encodings.c | 6 | ||||
-rw-r--r-- | util-src/hashes.c | 6 | ||||
-rw-r--r-- | util-src/pposix.c | 6 | ||||
-rw-r--r-- | util-src/windows.c | 103 |
4 files changed, 67 insertions, 54 deletions
diff --git a/util-src/encodings.c b/util-src/encodings.c index c573a330..f2109d0c 100644 --- a/util-src/encodings.c +++ b/util-src/encodings.c @@ -1,6 +1,6 @@ -/* Prosody IM v0.4 --- Copyright (C) 2008-2009 Matthew Wild --- Copyright (C) 2008-2009 Waqas Hussain +/* Prosody IM +-- Copyright (C) 2008-2010 Matthew Wild +-- Copyright (C) 2008-2010 Waqas Hussain -- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. diff --git a/util-src/hashes.c b/util-src/hashes.c index 907167e2..33a9be89 100644 --- a/util-src/hashes.c +++ b/util-src/hashes.c @@ -1,6 +1,6 @@ -/* Prosody IM v0.4 --- Copyright (C) 2008 Matthew Wild --- Copyright (C) 2008 Waqas Hussain +/* Prosody IM +-- Copyright (C) 2009-2010 Matthew Wild +-- Copyright (C) 2009-2010 Waqas Hussain -- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. diff --git a/util-src/pposix.c b/util-src/pposix.c index 8c1dbcc6..9f16f178 100644 --- a/util-src/pposix.c +++ b/util-src/pposix.c @@ -1,6 +1,6 @@ -/* Prosody IM v0.4 --- Copyright (C) 2008-2009 Matthew Wild --- Copyright (C) 2008-2009 Waqas Hussain +/* Prosody IM +-- Copyright (C) 2008-2010 Matthew Wild +-- Copyright (C) 2008-2010 Waqas Hussain -- Copyright (C) 2009 Tobias Markmann -- -- This project is MIT/X11 licensed. Please see the diff --git a/util-src/windows.c b/util-src/windows.c index 7fb96312..12bd7ce9 100644 --- a/util-src/windows.c +++ b/util-src/windows.c @@ -1,45 +1,58 @@ -
-#include <stdio.h>
-#include <windows.h>
-#include <windns.h>
-
-#include "lua.h"
-#include "lauxlib.h"
-
-static int Lget_nameservers(lua_State *L) {
- char stack_buffer[1024]; // stack allocated buffer
- IP4_ARRAY* ips = (IP4_ARRAY*) stack_buffer;
- DWORD len = sizeof(stack_buffer);
- DNS_STATUS status;
-
- status = DnsQueryConfig(DnsConfigDnsServerList, FALSE, NULL, NULL, ips, &len);
- if (status == 0) {
- DWORD i;
- lua_createtable(L, ips->AddrCount, 0);
- for (i = 0; i < ips->AddrCount; i++) {
- DWORD ip = ips->AddrArray[i];
- char ip_str[16] = "";
- sprintf_s(ip_str, sizeof(ip_str), "%d.%d.%d.%d", (ip >> 0) & 255, (ip >> 8) & 255, (ip >> 16) & 255, (ip >> 24) & 255);
- lua_pushstring(L, ip_str);
- lua_rawseti(L, -2, i+1);
- }
- return 1;
- } else {
- luaL_error(L, "DnsQueryConfig returned %d", status);
- return 0; // unreachable, but prevents a compiler warning
- }
-}
-
-static const luaL_Reg Reg[] =
-{
- { "get_nameservers", Lget_nameservers },
- { NULL, NULL }
-};
-
-LUALIB_API int luaopen_util_windows(lua_State *L) {
- luaL_register(L, "windows", Reg);
- lua_pushliteral(L, "version"); /** version */
- lua_pushliteral(L, "-3.14");
- lua_settable(L,-3);
- return 1;
-}
+/* Prosody IM +-- Copyright (C) 2008-2010 Matthew Wild +-- Copyright (C) 2008-2010 Waqas Hussain +-- +-- This project is MIT/X11 licensed. Please see the +-- COPYING file in the source package for more information. +-- +*/ + +/* +* windows.c +* Windows support functions for Lua +*/ + +#include <stdio.h> +#include <windows.h> +#include <windns.h> + +#include "lua.h" +#include "lauxlib.h" + +static int Lget_nameservers(lua_State *L) { + char stack_buffer[1024]; // stack allocated buffer + IP4_ARRAY* ips = (IP4_ARRAY*) stack_buffer; + DWORD len = sizeof(stack_buffer); + DNS_STATUS status; + + status = DnsQueryConfig(DnsConfigDnsServerList, FALSE, NULL, NULL, ips, &len); + if (status == 0) { + DWORD i; + lua_createtable(L, ips->AddrCount, 0); + for (i = 0; i < ips->AddrCount; i++) { + DWORD ip = ips->AddrArray[i]; + char ip_str[16] = ""; + sprintf_s(ip_str, sizeof(ip_str), "%d.%d.%d.%d", (ip >> 0) & 255, (ip >> 8) & 255, (ip >> 16) & 255, (ip >> 24) & 255); + lua_pushstring(L, ip_str); + lua_rawseti(L, -2, i+1); + } + return 1; + } else { + luaL_error(L, "DnsQueryConfig returned %d", status); + return 0; // unreachable, but prevents a compiler warning + } +} + +static const luaL_Reg Reg[] = +{ + { "get_nameservers", Lget_nameservers }, + { NULL, NULL } +}; + +LUALIB_API int luaopen_util_windows(lua_State *L) { + luaL_register(L, "windows", Reg); + lua_pushliteral(L, "version"); /** version */ + lua_pushliteral(L, "-3.14"); + lua_settable(L,-3); + return 1; +} |