From owner-cvs-all@FreeBSD.ORG Mon Dec 15 03:03:14 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5592716A4CE; Mon, 15 Dec 2003 03:03:14 -0800 (PST) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id A1F4243D2D; Mon, 15 Dec 2003 03:02:14 -0800 (PST) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id D78FC5C7A3; Mon, 15 Dec 2003 03:02:13 -0800 (PST) Date: Mon, 15 Dec 2003 03:02:13 -0800 From: Alfred Perlstein To: Alexey Dokuchaev Message-ID: <20031215110213.GB60229@elvis.mu.org> References: <200312141136.hBEBa2pD043994@grimreaper.grondar.org> <20031215083703.GB956@cirb503493.alcatel.com.au> <20031215095049.GA78800@regency.nsu.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031215095049.GA78800@regency.nsu.ru> User-Agent: Mutt/1.4.1i cc: src-committers@freebsd.org cc: Mark Murray cc: cvs-src@freebsd.org cc: Peter Jeremy cc: Dag-Erling Sm?rgrav cc: cvs-all@freebsd.org Subject: Re: cvs commit: src Makefile.inc1 X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Dec 2003 11:03:14 -0000 * Alexey Dokuchaev [031215 01:48] wrote: > On Mon, Dec 15, 2003 at 07:37:04PM +1100, Peter Jeremy wrote: > > On Sun, Dec 14, 2003 at 11:36:02AM +0000, Mark Murray wrote: > > >Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?= writes: > > >> It uses Perl directly to compute the numeric mode of a file. The > > >> version in -CURRENT uses a combination of stat(1), bc(1) and shell > > >> arithmetic which causes a syntax error in 4.x. > > >> > > >> Personally, I think it would be best if stat(1) could gain an option > > >> (-m perhaps) that makes it simply print its arguments' modes in octal. > > > > > >Does 4.x's stat(1) have the "-s" switch? If so: > > > > > >$ ( eval $(stat -s .profile) ; printf "%o %s\n" ${st_mode} ${st_mode} ) > > >100644 0100644 > > > > > >Would that be any use? > > > > Not in the absence of stat(1) :-(. As an alternative, maybe ls(1) > > could grow an option to spit out the mode in octal - assuming there > > are any spare opton letters left. The simplest solution would seem > > to be to MFC stat(1) to 4.x. The only other alternative would be a > > (messy) awk script to convert the mode letters in 'ls -l' output to > > an octal number. > > Frankly, adding an option to ls(1) or writing ls(1) -l/awk(1) combo > takes my vote, rather than adding yet another foo(1) utility to the > base; especially provided that its functionality isn't strictly > orthogonal. > > Just my $.02. kekekekeke #!/bin/sh # Copyright (c) 2003 Research Engineering Development, Inc. # Author: Alfred Perlstein # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. file=$1 val=`ls -ld "$1"| sed \ -e 's/ .*//' \ -e 's/^.//' \ -e 's/^\(..\)s\(......\)/\11\2 + 100000000000 /' \ -e 's/^\(.....\)s\(...\)/\11\2 + 010000000000 /' \ -e 's/^\(........\)t/\11 + 001000000000 /' \ -e 's/[a-z]/1/g' \ -e 's/-/0/g'` printf "ibase=2\nobase=8\n$val\nquit\n" | bc