#!/bin/bash
# sync - Synchronise Configuration Files
# Author: Sean B. Palmer, inamidst.com
# @@ Only tested on Max OS X 10.4

function update() { 
   cmp --silent $1 $2

   if (( $? ))
   then cp -p $1 $2
        echo "UPDATED: $1 -> $2"
   else echo "Skipped: $1 -> $2"
   fi
}

# Operating System independent
update emacs ~/.emacs
update emacs.elc ~/.emacs.elc
# update nanorc ~/.nanorc
update ssh.conf ~/.ssh/config

# Operating System dependent
if [[ $(uname -s) = 'Darwin' ]]
then 
   # update gvimrc ~/.gvimrc
   # update ntp.conf /etc/myntp.conf
   # update vimrc ~/.vimrc
   update zshrc ~/.zshrc
   update zshrc.zwc ~/.zshrc.zwc
   update zshenv ~/.zshenv
   update zshenv.zwc ~/.zshenv.zwc
   update zlogin ~/.zlogin
   update zlogin.zwc ~/.zlogin.zwc
else 
   update cygwin.vimrc ~/.vimrc
   update cygwin.zshrc ~/.zshrc
   update cygwin.zshrc.zwc ~/.zshrc.zwc
fi

# [EOF]
