# $Date: 2008-11-01 10:58:27 +0100 (Sat, 01 Nov 2008) $
# This file is sourced by all *interactive* bash shells on startup.
# This file *should generate no output* or it will break the scp and rcp commands.

# Source global definITIONs
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

if test "$HOSTNAME" == chip  ; then
export PATH=/usr/local/mpich2-gcc43/bin/:$PATH
export LD_LIBRARY_PATH=/usr/local/mpich2-gcc43-libs/:$LD_LIBRARY_PATH
export MPIRUN_DEVICE=ch_p4
fi


# colors for ls, etc.
#eval `dircolors -b /etc/DIR_COLORS`
# Change the window title of X terminals

case $TERM in
        # default setup for gentoo
        xterm*|rxvt|Eterm|eterm)
                PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
                ;;
        screen)
                PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
                ;;
#       linux)
#               PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
#               ;;
        screen.linux)
                PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
                ;;
esac

# Non interactive MPI runs on behalf of my user need some environmente variables to be set in a certain manner.
# This setup, however, is not portable.

#export MPICHDIR=/usr/local/mpich-1.2.7-gcc-4.2-20070307/
#export MPICHDIR=/usr/local/mpich-gcc42/bin
#export GCCDIR=/usr/local/gcc42/
#export PATH=$MPICHDIR:$PATH
#export LD_LIBRARY_PATH="${MPICHDIR}lib:${GCCDIR}lib:$LD_LIBRARY_PATH"

# Time zone information
#export TZ="GMT-1"      # spaghetti zeit
#export TZ="GMT-2"      # spaghetti zeit (...)

# If not running interactively, don't do anything (prash)
# (on bibo it is known to block user KDE startup (via XDM) )
#[ -z "$PS1" -a "$HOSTNAME" != "bibo" ] && exit
# 20080729 this exit is evil : it breaks scp ...

# uncomment the following to activate bash-completion:
#[ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion

# coloured prompt (gentoo's default)
export PS1="\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]"
export NNTPSERVER='news.tiscali.it'
#export NNTPSERVER='news2.autistici.org'

#used by yacc. for security reasons in the ~
export TMPDIR=~/.tmp

# These variables are used for system tools and personal scripts
export PEN=/mnt/cam
export PENB=/mnt/camb
export EDITOR=/usr/bin/vim

# this is EVIL
#PATH=/home/$USER/bin:$PATH
#PATH=~/bin:$PATH

# we would like to have the widest possible path
PATH=$PATH:/opt/bin
PATH=$PATH:/usr/games/bin/
#PATH=$PATH:/usr/kde/3.3/bin/kppp
alias feeds=raggle      # :)
PATH=$PATH:/opt/blackdown-jdk-1.4.2.03/bin/

#the path grows and grows..
PATH=~/bin:/sbin/:$PATH:/usr/sbin
PATH=$PATH:/home/dez/documents/programming/PMARST/bin

#if [ -f ~/.profile ]; then  . ~/.profile  ; fi

#midinight commander fixes
if [ -f /usr/share/mc/mc.gentoo ]; then
    . /usr/share/mc/mc.gentoo
fi

#setfont koi8r-8x16.gz

#setfont sun12x22.psfu.gz  -m 8859-1
#setfont LatArCyrHeb-19 -m 8859-1

#breaks mpich ?
#[ "$DISPLAY" == "" -a -f /bin/setfont ] && ( setfont  LatArCyrHeb-16.psfu.gz -m 8859-1 2>&1 > /dev/null )

#export LANG='it_IT.UTF-8'

# BASH shopt is described at SHELL BUILTIN COMMANDS in man bash
#set -o vi      #makes bash command line editing behave like vi :) (default is emacs)
shopt -s expand_aliases # i love aliases
#set -o  history        # no history as long as in bashrc
#shopt  -u exitfail     # don't exit on failure
#shopt -u nocaseglob    # case insensitive globbing
#shopt -u nocasematch   # case insensitive matching
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
#shopt -s promptvars    # prompt variables are expanded.. (enabled by default)
shopt -s checkwinsize

[ -f /bin/dircolors -a -f /etc/DIR_COLORS ] && eval `dircolors -b /etc/DIR_COLORS`

#ln -s /usr/bin/docbook2html /usr/bin/db2html
#ln -s /usr/bin/docbook2pdf /usr/bin/db2pdf

# frankly, I forgot the reason for keeping this one.. see man ld.so
#        LD_BIND_NOW
#              (libc5; glibc since 2.1.1) If set to non-empty string, causes the dynamic linker to resolve all  sym-
#              bols  at program startup instead of deferring function call resolval to the point when they are first
#              referenced.  This is useful when using a debugger.
# LD_BIND_NOW=1
# for messing up things
# LD_PRELOAD=1

# some aliases are ugly and stinky, so i made them private
[ -f ~/.alias         ] && . ~/.alias
[ -f ~/.alias_private ] && . ~/.alias_private

# when working on a foreign non Linux machine, typos can be dangerous
[ "`uname`" != "Linux" ] && export HISTFILE=''

# some host specific stuff..
# i happen to work sometimes on a Darwin PPC machine with fink installed.
[ "`uname`" == "Darwin" ] && export PATH="/sw/bin:/sw/sbin:$PATH" && export MANPATH="/sw/share/man/:$MANPATH" 
[ "`uname`" == "Darwin" ] && export DYLD_LIBRARY_PATH="/sw/share/lib:$DYLD_LIBRARY_PATH" 
[ -d /opt/bin/  ] && export PATH="/opt/bin:$PATH"
[ -d /opt/sbin/ ] && export PATH="/opt/sbin:$PATH"
[ "`hostname`" == "epsilon" ] && export LD_LIBRARY_PATH=/opt/gcc43/lib/:$LD_LIBRARY_PATH

alias kbdhelp='setxkbmap -layout it'
#MANPATH=$MANPATH:/usr/local/gcc-4.2-20061031/man/
#MANPATH=/usr/local/gcc-4.2-20070307/man/:$MANPATH
#PATH=$PATH:/opt/sourcenav/bin/

### Taken from prashblog.com
# C-s does not stop the terminal anymore (taken from prash)
#stty stop  '^-'
#stty start '^-'

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups

#PATH=$PATH:/home/dez/uni/tesi/enea/PMARST/
#PATH=$PATH:/home/dez/uni/tesi/enea/PMARST/bin

# locale stuff.. the alternative is POSIX o/
#export LC_ALL="C"
export HOSTNAME
export LANG="en_US.UTF-8"
#export LC_ALL="it_IT.UTF-8"
#export LC_ALL="en_US.UTF-8"
export LC_ALL="C"
#export LANG="it_IT.UTF-8"

[[ "$HOSTNAME" == bibo ]] && {
# bibo likes utf-8
export LANG="it_IT.UTF-8"
export LC_ALL="it_IT.UTF-8"
}


# setfont ter-u16n
# this makes only sense with no X nor screen : tries using unicode
( [ "$DISPLAY" == '' -a "$TERM" != "screen" -o "$TERM" == "linux" ] && \
        which unicode_start > /dev/null && unicode_start && setfont /usr/share/consolefonts/LatArCyrHeb-16 -m 8859-1 ) \
        2>/dev/null

# in /etc/conf.d/consolefont :
#CONSOLEFONT=LatArCyrHeb-16  # Latin, Arabic (only isolated forms, Cyrillic, Hebrew)

[[ x"$HOSTNAME" =~ "xcresco" ]] && [[ -f ~/.mpi-selector ]] && .  /var/mpi-selector/data/`cat ~/.mpi-selector`.sh


#shopt -o  histappend