Guest User

Untitled

a guest
Jun 19th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. diff -r a172541b6c86 config.sample.h
  2. --- a/config.sample.h Tue May 05 17:12:22 2009 -0400
  3. +++ b/config.sample.h Sun May 24 23:31:40 2009 -0400
  4. @@ -5,3 +5,14 @@
  5. #define IRC_COMCHAR '!'
  6.  
  7. #define PIDFILE "/tmp/simplebot-pid"
  8. +
  9. +/*
  10. + * Undefine LOG_FILE_DEFINED if you want to disable logging.
  11. + * LOG_FILE_SETTINGS can be "w" or "a", depending if you want it to
  12. + * overwrite the log file or append to it.
  13. + * LOG_FILE is the log file.
  14. + */
  15. +
  16. +#define LOG_FILE_DEFINED
  17. +#define LOG_FILE_SETTINGS "w"
  18. +#define LOG_FILE "/tmp/" IRC_NICK "-log"
  19. diff -r a172541b6c86 src/simplebot/main.c
  20. --- a/src/simplebot/main.c Tue May 05 17:12:22 2009 -0400
  21. +++ b/src/simplebot/main.c Sun May 24 23:31:40 2009 -0400
  22. @@ -41,6 +41,7 @@
  23. if (obuf[i] == '\r' && obuf[i + 1] == '\n') {
  24. obuf[i] = '\0';
  25. printf("< %s\n", obuf + o);
  26. + fflush(stdout);
  27. o = i + 2;
  28. }
  29. }
  30. @@ -50,6 +51,7 @@
  31. int parsemessage(char *user, char *msgtype, char *where, char *target, char *message) {
  32.  
  33. printf("message: [from: %s] [reply-with: %s] [where: %s] [reply-to: %s] \"%s\"\n", user, msgtype, where, target, message);
  34. + fflush(stdout);
  35.  
  36. return 0;
  37.  
  38. @@ -58,6 +60,7 @@
  39. int parsecommand(char *user, char *target, char *msgtype, char *command, char *args) {
  40.  
  41. printf("cmd: [from: %s] [reply-with: %s] [reply-to: %s] [cmd: \"%s\"] [args: \"%s\"]\n", user, msgtype, target, command, args ? args : "");
  42. + fflush(stdout);
  43.  
  44. raw("%s %s :command: %s\r\n%s %s :args: %s\r\n", msgtype, target, command, msgtype, target, args ? args : "");
  45.  
  46. @@ -70,6 +73,7 @@
  47. int j, start, wc;
  48.  
  49. printf("> %s\n", buf);
  50. + fflush(stdout);
  51.  
  52. if (!strncmp(buf, "PING", 4)) {
  53. buf[1] = 'O';
  54. @@ -266,11 +270,17 @@
  55. exit(EXIT_FAILURE);
  56. }
  57.  
  58. - /* Redirect stdin, stdout, and stderr to /dev/null */
  59. + /* Redirect stdin and stderr to /dev/null */
  60. freopen("/dev/null", "r", stdin);
  61. freopen("/dev/null", "w", stdout);
  62. freopen("/dev/null", "w", stderr);
  63.  
  64. +#ifdef LOG_FILE_DEFINED
  65. + freopen(LOG_FILE, LOG_FILE_SETTINGS, stdout);
  66. +#else
  67. + freopen("/dev/null", "w", stdout);
  68. +#endif
  69. +
  70. if (create_pidfile) {
  71. /* Set the pidfile to contain the pid */
  72. remove(PIDFILE);
Add Comment
Please, Sign In to add comment