🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.att
Article #934

fix to "mongo" graphing program

#934
From: Michael Richmond
Date: Sat, 12 Apr 1986 16:20
34 lines
1800 bytes
About a week or so ago I posted the sources to a simple graphing package
called "mongo" to net.sources. Since then, I have discovered that on the
7300, whenever you resize or move a window, the escape sequence generated
by the mouse gets passed to the input stream of the program (!), causing
the command-hashing routine to yield a non-sense pointer, causing the
program to bomb as soon as you type <return>. Here's the fix:

file: hash.c  function: lookup()

lookup(s)
char *s;
{
    struct nlist *np;
    int i;                    /* first line of fix */

    if ((i = hash(s)) < 0) 	  /* second line */
       return(NULL);          /* third */

    for (np = hashtab[i]; np != NULL; np = np->next)   /* last line of fix */
       .
       .
 

As you can see, I've added a check to make sure that the hashing function
does not return a negative value. What happened was that the mouse escape
sequence somehow gave negative character values, AND the mod function
inside the hashing procedure returned negative values for negative arguments.
Hmmm.


-- 
Michael Richmond			Princeton University, Astrophysics

{allegra,akgua,burl,cbosgd,decvax,ihnp4,noao,princeton,vax135}!astrovax!richmon
Technical Details
Message-ID: <770@astrovax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!linus!decvax!bellcore!ulysses!allegra!princeton!astrovax!richmon

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 11/03/84 (WLS Mods); site astrovax.UUCP
Path: arc1-ca.pugleaf.net!utzoo!linus!decvax!bellcore!ulysses!allegra!princeton!astrovax!richmon
From: richmon@astrovax.UUCP (Michael Richmond)
Newsgroups: net.micro.att
Subject: fix to "mongo" graphing program
Message-ID: <770@astrovax.UUCP>
Date: Sat, 12-Apr-86 11:20:02 EST
Article-I.D.: astrovax.770
Posted: Sat Apr 12 11:20:02 1986
Date-Received: Mon, 14-Apr-86 03:31:29 EST
Distribution: net
Organization: Princeton Univ. Astrophysics
Lines: 34