This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Traceroute...

Old posts that have not been replied to for several years.
Locked
e
elajt

Traceroute...

Post by elajt »

I just can’t get this right, should it be with or without $text?
There is one error that says that the arguments are wrong, what does this mean? And how should I change it? This is strange I think, because usually, when redesiged this script to use another command, like reading from a document, it works.. :-?

Here's the script:

Code: Select all

bind pub o ?access pub:traceroute

proc pub:traceroute {nick uhost hand chan text} {
set input [open "|/bin/traceroute $text" r]      

while {![eof $input]} {
catch {set contents [gets $input]}
putserv "NOTICE $nick :$contents"
}
close $input
}
And here is the error i get :x :

Code: Select all

Tcl error [pub:trace]: wrong # args: should be "catch command ?varName?"
...
t
tainted
Master
Posts: 239
Joined: Sun May 12, 2002 8:00 pm
Location: chicago
Contact:

Post by tainted »

I can't see anything wrong with that code offhand, perhaps try a .restart to clear out any previous 'test' versions of the script? That catch command is in perfect working order, though it may be something with the data fed into it from $input. A pair of "s might help around the gets command although.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

As well as this, you could use the "exec" command instead.

While exec is gurenteed to block, unlike open, the way this traceroute script is setup, it would block anyway, so there is no real disadvantage to using this.

Instead if using gets or read to read the ouput from the open file pointer, the data is simply returned to the variable straight away.

You simply split the output using \n, and output each line.
e
elajt

Post by elajt »

Ok, thanx!
Locked