maint: adjust the URL that will appear in the generated announcement
[coreutils/ericb.git] / gl / lib / mbsalign.h
blobde5d767fa7d44e1471a94d166041a4023140e0a4
1 /* Align/Truncate a string in a given screen width
2 Copyright (C) 2009-2011 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 #include <stddef.h>
19 typedef enum { MBS_ALIGN_LEFT, MBS_ALIGN_RIGHT, MBS_ALIGN_CENTER } mbs_align_t;
21 enum {
22 /* Use unibyte mode for invalid multibyte strings
23 or when heap memory is exhausted. */
24 MBA_UNIBYTE_FALLBACK = 0x0001
26 #if 0 /* Other possible options. */
27 /* Skip invalid multibyte chars rather than failing */
28 MBA_IGNORE_INVALID = 0x0002,
30 /* Align multibyte strings using "figure space" (\u2007) */
31 MBA_USE_FIGURE_SPACE = 0x0004,
33 /* Don't add any padding */
34 MBA_TRUNCATE_ONLY = 0x0008,
36 /* Don't truncate */
37 MBA_PAD_ONLY = 0x0010,
38 #endif
41 size_t
42 mbsalign (const char *src, char *dest, size_t dest_size,
43 size_t *width, mbs_align_t align, int flags);
45 char *
46 ambsalign (const char *src, size_t *width, mbs_align_t align, int flags);