PRO kiexpand,compressed_file_name,rm=rm,script=script ; This routine derives the appropriate name of the expanded ; data file from the name of the compressed file, and expands ; the KI-produced file, storing it under the appropriate name. ; ; Once I'm sure everything is going properly, the routine will ; delete the compressed file after expanding it. ; Set up OS-specific items @isitdos cpfn=STRTRIM(compressed_file_name,2) fc=STRMID(cpfn,STRLEN(cpfn)-12,1) bfc=BYTE(fc) bc=bfc(0) ; Is the first character of the file name between 'n' and 't'? IF ((078B LE bc) AND (bc LE 084B)) OR $ ((110B LE bc) AND (bc LE 116B)) THEN BEGIN ucfn=cpfn STRPUT,ucfn,STRING(bc-13B),STRLEN(ucfn)-12 cmd=kiexpcmd+cpfn+' '+ucfn IF KEYWORD_SET(script) THEN BEGIN ; Return a line to be added to a script to uncompress all files IF dos $ THEN cmd=cmd+' > devnull' $ ELSE cmd=cmd+' > /dev/null' IF KEYWORD_SET(rm) THEN cmd=[cmd,rmcmd+cpfn] script=cmd ENDIF ELSE BEGIN ; spawn a shell command to uncompress this particular file SPAWN,cmd IF KEYWORD_SET(rm) THEN BEGIN ; spawn another command to remove the compressed file SPAWN,rmcmd+cpfn ENDIF ENDELSE ENDIF ELSE BEGIN MESSAGE,'Bad file name :'+cpfn,/INFORMATIONAL MESSAGE,'Expansion not attempted' ENDELSE END