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