home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / usercfg.zip / USERCFG.CMD < prev    next >
OS/2 REXX Batch file  |  1997-07-28  |  8KB  |  308 lines

  1. /* */
  2. call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
  3. call RxFuncAdd 'HPassLoadFuncs', 'HRxPass', 'HPassLoadFuncs'
  4. call SysLoadFuncs
  5. call HPassLoadFuncs
  6.  
  7.  
  8. SIGNAL on Halt name CLEANUP
  9. SIGNAL on Syntax name CLEANUP
  10. SIGNAL on Error name CLEANUP
  11.  
  12.  
  13. arg passfile
  14.  
  15. if passfile = '' then passfile='f:\mail\inetmail.pas'
  16.  
  17. MainMenu:
  18. leave_flag = ''
  19. passinfo.realname = ''
  20. passinfo.username = ''
  21. passinfo.password = ''
  22. passinfo.emaildir = ''
  23. passinfo.passtype = ''
  24. passinfo.forward = ''
  25. passinfo.foraddr = ''
  26. passinfo.locproc = ''
  27. passinfo.procname = ''
  28. passinfo.ccmail = ''
  29. passinfo.ccaddr = ''
  30.  
  31. call SysCls
  32. say ''
  33. say ''
  34. say ''
  35. say '    [ 1 ] Create/Update User'
  36. say '    [ 2 ] Delete User'       
  37. say '    [ 3 ] Query User'        
  38. say '    [ 4 ] List Users'        
  39. say '    [ 5 ] User Info'   
  40. say '    [ 6 ] Check User and password'   
  41. say ''
  42. say '    [ 9 ] EXIT'
  43. say ''
  44. say '      ?'
  45. rc = SysCurPos(12,6)
  46. Pull what .
  47. Select
  48.  
  49. /* CREATE USER */
  50.    when what = 1 then do
  51.         call SysCls
  52.         say ''
  53.         say ''
  54.         call username
  55.         call realname
  56.         call password
  57.         call emaildir
  58.         call passtype
  59.         if passinfo.passtype <> 'APOP' then passinfo.passtype = 'PASS'
  60.         call forward
  61.         if LEFT(passinfo.forward,1) = 'Y' then do
  62.            passinfo.forward = 'TRUE'
  63.            call foraddr
  64.         end /* if do */
  65.         else passinfo.forward ='FALSE'
  66.         call localproc
  67.         if LEFT(passinfo.localproc,1) = 'Y' then do
  68.            passinfo.localproc = 'TRUE'
  69.            call procname
  70.         end /* if do */
  71.         else passinfo.localproc = 'FALSE'
  72.         call ccmail
  73.         if LEFT(passinfo.ccmail,1) = 'Y' then do
  74.            passinfo.ccmail = 'TRUE'
  75.            call ccaddr
  76.         end /* if do */
  77.         else passinfo.ccmail = 'FALSE'
  78.         call SysCls
  79.         say ''
  80.         say ''
  81.         call showstem
  82.         say ''
  83.         say '     OK to create/update User? (Y/N)'
  84.         rc = charout(,'     ')
  85.         Parse upper Pull ok
  86.         if LEFT(ok,1) = 'Y' then NOP
  87.         else SIGNAL MainMenu
  88.         say ''
  89.         rc = HCreateUser(passfile, passinfo.)
  90.         say '     'rc
  91.         call pressenter
  92.         end /* do what = 1 */
  93.  
  94. /* DELETE USER */
  95.         when what = 2 then do
  96.         call SysCls
  97.         say ''
  98.         say ''
  99.         call username
  100.         call SysCls
  101.         rc = HUserInfo(passfile, passinfo.)
  102.         say ''     
  103.         say ''   
  104.         say '     'rc
  105.         if LEFT(rc,2)<>'OK' then do
  106.            rc=HQueryUser(passfile, passinfo.username)
  107.            say '     'rc
  108.            call pressenter
  109.            Signal MainMenu
  110.            end /* if do */
  111.         call showstem
  112.         say ''
  113.         say '     delete 'passinfo.username'? (Y/N)'
  114.         rc = charout(,'     ')
  115.         Parse upper Pull ok
  116.         if LEFT(ok,1) = 'Y' then NOP
  117.         else SIGNAL MainMenu
  118.         rc = HDeleteUser(passfile, passinfo.username)
  119.         say ''
  120.         say '     'rc
  121.         call pressenter
  122.         end /* do */
  123.  
  124.  
  125. /* QUERY USER */
  126.         when what = 3 then do
  127.         call SysCls
  128.         say ''
  129.         say ''
  130.         call username
  131.         rc = HQueryUser(passfile, passinfo.username)
  132.         say ''
  133.         say '     'rc
  134.         call pressenter        
  135.         end /* do what =3 */
  136.  
  137. /* LIST USERS */
  138.         when what = 4 then do
  139.         call SysCls
  140.         say ''
  141.         say ''
  142.         rc = HListUsers(passfile, user.)
  143.         say '     'rc
  144.         say ''
  145.         say '     there are 'user.0' users in 'passfile
  146.         say ''
  147.             do count = 1 to user.0
  148.                 say '     'CENTER(count,4)''user.count
  149.                 rc = datatype(count/15, whole number)
  150.                 if rc = 0 then iterate
  151.                 call pressenter_or_q
  152.                 if leave_flag = "q" then leave
  153.                 if leave_flag = "Q" then leave
  154.                 call SysCls
  155.                 say ''
  156.                 say ''
  157.                 say ''
  158.                 say ''
  159.                 say '     there are 'user.0' users in 'passfile  
  160.                 say ''                  
  161.                 end /* do */
  162.             call pressenter        
  163.         end /* do what = 4 */
  164.  
  165. /* USER INFO */
  166.         when what = 5 then do
  167.         call SysCls
  168.         say ''
  169.         say ''
  170.         call username
  171.         rc = HUserInfo(passfile, passinfo.)
  172.         say ''        
  173.         say '     'rc
  174.         if LEFT(rc,2)<>'OK' then do
  175.            rc=HQueryUser(passfile, passinfo.username)
  176.            say '     'rc
  177.            call pressenter
  178.            Signal MainMenu
  179.            end /* if do */
  180.         call showstem
  181.         call pressenter
  182.         end /* do what = 5 */
  183.  
  184. /* CHECK USER */
  185.         when what = 6 then do
  186.         call SysCls
  187.         say ''
  188.         say ''
  189.         call username
  190.         call password
  191.         rc = HCheckUser(passfile, passinfo.)
  192.         say ''
  193.         say '     'rc
  194.         call pressenter
  195.         end /* do what = 6*/
  196.  
  197. /* EXIT */
  198.         when what = 9 then SIGNAL CLEANUP
  199.  
  200. otherwise SIGNAL MainMenu
  201. end  /* select */
  202. SIGNAL MainMenu
  203.  
  204. /* ----------------------------- */
  205. exit 0
  206.  
  207. realname:
  208.         say "     enter the user's real name:"
  209.         rc = charout(,'     ')
  210.         Parse Pull realname
  211.         passinfo.realname = realname
  212. Return
  213. username:
  214.         say '     enter the username:'
  215.         rc = charout(,'     ')
  216.         Parse Pull username
  217.         passinfo.username = username
  218. Return
  219. password:
  220.         say '     enter the password:'
  221.         rc = charout(,'     ')
  222.         Parse Pull password
  223.         passinfo.password = password
  224. Return
  225. emaildir:
  226.         say '     enter the email home directory:'
  227.         rc = charout(,'     ')
  228.         Parse Pull emaildir
  229.         passinfo.emaildir = emaildir
  230. Return
  231. passtype:
  232.         say '     enter the type of password (APOP or PASS)'
  233.         rc = charout(,'     ')
  234.         Parse upper Pull passtype
  235.         passinfo.passtype = passtype
  236. Return
  237. forward:
  238.         say '     Forward mail (Y/N)?'
  239.         rc = charout(,'     ')
  240.         Parse upper Pull passinfo.forward
  241. Return
  242. foraddr:
  243.         say '     enter the forwarding address:'
  244.         rc = charout(,'     ')
  245.         Parse Pull foraddr
  246.         passinfo.foraddr = foraddr
  247. Return
  248. localproc:
  249.         say '     Local processing (Y/N)?'
  250.         rc = charout(,'     ')
  251.         Parse upper Pull passinfo.localproc 
  252. Return
  253. procname:
  254.         say '     enter the full pathname of the local process:'
  255.         rc = charout(,'     ')
  256.         Parse Pull procname
  257.         passinfo.procname = procname
  258. Return
  259. ccmail:
  260.         say '     cc the mail (Y/N)?'
  261.         rc = charout(,'     ')
  262.         Parse upper Pull passinfo.ccmail
  263. Return
  264. ccaddr:
  265.         say '     enter the cc mail address'
  266.         rc = charout(,'     ')
  267.         Parse Pull ccaddr
  268.         passinfo.ccaddr = ccaddr
  269. Return
  270. showstem:
  271.         say ''
  272.         say ''
  273.         say '     realname : 'passinfo.realname
  274.         say '     username : 'passinfo.username
  275.         say '     password : 'passinfo.password
  276.         say '     emaildir : 'passinfo.emaildir
  277.         say '     Paswtype : 'passinfo.passtype
  278.         say '     FWD Mail : 'passinfo.forward
  279.         say '     FWD ADDR : 'passinfo.foraddr
  280.         say '     locproc  : 'passinfo.localproc
  281.         say '     procname : 'passinfo.procname
  282.         say '     CC mail  : 'passinfo.ccmail
  283.         say '     CC ADDR  : 'passinfo.ccaddr
  284. Return
  285. pressenter:
  286.         if leave_flag = "q" then Return
  287.         if leave_flag = "Q" then Return
  288.         say ''
  289.         call SysCurState off
  290.         rc=charout(,'     press enter to continue')
  291.         pull .
  292.         call SysCurState on
  293. Return
  294. pressenter_or_q:
  295.         leave_flag = ''
  296.         say ''
  297.         call SysCurState off
  298.         rc=charout(,'     press enter to continue, or "Q" to quit')
  299.         rc = SysCurPos(22,34)
  300.         pull leave_flag
  301.         call SysCurState on
  302. Return
  303.  
  304. CLEANUP:
  305. say ''
  306. say '     Stopped...'
  307. say ''
  308.