[comp.sys.ibm.pc] MKS vi bug

lyourk@ihlpf.ATT.COM (Loran N. Yourk) (03/17/88)

] MKS 'vi' does some pretty weird things on me - noticably a
] :%s/^/string/ replaces the file with 'string',instead of 
] prepending each line with it.  Also, is there a way around
] the inability to imbed carraige returns (^M) files with
] this 'vi' - i'd like my ex.rc to do some of the work for
] me, as well as set up macros that executes several commands.
] 
] +===========================================================+
] +UUCP: killer!treed                                         +
] +VOICE: (202) 265-1309                                      +
] +USMAIL: ACS^MOIS Dept.^M1155 16th NW^MWashington DC  20036 +
] +DISCLAIMER: ACS has nothing to do with anything I say here +
] +===========================================================+

The version of the MKS vi I have (ver 3.5, MKS release 2.2) does
not have the the problem you mentioned with the :%s command.  As
to the problem with embedding carriage returns,  the carriage
returns are there but MKS vi doesn't display (or read) past the
first carriage return on the line (for that line only) the next
time you edit the file (or read it in as is the case for ex.rc).
If you need a vi that doesn't have these problems then you should
try PC/VI.

Loran Yourk
ihnp4!ihlpf!lyourk

waynec@hpsrli.HP.COM (Wayne Cannon) (03/18/88)

I don't see the same behavior that your describe.  

:%s/^/string/ appends "string" to the beginning of every line just fine
on my machine.

It is possible to imbed carriage returns and write them to disc, but vi
seems to truncate lines containing carriage returns when reading them
back in the next time.  However, :set notosscr makes ed treat the
carriage return as any other character, including displaying the line
terminating cr prior to the lf.  Type ":set all" to see all of the
options.

I am not familiar with the :o command of which you speak, but the MKS vi
that I have and the UNIX vi that I have both behave and respond the same
way to the limit that I played with them.

alex@mks.UUCP (Alex White) (03/18/88)

In article <4014@ihlpf.ATT.COM>, lyourk@ihlpf.ATT.COM (Loran N. Yourk) writes:
	> to the problem with embedding carriage returns,  the carriage
	> returns are there but MKS vi doesn't display (or read) past the
	> first carriage return on the line (for that line only) the next
	> time you edit the file (or read it in as is the case for ex.rc).
Set the set option tosscr to notosscr.  If you do, it'll treat ^M
as any other character.

grandi@noao.arizona.edu (Steve Grandi) (03/28/88)

I haven't notice the problems reported by others, but I do have a few
quirks to report.  

