xref: /original-bsd/lib/libc/locale/setlocale.c (revision 0bd63870)
1 /*
2  * Copyright (c) 1991 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #if defined(LIBC_SCCS) && !defined(lint)
9 static char sccsid[] = "@(#)setlocale.c	5.2 (Berkeley) 02/24/91";
10 #endif /* LIBC_SCCS and not lint */
11 
12 #include <locale.h>
13 #include <string.h>
14 
15 static char C[] = "C";
16 
17 /*
18  * The setlocale function.
19  *
20  * Sorry, for now we only accept the C locale.
21  */
22 char *
23 setlocale(category, locale)
24 	int category;
25 	const char *locale;
26 {
27 	if ((unsigned int)category >= _LC_LAST)
28 		return (NULL);
29 	if (locale == NULL)
30 		return (C);
31 	return(strcmp(locale, C) ? NULL : C);
32 }
33