LP64 fixes: remove a hand-rolled setproctitle() from ye olden days,

add missing #includes, fix type of ctime() argument.

Allows this to work on 64-bit archs.
This commit is contained in:
naddy 2010-08-07 20:06:14 +00:00
parent 9a190cd45e
commit 9eebe9b217
3 changed files with 74 additions and 24 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.27 2007/12/04 15:00:20 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.28 2010/08/07 20:06:14 naddy Exp $
COMMENT= curses version of the classic game
DISTNAME= connect4
PKGNAME= connect4-3.2p0
PKGNAME= connect4-3.2
REVISION= 1
CATEGORIES= games
# License: NONE

View File

@ -1,15 +1,25 @@
$OpenBSD: patch-c4_c,v 1.2 2003/04/14 16:03:01 avsm Exp $
--- c4.c.orig Mon Apr 14 16:53:17 2003
+++ c4.c Mon Apr 14 16:54:01 2003
@@ -11,6 +11,8 @@
* BITNET: tcjones@WATER.bitnet
* Canadian domain: tcjones@dragon.uwaterloo.ca
*
+ * Patched by Joel Sutton, 15th April 1997
+ * Changed gets calls to fgets. Changed inital prompt slightly.
$OpenBSD: patch-c4_c,v 1.3 2010/08/07 20:06:14 naddy Exp $
--- c4.c.orig Sat Aug 7 21:36:09 2010
+++ c4.c Sat Aug 7 21:37:10 2010
@@ -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;
@ -30,3 +40,51 @@ $OpenBSD: patch-c4_c,v 1.2 2003/04/14 16:03:01 avsm Exp $
fprintf(stderr, "Could not read input line\n");
goodbye();
}
@@ -687,9 +689,11 @@ date()
struct timeval v;
struct timezone z;
char *nl;
+ time_t sec;
gettimeofday(&v, &z);
- sprintf(time,"%s", ctime(&v.tv_sec));
+ sec = v.tv_sec;
+ sprintf(time,"%s", ctime(&sec));
if ((nl = index(time, '\n')) == NULL){
fprintf(stderr,"date: ctime returned non-newline terminated string.\n");
@@ -813,34 +817,5 @@ debug_off()
save = d;
d = NULL;
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 );
}

View File

@ -1,16 +1,7 @@
$OpenBSD: patch-screen_c,v 1.1 2001/08/11 03:17:12 brad Exp $
--- screen.c.orig Fri Aug 10 22:48:15 2001
+++ screen.c Fri Aug 10 22:48:25 2001
@@ -1,3 +1,8 @@
+/*
+ * Patched by Joel Sutton, 15th April 1997
+ * Added endwin to tidy things up as per usenet posted patch.
+ */
+
#include <stdio.h>
#include <curses.h>
#include "c4.h"
@@ -116,6 +121,7 @@ plot_finish()
$OpenBSD: patch-screen_c,v 1.2 2010/08/07 20:06:14 naddy Exp $
--- screen.c.orig Sat Aug 7 21:33:13 2010
+++ screen.c Sat Aug 7 21:34:36 2010
@@ -116,6 +116,7 @@ plot_finish()
refresh();
nocrmode();
echo();