PreviousNext

dce_cf_find_name_by_key(3dce)

Returns a string tagged by a character string key

Synopsis

#include <dce/dce_cf.h>

void dce_cf_find_name_by_key(

FILE *fp,

char *key,

char **name,

error_status_t *status);

Parameters

Input

fp
A file pointer to a correctly formatted text file opened for reading.

key
A character string key that will be used to find name.

Input/Output

name
A pointer to a string (char **) in which a string containing the name found will be placed. The name string will be allocated by malloc( ).

Output

status
Returns the status code from this operation. The status code is a value that indicates whether the routine completed successfully and if not, why not.

Description
The dce_cf_find_name_by_key( ) routine searches a text file for the first occurrence of a string tag identical to the string passed in key. The tag string, in order to be found, must be the first non-white space string on an uncommented line. If the tag string is found, dce_cf_find_name_by_key( ) allocates (by a call to malloc( )) a buffer for the next string found on the same line as the tag string, copies this second string into the buffer, and returns its address in the name input parameter.

The name of the DCE configuration file is in the constant dce_cf_c_db_name; in turn, this constant is defined in the include file <dce_cf.h>.

Cautions
The memory for a returned name string is allocated by malloc( ), and must be freed by the original caller of the configuration routine that called dce_cf_find_name_by_key( ).

Files

dcelocal/dce_cf.db
The machine's local DCE configuration file (where dcelocal is usually something like /opt/dcelocal).

Errors

The following describes a partial list of errors that might be returned. Refer to the OSF DCE Problem Determination Guide for complete descriptions of all error messages.

dce_cf_st_ok
Operation completed successfully.

dce_cf_e_no_mem
No memory available.

dce_cf_e_no_match
No match for key in the file.

Related Information
Functions: dce_cf_binding_entry_from_host(3dce)

dce_cf_get_cell_name(3dce)

dce_cf_get_host_name(3dce)

dce_cf_prin_name_from_host(3dce)

Books: OSF DCE Administration Guide - Core Components