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