> the trick nicely (but is too ``complicated'', and I'd still like
> having a tool that allows userland to call stat/fstat(2):
You are not alone; a number of stat(1) commands seemed to
have popped up over the years. My friend @ SGI told me IRIX
also has such a command. I liked its options so I modified
mine to match its options as well as kept the option to
specify output format.
-k kind (dir/file/fifo/symlnk/char/block/socket/whiteout)
-t all three times
-q quite (print numeric values, no syntactic sugar)
-f <fd> fstat on file descr. <fd>
For BSD stuff I added
-L use lstat instead of stat
-n print name
-% <fmt> user specified format
<fmt> specification as shown in my previous email, except use
%k for kind and %t for printing all three times.
By default it prints all the stat fields instead of mimicing
"ls -lTd" as before. You can specify STATFMT env. var for
a default format.
$ stat -p stat
$ stat -p -q stat
Not having used SGI's stat command I don't know what output
format it uses.
Paul Herman asks in a separate email if there is a happy
medium. I don't think so. One can use ls(1) for a more
human readable format. stat(1) is really for script use.
Even the -% format is for that (to avoid having to pull out
the ginsu knife of awk/sed/perl for common uses). About the
best I can do in 300 or so lines of code and that is already
a lot of lines for something like this.
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message