zsh-users
 help / color / mirror / code / Atom feed
From: schaefer@z-code.com (Barton E. Schaefer)
To: Zefram <A.Main@dcs.warwick.ac.uk>
Cc: zsh-users@math.gatech.edu
Subject: Re: maintaining init files on a [t]csh influenced system
Date: Wed, 6 Sep 1995 12:00:41 -0700	[thread overview]
Message-ID: <950906120041.ZM4788@zyrcon.z-code.com> (raw)
In-Reply-To: Zefram <A.Main@dcs.warwick.ac.uk> "Re: maintaining init files on a [t]csh influenced system" (Sep  6,  7:33pm)

On Sep 6,  7:33pm, Zefram wrote:
} Subject: Re: maintaining init files on a [t]csh influenced system
}
} >On the original question, though -- there are two major syntactic barriers
} >to getting zsh to parse csh script files:
} >
} >1.  "set" commands, because they can do any of:
} >    a.  assign to multiple boolean options in a single command
} >    b.  mix assignments of option variables with string assignments
} >    c.  use spaces around the "=" sign in any string assignment
} >
} >	set noclobber history = 50 nonomatch prompt="`hostname`: "
} >
} >2.  the "$?variable" syntax for testing whether a variable is set
} >
} >You can get zsh to parse just about everything else (*) by clever use of
} >aliases and zsh functions, but I haven't figured out a workaround for
} >either of the above.
} 
} $?variable would have to be supported by zsh itself, and would conflict
} with the normal use of $?.

Yup.

} I think you could define a set function
} that would do everything required, though.  (Check if argument is an
} option and set it if so, check for separated = signs and join together
} arguments as required.  It's actually not too difficult to write.)

I suspect that if you wrote it, I could break it using something that
would be legal csh syntax.  I do agree that you can cover most of the
common cases.

Oh, I thought of a third serious syntax problem:  History syntax in
aliases.  I shouldn't have forgotten that one, it's even mentioned in
the section that I contributed to the FAQ. :-}

} >(*) "switch" statements are VERY entertaining, but possible (I think);
} >    anybody care to guess how?
} 
} Please enlighten us.

It starts out with something like:

    alias switch='cat >! /tmp/sw$$ <<\endsw ; doswitch'

And finishes up with a doswitch() function that reads the temporary file
and looks for the case ... breaksw block matching the function params.

-- 
Bart Schaefer                     Vice President, Technology, Z-Code Software
schaefer@z-code.com                  Division of NCD Software Corporation
http://www.well.com/www/barts


       reply	other threads:[~1995-09-06 19:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <28279.199509061833@stone.dcs.warwick.ac.uk>
1995-09-06 19:00 ` Barton E. Schaefer [this message]
1995-09-07  5:38   ` Dave Sainty
     [not found]     ` <z-code!Comp.VUW.AC.NZ!David.Sainty>
1995-09-07  8:17       ` Bart Schaefer
1995-09-06 13:23 Andrew Eskilsson
1995-09-06 16:16 ` Toshi Isogai
     [not found]   ` <toshi_isogai@maxtor.com>
1995-09-06 18:10     ` Barton E. Schaefer
1995-09-06 18:15       ` Zefram
1995-09-06 18:33       ` Zefram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=950906120041.ZM4788@zyrcon.z-code.com \
    --to=schaefer@z-code.com \
    --cc=A.Main@dcs.warwick.ac.uk \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).