diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index 93f17b0f4ae3..69ff8c33cbbf 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -144,14 +144,16 @@ main(int argc, char *argv[]) char buf[MAXHOSTNAMELEN], fn[MAXHOSTNAMELEN]; char *dot; - (void)setlocale(LC_ALL, ""); - use_ampm = (*nl_langinfo(T_FMT_AMPM) != '\0'); - use_comma = (*nl_langinfo(RADIXCHAR) != ','); argc = xo_parse_args(argc, argv); if (argc < 0) exit(1); + if (xo_get_style(NULL) == XO_STYLE_TEXT) { + setlocale(LC_ALL, ""); + } + use_ampm = (*nl_langinfo(T_FMT_AMPM) != '\0'); + use_comma = (*nl_langinfo(RADIXCHAR) != ','); /* Are we w(1) or uptime(1)? */ if (strcmp(basename(argv[0]), "uptime") == 0) { wcmd = 0;