IRCII Functions
  IRCII functions are substituted with the format $FUNCTION(arguments).
  A function is any ALIAS that assigns the variable $FUNCTION_RETURN.
  For example:
    ALIAS DOUBLE ^assign FUNCTION_RETURN ${[$0]+[$0]}
  which is the same as:
    ALIAS DOUBLE @ function_return = [$0] * 2
  used with:
    ALIAS SHOWDOUBLE echo $DOUBLE($0)
  will cause
    SHOWDOUBLE 7
  to display "14".  (Hint: '7' is expanded as $0 in SHOWDOUBLE and
  then passed to the function $DOUBLE() where it is again expanded
  as $0 (because it is the first argument) and multiplied by two)

  The following built-in functions already exist and cannot be overriden:

  LEFT(COUNT STRING)    Returns the COUNT leftmost bytes from the STRING.
  RIGHT(COUNT STRING)   Returns the COUNT rightmost bytes from the STRING.
  MID(INDEX COUNT STRING) Returns COUNT bytes starting at position INDEX
                        in STRING.
  INDEX(CHARLIST STRING) Returns the index to the first character in STRING
                        which appears in CHARLIST.
  RINDEX(CHARLIST STRING) Returns the index to the last character in STRING
			which appears in CHARLIST.
  TIME()                Returns the current system time as a long integer
  STIME(TIMEVAL)        Returns the date and time in English that corresponds
                        to the long integer TIMEVAL.
  TDIFF(TIME_INTERVAL)	Takes a TIME_INTERVAL in seconds and returns it in 
			the format.. dd days hh hours mm minutes ss seconds
			Any fields with 00 are omitted.
  RAND(LIMIT)           Returns a random number x such that 0<=x<LIMIT
  SRAND(SEED)           Seeds the random number generator and returns nothing.
                        The seed may be a long integer, although only the low
                        integer is used.
  USERHOST()            Returns the user@host value under which the current
                        message was sent if you are on a 2.7 server or better.
  MATCH(PATTERN WORDS)  Returns an index into the list of WORDS of the first
                        match for the given PATTERN. Returns 1 if it matches
                        the first word, 0 if it matches none.
  RMATCH(WORD PATTERNS) Returns an index into the list of PATTERNS of the
                        pattern which best matches the given WORD. Returns
                        1 for the first pattern, 0 for none.
  WORD(INDEX WORDS)	Returns the single word in the list of WORDS pointed
			to by INDEX.
  STRIP(CHARLIST STRING) Returns the STRING with all occurrences of characters
                        listed in CHARLIST removed.
  CONNECT(HOST PORT)	Returns the file descriptor for the connection.
			A NULL fd means host could not be resolved.
			Negative fd means some error occurred in the attempt.
			Communication through the connection is done with 
			DCC RAW and ON DCC_RAW.
                        (See DCC RAW and ON DCC_RAW)
  LISTEN(PORT)		Creates a listening socket on the specified port.
			If the port # is not specified then it returns the 
			number of the port it chose arbitrarily.  It cannot
			open a port# < 1025
  ISCHANNEL(word)       Returns 1 if word is a valid channel name.
  ISCHANOP(nick channel) Returns 1 if nick is a chanop on the given channel.
  WINNUM()              Returns the current window number.  This is always 
			the window which is indicated by STATUS_WINDOW.
  WINNAM()              Returns the current window name.
                        This is always the window which is indicated by 
			STATUS_WINDOW.  If the window has no name, it returns
                        nothing.
  ENCODE(input text)	Convert input text to an encoded string suitable for
			use as an ircII variable or alias name.  Any special
			including spaces can be encoded into the string.
  DECODE(encoded text)	Decode a single STRING of text produced by ENCODE()
			into it's original characters.  Note that these are
			case sensitive.
  TOUPPER(string)       Convert string to upper case.
  TOLOWER(string)       Convert string to lower case.
  CURPOS()		Returns the postition from the start of the input line
			to where the cursor is now.
  MYCHANNELS(refnum)    Returns a string with a list of channels on that
                        windows server. (defaults to current window)
  MYSERVERS()		Returns a string of the names of the servers
			you are connected to.
  ONCHANNEL(nick channel) Returns 1 if nick is on channel
  PID()                 Returns the current process ID.
  PPID()                Returns the current parent process iD.
  CHANUSERS(channel)    Returns a list of users on channel.
  BEFORE(<val> chars text)  Returns the portion of text that occurs before
			the "val"th instance of any character in "chars".
			if "val" is negative, the search begins from
			the end of "text" instead of the beginning.
			if "val" is not specified, 1 is the default.
  AFTER(<val> chars text)  Same as BEFORE, but returns the text after.
  WHICH(filename <path>) Returns the path in which the file "fliename"
			exists.  If <path> is not specified, your 
			IRCLOAD path is used. (see SET LOAD_PATH)
  CHR(num <num> ...)	Retuns the ascii characters represented by the
			integer arguments passed:  CHR(65) returns "A"
  ASCII(chars)		Returns the list of integers that reprents the
			arguments: ASCII(ABC) returns "65 66 67"
  NUMONCHANNEL(channel) Returns the number of people on the channel specified.
  KEY(channel)		Returns the password key for the channel specified.
  CENTER(length string) Returns string centered in a string length characters
			long.
  SPLIT(chars text)     Returns text with all characters found in chars
			converted to spaces.
  SHIFT(varname)        Removes the 0th word from $varname and returns 
			that word.
  UNSHIFT(varname word) Prepends "word" onto varname (with space)
  POP(varname)		Removes the last word from $varname and returns
			that word.
  PUSH(varname word)	Appends "word" onto varname (with space)
  SAR([r][g]/search/replace/text)
			Replaces the first instance of "search" with
			"replace" in the "text".  If the 'g' command
			is used, all instances are converted, If
			the 'r' command is used, "text" is instead assumed  
			to be a variable name, and the result of the 
			substitution is placed back into the variable.
			The delim does not need to be a '/', it is in 
			fact the first character that appears that is 
			not a 'r' or 'g' that is used.
  REVERSE(text)		Returns "text" reversed character by character
  REVW(text)		Returns "text" reversed word by word
  JOT(min max interval) Returns a string of every "interval"th integer 
			starting from "min" to "max".  If "interval" is
			not specified, the default is 1.
  RPATTERN(word patterns) Returns all patterns that match "word"
  RFILTER(word patterns)  Returns all patterns that do NOT match "word"
  COPATTERN(word varname1 varname2) 
			For each value in varname1 that matches "word",
			the corresponding value from varname2 will be returned.
  ONCHANNEL(channel)    Returns everyone on the channel specified.  "*" means
			the current channel. 
  CHOPS(channel)	Returns all the channel operators on the channel
			specified.  "*" means the current channel.
  NOCHOPS(channel)	Returns all those who are not channel operators on
			the channel specified.  "*" means the current channel.
  LEFTW(x text)		Returns the first X words in text.
  RIGHTW(x text)	Returns the last X words in text.
  RESTW(x text)		Returns the Xth word and after in text.
  MIDW(start stop text)	Returns the Start'th word to the stop'th word in text
  NOTW(x text)		Returns text with the Xth word removed
  INSERTW(x word text)	Returns text with "word" being added as the Xth word
  REMW(word text)	Returns text with the first instance of "word" deleted
  PATTERN(pattern list) Returns all words that are matched by the pattern
  FILTER(pattern list)  Returns all words that are NOT matched by the pattern
  CHNGW(x new text)	Returns text with the Xth word changed to "new"
  TOW(word text)	Returns text up to and including the first instance 
			of "word"
  BEFOREW(word text)	Returns text before the first instance of "word"
  FROMW(word text)	Returns text after and including the first instance
			of "word"
  AFTERW(word text)	Returns text after the first instance of "word"
  COMMON(text / text)   Returns all words common to both lists (seperate
			lists with a forward-slash '/')
  DIFF(text / text)	Returns all words that do not appear in both lists
  VERSION(id)		Returns in string for the server version that is
			being run on server # 'id' -- you must either be
			connected to the server or have been connected
			previously to get a valid answer.
  TR(/oldc/newc/text)	Returns TEXT with all the instances of the characters
			in "oldc" changes to the corresponding characters in
			"newc".  Any character not in 'oldc' or 'newc' can 
			be the delim.
  IPTONAME(ip-address)  Converts an address of the form XXX.XXX.XXX.XXX to
			hostname ("machine name") form.
  NAMETOIP(hostname)    Converts a hostname ("machine name") address to the
			IP (XXX.XXX.XXX.XXX) form.
  CONVERT(address)	Converts host to IP or IP to host automatically.
  OPEN(filename type)	Opens a file 'filename' for direct access.  Type must
			be one of 'w' for writing, 'r' for reading.  Write
			appends to the file, it does not truncate the file.
			Use UNLINK() to remove a file.  Returns the FD for 
			the open file.
  CLOSE(fd)		Closes the file corresponding to the open file
			descriptor 'fd' -- returns -1 if the fd is not an
			file opened with the OPEN function
  READ(fd [bytes])      If bytes is not specified, one line of input is read
                        from the file pointed to by fd.  If it is specified,
                        that number of bytes is read instead (useful for
                        reading from binary files).  Returns -1 if fd is not
                        a valid file descriptor returned by $open().
  WRITE(fd text)	Writes one line of output to the file corresponding
			to the file descriptor 'fd'  Returns -1 if 'fd' is
			not from a file opened with the OPEN function.
  EOF(fd)		Returns 1 if the file corresponding to the given 'fd'
			is at the end-of-file marker, Returns -1 if 'fd' is
			not from a file opened with the OPEN function.
			Returns 0 in any other case.
  UNLINK(filename[s])	Returns 0 if all the filenames specified were removed
			successfully: returns the total number of files that
			could not be removed otherwise.
  RMDIR(directory[ies])	Returns 0 if all the directories specified were
			removed sucessfully: Returns the total number of
			files that could not be removed (possibly because
			they were not a directory or the directory was not
			empty.)
  RENAME(file1 file2)	Returns 0 if the file was successfully renamed from
			file1 to file2, or returns 1 if it was not.
  ISALPHA(text)		Returns 1 if the first character is an alphabetic
			character.  Useful in conjunction with the FEC
			command.
  ISDIGIT(text)		Returns 1 if the first character is a numeric digit.
			Useful in conjunction with the FEC command.
  TRUNC(x y)            If x is positive, truncates y to x decimal places.
                        If x is negative, truncates y to x significant
                        digits.
  WRITEB(text)          Same as $write() except a trailing newline is not
                        appended (useful for writing to binary files)
  WINSERV(x)            Returns server index for window number x.  If x is
                        0 (zero) or not specified, current window is used.
  LASTSERVER()          Returns server index for last server parsed (i.e.
                        the last server a PRIVMSG or NOTICE came from).
  SERVERNAME(x)         Returns name of server with index x.
  NUMWORDS(text)        Returns number of words in text.  Same as #var,
                        except it works with functions and numeric expandos.
  STRLEN(text)          Returns number of characters in text.  Same as @var,
                        except it works with functions and numeric expandos.
  ALIASCTL(alias|assign get|set|match text [value])
                        If "get" is specified, returns the current ALIAS or
                        ASSIGN definition.  If "set", "value" is aliased
                        or assigned to "text" (same as using those commands).
                        If "match", it finds all aliases or assigns matching
                        "text".
  FEXIST(filename)      Returns 1 if file exists, -1 if not (or if no file).
  FSIZE(filename)       Returns size of file, -1 if file does not exist or
                        not specified.
  CRYPT(salt password)  Returns encrypted password.  "salt" may be any two-
                        character string, and "password" may be up to eight
                        characters.  It is functionally equivalent to the
                        Unix library function crypt() (in fact it requires
                        it, and will not work if your system does not
                        support it).
  INFO(C|O|S)           Returns various information about the client:
                          C - date & person who compiled client
                          O - compile options used (see ircII compile_opts)
                          S - client binary checksum
  CHANMODE(channnel)    Returns the channel mode for the specified channel.
                        If no channel or "*" is specified, the current
                        channel is used.
  GEOM()                Returns the dimensions of your screen; two integers,
                        number of columns and number of lines.
  REPEAT(count text)    Returns text repeated count times.  Leading spaces
                        are stripped, but are not stripped elsewhere.  The
                        repeated text is not padded, so add an extra space
                        at the end if you want this.
  PASS(chars text)      Returns text with all occurences of any text NOT in
                        chars stripped out.  Opposite of $STRIP().
  STRFTIME(x)           Returns current time/date in user-specified format.
                        The formatting rules are the same as for ANSI C's
                        strftime() function, except arbitrary text may not
                        be interspersed among the %expandos.  The format is
                        for the time specified (UTC format), or the current
                        time if none is specified.
  WINSIZE(x)            Returns the height (in lines) of window x.  If no
                        window is specified, the current one is used.
  USERMODE(x)           Returns your current usermode on server number x.
                        If no server number is specified, your current
                        server is used.
  EPIC()                Returns 1 if client is an ircII-EPIC version.
  TDIFF2(x)             Same as $tdiff(), but more concise:
                        DDd HHh MMm SSs
  UTIME()               Same as $time(), but returns two integers: UTC time,
                        and a fraction of a second, accurate to 1e-6 second.
  STRIPANSI(text)       Strips out ESC's from text.
  SORT(wordlist)        Sorts the given list according the ASCII order. This
                        is generally alphabetic, except all capital letters
                        are sorted before lowercase letters.  Consult an
                        ASCII table for the exact order followed.
  NOTIFY(on|off|x)      Returns your current notify list.  If no arguments
                        specified, returns the whole list; "on" returns list
                        of users on irc, "off" returns users not on irc.  A
                        server number may be specified, showing users on (or
                        off) irc on server X.
  NUMSORT(wordlist)     Same as $SORT() except it tries to return numbers
                        (integer or decimal) in numerical order.
  GLOB(glob patterns)   Returns list of all files (including directories)
                        that match the specified glob patterns.  Accepts
                        normal wildcards.
  MKDIR(dir list)       Creates the directories specified using the current
                        umask.
  UMASK(mask)           Changes current umask to the specified value.

Note:
  The argument separator for functions is the space character or a pair
  of quotation marks, not a comma.

  The array functions are too involved to detail here.  Please refer to
  ircII arrays for a description of them.
