summaryrefslogtreecommitdiff
path: root/lunar.c
diff options
context:
space:
mode:
Diffstat (limited to 'lunar.c')
-rw-r--r--lunar.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/lunar.c b/lunar.c
index 33d7041..02241a8 100644
--- a/lunar.c
+++ b/lunar.c
@@ -36,6 +36,11 @@ static char rcs_id[]="$Id$";
#include <math.h>
#include <fcntl.h>
#include <string.h>
+#include <errno.h>
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include "Xbit.h"
@@ -1184,7 +1189,7 @@ static XFuncControl ProcessTitle(void)
{
Centre(100,RED,"PRESENTED BY");
Centre(115,RED,"NODDYBOX '95 - '05");
- Centre(130,RED,"www.noddybox.demon.co.uk");
+ Centre(130,RED,"noddybox.co.uk");
}
if ((ctr/10)%2)
@@ -1574,7 +1579,11 @@ static void ReadScores(void)
return;
for(f=0;f<NOHI;f++)
- read(fd,hisc+f,sizeof(HiSc));
+ if (read(fd,hisc+f,sizeof(HiSc)) == -1)
+ {
+ perror("read");
+ exit(EXIT_FAILURE);
+ }
close(fd);
}
@@ -1591,7 +1600,11 @@ static void WriteScores(void)
}
for(f=0;f<NOHI;f++)
- write(fd,hisc+f,sizeof(HiSc));
+ if (write(fd,hisc+f,sizeof(HiSc)) == -1)
+ {
+ perror("write");
+ exit(EXIT_FAILURE);
+ }
close(fd);
}
@@ -1711,10 +1724,16 @@ static char *GetLine(FILE *fp)
{
static char s[1204];
- fgets(s,1024,fp);
+ if (fgets(s,1024,fp))
+ {
+ if (s[strlen(s)-1]=='\n')
+ s[strlen(s)-1]='\0';
- if (s[strlen(s)-1]=='\n')
- s[strlen(s)-1]='\0';
+ }
+ else
+ {
+ s[0] = 0;
+ }
return s;
}