/* CrLf2Lf, Version 2.00 */ /* Convert CR/LF to LF only */ /* Written by Rob van der Woude */ /* Original version: September 9, 1998 */ /* Latest update: December 30, 2002 */ /* Initialize RexxUtil library */ Call RxFuncAdd "sysloadfuncs", "RexxUtil", "sysloadfuncs" Call sysloadfuncs /* Check and interpret command line parameters */ Parse Upper Arg commandline Parse Value commandline With source target dummy If dummy <> "" Then Call ErrorMsg "Too many parameters: "||commandline If source = "" Then Call ErrorMsg If target = "" Then Call ErrorMsg "Please specify target" /* Check source and target files */ Call SysFileTree source, "source.", "F" If source.0 <> 1 Then Call ErrorMsg "Source file "||source||" not found." Call SysFileTree target, "target.", "F" If target.0 = 1 Then Call ErrorMsg "Target file "||target||" already exists." /* Read source file as one single string */ Parse Value source.1 With . . size . filestring = CharIn( source, 1, size ) newstring = filestring /* Search source file for CR/LF combinations and remove the CR */ start = 1 Do Forever newline = Pos( "0D0A"X, newstring ) If newline = 0 Then Leave newstring = SubStr( newstring, 1, ( newline - 1 ) )||, SubStr( newstring, ( newline + 1 ) ) End /* Write result to target file and close it */ Call CharOut target, newstring Call LineOut target Exit 0 ErrorMsg: Procedure msg = Strip( arg( 1 ) ) Call Beep 220, 240 Say If msg <> "" Then Say "Error: "||msg||"0D0A"X Say "CRLF2LF, Version 1.01" Say "Convert CR/LF to LF only" Say Say "Usage: CRLF2LF " Say Say "Written by Rob van der Woude" Say "http://www.robvanderwoude.com" Exit 1 Return