U2D : Convert Unix text files to MS-DOS format ============================================== Keywords: Windows 3.1 Drag Drop Unix text ASCII MS-DOS convert U2D is a Windows 3.1 program which converts Unix text file line endings to MS-DOS format. U2D is an example of a Windows "drag-and-drop" application. To convert a file, all you have to do is to click on a file in the Program Manager, drag it to the U2D icon and drop it off. U2D can process multiple files at a time. Do you need U2D? ================ Only if you use Unix systems. I transfer files from a Unix system to my PC on a regular basis. The Unix program 'unix2dos' and communication programs such as Omen Technology's sz program will translate Unix text line endings to MS-DOS format. I seldom remember to do this before transfering text files (most of the files I transfer are binary, and text files tend to be contained in ZIP files) hence my need for a conversion utility on the PC side. I wrote a DOS utility to do the conversion but I use Windows most of the time thus the need for U2D. Unix text files terminate a line with the newline (0x0A) character. MS-DOS terminates text lines with a CR-LF pair (0x0D, 0x0A). U2D simply finds the newline character and adds a CR character. What makes U2D different is its use of Windows drag-and-drop technology. Installing U2D ============== U2D is distributed as a ZIP file. Change to, or create, a directory where you want to store the U2D executable file and this document. For example, you might do the following: MD \WINUTIL\U2D CD \WINUTIL\U2D COPY A:U2D.ZIP PKUNZIP U2D This of course assumes that you already have a directory named WINUTIL, are copying the distribution file from floppy drive A and are using PKWARE's PKUNZIP to extract the files. In the Program Manager, select the File/Run menu item. Enter the directory where the U2D executable resides and click OK. The U2D icon will appear at the bottom of your screen. Unlike most other icons, double clicking the icon will not open it. You can only drag and drop files onto it. To uninstall U2D, double-click the Windows background and cancel the program from the Task Manager. You can have U2D run every time you start Windows by editing your WIN.INI file. The top section should be [windows]. The third line should be load=. Add the path of U2D to look like: load=c:\winutil\u2d\u2d.exe Now restart Windows. Using U2D ========= U2D converts a file when you select it from the Windows Program Manager, drag it over the U2D icon and drop it off. U2D creates a new file with an extension of ".TXT" in place of the original extension. For example, if the file to be converted is named "UNIXDATA.ASC" then a new file will be created named "UNIXDATA.TXT". If the output file already exists, it will be overwritten. Be careful, you won't be warned if this happens. I regard this to be a feature rather than a deficiency. U2D will convert multiple files. You can select multiple files by using either the CTRL or SHIFT and left mouse button to select multiple files. (Consult your Windows documentation on how to do this). By default, U2D creates output files with an extension of ".TXT". You can modify the default extension used by making an entry in your WIN.INI file. The procedure is described in a later section. The U2D icon tries to stay on top of overlapping windows. This makes it more useful when used in conjunction with the File Manager. I find it easier to maximize the File Manager and then drag-and-drop without having File Manager cover the U2D icon. Default Extension ================= U2D writes its output to a file with the same filename as the input but with an extension of ".TXT". You can change this behavior by making the following addition to your WIN.INI file. At the bottom of the file add a new section as follows: [U2D] Extension=.DOS The two lines above will change the default output file to be written with an extension of ".DOS". Don't forget the period before the three character extension. You must exit and restart Windows for the change to take effect. Copyright ========= U2D is "freeware." That means that I retain the copyright to the program but that the program is freely distributable (this is different from "public domain."). You may use the program for private and commercial purposes without any reimbursment to me. The two restrictions that I impose are: 1) the U2D program and it's documentation be distributed together, 2) no fee may be charged for the program except for a reasonable distribution fee. Disclaimer ========== As of this writing there are no known problems. This represents my second Windows program and my first attempt at using drag-and-drop techniques. If you use this program you do so at your own risk. If this is not acceptable, then don't use the program. Technical Details ================= U2D is written in C++ and compiled with the Borland C++ 3.1 compiler. OWL isn't used. The API routine DragQueryFile and the window style WS_EX_ACCEPTFILES are the keys to making the drag-and-drop feature work. Support ======= You were expecting support for a free program? I do, however, welcome your comments and suggestions. Stan Wong s.wong@ieee.org 4/2/94