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