[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] TCL script - Problem with commandline argument



use "split" function
for example,

set arg [split $argv " " ]
set arguement-1 [lindex $arg 0]
set arguement-2 [lindex $arg 1]

Kun-chan Lan

On Sat, 1 Sep 2001, Giuseppe Tringali wrote:

> Hi NS users
> 
> I have modified the script sat-repeater.tcl to pass two arguments from 
> commandline.
> 
> The problem is with the second argument: the bandwith of the link.
> 
> set NN [lindex $argv 1] --> in $NN I find the second argument
> 
> set opt(bw_up)          $NN Mb; # Uplink bandwidth-- becomes downlink bw 
> also --> but in this way the assignement is not correct
> 
> (Below my signature you can find the first lines of the script)
> 
> Where's my mistake? Could you help me?
> 
> Thanks in advance,
> Giuseppe Tringali
> 
> 
> This is the beginning of the script:
> 
> if {$argc != 2} {
> puts "ERROR! ns called with wrong number of arguments!($argc)"
> exit 1
> } else {
> set arg [lindex $argv 0]
> 
> set NN [lindex $argv 1]
> 
> global ns
> set ns [new Simulator]
> $ns rtproto Dummy; # Using C++ routing agents and objects
> 
> # Global configuration parameters
> 
> global opt
> set opt(chan)           Channel/Sat
> set opt(bw_up)          $NN Mb; # Uplink bandwidth-- becomes downlink bw also
>