Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
/*%% $XConsortium: isfd.c /main/3 1995/10/23 11:39:10 rswiston $ */
#ifndef lint
static char sccsid[] = "@(#)isfd.c 1.3 89/07/17 Copyr 1988 Sun Micro";
#endif
/*
* Copyright (c) 1988 by Sun Microsystems, Inc.
*/
/*
* isfd.c
*
* Description:
* The ISAM file descriptors (isfd) are used as index to a table of
* pointers to File Access Block objects. Isfd.c maintains the table
* of the pointers (isfdtab).
*
*/
#include "isam_impl.h"
static Fab *isfdtab[MAXISFD]; /* Table of pointers */
/*
* _isfd_insert(fab)
*
* Insert a pointer to an Fab object to table of ISAM file descriptors.
* Return an ISAM file descriptor, or NOISFD if the table is full.
*/
Isfd
_isfd_insert(fab)
Fab *fab;
{
register Isfd i;
for (i = 0; i < MAXISFD; i++) {
if (isfdtab[i] == NULL) /* Empty entry found */
break;
}
if (i == MAXISFD)
return (NOISFD); /* isfdtab is full */
isfdtab[i] = fab;
return (i);
}
/*
* _isfd_find(isfd)
*
* Return a pointer to Fab object associated with the ISAM file
* descriptor isfd. If isfd is not a file descriptor of an open ISAM file,
* return NULL.
*/
Fab *
_isfd_find(isfd)
register Isfd isfd;
{
if (isfd < 0 || isfd >= MAXISFD || isfdtab[isfd] == NULL)
return (NULL);
else
return (isfdtab[isfd]);
}
/*
* _isfd_delete(isfd)
*
* Delete an entry from isfdtab. No check is made the entry exists.
*/
void
_isfd_delete(isfd)
register Isfd isfd;
{
if (isfd >= 0 && isfd < MAXISFD)
isfdtab[isfd] = NULL;
}