c_lockfil - Lock or unlock a file

SYNTAX

FUNCTION c_lockfil(hname, lockflg)

     char *hname;  
     long *lockflg;

PARAMETERS

hname (char *, input)

The host file name of the file to be locked.

lockflg (long *, input)

The locking operation. Valid operation codes are:

     LOCK   (1) :	Lock the file
     UNLOCK (0) :	Unlock the file

DESCRIPTION

The c_lockfil() routine is used to lock or unlock a file. A file is locked by creating a lock file in the same directory as the input host file. The lock file is named from the root of the input host file with an extension of "lock". The file is not actually locked for exclusive use, but like processes should check for the existence of this lock file. A file is unlocked by removing the "lock" file.

RETURN VALUE

c_lockfil() returns

     E_SUCC (0)  --> The locking operation was successful.
     E_FAIL (-1) --> The locking operation failed due to an error creating 
	             or removing the lock file.
     LOCKED (1)  --> The attempt to lock the file failed because the file 
	             is already locked by another user.