Function: $left()
Usage:    $left(number text)
Returns:  the <number> leftmost characters in <text>.
Example:  $left(5 the quick brown frog) returns "the q"

Function: $getkey()
Usage:    $getkey(channel)
Returns:  the channel key if there is one.
Example:  $getkey(#BitchX) should return nothing ;)

Function: $right()
Usage:    $right(number text)
Returns:  the <number> rightmost characters in <text>.
Example:  $right(5 the quick brown frog) returns " frog"

Function: $mid()
Usage:    $mid(start number text)
Returns:  the <start>th through <start>+<number>th characters in <text>.
Example:  $mid(3 4 the quick brown frog) returns " qui"
Notes:     the first character is numbered zero.

Function: $rand()
Usage:    $rand(max)
Returns:  A random number from zero to max-1.
Example:  $rand(10) might return any number from 0 to 9.

Function: $srand()
Usage:    $srand(seed)
Returns:  Nothing.
Side effect: seeds the random number generater.
Notes:     the argument is ignored.

Function: $time()
Usage:    $time()
Returns:  The number of seconds that has elapsed since Jan 1, 1970, GMT.
Example:  $time() returned something around 802835348 at the time I wrote         this comment.

Function: $stime()
Usage:    $stime(time)
Returns:  The human-readable form of the date based on the <time> argument.
Example:  $stime(1000) returns what time it was 1000 seconds from the epoch.
Notes:     $stime() is really useful when you give it the argument $time(),          ala $stime($time()) is the human readable form for now.

Function: $tdiff()
Usage:    $tdiff(seconds)
Returns:  The time that has elapsed represented in days/hours/minutes/seconds
          corresponding to the number of seconds passed as the argument.
Example:  $tdiff(3663) returns "1 hour 1 minute 3 seconds"

Function: $index()
Usage:    $index(characters text)
Returns:  The number of leading characters in <text> that do not occur
          anywhere in the <characters> argument.
Example:  $index(f three fine frogs) returns 6 (the 'f' in 'fine')
          $index(frg three fine frogs) returns 2 (the 'r' in 'three')

Function: $rindex()
Usage:    $rindex(characters text)
Returns:  The number of leading characters in <text> that occur before the
          *last* occurance of any of the characters in the <characters>
          argument.
Example:  $rindex(f three fine frogs) returns 12 (the 'f' in 'frogs')
          $rindex(frg three fine frogs) returns 15 (the 'g' in 'frogs')

Function: $match()
Usage:    $match(pattern list of words)
Returns:  if no words in the list match the pattern, it returns 0.
          Otherwise, it returns the number of the word that most
          exactly matches the pattern (first word is numbered one)
Example:  $match(f*bar foofum barfoo foobar) returns 3
          $match(g*ant foofum barfoo foobar) returns 0
Notes:    it is possible to embed spaces inside of a word or pattern simply
          by including the entire word or pattern in quotation marks. (")

Function: $rmatch()
Usage:    $rmatch(word list of patterns)
Returns:  if no pattern in the list matches the word, it returns 0.
          Otherwise, it returns the number of the pattern that most
          exactly matches the word (first word is numbered one)
Example:  $rmatch(foobar f*bar foo*ar g*ant) returns 2
          $rmatch(booya f*bar foo*ar g*ant) returns 0
Notes:    It is possible to embed spaces into a word or pattern simply by
          including the entire word or pattern within quotation marks (")

Function: $userhost()
Usage:    $userhost()
Returns:  the userhost (if any) of the most previously recieved message.
Notes:    $userhost() changes with every single line that appears on your
          screen, so if you want to save it, you will need to assign it to
          a variable.

Function: $strip()
Usage:    $strip(characters text)
Returns:  <text> with all instances of any characters in the <characters>
          argument removed.
Example:  $strip(f free fine frogs) returns "ree ine rogs"
Notes:    it can be difficult (actually, not possible) to remove spaces from
          a string using this function.  To remove spaces, simply use this:
             $tr(/ //$text)
          Actually, i recommend not using $strip() at all and just using
             $tr(/characters//$text)
          (but then again, im biased. >;-)

Function: $encode()
Usage:    $encode(text)
Returns:  a string, uniquely identified with <text> such that the string
          can be used as a variable name.
Example:  $encode(fe fi fo fum) returns "GGGFCAGGGJCAGGGPCAGGHFGN"
Notes:    $encode($decode(text)) returns text (most of the time)
          $decode($encode(text)) also returns text.

Function: $decode()
Usage:    $decode(text)
Returns:  If <text> was generated with $encode(), it returns the string
          you originally encoded.  If it wasnt, you will probably get
          nothing useful in particular.
Example:  $decode(GGGFCAGGGJCAGGGPCAGGHFGN) returns "fe fi fo fum"
Notes:    $encode($decode(text)) returns "text"
          $decode($encode(text)) returns "text" too.
          Yes.  $decode(plain-text) does compress the data by a factor of 2.
          But it ignores non-ascii text, so use this as compression at your
          own risk and peril.

Function: $ischannel()
Usage:    $ischannel(text)
Returns:  If <text> could be a valid channel name, 1 is returned.
          If <text> is an illegal channel name, 0 is returned.
Example:  $ischannel(i_am_not_on_this_channel) returns 0
          $ischannel(#i_am_not_on_this_channel) returns 1
Notes:    Contrary to popular belief, this function does NOT determine
          whether a given channel name is in use!

Function: $ischanop()
Usage:    $ischanop(nick channel)
Returns:  1 if <nick> is a channel operator on <channel>
          0 if <nick> is not a channel operator on <channel>
                  * O R *
          if you are not on <channel>
Notes:    Contrary to popular belief, this function can only tell you
          who the channel operators are for channels you are already on!
Boo Hiss: This should be $ischanop(channel nick <nick...nick>)
          and return a list (1 1 ... 0), which would allow us to
          call is_chanop() without ripping off the nick, and allow
          us to abstract is_chanop() to take a list. oh well...
          Too late to change it now. :/

Function: $word()
Usage:    $word(number text)
Returns:  the <number>th word in <text>.  The first word is numbered zero.
Example:  $word(3 one two three four five) returns "four" (think about it)

Function: $winnum()
Usage:    $winnum()
Returns:  the index number for the current window
Notes:    returns -1 if there are no windows open (ie, in dumb mode)

Function: $winnam()
Usage:    $winnam()
Returns:  the current window name if any.

Function: $connect()
Usage:    $connect(host port)
Returns:  the socket number to use for read/write.

Function: $listen()
Usage:    $listen(port)
Returns:  the port allocated for the RAW_LISTEN

Function: $toupper()
Usage:    $toupper(string)
Returns:  the upper case string.

Function: $tolower()
Usage:    $tolower(string)
Returns:  the lower case string.

Function: $curpos()
Usage:    $curpos()
Returns:  returns current position in window buffer

Function: $mychannels()
Usage:    $channels()
Returns:  the channels you are currently in

# Function: $servers()
# Usage:    $servers()
# Returns:  the list of servers.

Function: $pid()
Usage:    $pid()
Returns:  the pid of the process

Function: $ppid()
Usage:    $ppid()
Returns:  the parent pid of the process.

Function: $strftime()
Usage:    $strftime(time format)
Returns:  the formatted time str for time. if time is omitted then current
          time is used. man strftime for the format specs.

Function: $idle()
Usage:    $idle()
Returns:  the idle time.

Function: $before()
Usage:    $before(chars string of text)
Returns:  the part of "string of text" that occurs before the
          first instance of any character in "chars"
Example:  $before(! hop!jnelson@iastate.edu) returns "hop"

Function: $after()
Usage:    $after(chats string of text)
Returns:  the part of "string of text" that occurs after the
          first instance of any character in "chars"
Example:  $after(! hop!jnelson@iastate.edu)  returns "jnelson@iastate.edu"

Function: $leftw()
Usage:    $leftw(num string of text)
Returns:  the left "num" words in "string of text"
Example:  $leftw(3 now is the time for) returns "now is the"

Function: $rightw()
Usage:    $rightw(num string of text)
Returns:  the right num words in "string of text"
Example:  $rightw(3 now is the time for) returns "the time for"

Function: $midw()
Usage:    $midw(start num string of text)
Returns:  "num" words starting at word "start" in the string "string of text"
Example:  $midw(2 2 now is the time for) returns "the time"
Notes:    The first word is word #0.

Function: $notw()
Usage:    $notw(num string of text)
Returns:  "string of text" with word number "num" removed.
Example:  $notw(3 now is the time for) returns "now is the for"
Notes:     The first word is numbered 0.

Function: $restw()
Usage:    $restw(num string of text)
Returns:  "string of text" that occurs starting with and including
          word number "num"
Example:  $restw(3 now is the time for) returns "time for"
Notes:    the first word is numbered 0.
 
Function: $remw()
Usage:    $remw(word string of text)
Returns:  "string of text" with the word "word" removed
Example:  $remw(the now is the time for) returns "now is time for"
 
Function: $insertw()
Usage:    $insertw(num word string of text)
Returns:  "string of text" such that "word" is the "num"th word
          in the string.
Example:  $insertw(3 foo now is the time for) returns "now is the foo time for"
Notes:    the first word is numbered 0.
 
Function: $chngw()
Usage:    $chngw(num word string of text)
Returns:  "string of text" such that the "num"th word is removed
          and replaced by "word"
Example:  $chngw(3 foo now is the time for) returns "now is the foo for"
Notes:    the first word is numbered 0
 
Function: $common()
Usage:    $common (string of text / string of text)
Returns:  Given two sets of words seperated by a forward-slash '/', returns
          all words that are found in both sets.
Example:  $common(one two three / buckle my two shoe one) returns "one two"
Notes:    returned in order found in first string.

Function: $diff()
Usage:    $diff(string of text / string of text)
Returns:  given two sets of words, seperated by a forward-slash '/', returns
          all words that are not found in both sets
Example:  $diff(one two three / buckle my three shoe)
          returns "one two buckle my shoe"

Function: $pattern()
Usage:    $pattern(pattern string of words)
Returns:  given a pattern and a string of words, returns all words that
          are matched by the pattern
Example:  $pattern(f* one two three four five) returns "four five"
 
Function: $filter()
Usage:    $filter(pattern string of words)
Returns:  given a pattern and a string of words, returns all words that are
          NOT matched by the pattern
Example:  $filter(f* one two three four five) returns "one two three"
 
Function: $rpattern()
Usage:    $rpattern(word list of patterns)
Returns:  Given a word and a list of patterns, return all patterns that
          match the word.
Example:  $rpattern(jnelson@iastate.edu *@* jnelson@* f*@*.edu)
          returns "*@* jnelson@*"
 
Function: $rfilter()
Usage:    $rfilter(word list of patterns)
Returns:  given a word and a list of patterns, return all patterns that
          do NOT match the word
Example:  $rfilter(jnelson@iastate.edu *@* jnelson@* f*@*.edu)
          returns "f*@*.edu"

Function: $copattern()
Usage:    $copattern(pattern var_1 var_2)
Returns:  Given a pattern and two variable names, it returns all words
          in the variable_2 corresponding to any words in variable_1 that
          are matched by the pattern
Example:  @nicks = [hop IRSMan skip]
          @userh = [jnelson@iastate.edu irsman@iastate.edu sanders@rush.cc.edu]
          $copattern(*@iastate.edu userh nicks)
          returns "hop IRSMan"

Function: $beforew()
Usage:    $beforew(pattern string of words)
Returns:  the portion of "string of words" that occurs before the
          first word that is matched by "pattern"
Example:  $beforew(three one two three o leary) returns "one two"

Function: $tow()
Usage:    $tow(pattern string of words)
Returns:  the portion of "string of words" that occurs before the
          first word that is matched by "pattern" included word
Example:  $tow(panasync BitchX by panasync) returns "BitchX by panasync"

Function: $afterw()
Usage:    $afterw(number)
Returns:  the string after the word being matched

Function: $fromw()
Usage:    $fromw(pattern word1 ?word2? ... ?wordN?)
Returns:  the string starting with the word being matched
Example:  $fromw(asf asdf asf asdf) returns "asf asdf"

Function: $splice()
Usage:    $splice(variable start length)
Returns:  APPEARS to return a list of words starting with word "start"
          of the variable, of length "length"
Example:  assign cres.data.1 Cres... nuttin' but a smooth 100% /dev/zero
          $splice(cres.data.1 4 3) returns "smooth 100% /dev/zero"
Notes:    Not sure, but I think the first word is zero (thats pretty
          standard)

Function: $numonchannel()
Usage:    $numonchannel(channel)
Returns:  the number of users on a channel. if channel is omitted then the
          current channel is used.

Function: $onchannel()
Usage:    $onchannel(channel) * OR * $onchannel(nick)
Returns:  sorted list of nicks (channel) or if the nick is on channel
          If no args, sorted list of nicks for current channel is returned.
          Current channel is also used for (nick) test.

# Function: $channelnicks()
# Usage:    $channelnicks(channel)
# Returns:  chops in a comma separated list.

Function: $chops()
Usage:    $chops(channel)
Returns:  chops in a space separated list.

Function: $nochops()
Usage:    $nochops(channel)
Returns:  nops in a space separated list.

Function: $key()
Usage:    $key(channel)
Returns:  channel key or "*" if none.

Function: $revw
Usage:    $revw(words)
Returns:  reverses the words.
Example:  $revw(this rules) returns "rules this"

Function: $reverse()
Usage:    $reverse(words)
Returns:  reverses the chars in the words.
Example:  $reverse(this riles) returns "selur siht"

Function: $strstr()
Usage:    $strstr(needle haystack)
Returns:  a list of words from the first "needle" in "haystack" to the end
          of "haystack"
Example:  $strstr(needle there is a needle in this haystack)
          returns "needle in this haystack"

Function: $jot()
Usage:    $jot(val1 val2 ?step?)
Returns:  list of #'s from val1 to val2 by options ?step?, decreasing OR
          increasing
Example:  $jot(9 5 2) returns "9 7 5"

Function: $shift()
Usage:    $shift(word1 word2)
Returns:  appears to append word1 to word2 ;)

# Function: $unshift()
# Usage:    $unshift(arg1 arg2)
# Returns:  ???????????
# Example:  ???????????

Function: $tdiff2()
Usage:    $tdiff2(timestr)
Returns:  like tdiff but with d, h, m, s
Example:  $tdiff(1234) returns 20m 34s

Function: $winchan()
Usage:    $winchan(#channel <server refnum|server name>)
Returns:  The refnum of the window where the channel is the current channel
          on the server refnum or server name.
          returns -1 on error

Function: $crypt()
Usage:    $crypt(password seed)
Returns:  a 13-char encrypted string when given a seed and password. 
          Returns zero (0) if one or both args missing. Additional
          args ignored.
Notes:    Password truncated to 8 chars. Spaces allowed, but password
          must be inside "" quotes.

Function: $pad()
Usage:    $pad(N string of text goes here)
Returns:  a padded string of text, either left or right. Final length is
          N chars.
Notes:    if N is negative, it'll pad to the right
          if N is positive, it'll pad to the left
Example:  $pad(20 letters) returns "             letters"

Function: $uniq()
Usage:    $uniq (string of text)
Returns:  Given a set of words, returns a new set of words with duplicates
          removed.
Example:  $uniq(one two one two) returns "one two"

Function: $sar()
Usage:    $sar(c/search/replace/data)
Commands:
                r - treat data as a variable name and
                    return the replaced data to the variable
                g - Replace all instances, not just the first one
   The delimiter may be any character that is not a command (typically /)
   The delimiter MUST be the first character after the command
   Returns empty string on error


Function: $push()
Usage:    $push(var word1 word2 ... wordN)
Returns:  The value of $var with the given words appended to it (the var
          need not previously exist)
Example:  $push(newvar this is a new variable) returns "this is a new
          variable", provided $newvar does not exist.

#Function: $pop()
#Usage:    $pop(varname)
#Returns:  The value removed from varname.
#Notes:    This function removes the LAST "word" in $varname

Function: $center()
Usage:    $center(width string)
Returns:  Returns the string centered in "width" chars
Notes:    The string is truncated from the right, so the returned length
          is NOT "width".
Example:  $center(30 BitchX) returns "            BitchX"

Function: $split()
Usage:    $split(splitstring stringtosplit)
Returns:  a list composed of "stringtosplit" split using "splitstring"
Example:  $split(a abacadaeaf) returns " b c d e f"

Function: $chr()
Usage:    $chr(num [num2] ... [numN])
Returns:  the ascii char(s) the given "num(s)"
Example:  $chr(120 121 122) returns "xyz"

Function: $ascii()
Usage:    $ascii(char [char2] ... [charN])
Returns:  the ASCII value of the given chars
Note:     the arguments of $ascii() are NOT whitespaced.
Example:  $ascii(xyz) returns "120 121 122"

Function: $which()
Usage:    $which(filename)
Returns:  the absolute path of any file in ~/.BitchX
Example:  $which(BitchX.help) returns (on my box)
          "/home/by-tor/.BitchX/BitchX.help"

Function: $isalpha()
Usage:    $isalpha(char)
Returns:  1 or 0 if char alpha or not
Example:  $isalpha(6) returns 0

Function: $isdigit()
Usage:    $isdigit(digit)
Returns:  1 or 0 if digit is a digit or not
Example:  $isdigit(4) returns 1

Function: $isnum()
Usage:    $isnum(num)
Returns:  1 or 0 if num is a number or not
Example:  $isnum(44) returns 1

Function: $open()
Usage:    $open(filename mode)
Returns:  File handler # for the opened file, if successful. Nothing if
          unsuccessful.
Example:  $open($ctoolz_dir/BitchX.quits R) returns a # (should, if it
          exists.
Notes:    Possible flags are listed below...

Function: $close()
Usage:    $close(filenum)
Returns:  0 or -1, if closing the file handler "filenum" was successful or
          unsuccessful, respectively.
Example:  $close(99999999999999) returns -1 (hopefully)

Function: $writeb()
Usage:    $writeb(filenum text)
Returns:  The number of chars written to filenum
Example:  $open(pfft W) returns 10
          $writeb(10 pfft) returns 4

Function: $read()
Usage:    $read(filenum bytes)
Returns:  text read from the file opend by file handler "filenum"
Example:  (none)

Function: $eof()
Usage:    $eof()
Returns:  
Example:  

Function: $iptoname()
Usage:    $iptoname()
Returns:  
Example:  

Function: $nametoip()
Usage:    $nametoip()
Returns:  
Example:  

Function: $convert()
Usage:    $convert()
Returns:  
Example:  

Function: $translate()
Usage:    $translate()
Returns:  
Example:  

Function: $server_version()
Usage:    $server_version()
Returns:  
Example:  

Function: $unlink()
Usage:    $unlink()
Returns:  
Example:  

Function: $rename()
Usage:    $rename()
Returns:  
Example:  

Function: $rmdir()
Usage:    $rmdir()
Returns:  
Example:  

Function: $truncate()
Usage:    $truncate()
Returns:  
Example:  

Function: $utime()
Usage:    $utime()
Returns:  
Example:  

Function: $stripansi()
Usage:    $stripansi()
Returns:  
Example:  

Function: $stripansicodes()
Usage:    $stripansicodes()
Returns:  
Example:  

Function: $stripmirc()
Usage:    $stripmirc()
Returns:  
Example:  

Function: $servername()
Usage:    $servername()
Returns:  
Example:  

Function: $lastserver()
Usage:    $lastserver()
Returns:  
Example:  

Function: $winquery()
Usage:    $winquery()
Returns:  
Example:  

Function: $winserv()
Usage:    $winserv()
Returns:  
Example:  

Function: $numwords()
Usage:    $numwords()
Returns:  
Example:  

Function: $strlen()
Usage:    $strlen()
Returns:  
Example:  

Function: $fexist()
Usage:    $fexist()
Returns:  
Example:  

Function: $fsize()
Usage:    $fsize()
Returns:  
Example:  

Function: $info()
Usage:    $info()
Returns:  
Example:  

Function: $channelmode()
Usage:    $channelmode()
Returns:  
Example:  

Function: $geom()
Usage:    $geom()
Returns:  
Example:  

Function: $pass()
Usage:    $pass()
Returns:  
Example:  

Function: $uptime()
Usage:    $uptime()
Returns:  
Example:  

Function: $eleet()
Usage:    $eleet()
Returns:  
Example:  

Function: $cool()
Usage:    $cool()
Returns:  
Example:  

Function: $cool2()
Usage:    $cool2()
Returns:  
Example:  

Function: $annoy()
Usage:    $annoy()
Returns:  
Example:  

Function: $cluster()
Usage:    $cluster()
Returns:  
Example:  

Function: $checkshit()
Usage:    $checkshit(userhost channel)
Returns:  
Example:  

Function: $checkuser()
Usage:    $checkuser(userhost channel)
Returns:  
Example:  

Function: $checkbot()
Usage:    $checkbot(userhost, channel)
Returns:  
Example:  

Function: $getinfo()
Usage:    $getinfo(nick)
Returns:  
Example:  

Function: $setinfo()
Usage:    $setinfo(nick info)
Returns:  
Example:  

Function: $rot13()
Usage:    $rot13()
Returns:  
Example:  

Function: $flash()
Usage:    $flash()
Returns:  
Example:  

Function: $repeat()
Usage:    $repeat()
Returns:  
Example:  

Function: $bcopy()
Usage:    $bcopy()
Returns:  
Example:  

Function: $epic()
Usage:    $epic()
Returns:  
Example:  

Function: $winsize()
Usage:    $winsize()
Returns:  
Example:  

Function: $umode()
Usage:    $umode()
Returns:  
Example:  

Function: $lastnotice()
Usage:    $lastnotice()
Returns:  
Example:  

Function: $lastmessage()
Usage:    $lastmessage()
Returns:  
Example:  

Function: $addtabkey()
Usage:    $addtabkey(nick array)
Returns:  
Example:  

Function: $gettabkey()
Usage:    $gettabkey(direction array)
Returns:  
Example:  

Function: $sort()
Usage:    $sort()
Returns:  
Example:  

Function: $notify()
Usage:    $notify(on/off/serv #)
Returns:  
Example:  

Function: $numsort()
Usage:    $numsort()
Returns:  
Example:  

Function: $glob()
Usage:    $glob()
Returns:  
Example:  

Function: $userver()
Usage:    $userver()
Returns:  
Example:  

Function: $mkdir()
Usage:    $mkdir()
Returns:  
Example:  

Function: $umask()
Usage:    $umask()
Returns:  
Example:  

Function: $help()
Usage:    $help()
Returns:  
Example:  

Function: $isuser(nick userhost)
Usage:    $isuser(nick userhost)
Returns:  
Example:  

Function: $isban()
Usage:    $isban(channel ban)
Returns:  
Example:  

Function: $banonchannel()
Usage:    $banonchannel(channel ban)
Returns:  
Example:  

Function: $isop()
Usage:    $isop(channel nick)
Returns:  
Example:  

Function: $isvoice()
Usage:    $isvoice(channel nick)
Returns:  
Example:  

Function: $randomnick()
Usage:    $randomnick()
Returns:  
Example:  

Function: $openserver()
Usage:    $openserver()
Returns:  
Example:  

Function: $closeserver()
Usage:    $closeserver()
Returns:  
Example:  

Function: $readserver()
Usage:    $readserver()
Returns:  
Example:  

Function: $writeserver()
Usage:    $writeserver()
Returns:  
Example:  

Function: $cparse()
Usage:    $cparse()
Returns:  
Example:  

Function: $getreason()
Usage:    $getreason()
Returns:  
Example:  

Function: $chmod()
Usage:    $chmod()
Returns:  
Example:  

Function: $twiddle()
Usage:    $twiddle()
Returns:  
Example:  

Function: $uhost()
Usage:    $uhost(nick)
Returns:  
Example:  

Function: $numdiff()
Usage:    $numdiff()
Returns:  
Example:  

Function: $winvisible()
Usage:    $winvisible()
Returns:  
Example:  

Function: $mircansi()
Usage:    $mircansi()
Returns:  
Example:  

Function: $winrefs()
Usage:    $winrefs()
Returns:  
Example:  

Function: $getenv()
Usage:    $getenv()
Returns:  
Example:  

Function: $gethost(nick)
Usage:    $gethost(nick)
Returns:  
Example:  

Function: $getvar()
Usage:    $getvar()
Returns:  
Example:  

Function: $aliasctl()
Usage:    $aliasctl()
Returns:  
Example:  

Function: $status()
Usage:    $status()
Returns:  
Example:  

Function: $statsparse()
Usage:    $statsparse()
Returns:  
Example:  

Function: $absstrlen()
Usage:    $absstrlen()
Returns:  
Example:  

Function: $findw()
Usage:    $findw()
Returns:  
Example:  

Function: $countansi()
Usage:    $countansi()
Returns:  
Example:  

Function: $longip()
Usage:    $longip()
Returns:  
Example:  
