/*
*      SCCS:   @(#)install/userintf/base_ftok	Rel 4.4.1 (06/09/97)
*
*	UniSoft Ltd., London, England
*/
/***********************************************************************

NAME:		base_ftok - user-modifiable ftok() routine
PROJECT:	VSX (X/OPEN Validation Suite)
AUTHOR:		Geoff Clare, UniSoft Ltd.
DATE CREATED:	December 1996
MODIFICATIONS:

************************************************************************/

/*
 *	Ftok returns a key based on the arguments path and id, for use
 *	in msgget(), semget() and shmget() calls.
 *	Ftok() is normally supplied with IPC implementations.  Only
 *	uncomment the #define below if you do not already have ftok()
 *	on your system, or if your ftok() has different arguments or
 *	return type.  The example version assumes key_t is a 32 bit
 *	integral type.
 */

/* #define NO_FTOK */

#ifdef NO_FTOK
public key_t
ftok(path, id)
char *path;
int id;
{
        struct stat stb;

	if (stat(path, &stb) == -1)
		return (key_t)-1;

	return (key_t)((key_t)id << 24 |
		       (key_t)stb.st_dev << 16 | (key_t)stb.st_ino);
}
#endif

