[comp.sources.bugs] C Cross-ref package bug + FIX

rcodi@yabbie.rmit.oz (Ian Donaldson) (10/12/87)

I have discovered a bug in that if you hit ^C (or DEL or whatever)
while in vi from eid, both vi and eid die.  This would happen on -any-
UNIX system.

All attempts to contact the author via email have bounced unfortunately, so I 
am posting the fix here.

The fix follows; its trivial:

In "lid.c": Near the top, add the following two lines...
-----
#include	<signal.h>
#include	<errno.h>
-----

In "lid.c": Instead of the wait(0):
-----
		{
			int (*oldint)() = signal(SIGINT, SIG_IGN);
			int (*oldquit)() = signal(SIGQUIT, SIG_IGN);

			while(wait(0) == -1 && errno == EINTR)
				/* loop */;

			(void) signal(SIGINT, oldint);
			(void) signal(SIGQUIT, oldquit);
		}
-----

This is basically what system(3) does internally.

A couple of other funnies:

	1) no supplied man page for idx(1) or fid(1).  What do they do?

	2) file names with leading /'s can't be gid'd or eid'd etc,
	   because the leading slash gets dropped somewhere,
	   but mkid puts the names in the database and scans them happily.   
	   
	   Try mkid'ing files in /usr/include and you'll see what
	   I mean.  There is lots of code that deals with /'s in
	   the package, and not being absolutely sure of it all,
	   I haven't touched it.

This is an otherwise excellent piece of software and has saved
me heaps of time so far on large packages.

Ian D

walters@io.UUCP (Tim Walters) (10/16/87)

In article <615@yabbie.rmit.oz> rcodi@yabbie.rmit.oz (Ian Donaldson) writes:
>	2) file names with leading /'s can't be gid'd or eid'd etc,
>	   because the leading slash gets dropped somewhere,
>	   but mkid puts the names in the database and scans them happily.   

We've also had trouble with the leading slash being dropped off a
database file name specified with the -f option.
-- 
	...!harvard!umb!ileaf!walters	Tim Walters, Interleaf
	  ...!sun!sunne!ileaf!walters	Ten Canal Park, Cambridge, MA 02141
					(617) 577-9813 x5510

tbm@anuck.UUCP (t.b.merrick) (10/19/87)

> 	....
> 	2) file names with leading /'s can't be gid'd or eid'd etc,
> 	   because the leading slash gets dropped somewhere,
> 	   but mkid puts the names in the database and scans them happily.   
> 	   ....

I have the same problem.  I tried using a different ndir.h and a lib
that was newer containing dirclose etc.  It seemed the problem had
gone away.  Strangely the ndir.h and dir.a came with internal comm-ware,
not from standard U5.2.  What were we supposed to use?

Tom Merrick ATT BTL Andover