/* $Id: rm.the,v 1.1 2001/01/04 09:41:57 mark Exp $ */ /***********************************************************************/ /* Description: REXX macro to delete a file from a DIR.DIR file. */ /* Syntax: */ /* Notes: This macro deletes the line from the DIR.DIR file and */ /* the actual file from disk. */ /* Use with caution. */ /***********************************************************************/ Trace o 'EXTRACT /TOF/EOF/VERSION/DIRFILEID/CURLINE/' /* get various stuff */ If rc \= 0 Then Do Say 'Error in EXTRACT:' rc Exit 1 End If \dir() Then Do 'emsg ERROR: rm.the can only be run from the DIR.DIR file' Exit 1 End If \modifiable() Then Do 'emsg ERROR: invalid cursor position' Exit 1 End If version.2 = '1.5' Then oncommand = command() Else oncommand = incommand() If oncommand Then Do If tof.1 = 'ON' | eof.1 = 'ON' Then Do 'emsg ERROR: cannot delete TOF or EOF line' Exit 1 End End Select When (version.3 = 'UNIX' | version.3 = 'X11') & Substr(curline.3,1,1) = 'd' Then Do 'emsg ERROR: cannot delete directories' Exit 1 End When version.3 = 'DOS' & Substr(curline.3,6,3) = 'dir' Then Do 'emsg ERROR: cannot delete directories' Exit 1 End When version.3 = 'OS2' & Substr(curline.3,6,3) = 'dir' Then Do 'emsg ERROR: cannot delete directories' Exit 1 End Otherwise Nop End If version.3 = 'UNIX' | version.3 = 'X11' Then delcmd = 'osq rm -f' Else delcmd = 'osq del' 'sos delline' filename = dirfileid.1||dirfileid.2 delcmd filename 'msg File' filename 'deleted' Return 0