delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/02/01/20:25:03

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Sun, 1 Feb 2004 20:24:48 -0500 (EST)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Robert R Schneck <schneck AT math DOT berkeley DOT edu>
cc: cygwin AT cygwin DOT com
Subject: Re: ssmtp "Date:" oddity
In-Reply-To: <bvk6f6$a2a$1@sea.gmane.org>
Message-ID: <Pine.GSO.4.56.0402012004070.20927@slinky.cs.nyu.edu>
References: <Pine DOT CYG DOT 4 DOT 58 DOT 0401301353170 DOT 2536 AT vy27-1054> <bvk6f6$a2a$1 AT sea DOT gmane DOT org>
MIME-Version: 1.0

On Mon, 2 Feb 2004, Robert R Schneck wrote:

> Bradley Holdridge <Bradley DOT Holdridge AT motorola DOT com> wrote:
> > After I upgraded to the latest version of ssmtp (2.60.4-1), the messages
> > I sent with it started arriving with dates such as
> >
> > Thu, d Jan 2004 21:10:32
> >
> > The day of the month is always "d".
>
> I've just sent out a request to upload ssmtp-2.60.4-2.  Once it's
> available you'll see the announcement.
>
> Maybe someone can help me understand this.  The problem is in the
> following format string to strftime:
>
>         /* RFC822 format string borrowed from GNU shellutils date.c */
>         const char *format = "%a, %_d %b %Y %H:%M:%S %z";
>
>         now = time(NULL);
>         date = localtime((const time_t *)&now);
>         (void)strftime(d_string, ARPADATE_LENGTH, format, date);
>
> Both %_ and %z become nothing.
>
> Now, is there some system on which strftime will understand this as
> intended, or did the author foolishly fail to test his assumption that
> a format string for the "date" utility would work?
>
> (Luckily he left the old code around as well, so it was easy enough to
> fix.)
>
> Robert

Most likely the latter.  Cygwin gets its strftime implementation from
newlib, which understands neither of the two format strings above.

IIUC, "%_d" is intended to produce the day of the month preceded by a
blank if single-digit.  In newlib and all other systems I could access
this is accomplished via the "%e" strftime format string.  I couldn't even
find "%_d" until I looked at "date --help", and found out that "date" uses
the underscore ("_") to indicate space padding (although the newer GNU
versions also support "%e" for space-padded day).  It is my guess that
"%_d" is a typo and should be fixed.

"%z" is a harder case, since some systems (Darwin, Linux) do understand
it, and some (newlib, Solaris, BSD) don't.  The Linux man page lists "%z"
as a GNU extension.  I would guess newlib would be happy to support it
given a patch, since it is (to quote the Linux man page) "required to
emit RFC822-conformant dates", but it's their call.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019