1 <!-- Creator : groff version 1.18.1 -->
4 <meta name="generator" content="groff -Thtml, see www.gnu.org">
5 <meta name="Content-Style" content="text/css">
6 <title>BINDTEXTDOMAIN</title>
10 <h1 align=center>BINDTEXTDOMAIN</h1>
11 <a href="#NAME">NAME</a><br>
12 <a href="#SYNOPSIS">SYNOPSIS</a><br>
13 <a href="#DESCRIPTION">DESCRIPTION</a><br>
14 <a href="#RETURN VALUE">RETURN VALUE</a><br>
15 <a href="#ERRORS">ERRORS</a><br>
16 <a href="#BUGS">BUGS</a><br>
17 <a href="#SEE ALSO">SEE ALSO</a><br>
23 <table width="100%" border=0 rules="none" frame="void"
24 cols="2" cellspacing="0" cellpadding="0">
25 <tr valign="top" align="left">
28 <p>bindtextdomain − set directory containing message
32 <a name="SYNOPSIS"></a>
35 <table width="100%" border=0 rules="none" frame="void"
36 cols="2" cellspacing="0" cellpadding="0">
37 <tr valign="top" align="left">
40 <pre><b>#include <libintl.h>
42 char * bindtextdomain (const char *</b> <i>domainname</i><b>, const char *</b> <i>dirname</i><b>);
46 <a name="DESCRIPTION"></a>
50 <table width="100%" border=0 rules="none" frame="void"
51 cols="2" cellspacing="0" cellpadding="0">
52 <tr valign="top" align="left">
55 <p>The <b>bindtextdomain</b> function sets the base
56 directory of the hierarchy containing message catalogs for a
57 given message domain.</p>
59 <p>A message domain is a set of translatable <i>msgid</i>
60 messages. Usually, every software package has its own
61 message domain. The need for calling <b>bindtextdomain</b>
62 arises because packages are not always installed with the
63 same prefix as the <libintl.h> header and the
64 libc/libintl libraries.</p>
66 <p>Message catalogs will be expected at the pathnames
67 <i>dirname</i>/<i>locale</i>/<i>category</i>/<i>domainname</i>.mo,
68 where <i>locale</i> is a locale name and <i>category</i> is
69 a locale facet such as <b>LC_MESSAGES</b>.</p>
71 <p><i>domainname</i> must be a non-empty string.</p>
73 <p>If <i>dirname</i> is not NULL, the base directory for
74 message catalogs belonging to domain <i>domainname</i> is
75 set to <i>dirname</i>. The function makes copies of the
76 argument strings as needed. If the program wishes to call
77 the <b>chdir</b> function, it is important that
78 <i>dirname</i> be an absolute pathname; otherwise it cannot
79 be guaranteed that the message catalogs will be found.</p>
81 <p>If <i>dirname</i> is NULL, the function returns the
82 previously set base directory for domain
83 <i>domainname</i>.</p>
86 <a name="RETURN VALUE"></a>
89 <table width="100%" border=0 rules="none" frame="void"
90 cols="2" cellspacing="0" cellpadding="0">
91 <tr valign="top" align="left">
94 <p>If successful, the <b>bindtextdomain</b> function returns
95 the current base directory for domain <i>domainname</i>,
96 after possibly changing it. The resulting string is valid
97 until the next <b>bindtextdomain</b> call for the same
98 <i>domainname</i> and must not be modified or freed. If a
99 memory allocation failure occurs, it sets <b>errno</b> to
100 <b>ENOMEM</b> and returns NULL.</p>
103 <a name="ERRORS"></a>
106 <table width="100%" border=0 rules="none" frame="void"
107 cols="2" cellspacing="0" cellpadding="0">
108 <tr valign="top" align="left">
109 <td width="10%"></td>
111 <p>The following error can occur, among others:</p>
115 <table width="100%" border=0 rules="none" frame="void"
116 cols="5" cellspacing="0" cellpadding="0">
117 <tr valign="top" align="left">
118 <td width="11%"></td>
123 <td width="13%"></td>
126 <p>Not enough memory available.</p>
134 <table width="100%" border=0 rules="none" frame="void"
135 cols="2" cellspacing="0" cellpadding="0">
136 <tr valign="top" align="left">
137 <td width="10%"></td>
139 <p>The return type ought to be <b>const char *</b>, but is
140 <b>char *</b> to avoid warnings in C code predating ANSI
144 <a name="SEE ALSO"></a>
147 <table width="100%" border=0 rules="none" frame="void"
148 cols="2" cellspacing="0" cellpadding="0">
149 <tr valign="top" align="left">
150 <td width="10%"></td>
152 <p><b>gettext</b>(3), <b>dgettext</b>(3),
153 <b>dcgettext</b>(3), <b>ngettext</b>(3),
154 <b>dngettext</b>(3), <b>dcngettext</b>(3),
155 <b>textdomain</b>(3), <b>realpath</b>(3)</p>