Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > GNU AWK Pastebi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 2182 of 2317
Post > Topic >>

GNU AWK Pastebin

by "Scott S. McCoy" <tag@[EMAIL PROTECTED] > Mar 10, 2008 at 05:14 AM

So recently I've completed a long time work in progress that I thought I 
would share with you all.  Some years ago I wrote an IRC bot in GNU awk 
for the #awk IRC channel of freenode.  I originally intended to build a 
psate bin, but I ran into a few stumbling blocks based around awk's lack 
of being able to handle signals, not block on reads when data is not 
present, so forth...So in the mean time I built out awkbot, bit by bit, 
adding simple things like karma counting, factoids, the ability to scan 
the awk man and info pages and arbitrary arithmetic to it (using mysql 
and a mysql "library" I wrote which pipes to and from mysql client and 
uses tempfiles, and bc among other things).  Giving her about 10 hours a 
year worth of attention, she started to look quite nice.

Then one day I figured out how to do the IPC.  I replaced GNU awk's 
special co-process and internet filename usage with a general wrapper 
around netcat.  I built a bootstrap which allocates a tempfile, and 
stores the name of it in the awkbot database.  I then created a wrapper 
script which executes the bootstrap and then invokes awkbot.  I created 
my wrapper around netcat with the ability to read from an arbitrarily 
specified tempfile.  Awkbot configures the library and then proceeds to 
use it to connect to the IRC server.

Awkpaste, the paste-bin extension then opens connections to the same 
database, and when a paste is submitted injects a special non-IRC-
protocol string into the "stream" awkbot gets it's IRC data from, 
indicating it should relay a message to the #awk IRC channel to re****t a 
paste.

The awkpaste CGI will, given a query string parameter of an id, look up 
the paste of the specified key and pipe it through highlight(1) or vim, 
depending on how the macros are setup (I should mention for modularity 
I've been heavily abusing the C pre-processor).

More about it here:
http://www.blisted.org/wiki/blog/2008/Mar/01/19.53.49.html

The source can be browsed here:
http://www.blisted.org/browser/trunk/awkbot/
 




 5 Posts in Topic:
GNU AWK Pastebin
"Scott S. McCoy"  2008-03-10 05:14:50 
Re: GNU AWK Pastebin
"Scott S. McCoy"  2008-03-11 00:30:45 
Re: GNU AWK Pastebin
Ed Morton <morton@[EMA  2008-03-11 00:11:11 
Re: GNU AWK Pastebin
Kees Nuyt <k.nuyt@[EMA  2008-03-12 00:27:02 
Re: GNU AWK Pastebin
Exal de Jesus Garcia Carr  2008-03-11 17:46:23 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 15:18:50 CDT 2008.