Mercurial > hg > octave-jordi > gnulib-hg
annotate lib/xstriconveh.h @ 18029:e4a13d95b503
mgetgroups: port to strict OS X
* doc/glibc-functions/getgrouplist.texi (getgrouplist):
Document the getgrouplist problem.
* lib/mgetgroups.c (getgrouplist_gids) [HAVE_GETGROUPLIST]:
New macro.
(mgetgroups): Use it.
* m4/mgetgroups.m4 (gl_MGETGROUPS):
Check for OS X signature for getgrouplist.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sun, 28 Jun 2015 23:43:35 -0700 |
parents | ab58d4870664 |
children |
rev | line source |
---|---|
11913 | 1 /* Charset conversion with out-of-memory checking. |
17848 | 2 Copyright (C) 2001-2007, 2009-2015 Free Software Foundation, Inc. |
11913 | 3 Written by Bruno Haible and Simon Josefsson. |
4 | |
5 This program is free software: you can redistribute it and/or modify | |
6 it under the terms of the GNU General Public License as published by | |
7 the Free Software Foundation; either version 3 of the License, or | |
8 (at your option) any later version. | |
9 | |
10 This program is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 GNU General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU General Public License | |
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
17 | |
18 #ifndef _XSTRICONVEH_H | |
19 #define _XSTRICONVEH_H | |
20 | |
21 #include <stddef.h> | |
22 | |
23 /* Get the 'enum iconv_ilseq_handler' and iconveh_t types, and the | |
24 iconveh_open, iconveh_close declarations. */ | |
25 #include "striconveh.h" | |
26 | |
27 | |
28 #ifdef __cplusplus | |
29 extern "C" { | |
30 #endif | |
31 | |
32 | |
33 #if HAVE_ICONV | |
34 | |
35 /* Convert an entire string from one encoding to another, using iconv. | |
36 The original string is at [SRC,...,SRC+SRCLEN-1]. | |
37 CD points to the conversion descriptor from FROMCODE to TOCODE, created by | |
38 the function iconveh_open(). | |
39 If OFFSETS is not NULL, it should point to an array of SRCLEN integers; this | |
40 array is filled with offsets into the result, i.e. the character starting | |
41 at SRC[i] corresponds to the character starting at (*RESULTP)[OFFSETS[i]], | |
42 and other offsets are set to (size_t)(-1). | |
43 *RESULTP and *LENGTH should initially be a scratch buffer and its size, | |
44 or *RESULTP can initially be NULL. | |
45 May erase the contents of the memory at *RESULTP. | |
46 Upon memory allocation failure, report the error and exit. | |
47 Return value: 0 if successful, otherwise -1 and errno set. | |
48 If successful: The resulting string is stored in *RESULTP and its length | |
49 in *LENGTHP. *RESULTP is set to a freshly allocated memory block, or is | |
50 unchanged if no dynamic memory allocation was necessary. */ | |
51 extern int | |
52 xmem_cd_iconveh (const char *src, size_t srclen, | |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11913
diff
changeset
|
53 const iconveh_t *cd, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11913
diff
changeset
|
54 enum iconv_ilseq_handler handler, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11913
diff
changeset
|
55 size_t *offsets, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11913
diff
changeset
|
56 char **resultp, size_t *lengthp); |
11913 | 57 |
58 /* Convert an entire string from one encoding to another, using iconv. | |
59 The original string is the NUL-terminated string starting at SRC. | |
60 CD points to the conversion descriptor from FROMCODE to TOCODE, created by | |
61 the function iconveh_open(). | |
62 Both the "from" and the "to" encoding must use a single NUL byte at the end | |
63 of the string (i.e. not UCS-2, UCS-4, UTF-16, UTF-32). | |
64 Allocate a malloced memory block for the result. | |
65 Upon memory allocation failure, report the error and exit. | |
66 Return value: the freshly allocated resulting NUL-terminated string if | |
67 successful, otherwise NULL and errno set. */ | |
68 extern char * | |
69 xstr_cd_iconveh (const char *src, | |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11913
diff
changeset
|
70 const iconveh_t *cd, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11913
diff
changeset
|
71 enum iconv_ilseq_handler handler); |
11913 | 72 |
73 #endif | |
74 | |
75 /* Convert an entire string from one encoding to another, using iconv. | |
76 The original string is at [SRC,...,SRC+SRCLEN-1]. | |
77 If OFFSETS is not NULL, it should point to an array of SRCLEN integers; this | |
78 array is filled with offsets into the result, i.e. the character starting | |
79 at SRC[i] corresponds to the character starting at (*RESULTP)[OFFSETS[i]], | |
80 and other offsets are set to (size_t)(-1). | |
81 *RESULTP and *LENGTH should initially be a scratch buffer and its size, | |
82 or *RESULTP can initially be NULL. | |
83 May erase the contents of the memory at *RESULTP. | |
84 Upon memory allocation failure, report the error and exit. | |
85 Return value: 0 if successful, otherwise -1 and errno set. | |
86 If successful: The resulting string is stored in *RESULTP and its length | |
87 in *LENGTHP. *RESULTP is set to a freshly allocated memory block, or is | |
88 unchanged if no dynamic memory allocation was necessary. */ | |
89 extern int | |
90 xmem_iconveh (const char *src, size_t srclen, | |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11913
diff
changeset
|
91 const char *from_codeset, const char *to_codeset, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11913
diff
changeset
|
92 enum iconv_ilseq_handler handler, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11913
diff
changeset
|
93 size_t *offsets, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11913
diff
changeset
|
94 char **resultp, size_t *lengthp); |
11913 | 95 |
96 /* Convert an entire string from one encoding to another, using iconv. | |
97 The original string is the NUL-terminated string starting at SRC. | |
98 Both the "from" and the "to" encoding must use a single NUL byte at the | |
99 end of the string (i.e. not UCS-2, UCS-4, UTF-16, UTF-32). | |
100 Allocate a malloced memory block for the result. | |
101 Upon memory allocation failure, report the error and exit. | |
102 Return value: the freshly allocated resulting NUL-terminated string if | |
103 successful, otherwise NULL and errno set. */ | |
104 extern char * | |
105 xstr_iconveh (const char *src, | |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11913
diff
changeset
|
106 const char *from_codeset, const char *to_codeset, |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11913
diff
changeset
|
107 enum iconv_ilseq_handler handler); |
11913 | 108 |
109 | |
110 #ifdef __cplusplus | |
111 } | |
112 #endif | |
113 | |
114 | |
115 #endif /* _XSTRICONVEH_H */ |