Project

General

Profile

Bug #142 ยป t.c

This is a simple program I used to test setlocale with. - Garrett D'Amore, 2010-09-03 01:24 AM

 
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <locale.h>
4

    
5
int main(int argc, char **argv)
6
{
7
	char *ol, *nl;
8
	int i;
9

    
10
	ol = setlocale(LC_ALL, "");
11
	printf("old %s\n", ol);
12

    
13
	for (i = 1; i < argc; i += 2) {
14
		int c = atoi(argv[i]);
15
		char *ls = argv[i+1];
16
		printf("setting %d to %s: ", c, ls);
17
		nl = setlocale(c, ls);
18
		printf("%s\n", nl);
19
	}
20
	nl = setlocale(LC_ALL, NULL);
21
	printf("new = %s\n", nl);
22
#if 0
23
	for (i = 0x00; i < 0xff; i++) {
24
		if (!isprint(i))
25
			continue;
26
		printf("%x: upper %c (%x) lower %c (%x)\n",
27
			i, toupper(i), toupper(i), tolower(i), tolower(i));
28
	}
29
#endif
30
	return (0);
31
}
    (1-1/1)