[cvslog] (2002-09-21 21:32:15 UTC) Module eggdrop1.6: Change committed

cvslog cvs at tsss.org
Sat Sep 21 16:33:00 CST 2002


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2002-09-21 21:32:15 UTC
Commited by: Will Buckner <wcc at techmonkeys.org>

Modified files:
     doc/UPDATES1.6 src/eggdrop.h src/misc.c src/patch.h

Log message:

Made the timestamp style definable in src/eggdrop.h. Patch by BarkerJr.

---------------------- diff included ----------------------
Index: eggdrop1.6/doc/UPDATES1.6
diff -u eggdrop1.6/doc/UPDATES1.6:1.410 eggdrop1.6/doc/UPDATES1.6:1.411
--- eggdrop1.6/doc/UPDATES1.6:1.410	Sat Sep 21 16:06:23 2002
+++ eggdrop1.6/doc/UPDATES1.6	Sat Sep 21 16:32:05 2002
@@ -1,10 +1,11 @@
-$Id: UPDATES1.6,v 1.410 2002/09/21 21:06:23 wcc Exp $
+$Id: UPDATES1.6,v 1.411 2002/09/21 21:32:05 wcc Exp $
 
 Changes in Eggdrop: (since v1.6.0)
 ----------------------------------
 
 1.6.13
 Found by  Fixed by  What...
+          BarkerJr  made the timestamp style definable in src/eggdrop.h
           Eule      added a missing return in bot_actchan()
 various   [sL]      fixed a problem with 'connect' and 'control' where the script
                     would abort prematurely
Index: eggdrop1.6/src/eggdrop.h
diff -u eggdrop1.6/src/eggdrop.h:1.39 eggdrop1.6/src/eggdrop.h:1.40
--- eggdrop1.6/src/eggdrop.h:1.39	Mon Sep  9 21:22:01 2002
+++ eggdrop1.6/src/eggdrop.h	Sat Sep 21 16:32:05 2002
@@ -4,7 +4,7 @@
  *
  *   IF YOU ALTER THIS FILE, YOU NEED TO RECOMPILE THE BOT.
  *
- * $Id: eggdrop.h,v 1.39 2002/09/10 02:22:01 wcc Exp $
+ * $Id: eggdrop.h,v 1.40 2002/09/21 21:32:05 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -39,6 +39,13 @@
  * WARNING: DO NOT send in bug reports if you undefine this!
  */
 #define DEBUG_CONTEXT
+
+/*
+ * Set the following to the timestamp for the logfile entries.
+ * Popular times might be "[%H:%M]" (hour, min), or "[%H:%M:%S]" (hour, min, sec)
+ * Read `man strftime' for more formatting options.  Keep it below 32 chars.
+ */
+#define LOG_TS "[%H:%M]"
 
 /*
  * HANDLEN note:
Index: eggdrop1.6/src/misc.c
diff -u eggdrop1.6/src/misc.c:1.48 eggdrop1.6/src/misc.c:1.49
--- eggdrop1.6/src/misc.c:1.48	Tue Jul  9 00:43:27 2002
+++ eggdrop1.6/src/misc.c	Sat Sep 21 16:32:05 2002
@@ -7,7 +7,7 @@
  *   help system
  *   motd display and %var substitution
  *
- * $Id: misc.c,v 1.48 2002/07/09 05:43:27 guppy Exp $
+ * $Id: misc.c,v 1.49 2002/09/21 21:32:05 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -481,25 +481,27 @@
  */
 void putlog EGG_VARARGS_DEF(int, arg1)
 {
-  int i, type;
+  int i, type, tsl;
   char *format, *chname, s[LOGLINELEN], s1[256], *out;
-  time_t tt;
-  char ct[81], *s2;
-  struct tm *t = localtime(&now);
+  time_t tt=now;
+  char ct[81], *s2, stamp[32];
   va_list va;
 
   type = EGG_VARARGS_START(int, arg1, va);
   chname = va_arg(va, char *);
   format = va_arg(va, char *);
 
-  /* Format log entry at offset 8, then i can prepend the timestamp */
-  out = &s[8];
+  strftime(&stamp[0], 32, LOG_TS, localtime(&tt));
+  sprintf(&stamp[0], "%s ", stamp);
+  tsl = strlen(stamp);
+
+  /* Format log entry at offset 'tsl,' then i can prepend the timestamp */
+  out = &s[tsl];
   /* No need to check if out should be null-terminated here,
    * just do it! <cybah>
    */
-  egg_vsnprintf(out, LOGLINEMAX - 8, format, va);
-  out[LOGLINEMAX - 8] = 0;
-  tt = now;
+  egg_vsnprintf(out, LOGLINEMAX - tsl, format, va);
+  out[LOGLINEMAX - tsl] = 0;
   if (keep_all_logs) {
     if (!logfile_suffix[0])
       egg_strftime(ct, 12, ".%d%b%Y", localtime(&tt));
@@ -516,8 +518,7 @@
     }
   }
   if ((out[0]) && (shtime)) {
-    egg_strftime(s1, 9, "[%H:%M] ", localtime(&tt));
-    strncpy(&s[0], s1, 8);
+    strncpy(&s[0], stamp, tsl);
     out = s;
   }
   strcat(out, "\n");
