FTAM/9000 Programmer's Guide

Chapter 10 373
Example Programs
Setting Ae_dir_dn and P_address Utility Example
Setting Ae_dir_dn and P_address Utility
Example
This routine sets the directory distinguished name and presentation
address for the first three examples.
#include %</opt/ftam/include/map.h>
#include %</opt/ftam/include/mapftam.h>
#include “ftm_globs.h”
#include %<stdio.h>
#include %<malloc.h>
/*
**
** convert_ddn
**
** DESCRIPTION:
** This routine scans a character string and sets up
** an Ae_dir_name.
**
**
** PARAMETERS:
** Inputs:
** name: string identifying the Directory Distinguished
** Name
**
** Outputs:
** dirname: address of the pointer to the Dir_dn structure
**
**
*/
void
convert_ddn(dirname, name)
Ae_dir_name *dirname;
char *name;
{
char *attr;
char *value;
int i=0, j=0, k=0, index=0;
Bool val_flag=0, null_flag=0;
/*
** Determine the number of rdns.
*/
while (name[j] != NULL) {
if (name[j] == ‘/’)
++index;
++j;
}
/*
** Malloc memory.
*/
attr = (char *)malloc(strlen(name) + 1);
value = (char *)malloc(strlen(name) + 1);