diff options
author | Ian C <ianc@noddybox.co.uk> | 2020-05-20 20:34:56 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2020-05-20 20:34:56 +0000 |
commit | d71fef04f16e0d3fa901a0201d0b1b538a12ec1b (patch) | |
tree | 36e2a970e5726acbb41148217642aa15d330517f /lunar.c | |
parent | 44eec17db0d83b99ccaeb39c3dcdcc0825a7a04c (diff) |
Fixed warnings.
Diffstat (limited to 'lunar.c')
-rw-r--r-- | lunar.c | 31 |
1 files changed, 25 insertions, 6 deletions
@@ -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; } |