]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/journal.c
New journal event command
[empserver] / src / lib / subs / journal.c
index 9313135ab453859ff223cbda08ee7d16d00aa31f..90c34a62a01f375b6d8541466dd2ae36b368bd7e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,7 @@
  *  ---
  *
  *  journal.c: Log a journal of events to a file
- * 
+ *
  *  Known contributors to this file:
  *     Markus Armbruster, 2004-2008
  *     Ron Koenderink, 2008
@@ -44,6 +44,7 @@
  *     prng NAME SEED
  *     login CNUM HOSTADDR USER
  *     logout CNUM
+ *     command NAME
  *     input INPUT
  *     update ETU
  */
@@ -86,7 +87,7 @@ journal_entry(char *fmt, ...)
        time(&now);
        fprintf(journal, "%.24s %10.10s ",
                ctime(&now), empth_name(empth_self()));
-       
+
        va_start(ap, fmt);
        vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
        va_end(ap);
@@ -173,6 +174,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)
 {