============================================================================= udl - Convert EOL formats freely between MS-DOS (CR/LF), Unix/Amiga (LF), and Apple (CR). (c) 1993-1996 Soenke Behrens, Devin Reade Version 1.1.5: $Id: README,v 1.9 1996/02/04 01:34:25 gdr Exp $ ============================================================================= Udl converts text files between the various end-of-line conventions, i.e. CR, LF, and CR/LF, used by the Apple IIgs, MS-DOS, Amiga, and Unix. After conversion, the original file is replaced with the converted file. Udl is known to run with ORCA/Shell 2.x, GNO/ME 2.x, and Unix. Not only is udl faster and simpler than tr(1), but it saves a step in the conversion process by automatically replacing the original file after the conversion completes. Thus: udl file replaces the longer sequence of tr '\012' '\015' < file > file.temp mv file.temp file Because it replaces the original file, udl makes every effort to ensure that the conversion process cannot corrupt the original. The translation process uses a temporary file and replaces the original only after the translation has completed. In case of a machine crash or power-down, the original file remains intact, unless the machine dies at precisely the instant the update occurs. This problem exists for a manual file replacement, as in: mv file.temp file so the risk is no greater. ========= Compiling: ========= Three makefiles are included: Makefile.gs For use on the Apple IIgs running GNO Makefile.unx For use with Unix systems Makefile.msd For use with MS-DOS systems (djgpp) Although udl on the IIgs can be run from either GNO or ORCA shells, it cannot be built with the standard ORCA installation due to a lack of additional libraries. The IIgs distribution should contain a binary of udl, including a resource fork. Therefore, you should be able to skip straight to the section on installation. For those who must know, however, building the binaries under GNO should just be a matter of typing 'dmake -f Makefile.gs'. If you are compiling on Unix operating systems that have been previously tested, you should be able to just type 'make -f Makefile.unx'. This will select the appropriate DEFINES for your system. For an explanation the various DEFINES, see the section below on "DEFINES Definitions". Note that compilation of udl _requires_ an ANSI C compiler. If you are compiling to a new system, add in another set of defines and let us know about them. Note that udlunix.c and udlgs.c assume that getopt() is declared in and that the function strdup() exists in . You might have to change these includes if that's not the case. Ensure you use cpp conditional compilations to match your platform (and to avoid breaking the code for other platforms). ============ Installation ============ Apple IIgs with GNO ^^^^^^^^^^^^^^^^^^^ Type 'dmake install -f Makefile.gs'. By default this copies the binary into "/usr/local/bin" and the man page into "/usr/local/man/man1". (You _are_ using version 3.x of 'man', are you not? *blatant plug*) If you don't like these locations, either modify the BINDIR and MANDIR macros in the makefile or install the files by hand. If you have describe(1) installed, you can update the udl(1) entry with the file "describe.udl". See the descu(8) and descc(8) man pages for details. Apple IIgs with Orca/Shell ^^^^^^^^^^^^^^^^^^^^^^^^^^ Copy the following files to their respective destinations: udl to 17 help/udl to 17/help Unix systems ^^^^^^^^^^^^ Type 'make -f Makefile.unx install'. By default the binary will go into /usr/local/bin and the man page into /usr/local/man/man1. This assumes root access. If this does not match your plans and/or access permissions, either copy the files by hand or change the BINDIR, MANDIR, and OWNER_GROUP macros in the makefile. =================== DEFINES Definitions =================== If you have problems compiling or are porting udl to a new operating system, define the following macros in the makefile as necessary. They should be used as the value of $(DEFINES_$(OS)) where $(OS) is your operating system as returned by `uname -sr | tr ' ' '_'`. HAS_ATEXIT if your system has atexit() _POSIX_C_SOURCE and _POSIX_SOURCE if your compiler is Posix compliant READDIR_RETURNS_DOT if your direct readdir() function will return entries for "." and "..". SunOS 4.x and 5.x (Solaris) are known to do this. BROKEN_REALLOC if your realloc() doesn't behave like malloc() when passed a NULL pointer as the first argument. BROKEN_DIRENT_STRUCT if you find that the first two letters of filenames obtained during directory recursion (as shown when the "-v" flag is used) seem to be missing. Some installations of Solaris are known to do this. GNO if you are compiling on the IIgs. This will allow for both ':' and '/' as pathname separators. OVERFLOW_CHECK Udl uses one recursive subroutine. Define this if you want to check for stack overflows for this routine (independent of any compiler flags). Strongly recommended. CHECK_STACK if you want stack usage to be displayed (IIgs only). You will also have to specify -l/usr/lib/stack in LDFLAGS. The following are the DEFINES values for tested operating systems: APPLE IIGS: (use "dmake -f Makefile.gs") ^^^^^^^^^^ ORCA/Shell and GNO/ME: (tested with occ) -DGNO -D_POSIX_C_SOURCE -D_POSIX_SOURCE -DHAS_ATEXIT -DOVERFLOW_CHECK MS-DOS: (use "make -f Makefile.msd") ^^^^^^ DJGPP: (tested with djgpp v2beta) -DREADDIR_RETURNS_DOT -DHAS_ATEXIT TESTED UNIX OS's: (use "make -f Makefile.unx") ^^^^^^^^^^^^^^^^ SunOS 4.x: (tested with gcc) -DREADDIR_RETURNS_DOT -DBROKEN_REALLOC -D_POSIX_C_SOURCE -D_POSIX_SOURCE SunOS 5.x (Solaris): (tested with SUNWspro cc) -DREADDIR_RETURNS_DOT -DBROKEN_DIRENT_STRUCT -D_POSIX_C_SOURCE -D_POSIX_SOURCE AIX 3.2: (tested with xlc) -DBROKEN_REALLOC -D_POSIX_C_SOURCE -D_POSIX_SOURCE Linux 1.2.3: (tested with gcc) -DREADDIR_RETURNS_DOT -D_POSIX_C_SOURCE -D_POSIX_SOURCE -DHAS_ATEXIT ===== Files ===== The following files are present in the udl package: README This file History Revision history Makefile.gs make(1) script for GNO Makefile.unx make(1) script for Unix Makefile.msd make(1) script for MS-DOS common.c Routines common to GNO and Unix versions common.h Header file for common.c globals.c Global variable definitions udl.1 Man page for udl command describe.udl short description of udl, FTP info udlgs.c Apple IIgs specific routines udl.rez Apple IIgs REZ source for resource fork udlunix.c Unix specific routines udluse.c Strings for invocation information ===== Notes ===== If the machine crashes before udl has replaced the original file with the converted file, the temporary file needs to be manually deleted. The temporary file resides in the same directory as the source file and has a name of the form: UDLTMPXX where XX is replaced by AA, AB and so on. ========= Copyright ========= COPYRIGHT 1993-1996 by Soenke Behrens and Devin Reade ALL RIGHTS RESERVED This package may be redistributed so long as no fee is charged, the authors' names remain, and all modifications are clearly marked as such and the unmodified source is included. This program contains material from the Orca/C Run-Time Libraries, Copyright 1987-1995 by Byte Works, Inc. Used with permission. ======= Authors ======= Original code by Soenke Behrens with modifications and version-merging by Devin Reade . Soenke Behrens sbehrens@contech.demon.co.uk Devin Reade gdr@myrias.ab.ca January 1996 Version 1.1.5