home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rxnet2.zip
/
NU.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-08-04
|
2KB
|
109 lines
/*
N E T U S E . C M D
Net Use in REXX
Usage: NU drive alias
NU drive UNCpath
NU drive /D
NU LPTx alias
NU LPTx UNCpath
NU LPTx /D
*/
call rxfuncadd SysLoadFuncs, REXXUTIL, SysLoadFuncs
call SysLoadFuncs
call rxfuncadd NetLoadFuncs, "RexxNet", NetLoadFuncs
call NetLoadFuncs
if rxfuncquery('NetAliasGetInfo') then do
say "Rexx Network DLL is not available"
signal finish
end
parse upper arg Drive Alias
if Drive = '' then do
call Display
retc = 0
signal finish
end
if Drive = '/?' then do
call Help
retc = 0
signal finish
end
retc = NetUseGetInfo('', Drive, 1, 'NetUse')
select
when retc = 0 then do
retc = NetUseDel('', Drive, 2)
if retc \= 0 then
signal error
end
when retc = 2250 then do
NetUse.Local = Drive
if Length(Drive) >= 4 then
NetUse.Asg_Type = 1
else
NetUse.Asg_Type = 0
end
otherwise
signal error
end
if Alias = '/D' then do
retc = NetUseDel('', Drive, 2)
if retc \= 0 then do
if retc \= 2250 then
signal error
end
signal finish
end
if Left(Alias, 2) = '\\' then
NetUse.Remote = Alias
else do
retc = NetAliasGetInfo('', Alias, 2, "NetAlias")
if retc \= 0 then
signal error
NetUse.Remote = NetAlias.Server||'\'||NetAlias.NetName
end
say NetUse.Local NetUse.Remote NetUse.Asg_type
retc = NetUseAdd('', 1, "NetUse")
if rect \= 0 then
signal error
say Drive NetUse.Remote
signal finish
display:
retc = NetUseEnum('', 1, "NetUse")
do i = 0 to NetUse.Entries - 1
if NetUse.i.Local \= '' then
say NetUse.i.Local " " NetUse.i.Remote
else
say " " NetUse.i.Remote
end
return
help:
say "Usage:"
say " NU Drive Alias"
say " NU Drive \\server\sharename"
say " NU Drive /D"
return
error:
if retc \= 0 then do
if retc < 2100 then
say SysGetMessage(retc)
else
say SysGetMessage(retc, "NET.MSG")
end
finish:
call NetDropFuncs
call SysDropFuncs
exit retc