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