Mailing List Archive

libnasl/nasl exec.c,1.77.2.4,1.77.2.5
Update of /usr/local/cvs/libnasl/nasl
In directory raccoon.nessus.org:/tmp/cvs-serv85293

Modified Files:
Tag: NESSUS_2_2
exec.c
Log Message:
- Bugfix - make this code work:
a=1; b=1; c = a + b ++; # Should return 2 instead of 3
- Warning (from 2.3 branch) if string "0" is converted to boolean
(since the early days of NASL2, it gives FALSE just like in Perl, but
this was not what I intended)


Index: exec.c
===================================================================
RCS file: /usr/local/cvs/libnasl/nasl/exec.c,v
retrieving revision 1.77.2.4
retrieving revision 1.77.2.5
diff -u -d -r1.77.2.4 -r1.77.2.5
--- exec.c 8 Nov 2005 12:20:11 -0000 1.77.2.4
+++ exec.c 23 Apr 2006 20:57:02 -0000 1.77.2.5
@@ -70,7 +70,19 @@
if (c->size == 0)
return 0;
if(c->x.str_val[0] == '0' && c->size == 1)
+ {
+ /*
+ * This gives the same semantics as Perl ("0" is false),
+ * but I do not agree with it.
+ * This piece of code is here from the begining of NASL2; it
+ * probably fixed some compatibility issue with old
+ * quick & dirty scripts.
+ * I added this warning to check if we can switch to a
+ * simpler behaviour (empty string = false, not empty = true)
+ */
+ nasl_perror(lexic, "cell2boll: string '0' is FALSE\n");
return 0;
+ }
return 1;

case REF_ARRAY:
@@ -1313,7 +1325,7 @@
{
case CONST_INT:
x = tc1->x.i_val;
- y = cell2int(lexic, st->link[1]);
+ y = cell2int(lexic, tc2);
ret = int2cell(x + y);
break;


_______________________________________________
Nessus-cvs mailing list
Nessus-cvs@list.nessus.org
http://mail.nessus.org/mailman/listinfo/nessus-cvs