diff options
Diffstat (limited to 'games/scare/files/patch-os_glk.c')
-rw-r--r-- | games/scare/files/patch-os_glk.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/games/scare/files/patch-os_glk.c b/games/scare/files/patch-os_glk.c index 4f4781a1bd9..4f53fcd59c8 100644 --- a/games/scare/files/patch-os_glk.c +++ b/games/scare/files/patch-os_glk.c @@ -1,40 +1,40 @@ ---- os_glk.c.orig Sat Feb 5 19:58:33 2005 -+++ os_glk.c Sat Feb 5 20:17:22 2005 -@@ -899,6 +899,8 @@ - && glk_gestalt (gestalt_Graphics, 0)) - { - sc_char *buffer; -+ char fname[80]; -+ int fd; +--- os_glk.c.orig Tue Sep 26 21:50:17 2006 ++++ os_glk.c Tue Sep 26 21:55:13 2006 +@@ -1110,6 +1110,8 @@ + && gsclinux_graphics_enabled && glk_gestalt (gestalt_Graphics, 0)) + { + sc_char *buffer; ++ char fname[80]; ++ int fd; - /* - * Try to extract data with dd. Assuming that works, back- -@@ -906,15 +908,23 @@ - * delay ten seconds and then delete the temporary file - * containing the image. Not exactly finessed. - */ -+ strcpy(fname, "/tmp/scare-XXXXXX.jpg"); -+ fd = mkstemps(fname, 4); -+ if (fd < 0) -+ return; -+ close(fd); - assert (gsclinux_game_file != NULL); - buffer = gsc_malloc (strlen (gsclinux_game_file) + 128); -- sprintf (buffer, "dd if=%s ibs=1c skip=%ld count=%ld obs=100k" -- " of=/tmp/scare.jpg 2>/dev/null", -- gsclinux_game_file, offset, length); -+ sprintf (buffer, "dd if=%s ibs=1 skip=%ld count=%ld obs=100k" -+ " of=%s 2>/dev/null", -+ gsclinux_game_file, offset, length, -+ fname); -+ system (buffer); -+ sprintf (buffer, "xv %s >/dev/null 2>&1 &", fname); -+ system (buffer); -+ sprintf (buffer, "( sleep 10; rm %s ) >/dev/null 2>&1 &", fname); - system (buffer); - free (buffer); -- system ("xv /tmp/scare.jpg >/dev/null 2>&1 &"); -- system ("( sleep 10; rm /tmp/scare.jpg ) >/dev/null 2>&1 &"); - } + /* + * Try to extract data with dd. Assuming that works, background xv to +@@ -1118,15 +1120,23 @@ + * xv can usually use a small script, named xv, to invoke eog or an + * alternative image display binary. Not exactly finessed. + */ ++ strcpy(fname, "/tmp/scare-XXXXXX.jpg"); ++ fd = mkstemps(fname, 4); ++ if (fd < 0) ++ return; ++ close(fd); + assert (gsclinux_game_file); + buffer = gsc_malloc (strlen (gsclinux_game_file) + 128); +- sprintf (buffer, "dd if=%s ibs=1c skip=%ld count=%ld obs=100k" +- " of=/tmp/scare.jpg 2>/dev/null", +- gsclinux_game_file, offset, length); ++ sprintf (buffer, "dd if=%s ibs=1 skip=%ld count=%ld obs=100k" ++ " of=%s 2>/dev/null", ++ gsclinux_game_file, offset, length, ++ fname); ++ system (buffer); ++ sprintf (buffer, "xv %s >/dev/null 2>&1 &", fname); ++ system (buffer); ++ sprintf (buffer, "( sleep 10; rm %s ) >/dev/null 2>&1 &", fname); + system (buffer); + free (buffer); +- system ("xv /tmp/scare.jpg >/dev/null 2>&1 &"); +- system ("( sleep 10; rm /tmp/scare.jpg ) >/dev/null 2>&1 &"); + } } #else |