+2008-01-16 Martin Mares <mj@ucw.cz>
+
+ * Non-ASCII characters are displayed properly in UTF-8 locale.
+ Unfortunately, this needs linking checkmail with libncursesw,
+ because plain libncurses chokes on multi-byte characters whose
+ parts do not look printable. This mode is now enabled by default,
+ tweak the Makefile if you do not have libncursesw.
+
2007-06-25 Martin Mares <mj@ucw.cz>
* Non-ASCII characters encoded as per RFC 2047 are now deciphered
+# Define if you want support for wide characters (needs libncursesw)
+CONFIG_WIDE_CURSES=1
+
#DEBUG=-ggdb
CFLAGS=-O2 -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Winline $(DEBUG) -std=gnu99 -DVERSION=$(VERSION) -DYEAR=$(YEAR)
+
+ifdef CONFIG_WIDE_CURSES
+LDFLAGS=-lncursesw
+CFLAGS+=-DCONFIG_WIDE_CURSES=1
+else
LDFLAGS=-lncurses
+endif
-VERSION=1.0
-YEAR=2007
+VERSION=1.1
+YEAR=2008
all: cm
Checkmail @VERSION@
- (c) 2005--2007 Martin Mares <mj@ucw.cz>
+ (c) 2005--2008 Martin Mares <mj@ucw.cz>
================================================================================
/*
* Incoming Mail Checker
*
- * (c) 2005--2007 Martin Mares <mj@ucw.cz>
+ * (c) 2005--2008 Martin Mares <mj@ucw.cz>
*/
+#define _GNU_SOURCE
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <pwd.h>
#include <time.h>
+
+#ifdef CONFIG_WIDE_CURSES
+#include <ncursesw/ncurses.h>
+#else
#include <curses.h>
+#endif
#include "util.h"
#include "clists.h"
getyx(stdscr, yy, xx);
int remains = COLS-1-xx;
if (remains > 2)
- printw("%-.*s", remains, b->snippet);
+ {
+#ifdef CONFIG_WIDE_CURSES
+ size_t len = strlen(b->snippet)+1;
+ wchar_t snip[len];
+ mbstowcs(snip, b->snippet, len);
+ addnwstr(snip, remains);
+#else
+ printw("%-.*s", remains, b->snippet);
+#endif
+ }
}
}
}