aboutsummaryrefslogtreecommitdiff
path: root/src/inet.c
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2005-06-14 04:29:23 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2005-06-14 04:29:23 +0000
commit65c35845c54c7f84b1cf5b0e3d4c7bbdaf1014e3 (patch)
treef6e3f1a31451281ac2a347c3080e9749456dac29 /src/inet.c
parent8b114f3bf4ccea3b065551fa94649a9e45935b5b (diff)
downloadluasocket-65c35845c54c7f84b1cf5b0e3d4c7bbdaf1014e3.tar.gz
luasocket-65c35845c54c7f84b1cf5b0e3d4c7bbdaf1014e3.tar.bz2
luasocket-65c35845c54c7f84b1cf5b0e3d4c7bbdaf1014e3.zip
Working on the manual.
Diffstat (limited to 'src/inet.c')
-rw-r--r--src/inet.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/inet.c b/src/inet.c
index d713643..d102060 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -172,21 +172,25 @@ static void inet_pushresolved(lua_State *L, struct hostent *hp)
172 i = 1; 172 i = 1;
173 alias = hp->h_aliases; 173 alias = hp->h_aliases;
174 lua_newtable(L); 174 lua_newtable(L);
175 while (*alias) { 175 if (alias) {
176 lua_pushnumber(L, i); 176 while (*alias) {
177 lua_pushstring(L, *alias); 177 lua_pushnumber(L, i);
178 lua_settable(L, -3); 178 lua_pushstring(L, *alias);
179 i++; alias++; 179 lua_settable(L, -3);
180 i++; alias++;
181 }
180 } 182 }
181 lua_settable(L, resolved); 183 lua_settable(L, resolved);
182 i = 1; 184 i = 1;
183 lua_newtable(L); 185 lua_newtable(L);
184 addr = (struct in_addr **) hp->h_addr_list; 186 addr = (struct in_addr **) hp->h_addr_list;
185 while (*addr) { 187 if (addr) {
186 lua_pushnumber(L, i); 188 while (*addr) {
187 lua_pushstring(L, inet_ntoa(**addr)); 189 lua_pushnumber(L, i);
188 lua_settable(L, -3); 190 lua_pushstring(L, inet_ntoa(**addr));
189 i++; addr++; 191 lua_settable(L, -3);
192 i++; addr++;
193 }
190 } 194 }
191 lua_settable(L, resolved); 195 lua_settable(L, resolved);
192} 196}