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

  1. /*******************************************************************/
  2. /* LISTAPPS.CMD  List applications defined in the current domain.  */
  3. /*                                                                 */
  4. /* The argument is the type of application to be listed. The       */
  5. /* following values are supported:                                 */
  6. /*                                                                 */
  7. /*  DOS       List the names of all public DOS applications        */
  8. /*  OS2       List the names of all public OS/2 applications       */
  9. /*  PRIVATE   List all private applications with user IDs          */
  10. /*  ALL       List all of above                                    */
  11. /*                                                                 */
  12. /*******************************************************************/
  13.  
  14. parse upper arg appType dummyArg
  15.  
  16. call LoadFuncs; /* Load DLL utility functions */
  17.  
  18. if appType = '' then do
  19.  call dspHelp;
  20.  exit 9
  21. end
  22.  
  23. parse value GetDCName() with rc dcName
  24. if ( (rc <> '0') | (dcName = '') ) then do
  25.  say 'Could not obtain domain controller machine ID'
  26.  exit 99
  27. end
  28.  
  29. select
  30.  when appType = 'DOS' then do
  31.   rc = NetEnum('applications', dcName, 'appList', 'PUBLICDOS')
  32.  end
  33.  when appType = 'OS2' then do
  34.   rc = NetEnum('applications', dcName, 'appList', 'PUBLICOS2')
  35.  end
  36.  when appType = 'PRIVATE' then do
  37.   rc = NetEnum('applications', dcName, 'appList', 'PRIVATE')
  38.  end
  39.  when appType = 'ALL' then do
  40.   rc = NetEnum('applications', dcName, 'appList', 'ALL')
  41.  end
  42.  otherwise
  43.   say 'Unsupported option'
  44.   call dspHelp;
  45.   exit 9
  46. end
  47.  
  48. if rc = '0' then do
  49.  if appList.0 = 0 then do /* No apps found */
  50.   say
  51.   say 'No application found'
  52.  end
  53.  else do
  54.   do i=1 to appList.0
  55.    say appList.i
  56.   end
  57.  end
  58. end
  59. else do
  60.  say 'Error occured. Returncode from NetEnum() was: ' rc
  61. end
  62.  
  63. call DropFuncs
  64. exit 0
  65.  
  66. /*************************************************************/
  67. /* Load DLL Functions                                        */
  68. /*************************************************************/
  69. LoadFuncs:
  70.  
  71.  /* Load LS30UT.DLL functions */
  72.  call RxFuncAdd 'LoadLs30utFuncs', 'LS30UT', 'LoadLs30utFuncs'
  73.  call LoadLs30utFuncs
  74.  
  75. return
  76.  
  77. /*************************************************************/
  78. /* Drop DLL Functions                                        */
  79. /*************************************************************/
  80. DropFuncs:
  81.  
  82.  /* Drop LS30UT.DLL functions */
  83.  call DropLs30utFuncs
  84.  
  85. return
  86.  
  87. /*************************************************************/
  88. /* Display help                                              */
  89. /*************************************************************/
  90. dspHelp:
  91.  
  92.  say 'Use LISTAPPS application_type'
  93.  say
  94.  say 'where application_type can be:'
  95.  say
  96.  say 'DOS       List the names of all public DOS applications'
  97.  say 'OS2       List the names of all public OS/2 applications'
  98.  say 'PRIVATE   List all private applications with user IDs'
  99.  say 'ALL       List all of above'
  100.  
  101. return
  102.  
  103.