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

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



Oops, I think I misintepreted your question...

I wonder if the problem comes from that you have space
between "NN" and "Mb" (assuming there is no error in
your "GetOpt" procedure). Try

set bandwidth [format "%dMb" $NN ]
set opt(bw_up)          $bandwidth

and see if that helps

Kun-chan Lan

On Tue, 4 Sep 2001, Giuseppe Tringali wrote:

> At 13.03 03/09/2001 -0700, you wrote:
> >use "split" function
> >for example,
> >
> >set arg [split $argv " " ]
> >set arguement-1 [lindex $arg 0]
> >set arguement-2 [lindex $arg 1]
> >
> >Kun-chan Lan
> 
> 
> I have not understood how this split function can help me. Could you tell 
> me something more?
> 
> (I explain better my problem. I call the script in this way: ns script.tcl 0 25
> so that 25 Mb/s is the bandwith of the link)
> 
> Thanks for your answer,
> 
> Giuseppe Tringali
> 
> 
> >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
> > >
>