This patch automatically removes backspaces from logs sent by the kernel. The kernel uses backspaces to show its progress during the ramdisk decompression. --- ./sysklogd/syslogd.c~ 2006-03-13 22:32:55.000000000 +0100 +++ ./sysklogd/syslogd.c 2006-03-13 22:30:35.000000000 +0100 @@ -522,7 +522,7 @@ /* This must be a #define, since when CONFIG_DEBUG and BUFFERS_GO_IN_BSS are * enabled, we otherwise get a "storage size isn't constant error. */ -static int serveConnection(char *tmpbuf, int n_read) +static int serveConnection(char *tmpbuf, int n_read, int remove_bs) { char *p = tmpbuf; @@ -547,6 +547,9 @@ } } else if (c == '\n') { *q++ = ' '; + } else if (c == '\b') { + if (q > line) + *--q = '\0'; } else if (iscntrl(c) && (c < 0177)) { *q++ = '^'; *q++ = c ^ 0100; @@ -687,7 +690,7 @@ if ((i = recv(sock_fd, tmpbuf, TMP_BUF_SZ, 0)) > 0) { tmpbuf[i] = '\0'; - serveConnection(tmpbuf, i); + serveConnection(tmpbuf, i, 0); } else if (i < 0 && errno != EINTR && errno != EAGAIN) { bb_perror_msg_and_die("UNIX socket error"); } @@ -699,7 +702,7 @@ if ((i = recv(listen_udp_fd, tmpbuf, TMP_BUF_SZ, 0)) > 0) { tmpbuf[i] = '\0'; - serveConnection(tmpbuf, i); + serveConnection(tmpbuf, i, 0); } else if (i < 0 && errno != EINTR && errno != EAGAIN) { bb_perror_msg_and_die("UDP socket error"); } @@ -737,7 +740,7 @@ memcpy(tmpbuf + msgptr - save, "kernel: ", save); serveConnection(tmpbuf + msgptr - save, - j - msgptr + save); + j - msgptr + save, 1); msgptr = ++j; } remain = msgend - msgptr; @@ -765,7 +768,7 @@ /* end of read : send last data and return */ tmpbuf[save + remain] = 0; memcpy(tmpbuf, "kernel: ", save); - serveConnection(tmpbuf, save + remain); + serveConnection(tmpbuf, save + remain, 1); break; } } /* end of while(1) */