/* lha2lzx.rexx - currently only for handling of the tilde (~) in filenames */ OPEN('File','env:nl2zl') /* Open the file containing the filename of the archive */ Name = READLN('File') /* Read the filename */ Name1 = TRANSLATE(Name,'_','~') /* Change the tilde to an underscore */ Length = WORDLENGTH(Name,1) /* Get the length of the filename */ Pos = 1 /* Set the character position to an initial value */ DO UNTIL Length = Pos + 4 /* Just in case there is more than one tilde in the filename... */ Pos = INDEX(Name,'~',Pos) /* Find the numerical position of the (next) tilde */ IF Pos = 0 THEN SIGNAL Fin /* Go to the label 'Fin' if there are no more tilde's */ Pos = Pos - 1 /* Go to the previous character position - the one BEFORE the tilde */ Name = INSERT("'",Name,Pos) /* Insert an apostrophe before the tilde */ Pos = Pos + 3 /* Jump to the character after the tilde */ END /* End of the 'DO UNTIL...' statement */ Fin: /* The label 'Fin' */ CLOSE('File') /* Close the file containing the old filename, so that it can be renamed */ ADDRESS COMMAND /* Address AmigaDOS */ 'rename "'Name'" AS "'Name1'"' /* Rename the old file to the new name, e.g. "rename old'~file TO old_file" */ 'echo "'Name1'" >env:nl2zl' /* Copy the new filename over the old */ 'echo "*"$nl2zl*"" >env:nl2zldfl' /* Copy the new filname surrounded by quotes over the old (which was surrounded by quotes) */ /* As this doesn't really concern writing AmigaDOS scripts, if you're using */ /* LhA2LZX as a tutorial then don't worry about this bit - it's just a way */ /* of easily inserting an apostrophe before a tilde so that it can be */ /* renamed by AmigaDOS - see the 'Bugs' section of the LhA2LZX.guide for */ /* more details */