home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / netdor3.zip / DISK_12 / IMAGE11.ZIP / ADMTOOLS / TYPEINI.CMD < prev    next >
OS/2 REXX Batch file  |  1993-08-20  |  6KB  |  124 lines

  1. /*****************************************************************************
  2.  *                       TYPEINI - Display an INI file                       *
  3.  *                 T. Rogers / T. Bridgman (CORE at WATSON)                  *
  4.  *****************************************************************************
  5.  *                    Licensed Materials-Property of IBM                     *
  6.  *               5604-472 (c) Copyright IBM Corporation, 1993                *
  7.  *                           All rights reserved.                            *
  8.  *                  US Government Users Restricted Rights -                  *
  9.  *                 Use, duplication or disclosure restricted                 *
  10.  *                by GSA ADP Schedule Contract with IBM Corp.                *
  11.  *****************************************************************************
  12.  * Change History:                                                           *
  13.  * Version 1.0 - 29 Sep 90 - tjr                                             *
  14.  * Version 1.1 - 20 Dec 91 - teb                                             *
  15.  * - bug fix: detect errors properly w/ latest RXUTILS                       *
  16.  * - Add ability to query select applications in the INI file                *
  17.  * - Add on-line help                                                        *
  18.  *****************************************************************************/
  19. trace 'O'
  20. parse upper arg IniFile AppList '/' Opts
  21. if IniFile = '' | IniFile = '?'
  22.   then signal Tell
  23.  
  24. say 
  25. say 'TYPEINI - Display INI file contents'
  26. say
  27. call LoadRxUtils
  28.  
  29. if rxFileExist(IniFile) | wordpos(IniFile, 'USER SYSTEM') <> 0
  30.   then if abbrev(rxOs2Ini(IniFile, '$RXALL', 'APPS.'), '$')
  31.     then do
  32.       say 'Error reading INI file' IniFile'.'
  33.       exit 2
  34.     end
  35.     else if Apps.0 = 0
  36.       then do
  37.         say 'INI file does not contain data.'
  38.         exit 2
  39.       end
  40.       else nop
  41.   else do
  42.     say 'INI file' IniFile 'does not exist.'
  43.     exit 2
  44.   end
  45.  
  46. parse value '0' with AsIs .
  47. if Opts <> ''
  48.   then do
  49.     Opts = '/'Opts
  50.     AsIs = wordpos('/ASIS', Opts)
  51.   end
  52.  
  53. AppLimit = (AppList <> '')
  54. say 'Contents of INI file' IniFile':'
  55. do I = 1 to Apps.0
  56.   if AppLimit
  57.     then do
  58.       AP = wordpos(translate(Apps.I), AppList) 
  59.       if AP = 0
  60.         then iterate I
  61.       AppList = delword(AppList, AP, 1)
  62.     end
  63.   if abbrev(rxOs2Ini(IniFile, Apps.I, '$RXALL', 'KEYS.'), '$')
  64.     then do
  65.       say 'Error reading' Apps.I 'from' IniFile'.'
  66.       iterate
  67.     end
  68.   say Apps.I':'
  69.   do J = 1 to Keys.0
  70.     Val = rxOs2Ini(IniFile, Apps.I, Keys.J)
  71.     if \AsIs
  72.       then Val = translate(Val,, '0007090A0D'x, 'FE'x)
  73.     say '  'Keys.J':' Val
  74.   end
  75. end
  76. do while AppList <> ''
  77.   parse var AppList BadApp AppList
  78.   say BadApp':  Not found.'
  79. end
  80. exit 0
  81.  
  82. LoadRxUtils: procedure                                                   
  83. if \rxfuncadd('RXLOADFUNCS', 'RXUTILS', 'RXLOADFUNCS')                   
  84.   then do                                                                
  85.     signal on syntax name LoadRxUtils2                                   
  86.     call rxLoadFuncs 'QUIET'                                             
  87.   end                                                                    
  88. return 0                                                                 
  89.                                                                          
  90. LoadRxUtils2:                                                            
  91. signal off syntax    /* Turn off temp error trap */                      
  92. /* If you have an error trap in the program, use the following line inste
  93. signal on syntax name syntax                                             
  94. */                                                                       
  95. select                                                                   
  96.   when rc = 40                                                           
  97.     then call rxLoadFuncs                                                
  98.   when rc = 43                                                           
  99.     then do                                                              
  100.       say 'Error:  RXUTILS.DLL not found.'                               
  101.       exit 2                                                             
  102.     end                                                                  
  103.   otherwise do                                                           
  104.     say 'Error: Error' rc 'registering RXUTILS functions.'               
  105.     exit 2                                                               
  106.   end                                                                    
  107. end                                                                      
  108. return 0                                                                 
  109.  
  110. Tell:
  111. say
  112. say 'TYPEINI inifile [applist] [/ASIS]'
  113. say
  114. say 'Display the contents of the specified INI file.'
  115. say
  116. say 'inifile  - The name of the INI file to display.  USER and SYSTEM can'
  117. say '           be specified for OS2.INI and OS2SYS.INI respectively.'
  118. say 'applist  - List of applications to display, separated by spaces.'
  119. say '           If not specified, all applications will be displayed.'
  120. say '/ASIS    - By default, certain nonprintable characters (nulls, tabs,'
  121. say '           carriage returns, and line feeds) will be replaced with a'
  122. say '           "'||'FE'x||'".  To see the raw data, specify /ASIS.'
  123. exit 0
  124.