home *** CD-ROM | disk | FTP | other *** search
- /* Show all CLI tasks */
- address 'COMMAND'
- 'version >nil: exec.library 36 '
- lrc = rc
-
- if (rc = 0) then
- check = addlib('rexxsupport.library',0,-30,0)
-
- address
-
- NULL = "00000000"x
-
- dosbase = findlib("dos.library")
- rootnode = import(offset(dosbase,34),4)
- tasktable = d2c(c2d(import(rootnode,4))*4,4)
- taskcount = c2d(import(tasktable,4))
- do tasknum = 1 to taskcount
- proc = import(offset(tasktable,tasknum*4),4)
- if (proc ~= NULL) then
- do
- proc = offset(proc,-92)
- cli = d2c(c2d(import(offset(proc,172),4))*4,4)
- command = 'No command loaded'
- args = ''
- if (cli ~= NULL) then
- do
- cmdname = d2c(c2d(import(offset(cli,16),4))*4,4)
- cmdlen = c2d(import(cmdname, 1))
- if cmdlen ~= 0 then
- do
- command = 'Command:' import(offset(cmdname,1), cmdlen)
- cis = d2c(c2d(import(offset(cli,32),4))*4,4)
- cptr = d2c(c2d(import(offset(cis,12),4))*4,4)
- args = import(cptr,80)
- args = translate(args,"'"||'0a0a'x,'"'||'0d00'x)
- y = pos('0a'x, args)
- if (y ~= 0) then args = left(args,y-1)
- end
- end
- 'd "Process' tasknum||': 0x'||c2x(proc) command args'"'
- end
- end
- exit(0)
-
- /* Find a given library in the system */
- findlib:
- parse arg tofind
- execbase = next("00000004"x)
- liboff = 378
- nodebase = import(offset(execbase, liboff), 4)
-
- do while(import(nodebase,4) ~= NULL)
- namestr = import(import(offset(nodebase,10),4))
- if namestr = tofind then return nodebase
- nodebase = import(nodebase,4)
- end
-
- 'd "Could not find' tofind||'"'
- exit(0)
-