head	1.6;
access;
symbols
	charm6_1:1.6
	charm_6_0_1:1.6
	charm6_0_1:1.6
	charm6_0:1.5
	ChaNGa_1-0:1.4
	charm5_9:1.2
	charm_5-4-2:1.1
	charm_5-4-1:1.1;
locks; strict;
comment	@# @;


1.6
date	2008.07.07.01.59.24;	author gzheng;	state Exp;
branches;
next	1.5;
commitid	e3EWgt6xc9CIuO9t;

1.5
date	2007.06.08.20.32.44;	author gzheng;	state Exp;
branches;
next	1.4;
commitid	38114669bcdf4567;

1.4
date	2005.12.10.07.42.34;	author gzheng;	state Exp;
branches;
next	1.3;

1.3
date	2005.11.20.21.16.10;	author gzheng;	state Exp;
branches;
next	1.2;

1.2
date	2002.05.31.14.37.45;	author gzheng;	state Exp;
branches;
next	1.1;

1.1
date	2001.01.29.21.23.12;	author olawlor;	state Exp;
branches;
next	;


desc
@@


1.6
log
@remove existing file before make symbolic linking
@
text
@#!/bin/sh

if test "$OS" = 'Windows_NT'
then
  junction=`which createlink 2>/dev/null`
fi
test x$junction = x && junction='cp -f'

srcs=` echo $* | awk '{ for (i=1; i<NF; i++) printf "%s ", $i}'`
dest=` echo $* | awk '{ printf $NF}'`
test -z "$srcs" && exit 0
test -z "$dest" && exit 0

#if multiple sources, target must be a directory
num=`echo $srcs | awk '{ printf NF }'`
if test $num -gt 1
then
  if test ! -d $dest 
  then
    echo "The target is not a directory or does not exist!"
    exit 1;
  fi
fi

for src in $srcs
do
  while [ ! -r $src ] 
  do
#Strip one ../ from the source path
    src=`echo $src | awk -F/ '{printf "%s",$2;for (i=3;i<=NF;i++) printf "/%s",$i}'`
  done
  if test -n "$src" 
  then
    destFile=$dest
    test -d $dest && destFile=$dest/`basename $src`
#    echo $junction $src $destFile
    test -f $destFile && /bin/rm -f $destFile
    $junction $src $destFile
    status=$?
    test $status -ne 0 && echo "ERROR" &&exit $status
  fi
done

exit 0
@


1.5
log
@run dox2unix upon it.
@
text
@d37 1
@


1.4
log
@rmeoved debug print. Better error msg in createlink.
@
text
@d1 43
a43 43
#!/bin/sh

if test "$OS" = 'Windows_NT'
then
  junction=`which createlink 2>/dev/null`
fi
test x$junction = x && junction='cp -f'

srcs=` echo $* | awk '{ for (i=1; i<NF; i++) printf "%s ", $i}'`
dest=` echo $* | awk '{ printf $NF}'`
test -z "$srcs" && exit 0
test -z "$dest" && exit 0

#if multiple sources, target must be a directory
num=`echo $srcs | awk '{ printf NF }'`
if test $num -gt 1
then
  if test ! -d $dest 
  then
    echo "The target is not a directory or does not exist!"
    exit 1;
  fi
fi

for src in $srcs
do
  while [ ! -r $src ] 
  do
#Strip one ../ from the source path
    src=`echo $src | awk -F/ '{printf "%s",$2;for (i=3;i<=NF;i++) printf "/%s",$i}'`
  done
  if test -n "$src" 
  then
    destFile=$dest
    test -d $dest && destFile=$dest/`basename $src`
#    echo $junction $src $destFile
    $junction $src $destFile
    status=$?
    test $status -ne 0 && echo "ERROR" &&exit $status
  fi
done

exit 0
@


1.3
log
@a simple program to create windows hard link, which makes it easy to keep track of changes made under tmp/.
@
text
@d36 1
a36 1
    echo $junction $src $destFile
@


1.2
log
@rewrote to allow multiple sources for link. also add more error detection.
@
text
@d2 7
d27 2
a28 2
while [ ! -r $src ] 
do
d30 11
a40 1
	src=`echo $src | awk -F/ '{printf "%s",$2;for (i=3;i<=NF;i++) printf "/%s",$i}'`
a41 3
test -n "$src" && cp -f $src $dest
done

d43 1
@


1.1
log
@These translate UNIX calls to NT calls--
system_ln maps "ln" to "cp"
unix2nt_ar is a wrapper around Visual C++ "LIB.EXE"
unix2nt_cc is a wrapper around Visual C++ "CL.EXE" and "LINK.EXE"
@
text
@d2 18
a19 2
src=$1
dest=$2
d25 4
a28 1
cp -f $src $dest
@

