stop = 1;
break;
default:
- if ((ch >= 32) && ( ch < 128)) {
+ if ((ch >= 32) && ( ch < 127)) {
name[l + i] = ch;
i++;
if (i == length) {
mvaddch (win->ysize + win->yoffset, win->xsize + win->xoffset, ACS_DARROW);
}
- int eol = 0;
for (i = 0; i < win->ysize; i++) {
+ unsigned char *pt = (unsigned char *)(lines[skip + i]);
for (j = 0; j < win->xsize; j++) {
- mvaddch (win->yoffset + i, win->xoffset + j, ' ');
- }
- if (!eol) {
- unsigned char *pt = (unsigned char *)(lines[skip + i]);
- if (pt != NULL) {
- for (j = 0; (j < win->xsize) && (pt[j] != '\0'); j++) {
- if (pt[j] == 128) {
- set_color (white);
- mvaddch (win->yoffset + i, win->xoffset + j, '.');
- set_color (black);
- } else {
- mvaddch (win->yoffset + i, win->xoffset + j, (char)pt[j]);
- }
- }
+ if (pt[j] == '\0') {
+ break;
+ } else if (pt[j] == 128) {
+ set_color (imagenta);
+ mvaddch (win->yoffset + i, win->xoffset + j, '.');
+ set_color (black);
} else {
- eol = 1;
+ mvaddch (win->yoffset + i, win->xoffset + j, (char)pt[j]);
}
}
+ for (; j < win->xsize; j++) {
+ mvaddch (win->yoffset + i, win->xoffset + j, ' ');
+ }
}
switch (getch ()) {
} while (blocklen > 0);
/* check size */
+ VERBOSE (DEBUG, fprintf (stderr, "length: %d\n", length));
if (length == 0) {
free (buffer);
buffer = NULL;
} else {
- int i;
- for (i = 0; i < length; i++) {
- unsigned char *pt = (unsigned char *)(buffer + i);
- if ((*pt != '\n') && ((*pt < 32) || (*pt > 127))) {
+ unsigned char *pt = (unsigned char *)buffer;
+ while (length-- > 0) {
+ if ((*pt != '\n') && ((*pt < 32) || (*pt >= 127))) {
*pt = 128;
}
+ pt++;
}
}
- VERBOSE (DEBUG, fprintf (stderr, "length: %d\n", length));
return buffer;
}
int i, j;
char *line = (char *) calloc (max + 1, sizeof (char));
for (i = j = 0; buffer[i] != '\0'; i++) {
- if (buffer[i] >= ' ') {
+ if ((unsigned char)buffer[i] >= 32) {
line[j++] = buffer[i];
}
if ((j == max) || (buffer[i] == '\n')) {
lines = (char **) realloc (lines, (n + 2) * sizeof (char *));
lines[n] = line;
lines[n + 1] = NULL;
- line = calloc (max + 1, sizeof (char));
+ line = (char *) calloc (max + 1, sizeof (char));
n++;
VERBOSE (DEBUG, fprintf (stderr, "j: %d\n", j));
j = 0;
}
if (line[0] != '\0') {
lines = (char **) realloc (lines, (n + 2) * sizeof (char *));
- lines[n++] = line;
+ lines[n] = line;
+ lines[n + 1] = NULL;
+ n++;
} else {
free (line);
}