One of my vi idioms is to mark the beginning of a line with mz, then move
forward some number of lines and with the cursor at the beginning of a
line, delete the chunk of lines with d`z.  Using the vi from 4.3BSD, PC/VI
and Aztec's Z (the latter two both MS-DOS programs), the line the cursor
was on IS NOT deleted, using MKS vi, the line the cursor is on IS deleted.

I have also had MKS vi crash the PC a few times:  I was editing a big file
and had little free space on the disk for vi's temporary files.  More
often, vi would report a "write error on temporary file" or somesuch and
tell you to bail out quick, but more than once I could do nothing but
reboot.

Finally, one can place vi option variables in the EXINIT environment
variable or the ex.rc startup file.  Since I dislike tiny files that
clutter the disk, I would prefer to use the EXINIT variable.
Unfortunately, one must put strings such as "set wm=3" in EXINIT which is 
impossible with the standard MS-DOS set command since the equal sign
confuses the poor command.  If one uses the MKS shell, one can do the deed,
but with COMMAND.COM, other tricks are necessary (which I haven't quite
figured out!).

Nevertheless, I like MKS vi.  It is quick on startup, updates the screen
very quickly, is not outrageously large, does not require several files on
the disk other than the executable, supports full vi functionality (such as
filtering sections through MS-DOS commands), has a "job control" feature
and is a supported project. 
-- 
Steve Grandi, National Optical Astronomy Observatories, Tucson AZ, 602-325-9228
UUCP: {arizona,decvax,hao,ihnp4}!noao!grandi  or  uunet!noao.arizona.edu!grandi 
Internet: grandi@noao.arizona.edu    SPAN/HEPNET: 5356::GRANDI or DRACO::GRANDI

lufkin@hpccc.HP.COM (Paul Lufkin) (03/29/88)

...since this seems to be the MKS vi string:

I'm having trouble manipulating strings containing the pipe ( "|" ) 
with MKS regular expressions in vi/ex and sed.

In other implementations of UN*X ex, the command    1,$s/||/:/g
would change all occurences of "||" to ":".

In MKS vi I get the error message 'Badly constructed regular expression'.
Escaping the |'s does not help (ie. /\|\|/ ), nor does setting 'nomagic'.

If I try the substitution from MKS sed, my PC hangs without error message 
and must be rebooted.

Interestingly enough, I *was* able to pattern match and make the desired
substitutions with MKS awk using the 'sub' string function.

Any suggestions?

Environment:
-------------------------------------------
PC:  HP Vectra ES 12 (12 MHz AT workalike)
DOS: MS-DOS 3.2
VI:  VI/EX 3.5 compatible.  MKS Toolkit release 2.2
Shell: c:\dos\command.com

Paul Lufkin, Jr.
Hewlett-Packard Application Support Division
lufkin@hpccc or [hpda|hpfcla]!hpwcso!paul
(415) 691-5780

psc@lznv.ATT.COM (Paul S. R. Chisholm) (04/06/88)

< If you lined all the news readers up end-to-end, they'd be easier to shoot. >

In article <5060020@hpccc.HP.COM>, lufkin@hpccc.HP.COM (Paul Lufkin) writes:
> I'm having trouble manipulating strings containing the pipe ( "|" ) 
> with MKS regular expressions in vi/ex and sed.
> 
> In other implementations of UN*X ex, the command    1,$s/||/:/g
> would change all occurences of "||" to ":".
> 
> In MKS vi I get the error message 'Badly constructed regular expression'.
> Escaping the |'s does not help (ie. /\|\|/ ), nor does setting 'nomagic'.
> 
> Paul Lufkin, Jr., Hewlett-Packard Application Support Division
> lufkin@hpccc or [hpda|hpfcla]!hpwcso!paul, (415) 691-5780

I'll be dipped; you're right.  Searching for || works just fine.  Weirder
than that, after you've searched for ||, using that as the previous
regular expression, you *can* change it; that is, :s//:/g<ret> works
just fine.  Gee, I think I'll send these guys some E-mail.

-Paul S. R. Chisholm, {ihnp4,cbosgd,allegra,rutgers}!mtune!lznv!psc
AT&T Mail !psrchisholm, Internet psc@lznv.att.com
I'm not speaking for my employer, I'm just speaking my mind.

wheels@mks.UUCP (Gerry Wheeler) (04/07/88)

In article <5060020@hpccc.HP.COM>, lufkin@hpccc.HP.COM (Paul Lufkin) writes:
] I'm having trouble manipulating strings containing the pipe ( "|" ) 
] with MKS regular expressions in vi/ex and sed.
] In other implementations of UN*X ex, the command    1,$s/||/:/g
] would change all occurences of "||" to ":".
] In MKS vi I get the error message 'Badly constructed regular expression'.

I tried this out on various versions of the editor here.  It shows up in
vi versions 2.2b and earlier, but is fixed from 2.2c on. 
-- 
     Gerry Wheeler                           Phone: (519)884-2251
Mortice Kern Systems Inc.               UUCP: uunet!watmath!mks!wheels
   35 King St. North                             BIX: join mks
Waterloo, Ontario  N2J 2W9                  CompuServe: 73260,1043