File: rm.the

package info (click to toggle)
the 3.1-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 4,452 kB
  • ctags: 5,268
  • sloc: ansic: 63,118; sh: 2,399; makefile: 444
file content (62 lines) | stat: -rw-r--r-- 1,830 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
$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