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