/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2015 Joyent, Inc.
*/
#include <string.h>
#include <locale.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
/*
* This is designed to test strerorr and strerror_l's ability to react properly
* to being in various locales. This also serves as a regression test for
* illumos#6133.
*
* For this test, we utilize the poorly named 'zz_AA.UTF_8' locale which
* was created because it actually has a translation! It 'translates'
* the string:
*
* "No such file or directory" -> "It's a trap!"
*
* It's otherwise a boring en_US.UTF-8 locale under the hood.
*
* We explicitly want to verify the following cases:
*
* + strerror() honors the global locale before uselocale
* + strerror() honors the per-thread locale
* + strerror_l() always reflects the chosen locale
*/
static void
{
const char *r;
errno = 0;
}
static void
{
const char *r;
errno = 0;
}
int
main(void)
{
(void) uselocale(LC_GLOBAL_LOCALE);
return (0);
}