Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!bloom-beacon!usc!cs.utexas.edu!uunet!bfmny0!tneff From: tneff@bfmny0.UUCP (Tom Neff) Newsgroups: comp.unix.microport,comp.unix.i386 Subject: Re: new DOSMerge Keywords: DOSMerge VP/ix scripts help Message-ID: <14439@bfmny0.UUCP> Date: 6 Jul 89 16:21:31 GMT References: <51@calcite.UUCP> <1989Jul5.174059.27378@eci386.uucp> Reply-To: tneff@bfmny0.UUCP (Tom Neff) Followup-To: comp.unix.microport Organization: ^ Lines: 83 Summary: Expires: Sender: Followup-To: Distribution: In article <1989Jul5.174059.27378@eci386.uucp> clewis@eci386.UUCP (Chris Lewis) writes: >You can run any DOS program from a UNIX makefile, but you cannot run the >make in the background or redirect output of the make (VP/IX needs a console). >I do this all the time. I redirect VP/ix output all the time. Here's an excerpt from a Korn shell script I use in building one of my products: =================================================================== addcr <<- EOF > $Rootbat # DOS batch needs full CRLF set FILL1= set :F0:=$Rootdir unixpath asm86 $Rootasm oj($Rootobj) print($Rootals) if errorlevel 2 quit link86 & < $Linkcmd if errorlevel 2 quit loc86 & < $Loccmd if errorlevel 2 quit EOF dos -c "$Rootbat" | nocrf | tee $Rooterr =================================================================== In the above example, "nocrf" is a ^M-stripper filter I wrote which forces fflush(stdout) on ^J's, thus allowing me to see the compiler status messages immediately without cat(1) buffering. "Dumb" inelegant program, anyway here's the source. =================================================================== #include main() { register c; while ((c = getchar()) != -1) { if (c != '\r') putchar(c); if (c == '\n' || c == '\r') fflush(stdout); } fflush(stdout); exit(0); } =================================================================== (I originally wrote 'nocr' without the extra fflush() calls because the "rmcr" program that came with VP/ix was UNFORGIVEABLY BUGGY!!! It munches source files occasionally and if you're doing BULK file conversion in place during a platform move, as I recently did, it's MEGADEATH to come back 3 weeks later and find zorched source. Grrrrr.) So, anyway, yes you can certainly redirect VP/ix output. If you do, and you cancel the running pipe with , you may get kicked off and have to re-login, sometimes. Who knows why. Although VP/ix won't run in the background, it's very happy to run on a virtual terminal (vtlmgr). So you can still do many things at once while a DOS application runs, just by flipping to the next VT. >You may have to write a small shell wrapper because make doesn't know >about DOSPATH explicitly, and DOSPATH will need to point at the executable >for the DOS things you want to run (and the DOS things you want to run >shouldn't be in a "DOS disk as UNIX file" like "C:"). You only need DOSPATH if you want to be able to fire off EXE/COM/BAT files from the shell prompt as if they were UNIX commands. If you are willing to type 'dos command' rather than 'command', you can run anything DOS can get at, even stuff in pseudodisks like "C:" or in real DOS partitions on your hard disk (if you have VP/ix set up to access it), whether or not it lies in DOSPATH. In a production environment you should be operating out of shell scripts anyway, so sticking the 'dos' in (as I do in the example above) is easy and wise. At the interactive shell prompt, you can use aliases or (as Chris points out) shell wrappers to do it. dir () { dos -c "dir $*" | nocr } -- "My God, Thiokol, when do you \\ Tom Neff want me to launch -- next April?" \\ uunet!bfmny0!tneff