[ns] bug in bind command for CBQ class

Håkan Byström hakan.bystrom@operax.com
Wed, 03 Oct 2001 16:06:34 +0200


--------------70A2EBE434E97E6B2A9F6BEB
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Thank you!

Embarrassing enough I have to say that it was a simple mistake (lack of ';'
before a comment in the same line) in my script that was the cause of the
problem.

To make the command more foolproof the following change should be made to

CBQLink instproc bind

in ~ns/tcl/lib/ns-queue.tcl:

if { $nargs == 3 } {
    set b [lindex $args 2]
} else {
    set b $a
}

should be changed to

if { $nargs == 2 } {
    set b $a
} elseif { $nargs == 3 } {
    set b [lindex $args 2]
} else {
    error "Wrong number of arguments to 'bind'."
}





Lloyd Wood wrote:

> You're typing an OTcl command, so you need to look at the tcl to see
> how it's parsed.
>
> See
> CBQLink instproc bind args {
>
> in ~ns/tcl/lib/ns-queue.tcl
>
> L.
>
> <L.Wood@surrey.ac.uk>PGP<http://www.ee.surrey.ac.uk/Personal/L.Wood/>

--
Håkan Byström, Operax
+46 920 755 07, office
+46 70 374 03 24, cellular



--------------70A2EBE434E97E6B2A9F6BEB
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Thank you!
<p>Embarrassing enough I have to say that it was a simple mistake (lack
of ';' before a comment in the same line) in my script that was the cause
of the problem.
<p>To make the command more foolproof the following change should be made
to
<pre>CBQLink instproc bind</pre>
in ~ns/tcl/lib/ns-queue.tcl:
<pre>if { $nargs == 3 } {
&nbsp;&nbsp;&nbsp; set b [lindex $args 2]
} else {
&nbsp;&nbsp;&nbsp; set b $a
}</pre>
should be changed to
<pre>if { $nargs == 2 } {
&nbsp;&nbsp;&nbsp; set b $a
} elseif { $nargs == 3 } {
&nbsp;&nbsp;&nbsp; set b [lindex $args 2]
} else {
&nbsp;&nbsp;&nbsp; error "Wrong number of arguments to 'bind'."
}</pre>
&nbsp;
<p>&nbsp;
<p>Lloyd Wood wrote:
<blockquote TYPE=CITE>You're typing an OTcl command, so you need to look
at the tcl to see
<br>how it's parsed.
<p>See
<br>CBQLink instproc bind args {
<p>in ~ns/tcl/lib/ns-queue.tcl
<p>L.
<p>&lt;L.Wood@surrey.ac.uk>PGP&lt;<a href="http://www.ee.surrey.ac.uk/Personal/L.Wood/">http://www.ee.surrey.ac.uk/Personal/L.Wood/</a>></blockquote>

<pre>--&nbsp;
H&aring;kan Bystr&ouml;m, Operax
+46 920 755 07, office
+46 70 374 03 24, cellular</pre>
&nbsp;</html>

--------------70A2EBE434E97E6B2A9F6BEB--