@@ -538,7 +539,7 @@
 	  /* Check if this is the same as the last line added to
 	   * the log. <cybah>
 	   */
-	  if (!egg_strcasecmp(out + 8, logs[i].szlast)) {
+	  if (!egg_strcasecmp(out + tsl, logs[i].szlast)) {
 	    /* It is a repeat, so increment repeats */
 	    logs[i].repeats++;
 	  } else {
@@ -550,20 +551,15 @@
 	       * then reset repeats. We want the current time here,
 	       * so put that in the file first.
 	       */
-	      if (t) {
-		fprintf(logs[i].f, "[%2.2d:%2.2d] ", t->tm_hour, t->tm_min);
-		fprintf(logs[i].f, MISC_LOGREPEAT, logs[i].repeats);
-	      } else {
-		fprintf(logs[i].f, "[??:??] ");
-		fprintf(logs[i].f, MISC_LOGREPEAT, logs[i].repeats);
-	      }
+	      fprintf(logs[i].f, stamp);
+	      fprintf(logs[i].f, MISC_LOGREPEAT, logs[i].repeats);
 	      logs[i].repeats = 0;
 	      /* No need to reset logs[i].szlast here
 	       * because we update it later on...
 	       */
 	    }
 	    fputs(out, logs[i].f);
-	    strncpyz(logs[i].szlast, out + 8, LOGLINEMAX);
+	    strncpyz(logs[i].szlast, out + tsl, LOGLINEMAX);
 	  }
 	}
       }
@@ -579,7 +575,7 @@
     dprintf(DP_STDOUT, "%s", out);
   else if ((type & LOG_MISC) && use_stderr) {
     if (shtime)
-      out += 8;
+      out += tsl;
     dprintf(DP_STDERR, "%s", s);
   }
   va_end(va);
Index: eggdrop1.6/src/patch.h
diff -u eggdrop1.6/src/patch.h:1.824 eggdrop1.6/src/patch.h:1.825
--- eggdrop1.6/src/patch.h:1.824	Sat Sep 21 16:06:23 2002
+++ eggdrop1.6/src/patch.h	Sat Sep 21 16:32:05 2002
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  *
- * $Id: patch.h,v 1.824 2002/09/21 21:06:23 wcc Exp $
+ * $Id: patch.h,v 1.825 2002/09/21 21:32:05 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -41,12 +41,12 @@
  *
  *
  */
-patch("1032641969");		/* current unixtime */
+patch("1032643721");		/* current unixtime */
 /*
  *
  *
  */
-patch("fake_alert");
+patch("timestamp-style");
 /*
  *
  *
----------------------- End of diff -----------------------



More information about the Changes mailing list