"Henri Doreau" <henri.doreau () gmail com> wrote:
I've committed the socket_strerror() part with a little change
(r31677). Can you elaborate on why ANSI codes should be avoided? I
wouldn't put them everywhere but they're something quite common for
On machines where you have an ANSI-driver in the console, yes.
The Windows console doesn't have that. Running this here now
produces these codes verbatim on the console (not colour changes):
nsock pool user data [←[1m←[32mOK←[0m]
test timer operations [←[1m←[32mOK←[0m]
set standard log levels [←[1m←[32mOK←[0m]
check error log levels [←[1m←[32mOK←[0m]
simple tcp connection Socket troubles: No error
Assertion failed: sd >= 0, file engine_select.c, line 353
The assert() is also a non-portable issue with WinPcap; it doesn't
have a selectable pcap structure or something.
Back to the colours on Windows. tests_main.c could have some
#define BOLDGREEN (FOREGROUND_GREEN | FOREGROUND_INTENSITY)
/* default WinCon state */
static CONSOLE_SCREEN_BUFFER_INFO csbi;
static void init_console (void)
#define PRINT_OK() \
SetConsoleTextAttribute (stdout_hnd, (csbi.wAttributes & 0xf0) |
printf ("OK\n"); \
SetConsoleTextAttribute (stdout_hnd, csbi.wAttributes)
#define PRINT_OK() printf(TEST_OK "\n");
And use PRINT_OK() instead of printf(TEST_OK "\n").
Similar for TEST_FAILED. I could make a patch if there's an interest.