typedef struct char_str {
#define CS_NORMAL 1
#define CS_ALTERNATE 2
- short c_column; /* column character is in */
+ int c_column; /* column character is in */
CSET c_set; /* character set (currently only 2) */
wchar_t c_char; /* character in question */
int c_width; /* character width */
errno = 0;
if ((ch = getwchar()) == WEOF) {
if (errno == EILSEQ) {
- warn(NULL);
+ warn(_("failed on line %d"), max_line);
ret = EXIT_FAILURE;
}
break;
nchars = l->l_line_len;
if (l->l_needs_sort) {
- static CHAR *sorted;
- static int count_size, *count, i, save, sorted_size, tot;
+ static CHAR *sorted = NULL;
+ static int count_size = 0, *count = NULL, sorted_size = 0;
+ int i, tot;
/*
* Do an O(n) sort on l->l_line by column being careful to
(unsigned)sizeof(int) * count_size);
}
memset(count, 0, sizeof(int) * l->l_max_col + 1);
- for (i = nchars, c = l->l_line; --i >= 0; c++)
+ for (i = nchars, c = l->l_line; c && --i >= 0; c++)
count[c->c_column]++;
/*
* indices into new line.
*/
for (tot = 0, i = 0; i <= l->l_max_col; i++) {
- save = count[i];
+ int save = count[i];
count[i] = tot;
tot += save;
}