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