summaryrefslogtreecommitdiff
path: root/games/sxsame/files/patch-ah
diff options
context:
space:
mode:
authorWill Andrews <will@FreeBSD.org>2000-07-15 16:37:58 +0000
committerWill Andrews <will@FreeBSD.org>2000-07-15 16:37:58 +0000
commit179f9d996f48815f0ef219a2fe664f626b780228 (patch)
tree1362e1a18ae7e05ded06b97d9fae2e2e5050c60e /games/sxsame/files/patch-ah
parentSupport 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 '')
-rw-r--r--games/sxsame/files/patch-ah85
1 files changed, 85 insertions, 0 deletions
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);