Re: stat(1) (was Re: mergemaster(8) broken -- uses Perl

2002-06-06 Thread Sheldon Hearn



On Wed, 05 Jun 2002 23:58:14 MST, Doug Barton wrote:

> I'm currently testing a buildworld prior to importing NetBSD's stat(1)
> into the tree. Once that's done, if you have suggestions for
> improvements I'm sure that they would be interested. I'll be happy to
> work with you on adding useful bits to it in our tree as well. You can
> see what I'm importing at
> http://cvsweb.netbsd.org/bsdweb.cgi/basesrc/usr.bin/stat/

I really like the fact that you're trying to maintain NetBSD
compatibility with tools imported from NetBSD.

Ciao,
Sheldon.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: stat(1) (was Re: mergemaster(8) broken -- uses Perl

2002-06-05 Thread Doug Barton

Bakul Shah wrote:
> 
> > the trick nicely (but is too ``complicated'', and I'd still like
> > having a tool that allows userland to call stat/fstat(2):

I'm currently testing a buildworld prior to importing NetBSD's stat(1)
into the tree. Once that's done, if you have suggestions for
improvements I'm sure that they would be interested. I'll be happy to
work with you on adding useful bits to it in our tree as well. You can
see what I'm importing at
http://cvsweb.netbsd.org/bsdweb.cgi/basesrc/usr.bin/stat/

My reasons for choosing to import this version are the obvious benefits
of working closely with the NetBSD folks, as well as the fact that it
has a large number of features, compiles cleanly on our system (even
with WARNS=2), etc. 

Doug
-- 
   "We have known freedom's price. We have shown freedom's power.
  And in this great conflict, ...  we will see freedom's victory."
- George W. Bush, President of the United States
  State of the Union, January 28, 2002

 Do YOU Yahoo!?

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



stat(1) (was Re: mergemaster(8) broken -- uses Perl

2002-05-19 Thread Bakul Shah

> 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.

New options:

-a atime
-c ctime
-d dev
-g group
-i inode
-k kind (dir/file/fifo/symlnk/char/block/socket/whiteout)
-l links
-m mtime
-p permissions
-r rdev
-s size
-t all three times
-u user

-q quite (print numeric values, no syntactic sugar)
-f  fstat on file descr. 

For BSD stuff I added

-F flags
-G generation
-b blocks
-B blocksize

Also,
-L use lstat instead of stat
-n print name
-%  user specified format

 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.

Example:

$ stat -p stat
rwxr-xr-x
$ stat -p -q stat
755

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.

-- bakul

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message