From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18363 invoked from network); 11 Sep 1997 16:58:27 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 11 Sep 1997 16:58:27 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id MAA12367; Thu, 11 Sep 1997 12:53:39 -0400 (EDT) Resent-Date: Thu, 11 Sep 1997 12:53:39 -0400 (EDT) From: "Bart Schaefer" Message-Id: <970911095346.ZM6209@candle.brasslantern.com> Date: Thu, 11 Sep 1997 09:53:46 -0700 X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-workers@math.gatech.edu Subject: Is anybody maintaining c2z and lete2ctl? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"sQQpN.0.713.J826q"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3484 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu I noticed they haven't changed for quite some time (at least, not in the zsh 3.0.x sources, I haven't checked 3.1.x). Here are a batch of tweaks to the 3.0.4 c2z: * Fix the usage comment (can't give both -l and -i, must use one or the other) * Optionally take the name of a file to convert (instead of always converting .cshrc and optionally also .login) * Use $ZSH_NAME in preference to $VERSION to detect zsh (hopefully nobody exports ZSH_NAME and then runs `sh') * Change $cwd to $PWD in aliases converted to functions * Delete assignment to PWD from the environment * Fix handling of tcsh `correct' variable (what was `setopt autocorrect' supposed to do?) * Upcase all `prompt' variables (zsh maps prompt->PROMPT but not prompt2->PROMPT2 et. al.) * Change `!' to `%h' in PROMPT (old csh history number references) There are probably other tcsh-isms that could be incorporated. Index: Misc/c2z --- c2z 1997/06/27 16:55:18 1.1.1.1 +++ c2z 1997/09/11 16:40:18 @@ -20,7 +20,7 @@ # procedures. # # usage: -# c2z [-i] [-l] +# c2z [-i | -l | filename] # # You can use this script in your .zshrc or .zlogin files to load your # regular csh environment into zsh; for example, in .zlogin: @@ -39,27 +39,30 @@ # If we're zsh, we can run "- csh" to get the complete environment. # MINUS="" -LOGIN="" +LOADFILE="" INTERACT="" -case "$VERSION" in +CSH=csh +case "$ZSH_NAME$ZSH_VERSION$VERSION" in zsh*) case $1 in -l*) MINUS="-" ;; -i*) INTERACT="-i" ;; + *) LOADFILE="source $1" CSH="csh -f";; esac if [[ -o INTERACTIVE ]]; then INTERACT="-i"; fi setopt nobanghist ;; *) case $1 in - -l*) LOGIN="source ~/.login" ;; + -l*) LOADFILE="source ~/.login" ;; -i*) INTERACT="-i" ;; + *) LOADFILE="source $1" CSH="csh -f";; esac ;; esac -( eval $MINUS csh $INTERACT ) <&1 >/dev/null -$LOGIN +( eval $MINUS $CSH $INTERACT ) <&1 >/dev/null +$LOADFILE alias >! /tmp/cz$$.a setenv >! /tmp/cz$$.e set >! /tmp/cz$$.v @@ -79,6 +82,7 @@ -e 's/^\([^'"$T"']*\)'"$T"'\(.*\)$/alias -- \1='"'\2'/" \ /tmp/cz$$.3 sed -e 's/![:#]*/$/g' \ + -e 's/\$cwd/$PWD/' \ -e 's/^\([^'"$T"']*\)'"$T"'\(.*\)$/\1 () { \2 }/' \ /tmp/cz$$.2 @@ -87,6 +91,7 @@ # Would be nice to deal with embedded newlines, e.g. in TERMCAP, but ... sed -e '/^SHLVL/d' \ + -e '/^PWD/d' \ -e "s/'/'"\\\\"''"/g \ -e "s/^\([A-Za-z0-9_]*=\)/export \1'/" \ -e "s/$/'/" @@ -101,16 +106,19 @@ s/$/'"'/"' }' | sed -e '/^argv=/d' -e '/^cwd=/d' -e '/^filec=/d' -e '/^status=/d' \ + -e '/^autolist=/s/.*/setopt autolist/' \ + -e '/^correct=all/s//setopt correctall/' \ + -e '/^correct=/s//setopt correct/' \ -e '/^histchars=/s//HISTCHARS=/' \ -e '/^history=/s//HISTSIZE=/' \ -e '/^home=/s//HOME=/' \ -e '/^ignoreeof=/s/.*/setopt ignoreeof/' \ -e '/^noclobber=/s/.*/setopt noclobber/' \ -e '/^notify=/d' \ + -e '/^prompt=/s/!/%h/' \ + -e 's/^prompt/PROMPT/' \ -e '/^showdots=/s/.*/setopt globdots/' \ - -e '/^savehist=/s//HISTFILE=\~\/.zhistory SAVEHIST=/' \ - -e '/^autolist=/s/.*/setopt autolist/' \ - -e '/^correct=[cmd]*/s//setopt autocorrect/' \ + -e '/^savehist=/s//HISTFILE=\~\/.zhistory SAVEHIST=/' \ -e '/^who=/s//WATCHFMT=/' -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com