home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / listcfg.zip / LISTCFG.CMD
OS/2 REXX Batch file  |  1996-01-12  |  44KB  |  657 lines

  1. /*------------------------------------------------------------------------*\
  2. |                                                                          |
  3. |           LISTCFG.CMD  - Version 1.0 - Version Date 1995-09-22           |
  4. |                 Copyright (C) 1995 by C F S Nevada, Inc.                 |
  5. |                                                                          |
  6. |                  by Dick Goran  - Voice    702-732-9616                  |
  7. |                                 - FAX      702-732-3847                  |
  8. |                                 - CIS      71154,2002                    |
  9. |                                 - Internet dgoran@cfsrexx.com            |
  10. |                                 - WWW      <http://www.cfsrexx.com>      |
  11. |                                                                          |
  12. \*------------------------------------------------------------------------*/
  13. /*
  14.  
  15.    This program will create a CONFIG.TXT file which will contain date &
  16.    time stamps for all files referenced in CONFIG.SYS as well as breaking
  17.    all multiple directory lines (e.g PATH, LIBPATH, etc.) into short
  18.    lines. The output .TXT file will be created in th esame directory where
  19.    the CONFIG.SYS file is located.
  20.  
  21.    Default is to use CONFIG.SYS on the boot drive; however, an alternate
  22.    CONFIG.SYS can be specified by supplying its full file system name
  23.    on the command line.
  24.  
  25. */                                                                /* 0025 */
  26.                                                                   /* 0026 */
  27. GBL. = ''             /* initialize stem */                       /* 0027 */
  28. parse Arg             GBL.command_line                            /* 0028 */
  29. parse Version         GBL.REXX_version,                           /* 0029 */
  30.                       GBL.REXX_version_level,                     /* 0030 */
  31.                       GBL.REXX_version_day,                       /* 0031 */
  32.                       GBL.REXX_version_month,                     /* 0032 */
  33.                       GBL.REXX_version_year .                     /* 0033 */
  34. parse Source          GBL.operating_system,                       /* 0034 */
  35.                       GBL.calling_environment,                    /* 0035 */
  36.                       GBL.program_path_and_name                   /* 0036 */
  37. GBL.environment     = 'OS2ENVIRONMENT'                            /* 0037 */
  38. GBL.boot_drive      = LEFT( VALUE( 'RUNWORKPLACE',, GBL.environment ), 2 )
  39. GBL.program_version = 1.0           /* version / mod of this program */
  40. GBL.program_name    = STRIP( FILESPEC( 'N', GBL.program_path_and_name ) )
  41. GBL.program_path    = STRIP( FILESPEC( 'D', GBL.program_path_and_name ) ||,
  42.                              FILESPEC( 'P', GBL.program_path_and_name ) )
  43.                                                                   /* 0043 */
  44. parse var GBL.program_name,                                       /* 0044 */
  45.    GBL.program_fn '.',                                            /* 0045 */
  46.    GBL.program_fe                                                 /* 0046 */
  47.                                                                   /* 0047 */
  48. call TIME 'E'                       /* set elapsed timer - sssss.uuuuu */
  49. say 'Begin' TRANSLATE( GBL.program_name ) 'at' TIME('N')          /* 0049 */
  50.                                                                   /* 0050 */
  51. call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'         /* 0051 */
  52. call SysLoadFuncs                                                 /* 0052 */
  53.                                                                   /* 0053 */
  54. /*------------------------*\                                      /* 0054 */
  55. |  Enable trap processing  |                                      /* 0055 */
  56. |    if REXXLIB present    |                                      /* 0056 */
  57. \*------------------------*/                                      /* 0057 */
  58.    SIGNAL ON ERROR                                                /* 0058 */
  59.    SIGNAL ON FAILURE                                              /* 0059 */
  60.    SIGNAL ON HALT                                                 /* 0060 */
  61.    SIGNAL ON NOVALUE                                              /* 0061 */
  62.    SIGNAL ON SYNTAX                                               /* 0062 */
  63.                                                                   /* 0063 */
  64. /*------------------------------------*\                          /* 0064 */
  65. |  Assure validity of CONFIG.SYS file  |                          /* 0065 */
  66. \*------------------------------------*/                          /* 0066 */
  67. if GBL.command_line = '' then                                     /* 0067 */
  68.    do                                                             /* 0068 */
  69.       input_file =,                                               /* 0069 */
  70.          STREAM( GBL.boot_drive || '\CONFIG.SYS', 'C', 'QUERY EXISTS' )
  71.    end                                                            /* 0071 */
  72. else                                                              /* 0072 */
  73.    do                                                             /* 0073 */
  74.       input_file =,                                               /* 0074 */
  75.          STREAM( GBL.command_line, 'C', 'QUERY EXISTS' )          /* 0075 */
  76.    end                                                            /* 0076 */
  77. if input_file = '' then                                           /* 0077 */
  78.    do                                                             /* 0078 */
  79.       say '   Unable to locate CONFIG.SYS on' GBL.boot_drive      /* 0079 */
  80.       call EOJ                                                    /* 0080 */
  81.    end                                                            /* 0081 */
  82.                                                                   /* 0082 */
  83. /*--------------------*\                                          /* 0083 */
  84. |  Create output file  |                                          /* 0084 */
  85. \*--------------------*/                                          /* 0085 */
  86. output_file =,                                                    /* 0086 */
  87.    FILESPEC( 'D', input_file ) ||,                                /* 0087 */
  88.    FILESPEC( 'P', input_file ) ||,                                /* 0088 */
  89.    'CONFIG.TXT'                                                   /* 0089 */
  90. call SysFileDelete output_file                                    /* 0090 */
  91.                                                                   /* 0091 */
  92. dbl_h     = '═'                     /* double line - horizontal            */
  93. dbl_v     = '║'                     /* double line - vertical              */
  94. dbl_bl    = '╚'                     /* double line - bottom left           */
  95. dbl_br    = '╝'                     /* double line - bottom right          */
  96. dbl_tl    = '╔'                     /* double line - top left              */
  97. dbl_tr    = '╗'                     /* double line - top right             */
  98. title     =,                                                      /* 0098 */
  99.    ' This file was created from '              ||,                /* 0099 */
  100.    input_file                                  ||,                /* 0100 */
  101.    '   ('                                      ||,                /* 0101 */
  102.    STREAM( input_file, 'C', 'QUERY DATETIME' ) ||,                /* 0102 */
  103.    ') '                                                           /* 0103 */
  104.                                                                   /* 0104 */
  105. h=0                                                               /* 0105 */
  106. h=h+1; heading.h =,                                               /* 0106 */
  107.           dbl_tl || COPIES( dbl_h, LENGTH(title) ) || dbl_tr      /* 0107 */
  108. h=h+1; heading.h =,                                               /* 0108 */
  109.           dbl_v  ||         title                  || dbl_v       /* 0109 */
  110. h=h+1; heading.h =,                                               /* 0110 */
  111.           dbl_bl || COPIES( dbl_h, LENGTH(title) ) || dbl_br      /* 0111 */
  112. h=h+1; heading.h = ''                                             /* 0112 */
  113.        heading.0 = h                                              /* 0113 */
  114. do h = 1 to heading.0                                             /* 0114 */
  115.    call LINEOUT output_file, heading.h                            /* 0115 */
  116. end                                                               /* 0116 */
  117.                                                                   /* 0117 */
  118. /*--------------------------------*\                              /* 0118 */
  119. |  Format CONFIG.SYS line-by-line  |                              /* 0119 */
  120. \*--------------------------------*/                              /* 0120 */
  121. known_file_name_lines =,                                          /* 0121 */
  122.    'COUNTRY=',                                                    /* 0122 */
  123.    'DEVICE=',                                                     /* 0123 */
  124.    'IFS=',                                                        /* 0124 */
  125.    'LIBPATH=',                                                    /* 0125 */
  126.    'PROTSHELL=',                                                  /* 0126 */
  127.    'RUN=',                                                        /* 0127 */
  128.    'SHELL=',                                                      /* 0128 */
  129.    ''                                                             /* 0129 */
  130.                                                                   /* 0130 */
  131. do while LINES( input_file ) > 0                                  /* 0131 */
  132.    input_line = LINEIN( input_file )                              /* 0132 */
  133.    uppercase_input_line = SPACE( TRANSLATE( input_line ) )        /* 0133 */
  134.                                                                   /* 0134 */
  135.    /*------------------------------------*\                       /* 0135 */
  136.    |  Setup correct length, blank fields  |                       /* 0136 */
  137.    \*------------------------------------*/                       /* 0137 */
  138.    output_name = ''                                               /* 0138 */
  139.    output_date = COPIES( ' ', 10 )                                /* 0139 */
  140.    output_time = COPIES( ' ',  8 )                                /* 0140 */
  141.    output_max_width = 76 - ( LENGTH(output_date) + LENGTH(output_time) )
  142.                                                                   /* 0142 */
  143.    /*---------------------------------*\                          /* 0143 */
  144.    |  Check for lines with file names  |                          /* 0144 */
  145.    \*---------------------------------*/                          /* 0145 */
  146.    file_name_ext = ''                                             /* 0146 */
  147.    do w = 1 to WORDS( known_file_name_lines )                     /* 0147 */
  148.       keyword = WORD( known_file_name_lines, w )                  /* 0148 */
  149.       if LEFT( uppercase_input_line, LENGTH(keyword) ) = keyword then
  150.          do                                                       /* 0150 */
  151.             parse value input_line with,                          /* 0151 */
  152.                '=',                                               /* 0152 */
  153.                possible_full_path_name,                           /* 0153 */
  154.                .                                                  /* 0154 */
  155.             file_name_ext =,                                      /* 0155 */
  156.                FILESPEC( 'N', possible_full_path_name )           /* 0156 */
  157.             leave w                                               /* 0157 */
  158.          end                                                      /* 0158 */
  159.    end                                                            /* 0159 */
  160.    if file_name_ext = '' then                                     /* 0160 */
  161.       do                                                          /* 0161 */
  162.          /* let FILESPEC() try to find the file name */           /* 0162 */
  163.          file_name_ext = FILESPEC( 'N', input_line )              /* 0163 */
  164.       end                                                         /* 0164 */
  165.                                                                   /* 0165 */
  166.    if file_name_ext ¬= '',                                        /* 0166 */
  167.          &,                                                       /* 0167 */
  168.       LEFT( uppercase_input_line, 3 ) ¬= 'REM' then               /* 0168 */
  169.       do                                                          /* 0169 */
  170.          /*---------------------------------*\                    /* 0170 */
  171.          |  Remove any follow-on parameters  |                    /* 0171 */
  172.          \*---------------------------------*/                    /* 0172 */
  173.          parse value file_name_ext with,                          /* 0173 */
  174.             file_name_ext,                                        /* 0174 */
  175.             .                                                     /* 0175 */
  176.                                                                   /* 0176 */
  177.          /*--------------------------------------------*\         /* 0177 */
  178.          |  Point backward from fn.fe to get full path  |         /* 0178 */
  179.          \*--------------------------------------------*/         /* 0179 */
  180.          file_name_ptr = POS( file_name_ext, input_line )         /* 0180 */
  181.          if LEFT( uppercase_input_line, 8 ) = 'BASEDEV=' then     /* 0181 */
  182.             do                                                    /* 0182 */
  183.                parse value input_line with,                       /* 0183 */
  184.                   '=',                                            /* 0184 */
  185.                   file_name_ext,                                  /* 0185 */
  186.                   .                                               /* 0186 */
  187.                file_name_ext =,                                   /* 0187 */
  188.                   GBL.boot_drive || '\OS2\BOOT\' ||,              /* 0188 */
  189.                   file_name_ext                                   /* 0189 */
  190.             end                                                   /* 0190 */
  191.          else                                                     /* 0191 */
  192.             do                                                    /* 0192 */
  193.                drive_ptr = LASTPOS( ':', input_line, file_name_ptr ) - 1
  194.                if drive_ptr > 0 then                              /* 0194 */
  195.                   do                                              /* 0195 */
  196.                      file_name_ext =,                             /* 0196 */
  197.                         SUBSTR( input_line,,                      /* 0197 */
  198.                                 drive_ptr,,                       /* 0198 */
  199.                                 file_name_ptr - drive_ptr ) ||,   /* 0199 */
  200.                         file_name_ext                             /* 0200 */
  201.                   end                                             /* 0201 */
  202.                else                                               /* 0202 */
  203.                   do                                              /* 0203 */
  204.                      file_name_ext =,                             /* 0204 */
  205.                         GBL.boot_drive || '\' ||,                 /* 0205 */
  206.                         file_name_ext                             /* 0206 */
  207.                   end                                             /* 0207 */
  208.             end                                                   /* 0208 */
  209.                                                                   /* 0209 */
  210.          /*-------------------------------------------*\          /* 0210 */
  211.          |  Get & format time stamp if file was found  |          /* 0211 */
  212.          \*-------------------------------------------*/          /* 0212 */
  213.          if POS( '.', file_name_ext ) > 0 then                    /* 0213 */
  214.             do                                                    /* 0214 */
  215.                call FORMAT_DATE_AND_TIME file_name_ext            /* 0215 */
  216.             end                                                   /* 0216 */
  217.       end                                                         /* 0217 */
  218.                                                                   /* 0218 */
  219.       /*--------------------------------------------------*\      /* 0219 */
  220.       |  Find equal sign position as continuation pointer  |      /* 0220 */
  221.       \*--------------------------------------------------*/      /* 0221 */
  222.       equal_ptr = POS( '=', input_line )                          /* 0222 */
  223.                                                                   /* 0223 */
  224.       /*------------------------------------------------*\        /* 0224 */
  225.       |  Write ouput line for short, REM, or no = lines  |        /* 0225 */
  226.       \*------------------------------------------------*/        /* 0226 */
  227.       if LENGTH( input_line ) <= output_max_width,                /* 0227 */
  228.             |,                                                    /* 0228 */
  229.          equal_ptr = 0,                                           /* 0229 */
  230.             |,                                                    /* 0230 */
  231.          LEFT( uppercase_input_line, 3 ) = 'REM' then             /* 0231 */
  232.          do                                                       /* 0232 */
  233.             call LINEOUT output_file,,                            /* 0233 */
  234.                output_date ||,                                    /* 0234 */
  235.                output_time ||,                                    /* 0235 */
  236.                input_line                                         /* 0236 */
  237.             iterate                                               /* 0237 */
  238.          end                                                      /* 0238 */
  239.                                                                   /* 0239 */
  240.       /*-------------------*\                                     /* 0240 */
  241.       |  Format long lines  |                                     /* 0241 */
  242.       \*-------------------*/                                     /* 0242 */
  243.       parse value input_line with,                                /* 0243 */
  244.          before_equal,                                            /* 0244 */
  245.          '=',                                                     /* 0245 */
  246.          after_equal                                              /* 0246 */
  247.       output_line =,                                              /* 0247 */
  248.          output_date ||,                                          /* 0248 */
  249.          output_time ||,                                          /* 0249 */
  250.          before_equal || '='                                      /* 0250 */
  251.       continuation = COPIES( ' ', LENGTH( output_line ) )         /* 0251 */
  252.       before_equal = ''                                           /* 0252 */
  253.                                                                   /* 0253 */
  254.       do forever                                                  /* 0254 */
  255.          parse value after_equal with,                            /* 0255 */
  256.             token,                                                /* 0256 */
  257.             ';',                                                  /* 0257 */
  258.             after_equal                                           /* 0258 */
  259.          if POS( ':\', token ) > 0,                               /* 0259 */
  260.                &,                                                 /* 0260 */
  261.             STREAM( token, 'C', 'QUERY DATETIME') ¬= '' then      /* 0261 */
  262.             do                                                    /* 0262 */
  263.                call FORMAT_DATE_AND_TIME token                    /* 0263 */
  264.                output_line =,                                     /* 0264 */
  265.                   OVERLAY( output_date || output_time, output_line, 1 )
  266.             end                                                   /* 0266 */
  267.          if POS( ':\', token ) > 0,                               /* 0267 */
  268.                &,                                                 /* 0268 */
  269.             LEFT( output_line, LENGTH( output_date) ) =,          /* 0269 */
  270.                   COPIES( ' ', LENGTH( output_date ) ) then       /* 0270 */
  271.             do                                                    /* 0271 */
  272.                output_line =,                                     /* 0272 */
  273.                   OVERLAY( '?', output_line, 1 )                  /* 0273 */
  274.             end                                                   /* 0274 */
  275.          if LENGTH( output_line ) >= LENGTH( continuation ) then  /* 0275 */
  276.             do                                                    /* 0276 */
  277.                output_line =,                                     /* 0277 */
  278.                   output_line ||,                                 /* 0278 */
  279.                   token || ';'                                    /* 0279 */
  280.             end                                                   /* 0280 */
  281.          else                                                     /* 0281 */
  282.             do                                                    /* 0282 */
  283.                output_line =,                                     /* 0283 */
  284.                   LEFT( output_line, LENGTH( continuation ) ) ||, /* 0284 */
  285.                   token || ';'                                    /* 0285 */
  286.             end                                                   /* 0286 */
  287.          call LINEOUT output_file, output_line                    /* 0287 */
  288.          output_line = ''                                         /* 0288 */
  289.          if after_equal = '' then                                 /* 0289 */
  290.             do                                                    /* 0290 */
  291.                leave                                              /* 0291 */
  292.             end                                                   /* 0292 */
  293.       end                                                         /* 0293 */
  294.                                                                   /* 0294 */
  295. end                                                               /* 0295 */
  296.                                                                   /* 0296 */
  297. call STREAM input_file,  'C', 'CLOSE'                             /* 0297 */
  298. call STREAM output_file, 'C', 'CLOSE'                             /* 0298 */
  299.                                                                   /* 0299 */
  300. call EOJ 0                                                        /* 0300 */
  301.                                                                   /* 0301 */
  302. /*------------------------------------------------------------------------*\
  303. |                                                                          |
  304. |          Format date and time for file name passed as parameter          |
  305. |                                                                          |
  306. \*------------------------------------------------------------------------*/
  307. FORMAT_DATE_AND_TIME:                                             /* 0307 */
  308.                                                                   /* 0308 */
  309. parse value STREAM( ARG(1), 'C', 'QUERY DATETIME' ) with,         /* 0309 */
  310.    month   '-',                                                   /* 0310 */
  311.    day     '-',                                                   /* 0311 */
  312.    year    '  ',                                                  /* 0312 */
  313.    hours   ':',                                                   /* 0313 */
  314.    minutes ':',                                                   /* 0314 */
  315.    seconds                                                        /* 0315 */
  316.                                                                   /* 0316 */
  317. date_stamp =,                                                     /* 0317 */
  318.    RIGHT( year,  2, '0' ) || '/' ||,                              /* 0318 */
  319.    RIGHT( month, 2, '0' ) || '/' ||,                              /* 0319 */
  320.    RIGHT( day,   2, '0' )                                         /* 0320 */
  321.                                                                   /* 0321 */
  322. am_pm = 'a'                                                       /* 0322 */
  323. if hours > 11 then                                                /* 0323 */
  324.    do                                                             /* 0324 */
  325.       am_pm = 'p'                                                 /* 0325 */
  326.       if hours > 12 then                                          /* 0326 */
  327.          do                                                       /* 0327 */
  328.             hours = hours - 12                                    /* 0328 */
  329.          end                                                      /* 0329 */
  330.    end                                                            /* 0330 */
  331.                                                                   /* 0331 */
  332. time_stamp =,                                                     /* 0332 */
  333.    RIGHT( hours,   '2', '0' ) || ':' ||,                          /* 0333 */
  334.    RIGHT( minutes, '2', '0' ) ||,                                 /* 0334 */
  335.    am_pm                                                          /* 0335 */
  336.                                                                   /* 0336 */
  337. output_date =,                                                    /* 0337 */
  338.    LEFT( date_stamp, LENGTH( output_date ) )                      /* 0338 */
  339. output_time =,                                                    /* 0339 */
  340.    LEFT( time_stamp, LENGTH( output_time ) )                      /* 0340 */
  341.                                                                   /* 0341 */
  342. return                                                            /* 0342 */
  343.                                                                   /* 0343 */
  344. !tr! = VALUE('TRACE',,GBL.environment); if !tr! <> '' then do; TRACE(!tr!); nop; end
  345. /*------------------------------------------------------------------------*\
  346. |                                                                          |
  347. |                                End of Job                                |
  348. |                                                                          |
  349. \*------------------------------------------------------------------------*/
  350. EOJ:                                                              /* 0350 */
  351.    Procedure expose,                                              /* 0351 */
  352.       GBL.                                                        /* 0352 */
  353.                                                                   /* 0353 */
  354. if ARG() = 0 then                                                 /* 0354 */
  355.    eoj_rc = 0                                                     /* 0355 */
  356. else                                                              /* 0356 */
  357.    eoj_rc = ARG(1)                                                /* 0357 */
  358.                                                                   /* 0358 */
  359. elapsed_time = TIME('E')            /* get elapsed time - sssss.uuuuu */
  360. parse value elapsed_time with seconds '.' micro_seconds           /* 0360 */
  361. if LEFT( micro_seconds, 1, 1 ) >= 5 then                          /* 0361 */
  362.    seconds = seconds + 1                                          /* 0362 */
  363. ss = FORMAT( seconds // 60, 2 )                                   /* 0363 */
  364. minutes = ( seconds - ss ) / 60                                   /* 0364 */
  365. mm = FORMAT( minutes // 60, 2 )                                   /* 0365 */
  366. hh = FORMAT( ( minutes - mm ) / 60, 2 )                           /* 0366 */
  367. duration = hh':'mm':'ss                                           /* 0367 */
  368.                                                                   /* 0368 */
  369. program_name = TRANSLATE( FILESPEC( 'N', GBL.program_path_and_name ) )
  370. say 'EOJ  ' program_name 'at' TIME('N') ||,                       /* 0370 */
  371.     ', duration' TRANSLATE( duration, '0', ' ' )                  /* 0371 */
  372. exit eoj_rc                                                       /* 0372 */
  373.                                                                   /* 0373 */
  374. /*------------------------------------------------------------------------*\
  375. |                                                                          |
  376. |                              Trap Routines                               |
  377. |                                                                          |
  378. \*------------------------------------------------------------------------*/
  379. ERROR:   call TRAP_PROCESSING SIGL, 'ERROR',   RC                 /* 0379 */
  380. FAILURE: call TRAP_PROCESSING SIGL, 'FAILURE', RC                 /* 0380 */
  381. HALT:    call TRAP_PROCESSING SIGL, 'HALT',    ''                 /* 0381 */
  382. NOVALUE: call TRAP_PROCESSING SIGL, 'NOVALUE', ''                 /* 0382 */
  383. SYNTAX:  call TRAP_PROCESSING SIGL, 'SYNTAX',  RC                 /* 0383 */
  384.                                                                   /* 0384 */
  385. /* Rev. 95/10/14 */                                               /* 0385 */
  386. TRAP_PROCESSING:                                                  /* 0386 */
  387.    parse Source . . TRAP.path_and_program                         /* 0387 */
  388.    trap.line_nbr = ARG(1)                                         /* 0388 */
  389.    if POS( ':', TRAP.path_and_program ) > 0 then                  /* 0389 */
  390.       /* get source line if it is available */                    /* 0390 */
  391.       do t = 1                                                    /* 0391 */
  392.          trap_source_line.t =  SOURCELINE( trap.line_nbr )        /* 0392 */
  393.          trap_source_line.0 = t                                   /* 0393 */
  394.          trap.line_nbr      = trap.line_nbr + 1                   /* 0394 */
  395.          if RIGHT( trap_source_line.t, 1 ) ¬= ',' then            /* 0395 */
  396.             do                                                    /* 0396 */
  397.                leave                                              /* 0397 */
  398.             end                                                   /* 0398 */
  399.       end                                                         /* 0399 */
  400.    else                                                           /* 0400 */
  401.       /* program is running in macrospace */                      /* 0401 */
  402.       do                                                          /* 0402 */
  403.          TRAP.path_and_program = STRIP( DIRECTORY(), 'T', '\' ) || '\' ||,
  404.                                  TRAP.path_and_program            /* 0404 */
  405.          trap_source_line.1 = 'Source line is not available.'     /* 0405 */
  406.          trap_source_line.0 = 1                                   /* 0406 */
  407.       end                                                         /* 0407 */
  408.                                                                   /* 0408 */
  409.    parse value FILESPEC( 'N', TRAP.path_and_program ) with,       /* 0409 */
  410.       TRAP.fn '.' TRAP.fe                                         /* 0410 */
  411.    trap_file_name = FILESPEC( 'D', TRAP.path_and_program ) ||,    /* 0411 */
  412.                     FILESPEC( 'P', TRAP.path_and_program ) ||,    /* 0412 */
  413.                     TRAP.fn || '.' || 'DMP'                       /* 0413 */
  414.                                                                   /* 0414 */
  415.    /*------------------------------------------*\                 /* 0415 */
  416.    |  check for reason not to create .DMP file  |                 /* 0416 */
  417.    \*------------------------------------------*/                 /* 0417 */
  418.    if ARG(2) = 'HALT' then                                        /* 0418 */
  419.       do                                                          /* 0419 */
  420.          trap_file_name = ''                                      /* 0420 */
  421.       end                                                         /* 0421 */
  422.    if RxFuncQuery( 'VARDUMP' ) <> 0 then                          /* 0422 */
  423.       do                                                          /* 0423 */
  424.          trap_file_name = ''                                      /* 0424 */
  425.       end                                                         /* 0425 */
  426.    if POS( ':', trap_file_name ) = 0 then                         /* 0426 */
  427.       do                                                          /* 0427 */
  428.          trap_file_name = ''                                      /* 0428 */
  429.       end                                                         /* 0429 */
  430.                                                                   /* 0430 */
  431.    /*------------------------*\                                   /* 0431 */
  432.    |  Build trap message box  |                                   /* 0432 */
  433.    \*------------------------*/                                   /* 0433 */
  434.    dbl.h    = 'CD'x                 /* ═ double line - horizontal   */
  435.    dbl.v    = 'BA'x                 /* ║ double line - vertical     */
  436.    dbl.bl   = 'C8'x                 /* ╚ double line - bottom left  */
  437.    dbl.br   = 'BC'x                 /* ╝ double line - bottom right */
  438.    dbl.tl   = 'C9'x                 /* ╔ double line - top left     */
  439.    dbl.tr   = 'BB'x                 /* ╗ double line - top right    */
  440.    trap.red = '1B'x || '[1;37;41m'  /* bright white on red          */
  441.    trap.dul = '1B'x || '[0m'        /* reset to normal              */
  442.                                                                   /* 0442 */
  443.    say ' '                                                        /* 0443 */
  444.    trap_error_description =,                                      /* 0444 */
  445.       'Error line = ' || ARG(1) ||,                               /* 0445 */
  446.       '; ' ||,                                                    /* 0446 */
  447.       ARG(2) ||,                                                  /* 0447 */
  448.       ' error.'                                                   /* 0448 */
  449.    if ARG(3) <> '' then                                           /* 0449 */
  450.       trap_error_description = trap_error_description ||,         /* 0450 */
  451.                                '  Return code = ' || ARG(3)       /* 0451 */
  452.    trap.width = MAX( 74, LENGTH( trap_error_description ) )       /* 0452 */
  453.    say trap.red || dbl.tl || COPIES( dbl.h,trap.width + 2 ) || dbl.tr || trap.dul
  454.    say trap.red || dbl.v  || COPIES( ' ',  trap.width + 2 ) || dbl.v  || trap.dul
  455.    say trap.red || dbl.v CENTER( TRAP.fn'.'TRAP.fe,trap.width )    dbl.v  || trap.dul
  456.    say trap.red || dbl.v CENTER( trap_error_description, trap.width ) dbl.v || trap.dul
  457.    if trap_file_name <> '' then                                   /* 0457 */
  458.       do                                                          /* 0458 */
  459.    say trap.red || dbl.v  || COPIES( ' ',  trap.width + 2 ) || dbl.v  || trap.dul
  460.    say trap.red || dbl.v     CENTER( 'See: ' || trap_file_name,,  /* 0460 */
  461.                                      trap.width )  dbl.v  || trap.dul
  462.       end                                                         /* 0462 */
  463.    say trap.red || dbl.v  || COPIES( ' ',  trap.width + 2 ) || dbl.v  || trap.dul
  464.    say trap.red || dbl.bl || COPIES( dbl.h,trap.width + 2 ) || dbl.br || trap.dul
  465.    say trap.red || COPIES( ' ', trap.width + 4 ) || trap.dul      /* 0465 */
  466.    say trap.red || LEFT( 'Source line(s) at time of trap:', trap.width + 4 ) || trap.dul
  467.    do t = 1 to trap_source_line.0                                 /* 0467 */
  468.       say trap.red || LEFT( '   ' || trap_source_line.t, trap.width + 4 ) || trap.dul
  469.    end                                                            /* 0469 */
  470.    say trap.red || COPIES( ' ', trap.width + 4 ) || trap.dul      /* 0470 */
  471.                                                                   /* 0471 */
  472.    /*---------------------------------*\                          /* 0472 */
  473.    |  Create .DMP file if appropriate  |                          /* 0473 */
  474.    \*---------------------------------*/                          /* 0474 */
  475.    if trap_file_name <> '' then                                   /* 0475 */
  476.       do                                                          /* 0476 */
  477.          call SysFileDelete trap_file_name                        /* 0477 */
  478.          /* remove meaningless labels from dump for clarity */    /* 0478 */
  479.          drop dbl. TRAP. RC RESULT SIGL !tr!                      /* 0479 */
  480.          call VARDUMP trap_file_name  /* write variables to program.DMP file */
  481.       end                                                         /* 0481 */
  482.    exit 253                                                       /* 0482 */
  483. /*---------  REXX Cross Reference  - Created: 01/12/96 6:45pm ----------*\
  484.        J:\REXXPROG\LISTCFG.CMD - Directory time stamp 12/28/95 12:26p
  485.  
  486. ---- VARIABLES ----
  487. !tr!                0344<  0344   0344   0479
  488. GBL.                0027<  0352
  489. GBL.REXX_version    0029
  490. GBL.REXX_version_day
  491.                     0031
  492. GBL.REXX_version_level
  493.                     0030
  494. GBL.REXX_version_month
  495.                     0032
  496. GBL.REXX_version_year
  497.                     0033
  498. GBL.boot_drive      0038<  0070   0079   0188   0205
  499. GBL.calling_environment
  500.                     0035
  501. GBL.command_line    0028   0067   0075
  502. GBL.environment     0037<  0038   0344
  503. GBL.operating_system
  504.                     0034
  505. GBL.program_fe      0046
  506. GBL.program_fn      0045
  507. GBL.program_name    0040<  0044   0049
  508. GBL.program_path    0041<
  509. GBL.program_path_and_name
  510.                     0036   0040   0041   0042   0369
  511. GBL.program_version
  512.                     0039<
  513. RC                  0379   0380   0383   0479
  514. RESULT              0479
  515. SIGL                0379   0380   0381   0382   0383   0479
  516. TRAP.               0479
  517. TRAP.fe             0410   0455
  518. TRAP.fn             0410   0413   0455
  519. TRAP.path_and_program
  520.                     0387   0389   0403<  0404   0409   0411   0412
  521. Version             0029
  522. after_equal         0246   0255   0258   0289
  523. am_pm               0322<  0325<  0335
  524. before_equal        0244   0250   0252<
  525. continuation        0251<  0275   0284
  526. date_stamp          0317<  0338
  527. day                 0311   0320
  528. dbl.                0479
  529. dbl.bl              0436<  0464
  530. dbl.br              0437<  0464
  531. dbl.h               0434<  0453   0464
  532. dbl.tl              0438<  0453
  533. dbl.tr              0439<  0453
  534. dbl.v               0435<  0454   0454   0455   0455   0456   0456   0459
  535.                     0459   0460   0461   0463   0463
  536. dbl_bl              0094<  0111
  537. dbl_br              0095<  0111
  538. dbl_h               0092<  0107   0111
  539. dbl_tl              0096<  0107
  540. dbl_tr              0097<  0107
  541. dbl_v               0093<  0109   0109
  542. drive_ptr           0193<  0194   0198   0199
  543. duration            0367<  0371
  544. elapsed_time        0359<  0360
  545. eoj_rc              0355<  0357<  0372
  546. equal_ptr           0222<  0229
  547. file_name_ext       0146<  0155<  0160   0163<  0166   0173   0174   0180
  548.                     0185   0187<  0189   0196<  0200   0204<  0206   0213
  549.                     0215
  550. file_name_ptr       0180<  0193   0199
  551. h                   0105<  0106<  0106   0108<  0108   0110<  0110   0112<
  552.                     0112   0113   0114
  553. heading.0           0113<  0114
  554. heading.h           0106<  0108<  0110<  0112<  0115
  555. hh                  0366<  0367
  556. hours               0313   0323   0326   0328<  0328   0333
  557. input_file          0069<  0074<  0077   0087   0088   0100   0102   0131
  558.                     0132   0297
  559. input_line          0132<  0133   0151   0163   0180   0183   0193   0197
  560.                     0222   0227   0236   0243
  561. keyword             0148<  0149   0149
  562. known_file_name_lines
  563.                     0121<  0147   0148
  564. micro_seconds       0360   0361
  565. minutes             0314   0334   0364<  0365   0366
  566. mm                  0365<  0366   0367
  567. month               0310   0319
  568. output_date         0139<  0141   0234   0248   0265   0269   0270   0337<
  569.                     0338
  570. output_file         0086<  0090   0115   0233   0287   0298
  571. output_line         0247<  0251   0264<  0265   0269   0272<  0273   0275
  572.                     0277<  0278   0283<  0284   0287   0288<
  573. output_max_width    0141<  0227
  574. output_name         0138<
  575. output_time         0140<  0141   0235   0249   0265   0339<  0340
  576. possible_full_path_name
  577.                     0153   0156
  578. program_name        0369<  0370
  579. seconds             0315   0360   0362<  0362   0363   0364
  580. ss                  0363<  0364   0367
  581. t                   0391   0393   0467
  582. time_stamp          0332<  0340
  583. title               0098<  0107   0109   0111
  584. token               0256   0259   0261   0263   0267   0279   0285
  585. trap.dul            0441<  0453   0454   0455   0456   0459   0461   0463
  586.                     0464   0465   0466   0468   0470
  587. trap.line_nbr       0388<  0392   0394<  0394
  588. trap.red            0440<  0453   0454   0455   0456   0459   0460   0463
  589.                     0464   0465   0466   0468   0470
  590. trap.width          0452<  0453   0454   0455   0456   0459   0461   0463
  591.                     0464   0465   0466   0468   0470
  592. trap_error_description
  593.                     0444<  0450<  0450   0452   0456
  594. trap_file_name      0411<  0420<  0424<  0426   0428<  0457   0460   0475
  595.                     0477   0480
  596. trap_source_line.0  0393<  0406<  0467
  597. trap_source_line.1  0405<
  598. trap_source_line.t  0392<  0395   0468
  599. uppercase_input_line
  600.                     0133<  0149   0168   0181   0231
  601. w                   0147   0148   0157
  602. with                0151   0173   0183   0243   0255   0309   0360   0409
  603. x                   0434   0435   0436   0437   0438   0439   0440   0441
  604. year                0312   0318
  605.  
  606. ---- LABELS ----
  607. EOJ                 0080   0300   0350:
  608. ERROR               0058   0379:
  609. FAILURE             0059   0380:
  610. FORMAT_DATE_AND_TIME
  611.                     0215   0263   0307:
  612. HALT                0060   0381:
  613. NOVALUE             0061   0382:
  614. RxFuncAdd           0051
  615. SYNTAX              0062   0383:
  616. SysLoadFuncs        0052
  617. TRAP_PROCESSING     0379   0380   0381   0382   0383   0386:
  618.  
  619. ---- FUNCTIONS ----
  620. ARG                 0309   0354   0357   0388   0418   0445   0447   0449
  621.                     0451
  622. CENTER              0455   0456   0460
  623. COPIES              0107   0111   0139   0140   0251   0270   0453   0454
  624.                     0459   0463   0464   0465   0470
  625. DIRECTORY           0403
  626. FILESPEC            0040   0041   0042   0087   0088   0156   0163   0369
  627.                     0409   0411   0412
  628. FORMAT              0363   0365   0366
  629. LASTPOS             0193
  630. LEFT                0038   0149   0168   0181   0231   0269   0284   0338
  631.                     0340   0361   0466   0468
  632. LENGTH              0107   0111   0141   0141   0149   0227   0251   0269
  633.                     0270   0275   0275   0284   0338   0340   0452
  634. LINEIN              0132
  635. LINEOUT             0115   0233   0287
  636. LINES               0131
  637. MAX                 0452
  638. OVERLAY             0265   0273
  639. POS                 0180   0213   0222   0259   0267   0389   0426
  640. RIGHT               0318   0319   0320   0333   0334   0395
  641. RxFuncQuery         0422
  642. SOURCELINE          0392
  643. SPACE               0133
  644. STREAM              0070   0075   0102   0261   0297   0298   0309
  645. STRIP               0040   0041   0403
  646. SUBSTR              0197
  647. SysFileDelete       0090   0477
  648. TIME                0048   0049   0359   0370
  649. TRACE               0344
  650. TRANSLATE           0049   0133   0369   0371
  651. VALUE               0038   0344
  652. VARDUMP             0480
  653. WORD                0148
  654. WORDS               0147
  655.  
  656. \*-------------------  End of REXX Cross Reference  -------------------*/
  657.