[comp.sources.games.bugs] Cubes 5.1 and control codes

ameiba@reed.UUCP (Keith Steiger) (05/10/89)

Well, while happily hacking away at Cubes 5.1, I found that the program
doesn't deal with Control-Cs.  This is evil.  Furthermore, it won't accept
any attempts to shell out.  This often leaves the player hung, halfway
out of the process, with no possibility of killing it.

I suggest adding the following line to main() in cubes.c:

signal(SIGINT,reallyquit);

This makes the computer ask you "Do you really want to quit?" if you hit
^C, and deals with you intelligently if you say yes.  It saves a lot of
headaches.

If a .signature doesn't follow this line, I'm going to rip out Pnews' innards.

ameiba@reed.UUCP (Keith Steiger) (05/10/89)

In article <12711@reed.UUCP> ameiba@reed.UUCP (Keith Steiger) writes:
>I suggest adding the following line to main() in cubes.c:
>signal(SIGINT,reallyquit);

Oh, BTW, you need to put in a "int (*reallyquit)();" in the declaration area
to make signal happy.  It really doesn't matter.

>If a .signature doesn't follow this line, I'm going to rip out Pnews' innards.

Ditto.  I'm Keith Steiger, ameiba@reed.UUCP, in case it fails AGAIN.

gmp@rayssd.ray.com (Gregory M. Paris) (05/12/89)

In article <12711@reed.UUCP> ameiba@reed.UUCP (Keith Steiger) writes:
> Well, while happily hacking away at Cubes 5.1, I found that the program
> doesn't deal with Control-Cs.  This is evil.  Furthermore, it won't accept
> any attempts to shell out.  This often leaves the player hung, halfway
> out of the process, with no possibility of killing it.

I've run cubes on four different types of BSDish UNIX machines and do
not have the problem you mention above.  Could you please tell me what
kind of system you are running on?  When you say that cubes doesn't
deal with Control-Cs, what do you mean?  Does it ignore them?  Also,
I don't know what you mean by "attempts to shell out" -- cubes does
honor the suspend signal, at least here anyway.

You aren't, perhaps, running cubes via a shell script, are you?  As
stated in the long version of the cubes manual page, cubes treats
interrupt specially (so that you don't accidentally quit out of a
game), thus your shell script must take care to either exec cubes
or trap the interrupt signal.  Otherwise, your shell might go away
and cubes would continue to run (a distasteful situation :-).

> I suggest adding the following line to main() in cubes.c:
> 
> signal(SIGINT,reallyquit);

Anyone else having this or any other problem with cubes please let
me know.  I do suggest that you not add the code above.  When the
cause of the problem is found, I'll post an offical patch, if one
turns out to be necessary.

-- 
Greg Paris <gmp@rayssd.ray.com>
{decuac,necntc,spdcc,sun,uiucdcs,ukma}!rayssd!gmp
"It has been confirmed; he was attacked by goons." -- Tom Brokaw
And a river of green is sliding unseen beneath the trees.