|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T c
Length: 4222 (0x107e)
Types: TextFile
Names: »c4.c.diff«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Connect4/c4.c.diff«
*** Orig/c4.c Thu Apr 27 07:35:24 1989
--- c4.c Thu Apr 27 07:37:56 1989
***************
*** 11,16 ****
--- 11,18 ----
* BITNET: tcjones@WATER.bitnet
* Canadian domain: tcjones@dragon.uwaterloo.ca
*
+ * Patched for SysV Rel3.1 by Tim Ramsey on 27 April 89.
+ * ..!rutgers!ksuvax1!tar, tar@ksuvax1.cis.ksu.edu
*/
#include <stdio.h>
***************
*** 17,25 ****
#include <sys/types.h>
#include <ctype.h>
#include <pwd.h>
! #include <sys/time.h>
! #include <sys/file.h>
! #include <sys/param.h>
#include "c4.h"
#include "types.h"
#include "tables.h"
--- 19,44 ----
#include <sys/types.h>
#include <ctype.h>
#include <pwd.h>
!
! #define SYSV /* TAR: could do this in Makefile but screen.c would complain */
!
! #ifdef SYSV /* TAR */
! # include <unistd.h> /* For lockf() */
! # include <sys/utsname.h> /* For uname() */
!
! # define index strchr
! # define u_char unchar
! # define u_short ushort
!
! struct passwd *getpwuid(), *getpwnam();
!
! #else /* !SYSV */
!
! # include <sys/time.h>
! # include <sys/file.h>
! # include <sys/param.h>
! #endif /* SYSV */
!
#include "c4.h"
#include "types.h"
#include "tables.h"
***************
*** 43,49 ****
char *release_date = "8pm, January 1st, 1988";
int turn = GAME_OVER;
int first;
! char *wizard = "tcjones";
main(argc, argv, envp)
int argc;
--- 62,68 ----
char *release_date = "8pm, January 1st, 1988";
int turn = GAME_OVER;
int first;
! char wizard[] = "tcjones"; /* TAR: added "[]" */
main(argc, argv, envp)
int argc;
***************
*** 259,264 ****
--- 278,287 ----
char *win_str = "won";
extern char *date();
+ #ifdef SYSV /* TAR */
+ struct utsname sysname;
+ #endif
+
bell();
switch (winner){
case OURS:{
***************
*** 285,296 ****
--- 308,330 ----
}
}
+ #ifdef SYSV /* TAR */
+ if (uname(&sysname) != -1){
+ strcpy(host, sysname.nodename);
+ }
+ else{
+ #else
if (gethostname(host, sizeof(host)) == -1){
+ #endif
host[0] = '\0';
strcat(host, "Unknown");
}
+ #ifdef SYSV /* TAR */
+ if (lockf(fileno(scorefile), F_LOCK, 0) == -1){
+ #else
if (flock(fileno(scorefile), LOCK_EX) == -1){
+ #endif
fprintf(stderr, "Could not lock scorefile!\n");
return;
}
***************
*** 297,303 ****
--- 331,341 ----
if (fseek(scorefile, 0L, 2) == -1){
fprintf(stderr, "Could not unlock scorefile!\n");
+ #ifdef SYSV /* TAR */
+ if (lockf(fileno(scorefile), F_ULOCK, 0) == -1){
+ #else
if (flock(fileno(scorefile), LOCK_UN) == -1){
+ #endif
fprintf(stderr, "Could not unlock scorefile!\n");
}
return;
***************
*** 320,326 ****
--- 358,368 ----
}
fprintf(scorefile, "\n\n");
+ #ifdef SYSV /* TAR */
+ if (lockf(fileno(scorefile), F_ULOCK, 0) == -1){
+ #else
if (flock(fileno(scorefile), LOCK_UN) == -1){
+ #endif
fprintf(stderr, "Could not unlock scorefile!\n");
return;
}
***************
*** 683,703 ****
/* return pointer to NULL terminated date string */
extern char *index();
! static char time[26];
struct timeval v;
struct timezone z;
- char *nl;
gettimeofday(&v, &z);
! sprintf(time,"%s", ctime(&v.tv_sec));
! if ((nl = index(time, '\n')) == NULL){
fprintf(stderr,"date: ctime returned non-newline terminated string.\n");
exit(1);
}
*nl = '\0';
! return time;
}
void
--- 725,753 ----
/* return pointer to NULL terminated date string */
extern char *index();
! static char timestr[26]; /* TAR */
! char *nl;
!
! #ifdef SYSV /* TAR */
! long secs;
!
! secs = time((long *) 0);
! sprintf(timestr,"%s", ctime(&secs));
! #else
struct timeval v;
struct timezone z;
gettimeofday(&v, &z);
! sprintf(timestr,"%s", ctime(&v.tv_sec));
! #endif
! if ((nl = index(timestr, '\n')) == NULL){
fprintf(stderr,"date: ctime returned non-newline terminated string.\n");
exit(1);
}
*nl = '\0';
! return timestr;
}
void