% This code is (c)1997 Nathan Hyatt.  Feel free to use this code in your
% work.  If you release a module using this code or a modified version
% of this code, you MUST include the full source and give credit where credit
% is due.  I suggest we all release our source code so we can help each other
% and promote the use of Iniquity BBS Software.
%                                                        -sect[tric.inc.dms]

% This will read a text config file, ignoring lines starting with "#" or ";".
% Lines not starting with these characters are displayed.  You can copy the
% strings to be used as lines in matrix menus, etc.

{
  @file f
  @str text1
  @str text2
  @byte start=1
  @byte chars=1

  proc readconfig{
    fileassign[f,"C:\INIQ\DATA\DATA.CFG"]
    fileopen[f]
    if ioerror<>0 then {
      coutln["File not available!"]
      coutln[""]
      coutln["Create a small file with some normal and commented lines,"]
      coutln["and try again."]
      exit
    }
    while not fileend[f] do {
      filereadln[f,text1]
      text2=strcopy[text1,start,chars]
      if (text2="#") or (text2=";") then {
        % we do nothing with/to lines that are commented
      } else {
        coutln[text1] % replace this with what you want to do with the cfg
      }
    }
    fileclose[f]
  }
  readconfig }