Beforeinstall log and score files to prevent owning of them by first
user who run game Slightly modify game to understand pre-created score file
This commit is contained in:
parent
ca54550bb7
commit
0d91fed910
@ -65,5 +65,9 @@ beforeinstall:
|
||||
(cd ${.CURDIR}/datfiles; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} \
|
||||
-m ${NOBINMODE} larnmaze larnopts larn.help \
|
||||
${DESTDIR}${SHAREDIR}/games/larn)
|
||||
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 660 /dev/null \
|
||||
${DESTDIR}/var/games/larn/lscore12.0
|
||||
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 660 /dev/null \
|
||||
${DESTDIR}/var/games/larn/llog12.0
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -153,6 +153,8 @@ Noah Morgan
|
||||
.Bl -tag -width "/var/games/larn/lscore12.0" -compact
|
||||
.It Pa /var/games/larn/lscore12.0
|
||||
Score file.
|
||||
.It Pa /var/games/larn/llog12.0
|
||||
Log file.
|
||||
.It Pa ~/.larnopts
|
||||
Options file.
|
||||
.El
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* main.c */
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "header.h"
|
||||
#include <pwd.h>
|
||||
static char copyright[]="\nLarn is copyrighted 1986 by Noah Morgan.\n";
|
||||
@ -41,6 +42,7 @@ main(argc,argv)
|
||||
int hard;
|
||||
char *ptr=0,*ttype;
|
||||
struct passwd *pwe;
|
||||
struct stat sb;
|
||||
|
||||
/*
|
||||
* first task is to identify the player
|
||||
@ -98,7 +100,7 @@ main(argc,argv)
|
||||
/*
|
||||
* now make scoreboard if it is not there (don't clear)
|
||||
*/
|
||||
if (access(scorefile,0) == -1) /* not there */
|
||||
if (stat(scorefile,&sb) < 0 || sb.st_size == 0) /* not there */
|
||||
makeboard();
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user