home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
usercfg.zip
/
USERCFG.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-07-28
|
8KB
|
308 lines
/* */
call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
call RxFuncAdd 'HPassLoadFuncs', 'HRxPass', 'HPassLoadFuncs'
call SysLoadFuncs
call HPassLoadFuncs
SIGNAL on Halt name CLEANUP
SIGNAL on Syntax name CLEANUP
SIGNAL on Error name CLEANUP
arg passfile
if passfile = '' then passfile='f:\mail\inetmail.pas'
MainMenu:
leave_flag = ''
passinfo.realname = ''
passinfo.username = ''
passinfo.password = ''
passinfo.emaildir = ''
passinfo.passtype = ''
passinfo.forward = ''
passinfo.foraddr = ''
passinfo.locproc = ''
passinfo.procname = ''
passinfo.ccmail = ''
passinfo.ccaddr = ''
call SysCls
say ''
say ''
say ''
say ' [ 1 ] Create/Update User'
say ' [ 2 ] Delete User'
say ' [ 3 ] Query User'
say ' [ 4 ] List Users'
say ' [ 5 ] User Info'
say ' [ 6 ] Check User and password'
say ''
say ' [ 9 ] EXIT'
say ''
say ' ?'
rc = SysCurPos(12,6)
Pull what .
Select
/* CREATE USER */
when what = 1 then do
call SysCls
say ''
say ''
call username
call realname
call password
call emaildir
call passtype
if passinfo.passtype <> 'APOP' then passinfo.passtype = 'PASS'
call forward
if LEFT(passinfo.forward,1) = 'Y' then do
passinfo.forward = 'TRUE'
call foraddr
end /* if do */
else passinfo.forward ='FALSE'
call localproc
if LEFT(passinfo.localproc,1) = 'Y' then do
passinfo.localproc = 'TRUE'
call procname
end /* if do */
else passinfo.localproc = 'FALSE'
call ccmail
if LEFT(passinfo.ccmail,1) = 'Y' then do
passinfo.ccmail = 'TRUE'
call ccaddr
end /* if do */
else passinfo.ccmail = 'FALSE'
call SysCls
say ''
say ''
call showstem
say ''
say ' OK to create/update User? (Y/N)'
rc = charout(,' ')
Parse upper Pull ok
if LEFT(ok,1) = 'Y' then NOP
else SIGNAL MainMenu
say ''
rc = HCreateUser(passfile, passinfo.)
say ' 'rc
call pressenter
end /* do what = 1 */
/* DELETE USER */
when what = 2 then do
call SysCls
say ''
say ''
call username
call SysCls
rc = HUserInfo(passfile, passinfo.)
say ''
say ''
say ' 'rc
if LEFT(rc,2)<>'OK' then do
rc=HQueryUser(passfile, passinfo.username)
say ' 'rc
call pressenter
Signal MainMenu
end /* if do */
call showstem
say ''
say ' delete 'passinfo.username'? (Y/N)'
rc = charout(,' ')
Parse upper Pull ok
if LEFT(ok,1) = 'Y' then NOP
else SIGNAL MainMenu
rc = HDeleteUser(passfile, passinfo.username)
say ''
say ' 'rc
call pressenter
end /* do */
/* QUERY USER */
when what = 3 then do
call SysCls
say ''
say ''
call username
rc = HQueryUser(passfile, passinfo.username)
say ''
say ' 'rc
call pressenter
end /* do what =3 */
/* LIST USERS */
when what = 4 then do
call SysCls
say ''
say ''
rc = HListUsers(passfile, user.)
say ' 'rc
say ''
say ' there are 'user.0' users in 'passfile
say ''
do count = 1 to user.0
say ' 'CENTER(count,4)''user.count
rc = datatype(count/15, whole number)
if rc = 0 then iterate
call pressenter_or_q
if leave_flag = "q" then leave
if leave_flag = "Q" then leave
call SysCls
say ''
say ''
say ''
say ''
say ' there are 'user.0' users in 'passfile
say ''
end /* do */
call pressenter
end /* do what = 4 */
/* USER INFO */
when what = 5 then do
call SysCls
say ''
say ''
call username
rc = HUserInfo(passfile, passinfo.)
say ''
say ' 'rc
if LEFT(rc,2)<>'OK' then do
rc=HQueryUser(passfile, passinfo.username)
say ' 'rc
call pressenter
Signal MainMenu
end /* if do */
call showstem
call pressenter
end /* do what = 5 */
/* CHECK USER */
when what = 6 then do
call SysCls
say ''
say ''
call username
call password
rc = HCheckUser(passfile, passinfo.)
say ''
say ' 'rc
call pressenter
end /* do what = 6*/
/* EXIT */
when what = 9 then SIGNAL CLEANUP
otherwise SIGNAL MainMenu
end /* select */
SIGNAL MainMenu
/* ----------------------------- */
exit 0
realname:
say " enter the user's real name:"
rc = charout(,' ')
Parse Pull realname
passinfo.realname = realname
Return
username:
say ' enter the username:'
rc = charout(,' ')
Parse Pull username
passinfo.username = username
Return
password:
say ' enter the password:'
rc = charout(,' ')
Parse Pull password
passinfo.password = password
Return
emaildir:
say ' enter the email home directory:'
rc = charout(,' ')
Parse Pull emaildir
passinfo.emaildir = emaildir
Return
passtype:
say ' enter the type of password (APOP or PASS)'
rc = charout(,' ')
Parse upper Pull passtype
passinfo.passtype = passtype
Return
forward:
say ' Forward mail (Y/N)?'
rc = charout(,' ')
Parse upper Pull passinfo.forward
Return
foraddr:
say ' enter the forwarding address:'
rc = charout(,' ')
Parse Pull foraddr
passinfo.foraddr = foraddr
Return
localproc:
say ' Local processing (Y/N)?'
rc = charout(,' ')
Parse upper Pull passinfo.localproc
Return
procname:
say ' enter the full pathname of the local process:'
rc = charout(,' ')
Parse Pull procname
passinfo.procname = procname
Return
ccmail:
say ' cc the mail (Y/N)?'
rc = charout(,' ')
Parse upper Pull passinfo.ccmail
Return
ccaddr:
say ' enter the cc mail address'
rc = charout(,' ')
Parse Pull ccaddr
passinfo.ccaddr = ccaddr
Return
showstem:
say ''
say ''
say ' realname : 'passinfo.realname
say ' username : 'passinfo.username
say ' password : 'passinfo.password
say ' emaildir : 'passinfo.emaildir
say ' Paswtype : 'passinfo.passtype
say ' FWD Mail : 'passinfo.forward
say ' FWD ADDR : 'passinfo.foraddr
say ' locproc : 'passinfo.localproc
say ' procname : 'passinfo.procname
say ' CC mail : 'passinfo.ccmail
say ' CC ADDR : 'passinfo.ccaddr
Return
pressenter:
if leave_flag = "q" then Return
if leave_flag = "Q" then Return
say ''
call SysCurState off
rc=charout(,' press enter to continue')
pull .
call SysCurState on
Return
pressenter_or_q:
leave_flag = ''
say ''
call SysCurState off
rc=charout(,' press enter to continue, or "Q" to quit')
rc = SysCurPos(22,34)
pull leave_flag
call SysCurState on
Return
CLEANUP:
say ''
say ' Stopped...'
say ''