1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Add an nseU_opttarget function.

This commit is contained in:
david
2012-09-15 17:56:17 +00:00
parent d319f8bf56
commit 9b28bc8ed5
2 changed files with 20 additions and 0 deletions

View File

@@ -121,6 +121,17 @@ void nseU_checktarget (lua_State *L, int idx, const char **address, const char *
}
}
void nseU_opttarget (lua_State *L, int idx, const char **address, const char **targetname)
{
if (lua_isnoneornil(L, idx)) {
*address = NULL;
*targetname = NULL;
return;
} else {
return nseU_checktarget(L, idx, address, targetname);
}
}
uint16_t nseU_checkport (lua_State *L, int idx, const char **protocol)
{
uint16_t port;

View File

@@ -108,6 +108,15 @@ void *nseU_checkudata (lua_State *L, int idx, int upvalue, const char *name);
*/
void nseU_checktarget (lua_State *L, int idx, const char **address, const char **targetname);
/* void nseU_opttarget (lua_State *L, int idx, [-0, +0, v]
* const char **address,
* const char **targetname)
*
* Like nseU_checktarget, but sets *address and *targetname to NULL and returns
* success if the argument at idx is none or nil.
*/
void nseU_opttarget (lua_State *L, int idx, const char **address, const char **targetname);
/* uint16_t nseU_checkport (lua_State *L, int idx, [-0, +0, v]
* const char **protocol)
*