getnextprojdb Subroutine

Purpose

Retrieves the next project from the specified project database.

Library

The libaacct.a library.

Syntax

<sys/aacct.h>

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

Description

The getnextprojdb subroutine retrieves the next project definitions from the project database named 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. When the last project is read, the current project assignment is advanced to the end of the database. Any attempt to read beyond the end of the project database results in a failure.

Parameters

Item Description
handle Pointer to the projdb handle.
project Pointer to project structure where the retrieved data is stored.
comm Comment associated with the project in the database.

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 End of the project database.
ENOENT No projects available.