Add fake support for locale="" (#546)

This commit is contained in:
Gavin Hayes 2022-08-18 18:51:23 -04:00 committed by GitHub
parent 6c3048821c
commit 27416e7dd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 2 deletions

View file

@ -17,16 +17,18 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/intrin/safemacros.internal.h"
#include "libc/str/str.h"
#include "libc/str/locale.h"
#include "libc/str/str.h"
/**
* Sets program locale.
*
* Cosmopolitan only supports the C or POSIX locale.
*
* "You can have any locale you want as long as it's C." -- Henry Ford
*/
char *setlocale(int category, const char *locale) {
if (!locale) return "C";
if (!locale || (*locale == '\0')) return "C";
if (!strcmp(locale, "C") || !strcmp(locale, "POSIX")) {
return locale;
} else {