c-bot commands

c-bot is a knowledge-bot, designed to help channel members with information about the c language. Commands are sent by regular IRC chat that starts with c-bot's nick. An example IRC session is below:

<noob> The code doesn't work right. It should convert the input into a number, but i'm having problems with stopping at letters.

<UberGeek> Have you tried strtol()? It should do that for you

<noob> strtol? What's that?

<UberGeek> c-bot tell noob about strtol

<c-bot> noob, hmm .. strtol - #include <stdlib.h> long int strtol (const char *restrict string, char **restrict tailptr, int base) Parsing of Integers (ISO) see - http://www.gnu.org/manual/glibc-2.2.3/html_chapter/libc_20.html#SEC422

<UberGeek> Put your string in, get *tailptr back, and use base 10. It returns the number that it reads back. Then just check if (strlen(tailptr) == 0). if it does, you know it was able to parse the entire input. Otherwise you can tell them there was an error.

<noob> Cool.

<noob> Hey, what is c-bot?


c-bot [routing] command

The route and command information are given below


By default, c-bot addresses comments to the nick who talked to it. Adding either of these commands will route the result elsewhere.

tell nick about

This will cause c-bot to address nick instead of the speaker.

msg nick

Causes the output to be sent through "/msg nick output" rather than back to the channel.


c-function or search phrase

List the header and prototype of a function, and a link to the GNU documentation for the function. Only c is supported at this time.

See the example in the intro above

Some useful and commonly-used values:

pointer tutorial

Gives a link to the pointer tutorial, a must read for new c programmers.

socket tutorial

Gives a link to a tutorial about programming for the Internet with sockets.

paste code

Tells the location that you should paste your code to.

free compilers

Tells where many no-cost compilers can be found.

c tutorial

Provides the location of the C tutorial

explain declaration

Explains the meaning of simple declarations

<UberGeek> c-bot explain int** blah[40]

<c-bot> UberGeek, declare blah as array 40 of pointer to pointer to int

declare explanation

Provide the declaration for a given explanation. This command isn't very fault tolerant, and should be of the same format as the explain command.

<UberGeek> c-bot declare blah as pointer to array 40 of pointer to char

<c-bot> UberGeek, char*(*blah)[40]

calc expression

Calculates the given expression. Calc accepts integers, floats, and hex numbers (0x##) and can calculate simple expressions. Calc does not yet handle parenthasis. The result is given in decimal format.

<UberGeek> c-bot, calc 4+5

<c-bot> UberGeek, 9

<UberGeek> c-bot calc 0xa3 & 0x82

<c-bot> UberGeek, 130

google terms

Perform a google search on terms, display the top results

<UberGeek> c-bot google Intel Small Matrix Library

<c-bot> UberGeek, searching ...

<c-bot> Intel® Pentium® Processor - Small Matrix Library, http://www.intel.com/design/PentiumIII/sml/

<c-bot> Pentium(R) III ????? - Small Matrix Library, http://www.intel.com/jp/developer/design/pentiumiii/sml/

compile code

Attempt to compile the code fragment, displaying any errors.

<UberGeek> c-bot compile int main() { int x; x=4; printf("x = %d",x); return 0; }

<c-bot> UberGeek, no errors.


provides status information

<UberGeek> c-bot info

* c-bot powered by sqlbot version 2.5-devel BUILD 559. the most powerful knowledge irc robot ever. I have 14438 topics available. Uptime 6 days, 23 hours, 59 minutes, 33 seconds.

seen nick

Display when c-bot last saw the user nick

<UberGeek> c-bot seen noob

<c-bot> noob!~greg@noob.users.undernet.org was last seen in #c on Saturday, 21 December 2002, 21:07:45

search keyword

Searches for terms that contain the substring keyword. The reterned elements are all in c-bot's knowledge base.

<UberGeek> c-bot: search man

<c-bot> UberGeek: I found 13 matches: ETOOMANYREFS, cayman islands, germany, oman, romania, DBL_MANT_DIG, FLT_MANT_DIG, amandda, dman, lman, pdsman, rman, sman

<UberGeek> c-bot germany

<c-bot> UberGeek, hmm .. .DE

dsearch items

This looks up the definitions that contain items, and displays the topics associated with them.

<UberGeek> c-bot dsearch Internet Relay Chat

<c-bot> UberGeek: I found 11 matches: port 194, port 6665, port 6666, port 6667, port 6668, port 6669, rfc1459, rfc2810, rfc2811, rfc2812, rfc2813

For those who keep asking, c-bot is written and maintained by reet or reetix, depending on his nick at the time.

This concludes the documentation for c-bot.