#!/bin/sh

# sam_view
# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011, 2012 Joseph Rosevear

# This file is part of The SAM Kernel.

# The SAM Kernel 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 3 of the
# License, or (at your option) any later version.

# The SAM Kernel 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, see <http://www.gnu.org/licenses/>.



# JHR 111231 I changed #!/bin/sh to #!/bin/bash.

# JHR 120808 I changed the prgama back to #!/bin/sh, because due to
# changes in SAM the sh shell will work fine.



if [ -x "$sam_view" ]; then
   
   #This was $* without the " and not $@
   #I changed it hoping it would deal well with args that have spaces
   #in them.
   $sam_view "$@"

else

   export LESS=-MPM"Using \"less\"\.  Use arrows to scroll\.  Press q to exit\."

   #I put " around the $1 and $2 trying to make it deal better with
   #args that have spaces in them.
   if [ "$2" = "" ]; then
      less "$1"
   else
      less "+$2" -- "$1" 
   fi
fi
