]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap_friendly.3
apply FreeBSD changes to main branch
[openldap] / doc / man / man3 / ldap_friendly.3
1 .TH LDAP_FRIENDLY 3  "11 October 1993" "U-M LDAP LDVERSION"
2 .SH NAME
3 ldap_friendly_name, ldap_free_friendlymap \- LDAP unfriendly to friendly name mapping routine
4 .SH SYNOPSIS
5 .nf
6 .ft B
7 #include <lber.h>
8 #include <ldap.h>
9 .LP
10 .ft B
11 typedef struct friendly {
12         char *f_unfriendly;
13         char *f_friendly;
14 } FriendlyMap;
15 .LP
16 .ft B
17 char *ldap_friendly_name(filename, name, map)
18 .ft
19 char *filename;
20 char *name;
21 FriendlyMap **map;
22 .LP
23 .ft B
24 void ldap_free_friendlymap(map)
25 .ft
26 FriendlyMap **map;
27 .SH DESCRIPTION
28 This routine is used to map one set of strings to another.  Typically,
29 this is done for country names, to map from the two-letter country
30 codes to longer more readable names.  The mechanism is general enough
31 to be used with other things, though.
32 .LP
33 \fIfilename\fP is the name of a file containing the unfriendly to
34 friendly mapping, \fIname\fP is the unfriendly name to map to a friendly
35 name, and \fImap\fP is a result-parameter that should be set to NULL
36 on the first call.  It is then used to hold the mapping in core so that
37 the file need not be read on subsequent calls.
38 .LP
39 For example:
40 .LP
41 .nf
42 .ft tt
43         FriendlyMap *map = NULL;
44
45         printf( "unfriendly %s => friendly %s\\n", name,
46             ldap_friendly_name( "ETCDIR/ldapfriendly", name, &map ) );
47 .ft
48 .fi
49 .LP
50 The mapping file should contain lines like this: unfriendlyname\\tfriendlyname.
51 Lines that begin with a '#' character are comments and are ignored.
52 .LP
53 The
54 .B ldap_free_friendlymap()
55 call is used to free structures allocated by
56 .B ldap_friendly_name()
57 when no more calls to
58 .B ldap_friendly_name()
59 are to be made.
60 .SH ERRORS
61 NULL is returned by
62 .B ldap_friendly_name()
63 if there is an error opening \fIfilename\fP, or if the file has a bad
64 format, or if the \fImap\fP parameter is NULL.
65 .SH FILES
66 ETCDIR/ldapfriendly.conf
67 .SH SEE ALSO
68 .BR ldap (3)