Subject: Re: stat(1)
To: Andrew Brown <atatat@atatdot.net>
From: Robert Elz <kre@munnari.OZ.AU>
List: current-users
Date: 12/30/2001 17:34:24
    Date:        Sat, 29 Dec 2001 11:59:58 -0500
    From:        Andrew Brown <atatat@atatdot.net>
    Message-ID:  <20011229115958.C5568@noc.untraceable.net>

  | well...it's arguable.  strftime() doesn't really operate directly on a
  | time_t, it uses a struct tm.

True, but the discussion was about commands, not library functions, and
date operates on a time_t (one it gets from the kernel, usually, or -r).
That it chooses to provide its formatting by building a struct, and then
using a library routine to format that is just a design decision (a pretty
obvious one perhaps).

  | a shell routine that could dump out the contents of a symbolic link is
  | something that people sometimes ask for

Yes, rc.d/bootconf needs exactly such a tool, the parsing of ls output is
truly ugly to achieve this (more so there where it can't use awk or sed,
only sh facilities - though I guess it could use ed).

I don't have that in my stat as it is confined to being just a stat,
readlink info isn't from stat, so isn't there.

  | 	% stat -f%sM / ~/.cshrc
  | 	directory
  | 	file

I do:

  brandenburg$ stat -f %t / ~/.cshrc
  directory
  -file

The "-file" is so "%t..1s" produces "-" for regular files, not "f".   A bit
of a hack, but it means everything remains consistent.  I didn't bother
with %c support, that didn't seem useful.

  | ...and so on.  how it works is somewhat incidental.  the fact that
  | almost *everyone* finds the need for something like this is the
  | interesting bit.

Yes.

kre