Documentation for CNTLH, Version 1.1 by David McCord 10 Sept 1989 CNTLH is a zsystem program. You must be using ZCPR3 (or later) and a Z80- compatible microprocessor to use it. 1. Why CNTLH? To explain why this program exists and what it is useful for, I have to tell you a little about myself. The past few years I have become heavily interested in the use of computers as a social outlet. That sounds contradictory, doesn't it. The stereotypical image of someone using a computer is someone *not* socializing, right? Well, like all stereotypes, this one turns out to be incorrect at least some of the time. A couple of years ago, Keith Petersen invited me to participate in an online real-time conference on GEnie. He arranged for me to use a "press pass" to avoid the typical (then) $5/hour GEnie usage charge. The conference itself was nothing spectacular. It didn't grab me. However, over the period of a week or two after the conference, still using my free pass, I explored GEnie. Sure, GEnie is an interesting place, has gigabytes of information, but it wasn't until one day that I discovered something they called the "CB" (as in citizen's band radios) area that I finally discovered something new and different. Suddenly I was connected to a community of whose existence I had never been aware, that of online realtime socializers. This community had its own social mores, jargon, ethics, and environment. It used computers in a way I had never experienced before, as that of a social and communications facilitator. There are a lot of benefits and new perspectives that online socializing has to offer. First, it is a great equalizer. When your only contact with another person is via keyboard and display, it is not very easy to determine characteristics such as age, race, gender, handicap, height, weight, and so forth. Thus, you can and do end up socializing with people that you would never socialize with in a non-online manner, which has the benefit of expanding your horizons. Second, it is very convenient. At just about any time of night or day, you can enter the social environment, and it doesn't matter if you are dressed for the occasion or not. Third, it is a medium of communication only. The physical aspects of "real life" socialization are totally absent. Thus, one learns about your conversational partners from the inside out, instead of the normal manner, outside-in. Although not identical and certainly more inefficient, it is very close to pure telepathy in spirit. Fourth, using a computer for this purpose is much less inexpensive than voice telephone calling, or going out. Well, I jumped in with both feet to this new milieu; when my free GEnie pass expired, I got my own account. Once my bills got to be too much to handle on GEnie, I discovered inexpensive alternatives. Try Portal at 408/725-0561 or BIX at 617/861-9767 if you are interested in affordable alternatives to the "big guys" like GEnie and Compuserve. Then, my life changed when I became a single parent. I find now that if it were not for online socialization, I would have virtually no social life. Two small kids can't be left to themselves whenever Daddy wants to go to parties or visit friends, and babysitters....well, babysitters create additional problems. So, now I spend a lot of my leisure time at my keyboard, chatting with friends. Now, there are certain times when one wants to capture an online conversation for later review or perusal. (In fact, this practice is very common - you should always expect everything you say online to end up getting recorded.) The actual capture of a conversation is very easy, a standard function of any decent telecommunications software package. However, viewing or editing such captured data is usually not so easy, due to variations in elements such as parity settings, dissimilar handling of carriage return characters, and realtime on-the-fly editing of inadvertent typographical errors. This is particularly true of "direct" conversations where your computer is directly connected to someone else's via Telenet, without an intervening host computer (like GEnie). Trying to use an editor on such a file, filled with control-h (backspace) characters from on-the-fly edits, possible orphan carriage returns (for instance, if you were talking to someone with a Commodore 64/128, very common computers), and characters with the high bit set so they potentially appear to be non-ASCII, is a headache. WordStar 4 for CP/M can do the job of cleaning up such a file, but it is a very tedious and slow. WordStar also has a nasty habit of slowing down enormously when confronted with a file of this nature, making things much worse. After the "n"th time of trying to use WordStar for this purpose, I got motivated enough to write CNTLH. 2. What does CNTLH do? CNTLH is a filtering and formatting program that cleans up captured chat files to the point where only minor editing is necessary, automating several editing processes. This can save you large amounts of time - it used to take me about 45 minutes to edit a 30K file; now, using CNTLH, I can do the same editing job in five minutes. These functions performed by CNTLH are: 2.1 Stripping the high-order bit CNTLH converts all characters in a file so that they appear to be "normal" ASCII characters. This eliminates problems arising from incorrect parity settings or capture software (like T3TERM) that marks all incoming characters to have the high bit set, adding 128 to their ASCII value. This is equivalent to opening the file from WS in non-document mode and using the ^QU command. CNTLH can also be used, because of this function, to convert a WordStar "document" format file to a WordStar "non-document" (plain ASCII) file. 2.2 Handling control-h (backspace) characters CNTLH processes control-h characters found in conversation files, resulting in a much more readable and useful document under WordStar. Control-h characters are used to "back up" the cursor and correct a typographical error when chatting; unfortunately, the original error, the backspacing, and the corrected characters all get captured into the file. This looks like a real mess under WordStar if not processed, something like: Here is a typofraphic^H^H^H^H^H^H^Hgraphical error. CNTLH eliminates the ^H's and the characters they should delete, automatically. This is equivalent to a WS or NuKey macro to find the next ^H, delete it, back up one character, and delete it too, except that CNTLH does it to the whole file with one shot. 2.3 Handling "orphan" carriage returns Not all computers are compatible with the cp/m/zsystem standard that the end of a line is marked by a carriage return/linefeed pair of characters. Apple IIs and Macintoshes, Commodore 64/128s, and many other common computer types mark the end of a line with a single carriage return (the "orphan") and no line feed. This particular situation really gives WordStar headaches, because WS thinks an orphan carriage return means "overprint this line with the next one when printing". Yuck. And, to make things worse, if the conversation file is mixed in that some carriage returns are orphan and others are not, it is impossible to automate the search and replacement of the orphans, because WordStar doesn't have any way to "search and replace all returns NOT followed by a linefeed". CNTLH fixes this one too. 3. How is CNTLH used? CNTLH is very simple to use. You simply invoke it by typing: a0:command>CNTLH is any unambiguous zsystem filename, for example, SHERRY.003, B12:POOKA.TMP, or CHAT:LARRY.TLK. CNTLH then reads through , processing as it goes, and when finished creates an output file of the same name as the original file. The original file is renamed to .BAK. This is identical to how WordStar works. When invoked and running, CNTLH displays a few status messages. Standard kinds of errors, such as being unable to find the input file, will be handled and an appropriate message displayed. In its distributed form, CNTLH uses a little over 35K of TPA; this can be reduced, but only by reassembling the program with different buffer size selections in the source code. CNTLH can by aborted during operation at any time by pressing any key. If aborted prior to completion, the original file will be present under it's original name, unmodified. There may be a file with a .$$$ extension present which should be deleted. Because CNTLH is a zsystem utility, built-in help is provided. Just type "cntlh //" to see it. 4. Programming notes CNTLH, like any self-respecting zsystem program, relies on SYSLIB and Z3LIB subroutines heavily. Thus, you'll need SYSLIB.REL and Z3LIB.REL to reassemble it. You might want to reassemble it to reduce or enlarge its TPA use or to enhance it. The assembler I used was ZAS 3.02, but most Z80 relocatable assemblers should work. The system I run CNTLH on is a SemiDisk DT42 9MHz HD64180 CPU w/512K RAM and ST225 20MB hard disk, running the "Hyperspace" Z-System (ZRDOS 2.0, ZCPR 3.3). Part of the challenge of writing CNTLH was coping with the "backwards editing" of the control-h characters in the conversation file. It is conceiveable that dozens or more control-h characters might consecutively exist in the file; how could I process them properly using sequential or random-access file structures? Sequential didn't seem like a likely candidate, no way to back up (although extensively supported by SYSLIB). How could I "back up" reliably under all circumstances? With a random-access model, this might involve going to the previous sector and rewriting it, making things very complicated. And in the sequential model, although Rick Conn provides an "unget" function, it was only single-level and couldn't support, say, twenty control-h's in a row (where I'd have to "unget" twenty times consecutively). The solution I employed was to use sequential file structures and a construct I called a "pipe". The pipe is a FIFO (first-in-first-out) buffer wherein I can "back up" as many characters as the pipe is long. I have experimented with various settings of the length of the pipe; the distributed length is 64, which seems to be a good tradeoff of speed versus maximum number of controlh's handled. I have even run the length of the pipe up as high as 1K; but things get pretty slow when you do that, and it's pretty unlikely that a captured conversation file would have a thousand consecutive control-h's in it. However, ten or twenty consecutive ones are not uncommon. Happy chatting! --David McCord