SAM TIPS

# TIPS
# Copyright (C) 2025 Joseph Rosevear, San Diego CA, USA.

# This file is part of a distribution SAM.

# SAM 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.

# SAM 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/>.



1.  File $sam_root/begin contains some variable assignments that affect
the way SAM runs.  In particular:

   export sam_root=`dirname $0`
   export sam_mark_num=1
   export sam_temp_base=/tmp/`whoami`
   export env_scratch=$sam_temp_base/scratch
   export sam_set_version=2
   export sam_scroll="-ls -sb"
   export sam_font="-fa 'DejaVu Sans Mono' -fs 9"
   export sam_geometry=80x35+80+35

You can override these settings by adding commands to define and export
these variables to file bprofile in a Dual directory .  See the online
instructions for making and using a Dual directory:

   https://rosevearsoftware.com/products/sam

Or, alternatively, you can put the commands in any file, then prefix a
definition of variable bprofile--which refers to othe file--when
invoking begin.

Here I will describe these variables:

The first of these, $sam_root/bashprofile, sets (or unsets) five
variables that are important to SAM.  These are

   sam_root:

      Although you can overrride the value given if you want to, you
      probably should not.  I honestly don't know if it is critical to
      SAM.  But it certainly has the potential for many uses. 
      Therefore there is a high chance that you will cause trouble by
      changing it.

   sam_mark_num:

      This variable is not currently used.  I hope to use it in the
      future as part of a scheme which will allow the running of multiple
      consecutive "bye" commands until reaching a value for $level
      which is equal to $sam_mark_num.

   sam_temp_base:

      Variable sam_temp_base identifies the directory in which SAM's
      temp directories will be made.  SAM expects $sam_temp_base to
      exist and be writable.  The file rc.SAM in this directory has
      code in it that makes the directory (for each user of SAM)
      suitable for use as a sam_temp_base directory, so you will
      probably want to use the one that it makes.  $sam_root/bprofile
      sets sam_temp_base to /tmp/`whoami`, but you can use any
      directory you want if it exists and you can write to it.

   sam_set_version:

      Unless you are using a really old version of Slackware (before
      10.0) configure $sam_root/bprofile to export sam_set_version as
      "2".  This variable is needed, because of a change that occurred
      in the way that the "set" command formats its output.  SAM uses
      the output of the set command to read the current variables and
      functions, but to do this correctly it needs to know how the set
      command behaves.  The issue regards the way that the set command
      formats its output when listing functions.
      
      Currently, there are two possible values for sam_set_version, as
      this table shows:

vvv      

sam_set_version  works in Slackware  GNU bash           behavior of set
---------------  ------------------  --------           ---------------

      1                7.1           bash-2.04           <function>=()

      2               10.0           bash-2.05b-i486-3   <function> ()

^^^

      So, you must give sam_set_version a value of 1 or 2 and export
      it.  Note that I do not know whether you should use 1 or 2 for
      the versions that went between 7.1 and 10.0.  Also I cannot say
      what will happen if you use versions before 7.1.  If you try any
      of these, would you please let me know what happens?
      
      To use a value of "2" for sam_set_version, put this in your
      $sam_root/bprofile:

         export sam_set_version=2

You may also use bprofile to set and export other variables as needed.


2.  I recommend that you start any gui that you wish to use before you start
SAM.  (There doesn't seem to be any good reason for doing it the other way
around.)

Once your gui is started you may want to run SAM from buttons or menus that
you have configured in your gui.

I use Fvwm2.  I run SAM from an Fvwm2 MiniButton.  Here the lines from
my .fvwm2rc file that I use:

vvv

DestroyMenu "My-buttons"
AddToMenu "My-buttons"
+ "/mnt/joe_root/begin%/mnt/joresorc/icons/mini/icon2-mini-alpha.png%"  Exec exec /mnt/joe_root/begin
+ "/mnt/joe_root/breekit%/mnt/joresorc/icons/mini/icon2-mini-alpha.png%" Exec exec /mnt/joe_root/breekit

^^^

The first of these starts SAM in the usual way.

The next one below it uses breekit to open a root shell in SAM.
