#include <locale.h>
#include <stdio.h>
#include <time.h>

static void print(const char *loc, const char *str, const wchar_t *wcs)
{
	int i;
	printf("%s:str = ", loc);
	for (i = 0; str[i]; i++)
		printf("%x ", (int)(unsigned char)str[i]);
	printf("\n");
	printf("%s:wcs = ", loc);
	for (i = 0; wcs[i]; i++)
		printf("%x ", (int)wcs[i]);
	printf("\n");
}

int main(void)
{
	char	*loc;
	char	str[100];
	wchar_t	wcs[100];
	time_t	now = time(NULL);
	struct tm	*tm = localtime(&now);

	loc = setlocale(LC_TIME, "C");
	printf("locale: %s\n", loc);
	strftime(str, 100, "%A", tm);
	wcsftime(wcs, 100, L"%A", tm);
	printf("[%s]\n", str);
	print("C", str, wcs);

	loc = setlocale(LC_TIME, "Japanese_Japan.932");
	printf("locale: %s\n", loc);
	strftime(str, 100, "%A", tm);
	wcsftime(wcs, 100, L"%A", tm);
	print("SJIS", str, wcs);

	loc = setlocale(LC_TIME, "Japanese_Japan.20932");
	printf("locale: %s\n", loc);
	strftime(str, 100, "%A", tm);
	wcsftime(wcs, 100, L"%A", tm);
	print("EUCJP", str, wcs);

	return 0;
}
