summaryrefslogtreecommitdiff
path: root/games/xchomp/files/patch-main.c
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2013-02-04 14:30:02 +0000
committerMartin Wilke <miwi@FreeBSD.org>2013-02-04 14:30:02 +0000
commit5eee5a30c71c8d68f07ea563c9af100c04e1a19a (patch)
tree282265cf232525e9af5b4289080a1b396deb233e /games/xchomp/files/patch-main.c
parent- Update MASTER_SITES (diff)
- Update MASTER_SITES
- Fix build with clang - Add MAKE_JOBS_SAFE PR: 175572 Submitted by: Ports Fury
Notes
Notes: svn path=/head/; revision=311621
Diffstat (limited to 'games/xchomp/files/patch-main.c')
-rw-r--r--games/xchomp/files/patch-main.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/games/xchomp/files/patch-main.c b/games/xchomp/files/patch-main.c
new file mode 100644
index 000000000000..8cf838de2a4b
--- /dev/null
+++ b/games/xchomp/files/patch-main.c
@@ -0,0 +1,76 @@
+--- main.c.orig
++++ main.c
+@@ -2,7 +2,7 @@
+ #define EXTERN
+ #include "xchomp.h"
+
+-main(argc, argv)
++int main(argc, argv)
+ int argc;
+ char *argv[];
+ {
+@@ -10,6 +10,12 @@
+ int dummy;
+ XCharStruct chars;
+ unsigned long event_mask;
++ int fdelay = 0;
++
++ /* User may set FRAME_DELAY from the command line */
++ if (argc >= 2) {
++ fdelay = atoi(argv[1]);
++ }
+
+ /* open the display */
+ display = XOpenDisplay(NULL);
+@@ -64,17 +70,18 @@
+ }
+
+ /* go to it */
+- play_game();
++ play_game(fdelay);
+
+ /* exit */
+ do_exit();
++ return 0;
+ }
+
+
+ /*
+ * The following function contains the main game loop.
+ */
+-play_game() {
++void play_game(fdelay) {
+ register int i;
+ char c_buf;
+ XComposeStatus status;
+@@ -166,7 +173,7 @@
+ if (event.xany.window != window) continue;
+ switch (event.type) {
+ case KeyPress:
+- XLookupString(&event, &c_buf, 1, &last_key, &status);
++ XLookupString((XKeyEvent *) &event, &c_buf, 1, &last_key, &status);
+ if (last_key == XK_space)
+ if (!pause_seq())
+ goto demo;
+@@ -325,7 +332,11 @@
+ XSync(display, False);
+
+ #ifdef FRAME_DELAY
+- usleep(FRAME_DELAY);
++ if (fdelay > 0) {
++ usleep(fdelay);
++ } else {
++ usleep(FRAME_DELAY);
++ }
+ #endif
+
+ } /* while */
+@@ -347,7 +358,7 @@
+ }
+
+
+-do_exit()
++void do_exit()
+ {
+ destroy_regions();
+ XUnmapWindow(display, window);