[comp.sys.amiga.tech] Pathname Comparison

peter@sugar.UUCP (Peter da Silva) (07/14/88)

Well, it looks like it should pretty much work, but this is smaller and might
be a bit more reliable, taken from the source to Browser:

----------
#include <exec/memory.h>
#include <libraries/dosextens.h>

SameFile(lock1, lock2)	/* return true if the locks match */
long lock1, lock2;
{
	struct FileLock *flock1, *flock2;

	if(!lock1 || !lock2)	/* handle special case of the zero lock */
		return lock1 == lock2;

	flock1 = (struct FileLock *) (lock1<<2);	/* convert BPTRs */
	flock2 = (struct FileLock *) (lock2<<2);

	return	flock1->fl_Volume == flock2->fl_Volume &&
		flock1->fl_Key == flock2->fl_Key;
}
-- 
-- `-_-' Peter (have you hugged your wolf today?) da Silva.
--   U   Mail to ...!uunet!sugar!peter, flames to alt.dev.null.
-- "Running OS/2 on a '386 is like pulling your camper with an Indy car"

acphssrw@csuna.UUCP (Stephen R. Walton) (07/15/88)

In article <483@amanpt1.zone1.com>, Mark Rinfret asks about comparing
two path names for equality.  If you can get Lock()'s on both of them,
the ARP V1.1 CompareLock() function will do this for you.  Its prototype
is:
	int CompareLock(BPTR Lock1, BPTR Lock2);
and it returns 0 if the locks point to the same object, 1 if they don't.

Stephen Walton, representing myself		swalton@solar.stanford.edu
Cal State, Northridge				rckg01m@calstate.BITNET