Next: Returning a value
Up: Adding new internal functions
Previous: Interface
Contents
Index
The arguments are stored as ``named'' or ``numbered'' variables
in the context. This NASL code:
-
- f(1, "TWO", a: 33, z: "three");
will create four variables in the context, two ``numbered'' and
two ``named'':
- 0 -> 1
- 1 -> "TWO"
- a -> 33
- z -> "three"
To read those arguments, you can use one of those functions:
- char* get_str_var_by_num (lex_ctxt* lexic, int num)
reads the variable and converts it to a string if necessary. Do not
free the result and do not call the function twice in a row on a non-string
variable48 without copying the result somewhere, as the function returns a pointer
to a static buffer in this case.
If the variable is not initialized or cannot be converted to character,
NULL is returned.
- int get_int_var_by_num(lex_ctxt* lexic, int num, int
default_value)
reads the variable and converts it to an integer if necessary.
If the variable is not initialized or cannot be converted, the default
value is returned.
- char* get_str_local_var_by_num(lex_ctxt* lexic,
const char* name)
- int get_int_local_var_by_num(lex_ctxt* lexic, int
num, int default_value)
- int get_local_var_size_by_name
- int get_var_size_by_num
Next: Returning a value
Up: Adding new internal functions
Previous: Interface
Contents
Index
Michel Arboi
2005-04-29