Changes in uspace/lib/fmtutil/fmtutil.c [1d6dd2a:38d150e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/fmtutil/fmtutil.c
r1d6dd2a r38d150e 31 31 #include <fmtutil.h> 32 32 #include <stdlib.h> 33 #include <str.h>34 33 35 34 typedef struct { … … 39 38 } printmode_t; 40 39 41 errno_t print_wrapped_console(const char *str, align_mode_t alignment)40 int print_wrapped_console(const char *str, align_mode_t alignment) 42 41 { 43 42 console_ctrl_t *console = console_init(stdin, stdout); … … 47 46 } 48 47 sysarg_t con_rows, con_cols, con_col, con_row; 49 errno_t rc = console_get_size(console, &con_cols, &con_rows);48 int rc = console_get_size(console, &con_cols, &con_rows); 50 49 if (rc != EOK) { 51 50 return rc; … … 64 63 * 65 64 **/ 66 static errno_t print_line(wchar_t *wstr, size_t chars, bool last, void *data)65 static int print_line(wchar_t *wstr, size_t chars, bool last, void *data) 67 66 { 68 67 printmode_t *pm = (printmode_t *) data; 69 68 wchar_t old_char = wstr[chars]; 70 69 wstr[chars] = 0; 71 errno_t rc = print_aligned_w(wstr, pm->width, last, pm->alignment);70 int rc = print_aligned_w(wstr, pm->width, last, pm->alignment); 72 71 wstr[chars] = old_char; 73 72 return rc; 74 73 } 75 74 76 errno_t print_wrapped(const char *str, size_t width, align_mode_t mode)75 int print_wrapped(const char *str, size_t width, align_mode_t mode) 77 76 { 78 77 printmode_t pm; … … 84 83 return ENOMEM; 85 84 } 86 errno_t rc = wrap(wstr, width, print_line, &pm);85 int rc = wrap(wstr, width, print_line, &pm); 87 86 free(wstr); 88 87 return rc; 89 88 } 90 89 91 errno_t print_aligned_w(const wchar_t *wstr, size_t width, bool last,90 int print_aligned_w(const wchar_t *wstr, size_t width, bool last, 92 91 align_mode_t mode) 93 92 { … … 170 169 return EOK; 171 170 } 172 errno_t print_aligned(const char *str, size_t width, bool last, align_mode_t mode)171 int print_aligned(const char *str, size_t width, bool last, align_mode_t mode) 173 172 { 174 173 wchar_t *wstr = str_to_awstr(str); … … 176 175 return ENOMEM; 177 176 } 178 errno_t rc = print_aligned_w(wstr, width, last, mode);177 int rc = print_aligned_w(wstr, width, last, mode); 179 178 free(wstr); 180 179 return rc; 181 180 } 182 181 183 errno_t wrap(wchar_t *wstr, size_t width, line_consumer_fn consumer, void *data)182 int wrap(wchar_t *wstr, size_t width, line_consumer_fn consumer, void *data) 184 183 { 185 184 size_t word_start = 0;
Note:
See TracChangeset
for help on using the changeset viewer.