diff options
author | Will Andrews <will@FreeBSD.org> | 2000-07-15 16:37:58 +0000 |
---|---|---|
committer | Will Andrews <will@FreeBSD.org> | 2000-07-15 16:37:58 +0000 |
commit | 179f9d996f48815f0ef219a2fe664f626b780228 (patch) | |
tree | 1362e1a18ae7e05ded06b97d9fae2e2e5050c60e /games/sxsame | |
parent | Support CFLAGS properly. Conform to one file per patch guideline. Be (diff) |
[ second commit, I forgot to add these patches. ]
Support CFLAGS properly. Conform to one file per patch guideline. Be
extra careful with $i; remove unnecessary WRKSRC.
PR: 19925
Submitted by: KATO Tsuguru <tkato@prontomail.ne.jp>
Notes
Notes:
svn path=/head/; revision=30659
Diffstat (limited to 'games/sxsame')
-rw-r--r-- | games/sxsame/files/patch-ad | 86 | ||||
-rw-r--r-- | games/sxsame/files/patch-ae | 11 | ||||
-rw-r--r-- | games/sxsame/files/patch-af | 39 | ||||
-rw-r--r-- | games/sxsame/files/patch-ag | 71 | ||||
-rw-r--r-- | games/sxsame/files/patch-ah | 85 |
5 files changed, 292 insertions, 0 deletions
diff --git a/games/sxsame/files/patch-ad b/games/sxsame/files/patch-ad new file mode 100644 index 000000000000..34b7a8109bf2 --- /dev/null +++ b/games/sxsame/files/patch-ad @@ -0,0 +1,86 @@ +--- hiscore.c.orig Sun May 5 04:09:25 1996 ++++ hiscore.c Tue Jul 11 21:29:01 2000 +@@ -5,14 +5,16 @@ + * Copyleft (c) 1994-1996 Software Research Academy * + ************************************************************************/ + #include <stdio.h> +-#include <sys/types.h> +-#include <sys/stat.h> ++#include <stdlib.h> ++#include <string.h> ++#include <unistd.h> ++#include <sys/param.h> + #include "config.h" + #include "hiscore.h" + + static struct Hiscore hiscore[4]; + +-static char *lockf = LOCK_FILE; ++static char *lockfn = LOCK_FILE; + static char *hiscoref = HISCORE_FILE; + extern char *same_dir; + static int lock_file( +@@ -30,12 +32,15 @@ + FILE *fp; + int i, j; + char *myname; +- char tmpf[256]; ++ char tmpf[MAXPATHLEN]; + int new = 0; + + myname = (char *)getenv("LOGNAME"); +- sprintf(tmpf, "%s/%s", same_dir, hiscoref); +- umask(0); ++ if (MAXPATHLEN <= snprintf(tmpf, MAXPATHLEN ,"%s/%s", same_dir, hiscoref) ) { ++ fprintf(stderr,"Error: hiscore file name too long.\n"); ++ return -1; ++ } ++ umask(002); + fp = fopen(tmpf,"rb"); + if(fp != NULL) + { +@@ -75,11 +80,11 @@ + break; + } + } +- if(i < 10 | new == 1) ++ if(i < 10 || new == 1) + { + if(lock_file(0) != 0) + return(-1); +- umask(0); ++ umask(002); + fp = fopen(tmpf, "wb"); + fwrite(hiscore, sizeof(hiscore), 1, fp); + fclose(fp); +@@ -95,10 +100,12 @@ + int cmd; + { + FILE *fp; +- char lkf[256]; ++ char lkf[MAXPATHLEN]; + int i; +- +- sprintf(lkf,"%s/%s", same_dir, lockf); ++ if (MAXPATHLEN <= snprintf(lkf, MAXPATHLEN, "%s/%s", same_dir, lockfn)) { ++ fprintf(stderr,"Error: lock file name too long.\n"); ++ return -1; ++ } + if(cmd == 1) + { + if(remove(lkf) != 0) +@@ -134,9 +141,12 @@ + struct Hiscore *hi; + { + FILE *fp; +- char tmpf[256]; ++ char tmpf[MAXPATHLEN]; + +- sprintf(tmpf, "%s/%s", same_dir, hiscoref); ++ if (MAXPATHLEN <= snprintf(tmpf, MAXPATHLEN, "%s/%s", same_dir, hiscoref)) { ++ fprintf(stderr,"Error: hiscore file name too long.\n"); ++ return -1; ++ } + fp = fopen(tmpf,"rb"); + if(fp == NULL) + return(-1); diff --git a/games/sxsame/files/patch-ae b/games/sxsame/files/patch-ae new file mode 100644 index 000000000000..10ba162863f9 --- /dev/null +++ b/games/sxsame/files/patch-ae @@ -0,0 +1,11 @@ +--- inifile.c.orig Sun May 5 04:09:25 1996 ++++ inifile.c Tue Jul 11 21:14:03 2000 +@@ -5,6 +5,8 @@ + * Copyleft (c) 1994-1996 Software Research Academy * + ************************************************************************/ + #include <stdio.h> ++#include <stdlib.h> ++#include <string.h> + + #include "sxsame.h" + diff --git a/games/sxsame/files/patch-af b/games/sxsame/files/patch-af new file mode 100644 index 000000000000..9d193e2ac01a --- /dev/null +++ b/games/sxsame/files/patch-af @@ -0,0 +1,39 @@ +--- loadbmp.c.orig Sun May 5 04:09:25 1996 ++++ loadbmp.c Tue Jul 11 21:30:24 2000 +@@ -5,6 +5,9 @@ + * Copyleft (c) 1994-1996 Software Research Academy * + ************************************************************************/ + #include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include <sys/param.h> + #include <X11/Xlib.h> + #include "sxsame.h" + +@@ -37,17 +40,24 @@ + int c, c1,c2; + int width, height, planes, ncol; + int *col; +- char fname[256]; ++ char fname[MAXPATHLEN]; + + Pixmap w; + GC gc; + int i, j, k; + ++ if (MAXPATHLEN <= strlen(bmpname) ) { ++ fprintf(stderr,"Error: BMP file name too long.\n"); ++ return -1; ++ } + strcpy(fname,bmpname); + fp = fopen(fname,"rb"); + if(fp == NULL) + { +- sprintf(fname, "%s/%s", SAME_DIR, bmpname); ++ if (MAXPATHLEN <= snprintf(fname, MAXPATHLEN, "%s/%s", SAME_DIR, bmpname)) { ++ fprintf(stderr,"Error: BMP file name too long.\n"); ++ return -1; ++ } + fp = fopen(fname, "r"); + if(fp == NULL) + { diff --git a/games/sxsame/files/patch-ag b/games/sxsame/files/patch-ag new file mode 100644 index 000000000000..7641c57c7e0f --- /dev/null +++ b/games/sxsame/files/patch-ag @@ -0,0 +1,71 @@ +--- loaddata.c.orig Sun May 5 04:09:25 1996 ++++ loaddata.c Tue Jul 11 21:32:34 2000 +@@ -5,6 +5,9 @@ + * Copyleft (c) 1994-1996 Software Research Academy * + ************************************************************************/ + #include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include <sys/param.h> + #include "config.h" + #include "sxsame.h" + +@@ -25,7 +28,7 @@ + DataFile ***data; + { + FILE *fp; +- char fname[256]; ++ char fname[MAXPATHLEN]; + char buf[256]; + char str1[256]; + char str2[256]; +@@ -34,11 +37,18 @@ + char *p; + int i; + ++ if (MAXPATHLEN <= strlen(entry_name)) { ++ fprintf(stderr,"Error: data file name too long.\n"); ++ return 0; ++ } + strcpy(fname,entry_name); + fp = fopen(fname, "r"); + if(fp == NULL) + { +- sprintf(fname, "%s/%s", SAME_DIR, entry_name); ++ if (MAXPATHLEN <= snprintf(fname, MAXPATHLEN ,"%s/%s", SAME_DIR, entry_name)) { ++ fprintf(stderr,"Error: data file name too long.\n"); ++ return 0; ++ } + fp = fopen(fname, "r"); + if(fp == NULL) + return(0); +@@ -81,7 +91,7 @@ + char *fname; + { + FILE *fp; +- char tmpfname[256]; ++ char tmpfname[MAXPATHLEN]; + char buf[256]; + char str1[256],str2[256]; + int val, i, j; +@@ -94,7 +104,7 @@ + { + for(j=0;j<5;j++) + { +- data->xpm_data[i][j] == 0; ++ data->xpm_data[i][j] = 0; + } + } + data->bg_data = 0; +@@ -103,7 +113,10 @@ + fp = fopen(fname,"r"); + if(fp == NULL) + { +- sprintf(tmpfname, "%s/%s", SAME_DIR, fname); ++ if (MAXPATHLEN <= snprintf(tmpfname, MAXPATHLEN, "%s/%s", SAME_DIR, fname)) { ++ fprintf(stderr,"Error: data file name too long.\n", fname); ++ return -1; ++ } + fp = fopen(tmpfname, "r"); + if(fp == NULL) + { diff --git a/games/sxsame/files/patch-ah b/games/sxsame/files/patch-ah new file mode 100644 index 000000000000..d4e679528411 --- /dev/null +++ b/games/sxsame/files/patch-ah @@ -0,0 +1,85 @@ +--- sxsame.c.orig Sun May 5 04:09:26 1996 ++++ sxsame.c Tue Jul 11 21:35:38 2000 +@@ -12,6 +12,11 @@ + char *program_version = "3.02"; + + #include <stdio.h> ++#include <stdlib.h> ++#include <unistd.h> ++#include <time.h> ++#include <string.h> ++#include <sys/param.h> + #include <X11/Xlib.h> + #include <X11/Xutil.h> + #ifndef LOCAL_XPM_H +@@ -163,11 +168,21 @@ + int hisc_height = 80; + #endif /* !ENABLE_HISCORE */ + +- ++int ReadInitFile(int* width, int* height, int* same_pic); ++int SaveInitFile(int width, int height, int same_pic); + int CheckSameDataFile(DataFile ***); + int LoadBMPSameData(Display *dpy, Colormap cmap, SameGame *, char *); + int LoadSameData(ImportSameData *, char *); ++int CheckSelectSame(int sx, int sy); + ++static ++int ++Access(const char* path) ++{ ++ return access(path, R_OK); ++} ++ ++# define access(x) Access(x) + + void main(argc, argv) + int argc; +@@ -726,7 +741,7 @@ + { + ImportSameData data; + int i, j, val, ncol; +- char tmpfname[256]; ++ char tmpfname[MAXPATHLEN]; + + if(strlen(fname)>4) /* check Windows data file... */ + { +@@ -784,9 +799,13 @@ + { + if(!access(data.xpm_data[i][j])) + strcpy(tmpfname,data.xpm_data[i][j]); +- else +- sprintf(tmpfname,"%s/%s",same_dir, +- data.xpm_data[i][j]); ++ else { ++ if (MAXPATHLEN <= ++ snprintf(tmpfname, MAXPATHLEN, "%s/%s",same_dir, ++ data.xpm_data[i][j])) { ++ goto xpm_error; ++ } ++ } + val = XpmReadFileToPixmap(dpy, root, + tmpfname, &game.bits_xpm[i][j], + NULL, &xpm_attr); +@@ -804,7 +823,9 @@ + if(!access(data.bg_data)) + strcpy(tmpfname,data.bg_data); + else +- sprintf(tmpfname,"%s/%s",same_dir, data.bg_data); ++ if (MAXPATHLEN <= snprintf(tmpfname, MAXPATHLEN, "%s/%s",same_dir, data.bg_data)) { ++ goto xpm_error; ++ } + val = XpmReadFileToPixmap(dpy, root, tmpfname, + &game.bg_xpm, NULL, &xpm_attr); + free(data.bg_data); +@@ -815,6 +836,10 @@ + strcpy(tmpfname,data.frame_data); + else + sprintf(tmpfname,"%s/%s",same_dir, data.frame_data); ++ if (MAXPATHLEN <= snprintf(tmpfname, MAXPATHLEN, "%s/%s",same_dir, data.frame_data)) { ++ ++ goto xpm_error; ++ } + val = XpmReadFileToPixmap(dpy, root, tmpfname, + &game.frame_xpm, NULL, &xpm_attr); + free(data.frame_data); |