Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -r a172541b6c86 config.sample.h
- --- a/config.sample.h Tue May 05 17:12:22 2009 -0400
- +++ b/config.sample.h Sun May 24 23:31:40 2009 -0400
- @@ -5,3 +5,14 @@
- #define IRC_COMCHAR '!'
- #define PIDFILE "/tmp/simplebot-pid"
- +
- +/*
- + * Undefine LOG_FILE_DEFINED if you want to disable logging.
- + * LOG_FILE_SETTINGS can be "w" or "a", depending if you want it to
- + * overwrite the log file or append to it.
- + * LOG_FILE is the log file.
- + */
- +
- +#define LOG_FILE_DEFINED
- +#define LOG_FILE_SETTINGS "w"
- +#define LOG_FILE "/tmp/" IRC_NICK "-log"
- diff -r a172541b6c86 src/simplebot/main.c
- --- a/src/simplebot/main.c Tue May 05 17:12:22 2009 -0400
- +++ b/src/simplebot/main.c Sun May 24 23:31:40 2009 -0400
- @@ -41,6 +41,7 @@
- if (obuf[i] == '\r' && obuf[i + 1] == '\n') {
- obuf[i] = '\0';
- printf("< %s\n", obuf + o);
- + fflush(stdout);
- o = i + 2;
- }
- }
- @@ -50,6 +51,7 @@
- int parsemessage(char *user, char *msgtype, char *where, char *target, char *message) {
- printf("message: [from: %s] [reply-with: %s] [where: %s] [reply-to: %s] \"%s\"\n", user, msgtype, where, target, message);
- + fflush(stdout);
- return 0;
- @@ -58,6 +60,7 @@
- int parsecommand(char *user, char *target, char *msgtype, char *command, char *args) {
- printf("cmd: [from: %s] [reply-with: %s] [reply-to: %s] [cmd: \"%s\"] [args: \"%s\"]\n", user, msgtype, target, command, args ? args : "");
- + fflush(stdout);
- raw("%s %s :command: %s\r\n%s %s :args: %s\r\n", msgtype, target, command, msgtype, target, args ? args : "");
- @@ -70,6 +73,7 @@
- int j, start, wc;
- printf("> %s\n", buf);
- + fflush(stdout);
- if (!strncmp(buf, "PING", 4)) {
- buf[1] = 'O';
- @@ -266,11 +270,17 @@
- exit(EXIT_FAILURE);
- }
- - /* Redirect stdin, stdout, and stderr to /dev/null */
- + /* Redirect stdin and stderr to /dev/null */
- freopen("/dev/null", "r", stdin);
- freopen("/dev/null", "w", stdout);
- freopen("/dev/null", "w", stderr);
- +#ifdef LOG_FILE_DEFINED
- + freopen(LOG_FILE, LOG_FILE_SETTINGS, stdout);
- +#else
- + freopen("/dev/null", "w", stdout);
- +#endif
- +
- if (create_pidfile) {
- /* Set the pidfile to contain the pid */
- remove(PIDFILE);
Add Comment
Please, Sign In to add comment