1 1.1.2.2 gwr /* 2 1.1.2.2 gwr * Written by Gordon W. Ross <gwr (at) netbsd.org> 3 1.1.2.2 gwr * Public domain. 4 1.1.2.2 gwr */ 5 1.1.2.2 gwr 6 1.1.2.2 gwr #include <sys/localedef.h> 7 1.1.2.2 gwr #include <locale.h> 8 1.1.2.2 gwr 9 1.1.2.2 gwr /* 10 1.1.2.2 gwr * Cheap and dirty setlocale() that is just good enough to 11 1.1.2.2 gwr * satisfy references in programs like cat that do: 12 1.1.2.2 gwr * setlocale(LC_ALL, ""); 13 1.1.2.2 gwr * Offered with apologies to all non-english speakers... 14 1.1.2.2 gwr */ 15 1.1.2.2 gwr 16 1.1.2.2 gwr static char current_locale[32] = { "C" }; 17 1.1.2.2 gwr 18 1.1.2.2 gwr char * 19 1.1.2.2 gwr setlocale(category, locale) 20 1.1.2.2 gwr int category; 21 1.1.2.2 gwr const char *locale; 22 1.1.2.2 gwr { 23 1.1.2.2 gwr if (category < 0 || category >= _LC_LAST) 24 1.1.2.2 gwr return (NULL); 25 1.1.2.2 gwr 26 1.1.2.2 gwr /* No change of locale is allowed. */ 27 1.1.2.2 gwr if (locale && locale[0]) 28 1.1.2.2 gwr return(NULL); 29 1.1.2.2 gwr 30 1.1.2.2 gwr return (current_locale); 31 1.1.2.2 gwr } 32