Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dce_cf_find_name_by_key(3dce) — DCE 3.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

dce_cf_find_name_by_key(3dce)  —  Subroutines

Name

dce_cf_find_name_by_key - Returns a string tagged by a character string key

Synopsis

#include <stdio.h>
#include <dce/dce_cf.h> void dce_cf_find_name_by_key(
FILE ∗fp,
char ∗key,
char ∗∗name,
error_status_t ∗status);

Parameters

Input

fpA file pointer to a correctly formatted text file opened for reading. 

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

Input/Output

nameA 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

statusReturns 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 nonwhitespace 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 header 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 succesfully.

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. 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026