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