Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 10221 Details for
Bug 18766
gcc-config reduces gcc performance to 1/10
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
bash PATH manipulation functions
bashstuff (text/plain), 4.53 KB, created by
Aron Griffis (RETIRED)
on 2003-04-05 07:45:22 UTC
(
hide
)
Description:
bash PATH manipulation functions
Filename:
MIME Type:
Creator:
Aron Griffis (RETIRED)
Created:
2003-04-05 07:45:22 UTC
Size:
4.53 KB
patch
obsolete
># $Id: bashrc,v 1.10 2003/03/14 21:17:47 agriffis Exp $ ># ># This file contains the base configuration. This file is read for ># both login shells (via .bash_profile) and non-login shells. Note ># that it returns halfway through for non-interactive shells. > > ># This configuration is dependent on the functions from .bashrc.funcs. ># None of the other .bashrc.* files are truly necessary and their ># absence will not generate errors. >. $HOME/.bashrc.funcs > > >####################################################################### ># Non-interactive settings >####################################################################### > ># Load /etc/profile to pick up system environment changes, ># however this will load PS1 which erases our ability to detect a ># non-interactive shell. >[ -n "$PS1" ] && _interactive_shell=1 >. /etc/profile > ># PATH ># ---- > >frontpath PATH \ > /usr/local/bin /usr/local/sbin \ > /usr/bin/mme \ > /usr/bin /bin \ > /usr/sbin /sbin \ > /usr/dt/bin /usr/bin/X11 /usr/X11R6/bin /usr/bin/X11/demos \ > /usr/bin/mtools /usr/ucb /etc /usr/etc /usr/games >[ "$HOME" = / ] || frontpath PATH $HOME/bin > ># remove . security hole from PATH, added by some foolish sysadmins >rmpath PATH . > ># fix for POSIX.2 idiocy that assumes you mean . when there's an empty ># element in PATH >rmpath PATH '' >export PATH > ># All done if non-interactive >[ "$_interactive_shell" = 1 ] || return >unset _interactive_shell # don't need this anymore > > >####################################################################### ># Below actually lives in my .bashrc.funcs. I didn't include the ># whole thing because much of it is specific to other operating ># systems where I work. Also, only frontpath and rmpath are used ># above. >####################################################################### > ># syntax: inpath PATHvar element ># example: ># if inpath PATH /usr/bin; then ># echo "Your PATH contains /usr/bin" ># fi >inpath() { > local curpath > eval curpath=\$$1 > case "$curpath" in > $2|$2:*|*:$2|*:$2:*) return 0 ;; > *) return 1 ;; > esac >} > > ># rmpath uses some bash2 specific features... so provide ># a bash1 compatibility version. >if [ ${BASH_VERSION%%.*} -ge 2 ]; then > > # syntax: rmpath PATHvar element1 [ element2 ... ] > # example: > # rmpath MANPATH /usr/local/man > rmpath() { > local newpath e PATHvar > PATHvar=$1 > eval newpath=\$$1 > shift > for e in "$@"; do > newpath=${newpath/#$e:} > newpath=${newpath//:$e:/:} > newpath=${newpath/%:$e} > [ "$newpath" = "$e" ] && { newpath=; break; } > done > eval $PATHvar=\$newpath > } > >else # bash1 compatibility > > # syntax: rmpath PATHvar element1 [ element2 ... ] > # Remove all occurences of each element from PATHvar > rmpath() { > local newpath e PATHvar > PATHvar=$1 > eval newpath=\$$1 > shift > for e in "$@"; do > while true; do > case "$newpath" in > $e:*) newpath="${newpath#$e:}" ;; > *:$e) newpath="${newpath%:$e}" ;; > *:$e:*) newpath="${newpath%%:$e:*}:${newpath#*:$e:}" ;; > $e) newpath=; break 2 ;; # all the way out > *) break ;; > esac > done > done > eval $PATHvar=\$newpath > } > >fi # end bash1 compatibility > > ># syntax: frontpath PATHvar element1 [ element2 ... ] ># Remove all occurences of each element, then prepend elements >frontpath() { > local e oldpath newpath PATHvar > PATHvar=$1 > eval oldpath=\$$PATHvar > newpath= > shift > rmpath oldpath $* > for e in "$@"; do > newpath="$newpath${newpath:+:}$e" > done > eval $PATHvar='$newpath${oldpath:+:}$oldpath' >} > > ># syntax: addpath PATHvar element1 [ element2 ... ] ># Remove all occurences of each element, then append elements >addpath() { > local e oldpath newpath PATHvar > PATHvar=$1 > eval oldpath=\$$PATHvar > newpath= > shift > rmpath oldpath $* > for e in "$@"; do > newpath="$newpath${newpath:+:}$e" > done > eval $PATHvar='$oldpath${oldpath:+:}$newpath' >} > > ># syntax: cleanpath PATHvar ># Clean up PATHvar by removing duplicate elements and doubled slashes >cleanpath() { > local e oldpath newpath PATHvar _IFS > PATHvar=$1 > eval oldpath=\$$PATHvar > # Get rid of doubled slashes > while true; do > case "$oldpath" in > *//*) oldpath=${oldpath%%//*}/${oldpath#*//} ;; > *) break ;; > esac > done > # Remove duplicate elements > _IFS="$IFS"; IFS=':' > for e in $oldpath; do > # Remove trailing slash; the ? is to prevent removal of root dir! > case "$e" in > *?/) e="${e%/}" ;; > esac > # Append to newpath if not seen yet > case "$newpath" in > $e|$e:*|*:$e|*:$e:*) continue ;; > *) newpath="$newpath${newpath:+:}$e" ;; > esac > done > IFS="$_IFS" > eval $PATHvar='"$newpath"' >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 18766
: 10221 |
10224
|
10331