🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Daniel R. Levy Thu, 04 Sep 1986 23:21
vi bug?
#330
Author: Daniel R. Levy
Date: Thu, 04 Sep 1986 23:21
34 lines
2057 bytes
I have found what I _think_ is a bug in several different versions of vi
(on a VAX running BSD4.1, on a 3B2/400 running SysVR2, on a 3B20S running
SysVR2, but not on a PDP 11/70 running the UNIX 4.0 system).

The trouble seems to be that vi will intercept certain ASCII sequences in
the input file on lines beginning with 'ex:' and will interpret them as if
they were commands.

For example, a file containing the two lines

ex::
ex:3:

will, when read into some versions of vi, produce the diagnostic
"Not that many lines in buffer."

This problem arose when using vi to edit ASCII database files structured into
newline-separated records with the fields separated by colons (a la
/etc/passwd) and where 'ex' was one possible entry in the first field of
a record.

Would someone who is in the know please tell me whether this behavior is
a bug or a "feature"?  I certainly cannot find any mention of it in what
little documentation I have about vi (the SysV and BSD man pages on ex and
vi, and a document called "An Introduction to Display Editing using Vi").
Thank you in advance.
-- 
 -------------------------------    Disclaimer:  The views contained herein are
|       dan levy | yvel nad      |  my own and are not at all those of my em-
|         an engihacker @        |  ployer or the administrator of any computer
| at&t computer systems division |  upon which I may hack.
|        skokie, illinois        |
 --------------------------------   Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
	   go for it!  			allegra,ulysses,vax135}!ttrdc!levy
Re: vi bug?
#331
Author: Jim Webb
Date: Fri, 05 Sep 1986 21:16
32 lines
2179 bytes
> I have found what I _think_ is a bug in several different versions of vi
  ....
> The trouble seems to be that vi will intercept certain ASCII sequences in
> the input file on lines beginning with 'ex:' and will interpret them as if
> they were commands.
> 
> Would someone who is in the know please tell me whether this behavior is
> a bug or a "feature"?  I certainly cannot find any mention of it in what
> little documentation I have about vi (the SysV and BSD man pages on ex and
> vi, and a document called "An Introduction to Display Editing using Vi").
> Thank you in advance.

This is an semi-documented feature:  

	Mode lines are now supported.  Put a line containing
		ex: xxx :
	in the first or last 5 lines of the file, where xxx is any ex
	command you want executed when that file is read in.  To make
	other programs happy, it should probably be inside a comment. ----+
	You can use vi: as well as ex:.  (Note: no space allowed          |
	between the "ex" and ":".  The spaces around xxx are considered   |
	part of the command, and so are optional.)                        |
                                                                          |
                                              eg /* ex: autoindent : */ <-+

It was added in version 3.7 (October 16, 1981).  This and other goodies
are found in a file ex.news which comes with the vi src.  On my machine,
it was in /usr/src/cmd/vi/vax/ex.news which is a vax running SVR2.  I don't
know whether or not it is considered proprietary, otherwise I would have
posted it in its entirety.
-- 
Jim Webb             "Out of phase--get help"          ...!ihnp4!hropus!jrw
Re: vi bug?
#332
Author: Daniel R. Levy
Date: Mon, 08 Sep 1986 01:26
27 lines
2164 bytes
Thanks to the several people who wrote or posted to say that yes, this
(intercepting ex: or vi: [or ei: or vx: -- yuck] in the first or last few
lines of a file being read in) is an old, old "feature" allowing for auto-
configuration of vi, and that, yawn, it had been hashed over many many
times before on the net.  (Guess I have to get a copy of the compleat net
archives, then, so I won't appear stupid to the oldtimers.  Postpone those
backups, Joe, gotta mount a few dozen magtapes to grep for something :-). )

I sure would have preferred that this behavior wasn't the default, requiring
a command line option or environment variable to turn it on, or at the least
that it could be turned off by a command line option or something in the
$HOME/.exrc file.  In certain contexts, e.g. editing ASCII database files,
it stinks.  I particularly liked the message from the fellow who said that his
version of the vi source code deleted this "feature" by #ifdef SUICIDE
preprocessor directives.  (I have now found it, in the routine checkmodeline()
in ex_io.c.  Not the #ifdef SUICIDE directive, but rather the suicidal code.)

Dan

-- 
 -------------------------------    Disclaimer:  The views contained herein are
|       dan levy | yvel nad      |  my own and are not at all those of my em-
|         an engihacker @        |  ployer or the administrator of any computer
| at&t computer systems division |  upon which I may hack.
|        skokie, illinois        |
 --------------------------------   Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
	   go for it!  			allegra,ulysses,vax135}!ttrdc!levy
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads