1 | # Global cshrc file |
---|
2 | # |
---|
3 | # $Id: cshrc,v 1.2 2003-03-15 16:16:03 ghudson Exp $ |
---|
4 | |
---|
5 | # This file is sourced by default user file ~/.cshrc |
---|
6 | |
---|
7 | |
---|
8 | set initdir=/usr/athena/lib/init |
---|
9 | |
---|
10 | # ******************* ENVIRONMENT SETUP ******************* |
---|
11 | |
---|
12 | # Compatibility with older versions of Athena tcsh |
---|
13 | set autolist="" |
---|
14 | if ($?tcsh) then |
---|
15 | bindkey "^W" backward-delete-word |
---|
16 | bindkey "^Z" complete-word |
---|
17 | bindkey " " magic-space |
---|
18 | |
---|
19 | if ($tcsh:r:e > 7 || $tcsh:r:r > 6) then |
---|
20 | alias bind 'echo The \"bind\" command is no longer supported in tcsh 6.08. Use the; echo \"bindkey\" command instead. See the tcsh man page for more information.; ( echo \!* > /dev/null )' |
---|
21 | endif |
---|
22 | endif |
---|
23 | |
---|
24 | # Set up standard system/user environment configuration (including setup of |
---|
25 | # environment variables, attachment of lockers, and setting of search path) |
---|
26 | |
---|
27 | if (! $?ENV_SET) then |
---|
28 | |
---|
29 | setenv ENV_SET # Avoid unnecessary repeat |
---|
30 | setenv HOSTTYPE "`/bin/athena/machtype`" |
---|
31 | setenv HOST "`hostname`" |
---|
32 | set hosttype=$HOSTTYPE |
---|
33 | set host=$HOST |
---|
34 | |
---|
35 | umask 077 # Strictly protect files |
---|
36 | # (does not apply in AFS) |
---|
37 | limit coredumpsize 0 # Don't allow coredumps |
---|
38 | setenv MORE -s # Default "more" behavior |
---|
39 | # we are now down to -s |
---|
40 | # because -d is wrong. |
---|
41 | setenv EDITOR emacs # Set default editor |
---|
42 | setenv VISUAL emacs # Set default screen editor |
---|
43 | setenv MM_CHARSET iso-8859-1 |
---|
44 | |
---|
45 | # Set standard Athena path variables. Actual $path (and thus $PATH) |
---|
46 | # are set later, after ~/.environment is sourced. |
---|
47 | |
---|
48 | switch ("$HOSTTYPE") |
---|
49 | case sun4: |
---|
50 | set athena_path=( /srvd/patch /usr/athena/bin /usr/athena/etc /bin/athena \ |
---|
51 | /usr/openwin/bin /usr/openwin/demo /usr/bin \ |
---|
52 | /usr/ccs/bin /usr/sbin /sbin /usr/ucb ) |
---|
53 | set athena_manpath=/usr/athena/man:/usr/openwin/man:/usr/dt/man:/usr/man |
---|
54 | breaksw |
---|
55 | case linux: |
---|
56 | set athena_path=( /usr/athena/bin /usr/athena/etc /bin/athena /usr/bin \ |
---|
57 | /bin /usr/X11R6/bin /usr/sbin /sbin ) |
---|
58 | set athena_manpath=/usr/athena/man:/usr/share/man:/usr/X11R6/man |
---|
59 | breaksw |
---|
60 | default: |
---|
61 | echo "Standard dotfiles do not support system type $HOSTTYPE." |
---|
62 | breaksw |
---|
63 | endsw |
---|
64 | |
---|
65 | setenv MANPATH "$athena_manpath" |
---|
66 | |
---|
67 | # Set other miscellaneous OS-specific environment variables |
---|
68 | switch ("$HOSTTYPE") |
---|
69 | case sun4: |
---|
70 | setenv LD_LIBRARY_PATH /usr/openwin/lib |
---|
71 | setenv OPENWINHOME /usr/openwin |
---|
72 | breaksw |
---|
73 | endsw |
---|
74 | |
---|
75 | setenv ATHENA_SYS `/bin/athena/machtype -S` |
---|
76 | if ( $ATHENA_SYS == "" ) then |
---|
77 | setenv ATHENA_SYS @sys |
---|
78 | endif |
---|
79 | setenv ATHENA_SYS_COMPAT `/bin/athena/machtype -C` |
---|
80 | |
---|
81 | set bindir=arch/${ATHENA_SYS}/bin |
---|
82 | |
---|
83 | if ( ! $?PRINTER && -e /var/athena/clusterinfo ) then |
---|
84 | setenv PRINTER `awk '/LPR/ { print $3 }' /var/athena/clusterinfo` |
---|
85 | if ( $PRINTER == "" ) unsetenv PRINTER |
---|
86 | endif |
---|
87 | |
---|
88 | # Reset the "home" and HOME variables to correspond to the actual |
---|
89 | # location of the user's home directory. This will avoid having |
---|
90 | # long pathnames being printed when /mit/<user> is a symlink to a |
---|
91 | # path within AFS. |
---|
92 | # |
---|
93 | # This code has been optimized to run as quickly as possible. Since |
---|
94 | # it is being invoked only at the beginning of the session, and |
---|
95 | # prior to the inclusion of any of the user's other dotfiles, we can |
---|
96 | # assume that the current directory is the user's home directory. |
---|
97 | # Also, to avoid having the shell re-evaluate the current contents |
---|
98 | # of the directory, we help it by resetting its "cwd" variable. We |
---|
99 | # do error checking just in case the path somehow disappears. |
---|
100 | |
---|
101 | set x=`/bin/pwd` |
---|
102 | if ("$x" != "") then |
---|
103 | set home=$x cwd=$x |
---|
104 | endif |
---|
105 | unset x |
---|
106 | |
---|
107 | # Special version of add alias that will work in your ~/.environment |
---|
108 | # file. This is replaced further down with the version that works |
---|
109 | # when you are logged in. |
---|
110 | |
---|
111 | # This "extend" alias and friends have been left in for backwards |
---|
112 | # compatibility with old .environment files, just in case. The new |
---|
113 | # add alias does not use them. |
---|
114 | alias extend 'if (-d \!:2) if ("$\!:1" \!~ *"\!:2"*) set extendyes && \\ |
---|
115 | if ($?extendyes && $?verboseadd) echo \!:2 added to end of \$\!:1 && \\ |
---|
116 | if ($?extendyes) setenv \!:1 ${\!:1}:\!:2 && \\ |
---|
117 | unset extendyes' |
---|
118 | alias sextend 'if (-d \!:2) if ("$\!:1" \!~ *"\!:2"*) set extendyes && \\ |
---|
119 | if ($?extendyes && $?verboseadd) echo \!:2 added to end of \$\!:1 && \\ |
---|
120 | if ($?extendyes) set \!:1=(${\!:1} \!:2) && \\ |
---|
121 | unset extendyes' |
---|
122 | alias textend 'if (-d \!:2) if ("$\!:1" \!~ *"\!:2"*) set extendyes && \\ |
---|
123 | if ($?extendyes && $?verboseadd) echo \!:2 added to end of \$\!:1 && \\ |
---|
124 | if ($?extendyes) set \!:1=${\!:1}:\!:2 && \\ |
---|
125 | unset extendyes' |
---|
126 | |
---|
127 | alias add 'eval `/bin/athena/attach -Padd -P "$athena_path" \!:*`' |
---|
128 | |
---|
129 | # Run user environment customizations identified in your |
---|
130 | # ~/.environment file. This is the place to include your own |
---|
131 | # environment variables, attach commands, and other system wide |
---|
132 | # setup commands. You can also cancel default behaviors listed |
---|
133 | # above with "unsetenv" or "setenv". ~/.environment is not sourced |
---|
134 | # if NOCALLS is set (i.e., if you selected the xlogin "Ignore your |
---|
135 | # customizations" option when you logged in). |
---|
136 | |
---|
137 | if ((! $?NOCALLS) && (-r ~/.environment)) source ~/.environment |
---|
138 | |
---|
139 | # remove temporary version of add |
---|
140 | unalias extend sextend textend add |
---|
141 | alias add 'echo Use add in your ~/.environment, not your ~/.path.' |
---|
142 | |
---|
143 | # Reset athena_manpath in case .path uses it (.path should just use |
---|
144 | # $MANPATH, but using $athena_manpath has worked historically). |
---|
145 | set athena_manpath=$MANPATH |
---|
146 | |
---|
147 | # Set up default search path, if not yet set. Use your ~/.path file |
---|
148 | # to provide an alternative path -- this file should be of the form |
---|
149 | # "set path=...", and can refer to the shell variable $athena_path, |
---|
150 | # defined above. The ~/.path file should list a complete path, since |
---|
151 | # the path identified there will be used INSTEAD of the default |
---|
152 | # path, not appended. ~/.path is not sourced if the xlogin "Ignore |
---|
153 | # your customizations" option was selected to begin the session. |
---|
154 | |
---|
155 | if ((! $?NOCALLS) && (-r ~/.path)) then |
---|
156 | # User-specified path |
---|
157 | source ~/.path |
---|
158 | else |
---|
159 | # Standard Athena path |
---|
160 | set path=(`/usr/athena/bin/athdir $HOME` $athena_path .) |
---|
161 | endif |
---|
162 | |
---|
163 | # Make sure applications can properly find their appdefs, etc. |
---|
164 | |
---|
165 | if (! $?XUSERFILESEARCHPATH) then |
---|
166 | setenv XUSERFILESEARCHPATH "/usr/athena/lib/X11/app-defaults/%N" |
---|
167 | else |
---|
168 | setenv XUSERFILESEARCHPATH "${XUSERFILESEARCHPATH}:/usr/athena/lib/X11/app-defaults/%N" |
---|
169 | endif |
---|
170 | endif |
---|
171 | |
---|
172 | # Set appropriate bin directory variable for this platform |
---|
173 | # (e.g., vaxbin for VAXstations, decmipsbin for pMAXen, etc.; this will |
---|
174 | # be included in actual searchpath as ~/$bindir -- e.g., ~/vaxbin): |
---|
175 | set bindir=arch/${ATHENA_SYS}/bin |
---|
176 | |
---|
177 | # ******************* C SHELL SETUP ******************* |
---|
178 | |
---|
179 | # Set up standard C shell initializations |
---|
180 | |
---|
181 | set noclobber # Don't overwrite files with redirection |
---|
182 | |
---|
183 | if ($?prompt) then # For interactive shells only (i.e., NOT rsh): |
---|
184 | # Set prompt. |
---|
185 | set promptchars="%#" |
---|
186 | if ($home =~ /var/athena/tmphomedir/*) then |
---|
187 | set prompt = "athena (temporary homedir)%# " |
---|
188 | else |
---|
189 | set prompt = "athena%# " |
---|
190 | endif |
---|
191 | |
---|
192 | set history = 20 # Number of commands saved as history |
---|
193 | set cdpath = (~) # Path to search for directory changes |
---|
194 | set interactive # Provide shell variable for compatability |
---|
195 | set nostat = (/afs/) # Don't stat when completing in /afs |
---|
196 | endif |
---|
197 | |
---|
198 | set hosttype=$HOSTTYPE |
---|
199 | set host=$HOST |
---|
200 | |
---|
201 | # Set up standard C shell aliases |
---|
202 | |
---|
203 | # alias for re-establishing authentication |
---|
204 | alias renew 'kinit $USER && fsid -a && zctl load /dev/null' |
---|
205 | |
---|
206 | # alias for a convenient way to change terminal type |
---|
207 | alias term 'set noglob; unsetenv TERMCAP; eval `tset -s -I -Q \!*`' |
---|
208 | |
---|
209 | # aliases dealing with x window system |
---|
210 | alias xresize 'set noglob; eval `resize -c` || unset noglob' |
---|
211 | |
---|
212 | if ($?XSESSION) then |
---|
213 | if ("$XSESSION" == "") then |
---|
214 | alias logout 'exit && end_session' # logout for X |
---|
215 | else |
---|
216 | alias logout 'exit && kill -HUP $XSESSION' # logout for X |
---|
217 | endif |
---|
218 | endif |
---|
219 | |
---|
220 | # aliases dealing with adding locker programs |
---|
221 | # extend remains for other software; add no longer uses the extend alias |
---|
222 | alias extend 'if (-d \!:2) if ("$\!:1" \!~ *"\!:2"*) set extendyes && \\ |
---|
223 | if ($?extendyes && $?verboseadd) echo \!:2 added to end of \$\!:1 && \\ |
---|
224 | if ($?extendyes) setenv \!:1 ${\!:1}:\!:2 && \\ |
---|
225 | unset extendyes' |
---|
226 | |
---|
227 | set add_flags |
---|
228 | alias add 'eval `/bin/athena/attach -Padd $add_flags \!:*`' |
---|
229 | |
---|
230 | # aliases dealing with subjects |
---|
231 | alias setup_X '( setenv SUBJECT \!:1 ; ( xterm -title \!* & ) )' |
---|
232 | alias setup_tty '( setenv SUBJECT \!* ; $SHELL )' |
---|
233 | if ($?XSESSION) then |
---|
234 | alias setup setup_X |
---|
235 | else |
---|
236 | alias setup setup_tty |
---|
237 | endif |
---|
238 | alias remove 'setenv SUBJECT \!* ; source $initdir/env_remove' |
---|
239 | |
---|
240 | # If this is a subject window, run the env_setup script |
---|
241 | if (($?SUBJECT) && (-r $initdir/env_setup)) source $initdir/env_setup |
---|
242 | |
---|
243 | |
---|
244 | # All of the C shell initializing commands above can be overridden by |
---|
245 | # using "unset" or "unalias" commands (or by changing things using |
---|
246 | # "set" or "alias" again) in your ~/.cshrc.mine file, which is sourced |
---|
247 | # here. ~/.cshrc.mine is not sourced if the xlogin "Ignore your |
---|
248 | # customizations" option was selected to begin the session. |
---|
249 | |
---|
250 | if ((! $?NOCALLS) && (-r ~/.cshrc.mine)) source ~/.cshrc.mine |
---|