# Copyright (C) 2001, 2002  Earnie Boyd  <earnie@users.sf.net>
# This file is part of the Minimal SYStem.
#   http://www.mingw.org/msys.shtml
# 
#         File:	profile
#  Description:	Shell environment initialization script
# Last Revised:	2002.05.04

# *** Begin Modifs P. Robert (no need MINGW installation)
#     ----------------------

#if [ -z "$MSYSTEM" ]; then
#  MSYSTEM=MINGW32
#fi
# My decision to add a . to the PATH and as the first item in the path list
# is to mimick the Win32 method of finding executables.
#
# I filter the PATH value setting in order to get ready for self hosting the
# MSYS runtime and wanting different paths searched first for files.
#if [ $MSYSTEM == MINGW32 ]; then
#  export PATH=".:/usr/local/bin:/mingw/bin:/bin:$PATH"
#else
#  export PATH=".:/usr/local/bin:/bin:/mingw/bin:$PATH"
#fi

export PATH=".:/bin:$PATH"

# *** end modifs P. Robert 
#     --------------------

if [ -z "$USERNAME" ]; then
  LOGNAME="`id -un`"
else
  LOGNAME="$USERNAME"
fi

# Set up USER's home directory
if [ -z "$HOME" ]; then
  HOME="/home/$LOGNAME"
fi

if [ ! -d "$HOME" ]; then
  mkdir -p "$HOME"
  cp /etc/inputrc.default "$HOME"/.inputrc
fi

# P. Robert define history
#if [ "x$HISTFILE" == "x/.bash_history" ]; then
  HISTFILE=$HOME/.bash_history
#fi

export HOME LOGNAME MSYSTEM HISTFILE

# modif P. Robert profile.d does not exist
#for i in /etc/profile.d/*.sh ; do
#  if [ -f $i ]; then
#    . $i
#  fi
#done

export MAKE_MODE=unix


# *** Begin Modifs P. Robert for the prompt
#     -------------------------------------

#export PS1='\[\033]0;$MSYSTEM:\w\007
#\033[32m\]\u@\h \[\033[33m\w\033[0m\]
#$ '

# WHITE="\[\033[1;37m\]"
# LIGHT_BLUE="\[\033[1;34m\]"
# YELLOW="\[\033[1;33m\]"
# NO_COLOUR="\[\033[0m\]"
# 0,1 contraire
# Black       1;30     Dark Gray     1;30
# Blue        1;34     Light Blue    0;34
# Green       1;32     Light Green   0;32
# Cyan        1;36     Light Cyan    0;36
# Red         1;31     Light Red     0;31
# Purple      1;35     Light Purple  0;35
# Brown       1;33     Yellow        1;33
# Light Gray  0;37     White         1;37

export PS1='\[\033[0;32m\]\h `date +%H:%M` TU \[\033[0;31m\]\w  \[\033[34m\] 
-> '

# *** end modifs P. Robert for the prompt
#     -----------------------------------

alias clear=clsb
alias ll='ls -la'
alias ls='ls --color'
alias vi='vim -C'

##     ---------------------------------                                         
## *** Begin Modifs P. Robert for RPC 
##     ---------------------------------

# define full path of msys on unix form (mandatory for the path)
sed -e 's%\\%/%'g -e 's%:%%' -e 's%^%/%' /dir_msys.dos > /dir_msys.lx

dir_msys=`cat /dir_msys.lx`


# acces au directory bin de MinGW pour avoir gfortran
export PATH=$PATH:${dir_msys}gfortran_for_msys/bin
# acces aux librairies pour GCC
export PATH=$PATH:${dir_msys}gfortran_for_msys/lib
export LD_LIBRARY_PATH=${dir_msys}gfortran_for_msys/lib

# enlever le "buffering" par défaut de gfortran:            
export GFORTRAN_UNBUFFERED_ALL="y" 
export GFORTRAN_SHOW_LOCUS="y"
export GFORTRAN_ERROR_BACKTRACE="y"

# set tem pour utiliser vi ou vim
export TERM=xterm

#set LOGONSERVER=\\LOCALHOST

cd $dir_msys 

# execution du RPC_config.bash
# start ../run_RPC_config.bash
com=${dir_msys}run_RPC_config.bash
. $com $dir_msys   
echo

export LS_COLORS="no=0;30:di=1;31:fi=0;30:ex=0;34:ln=0;32"

## *** End   Modifs P. Robert for RPC
##     ------------------------------

