[17853] | 1 | # Global cshrc file |
---|
| 2 | # |
---|
[22667] | 3 | # $Id: cshrc,v 1.12 2007-08-22 18:12:33 ghudson Exp $ |
---|
[17853] | 4 | |
---|
| 5 | # This file is sourced by default user file ~/.cshrc |
---|
| 6 | |
---|
| 7 | |
---|
[22913] | 8 | set initdir=/usr/lib/init |
---|
[17853] | 9 | |
---|
[25097] | 10 | # Determine if we're in an sftp or scp session, and if so, be quiet |
---|
| 11 | set SILENT=no |
---|
| 12 | if ($?command) then |
---|
[25803] | 13 | switch ("${command:q}") |
---|
[25364] | 14 | case '*/usr/lib/openssh/sftp-server': |
---|
[25097] | 15 | set SILENT=yes |
---|
| 16 | breaksw |
---|
[25100] | 17 | case 'scp *': |
---|
[25097] | 18 | set SILENT=yes |
---|
| 19 | breaksw |
---|
| 20 | endsw |
---|
| 21 | endif |
---|
| 22 | |
---|
[17853] | 23 | # ******************* ENVIRONMENT SETUP ******************* |
---|
| 24 | |
---|
| 25 | # Compatibility with older versions of Athena tcsh |
---|
| 26 | set autolist="" |
---|
| 27 | if ($?tcsh) then |
---|
| 28 | bindkey "^W" backward-delete-word |
---|
| 29 | bindkey "^Z" complete-word |
---|
| 30 | bindkey " " magic-space |
---|
| 31 | |
---|
| 32 | endif |
---|
| 33 | |
---|
[19645] | 34 | # Set host type and hostname variables. |
---|
[22913] | 35 | if (! $?ATHENA_HOSTTYPE) setenv ATHENA_HOSTTYPE "`/bin/machtype`" |
---|
[19645] | 36 | if (! $?HOST) setenv HOST "`hostname`" |
---|
| 37 | setenv HOSTTYPE "$ATHENA_HOSTTYPE" |
---|
| 38 | set hosttype=$HOSTTYPE |
---|
| 39 | set host=$HOST |
---|
| 40 | |
---|
[17853] | 41 | # Set up standard system/user environment configuration (including setup of |
---|
[22940] | 42 | # environment variables, attachment of lockers, and additions to search path) |
---|
[17853] | 43 | |
---|
| 44 | if (! $?ENV_SET) then |
---|
| 45 | |
---|
| 46 | setenv ENV_SET # Avoid unnecessary repeat |
---|
| 47 | |
---|
[24770] | 48 | # Ensure user's homedir is attached, for legacy things |
---|
| 49 | # that care about attachtab |
---|
[24792] | 50 | # Only attach if running as an Athena user, not e.g. using sudo. |
---|
[24793] | 51 | if ( $?DEBATHENA_HOME_TYPE ) then |
---|
| 52 | if ( $DEBATHENA_HOME_TYPE == afs ) then |
---|
| 53 | if ( $?ATHENA_USER ) then |
---|
[24795] | 54 | /bin/attach -h -q "$ATHENA_USER" |
---|
[24793] | 55 | else |
---|
[24795] | 56 | /bin/attach -h -q "$USER" |
---|
[24793] | 57 | endif |
---|
| 58 | endif |
---|
[24792] | 59 | endif |
---|
[24770] | 60 | |
---|
[22975] | 61 | if (-r ~/.generation) then |
---|
| 62 | setenv ATHENA_DOTFILE_GENERATION `cat ~/.generation` |
---|
| 63 | else |
---|
| 64 | setenv ATHENA_DOTFILE_GENERATION 0 |
---|
| 65 | endif |
---|
| 66 | |
---|
[17853] | 67 | limit coredumpsize 0 # Don't allow coredumps |
---|
| 68 | setenv MORE -s # Default "more" behavior |
---|
| 69 | # we are now down to -s |
---|
| 70 | # because -d is wrong. |
---|
| 71 | setenv EDITOR emacs # Set default editor |
---|
| 72 | setenv MM_CHARSET iso-8859-1 |
---|
| 73 | |
---|
[23438] | 74 | setenv EMAIL "$USER@mit.edu" # Set default email address |
---|
| 75 | |
---|
[22913] | 76 | setenv ATHENA_SYS `/bin/machtype -S` |
---|
[17853] | 77 | if ( $ATHENA_SYS == "" ) then |
---|
| 78 | setenv ATHENA_SYS @sys |
---|
| 79 | endif |
---|
[22913] | 80 | setenv ATHENA_SYS_COMPAT `/bin/machtype -C` |
---|
[17853] | 81 | |
---|
| 82 | set bindir=arch/${ATHENA_SYS}/bin |
---|
| 83 | |
---|
[23132] | 84 | if ( ! $?PRINTER && -e /var/run/athena-clusterinfo.csh ) then |
---|
[25864] | 85 | # Backticks will get us a subshell to avoid any other variables |
---|
[25954] | 86 | setenv PRINTER `setenv LPR '' && source /var/run/athena-clusterinfo.csh && echo $LPR` |
---|
[17853] | 87 | if ( $PRINTER == "" ) unsetenv PRINTER |
---|
| 88 | endif |
---|
| 89 | |
---|
| 90 | # Reset the "home" and HOME variables to correspond to the actual |
---|
| 91 | # location of the user's home directory. This will avoid having |
---|
| 92 | # long pathnames being printed when /mit/<user> is a symlink to a |
---|
| 93 | # path within AFS. |
---|
| 94 | |
---|
[22667] | 95 | set x=`(cd && /bin/pwd)` |
---|
[17853] | 96 | if ("$x" != "") then |
---|
[22667] | 97 | set home=$x |
---|
| 98 | if ("$x" == "`/bin/pwd`") then |
---|
| 99 | set cwd=$x |
---|
| 100 | endif |
---|
[17853] | 101 | endif |
---|
| 102 | unset x |
---|
| 103 | |
---|
[23842] | 104 | # NOTE: |
---|
| 105 | # The use of the "extend", "sextend", and "textend" aliases in |
---|
| 106 | # ~/.environment is no longer supported. Consult the Athena |
---|
| 107 | # documentation on Dotfiles for supported dotfile operations |
---|
[23049] | 108 | |
---|
[17853] | 109 | # Run user environment customizations identified in your |
---|
| 110 | # ~/.environment file. This is the place to include your own |
---|
| 111 | # environment variables, attach commands, and other system wide |
---|
| 112 | # setup commands. You can also cancel default behaviors listed |
---|
| 113 | # above with "unsetenv" or "setenv". ~/.environment is not sourced |
---|
| 114 | # if NOCALLS is set (i.e., if you selected the xlogin "Ignore your |
---|
| 115 | # customizations" option when you logged in). |
---|
| 116 | |
---|
[25097] | 117 | if ((! $?NOCALLS) && (-r ~/.environment)) then |
---|
| 118 | if ( $SILENT == "yes" ) then |
---|
[25098] | 119 | source ~/.environment >&/dev/null |
---|
| 120 | else |
---|
[25097] | 121 | source ~/.environment |
---|
| 122 | endif |
---|
| 123 | endif |
---|
[17853] | 124 | |
---|
[23842] | 125 | # NOTE: |
---|
| 126 | # .path files are no longer supported, consult Athena documentation |
---|
| 127 | # for the correct way to specify your PATH |
---|
| 128 | |
---|
| 129 | # Standard Athena path additions. |
---|
| 130 | set path=(`/usr/bin/athdir $HOME` $path .) |
---|
[23049] | 131 | |
---|
[17853] | 132 | endif |
---|
| 133 | |
---|
| 134 | # Set appropriate bin directory variable for this platform |
---|
| 135 | # (e.g., vaxbin for VAXstations, decmipsbin for pMAXen, etc.; this will |
---|
| 136 | # be included in actual searchpath as ~/$bindir -- e.g., ~/vaxbin): |
---|
| 137 | set bindir=arch/${ATHENA_SYS}/bin |
---|
| 138 | |
---|
| 139 | # ******************* C SHELL SETUP ******************* |
---|
| 140 | |
---|
| 141 | # Set up standard C shell initializations |
---|
| 142 | |
---|
| 143 | set noclobber # Don't overwrite files with redirection |
---|
| 144 | |
---|
| 145 | if ($?prompt) then # For interactive shells only (i.e., NOT rsh): |
---|
| 146 | set interactive # Provide shell variable for compatability |
---|
| 147 | endif |
---|
| 148 | |
---|
| 149 | # Set up standard C shell aliases |
---|
| 150 | |
---|
| 151 | if ($?XSESSION) then |
---|
[25379] | 152 | if ( -x /usr/bin/gnome-session-quit ) then |
---|
[25644] | 153 | alias logout 'exit && /usr/lib/init/check-for-reboot && gnome-session-quit --no-prompt' # logout for X |
---|
[25379] | 154 | else |
---|
[25644] | 155 | alias logout 'exit && /usr/lib/init/check-for-reboot && gnome-session-save --kill --silent' # logout for X |
---|
[25379] | 156 | endif |
---|
[17853] | 157 | endif |
---|
| 158 | |
---|
| 159 | # aliases dealing with subjects |
---|
| 160 | alias setup_X '( setenv SUBJECT \!:1 ; ( xterm -title \!* & ) )' |
---|
| 161 | alias setup_tty '( setenv SUBJECT \!* ; $SHELL )' |
---|
| 162 | if ($?XSESSION) then |
---|
| 163 | alias setup setup_X |
---|
| 164 | else |
---|
| 165 | alias setup setup_tty |
---|
| 166 | endif |
---|
[23782] | 167 | alias remove 'setenv SUBJECT \!* ; source $initdir/env_remove ; unsetenv SUBJECT' |
---|
[17853] | 168 | |
---|
| 169 | # If this is a subject window, run the env_setup script |
---|
| 170 | if (($?SUBJECT) && (-r $initdir/env_setup)) source $initdir/env_setup |
---|
| 171 | |
---|
| 172 | |
---|
| 173 | # All of the C shell initializing commands above can be overridden by |
---|
| 174 | # using "unset" or "unalias" commands (or by changing things using |
---|
| 175 | # "set" or "alias" again) in your ~/.cshrc.mine file, which is sourced |
---|
| 176 | # here. ~/.cshrc.mine is not sourced if the xlogin "Ignore your |
---|
| 177 | # customizations" option was selected to begin the session. |
---|
| 178 | |
---|
[25097] | 179 | if ((! $?NOCALLS) && (-r ~/.cshrc.mine)) then |
---|
| 180 | if ( $SILENT == "yes" ) then |
---|
[25098] | 181 | source ~/.cshrc.mine >&/dev/null |
---|
| 182 | else |
---|
[25097] | 183 | source ~/.cshrc.mine |
---|
| 184 | endif |
---|
| 185 | endif |
---|
[25590] | 186 | |
---|
| 187 | if (! $?skip_sanity_checks) then |
---|
[25593] | 188 | set missing=0 |
---|
[25631] | 189 | echo $path | /usr/bin/tr ' ' '\n' | /bin/grep -Fqx /bin |
---|
[25590] | 190 | if ( $? != 0 ) then |
---|
[25593] | 191 | set missing=1 |
---|
[25590] | 192 | endif |
---|
[25631] | 193 | echo $path | /usr/bin/tr ' ' '\n' | /bin/grep -Fqx /usr/bin |
---|
[25590] | 194 | if ( $? != 0 ) then |
---|
[25593] | 195 | set missing=1 |
---|
[25590] | 196 | endif |
---|
| 197 | if ( $missing == 1 ) then |
---|
[25601] | 198 | set text="You appear to have incorrectly modified your PATH variable in your dotiles,\nand as such have deleted /bin and/or /usr/bin from your PATH, which\nwill likely cause this login session to fail. Please correct this problem.\nThis warning can be disabled with 'set skip_sanity_checks=t' in ~/.cshrc.mine." |
---|
[25590] | 199 | echo "$text" > /dev/stderr |
---|
| 200 | if ( $?DISPLAY) then |
---|
| 201 | /usr/bin/zenity --warning --text="$text" |
---|
| 202 | endif |
---|
| 203 | endif |
---|
| 204 | if ( $?LD_ASSUME_KERNEL ) then |
---|
| 205 | unsetenv LD_ASSUME_KERNEL |
---|
[25601] | 206 | set text="In your dotfiles, you set LD_ASSUME_KERNEL. This generally causes undesirable behavior.\nIt has been unset for you.\nIf you really wanted it set, you can add 'set skip_sanity_checks=t' to your ~/.cshrc.mine." |
---|
[25593] | 207 | echo "$text" > /dev/stderr |
---|
[25590] | 208 | if ( $?DISPLAY) then |
---|
[25593] | 209 | /usr/bin/zenity --warning --text="$text" |
---|
[25590] | 210 | endif |
---|
| 211 | endif |
---|
| 212 | endif |
---|