### Copyright (C) 1995-1997 Jesper K. Pedersen
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.


proc addSet {} {
  # additional settings

  Desc "This page is for additional (environment) variables,"\
      "which the Dotfile Generator doesn't cover."
  ShortDesc "additional variables"

  ############################### Widgets ##############################
  CheckBox var \
      -text "Environment Variable" 

  Entry name \
      -text name

  Entry value \
      -text value

  ExtEntry extra \
      -text "Additional variables"\
      -entries var name value \
      -orient left

  TextBox commands \
      -text "Additional Commands (one per line)"

  ################################ Help ################################
  Help var \
      "There are two different variables in the shell:\n 1: The"\
      "ordinary variables which apply only to the current shell"\
      "process\n 2: Environment variables which are passed on to"\
      "programs started from the shell"
  
  ############################## Page End ##############################
  PageEnd {
    forevery extra {
      if {$name == "" && $value != ""} {
        error "value \"$value\" without name"
      }
    }
  }

  ################################ Save ################################
  Save {
    forevery extra {
      if {$name == ""} continue
      if {$var == 0} {
        if {$value == ""} {
          print "set $name"
        } else {
          print "set $name=$value"
        }
      } else {
        print "setenv $name $value"
      }
    }
    if {$commands != ""} {
      print $commands
    }

  }
}

