Small error in Zip 2.0


31 May 1995 06:19:25 GMT

Ok, so this is my third post on this topic so far today. I think I've fixed
my problem, and although no one responded saying they were having the same
problem, I thought I'd toss this out there anyway.

To recap:
I compiled zip on an ultrix machine, and used it for a long time, playing
all sorts of Infocom (LTOI and disk-imaged) and infocom-alike games. I just
recently tried playing Bureaucracy with it, and found that it didn't behave
well with that game's odd input areas. There are forms to fill out in this
game, if you haven't played it. In short, the forms didn't work.

So I spent a bit of time figuring out what was happening, and it's this:

in unixio.c (I don't know about the other os-dependent sources), the same
function gets called by input_character() and input_line() to read a single
character. I see this as a minor bug, since input_character() seems to want
newlines translated to carriage returns, and input_line() seems to want the
opposite.

I opted not to change the read_key() function, since that function's probably
called often, and a change could increase processing time. I made a small
change to input_character(), however. This is what my version of
input_character() looks like:

int input_character (timeout)
int timeout;
{
struct timeval tv;
struct timezone tz;
int c;

gettimeofday (&tv, &tz);

tv.tv_sec += timeout;

fflush (stdout);

if (timeout && wait_for_char (&tv))
return (-1);

c = read_key ();
if (c == '\n')
c = '\r';

return (c);

}/* input_character */

Only 5 lines have been changed from the original, but now Bureaucracy works,
which was my intent.

I haven't tested this on any other games which might use input_character in
odd ways (I can't think of any, really).

If no one else has been having this problem, oh well. I was. *grin*
If anyone else has had this problem, I hope this fixes it for you, too.

-Josh (Who will never write an original piece of code, but always seems to
spend a lot of time looking for ways to improve others' code...)