t/test.pl: Add option to runperl to suppress STDERR
Emulate POSIX locale setting on Windows

Locale initialization and setting on Windows haven't been as
described in perllocale for setting locales to "".  This is because that
tells Windows to use the system default locale, as set through the
Control Panel, but on POSIX systems, it means to look at various
environment variables.

This commit creates a wrapper for setlocale, used only on Windows, that
looks for the appropriate environment variables when called with a ""
input locale.  If none are found, it continues to use the system default
locale.
locale.c: Add, move some comments, and a declaration

This adds some more comments at the beginning of a function concerning
its API, and moves them to before any declarations.

It also moves the declaration for 'done' to the block of other
declarations, and adds a PERL_UNUSED_VAR call if the code that uses it
is #ifdef'd out.  Previously it was too easy to not notice the
declaration separate from the others, and to insert code between the
two, which would not compile under C89, but only on Ultrix machines.
Improve fallback during locale initialization

If Perl encounters a problem during startup trying to initialize the
locales from the environment it has immediately reverted to the "C"
locale.

This commit generalizes that so it tries each of the applicable
environment variables in order of priority until it works, or it gives
up and uses the "C" locale.  For example, if LC_ALL is set to something
that is invalid, but LANG is valid, LANG will be used.  This was
motivated by trying to get the Windows system default locale used in
preference to "C" if all else fails.
locale.c: White-space, useless brace removal only

This takes one piece of code that is needlessly enclosed in braces and
removes the braces, outdenting and reflowing the comments.

Otherwise, it changes to correct indentation for the addition and
removal of braces by the previous commit.
Initialize LC_MESSAGES at start-up

The code did not explicitly iinitialize LC_MESSAGES at startup, unlike
most of the other standard categories; I don't know why.

This is only an issue for those few platforms without LC_ALL, as that is
initialized, and includes LC_MESSAGES.  This commit extends the proper
initialization to those other platforms.
Make sure LC_MONETARY is initialized

This is only an issue for those few platforms without LC_ALL, as that
is initialized, and includes LC_MONETARY.  This commit extends the
proper initialization to those other platforms.  Perl doesn't use
LC_MONETARY itself, but it should be properly initialized for modules
that do.
t/run/locale.t: Fix SKIP end position

On the platforms where this skip gets engaged, it would have skipped too
much