From 72d051310cfe1f41ceae818bbb01c63153d322a7 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 3 Apr 2011 08:27:30 +0200 Subject: [PATCH] New journal event "command" Redundant information. Allows making sense of input without context. The redundancy could help making a journal replay tool more robust. --- include/journal.h | 3 ++- src/lib/player/dispatch.c | 4 +++- src/lib/subs/journal.c | 10 +++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/journal.h b/include/journal.h index defe2e28c..4c604a498 100644 --- a/include/journal.h +++ b/include/journal.h @@ -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 diff --git a/src/lib/player/dispatch.c b/src/lib/player/dispatch.c index 21868477f..c576840d7 100644 --- a/src/lib/player/dispatch.c +++ b/src/lib/player/dispatch.c @@ -29,7 +29,7 @@ * Known contributors to this file: * Dave Pare, 1994 * Steve McClure, 1998 - * Markus Armbruster, 2007-2009 + * Markus Armbruster, 2007-2011 */ #include @@ -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; diff --git a/src/lib/subs/journal.c b/src/lib/subs/journal.c index c4ae056c1..aa27f97e0 100644 --- a/src/lib/subs/journal.c +++ b/src/lib/subs/journal.c @@ -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) { -- 2.43.0