Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!ncar!noao!amethyst!organpipe!afthree.as.arizona.edu!tom From: tom@afthree.as.arizona.edu (Thomas J. Trebisky) Newsgroups: comp.os.cpm Subject: Re: Need WordStar utility Keywords: wordstar non-document Message-ID: <699@organpipe.UUCP> Date: 12 Dec 90 21:23:13 GMT References: <16529@s.ms.uky.edu> Sender: news@organpipe.UUCP Organization: University of Arizona, Tucson, AZ Lines: 39 In article <16529@s.ms.uky.edu> tindle@ms.uky.edu (Ken Tindle) writes: > >Files created with WordStar must contain some binary characters, which is >ruining the "raw" upload of program code to the uC board. >I need a real, flat ASCII file on disk- so is there easily available a >utility to massage WordStar output? The thing to do (perhaps you know this) is to run wordstar in non-document mode - then you read and write plain old ascii files and all is well. A contract I have made with myself is to NEVER type the filename to be edited on the command line (wordstar is most commonly installed to use document mode by default - putting all those nasty binary chars in your file (and setting the 8th bit in some others as well as part of it's way of "marking" up your file.) Then type N and then type your filename --- if you mistakenly start wordstar in document mode on your 2999 line source file DON'T SAVE IT!!! use the abort and exit command (whatever that is, I forget), and start over. If you did save it ......... ....... you poor guy ..... try the following recipe. Just talked to my CPM guru nextdoor and he says to write a simple filter that does this - Read the file byte by byte. Force the high bit in every byte to zero on every byte read. Delete every byte that is < 0x20 (blank) and that is not 0x09, 0x0a, 0x0c, 0r 0x0d (tab,newline,formfeed,return). A code fragment in C would be something like this: (this has not been tested, but this is the idea) while ( c = getchar() ) { c &= 0x7f; if ( c < 0x20 ) { if ( c == 0x09 || c == 0x0a || c == 0x00c || c == 0x0d ) putchar(c); } else putchar(c); } ttrebisky@as.arizona.edu (internet)