#!/bin/sh
 
 # l_file
 # ======
 
 # This file is part of Gerolf Markup Shredder,
 # written by G. D. Brettschneider (1999-2006).

 GMSdateL_FILE=20060927
 
 # Prologue: ==================================================================
 
 # Not running:
 
 if [ "$GMS_SHELL" = "" ]; then
   echo "This is Gerolf Markup Shredder (l_file)."
   exit
 fi 
 
 # Debug: ---------------------------------------------------------------------

 if [ "$GMS_DEBUG" = "X" -o "$GMS_DEBUG" = "Y" ]; then
   source "$GMS_SHELL/l_banner" -debug l_file $1 $2 $3 $4
 elif  [ "$GMS_DEBUG" = "Z" ]; then
   echo " l_file ($1) ($2) ($3) ($4) ($5) ($6) ($7) ($8) ($9)" >> "$Z"
 fi 
 
 # Chapters: ==================================================================
 
 # Not defined:
 
 if [ "$1" = "" ]; then source "$GMS_SHELL/l_banner" -no_action l_file
 
 # Update: --------------------------------------------------------------------
 
 elif [ $1 = -update ]; then
 
 # Cold state:
   if [ "$3" = "" ]; then
     source "$GMS_SHELL/l_banner" -no_cold l_file called_by l_file -update
   elif [ $3 = 1 ]; then "$GMS_REPLY" -item 11 "1 $GMS1 $REPLY1" 1 1
   elif [ $3 = 2 ]; then "$GMS_REPLY" -item 12 "2 $GMS2 $REPLY2" 2 2
   elif [ $3 = 3 ]; then "$GMS_REPLY" -item 13 "3 $GMS3 $REPLY3" 3 3
   elif [ $3 = 4 ]; then "$GMS_REPLY" -item 14 "4 $GMS4 $REPLY4" 4 4
   elif [ $3 = 5 ]; then "$GMS_REPLY" -item 15 "5 $GMS5 $REPLY5" 5 5
   elif [ $3 = 6 ]; then "$GMS_REPLY" -item 16 "6 $GMS6 $REPLY6" 6 6
   elif [ $3 = 7 ]; then "$GMS_REPLY" -item 17 "7 $GMS7 $REPLY7" 7 7
   elif [ $3 = 8 ]; then "$GMS_REPLY" -item 18 "8 $GMS8 $REPLY8" 8 8
   elif [ $3 = 9 ]; then "$GMS_REPLY" -item 19 "9 $GMS9 $REPLY9" 9 9
   elif [ $3 = - ]; then "$GMS_REPLY" -item 4 " " " " 
   elif [ $3 = Q ]; then "$GMS_REPLY" -item 5 "Q      Quit dialog" Q 10
   elif [ $3 = P ]; then "$GMS_REPLY" -item 7 "P  <-  Previous files" P 11
   elif [ $3 = N ]; then "$GMS_REPLY" -item 8 "N  ->  Next files" N 12
   elif [ $3 = H ]; then "$GMS_REPLY" -item 9 "H  ..  Higher level" H 13
   else
     source "$GMS_SHELL/l_banner" -no_cold l_file $3 called_by l_file -update
   fi
   
 # Hot state:
   if [ "$2" = "" ]; then
     source "$GMS_SHELL/l_banner" -no_hot l_file called_by l_file -update
   elif [ $2 = 1 ]; then "$GMS_REPLY" -item 11 "1 $GMS1 $REPLY1" 11 1
   elif [ $2 = 2 ]; then "$GMS_REPLY" -item 12 "2 $GMS2 $REPLY2" 22 2
   elif [ $2 = 3 ]; then "$GMS_REPLY" -item 13 "3 $GMS3 $REPLY3" 33 3
   elif [ $2 = 4 ]; then "$GMS_REPLY" -item 14 "4 $GMS4 $REPLY4" 44 4
   elif [ $2 = 5 ]; then "$GMS_REPLY" -item 15 "5 $GMS5 $REPLY5" 55 5
   elif [ $2 = 6 ]; then "$GMS_REPLY" -item 16 "6 $GMS6 $REPLY6" 66 6
   elif [ $2 = 7 ]; then "$GMS_REPLY" -item 17 "7 $GMS7 $REPLY7" 77 7
   elif [ $2 = 8 ]; then "$GMS_REPLY" -item 18 "8 $GMS8 $REPLY8" 88 8
   elif [ $2 = 9 ]; then "$GMS_REPLY" -item 19 "9 $GMS9 $REPLY9" 99 9
   elif [ $2 = Q ]; then "$GMS_REPLY" -item 5 "Q      Quit dialog" QQ 10
   elif [ $2 = P ]; then "$GMS_REPLY" -item 7 "P  <-  Previous files" PP 11
   elif [ $2 = N ]; then "$GMS_REPLY" -item 8 "N  ->  Next files" NN 12
   elif [ $2 = H ]; then "$GMS_REPLY" -item 9 "H  ..  Higher level" HH 13
   else
     source "$GMS_SHELL/l_banner" -no_hot l_file $2 called_by l_file -update
   fi
   
 # Build: ---------------------------------------------------------------------
   
 elif [ $1 = -build ]; then
   "$GMS_REPLY" -top 3 "$GMS_FILEBOX" 
   "$GMS_REPLY" -item 4 " " " " 
   "$GMS_REPLY" -item 5 "Q      Quit dialog" Q 10
   "$GMS_REPLY" -item 6 " " " " 
   "$GMS_REPLY" -item 7 "P  <-  Previous files" P 11
   "$GMS_REPLY" -item 8 "N  ->  Next files" N 12
   "$GMS_REPLY" -item 9 "H  ..  Higher level" H 13
   for i in 10 11 12 13 14 15; do "$GMS_REPLY" -item $i " " " "; done
   for i in 16 17 18 19 20; do "$GMS_REPLY" -item $i " " " "; done
   "$GMS_REPLY" -bottom 21 
   "$GMS_REPLY" -shadow 22 
   
 # Not found: -----------------------------------------------------------------
 
 else
   source "$GMS_SHELL/l_banner" -no_action l_file $1   
 fi
