]> git.pond.sub.org Git - empserver/commitdiff
New journal event "command"
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 3 Apr 2011 06:27:30 +0000 (08:27 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 14 Apr 2011 17:46:05 +0000 (19:46 +0200)
Redundant information.  Allows making sense of input without context.
The redundancy could help making a journal replay tool more robust.

include/journal.h
src/lib/player/dispatch.c
src/lib/subs/journal.c

index defe2e28cc01430ad50c040a3a7cd3d1d384ee73..4c604a49805392910d8041c4b9c05ddf76991fdb 100644 (file)
@@ -27,7 +27,7 @@
  *  journal.h: Log a journal of events to a file
  *
  *  Known contributors to this file:
- *     Markus Armbruster, 2004-2008
+ *     Markus Armbruster, 2004-2011
  */
 
 #ifndef JOURNAL_H
@@ -40,6 +40,7 @@ void journal_login(void);
 void journal_logout(void);
 void journal_prng(unsigned);
 void journal_input(char *);
+void journal_command(char *);
 void journal_update(int);
 
 #endif
index 21868477f2747ad238ad7a404ddc9e5b9d440b88..c576840d7a1839f568a6bd8bb3129c556284cdaf 100644 (file)
@@ -29,7 +29,7 @@
  *  Known contributors to this file:
  *     Dave Pare, 1994
  *     Steve McClure, 1998
- *     Markus Armbruster, 2007-2009
+ *     Markus Armbruster, 2007-2011
  */
 
 #include <config.h>
@@ -37,6 +37,7 @@
 #include "com.h"
 #include "empio.h"
 #include "file.h"
+#include "journal.h"
 #include "match.h"
 #include "misc.h"
 #include "nat.h"
@@ -93,6 +94,7 @@ dispatch(char *buf, char *redir)
        uprnf(buf);
        pr("\n");
     }
+    journal_command(command->c_form);
     switch (command->c_addr()) {
     case RET_OK:
        player->btused += command->c_cost;
index c4ae056c199893e17b03b1cc29eec86429e9b332..aa27f97e045c0304f00becddbc8014e33e5d05de 100644 (file)
@@ -27,7 +27,7 @@
  *  journal.c: Log a journal of events to a file
  *
  *  Known contributors to this file:
- *     Markus Armbruster, 2004-2008
+ *     Markus Armbruster, 2004-2011
  *     Ron Koenderink, 2008
  */
 
@@ -43,6 +43,7 @@
  *     prng NAME SEED
  *     login CNUM HOSTADDR USER
  *     logout CNUM
+ *     command NAME
  *     input INPUT
  *     update ETU
  */
@@ -172,6 +173,13 @@ journal_input(char *input)
     journal_entry("input %s", input);
 }
 
+void
+journal_command(char *cmd)
+{
+    char *eptr = strchr(cmd, ' ');
+    journal_entry("command %.*s", eptr ? (int)(eptr - cmd) : -1, cmd);
+}
+
 void
 journal_update(int etu)
 {