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.

"subst -nobackslashes -nocommands -novariables" ?

Old posts that have not been replied to for several years.
User avatar
Adrenalin
Voice
Posts: 21
Joined: Sat Jan 29, 2005 10:32 am
Location: Moldova
Contact:

"subst -nobackslashes -nocommands -novariables" ?

Post by Adrenalin »

I trying to figured out what "subst -nobackslashes -nocommands -novariables text" are doing ?

bind ctcp - ACTION action_in
proc action_in {nick uhost hand chan key text} {
subst -nobackslashes -nocommands -novariables text
general_in $nick $uhost $hand $chan $text
}

That must be some protection ? Any example is also welcomed, thanks.
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

Que?
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

PS: lol @KrzychuG, a few sec faster ^-^

PPS: better? :P
Last edited by De Kus on Thu Feb 03, 2005 10:10 am, edited 1 time in total.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

I don't think Adrenalin was asking for the man page... more like, what is it DOING? In other words, if you call subst and tell it not to evaluate backslashes, commands, or variables, what is the point? What does it DO? Anybody have an idea? My initial guess is... it does nothing.
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

well its like for example to evaluate variables but not execute or execute but not resolve variables and so on .. for example

Code: Select all

set new_test blah
set a new
set b test
puts [subst -nocommands $a_$b]
otherwize it would say $a_ is not a variable !

i used it to create dynamic array names.

name_Array(something) data

ex:
set $nick_$chan($host) "+o"

could be done more efficient but just to give you an idea..
XplaiN but think of me as stupid
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

De Kus wrote:RTFM
http://www.tcl.tk/man/tcl8.5/TclCmd/subst.htm

PS: lol @KrzychuG, a few sec faster ^-^
i think mentioning the manual once would be sufficient
XplaiN but think of me as stupid
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Ofloo, the posted code uses -nocommands -novariables -nobackslashes all at once.

If it only used one of them, then yeah, it would have a point.. but all 3?
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

hehe sorry didn't notice he used all 3 of em
XplaiN but think of me as stupid
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

A rough guess would be that the piece of code Adrenalin posted is from some sort of channel protection script and is used for excessive "away" messages in the channel and the use of -nocommands -novariables -nobackslashes could be to get around the varied weird and wonderfull messages that are created these days (along with equally weird and wonderfull nicks) all using characters that eggdrop most of the time chokes on.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

It does nothing but waste some cpu. The string "text" doesn't contain any characters that would trigger substitutions, and the return value (text) is discarded. The author is either stupid or trying to confuse you. :)
Have you ever read "The Manual"?
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

Dont hold back user you just tell it as you see it.. :wink:
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

^DooM^ wrote:Dont hold back user you just tell it as you see it.. :wink:
LOL .. well there went my nice little theory out the window. :lol:
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

i think he just forgot a '$' infront of the word text
XplaiN but think of me as stupid
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Ofloo wrote:i think he just forgot a '$' infront of the word text
It would still do nothing. (subst doesn't modify variables...it returns the string fed to it with substitutions performed (none if all the switches are used)) :P
Have you ever read "The Manual"?
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

i know, but i don't think it was the intention of using them all i think he is learning tcl and trying to find out the use of the command
XplaiN but think of me as stupid
Locked