! $Id: more.sqh,v 1.3 2003/11/30 23:57:54 rayo Exp $
!
! sqrsh (sqr shell)
! Copyright (C) 1997 Ray Ontko & Company
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation; either version 2 of the License, or
! (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program; if not, write to the Free Software
! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
!
!------------------------------------------------------------------- more

!++
!
! more
!
! displays the contents of a file, page by page.
!
!--
!
! Modification History
!
! $Log: more.sqh,v $
! Revision 1.3  2003/11/30 23:57:54  rayo
! added help
! added RCS header
!
!

begin-procedure more local
   do more_file( $_p1 , #status )
   if #status <> 0
      show 'sqrsh: Unable to open file ' $_p1
   end-if
end-procedure ! more

!-------------------------------------------------------------- more_file
begin-procedure more_file( $fn , :#status )
   open $fn as 1 for-reading record={SQRSH_LINE_MAX}:vary status=#status
   if #status = 0
      read 1 into $line:{SQRSH_LINE_MAX}
      move 0 to #count
      while not #_end-file
         if #count >= 23
            show '[More...]' noline
            input $more noprompt
            uppercase $more
            extract $more from $more 0 1
            if $more = 'Q'
               break
            end-if
            move 0 to #count
         end-if
         show $line
         read 1 into $line:{SQRSH_LINE_MAX}
         add 1 to #count
      end-while
      close 1
   end-if
end-procedure ! more_file
