Skip to content
Browse files

Add relpath file which had been deleted by error in a previous change.

  • Loading branch information...
1 parent 65f260e commit 830d376ebf7873d59d24dea30a9f67007f986173 @feeley committed Jun 6, 2009
Showing with 32 additions and 2 deletions.
  1. +2 −2 include/stamp.h
  2. +30 −0 relpath
View
4 include/stamp.h
@@ -2,5 +2,5 @@
* Time stamp of last source code repository commit.
*/
-#define ___STAMP_YMD 20090606
-#define ___STAMP_HMS 124647
+#define ___STAMP_YMD 20090607
+#define ___STAMP_HMS 35240
View
30 relpath
@@ -0,0 +1,30 @@
+#! /bin/sh
+
+# Conversion of an absolute path to a relative path.
+
+# Copyright (c) 2008 by Marc Feeley, All Rights Reserved.
+
+TARGET_PATH=`echo "$1" | sed -e 's#\\\\#/#g' -e 's#//*#/#g' -e 's#/$##' -e 's#\([/]\{0,1\}\)\(.*\)#\2/#' -e 's#^/$##'`
+ORIG_DIR=`echo "$2" | sed -e 's#\\\\#/#g' -e 's#//*#/#g' -e 's#/$##' -e 's#\([/]\{0,1\}\)\(.*\)#\2/#' -e 's#^/$##'`
+ENABLE_MV="$3"
+
+while test "$TARGET_PATH" != "" -a "$ORIG_DIR" != ""; do
+ TP_CAR=`echo "$TARGET_PATH" | sed -e 's#\([^/]*[/]\)\(.*\)#\1#'`
+ TP_CDR=`echo "$TARGET_PATH" | sed -e 's#\([^/]*[/]\)\(.*\)#\2#'`
+ OD_CAR=`echo "$ORIG_DIR" | sed -e 's#\([^/]*[/]\)\(.*\)#\1#'`
+ OD_CDR=`echo "$ORIG_DIR" | sed -e 's#\([^/]*[/]\)\(.*\)#\2#'`
+ if test "$TP_CAR" = "$OD_CAR"; then
+ TARGET_PATH="$TP_CDR"
+ ORIG_DIR="$OD_CDR"
+ else
+ break
+ fi
+done
+
+REL_PATH=`echo "$ORIG_DIR" | sed -e 's#[^/]*[/]#../#g'`"$TARGET_PATH"
+
+if test "$ENABLE_MV" = "yes"; then
+ echo "$REL_PATH" | sed -e 's#^#/#' -e 's#^\(.*/\)\([^/][^/]*\)/\([^/][^/]*\)/$#\1current/\3/#' -e 's#^/##'
+else
+ echo "$REL_PATH"
+fi

0 comments on commit 830d376

Please sign in to comment.
Something went wrong with that request. Please try again.