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