getfirstprojdb Subroutine

Purpose

Retrieves details of the first project from the specified project database.

Library

The libaacct.a library.

Syntax

<sys/aacct.h>

getfirstprojdb(void *handle, struct project *project, char *comm)

Description

The getfirstprojdb subroutine retrieves the first project definitions from the project database, which is controlled through the handle parameter. The caller must initialize the project database prior to calling this routine with the projdballoc routine. Upon successful completion, the project information is copied to the project structure specified by the caller. In addition, the associated project comment, if present, is copied to the buffer pointed to by the comm parameter. The comment buffer is allocated by the caller and must have a length of 1024 bytes.

There is an internal state (that is, the current project) associated with the project database. When the project database is initialized, the current project is the first project in the database. The getnextprojdb subroutine returns the current project and advances the current project assignment to the next project in the database so that successive calls read each project entry in the database. The getfirstprojdb subroutine can be used to reset the database, so that the initial project is the current project assignment.

Parameters

Item Description
handle Pointer to the projdb handle.
project Pointer to project structure where the retrieved data is stored.
comm Pointer to the comment buffer.

Security

No restriction. Any user can call this function.

Return Values

Item Description
0 Success
-1 Failure

Error Codes

Item Description
EINVAL Invalid arguments, if passed pointer is NULL.
ENOENT No projects available.