New journal event "command"

Redundant information.  Allows making sense of input without context.
The redundancy could help making a journal replay tool more robust.
This commit is contained in:
Markus Armbruster 2011-04-03 08:27:30 +02:00
parent 9be4f57ad5
commit 72d051310c
3 changed files with 14 additions and 3 deletions

View file

@ -27,7 +27,7 @@
* journal.h: Log a journal of events to a file * journal.h: Log a journal of events to a file
* *
* Known contributors to this file: * Known contributors to this file:
* Markus Armbruster, 2004-2008 * Markus Armbruster, 2004-2011
*/ */
#ifndef JOURNAL_H #ifndef JOURNAL_H
@ -40,6 +40,7 @@ void journal_login(void);
void journal_logout(void); void journal_logout(void);
void journal_prng(unsigned); void journal_prng(unsigned);
void journal_input(char *); void journal_input(char *);
void journal_command(char *);
void journal_update(int); void journal_update(int);
#endif #endif

View file

@ -29,7 +29,7 @@
* Known contributors to this file: * Known contributors to this file:
* Dave Pare, 1994 * Dave Pare, 1994
* Steve McClure, 1998 * Steve McClure, 1998
* Markus Armbruster, 2007-2009 * Markus Armbruster, 2007-2011
*/ */
#include <config.h> #include <config.h>
@ -37,6 +37,7 @@
#include "com.h" #include "com.h"
#include "empio.h" #include "empio.h"
#include "file.h" #include "file.h"
#include "journal.h"
#include "match.h" #include "match.h"
#include "misc.h" #include "misc.h"
#include "nat.h" #include "nat.h"
@ -93,6 +94,7 @@ dispatch(char *buf, char *redir)
uprnf(buf); uprnf(buf);
pr("\n"); pr("\n");
} }
journal_command(command->c_form);
switch (command->c_addr()) { switch (command->c_addr()) {
case RET_OK: case RET_OK:
player->btused += command->c_cost; player->btused += command->c_cost;

View file

@ -27,7 +27,7 @@
* journal.c: Log a journal of events to a file * journal.c: Log a journal of events to a file
* *
* Known contributors to this file: * Known contributors to this file:
* Markus Armbruster, 2004-2008 * Markus Armbruster, 2004-2011
* Ron Koenderink, 2008 * Ron Koenderink, 2008
*/ */
@ -43,6 +43,7 @@
* prng NAME SEED * prng NAME SEED
* login CNUM HOSTADDR USER * login CNUM HOSTADDR USER
* logout CNUM * logout CNUM
* command NAME
* input INPUT * input INPUT
* update ETU * update ETU
*/ */
@ -172,6 +173,13 @@ journal_input(char *input)
journal_entry("input %s", 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 void
journal_update(int etu) journal_update(int etu)
{ {