/* Always output the locale in debug mode, since this
is such a common source of confusion. */
+
+ /* OpenBSD can only set some categories with LC_ALL above,
+ so set LC_COLLATE explicitly to flag errors. */
+ if (locale_ok)
+ locale_ok = !! setlocale (LC_COLLATE, "");
+ if (! locale_ok)
+ error (0, 0, "%s", _("failed to set locale"));
if (hard_LC_COLLATE)
error (0, 0, _("using %s sorting rules"),
quote (setlocale (LC_COLLATE, NULL)));
else
- {
- /* OpenBSD can only set some categories with LC_ALL above,
- so set LC_COLLATE explicitly to flag errors. */
- if (locale_ok)
- locale_ok = !! setlocale (LC_COLLATE, "");
- error (0, 0, "%s%s", locale_ok ? "" : _("failed to set locale; "),
- _("using simple byte comparison"));
- }
+ error (0, 0, "%s", _("using simple byte comparison"));
+
key_warnings (&gkey, gkey_only);
}
17
sort: using simple byte comparison
18
-sort: failed to set locale; using simple byte comparison
+sort: failed to set locale
+sort: using simple byte comparison
EOF
echo 1 >> out
echo 17 >> out
sort -rM -k1,1 --debug /dev/null 2>>out #no warning
echo 18 >> out
-LC_ALL=missing sort --debug /dev/null 2>>out
+LC_ALL=missing sort --debug /dev/null 2>>out.t
+# musl libc accepts "missing" and implicitly uses UTF8,
+# so adjust the expected message accordingly.
+sed 's/using .*missing.* sorting rules/using simple byte comparison/' \
+ out.t >>out
compare exp out || fail=1