Removed /usr/local from CDPATH
[clearscm.git] / rc / set_path
1 #!/bin/bash
2 ################################################################################
3 #
4 # File:         $RCSfile: set_path,v $
5 # Revision:     $Revision: 1.8 $
6 # Description:  Sets the path from scratch
7 # Author:       Andrew@DeFaria.com
8 # Created:      Thu Jun  6 08:31:57 PDT 1996
9 # Modified:     $Date: 2012/09/20 18:10:28 $
10 # Language:     bash
11 #
12 # (c) Copyright 2000-2005, Andrew@DeFaria.com, all rights reserved.
13 #
14 ################################################################################
15 function append_to_path {
16   component="$1"
17
18   if [ -d "$component" ]; then
19     if [ -z "$PATH" ]; then 
20       PATH="$component"
21     else
22       PATH="$PATH:$component"
23     fi
24   fi
25 } # append_to_path
26
27 function prepend_to_path {
28  component="$1"
29
30   if [ -d "$component" ]; then
31     PATH="$component:$PATH"
32   fi
33 } # prepend_to_path
34
35 function append_to_manpath {
36   component="$1"
37   
38   if [ -d "$component" ]; then
39     if [ -z "$MANPATH" ]; then 
40       MANPATH="$component"
41     else
42       MANPATH="$MANPATH:$component"
43     fi
44   fi
45 } # append_to_manpath
46
47 if [ -x /app/manpath ]; then
48   OLDIFS=$IFS
49   IFS=:
50   for manpath in $(/app/manpath); do
51     manpath_dirs="$manpath_dirs $manpath"
52   done
53   IFS=$OLDIFS
54 fi
55     
56 # Set up PATH
57 path_dirs=
58
59 if [ -f /etc/PATH ]; then
60   OLDIFS=$IFS
61   IFS=:
62   for path in $(cat /etc/PATH); do
63     path_dirs="$path_dirs $path"
64   done
65   IFS=$OLDIFS
66 fi
67
68 if [ "$SYSTEMROOT" ]; then
69   systemroot=$(cygpath -u $SYSTEMROOT)
70 fi
71
72 path_dirs="$path_dirs\
73   .\
74   "$HOME/bin"\
75   $adm_base/bin\
76   $adm_base/cc\
77   $adm_base/cq\
78   $adm_base/cvsbin\
79   /opt/Rational/Clearcase/bin\
80   /opt/Rational/ClearQuest\
81   /opt/Rational/Common\
82   /usr/local/mysql/bin\
83   /usr/local/maps/bin\
84   /usr/local/ddts/bin\
85   /usr/local/bin\
86   /usr/afsws/bin\
87   /usr/afsws\
88   /usr/xpg4/bin\
89   /bin\
90   /sbin\
91   /usr/bin\
92   /usr/games\
93   /usr/X11R6/bin\
94   /usr/bin/X11\
95   /usr/dt/bin\
96   /usr/openwin/bin\
97   /usr/kerberos/bin\
98   /opt/rational/clearcase/bin\
99   /opt/rational/clearquest/bin\
100   /opt/ibm/rationalsdlc/clearcase/bin\
101   /opt/ibm/rationalsdlc/clearcase/etc\
102   /opt/ibm/rationalsdlc/clearquest/bin\
103   /opt/ibm/rationalsdlc/clearquest\
104   /opt/ibm/rationalsdlc/common\
105   /opt/mycroft-core/bin\
106   /opt/perforce/bin\
107   /opt/perforce/sbin\
108   /usr/sbin\
109   /usr/ccs/bin\
110   /usr/seos/bin\
111   /usr/ucb\
112   /opt/ssh/bin\
113   /tools/bin\
114   /snap/bin\
115   /System/bin\
116   /opt/bin\
117   $systemroot/System32\
118   $systemroot\
119 "
120
121 manpath_dirs="\
122   /usr/share/man\
123   /usr/dt/man\
124   /usr/dt/man/man1\
125   /usr/cns/man\
126   /usr/local/packages/ccperl/ccperl5.001m/man\
127   /usr/local/packages/atria/current/man\
128   /usr/local/packages/emacs/man\
129   /usr/seos/man\
130   /opt/ssh/man\
131   /opt/medusa/share/man\
132   /usr/afsws/man\
133 "
134
135 PATH=
136 for component in $path_dirs; do
137   append_to_path "$component"
138 done
139
140 # Set up MANPATH
141 if [ -f /etc/MANPATH ]; then
142   MANPATH=$(cat /etc/MANPATH)
143 fi
144
145 for component in $manpath_dirs; do
146   append_to_manpath "$component"
147 done
148
149 # Set up SHLIB_PATH
150 if [ "hp-ux" = "10" ]; then
151   export SHLIB_PATH=$(cat /etc/SHLIB_PATH)
152   export SHLIB_PATH=$SHLIB_PATH:$M_LROOT/bin
153   export LD_LIBRARY_PATH=$SHLIB_PATH:$M_LROOT/bin
154 fi