#ifndef JOURNAL_H
#define JOURNAL_H
+struct player; /* FIXME temporary hack */
+
int journal_startup(void);
void journal_shutdown(void);
int journal_reopen(void);
void journal_login(void);
void journal_logout(void);
void journal_prng(unsigned);
+void journal_output(struct player *, int, char *);
void journal_input(char *);
void journal_command(char *);
void journal_update(int);
* logout CNUM
* command NAME
* input INPUT
+ * output THREAD ID OUTPUT
* update ETU
*/
fprintf(journal, "\\%03o", *p);
}
fputs("\n", journal);
- fflush(journal);
+ if (fmt[0] != 'o') /* FIXME disgusting hack */
+ fflush(journal);
if (ferror(journal)) {
logerror("Error writing journal (%s)", strerror(errno));
clearerr(journal);
journal_entry("logout %d", player->cnum);
}
+void
+journal_output(struct player *pl, int id, char *output)
+{
+ if (keep_journal < 2)
+ return;
+ if (pl && pl->state == PS_PLAYING)
+ journal_entry("output %d %d %s", pl->cnum, id, output);
+ else
+ journal_entry("output %p %d %s", pl, id, output);
+}
+
void
journal_input(char *input)
{
#include "com.h"
#include "empio.h"
#include "file.h"
+#include "journal.h"
#include "misc.h"
#include "nat.h"
#include "player.h"
}
}
+ journal_output(pl, id, buf);
+
if (player == pl) {
while (io_output_if_queue_long(pl->iop,
pl->may_sleep == PLAYER_SLEEP_FREELY) > 0)
}
}
+ journal_output(pl, id, buf);
+
if (player == pl) {
while (io_output_if_queue_long(pl->iop,
pl->may_sleep == PLAYER_SLEEP_FREELY) > 0)