Initial import of the ircii-pana-1.1-final source tree.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/tags/ircii-pana-1.1-final@1 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
45
bitchx-docs/6_Functions/6_Functions
Normal file
45
bitchx-docs/6_Functions/6_Functions
Normal file
@@ -0,0 +1,45 @@
|
||||
Section 6: Built-In Functions
|
||||
|
||||
This section will be a treasure trove for many script writers. Every single
|
||||
built-in function is described here; every helpfile shows exactly what each
|
||||
function takes in and what they spit out.
|
||||
|
||||
Client State Information: cexist chanwin curpos currchans epic fnexist geom
|
||||
getsets igmask igtype info irclib isconnected iscurchan lastserver
|
||||
mychannels myservers pid ppid querywin rigmask rigtype servername
|
||||
servernick servernum servports status userhost winbound winchan winlevel
|
||||
winnam winnicklist winnum winrefs winserv winsize winvisible
|
||||
|
||||
Server State Information: chanmode channel chanusers chops ischannel ischanop
|
||||
ischanvoice key nochops notify numonchannel onchannel usermode version
|
||||
|
||||
System Information: getenv getgid getlogin getpgrp getuid uname
|
||||
|
||||
Time Functions: stime strftime tdiff tdiff2 time utime
|
||||
|
||||
Pattern Matching: common copattern deuhc diff filter mask match pattern
|
||||
regcomp regerror regex regexec regfree rfilter rmatch rpattern uhc
|
||||
|
||||
Character Operations: ascii chr isalpha isdigit isnumber jot nohighlight
|
||||
pass printlen split strip stripansi stripansicodes stripc tolower toupper
|
||||
|
||||
String Operations: after before center chop count cparse decode encode
|
||||
index left leftpc mid msar pad repeat rest reverse right rindex sar strlen
|
||||
substr tr
|
||||
|
||||
Word Operations: afterw beforew chngw findw fromw insertw leftw midw notw
|
||||
numwords remw remws restw revw rightw tow uniq word
|
||||
|
||||
Variable Operations: pop push shift splice unshift
|
||||
|
||||
Array Operations: delarray delitem finditem getarrays getitem getmatches
|
||||
getrmatches gettmatch ifindfirst ifinditem igetitem igetmatches igetrmatches
|
||||
indextoitem itemtoindex matchitem numarrays numitems rmatchitem setitem
|
||||
|
||||
File Operations: chmod close eof fexist fsize ftime glob mkdir open randread
|
||||
read renme rmdir twiddle umask unlink which write writeb
|
||||
|
||||
Network Operations: connect convert iptoname listen nametoip
|
||||
|
||||
Miscellaneous: aliasctl crypt pipe rand srand trunc
|
||||
|
||||
20
bitchx-docs/6_Functions/absstrlen
Normal file
20
bitchx-docs/6_Functions/absstrlen
Normal file
@@ -0,0 +1,20 @@
|
||||
Synopsis:
|
||||
$absstrlen(<string>)
|
||||
|
||||
Technical:
|
||||
This function is used to determine the length, in characters, of a given
|
||||
string, while stripping ansi codes from it.
|
||||
|
||||
Practical:
|
||||
This function is the same as $strlen() except that it will strip
|
||||
ansicodes from the string so it will count everything but the
|
||||
ansicodes.
|
||||
|
||||
Returns:
|
||||
>0 number of characters in string
|
||||
0 no string given
|
||||
|
||||
Examples:
|
||||
|
||||
$abbstrlen($cparse("%ghello")) returns "5"
|
||||
|
||||
18
bitchx-docs/6_Functions/addtabkey
Normal file
18
bitchx-docs/6_Functions/addtabkey
Normal file
@@ -0,0 +1,18 @@
|
||||
Synopsis:
|
||||
$addtabkey(<nick>)
|
||||
|
||||
Technical:
|
||||
This function will add the specified nick into the tab key list
|
||||
|
||||
Practical:
|
||||
By pressing tab you can cycle through the nicks that just messaged you
|
||||
or nicks that are on the channel. addtabkey will add the specified nick
|
||||
to the list.
|
||||
|
||||
Returns:
|
||||
Nothing
|
||||
|
||||
|
||||
Examples:
|
||||
$addtabkey(panasync) will add panasync to tab key list
|
||||
$addtabkey() won't return or do anything
|
||||
29
bitchx-docs/6_Functions/after
Normal file
29
bitchx-docs/6_Functions/after
Normal file
@@ -0,0 +1,29 @@
|
||||
Synopsis:
|
||||
$after([<count>] <char> <text>)
|
||||
$before([<count>] <char> <text>)
|
||||
|
||||
Technical:
|
||||
These functions return their respective input strings up to or following
|
||||
the specified occurrence of the given character. If no "count" is given,
|
||||
1 (one) is assumed. If the count is negative, the functions look for
|
||||
the specified instance of the given character from the end of the text.
|
||||
|
||||
Practical:
|
||||
These functions are among the most useful additions to ircII present in
|
||||
EPIC. They conveniently permit you to extract parts of a string based
|
||||
on its content, not the position of key characters. This is useful for
|
||||
parsing through a nick!user@host pattern, or some other pattern with
|
||||
well-defined delimiters.
|
||||
|
||||
Returns:
|
||||
after: input text after specified occurrence of given character
|
||||
before: input text before specified occurrence of given character
|
||||
|
||||
Examples:
|
||||
$after(@ hop!jnelson@wicked.neato.org) returns "wicked.neato.org"
|
||||
$after(-1 ! hop!jnelson@wicked.neato.org) returns "hop"
|
||||
$after(2 . hop!jnelson@wicked.neato.org) returns "org"
|
||||
$after(-2 . hop!jnelson@wicked.neato.org) returns "neato.org"
|
||||
$before(@ hop!jnelson@wicked.neato.org) returns "hop!jnelson"
|
||||
$before(-1 e hop!jnelson@wicked.neato.org) returns "hop!jnelson@wicked.n"
|
||||
|
||||
29
bitchx-docs/6_Functions/afterw
Normal file
29
bitchx-docs/6_Functions/afterw
Normal file
@@ -0,0 +1,29 @@
|
||||
Synopsis:
|
||||
$afterw(<word> <text>)
|
||||
$beforew(<word> <text>)
|
||||
|
||||
Technical:
|
||||
These functions return their input string, minus all words up to the
|
||||
given word ($beforew()) or following the given word ($afterw()). They
|
||||
are analogous to $after() and $before(), operating on whole words
|
||||
instead of characters. They search only for the first occurrence of the
|
||||
given word.
|
||||
|
||||
Practical:
|
||||
These return the part of the input text that is before or after the
|
||||
first instance of the given word. This is probably most useful for
|
||||
internal parsing inside scripts; a variable might hold certain
|
||||
parameters, of which only certain ones might be useful at a particular
|
||||
time. If the given word does not appear in the input text, nothing
|
||||
is returned.
|
||||
|
||||
Returns:
|
||||
afterw: input list after first instance of given word
|
||||
beforew: input list before first instance of given word
|
||||
|
||||
Examples:
|
||||
$afterw(foobar one two foobar my shoe) returns "my shoe"
|
||||
$afterw(booya one two foobar my shoe) returns "" (empty string)
|
||||
$beforew(foobar one two foobar my shoe) returns "one two"
|
||||
$beforew(booya one two foobar my shoe) returns "" (empty string)
|
||||
|
||||
22
bitchx-docs/6_Functions/ajoinitem
Normal file
22
bitchx-docs/6_Functions/ajoinitem
Normal file
@@ -0,0 +1,22 @@
|
||||
Synopsis:
|
||||
$ajoinitem(refnum)
|
||||
|
||||
Technical:
|
||||
This function will return the channel in your ajoinlist according to the
|
||||
specified number, starting with 0.
|
||||
|
||||
Practical:
|
||||
BitchX has an autojoin list that given the specified channel will join
|
||||
on connect. ajoinitem can access this list by specifying a number
|
||||
(starting with 0). If the number doesn't exist then it will return
|
||||
nothing
|
||||
|
||||
Returns:
|
||||
Channel that's in the list. If number doesn't exist then nothing.
|
||||
|
||||
Examples:
|
||||
$ajoinitem(0) returns #bitchx (#bitchx being the first channel
|
||||
in the list)
|
||||
|
||||
See Also:
|
||||
ajoin ajoinlist unajoin
|
||||
37
bitchx-docs/6_Functions/aliasctl
Normal file
37
bitchx-docs/6_Functions/aliasctl
Normal file
@@ -0,0 +1,37 @@
|
||||
Synopsis:
|
||||
$aliasctl(alias|assign get|set|match <lval> [<rval>])
|
||||
|
||||
Technical:
|
||||
This function allows low-level manipulation of aliases and assigns.
|
||||
The noun of the action is either "alias" or "assign". The verb is
|
||||
either "get", "set", or "match". The "lval" must a valid variable name.
|
||||
The "rval" is used only if the verb is "set", and is any sequence of
|
||||
octets.
|
||||
|
||||
* The "GET" verb allows you to retrieve the value of an alias or assign
|
||||
named by "lval".
|
||||
* The "SET" verb allows you to set the value of an alias or assign named
|
||||
by "lval" to "rval".
|
||||
* The "MATCH" verb allows you to retrieve the list of all same-level
|
||||
variable names that begin with "lval" (ie, command completion).
|
||||
Wildcards are not allowed, but the simple use of a single asterisk is
|
||||
allowed to match all assigns or aliases.
|
||||
|
||||
Practical:
|
||||
You would use this function if you needed to get the text value of an
|
||||
alias. For completeness, you can use this to get the value of an
|
||||
assign, even though you can (obviously) get that value by $-referencing
|
||||
it. You can set the value of an assign (comparable to using ASSIGN),
|
||||
and you can set the value of an alias (comparable to using ALIAS). You
|
||||
can get the list of aliases or assigns that "begin" with a certain
|
||||
string, but it doesn't descend arrays (a period).
|
||||
|
||||
Examples:
|
||||
$aliasctl(alias get join) returns current value of alias "join"
|
||||
$aliasctl(alias set join //channel) sets an alias called "join"
|
||||
$aliasctl(assign match foo) returns all vars starting with "foo"
|
||||
$aliasctl(alias match foo.) returns all aliases of "foo" struct
|
||||
|
||||
See Also:
|
||||
assign(5); alias(5); edit(8)
|
||||
|
||||
18
bitchx-docs/6_Functions/annoy
Normal file
18
bitchx-docs/6_Functions/annoy
Normal file
@@ -0,0 +1,18 @@
|
||||
Synopsis:
|
||||
$annoy(<text>)
|
||||
|
||||
Technical:
|
||||
This function will change given text into random uppercase, lowercase,
|
||||
bold, inverse, and underlined text.
|
||||
|
||||
Practical:
|
||||
$annoy() is exactly how it sounds, annoying. It returns the text given
|
||||
into uppercase , lowercase, bold, inverse, and underlined text.
|
||||
|
||||
|
||||
Returns:
|
||||
Given text into uppercase , lowercase, bold, inverse, and underlined.
|
||||
|
||||
See Also:
|
||||
|
||||
cool(6); cool2(6); eleet(6)
|
||||
34
bitchx-docs/6_Functions/ascii
Normal file
34
bitchx-docs/6_Functions/ascii
Normal file
@@ -0,0 +1,34 @@
|
||||
Synopsis:
|
||||
$ascii(<integer list>)
|
||||
$chr(<character list>)
|
||||
|
||||
Technical:
|
||||
This pair of function is used to convert between 8-bit characters and
|
||||
their numeric equivalent (dependent on your locale). The $ascii()
|
||||
function converts from numeric to character, and $chr() converts from
|
||||
characters to their numeric values.
|
||||
|
||||
For $ascii(), integers in the range 0..255 are accepted for input. For
|
||||
$chr() any arbitrary list of characters is accepted.
|
||||
|
||||
Practical:
|
||||
These functions are used to convert from character values to their
|
||||
numeric values, and back. One common use for these is to insert control
|
||||
character into text without having to actually type them in; or to
|
||||
check the case of a character.
|
||||
|
||||
Returns:
|
||||
ascii: space-delimited list of integer values
|
||||
chr: concatenated list of characters
|
||||
|
||||
Examples:
|
||||
/* assume iso8859-1 character set */
|
||||
$ascii(abcABC) returns "97 98 99 65 66 67"
|
||||
$chr(1 2 3) returns "ABC" (ctrl-A, -B, -C)
|
||||
$chr($ascii(abcABC)) returns "abcABC"
|
||||
|
||||
Other Notes:
|
||||
Some characters with the high bit set will return negative numeric
|
||||
values from $ascii(). Add 256 to this negative value to get its
|
||||
positive equivalent. The $chr() function will accept either.
|
||||
|
||||
29
bitchx-docs/6_Functions/before
Normal file
29
bitchx-docs/6_Functions/before
Normal file
@@ -0,0 +1,29 @@
|
||||
Synopsis:
|
||||
$after([<count>] <char> <text>)
|
||||
$before([<count>] <char> <text>)
|
||||
|
||||
Technical:
|
||||
These functions return their respective input strings up to or following
|
||||
the specified occurrence of the given character. If no "count" is given,
|
||||
1 (one) is assumed. If the count is negative, the functions look for
|
||||
the specified instance of the given character from the end of the text.
|
||||
|
||||
Practical:
|
||||
These functions are among the most useful additions to ircII present in
|
||||
EPIC. They conveniently permit you to extract parts of a string based
|
||||
on its content, not the position of key characters. This is useful for
|
||||
parsing through a nick!user@host pattern, or some other pattern with
|
||||
well-defined delimiters.
|
||||
|
||||
Returns:
|
||||
after: input text after specified occurrence of given character
|
||||
before: input text before specified occurrence of given character
|
||||
|
||||
Examples:
|
||||
$after(@ hop!jnelson@wicked.neato.org) returns "wicked.neato.org"
|
||||
$after(-1 ! hop!jnelson@wicked.neato.org) returns "hop"
|
||||
$after(2 . hop!jnelson@wicked.neato.org) returns "org"
|
||||
$after(-2 . hop!jnelson@wicked.neato.org) returns "neato.org"
|
||||
$before(@ hop!jnelson@wicked.neato.org) returns "hop!jnelson"
|
||||
$before(-1 e hop!jnelson@wicked.neato.org) returns "hop!jnelson@wicked.n"
|
||||
|
||||
20
bitchx-docs/6_Functions/bitchx
Normal file
20
bitchx-docs/6_Functions/bitchx
Normal file
@@ -0,0 +1,20 @@
|
||||
Synopsis:
|
||||
$bitchx()
|
||||
|
||||
Technical:
|
||||
Returns true if the client is an BitchX client.
|
||||
|
||||
Practical:
|
||||
If this function returns true, the client is an BitchX client, or some
|
||||
variant of it. The $V and $J expandos will tell you the exact version
|
||||
of the client. This function is necessary because the stock ircII
|
||||
client's value for $V and EPIC's overlap. This is mostly a useful way
|
||||
for scripts to see if they can load or not.
|
||||
|
||||
Returns:
|
||||
> 0 client is an BitchX client
|
||||
0 client is not an BitchX client (should never happen)
|
||||
|
||||
See Also:
|
||||
Special_Vars(7)
|
||||
|
||||
24
bitchx-docs/6_Functions/center
Normal file
24
bitchx-docs/6_Functions/center
Normal file
@@ -0,0 +1,24 @@
|
||||
Synopsis:
|
||||
$center(<width> <text>)
|
||||
|
||||
Technical:
|
||||
This function returns the input text right-justified in a buffer that is
|
||||
precisely ( ((width - strlen(text)) / 2) + strlen(text) ) characters
|
||||
wide. The width must be given, there is no default.
|
||||
|
||||
Practical:
|
||||
This function returns the given text, padded on the left such that it
|
||||
will appear to be "centered" in the width given. The right side is not
|
||||
padded, only the left. To force padding on both sides, you must use the
|
||||
width qualifier $[]var.
|
||||
|
||||
Returns:
|
||||
input text centered in given width
|
||||
|
||||
Examples:
|
||||
$center(15 hello there) returns " hello there"
|
||||
$[15]center(15 hello there) returns " hello there "
|
||||
|
||||
See Also:
|
||||
Special_Vars(7)
|
||||
|
||||
17
bitchx-docs/6_Functions/cexist
Normal file
17
bitchx-docs/6_Functions/cexist
Normal file
@@ -0,0 +1,17 @@
|
||||
Synopsis:
|
||||
$cexist(<command>)
|
||||
|
||||
Technical:
|
||||
This function tells wether or not a built-in command exists.
|
||||
|
||||
Practical:
|
||||
This can be used to emulate a built-in command in older versions of epic
|
||||
that may not support it.
|
||||
|
||||
Returns:
|
||||
1 If the built-in command <command> exists
|
||||
0 If <command> doesn't exist
|
||||
|
||||
See Also:
|
||||
fnexist(6)
|
||||
|
||||
28
bitchx-docs/6_Functions/chanmode
Normal file
28
bitchx-docs/6_Functions/chanmode
Normal file
@@ -0,0 +1,28 @@
|
||||
Synopsis:
|
||||
$chanmode(<channel>|* [<channel> ...])
|
||||
|
||||
Technical:
|
||||
This function is used to retrieved the current channel mode for the given
|
||||
channel. If no channel, or a "*", is given, the current is assumed. You
|
||||
must be on the channel specified for it to function properly. Multiple
|
||||
channels may be specified.
|
||||
|
||||
Practical:
|
||||
You give it a list of channels you want to know the channel mode for, and
|
||||
it returns the modes on that channel. Of course, you have to be on the
|
||||
channel for it to make any sense. You can use an asterisk ('*') to stand
|
||||
for the current channel. If you don't specify any arguments, the current
|
||||
channel is assumed.
|
||||
|
||||
Returns:
|
||||
modes for specified channels
|
||||
|
||||
Examples:
|
||||
$chanmode(#blah) returns modes for #blah
|
||||
$chanmode(#foo #bar) returns modes for #foo and #bar
|
||||
$chanmode(*) returns modes for current channel
|
||||
$chanmode() returns modes for current channel too
|
||||
|
||||
See also:
|
||||
key(6); mode(1); onchannel(6)
|
||||
|
||||
22
bitchx-docs/6_Functions/channel
Normal file
22
bitchx-docs/6_Functions/channel
Normal file
@@ -0,0 +1,22 @@
|
||||
Synopsis:
|
||||
$channel(<channel name>)
|
||||
|
||||
Technical:
|
||||
This function returns some extended information about who's on a channel.
|
||||
It returns a sorted list of nicknames prepended by two characters.
|
||||
|
||||
Returns:
|
||||
space-separated list in the form: OVnick, where O is channel operator
|
||||
status (an '@' if the nick is a chanop, '.' if not, '?' if we don't know),
|
||||
V is voice status (a '+' if the nick has voice status, '.' if not, '?' if
|
||||
we don't know)
|
||||
|
||||
Examples:
|
||||
Instead of:
|
||||
/on ^send_public * {if ([$0] == C) {...} {...}}
|
||||
Try doing:
|
||||
/on ^send_public * {if (iscurchan($0)) {....} {...}}
|
||||
|
||||
See Also
|
||||
chops(6); nochops(6); chanusers(6)
|
||||
|
||||
21
bitchx-docs/6_Functions/chmod
Normal file
21
bitchx-docs/6_Functions/chmod
Normal file
@@ -0,0 +1,21 @@
|
||||
Synopsis:
|
||||
$chmod(<file> <mode>)
|
||||
|
||||
Technical:
|
||||
This function provides an interface to the Unix system call chmod(2). It
|
||||
applies the given mode to the file specified. Refer to your Unix system
|
||||
manual for more information (usually "man 2 chmod"). The mode must be in
|
||||
numeric format.
|
||||
|
||||
Practical:
|
||||
This function is used to change the access permissions on a given file.
|
||||
A discussion of Unix file permissions is beyond the scope of this
|
||||
document; refer to your system's manual page for chmod(1) or chmod(2).
|
||||
|
||||
Returns:
|
||||
-1 error
|
||||
0 permissions changed successfully
|
||||
|
||||
See Also:
|
||||
umask(6)
|
||||
|
||||
21
bitchx-docs/6_Functions/chngw
Normal file
21
bitchx-docs/6_Functions/chngw
Normal file
@@ -0,0 +1,21 @@
|
||||
Synopsis::
|
||||
$chngw(<index> <word> <text>)
|
||||
|
||||
Technical:
|
||||
This function returns its input text, with the given word replacing the
|
||||
word pointed to by the index. Words are counted from 0 (zero).
|
||||
|
||||
Practical:
|
||||
This function changes a single word in a list of words to another word.
|
||||
This might be useful for changing a user's permission bits in a variable
|
||||
that holds a script's access levels.
|
||||
|
||||
Returns:
|
||||
text with new word inserted
|
||||
|
||||
Examples:
|
||||
$chngw(2 blah foo bar booya) returns "foo bar blah"
|
||||
|
||||
See also:
|
||||
insertw(6); remw(6); splice(6)
|
||||
|
||||
20
bitchx-docs/6_Functions/chop
Normal file
20
bitchx-docs/6_Functions/chop
Normal file
@@ -0,0 +1,20 @@
|
||||
Synopsis:
|
||||
$chops(<num> <text>)
|
||||
|
||||
Technical:
|
||||
This function chops <num> characters from the end of <text>.
|
||||
|
||||
Practical:
|
||||
It is an excellent shortcut for mid(6) expressions starting at the first
|
||||
character of <text>.
|
||||
|
||||
Returns:
|
||||
<text> with <num> characters removed from the end
|
||||
|
||||
Examples:
|
||||
$chop(5 abcdef) /* returns "a" */
|
||||
$chop(2 fnord) /* returns "fno" */
|
||||
|
||||
See Also:
|
||||
left(6); right(6); mid(6)
|
||||
|
||||
38
bitchx-docs/6_Functions/chops
Normal file
38
bitchx-docs/6_Functions/chops
Normal file
@@ -0,0 +1,38 @@
|
||||
Synopsis:
|
||||
$chops([<channel>|*])
|
||||
$nochops([<channel>|*])
|
||||
|
||||
Technical:
|
||||
These functions are used to show the channel operators (and non-ops) on
|
||||
the given channel. If a "*" is given as the channel name, or no name is
|
||||
given at all, the current is assumed. These functions require that you
|
||||
be on the specified channel to function.
|
||||
|
||||
Practical:
|
||||
This is a convenient way to see who is and isn't a channel operator on
|
||||
the channel you specify. One use for $chops() might be to send a
|
||||
message to all channel operators on your channel.
|
||||
|
||||
Returns:
|
||||
chops: channel operators on given channel
|
||||
nochops: non-operators on given channel
|
||||
|
||||
Examples:
|
||||
$chops(#foo) shows operators on channel #foo
|
||||
$chops(*) shows channel operators on current channel
|
||||
$chops() also shows operators on current channel
|
||||
$nochops() shows non-operators on current channel
|
||||
|
||||
Bugs:
|
||||
There is a long-standing bug in many servers that can lead to erroneous
|
||||
output from this function. These servers limit the length of numeric
|
||||
353 (RPL_NAMEREPLY) to 510 characters. When the nickname list exceeds
|
||||
this, the server uses multiple 353s. Unfortunately, they will truncate
|
||||
any nickname that would end up exceeding the 510th character. This
|
||||
function uses 353 to generate it's initial nickname list, so it is
|
||||
likely that it will return chopped nicknames on large channels. This is
|
||||
an unavoidable server bug.
|
||||
|
||||
See Also:
|
||||
names(2); onchannel(6)
|
||||
|
||||
34
bitchx-docs/6_Functions/chr
Normal file
34
bitchx-docs/6_Functions/chr
Normal file
@@ -0,0 +1,34 @@
|
||||
Synopsis:
|
||||
$ascii(<integer list>)
|
||||
$chr(<character list>)
|
||||
|
||||
Technical:
|
||||
This pair of function is used to convert between 8-bit characters and
|
||||
their numeric equivalent (dependent on your locale). The $ascii()
|
||||
function converts from numeric to character, and $chr() converts from
|
||||
characters to their numeric values.
|
||||
|
||||
For $ascii(), integers in the range 0..255 are accepted for input. For
|
||||
$chr() any arbitrary list of characters is accepted.
|
||||
|
||||
Practical:
|
||||
These functions are used to convert from character values to their
|
||||
numeric values, and back. One common use for these is to insert control
|
||||
character into text without having to actually type them in; or to
|
||||
check the case of a character.
|
||||
|
||||
Returns:
|
||||
ascii: space-delimited list of integer values
|
||||
chr: concatenated list of characters
|
||||
|
||||
Examples:
|
||||
/* assume iso8859-1 character set */
|
||||
$ascii(abcABC) returns "97 98 99 65 66 67"
|
||||
$chr(1 2 3) returns "ABC" (ctrl-A, -B, -C)
|
||||
$chr($ascii(abcABC)) returns "abcABC"
|
||||
|
||||
Other Notes:
|
||||
Some characters with the high bit set will return negative numeric
|
||||
values from $ascii(). Add 256 to this negative value to get its
|
||||
positive equivalent. The $chr() function will accept either.
|
||||
|
||||
21
bitchx-docs/6_Functions/close
Normal file
21
bitchx-docs/6_Functions/close
Normal file
@@ -0,0 +1,21 @@
|
||||
Synopsis:
|
||||
$close(<file descriptor>)
|
||||
|
||||
Technical:
|
||||
This function unbinds the given file descriptor (previously returned by
|
||||
the $open() function) from the underlying file, causing the file to be
|
||||
committed to disk if necessary. An error is returned if it is passed a
|
||||
file descriptor not produced by an $open() call.
|
||||
|
||||
Practical:
|
||||
This function is used to close a file that was opened for reading or
|
||||
writing by $open(). Data corruption may result if the client exits
|
||||
before all open files are closed.
|
||||
|
||||
Returns:
|
||||
-1 error
|
||||
0 file closed successfully
|
||||
|
||||
See Also:
|
||||
open(6); read(6); write(6)
|
||||
|
||||
29
bitchx-docs/6_Functions/common
Normal file
29
bitchx-docs/6_Functions/common
Normal file
@@ -0,0 +1,29 @@
|
||||
Synopsis:
|
||||
$common(<word list> / <word list>)
|
||||
$diff(<word list> / <word list>)
|
||||
|
||||
Technical:
|
||||
These functions are exact opposites. The $common() function finds and
|
||||
returns all words common to both input lists. The $diff() function
|
||||
funds are returns all words present in only one list. The two input
|
||||
lists must be separated by a single forward-slash. Whitespace is not
|
||||
significant.
|
||||
|
||||
Practical:
|
||||
These functions might be considered useful for statistical information.
|
||||
For instance, given 2 channels, they could be used to show who is and
|
||||
isn't on both of them.
|
||||
|
||||
Returns:
|
||||
common: words in both lists
|
||||
diff: words not in both lists
|
||||
|
||||
Examples:
|
||||
$common(one two three / two three four) returns "two three"
|
||||
$common(one two / three four) returns "" (empty string)
|
||||
$diff(one two three / two three four) returns "one four"
|
||||
$diff(one two / one two) returns "" (empty string)
|
||||
|
||||
See Also:
|
||||
common(6); remws(6); uniq(6)
|
||||
|
||||
26
bitchx-docs/6_Functions/connect
Normal file
26
bitchx-docs/6_Functions/connect
Normal file
@@ -0,0 +1,26 @@
|
||||
Synopsis:
|
||||
$connect(<host> <port>)
|
||||
|
||||
Technical:
|
||||
This function opens a raw TCP connection to the specified remote host on
|
||||
the specified remote port. It returns a unique file descriptor for the
|
||||
connection that can be used by DCC RAW to communicate with the host.
|
||||
|
||||
Practical:
|
||||
This function attempts to open up a TCP socket to the given host on the
|
||||
given port. DCC RAW is used to read and write data from and to it.
|
||||
This function effectively permits EPIC to act as a client for any
|
||||
TCP service. In the past, people have used it for direct finger, whois,
|
||||
and simple ftp access.
|
||||
|
||||
Returns:
|
||||
file descriptor for connection, or nothing if error
|
||||
|
||||
Examples:
|
||||
$connect(127.0.0.1 25) connect to your local mail server
|
||||
$connect(ftp.neato.org 21) connect to an EPIC ftp site
|
||||
$connect(0.0.0.0 0) error (no such host/port)
|
||||
|
||||
See Also:
|
||||
dcc(1) close, raw; listen(6); on(5) dcc_raw
|
||||
|
||||
23
bitchx-docs/6_Functions/convert
Normal file
23
bitchx-docs/6_Functions/convert
Normal file
@@ -0,0 +1,23 @@
|
||||
Synopsis:
|
||||
$convert(<ip address|hostname>)
|
||||
|
||||
Technical:
|
||||
This function does a DNS lookup on the given address. For an IP address,
|
||||
it attempts to find the corresponding Internet hostname. For a hostname,
|
||||
it attempts to find the corresponding IP address.
|
||||
|
||||
Practical:
|
||||
This function does effectively the same thing as $iptoname() and
|
||||
$nametoip(). It is mostly useful when you want to convert an address,
|
||||
but you aren't sure if the input will be an IP address or not.
|
||||
|
||||
Returns:
|
||||
IP address or hostname corresponding to input, or nothing on error
|
||||
|
||||
Examples:
|
||||
$convert(some.school.edu) returns IP address for "some.school.edu"
|
||||
$convert(192.168.1.1) returns hostname for "192.168.1.1"
|
||||
|
||||
See Also:
|
||||
iptoname(6); nametoip(6)
|
||||
|
||||
33
bitchx-docs/6_Functions/copattern
Normal file
33
bitchx-docs/6_Functions/copattern
Normal file
@@ -0,0 +1,33 @@
|
||||
Synopsis:
|
||||
$copattern(<pattern> <var1> <var2>)
|
||||
|
||||
Technical:
|
||||
Given a pattern and two variable names that represent lists of words of
|
||||
the same length, for every word in $var1 that is matched by the
|
||||
specified pattern, the corresponding word in $var2 will be returned.
|
||||
If the corresponding word in $var2 is absent (because $var2 is too
|
||||
short), then the empty string is substituted (i.e., nothing is returned
|
||||
for that word.)
|
||||
|
||||
Practical:
|
||||
When you have two variables, one that contains a list of control data,
|
||||
and another that contains a list of secondary data, and you wish to
|
||||
retrieve the secondary data, but you need to do it based on a query of
|
||||
the control data, you might use this function. One possible use might
|
||||
be if one variable held your friends list, and another held their access
|
||||
levels.
|
||||
|
||||
Returns:
|
||||
word in var2 corresponding to indexed word in var1
|
||||
|
||||
Examples:
|
||||
@ friends = [bob@foo.com tom@bar.com]
|
||||
@ levels = [20 10]
|
||||
$copattern(*@foo.com friends levels) returns "20"
|
||||
$copattern(*@bar.com friends levels) returns "10"
|
||||
$copattern(*@*.com friends levels) returns "20 10"
|
||||
$copattern(*@*.net friends levels) returns "" (empty string)
|
||||
|
||||
See also:
|
||||
match(6); word(6)
|
||||
|
||||
19
bitchx-docs/6_Functions/count
Normal file
19
bitchx-docs/6_Functions/count
Normal file
@@ -0,0 +1,19 @@
|
||||
Synopsis:
|
||||
$count(<string> <text>)
|
||||
|
||||
Technical:
|
||||
This function counts how many times <string> appears in the text specified
|
||||
by <text>, possibly overlapping.
|
||||
|
||||
Practical:
|
||||
The uses for a function like this are unlimited. One may be to count how
|
||||
many times a person's nick appears in a public message, for logging
|
||||
purposes.
|
||||
|
||||
Returns:
|
||||
number of times <string> is found in <text>
|
||||
|
||||
Examples:
|
||||
$count(. one.two.three) returns 2
|
||||
$count(zz zzzz) returns 3
|
||||
|
||||
44
bitchx-docs/6_Functions/cparse
Normal file
44
bitchx-docs/6_Functions/cparse
Normal file
@@ -0,0 +1,44 @@
|
||||
Synopsis:
|
||||
$cparse(<text>)
|
||||
$cparse(<text> <arguments>...)
|
||||
|
||||
Technical:
|
||||
This function parses <text> according to the following table:
|
||||
|
||||
Any instance of will be replaced with ^C codes to change the
|
||||
text to text to background to
|
||||
---------------------------------------------------------------------
|
||||
%k %K %0 black bold black black
|
||||
%r %R %1 red bold red red
|
||||
%g %G %2 green bold green green
|
||||
%y %Y %3 yellow bold yellow yellow
|
||||
%b %B %4 blue bold blue blue
|
||||
%m %M %5 magenta bold magenta magenta
|
||||
%p %P magenta (think: purple)
|
||||
%c %C %6 cyan bold cyan cyan
|
||||
%w %W %7 white bold white white
|
||||
%F Flashing attribute turned on
|
||||
%n All colors turned off
|
||||
%N Don't put a clear-color tag at the of output
|
||||
%% A single %
|
||||
|
||||
If the first argument to $cparse() is an extended word (string with
|
||||
quotes), it will be parsed similar to bitchx. (example below)
|
||||
|
||||
Practical:
|
||||
This is a convenient way add color to scripts without actually using
|
||||
the control-c character.
|
||||
|
||||
Returns:
|
||||
<text> parsed according to the rules in the above table
|
||||
|
||||
Examples:
|
||||
$cparse(bl%Bah)
|
||||
returns
|
||||
bl^C4ah
|
||||
where ^C4 is the control-c color code for blue.
|
||||
|
||||
$cparse("This is a $0 test" cparse)
|
||||
returns
|
||||
This is a cparse test
|
||||
|
||||
30
bitchx-docs/6_Functions/crypt
Normal file
30
bitchx-docs/6_Functions/crypt
Normal file
@@ -0,0 +1,30 @@
|
||||
Synopsis:
|
||||
$crypt(<string> <salt>)
|
||||
|
||||
Technical:
|
||||
Given an arbitrary string and a "salt" (a randomizer), this function
|
||||
returns the input string in a one-way encrypted form. This function
|
||||
depends on the availability of a local crypt(3) library function. Only
|
||||
the first 8 characters of the input string are significant. The salt
|
||||
is a two-character string, and may be composed of any combination of
|
||||
any alphanumeric character, a period (.), or a forward-slash (/).
|
||||
Additional characters may be available, depending on the crypt(3) in
|
||||
use at your site.
|
||||
|
||||
Practical:
|
||||
This function is primarily used for encrypting passwords, Unix style.
|
||||
It is helpful if the input salt is itself sufficiently random. Case is
|
||||
preserved in both the salt and input string.
|
||||
|
||||
Returns:
|
||||
encrypted input text, or nothing if error
|
||||
|
||||
Example:
|
||||
$crypt(foobar ab) returns "foobar" encrypted with salt "ab"
|
||||
|
||||
Other Notes:
|
||||
As mentioned above, this function relies completely on the availability
|
||||
of a local crypt(3) library function. This function is not available
|
||||
on some systems. Refer to your system's manual pages for more
|
||||
information.
|
||||
|
||||
11
bitchx-docs/6_Functions/curpos
Normal file
11
bitchx-docs/6_Functions/curpos
Normal file
@@ -0,0 +1,11 @@
|
||||
Synopsis:
|
||||
$curpos()
|
||||
|
||||
Technical:
|
||||
Returns the offset of the cursor to the current window's input buffer.
|
||||
|
||||
Practical:
|
||||
There aren't many practical, everyday uses for this function. One might
|
||||
use it to indicate when the user is nearing the end of the input line
|
||||
while typing (sort of like the bell on a typewriter).
|
||||
|
||||
15
bitchx-docs/6_Functions/currchans
Normal file
15
bitchx-docs/6_Functions/currchans
Normal file
@@ -0,0 +1,15 @@
|
||||
Synopsis:
|
||||
$currchans([<server refnum>])
|
||||
|
||||
Technical:
|
||||
Returns the current channels for each window connected to <server refnum>.
|
||||
If <server refnum> is -1, then $lastserver() is assumed. If no arguments
|
||||
are passed, all current channels are returned. This function returns
|
||||
each argument as "<server refnum> <channel>" in double quotes.
|
||||
|
||||
Examples:
|
||||
eval echo $currchans(1) /* returns "1 #epic" "1 #unix" */
|
||||
(assuming there are two windows connected to server 1, with #epic in
|
||||
one window and #unix in the other)
|
||||
|
||||
|
||||
34
bitchx-docs/6_Functions/decode
Normal file
34
bitchx-docs/6_Functions/decode
Normal file
@@ -0,0 +1,34 @@
|
||||
Synopsis:
|
||||
$encode(<text>)
|
||||
$decode(<text>)
|
||||
|
||||
Technical:
|
||||
Given any input, $encode() will return a unique string that can serve as
|
||||
an lvalue (a variable name that can be ASSIGNed to.) Use $decode() to
|
||||
retrieve the original text. The $encode() function is case-preserving.
|
||||
|
||||
Practical:
|
||||
The $encode() function is used to convert an arbitrary text string into
|
||||
a string suitable for use in variable or alias names. This might be
|
||||
used to set up a hash table keyed with nick!user@host patterns. The
|
||||
$decode() function does just the opposite, converting a string returned
|
||||
by $encode() to the original string.
|
||||
|
||||
Returns:
|
||||
encode: encoded string
|
||||
decode: decoded string
|
||||
|
||||
Examples:
|
||||
$encode(hello there) returns "GIGFGMGMGPCAHEGIGFHCGF"
|
||||
$decode(GIGFGMGMGPCAHEGIGFHCGF) returns "hello there"
|
||||
$decode($encode(hello there)) returns "hello there"
|
||||
|
||||
See Also:
|
||||
assign(5)
|
||||
|
||||
Other Notes:
|
||||
You should not trust $encode() to return any specific string. You may
|
||||
only trust that it is unique given the input string, and that you may
|
||||
use the return value as an lvalue. Any other use of $encode() should be
|
||||
considered an error.
|
||||
|
||||
18
bitchx-docs/6_Functions/delarray
Normal file
18
bitchx-docs/6_Functions/delarray
Normal file
@@ -0,0 +1,18 @@
|
||||
Synopsis:
|
||||
$delarray(<array>)
|
||||
|
||||
Technical:
|
||||
This function removes all items in an array created with $setitem(),
|
||||
having the effect of deleting the array.
|
||||
|
||||
Practical:
|
||||
This function deletes an array. Generally this is most useful when
|
||||
cleaning up after a script.
|
||||
|
||||
Returns:
|
||||
-1 error, array does not exist
|
||||
0 array deleted successfully
|
||||
|
||||
See Also:
|
||||
Arrays(7); delitem(6); setitem(6)
|
||||
|
||||
28
bitchx-docs/6_Functions/delitem
Normal file
28
bitchx-docs/6_Functions/delitem
Normal file
@@ -0,0 +1,28 @@
|
||||
Synopsis:
|
||||
$delitem(<array> <item#>)
|
||||
|
||||
Technical:
|
||||
This function is used to delete an entry from an array created with
|
||||
$setitem(). If the item deleted is the only one present in the array,
|
||||
the array is deleted too. If the item is not the last item in the
|
||||
array, all items beyond it (with higher item numbers) are shifted down
|
||||
by one to fill in the gap.
|
||||
|
||||
Practical:
|
||||
This function is used to delete items from an array. The uses for this
|
||||
are pretty obvious. If you add items to an array, it follows that you
|
||||
might want to remove them, too.
|
||||
|
||||
Returns:
|
||||
-2 if the item does not exist in the array
|
||||
-1 if the array does not exist
|
||||
0 on success
|
||||
|
||||
Examples:
|
||||
$delitem(array 2) deletes item 2 from array "array"
|
||||
$delitem(fake_array 4) error, "fake_array_ does not exist
|
||||
$delitem(array -2) error, item -2 does not exist
|
||||
|
||||
See Also:
|
||||
Arrays(7); getitem(6); setitem(6)
|
||||
|
||||
20
bitchx-docs/6_Functions/deuhc
Normal file
20
bitchx-docs/6_Functions/deuhc
Normal file
@@ -0,0 +1,20 @@
|
||||
Synopsis:
|
||||
$deuhc(<user@host>)
|
||||
|
||||
Technical:
|
||||
This function removes a *! or *!*@ from the <user@host>, if it is present.
|
||||
|
||||
Practical:
|
||||
It can be used as a quick way to get only the hostname from a full address
|
||||
argument.
|
||||
|
||||
Returns:
|
||||
arguments without *! or *!*@ in front
|
||||
|
||||
Examples:
|
||||
$deuhc(*!user@host) returns "user@host"
|
||||
$deuhc(*!*@host) returns "host"
|
||||
|
||||
See Also:
|
||||
uhc(6); match(6); userhost(6)
|
||||
|
||||
34
bitchx-docs/6_Functions/encode
Normal file
34
bitchx-docs/6_Functions/encode
Normal file
@@ -0,0 +1,34 @@
|
||||
Synopsis:
|
||||
$encode(<text>)
|
||||
$decode(<text>)
|
||||
|
||||
Technical:
|
||||
Given any input, $encode() will return a unique string that can serve as
|
||||
an lvalue (a variable name that can be ASSIGNed to.) Use $decode() to
|
||||
retrieve the original text. The $encode() function is case-preserving.
|
||||
|
||||
Practical:
|
||||
The $encode() function is used to convert an arbitrary text string into
|
||||
a string suitable for use in variable or alias names. This might be
|
||||
used to set up a hash table keyed with nick!user@host patterns. The
|
||||
$decode() function does just the opposite, converting a string returned
|
||||
by $encode() to the original string.
|
||||
|
||||
Returns:
|
||||
encode: encoded string
|
||||
decode: decoded string
|
||||
|
||||
Examples:
|
||||
$encode(hello there) returns "GIGFGMGMGPCAHEGIGFHCGF"
|
||||
$decode(GIGFGMGMGPCAHEGIGFHCGF) returns "hello there"
|
||||
$decode($encode(hello there)) returns "hello there"
|
||||
|
||||
See Also:
|
||||
assign(5)
|
||||
|
||||
Other Notes:
|
||||
You should not trust $encode() to return any specific string. You may
|
||||
only trust that it is unique given the input string, and that you may
|
||||
use the return value as an lvalue. Any other use of $encode() should be
|
||||
considered an error.
|
||||
|
||||
21
bitchx-docs/6_Functions/eof
Normal file
21
bitchx-docs/6_Functions/eof
Normal file
@@ -0,0 +1,21 @@
|
||||
Synopsis:
|
||||
$eof(<file descriptor>)
|
||||
|
||||
Technical:
|
||||
This function tests whether the client is currently at the end of the
|
||||
file pointed to by the given file descriptor. The only valid input is
|
||||
a file descriptor returned by the $open() function.
|
||||
|
||||
Practical:
|
||||
This function is used to see if the end of a file has been reached.
|
||||
This is mostly useful while reading a file, such that it can be closed
|
||||
once the end is reached.
|
||||
|
||||
Returns:
|
||||
-1 error, no such file descriptor
|
||||
0 not at end of file
|
||||
1 end of file reached
|
||||
|
||||
See also:
|
||||
close(6); open(6); read(6)
|
||||
|
||||
20
bitchx-docs/6_Functions/epic
Normal file
20
bitchx-docs/6_Functions/epic
Normal file
@@ -0,0 +1,20 @@
|
||||
Synopsis:
|
||||
$epic()
|
||||
|
||||
Technical:
|
||||
Returns true if the client is an EPIC client.
|
||||
|
||||
Practical:
|
||||
If this function returns true, the client is an EPIC3 client, or some
|
||||
variant of it. The $V and $J expandos will tell you the exact version
|
||||
of the client. This function is necessary because the stock ircII
|
||||
client's value for $V and EPIC's overlap. This is mostly a useful way
|
||||
for scripts to see if they can load or not.
|
||||
|
||||
Returns:
|
||||
> 0 client is an EPIC client
|
||||
0 client is not an EPIC client (should never happen)
|
||||
|
||||
See Also:
|
||||
Special_Vars(7)
|
||||
|
||||
31
bitchx-docs/6_Functions/fexist
Normal file
31
bitchx-docs/6_Functions/fexist
Normal file
@@ -0,0 +1,31 @@
|
||||
Synopsis:
|
||||
$fexist(<file>)
|
||||
|
||||
Technical:
|
||||
This function tests for the existence of the given file. The function
|
||||
permits tilde-expansion.
|
||||
|
||||
Practical:
|
||||
This function is used when you want to see if a particular file exists.
|
||||
This could be useful to make sure a file is present before trying to
|
||||
load it.
|
||||
|
||||
Returns:
|
||||
-1 error, unable to access file
|
||||
1 file exists and client has read permission
|
||||
|
||||
Examples:
|
||||
$fexist(/etc/passwd) probably will return 1
|
||||
$fexist(~/.ircrc) probably will return 1 too
|
||||
$fexist(fake_file) returns -1
|
||||
|
||||
See Also:
|
||||
open(6)
|
||||
|
||||
Other Notes:
|
||||
This function never returns 0. This is worth noting, because the natural
|
||||
tendency will be to check for the return value's existence, not its
|
||||
actual value (meaning it always returns "true", as far as the client's
|
||||
string parser is concerned). This was done intentionally to match the
|
||||
return values of $fsize().
|
||||
|
||||
26
bitchx-docs/6_Functions/filter
Normal file
26
bitchx-docs/6_Functions/filter
Normal file
@@ -0,0 +1,26 @@
|
||||
Synopsis:
|
||||
$filter(<pattern> <word list>)
|
||||
$rfilter(<word> <pattern list>)
|
||||
|
||||
Technical:
|
||||
These function are used to filter out any items from the input list that
|
||||
do not match the given word (for $rfilter()) or pattern (for $filter()).
|
||||
If there are no matches, the entire input list is returned.
|
||||
|
||||
Practical:
|
||||
These functions are effectively the opposite of the $pattern() and
|
||||
$rpattern() functions. The pattern functions return items that do match,
|
||||
while the filter functions return those that don't.
|
||||
|
||||
Returns:
|
||||
items in input list that do not match given word/pattern
|
||||
|
||||
Examples:
|
||||
$filter(*oo* booya blah foobar) returns "blah"
|
||||
$filter(*oo* blah erf twiddle) returns "blah erf twiddle"
|
||||
$rfilter(blah b* *oo* *bar) returns "*oo* *bar"
|
||||
$rfilter(blah foo* *ya *bar) returns "foo* *ya *bar"
|
||||
|
||||
See Also:
|
||||
pattern(6); rpattern(6)
|
||||
|
||||
46
bitchx-docs/6_Functions/finditem
Normal file
46
bitchx-docs/6_Functions/finditem
Normal file
@@ -0,0 +1,46 @@
|
||||
Synopsis:
|
||||
$finditem(<array> <string>)
|
||||
$ifinditem(<array> <string>)
|
||||
$ifindfirst(<array> <string>)
|
||||
|
||||
Technical:
|
||||
These functions do a binary search on the items stored in the given
|
||||
array, looking for an exact match of the input string. It will only
|
||||
return the results of an exact match. Unlike other string handlers in
|
||||
the client, these are case-sensitive. They only operate on arrays
|
||||
created with the $setitem() function.
|
||||
|
||||
These functions differ only in which exact match they will return. The
|
||||
$finditem() function returns the item number of the first match found;
|
||||
it does not check the array sequentially, so other exact matches with
|
||||
lower item numbers may not be returned. The $ifinditem() function is
|
||||
same, except it returns the index number of the first match found (also
|
||||
regardless of the actual indexing order). The $ifindfirst function is
|
||||
similar to $ifinditem(), except it returns the first exact match after
|
||||
the array has been sorted.
|
||||
|
||||
Practical:
|
||||
These functions are useful when you want to see if a particular string is
|
||||
present in an array. Being sensitive to case, they are more precise than
|
||||
the general pattern-matching functions.
|
||||
|
||||
Returns:
|
||||
-2 item not found in array
|
||||
-1 array does not exist
|
||||
> -1 item/index number that matches input
|
||||
|
||||
Examples:
|
||||
/* contrived sample array */
|
||||
$setitem(booya 0 blah)
|
||||
$setitem(booya 1 foobar)
|
||||
$setitem(booya 2 blah)
|
||||
|
||||
$finditem(booya blah) returns 0
|
||||
$ifinditem(booya blah) returns 1
|
||||
$ifindfirst(booya blah) returns 0
|
||||
$finditem(booya Blah) returns -1
|
||||
$finditem(foobar blah) returns -2
|
||||
|
||||
See Also:
|
||||
Arrays(7); getitem(6); setitem(6)
|
||||
|
||||
23
bitchx-docs/6_Functions/findw
Normal file
23
bitchx-docs/6_Functions/findw
Normal file
@@ -0,0 +1,23 @@
|
||||
Synopsis:
|
||||
$findw(<word> <wordlist>)
|
||||
|
||||
Technical:
|
||||
This function searches <wordlist> for <word> and returns the place it was
|
||||
found. If <word> isn't in <wordlist>, -1 is returned.
|
||||
|
||||
Practical:
|
||||
This function should put many scripters to ease, as it has been written
|
||||
into many scripts :)
|
||||
|
||||
Returns:
|
||||
index to <word> in <wordlist>
|
||||
|
||||
Examples:
|
||||
$findw(very epic is a very scriptable client) /* returns 3 */
|
||||
|
||||
assign test blah hmm foo bar
|
||||
eval echo $word($findw(hmm $test) $test) /* returns "hmm" */
|
||||
|
||||
See Also:
|
||||
word(6).
|
||||
|
||||
17
bitchx-docs/6_Functions/fnexist
Normal file
17
bitchx-docs/6_Functions/fnexist
Normal file
@@ -0,0 +1,17 @@
|
||||
Synopsis:
|
||||
$fnexist(<function>)
|
||||
|
||||
Technical:
|
||||
This function tells wether or not a built-in function exists.
|
||||
|
||||
Practical:
|
||||
This can be used to emulate a built-in function in older versions of epic
|
||||
that may not support it.
|
||||
|
||||
Returns:
|
||||
1 If the built-in function <function> exists
|
||||
0 If <function> doesn't exist
|
||||
|
||||
See Also:
|
||||
cexist(6)
|
||||
|
||||
28
bitchx-docs/6_Functions/fromw
Normal file
28
bitchx-docs/6_Functions/fromw
Normal file
@@ -0,0 +1,28 @@
|
||||
Synopsis:
|
||||
$fromw(<word> <list of words>)
|
||||
$tow(<word> <list of words>)
|
||||
|
||||
Technical:
|
||||
These two functions are used to filter a range of words from the given
|
||||
input string. The $fromw() function starts at the first occurrence of the
|
||||
specified word, and returns it and all that follow it. The $tow()
|
||||
function is the opposite, returning all words up to and including the
|
||||
search word.
|
||||
|
||||
Practical:
|
||||
The mnemonic for these functions are "from word" and "to word". The
|
||||
most important distinction is that they include the search word in the
|
||||
return string, where functions like $afterw() and $beforew() do not.
|
||||
|
||||
Returns:
|
||||
list of words
|
||||
|
||||
Examples:
|
||||
$tow(two one two three) returns "one two"
|
||||
$tow(four one two three) returns nothing, "four" not in list
|
||||
$fromw(two one two three) returns "two three"
|
||||
$fromw(four one two three) returns nothing, "four" not in list
|
||||
|
||||
See Also:
|
||||
afterw(6); beforew(6)
|
||||
|
||||
18
bitchx-docs/6_Functions/fsize
Normal file
18
bitchx-docs/6_Functions/fsize
Normal file
@@ -0,0 +1,18 @@
|
||||
Synopsis:
|
||||
$fsize(<file>)
|
||||
|
||||
Technical:
|
||||
This function attempts to determine the size of the given file. Tilde-
|
||||
expansion is permitted.
|
||||
|
||||
Practical:
|
||||
This function is used to get the size of a file. This can be useful
|
||||
for seeing is a file exists, but has a zero length.
|
||||
|
||||
Returns:
|
||||
-1 file does not exists, or no read access
|
||||
> -1 size of file
|
||||
|
||||
See Also:
|
||||
fexist(6)
|
||||
|
||||
18
bitchx-docs/6_Functions/ftime
Normal file
18
bitchx-docs/6_Functions/ftime
Normal file
@@ -0,0 +1,18 @@
|
||||
Synopsis:
|
||||
$ftime(<file>)
|
||||
|
||||
Technical:
|
||||
This function gets the last modified time (mtime) of a file, and returns
|
||||
it in seconds since the epoch.
|
||||
|
||||
Returns:
|
||||
when the file was last modified
|
||||
|
||||
Example:
|
||||
eval echo $stime($ftime(/usr/local/bin/irc))
|
||||
|
||||
"Tue Oct 21 23:30:54 1997"
|
||||
|
||||
See Also:
|
||||
fexist(6); fsize(6)
|
||||
|
||||
18
bitchx-docs/6_Functions/geom
Normal file
18
bitchx-docs/6_Functions/geom
Normal file
@@ -0,0 +1,18 @@
|
||||
Synopsis:
|
||||
$geom()
|
||||
|
||||
Technical:
|
||||
Returns the number of columns wide and the number of lines high that
|
||||
your current screen is.
|
||||
|
||||
Practical:
|
||||
This function is mostly useful by providing the screen width. This
|
||||
could be used by a script to determine how wide it should format its
|
||||
output.
|
||||
|
||||
Returns:
|
||||
X Y "X" is screen's column width, "Y" is screen's line height
|
||||
|
||||
See Also:
|
||||
winsize(6)
|
||||
|
||||
19
bitchx-docs/6_Functions/getarrays
Normal file
19
bitchx-docs/6_Functions/getarrays
Normal file
@@ -0,0 +1,19 @@
|
||||
Synopsis:
|
||||
$getarrays(<pattern>)
|
||||
|
||||
Technical:
|
||||
This function returns a space-seperated list of the names of the existing
|
||||
arrays created by $setitem() that match the given pattern.
|
||||
If the <pattern> argument is omitted all current arrays are returned.
|
||||
|
||||
Practical:
|
||||
This function is used to find all current arrays. This might be useful
|
||||
for modifying data in multiple arrays, when it is not known precisely
|
||||
which ones exist at the moment in question.
|
||||
|
||||
Returns:
|
||||
list of array names, or nothing if none are set
|
||||
|
||||
See Also:
|
||||
Arrays(7); setitem(6)
|
||||
|
||||
13
bitchx-docs/6_Functions/getenv
Normal file
13
bitchx-docs/6_Functions/getenv
Normal file
@@ -0,0 +1,13 @@
|
||||
Synopsis:
|
||||
$getenv(<variable>)
|
||||
|
||||
Technical:
|
||||
This function returns the <variable> from the shell's environment.
|
||||
|
||||
Practical:
|
||||
This function is especially useful when a /set or /assign variable
|
||||
conflicts with an environment variable.
|
||||
|
||||
Returns:
|
||||
Value of <variable> in the environment.
|
||||
|
||||
12
bitchx-docs/6_Functions/getgid
Normal file
12
bitchx-docs/6_Functions/getgid
Normal file
@@ -0,0 +1,12 @@
|
||||
Synopsis:
|
||||
$getgid()
|
||||
|
||||
Technical:
|
||||
Gets the current group id, similar to the Unix system call.
|
||||
|
||||
Returns:
|
||||
current groupid
|
||||
|
||||
See Also:
|
||||
getuid(6); getpgrp(6); getlogin(6)
|
||||
|
||||
24
bitchx-docs/6_Functions/getitem
Normal file
24
bitchx-docs/6_Functions/getitem
Normal file
@@ -0,0 +1,24 @@
|
||||
Synopsis:
|
||||
$getitem(<array> <item#>)
|
||||
$igetitem(<array> <index#>)
|
||||
|
||||
Technical:
|
||||
These functions are used to fetch data held in the given array. The
|
||||
$getitem() function retrieves data based on its item number in the array
|
||||
(counting from zero, the order in which the data was entered). The
|
||||
$igetitem() function retrieves it based on its index number (counting
|
||||
from zero, in a sorted order). These functions only affect arrays
|
||||
created with $setitem().
|
||||
|
||||
Practical:
|
||||
These functions are used to get an item in an array. The applications
|
||||
for these function should be obvious. The $igetitem() function, in
|
||||
particular, is useful for showing an array's contents in alphabetical
|
||||
order.
|
||||
|
||||
Returns:
|
||||
array item data, or empty string if array or item is not found
|
||||
|
||||
See Also:
|
||||
Arrays(7); indextoitem(6); itemtoindex(6); setitem(6)
|
||||
|
||||
13
bitchx-docs/6_Functions/getlogin
Normal file
13
bitchx-docs/6_Functions/getlogin
Normal file
@@ -0,0 +1,13 @@
|
||||
Synopsis:
|
||||
$getlogin()
|
||||
|
||||
Technical:
|
||||
Gets the name of the current logged in user, similar to the Unix
|
||||
system call.
|
||||
|
||||
Returns:
|
||||
current logged in username
|
||||
|
||||
See Also:
|
||||
getuid(6); getgid(6); getpgrp(6)
|
||||
|
||||
22
bitchx-docs/6_Functions/getmatches
Normal file
22
bitchx-docs/6_Functions/getmatches
Normal file
@@ -0,0 +1,22 @@
|
||||
Synopsis:
|
||||
$getmatches(<array> <pattern>)
|
||||
$getrmatches(<array> <string>)
|
||||
|
||||
Technical:
|
||||
This functions operate in a manner similar to $matchitem() and
|
||||
$rmatchitem(), except that they return a list of all items that match
|
||||
the input pattern or string, not just the best match. Item numbers
|
||||
are returned, not the actual array contents.
|
||||
|
||||
Practical:
|
||||
The $getmatches() function is used to retrieve all items in the given
|
||||
array that match the given pattern. Similarly, $getrmatches() is used
|
||||
to retrieve all items that match the given string.
|
||||
|
||||
Returns:
|
||||
list of item numbers corresponding to matches
|
||||
|
||||
See Also:
|
||||
Arrays(7); matchitem(6); rmatchitem(6); igetmatches(6);
|
||||
igetrmatches(6); gettmatch(6)
|
||||
|
||||
31
bitchx-docs/6_Functions/getopt
Normal file
31
bitchx-docs/6_Functions/getopt
Normal file
@@ -0,0 +1,31 @@
|
||||
Synopsis:
|
||||
$getopt(<optopt var> <optarg var> <opt string> <argument list>)
|
||||
|
||||
Technical:
|
||||
Processes a list of switches and args. Returns one switch char each time
|
||||
it's called, sets $<optopt var> to the char, and sets $<optarg var> to the
|
||||
value of the next argument if the switch needs one.
|
||||
|
||||
Syntax for <opt string> and <argument list> should be identical to
|
||||
getopt(3). A ':' in <opt string> is a required argument, and a "::"
|
||||
is an optional one. A '-' by itself in <argument list> is a null
|
||||
argument, and switch parsing stops after a "--"
|
||||
|
||||
If a switch requires an argument, but the argument is missing, $getopt()
|
||||
returns a '-' If a switch is given which isn't in the opt string, the
|
||||
function returns a '!' $<optopt var> is still set in both cases.
|
||||
|
||||
Returns:
|
||||
Returns a switch char.
|
||||
|
||||
Examples:
|
||||
while (option = getopt(optopt optarg "ab:c:" $*)) {
|
||||
switch ($option) {
|
||||
(a) {echo * option "$optopt" used}
|
||||
(b) {echo * option "$optopt" used - $optarg}
|
||||
(c) {echo * option "$optopt" used - $optarg}
|
||||
(!) {echo * option "$optopt" is an invalid option}
|
||||
(-) {echo * option "$optopt" is missing an argument}
|
||||
}
|
||||
}
|
||||
|
||||
13
bitchx-docs/6_Functions/getpgrp
Normal file
13
bitchx-docs/6_Functions/getpgrp
Normal file
@@ -0,0 +1,13 @@
|
||||
Synopsis:
|
||||
$getpgrp()
|
||||
|
||||
Technical:
|
||||
Gets the current process group id of the client, similar to the Unix
|
||||
system call.
|
||||
|
||||
Returns:
|
||||
current process group id
|
||||
|
||||
See Also:
|
||||
getuid(6); getgid(6); getlogin(6)
|
||||
|
||||
16
bitchx-docs/6_Functions/getsets
Normal file
16
bitchx-docs/6_Functions/getsets
Normal file
@@ -0,0 +1,16 @@
|
||||
Synopsis:
|
||||
$getsets(<mask>)
|
||||
|
||||
Technical:
|
||||
This function returns the names of all SET(4) variables matching <mask>.
|
||||
|
||||
Returns:
|
||||
space-separated list of the names of all /set variables matching the
|
||||
wildcard <mask>
|
||||
|
||||
Example:
|
||||
$getsets(*tab*) /* returns "TAB TAB_MAX"
|
||||
|
||||
See Also:
|
||||
set(4)
|
||||
|
||||
15
bitchx-docs/6_Functions/gettmatch
Normal file
15
bitchx-docs/6_Functions/gettmatch
Normal file
@@ -0,0 +1,15 @@
|
||||
Synopsis:
|
||||
$gettmatch(<array> <pattern>)
|
||||
|
||||
Technical:
|
||||
This function returns the best match of <pattern> within the array
|
||||
of strings specified by <array>. This is different than getmatches(6),
|
||||
which returns all matches.
|
||||
|
||||
Returns:
|
||||
best wildcard match of <pattern> within the array <array>
|
||||
|
||||
See Also:
|
||||
Arrays(7); getmatches(6); getrmatches(6); igetmatches(6);
|
||||
igetrmatches(6)
|
||||
|
||||
12
bitchx-docs/6_Functions/getuid
Normal file
12
bitchx-docs/6_Functions/getuid
Normal file
@@ -0,0 +1,12 @@
|
||||
Synopsis:
|
||||
$getuid()
|
||||
|
||||
Technical:
|
||||
Gets the current user id, similar to the Unix system call.
|
||||
|
||||
Returns:
|
||||
current userid
|
||||
|
||||
See Also:
|
||||
getgid(6); getpgrp(6); getlogin(6)
|
||||
|
||||
33
bitchx-docs/6_Functions/glob
Normal file
33
bitchx-docs/6_Functions/glob
Normal file
@@ -0,0 +1,33 @@
|
||||
Synopsis:
|
||||
$glob(<file glob pattern>)
|
||||
|
||||
Technical:
|
||||
This function is used to find filenames that are matched by specified
|
||||
patterns. This function is controlled by a compile time option, so it
|
||||
may not be available on every installation. Multiple patterns may be
|
||||
specified. Hidden files (dot-files) are not displayed unless a glob
|
||||
pattern beginning with a dot is given.
|
||||
|
||||
Practical:
|
||||
This function gives the client the file globbing abilities of modern
|
||||
Unix command shells. It will attempt to find any file or directory
|
||||
names matching the given glob pattern. This is highly useful for
|
||||
listing files, or finding files with similar names.
|
||||
|
||||
Returns:
|
||||
list of files matching input glob pattern, nothing if none match
|
||||
|
||||
Examples:
|
||||
$glob(~/*) returns all non-hidden files in your home directory
|
||||
$glob(*) returns all non-hidden files in your current directory
|
||||
$glob(.*) returns all hidden files in your current directory
|
||||
$glob(f*) returns all non-hidden files that start with "f" in cwd
|
||||
|
||||
See Also:
|
||||
fexist(6); fsize(6)
|
||||
|
||||
Restrictions:
|
||||
This function may not be present in all clients. A compile-time option
|
||||
is available to disable it. The function is present if the string
|
||||
returned by $info(o) has a "g" in it.
|
||||
|
||||
19
bitchx-docs/6_Functions/gui
Normal file
19
bitchx-docs/6_Functions/gui
Normal file
@@ -0,0 +1,19 @@
|
||||
Synopsis:
|
||||
$gui()
|
||||
|
||||
Technical:
|
||||
Returns true if the client is a GUI client.
|
||||
|
||||
Practical:
|
||||
If this function returns true, the client is a GUI client. Either
|
||||
Presentation Manager, GTK or any other GUIs that get added. This function
|
||||
is here to allow scripts to know whether the client they are being run
|
||||
on have the necessary functionality to execute graphical functions.
|
||||
|
||||
Returns:
|
||||
> 0 client is a GUI client
|
||||
0 client is not a GUI client
|
||||
|
||||
See Also:
|
||||
Special_Vars(7)
|
||||
|
||||
19
bitchx-docs/6_Functions/idle
Normal file
19
bitchx-docs/6_Functions/idle
Normal file
@@ -0,0 +1,19 @@
|
||||
Synopsis:
|
||||
$idle()
|
||||
|
||||
Technical:
|
||||
Returns your idle time. Synonymous with $E. Present for compatibility
|
||||
with the standard ircII 2.8.2 client.
|
||||
|
||||
Practical:
|
||||
This function is used to get your client's idle time. It should be used
|
||||
in lieu of $E if you intend your script to be compatible with the stock
|
||||
ircII client. Note that the client's concept of "idle time" is not
|
||||
necessarily the same as your server's (and in fact usually isn't).
|
||||
|
||||
Returns:
|
||||
number of seconds since last keypress
|
||||
|
||||
See Also:
|
||||
Special_Vars(7)
|
||||
|
||||
46
bitchx-docs/6_Functions/ifindfirst
Normal file
46
bitchx-docs/6_Functions/ifindfirst
Normal file
@@ -0,0 +1,46 @@
|
||||
Synopsis:
|
||||
$finditem(<array> <string>)
|
||||
$ifinditem(<array> <string>)
|
||||
$ifindfirst(<array> <string>)
|
||||
|
||||
Technical:
|
||||
These functions do a binary search on the items stored in the given
|
||||
array, looking for an exact match of the input string. It will only
|
||||
return the results of an exact match. Unlike other string handlers in
|
||||
the client, these are case-sensitive. They only operate on arrays
|
||||
created with the $setitem() function.
|
||||
|
||||
These functions differ only in which exact match they will return. The
|
||||
$finditem() function returns the item number of the first match found;
|
||||
it does not check the array sequentially, so other exact matches with
|
||||
lower item numbers may not be returned. The $ifinditem() function is
|
||||
same, except it returns the index number of the first match found (also
|
||||
regardless of the actual indexing order). The $ifindfirst function is
|
||||
similar to $ifinditem(), except it returns the first exact match after
|
||||
the array has been sorted.
|
||||
|
||||
Practical:
|
||||
These functions are useful when you want to see if a particular string is
|
||||
present in an array. Being sensitive to case, they are more precise than
|
||||
the general pattern-matching functions.
|
||||
|
||||
Returns:
|
||||
-2 item not found in array
|
||||
-1 array does not exist
|
||||
> -1 item/index number that matches input
|
||||
|
||||
Examples:
|
||||
/* contrived sample array */
|
||||
$setitem(booya 0 blah)
|
||||
$setitem(booya 1 foobar)
|
||||
$setitem(booya 2 blah)
|
||||
|
||||
$finditem(booya blah) returns 0
|
||||
$ifinditem(booya blah) returns 1
|
||||
$ifindfirst(booya blah) returns 0
|
||||
$finditem(booya Blah) returns -1
|
||||
$finditem(foobar blah) returns -2
|
||||
|
||||
See Also:
|
||||
Arrays(7); getitem(6); setitem(6)
|
||||
|
||||
46
bitchx-docs/6_Functions/ifinditem
Normal file
46
bitchx-docs/6_Functions/ifinditem
Normal file
@@ -0,0 +1,46 @@
|
||||
Synopsis:
|
||||
$finditem(<array> <string>)
|
||||
$ifinditem(<array> <string>)
|
||||
$ifindfirst(<array> <string>)
|
||||
|
||||
Technical:
|
||||
These functions do a binary search on the items stored in the given
|
||||
array, looking for an exact match of the input string. It will only
|
||||
return the results of an exact match. Unlike other string handlers in
|
||||
the client, these are case-sensitive. They only operate on arrays
|
||||
created with the $setitem() function.
|
||||
|
||||
These functions differ only in which exact match they will return. The
|
||||
$finditem() function returns the item number of the first match found;
|
||||
it does not check the array sequentially, so other exact matches with
|
||||
lower item numbers may not be returned. The $ifinditem() function is
|
||||
same, except it returns the index number of the first match found (also
|
||||
regardless of the actual indexing order). The $ifindfirst function is
|
||||
similar to $ifinditem(), except it returns the first exact match after
|
||||
the array has been sorted.
|
||||
|
||||
Practical:
|
||||
These functions are useful when you want to see if a particular string is
|
||||
present in an array. Being sensitive to case, they are more precise than
|
||||
the general pattern-matching functions.
|
||||
|
||||
Returns:
|
||||
-2 item not found in array
|
||||
-1 array does not exist
|
||||
> -1 item/index number that matches input
|
||||
|
||||
Examples:
|
||||
/* contrived sample array */
|
||||
$setitem(booya 0 blah)
|
||||
$setitem(booya 1 foobar)
|
||||
$setitem(booya 2 blah)
|
||||
|
||||
$finditem(booya blah) returns 0
|
||||
$ifinditem(booya blah) returns 1
|
||||
$ifindfirst(booya blah) returns 0
|
||||
$finditem(booya Blah) returns -1
|
||||
$finditem(foobar blah) returns -2
|
||||
|
||||
See Also:
|
||||
Arrays(7); getitem(6); setitem(6)
|
||||
|
||||
16
bitchx-docs/6_Functions/igetmatches
Normal file
16
bitchx-docs/6_Functions/igetmatches
Normal file
@@ -0,0 +1,16 @@
|
||||
Synopsis:
|
||||
$igetmatches(<array> <pattern>)
|
||||
$igetrmatches(<array> <string>)
|
||||
|
||||
Technical:
|
||||
This functions operate in a manner similar to $getmatches() and
|
||||
$getrmatches(), except that they return an index number (in alphabetical
|
||||
order) of the array members rather than the item numbers.
|
||||
|
||||
Returns:
|
||||
space-separated list of array index numbers corresponding to matches
|
||||
|
||||
See Also:
|
||||
Arrays(7); matchitem(6); rmatchitem(6); getmatches(6);
|
||||
getrmatches(6); gettmatch(6)
|
||||
|
||||
27
bitchx-docs/6_Functions/igmask
Normal file
27
bitchx-docs/6_Functions/igmask
Normal file
@@ -0,0 +1,27 @@
|
||||
Synopsis:
|
||||
$igmask(<mask>)
|
||||
|
||||
Technical:
|
||||
Scriptable interface to the list of users on the ignore(1) list.
|
||||
|
||||
Practical:
|
||||
This function would be ideal in a script that redefines the ignore(1)
|
||||
command. The script could display the list of ignores, or even tell the
|
||||
user if they're ignoring the same user twice.
|
||||
|
||||
Returns:
|
||||
space separated list of entries in the ignore list matching <mask>
|
||||
|
||||
Examples:
|
||||
/ignore foo!bar@test.org ALL
|
||||
/ignore nobody!fnord@more.nothing.com MSGS
|
||||
|
||||
/eval echo $igmask(*foo*)
|
||||
FOO!BAR@TEST.ORG
|
||||
|
||||
/eval echo $igmask(*)
|
||||
FOO!BAR@TEST.ORG NOBODY!FNORD@MORE.NOTHING.COM
|
||||
|
||||
See Also:
|
||||
ignore(1); rigmask(6); igtype(6); rigtype(6)
|
||||
|
||||
25
bitchx-docs/6_Functions/igtype
Normal file
25
bitchx-docs/6_Functions/igtype
Normal file
@@ -0,0 +1,25 @@
|
||||
Synopsis:
|
||||
$igtype(<ignore pattern>)
|
||||
|
||||
Technical:
|
||||
Takes an entry from the ignore(1) list as an argument, and returns all
|
||||
levels for that pattern.
|
||||
|
||||
Returns:
|
||||
space-separated list of ignore levels for <ignore pattern>
|
||||
|
||||
Examples:
|
||||
/ignore nobody!fnord@more.nothing.com MSGS NOTICES
|
||||
|
||||
/assign temp $igmask(*fnord*) /* assigns "NOBODY!FNORD@MORE.NOTHING.COM"
|
||||
to $temp */
|
||||
|
||||
$igtype($temp) /* returns " MSGS NOTICES" */
|
||||
|
||||
See Also:
|
||||
ignore(1); rigmask(6); igmask(6); rigtype(6)
|
||||
|
||||
Other Notes:
|
||||
This command does *NOT* do matching. The igmask(6) function must be used
|
||||
to get a complete ignore pattern for $igtype.
|
||||
|
||||
37
bitchx-docs/6_Functions/index
Normal file
37
bitchx-docs/6_Functions/index
Normal file
@@ -0,0 +1,37 @@
|
||||
Synopsis:
|
||||
$index(<characters> <text>)
|
||||
$rindex(<characters> <text>)
|
||||
|
||||
Technical:
|
||||
These functions are the equivalent of the BSD library functions index()
|
||||
and rindex() (and their ANSI equivalents, strchr() and strrchr()). They
|
||||
return the index to the first character in the given text that appears
|
||||
in the list of characters.
|
||||
|
||||
The $index() function searches the text left to right, and $rindex()
|
||||
searches right to left. The index, however, always counts from left to
|
||||
right, starting at 0 (zero). The first word passed to the function is
|
||||
assumed to be the list of characters to look for; to insert a space, it
|
||||
must be escaped with a \, unless it is the first character. To insert a
|
||||
backslash, it must also be escaped.
|
||||
|
||||
Practical:
|
||||
These functions are generally most useful in argument processing. For
|
||||
instance, they can be used to parse a list of command-line switches
|
||||
passed to an alias.
|
||||
|
||||
Returns:
|
||||
-1 no matches found
|
||||
> -1 index to character
|
||||
|
||||
Examples:
|
||||
$index(abc hello there bob) returns 12
|
||||
$index(xyz hello there bob) returns -1
|
||||
$rindex(abc hello there bob) returns 14
|
||||
$rindex(xyz hello there bob) returns -1
|
||||
|
||||
Other Notes:
|
||||
Keep in mind that a failed search returns -1, not 0. This has already
|
||||
been stated, but it is misused often enough that this reminder is
|
||||
warranted.
|
||||
|
||||
41
bitchx-docs/6_Functions/indextoitem
Normal file
41
bitchx-docs/6_Functions/indextoitem
Normal file
@@ -0,0 +1,41 @@
|
||||
Synopsis:
|
||||
$indextoitem(<array> <index number>)
|
||||
$itemtoindex(<array> <item number>)
|
||||
|
||||
Technical:
|
||||
These functions are used to convert between array item numbers are index
|
||||
numbers.
|
||||
|
||||
Item numbers are counted incrementally as items are added to an array,
|
||||
starting at 0 (zero). Each new item uses the next available item number;
|
||||
if there are 5 items in an array, the next item that may be added is item
|
||||
number 5 (remember that we count from zero... 5 items is 0..4).
|
||||
|
||||
Index numbers represent each items position in the array when sorted.
|
||||
Items are sorted based on their ascii values. This is generally
|
||||
alphabetical; however, since it is based on ascii values, all capital
|
||||
letters are sorted after all lowercase letters. It follows a sorting
|
||||
algorithm similar to the $sort() function's.
|
||||
|
||||
Practical:
|
||||
The $indextoitem() function converts an index number in the given array
|
||||
to its corresponding item number; $itemtoindex() does just the opposite.
|
||||
This is mostly useful in conjunction with $igetitem() or $ifinditem(),
|
||||
allowing an array to be dealt with in a logical order.
|
||||
|
||||
Returns:
|
||||
-2 cannot find index/item number in array
|
||||
-1 cannot find named array
|
||||
> -1 item number corresponding to given index number (and vice verse)
|
||||
|
||||
Examples:
|
||||
$setitem(booya 0 hello)
|
||||
$setitem(booya 1 goodbye)
|
||||
$itemtoindex(booya 0) returns 1
|
||||
$indextoitem(booya 1) returns 0
|
||||
$itemtoindex(foobar 0) returns -1
|
||||
$itemtoindex(booya 100) returns -2
|
||||
|
||||
See Also:
|
||||
Arrays(7); ifinditem(6); igetitem(6); setitem(6); sort(6)
|
||||
|
||||
29
bitchx-docs/6_Functions/info
Normal file
29
bitchx-docs/6_Functions/info
Normal file
@@ -0,0 +1,29 @@
|
||||
Synopsis:
|
||||
$info(C|O|S)
|
||||
|
||||
Technical:
|
||||
This function returns information about how the client was compiled.
|
||||
|
||||
Practical:
|
||||
This function is used to fetch information stored in the client at
|
||||
compile time. It can be used to find out who compiled it, and when;
|
||||
what #define options were enabled; and to get the checksums of the
|
||||
binary.
|
||||
|
||||
Returns:
|
||||
requested information
|
||||
|
||||
Options:
|
||||
c user@machine that compiled client, and time of compilation
|
||||
o compile-time options used
|
||||
s binary checksums
|
||||
|
||||
Examples:
|
||||
$info(c) might return
|
||||
"Compiled by root@foobar on Fri Jan 3 1997 at 01:56:24 CST"
|
||||
$info(o) might return "2aefgknvzc"
|
||||
$info(s) might return "1138232081 989 info.c.sh"
|
||||
|
||||
See Also:
|
||||
Compile_Opts(7)
|
||||
|
||||
24
bitchx-docs/6_Functions/insertw
Normal file
24
bitchx-docs/6_Functions/insertw
Normal file
@@ -0,0 +1,24 @@
|
||||
Synopsis:
|
||||
$insertw(<index> <word> <text>)
|
||||
|
||||
Technical:
|
||||
This function inserts the given word into the given text, in the position
|
||||
indicated by the given index. It returns the resultant string. The
|
||||
index counts from 0 (zero).
|
||||
|
||||
Practical:
|
||||
This function is used when you want to insert a word into an existing
|
||||
text string (usually held in a variable). This could be useful as a
|
||||
pseudo-unshift mechanism; using an index of 0 would yield the same
|
||||
results as $unshift(), but in truth any offset could be used (thus
|
||||
keeping the first few words intact, and unshifting the rest).
|
||||
|
||||
Returns:
|
||||
input text with word inserted
|
||||
|
||||
Examples:
|
||||
$insertw(1 blah hi there bob) returns "hi blah there bob"
|
||||
|
||||
See Also:
|
||||
remw(6); unshift(6)
|
||||
|
||||
29
bitchx-docs/6_Functions/iptoname
Normal file
29
bitchx-docs/6_Functions/iptoname
Normal file
@@ -0,0 +1,29 @@
|
||||
Synopsis:
|
||||
$iptoname(<ip address>)
|
||||
$nametoip(<hostname>)
|
||||
|
||||
Technical:
|
||||
These functions are used to convert an IP address to a hostname, and vice
|
||||
versa. The $iptoname() function returns the hostname associated with
|
||||
the given IP address, and $nametoip() does the opposite.
|
||||
|
||||
Practical:
|
||||
These functions are used to convert between IP addresses and Internet
|
||||
hostnames. Obvious reasons aside, they are mostly useful when you know
|
||||
which of the two the input will be. They return nothing if the address
|
||||
could not be converted, or if the input was invalid. The $convert()
|
||||
function should be used if the input is known to vary.
|
||||
|
||||
Returns:
|
||||
iptoname: hostname for the given IP address
|
||||
nametoip: IP address for the given hostname
|
||||
|
||||
Examples:
|
||||
$iptoname(127.0.0.1) probably returns "localhost"
|
||||
$nametoip(localhost) probably returns "127.0.0.1"
|
||||
$iptoname(localhost) error, input is not an IP address
|
||||
$nametoip(127.0.0.1) error, input is not a hostname
|
||||
|
||||
See Also:
|
||||
convert(6)
|
||||
|
||||
15
bitchx-docs/6_Functions/irclib
Normal file
15
bitchx-docs/6_Functions/irclib
Normal file
@@ -0,0 +1,15 @@
|
||||
Synopsis:
|
||||
$irclib()
|
||||
|
||||
Technical:
|
||||
This function returns the irc library directory, specified at compile time.
|
||||
|
||||
Practical:
|
||||
It can be used to locate scripts or whatnot.
|
||||
|
||||
Examples:
|
||||
load $irclib()/script/motd /* loads the "motd" script */
|
||||
|
||||
See Also:
|
||||
load(5);
|
||||
|
||||
26
bitchx-docs/6_Functions/isalpha
Normal file
26
bitchx-docs/6_Functions/isalpha
Normal file
@@ -0,0 +1,26 @@
|
||||
Synopsis:
|
||||
$isalpha(<text>)
|
||||
$isdigit(<text>)
|
||||
|
||||
Technical:
|
||||
These function test whether the first character in the given string is
|
||||
an alphabetical character or a digit. Only the first character is
|
||||
tested.
|
||||
|
||||
Practical:
|
||||
These functions are useful for testing an input string to see whether it
|
||||
is a number or a text string. One use for this might be to check if it
|
||||
would be suitable input for $iptoname() or $nametoip(). Keep in mind
|
||||
that only the first character is tested, so this isn't a reliable way
|
||||
to see if the entire string is a number.
|
||||
|
||||
Returns:
|
||||
"true" or "false" value if first character is a letter or a digit
|
||||
|
||||
Examples:
|
||||
$isalpha(hello) returns true
|
||||
$isalpha(2hello) returns false
|
||||
$isdigit(123) returns true
|
||||
$isdigit(2abc) returns true
|
||||
$isdigit(a123) returns false
|
||||
|
||||
29
bitchx-docs/6_Functions/ischannel
Normal file
29
bitchx-docs/6_Functions/ischannel
Normal file
@@ -0,0 +1,29 @@
|
||||
Synopsis:
|
||||
$ischannel(<channel name>)
|
||||
|
||||
Technical:
|
||||
This function checks whether the input channel name is a valid channel
|
||||
name. It does NOT check whether the channel actually exists, only that
|
||||
the name would be legal to use as a channel name.
|
||||
|
||||
Practical:
|
||||
This function compares the given channel name against the known server
|
||||
rules for channel names to determine if the server is likely to allow
|
||||
a channel with such a name. Contrary to common belief, it does not
|
||||
check for the existence of a channel.
|
||||
|
||||
Returns:
|
||||
"true" value if channel name is legal, "false" otherwise
|
||||
|
||||
Examples:
|
||||
$ischannel(#blah) returns true
|
||||
$ischannel(&blah) returns true
|
||||
$ischannel(blah) returns false
|
||||
|
||||
See Also:
|
||||
join(1)
|
||||
|
||||
Bugs:
|
||||
This function does not take ircd 2.9's modeless channels (prefixed with
|
||||
a '+') into account when determining the legality of a channel name.
|
||||
|
||||
19
bitchx-docs/6_Functions/ischanop
Normal file
19
bitchx-docs/6_Functions/ischanop
Normal file
@@ -0,0 +1,19 @@
|
||||
Synopsis:
|
||||
$ischanop(<nick> <channel>)
|
||||
|
||||
Technical:
|
||||
This function tests whether the given user is a channel operator on the
|
||||
given channel. It only functions for channels that you are currently
|
||||
on.
|
||||
|
||||
Practical:
|
||||
This function is used for seeing if someone is a channel operator on one
|
||||
of the channels you're on. This might be useful for an script that
|
||||
gives out chanops to people, to avoid any redundant mode changes.
|
||||
|
||||
Returns:
|
||||
"true" value if user is a channel op, "false" if not or if error
|
||||
|
||||
See Also:
|
||||
chops(6); nochops(6)
|
||||
|
||||
15
bitchx-docs/6_Functions/ischanvoice
Normal file
15
bitchx-docs/6_Functions/ischanvoice
Normal file
@@ -0,0 +1,15 @@
|
||||
Synopsis:
|
||||
$ischanvoice(<nick> <channel>)
|
||||
|
||||
Technical:
|
||||
This function tells wether or not the user <nick> has voice status on the
|
||||
channel specified by <channel>.
|
||||
|
||||
Returns:
|
||||
1 user has voice
|
||||
0 user does not have voice
|
||||
-1 undetermined
|
||||
|
||||
See Also:
|
||||
ischanop(6)
|
||||
|
||||
19
bitchx-docs/6_Functions/isconnected
Normal file
19
bitchx-docs/6_Functions/isconnected
Normal file
@@ -0,0 +1,19 @@
|
||||
Synopsis:
|
||||
$isconnected([<server refnum>])
|
||||
|
||||
Technical:
|
||||
This function tells wether a server is fully connected and ready to
|
||||
receive data. If no arguments are given, the last server to send you data
|
||||
is assumed.
|
||||
|
||||
Returns:
|
||||
1 If <server refnum> is connected and ready
|
||||
else returns -1
|
||||
|
||||
Examples:
|
||||
/window refnum 1 server irc.primenet.com
|
||||
$isconnected(1) returns 1
|
||||
|
||||
See Also:
|
||||
servername(6)
|
||||
|
||||
20
bitchx-docs/6_Functions/iscurchan
Normal file
20
bitchx-docs/6_Functions/iscurchan
Normal file
@@ -0,0 +1,20 @@
|
||||
Synopsis:
|
||||
$iscurchan(<channel name>)
|
||||
|
||||
Technical:
|
||||
This function returns '1' if the input channel name is the current channel
|
||||
on any window connected to the current server.
|
||||
|
||||
Practical:
|
||||
This function was intended to allow more flexibility for testing the
|
||||
current channel in an ON hook.
|
||||
|
||||
Returns:
|
||||
'1' if <channel name> is a current channel, else returns '0'
|
||||
|
||||
Examples:
|
||||
Instead of:
|
||||
/on ^send_public * {if ([$0] == C) {...} {...}}
|
||||
Try doing:
|
||||
/on ^send_public * {if (iscurchan($0)) {....} {...}}
|
||||
|
||||
26
bitchx-docs/6_Functions/isdigit
Normal file
26
bitchx-docs/6_Functions/isdigit
Normal file
@@ -0,0 +1,26 @@
|
||||
Synopsis:
|
||||
$isalpha(<text>)
|
||||
$isdigit(<text>)
|
||||
|
||||
Technical:
|
||||
These function test whether the first character in the given string is
|
||||
an alphabetical character or a digit. Only the first character is
|
||||
tested.
|
||||
|
||||
Practical:
|
||||
These functions are useful for testing an input string to see whether it
|
||||
is a number or a text string. One use for this might be to check if it
|
||||
would be suitable input for $iptoname() or $nametoip(). Keep in mind
|
||||
that only the first character is tested, so this isn't a reliable way
|
||||
to see if the entire string is a number.
|
||||
|
||||
Returns:
|
||||
"true" or "false" value if first character is a letter or a digit
|
||||
|
||||
Examples:
|
||||
$isalpha(hello) returns true
|
||||
$isalpha(2hello) returns false
|
||||
$isdigit(123) returns true
|
||||
$isdigit(2abc) returns true
|
||||
$isdigit(a123) returns false
|
||||
|
||||
33
bitchx-docs/6_Functions/isnumber
Normal file
33
bitchx-docs/6_Functions/isnumber
Normal file
@@ -0,0 +1,33 @@
|
||||
Synopsis:
|
||||
$isalpha(<text>)
|
||||
$isdigit(<text>)
|
||||
$isnumber(<text> <base>>)
|
||||
|
||||
Technical:
|
||||
These function test whether the first character in the given string is
|
||||
an alphabetical character or a digit. Only the first character is
|
||||
tested.
|
||||
|
||||
The function $isnumber() is very similar to $isdigit(), except that
|
||||
it takes two arguments, the second specifying the numeric base of <text>.
|
||||
The second argument must be prefixed with a 'b'; eg. "b8" for base 8, "b16"
|
||||
for base 16. And as always, numbers in base 16 may be prefixed with "0x".
|
||||
|
||||
Practical:
|
||||
These functions are useful for testing an input string to see whether it
|
||||
is a number or a text string. One use for this might be to check if it
|
||||
would be suitable input for $iptoname() or $nametoip(). Keep in mind
|
||||
that only the first character is tested, so this isn't a reliable way
|
||||
to see if the entire string is a number.
|
||||
|
||||
Returns:
|
||||
"true" or "false" value if first character is a letter or a digit
|
||||
|
||||
Examples:
|
||||
$isalpha(hello) returns true
|
||||
$isalpha(2hello) returns false
|
||||
$isdigit(123) returns true
|
||||
$isdigit(2abc) returns true
|
||||
$isdigit(a123) returns false
|
||||
$isnumber(0x9FF b16) returns true
|
||||
|
||||
41
bitchx-docs/6_Functions/itemtoindex
Normal file
41
bitchx-docs/6_Functions/itemtoindex
Normal file
@@ -0,0 +1,41 @@
|
||||
Synopsis:
|
||||
$indextoitem(<array> <index number>)
|
||||
$itemtoindex(<array> <item number>)
|
||||
|
||||
Technical:
|
||||
These functions are used to convert between array item numbers are index
|
||||
numbers.
|
||||
|
||||
Item numbers are counted incrementally as items are added to an array,
|
||||
starting at 0 (zero). Each new item uses the next available item number;
|
||||
if there are 5 items in an array, the next item that may be added is item
|
||||
number 5 (remember that we count from zero... 5 items is 0..4).
|
||||
|
||||
Index numbers represent each items position in the array when sorted.
|
||||
Items are sorted based on their ascii values. This is generally
|
||||
alphabetical; however, since it is based on ascii values, all capital
|
||||
letters are sorted after all lowercase letters. It follows a sorting
|
||||
algorithm similar to the $sort() function's.
|
||||
|
||||
Practical:
|
||||
The $indextoitem() function converts an index number in the given array
|
||||
to its corresponding item number; $itemtoindex() does just the opposite.
|
||||
This is mostly useful in conjunction with $igetitem() or $ifinditem(),
|
||||
allowing an array to be dealt with in a logical order.
|
||||
|
||||
Returns:
|
||||
-2 cannot find index/item number in array
|
||||
-1 cannot find named array
|
||||
> -1 item number corresponding to given index number (and vice verse)
|
||||
|
||||
Examples:
|
||||
$setitem(booya 0 hello)
|
||||
$setitem(booya 1 goodbye)
|
||||
$itemtoindex(booya 0) returns 1
|
||||
$indextoitem(booya 1) returns 0
|
||||
$itemtoindex(foobar 0) returns -1
|
||||
$itemtoindex(booya 100) returns -2
|
||||
|
||||
See Also:
|
||||
Arrays(7); ifinditem(6); igetitem(6); setitem(6); sort(6)
|
||||
|
||||
29
bitchx-docs/6_Functions/jot
Normal file
29
bitchx-docs/6_Functions/jot
Normal file
@@ -0,0 +1,29 @@
|
||||
Synopsis:
|
||||
$jot(<start> <stop>)
|
||||
|
||||
Technical:
|
||||
This script is used to obtain a series of integers, from the first input
|
||||
to the second. Negative numbers are permitted, and the series may be
|
||||
ascending or descending.
|
||||
|
||||
Practical:
|
||||
This function is used to generate a number range. One popular use for
|
||||
this is in conjunction with $chr(), allowing a range of ascii characters
|
||||
to be returned (which then might be stripped from another string, etc.).
|
||||
|
||||
Returns:
|
||||
* number range from start to stop
|
||||
* if less than 2 arguments, empty string
|
||||
* if more than 2 arguments, first argument
|
||||
* if non-digits entered, 0 (zero)
|
||||
|
||||
Examples:
|
||||
$jot(2 6) returns "2 3 4 5 6"
|
||||
$jot(3 -2) returns "3 2 1 0 -1 -2"
|
||||
$jot(4) returns "" (empty string)
|
||||
$jot(4 6 8) returns "4"
|
||||
$jot(a 4) returns "0"
|
||||
|
||||
See Also:
|
||||
chr(6); isdigit(6)
|
||||
|
||||
21
bitchx-docs/6_Functions/key
Normal file
21
bitchx-docs/6_Functions/key
Normal file
@@ -0,0 +1,21 @@
|
||||
Synopsis:
|
||||
$key([<channel>|* [<channel> ...]])
|
||||
|
||||
Technical:
|
||||
This function displays the channel key for each channel specified (if
|
||||
any have a key assigned). If a "*", or no channel, is specified, the
|
||||
current is assumed. It has no effect for channels that you aren't
|
||||
currently on.
|
||||
|
||||
Practical:
|
||||
This function is used to fetch a channel's key. Any number of channels
|
||||
may be specified, though the output could be confusing if only some
|
||||
actually have a key. You must be on the channel(s) specified for the
|
||||
function to have any effect.
|
||||
|
||||
Returns:
|
||||
list of channel keys for given channels, or empty string if none or error
|
||||
|
||||
See Also:
|
||||
chanmode(6)
|
||||
|
||||
27
bitchx-docs/6_Functions/lastclickline
Normal file
27
bitchx-docs/6_Functions/lastclickline
Normal file
@@ -0,0 +1,27 @@
|
||||
Synopsis:
|
||||
$lastclickline(<option>)
|
||||
|
||||
Technical:
|
||||
This function shows text on the last line clicked by the mouse,
|
||||
or some derivitive of it based on the option passed.
|
||||
Possible options:
|
||||
0 - Entire line clicked on without color codes.
|
||||
1 - Entire line with color codes (unimplemented same as 0)
|
||||
2 - (unimplemented same as 0)
|
||||
3 - Returns the word clicked on in the text.
|
||||
4 - Attempts to find a nick in the text clicked on.
|
||||
|
||||
Returns:
|
||||
Text string based on what was last clicked on.
|
||||
|
||||
Examples:
|
||||
For a line like this: "<NuKe> Who is nuke@host.com" when nuke@host.com is
|
||||
the text that was clicked on:
|
||||
|
||||
lastclickline(0) "<NuKe> Who is nuke@host.com"
|
||||
lastclickline(3) "nuke@host.com"
|
||||
lastclickline(4) "nuke"
|
||||
|
||||
See Also:
|
||||
lastclickx(6) lastclicky(6)
|
||||
|
||||
13
bitchx-docs/6_Functions/lastclickx
Normal file
13
bitchx-docs/6_Functions/lastclickx
Normal file
@@ -0,0 +1,13 @@
|
||||
Synopsis:
|
||||
$lastclickx()
|
||||
|
||||
Technical:
|
||||
This function shows the X coordinate (character based) where the last
|
||||
mouse click event occurred.
|
||||
|
||||
Returns:
|
||||
X coordinate
|
||||
|
||||
See Also:
|
||||
lastclicky(6) lastclickline(6)
|
||||
|
||||
13
bitchx-docs/6_Functions/lastclicky
Normal file
13
bitchx-docs/6_Functions/lastclicky
Normal file
@@ -0,0 +1,13 @@
|
||||
Synopsis:
|
||||
$lastclicky()
|
||||
|
||||
Technical:
|
||||
This function shows the Y coordinate (character based) where the last
|
||||
mouse click event occurred.
|
||||
|
||||
Returns:
|
||||
Y coordinate
|
||||
|
||||
See Also:
|
||||
lastclickx(6) lastclickline(6)
|
||||
|
||||
28
bitchx-docs/6_Functions/lastserver
Normal file
28
bitchx-docs/6_Functions/lastserver
Normal file
@@ -0,0 +1,28 @@
|
||||
Synopsis:
|
||||
$lastserver()
|
||||
|
||||
Technical:
|
||||
This function shows the name of the last server to send you a message of
|
||||
any kind. It only has an effect inside hooks.
|
||||
|
||||
Practical:
|
||||
This function shows the name of the server sending the current message.
|
||||
Like $userhost(), it s only useful inside hooks. It might be used to
|
||||
indicate when a message is no coming from the current server.
|
||||
|
||||
Returns:
|
||||
server name
|
||||
|
||||
Examples:
|
||||
To indicate that a remote server is sending the NAMES reply:
|
||||
on ^names "*" {
|
||||
if ( lastserver() == S ) {
|
||||
echo *** On $0: $1- \(from $lastserver()\)
|
||||
} {
|
||||
echo *** On $0: $1-
|
||||
}
|
||||
}
|
||||
|
||||
See Also:
|
||||
userhost(6)
|
||||
|
||||
28
bitchx-docs/6_Functions/left
Normal file
28
bitchx-docs/6_Functions/left
Normal file
@@ -0,0 +1,28 @@
|
||||
Synopsis:
|
||||
$left(<count> <text>)
|
||||
$right(<count> <text>)
|
||||
|
||||
Technical:
|
||||
These functions return a slice of the given length from the input
|
||||
string, either from the left side or the right side of the string. The
|
||||
functions do no padding, so it is more accurate to say that they will
|
||||
return no more than the given number of characters, not necessarily
|
||||
exactly the given amount.
|
||||
|
||||
Practical:
|
||||
The most common use for these functions is fetching a certain number of
|
||||
characters from an arbitrary string, where the length is known, but the
|
||||
contents are inconsequential.
|
||||
|
||||
Returns:
|
||||
substring no longer than specified length
|
||||
|
||||
Examples:
|
||||
$left(5 biklmnopstv) returns "biklm"
|
||||
$left(15 biklmnopstv) returns "biklmnopstv"
|
||||
$left(-2 biklmnopstv) returns nothing
|
||||
$right(5 biklmnopstv) returns "opstv"
|
||||
|
||||
See Also:
|
||||
mid(6)
|
||||
|
||||
15
bitchx-docs/6_Functions/leftpc
Normal file
15
bitchx-docs/6_Functions/leftpc
Normal file
@@ -0,0 +1,15 @@
|
||||
Synopsis:
|
||||
$leftpc(<count> <text>)
|
||||
|
||||
Technical:
|
||||
This function returns the leftmost <count> printable characters of <text>,
|
||||
taking into account ANSI color codes.
|
||||
|
||||
Returns:
|
||||
<count> number of printable characters in <text>
|
||||
|
||||
Examples:
|
||||
$leftpc(10 onetwothre$chr(27)[34mefour)
|
||||
returns
|
||||
onetwothree<blue attribute>
|
||||
|
||||
27
bitchx-docs/6_Functions/leftw
Normal file
27
bitchx-docs/6_Functions/leftw
Normal file
@@ -0,0 +1,27 @@
|
||||
Synopsis:
|
||||
$leftw(<count> <word list>)
|
||||
$rightw(<count> <word list>)
|
||||
|
||||
Technical:
|
||||
These functions are used to return a slice of the input list, from either
|
||||
the beginning or end of the list. It returns the indicated number of
|
||||
words from the beginning or the end of the list.
|
||||
|
||||
Practical:
|
||||
This is mostly useful when you know you always want to get a certain
|
||||
number of starting or ending words in a list, regardless of what they
|
||||
are. They are analogous to $left() and $right(), except they operate on
|
||||
whole words instead of characters.
|
||||
|
||||
Returns:
|
||||
list of words from beginning or end of word list
|
||||
|
||||
Examples:
|
||||
$leftw(2 hello there how are you?) returns "hello there"
|
||||
$leftw(-1 hello there bob) returns nothing
|
||||
$leftw(7 hello there bob) returns "hello there bob"
|
||||
$rightw(2 hello there how are you?) returns "are you?"
|
||||
|
||||
See Also:
|
||||
midw(6); restw(6)
|
||||
|
||||
13
bitchx-docs/6_Functions/listarray
Normal file
13
bitchx-docs/6_Functions/listarray
Normal file
@@ -0,0 +1,13 @@
|
||||
Synopsis:
|
||||
$listarray(<array>)
|
||||
|
||||
Technical:
|
||||
Attempts to list the contents of a particular array if it exists.
|
||||
|
||||
Returns:
|
||||
empty if no array is found or nothing is in the array
|
||||
otherwise returns the contents of the array
|
||||
|
||||
See Also:
|
||||
Arrays(7); getitem(6); setitem(6)
|
||||
|
||||
27
bitchx-docs/6_Functions/listen
Normal file
27
bitchx-docs/6_Functions/listen
Normal file
@@ -0,0 +1,27 @@
|
||||
Synopsis:
|
||||
$listen([<port>])
|
||||
|
||||
Technical:
|
||||
This function causes the client to bind to the given TCP port and listen
|
||||
for incoming connections. The client is not permitted to listen to any
|
||||
port below 1025; they are reserved for privileged system use. If no
|
||||
port is given, the system allocates an arbitrary port above 1024.
|
||||
|
||||
Practical:
|
||||
This function makes the client listen to the given port. This allows,
|
||||
theoretically, someone to connect to that port to use whatever services
|
||||
you have scripted for it. This could be used for something simple,
|
||||
such as a daytime or motd generator, or something more complex like a
|
||||
file server.
|
||||
|
||||
Returns:
|
||||
port number bound to, or nothing if error
|
||||
|
||||
Examples:
|
||||
$listen(1025) returns 1025
|
||||
$listen(1024) error, returns nothing
|
||||
$listen() returns a system-allocated port number
|
||||
|
||||
See Also:
|
||||
connect(6); dcc(1) close, raw; on(5) dcc_raw
|
||||
|
||||
53
bitchx-docs/6_Functions/mask
Normal file
53
bitchx-docs/6_Functions/mask
Normal file
@@ -0,0 +1,53 @@
|
||||
Synopsis:
|
||||
$mask(<type> <address>)
|
||||
|
||||
Technical:
|
||||
This function returns <address> in a wildcard mask according to the type
|
||||
specified by <type>. The mask types are defined in the following table:
|
||||
|
||||
<type> <address> has a hostname <address> has an ip
|
||||
-------------------------------------------------------------------
|
||||
0 *!u@h.d *!u@d.h
|
||||
1 *!*u@h.d *!*u@d.h
|
||||
2 *!*@h.d *!*@d.h
|
||||
3 *!*u@*.d *!*u@d.*
|
||||
4 *!*@*.d *!*@d.*
|
||||
5 n!u@h.d n!u@d.h
|
||||
6 n!*u@h.d n!*u@d.h
|
||||
7 n!*@h.d n!*@d.h
|
||||
8 n!*u@*.d n!*u@d.*
|
||||
9 n!*@*.d n!*@d.*
|
||||
10 *!*@h.d *!*@d.*
|
||||
11 *!*u@h.d *!*u@d.*
|
||||
12 n!*@h.d n!*@d.*
|
||||
13 n!*u@h.d n!*u@d.*
|
||||
|
||||
where n=nick, u=user, h=host, and d=domain
|
||||
|
||||
With the following modifications: In the ``local'' portion of
|
||||
the hostname, all sequence of numbers are substituted with a
|
||||
single '*'. In the username, leading ~'s are also substituted
|
||||
with a single '*'.
|
||||
|
||||
Returns:
|
||||
<address> in a wildcard mask according to <type>
|
||||
|
||||
Examples:
|
||||
$mask(3 foo!bar@long.host.blah.com)
|
||||
returns:
|
||||
*!*bar@*.blah.com
|
||||
|
||||
$mask(10 nick!user@ppp-147-0-52-129.frobitz.com)
|
||||
returns:
|
||||
*!*@ppp-*-*-*-*.frobitz.com
|
||||
|
||||
See also:
|
||||
uhc(6); deuhc(6)
|
||||
|
||||
Other Notes:
|
||||
This function strips all tildes ('~') from the left of the username. For
|
||||
script writers, this means that in mask types 0 and 5, the function is
|
||||
*NOT* guaranteed to produce a mask matching the given address. If a script
|
||||
is to use these types, they should expect tildes to be stripped and be able
|
||||
to act accordingly.
|
||||
|
||||
31
bitchx-docs/6_Functions/match
Normal file
31
bitchx-docs/6_Functions/match
Normal file
@@ -0,0 +1,31 @@
|
||||
Synopsis:
|
||||
$match(<pattern> <word list>)
|
||||
$rmatch(<word> <pattern list>)
|
||||
|
||||
Technical:
|
||||
The $match() function searches through a word list and returns the index
|
||||
to the word that best matches the given pattern. Its opposite is the
|
||||
$rmatch() function, which tries to match a pattern with a list of words.
|
||||
The index counts from 1.
|
||||
|
||||
Practical:
|
||||
These functions are generally most useful for automated processes. For
|
||||
instance, one could try to match a person's address with a predefined
|
||||
list of address patterns to see if the client should automatically
|
||||
accept channel invitations or DCC CHAT requests. Because they return
|
||||
the index to the best match, and not the matching item, they are mostly
|
||||
useful for boolean-type comparisons.
|
||||
|
||||
Returns:
|
||||
0 no matches found
|
||||
>0 index to best match in list
|
||||
|
||||
Examples:
|
||||
$match(*oo* blah foo booya) returns 2
|
||||
$match(*oo* blah fubar erf) returns 0
|
||||
$rmatch(joebob!jbriggs@drivein.com *.com *jbriggs@*) returns 2
|
||||
$rmatch(joebob!jbriggs@drivein.com *.net *jimbob*) returns 0
|
||||
|
||||
See Also:
|
||||
filter(6); pattern(6); rfilter(6); rpattern(6)
|
||||
|
||||
23
bitchx-docs/6_Functions/matchitem
Normal file
23
bitchx-docs/6_Functions/matchitem
Normal file
@@ -0,0 +1,23 @@
|
||||
Synopsis:
|
||||
$matchitem(<array> <word>)
|
||||
$rmatchitem(<array> <pattern>)
|
||||
|
||||
Technical:
|
||||
These functions are used to search through the given array for the item
|
||||
that best matches the given word or pattern.
|
||||
|
||||
Practical:
|
||||
These functions are analogous to $match() and $rmatch(). Given a word
|
||||
or pattern, they search through the given array's contents and look
|
||||
for the best match, if any. Basically, the array's contents behave as
|
||||
if they were the list of words or patterns passed to $match() or
|
||||
$rmatch().
|
||||
|
||||
Returns:
|
||||
> -1 item number in array that matched
|
||||
-1 could not find specified array
|
||||
-2 could not find a matching item
|
||||
|
||||
See Also:
|
||||
Arrays(7); getitem(6); getmatches(6); getrmatches(6); setitem(6)
|
||||
|
||||
20
bitchx-docs/6_Functions/menucontrol
Normal file
20
bitchx-docs/6_Functions/menucontrol
Normal file
@@ -0,0 +1,20 @@
|
||||
Synopsis:
|
||||
$menucontrol(<menuname> <refnum> <text|check> <param>)
|
||||
|
||||
Technical:
|
||||
This function modifies shared menus on the fly. Either changing
|
||||
the item text or the check status. The menuname is the name of the
|
||||
menu where the item you wish to change is located. The refnum is
|
||||
the refnum you passed when creating the menuitem. The third
|
||||
parameter is either "check" or "text" depending whether you want
|
||||
to change the menu's check status or text. If you choose "text"
|
||||
param is the new menu item text. If you choose check then param
|
||||
is either 1 or 0. Where 1 is check active and 0 is check inactive.
|
||||
|
||||
Returns:
|
||||
0 - on failure
|
||||
1 - on success
|
||||
|
||||
See Also:
|
||||
menu(4) menuitem, submenu
|
||||
|
||||
24
bitchx-docs/6_Functions/mid
Normal file
24
bitchx-docs/6_Functions/mid
Normal file
@@ -0,0 +1,24 @@
|
||||
Synopsis:
|
||||
$mid(<offset> <length> <text>)
|
||||
|
||||
Technical:
|
||||
This function returns the input text, starting at the specified offset,
|
||||
and not exceeding the specified length. If the length specified would
|
||||
extend beyond the end of the text, it is adjusted accordingly. The
|
||||
offset is counted from 0 (zero).
|
||||
|
||||
Practical:
|
||||
This function takes an arbitrary input string, and returns a slice of
|
||||
it. This might be used to strip the first few characters off of a
|
||||
string, regardless of what they might be.
|
||||
|
||||
Returns:
|
||||
slice of input text, or nothing if error
|
||||
|
||||
Examples:
|
||||
$mid(4 3 hello there) returns "o t"
|
||||
$mid(7 100 this is a long string) returns " a long string"
|
||||
|
||||
See Also:
|
||||
left(6); right(6)
|
||||
|
||||
24
bitchx-docs/6_Functions/midw
Normal file
24
bitchx-docs/6_Functions/midw
Normal file
@@ -0,0 +1,24 @@
|
||||
Synopsis:
|
||||
$midw(<offset> <count> <text>)
|
||||
|
||||
Technical:
|
||||
This function returns the input text, starting at the given word offset,
|
||||
and not exceeding the total number of words specified. The offset is
|
||||
counted from 0 (zero).
|
||||
|
||||
Practical:
|
||||
This function operates on words in the same manner that $mid() operates
|
||||
on characters, returning only a subset of the input word list. This is
|
||||
probably mostly useful in a script, perhaps to display the partial
|
||||
contents of a variable.
|
||||
|
||||
Returns:
|
||||
word subset from input list, or nothing if error
|
||||
|
||||
Examples:
|
||||
$midw(2 2 hello there how are you?) returns "how are"
|
||||
$midw(2 4 hello there how are you?) returns "how are you?"
|
||||
|
||||
See Also:
|
||||
leftw(6); restw(6); rightw(6)
|
||||
|
||||
26
bitchx-docs/6_Functions/mkdir
Normal file
26
bitchx-docs/6_Functions/mkdir
Normal file
@@ -0,0 +1,26 @@
|
||||
Synopsis:
|
||||
$mkdir(<directory> [<directory> ...])
|
||||
|
||||
Technical:
|
||||
This function adds the following directories to the filesystem, using
|
||||
the mkdir(3) library call. The default permissions are 0777, minus
|
||||
the current umask value. Any number of directories may be created at
|
||||
once. Tilde-expansion is permitted.
|
||||
|
||||
Practical:
|
||||
This function creates one or more new directories. It is probably most
|
||||
useful for script installers. Make sure you set your umask correctly,
|
||||
otherwise you may inadvertently create the directory with permissions
|
||||
that allow anyone to write to it.
|
||||
|
||||
Returns:
|
||||
> 0 number of directories that could not be created
|
||||
0 success
|
||||
|
||||
Examples:
|
||||
$mkdir(~/myscript) probably returns "0"
|
||||
$mkdir(~/myscript /etc/hackerz) probably returns "1"
|
||||
|
||||
See Also:
|
||||
chmod(6); rmdir(6); umask(6)
|
||||
|
||||
19
bitchx-docs/6_Functions/msar
Normal file
19
bitchx-docs/6_Functions/msar
Normal file
@@ -0,0 +1,19 @@
|
||||
Synopsis:
|
||||
$msar(/<search>/<replace>/ ... /<text>)
|
||||
|
||||
Technical:
|
||||
This function works much like sar(6), but handles multiple search
|
||||
and replace arguments. The first character, a '/' in this case, can be
|
||||
any character not appearing in <text>.
|
||||
|
||||
Returns:
|
||||
the resultant string
|
||||
|
||||
Examples:
|
||||
$msar(/as/xy/asdf) returns "xydf"
|
||||
$msar(/as/xy/yd/42/asdf) returns "x42f"
|
||||
$msar(/e/he/pi/ll/c/o/epic) returns "hello"
|
||||
|
||||
See Also:
|
||||
tr(6); sar(6)
|
||||
|
||||
19
bitchx-docs/6_Functions/mychannels
Normal file
19
bitchx-docs/6_Functions/mychannels
Normal file
@@ -0,0 +1,19 @@
|
||||
Synopsis:
|
||||
$mychannels(<server refnum>|<#window refnum>|<window name>)
|
||||
|
||||
Technical:
|
||||
This function is used to retrieve a list of channels you are currently
|
||||
on.
|
||||
|
||||
Practical:
|
||||
This function shows what channels you're on in your current window.
|
||||
This is mostly useful for accounting purposes.
|
||||
|
||||
Returns:
|
||||
which channels the user is currently on, depending on the server specified
|
||||
in the arguments as either a server refnum, a window refnum (must be
|
||||
prefixed with a '#'), or a window name.
|
||||
|
||||
See Also:
|
||||
myservers(6)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user