Date: Sun, 19 May 2002 12:16:09 -0700 From: Bakul Shah <bakul@bitblocks.com> To: Giorgos Keramidas <keramida@FreeBSD.ORG> Cc: Alfred Perlstein <bright@mu.org>, Dima Dorfman <dima@trit.org>, Paul Herman <pherman@frenchfries.net>, current@FreeBSD.ORG Subject: stat(1) (was Re: mergemaster(8) broken -- uses Perl Message-ID: <200205191916.PAA16371@illustrious.cnchost.com> In-Reply-To: Your message of "Sun, 19 May 2002 14:25:59 %2B0300." <20020519112559.GA33290@hades.hell.gr>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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 <fd> fstat on file descr. <fd> For BSD stuff I added -F flags -G generation -b blocks -B blocksize Also, -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. 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205191916.PAA16371>