getprojdb Subroutine

Purpose

Retrieves the specified project record from the project database.

Library

The libaacct.a library.

Syntax

<sys/aacct.h> 

getprojdb(void *handle, struct project *project,  int flag)

Description

The getprojdb subroutine searches the project database associated with the handle parameter for the specified project. The project database must be initialized before calling this subroutine. The routines projdballoc and projdbfinit are provided for this purpose. The flag parameter indicates the type of search. The following flags are defined:
  • PROJ_NAME — Search by product name. The getprojdb subroutine scans the file to obtain a match for the supplied project name and returns the matching entry.
  • PROJ_NUM — Search by product number. The getprojdb subroutine scans the file to obtain a match for the supplied project number and returns the matching entry.

The entire database is searched. If the specified record is found, the getprojdb subroutine stores the relevant project information into the struct project buffer, which is passed as an argument to this subroutine. The specified project is then made the current project in the database. If the specified project is not found, the database is reset so that the first project in the database is the current project.

Parameters

Item Description
handle Pointer to the handle allocated for the project database.
project Pointer holding the project name whose information is required.
flag Integer flag indicating what type of information is sent for matching; that is, whether the match needs to be performed by project name or number.

Security

No restrictions. Any user can call this function.

Return Values

Item Description
0 Success
-1 Failure

Error Codes

Item Description
ENOENT Project definition not found.
EINVAL Invalid arguments if flag is not valid or passed pointer is NULL.