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