NetBSD/distrib/utils/libhack/setlocale.c

34 lines
671 B
C
Raw Normal View History

/* $NetBSD: setlocale.c,v 1.5 2010/06/08 17:12:32 tnozaki Exp $ */
1998-01-09 11:03:16 +03:00
1996-09-13 22:57:38 +04:00
/*
2003-07-26 21:06:22 +04:00
* Written by Gordon W. Ross <gwr@NetBSD.org>
1996-09-13 22:57:38 +04:00
* Public domain.
*/
#include <stdlib.h>
1996-09-13 22:57:38 +04:00
#include <locale.h>
/*
* Cheap and dirty setlocale() that is just good enough to
* satisfy references in programs like cat that do:
* setlocale(LC_ALL, "");
* Offered with apologies to all non-english speakers...
*/
static char current_locale[32] = { "C" };
char *
setlocale(category, locale)
1996-09-13 22:57:38 +04:00
int category;
const char *locale;
{
if (category < 0 || category >= _LC_LAST)
return (NULL);
/* No change of locale is allowed. */
if (locale && locale[0])
return(NULL);
return (current_locale);
}