#!/bin/sh

# menu0
# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012, 2023
# 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/>.



# Joseph Rosevear 111231 I changed #!/bin/sh to #!/bin/bash.

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

# Joseph Rosevear 230502 I added an echo of $1 at the beginning.

# Joseph Rosevear 230512 I removed the above adding of an echo. 
# Apparently, it wasn't needed.

# Joseph Rosevear 230517 I changed the code to use shoparts to display
# the contents of sam_add

# I removed the code which displays the other, non-level, parts of the
# menu.

# I revised the menu format.

# I removed the code for the "invisible backbone".

# Joseph Rosevear 230517 I changed the name of this script from menu to
# menu0.

# Joseph Rosevear 230517 I changed the code so the contents of sam_add
# are always displayed, instead of conditionally.

# Joseph Rosevear 230523 I changed the path to copyr.dat.



# Definitions.
request="$1"

if [ "$request" = "" ]; then

   menu="$level"

else

   menu="$request"
fi

#if [ "$menu" = ":" ]; then

#   menu=""
#fi

(

   echo ""

   echo -e "added:\n\n`shoparts sam_add`"
   echo ""
   
   echo -e "${menu}:\n"
   
   echo  " COMMAND       DESCRIPTION"
   
   cat $menu/menu.dat
   
   echo ""
   cat $sam_root/kernel/data/copyr.dat
   echo ""
) > $sam_temp_dir/view.dat

sam_view $sam_temp_dir/view.dat
echo ""
