home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ob140os2.zip / LST.B < prev    next >
Text File  |  1996-06-07  |  545b  |  27 lines

  1. ********************************
  2. * PROGRAM: lst                 *
  3. * Lists a file and adds line   *
  4. * numbers                      *
  5. ********************************
  6.  dim InpFile:byte
  7.  dim Buf:string[300]
  8.  dim LineNum:short
  9. Start
  10.  LineNum=0
  11.  Buf=NextArg
  12.  if len(Buf)=0 then
  13.     print "No file specified"
  14.     end
  15.  endif
  16.  on error goto BadFile
  17.  open #InpFile,Buf:read
  18.  on error
  19.  while not(eof(#InpFile)) do
  20.     read #InpFile,Buf
  21.     inc LineNum
  22.     print right$(zstr$(LineNum),5);" ";Buf
  23.  endwhile
  24.  end
  25. BadFile
  26.  print "Cannot open ";Buf
  27.