Home | History | Annotate | Line # | Download | only in libhack
setlocale.c revision 1.2
      1  1.2  perry /*	$NetBSD: setlocale.c,v 1.2 1998/01/09 08:03:22 perry Exp $	*/
      2  1.2  perry 
      3  1.1    gwr /*
      4  1.1    gwr  * 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.1    gwr #include <sys/localedef.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.1    gwr 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