[comp.sys.amiga] Grow your own VI

peter@sugar.uu.net (Peter da Silva) (08/10/88)

I'm sure you all know whereof VI originated... there was this little editor
named ED. ED was a surprisingly powerful editor, and is still the best line
editor around. These crazy guys at Berkeley added steroids and before you knew
what was going on, there was VI.

Well, it seems that there's this group of loonies out called the Software Tools
Group. They have this wonderful idea that the UNIX tools are GOOD THINGS in and
of themselves, and that other operating systems would benefit from having them
around. Their bible is a book called Software Tools, by Kernighan and Plauger.
In Software Tools is the complete source to a large subset of ED, including the
regular expression code. It's in Fortran, but Pascal and 'C' code for it also
exists.

Perhaps this would be prime time for someone to take it and add steroids. This
would produce a *real* public domain VI...

For your edification, the copyright notice from my copy of "ED" in 'C':

/*
 * Copyright 1987 Brian Beattie Rights Reserved.
 *
 * Permission to copy and/or distribute granted under the
 * following conditions:
 *
 * 1). No charge may be made other than resonable charges
 *      for reproduction.
 *
 * 2). This notice must remain intact.
 *
 * 3). No further restrictions may be added.
 *
 */

I'm not up to doing this job... it's going to be a big one, no doubt about it,
and I've got enough on my plate right now... professionally, as a hobbyist,
and personally. I'll mail anyone who wants to give it a try a copy, though...
-- 
		Peter da Silva  `-_-'  peter@sugar.uu.net
		 Have you hugged  U  your wolf today?

lishka@uwslh.UUCP (Fish-Guts) (08/15/88)

In article <8233@watdragon.waterloo.edu> mwjones@lion.waterloo.edu (Morgan Jones) writes:
>In article <2030100@hpcilzb.HP.COM> daves@hpcilzb.HP.COM (Dave Scroggins) writes:
>>I always thought the progression went ED -> EX -> VI.
>
>EX and VI are the same editor.  Ed may be as well.  They're just different
>links to the same file.

     Yup.  In fact, vi/ex/view/edit/e actually has five names, but all
are the same program.  Check the links, and the Makefile in
/usr/src/ucb/ex.  What is *really* gross (IMHO) is that the way the
same program funtions as three different ones (according to our local
Unix expert) is by checking to see argv[0] to see what name the user
invoked the program as.  Then the program goes into one of its modes:
vi mode, ex mode, view mode, etc.  Pretty sneaky. 

     BTW, "ed" is a different program from vi/ex/view.

>Morgan Jones					mwjones@lily.waterloo.edu

					-Chris
-- 
Christopher Lishka                 ...!{rutgers|ucbvax|...}!uwvax!uwslh!lishka
Wisconsin State Lab of Hygiene                   lishka%uwslh.uucp@cs.wisc.edu
Immunology Section  (608)262-1617                            lishka@uwslh.uucp
				     ----
"...Just because someone is shy and gets straight A's does not mean they won't
put wads of gum in your arm pits."
                         - Lynda Barry, "Ernie Pook's Commeek: Gum of Mystery"

ericb@athertn.Atherton.COM (Eric Black) (08/15/88)

In article <8233@watdragon.waterloo.edu> mwjones@lion.waterloo.edu (Morgan Jones) writes:
>In article <2030100@hpcilzb.HP.COM> daves@hpcilzb.HP.COM (Dave Scroggins) writes:
>>I always thought the progression went ED -> EX -> VI.
>
>EX and VI are the same editor.  Ed may be as well.  They're just different
>links to the same file.
>

Nowadays EX and VI are combined into the same executable file, and are
just invoked by different names.  Once in either, you can switch to
the other.

However, they really are two different editor programs which were combined
into one executable.  They share some code, but not as much as you think.

Dave is right about the historical progression.  However, VI did not
spring forth from EX as we know it today.  What we see as VI and EX
are both descendents of a common ancestor version of EX, which was
itself an overgrown hacked-up ED.

-- 
Eric Black	"Garbage in, Gospel out"
Atherton Technology, 1333 Bordeaux Dr., Sunnyvale, CA, 94089
   UUCP:	{sun,decwrl,hpda,pyramid}!athertn!ericb
   Domainist:	ericb@Atherton.COM

peter@sugar.uu.net (Peter da Silva) (08/16/88)

In article ... ericb@athertn.Atherton.COM (Eric Black) writes:
> However, [ex and vi] really are two different editor programs which were
> combined into one executable.

Well as far back as 1979 all the ex commands were present in vi, and from ex
you could use the "open" and "visual" commands... so they seemed to be the
same program.

There was a serious improvement in vi some time in '80, though.

Back to the subject... I guess nobody's interested in a copy of 'ed' in 'c'...
-- 
		Peter da Silva  `-_-'  peter@sugar.uu.net
		 Have you hugged  U  your wolf today?

