--- c4.c.orig	2010-08-07 20:02:05.000000000 +0200
+++ c4.c	2010-08-07 20:23:15.000000000 +0200
@@ -14,7 +14,10 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
+#include <unistd.h>
 #include <ctype.h>
 #include <pwd.h>
 #include <sys/time.h>
@@ -55,7 +58,6 @@ char **envp;
     register int winner = DRAW;
 	int temp;
 
-    envmesg(envp, "Connect Four");
     do_args(argc, argv);
     open_scorefile("a");
     ask_help();
@@ -219,7 +221,7 @@ ask_turn()
     register char *cp;
 
     printf("Would you like to go first? (yes/no) -> ");
-    if (!gets(line)){
+    if (!fgets(line,256,stdin)){
         plot_finish();
         fprintf(stderr, "Could not read input line.\n");
         goodbye();
@@ -586,7 +588,7 @@ think_of_fucking_clever_move()
         }
     }
     DP(d, "The best column is %d\n", best_col);
-    DP(d, "Returning.\n\n\n", best_col);
+    DP(d, "Returning.\n\n\n");
 
     if (best_col == -1){
         print_game_record(CONFUSED);
@@ -620,8 +622,8 @@ ask_help()
         }
     }
 
-    printf("Do you need help (n/y)? -> ");
-    if (!gets(line)){
+    printf("Do you need help (y/n)? -> ");
+    if (!fgets(line,256,stdin)){
         fprintf(stderr, "Could not read input line\n");
         goodbye();
     }
@@ -815,32 +817,3 @@ debug_off()
     accept_move(turn);
 }
 
-/* 
- * Modify the environment to put message in the right place for
- * the w and ps commands to find.  Code stolen from MFCF lock
- * program, originally by Ian!
- *
- */
-
-void
-envmesg(environ, message)
-char **environ;
-char *message;
-{
-    /* 
-	 * Note that this clobbers the environment, so we have to
-     * do it last, after all the getenv and termcap calls.
-     */
-
-    char *last, *address;
-    while( environ[1] != 0 ) ++environ;
-    last = environ[0] + strlen(environ[0]);/* address of '\0' */
-    last = (char *)((int)last&(~03));/* word boundary */
-    *(int *)last = 0;       /* clean out last word */
-    address = last +3 -strlen(message);
-    address = (char *)((int)address&(~03));/* word boundary */
-    *(int *)(address-4) = 0;    /* clean out word below */
-    *(int *)(address-8) = 0;    /* clean out word below */
-    strcpy( address, message );
-}
-
