+2006-06-03 Martin Mares <mj@ucw.cz>
+
+ * cm.c (add_snippet): Compress spaces and avoid printing unprintable
+ characters.
+
+ * Released as 0.4.
+
2005-05-25 Martin Mares <mj@ucw.cz>
* cm.c (add_snippet): Don't forget to terminate the string. Gets rid of
}
static void
-add_snippet(char **ppos, char *term, char *add)
+add_snippet(char **ppos, char *term, unsigned char *add)
{
char *pos = *ppos;
+ int space = 1;
while (*add && pos < term)
- *pos++ = *add++;
+ {
+ if (*add <= ' ')
+ {
+ if (!space)
+ *pos++ = ' ';
+ space = 1;
+ }
+ else if (*add >= 0x7f)
+ {
+ *pos++ = '?';
+ space = 0;
+ }
+ else
+ {
+ *pos++ = *add;
+ space = 0;
+ }
+ add++;
+ }
*ppos = pos;
*pos = 0;
}
mb_pos = pos;
}
-static int
+static void
mb_seek(uns pos)
{
lseek(mb_fd, pos, SEEK_SET);