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

	<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>2002-10-27T07:36:09-04:00</updated>

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

		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-10-27T07:36:09-04:00</updated>

		<published>2002-10-27T07:36:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12450#p12450</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12450#p12450"/>
		<title type="html"><![CDATA[Double Output...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12450#p12450"><![CDATA[
Yes.<br><br>When you open a application, you can read from it an so on.<br><br>Afterwards, the application space needs cleraring.<br><br>When using the "open" command to do this, you should treak the file socket, the file as opening a normal file. It needs closing.<br><br>As allready mentioned, is there realy a need to to use the "/bin/date" program?<br><br>Tcl is much faster with it's builtin code, and it doesn't give you these hectic problems.<br><br>Tcl can also be told to return the date the the format you wan't it.<br><br>Another sugestion, is to use the "exec" command with programs. This will rmeove much of your issues.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sun Oct 27, 2002 7:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-10-27T06:11:10-04:00</updated>

		<published>2002-10-27T06:11:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12446#p12446</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12446#p12446"/>
		<title type="html"><![CDATA[Allright, but there is still one problem....]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12446#p12446"><![CDATA[
I changed my code to this: <div class="codebox"><p>Code: </p><pre><code>bind pub - ?date pub:dateproc pub:date {nick uhost hand chan text} {set input [open "|/bin/date" r]catch {set contents [gets $input]}putserv "PRIVMSG $chan :$nick: $contents"}</code></pre></div>But the date will hang up, hm, how should i explain this, hm, if i type ps ax, at my shell, it will display that the program has become defunct:<br>#elajt: ps ax |grep date<br><strong class="text-strong">7621 ?        Z      0:00 [date &lt;defunct&gt;]</strong><br><br>This is without doubt a security risk, anyone knows how to prevent it?<br><br>Thanx //Elajt<p>Statistics: Posted by Guest — Sun Oct 27, 2002 6:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[egghead]]></name></author>
		<updated>2002-10-27T05:18:10-04:00</updated>

		<published>2002-10-27T05:18:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12444#p12444</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12444#p12444"/>
		<title type="html"><![CDATA[Re: It works now]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12444#p12444"><![CDATA[
<blockquote class="uncited"><div>Thanx! I deleted that while loop, so now it works.. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"></div></blockquote>Actually, the problem is (was) due to the fact that you used a "while {![eof $input]}" construction. The eof is only set AFTER the last read. So after a last (unsuccessfull) read, the eof is set and the while loop stops.<br><br>If there is a one line file named "testfile.dat", with the one line being "hello world" then running this piece:<br><div class="codebox"><p>Code: </p><pre><code>set fileid [open testfile.dat r]while {![eof $fileid]} {    puts "LINE: [gets $fileid]"} close $fileid</code></pre></div>will produce as output:<br><blockquote class="uncited"><div>LINE: hello world<br>LINE: </div></blockquote>This file reading business is a very good candidate for the TCL FAQ <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Additionally and more serious is the fact that you use /bin/date to retrieve the date. On my shell system your code or the [exec /bin/date] against a [clock seconds] combined with a [clock format] runs as:<br><blockquote class="uncited"><div>2400 microseconds per iteration (/bin/date)<br>23 microseconds per iteration (clock seconds &amp; clock format)</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=282">egghead</a> — Sun Oct 27, 2002 5:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-10-27T04:11:57-04:00</updated>

		<published>2002-10-27T04:11:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12442#p12442</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12442#p12442"/>
		<title type="html"><![CDATA[It works now]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12442#p12442"><![CDATA[
Thanx! I deleted that while loop, so now it works.. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by Guest — Sun Oct 27, 2002 4:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tainted]]></name></author>
		<updated>2002-10-26T22:27:13-04:00</updated>

		<published>2002-10-26T22:27:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12436#p12436</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12436#p12436"/>
		<title type="html"><![CDATA[Double Output...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12436#p12436"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>catch {set input [exec /bin/date]}</code></pre></div>then just putserv $input, without the while loop. Since date only returns one line, you shouldn't need the while loop at all. (didn't test it myself)<br><br>Also, you didn't close the opened file at the end, which will create zombies.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1256">tainted</a> — Sat Oct 26, 2002 10:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2002-10-26T21:39:40-04:00</updated>

		<published>2002-10-26T21:39:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12435#p12435</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12435#p12435"/>
		<title type="html"><![CDATA[Re: Double Output...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12435#p12435"><![CDATA[
<blockquote class="uncited"><div>Here is the source: <br><div class="codebox"><p>Code: </p><pre><code>bind pub - ?date pub:dateproc pub:date {nick uhost hand chan text} {set input [open "|/bin/date" r]while {![eof $input]} {        catch {set contents [gets $input]}        putserv "PRIVMSG $chan :$nick: $contents"   }} </code></pre></div>*NOTE: <br>This wont happen if i replaces row 9 with this:<br>putserv "PRIVMSG $chan :$contents" <br>*NOTE</div></blockquote>The reason for this is because of the irc protocol, not your code...<br>You can't send a blank message on irc, thus if $contents is empty, you would be attempting to send an empty message to irc, which you can't do.. by adding $nick to the output, the output to server is no longer empty.<br><br>The problem lays in the output relayed from the program you are executing... Thus you should check if $contents is empty or not before sending output to server.<br><br>Hope this helps.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Sat Oct 26, 2002 9:39 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-10-26T21:26:27-04:00</updated>

		<published>2002-10-26T21:26:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=12433#p12433</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=12433#p12433"/>
		<title type="html"><![CDATA[Double Output...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=12433#p12433"><![CDATA[
I got this little problem, the script tells me the message twice, but the $contents variable is only in the first message. <br><br>Here is the output:<br><br>[02:18:56] &lt;CopyWrong&gt; ?date<br>[02:18:57] &lt;Elajt&gt; CopyWrong: Sun Oct 27 02:22:44 CET 2002<br>[02:18:58] &lt;Elajt&gt; CopyWrong: <br><br>Here is the source: <br><div class="codebox"><p>Code: </p><pre><code>bind pub - ?date pub:dateproc pub:date {nick uhost hand chan text} {set input [open "|/bin/date" r]while {![eof $input]} {        catch {set contents [gets $input]}        putserv "PRIVMSG $chan :$nick: $contents"   }} </code></pre></div>*NOTE: <br>This wont happen if i replaces row 9 with this:<br>putserv "PRIVMSG $chan :$contents" <br>*NOTE<br><br>How can i stop that? <br>Thanx!<p>Statistics: Posted by Guest — Sat Oct 26, 2002 9:26 pm</p><hr />
]]></content>
	</entry>
	</feed>
