<?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/15285" />

	<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>2008-01-24T10:26:20-04:00</updated>

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

		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-01-24T10:26:20-04:00</updated>

		<published>2008-01-24T10:26:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80309#p80309</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80309#p80309"/>
		<title type="html"><![CDATA[strange variable printing problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80309#p80309"><![CDATA[
The first thing that comes to mind is non-blocking sockets:<br>Calling gets on a socket set up in non-blocking mode results in two possible outcomes:<ul><li><strong class="text-strong">Socket has a complete, unread line with trailing newline:</strong><br>Line will be read, the filepointer advanced, and the read text will be returned</li><li><strong class="text-strong">Socket has unread data, but no trailing newline:</strong><br>This line can't be read, as it's ont yet completed. Since we're not blocking, gets simply returns an empty line.</li></ul>@Rosc:<br>Your splitting and joining really does'nt make much sense.<div class="codebox"><p>Code: </p><pre><code>join [split "sometext"]</code></pre></div>This will always return exactly the text or data that was used in the first place... Split should only be used when you wish to convert strings into a tcl-list, and absolutely nothing else. Thinking of it as a magic fix is very dangerous. Also keep in mind that glob-matching done by string match (by default) has a completely different ruleset for escaping than lists.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Jan 24, 2008 10:26 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sparc317]]></name></author>
		<updated>2008-01-23T17:12:08-04:00</updated>

		<published>2008-01-23T17:12:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80300#p80300</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80300#p80300"/>
		<title type="html"><![CDATA[strange variable printing problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80300#p80300"><![CDATA[
Cheers for the reply, really apprecitated.<br><br>The output of putcmdlog when printing the contents just gives:<br><div class="codebox"><p>Code: </p><pre><code>[21:09] gsoutput '</code></pre></div>So its missing even the last ' off the end.<br><br>I've tried the removal of TCL special chars and newline as suggested but still no joy.<br><br>What is even more bizarre, is if I fire up a netcat listen server and paste the EXACT same string in and send it, it prints it fine!!!!! Its only when connecting to the server itself.<br><br>I know the data is there as I have TCP dumped it and it also wouldn't match otherwise.<br><br>So strange  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_cry.gif" width="15" height="15" alt=":cry:" title="Crying or Very sad"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9653">sparc317</a> — Wed Jan 23, 2008 5:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2008-01-23T16:39:54-04:00</updated>

		<published>2008-01-23T16:39:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80298#p80298</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80298#p80298"/>
		<title type="html"><![CDATA[strange variable printing problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80298#p80298"><![CDATA[
Are there carriage returns in the $gsoutput?  That'll make puthelp not print the stuff after any carriage returns.  You can use putcmdlog to check the contents of the var:<br><br>putcmdlog "gsoutput '$gsoutput'"<br><br>or:<br><br>foreach line [split $gsoutput \n] {<br>            putcmdlog "line '$line'"<br>}<br><br>If there's carriage returns, clean up $gsoutput with regsub:<br><br>regsub -all {\n} $gsoutput {} gsoutput<br><br>Also, you might need to ensure $gsoutput doesn't have tcl special chars:<br><br>set gsoutput [split $gsoutput] <br><br>would protect/escape any tcl special chars that might be present in the output, then you can use:<br><br>puthelp "PRIVMSG #admins :Pub 2 - [join $gsoutput]"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Wed Jan 23, 2008 4:39 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[sparc317]]></name></author>
		<updated>2008-01-23T11:25:29-04:00</updated>

		<published>2008-01-23T11:25:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=80292#p80292</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=80292#p80292"/>
		<title type="html"><![CDATA[strange variable printing problem]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=80292#p80292"><![CDATA[
Ok... managed to solve my sockets problem <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"> Used the awesome ::sock:: stuff that was posted here instead.<br><br>I can't for the life of me work out why this isn't working though:<br><div class="codebox"><p>Code: </p><pre><code># Handle output from the server and print chat messages to channelproc read_sock {sock} {  set gsoutput [gets $sock]   if {[string match *Chat* $gsoutput]} {    puthelp "PRIVMSG #admins :Pub 2 - $gsoutput"   }}</code></pre></div><br>That works fine, it matches the string within $gsoutput and prints the message. <br><br>HOWEVER it doesn't print the contents of $gsoutput. For example if $gsoutput contains "Chat: foobar"<br><br>It just prints in the channel "Pub 2 -" instead of "Pub 2 - Chat: foobar"<br><br>Any ideas on this?<br><br>Thanks![/code]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9653">sparc317</a> — Wed Jan 23, 2008 11:25 am</p><hr />
]]></content>
	</entry>
	</feed>
