FTAM/9000 Programmer's Guide
376 Chapter 10
Example Programs
Setting Ae_dir_dn and P_address Utility Example
else {
/*
** Move to the next character in the string and the next
** Dir_rdn structure in the Dir_dn structure.
*/
++j;
++index;
}
}
}
}
/*
**
** convert_paddr
**
** DESCRIPTION:
** This routine scans a character string and sets up
** a P_address.
**
**
** PARAMETERS:
** Inputs:
** name: string for P_address
**
** Outputs:
** p_addr: pointer to the P_address
**
*/
void
convert_paddr(p_addr, name)
struct P_address *p_addr;
char *name;
{
char *temp;
int i=0, j=0, index=0;
Bool null_flag=0;
/*
** Malloc memory.
*/
temp = (char *)malloc(strlen(name) + 1);
p_addr->p_selector = (struct Octet_string *)malloc
(sizeof(struct Octet_string));
p_addr->s_selector = (struct Octet_string *)malloc
(sizeof(struct Octet_string));
p_addr->t_selector = (struct Octet_string *)malloc
(sizeof(struct Octet_string));
p_addr->nsaps = (struct Octet_string *)malloc
(8*sizeof(struct Octet_string));
/*
** How many nsaps?
*/
while (name[j] != NULL) {
if (name[j] == '.')
++index;
++j;
}
p_addr->n_nsaps = index - 2;