home *** CD-ROM | disk | FTP | other *** search
- #
- # $Id: setup,v 1.32 1994/02/22 21:53:27 carlson Exp carlson $
- #
- # setup Called by .login and .cshrc
- #
- # Synopsis:
- # if ( -e setup ) then
- # set { login | cshrc }
- # source setup
- # unset { login | cshrc }
- # endif
- #
- # Description:
- # This file is to be used as an extension of the standard .cshrc
- # and .login. This way, if this file doesn't exist, the
- # standard .cshrc and .login will still work in a basic manner.
- #
- # By default, 'setup' does some basic initializing and setting
- # of environment variables. If the variable $login exists, does
- # functions specific to .login. If the variable $cshrc exists,
- # does functions specific to .cshrc.
- #
- # Local csh Variables Defined:
- # ansiterm Set to one of the following:
- # 0 Not an interactive session
- # 1 Not an ANSI compatible terminal
- # 2 iris-ansi compatible terminal
- # 3 vt100 terminal
- # home_host Set to the machine which is my home. If the
- # machine which is being set up is NOT my home,
- # then I don't do some things.
- #
- # Permanent csh Variables Defined:
- # path Set to the search path for executables.
- # prompt Set to a fancy prompt string.
- # history Set to the number of history lines to keep.
- # cdpath Set to the directories to search for
- # subdirectories when doing a 'cd' command.
- # filec Set to allow file completion.
- # fignore Set to those extensions to ignore on file
- # completion.
- # ignoreeof Set to ignore the ^D end of file to logout.
- # notify Set to notify when subprocesses complete.
- #
- # Environment Variables Defined:
- # OS Defined to the current version of the
- # operating system and the alpha release version.
- # DISPLAY Set to the local display or, if running
- # remotely, to the remote display.
- # EMACSLOADPATH Where EMACS looks for .el files.
- # WINEDITOR The editor Workspace defaults to.
- # CONSOLE TRUE if this is the console window.
- # Otherwise, not set so we set it here to FALSE.
- # LPDEST Where enscript sends print files.
- #
- # Revision History:
- # $Log: setup,v $
- # Revision 1.32 1994/02/22 21:53:27 carlson
- # Added checking of flag to know when we are in an Emacs subshell.
- # Added check to see if we are actually a terminal session or just a subshell.
- # Always define WINEDITOR.
- # Changed colors of prompt.
- #
- # Revision 1.31 1993/12/16 22:53:48 carlson
- # Changed my home host to heaven.
- #
- # Revision 1.30 1993/12/16 14:49:22 carlson
- # Modified so we don't check the hostname to find out if this is a
- # dialback connection. Use the user (which should be UNKNOWN).
- #
- # Revision 1.29 93/08/18 17:12:21 carlson
- # Modified the terminal type to use when coming from dial-up to be vt100.
- # Added some documentation on how the DISPLAY variable is set.
- # Do the same for both calling from dialback and using a vt100.
- # Handle special case when logging in from an HP terminal.
- # Add $HOME/app-defaults to search path for X defaults.
- # Replace checks for $prompt with checks to my variable $ansiterm.
- # Added aliases for rcp and xv.
- #
- # Revision 1.28 93/06/02 10:59:36 carlson
- # Modify to keep version in a file identified by each host. This way,
- # I can NFS mount my home directory, if I want.
- # Changed prompt to have the expanded hostname rather than compute it
- # each time.
- # Modified aliases that fix the title of the window to use expanded
- # hostname rather than compute it each time.
- # Moved all the special stuff for opening windows to .sgisession.
- #
- # Revision 1.27 93/03/29 09:31:39 carlson
- # Only run unique on path if it exists.
- # Added cu alias to clean up after using.
- # Only run zmail if it exists.
- # Only run status e-lisp function if it exists.
- #
- # Revision 1.19 1993/03/27 04:52:14 chris
- # Added alias for cu so that it fixes the title bar.
- # Added neatsy keansy stuff for epoch when it first loads.
- #
- # Revision 1.18 1993/02/15 01:05:00 chris
- # Modified to be more machine independent.
- # Modified mailbox to better know where we are.
- #
- # Revision 1.25 93/01/22 12:27:01 carlson
- # Modified check for LPDEST to make sure we are running on an IRIX
- # system first.
- # Modified calls to run mailbox to have better Lat/Long values and to
- # run the mail programs under xwsh.
- #
- # Revision 1.24 93/01/06 17:42:30 carlson
- # Modified EMACSLOADPATH to use the new format.
- #
- # Revision 1.23 92/10/29 13:30:12 carlson
- # Added backup (bu) alias.
- #
- # Revision 1.22 92/10/27 10:10:44 carlson
- # Do not make anything dependent on $OS being defined.
- # Use 'unique' program to remove duplicate entries in path variable.
- # Added xlock alias.
- # Make sure labugs user exists before creating the mailbox for them.
- # Disable bell from mailbox program (since zmail does it for me).
- #
- # Revision 1.21 92/10/07 14:39:18 carlson
- # No longer check if OS is defined for a number of things. It didn't
- # work as expected.
- # Move the definition of OS to the end of the common script.
- # Use command unique instead of using a script to remove duplicate
- # directories from the path statement.
- # Change where zmail is positioned.
- # Remove position information from calls to epoch.
- #
- # Revision 1.20 92/08/28 17:13:26 carlson
- # Use the variable OS to determine if we need to do things. This way we
- # don't duplicate efforts.
- # Found a faster way to clear away duplicate entries in path.
- # Remove alias for make to pmake.
- # Define aliases for seticon and settitle in appropriate place.
- # Remove size info for epoch.
- #
- # Revision 1.19 92/08/28 11:18:31 carlson
- # Fixed EXPLORERHOME to be /usr relative.
- # Changed default mail handler for mailbox back to BSD mail.
- # Automatically load zmail.
- # Don't include size information when loading epoch.
- #
- # Revision 1.18 92/08/21 15:30:01 carlson
- # Added environment variable XENVIRONMENT if .Xdefaults_xxx is defined.
- #
- # Revision 1.17 92/08/21 12:57:09 carlson
- # Skip a whole bunch of stuff if ENVONLY is defined. This makes the program
- # userenv (which is called in .xsession) work.
- # Change EXPLORERHOME to be /usr relative instead of in /d1.
- #
- # Revision 1.16 92/08/19 16:42:42 carlson
- # Fixed path to find things in /usr rather than on /d1.
- # Added wp to path.
- #
- # Revision 1.15 92/08/11 16:48:43 carlson
- # If remote host is dialback, then assume iris-ansi-net terminal device.
- # Create the .version file if it doesn't exist or it is zero in length. For
- # some reason, there are times when it gets cleared.
- # If the remote host is dialback, remove the DISPLAY environment variable.
- # Otherwise, set the display variable to point to the remote host.
- # If the DISPLAY environment variable is set, define emacs, epoch and
- # zmail to use them. Otherwise, make emacs use the terminal device and
- # don't allow epoch to run.
- # Remove stuff that came from Jack's .cshrc a long time ago.
- #
- # Revision 1.14 92/03/18 16:14:02 carlson
- # Unset clobber - was set by desktop group in /etc/cshrc.
- # Added aliases for epoch and zmail.
- # Removed running of emacs by default.
- # Changed running of mailbox to use zmail, not Mail.
- # If epoch exists, run epoch else run emacs on status file.
- # If not home machine just run epoch or emacs.
- #
- # Revision 1.13 92/01/22 15:23:39 carlson
- # Added environment EXPLORERHOME.
- # Broke up search path to be divided into two. Those that are to be
- # searched first and those that are searched last. This improves the
- # way it works when changing to root.
- # Added Framemaker and Explorer to the search path.
- # Clean up search path to remove anything already there.
- #
- # Revision 1.12 91/10/10 16:12:45 carlson
- # Modified netemacs alias to pass parameters in the right place.
- #
- # Revision 1.11 91/09/06 13:34:12 carlson
- # Removed alias of domcs when on home machine.
- #
- # Revision 1.10 91/09/06 12:33:33 carlson
- # Modified RCS Header symbol to Id symbol.
- # Added netemacs alias.
- #
- # Revision 1.9 91/08/27 15:20:37 carlson
- # Have the status EMACS start in directory misc. This way it will load
- # the .emacsrc file.
- #
- # Revision 1.8 91/08/27 13:12:44 carlson
- # Added alias for ci.
- #
- # Revision 1.7 91/08/27 12:41:17 carlson
- # Modified definition of OS to allow no .version file.
- # Include search for FrameMaker directory.
- # Set notify only if not console window.
- #
- # Revision 1.6 91/08/13 13:10:31 carlson
- # Modified call to run emacs editing status to have special instance name.
- #
- # Revision 1.5 91/08/13 12:00:44 carlson
- # Added RCS special symbols.
- # Improved documentation in title block.
- # Added emacs alias to handle new X version of emacs.
- # Start two emacs windows, one for standard use, one for status.
- #
- #-------------------------------------------------------------------------
-
- set home_host = heaven
- set hostname = `hostname`
-
- if ( $?REMOTEHOST ) then
- if ( "$REMOTEUSER" == "UNKNOWN" ) then
- setenv TERM vt100
- endif
- endif
-
- if ( ! $?ENVONLY ) then
- set ansiterm = 0
- if ( $?prompt && ! $?INEMACS ) then
- set ansiterm = 1
- if ( -t 0 ) then
- if ( "$TERM" == "iris-ansi" || "$TERM" == "iris-ansi-net" ) \
- set ansiterm = 2
- if ( "$TERM" == "vt100" ) set ansiterm = 3
- endif
- endif
- endif
-
- #-----
- # Required by X Windows
- #
- # Set the DISPLAY environment variable.
- # 1. If remote host is dialback, then we are logging in from home
- # and we aren't using X. Remove the DISPLAY environment variable.
- # 2. If there is no prompt, then we are using 'rcp' and we don't
- # need to worry about a DISPLAY environment variable.
- # 3. If the 'hosts' file lists only the IP address and the hostname,
- # then we must be at PDA and need to use the IP address instead
- # of the hostname provided.
- # 4. Set XUSERFILESEARCHPATH so that app-defaults files will be used
- # properly.
- # 5. If we are not logging in remotely, just set DISPLAY to the
- # local screen.
- #
- if ( $?REMOTEHOST ) then
- if ( "$REMOTEUSER" == "UNKNOWN" || $ansiterm != 2 ) then
- if ( $?DISPLAY ) unsetenv DISPLAY
- else if ( $ansiterm > 0 ) then
- set ip = `ypmatch $REMOTEHOST hosts`
- if ( $#ip == 2 ) then
- setenv DISPLAY $ip[1]\:0
- else
- setenv DISPLAY $REMOTEHOST\:0
- endif
- unset ip
- setenv XUSERFILESEARCHPATH "$HOME/app-defaults/%N:`/usr/bin/X11/appdefpath`"
- endif
- else
- setenv DISPLAY :0
- endif
-
- #-----
- # Set other environment variables.
- #
- if ( ! $?EMACSLOADPATH ) setenv EMACSLOADPATH ~/emacs:
- if ( ! $?ENVONLY ) then
- setenv WINEDITOR /usr/local/bin/emacs
- if ( ! $?CONSOLE ) \
- setenv CONSOLE false
- set x = `uname`
- if ( "$x" == "IRIX" ) then
- if ( ! $?LPDEST ) then
- set x = ( `lpstat -d` )
- if ( "$x[1]" != "no" ) setenv LPDEST $x[4]
- endif
- endif
- unset x
- if ( ! $?EXPLORERHOME && -e /usr/explorer/bin ) \
- setenv EXPLORERHOME /usr/explorer
- endif
-
- if ( $?XSCREEN ) then
- if ( "$XSCREEN" == "1280x1024" && -r $HOME/.Xdefaults_1280 ) then
- setenv XENVIRONMENT $HOME/.Xdefaults_1280
- else if ( "$XSCREEN" == "1024x768" && -r $HOME/.Xdefaults_1024 ) then
- setenv XENVIRONMENT $HOME/.Xdefaults_1024
- endif
- endif
-
- #-----
- # Set the search path.
- #
- # dir1 Directories to search first.
- # dir2 Directories to search last.
- #
- set dir1
- if ( -e ~/bin ) set dir1 = ( $dir1 ~/bin )
- if ( -e ~/scripts ) set dir1 = ( $dir1 ~/scripts )
- if ( -e /usr/local/bin ) set dir1 = ( $dir1 /usr/local/bin )
-
- set dir2
- if ( -e /usr/frame/bin ) set dir2 = ( $dir2 /usr/frame/bin )
- if ( -e /usr/explorer/bin ) set dir2 = ( $dir2 /usr/explorer/bin )
- if ( -e /usr/wp/bin ) set dir2 = ( $dir2 /usr/wp/bin /usr/wp/sbin )
-
- if ( -o /bin/su ) then
- set path = ( $path $dir1 $dir2 )
- else
- set path = ( . $dir1 $path $dir2 )
- endif
-
- if ( -e ~/bin/unique ) set path = ( `unique $path` )
-
- unset dir1
- unset dir2
-
- #-----
- # Make an environment variable that tells us what release of the
- # operating system we are running. Note that we create a file called
- # .version later in the login stuff. This is because it takes too
- # long to compute it here.
- #
- if ( ! $?OS ) then
- set y = `uname -r`
- if ( -e ~/.${hostname}_version && ! -z ~/.${hostname}_version ) then
- set x = ( `cat ~/.${hostname}_version` )
- setenv OS "$y-$x[3]"
- unset x
- else
- setenv OS "$y"
- endif
- unset y
- endif
-
- if ( $?ENVONLY ) exit
-
- ##########################################################################
- # CSHRC stuff
- #
-
- if ( $?cshrc ) then
- #----
- # Do pretty stuff to prompt string
- # 1. Don't do this if we are not running with an ANSI terminal.
- # 2. If we are the owner of /bin/su, then we must be running in
- # superuser mode and we'll reverse video the prompt. Otherwise,
- # we'll just use the highlight color.
- #
- if ( $ansiterm > 0 ) then
- if ( $ansiterm > 1 ) then
- if ( -o /bin/su ) then
- set prompt="${hostname}:$user [\!] > "
- else
- set prompt="${hostname}:$user [\!] > "
- endif
- else
- set prompt="${hostname}:$user [\!]$prompt "
- endif
- endif
-
- #----
- # Set csh variables here. These variables must be set for each shell
- # invokation.
- #
- set history = 100
- set x
- if ( -e ~/developer ) set x = ($x ~/developer)
- if ( -e /usr/local/emacs ) set x = ($x /usr/local/emacs)
- set cdpath = (~ $x)
- unset x
- set filec
- set fignore = (.o .a .out \~)
- unset autologout
- set ignoreeof
- if ( "$CONSOLE" != "true" ) set notify
- unset noclobber
-
- #----
- # Perform alias definitions. These must be set for each invokation of
- # the csh.
- #
- # list directories in columns
- #
- alias ls 'ls -FC'
- alias ll 'ls -alF \!* | more'
- alias lt 'ls -alFt \!* | more'
- alias mail Mail -n
- if ( $?DISPLAY ) then
- alias emacs '/usr/local/bin/emacs \!* &'
- alias epoch '/usr/local/bin/epoch \!* &'
- alias zmail 'zmail -gui \!* &'
- alias xlock 'xlock -mode random +nolock'
- else
- alias emacs 'emacs -nw'
- alias epoch 'echo "epoch will not run over a modem"'
- endif
- if ( -e ~/scripts ) then
- alias co '~/scripts/co-script \!*'
- alias col '~/scripts/col-script -i \!*'
- alias ci '~/scripts/ci-script \!*'
- endif
- alias unlock "rcs -u \!* ; rm -f \!* >&/dev/null"
-
- #----
- # Define aliases to do fancy things to the title bar.
- #
- if ( $ansiterm == 2 ) then
- alias seticon 'echo "\033P3.y\!*\033\\\c"'
- alias settitle 'echo "\033P1.y\!*\033\\\c"'
-
- if ( "$CONSOLE" == "true" ) then
- alias cu 'cu \!* ; echo "\033P1.yConsole:${cwd}\033\\\c"'
- alias cd 'cd \!* ; echo "\033P1.yConsole:${cwd}\033\\\c"'
- alias rlogin 'rlogin \!* ; echo "\033P1.yConsole:${cwd}\033\\\c"'
- alias rsh 'rsh \!* ; echo "\033P1.yConsole:${cwd}\033\\\c"'
- alias pushd 'pushd \!* ; echo "\033P1.yConsole:${cwd}\033\\\c"'
- alias popd 'popd \!* ; echo "\033P1.yConsole:${cwd}\033\\\c"'
- else
- alias cu 'cu \!* ; echo "\033P1.y${hostname}:${cwd}\033\\\c"'
- alias cd 'cd \!* ; echo "\033P1.y${hostname}:${cwd}\033\\\c"'
- alias rlogin 'rlogin \!* ; echo "\033P1.y${hostname}:${cwd}\033\\\c"'
- alias rsh 'rsh \!* ; echo "\033P1.y${hostname}:${cwd}\033\\\c"'
- alias pushd 'pushd \!* ; echo "\033P1.y${hostname}:${cwd}\033\\\c"'
- alias popd 'popd \!* ; echo "\033P1.y${hostname}:${cwd}\033\\\c"'
- endif
- endif
-
- alias etags etags -t
- alias snoop '/usr/demos/bin/snoop'
- if ( "${hostname}" == "$home_host" ) then
- alias xrn 'xrn-motif &'
- endif
- alias chkalias 'rsh relay.sgi.com -l guest ypmatch -k \!* aliases'
- alias grepalias '(rsh relay.sgi.com -l guest ypcat -k aliases) | grep "\!*"'
- alias ping /usr/etc/ping
- alias bu 'cd $cwd:h'
- alias rcp 'rcp -rv'
- alias xv 'xv -8'
-
- endif
-
- ##########################################################################
- # LOGIN stuff
- #
-
- if ( $?login ) then
- #-----
- # Do pretty stuff to window border
- #
- if ( "$CONSOLE" == "true" ) then
- echo "\033P1.yConsole at ${hostname}, user: $user\033\\\c"
- else
- if ( $ansiterm == 2 ) then
- if ( $?REMOTEHOST ) then
- echo "\033P1.y${hostname}:`pwd`\033\\\c"
- echo "\033P3.y${hostname}\033\\\c"
- else
- echo "\033P1.y`pwd`\033\\\c"
- echo "\033P3.y${user}\033\\\c"
- endif
- endif
- endif
-
- #-----
- # Disable functions for f3 and f4 keys. See bindkey(1).
- #
- if ( $ansiterm == 2 ) then
- bindkey -l f3
- bindkey -l f4
- endif
-
- endif
-
- unset ansiterm
- unset home_host
-
- ### Local Variables:
- ### auto-fill-hook: nil
- ### End:
-