Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!iuvax!rutgers!ucla-cs!gast From: gast@lanai.cs.ucla.edu (David Gast) Newsgroups: comp.editors Subject: Re: re: Yet another vi question (summary) Summary: IT IS POSSIBLE Message-ID: <16745@shemp.CS.UCLA.EDU> Date: 12 Oct 88 21:56:33 GMT References: <270@tijc02.UUCP> Sender: news@CS.UCLA.EDU Reply-To: gast@cs.ucla.edu (David Gast) Organization: UCLA Computer Science Department Lines: 68 In article <270@tijc02.UUCP> djm408@tijc02.UUCP (David Marks ) writes: >I am still getting responses to my question on entering vi with a blank >template. Most of you are missing the point I was trying to make and why I >asked the question in the first place. > > around a problem, I usually am curious enough to want an > answer to why the original solution would not work. It seems to be a ``feature.'' But a solution does exist, see below. > > 2. I was trying to avoid copying the template file to the report > before editing it. Doing this from a program means that I have > to invoke a shell which creates another process that really should > not be needed. No need to invoke the shell or to create any new processes if you are writing a C program. Just use the function calls described in the manual. I use BSD so I do not know the precise names you will have to use for System V. > > 3. I feel that vi should be able to this. No manual I have read > (no flames on UNIX manuals and books please :-) ) even comes > close to explaining why this might not work. All claim that > ANY ex command can be executed on entry to vi, including those > that take arguments; most show examples of the "set" command. I just checked one. It says that "most" or "many" (I forget which one) commands work. It does not say that all work. It is, however, either a bug or a bad feature that not all do not work. > >Those of you that thought that my vi is damaged, should know that we are using >the same vi that is distributed by AT&T with System V rel. 2.2, and thus AT&T >must have a damaged vi. As you probably know, AT&T did not write vi. There is nothing that says that Berkeley or AT&T never write code with bugs or features. >I resent the attitude that some of you took trying to explain to me how to use >shell scripts to solve my problem. Please try to excuse us. How many cpu cycles do you figure you will save by not using a shell script? How many CPU cycles have been spent sending your message and all of the replies across the net? Is it a positive number or would have it been better to do it in a shell script to begin with? In the Bourne shell or Korn Shell, you could have done > file to create a file without starting any extra processes. The shell works great for many programs. There is a way to do exactly what you want to do and all from within vi. If I understand, you want to be able to invoke vi, with something like ``vi file'', where file does not exist, but when vi is called a template is copied into file automatically. Since you resent all suggestions, here is my offer. Send me a $100 cashiers check and I will send you the solution. It only uses vi. I do not claim that it is better than the above suggestions, only that it works. David Gast 1446 Federal Avenue #A Los Angeles, CA 90025 gast@cs.ucla.edu {uunet,ucbvax,rutgers}!{ucla-cs,cs.ucla.edu}!gast