home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Collection - Online Library - January 1996 / CKITOS2196.ISO / diskette / gg244043.dsk / unc.dsk / LS30UTIL / SETLASN.CMD < prev    next >
OS/2 REXX Batch file  |  1993-03-03  |  4KB  |  110 lines

  1. /*******************************************************************/
  2. /* SETLASN.CMD                                                     */
  3. /*                                                                 */
  4. /* Set logon assignments for users.                                */
  5. /* The procedure sets the logon assignments for users listed in a  */
  6. /* file togother with another file specifing the assignments. The  */
  7. /* files must be in ASCII. It is recommended to pipe the output of */
  8. /* SETLASN to a file.                                              */
  9. /*                                                                 */
  10. /* The arguments are:                                              */
  11. /*                                                                 */
  12. /*  userList        The file name of the users                     */
  13. /*                  The file contains a user name in each line.    */
  14. /*                                                                 */
  15. /*  assignments     The file containing the assignments. Supported */
  16. /*                  line options are:                              */
  17. /*                                                                 */
  18. /*                  type device aliasname                          */
  19. /*                                                                 */
  20. /*                  type A= for public application assignment      */
  21. /*                       D= for device assignment, such as         */
  22. /*                          G:, COM5, LPT3 or none                 */
  23. /*                  Examples:                                      */
  24. /*                                                                 */
  25. /*                  D=   G:     FILESDIR                           */
  26. /*                  D=          FILESDIR                           */
  27. /*                  D=   COM3   COMPORT                            */
  28. /*                  D=   LPT6   LPTPRT                             */
  29. /*                  A=          PUBLICAP                           */
  30. /*                                                                 */
  31. /*******************************************************************/
  32.  
  33. parse upper arg userList assignments
  34.  
  35. call LoadFuncs; /* Load DLL utility functions */
  36.  
  37. /* Must have all arguments with values */
  38. if ((userList='') | (assignments='')) then do
  39.  call dspHelp;
  40.  exit 9
  41. end
  42.  
  43. /* Ready to read user list file */
  44. userid = linein(userList,1,1)
  45. if userid = '' then do
  46.  say 'Could not obtain User List File'
  47.  exit 9
  48. end
  49.  
  50. /* Ready to read assignment list file */
  51. parse upper value linein(assignments,1,1) with type device aliasname
  52. if type = '' then do
  53.  say 'Could not obtain correct assignment list file'
  54.  exit 9
  55. end
  56.  
  57. do while type <> ''
  58.  
  59.  userid = linein(userList,1,1)
  60.  do while userid <> ''
  61.   /* Do the work here */
  62.   if aliasname = '' then do
  63.    aliasname = device
  64.    device = ''
  65.   end
  66.  
  67.   rc = SetLogonAsn(userid, type, device, STRIP(aliasname) )
  68.   if rc <> '0' then do
  69.    say 'SetLogonAsn returned ' rc
  70.   end
  71.  
  72.   userid = linein(userList)
  73.  end
  74.  parse upper value linein(assignments) with type device aliasname
  75. end
  76.  
  77. call DropFuncs
  78. exit 0
  79.  
  80. /*************************************************************/
  81. /* Load DLL Functions                                        */
  82. /*************************************************************/
  83. LoadFuncs:
  84.  
  85.  /* Load LS30UT.DLL functions */
  86.  call RxFuncAdd 'LoadLs30utFuncs', 'LS30UT', 'LoadLs30utFuncs'
  87.  call LoadLs30utFuncs
  88.  
  89. return
  90.  
  91. /*************************************************************/
  92. /* Drop DLL Functions                                        */
  93. /*************************************************************/
  94. DropFuncs:
  95.  
  96.  /* Drop LS30UT.DLL functions */
  97.  call DropLs30utFuncs
  98.  
  99. return
  100.  
  101. /*************************************************************/
  102. /* Display help                                              */
  103. /*************************************************************/
  104. dspHelp:
  105.  
  106.   say 'Use SETLASN userFile assignmentsFile'
  107.  
  108. return
  109.  
  110.