From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7189 invoked from network); 3 May 2007 05:40:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=no version=3.2.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 3 May 2007 05:40:05 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 68237 invoked from network); 3 May 2007 05:39:59 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 3 May 2007 05:39:59 -0000 Received: (qmail 16427 invoked by alias); 3 May 2007 05:39:57 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23386 Received: (qmail 16414 invoked from network); 3 May 2007 05:39:56 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 3 May 2007 05:39:56 -0000 Received: (qmail 67998 invoked from network); 3 May 2007 05:39:56 -0000 Received: from redoubt.spodhuis.org (HELO mx.spodhuis.org) (193.202.115.177) by a.mx.sunsite.dk with SMTP; 3 May 2007 05:39:52 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=first1; d=spodhuis.org; h=Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:MIME-Version:Content-Type:Content-Disposition; b=N6G6TTnMAeKH4qq27LVJHbitJB4t0RDSXGFnizmhATso1KZTmB7SuJLI/8M/k/lGzb/eRGzDyme3oUYwKweJ0H+an7ZLdHUb6UZf04lP/ZA91vfEm3DWYKiFfmft/YuL0uRsUc2cnWsOC3ERzWg6vcevioS7KT17vKq0H7j/r5c=; Received: by smtp.spodhuis.org with local id 1HjU2i-0000PS-7I; Thu, 03 May 2007 05:39:52 +0000 Date: Wed, 2 May 2007 22:39:52 -0700 From: Phil Pennock To: zsh-workers@sunsite.dk Subject: [PATCH] Proposal: stat -> zstat Message-ID: <20070503053952.GA1481@redoubt.spodhuis.org> Mail-Followup-To: zsh-workers@sunsite.dk MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Since a stat external command has become popular, perhaps it's worth zsh 4.4 migrating users towards using zstat as a builtin? Then turn off stat somewhere around zsh 6 ... *cough* Also, by having two builtins which can be independently disabled, the {...} always {...} stuff from zcalsys becomes thankfully unnecessary. I was thinking of making stat be a function wrapper, but I suspect that some people may have scripts using "command stat" vs "builtin stat". Thoughts? diff -urp zsh-head/Doc/Zsh/builtins.yo zsh-zstat/Doc/Zsh/builtins.yo --- zsh-head/Doc/Zsh/builtins.yo Fri Mar 23 10:14:05 2007 +++ zsh-zstat/Doc/Zsh/builtins.yo Wed May 2 22:30:21 2007 @@ -2014,6 +2014,7 @@ module(zprof)(zsh/zprof) module(zpty)(zsh/zpty) module(zregexparse)(zsh/zutil) module(zsocket)(zsh/net/socket) +module(zstat)(zsh/stat) module(zstyle)(zsh/zutil) module(ztcp)(zsh/net/tcp) enditem() diff -urp zsh-head/Doc/Zsh/calsys.yo zsh-zstat/Doc/Zsh/calsys.yo --- zsh-head/Doc/Zsh/calsys.yo Mon Mar 26 07:33:33 2007 +++ zsh-zstat/Doc/Zsh/calsys.yo Wed May 2 22:05:35 2007 @@ -466,8 +466,9 @@ findex(age) The function tt(age) can be autoloaded and use separately from the calendar system, although it uses the function tt(calendar_scandate) for date formatting. It requires the tt(zsh/stat) builtin, which -makes available the builtin tt(stat). This may conflict with an -external programme of the same name; if it does, the builtin may be +makes available the builtin tt(zstat). This currently still provides +the old name tt(stat) which may conflict with an +external programme of that same name; if it does, the builtin may be disabled for normal operation by including the following code in an initialization file: diff -urp zsh-head/Doc/Zsh/mod_stat.yo zsh-zstat/Doc/Zsh/mod_stat.yo --- zsh-head/Doc/Zsh/mod_stat.yo Fri Apr 7 13:07:10 2000 +++ zsh-zstat/Doc/Zsh/mod_stat.yo Wed May 2 22:29:19 2007 @@ -1,13 +1,28 @@ COMMENT(!MOD!zsh/stat A builtin command interface to the tt(stat) system call. !MOD!) -The tt(zsh/stat) module makes available one builtin command: +The tt(zsh/stat) module makes available two builtin commands which are +the same internally. startitem() findex(stat) +item(tt(stat) ...)( +This is identical to tt(zstat) but use of the name tt(stat) is deprecated. +As the years have passed, an external command named tt(stat) has appeared +with incompatible output. Zsh has renamed its tt(stat) to tt(zstat) and +is currently maintaining the old name for backwards compatibility. +When writing scripts, please use tt(zstat). One day, zsh will remove +its tt(stat) builtin; in the meantime, you can disable the tt(stat) name +whilst keeping tt(zstat) with the command: + +example(disable stat) +) + +startitem() +findex(zstat) cindex(files, listing) cindex(files, examining) -item(tt(stat) [ tt(-gnNolLtTrs) ] [ tt(-f) var(fd) ] \ +item(tt(zstat) [ tt(-gnNolLtTrs) ] [ tt(-f) var(fd) ] \ [ tt(-H) var(hash) ] [ tt(-A) var(array) ] \ [ tt(-F) var(fmt) ] [ tt(PLUS())var(element) ] [ var(file) ... ])( The command acts as a front end to the tt(stat) system call (see diff -urp zsh-head/Functions/Calendar/age zsh-zstat/Functions/Calendar/age --- zsh-head/Functions/Calendar/age Mon Dec 4 02:59:11 2006 +++ zsh-zstat/Functions/Calendar/age Wed May 2 22:17:51 2007 @@ -27,24 +27,16 @@ # any argument is passed in the first format. emulate -L zsh -integer mystat disable_stat +integer mystat zmodload -i zsh/stat -# Allow the builtin stat to be hidden. -zmodload -i zsh/parameter - -{ -if [[ $builtins[stat] != defined ]]; then - (( disable_stat = 1 )) - enable stat -fi autoload -U calendar_scandate local -a vals [[ -e $REPLY ]] || return 1 -stat -A vals +mtime $REPLY || return 1 +zstat -A vals +mtime $REPLY || return 1 if (( $# >= 1 )); then local AGEREF=$1 @@ -77,9 +69,6 @@ else mystat=1 fi -} always { -# If the builtin stat was previously disabled, disable it again. -(( disable_stat )) && disable stat } return $mystat diff -urp zsh-head/Functions/Example/zls zsh-zstat/Functions/Example/zls --- zsh-head/Functions/Example/zls Mon Apr 2 05:29:06 2001 +++ zsh-zstat/Functions/Example/zls Wed May 2 22:19:12 2007 @@ -49,7 +49,7 @@ fi for f in $* do - stat -s$L -H stat -F "%b %e %H:%M" - $f || continue + zstat -s$L -H stat -F "%b %e %H:%M" - $f || continue if [[ $opts != *d* && $stat[mode] == d* ]] then dirs=( $dirs $f ) elif [[ $opts == *l* ]] then diff -urp zsh-head/Src/Modules/stat.c zsh-zstat/Src/Modules/stat.c --- zsh-head/Src/Modules/stat.c Tue May 30 15:35:03 2006 +++ zsh-zstat/Src/Modules/stat.c Wed May 2 22:00:36 2007 @@ -620,6 +620,7 @@ bin_stat(char *name, char **args, Option } static struct builtin bintab[] = { + BUILTIN("zstat", 0, bin_stat, 0, -1, 0, NULL, NULL), BUILTIN("stat", 0, bin_stat, 0, -1, 0, NULL, NULL), }; diff -urp zsh-head/Src/Modules/stat.mdd zsh-zstat/Src/Modules/stat.mdd --- zsh-head/Src/Modules/stat.mdd Sun Nov 26 12:01:03 2000 +++ zsh-zstat/Src/Modules/stat.mdd Wed May 2 22:19:56 2007 @@ -2,6 +2,6 @@ name=zsh/stat link=dynamic load=no -autobins="stat" +autobins="stat zstat" objects="stat.o"