charles@hpcvca.HP.COM (Charles Brown) (08/19/88)

> Yup.  In fact, vi/ex/view/edit/e actually has five names, but all
> are the same program.  Check the links, and the Makefile in
> /usr/src/ucb/ex.  What is *really* gross (IMHO) is that the way the
> same program funtions as three different ones (according to our local
> Unix expert) is by checking to see argv[0] to see what name the user
> invoked the program as.
> -- 
> Christopher Lishka	...!{rutgers|ucbvax|...}!uwvax!uwslh!lishka

Why is this gross?  The 5 programs need substantially the same code.
If this wasn't done you would either need 5 separate binarys (taking
about 4 times as much disk space as the current links do) or you would
have to invoke the (only) program with different options for each of
the 5 functionalitys.
	ex -> editor -e
	vi -> editor -v
		etc.
Yuk!  Not only is that more verbose and harder to type, it is harder
to remember.  It also does not work with EDITOR envariables.

For these reasons I sorely miss file links, which are missing from
AmigaDo*.  I want to be able to do exactly the same thing on my Amiga.
--
	Charles Brown

pdg@hpcupt1.HP.COM (Paul Gootherts) (08/20/88)

>	What is *really* gross (IMHO) is that the way the same program
>	funtions as three different ones (according to our local Unix
>	expert) is by checking to see argv[0] to see what name the user
>	invoked the program as.  Then the program goes into one of its
>	modes:  vi mode, ex mode, view mode, etc.  Pretty sneaky.

When I first heard this, I assumed vi compared argv[0] against strings
like "vi", "ex", "view", and the like.  I was wrong.  It's worse.  The
version I saw set the mode flags based on characters appearing anywhere
in the name.

Thus, if the name contains a 'w', readonly mode is assumed.  If a 'd'
appears, it assumes you ran "edit", and if a 'v' appears, it assumes
visual mode.

It should be possible to get some weird combinations by making some
other links to the executable, for example, "dvw"....

__________________
Paul Gootherts
Hewlett Packard Co
hplabs!hpda!pdg

ricks@iscuva.ISCS.COM (Rick Schaeffer) (08/20/88)

In article <5660007@hpcvca.HP.COM> charles@hpcvca.HP.COM (Charles Brown) writes:
>
>For these reasons I sorely miss file links, which are missing from
>AmigaDo*.  I want to be able to do exactly the same thing on my Amiga.
>--
>	Charles Brown

I ran accross the same need in porting a c cross reference database system
to the Amiga.  It had a single program called "lid" which was linked to two
other names: "gid" and "eid".  I added "-g (for gid)" and "-e (for eid)"
options and created a couple of CSH scripts named "eid.sh" and "gid.sh"
which invoke lid with the proper option and pass on the rest of the command
line arguments.  Not quite as nice as a link but a heck of a lot less space
than three copies of the same binary.  With CSH 2.07 it will search your
path for files ending in ".sh" and execute them the same as commands.  And,
since CSH executes such scripts as "source" commands (ie: doesn't have to
load a new copy of itself) the time it takes is negligable.


-- 
Rick Schaeffer          UUCP:  uunet!iscuva!ricks
ISC Systems Corp.              ricks@iscuva.ISCS.COM
Box TAF-C8              Phone: (509)927-5114
Spokane, WA  99220