egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

BSD linebreaks issue revisited

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
rvwinkle
Guest





PostPosted: Sat Jun 26, 2004 11:55 am    Post subject: BSD linebreaks issue revisited Reply with quote

Hello I have asked and received much help from this forum on this and similar topics however i am still stumped by an issue my eggdrop has on bsd (mandrake works fine) with a script I pieced together to echo the contents of a file in my irc channel.

Code:

set cmd "!netstat"
bind pub -|- $cmd log:pub

proc htmltotext {text} {
  regsub -all -- {<br>} $text "\n" text
  regsub -all -- {</b>|</font>} $text { } text
  regsub -all -- {<[^>]*>} $text {} text
  regsub -all -- {&nbsp;|[<*>]} $text { } text
  return $text
}

proc log:pub {nick handle host chan text } {
  set foo [open "/www/message.txt" "r"]
  foreach line [split [read $foo] \n] {
  if {($line == "") || ($line == "\n") || ($line == "\r")} { continue }
    putserv "PRIVMSG $nick :[htmltotext \002$line\002]"
  }
  close $foo
}

bind time - "*6 % % % %" displayecho

proc displayecho {min hour day month year} {
  set foo [open "/www/message.txt" "r"]
  foreach line [split [read $foo] \n] {
  if {($line == "") || ($line == "\n") || ($line == "\r")} { continue }
    putserv "PRIVMSG #isg :[htmltotext \002$line\002]"
  }
  close $foo
}


This is what the file it echos looks like in vi

Code:

Iplanet BL, MT 2382446.^M
It's NetCool son, NetCool. It ain't that hard.^M
Baltimore edge 4 will be rebooted sometime within the next hour (4-5pm).^M
^M
 ^M
 ^M
 ^M
 ^M
 ^M
 ^M
 ^M
 ^M
 ^M
 ^M
 ^M
 ^M
 ^M
 ^M
 ^M
 ^M
 ^M
 ^M
 ^M

~


I have used eggdrop.conf to prevent dupe messages in queue to keep it from going crazy on all the windows linebreaks but I would love to keep it from pasting the one empty line I am still getting. I am thinking my issue may be the leading space on most of the ^M lines but I cant get it to stop adding one blank line at the end of its spew. Can anyone provide any additional assistance in this regard?
Back to top
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber