From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9291 invoked from network); 20 Feb 2002 09:33:10 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 20 Feb 2002 09:33:10 -0000 Received: (qmail 23603 invoked by alias); 20 Feb 2002 09:33:00 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16676 Received: (qmail 23589 invoked from network); 20 Feb 2002 09:32:59 -0000 Message-ID: <20020220093218.17365.qmail@web9303.mail.yahoo.com> Date: Wed, 20 Feb 2002 09:32:18 +0000 (GMT) From: =?iso-8859-1?q?Oliver=20Kiddle?= Subject: Re: PATCH: dirs builtin To: Bart Schaefer , zsh-workers@sunsite.dk In-Reply-To: <1020213170842.ZM20985@candle.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Bart wrote: > On Feb 13, 9:36am, Oliver Kiddle wrote: > } > } I've not implemented -l which would expand tilde substitutions - > } existing code for tilde expansions is mixed in with other expansions > so > } I'd have to either duplicate or pull apart existing code. > > The dirstack entries are already stored expanded. All you need to do > is > pass a flag through printdirstack() to fprintdir() to tell it to skip > the > finddir() call and just print the directory. Thanks, I should have thought about that. This patch goes on top of the previous one. Oliver --- Src/builtin.c Sat Feb 2 16:29:08 2002 +++ Src/builtin.c Tue Feb 19 21:57:46 2002 @@ -51,7 +51,7 @@ BUILTIN("chdir", 0, bin_cd, 0, 2, BIN_CD, NULL, NULL), BUILTIN("continue", BINF_PSPECIAL, bin_break, 0, 1, BIN_CONTINUE, NULL, NULL), BUILTIN("declare", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "AEFHLRTUZafghilrtux", NULL), - BUILTIN("dirs", 0, bin_dirs, 0, -1, 0, "cpv", NULL), + BUILTIN("dirs", 0, bin_dirs, 0, -1, 0, "clpv", NULL), BUILTIN("disable", 0, bin_enable, 0, -1, BIN_DISABLE, "afmr", NULL), BUILTIN("disown", 0, bin_fg, 0, -1, BIN_DISOWN, NULL, NULL), BUILTIN("echo", BINF_PRINTOPTS | BINF_ECHOPTS, bin_print, 0, -1, BIN_ECHO, "neE", "-"), @@ -623,10 +623,16 @@ fmt = "\n"; else fmt = " "; - fprintdir(pwd, stdout); + if (ops['l']) + fputs(pwd, stdout); + else + fprintdir(pwd, stdout); for (node = firstnode(dirstack); node; incnode(node)) { printf(fmt, pos++); - fprintdir(getdata(node), stdout); + if (ops['l']) + fputs(getdata(node), stdout); + else + fprintdir(getdata(node), stdout); } unqueue_signals(); putchar('\n'); --- Completion/Zsh/Command/_dirs Tue Feb 19 22:36:24 2002 +++ Completion/Zsh/Command/_dirs Tue Feb 19 22:38:10 2002 @@ -2,6 +2,7 @@ _arguments -s \ '(-)-c[clear the directory stack]' \ + '(* -c)-l[display directory names in full]' \ '(* -c)-v[display numbered list of directory stack]' \ '(* -c)-p[display directory entries on per line]' \ '(-)*:directory:_directories' --- Doc/Zsh/builtins.yo Tue Feb 19 22:42:08 2002 +++ Doc/Zsh/builtins.yo Tue Feb 19 22:45:27 2002 @@ -201,7 +201,7 @@ findex(dirs) cindex(directory stack, printing) xitem(tt(dirs) [ tt(-c) ] [ var(arg) ... ]) -item(tt(dirs) [ tt(-pv) ])( +item(tt(dirs) [ tt(-lpv) ])( With no arguments, print the contents of the directory stack. Directories are added to this stack with the tt(pushd) command, and removed with the tt(cd) or tt(popd) commands. @@ -212,6 +212,9 @@ startitem() item(tt(-c))( clear the directory stack. +) +item(tt(-l))( +print directory names in full instead of using of using tt(~) expressions. ) item(tt(-p))( print directory entries one per line. __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com