PMDF Programmer's Reference Manual


Previous Next Contents Index


PMDFgetAddressProperty

Parse an address and return the requested address property.

PASCAL

status = PMDF_get_address_property

(address, property, result, result_len)

argument information
Argument Data type Access Mechanism
address descriptor read reference
property integer read value
result descriptor read/write reference
result_len unsigned word write reference

C

status = PMDFgetAddressProperty

(address, address_len, property, result, result_len)

argument information


int PMDFgetAddressProperty(char *address, 
                           int   address_len, 
                           int   property, 
                           char *result, 
                           int  *result_len) 


Arguments

address

The address to parse. Length of this string can not exceed BIGALFA_SIZE bytes.

address_len

Length in bytes of the address to parse.

property

The address property to return.

result

String to receive the address property. Must be at least ALFA_SIZE bytes in length for PMDF_get_address_property or ALFA_SIZE+1 bytes for PMDFgetAddressProperty.

result_len

Length in bytes of the returned property. Callers using PMDFgetAddressProperty must, on input, supply the maximum length in bytes of result.

Description

PMDFgetAddressProperty can be used to parse an address and return the desired property. Moreover, PMDFgetAddressProperty can be used to see if an address is syntactically legal and to clean up addresses with minor syntax problems. The former is accomplished by seeing if PMDF__PARSE is returned and the latter by requesting the PMDF_PROP_PROPER property. The accepted values for property are shown below and refer to an address of the form


phrase <@otherhost:user@host> (comment) 
Symbolic name Value Description
PMDF_PROP_ADDRESS 1 Address part, @ otherhost: user@ host , of the address
PMDF_PROP_DOMAIN 2 Domain part, host , of the address
PMDF_PROP_FRIENDLY 3 See description below
PMDF_PROP_LOCAL 4 Local part, user , of the address
PMDF_PROP_PHRASE 5 Phrase part, phrase , of the address, if any
PMDF_PROP_PROPER 6 Full address including any phrases and comments
PMDF_PROP_ROUTE 7 Source route part, @ otherhost: , of the address, if any
The PMDF_PROP_FRIENDLY property can be used to attempt to extract a human name from the address. When this property is requested, the following steps are used to determine the value to return:

  1. If a RFC 822 phrase phrase is present, then return it, else
  2. If at least one RFC 822 comment comment is present, then return the first one, else
  3. If the local part user is not a RFC 1327 AVPL, then return the local part, else
  4. If a string of the form /pn=value/ is present in the local part, then replace any dots in value with spaces and return that, else
  5. If a string of the form /s=svalue/ is not present in the local part, then return the local part, else
  6. If a string of the form /g=gvalue/ is present in the local part then return gvalue svalue, otherwise
  7. Return svalue.
Note that PMDF_get_address_property can only handle a single address of length up to but not exceeding BIGALFA_SIZE bytes. If more than one address is present in the string, then PMDF__NO will be returned. So, if the address is longer than BIGALFA_SIZE bytes or more than one address can be present, PMDFaddressParseList and PMDFaddressGetProperty should instead be used.

Return Values

PMDF__OK Normal, successful completion.
PMDF__BAD Bad parameter supplied: invalid value for property. No result returned.
PMDF__FATERRLIB Call to LIB$SCOPY_R_DX failed owing to a fatal internal error in the OpenVMS Run Time Library. No result returned.
PMDF__INSVIRMEM Insufficient virtual memory: call to LIB$GET_VM made by LIB$SCOPY_R_DX has failed. No result returned.
PMDF__INVSTRDES Invalid string descriptor for result: descriptor has an invalid value in its DSC$B_CLASS field. No result returned.
PMDF__NO Invalid address. No result returned.
PMDF__STRTRU Supplied string was too long; result truncated to fit.


Previous Next Contents Index