coreutils /coreutils-8.17/gnulib-tests /test-mbsalign.c
1. /* Test that mbsalign works as advertised.
2. Copyright (C) 2010-2012 Free Software Foundation, Inc.
3.
19. #include <config.h>
20.
21. #include "mbsalign.h"
22. #include "macros.h"
23. #include <stdlib.h>
32. /* Test unibyte truncation. */
33. width = 4;
34. n = mbsalign ("t\tés", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
35. ASSERT (n == 4);
36.
37. /* Test center alignment. */
38. width = 4;
2. Copyright (C) 2010-2012 Free Software Foundation, Inc.
3.
19. #include <config.h>
20.
21. #include "mbsalign.h"
22. #include "macros.h"
23. #include <stdlib.h>
32. /* Test unibyte truncation. */
33. width = 4;
34. n = mbsalign ("t\tés", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
35. ASSERT (n == 4);
36.
37. /* Test center alignment. */
38. width = 4;
14 matches | 101 lines | C | Fedora Project
coreutils /coreutils-8.17/lib /mbsalign.c
18.
19. #include <config.h>
20. #include "mbsalign.h"
21.
22. #include <stdlib.h>
110.
111. size_t
112. mbsalign (const char *src, char *dest, size_t dest_size,
113. size_t *width, mbs_align_t align, int flags)
114. {
133. {
134. if (flags & MBA_UNIBYTE_FALLBACK)
135. goto mbsalign_unibyte;
136. else
137. goto mbsalign_cleanup;
19. #include <config.h>
20. #include "mbsalign.h"
21.
22. #include <stdlib.h>
110.
111. size_t
112. mbsalign (const char *src, char *dest, size_t dest_size,
113. size_t *width, mbs_align_t align, int flags)
114. {
133. {
134. if (flags & MBA_UNIBYTE_FALLBACK)
135. goto mbsalign_unibyte;
136. else
137. goto mbsalign_cleanup;
13 matches | 270 lines | C | Fedora Project
coreutils /coreutils-8.17/src /ls.c
107. #include "xstrtol.h"
108. #include "areadlink.h"
109. #include "mbsalign.h"
110.
111. /* Include <sys/capability.h> last to avoid a clash of <sys/types.h>
1059. size_t width = curr_max_width;
1060.
1061. size_t req = mbsalign (nl_langinfo (ABMON_1 + i),
1062. abmon[i], sizeof (abmon[i]),
1063. &width, MBS_ALIGN_LEFT, 0);
108. #include "areadlink.h"
109. #include "mbsalign.h"
110.
111. /* Include <sys/capability.h> last to avoid a clash of <sys/types.h>
1059. size_t width = curr_max_width;
1060.
1061. size_t req = mbsalign (nl_langinfo (ABMON_1 + i),
1062. abmon[i], sizeof (abmon[i]),
1063. &width, MBS_ALIGN_LEFT, 0);
2 matches | 4978 lines | C | Fedora Project
coreutils /coreutils-8.17/src /df.c
30. #include "fsusage.h"
31. #include "human.h"
32. #include "mbsalign.h"
33. #include "mbswidth.h"
34. #include "mountlist.h"
234. else
235. {
236. cell = ambsalign (cell, &width, alignments[field], 0);
237. /* When ambsalign fails, output unaligned data. */
238. fputs (cell ? cell : table[row][field], stdout);
239. free (cell);
31. #include "human.h"
32. #include "mbsalign.h"
33. #include "mbswidth.h"
34. #include "mountlist.h"
234. else
235. {
236. cell = ambsalign (cell, &width, alignments[field], 0);
237. /* When ambsalign fails, output unaligned data. */
238. fputs (cell ? cell : table[row][field], stdout);
239. free (cell);
3 matches | 1142 lines | C | Fedora Project

