From owner-freebsd-current Sun May 19 12:16:25 2002 Delivered-To: freebsd-current@freebsd.org Received: from illustrious.cnchost.com (illustrious.concentric.net [207.155.252.7]) by hub.freebsd.org (Postfix) with ESMTP id 53C7337B40D; Sun, 19 May 2002 12:16:21 -0700 (PDT) Received: from bitblocks.com (adsl-209-204-185-216.sonic.net [209.204.185.216]) by illustrious.cnchost.com id PAA16371; Sun, 19 May 2002 15:16:20 -0400 (EDT) [ConcentricHost SMTP Relay 1.14] Message-ID: <200205191916.PAA16371@illustrious.cnchost.com> To: Giorgos Keramidas Cc: Alfred Perlstein , Dima Dorfman , Paul Herman , current@FreeBSD.ORG Subject: stat(1) (was Re: mergemaster(8) broken -- uses Perl In-reply-to: Your message of "Sun, 19 May 2002 14:25:59 +0300." <20020519112559.GA33290@hades.hell.gr> Date: Sun, 19 May 2002 12:16:09 -0700 From: Bakul Shah Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > 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 majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message