add code to keep log of user input
[capablanca.git] / lasker-2.2.3 / src / command.c
index f779206..2286cd6 100644 (file)
@@ -21,7 +21,7 @@
 #include "includes.h"
 #include "command_list.h"
 
-static const char *usage_dir[NUM_LANGS] = {USAGE_DIR, USAGE_SPANISH, 
+const char *usage_dir[NUM_LANGS] = {USAGE_DIR, USAGE_SPANISH, 
                                           USAGE_FRENCH, USAGE_DANISH};
 
 static int lastCommandFound = -1;
@@ -695,12 +695,17 @@ static int process_password(int p, char *password)
   return 0;
 }
 
+FILE *comlog = NULL;
+
 static int process_prompt(int p, char *command)
 {
   struct player *pp = &player_globals.parray[p];
   int retval;
   char *cmd = "";
 
+       if(comlog == NULL) comlog = fopen("command.log", "a");
+       if(comlog) fprintf(comlog, "p%d: '%s'\n", p, command), fflush(comlog);
+
   command = eattailwhite(eatwhite(command));
   if (!*command) {
          send_prompt(p);