home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / BACK2FT2.ZIP / BACK2FT2.CMD < prev    next >
OS/2 REXX Batch file  |  1993-02-06  |  23KB  |  653 lines

  1. /* -----------------------------------------------------------------------
  2.  
  3.         File:   BACK2FAT.CMD
  4.  
  5.         Author: Ralf Hauser (c│o)
  6.                 e-mail:  affie@frege.sns.neuphilologie.uni-tuebingen.de
  7.  
  8.         Last
  9.         Change: chris hascall
  10.                 49 McKinley Street
  11.                 South Portland ME USA  04106
  12.  
  13.         Date:   02-06-93
  14.  
  15.         Ver:    1.02
  16.  
  17.         Desc:   Backs Up specified fileset on FAT drive
  18.                 using EABACKUP and ZOO.
  19.                 Resulting file may be further processed using a
  20.                 tape streamer running under DOS.
  21.  
  22.         Usage:  BACK2FAT  [{/|-}switches]  <fileset>  [target_path] [outfile_name] [utility]
  23.  
  24.         Note:   Refer to the "b2f_init" function to setup
  25.                 user specific constants
  26.  
  27.         Requirements:
  28.  
  29.                 OS/2 2.0 (V1.3 not tested, but should do)
  30.                 EABACKUP.EXE V2.x in PATH
  31.                 ZOO.EXE V2.x in PATH
  32.                 PKZIP.EXE V1.10 in Path
  33.                 ARJ.EXE in Path
  34.  
  35.                 for restoring the backuped data:
  36.                 EARESTOR.EXE V2.x in PATH
  37.                 ZOO.EXE V2.x in PATH
  38.                 PKUNZIP V1.10 in Path
  39.                 ARJ.EXE in Path
  40.  
  41. --------------------------------------------------------------------------
  42. History:
  43. 22-07-92 co     Created
  44. 06-02-93 ch     Modified
  45.                 - Added ability to use PKZIP and ARJ
  46.                 - Miscellaneous changes
  47. -------------------------------------------------------------------------- */
  48.  
  49. /* ----------------------------------------------------------------------- */
  50. /*      Globals                                                            */
  51. /* ----------------------------------------------------------------------- */
  52.  
  53. '@ECHO OFF'                       /* do not display any SHELL commands */
  54. global. = ""                      /* init */
  55.  
  56. /* ----------------------------------------------------------------------- */
  57. /*      Main                                                               */
  58. /* ----------------------------------------------------------------------- */
  59.  
  60. Main :
  61.         Parse Upper Arg switches fileset target outfile utility
  62.  
  63.         /*
  64.          *  check for which utility to use
  65.          *  ZOO is the default
  66.          */
  67.  
  68.         SELECT
  69.           WHEN utility = "PKZIPF" THEN
  70.             DO
  71.               zendr    = "ZIP"
  72.             END
  73.           WHEN utility = "ARJ" THEN
  74.             DO
  75.               zendr    = "ARJ"
  76.             END
  77.         OTHERWISE
  78.               utility  = "ZOO"
  79.               zendr    = "ZOO"
  80.         END
  81.  
  82.         CALL b2f_init(outfile utility zendr) /* initialize global data structures */
  83.  
  84.         /*
  85.          *    handle arguments
  86.          */
  87.  
  88.         IF Arg() = 0 THEN
  89.            CALL b2f_help
  90.  
  91.         /* header */
  92.         Say " "
  93.         Say global.title || "   V" || global.version,
  94.             "       a c│o tool - 4 use if u like it"
  95.         Say " " || switches
  96.  
  97.         /* look whether switches are specified */
  98.         IF Substr(switches, 1, 1) <> "-" & Substr(switches, 1, 1) <> "/" THEN DO
  99.            /* no, so shift arguments */
  100.            utility  = outfile
  101.            outfile  = target
  102.            target   = fileset
  103.            fileset  = switches
  104.            switches = ""
  105.            END
  106.         ELSE DO /* handle switches */
  107.            IF Pos("?", switches) > 0 THEN
  108.               CALL b2f_help
  109.            global.log       = Pos("L", switches)
  110.            global.debug     = Pos("D", switches)
  111.            global.overwrite = Pos("K", switches)
  112.            END
  113.  
  114.         /*
  115.          *    determine filespec in fileset
  116.          */
  117.  
  118.         source = b2f_get_filespec(fileset)
  119.         Say global.title || ": Creating backup of '" || source || "\" || global.filespec || "' ..."
  120.  
  121.         /*
  122.          *    create target directory
  123.          */
  124.  
  125.         IF target = "" THEN
  126.            target = global.target_drive || global.target_path
  127.  
  128.         /* test for absolute path specification */
  129.         IF Substr(target, 2, 1) <> ":" | Substr(target, 3, 1) <> "\" THEN
  130.            CALL b2f_error "A full targetpath must be specified - ", "'" || target || "' is not a full targetpath."
  131.  
  132.         Say global.title || ": Creating target directory '" || target || "' ..."
  133.  
  134.         IF b2f_dir_exist(target) THEN DO
  135.            IF global.overwrite = 0 THEN DO
  136.               Say global.title || ": Target directory '" || target "' already exists! Clear? [Y/N]"
  137.               Pull answer
  138.               IF answer <> "y" & answer <> "Y" THEN
  139.                  CALL b2f_error "Cannot work on '" || target || "' as it contains files."
  140.               END
  141.            Say global.title || ": Deleting contents of target directory ..."
  142.            CALL b2f_kill_dir target
  143.            END
  144.         ELSE
  145.            CALL b2f_make_dir target
  146.  
  147.         /*
  148.          *    create a filelist
  149.          */
  150.  
  151.         CALL b2f_filelist source target
  152.  
  153.         /*
  154.          *    create a backup of extended attributes
  155.          */
  156.  
  157.         CALL b2f_ea_backup source target
  158.  
  159.         /*
  160.          *    create a backup of files
  161.          */
  162.  
  163.         CALL b2f_backup source target zendr
  164.  
  165.         /*
  166.          *    create a backup of fileslisting of all errors
  167.          */
  168.  
  169.         IF global.log <> 0 THEN
  170.            CALL b2f_list_errors target
  171.  
  172.         /*
  173.          *    create an info file
  174.          */
  175.  
  176.         CALL b2f_info source target fileset
  177.  
  178.         /*
  179.          *    close
  180.          */
  181.  
  182.         IF global.debug <> 0 THEN DO
  183.            Say global.title || ": DEBUG: All files in " || target
  184.            DIR "/P /N" target
  185.            END
  186.  
  187.         /* that's it */
  188.         Say global.title || ": Successfully terminated!"
  189.         /* jippeeh */
  190.         Call beep 2000, 200
  191.         Call beep 1600, 200
  192. EXIT
  193.  
  194. /* ----------------------------------------------------------------------- */
  195. /*      b2f_init                                                           */
  196. /* ----------------------------------------------------------------------- */
  197.  
  198. b2f_init : PROCEDURE EXPOSE global.
  199. parse arg ofile cmprsr endr
  200. /*
  201.  *      initializes all global data
  202.  */
  203.  
  204.         /* check whether RxFuncs are loaded, if not, load them */
  205.         IF RxFuncQuery('SysLoadFuncs') THEN DO
  206.            /* load the load-function */
  207.            CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  208.            /* load the Sys* utilities */
  209.            CALL SysLoadFuncs
  210.            END
  211.         /* set default values */
  212.         global.title         = "BACK2FAT"
  213.         global.version       = "1.02"
  214.         global.fnam_backup   = ofile || "." || endr
  215.         global.fnam_infofile = ofile || ".DOC"
  216.         global.fnam_listfile = ofile || ".LST"
  217.         global.fnam_errfile  = ofile || ".ERR"
  218.         global.bckup_log     = cmprsr || ".LOG"
  219.         global.fnam_eabkup1  = "EA@BDATA.EAB"
  220.         global.fnam_eabkup2  = "EA@INDEX.EAB"
  221.         global.sepline       = "-------------------------------------------------------------------------"
  222.         global.log           = 0
  223.         global.debug         = 0
  224.         global.overwrite     = 0
  225.  
  226.         /*****************************************************************
  227.          *    USER-SPECIFIC section
  228.          */
  229.  
  230.         /* EA Backup service */
  231.         global.eabckup_pgm   = "EABACKUP.EXE"    /* must be executable; you may add a path */
  232.         global.eabckup_add   = " "     /* additional switches for EABACKUP program */
  233.         /* Backup service */
  234.         global.bckup_pgm     = cmprsr || ".EXE"  /* must be executable; you may add a path */
  235.         global.bckup_add     = " "     /* additional switches for BACKUP program */
  236.  
  237.         global.target_drive  = "G:"         /* FAT drive */
  238.         global.target_path   = "\ZOOBK"     /* default directory on FAT drive */
  239.         global.filespec      = "*"          /* wildcard for files to be backuped */
  240.  
  241.         /*
  242.          *      fileset: not only a name but a subdirectory in the root directory;
  243.          *               all files in the subdirectory are backuped
  244.          *
  245.          *      A fileset must be a string of the form "set --> drive/path spec"
  246.          */
  247.  
  248.         global.fileset.1     = "4DOS  -->   D:\4DOS"   /* OS2 system files */
  249.         global.fileset.2     = "4OS2  -->   D:\4OS2"   /* applications */
  250.         global.fileset.3     = "OS2   -->   D:\OS2"    /* 'binaries', tools */
  251.         global.fileset.4     = "NDW   -->   D:\NDW"    /* other system files */
  252.         global.fileset.5     = "WIN   -->   D:\WIN"    /* libraries */
  253.         global.fileset.6     = "WOS2  -->   D:\WINOS231" /* windows */
  254.         global.fileset.7     = "TEMP  -->   D:\TEMP"   /* temp files */
  255.         global.fileset.8     = "DDD   -->   D:"        /* entire D drive */
  256.         global.fileset.9     = "FFF   -->   F:"        /* entire F drive */
  257.         /* ... more ... */
  258.         global.fileset_num   = 9       /* must contain number of filesets! */
  259.  
  260.         /*
  261.          *    END OF USER-SPECIFIC section
  262.          *****************************************************************/
  263.  
  264.         /* check user defined section */
  265.         /* because there are always some guys wanting to see the program fail */
  266.         DO i = 1 TO global.fileset_num
  267.            IF Words(global.fileset.i) <> 3 THEN
  268.               CALL b2f_error "Syntax error in user section:", "'" || global.fileset.i "' is invalid."
  269.            IF Word(global.fileset.i, 2) <> "-->" THEN
  270.               CALL b2f_error "Syntax error in user section:", "'-->' missing in: '" || global.fileset.i "'"
  271.         END
  272.  
  273.         RETURN
  274.  
  275. /* b2f_init */
  276.  
  277. /* ----------------------------------------------------------------------- */
  278. /*      b2f_error                                                          */
  279. /* ----------------------------------------------------------------------- */
  280.  
  281. b2f_error : PROCEDURE EXPOSE global.
  282. Parse Arg msg, msg1, msg2
  283.  
  284.         Say global.title || ": An error occured:"
  285.         CALL Beep 500, 200
  286.         CALL Beep 900, 200
  287.         CALL Beep 500, 200
  288.         Say " "
  289.         Say "   Error: " || msg
  290.         IF msg1 <> "" THEN
  291.            Say "          " || msg1
  292.         IF msg2 <> "" THEN
  293.            Say "          " || msg2
  294.  
  295.         EXIT
  296.  
  297. /* b2f_error */
  298.  
  299. /* ----------------------------------------------------------------------- */
  300. /*      b2f_help                                                           */
  301. /* ----------------------------------------------------------------------- */
  302.  
  303. b2f_help : PROCEDURE EXPOSE global.
  304. /*
  305.  *      Prints a help
  306.  */
  307.         Say " "
  308.         Say " Usage: " || global.title || " [{/|-}switches]  <fileset>  [targetpath]  [targetfname]"
  309.         Say " "
  310.         Say "     Possible switches are:"
  311.         Say " "
  312.         Say "        ?      this help"
  313.         Say "        l      create log files"
  314.         Say "        d      display additional debug info"
  315.         Say "        k      kill files in target directory"
  316.         Say " "
  317.         Say "     Possible filesets are: "
  318.         Say " "
  319.  
  320.         DO i = 1 TO global.fileset_num
  321.            Say "        " || global.fileset.i
  322.         END
  323.      /*
  324.         Say " "
  325.         Say "     Manually generated by Ralf Hauser (c│o), 7400 Tübingen"
  326.         Say "     e-mail: affie@frege.sns.neuphilologie.uni-tuebingen.de"
  327.              */
  328.         EXIT
  329.  
  330. /* b2f_help */
  331.  
  332. /* ----------------------------------------------------------------------- */
  333. /*      b2f_get_filespec                                                   */
  334. /* ----------------------------------------------------------------------- */
  335.  
  336. b2f_get_filespec : PROCEDURE EXPOSE global.
  337. /*
  338.  *      return the filespec of the corresponding fileset
  339.  */
  340. Arg fset
  341.         DO i = 1 TO global.fileset_num
  342.            IF Word(global.fileset.i, 1) = fset THEN
  343.               RETURN Word(global.fileset.i, 3)
  344.         END
  345.         CALL b2f_error "The specified set '" || fset || "' does not exist."
  346.         RETURN " "          /* shutup compiler */
  347.  
  348. /* b2f_get_filespec */
  349.  
  350. /* ----------------------------------------------------------------------- */
  351. /*      b2f_dir_exist                                                      */
  352. /* ----------------------------------------------------------------------- */
  353.  
  354. b2f_dir_exist : PROCEDURE
  355. /*
  356.  *      return TRUE if specified directory exists
  357.  */
  358. Arg dirname
  359.  
  360.         CALL SysFileTree dirname, "file", "D"
  361.  
  362.         RETURN file.0
  363.  
  364. /* b2f_dir_exist */
  365.  
  366. /* ----------------------------------------------------------------------- */
  367. /*      b2f_kill_dir                                                       */
  368. /* ----------------------------------------------------------------------- */
  369.  
  370. b2f_kill_dir : PROCEDURE
  371. /*
  372.  *      kill the contents of the spec directory
  373.  *      return TRUE if successfull
  374.  */
  375. Arg dirname
  376.  
  377.         CALL SysFileTree dirname || "\*", "file", "F"
  378.  
  379.         DO i = 1 TO file.0
  380.            filename = word(file.i, 5)
  381.            /* Say "     (Deleting '" || filename || "')" */
  382.            CALL SysFileDelete filename
  383.         END
  384.  
  385.         RETURN
  386.  
  387. /* b2f_kill_dir  */
  388.  
  389. /* ----------------------------------------------------------------------- */
  390. /*      b2f_make_dir                                                       */
  391. /* ----------------------------------------------------------------------- */
  392.  
  393. b2f_make_dir : PROCEDURE
  394. /*
  395.  *      create a new directory
  396.  */
  397. Arg dirname
  398.  
  399.         IF SysMkDir(dirname) <> 0 THEN
  400.            CALL b2f_error "Could not create '" || dirname || "' as a directory."
  401.  
  402.         RETURN
  403.  
  404. /* b2f_make_dir  */
  405.  
  406. /* ----------------------------------------------------------------------- */
  407. /*      b2f_info                                                         */
  408. /* ----------------------------------------------------------------------- */
  409.  
  410. b2f_info : PROCEDURE EXPOSE global.
  411. Arg source target fileset
  412.  
  413.         filename = target || "\" || global.fnam_infofile
  414.         rc = 0
  415.  
  416.         Say global.title || ": Creating infofile '" || filename || "' ..."
  417.  
  418.         CALL Lineout filename, "BACKUP INFO"
  419.         CALL Lineout filename, global.sepline
  420.         CALL Lineout filename, "Programname......:" global.title
  421.         CALL Lineout filename, "Date.............:" Date("L")
  422.         CALL Lineout filename, "Time.............:" Time("N")
  423.         CALL Lineout filename, " "
  424.         CALL Lineout filename, "BackupProgram....:" global.bckup_pgm
  425.         CALL Lineout filename, "Fileset..........:" fileset
  426.         CALL Lineout filename, "Sourcepath.......:" source
  427.         CALL Lineout filename, "Filespec.........:" global.filespec
  428.         CALL Lineout filename, "Targetpath.......:" target
  429.         CALL Lineout filename, " "
  430.         CALL Lineout filename, "Infofile.........:" global.fnam_infofile "(This file)"
  431.         CALL Lineout filename, "Listfile.........:" global.fnam_listfile
  432.         CALL Lineout filename, "Backupfile.......:" global.fnam_backup
  433.         CALL Lineout filename, "EA Backupfile 1..:" global.fnam_eabkup1
  434.         CALL Lineout filename, "EA Backupfile 2..:" global.fnam_eabkup2
  435.         CALL Lineout filename, "Error listing....:" global.fnam_errfile
  436.         IF global.log <> 0 THEN DO
  437.            CALL Lineout filename, " "
  438.            CALL Lineout filename, "EA LogFile.......: EABACKUP.LOG"
  439.            CALL Lineout filename, "BackupLog........:" global.bckup_log
  440.            END
  441.         CALL Lineout filename, global.sepline
  442.         CALL Lineout filename
  443.  
  444.         IF rc > 0 THEN
  445.            CALL b2f_error "Could not create '" || filename || "' as an infofile.", "RC: " || rc
  446.  
  447.         IF global.debug <> 0 THEN DO
  448.            Say global.title || ": DEBUG: INFOFILE"
  449.          /*TYPE filename " | more " */
  450.            END
  451.  
  452.         RETURN
  453.  
  454. /* b2f_info */
  455.  
  456. /* ----------------------------------------------------------------------- */
  457. /*      b2f_filelist                                                       */
  458. /* ----------------------------------------------------------------------- */
  459.  
  460. b2f_filelist : PROCEDURE EXPOSE global.
  461. Arg source target
  462.  
  463.         filename = target || "\" || global.fnam_listfile
  464.         rc = 0
  465.  
  466.         Say global.title || ": Creating filelist '" || filename || "' ..."
  467.  
  468.         CALL Lineout filename, "FILELIST"
  469.         CALL Lineout filename, global.sepline
  470.  
  471.         CALL SysFileTree source || "\" || global.filespec, "file", "FS"
  472.  
  473.         DO i=1 to file.0
  474.            CALL Lineout filename, file.i
  475.         END
  476.  
  477.         CALL Lineout filename, global.sepline
  478.         CALL Lineout filename, " " || file.0 || " files."
  479.         CALL Lineout filename, global.sepline
  480.         CALL Lineout filename
  481.  
  482.         IF rc > 0 THEN
  483.            CALL b2f_error "Could not create '" || filename || "' as a filelist.", "RC: " || rc
  484.  
  485.         IF global.debug <> 0 THEN DO
  486.            Say global.title || ": DEBUG: FILELIST"
  487.         /* TYPE filename " | more "   */
  488.            END
  489.  
  490.         RETURN
  491.  
  492. /* b2f_filelist */
  493.  
  494. /* ----------------------------------------------------------------------- */
  495. /*      b2f_ea_backup                                                      */
  496. /* ----------------------------------------------------------------------- */
  497.  
  498. b2f_ea_backup : PROCEDURE EXPOSE global.
  499. Arg source target
  500.  
  501.         IF SysSearchPath("PATH", global.eabckup_pgm) = "" THEN
  502.            CALL b2f_error "Could not find EABACKUP service:", "'" || global.eabckup_pgm "' must exist in Environment PATH"
  503.  
  504.         Say global.title || ": Spawning '" || global.eabckup_pgm || "' ..."
  505.         rc = 0
  506.  
  507.         IF global.log <> 0 THEN
  508.            global.eabckup_pgm source target,
  509.                     "/S /Q /I" global.eabckup_add,
  510.                     " > " target || "\EABACKUP.LOG"
  511.         ELSE
  512.            global.eabckup_pgm source target,
  513.                     "/S /Q /I" global.eabckup_add
  514.  
  515.         IF rc > 0 THEN
  516.            CALL b2f_error "Could not run EABACKUP service:", "'" || global.eabckup_pgm || "' terminated abnormally!", "RC: " || rc
  517.  
  518.         RETURN
  519.  
  520. /* b2f_ea_backup */
  521.  
  522. /* ----------------------------------------------------------------------- */
  523. /*      b2f_backup                                                         */
  524. /* ----------------------------------------------------------------------- */
  525.  
  526. b2f_backup : PROCEDURE EXPOSE global.
  527. Arg source target endr
  528.  
  529.         IF SysSearchPath("PATH", global.bckup_pgm) = "" THEN
  530.            CALL b2f_error "Could not find BACKUP service in path", "'" || global.bckup_pgm "' must exist in Environment PATH"
  531.  
  532.         tmpfile = target || "\" || "_list_.tmp"
  533.  
  534.         /* create a tmp file containg all filenames to be backuped */
  535.         CALL SysFileTree source || "\" || global.filespec, "file", "FS"
  536.         /* (I know that this "tree walking job" is done twice, but I prefered
  537.            an encapsulation of procedures. If you use another backup service
  538.            as ZOO you must use another way of specifying files either...) */
  539.  
  540.         offset = 38   /* column where filename starts in output of FileTree */
  541.         DO i=1 to file.0
  542.            filename = Substr(file.i, offset)
  543.            /* Say "filename: " filename */
  544.            CALL Lineout tmpfile, filename
  545.         END
  546.         CALL Lineout tmpfile
  547.  
  548.         IF global.debug <> 0 THEN DO
  549.            Say global.title || ": DEBUG: FILELIST FOR " || global.bckup_pgm
  550.         /* TYPE tmpfile " | more " */
  551.            END
  552.  
  553.         Say global.title || ": Spawning '" || global.bckup_pgm || "' ..."
  554.         rc = 0
  555.  
  556.         /*  select the specific archiver with which to
  557.          *  process files.  this area is a little tricky
  558.          *  due to the nuances of each.  the registered
  559.          *  version of ARJ allows for the use of a listfile.
  560.          *  -- chris hascall --
  561.          */
  562.  
  563.         SELECT
  564.           WHEN endr = "ZIP" then
  565.              IF global.log <> 0 THEN
  566.                  global.bckup_pgm "-exrP" global.bckup_add,
  567.                  target || "\" || global.fnam_backup "@" || tmpfile,
  568.                  " > " target || "\" || global.bckup_log
  569.              ELSE
  570.                  global.bckup_pgm "-exrP" global.bckup_add,
  571.                  target || "\" || global.fnam_backup "@" || tmpfile
  572.           WHEN endr = "ZOO" then
  573.              IF global.log <> 0 THEN
  574.                   TYPE tmpfile " | " ,
  575.                      global.bckup_pgm "ahPI" global.bckup_add,
  576.                      target || "\" || global.fnam_backup,
  577.                      " > " target || "\" || global.bckup_log
  578.              ELSE
  579.                   TYPE tmpfile " | " ,
  580.                      global.bckup_pgm "ahPI" global.bckup_add,
  581.                      target || "\" || global.fnam_backup
  582.           WHEN endr = "ARJ" then
  583.              IF global.log <> 0 THEN
  584.                   global.bckup_pgm "a -r -jf -jm" global.bckup.add,
  585.                   target || "\" || global.fnam_backup source || "\*.*",
  586.                   "-ji" || target || "\" || global.bckup_log
  587.              ELSE
  588.                   global.bckup_pgm "a -r -jf" global.bckup_add,
  589.                   target || "\" || global.fnam_backup
  590.         OTHERWISE
  591.              NOP
  592.         END
  593.  
  594.         /* it seems that something is wrong with ZOO.EXE
  595.            since it returns with an exitcode of "1"
  596.            although no errors occur... */
  597.  
  598.         IF rc > 2 THEN
  599.            do
  600.             CALL b2f_error "Could not run BACKUP service:", "'" || global.bckup_pgm || "' terminated abnormally!", "RC: " || rc
  601.            end
  602.  
  603.         /* remove tmp file */
  604.         CALL SysFileDelete tmpfile
  605.  
  606.         RETURN
  607.  
  608. /* b2f_backup */
  609.  
  610. /* ----------------------------------------------------------------------- */
  611. /*      b2f_list_errors                                                    */
  612. /* ----------------------------------------------------------------------- */
  613.  
  614. b2f_list_errors : PROCEDURE EXPOSE global.
  615. Arg target
  616.  
  617.         /* examine all .LOG files */
  618.         CALL SysFileTree target || "\*.LOG", "file", "F"
  619.         offset = 38   /* column where filename starts in output of FileTree */
  620.         DO i=1 to file.0
  621.            filename = Substr(file.i, offset)
  622.            CALL b2f_list_errors_in_file filename
  623.         END
  624.         RETURN
  625.  
  626. /* b2f_list_errors target */
  627.  
  628. /* ----------------------------------------------------------------------- */
  629. /*      b2f_list_errors_in_file                                            */
  630. /* ----------------------------------------------------------------------- */
  631.  
  632. b2f_list_errors_in_file : PROCEDURE EXPOSE global.
  633. Arg filename
  634.  
  635.         Say global.title || ": Checking '" || filename || "' for errors ..."
  636.         linenum = 0;
  637.  
  638.         DO FOREVER
  639.            buffer = Linein(filename)
  640.            linenum = linenum + 1
  641.            IF Pos("error", buffer) > 0 THEN DO
  642.               Say "   #" || Format(linenum, 4) || ":  " Strip(buffer, "B")
  643.               END
  644.            IF lines(filename) = 0 THEN
  645.               LEAVE
  646.         END
  647.  
  648.         RETURN
  649.  
  650. /* b2f_list_errors_in_file */
  651.  
  652. /* <EOF> */
  653.