<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/12415" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2006-09-22T21:19:08-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/12415</id>

		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2006-09-22T21:19:08-04:00</updated>

		<published>2006-09-22T21:19:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66584#p66584</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66584#p66584"/>
		<title type="html"><![CDATA[regexp doesn't identify what it should]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66584#p66584"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>if {[regexp -- {^\w+\s\s((\w+\s){1,16}).*$} $trimStr matchStr binaryLine]} {         # Skipping headers         if {[llength $binaryLine] &lt; $newByteSkip} { ... cut ...set line [ eval "binary format [string repeat "H2" $rtpHdrSkip] $binaryLine"]</code></pre></div>There are some problems with this script. Up at the top where you initialize binaryLine, it's just a string (the 1-16 bytes matched by regexp). But then you start treating it as a list (llength) which can cause errors. The biggest problem is you're passing it to "eval" which causes it to be executed. If $binaryline contains [0 ... ...] or something, then it will try to execute that. The data you posted contains a $, so that's already a potential problem.<br><br>Another overall problem is using regular expressions with binary data. I'm surprised it's even working at all.<br><br>It's hard to identify the exact problem because you haven't posted the full script. The error identifies a line number but without the full code there's no way to tell which line it's talking about.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Fri Sep 22, 2006 9:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sma]]></name></author>
		<updated>2006-09-12T12:47:00-04:00</updated>

		<published>2006-09-12T12:47:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66282#p66282</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66282#p66282"/>
		<title type="html"><![CDATA[but this error is dependent on input]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66282#p66282"><![CDATA[
i think that if the error is somewhere in the code and is unrelated to the input then the error would appear when any input is given. but it doesn't.<br>it appears only sometimes and is somehow connected to the last line of the input.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8181">sma</a> — Tue Sep 12, 2006 12:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2006-09-12T12:44:43-04:00</updated>

		<published>2006-09-12T12:44:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66281#p66281</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66281#p66281"/>
		<title type="html"><![CDATA[regexp doesn't identify what it should]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66281#p66281"><![CDATA[
the lines making the error arent pasted, must be another part of it.<br>my gues is still:<br>you try to execute the content of a variable or boolan expression, maybe too many [] or $<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Tue Sep 12, 2006 12:44 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[deadite66]]></name></author>
		<updated>2006-09-12T12:32:04-04:00</updated>

		<published>2006-09-12T12:32:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66279#p66279</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66279#p66279"/>
		<title type="html"><![CDATA[regexp doesn't identify what it should]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66279#p66279"><![CDATA[
best to wrap that in <div class="codebox"><p>Code: </p><pre><code>code tags </code></pre></div>, you might not get any help until you do.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6296">deadite66</a> — Tue Sep 12, 2006 12:32 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sma]]></name></author>
		<updated>2006-09-12T12:38:39-04:00</updated>

		<published>2006-09-12T11:42:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66276#p66276</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66276#p66276"/>
		<title type="html"><![CDATA[regexp doesn't identify what it should]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66276#p66276"><![CDATA[
Hi all,<br>i have the following file part:<br>0000  00 14 a8 ff 32 24 00 18 18 8f a6 8e 08 00 45 88   ....2$........E.<br>0010  00 83 eb 36 00 00 40 11 63 6b ac 14 e9 ae ac 14   ...6..@.ck......<br>0020  e9 68 40 00 40 00 00 6f 0f 81 80 60 00 7a 00 00   .h@.@..o...`.z..<br>0030  e4 c0 71 72 0a 32 00 10 02 b8 09 00 75 65 86 31   ..qr.2......ue.1<br>0040  74 48 1d 23 e3 ce fa 92 a4 dd a1 2a a2 9d b9 55   tH.#.......*...U<br>0050  2a 86 64 e4 ce 1d b2 a9 3a 4a 92 de d1 94 81 ad   *.d.....:J......<br>0060  17 2a 67 d6 d5 66 7d 0c 6f a5 9d 4e 55 8d fa 8c   .*g..f}.o..NU...<br>0070  14 e9 61 a3 68 92 16 36 bf ad 19 d8 6e 3e 91 22   ..a.h..6....n&gt;."<br>0080  4d 86 70 18 f3 c5 72 92 1b b2 f2 30 8e 3a 3c 76   M.p...r....0.:&lt;v<br>0090  20                               <br><br>i am using the following code on it (trimStr is ofcourse a line from the above):<div class="codebox"><p>Code: </p><pre><code>if {[regexp -- {^\w+\s\s((\w+\s){1,16}).*$} $trimStr matchStr binaryLine]} {# Skipping headersif {[llength $binaryLine] &lt; $newByteSkip} {set newByteSkip [expr $newByteSkip - [llength $binaryLine]]continue} elseif {$newByteSkip &gt; 0} {# skipping last part of headers and printing raw data# including the first part of rtp header#removing the last of the unrelevant header bytes.set binaryLine [lreplace $binaryLine 0 [expr $newByteSkip - 1]]# getting length of the rest of the lineset len [llength $binaryLine]# setting sizeset line [binary format s $Size]append line [eval "binary format [string repeat "H2" $len] $binaryLine"]set newByteSkip 0set rtpHdrSkip [expr $rtpHdrSkip - $len]puts -nonewline $outFileBinNew $line} elseif {$rtpHdrSkip &gt; 0} {# Printing the second part of the rtp header # and printing the raw data to new formatset len [llength $binaryLine]# checking if last lineif { $len &lt; 16 } {set mode $PL_MODE}set line [ eval "binary format [string repeat "H2" $rtpHdrSkip] $binaryLine"]puts -nonewline $outFileBinNew $line# Skipping the rest of the rtp header and printing raw dataset binaryLine [lreplace $binaryLine 0 [expr $rtpHdrSkip - 1]]# from here printing the rest of the payload to both new and old filesset len [llength $binaryLine]if {$len &gt; $payloadLen} {set len $payloadLen} else {set payloadLen [expr $payloadLen - $len]}if {$len == 0} {set mode $PL_MODEcontinue}set line [ eval "binary format [string repeat "H2" $len] $binaryLine"]puts -nonewline $outFileBinOld $lineputs -nonewline $outFileBinNew $lineset rtpHdrSkip 0} else {# print raw dataset len [llength $binaryLine]if {$len &gt; $payloadLen} {set len $payloadLen} else {set payloadLen [expr $payloadLen - $len]}if {$len == 0} {set mode $PL_MODEcontinue}set line [ eval "binary format [string repeat "H2" $len] $binaryLine"]puts -nonewline $outFileBinNew $lineputs -nonewline $outFileBinOld $lineif { $len  &lt; 16 } {set mode $PL_MODE}}} elseif {[regexp -- {^Frame.*bytes\scaptured\)$} $trimStr]} {set mode $PL_MODE} else {continue}</code></pre></div>the problem is the last line is not identified by the regexp although it should. when i add a non-space character among the spaces of the last line, it is identified but i get the following error message:<br><br>invalid command name "0"<br>    while executing<br>"0"<br>    ("while" body line 204)<br>    invoked from within<br>"while {[gets $inFile readBuff] !=<br><br>        incr progBar<br>        if {$progBar == 100} {<br>                set progBar 0<br>                puts -nonewline ".<br>                flush stdout<br>        }<br>        set trimStr ..."<br>    (file "ether2mf.tcl" line 136)<br>Help please!!!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8181">sma</a> — Tue Sep 12, 2006 11:42 am</p><hr />
]]></content>
	</entry>
	</feed>
