From syssgm@dtir.qld.gov.au  Tue Oct 13 01:56:04 1998
Received: from ren.dtir.qld.gov.au (ns.dtir.qld.gov.au [203.108.138.66])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id BAA24870
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Oct 1998 01:56:02 -0700 (PDT)
          (envelope-from syssgm@dtir.qld.gov.au)
Received: by ren.dtir.qld.gov.au; id SAA03197; Tue, 13 Oct 1998 18:55:34 +1000 (EST)
Received: from ogre.dtir.qld.gov.au(167.123.8.3) by ren.dtir.qld.gov.au via smap (3.2)
	id xma003189; Tue, 13 Oct 98 18:55:12 +1000
Received: from atlas.dtir.qld.gov.au (atlas.dtir.qld.gov.au [167.123.8.9])
	by ogre.dtir.qld.gov.au (8.8.8/8.8.7) with ESMTP id SAA12970
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Oct 1998 18:55:12 +1000 (EST)
Received: from nymph.dtir.qld.gov.au (nymph.dtir.qld.gov.au [167.123.10.10])
	by atlas.dtir.qld.gov.au (8.8.5/8.8.5) with ESMTP id SAA07669
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Oct 1998 18:55:11 +1000 (EST)
Received: (from syssgm@localhost)
	by nymph.dtir.qld.gov.au (8.8.8/8.8.7) id SAA26209;
	Tue, 13 Oct 1998 18:55:11 +1000 (EST)
	(envelope-from syssgm)
Message-Id: <199810130855.SAA26209@nymph.dtir.qld.gov.au>
Date: Tue, 13 Oct 1998 18:55:11 +1000 (EST)
From: Stephen McKay <syssgm@dtir.qld.gov.au>
Reply-To: syssgm@dtir.qld.gov.au
To: FreeBSD-gnats-submit@freebsd.org
Subject: atq(1) ignores locale
X-Send-Pr-Version: 3.2

>Number:         8300
>Category:       bin
>Synopsis:       atq(1) ignores locale time info
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 13 02:00:01 PDT 1998
>Closed-Date:    Wed Nov 25 06:09:24 PST 1998
>Last-Modified:  Wed Nov 25 06:12:09 PST 1998
>Originator:     Stephen McKay
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
none
>Environment:

Fairly recent -current.  Dual PPro 200.

>Description:

Only some parts of "at" pay attention to the locale.  In particular,
listing your queued jobs produces output in the much cursed and
completely incomprehensible US date format.  Your LANG variable
is ignored.

>How-To-Repeat:

$ at teatime oct 15
echo hello
Job 20 will be executed using /bin/sh
$ unset LANG
$ atq
Date                    Owner   Queue   Job#
16:00:00 10/15/98       root    c       20
$ LANG=en_GB.ISO_8859-1 atq
Date                    Owner   Queue   Job#
16:00:00 10/15/98       root    c       20
$

But after the patch ...

$ LANG=en_GB.ISO_8859-1 ./atq
Date                    Owner   Queue   Job#
16:00:00 15/10/98       root    c       20

Actually, I'd prefer:

Date                    Owner   Queue   Job#
1998-10-15 16:00:00     root    c       20

but that's different from just fixing a locale bug.  Maybe later.

I'll complain about the broken en_AU.ISO_8859-1 locale in a minute...

>Fix:

This patch works for me.  But do we want to just move the setlocale() call
that is already there?  Can that break anything?

I'm keen to commit this as it stands for 3.0.  Do I have approval?

Index: at.c
===================================================================
RCS file: /cvs/src/usr.bin/at/at.c,v
retrieving revision 1.13
diff -u -r1.13 at.c
--- at.c	1997/03/29 04:27:56	1.13
+++ at.c	1998/10/13 07:27:49
@@ -450,6 +450,10 @@
     time_t runtimer;
     char timestr[TIMESIZE];
     int first=1;
+    
+#ifdef __FreeBSD__
+    (void) setlocale(LC_TIME, "");
+#endif
 
     PRIV_START
 
Stephen.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mckay 
State-Changed-When: Wed Nov 25 06:09:24 PST 1998 
State-Changed-Why:  
Patch applied to -current (1.14) and -stable (1.7.2.3). 
>Unformatted:
