home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rxnet2.zip
/
GETPERM.CMD
next >
Wrap
OS/2 REXX Batch file
|
1993-09-02
|
3KB
|
161 lines
/*
GetPerm.CMD
Retrieve Network Permissions for Files and Directory
Written: Steven Elliott, September 1993
Requires REXXNET.DLL
Usage: GetPerm [-S] resource
Display the permissions of the resource
if -S is given apply to all subdirs as well
*/
/*
**********************************************************************
GLOBAL VARIABLES
*/
version = 1.1
tab = D2C(9)
cr = D2C(13)
recursive = 0
/*********************************************/
call rxfuncadd SysLoadFuncs, "RexxUtil", SysLoadFuncs
call SysLoadFuncs
call rxfuncadd NetLoadFuncs, "RexxNet", NetLoadFuncs
call NetLoadFuncs
signal on syntax
signal on halt
if arg() = 0 then
signal usage
parse upper arg opt cmdline
if left(opt, 1) = '-' then do
if pos('S', opt) \= 0 then
recursive = 1
end
else
cmdline = opt cmdline
cmdline = strip(cmdline)
call main
done:
call NetDropFuncs
call SysDropFuncs
exit
halt:
say "GetPerm interrupted"
signal done
usage:
say "Usage: GetPerm [-s] drive:path"
say " -s - Include Subdirectories"
signal done
syntax:
say ""
say "Sorry, I've got a headache,"
say "I don't think I can help you at the moment"
say ""
say "Line:" sigl " Error:" rc ':' errortext(rc)
signal done
main:
Server = ''
retc = NetAccessEnum(Server, cmdline, recursive, 1, aInfo)
if retc \= 0 then
signal neterr
do i = 0 to aInfo.Entries - 1
call charout '', cmdline||aInfo.i.resource_name
do j = 0 to aInfo.i.count - 1
call charout '', ' 'aInfo.i.access_list.j.ugname':'atos(aInfo.i.access_list.j.access)
end
say ''
end
return
/*
S T O A - String to Access
Convert a string of letters into the appropriate number
*/
stoa: procedure
access = 0
string = arg(1)
if string = 'ALL' then
return 255
if pos('R', string) \= 0 then
access = access + 1
if pos('W', string) \= 0 then
access = access + 2
if pos('C', string) \= 0 then
access = access + 4
if pos('X', string) \= 0 then
access = access + 8
if pos('D', string) \= 0 then
access = access + 16
if pos('A', string) \= 0 then
access = access + 32
if pos('P', string) \= 0 then
access = access + 64
if pos('Y', string) \= 0 then
access = 4
return access
atos: procedure
if arg(1) < 0 then
access = 32768 + arg(1)
else
access = arg(1)
string = ''
if access = 127 then
return 'RWCXDAP'
if access > 63 then do
string = 'P'
access = access - 64
end
if access > 31 then do
string = 'A'string
access = access - 32
end
if access > 15 then do
string = 'D'string
access = access - 16
end
if access > 7 then do
string = 'X'string
access = access - 8
end
if access > 3 then do
string = 'C'string
access = access - 4
end
if access > 1 then do
string = 'W'string
access = access - 2
end
if access > 0 then do
string = 'R'string
end
return string
neterr:
if retc \= 0 then do
if retc < 2100 then
say NetGetMessage(retc)
else
say NetGetMessage(retc, "NET.MSG")
end
call charout '', "Hit ENTER to continue "
parse pull operation
return